php-general Digest 26 Jun 2009 12:41:31 -0000 Issue 6196
-0500, Shawn McKenzie wrote: Shawn McKenzie wrote: Govinda wrote: I need to parse those URLs and set the value of $myfolder to as follows: domain.com/unix/asdfsdf.html $myfolder=unix domain.com/macos/khsdfg.html $myfolder=macos BUT if there is no dir/ in between the domain and file, like so: domain.com/khsdfg.html then I want: $myfolder=default No way, you want to parse the url? How about, parse_url()? Or something like: /* UNTESTED */ $myfolder = 'default'; if (preg_match ('@^[^/]+/([^/]+)/@', $url, $m) { $myfolder = $m[1]; } or: /* UNTESTED */ $myfolder = 'default'; $parts = explode ('/', $url); if (count ($parts) 2) { $myfolder = $parts[1]; } Oh, and in the future, if you want to strip the slashes from a var, you would use the remove_escape_char() function :-) Is there a manual page for that? /Nisse ---End Message--- ---BeginMessage--- Hi guys: Now days I want to develop a web application like a chat room. the requests per seconds maybe very large, so I want to save some common info into to memory (quick access). So, I want to know does php have the follow features or implement them in other ways. 1. server scope objects, mostly like application in jsp. // the most important~ 2. multithread synchronize. 3. I want to start a thread timed execute, like Timer in java thanks -- Best Regards! Wen Dong ---End Message--- ---BeginMessage--- PHP doesn't support threading. On Thu, Jun 25, 2009 at 10:59 PM, WenDong Zhangzwd2...@gmail.com wrote: Hi guys: Now days I want to develop a web application like a chat room. the requests per seconds maybe very large, so I want to save some common info into to memory (quick access). So, I want to know does php have the follow features or implement them in other ways. 1. server scope objects, mostly like application in jsp. // the most important~ 2. multithread synchronize. 3. I want to start a thread timed execute, like Timer in java thanks -- Best Regards! Wen Dong ---End Message--- ---BeginMessage--- No, it doesn't at this time. Have you looked into Quercus? -Original Message- From: Eddie Drapkin [mailto:oorza...@gmail.com] Sent: Thursday, June 25, 2009 11:42 PM To: WenDong Zhang Cc: php-gene...@lists.php.net Subject: Re: [PHP] Does php have multithread, shared object(like jsp application) PHP doesn't support threading. On Thu, Jun 25, 2009 at 10:59 PM, WenDong Zhangzwd2...@gmail.com wrote: Hi guys: Now days I want to develop a web application like a chat room. the requests per seconds maybe very large, so I want to save some common info into to memory (quick access). So, I want to know does php have the follow features or implement them in other ways. 1. server scope objects, mostly like application in jsp. // the most important~ 2. multithread synchronize. 3. I want to start a thread timed execute, like Timer in java thanks -- Best Regards! Wen Dong -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php __ Information from ESET Smart Security, version of virus signature database 4190 (20090626) __ The message was checked by ESET Smart Security. http://www.eset.com ---End Message--- ---BeginMessage--- hello all, Is there anyway in php by which i can get the total play time of a mp3 , I found some information while doing the google thing using some 3rd party plug ins like getID3 but without any luck, Any help in this case would be helpful. Thank you. Regards, Gautam Bhatia . ---End Message--- ---BeginMessage--- Hello fellow coders... THE 'KING OF POP' IS DEAD ! Tonight (here in Germany), Mr. Michael Joseph Jackson, also known as 'the king of pop', died on heart failure in the age of 50. I just want to express my condolences to his family and friends and all the people who loved him and his music. This incomparable legendary musician has made such a big impact on music and musicians than any other artist in history. Rest in peace, Mr. Jackson! And may you and your music never be forgotten... YT BB (a drummer) PS: I know, this thread usually is of some funny nature, so I opologize for this mood killing post and I hope you understand [Björn Bartels ] [email : bart...@dragon-projects.de ] [home : http://dragon-projects.de ] [skype : bb-drummer ] [icq : 283827160 ] [--- ] Diese E-Mail könnte vertrauliche und/oder rechtlich geschützte Informationen enthalten. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail sind nicht gestattet. This e-mail may contain confidential and/or privileged information. If you are not the intended
RE: [PHP] Does php have multithread, shared object(like jsp application)
No, it doesn't at this time. Have you looked into Quercus? -Original Message- From: Eddie Drapkin [mailto:oorza...@gmail.com] Sent: Thursday, June 25, 2009 11:42 PM To: WenDong Zhang Cc: php-general@lists.php.net Subject: Re: [PHP] Does php have multithread, shared object(like jsp application) PHP doesn't support threading. On Thu, Jun 25, 2009 at 10:59 PM, WenDong Zhangzwd2...@gmail.com wrote: Hi guys: Now days I want to develop a web application like a chat room. the requests per seconds maybe very large, so I want to save some common info into to memory (quick access). So, I want to know does php have the follow features or implement them in other ways. 1. server scope objects, mostly like application in jsp. // the most important~ 2. multithread synchronize. 3. I want to start a thread timed execute, like Timer in java thanks -- Best Regards! Wen Dong -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php __ Information from ESET Smart Security, version of virus signature database 4190 (20090626) __ The message was checked by ESET Smart Security. http://www.eset.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] This Friday's OT Thread
Hello fellow coders... THE 'KING OF POP' IS DEAD ! Tonight (here in Germany), Mr. Michael Joseph Jackson, also known as 'the king of pop', died on heart failure in the age of 50. I just want to express my condolences to his family and friends and all the people who loved him and his music. This incomparable legendary musician has made such a big impact on music and musicians than any other artist in history. Rest in peace, Mr. Jackson! And may you and your music never be forgotten... YT BB (a drummer) PS: I know, this thread usually is of some funny nature, so I opologize for this mood killing post and I hope you understand [Björn Bartels ] [email : bart...@dragon-projects.de ] [home : http://dragon-projects.de ] [skype : bb-drummer ] [icq : 283827160 ] [--- ] Diese E-Mail könnte vertrauliche und/oder rechtlich geschützte Informationen enthalten. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail sind nicht gestattet. This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden. [--- ] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] What does this mean?
Hey all, I'm new to the list and I have a question... What does = mean? The book I am reading is called Programming PHP published by O'Reilly. I haven't read the whole book yet. I was flipping through the pages and in the book there is mention of = (less than or equal) and = (greater than or equal)but it doesn't say what = is even though it is used numerous times in the example code. Thanks Jason -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Fwd: [PHP] What does this mean?
Just getting this back on the list . -- Forwarded message -- From: Eddie Drapkin oorza...@gmail.com Date: Fri, Jun 26, 2009 at 2:36 AM Subject: Re: [PHP] What does this mean? To: Jason Carson ja...@jasoncarson.ca It's used in key value combinations in several places. When building an array: $foo = array('key' = 'value', 'another_key' = 'another value'); which will give you an array that looks like $foo['key'] = 'value'; $foo['another_key'] = 'another_value'; Also, in foreach(), which is a language construct used to iterate over arrays: foreach($foo as $key = $val) { echo The key for this element is $key and the value is $val\n; } will output: The key for this element is key and the value is value The key for this element is another_key and the value is another_value Those are the two most common places you'll see it (and perhaps the only, I don't want to speak conclusively, though, I'm awfully tired this evening!) On Fri, Jun 26, 2009 at 2:31 AM, Jason Carsonja...@jasoncarson.ca wrote: Hey all, I'm new to the list and I have a question... What does = mean? The book I am reading is called Programming PHP published by O'Reilly. I haven't read the whole book yet. I was flipping through the pages and in the book there is mention of = (less than or equal) and = (greater than or equal)but it doesn't say what = is even though it is used numerous times in the example code. Thanks Jason -- 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 doesn't see php.ini
-Original Message- From: Tir [mailto:tirsa...@yandex.ru] Sent: 25 June 2009 08:48 PM To: php-general@lists.php.net Subject: Re: [PHP] PHP doesn't see php.ini Presume you did restart apache after making the change? Of course Is there anything in your phpinfo output that relates to your php.ini? I think there must be a mention of MySQL because i've enabled it. But it isn't there. Maybe some error near the beginning of php.ini causes php to stop loading the ini file? I use a copy of php.ini-recommended from PHP distributive. I don't think that there could be errors. I've only uncommented few strings to enable MySQL extensions, set display_errors on and changed extension_dir. Check that the extension_dir in phpinfo agrees with the extension_dir in your php.ini. It agrees. Maybe try enabling error logging in the php.ini and check the log file - I use apache\logs\phperror.log and invalid extension loading is definitely reported there (I've had this problem before). That's it, i think. I've enabled display_startup_errors and now on start apache i receive errors. PHP can't find libraries of MySQL extensions. But this libraries exactly exist in folder that indicated in error messages. What that could be? -- Does mysql run from the command line? You can also download MySQL Administrator from mysql.com and see if it can connect to mysql. Cheers Arno -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: point me to functions to parse the URL? (best one for *this*job?)
On Thu, 25 Jun 2009 18:20:36 -0500, Shawn McKenzie wrote: Shawn McKenzie wrote: Govinda wrote: I need to parse those URLs and set the value of $myfolder to as follows: domain.com/unix/asdfsdf.html $myfolder=unix domain.com/macos/khsdfg.html $myfolder=macos BUT if there is no dir/ in between the domain and file, like so: domain.com/khsdfg.html then I want: $myfolder=default No way, you want to parse the url? How about, parse_url()? Or something like: /* UNTESTED */ $myfolder = 'default'; if (preg_match ('@^[^/]+/([^/]+)/@', $url, $m) { $myfolder = $m[1]; } or: /* UNTESTED */ $myfolder = 'default'; $parts = explode ('/', $url); if (count ($parts) 2) { $myfolder = $parts[1]; } Oh, and in the future, if you want to strip the slashes from a var, you would use the remove_escape_char() function :-) Is there a manual page for that? /Nisse -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: idiot proofing
Hello, on 06/24/2009 09:24 PM Shawn McKenzie said the following: What about placing the contents in different divs and showing hiding those divs on submit? Then using AJAX to update the server / database with the requested operation? That's a good one, however I'm assuming you haven't been following PJ's posts :-) Once he tries AJAX, I feel for the js.general and ajax.general folks! Not necesssarily. You may want to try this scaffolding component that lets you create CRUD (Create, Read, Update, Delete) forms without writing a single line of Javascript, all with AJAX support, so it submits the forms to the server without page reloading. Actually this a plug-in of the Forms Generation and Validation class, that generates all the necessary Javascript transparently for you. You can compose any forms with any custom inputs, and save data to databases or any other type of storage. Take a look at this live example: http://www.meta-language.net/forms-examples.html?example=test_scaffolding_input The main forms class and the optional plug-ins are available from here: http://www.phpclasses.org/formsgeneration -- Regards, Manuel Lemos Find and post PHP jobs http://www.phpclasses.org/jobs/ PHP Classes - Free ready to use OOP components written in PHP http://www.phpclasses.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to sort a two-D ARRAY
On Thursday 25 June 2009 21:38:24 Ashley Sheridan wrote: On Wed, 2009-06-24 at 15:23 -0700, salmarayan wrote: Can Anyone tell me how to sort two D Array in Descending Order for example like this one based on the gain Array ( [0] = Array ( [company_name] =X [gain] = 0.2 ) [1] = Array ( [company_name] = y[gain] = 0.34 )[2]1] = Array ( [company_name] =z[gain] = 2 ) ) Thanks in advance -- View this message in context: http://www.nabble.com/How-to-sort-a-two-D-ARRAY-tp24193925p24193925.html Sent from the PHP - General mailing list archive at Nabble.com. stw http://us3.php.net/manual/en/function.array-multisort.php Thanks Ash www.ashleysheridan.co.uk in this case salmarayan whanted to sotr by one specific feeld of sub array. http://us3.php.net/manual/en/function.uasort.php should be used. -- Best regards, Isia [isj^] (Isataev Vladimir) ICQ: 305832316 CEL: +38 (067) 58-68-148 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] This Friday's OT Thread
Farah Fawcett has also died. I guess you gotta go sometime :| Björn Bartels wrote: Hello fellow coders... THE 'KING OF POP' IS DEAD ! Tonight (here in Germany), Mr. Michael Joseph Jackson, also known as 'the king of pop', died on heart failure in the age of 50. I just want to express my condolences to his family and friends and all the people who loved him and his music. This incomparable legendary musician has made such a big impact on music and musicians than any other artist in history. Rest in peace, Mr. Jackson! And may you and your music never be forgotten... YT BB (a drummer) PS: I know, this thread usually is of some funny nature, so I opologize for this mood killing post and I hope you understand [Björn Bartels ] [email : bart...@dragon-projects.de ] [home : http://dragon-projects.de ] [skype : bb-drummer ] [icq : 283827160 ] [--- ] Diese E-Mail könnte vertrauliche und/oder rechtlich geschützte Informationen enthalten. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail sind nicht gestattet. This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden. [--- ] -- 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] This Friday's OT Thread
and Kaleem Omar. and 15 people in Baghdad when motorcycle loaded with nails and ball-bearings exploded in a crowded bazaar. On 6/26/09 4:27 AM, Robert Cummings rob...@interjinn.com wrote: Farah Fawcett has also died. I guess you gotta go sometime :| Björn Bartels wrote: Hello fellow coders... THE 'KING OF POP' IS DEAD ! Tonight (here in Germany), Mr. Michael Joseph Jackson, also known as 'the king of pop', died on heart failure in the age of 50. I just want to express my condolences to his family and friends and all the people who loved him and his music. This incomparable legendary musician has made such a big impact on music and musicians than any other artist in history. Rest in peace, Mr. Jackson! And may you and your music never be forgotten... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] This Friday's OT Thread
:( Tom Worster wrote: and Kaleem Omar. and 15 people in Baghdad when motorcycle loaded with nails and ball-bearings exploded in a crowded bazaar. On 6/26/09 4:27 AM, Robert Cummings rob...@interjinn.com wrote: Farah Fawcett has also died. I guess you gotta go sometime :| Björn Bartels wrote: Hello fellow coders... THE 'KING OF POP' IS DEAD ! Tonight (here in Germany), Mr. Michael Joseph Jackson, also known as 'the king of pop', died on heart failure in the age of 50. I just want to express my condolences to his family and friends and all the people who loved him and his music. This incomparable legendary musician has made such a big impact on music and musicians than any other artist in history. Rest in peace, Mr. Jackson! And may you and your music never be forgotten... -- 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] This Friday's OT Thread
2009/6/26 Robert Cummings rob...@interjinn.com: :( Tom Worster wrote: and Kaleem Omar. and 15 people in Baghdad when motorcycle loaded with nails and ball-bearings exploded in a crowded bazaar. On 6/26/09 4:27 AM, Robert Cummings rob...@interjinn.com wrote: Farah Fawcett has also died. I guess you gotta go sometime :| Björn Bartels wrote: Hello fellow coders... THE 'KING OF POP' IS DEAD ! Tonight (here in Germany), Mr. Michael Joseph Jackson, also known as 'the king of pop', died on heart failure in the age of 50. I just want to express my condolences to his family and friends and all the people who loved him and his music. This incomparable legendary musician has made such a big impact on music and musicians than any other artist in history. Rest in peace, Mr. Jackson! And may you and your music never be forgotten... -- 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 According to twitter Jeff Goldblum also snuffed it, but that was a joke -- Bastien Cat, the other other white meat -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] This Friday's OT Thread
...and no one care about the foreign (european) sniper WHO killed Neda in Iran. Note: I can not reach my Company Website in Tehran nor can I reach my Office over fixed telephone lines. I can not even contact one of my 57 employees privately. No one has tried to access my courier-imap or my webmail server in Germany... F..king world... and now Jackson? WHO IS HE? Am 2009-06-26 08:41:21, schrieb Tom Worster: and Kaleem Omar. and 15 people in Baghdad when motorcycle loaded with nails and ball-bearings exploded in a crowded bazaar. On 6/26/09 4:27 AM, Robert Cummings rob...@interjinn.com wrote: Farah Fawcett has also died. I guess you gotta go sometime :| Björn Bartels wrote: Hello fellow coders... THE 'KING OF POP' IS DEAD ! Tonight (here in Germany), Mr. Michael Joseph Jackson, also known as 'the king of pop', died on heart failure in the age of 50. I just want to express my condolences to his family and friends and all the people who loved him and his music. This incomparable legendary musician has made such a big impact on music and musicians than any other artist in history. Rest in peace, Mr. Jackson! And may you and your music never be forgotten... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php END OF REPLIED MESSAGE * Do not Cc: me, because I READ THIS LIST, if I write here * *Keine Cc: am mich, ich LESE DIESE LISTE wenn ich hier schreibe* Hello, 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] This Friday's OT Thread
On 6/26/09 9:20 AM, Michelle Konzack linux4miche...@tamay-dogan.net wrote: ...and no one care about the foreign (european) sniper WHO killed Neda in Iran. i don't know why you'd think that. the story is all over the news. american pols have been exploiting it. cnn reports cia hay have been behind the shooting. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] This Friday's OT Thread
On Fri, Jun 26, 2009 at 09:43, Tom Worsterf...@thefsb.org wrote: On 6/26/09 9:20 AM, Michelle Konzack linux4miche...@tamay-dogan.net wrote: ...and no one care about the foreign (european) sniper WHO killed Neda in Iran. i don't know why you'd think that. the story is all over the news. american pols have been exploiting it. cnn reports cia hay have been behind the shooting. OT is one thing, fellas, but politics is another. Please keep that stuff to private emails or a more appropriate forum. -- /Daniel P. Brown daniel.br...@parasane.net || danbr...@php.net http://www.parasane.net/ || http://www.pilotpig.net/ Ask me about our fully-managed servers and proactive management clusters starting at just $200/mo.! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regarding Accesing mp3 with php
On Fri, Jun 26, 2009 at 00:32, Gautam Bhatiamail2gautambha...@gmail.com wrote: hello all, Is there anyway in php by which i can get the total play time of a mp3 , I found some information while doing the google thing using some 3rd party plug ins like getID3 but without any luck, Any help in this case would be helpful. Thank you. Regards, What issue were you facing when trying to use the (third-party) getID3() function? Also, if you haven't already, check out ffmpeg-php (http://ffmpeg-php.sourceforge.net/). -- /Daniel P. Brown daniel.br...@parasane.net || danbr...@php.net http://www.parasane.net/ || http://www.pilotpig.net/ Ask me about our fully-managed servers and proactive management clusters starting at just $200/mo.! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] This Friday's OT Thread
-Original Message- From: Michelle Konzack [mailto:linux4miche...@tamay-dogan.net] Sent: 26 June 2009 03:20 PM To: php-general@lists.php.net Subject: Re: [PHP] This Friday's OT Thread ...and no one care about the foreign (european) sniper WHO killed Neda in Iran. Note: I can not reach my Company Website in Tehran nor can I reach my Office over fixed telephone lines. I can not even contact one of my 57 employees privately. No one has tried to access my courier-imap or my webmail server in Germany... F..king world... and now Jackson? WHO IS HE? -- You've been living in a missile launcher for too long -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regarding Accesing mp3 with php
At 10:02 AM +0530 6/26/09, Gautam Bhatia wrote: hello all, Is there anyway in php by which i can get the total play time of a mp3 , I found some information while doing the google thing using some 3rd party plug ins like getID3 but without any luck, Any help in this case would be helpful. Thank you. Regards, Gautam Bhatia . Gautam: I think that play time would be proportional to file size, right? If so, then take two files and play them. Note the play times and file sizes of both and work out a algorithm. That would be the way I would try to solve it. 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] Regarding Accesing mp3 with php
On Fri, Jun 26, 2009 at 10:43, teddtedd.sperl...@gmail.com wrote: I think that play time would be proportional to file size, right? If so, then take two files and play them. Note the play times and file sizes of both and work out a algorithm. That would be the way I would try to solve it. The compression algorithm used for encoding, frequency and quality of the file, and actual noise signature itself would throw this off. For example, a file with seven notes played in a period of 8 seconds will be larger than a file with one note played at the same volume for the same duration. Then take into account the bitrate, if there are ID3 tags or not, if there are compression comments embedded by the encoding software -- /Daniel P. Brown daniel.br...@parasane.net || danbr...@php.net http://www.parasane.net/ || http://www.pilotpig.net/ Ask me about our fully-managed servers and proactive management clusters starting at just $200/mo.! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regarding Accesing mp3 with php
tedd wrote: At 10:02 AM +0530 6/26/09, Gautam Bhatia wrote: hello all, Is there anyway in php by which i can get the total play time of a mp3 , I found some information while doing the google thing using some 3rd party plug ins like getID3 but without any luck, Any help in this case would be helpful. Thank you. Regards, Gautam Bhatia . Gautam: I think that play time would be proportional to file size, right? If so, then take two files and play them. Note the play times and file sizes of both and work out a algorithm. That would be the way I would try to solve it. Dear $_DEITY no. Filesize is barely related to play time. He's going aboutit the correct way, using existing libraries that know how retrieve the information. I would probably try ffplay (part of ffmpeg package): ffplay -an -stats THE_FILE.mp3 You'll see a line with the duration: Input #0, mp3, from 'THE_FILE.mp3': Duration: 00:03:35.10, start: 0.00, bitrate: 127 kb/s Stream #0.0: Audio: mp3, 44100 Hz, stereo, s16, 128 kb/s 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] Regarding Accesing mp3 with php
2009/6/26 Gautam Bhatia mail2gautambha...@gmail.com: hello all, Is there anyway in php by which i can get the total play time of a mp3 , I found some information while doing the google thing using some 3rd party plug ins like getID3 but without any luck, Any help in this case would be helpful. Thank you. Regards, Gautam Bhatia . I use this and find it very good: http://getid3.sourceforge.net/ Here is some code I'm using on one of my sites. Bit messy - but it works for me :) require_once('../public_html/audio/getid3/getid3.php'); function show_audio($type) { //Set path to audio files if ($type == rmx) { $path = '/audio/productions/remixes/'; $DirectoryToScan = '../public_html/audio/productions/remixes/'; } elseif ($type == pro) { $path = '/audio/productions/original/'; $DirectoryToScan = '../public_html/audio/productions/original/'; } $getID3 = new getID3; $dir = opendir($DirectoryToScan); while (($file = readdir($dir)) !== false) { $FullFileName = realpath($DirectoryToScan.'/'.$file); if (is_file($FullFileName)) { set_time_limit(30); $ThisFileInfo = $getID3-analyze($FullFileName); getid3_lib::CopyTagsToComments($ThisFileInfo); echo (!empty($ThisFileInfo['comments_html']['artist']) ? implode('BR', $ThisFileInfo['comments_html']['artist']) : 'nbsp;') . - ; echo (!empty($ThisFileInfo['comments_html']['title']) ? implode('BR', $ThisFileInfo['comments_html']['title']) : 'nbsp;'); echo ( . (!empty($ThisFileInfo['audio']['bitrate']) ? round($ThisFileInfo['audio']['bitrate'] / 1000).' kbps' : 'nbsp;') . ) - ; echo (!empty($ThisFileInfo['playtime_string']) ? $ThisFileInfo['playtime_string'] : 'nbsp;') . - ; echo 'a href = ' . $path . $file . 'Download/abr'; } } } Then I simply upload audio files to the right directory and I don't have to update the page that lists them. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] OT mysql pivot table problem
Ummm yeah, its going to take me a while to wrap my head around that one. thanks though! Matt On Thu, Jun 25, 2009 at 5:07 PM, Andrew Ballard aball...@gmail.com wrote: On Thu, Jun 25, 2009 at 4:21 PM, Andrew Ballardaball...@gmail.com wrote: On Thu, Jun 25, 2009 at 3:20 PM, Matt Giddingsmcgid...@svsu.edu wrote: I know this is the off topic (sorry), but it is a php project that I'm working on! I need some pointers on how to pivot a mysql column (containing comma delimited data) into an equal number of rows (see example). Any direction (pointers to links, etc. would be appreciated). From this: user.table uid|name|groups 1|mcgiddin|1,4,7,10,12 To this: pivot.table uid|group 1|1 1|4 1|7 1|10 1|12 The best performance I've seen for a SQL solution uses a tally table. CREATE TABLE Tally ( N int not null, PRIMARY KEY (N) ) The table holds a sequence of numbers from 1 to some large number. Then you can write a query something like this: SELECT uid, SUBSTRING(user.table.groups,N+1,LOCATE(',',user.table.groups,N+1)-N-1) FROM Tally, user.table WHERE N LENGTH(user.table.groups) AND SUBSTRING(user.table.groups,N,1) = ',' Andrew OK, I actually tested this and it appears I missed something. For this query to work, the string has to begin and end with the delimiter. So I just replaced user.table.groups with CONCAT(',', user.table.groups, ','). SELECT uid, SUBSTRING(CONCAT(',', user.table.groups, ','),N+1,LOCATE(',',CONCAT(',', user.table.groups, ','),N+1)-N-1) FROM Tally, sample WHERE N LENGTH(CONCAT(',', user.table.groups, ',')) AND SUBSTRING(CONCAT(',', user.table.groups, ','),N,1) = ',' For more in-depth information, check out some of the links in this search: http://www.google.com/search?q=sql+split+tally+table Andrew -- Matt Giddings Web Programmer Information Technology Services Saginaw Valley State University Phone: 989.964.7247 http://www.svsu.edu
Re: [PHP] OT mysql pivot table problem
Matt Giddings wrote: Ummm yeah, its going to take me a while to wrap my head around that one. thanks though! Matt -- Matt Giddings Web Programmer Information Technology Services Saginaw Valley State University Phone: 989.964.7247 http://www.svsu.edu I was born in Saginaw, Michigan. I grew up in a house on Saginaw Bay. My dad was a poor hard working Saginaw fisherman: Too many times he came home with too little pay. I loved a girl in Saginaw, Michigan. The daughter of a wealthy, wealthy man. But he called me: That son of a Saginaw fisherman. And not good enough to claim his daughter's hand. -- Thanks! -Shawn http://www.spidean.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regarding Accesing mp3 with php
At 10:49 AM -0400 6/26/09, Daniel Brown wrote: The compression algorithm used for encoding, frequency and quality of the file, and actual noise signature itself would throw this off. For example, a file with seven notes played in a period of 8 seconds will be larger than a file with one note played at the same volume for the same duration. Then take into account the bitrate, if there are ID3 tags or not, if there are compression comments embedded by the encoding software AND At 10:53 AM -0400 6/26/09, Robert Cummings wrote: Dear $_DEITY no. Filesize is barely related to play time. He's going aboutit the correct way, using existing libraries that know how retrieve the information. I would probably try ffplay (part of ffmpeg package): I stand corrected. Actually, I stand leaning a little to the right. 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] Regarding Accesing mp3 with php
On Fri, Jun 26, 2009 at 11:17, teddtedd.sperl...@gmail.com wrote: I stand corrected. Actually, I stand leaning a little to the right. And your mother dresses you funny. ;-P -- /Daniel P. Brown daniel.br...@parasane.net || danbr...@php.net http://www.parasane.net/ || http://www.pilotpig.net/ Ask me about our fully-managed servers and proactive management clusters starting at just $200/mo.! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regarding Accesing mp3 with php
At 11:22 AM -0400 6/26/09, Daniel Brown wrote: On Fri, Jun 26, 2009 at 11:17, teddtedd.sperl...@gmail.com wrote: I stand corrected. Actually, I stand leaning a little to the right. And your mother dresses you funny. ;-P Well, at least I had a mother. :-) 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] Regarding Accesing mp3 with php
On Fri, Jun 26, 2009 at 11:42, teddtedd.sperl...@gmail.com wrote: Well, at least I had a mother. :-) Mrs. Sperling, Tedd's hurting my feelings -- /Daniel P. Brown daniel.br...@parasane.net || danbr...@php.net http://www.parasane.net/ || http://www.pilotpig.net/ Ask me about our fully-managed servers and proactive management clusters starting at just $200/mo.! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: XSS Preventing.
On Jun 23, 2009, at 10:29, Martin Zvarík wrote: Don't htmlentiies() before DB save. In general: - mysql_real_escape_string() before DB insertion - htmlentities() before dispaly I, on the other hand, would do htmlentities() BEFORE insertion. Pros: --- The text is processed once and doesn't have to be htmlentitied() everytime you read the database - what a stupid waste of performance anyway. Isn't reading from the database every time a much bigger waste? Sounds like you might benefit from reading about Amdahl's law: http://en.wikipedia.org/wiki/Amdahl%27s_law Additionally, these slides from a talk by George Schlossnagle are good: http://schlossnagle.org/~george/talks/ZendPerf.pdf Amdahl's law aside, it does make sense in some cases (profiles for social apps, for example) to cache this information in a ready-to-be- displayed format, but no one should be talking about performance and reading from the database every time in the same sentence. Chris -- Chris Shiflett http://shiflett.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regarding Accesing mp3 with php
At 11:46 AM -0400 6/26/09, Daniel Brown wrote: On Fri, Jun 26, 2009 at 11:42, teddtedd.sperl...@gmail.com wrote: Well, at least I had a mother. :-) Mrs. Sperling, Tedd's hurting my feelings Mom... he hurt my feeling first! And his mother doesn't dress him as well as you do me. -- --- 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] Image Type BMP @ Save Image As Dialog on IE
I have wrote a PHP script that serves JPEG images in smaller size, the resize is done using GD on-the-fly. I have noticed an interesting issue during the save image as... dialog on serveral internet explorer browsers, somehow, for some strange reason, the JPEG file is shown as BMP file. I don't know why this is happening, but I'm trying to make it save it as JPG file. In firefox or any other browser everything works like a charm. I have to mention that the JPG file is located in the HTML in the following format: img src='xxx.jpg' alt='aaa' style='border:0;' / I have also used mod_rewrite to serve the file with .jpg extension (I thought that the strange IE may not know how to recognize it..), the PHP file is sending the correct headers, I'm attaching an example for HTTP request response for this resized image: GET /gallery-image-dolphinim-12450163853. HTTP/1.1 Host: www.dolphinim.net User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.10) Gecko/2009042316 Firefox/3.0.10 FirePHP/0.3 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language: en-us,en;q=0.5 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 300 Connection: keep-alive Cookie: PHPSESSID=e4542edfa5bcb7904e351d39c341fffa HTTP/1.x 200 OK Date: Fri, 26 Jun 2009 16:18:52 GMT Server: Apache/1.3.41 (Unix) PHP/5.2.6 mod_log_bytes/1.2 mod_bwlimited/1.4 mod_auth_passthrough/1.8 FrontPage/5.0.2.2635 DAV/1.0.3 mod_ssl/2.8.31 OpenSSL/0.9.8e-fips-rhel5 X-Powered-By: PHP/5.2.6 Expires: Thu, 19 Nov 1981 08:52:00 GMT Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Pragma: no-cache Keep-Alive: timeout=15, max=98 Connection: Keep-Alive Transfer-Encoding: chunked Content-Type: image/jpeg Any directions will be highly appreciated! Thanks!
[PHP] fixing new lines from textarea in an email?
I have staff fill out a form that contains a textarea with their problem description and emailed to me when they click submit. Staff will press enter in the text area, but I'm having problems converting the \r\n into a new line in the email that is sent to me, here is the code: $subject = new support request #.mysqli_insert_id($mysqli); $message = Hello, .$_SESSION[full_name]. has created a new support request. Please log in at a href=\http://intra/helpdesk\;MDAH Helpdesk/a. The problem request is \.htmlspecialchars(nl2br(str_replace('\r','',$_POST[problem]))).\. and the best time to contact is \.htmlspecialchars($_POST[contact_time]).\.; $headers = 'MIME-Version: 1.0' . \r\n; $headers .= 'Content-type: text/html; charset=iso-8859-1' . \r\n; $headers .= From: .$_SESSION[full_name]..$_SESSION[username].@mdah.state.ms.us .\r\n .X-Mailer: PHP/ . phpversion(); mail('awill...@mdah.state.ms.us', $subject, $message, $headers); and here is an example email, notice the \n is still in the body of the email, and it needs to be converted to a new line in the email: Hello, Gwendolyn Jones has created a new support request. Please log in at MDAH Helpdesk http://intra/helpdesk. The problem request is 1 of 2 questions: I'm having trouble opening files from Jennifer, Susie, and Bill because they are working with a higher version of microsoft office. My version is 2003. Is there any way I could get an update on this?\n2 of 2 questions: I need permission to download a plug-in for the NPS site where I research NR properties.\nNeither of these questions/issues are urgent. Thanks. -Gwen. and the best time to contact is Any time, phone # is cell. why isn't nl2br converting the \n to br in the email?
Re: [PHP] fixing new lines from textarea in an email?
On Fri, Jun 26, 2009 at 12:27, Adam Williamsawill...@mdah.state.ms.us wrote: I have staff fill out a form that contains a textarea with their problem description and emailed to me when they click submit. Staff will press enter in the text area, but I'm having problems converting the \r\n into a new line in the email that is sent to me, here is the code: [snip!] In a cursory glance, I've noticed the following code: htmlspecialchars(nl2br(str_replace('\r','',$_POST[problem]))) You are using a literal '\r' in your str_replace() function. This should instead be replaced with double quotes to translate the \r to its appropriate EOL character: htmlspecialchars(nl2br(str_replace(\r,'',$_POST[problem]))) -- /Daniel P. Brown daniel.br...@parasane.net || danbr...@php.net http://www.parasane.net/ || http://www.pilotpig.net/ Ask me about our fully-managed servers and proactive management clusters starting at just $200/mo.! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] fixing new lines from textarea in an email?
Daniel Brown wrote: In a cursory glance, I've noticed the following code: htmlspecialchars(nl2br(str_replace('\r','',$_POST[problem]))) You are using a literal '\r' in your str_replace() function. This should instead be replaced with double quotes to translate the \r to its appropriate EOL character: htmlspecialchars(nl2br(str_replace(\r,'',$_POST[problem]))) Thanks, I didn't know that single vs double quotes in that instance made a difference. I've made the change to my code. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP 5.2.9 Apache 2.2.11 outputs php code on Vista
I have a working apache 2.2.11 server and php 5.2.9 installed. APACHE CONFIGURATION Files are in: C:/Program Files/Apache Software Foundation/Apache2.2/ Apache https.conf is amended to add at the end of the LoadModule lines (not between any tags): LoadModule php5_module C:/PHP/php5apache2_2.dll PHPIniDir C:/PHP at the end of the file, though i cannot find any section called AddModule per the php installation notes ('Installing as an Apache module'): AddModule mod_php5.c On clicking Start Apache http server, this gives Invalid command 'AddModule' perhaps misspelled or defined by a module not included in server configuration. The PHP Installation guide says to add this at the end of the AddModule section. There is no AddModule in the default http.conf of Apache 2.2.11. So for now have commented it out. and between IfModule mime_module and /IfModule: AddType application/x-httpd-php .php PHP CONFIGURATION The php.ini file is in C:/PHP. php.ini: doc_root = C:\Program Files\Apache Software Foundation\Apache2.2\htdocs WINDOWS CONFIGURATION I have added ;C:/PHP to the end of the string for Environment Variables. I have re-booted and re-started. I am testing this file: C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\test.php which has ? print(test); ? and this outputs as code rather thna as 'test'. When I start the Apache http server, I get: httpd.exe: Could not reliably determine the server's fully qualified domain name , using 10.0.0.4 for ServerName (OS 10048)Only one usage of each socket address (protocol/network address/port) is normally permitted. : make_sock: could not bind to address 0.0.0.0:80 no listening sockets available, shutting down Unable to open logs My ISP has a dynamic IP address system, what do I use for ServerName? Do I need a static address or registered web site name to run on home computer? Apache httpd.conf has: # ServerName gives the name and port that the server uses to identify itself. # This can often be determined automatically, but we recommend you specify # it explicitly to prevent problems during startup. # # If your host doesn't have a registered DNS name, enter its IP address here. # #ServerName Any idea what might be wrong with the php code showing? Thanks, John -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: XSS Preventing.
On Fri, Jun 26, 2009 at 12:07 PM, Chris Shiflettshifl...@php.net wrote: On Jun 23, 2009, at 10:29, Martin Zvarík wrote: Don't htmlentiies() before DB save. In general: - mysql_real_escape_string() before DB insertion - htmlentities() before dispaly I, on the other hand, would do htmlentities() BEFORE insertion. Pros: --- The text is processed once and doesn't have to be htmlentitied() everytime you read the database - what a stupid waste of performance anyway. Isn't reading from the database every time a much bigger waste? Sounds like you might benefit from reading about Amdahl's law: http://en.wikipedia.org/wiki/Amdahl%27s_law Additionally, these slides from a talk by George Schlossnagle are good: http://schlossnagle.org/~george/talks/ZendPerf.pdf Amdahl's law aside, it does make sense in some cases (profiles for social apps, for example) to cache this information in a ready-to-be-displayed format, but no one should be talking about performance and reading from the database every time in the same sentence. Chris -- Chris Shiflett http://shiflett.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Fantastic PDF from the George Schlossnagle http://schlossnagle.org/~george/talks/ZendPerf.pdf Thanks -- Bastien Cat, the other other white meat -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] This Friday's OT Thread
On Fri, Jun 26, 2009 at 09:48:06AM -0400, Daniel Brown wrote: On Fri, Jun 26, 2009 at 09:43, Tom Worsterf...@thefsb.org wrote: On 6/26/09 9:20 AM, Michelle Konzack linux4miche...@tamay-dogan.net wrote: ...and no one care about the foreign (european) sniper WHO killed Neda in Iran. i don't know why you'd think that. the story is all over the news. american pols have been exploiting it. cnn reports cia hay have been behind the shooting. OT is one thing, fellas, but politics is another. Please keep that stuff to private emails or a more appropriate forum. +1 Paul -- Paul M. Foster -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP 5.2.9 Apache 2.2.11 outputs php code on Vista
I meant httpd.conf. And what is it about Vista that when in Notepad and you save a file, say test.php in directory htdocs, it shows test.php in the folder, but when you go to Windows Explorer there it is and it is gone? Nor does it load as http://localhost/test.php although http://localhost/ loads as the index.html file which is in the same folder? Pathetic notes on installation of Apache. J. ioan...@btinternet.com wrote: I have a working apache 2.2.11 server and php 5.2.9 installed. APACHE CONFIGURATION Files are in: C:/Program Files/Apache Software Foundation/Apache2.2/ Apache https.conf is amended to add at the end of the LoadModule lines (not between any tags): LoadModule php5_module C:/PHP/php5apache2_2.dll PHPIniDir C:/PHP at the end of the file, though i cannot find any section called AddModule per the php installation notes ('Installing as an Apache module'): AddModule mod_php5.c On clicking Start Apache http server, this gives Invalid command 'AddModule' perhaps misspelled or defined by a module not included in server configuration. The PHP Installation guide says to add this at the end of the AddModule section. There is no AddModule in the default http.conf of Apache 2.2.11. So for now have commented it out. and between IfModule mime_module and /IfModule: AddType application/x-httpd-php .php PHP CONFIGURATION The php.ini file is in C:/PHP. php.ini: doc_root = C:\Program Files\Apache Software Foundation\Apache2.2\htdocs WINDOWS CONFIGURATION I have added ;C:/PHP to the end of the string for Environment Variables. I have re-booted and re-started. I am testing this file: C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\test.php which has ? print(test); ? and this outputs as code rather thna as 'test'. When I start the Apache http server, I get: httpd.exe: Could not reliably determine the server's fully qualified domain name , using 10.0.0.4 for ServerName (OS 10048)Only one usage of each socket address (protocol/network address/port) is normally permitted. : make_sock: could not bind to address 0.0.0.0:80 no listening sockets available, shutting down Unable to open logs My ISP has a dynamic IP address system, what do I use for ServerName? Do I need a static address or registered web site name to run on home computer? Apache httpd.conf has: # ServerName gives the name and port that the server uses to identify itself. # This can often be determined automatically, but we recommend you specify # it explicitly to prevent problems during startup. # # If your host doesn't have a registered DNS name, enter its IP address here. # #ServerName Any idea what might be wrong with the php code showing? Thanks, John -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php