Oh, hey Mistin! I haven't talked to you in awhile!
And this seems really simple, thanks ^_^
Printable View
Oh, hey Mistin! I haven't talked to you in awhile!
And this seems really simple, thanks ^_^
Personally, I would prefer to store the last active time as either a timestamp or datetime column type, not an integer. Besides better describing the data to be stored in the first place, this way you can use the built-in date/time functions in MySQL (or PostgreSQL, etc.), instead of converting things back and forth from integers to dates, e.g.:
And if you make it a timestamp type, to update it all you have to do is set it to NOW().Code:. . . WHERE DATE_ADD(last_active, INTERVAL 5 MINUTE) > NOW() . . .
I used to have datetime columns but when I wanted to use one in an ORDER BY clause, MySQL would treat the data like strings and order them like strings. This order wouldn't necessarily be the chronological order. Well, after I switched to using integers, this problem disappeared.
Another problem is the server that houses my database is in another timezone and they won't let me set the MySQL default timezone to mine, so I get timestamps that are an hour ahead. Granted, I now collect a user's timezone and have all times displayed to them in that timezone. So, maybe it doesn't matter anymore *shrug*
ANYHOO I came to ask a quick question: What is the difference between a medium and large web application? Is it the amount/size of files that determines the size or is it the amount of users?
Sorting on a datetime or timestamp column should work fine. Where you might run into trouble is if you sort on a formatted string derived from a date, in which case you want to use the column itself in the order by expression.
As far as application size, it's the code size, based on whatever arbitrary means you choose to measure it by.Code:SELECT DATE_FORMAT(date_column, '%W %M %Y') AS formatted_date FROM some_table ORDER BY date_column;
As I recall, my datetimes were stored like this YYYY-MM-DD HH-MM-SS and I did use the column directly "Order BY datetimecolumn". It seemed to do fine with just dates but dates with times could get messed up. I never found out why. The only time I would format the date was when I was foreaching a result set for display in a view. The foreach was in the view so it was used after the query was completed.
So yea, don't know why it didn't work, but it works now, so I'm happy.
Ok, so I'm stumped royal. My pages aren't updating automatically anymore. Like, if somebody changes their display name, then you either have to wait a few minutes or refresh every page you visit, because you're going to see the display name you had when you last visited. (The sidebar shows your display name on every page.) I am using no caching that I know of and my host says they don't cache. The problem seems to be in the browser. If you empty the browser cache each page will update as soon as you visit it, HOWEVER, if you visit the same page again, it will not update until you refresh (just like before.) So the problem seems to be with the browser cache.
The same thing is happening to other people on my site too! :(
But, argh, there has to be some way to make the browser stop caching like this. I see plenty of PHP websites whose pages are up to date every time you click on them. Could something be wrong with my headers?
Also if we make the browser stop caching, is there a way to make it still cache the jquery file and the images? The jquery-1.8.3.min.js file is saved on my site
Are you using Session variables to store your content perhaps? Are you clearing old values from any Session state when they are changed?
I'm using CodeIgniter's sessions. I only have it storing display name and a couple other things, though.
Anyway, I added some code to .htaccess and the problem went away, but now some people can't login. They login and get logged out soon as they visit another page. It makes me think they aren't getting the cookie or the cookie is being immediately deleted. However I can't figure it out because this is only happening in IE and I can't even find my site's cookie in IE's cookies >.>
Know what's interesting? This problem isn't happening to everybody using IE. It doesn't even happen all the time. One person was experiencing this problem, then I had her disable the Yontoo toolbar and my site started working perfect. However she went back a few days later, and the site was acting up again, but her toolbar was still disabled. What gives?
PHP Code:<ifmodule mod_expires.c>
ExpiresActive On
ExpiresByType text/html "now"
</ifmodule>
<ifmodule mod_headers.c>
# Cache specified files for 1 day
<filesmatch "\.(jpg|jpeg|png|gif)$">
Header set Cache-Control "max-age=86400, public"
</filesmatch>
</ifmodule>
One possible gotcha is the difference between a cookie from "yourdomain.com" and "www.yourdomain.com", which depending on the user's security sessions, can cause grief. (I forget off the top of my head which one will ignore cookies from the other.) In general, the way to avoid it is by setting PHP's session.cookie_domain setting to ".yourdomain.com" (note the leading dot). If you're using CI's session functions, you may want to double-check if they either use that setting or have their own comparable setting in their configuration file.
Hey guys.
Ok, I'm having a simple problem with Imagick, but I can't find the answer on Google or the manual :confused:
I can't get imagick::writeImage() to work. It gives me an error and doesn't seem to save the image.
I get this error message:PHP Code:$image = new Imagick();
$image->readImage('/home/website/images/starter.png');
$image->setImageFormat('png');
$image->writeImage('home/website/public_html/images/tmp/5.png');
There is surprisingly little information about this on Google =(Quote:
Uncaught exception 'ImagickException' with message 'WriteBlob Failed `home/website/public_html/images/tmp/5.png' @ error/png.c/MagickPNGErrorHandler/1751' in /home/website/application/libraries/Image_maker.php:24
First thing to check is that the web server user (e.g. "apache", "nobody", or whoever is the user account for your web server) has write permission on the target directory.
Just checked the permissions, they're 755
Unless it's owned by the web server, it will need to be 775 (if the web server user and directory owner are in the same group) or else 777 (writable by all).
(Just in case you or any other reader does not know, 4 = read, 2 = write, and 1 = execute, and the order is owner, group, world.)
The error is now gone but it's still not working. Here's an interesting bit of information. I added "beginning" and "got here" outputs. The first displays on the page, the later does not:
What should I try next?PHP Code:print "beginning";
$image = new Imagick();
$image->readImage('/home/website/generator/starter.png');
$image->setImageFormat('png');
$image->writeImage('home/website/public_html/images/tmp/5.png');
print "got here";
die;
Update: I checked with my host and they don't think the problem is anything on their end.