Jump to content

tibberous

Members
  • Posts

    1,187
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by tibberous

  1. I have a PHP script that downloads an image from a 3rd party. It works when I run it from the command line, doesn't work when I run it as a cron daemon. I was thinking it might be having trouble because of relative file paths, so I tried running it from different directories and it still worked.

     

    The script is running, it's just the part that saves the image that doesn't - would it be a permissions error? Or is there something common I might want to check for?

  2. I am trying to send an email to approx 2,000 people every time a new event is added to a calendar. I'm guessing that I can't just call mail() 2,000 times, but I'm not real sure how to do this. I was thinking either a cron job that was called every minute, or a script that could be started from the webpage that would run in the background and process a queue.

     

    Ideas?

  3. I am using a 3rd party lookup service. Basically, they have you connect to their mysql database, select their db and do a query.

     

    I tried:

     

    $newconn = mysql_connect()
    mysql_select_db('db', $newconn);
    mysql_query("...", $newconn);
    mysql_close($newconn);
    
    

     

    But if I try to do mysql_queries without sending $newconn I still get errors. For right now, I'm just closing my first connection and reconnecting, but it seems like there should be a way to query a second database without messing up the connect to the first one.

  4. It is the one at:

     

    /usr/local/lib/php.ini

     

    Which is the path phpinfo() has for "Loaded Configuration File"

     

    I restarted the server after I changed the ini file, if I do phpinfo() it has:

     

    session.cookie_lifetime 2592000 2592000

     

    Under the session section.

     

    Here is all my session data:

    session
    Session Support 	enabled
    Registered save handlers 	files user sqlite
    Registered serializer handlers 	php php_binary wddx
    
    Directive	Local Value	Master Value
    session.auto_start	Off	Off
    session.bug_compat_42	On	On
    session.bug_compat_warn	On	On
    session.cache_expire	180	180
    session.cache_limiter	nocache	nocache
    session.cookie_domain	no value	no value
    session.cookie_httponly	Off	Off
    session.cookie_lifetime	2592000	2592000
    session.cookie_path	/	/
    session.cookie_secure	Off	Off
    session.entropy_file	no value	no value
    session.entropy_length	0	0
    session.gc_divisor	100	100
    session.gc_maxlifetime	1440	1440
    session.gc_probability	1	1
    session.hash_bits_per_character	4	4
    session.hash_function	0	0
    session.name	PHPSESSID	PHPSESSID
    session.referer_check	no value	no value
    session.save_handler	files	files
    session.save_path	/tmp	/tmp
    session.serialize_handler	php	php
    session.use_cookies	On	On
    session.use_only_cookies	Off	Off
    session.use_trans_sid	0	0
    

     

    I generally use tables and cookies for everything, thought this would be a good application for sessions =/

  5. I'm on a dedicated server. Here is how everything is set:

     

    session.save_path = /tmp
    
    ; Whether to use cookies.
    session.use_cookies = 1
    
    ; This option enables administrators to make their users invulnerable to
    ; attacks which involve passing session ids in URLs; defaults to 0.
    ; session.use_only_cookies = 1
    
    session.name = PHPSESSID
    session.auto_start = 0
    session.cookie_lifetime = 1440
    

     

     

  6. Personally, I hate Java - the runtime is bloated and makes my whole browser lag, plus I use java apps so infrequently that I always have to install or update the runtime.

     

    Everyone is going to have their own opinion of different technologies but it is pretty hard to be against using a propriety technology when there isn't a good, non-propriety alternative. I've heard java applets called a dead technology more than once. Flash isn't made to make whole websites, but it is the best platform for games, web cams, streaming video and animation.

     

    I'd say, in general, people like flash because they think games. My brother talks about "Flash Games" like they're their own genre or something.

     

    Be honest. The only reason you hate Java is because it's more difficult.

     

    ?

     

    I always thought Java was an easy language to program in. I'd say Flash is a touch harder, but they are also both very close to program in.

     

    Really the only reason I don't like Java is because of the runtime and it's performance. It isn't that bad for simple programs (I've used Frostwire) but it isn't good for web apps -- which is probably why most developers are writing in Flash. Java is to Flash what Perl is to PHP.

  7. Didn't say there were critical, just that they would make the language better. If floatval stripped everything to the first number, I'd be happy -- returning 0 when there are digits in the string really doesn't make sense.

     

    If the people who made PHP weren't worried about convenience when they wrote the language, we wouldn't have anything near what we have now. The ? operator, the foreach loop, $arr[] = $x, the for loop, ect. are all just shortcuts for things that could be done with only slightly more code.

     

  8. floatval / intval would ignore $ signs (ie: floatval("$5.25") would be 5.25, instead of 0 )

     

    There would be a shorter version of mysql_real_escape_string, or even better, a shorter version of mysql_real_escape_string(trim())

     

    Using [] on a non-array would initialize it as an array

     

     

  9. Personally, I hate Java - the runtime is bloated and makes my whole browser lag, plus I use java apps so infrequently that I always have to install or update the runtime.

     

    Everyone is going to have their own opinion of different technologies but it is pretty hard to be against using a propriety technology when there isn't a good, non-propriety alternative. I've heard java applets called a dead technology more than once. Flash isn't made to make whole websites, but it is the best platform for games, web cams, streaming video and animation.

     

    I'd say, in general, people like flash because they think games. My brother talks about "Flash Games" like they're their own genre or something.

  10. Not sure how to get that to work - stuff like that was generally done back before browsers were capable of doing much. One of the problems with doing weird stuff like that is that it can easily be broken by server settings (timeout issues), browser versions, php versions, ect.

     

    If you have the time, you'd probably do better to write it with ajax. If your sleep is really long, you could even do it with straight meta refreshes and a session/db/file.

     

     

  11. I am looping through an array called items:

    for($i=0;$item=$items[$i];$i++){
    
    // I want to see the price of the next item, if there is a next item
    if($item[$i+1] && $item[$i+1]['price'] ...
    

     

    Does php look at this, evaluate $item[$i+1] to false, then leave because the condition can never be true?

     

    Is $item[$i+1] guaranteed to get evaluated first because it is the left most condition? Is this a standard way to write code, or would 2 if's be better?

    if($item[$i+1]) if($item[$i+1]['price'])  // safe, but makes it look like I don't understand Short circuit evaluation.

  12. You learn something new everyday:

     

    http://www.arraystudio.com/as-workshop/mysql-get-total-number-of-rows-when-using-limit.html

     

    Basically, rather than having to do a query twice, you can do it once, then do a second query to get the amount of total results. Not only is it better performance wise, but you don't need to have conditions in 2 places (and it avoids the bug where the queries are out of sync, and you'll have like 8 pages but only 2 real pages of results)

  13. Yeah - the other thing to keep in mind is that eBay is going to have staff, which is going to be far more expensive than outsourcing. Everything eBay did in 2008 had to be done without causing downtime, while the system ran.

     

    Still, it is frustrating to see that projects that, in 2002 would have had 4 developers working for a year and a half, are now expected to be done in a month or two by one guy (for no money)

  14. Using $_GET and $_POST instead of $_REQUEST

    Using some kind of big framework they wrote themselves that makes the code unreadable to anyone but them.

     

    $databaseConnection = new dbc();
    $databaseManager = new databaseManager($databaseConnection, $response, true, 4);
    $databaseManager->executeQuery('users', 'insert', array('name'=>'Bob', 'age'=>'5'), 1);
    // wtf??
    

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.