Re: [PHP] de lester
[EMAIL PROTECTED] wrote: � I am working with videos and I need to Know how I can obtain the duration of the videos �I had a formula that did not need any�function of�php, but i lost de page,� please i need any help with this. Sorry for my english, i am from Cuba. Lester..Univ de Cienfuegos..Informatica 3 A�o (*_*)Todos somos muy ignorantes. Lo que ocurre es que no todos ignoramos las mismas cosas(*_*) Servicio del Grupo de Redes Universidad de Cienfuegos Contacto: [EMAIL PROTECTED] Since you didn't say what type of video you wanted to work with, I'm going to assume that you meant most common video formats = videos Here is one that works (suppose to anyway) on MPEG http://phpvideotoolkit.sourceforge.net/ Again, I have not tested either of my suggestions. Have no idea if they are close to what you are looking for, but I hope it helps. Jim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] de lester
27 jun 2008 kl. 09.05 skrev [EMAIL PROTECTED]: SORRY, IN THE LAST EMAIL I DONT SAY WHAT TYPE OF VIDEO I WAS WORKING, I AM WORKING WITH VIDEO .MOV THANKS. I am working with videos and I need to Know how I can obtain the duration of the videos I had a formula that did not need any function of php, but i lost de page, please i need any help with this. Sorry for my english, i am from Cuba. Lester..Univ de Cienfuegos..Informatica 3 Año (*_*)Todos somos muy ignorantes. Lo que ocurre es que no todos ignoramos las mismas cosas(*_*) Servicio del Grupo de Redes Universidad de Cienfuegos Contacto: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php First of all, I think it's not necessary for you to apologize for your skills in the English language. Sometimes I feel that some members of this list tend to think that it is funny when somebody is not able to express him-/herself to 100% when English is not the native language. I think it is wrong to make fun of something like that. Not everyone subscribing to this list is a lecturer in english. Now something that might help you to find a solution. Depending on your operating system, there are definitely several different solutions out there that are able to get the information you are looking for. Have a look at the command line tool ffmpeg. This package is able to convert many different movie formats (it's like ImageMagick, but for movie files) and to retrieve some information from movie files. Have a look at http://ffmpeg.mplayerhq.hu/ http://ffmpeg-php.sourceforge.net/ An other option could be Apple Quicktime. There are some command line tools out there that interact with Quicktime. Google for quicktime command line tool and see if you find something useful. Regards, //frank -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Inspiration for a Tombstone.
Dan Shirah wrote: if ($user_name == Dan S) { echo Quit while you're ahead; } exit; As I very humorously hinted at in a earlier mail on this thread, it is a very, very good idea to get into the habit of putting constants *first* in if/while/etc statements. if (Dan S = $user_name) PHP/C/C++ etc. Bombs with a syntax error. if ($user_name = Dan S) Works silently and looks right at first glance. I forced myself to write things that way round a good number of years ago and it has served me well and caught a few potential mishaps. Col. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] de lester
On Fri, 2008-06-27 at 03:05 -0400, [EMAIL PROTECTED] wrote: SORRY, IN THE LAST EMAIL I DONT SAY WHAT TYPE OF VIDEO I WAS WORKING, I AM WORKING WITH VIDEO .MOV THANKS. I am working with videos and I need to Know how I can obtain the duration of the videos I had a formula that did not need any function of php, but i lost de page, please i need any help with this. Sorry for my english, i am from Cuba. Here's how I do it. I make a file with the output of ffmpeg and then just parse the file for duration. After looking at a lot of options, this proved to be the easiest and most reliable. Here's my code that also finds the mid-time and grabs an image of the middle frame for a thumbnail: //tmpname is the temp name of the video //First we get some info about the video with ffmpeg $cmd=/usr/local/bin/ffmpeg -i $tmpname 2 $tmpname.info; system($cmd,$ok); if (!$ok) { return false; } $ffinfo=file_get_contents($tmpname..info); $ffinfo=substr($ffinfo,strpos($ffinfo,Duration:)+10,strlen($ffinfo)); //Now that we got the duration we parse the string so that we get hours, mins and seconds $ffinfo=substr($ffinfo,0,strpos($ffinfo,.)); $runningtimeparts=explode(:,$ffinfo); foreach($runningtimeparts as $rt) { $newparts[]=floor((($rt/60)*0.5)*60); } //Get the mid point $midtime=($newparts[0]*3600)+($newparts[1]*60)+$newparts[2]; $midtimestr=implode(:,$newparts); //$jpegname is the name of where you want to save the thumbnail $cmd=/usr/local/bin/ffmpeg -i $tmpname -ss $midtimestr -y -r 1 -vframes 1 -f mjpeg $jpegname; system($cmd); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] FW: [SPAM] Re: [PHP] Inspiration for a Tombstone.
410 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] fwrite() Append Files
Hi, I wonder if anyone on the list could tell me how to append the files as I am writing in them. I have a file that has no more than five characters per line, and I would like to keep its spacing between the lines. Right now I have the set up so that it could write in the first line, but the problem is that all the lines after it never get written in to the desired file. Is there some sort of command that I could use to append files as I am writing them? I would provide the code if this is not clear enough. Thanks in advance. Alice == Alice Wei MIS 2009 School of Library and Information Science Indiana University Bloomington [EMAIL PROTECTED]
FW: [PHP] fwrite() Append Files
Please post the code, I'm not clear on the problem. -Original Message- From: Wei, Alice J. [mailto:[EMAIL PROTECTED] Sent: Friday, June 27, 2008 12:02 PM To: php-general@lists.php.net Subject: [PHP] fwrite() Append Files Hi, I wonder if anyone on the list could tell me how to append the files as I am writing in them. I have a file that has no more than five characters per line, and I would like to keep its spacing between the lines. Right now I have the set up so that it could write in the first line, but the problem is that all the lines after it never get written in to the desired file. Is there some sort of command that I could use to append files as I am writing them? I would provide the code if this is not clear enough. Thanks in advance. Alice == Alice Wei MIS 2009 School of Library and Information Science Indiana University Bloomington [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Inspiration for a Tombstone.
On Thu, Jun 26, 2008 at 4:31 PM, tedd [EMAIL PROTECTED] wrote: Hi gang: For a break in our normal serious thinking, I suggested tombstone wit of: Always on the edge of greatness Dan offered: /cruelWorld or /Dan or ?php function dan($dateOfDeath) { return Daniel P. Brown: 01-01-1970 - .$dateOfDeath; } die(dan('00-00-')); ? What would you like on your Tombstone? (-- that's actually a trademarked saying) A classical : ?php echo So long and thanks for all the PHP; die(); ? Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Inspiration for a Tombstone.
2008/6/27 Colin Guthrie [EMAIL PROTECTED]: As I very humorously hinted at in a earlier mail on this thread, it is a very, very good idea to get into the habit of putting constants *first* in if/while/etc statements. if (Dan S = $user_name) PHP/C/C++ etc. Bombs with a syntax error. That is a great tip, thanks! Dotan Cohen http://what-is-what.com http://gibberish.co.il א-ב-ג-ד-ה-ו-ז-ח-ט-י-ך-כ-ל-ם-מ-ן-נ-ס-ע-ף-פ-ץ-צ-ק-ר-ש-ת A: Because it messes up the order in which people normally read text. Q: Why is top-posting such a bad thing?
Re: FW: [PHP] fwrite() Append Files
Hey Alice, Are you sure you can do this with vanilla flavor PHP ? Your professor could be mistaking on this particular assignment. Maybe some kind of webservice could do the trick. ASP.net is really good at handling file I/O. Kind regards, Stijn Chris Scott wrote: Please post the code, I'm not clear on the problem. -Original Message- From: Wei, Alice J. [mailto:[EMAIL PROTECTED] Sent: Friday, June 27, 2008 12:02 PM To: php-general@lists.php.net Subject: [PHP] fwrite() Append Files Hi, I wonder if anyone on the list could tell me how to append the files as I am writing in them. I have a file that has no more than five characters per line, and I would like to keep its spacing between the lines. Right now I have the set up so that it could write in the first line, but the problem is that all the lines after it never get written in to the desired file. Is there some sort of command that I could use to append files as I am writing them? I would provide the code if this is not clear enough. Thanks in advance. Alice == Alice Wei MIS 2009 School of Library and Information Science Indiana University Bloomington [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] fwrite() Append Files
Wei, Alice J. wrote: Hi, I wonder if anyone on the list could tell me how to append the files as I am writing in them. I have a file that has no more than five characters per line, and I would like to keep its spacing between the lines. Right now I have the set up so that it could write in the first line, but the problem is that all the lines after it never get written in to the desired file. Is there some sort of command that I could use to append files as I am writing them? I would provide the code if this is not clear enough. Thanks in advance. Alice Alice, ALWAYS POST CODE. It gives us an example that you have done your assignment to begin with and aren't continuing to ask this list to do your work for you. RTFM as the fwrite module is pretty clear on its usage. But start with posting your current code (and not pseudo code) so that we can point you in a better direction. Wolf -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Inspiration for a Tombstone.
2008/6/27 Brice [EMAIL PROTECTED]: On Thu, Jun 26, 2008 at 4:31 PM, tedd [EMAIL PROTECTED] wrote: Hi gang: For a break in our normal serious thinking, I suggested tombstone wit of: Always on the edge of greatness Dan offered: /cruelWorld or /Dan or ?php function dan($dateOfDeath) { return Daniel P. Brown: 01-01-1970 - .$dateOfDeath; } die(dan('00-00-')); ? What would you like on your Tombstone? (-- that's actually a trademarked saying) A classical : ?php echo So long and thanks for all the PHP; die(); ? echo PHP_EOL; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Inspiration for a Tombstone.
Robin Vickery wrote: 2008/6/27 Brice [EMAIL PROTECTED]: A classical : ?php echo So long and thanks for all the PHP; die(); ? echo PHP_EOL; If even your kids don't know your name, since you're always busy hacking away: Rest in peace posix_getppid(); Johnny jr. Susie Melanie -- Aschwin Wesselius /'What you would like to be done to you, do that to the other'/
[PHP] Help with login
Hey, I think this should be working but it doesn't seem to be. ?php /* Admin Login Page TS Achilles Website Created by Byron Glover */ require(config.php); require(functions.php); // Check for previous authentication if (isset($_COOKIE[auth]) isset($_GET[page])) { include($_GET[page]..php); die(); } if (isset($_COOKIE[auth]) !isset($_GET[page])) { include($GLOBALS['admin_index']); die(); } // Handle login form data that has been self-$_POSTed if ( $GLOBALS['admin_log_user'] == $_POST[user] $GLOBALS['admin_encrypt_pass'] == md5($_POST[password]) ){ setcookie(auth, 1, time()+900); header(Refresh: url=.$_SERVER['PHP_SELF']); } ? html form method=post action=login.php table align=center tddiv class=h1 underlineAdministrator Login/div trtddiv class=plaintextUsername: /div/tdtd trtdinput name=username type=text width=25/td/tr trtddiv class=plaintextPassword: /div/tdtd trtdinput name=password type=password width=25/td/tr trtd colspan=2 align=centerinput name=Login type=submit/td/tr /table /form /html
Re: [PHP] fwrite() Append Files
Wei, Alice J. wrote: Hi, I wonder if anyone on the list could tell me how to append the files as I am writing in them. I have a file that has no more than five characters per line, and I would like to keep its spacing between the lines. Right now I have the set up so that it could write in the first line, but the problem is that all the lines after it never get written in to the desired file. You need to open the file in append mode = 'a+'. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help with login
Hey, I think this should be working but it doesn't seem to be. $_GET[page] $_SERVER['PHP_SELF'] What is the error message you are getting? And, why are you using different quotes throughout all of your script? I believe you should use single quotes for all of your server generated variables like $_GET['page'], $_SERVER['PHP_SELF'], $_POST['user']
[PHP] Re: Inspiration for a Tombstone.
At 11:01 AM +0100 6/27/08, Colin Guthrie wrote: if ($user_name = Dan S) Works silently and looks right at first glance. I forced myself to write things that way round a good number of years ago and it has served me well and caught a few potential mishaps. Col. Really? I do it this way: if ($user_name == Dan S) That not only looks right at first glance, but it actually works. :-) tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] unset and circular references
Hi, I'm using php 5.2.1 on an Ubuntu machine. I have the following class diagram (observer pattern): +-+ +-+ +-+ | class A |#-| class B | -| interface C | | | +-+ | | | |---|| | +-+ +-+ in my case class A, the creator of class B, is also the class to observe for class B. The following code implements the above diagram: ?php interface C { } class B { var $m_ObsC; public function __construct( C $p_ObsC ) { $this-m_ObsC = $p_ObsC; } public function __destruct() { echo B::destruct called br; } } class A implements C { var $m_b; public function __construct() { $this-m_b = new B( $this ); } public function __destruct() { echo A::destruct called br; } } $a = new A(); unset( $a ); echo br-end-of-scriptbr; ? the output of the above code is: -end-of-script A::destruct called B::destruct called So actually the memory used by object $a is freed only after the script ends and NOT when unset was called. Now this is a big problem for me, because i need to free the memory when I call unset and not after the script ends else php runs out of memory in my real application. Object $a is not referenced by any other object. I also tried with: $this-m_b = new B( $this ); but the result is the same. Any clue how to determine php tho free the memory when unset is called and not after the script ends? Thanks, Abu -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] fwrite() Append Files
Hi, This is my current code: $lines = file(http://www.mysite.com/hello.txt;); $file=http://www.mysite.com/hello.txt;; $ourFileName = hello.txt; $ourFileHandle = fopen($ourFileName, 'wb') or die(can't open file); fclose($ourFileHandle); $newFileName=http://www.yoursite.com/hello.txt;; echo $newFileName; $result=rename($ourFileName, $newFileName); $ourFileHandle = fopen($ourFileName, 'wb') or die(can't open file); // Loop through our array, show HTML source as HTML source; and line numbers too. foreach ($lines as $line_num = $line) { echo pLine #b{$line_num}/b : . htmlspecialchars($line) . /p; $ourFileHandle = fopen($newFileName, 'wb') or die(can't open file); $content=fwrite($ourFileHandle, htmlspecialchars($line)); echo pThe line: $content has been written into $newFilename/p; } fclose($ourFileHandle); Do you mean to edit $ourFileHandle to fopen($ourFileName, 'wba')? What I really wanted to do is to copy the file directory from $file to $newFileName directory using the cp command or something, but if I cannot do that, writing in and out of the file may be good enough. Alice == Alice Wei MIS 2009 School of Library and Information Science Indiana University Bloomington [EMAIL PROTECTED] From: Per Jessen [EMAIL PROTECTED] Sent: Friday, June 27, 2008 8:26 AM To: php-general@lists.php.net Subject: Re: [PHP] fwrite() Append Files Wei, Alice J. wrote: Hi, I wonder if anyone on the list could tell me how to append the files as I am writing in them. I have a file that has no more than five characters per line, and I would like to keep its spacing between the lines. Right now I have the set up so that it could write in the first line, but the problem is that all the lines after it never get written in to the desired file. You need to open the file in append mode = 'a+'. /Per Jessen, Zürich -- 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] de lester
At 9:43 AM +0200 6/27/08, Frank Arensmeier wrote: Sometimes I feel that some members of this list tend to think that it is funny when somebody is not able to express him-/herself to 100% when English is not the native language. I think it is wrong to make fun of something like that. Not everyone subscribing to this list is a lecturer in english. While you may feel that, that generally isn't true. I feel that all regulars on this list are here to help, and that includes everyone. If someone publishes something to the list, we read it for what it says. If the person doesn't express what they want well enough, then it's open for us to comment as we feel fit. That doesn't mean we are making fun of someone who doesn't write English good, but rather providing feedback that what they wrote didn't convey what they wanted. IMO, that's better than ignoring them. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: Inspiration for a Tombstone.
[snip] Really? I do it this way: if ($user_name == Dan S) That not only looks right at first glance, but it actually works. :-) [/snip] This works better though; if(Dan S == $user_name) ... if you drop one of the comparison operators in your haste to type then an error gets thrown and you will be able to find it precisely. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help with login
At 8:37 AM -0400 6/27/08, Dan Shirah wrote: Hey, I think this should be working but it doesn't seem to be. $_GET[page] $_SERVER['PHP_SELF'] What is the error message you are getting? And, why are you using different quotes throughout all of your script? I believe you should use single quotes for all of your server generated variables like $_GET['page'], $_SERVER['PHP_SELF'], $_POST['user'] While it isn't a killer, using different quotes isn't best practice. I use single quotes for just about everything in PHP except when the string contains a variable. So, in my code when I see double quotes, I also expect to see a variable -- it's a debugging check for me. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] fwrite() Append Files
Wei, Alice J. wrote: Do you mean to edit $ourFileHandle to fopen($ourFileName, 'wba')? I think fopen($ourFileName, 'a') will do what you want. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] fwrite() Append Files
On Fri, Jun 27, 2008 at 7:01 AM, Wei, Alice J. [EMAIL PROTECTED] wrote: Hi, I wonder if anyone on the list could tell me how to append the files as I am writing in them. I have a file that has no more than five characters per line, and I would like to keep its spacing between the lines. Right now I have the set up so that it could write in the first line, but the problem is that all the lines after it never get written in to the desired file. Is there some sort of command that I could use to append files as I am writing them? I would provide the code if this is not clear enough. This is generally your first stop when you have a question, meaning you don't read the manual, right? There are a few file-writing tools included in a basic PHP build. Always RTFM before posting here. http://php.net/file-put-contents http://php.net/fwrite -- /Daniel P. Brown Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just $59.99/mo. with no contract! Dedicated servers, VPS, and hosting from $2.50/mo. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: Inspiration for a Tombstone.
At 8:30 AM -0500 6/27/08, Jay Blanchard wrote: [snip] Really? I do it this way: if ($user_name == Dan S) That not only looks right at first glance, but it actually works. :-) [/snip] This works better though; if(Dan S == $user_name) ... if you drop one of the comparison operators in your haste to type then an error gets thrown and you will be able to find it precisely. Ah yes, and this works even better. if('Dan S' == $user_name) ... also, no need for double quotes And being dyslexic, I knew the 'Dan S' should have come first, but didn't immediately recognize it as I was rushing to point out a double equal-sign boo-boo made by Col. Thanks, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] FW: [SPAM] RE: [PHP] fwrite() Append Files
I don't think you can open files for writing over http, you get an error: failed to open stream: HTTP wrapper does not support writeable connections. -Original Message- From: Per Jessen [mailto:[EMAIL PROTECTED] Sent: Friday, June 27, 2008 2:39 PM To: php-general@lists.php.net Subject: [SPAM] RE: [PHP] fwrite() Append Files Importance: Low Wei, Alice J. wrote: Do you mean to edit $ourFileHandle to fopen($ourFileName, 'wba')? I think fopen($ourFileName, 'a') will do what you want. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: Inspiration for a Tombstone.
[snip] And being dyslexic, I knew the 'Dan S' should have come first, but didn't immediately recognize it as I was rushing to point out a double equal-sign boo-boo made by Col. [/snip] Had Col used the method we're speaking of here the error would have been thrown and he would have found the culprit post haste. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] unset and circular references
Quoting Abu Warez [EMAIL PROTECTED]: Hi, I'm using php 5.2.1 on an Ubuntu machine. I have the following class diagram (observer pattern): +-+ +-+ +-+ | class A |#-| class B | -| interface C | | | +-+ | | | |---|| | +-+ +-+ in my case class A, the creator of class B, is also the class to observe for class B. The following code implements the above diagram: ?php interface C { } class B { var $m_ObsC; public function __construct( C $p_ObsC ) { $this-m_ObsC = $p_ObsC; } public function __destruct() { echo B::destruct called br; } } class A implements C { var $m_b; public function __construct() { $this-m_b = new B( $this ); } public function __destruct() { echo A::destruct called br; } } $a = new A(); unset( $a ); echo br-end-of-scriptbr; ? the output of the above code is: -end-of-script A::destruct called B::destruct called So actually the memory used by object $a is freed only after the script ends and NOT when unset was called. Now this is a big problem for me, because i need to free the memory when I call unset and not after the script ends else php runs out of memory in my real application. Object $a is not referenced by any other object. I also tried with: $this-m_b = new B( $this ); but the result is the same. Any clue how to determine php tho free the memory when unset is called and not after the script ends? Thanks, Abu I think this happens because there is still a reference to the B object. According to the manual : The destructor method will be called as soon as all references to a particular object are removed or when the object is explicitly destroyed or in any order in shutdown sequence. So as long as A has a reference to B the __destructor will not be called. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Inspiration for a Tombstone.
On Fri, Jun 27, 2008 at 6:01 AM, Colin Guthrie [EMAIL PROTECTED] wrote: As I very humorously hinted at in a earlier mail on this thread, it is a very, very good idea to get into the habit of putting constants *first* in if/while/etc statements. if (Dan S = $user_name) PHP/C/C++ etc. Bombs with a syntax error. if ($user_name = Dan S) Works silently and looks right at first glance. I forced myself to write things that way round a good number of years ago and it has served me well and caught a few potential mishaps. You raise a very good and valid point, Col. I format my code that way with C/C++, BASH, even Tcl/Tk (yeah, I said it), but for some reason I never remember to do it in PHP. I think it's time to start forcing myself to develop that habit. -- /Daniel P. Brown Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just $59.99/mo. with no contract! Dedicated servers, VPS, and hosting from $2.50/mo. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] segfault help
Hi list, I'm getting a segfault when I run (what I assume) is a very simple script. I'm not sure if it's a php bug or a bug in the library I'm using (MDB2) with PHP 5.2.5 via the cli. Everything seems to go fine until it's time for the script to end. That's when it receives the seg fault. I have the following backtrace. Program received signal SIGSEGV, Segmentation fault. [Switching to Thread -1209059648 (LWP 2815)] _zend_mm_free_int (heap=0x9d0d1b8, p=Variable p is not available. ) at /root/php-5.2.5/Zend/zend_alloc.c:807 807 ZEND_MM_CHECK_TREE(mm_block); (gdb) bt #0 _zend_mm_free_int (heap=0x9d0d1b8, p=Variable p is not available. ) at /root/php-5.2.5/Zend/zend_alloc.c:807 #1 0x08313a85 in zend_hash_destroy (ht=0xb78812d4) at /root/php-5.2.5/Zend/zend_hash.c:531 #2 0x0831f6dd in zend_object_std_dtor (object=0xb788cd00) at /root/php-5.2.5/Zend/zend_objects.c:45 #3 0x0831f900 in zend_objects_free_object_storage (object=0xb788cd00) at /root/php-5.2.5/Zend/zend_objects.c:122 #4 0x0832224c in zend_objects_store_free_object_storage (objects=0x86174c8) at /root/php-5.2.5/Zend/zend_objects_API.c:89 #5 0x082fdf27 in shutdown_executor () at /root/php-5.2.5/Zend/zend_execute_API.c:299 #6 0x0830a71c in zend_deactivate () at /root/php-5.2.5/Zend/zend.c:860 #7 0x082d2a4a in php_request_shutdown (dummy=0x0) at /root/php-5.2.5/main/main.c:1485 #8 0x0838c16f in main (argc=2, argv=0xbff74d24) at /root/php-5.2.5/sapi/cli/php_cli.c:1321 (gdb) quit The program is running. Exit anyway? (y or n) y And it's occurring when I run this script ?php require 'lib/appDB.php'; $db = appDB::getInstance(); $count = 0; while ($count 1) { $id = rand(3,10); $query = insert into plugins (id) values ('$id'); $result = $db-exec($query); echo $count.\n; $count++; } exit; ? appDB is my own wrapper around this code $options = array( 'debug_expanded_output' = true, 'quote_identifier' = true, ); $db = MDB2::singleton(sqlite:///myfile, $options); $db-setFetchMode(MDB2_FETCHMODE_ASSOC); $db-setOption('persistent', false); As shown above, I'm using sqlite. The database file and the folder that the file is in are both writable by the user that I'm running the script as. Any help would be appreciated. Thanks, Tim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: Re: [PHP] exec() Error
-Original Message- From: Wei, Alice J. [mailto:[EMAIL PROTECTED] Sent: Thursday, June 26, 2008 7:50 AM To: Boyd, Todd M.; php-general@lists.php.net Subject: RE: Re: [PHP] exec() Error Hi, Todd: It looks like I have some other errors in my Perl code, and I got it fixed, switched the permission to 755, and made attempts to call it using cURL through my working PHP script. Here is the code: // create a new cURL resource $ch = curl_init(); // set URL and other appropriate options curl_setopt($ch, CURLOPT_URL, http://192.168.10.63/total.cgi;); curl_setopt($ch, CURLOPT_HEADER, false); // grab URL and pass it to the browser curl_exec($ch); // close cURL resource, and free up system resources curl_close($ch); This time, I do not get the script output from the script in total.cgi, but I got Forbidden You don't have permission to access /total.cgi on this server. I have switched the permission to both scripts at both servers. Is there something wrong I have done here? Alice, I do not program in Perl, nor do I use CGI often enough to help you much here. However, it looks to me like it's a webserver issue, and has nothing to do with your code itself. Whatever CGI module is being used must probably be told that total.cgi needs granular permissions. Your web administrator will be able to help you much more than I can at this point. HTH, Todd Boyd Web Programmer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: Inspiration for a Tombstone.
-Original Message- From: Jay Blanchard [mailto:[EMAIL PROTECTED] Sent: Friday, June 27, 2008 8:50 AM To: tedd; php-general@lists.php.net Subject: RE: [PHP] Re: Inspiration for a Tombstone. [snip] And being dyslexic, I knew the 'Dan S' should have come first, but didn't immediately recognize it as I was rushing to point out a double equal-sign boo-boo made by Col. [/snip] Had Col used the method we're speaking of here the error would have been thrown and he would have found the culprit post haste. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php I think you guys are missing something: he wrote it with single equals signs on purpose. He was demonstrating how the one with the constant to the right of the assignment operator is a valid statement... and that putting the constant first will aid you in finding such mistakes. if(constant = $variable){} // bombs, and lets you know right away you missed an = if($variable = constant){} // assigns rather than compares, but nonetheless is valid code To quote Colin: As I very humorously hinted at in a earlier mail on this thread, it is a very, very good idea to get into the habit of putting constants *first* in if/while/etc statements. So, I'm sure he is well familiar with this method we're speaking of. :) Todd Boyd Web Programmer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] FW: [SPAM] RE: [PHP] fwrite() Append Files
-Original Message- From: Chris Scott [mailto:[EMAIL PROTECTED] Sent: Friday, June 27, 2008 8:48 AM To: php-general@lists.php.net Subject: [PHP] FW: [SPAM] RE: [PHP] fwrite() Append Files Importance: Low I don't think you can open files for writing over http, you get an error: failed to open stream: HTTP wrapper does not support writeable connections. -Original Message- From: Per Jessen [mailto:[EMAIL PROTECTED] Sent: Friday, June 27, 2008 2:39 PM To: php-general@lists.php.net Subject: [SPAM] RE: [PHP] fwrite() Append Files Importance: Low Wei, Alice J. wrote: Do you mean to edit $ourFileHandle to fopen($ourFileName, 'wba')? I think fopen($ourFileName, 'a') will do what you want. From Alice's code: $ourFileName = hello.txt; $ourFileHandle = fopen($ourFileName, 'wb') or die(can't open file); So... she is not, in fact, trying to write a file over HTTP. She is reading a file via HTTP and writing something pertaining to it on the local file system. Also, please refrain from top-posting. It makes the posts get very confusing. :( Todd Boyd Web Programmer
[PHP] FW: [SPAM] RE: [PHP] FW: [SPAM] RE: [PHP] fwrite() Append Files
-Original Message- From: Chris Scott [mailto:[EMAIL PROTECTED] Sent: Friday, June 27, 2008 8:48 AM To: php-general@lists.php.net Subject: [PHP] FW: [SPAM] RE: [PHP] fwrite() Append Files Importance: Low I don't think you can open files for writing over http, you get an error: failed to open stream: HTTP wrapper does not support writeable connections. -Original Message- From: Per Jessen [mailto:[EMAIL PROTECTED] Sent: Friday, June 27, 2008 2:39 PM To: php-general@lists.php.net Subject: [SPAM] RE: [PHP] fwrite() Append Files Importance: Low Wei, Alice J. wrote: Do you mean to edit $ourFileHandle to fopen($ourFileName, 'wba')? I think fopen($ourFileName, 'a') will do what you want. From Alice's code: $ourFileName = hello.txt; $ourFileHandle = fopen($ourFileName, 'wb') or die(can't open file); So... she is not, in fact, trying to write a file over HTTP. She is reading a file via HTTP and writing something pertaining to it on the local file system. Also, please refrain from top-posting. It makes the posts get very confusing. :( Todd Boyd Web Programmer Sorry about the top posting, just habit. I'll stop doing it. From Alice's code: $newFileName=http://www.yoursite.com/hello.txt;; echo $newFileName; $result=rename($ourFileName, $newFileName); $ourFileHandle = fopen($ourFileName, 'wb') or die(can't open file); // Loop through our array, show HTML source as HTML source; and line numbers too. foreach ($lines as $line_num = $line) { echo pLine #b{$line_num}/b : . htmlspecialchars($line) . /p; $ourFileHandle = fopen($newFileName, 'wb') or die(can't open file); $content=fwrite($ourFileHandle, htmlspecialchars($line)); .. The fwrite is $ourFileHandle which on the previous line is set to $newFileName which is http://www.yoursite.com/hello.txt. I might have missed the point (I regularly do) but it looks like http to me.
Re: [PHP] segfault help
On Fri, Jun 27, 2008 at 10:30 AM, Tim Rupp [EMAIL PROTECTED] wrote: Hi list, I'm getting a segfault when I run (what I assume) is a very simple script. I'm not sure if it's a php bug or a bug in the library I'm using (MDB2) with PHP 5.2.5 via the cli. Everything seems to go fine until it's time for the script to end. That's when it receives the seg fault. [snip!] Tim, In 5.2.6, line 807 is in zend_mm_remove_from_free_list(), but it's still memory-related, since it's zend_alloc.c that appears to be causing the crash. What does your ./configure line look like? -- /Daniel P. Brown Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just $59.99/mo. with no contract! Dedicated servers, VPS, and hosting from $2.50/mo. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] unset and circular references
--- On Fri, 6/27/08, Thijs Lensselink [EMAIL PROTECTED] wrote: From: Thijs Lensselink [EMAIL PROTECTED] Subject: Re: [PHP] unset and circular references To: php-general@lists.php.net Date: Friday, June 27, 2008, 5:21 PM Quoting Abu Warez [EMAIL PROTECTED]: Hi, I'm using php 5.2.1 on an Ubuntu machine. I have the following class diagram (observer pattern): +-+ +-+ +-+ | class A |#-| class B | -| interface C | | | +-+ | | | |---|| | +-+ +-+ in my case class A, the creator of class B, is also the class to observe for class B. The following code implements the above diagram: ?php interface C { } class B { var $m_ObsC; public function __construct( C $p_ObsC ) { $this-m_ObsC = $p_ObsC; } public function __destruct() { echo B::destruct called br; } } class A implements C { var $m_b; public function __construct() { $this-m_b = new B( $this ); } public function __destruct() { echo A::destruct called br; } } $a = new A(); unset( $a ); echo br-end-of-scriptbr; ? the output of the above code is: -end-of-script A::destruct called B::destruct called So actually the memory used by object $a is freed only after the script ends and NOT when unset was called. Now this is a big problem for me, because i need to free the memory when I call unset and not after the script ends else php runs out of memory in my real application. Object $a is not referenced by any other object. I also tried with: $this-m_b = new B( $this ); but the result is the same. Any clue how to determine php tho free the memory when unset is called and not after the script ends? Thanks, Abu I think this happens because there is still a reference to the B object. According to the manual : The destructor method will be called as soon as all references to a particular object are removed or when the object is explicitly destroyed or in any order in shutdown sequence. So as long as A has a reference to B the __destructor will not be called. -- 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] segfault help
On Fri, Jun 27, 2008 at 10:14 AM, Daniel Brown [EMAIL PROTECTED] wrote: On Fri, Jun 27, 2008 at 10:30 AM, Tim Rupp [EMAIL PROTECTED] wrote: Hi list, I'm getting a segfault when I run (what I assume) is a very simple script. I'm not sure if it's a php bug or a bug in the library I'm using (MDB2) with PHP 5.2.5 via the cli. Everything seems to go fine until it's time for the script to end. That's when it receives the seg fault. [snip!] Tim, In 5.2.6, line 807 is in zend_mm_remove_from_free_list(), but it's still memory-related, since it's zend_alloc.c that appears to be causing the crash. What does your ./configure line look like? -- /Daniel P. Brown Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just $59.99/mo. with no contract! Dedicated servers, VPS, and hosting from $2.50/mo. Here's my configure line ./configure --enable-force-cgi-redirect --enable-debug --disable-rpath --enable-inline-optimization --with-bz2 --with-db4=/usr --with-curl --with-gd --enable-gd-native-ttf --without-gdbm --with-gettext --with-ncurses --with-gmp --with-iconv --with-openssl --with-regex=system --with-zlib --with-layout=GNU --enable-bcmath --enable-exif --enable-ftp --enable-magic-quotes --enable-safe-mode --enable-sockets --enable-sysvsem --enable-sysvshm --enable-wddx --with-kerberos --with-ldap=shared --with-mysql=shared --enable-mbstring=all --with-apxs2=/usr/sbin/apxs --with-pgsql=shared --with-mysqli --with-freetype-dir=/usr/include/freetype2 --with-mcrypt --enable-soap --enable-sigchild --enable-pcntl it was compiled on a RHEL 4.2 machine. I compiled 5.2.6 to see if that would fix it, but no change. Thanks, -Tim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] unset and circular references
--- On Fri, 6/27/08, Thijs Lensselink [EMAIL PROTECTED] wrote: From: Thijs Lensselink [EMAIL PROTECTED] Subject: Re: [PHP] unset and circular references To: php-general@lists.php.net Date: Friday, June 27, 2008, 5:21 PM Quoting Abu Warez [EMAIL PROTECTED]: I think this happens because there is still a reference to the B object. According to the manual : The destructor method will be called as soon as all references to a particular object are removed or when the object is explicitly destroyed or in any order in shutdown sequence. So as long as A has a reference to B the __destructor will not be called. I think you mean: As long as B has a ref to A (which, indeed, creates B), the destructor of A will not be called. I agree with that, but in this case the garbage collector should detect that the reference to object $a is from an object $m_b which is created (and maintained) again by the first object $a. In other words, if object $a is not needed then its member $m_b (which has a reference to $a) is not needed neither. So in this case, in my opinion, if one wants to destory object $a then the reference from $m_b to $a should not count. This issue is really frustrating because because in my code I have something like (where $a is of type class A): for ( $id ... ) { $a = daoMyClass-LoadById( $id ); modify $a ... /* persist modified $a */ daoMyClass-Update( $a ); unset( $a ); } unset, as stated, does not destroy $a and all the loaded $a's remain in memory until the script ends. Rising the memory limit is not a solution because the count of $a objects grows between script calls. Any ideas? Thx, Abu -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] segfault help
On Fri, Jun 27, 2008 at 11:57 AM, Tim Rupp [EMAIL PROTECTED] wrote: ./configure --enable-force-cgi-redirect --enable-debug --disable-rpath --enable-inline-optimization --with-bz2 --with-db4=/usr --with-curl --with-gd --enable-gd-native-ttf --without-gdbm --with-gettext --with-ncurses --with-gmp --with-iconv --with-openssl --with-regex=system --with-zlib --with-layout=GNU --enable-bcmath --enable-exif --enable-ftp --enable-magic-quotes --enable-safe-mode --enable-sockets --enable-sysvsem --enable-sysvshm --enable-wddx --with-kerberos --with-ldap=shared --with-mysql=shared --enable-mbstring=all --with-apxs2=/usr/sbin/apxs --with-pgsql=shared --with-mysqli --with-freetype-dir=/usr/include/freetype2 --with-mcrypt --enable-soap --enable-sigchild --enable-pcntl it was compiled on a RHEL 4.2 machine. I compiled 5.2.6 to see if that would fix it, but no change. This is just a way outside guess, but try recompiling (either version) with the same ./configure, but removing '--enable-inline-optimization'. -- /Daniel P. Brown Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just $59.99/mo. with no contract! Dedicated servers, VPS, and hosting from $2.50/mo. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] fwrite() Append Files
Wei, Alice J. wrote: Hi, This is my current code: $lines = file(http://www.mysite.com/hello.txt;); $file=http://www.mysite.com/hello.txt;; You are referring to the file from the website point of view. You must access it from the filesystem point of view $file = '/path/to/public_html/hello.txt'; $ourFileName = hello.txt; $ourFileHandle = fopen($ourFileName, 'wb') or die(can't open file); fclose($ourFileHandle); $newFileName=http://www.yoursite.com/hello.txt;; Same thing here. You are never going to be able to write to that file. The webserver will never allow it. echo $newFileName; $result=rename($ourFileName, $newFileName); $ourFileHandle = fopen($ourFileName, 'wb') or die(can't open file); // Loop through our array, show HTML source as HTML source; and line numbers too. foreach ($lines as $line_num = $line) { echo pLine #b{$line_num}/b : . htmlspecialchars($line) . /p; $ourFileHandle = fopen($newFileName, 'wb') or die(can't open file); $content=fwrite($ourFileHandle, htmlspecialchars($line)); echo pThe line: $content has been written into $newFilename/p; } fclose($ourFileHandle); Do you mean to edit $ourFileHandle to fopen($ourFileName, 'wba')? What I really wanted to do is to copy the file directory from $file to $newFileName directory using the cp command or something, but if I cannot do that, writing in and out of the file may be good enough. Alice == Alice Wei MIS 2009 School of Library and Information Science Indiana University Bloomington [EMAIL PROTECTED] From: Per Jessen [EMAIL PROTECTED] Sent: Friday, June 27, 2008 8:26 AM To: php-general@lists.php.net Subject: Re: [PHP] fwrite() Append Files Wei, Alice J. wrote: Hi, I wonder if anyone on the list could tell me how to append the files as I am writing in them. I have a file that has no more than five characters per line, and I would like to keep its spacing between the lines. Right now I have the set up so that it could write in the first line, but the problem is that all the lines after it never get written in to the desired file. You need to open the file in append mode = 'a+'. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Jim Lucas Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them. Twelfth Night, Act II, Scene V by William Shakespeare -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] fwrite() Append Files
Jim Lucas wrote: Wei, Alice J. wrote: Hi, This is my current code: $lines = file(http://www.mysite.com/hello.txt;); $file=http://www.mysite.com/hello.txt;; You are referring to the file from the website point of view. You must access it from the filesystem point of view $file = '/path/to/public_html/hello.txt'; $ourFileName = hello.txt; $ourFileHandle = fopen($ourFileName, 'wb') or die(can't open file); fclose($ourFileHandle); $newFileName=http://www.yoursite.com/hello.txt;; Same thing here. You are never going to be able to write to that file. The webserver will never allow it. I guess I should have suggested a work around in this case. You will need to create the file locally and then transfer via ftp/scp/etc... the newly created file to the remote server. I built an FTP client once with PHP using the built in FTP functions. You will probably need to do something similar. echo $newFileName; $result=rename($ourFileName, $newFileName); $ourFileHandle = fopen($ourFileName, 'wb') or die(can't open file); // Loop through our array, show HTML source as HTML source; and line numbers too. foreach ($lines as $line_num = $line) { echo pLine #b{$line_num}/b : . htmlspecialchars($line) . /p; $ourFileHandle = fopen($newFileName, 'wb') or die(can't open file); $content=fwrite($ourFileHandle, htmlspecialchars($line)); echo pThe line: $content has been written into $newFilename/p; } fclose($ourFileHandle); Do you mean to edit $ourFileHandle to fopen($ourFileName, 'wba')? What I really wanted to do is to copy the file directory from $file to $newFileName directory using the cp command or something, but if I cannot do that, writing in and out of the file may be good enough. Alice == Alice Wei MIS 2009 School of Library and Information Science Indiana University Bloomington [EMAIL PROTECTED] From: Per Jessen [EMAIL PROTECTED] Sent: Friday, June 27, 2008 8:26 AM To: php-general@lists.php.net Subject: Re: [PHP] fwrite() Append Files Wei, Alice J. wrote: Hi, I wonder if anyone on the list could tell me how to append the files as I am writing in them. I have a file that has no more than five characters per line, and I would like to keep its spacing between the lines. Right now I have the set up so that it could write in the first line, but the problem is that all the lines after it never get written in to the desired file. You need to open the file in append mode = 'a+'. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Jim Lucas Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them. Twelfth Night, Act II, Scene V by William Shakespeare -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] how to load uneven XML file into an array
I need an array filled with an XML file made from the CSV example below. bactisample row has 14 columns bactiresult row has 11 columns CSV is taken and run through an XML creator (we have no control over this piece). bactisample,20802016AA,OR4195079,DIST-A,A,STATE,OR100033,Kitchen Sink,RT,,,TC,Y,06202008 bactisample,20802017AA,OR4101020,DIST-A,A,STATE,OR100033,Mobile SP# 8,RT,,,TC,Y,06202008 bactisample,20802018AA,OR4100341,DIST-A,A,STATE,OR100033,Well Tap,RT,,,TC,Y,06202008 bactisample,20802019AA,OR4100350,DIST-A,A,STATE,OR100033,Well Tap,RT,,,TC,Y,06202008 bactisample,20802024AA,OR4100342,DIST-A,A,STATE,OR100033,2137 SW Mendi Way,RT,,0.64,TC,Y,06202008 bactiresult,20802016AA,06202008,OR4195079,STATE,OR100033,3100,06232008,A,COLILERT,A bactiresult,20802017AA,06202008,OR4101020,STATE,OR100033,3100,06232008,A,COLILERT,A bactiresult,20802018AA,06202008,OR4100341,STATE,OR100033,3100,06232008,A,COLILERT,A bactiresult,20802019AA,06202008,OR4100350,STATE,OR100033,3100,06232008,A,COLILERT,A bactiresult,20802024AA,06202008,OR4100342,STATE,OR100033,3100,06232008,A,9222B,A Here is the XML file. I am going to paste the whole thing and hope it doesn't slow down the internet too much. Any insites on how to parse this file with PHP into some sort of loop we can use to validate every item would be very helpful. ?xml version=1.0 encoding=UTF-8? EN:eDWR xmlns:EN=urn:us:net:exchangenetwork xmlns:SDWIS=http://www.epa.gov/sdwis; xmlns:ns3=http://www.epa.gov/xml; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; EN:Submission EN:submissionFileCreatedDate=2008-06-23 EN:submissionFileName=CSV_06-23-2008_1_35_53PM.csv EN:submissionID=53 EN:LabReport EN:LabIdentification EN:LabAccreditation EN:LabAccreditationIdentifierOR100033/EN:LabAccreditationIdentifier EN:LabAccreditationAuthorityNameSTATE/EN:LabAccreditationAuthorityName /EN:LabAccreditation /EN:LabIdentification EN:Sample EN:SampleIdentification EN:LabSampleIdentifier20802016AA/EN:LabSampleIdentifier EN:PWSIdentifierOR4195079/EN:PWSIdentifier EN:PWSFacilityIdentifierDIST-A/EN:PWSFacilityIdentifier EN:SampleRuleCodeTC/EN:SampleRuleCode EN:SampleMonitoringTypeCodeRT/EN:SampleMonitoringTypeCode EN:ComplianceSampleIndicatorY/EN:ComplianceSampleIndicator EN:SampleCollectionEndDate2008-06-20/EN:SampleCollectionEndDate EN:SampleComments EN:CommentsKitchen Sink/EN:Comments /EN:SampleComments /EN:SampleIdentification EN:SampleLocationIdentification EN:SampleLocationIdentifierA/EN:SampleLocationIdentifier /EN:SampleLocationIdentification /EN:Sample EN:Sample EN:SampleIdentification EN:LabSampleIdentifier20802017AA/EN:LabSampleIdentifier EN:PWSIdentifierOR4101020/EN:PWSIdentifier EN:PWSFacilityIdentifierDIST-A/EN:PWSFacilityIdentifier EN:SampleRuleCodeTC/EN:SampleRuleCode EN:SampleMonitoringTypeCodeRT/EN:SampleMonitoringTypeCode EN:ComplianceSampleIndicatorY/EN:ComplianceSampleIndicator EN:SampleCollectionEndDate2008-06-20/EN:SampleCollectionEndDate EN:SampleComments EN:CommentsMobile SP# 8/EN:Comments /EN:SampleComments /EN:SampleIdentification EN:SampleLocationIdentification EN:SampleLocationIdentifierA/EN:SampleLocationIdentifier /EN:SampleLocationIdentification /EN:Sample EN:Sample EN:SampleIdentification EN:LabSampleIdentifier20802018AA/EN:LabSampleIdentifier EN:PWSIdentifierOR4100341/EN:PWSIdentifier EN:PWSFacilityIdentifierDIST-A/EN:PWSFacilityIdentifier EN:SampleRuleCodeTC/EN:SampleRuleCode EN:SampleMonitoringTypeCodeRT/EN:SampleMonitoringTypeCode EN:ComplianceSampleIndicatorY/EN:ComplianceSampleIndicator EN:SampleCollectionEndDate2008-06-20/EN:SampleCollectionEndDate EN:SampleComments EN:CommentsWell Tap/EN:Comments /EN:SampleComments /EN:SampleIdentification EN:SampleLocationIdentification EN:SampleLocationIdentifierA/EN:SampleLocationIdentifier /EN:SampleLocationIdentification /EN:Sample EN:Sample EN:SampleIdentification
Re: [PHP] FW: [SPAM] RE: [PHP] fwrite() Append Files
Boyd, Todd M. wrote: -Original Message- From: Chris Scott [mailto:[EMAIL PROTECTED] Sent: Friday, June 27, 2008 8:48 AM To: php-general@lists.php.net Subject: [PHP] FW: [SPAM] RE: [PHP] fwrite() Append Files Importance: Low I don't think you can open files for writing over http, you get an error: failed to open stream: HTTP wrapper does not support writeable connections. -Original Message- From: Per Jessen [mailto:[EMAIL PROTECTED] Sent: Friday, June 27, 2008 2:39 PM To: php-general@lists.php.net Subject: [SPAM] RE: [PHP] fwrite() Append Files Importance: Low Wei, Alice J. wrote: Do you mean to edit $ourFileHandle to fopen($ourFileName, 'wba')? I think fopen($ourFileName, 'a') will do what you want. From Alice's code: $ourFileName = hello.txt; $ourFileHandle = fopen($ourFileName, 'wb') or die(can't open file); So... she is not, in fact, trying to write a file over HTTP. She is reading a file via HTTP and writing something pertaining to it on the local file system. Also, please refrain from top-posting. It makes the posts get very confusing. :( Todd Boyd Web Programmer Todd, if you look at her initial code posted in the other thread, you will see that she WAS infact trying to write the file to a remote server. The two URLs were www.mysite.com/hello.txt and www.yoursite.com/hello.txt That would have been trying to write the new file of http. so he was right in saying what he said. Not sure where you got the above code snippet, but it is not from what she originally posted to the list. -- Jim Lucas Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them. Twelfth Night, Act II, Scene V by William Shakespeare -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how to load uneven XML file into an array
On Fri, Jun 27, 2008 at 12:34 PM, John A DAVIS [EMAIL PROTECTED] wrote: I need an array filled with an XML file made from the CSV example below. bactisample row has 14 columns bactiresult row has 11 columns CSV is taken and run through an XML creator (we have no control over this piece). bactisample,20802016AA,OR4195079,DIST-A,A,STATE,OR100033,Kitchen Sink,RT,,,TC,Y,06202008 bactisample,20802017AA,OR4101020,DIST-A,A,STATE,OR100033,Mobile SP# 8,RT,,,TC,Y,06202008 bactisample,20802018AA,OR4100341,DIST-A,A,STATE,OR100033,Well Tap,RT,,,TC,Y,06202008 bactisample,20802019AA,OR4100350,DIST-A,A,STATE,OR100033,Well Tap,RT,,,TC,Y,06202008 bactisample,20802024AA,OR4100342,DIST-A,A,STATE,OR100033,2137 SW Mendi Way,RT,,0.64,TC,Y,06202008 bactiresult,20802016AA,06202008,OR4195079,STATE,OR100033,3100,06232008,A,COLILERT,A bactiresult,20802017AA,06202008,OR4101020,STATE,OR100033,3100,06232008,A,COLILERT,A bactiresult,20802018AA,06202008,OR4100341,STATE,OR100033,3100,06232008,A,COLILERT,A bactiresult,20802019AA,06202008,OR4100350,STATE,OR100033,3100,06232008,A,COLILERT,A bactiresult,20802024AA,06202008,OR4100342,STATE,OR100033,3100,06232008,A,9222B,A Here is the XML file. I am going to paste the whole thing and hope it doesn't slow down the internet too much. Any insites on how to parse this file with PHP into some sort of loop we can use to validate every item would be very helpful. ?xml version=1.0 encoding=UTF-8? EN:eDWR xmlns:EN=urn:us:net:exchangenetwork xmlns:SDWIS=http://www.epa.gov/sdwis; xmlns:ns3=http://www.epa.gov/xml; xmlns:xsi= http://www.w3.org/2001/XMLSchema-instance; EN:Submission EN:submissionFileCreatedDate=2008-06-23 EN:submissionFileName=CSV_06-23-2008_1_35_53PM.csv EN:submissionID=53 EN:LabReport EN:LabIdentification EN:LabAccreditation EN:LabAccreditationIdentifierOR100033/EN:LabAccreditationIdentifier EN:LabAccreditationAuthorityNameSTATE/EN:LabAccreditationAuthorityName /EN:LabAccreditation /EN:LabIdentification EN:Sample EN:SampleIdentification EN:LabSampleIdentifier20802016AA/EN:LabSampleIdentifier EN:PWSIdentifierOR4195079/EN:PWSIdentifier EN:PWSFacilityIdentifierDIST-A/EN:PWSFacilityIdentifier EN:SampleRuleCodeTC/EN:SampleRuleCode EN:SampleMonitoringTypeCodeRT/EN:SampleMonitoringTypeCode EN:ComplianceSampleIndicatorY/EN:ComplianceSampleIndicator EN:SampleCollectionEndDate2008-06-20/EN:SampleCollectionEndDate EN:SampleComments EN:CommentsKitchen Sink/EN:Comments /EN:SampleComments /EN:SampleIdentification EN:SampleLocationIdentification EN:SampleLocationIdentifierA/EN:SampleLocationIdentifier /EN:SampleLocationIdentification /EN:Sample EN:Sample EN:SampleIdentification EN:LabSampleIdentifier20802017AA/EN:LabSampleIdentifier EN:PWSIdentifierOR4101020/EN:PWSIdentifier EN:PWSFacilityIdentifierDIST-A/EN:PWSFacilityIdentifier EN:SampleRuleCodeTC/EN:SampleRuleCode EN:SampleMonitoringTypeCodeRT/EN:SampleMonitoringTypeCode EN:ComplianceSampleIndicatorY/EN:ComplianceSampleIndicator EN:SampleCollectionEndDate2008-06-20/EN:SampleCollectionEndDate EN:SampleComments EN:CommentsMobile SP# 8/EN:Comments /EN:SampleComments /EN:SampleIdentification EN:SampleLocationIdentification EN:SampleLocationIdentifierA/EN:SampleLocationIdentifier /EN:SampleLocationIdentification /EN:Sample EN:Sample EN:SampleIdentification EN:LabSampleIdentifier20802018AA/EN:LabSampleIdentifier EN:PWSIdentifierOR4100341/EN:PWSIdentifier EN:PWSFacilityIdentifierDIST-A/EN:PWSFacilityIdentifier EN:SampleRuleCodeTC/EN:SampleRuleCode EN:SampleMonitoringTypeCodeRT/EN:SampleMonitoringTypeCode EN:ComplianceSampleIndicatorY/EN:ComplianceSampleIndicator EN:SampleCollectionEndDate2008-06-20/EN:SampleCollectionEndDate EN:SampleComments EN:CommentsWell Tap/EN:Comments /EN:SampleComments /EN:SampleIdentification EN:SampleLocationIdentification EN:SampleLocationIdentifierA/EN:SampleLocationIdentifier /EN:SampleLocationIdentification /EN:Sample EN:Sample EN:SampleIdentification EN:LabSampleIdentifier20802019AA/EN:LabSampleIdentifier EN:PWSIdentifierOR4100350/EN:PWSIdentifier EN:PWSFacilityIdentifierDIST-A/EN:PWSFacilityIdentifier EN:SampleRuleCodeTC/EN:SampleRuleCode EN:SampleMonitoringTypeCodeRT/EN:SampleMonitoringTypeCode
Re: [PHP] segfault help
On Fri, Jun 27, 2008 at 11:03 AM, Daniel Brown [EMAIL PROTECTED] wrote: On Fri, Jun 27, 2008 at 11:57 AM, Tim Rupp [EMAIL PROTECTED] wrote: ./configure --enable-force-cgi-redirect --enable-debug --disable-rpath --enable-inline-optimization --with-bz2 --with-db4=/usr --with-curl --with-gd --enable-gd-native-ttf --without-gdbm --with-gettext --with-ncurses --with-gmp --with-iconv --with-openssl --with-regex=system --with-zlib --with-layout=GNU --enable-bcmath --enable-exif --enable-ftp --enable-magic-quotes --enable-safe-mode --enable-sockets --enable-sysvsem --enable-sysvshm --enable-wddx --with-kerberos --with-ldap=shared --with-mysql=shared --enable-mbstring=all --with-apxs2=/usr/sbin/apxs --with-pgsql=shared --with-mysqli --with-freetype-dir=/usr/include/freetype2 --with-mcrypt --enable-soap --enable-sigchild --enable-pcntl it was compiled on a RHEL 4.2 machine. I compiled 5.2.6 to see if that would fix it, but no change. This is just a way outside guess, but try recompiling (either version) with the same ./configure, but removing '--enable-inline-optimization'. -- /Daniel P. Brown Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just $59.99/mo. with no contract! Dedicated servers, VPS, and hosting from $2.50/mo. Well, no luck with the removal of inline, but I'll leave it removed since it appears to be an artifact from way back when (we tend to keep dragging this config file with us through the generations). Now, here's something weird, maybe someone can explain this. When compiled with --enable-debug, I don't see the Segmentation fault message on the cli. When I compile with --disable-debug, I see the error message. gdb too reports no error when debug is enabled. -Tim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] unset and circular references
Abu Warez wrote: --- On Fri, 6/27/08, Thijs Lensselink [EMAIL PROTECTED] wrote: From: Thijs Lensselink [EMAIL PROTECTED] Subject: Re: [PHP] unset and circular references To: php-general@lists.php.net Date: Friday, June 27, 2008, 5:21 PM Quoting Abu Warez [EMAIL PROTECTED]: I think this happens because there is still a reference to the B object. According to the manual : The destructor method will be called as soon as all references to a particular object are removed or when the object is explicitly destroyed or in any order in shutdown sequence. So as long as A has a reference to B the __destructor will not be called. I think you mean: As long as B has a ref to A (which, indeed, creates B), the destructor of A will not be called. My bad. that's what i meant. I agree with that, but in this case the garbage collector should detect that the reference to object $a is from an object $m_b which is created (and maintained) again by the first object $a. In other words, if object $a is not needed then its member $m_b (which has a reference to $a) is not needed neither. So in this case, in my opinion, if one wants to destory object $a then the reference from $m_b to $a should not count. That would still leave a reference from B to A. That's why it doesn't get unset. If you unset B before unsetting A the problem is resolved. This issue is really frustrating because because in my code I have something like (where $a is of type class A): for ( $id ... ) { $a = daoMyClass-LoadById( $id ); modify $a ... /* persist modified $a */ daoMyClass-Update( $a ); unset( $a ); } unset, as stated, does not destroy $a and all the loaded $a's remain in memory until the script ends. Rising the memory limit is not a solution because the count of $a objects grows between script calls. Any ideas? Thx, Abu -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] segfault help
On Fri, Jun 27, 2008 at 1:00 PM, Tim Rupp [EMAIL PROTECTED] wrote: --enable-soap --enable-sigchild --enable-pcntl Drop out '--enable-sigchild', too, unless you're using Oracle. -- /Daniel P. Brown Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just $59.99/mo. with no contract! Dedicated servers, VPS, and hosting from $2.50/mo. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: Inspiration for a Tombstone.
At 9:52 AM -0500 6/27/08, Boyd, Todd M. wrote: I think you guys are missing something: he wrote it with single equals signs on purpose. He was demonstrating how the one with the constant to the right of the assignment operator is a valid statement... and that putting the constant first will aid you in finding such mistakes. No question -- I missed the intent. But in my defense, a single equal sign in an if statement stands out like a red flag to me and thus I really don't need help finding it. When my code craters, it's usually for things other than that. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help with login
if (isset($_COOKIE[auth]) !isset($_GET[page])) { include($GLOBALS['admin_index']); die(); } Your script is awfully insecure. $_COOKIE is user supplied, so in if I hand craft a request, I could just send an auth cookie which is set to 1. Relying on people not knowing is not good, especially as you've just posted you authentictaion method to the world. At the very least switch to storing the fact that the user is authed to the session. Eg: if (!empty($_SESSION[auth]) empty($_GET[page])) { include($GLOBALS['admin_index']); die(); } -- Richard Heyes -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Re: Re: Re: Military Service WAS [PHP] Capitalization of variable
Am 2008-06-24 15:10:49, schrieb Per Jessen: Dotan Cohen wrote: What is the English/French name of the French non-Frenchmen reserve army? They are very well respected. The French Foreign Legion?? I wouldn't call that a reserve army. :-) We are always the first ones... Worldwide! We can even react many times faster then the whole US-Army. ;-) Thanks, Greetings and nice Day/Evening Michelle Konzack Systemadministrator 24V Electronic Engineer Tamay Dogan Network Debian GNU/Linux Consultant -- Linux-User #280138 with the Linux Counter, http://counter.li.org/ # Debian GNU/Linux Consultant # Michelle Konzack Apt. 917 ICQ #328449886 +49/177/935194750, rue de Soultz MSN LinuxMichi +33/6/61925193 67100 Strasbourg/France IRC #Debian (irc.icq.com) signature.pgp Description: Digital signature
[PHP] Re: (*OT) What we are going to do about those OT's?
Hi Tedd, Am 2008-06-23 12:29:17, schrieb tedd: Interesting concept. In other words, have a domain/subscription where people can register and then record all the places where they would like notified in case of their death. It could hold a bunch of different things that you would want released/said after you die. Such as notices to your attorney, life-insurances, email to people you like/dislike, and so on. The only fly in the ointment would be how to notify your account that you are dead? Might have difficulty detecting that, at least just yet. :-) Since most of use always the same E-Mail, write a small script and let it run as cronjob on your ISPs server. The script use google to do an advanced search on your E-Mail based on the last 7 days... If there is no E-Mail withing 7 days, it will frlush your I-AM-DEAD mail spool... My sister-in-law has a pacemaker hooked up to a wireless connection to a local hospital. If something happens, the hospital responds. ??? You have a sister-in-law with Tele-Commande? And what about the liability that a death notice might be accidentally sent out? That might prove exciting, huh? It's an interesting idea. Thanks, Greetings and nice Day/Evening Michelle Konzack Systemadministrator 24V Electronic Engineer Tamay Dogan Network Debian GNU/Linux Consultant -- Linux-User #280138 with the Linux Counter, http://counter.li.org/ # Debian GNU/Linux Consultant # Michelle Konzack Apt. 917 ICQ #328449886 +49/177/935194750, rue de Soultz MSN LinuxMichi +33/6/61925193 67100 Strasbourg/France IRC #Debian (irc.icq.com) signature.pgp Description: Digital signature
[PHP] Re: Re: Re: Re: Military Service WAS [PHP] Capitalization of variable
Am 2008-06-23 21:17:13, schrieb Dotan Cohen: 2008/6/22 Michelle Konzack [EMAIL PROTECTED]: I know at least on Jew, which was 1 1/2 years in the french army for his service national and then 5 years in Israel. That was very likely not compulsory service. Especially if he served years. He has French citizenship and is Jew like many others here. And they all go to Israel to serv since the have the choice/right, to do the national service in France or in Israel... What is the English/French name of the French non-Frenchmen reserve army? They are very well respected. Légion Etrangère Français = French Foreign Legion Thanks, Greetings and nice Day/Evening Michelle Konzack Systemadministrator 24V Electronic Engineer Tamay Dogan Network Debian GNU/Linux Consultant -- Linux-User #280138 with the Linux Counter, http://counter.li.org/ # Debian GNU/Linux Consultant # Michelle Konzack Apt. 917 ICQ #328449886 +49/177/935194750, rue de Soultz MSN LinuxMichi +33/6/61925193 67100 Strasbourg/France IRC #Debian (irc.icq.com) signature.pgp Description: Digital signature
[PHP] Re: Fwd: How to make a Auto View and a Download Link for PDF?
Hi Nitsan, Am 2008-06-22 22:09:38, schrieb Nitsan Bin-Nun: Oops :-) -- Forwarded message -- From: Nitsan Bin-Nun [EMAIL PROTECTED] Date: 21 Jun 2008 19:23 Subject: Re: [PHP] How to make a Auto View and a Download Link for PDF? To: Michelle Konzack [EMAIL PROTECTED] I am not 100 percent sure that i have understood your idea, but if i did you can place the PDF for online view with content-disposition header* ** Content-Disposition: inline; filename=pdf1.pdf * replace the *inline* with *attachment* and you get the save as dialog More simple was not possible... It works perfectly. Thanks, Greetings and nice Day/Evening Michelle Konzack Systemadministrator 24V Electronic Engineer Tamay Dogan Network Debian GNU/Linux Consultant -- Linux-User #280138 with the Linux Counter, http://counter.li.org/ # Debian GNU/Linux Consultant # Michelle Konzack Apt. 917 ICQ #328449886 +49/177/935194750, rue de Soultz MSN LinuxMichi +33/6/61925193 67100 Strasbourg/France IRC #Debian (irc.icq.com) signature.pgp Description: Digital signature
Re: [PHP] Help with login
On Fri, Jun 27, 2008 at 1:36 PM, Richard Heyes [EMAIL PROTECTED] wrote: if (isset($_COOKIE[auth]) !isset($_GET[page])) { include($GLOBALS['admin_index']); die(); } Your script is awfully insecure. $_COOKIE is user supplied, so in if I hand craft a request, I could just send an auth cookie which is set to 1. Relying on people not knowing is not good, especially as you've just posted you authentictaion method to the world. It should also be noted that this code: ?php // Check for previous authentication if (isset($_COOKIE[auth]) isset($_GET[page])) { include($_GET[page]..php); die(); } ? is EXTREMELY dangerous. When I perform pen testing for websites, one of the first things I do is check to see if I can include other files. Because from there, I can gain privilege escalation by forcing an upload and calling the file directly. I've broken literally hundreds of websites this way --- no joke. NEVER leave it up to the user to decide what they can access. Always expect specific input and handle (and filter!) it accordingly. If something comes up that you don't expect, force it to error out. You'll be sorry otherwise. -- /Daniel P. Brown Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just $59.99/mo. with no contract! Dedicated servers, VPS, and hosting from $2.50/mo. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] fwrite() Append Files
Hi, Right now I enforced the file to read in through HTTP-Request and output it to a local file. Looks like this functioned perfectly after I used append functions after I attempted to write to the file! Thanks to everyone who contributed to this. Alice == Alice Wei MIS 2009 School of Library and Information Science Indiana University Bloomington [EMAIL PROTECTED] From: Jim Lucas [EMAIL PROTECTED] Sent: Friday, June 27, 2008 12:45 PM To: Wei, Alice J. Cc: Per Jessen; php-general@lists.php.net Subject: Re: [PHP] fwrite() Append Files Jim Lucas wrote: Wei, Alice J. wrote: Hi, This is my current code: $lines = file(http://www.mysite.com/hello.txt;); $file=http://www.mysite.com/hello.txt;; You are referring to the file from the website point of view. You must access it from the filesystem point of view $file = '/path/to/public_html/hello.txt'; $ourFileName = hello.txt; $ourFileHandle = fopen($ourFileName, 'wb') or die(can't open file); fclose($ourFileHandle); $newFileName=http://www.yoursite.com/hello.txt;; Same thing here. You are never going to be able to write to that file. The webserver will never allow it. I guess I should have suggested a work around in this case. You will need to create the file locally and then transfer via ftp/scp/etc... the newly created file to the remote server. I built an FTP client once with PHP using the built in FTP functions. You will probably need to do something similar. echo $newFileName; $result=rename($ourFileName, $newFileName); $ourFileHandle = fopen($ourFileName, 'wb') or die(can't open file); // Loop through our array, show HTML source as HTML source; and line numbers too. foreach ($lines as $line_num = $line) { echo pLine #b{$line_num}/b : . htmlspecialchars($line) . /p; $ourFileHandle = fopen($newFileName, 'wb') or die(can't open file); $content=fwrite($ourFileHandle, htmlspecialchars($line)); echo pThe line: $content has been written into $newFilename/p; } fclose($ourFileHandle); Do you mean to edit $ourFileHandle to fopen($ourFileName, 'wba')? What I really wanted to do is to copy the file directory from $file to $newFileName directory using the cp command or something, but if I cannot do that, writing in and out of the file may be good enough. Alice == Alice Wei MIS 2009 School of Library and Information Science Indiana University Bloomington [EMAIL PROTECTED] From: Per Jessen [EMAIL PROTECTED] Sent: Friday, June 27, 2008 8:26 AM To: php-general@lists.php.net Subject: Re: [PHP] fwrite() Append Files Wei, Alice J. wrote: Hi, I wonder if anyone on the list could tell me how to append the files as I am writing in them. I have a file that has no more than five characters per line, and I would like to keep its spacing between the lines. Right now I have the set up so that it could write in the first line, but the problem is that all the lines after it never get written in to the desired file. You need to open the file in append mode = 'a+'. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Jim Lucas Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them. Twelfth Night, Act II, Scene V by William Shakespeare -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: Inspiration for a Tombstone.
On Fri, 2008-06-27 at 09:52 -0500, Boyd, Todd M. wrote: -Original Message- From: Jay Blanchard [mailto:[EMAIL PROTECTED] Sent: Friday, June 27, 2008 8:50 AM To: tedd; php-general@lists.php.net Subject: RE: [PHP] Re: Inspiration for a Tombstone. [snip] And being dyslexic, I knew the 'Dan S' should have come first, but didn't immediately recognize it as I was rushing to point out a double equal-sign boo-boo made by Col. [/snip] Had Col used the method we're speaking of here the error would have been thrown and he would have found the culprit post haste. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php I think you guys are missing something: he wrote it with single equals signs on purpose. He was demonstrating how the one with the constant to the right of the assignment operator is a valid statement... and that putting the constant first will aid you in finding such mistakes. if(constant = $variable){} // bombs, and lets you know right away you missed an = if($variable = constant){} // assigns rather than compares, but nonetheless is valid code To quote Colin: As I very humorously hinted at in a earlier mail on this thread, it is a very, very good idea to get into the habit of putting constants *first* in if/while/etc statements. So, I'm sure he is well familiar with this method we're speaking of. :) I will never do it... it looks ugly, especially when performing multiple if comparisons on the variable. Additionally, using a little red to highlight the assignment operator but not the comparison operator works just as well. Make machines work for you, not the other way around. Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] fwrite() Append Files
Wei, Alice J. wrote: Hi, Right now I enforced the file to read in through HTTP-Request and output it to a local file. Looks like this functioned perfectly after I used append functions after I attempted to write to the file! Thanks to everyone who contributed to this. Alice Are you making sure to credit the work and suggestions in your code as required by your class documentation standards? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] fwrite() Append Files
From: Wolf [EMAIL PROTECTED] Sent: Friday, June 27, 2008 2:18 PM To: Wei, Alice J. Cc: php-general@lists.php.net Subject: Re: [PHP] fwrite() Append Files Wei, Alice J. wrote: Hi, Right now I enforced the file to read in through HTTP-Request and output it to a local file. Looks like this functioned perfectly after I used append functions after I attempted to write to the file! Thanks to everyone who contributed to this. Alice Are you making sure to credit the work and suggestions in your code as required by your class documentation standards? I am working for my client who wants to get some tasks done. Had this been for an assignment for a class, I would probably have to contact my instructor about it. Thanks for pointing it out. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] [Q] Exec'ing a command
Hopefully this will be clear. I've got a unix command-line app which I will be exec'ing (or some other similar command) from a php script. The special property of this unix app is that while it executes and terminates quickly, only a single instance can be running at any one time. However, the php script can be called simultaneously and it is possible that an invalid attempt to run two or more instances of the unix app at the same time could be made. Now, one possible solution to this problem is that the php script adds it's request to run the unix app to a queue and their is some other code which pulls a request off the queue, performs the operation and returns the data back to the php script which made the request. Are there other solutions that I have not considered? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] [Q] Exec'ing a command
On Fri, Jun 27, 2008 at 3:12 PM, Eric Gorr [EMAIL PROTECTED] wrote: Now, one possible solution to this problem is that the php script adds it's request to run the unix app to a queue and their is some other code which pulls a request off the queue, performs the operation and returns the data back to the php script which made the request. Are there other solutions that I have not considered? Can you just add the commands to a database, and have the commands read from there and run via cron job every n minutes? That would ensure that the *NIX file will only be run with a single instance, but run over and over again. -- /Daniel P. Brown Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just $59.99/mo. with no contract! Dedicated servers, VPS, and hosting from $2.50/mo. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] [Q] Exec'ing a command
On Jun 27, 2008, at 3:18 PM, Daniel Brown wrote: On Fri, Jun 27, 2008 at 3:12 PM, Eric Gorr [EMAIL PROTECTED] wrote: Now, one possible solution to this problem is that the php script adds it's request to run the unix app to a queue and their is some other code which pulls a request off the queue, performs the operation and returns the data back to the php script which made the request. Are there other solutions that I have not considered? Can you just add the commands to a database, and have the commands read from there and run via cron job every n minutes? That would ensure that the *NIX file will only be run with a single instance, but run over and over again. Sure. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Fwd: How to make a Auto View and a Download Link for PDF?
Great. Cheers, Nitsan On 25/06/2008, Michelle Konzack [EMAIL PROTECTED] wrote: Hi Nitsan, Am 2008-06-22 22:09:38, schrieb Nitsan Bin-Nun: Oops :-) -- Forwarded message -- From: Nitsan Bin-Nun [EMAIL PROTECTED] Date: 21 Jun 2008 19:23 Subject: Re: [PHP] How to make a Auto View and a Download Link for PDF? To: Michelle Konzack [EMAIL PROTECTED] I am not 100 percent sure that i have understood your idea, but if i did you can place the PDF for online view with content-disposition header* ** Content-Disposition: inline; filename=pdf1.pdf * replace the *inline* with *attachment* and you get the save as dialog More simple was not possible... It works perfectly. Thanks, Greetings and nice Day/Evening Michelle Konzack Systemadministrator 24V Electronic Engineer Tamay Dogan Network Debian GNU/Linux Consultant -- Linux-User #280138 with the Linux Counter, http://counter.li.org/ # Debian GNU/Linux Consultant # Michelle Konzack Apt. 917 ICQ #328449886 +49/177/935194750, rue de Soultz MSN LinuxMichi +33/6/61925193 67100 Strasbourg/France IRC #Debian (irc.icq.com)
Re: [PHP] Re: Re: Re: Re: Military Service WAS [PHP] Capitalization of variable
2008/6/25 Michelle Konzack [EMAIL PROTECTED]: Am 2008-06-23 21:17:13, schrieb Dotan Cohen: 2008/6/22 Michelle Konzack [EMAIL PROTECTED]: I know at least on Jew, which was 1 1/2 years in the french army for his service national and then 5 years in Israel. That was very likely not compulsory service. Especially if he served years. He has French citizenship and is Jew like many others here. And they all go to Israel to serv since the have the choice/right, to do the national service in France or in Israel... I still do not believe that he had to do 5 years in the IDF by Israeli law. Unless he signed up as an officer, which he could have chosen not to do. What is the English/French name of the French non-Frenchmen reserve army? They are very well respected. Légion Etrangère Français = French Foreign Legion Thanks. _That_ is an army that I very much respect. Dotan Cohen http://what-is-what.com http://gibberish.co.il א-ב-ג-ד-ה-ו-ז-ח-ט-י-ך-כ-ל-ם-מ-ן-נ-ס-ע-ף-פ-ץ-צ-ק-ר-ש-ת A: Because it messes up the order in which people normally read text. Q: Why is top-posting such a bad thing?
[PHP] localconv() monetary grouping
Looking through the PHP 5 docs regarding the information returned by localconv(), I am not sure what the 'grouping' and 'mon_grouping' elements refer to. Can someone explain to me why in the example shown ('[EMAIL PROTECTED]'), the grouping array is empty and the mon_grouping array has two elements of '3' each. Thanks, Ian. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php