Jump to content

End User

Members
  • Content Count

    309
  • Joined

  • Last visited

Everything posted by End User

  1. End User

    Fast Calc

    This sounds like a homework problem to me.
  2. When submitted, the checkboxes will come in as an array without you having to do anything. If your checkboxes are named "box", then this:$boxlist = $_POST[box'];...will produce an array of the checkboxes named "$boxlist".
  3. I could be mistaken, but if they're integers then there won't be any values between whole numbers. An integer column won't store a value like '35.00000', it'll truncate it and store '35'. You can store a negative number, i.e. '-50', but not '-50.003'.
  4. I think this looks much, much better. Much easier on the eyes, and the red now acts as a nice accent to offset parts of the page.
  5. White text on a red background is difficult for the eye to process easily, but it (paradoxically) is also one of the more attention-getting color combinations that appear to be hard-wired into the human brain. (Think stop signs and other warning signage. The other hard-wired "alert/danger" color combo is yellow on black.)It's why you never, and I mean *never* see a book printed in white-on-red. Or red-on-black. The eye likes high contrast but also little or no color when processing text. It also likes the lighter color, whatever it is, to be the background color. For example, it's much, much e
  6. Textarea tags need to be closed, and no "type" is needed. They also don't take a "value" param:<textarea name="order" rows = "5" cols = "50"/>$row['order']</textarea>
  7. He wasn't asking about SEO, just what language or technology he should learn next. I think it may be a while (a year or so) before we see significant movement in canvas app development. It's still fairly new and not all browsers are caught up to it yet. I think in time it'll give Flash a good run for its money since it's much more accessible to developers than Flash.
  8. If I was going to learn Flash, that would be my intent. Not to make a web site, but to create applications. I've seen some pretty impressive Flash apps, basically the equivalent of good desktop apps on the web, accessible through a browser.
  9. How about Flash/Actionscript?
  10. End User

    imagegrabscreen()

    Sadly this is only available on Windows platforms (according to the docs). I'd love to have this function available on Linux.
  11. Use a small intermediary script to fetch the image. Something like this (you'll need to modify it a bit). Untested, may have bugs, may cause blindness.// show_image.php// the image name $img = 'some_image.png';// create full absolute path to actual file object $fn = "/server/path/to/the/$img";// get extension$path_info = pathinfo($fn);$ext = $path_info['extension'];// show only approved filetypesif($ext == 'gif' || $ext == 'jpg' || $ext == 'jpeg' || $ext == 'png'){ // set header if($ext == "gif"){header('Content-type: image/gif');} if($ext == 'jpg'){header('Content-type: image/jpeg');} if($ex
  12. It's nice, but the colors are a bit daunting for me. Overall it seems well done.
  13. I'd suggest doing some of the classic beginner projects, like a guestbook or contact form, then move on to more complex projects like an image gallery or simple message board. For me the best way to learn was to grab a script and start modifying it. I found it helped a lot to start with something that already works and make changes.
  14. If you're making HTML edits it could be browser caching, but I'd bet that it's not actually saving the changes, perhaps due to a permissions issue. If you FTP the file down and look at it, are the changes actually present in the file? I'm not familiar with VS, so I may be way off base.
  15. Some coders use anonymous functions when they only require the function to be run from one particular location (instead of making a full, separate function out of it). There's some debate among programmers as to whether or not anonymous functions are a "proper" coding style, since they can make code a bit harder to puzzle out.
  16. This will return some valid IPs, but if they're using a proxy or other forwarding mechanism you may want to go with something like this:// try and get the real IP address...if (getenv('HTTP_CLIENT_IP')) { $ip_address = getenv('HTTP_CLIENT_IP');}elseif (getenv('HTTP_X_FORWARDED_FOR')) { $ip_address = getenv('HTTP_X_FORWARDED_FOR');}elseif (getenv('HTTP_X_FORWARDED')) { $ip_address = getenv('HTTP_X_FORWARDED');}elseif (getenv('HTTP_FORWARDED_FOR')) { $ip_address = getenv('HTTP_FORWARDED_FOR');}elseif (getenv('HTTP_FORWARDED')) { $ip_address = getenv('HTTP_FORWARDED');}else { $ip_address = $_SERV
  17. If you're trying to prevent people from gaining access to your content by disabling the right-click feature, be aware that it's not really possible to do this.
  18. End User

    injection

    You need to sanitize your inputs rigorously. There's a lot more to it than just stripping slashes.http://psoug.org/blogs/mike/2010/04/11/little-bobby-tables/Sanitizing HTML
  19. I tried your SQL but it kept returning an empty set. It may have been something I was doing wrong, but I don't know. If you're bored and want to play with it, here's my test table: CREATE TABLE IF NOT EXISTS `test_table` ( `event_id` int(11) NOT NULL auto_increment, `start_ts` datetime NOT NULL, `stop_ts` datetime NOT NULL, PRIMARY KEY (`event_id`)) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=9;-- Dumping data for table `test_table`INSERT INTO `test_table` VALUES(1, '2010-10-03 13:22:28', '2010-10-05 13:22:33');INSERT INTO `test_table` VALUES(2, '2010-10-12 13:45:19', '2011-01-3
  20. I haven't tried that yet, but I think I was "over thinking" this and making it harder than it was. In PHP I think it's very simple. I'm still going to try your SQL and see if it works because it would probably be a faster way to get the data, but here's what I came up with in PHP...I cut out a lot of code here that deals with converting to timestamps and whatnot, but this POC code *seems* to work. It's within a loop that pulls all of the client's rows from the DB: // is the START date AFTER the end of target month? if($event_start_stamp > $end_of_month){ print "<b>Discarding:</b
  21. Maybe I'm misunderstanding...Getting rows inside April are easy enough- I can look for any matches that have April (for example) as part of the start or the stop timestamp. But an event that runs from March to May won't match either of the timestamps. At the moment what I'm trying is something like this:1) Grab all the timestamps.2) Check if the end of the event is before the start of April *OR* if the start of the event is after the end of April. If either of these are true then it's not a matching event and the event is discarded.3) Check to see if the start of the event is before the start
  22. I think this is close to what I need...almost. In addition to the rows in April, I'm trying to also get rows where the start date/time might be before April (like March 25th) and possibly end after April (like May 15th. In other words, find every row where the timestamps might not only be in April, but also include April (i.e March 25 to May 15). So I'm not sure this will do exactly what I'm looking to accomplish. (??)
  23. I've been trying to get a good solution to a pair of problems and am looking for any ideas that might work. I have a list of timestamps that can span any number of days or months (including crossing a year boundary). The first problem: I want to get a list of all of the rows that "touch" or include a given month, like March. Like these, for example:2010-02-05 10:15:30 to 2010-02-15 08:25:30 (feb 2nd to feb 15th, doesn't touch march)2010-02-05 10:15:30 to 2010-03-02 08:25:30 (feb 5th to march 2nd, touches march)2010-03-05 14:20:30 to 2010-03-06 16:30:10 (march 5th to march 6th, touches march)20
  24. Two methods I've seen used: SELECT ROUND(RAND() * (SELECT MAX(id) FROM some_table)); and: LOCK TABLES foo READ; SELECT FLOOR(RAND() * COUNT(*)) AS rand_row FROM foo; SELECT * FROM foo LIMIT $rand_row, 1; UNLOCK TABLES; If you have gaps or missing IDs, you may need to check and loop to make sure you get an existing ID. If you have lots and lots of missing IDs or gaps, this could be a problem..in that case I think all you can do is select a range of IDs and then randomly pick one of them. That is, select all IDs between 12345 and 53645, use PHP to shuffle() them and then pick one off the to
  25. I doubt that explicitly closing the connection is going to make much of a difference. You can try it but I doubt that will "fix" this problem.Most default configurations of mySQL set the maximum number of (simultaneous) connections to 100. To increase this you'll need to edit the 'my.cnf' file. On some platforms the file may have a different name, but that's usually it. In 'my.cnf', look for this line (mySQL 4.x and 5.x): max_connections = 100 Change it to: max_connections = 200 Restart mySQL after editing this value. You could use a higher number (i.e. 250), but that's rarely needed un
×
×
  • Create New...