www.webdeveloper.com
Page 12 of 14 FirstFirst ... 21011121314 LastLast
Results 166 to 180 of 198

Thread: My questions thread.

  1. #166
    Join Date
    Jun 2006
    Location
    Under your bed
    Posts
    357
    Oh, hey Mistin! I haven't talked to you in awhile!

    And this seems really simple, thanks ^_^
    The better I get at programming, the more I appreciate arrays. Handy dandy things they are.

  2. #167
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,178
    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.:
    Code:
    . . . WHERE DATE_ADD(last_active, INTERVAL 5 MINUTE) > NOW() . . .
    And if you make it a timestamp type, to update it all you have to do is set it to NOW().
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

  3. #168
    Join Date
    Jun 2006
    Location
    Under your bed
    Posts
    357
    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?
    Last edited by evenstar7139; 11-28-2012 at 08:27 AM.
    The better I get at programming, the more I appreciate arrays. Handy dandy things they are.

  4. #169
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,178
    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.
    Code:
    SELECT DATE_FORMAT(date_column, '%W %M %Y') AS formatted_date FROM some_table ORDER BY date_column;
    As far as application size, it's the code size, based on whatever arbitrary means you choose to measure it by.
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

  5. #170
    Join Date
    Jun 2006
    Location
    Under your bed
    Posts
    357
    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.
    The better I get at programming, the more I appreciate arrays. Handy dandy things they are.

  6. #171
    Join Date
    Jun 2006
    Location
    Under your bed
    Posts
    357
    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
    Last edited by evenstar7139; 12-06-2012 at 04:17 PM.
    The better I get at programming, the more I appreciate arrays. Handy dandy things they are.

  7. #172
    Join Date
    Jan 2009
    Posts
    3,346
    Are you using Session variables to store your content perhaps? Are you clearing old values from any Session state when they are changed?

  8. #173
    Join Date
    Jun 2006
    Location
    Under your bed
    Posts
    357
    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
    Last edited by evenstar7139; 12-19-2012 at 05:29 PM.
    The better I get at programming, the more I appreciate arrays. Handy dandy things they are.

  9. #174
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,178
    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.
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

  10. #175
    Join Date
    Jun 2006
    Location
    Under your bed
    Posts
    357
    Hey guys.

    Ok, I'm having a simple problem with Imagick, but I can't find the answer on Google or the manual

    I can't get imagick::writeImage() to work. It gives me an error and doesn't seem to save the image.

    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'); 
    I get this error message:
    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
    There is surprisingly little information about this on Google =(
    The better I get at programming, the more I appreciate arrays. Handy dandy things they are.

  11. #176
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,178
    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.
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

  12. #177
    Join Date
    Jun 2006
    Location
    Under your bed
    Posts
    357
    Just checked the permissions, they're 755
    The better I get at programming, the more I appreciate arrays. Handy dandy things they are.

  13. #178
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,178
    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.)
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

  14. #179
    Join Date
    Jun 2006
    Location
    Under your bed
    Posts
    357
    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:
    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; 
    What should I try next?
    The better I get at programming, the more I appreciate arrays. Handy dandy things they are.

  15. #180
    Join Date
    Jun 2006
    Location
    Under your bed
    Posts
    357
    Update: I checked with my host and they don't think the problem is anything on their end.
    The better I get at programming, the more I appreciate arrays. Handy dandy things they are.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles