php-general Digest 14 Sep 2010 10:12:09 -0000 Issue 6940
php-general Digest 14 Sep 2010 10:12:09 - Issue 6940 Topics (messages 308035 through 308059): Re: 1984 (Big Brother) 308035 by: chris h 308037 by: Daevid Vincent 308042 by: Micky Hulse 308045 by: Daniel Brown 308048 by: Micky Hulse 308049 by: Andy McKenzie 308055 by: viraj 308056 by: viraj 308057 by: Gary 308059 by: Richard Quadling Re: [!! SPAM] Re: [PHP] 1984 (Big Brother) 308036 by: Tim Thorburn 308044 by: Phpster Question about news.php.net 308038 by: MikeB 308041 by: Daniel Brown 308043 by: MikeB 308046 by: Daniel Brown 308047 by: Shawn McKenzie 308050 by: MikeB Could this be a bug? 308039 by: Camilo Sperberg 308040 by: Tamara Temple 308051 by: Camilo Sperberg 308052 by: Camilo Sperberg 308053 by: Thijs Lensselink 308054 by: Thijs Lensselink Re: php cli question 308058 by: Per Jessen Administrivia: To subscribe to the digest, e-mail: php-general-digest-subscr...@lists.php.net To unsubscribe from the digest, e-mail: php-general-digest-unsubscr...@lists.php.net To post to the list, e-mail: php-gene...@lists.php.net -- ---BeginMessage--- On Mon, Sep 13, 2010 at 5:09 PM, Daevid Vincent dae...@daevid.com wrote: -Original Message- From: tedd [mailto:t...@sperling.com] Sent: Sunday, September 12, 2010 9:32 AM To: PHP-General list Subject: [PHP] 1984 (Big Brother) Hi gang: I have a client who wants his employees' access to their online business database restricted to only times when he is logged on. (Don't ask why) In other words, when the boss is not logged on, then his employees cannot access the business database in any fashion whatsoever including checking to see if the boss is logged on, or not. No access whatsoever! Normally, I would just set up a field in the database and have that set to yes or no as to if the employees could access the database, or not. But in this case, the boss does not want even that type of access to the database permitted. Repeat -- No access whatsoever! I was thinking of the boss' script writing to a file that accomplished the yes or no thing, but if the boss did not log off properly then the file would remain in the yes state allowing employees undesired access. That would not be acceptable. So, what methods would you suggest? Cheers, tedd You sure know how to pick'em Tedd. This is the second whacky client you've posted about on the list... This guy sounds like a real control-freak (read: tool). One other thing I'll throw out is the use of a crontab to start/stop mysql during boss's hours. I don't have a complete solution for you as I just don't care enough about helping this Dbag lord over his employees like that, but I suspect you could have /etc/init.d/mysql start or stop at some pre-determined times like 8am - noon. Then noon till 5pm. Or something. RDBMS are not really designed to be turned on and off like that. Another option is to maybe use M$ Access instead (which does have a multi-user mode). Use ODBC to connect via PHP to it. So then he would start up the DB when he likes and shut it down when he likes. (note that a logout of Windows will NOT prevent the ODBC connection as it is a service -- as God intended RDBMS to be) http://www.configure-all.com/php_access.php This guy is making me angry just thinking about it! d Yes I've been following this post purely in the hope that someone gets Tedd is explain the client's logic on this one. It's one thing for a layman to have this kind of requirement, but another entirely for them to STILL have it after an explanation. I mean part of consulting is to tell the client when they're wrong, for someone to not heed that when they are paying for the advice is mind boggling. *sigh* if only everyone were perfect like me... :p Hey lets pay someone to consult us on a subject that we're ignorant of. Great idea! And when he makes a suggestion we can totally ignore him! SQL - Shmeequal Rant aside; I would defer the logistics to the client. He wants the DB to shutdown when he's not in the office? Ok no problem - not what it was designed to do, but no problem! How would you like the system to be aware of rather or not you're in the office? It can assume you are between these hours; You can log into a screen that unlocked it, but then you have to logout; we can put a motion detector in your office; ... etc. This would put the consequences of the system off on the client. Because if this system works then there will be consequences and you'll look like a jerk :-) Btw, are there no cron / batch jobs that need to run over night? Chris ---End Message--- ---BeginMessage--- have been you'll have fun getting paid to re-do
php-general Digest 15 Sep 2010 01:00:44 -0000 Issue 6941
php-general Digest 15 Sep 2010 01:00:44 - Issue 6941 Topics (messages 308060 through 308074): Re: Counting Children! 308060 by: Sridhar Pandurangiah Re: 1984 (Big Brother) 308061 by: Kevin Kinsey 308065 by: tedd Adjusting Session Times 308062 by: Floyd Resler 308063 by: chris h 308064 by: Andrew Ballard 308066 by: tedd 308067 by: Floyd Resler Re: Filestat.c erorrs when building php-5.3.3 on solaris 308068 by: STANFIELD, VICKI CTR DFAS Re: php cli question 308069 by: J Ravi Menon 308071 by: Per Jessen bcompiler: compile in a diferent directory 308070 by: Ramiro Gonzalez Image question for runways 308072 by: Alexis Re: Could this be a bug? 308073 by: Camilo Sperberg Re: Question about news.php.net 308074 by: Nathan Rixham Administrivia: To subscribe to the digest, e-mail: php-general-digest-subscr...@lists.php.net To unsubscribe from the digest, e-mail: php-general-digest-unsubscr...@lists.php.net To post to the list, e-mail: php-gene...@lists.php.net -- ---BeginMessage--- I managed to solve this myself. Here is the code. For some reason foreach works for the first set of non unique tags and doesn't work if the non unique tags are nested within the first set. Use the following code to access the tag values of the nested non unique tags. (see the XML file below if this seems confusing) $chi = count($member-line); for ($i = 0; $i $chi; $i++) { echo $member-line[$i]-particular1; echo $member-line[$i]-amount1; echo $member-line[$i]-particular2; echo $member-line[$i]-amount2; } Best regards Sridhar Sridhar Pandurangiah wrote: Hi I have an XML generated by another computer application. The format is as below. (Don't worry about the data in the XML. Its the test data). I am able to locate the correct member bill using XPATH. However I have hit a bottleneck. I am unable to echo all the line elements. This is what happens $row = simplexml_load_string($member-asXML()); echo $line-particular1; echo $line-amount1; echo $line-particular2; echo $line-amount2; Echoes the first line element of the member bill. If I add the same set of statements it echoes the second line element and so on. But then if I put the following code which I feel is correct $row = simplexml_load_string($member-asXML()); foreach ($row-line as $line); { echo $line-particular1; echo $line-amount1; echo $line-particular2; echo $line-amount2; } Echoes only the last line element of the member. Can someone tell me what's wrong -The XML file - bill clubnameThe Great Eastern Club/clubname addressAnna Road/address cityMadras/city titleBILL/title member membernumberA0099/membernumber billnumberBill no. : A0099/APRIL 10/billnumber membernameRaman C V/membername billdateRun date : 03/05/2010/billdate memberaddress1NO 33,MUGAPPAIR ROAD,/memberaddress1 memberaddress2PADI,/memberaddress2 membercityCHENNAI/membercity memberpostalcode600032/memberpostalcode memberphonenumber9840012345/memberphonenumber prefaceSTATEMENT OF ACCOUNTS AND BILL FOR THE MONTH OF APRIL-2010/preface columnh1Particulars/columnh1 columnh2Debit/columnh2 columnh3Receivables/columnh3 columnh4Credit/columnh4 line particular1Opening Balance/particular1 amount1275.14/amount1 particular2-/particular2 amount20.00/amount2 /line line particular1CHARGES/particular1 amount133.09/amount1 /line line particular1MINIMUM USAGE/particular1 amount1220.60/amount1 /line line particular1SUBSCRIPTION CHARGES/particular1 amount1220.60/amount1 /line line particular1WATER CHARGE/particular1 amount122.06/amount1 /line line particular1Total Debit/particular1 amount1771.49/amount1 particular2Total Credit/particular2 amount20.00/amount2 /line line particular1Amount to be Received/particular1 amount1771.49/amount1 /line noteHereafter no reminders will be sent for payment of monthly/Arrears bills./note /member member membernumberA0100/membernumber billnumberBill no. : A0100/APRIL 10/billnumber
Re: [PHP] Could this be a bug?
Well, after some more testing I'm almost sure it is some kind of strange minor bug... so I've submitted a bug report: http://bugs.php.net/bug.php?id=52833 Greetings ! On Tue, Sep 14, 2010 at 00:51, Camilo Sperberg unrea...@gmail.com wrote: On Mon, Sep 13, 2010 at 18:56, Tamara Temple tamouse.li...@gmail.comwrote: This isn't to answer your question, but... On Sep 13, 2010, at 5:16 PM, Camilo Sperberg wrote: function my_error_handler($errno = '0', $errstr = '[FATAL] General Error', $errfile = 'N/A', $errline = 'N/A', $errctx = '') { global $clean_exit; if(empty($clean_exit)) { ini_set('memory_limit','16M'); ob_start(); echo 'h1PHP v'.PHP_VERSION.', error Ndeg; '.$errno.'/h1'; ?h4-- BEGIN COPY --/h4p style=font-size:110%;margin:50px 0 20px 25pxemError Ndeg;:/embr /?php echo 'strong'.$errno.'/strongbr /'; ?emError Detail:/embr /?php echo 'strong'.$errstr.'/strongbr /emFile:/embr /strong'.$errfile.'/strongbr /emLine:/embr /strong'.$errline.'/strongbr /emDebug:/embr /'; if (isset($errctx['r']['print'])) echo 'pTHIS LINE GIVES THE ERROR, WHAT SHOULD IT RETURN?/p'; ?/ph4-- END COPY --/h4?php $content = ob_get_contents(); ob_end_clean(); die($content); } } Why do you put ?php echo...? inside an echo statement in php space? I think you may have mis-readed the code, I can't find where I put an ?php echo inside an echo. I do a lot of opening/closing tags which contributes to messing things up estetically but it works... Any way, the posted code had a lot of remniscants of the production code, here is a simplified version which does the same as above but .. well, simplified :P ?php date_default_timezone_set('America/Santiago'); ini_set('memory_limit','1M'); ini_set('display_errors',1); error_reporting(-1); function my_error_handler($errno = '0', $errstr = '[FATAL] General Error', $errfile = 'N/A', $errline = 'N/A', $errctx = '') { global $clean_exit; if(empty($clean_exit)) { // if isset or !empty, the script would have been exited cleanly. ini_set('memory_limit','16M'); // This would be just to have enough memory to print out the error. echo 'h5-- BEGIN ERROR --/h5Error Ndeg;: strong'.$errno.'/strongbr /Error Description: strong'.$errstr.'/strongbr /File: strong'.$errfile.'/strongbr /Line: strong'.$errline.'/strong'; if (isset($errctx['r']['print'])) echo 'pTHIS LINE GIVES THE ERROR, WHAT SHOULD IT RETURN?/p'; // isset or empty gives the same error echo 'h5-- END ERROR --/h5'; die(); // shutdown_function == manual die() or else it will continue to execute. } } set_error_handler('my_error_handler'); register_shutdown_function('my_error_handler'); for ($i = 0; $i 15000; $i++) $a[$i] = mt_rand(1,255); $r['print'] = (string)$a[1]; // Just to asign something to that variable. echo 'pEverything fine./p'; $clean_exit = TRUE; Greetings :) -- Mailed by: UnReAl4U - unreal4u ICQ #: 54472056 www1: http://www.chw.net/ www2: http://unreal4u.com/ -- Mailed by: UnReAl4U - unreal4u ICQ #: 54472056 www1: http://www.chw.net/ www2: http://unreal4u.com/
Re: [PHP] Could this be a bug?
On 09/14/2010 12:16 AM, Camilo Sperberg wrote: I have some really strange behaviour going on here, and I think it could be a (minor) PHP's bug. I am not really sure about what happens internally, but my best guess would be that after a memory exhaustion, when I try to execute a custom error handler with the register_shutdown_function (which is executed even after a fatal error) and try to access the element that provoked the memory exhaustion, no error should raise instead of *Uninitialized string offset: 0. I have prepared a little test case to reproduce the error and (I hope) can explain the error. ?php date_default_timezone_set('America/Santiago'); ini_set('memory_limit','1M'); ini_set('display_errors',1); error_reporting(-1); function my_error_handler($errno = '0', $errstr = '[FATAL] General Error', $errfile = 'N/A', $errline = 'N/A', $errctx = '') { global $clean_exit; if(empty($clean_exit)) { ini_set('memory_limit','16M'); ob_start(); echo 'h1PHP v'.PHP_VERSION.', error Ndeg; '.$errno.'/h1'; ?h4-- BEGIN COPY --/h4p style=font-size:110%;margin:50px 0 20px 25pxemError Ndeg;:/embr /?php echo 'strong'.$errno.'/strongbr /'; ?emError Detail:/embr /?php echo 'strong'.$errstr.'/strongbr /emFile:/embr /strong'.$errfile.'/strongbr /emLine:/embr /strong'.$errline.'/strongbr /emDebug:/embr /'; if (isset($errctx['r']['print'])) echo 'pTHIS LINE GIVES THE ERROR, WHAT SHOULD IT RETURN?/p'; Maybe i'm missing something here (kinda sick at home) but.. What do you expect to happen here? When i do a var_dump() on $errctx i get string(0) That would explain the error you are seeing. ?/ph4-- END COPY --/h4?php $content = ob_get_contents(); ob_end_clean(); die($content); } } set_error_handler('my_error_handler'); register_shutdown_function('my_error_handler'); for ($i = 0; $i 1; $i++) $a[$i] = mt_rand(1,254); $r['print'] = print_r($a,TRUE); echo 'pEverything fine./p'; $clean_exit = TRUE; * Would this be a bug or is this expected behaviour? I have tested this on PHP v5.2.14, I've not tested it yet on 5.3.3, but I guess it would have the same behaviour. Greetings! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Could this be a bug?
On 09/14/2010 08:33 AM, Thijs Lensselink wrote: On 09/14/2010 12:16 AM, Camilo Sperberg wrote: I have some really strange behaviour going on here, and I think it could be a (minor) PHP's bug. I am not really sure about what happens internally, but my best guess would be that after a memory exhaustion, when I try to execute a custom error handler with the register_shutdown_function (which is executed even after a fatal error) and try to access the element that provoked the memory exhaustion, no error should raise instead of *Uninitialized string offset: 0. I have prepared a little test case to reproduce the error and (I hope) can explain the error. ?php date_default_timezone_set('America/Santiago'); ini_set('memory_limit','1M'); ini_set('display_errors',1); error_reporting(-1); function my_error_handler($errno = '0', $errstr = '[FATAL] General Error', $errfile = 'N/A', $errline = 'N/A', $errctx = '') { This seems to be your error. You set $errctx to be a string. But later on you use it as an array. Remove the = '' part. And it will function as expected. global $clean_exit; if(empty($clean_exit)) { ini_set('memory_limit','16M'); ob_start(); echo 'h1PHP v'.PHP_VERSION.', error Ndeg; '.$errno.'/h1'; ?h4-- BEGIN COPY --/h4p style=font-size:110%;margin:50px 0 20px 25pxemError Ndeg;:/embr /?php echo 'strong'.$errno.'/strongbr /'; ?emError Detail:/embr /?php echo 'strong'.$errstr.'/strongbr /emFile:/embr /strong'.$errfile.'/strongbr /emLine:/embr /strong'.$errline.'/strongbr /emDebug:/embr /'; if (isset($errctx['r']['print'])) echo 'pTHIS LINE GIVES THE ERROR, WHAT SHOULD IT RETURN?/p'; Maybe i'm missing something here (kinda sick at home) but.. What do you expect to happen here? When i do a var_dump() on $errctx i get string(0) That would explain the error you are seeing. ?/ph4-- END COPY --/h4?php $content = ob_get_contents(); ob_end_clean(); die($content); } } set_error_handler('my_error_handler'); register_shutdown_function('my_error_handler'); for ($i = 0; $i 1; $i++) $a[$i] = mt_rand(1,254); $r['print'] = print_r($a,TRUE); echo 'pEverything fine./p'; $clean_exit = TRUE; * Would this be a bug or is this expected behaviour? I have tested this on PHP v5.2.14, I've not tested it yet on 5.3.3, but I guess it would have the same behaviour. Greetings! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] 1984 (Big Brother)
got another idea.. setup the database on a machine which can detect the availability of the boss. if the boss machine is on.. and connected to network.. the script will try to verify the availability of the bosses's ip and interface hardware address. (if the boss change the nic or machine, mac has to be updated manually in the script) and starts or stops the database. this can be done with bit of shellexec and bit of shellscripting, if on linux with 'arp' (all employees and boss has to be in same subnet i guess.. ) ~viraj On Tue, Sep 14, 2010 at 7:17 AM, Andy McKenzie amckenz...@gmail.com wrote: On Mon, Sep 13, 2010 at 8:11 PM, Micky Hulse mickyhulse.li...@gmail.com wrote: On Mon, Sep 13, 2010 at 5:05 PM, Daniel Brown danbr...@php.net wrote: It would be cheaper to employ the same method used on some lawnmowers and required on Jet Skis and Skidoos: a cable with a clip worn by the rider. The rider falls off, the cable releases from the vehicle, disengaging the throttle and cutting the engine. The boss stands up, his entire infrastructure collapses, everyone's connections are closed, and all PCs subsequently catch fire. Lol! That would make a great Dilbert and/or Farside cartoon. :) It would, wouldn't it? Anyway. Something you could do is a script that turns mysqld on and off: set him up with an SSH connection to the server, and he can run the script when he gets in to turn it on, and run it again whenever he leaves to turn it off. A cron job to turn mysqld off at whatever time he usually leaves would probably be a reasonable failsafe. If he really wants you could probably link it to a swipe card system or just a keyboard on his desk (enter your PIN to turn it on, enter it again to turn it off). All that aside, I can't help feeling that this has gotten into I'm afraid you know too much for us to let you leave: Guards! Take him away! territory. -Alex -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] 1984 (Big Brother)
On Tue, Sep 14, 2010 at 12:25 PM, viraj kali...@gmail.com wrote: got another idea.. setup the database on a machine which can detect the availability of the boss. if the boss machine is on.. and connected to network.. the script will try to verify the availability of the bosses's ip and interface hardware address. (if the boss change the nic or machine, mac has to be updated manually in the script) and starts or stops the database. this can be done with bit of shellexec and bit of shellscripting, if on linux with 'arp' (all employees and boss has to be in same subnet i guess.. ) and yeah, the script has to be run at some reasonable time interval using a cron ~viraj ~viraj On Tue, Sep 14, 2010 at 7:17 AM, Andy McKenzie amckenz...@gmail.com wrote: On Mon, Sep 13, 2010 at 8:11 PM, Micky Hulse mickyhulse.li...@gmail.com wrote: On Mon, Sep 13, 2010 at 5:05 PM, Daniel Brown danbr...@php.net wrote: It would be cheaper to employ the same method used on some lawnmowers and required on Jet Skis and Skidoos: a cable with a clip worn by the rider. The rider falls off, the cable releases from the vehicle, disengaging the throttle and cutting the engine. The boss stands up, his entire infrastructure collapses, everyone's connections are closed, and all PCs subsequently catch fire. Lol! That would make a great Dilbert and/or Farside cartoon. :) It would, wouldn't it? Anyway. Something you could do is a script that turns mysqld on and off: set him up with an SSH connection to the server, and he can run the script when he gets in to turn it on, and run it again whenever he leaves to turn it off. A cron job to turn mysqld off at whatever time he usually leaves would probably be a reasonable failsafe. If he really wants you could probably link it to a swipe card system or just a keyboard on his desk (enter your PIN to turn it on, enter it again to turn it off). All that aside, I can't help feeling that this has gotten into I'm afraid you know too much for us to let you leave: Guards! Take him away! territory. -Alex -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php cli question
J Ravi Menon wrote: Few questions: 1) Does opcode cache really matter in such cli-based daemons? As 'SomeClass' is instantiated at every loop, I am assuming it is only compiled once as it has already been 'seen'. Yup. 2) What about garbage collection? In a standard apache-mod-php setup, we rely on the end of a request-cycle to free up resources - close file descriptiors, free up memory etc.. I am assuming in the aforesaid standalone daemon case, we would have to do this manually? Yes. Note: I have written pre-forker deamons in php directly and successfully deployed them in the past, but never looked at in depth to understand all the nuances. Anecdotally, I have done 'unset()' at some critical places were large arrays were used, and I think it helped. AFAIK, unlike Java, there is no 'garbage collector' thread that does all the magic? Correct. -- Per Jessen, Zürich (12.9°C) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: 1984 (Big Brother)
On 14 September 2010 08:05, Gary php-gene...@garydjones.name wrote: tedd wrote: I have a client who wants his employees' access to their online business database restricted to only times when he is logged on. (Don't ask why) Simply put a dead man's handle under his seat which turns on the power to the server when he sits on it. -- Gary Please do NOT send me 'courtesy' replies off-list. PHP 5.2.12 (cli) (built: Jan 14 2010 14:54:11) 1.7.7(0.230/5/3) 2010-08-31 09:58 Cygwin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Hmm. I think there is a really easy, cost free, way to deal with this. You get all the employees in a room, with the boss. And then you tell them that when the boss isn't in, they don't have to do any work. I'm pretty sure the employees will be your new BFFs. -- Richard Quadling Twitter : EE : Zend @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Counting Children!
I managed to solve this myself. Here is the code. For some reason foreach works for the first set of non unique tags and doesn't work if the non unique tags are nested within the first set. Use the following code to access the tag values of the nested non unique tags. (see the XML file below if this seems confusing) $chi = count($member-line); for ($i = 0; $i $chi; $i++) { echo $member-line[$i]-particular1; echo $member-line[$i]-amount1; echo $member-line[$i]-particular2; echo $member-line[$i]-amount2; } Best regards Sridhar Sridhar Pandurangiah wrote: Hi I have an XML generated by another computer application. The format is as below. (Don't worry about the data in the XML. Its the test data). I am able to locate the correct member bill using XPATH. However I have hit a bottleneck. I am unable to echo all the line elements. This is what happens $row = simplexml_load_string($member-asXML()); echo $line-particular1; echo $line-amount1; echo $line-particular2; echo $line-amount2; Echoes the first line element of the member bill. If I add the same set of statements it echoes the second line element and so on. But then if I put the following code which I feel is correct $row = simplexml_load_string($member-asXML()); foreach ($row-line as $line); { echo $line-particular1; echo $line-amount1; echo $line-particular2; echo $line-amount2; } Echoes only the last line element of the member. Can someone tell me what's wrong -The XML file - bill clubnameThe Great Eastern Club/clubname addressAnna Road/address cityMadras/city titleBILL/title member membernumberA0099/membernumber billnumberBill no. : A0099/APRIL 10/billnumber membernameRaman C V/membername billdateRun date : 03/05/2010/billdate memberaddress1NO 33,MUGAPPAIR ROAD,/memberaddress1 memberaddress2PADI,/memberaddress2 membercityCHENNAI/membercity memberpostalcode600032/memberpostalcode memberphonenumber9840012345/memberphonenumber prefaceSTATEMENT OF ACCOUNTS AND BILL FOR THE MONTH OF APRIL-2010/preface columnh1Particulars/columnh1 columnh2Debit/columnh2 columnh3Receivables/columnh3 columnh4Credit/columnh4 line particular1Opening Balance/particular1 amount1275.14/amount1 particular2-/particular2 amount20.00/amount2 /line line particular1CHARGES/particular1 amount133.09/amount1 /line line particular1MINIMUM USAGE/particular1 amount1220.60/amount1 /line line particular1SUBSCRIPTION CHARGES/particular1 amount1220.60/amount1 /line line particular1WATER CHARGE/particular1 amount122.06/amount1 /line line particular1Total Debit/particular1 amount1771.49/amount1 particular2Total Credit/particular2 amount20.00/amount2 /line line particular1Amount to be Received/particular1 amount1771.49/amount1 /line noteHereafter no reminders will be sent for payment of monthly/Arrears bills./note /member member membernumberA0100/membernumber billnumberBill no. : A0100/APRIL 10/billnumber membernameSandeep/membername billdateRun date : 03/05/2010/billdate memberaddress1NO 12,/memberaddress1 memberaddress2TNAGAR,/memberaddress2 membercityCHENNAI/membercity memberpostalcode600017/memberpostalcode memberphonenumber9840012365/memberphonenumber prefaceSTATEMENT OF ACCOUNTS AND BILL FOR THE MONTH OF APRIL-2010/preface columnh1Particulars/columnh1 columnh2Debit/columnh2 columnh3Receivables/columnh3 columnh4Credit/columnh4 line particular1Opening Balance/particular1 amount1496.38/amount1 particular2-/particular2 amount20.00/amount2 /line line particular1ENTERTAINMENT CHARGES/particular1 amount133.09/amount1 particular217/06/2010 CASH PCR/000544/10-11/particular2 amount2124.00/amount2 /line line particular1MINIMUM USAGE/particular1 amount1124.00/amount1 /line line particular1SUBSCRIPTION CHARGES/particular1 amount1220.60/amount1 /line line particular1WATER CHARGE/particular1
Re: [PHP] Re: 1984 (Big Brother)
Gary wrote: tedd wrote: I have a client who wants his employees' access to their online business database restricted to only times when he is logged on. (Don't ask why) Simply put a dead man's handle under his seat which turns on the power to the server when he sits on it. I figured we'd get here sooner or later, esp. after I saw Daniel B. talking about lawnmowers. And now you can tell the client with a straight face ... if you want any work to get done today you'd best sit your @$$ down right here Then, of course, for fun, you could encourage PHB to bounce up down a few times a day to keep the employees on their toes. He'd dig it, I'm sure, and you'd pick up a good parcel of extra work recovering DB's ... and disks. Richard Quadling: You get all the employees in a room, with the boss. And then you tell them that when the boss isn't in, they don't have to do any work. I'm pretty sure the employees will be your new BFFs. +11. We should ABSOLUTELY copy Scot Adams on this. Wait a minute, maybe Tedd's client IS Scot Adams. Kevin Kinsey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Adjusting Session Times
We just got a client whose requirement is that user sessions expire after 30 minutes of inactivity. Our other clients are happy with not having their sessions expire during the work day (i.e. life is 8 hours). I am using a MySQL database to store the session data. My thought is to adjust the session expiration in the table based on the client currently logged in. Is this a good approach or would there be better ways to do it? And just to clarify: all clients use the same Web site. Thanks! Floyd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Adjusting Session Times
My thought is to adjust the session expiration in the table based on the client currently logged in. I don't know if there's a better way, but I would probably just do that. The expiration would be set to whatever the client's preference is, and default to 8 hours if he doesn't have one. You may want to set some checks to ensure that the client's preference is within a specific range (e.g. between 30 minutes and 16 hours). Chris.
Re: [PHP] Adjusting Session Times
On Tue, Sep 14, 2010 at 10:26 AM, Floyd Resler fres...@adex-intl.com wrote: We just got a client whose requirement is that user sessions expire after 30 minutes of inactivity. Our other clients are happy with not having their sessions expire during the work day (i.e. life is 8 hours). I am using a MySQL database to store the session data. My thought is to adjust the session expiration in the table based on the client currently logged in. Is this a good approach or would there be better ways to do it? And just to clarify: all clients use the same Web site. Thanks! Floyd I store the date and time of the last page access and the session lifetime in minutes in the database. Then when I fetch the session from the database, the WHERE clause includes a condition that the number of minutes elapsed between the current date/time and the time stored in the session table is less than the session lifetime (maximum duration of inactivity for that session). That way, each individual user could have his or her own session timeout period if needed. Andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] 1984 (Big Brother)
At 8:05 PM -0400 9/13/10, Daniel Brown wrote: The boss stands up, his entire infrastructure collapses, everyone's connections are closed, and all PCs subsequently catch fire. LOL Sounds good to me. After that happens a couple of times, maybe things will change. If it's the private sector, they investigate and find a better solution. If it's the public sector, they will probably require water based fire extinguishers. Cheers, tedd -- --- http://sperling.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Adjusting Session Times
At 10:26 AM -0400 9/14/10, Floyd Resler wrote: We just got a client whose requirement is that user sessions expire after 30 minutes of inactivity. Our other clients are happy with not having their sessions expire during the work day (i.e. life is 8 hours). I am using a MySQL database to store the session data. My thought is to adjust the session expiration in the table based on the client currently logged in. Is this a good approach or would there be better ways to do it? And just to clarify: all clients use the same Web site. Thanks! Floyd Floyd: I don't know how others solve this, but my solution is pretty straightforward (see code below). I require this code for every script that is in the secured area. Simply put, if the user runs a script, then this script is also run. As a result, if the user is not logged in they are directed to the login script. If the user is logged in, but has exceeded the expiration time due to inactivity, then the user is redirected to the same login script with a GET value to trigger the login script to report that they timed out due to inactivity. I find it bad practice to tell a user that they are not logged in when they did log in. It's better to explain why they have to log on again. Now, with respect to your storing the expiration time in the database, that could be done easily enough by this script accessing the database, getting, and setting the time-limit -- OR -- at the start of any logon have the script pull the time-limit from the database and store that value in a SESSION. Either way would work. In any event, this is what I do. Cheers, tedd == code ?php $redirect = 'http://yourdomain.com/admin/logon.php'; // standard security $secure = isset($_SESSION['security']) ? $_SESSION['security'] : 0; if ($secure == 0) // if admin is not logged in -- then redirect to the admin logon { header(location:$redirect); exit(); } // timed security $_SESSION['start'] = isset($_SESSION['start']) ? $_SESSION['start'] : 0; $timelimit = 15 * 60; // 15 minutes $now = time(); if($now $_SESSION['start'] + $timelimit) { logOff(); $t = '?t=1'; header(location:$redirect$t); exit(); } $_SESSION['start'] = time(); // properly logged on pass here ? ?php // log off function = // to destroy the current session function logOff() { $_SESSION = array(); if(isset($_COOKIE[session_name()])) { setcookie(session_name(), '', time()-86400, '/'); } session_destroy(); } -- --- http://sperling.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Adjusting Session Times
Tedd, I really like your solution. The idea of storing the expiration in the SESSION makes it easier for me and makes it more flexible. Someone else had provided a solution that would actually allow me to take it down to a user level if I needed to. I loved the idea for flexibility but would have required a major rewrite. Your idea gives me the flexibility and doesn't require any major rewriting - just a little tweaking. Thanks! Floyd On Sep 14, 2010, at 12:58 PM, tedd wrote: At 10:26 AM -0400 9/14/10, Floyd Resler wrote: We just got a client whose requirement is that user sessions expire after 30 minutes of inactivity. Our other clients are happy with not having their sessions expire during the work day (i.e. life is 8 hours). I am using a MySQL database to store the session data. My thought is to adjust the session expiration in the table based on the client currently logged in. Is this a good approach or would there be better ways to do it? And just to clarify: all clients use the same Web site. Thanks! Floyd Floyd: I don't know how others solve this, but my solution is pretty straightforward (see code below). I require this code for every script that is in the secured area. Simply put, if the user runs a script, then this script is also run. As a result, if the user is not logged in they are directed to the login script. If the user is logged in, but has exceeded the expiration time due to inactivity, then the user is redirected to the same login script with a GET value to trigger the login script to report that they timed out due to inactivity. I find it bad practice to tell a user that they are not logged in when they did log in. It's better to explain why they have to log on again. Now, with respect to your storing the expiration time in the database, that could be done easily enough by this script accessing the database, getting, and setting the time-limit -- OR -- at the start of any logon have the script pull the time-limit from the database and store that value in a SESSION. Either way would work. In any event, this is what I do. Cheers, tedd == code ?php $redirect = 'http://yourdomain.com/admin/logon.php'; // standard security $secure = isset($_SESSION['security']) ? $_SESSION['security'] : 0; if ($secure == 0) // if admin is not logged in -- then redirect to the admin logon { header(location:$redirect); exit(); } // timed security $_SESSION['start'] = isset($_SESSION['start']) ? $_SESSION['start'] : 0; $timelimit = 15 * 60; // 15 minutes $now = time(); if($now $_SESSION['start'] + $timelimit) { logOff(); $t = '?t=1'; header(location:$redirect$t); exit(); } $_SESSION['start'] = time(); // properly logged on pass here ? ?php // log off function = // to destroy the current session function logOff() { $_SESSION = array(); if(isset($_COOKIE[session_name()])) { setcookie(session_name(), '', time()-86400, '/'); } session_destroy(); } -- --- http://sperling.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Filestat.c erorrs when building php-5.3.3 on solaris
For the record, the problem appears to have been that the gcc version was too old. It compiles with gcc 3.4.6 -Vicki Stanfield, RHCE, CISSP Web Management Group tso-cs-web-t...@dfas.mil Defense Finance and Accounting Service Technical Services Organization - Corporate Services vicki.stanfield@dfas.mil (317)510-3375 -Original Message- From: Tom Rogers [mailto:trog...@kwikin.com] Sent: Thursday, September 09, 2010 10:05 PM To: STANFIELD, VICKI CTR DFAS Cc: php-general@lists.php.net Subject: Re: [PHP] Filestat.c erorrs when building php-5.3.3 on solaris Hi, Friday, September 10, 2010, 2:49:36 AM, you wrote: SVCD Ok, I tried removing the --disable-posix and adding --with-tsrm-pthreads SVCD to the configure options. SVCD The resulting configure looks like this: SVCD CC='/usr/local/bin/gcc' \ SVCD './configure' \ SVCD '--prefix=/app/php533' \ SVCD '--enable-shared' \ SVCD '--with-tsrm-pthreads' \ SVCD '--with-gnu-ld' \ SVCD '--with-apxs2=/app/apache2216/bin/apxs' \ SVCD '--with-zlib' \ SVCD '--with-zlib-dir=/usr/lib' \ SVCD '--with-png-dir=/usr/include/libpng' \ SVCD '--with-openssl=/shared_ro/openssl_098' \ SVCD '--with-oci8=/shared_ro/users.oracle/11.1.0' SVCD Now I get this: SVCD /users/0/php-5.3.3/ext/posix/posix.c: In function SVCD `zif_posix_getgrnam': SVCD /users/0/php-5.3.3/ext/posix/posix.c:1017: error: too many arguments SVCD to function `getgrnam_r' SVCD /users/0/php-5.3.3/ext/posix/posix.c: In function SVCD `zif_posix_getgrgid': SVCD /users/0/php-5.3.3/ext/posix/posix.c:1067: error: too many arguments SVCD to function `getgrgid_r' SVCD /users/0/php-5.3.3/ext/posix/posix.c:1067: warning: assignment makes SVCD integer from pointer without a cast SVCD /users/0/php-5.3.3/ext/posix/posix.c: In function SVCD `zif_posix_getpwnam': SVCD /users/0/php-5.3.3/ext/posix/posix.c:1136: error: too many arguments SVCD to function `getpwnam_r' SVCD /users/0/php-5.3.3/ext/posix/posix.c: In function SVCD `zif_posix_getpwuid': SVCD /users/0/php-5.3.3/ext/posix/posix.c:1184: error: too many arguments SVCD to function `getpwuid_r' SVCD /users/0/php-5.3.3/ext/posix/posix.c:1184: warning: assignment makes SVCD integer from pointer without a cast SVCD gmake: *** [ext/posix/posix.lo] Error 1 SVCD Do I need to add the -D_POSIX_PTHREAD_SEMANTICS in the makefile or SVCD configure.in somewhere? Can you point me in the right direction? SVCD -Vicki Stanfield, RHCE, CISSP SVCD -Original Message- SVCD From: Tom Rogers [mailto:trog...@kwikin.com] SVCD Sent: Wednesday, September 08, 2010 10:06 PM SVCD To: Tom Rogers SVCD Cc: php-general@lists.php.net SVCD Subject: Re: [PHP] Filestat.c erorrs when building php-5.3.3 on solaris SVCD Hi, SVCD Thursday, September 9, 2010, 11:31:06 AM, you wrote: TR Hi, TR Thursday, September 9, 2010, 2:07:50 AM, you wrote: SVCD I am trying to build php-5.3.3 and getting the following error: SVCD /users/0/php-5.3.3/TSRM -I/users/0/php-5.3.3/Zend SVCD -I/usr/local/include -g -O2 -DZTS -c SVCD /users/0/php-5.3.3/ext/standard/filestat.c -o SVCD ext/standard/filestat.lo SVCD /users/0/php-5.3.3/ext/standard/filestat.c: In function SVCD `php_do_chgrp': SVCD /users/0/php-5.3.3/ext/standard/filestat.c:416: error: too SVCD many SVCD arguments to function `getgrnam_r' SVCD /users/0/php-5.3.3/ext/standard/filestat.c: In function SVCD `php_do_chown': SVCD /users/0/php-5.3.3/ext/standard/filestat.c:517: error: too SVCD many SVCD arguments to function `getpwnam_r' SVCD make: *** [ext/standard/filestat.lo] Error 1 SVCD I have set my ORACLE_HOME, my PATH, and my LD_LIBRARY_PATH SVCD And used the following configure command: SVCD ./configure --prefix=/app/php533 SVCD --with-apxs2=/app/apache2215/bin/apxs SVCD --with-zlib --with-zlib-dir=/usr/lib SVCD --with-png-dir=/usr/include/libpng SVCD --with-openssl=/shared_ro/openssl_098 SVCD --with-oci8=/shared_ro/users.oracle/11.1.0 SVCD I am using gmake 3.80. Can anyone give me a hint as to what I am SVCD doing SVCD wrong in this build? SVCD -Vicki Stanfield, RHCE, CISSP TR From the error message it would seem the operating SVCD system's TR getpwnam_r() function is not POSIX compatible. TR What system are you compiling on? TR -- TR regards, TR Tom SVCD It would seem you need to add -D_POSIX_PTHREAD_SEMANTICS to the cc SVCD flags to get the right function. SVCD -- SVCD regards, SVCD Tom That should get added automatically when you run configure if it recognizes that the system is solaris. Try adding --host=solaris to configure and see if that helps -- regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php cli question
On Tue, Sep 14, 2010 at 12:43 AM, Per Jessen p...@computer.org wrote: J Ravi Menon wrote: Few questions: 1) Does opcode cache really matter in such cli-based daemons? As 'SomeClass' is instantiated at every loop, I am assuming it is only compiled once as it has already been 'seen'. Yup. Just to clarify, you mean we don't need the op-code cache here right? 2) What about garbage collection? In a standard apache-mod-php setup, we rely on the end of a request-cycle to free up resources - close file descriptiors, free up memory etc.. I am assuming in the aforesaid standalone daemon case, we would have to do this manually? Yes. So 'unset($some_big_array)' or 'unset($some_big_object)' etc.. is the right way to go for non-resource based items? i.e. it needs to be explicitly done? thx, Ravi Note: I have written pre-forker deamons in php directly and successfully deployed them in the past, but never looked at in depth to understand all the nuances. Anecdotally, I have done 'unset()' at some critical places were large arrays were used, and I think it helped. AFAIK, unlike Java, there is no 'garbage collector' thread that does all the magic? Correct. -- Per Jessen, Zürich (12.9°C) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] bcompiler: compile in a diferent directory
I use bcompiler in my php code(bcompiler_write_header+bcompiler_write_file+bcompiler_write_footer). If the original phps are not located in the deployment directory I get an error: require_once use the path to the not compiled phps. I'd like to know if there is any way to compile the phps and use the compiled versión from a different directory. Thanks Ramiro
Re: [PHP] php cli question
J Ravi Menon wrote: On Tue, Sep 14, 2010 at 12:43 AM, Per Jessen p...@computer.org wrote: J Ravi Menon wrote: Few questions: 1) Does opcode cache really matter in such cli-based daemons? As 'SomeClass' is instantiated at every loop, I am assuming it is only compiled once as it has already been 'seen'. Yup. Just to clarify, you mean we don't need the op-code cache here right? That is correct. 2) What about garbage collection? In a standard apache-mod-php setup, we rely on the end of a request-cycle to free up resources - close file descriptiors, free up memory etc.. I am assuming in the aforesaid standalone daemon case, we would have to do this manually? Yes. So 'unset($some_big_array)' or 'unset($some_big_object)' etc.. is the right way to go for non-resource based items? i.e. it needs to be explicitly done? It's not quite like C - if you reassign something, the previous contents are automagically freed. I use unset() if I know it could be a while (hours) before it'll likely be reassigned, but it won't be used in the meantime. -- Per Jessen, Zürich (14.6°C) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Image question for runways
Hi, I am trying to create an on the fly image of runway layouts but am hitting a brick wall. I have both the starting and ending coordinates of each runway, it's length, as well as it's angle of direction (heading). I can draw one runway without any problem, but where I am falling short is how to 'scale', if that is the right word, the other runway(s) to display properly in a 500x500px image function imagepolarline($image,$x1,$y1,$length,$angle,$color) { $length=($length/500)*20; $x2 = $x1 + cos( deg2rad($angle-90)) * $length; $y2 = $y1 + sin( deg2rad($angle-90)) * $length; imageline($image, $x1,$y1,$x2,$y2, $color); } //'base' coords $x1=200;$y1=200; $scale=1; //if first runway if ($d==0) {$xbase=abs($lon1);$ybase=abs($lat1);} //for all others else { $x1=$x1+(($xbase-(abs($lon1)))*$scale); $y1=$y1+(($ybase-(abs($lat1)))*$scale); } Here is some test data if that would help: length,lat_start,lon_start,heading,lat_stop,lon_stop 6869,38.8424,-77.0368,355.5000,38.8612,-77.0387 4911,38.8423,-77.0408,26.,38.8544,-77.0333 5204,38.8617,-77.0438,142.7000,38.8503,-77.0327 Any suggestions would be most appreciated. Alexis -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Could this be a bug?
On Tue, Sep 14, 2010 at 02:46, Thijs Lensselink d...@lenss.nl wrote: On 09/14/2010 08:33 AM, Thijs Lensselink wrote: On 09/14/2010 12:16 AM, Camilo Sperberg wrote: I have some really strange behaviour going on here, and I think it could be a (minor) PHP's bug. I am not really sure about what happens internally, but my best guess would be that after a memory exhaustion, when I try to execute a custom error handler with the register_shutdown_function (which is executed even after a fatal error) and try to access the element that provoked the memory exhaustion, no error should raise instead of *Uninitialized string offset: 0. I have prepared a little test case to reproduce the error and (I hope) can explain the error. ?php date_default_timezone_set('America/Santiago'); ini_set('memory_limit','1M'); ini_set('display_errors',1); error_reporting(-1); function my_error_handler($errno = '0', $errstr = '[FATAL] General Error', $errfile = 'N/A', $errline = 'N/A', $errctx = '') { This seems to be your error. You set $errctx to be a string. But later on you use it as an array. Remove the = '' part. And it will function as expected. You're right... However I don't like leaving non-default value in functions so I did something like if(empty($errctx)) $errctx = array() in the first line of the custom error handler which threw out the error message and everything works ok now. But -and correct me if I'm wrong- isn't isset (or empty) supposed to return a FALSE whenever that variable doesn't exist? With your help, I could reduce the test case into: $asdf = 'hello world'; if (empty($asdf[4]['inventing'])) echo 'nice little world'; if (isset($asdf['inventing'][6])) echo 'little nice world'; // This works ok. $asdf = ''; if (empty($asdf[4]['inventing'])) echo 'nice little world'; if (isset($asdf['inventing'][6])) echo 'little nice world'; // This returns E_NOTICE Shouldn't these 2 examples work exactly the same way? (AKA as Nº 1). If not... why not? Both are string types, onyl difference is that one has no characters in it while the other does, but essentialy they are both the same. Greetings ! -- Mailed by: UnReAl4U - unreal4u ICQ #: 54472056 www1: http://www.chw.net/ www2: http://unreal4u.com/
Re: [PHP] Question about news.php.net
Daniel Brown wrote: On Mon, Sep 13, 2010 at 18:09, MikeB mpbr...@gmail.com wrote: However, getting access seems to be hit-and-miss, since I more often than not get a message that the connection to news.php.net timed out. Is this an indication that the server is just very busy? I don't get this on any other news server I'm using on the smae news reader and I have gotten this on two different news readers that I have tried. I don't believe that we've been having any issues with the server, no. Are you using NNTP to connect? You may want to consider using the HTTP-based RSS and/or RDF feeds if it continues to be an issue. In addition, if you continue to have problems, file a bug report at http://bugs.php.net/ and we'll look into it further. Dan, Mike, I can confirm this happens all the time in thunderbird, and always has for many years now, on all PHP NNTP lists. However, the problem can be worked around simply, for some reason the timeout generally only happens with the first call to view a mailing list, after X minutes of inactivity. Thus, I simply subscribe to a few different PHP lists (like .soap .test and general) then when I open thunderbird I quickly click a list I *don't* want to see, then click on .general, .general then loads nicely as expected letting the other one timeout :) It's hardly a fix, but it works - may be worth checking if this is the case with the latest thunderbird revision and then reporting it as a bug (in either thunderbird or the mailing list software that PHP is running). Best, Nathan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Adjusting Session Times
Floyd Resler wrote: We just got a client whose requirement is that user sessions expire after 30 minutes of inactivity. Our other clients are happy with not having their sessions expire during the work day (i.e. life is 8 hours). I am using a MySQL database to store the session data. My thought is to adjust the session expiration in the table based on the client currently logged in. Is this a good approach or would there be better ways to do it? And just to clarify: all clients use the same Web site. It may be worth storing sessions in something like redis [1] instead, which let's you expire data [2] after a given time, then you can configure however you want easily. The other benefit is that sessions will be extremely fast given that they'll all be stored in ram :) [1] http://code.google.com/p/redis/ [2] http://code.google.com/p/redis/wiki/ExpireCommand Best, Nathan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question about news.php.net
Good to know there's a workaround. I am thinking of using one (or more) of the old VOOM boxes to mirror the news server for NNTP-only access. Sent from my DROID. Apologies if formatting is off or I'm top-posting on a list. On Sep 14, 2010 8:59 PM, Nathan Rixham nrix...@gmail.com wrote: Daniel Brown wrote: On Mon, Sep 13, 2010 at 18:09, MikeB mpbr...@gmail.com wrote: However, getting access seems to be hit-and-miss, since I more often than not get a message that the connection to news.php.net timed out. Is this an indication that the server is just very busy? I don't get this on any other news server I'm using on the smae news reader and I have gotten this on two different news readers that I have tried. I don't believe that we've been having any issues with the server, no. Are you using NNTP to connect? You may want to consider using the HTTP-based RSS and/or RDF feeds if it continues to be an issue. In addition, if you continue to have problems, file a bug report at http://bugs.php.net/ and we'll look into it further. Dan, Mike, I can confirm this happens all the time in thunderbird, and always has for many years now, on all PHP NNTP lists. However, the problem can be worked around simply, for some reason the timeout generally only happens with the first call to view a mailing list, after X minutes of inactivity. Thus, I simply subscribe to a few different PHP lists (like .soap .test and general) then when I open thunderbird I quickly click a list I *don't* want to see, then click on .general, .general then loads nicely as expected letting the other one timeout :) It's hardly a fix, but it works - may be worth checking if this is the case with the latest thunderbird revision and then reporting it as a bug (in either thunderbird or the mailing list software that PHP is running). Best, Nathan
Re: [PHP] php cli question
Per Jessen wrote: J Ravi Menon wrote: 2) What about garbage collection? In a standard apache-mod-php setup, we rely on the end of a request-cycle to free up resources - close file descriptiors, free up memory etc.. I am assuming in the aforesaid standalone daemon case, we would have to do this manually? Yes. So 'unset($some_big_array)' or 'unset($some_big_object)' etc.. is the right way to go for non-resource based items? i.e. it needs to be explicitly done? It's not quite like C - if you reassign something, the previous contents are automagically freed. I use unset() if I know it could be a while (hours) before it'll likely be reassigned, but it won't be used in the meantime. Has anybody done a comparison of setting to null rather than unset'ing; does unset invoke the garbage collector instantly? i.e. is unset the best approach to clearing objects from memory quickly? Best, Nathan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] 1984 (Big Brother)
Daniel Brown wrote: On Mon, Sep 13, 2010 at 19:47, Micky Hulse mickyhulse.li...@gmail.com wrote: Motion sensing camera connected to a mechanical pointer stick aimed to trigger the server power button. On his way out of the office: Clap on/clap off Clapper connected to computer power cable. It would be cheaper to employ the same method used on some lawnmowers and required on Jet Skis and Skidoos: a cable with a clip worn by the rider. The rider falls off, the cable releases from the vehicle, disengaging the throttle and cutting the engine. The boss stands up, his entire infrastructure collapses, everyone's connections are closed, and all PCs subsequently catch fire. I fear this is the implementation needed to make boss see sense, however.. Realistically, a simple desktop-based application running in the system tray (presuming Windows) would send a kill signal to a predefined script to issue safe closing routines to the database first, then any other systems he wants to close out. It could even have simple options to poll if there's a screensaver activated, which would initiate the process automatically, should he choose to be extremely paranoid. The same could be automated to work in reverse, to automatically bring the systems up, when the local desktop session becomes active (from hibernation, logoff, or screensaver), or even with an override (Pause Sessions) by right-clicking the systray icon. The main problem here is in using a stateless protocol (HTTP) in a stateful manner (with sessions), it makes this, technically, impossible. That said, you could do this in a stateless manner quite easily by giving the boss full control of granting and denying access, that way he is always accountable (with his described nature, it might be good for the buck to stop with him, rather than your code). I'd suggest having a simple boolean flag, usersCanAccess and giving him a button to toggle the flags state from true to false. Real life implementation could be an empty file which is `touch`ed and `unlink`ed, php implementation being an if(file_exists('boss_man_say_okay') ){ // let monkeys work } type solution. Best, Nathan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php cli question
On Tue, Sep 14, 2010 at 1:15 PM, Per Jessen p...@computer.org wrote: J Ravi Menon wrote: On Tue, Sep 14, 2010 at 12:43 AM, Per Jessen p...@computer.org wrote: J Ravi Menon wrote: Few questions: 1) Does opcode cache really matter in such cli-based daemons? As 'SomeClass' is instantiated at every loop, I am assuming it is only compiled once as it has already been 'seen'. Yup. Just to clarify, you mean we don't need the op-code cache here right? That is correct. 2) What about garbage collection? In a standard apache-mod-php setup, we rely on the end of a request-cycle to free up resources - close file descriptiors, free up memory etc.. I am assuming in the aforesaid standalone daemon case, we would have to do this manually? Yes. So 'unset($some_big_array)' or 'unset($some_big_object)' etc.. is the right way to go for non-resource based items? i.e. it needs to be explicitly done? It's not quite like C - if you reassign something, the previous contents are automagically freed. I use unset() if I know it could be a while (hours) before it'll likely be reassigned, but it won't be used in the meantime. Thanks Per for clarifying this for me. Now on my follow up question: [Note: I think it is related to the issues discussed above hence keeping it on this thread but if I am violating any guidelines here, do let me know] One reason the aforesaid questions got triggered was that in our company right now, there is a big discussion on moving away from apache+mod_php solution to nginx+fast-cgi based model for handling all php-based services. The move seems to be more based some anecdotal observations and possibly not based on a typical php-based app (i.e. the php script involved was trivial one acting as some proxy to another backend service). I have written fast-cgi servers in the past in C++, and I am aware how the apahcefast-cgi-servers work (in unix socket setups). All our php apps are written with apache+mod_php in mind (no explicit resource mgmt ), so this was a concern to me. If the same scripts now need to run 'forever' as a fastcgi server, are we forced to do such manual resource mgmt? Or are there solutions here that work just as in mod_php? This reminded me of the cli daemons that I had written earlier where such manual cleanups were done, and hence my doubts on this nginx+fast-cgi approach. thx, Ravi -- Per Jessen, Zürich (14.6°C) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php