php-general Digest 12 Mar 2008 08:28:07 -0000 Issue 5343
php-general Digest 12 Mar 2008 08:28:07 - Issue 5343 Topics (messages 271313 through 271332): Re: link with database 271313 by: Shawn McKenzie 271314 by: Shawn McKenzie Know a JS list serve 271315 by: Skip Evans 271318 by: Greg Donald Re: Whats faster? simplexml_load_string or simplexml_load_file? 271316 by: Lamonte H Re: save image in database vs folder 271317 by: Børge Holen Curl Javascript 271319 by: William Piper 271321 by: Nathan Nobbe 271324 by: chetan rane Setting a variable inside a function and making it global inside an inner function doesn't work? 271320 by: Lamonte H 271322 by: Shawn McKenzie 271323 by: Shawn McKenzie 271326 by: Shawn McKenzie 271327 by: Lamonte H 271330 by: Shawn McKenzie 271331 by: Lamonte H PHP Ajax progress bar 271325 by: Shelley 271328 by: Wolf 271329 by: Wolf 271332 by: Thijs Lensselink Administrivia: To subscribe to the digest, e-mail: [EMAIL PROTECTED] To unsubscribe from the digest, e-mail: [EMAIL PROTECTED] To post to the list, e-mail: [EMAIL PROTECTED] -- ---BeginMessage--- Sofia Jacob (CA) wrote: Hi, I want to create a link that get the name and the link from the database. The problem is that I get the bullets created with li but not the link, here is my code and the result: ?php function do_html_URL($url, $name) { // output URL as link and br ? a href=?=$url??=$name?/abr ?php } ? function display_categories($cat_array) { if (!is_array($cat_array)) { echo No hay categorías actualmente disponiblesbr; return; } echo ul; foreach ($cat_array as $row) { $url = show_cat.php?Categorie_ID=.($row[Categorie_ID]); $title = $row[Catname]; echo li; do_html_URL($url, $title); } echo /ul; echo hr; } function get_categories() { // Petición a la base de datos de una lista de categorías $conn = db_connect(); $query = SELECT Categorie_ID, Catname FROM categories; $result = @mysql_query($query); if (!$result) return false; $num_cats = @mysql_num_rows($result); if ($num_cats ==0) return false; $result = db_result_to_array($result); //db_fns.php return $result; } $cat_array = get_categories(); display_categories($cat_array); Shorts tags are not enabled maybe? use ?php and ? not ?=. -Shawn ---End Message--- ---BeginMessage--- Shawn McKenzie wrote: Sofia Jacob (CA) wrote: Hi, I want to create a link that get the name and the link from the database. The problem is that I get the bullets created with li but not the link, here is my code and the result: ?php function do_html_URL($url, $name) { // output URL as link and br ? a href=?=$url??=$name?/abr ?php } ? function display_categories($cat_array) { if (!is_array($cat_array)) { echo No hay categorías actualmente disponiblesbr; return; } echo ul; foreach ($cat_array as $row) { $url = show_cat.php?Categorie_ID=.($row[Categorie_ID]); $title = $row[Catname]; echo li; do_html_URL($url, $title); } echo /ul; echo hr; } function get_categories() { // Petición a la base de datos de una lista de categorías $conn = db_connect(); $query = SELECT Categorie_ID, Catname FROM categories; $result = @mysql_query($query); if (!$result) return false; $num_cats = @mysql_num_rows($result); if ($num_cats ==0) return false; $result = db_result_to_array($result); //db_fns.php return $result; } $cat_array = get_categories(); display_categories($cat_array); Shorts tags are not enabled maybe? use ?php and ? not ?=. -Shawn Also, you need to close your li with /li after. That should be fixed, but you can confirm by looking at your page source. If you see: lia href=/abr Then short tags are not enabled. -Shawn ---End Message--- ---BeginMessage--- Hey all, I've been Googling trying to find a JavaScript list serve to post a question to, but have been, embarrassingly, unable to find one. Anyone on one they'd recommend or know of one? Thanks *sigh* -- Skip Evans Big Sky Penguin, LLC 503 S Baldwin St, #1 Madison, WI 53703 608-250-2720 http://bigskypenguin.com =-=-=-=-=-=-=-=-=-= Check out PHPenguin, a lightweight and versatile PHP/MySQL, AJAX DHTML development framework. http://phpenguin.bigskypenguin.com/ ---End Message--- ---BeginMessage--- On 3/11/08, Skip Evans [EMAIL PROTECTED] wrote: Hey all, I've been Googling trying to find a JavaScript list serve to post a question to, but have been, embarrassingly, unable to find one. Anyone on one they'd recommend or know of one? Not a list, but the
Re: [PHP] PHP Ajax progress bar
Quoting Shelley [EMAIL PROTECTED]: Hi all, I'm searching some file upload progress bar code. But no good result was found. :( So is there anybody please be kind enough to show some code here? Great thanks. -- Regard, Shelley (http://phparch.cn) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php You can try searching the archives. Rasmus had an example a long time ago. Although it requires APC to be installed. Maybe it's interesting. Found it: Example : http://progphp.com/upload.php Source : http://progphp.com/upload.phps -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP Ajax progress bar
I haven't' tried this yet ... so I would appreciate your feedback. -Original Message- From: Thijs Lensselink [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 12, 2008 4:28 AM To: php-general@lists.php.net Subject: Re: [PHP] PHP Ajax progress bar Quoting Shelley [EMAIL PROTECTED]: Hi all, I'm searching some file upload progress bar code. But no good result was found. :( So is there anybody please be kind enough to show some code here? Great thanks. -- Regard, Shelley (http://phparch.cn) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php You can try searching the archives. Rasmus had an example a long time ago. Although it requires APC to be installed. Maybe it's interesting. Found it: Example : http://progphp.com/upload.php Source : http://progphp.com/upload.phps -- 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 Ajax progress bar
Quoting Mr Webber [EMAIL PROTECTED]: I haven't' tried this yet ... so I would appreciate your feedback. -Original Message- From: Thijs Lensselink [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 12, 2008 4:28 AM To: php-general@lists.php.net Subject: Re: [PHP] PHP Ajax progress bar Quoting Shelley [EMAIL PROTECTED]: Hi all, I'm searching some file upload progress bar code. But no good result was found. :( So is there anybody please be kind enough to show some code here? Great thanks. -- Regard, Shelley (http://phparch.cn) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php You can try searching the archives. Rasmus had an example a long time ago. Although it requires APC to be installed. Maybe it's interesting. Found it: Example : http://progphp.com/upload.php Source : http://progphp.com/upload.phps -- Pls don't top post. If you want to know if it works. Go ahead! Copy paste the code and give it a try. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Parameter
Hi Folks, I am thinking of putting together a class to handle passing parameters to a class. Basically when you define a class you would define your class to extend the parameter class. The parameter class would be JSON compliant so in the end when you call a class it you could pass the parameters as a JSON string. (rough) eg. myClass(label:test,title:this is text); the parameter class would allow you to do something like: echo myClass-get(label); The advantages are: - You don't have to have a declaration for every variable used within your class - I could make the parameter class case independent (I know I need a flame suit for this but case dependency get on my nerves) - I can wrap a lot of functionality into the parameter class, stuff like 'ifNotNull(label) ...' So far disadvantages are: - Eclipse etc. has code completion, which means all the parameters you pass to a function can be presented to the developer as part of code completion I'd like to know: - Have any of you guys already done something like I am talking about. - As developers do you reckon losing code completion is worth the advantages of a parameter class - Have I overlooked something major ? Let me know what you think, JC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Know a JS list serve
11 mar 2008 kl. 22.39 skrev Skip Evans: Hey all, I've been Googling trying to find a JavaScript list serve to post a question to, but have been, embarrassingly, unable to find one. Anyone on one they'd recommend or know of one? Thanks *sigh* Evolt has a rather good list (not too much traffic, but still ...) http://lists.evolt.org/mailman/listinfo/javascript //frank -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Ajax progress bar
Thijs Lensselink 写道: Quoting Mr Webber [EMAIL PROTECTED]: I haven't' tried this yet ... so I would appreciate your feedback. -Original Message- From: Thijs Lensselink [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 12, 2008 4:28 AM To: php-general@lists.php.net Subject: Re: [PHP] PHP Ajax progress bar Quoting Shelley [EMAIL PROTECTED]: Hi all, I'm searching some file upload progress bar code. But no good result was found. :( So is there anybody please be kind enough to show some code here? Great thanks. -- Regard, Shelley (http://phparch.cn) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php You can try searching the archives. Rasmus had an example a long time ago. Although it requires APC to be installed. Maybe it's interesting. Found it: Example : http://progphp.com/upload.php Source : http://progphp.com/upload.phps -- Pls don't top post. If you want to know if it works. Go ahead! Copy paste the code and give it a try. I don't think it works. I tried. The screen always said 0%, 0 of 0 byte until the file is uploaded. Is that what you mean progress bar? -- Regards, Shelley (http://phparch.cn) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Ajax progress bar
Quoting Shelley [EMAIL PROTECTED]: Thijs Lensselink 写道: Quoting Mr Webber [EMAIL PROTECTED]: I haven't' tried this yet ... so I would appreciate your feedback. -Original Message- From: Thijs Lensselink [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 12, 2008 4:28 AM To: php-general@lists.php.net Subject: Re: [PHP] PHP Ajax progress bar Quoting Shelley [EMAIL PROTECTED]: Hi all, I'm searching some file upload progress bar code. But no good result was found. :( So is there anybody please be kind enough to show some code here? Great thanks. -- Regard, Shelley (http://phparch.cn) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php You can try searching the archives. Rasmus had an example a long time ago. Although it requires APC to be installed. Maybe it's interesting. Found it: Example : http://progphp.com/upload.php Source : http://progphp.com/upload.phps -- Pls don't top post. If you want to know if it works. Go ahead! Copy paste the code and give it a try. I don't think it works. I tried. The screen always said 0%, 0 of 0 byte until the file is uploaded. Is that what you mean progress bar? -- Regards, Shelley (http://phparch.cn) Do you have all the yui files? and APC enabled? I tried it some time ago and it worked. But i did have to set apc.rfc1867 = on in php.ini to make it work. Forgot to mention that one. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Comparing files
Quoting mathieu leddet [EMAIL PROTECTED]: Hi all, I have a simple question : how can I ensure that 2 files are identical ? How about this ? 8-- function files_identical($path1, $path2) { return (file_get_contents($path1) == file_get_contents($path2)); } 8-- Note that I would like to compare any type of files (text and binary). Thanks for any help, -- Mathieu You could use md5_file for this. Something like: function files_identical($path1, $path2) { return (md5_file($path1) == md5_file($path2)); } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Comparing files
mathieu leddet wrote: I have a simple question : how can I ensure that 2 files are identical ? How about this ? 8-- function files_identical($path1, $path2) { return (file_get_contents($path1) == file_get_contents($path2)); } 8-- Note that I would like to compare any type of files (text and binary). http://php.net/md5_file -Stut -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Comparing files
mathieu leddet wrote: Hi all, I have a simple question : how can I ensure that 2 files are identical ? How about this ? 8-- function files_identical($path1, $path2) { return (file_get_contents($path1) == file_get_contents($path2)); } I would say, use a md5 checksum on both files: function files_identical($path1, $path2) { return (md5(file_get_contents($path1)) === md5(file_get_contents($path2))); } -- Aschwin Wesselius /'What you would like to be done to you, do that to the other'/
RE: [PHP] Comparing files
-Original Message- From: mathieu leddet [mailto:[EMAIL PROTECTED] Sent: 12 March 2008 11:04 To: php-general@lists.php.net Subject: [PHP] Comparing files Hi all, I have a simple question : how can I ensure that 2 files are identical ? How about this ? 8-- function files_identical($path1, $path2) { return (file_get_contents($path1) == file_get_contents($path2)); } 8-- Note that I would like to compare any type of files (text and binary). Thanks for any help, Depending upon the size of the files, I would expect it would be quicker to compare a hash of each file. Edward -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Comparing files
Hi all, I have a simple question : how can I ensure that 2 files are identical ? How about this ? 8-- function files_identical($path1, $path2) { return (file_get_contents($path1) == file_get_contents($path2)); } 8-- Note that I would like to compare any type of files (text and binary). Thanks for any help, -- Mathieu -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Comparing files
Yes! Thanks a lot, md5_file suits perfectly well my needs. I've read that 'exec'ing the md5 command is faster... I'll see when performance on large files will become an issue. Thanks again, -- Mathieu -Message d'origine- De : Thijs Lensselink [mailto:[EMAIL PROTECTED] Envoyé : Wednesday, March 12, 2008 12:09 PM À : php-general@lists.php.net Objet : Re: [PHP] Comparing files Quoting mathieu leddet [EMAIL PROTECTED]: Hi all, I have a simple question : how can I ensure that 2 files are identical ? How about this ? 8-- function files_identical($path1, $path2) { return (file_get_contents($path1) == file_get_contents($path2)); } 8-- Note that I would like to compare any type of files (text and binary). Thanks for any help, -- Mathieu You could use md5_file for this. Something like: function files_identical($path1, $path2) { return (md5_file($path1) == md5_file($path2)); } -- 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] Comparing files
mathieu leddet wrote: Yes! Thanks a lot, md5_file suits perfectly well my needs. I've read that 'exec'ing the md5 command is faster... I'll see when performance on large files will become an issue. Doing a diff on the files would make absolutely certain - an md5 checksum is not. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Comparing files
-Original Message- From: Edward Kay [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 12, 2008 7:13 AM To: mathieu leddet; php-general@lists.php.net Subject: RE: [PHP] Comparing files -Original Message- From: mathieu leddet [mailto:[EMAIL PROTECTED] Sent: 12 March 2008 11:04 To: php-general@lists.php.net Subject: [PHP] Comparing files Hi all, I have a simple question : how can I ensure that 2 files are identical ? How about this ? 8-- function files_identical($path1, $path2) { return (file_get_contents($path1) == file_get_contents($path2)); } 8-- Note that I would like to compare any type of files (text and binary). Thanks for any help, Depending upon the size of the files, I would expect it would be quicker to compare a hash of each file. Edward I don't understand how comparing hashes can be faster than comparing contents, except for big files for which you will likely hit the memory limit first and for files who only differ from each other at the very end of them, so the comparison will only be halted then. If the file sizes vary too much, however, a mixed strategy would be the winner; and certainly, you will want to store path names and calculated hashes in a database of some kind to save yourself from hogging the server each time (yeah, CPU and RAM are cheap, but not unlimited resources). Comparing hashes means that a hash must be calculated for files A and B and the related overhead will increase according to the file size (right or wrong?). Comparing the file contents will have an associated overhead for buffering and moving the file contents into memory, and it's also a linear operation (strings are compared byte to byte till there's a difference). So... why not doing the following? 1 - Compare file sizes (this is just a property stored in the file system structures, right?). If sizes are different, the files are different. Otherwise move to step 2. 2 - If the file sizes are smaller than certain size (up to you to find the optimal file size), just compare contents through, say, file_get_contents. Otherwise move to step 3. 3 - Grab some random bytes at the beginning, at the middle and at the end of both files and compare them. If they are different, the files are different. Otherwise move to step 4. 4 - If you reach this point, you are doomed. You have 2 big files that you must compare and they are apparently equal so far. Comparing contents will be over killing if at all possible, so you will want to generate hashes and compare them. Run md5_file on both files (it would be great if you have, say, file A's hash already calculated and stored in a DB or data file) and compare results. It is always up to what kind of files you are dealing with, if the files are often different only at the end of the stream, you may want to skip step 2. But this is what I would generally do. By the way, md5 is a great hashing function, but it is not bullet-proof, collisions may happen (though it's much better than crc32, for example). So, you may also think of how critical is to you to have some false positives (some files that are considered equal by md5_file and they are not) and probably use some diff-like solution instead of md5_file. Anyway, having compared sizes and random bytes (steps 1 through 3), it's very likely that md5_file will catch it if two files are different in just a few bytes. Regards, Rob Andrés Robinet | Lead Developer | BESTPLACE CORPORATION 5100 Bayview Drive 206, Royal Lauderdale Landings, Fort Lauderdale, FL 33308 | TEL 954-607-4207 | FAX 954-337-2695 | Email: [EMAIL PROTECTED] | MSN Chat: [EMAIL PROTECTED] | SKYPE: bestplace | Web: bestplace.biz | Web: seo-diy.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] setcookie
Hi, I am learning PHP, I am trying to set a simple cookie: html head titleCookies/title /head body ?php setcookie('test', 45, time()+(60*60*24*7)); ? /body /html Firefox is returning this error: Warning: Cannot modify header information - headers already sent by (output started at /Users/Daff/Sites/php_sandbox/cookies.php:7) in / Users/Daff/Sites/php_sandbox/cookies.php on line 7 I have googled this and can't find out what I am doing wrong. Any help you could give me would be much appreciated. Tim
Re: [PHP] setcookie
body ?php setcookie('test', 45, time()+(60*60*24*7)); ? from the doc: Cookies are part of the HTTP header, so setcookie() must be called before any output is sent to the browser. This is the same limitation that header() has. http://ca.php.net/cookies - Original Message From: Tim Daff [EMAIL PROTECTED] To: php-general@lists.php.net Sent: Wednesday, March 12, 2008 8:48:59 AM Subject: [PHP] setcookie Hi, I am learning PHP, I am trying to set a simple cookie: html head titleCookies/title /head body ?php setcookie('test', 45, time()+(60*60*24*7)); ? /body /html Firefox is returning this error: Warning: Cannot modify header information - headers already sent by (output started at /Users/Daff/Sites/php_sandbox/cookies.php:7) in / Users/Daff/Sites/php_sandbox/cookies.php on line 7 I have googled this and can't find out what I am doing wrong. Any help you could give me would be much appreciated. Tim Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
Re: [PHP] setcookie
On Wed, 12 Mar 2008, Tim Daff wrote: Hi, I am learning PHP, I am trying to set a simple cookie: html head titleCookies/title /head body ?php setcookie('test', 45, time()+(60*60*24*7)); ? /body /html Firefox is returning this error: Warning: Cannot modify header information - headers already sent by (output started at /Users/Daff/Sites/php_sandbox/cookies.php:7) in /Users/Daff/Sites/php_sandbox/cookies.php on line 7 I have googled this and can't find out what I am doing wrong. Any help you could give me would be much appreciated. Tim setcookie from php.net states the following: setcookie() defines a cookie to be sent along with the rest of the HTTP headers. Like other headers, cookies must be sent before any output from your script (this is a protocol restriction). This requires that you place calls to this function prior to any output, including html and head tags as well as any whitespace call setcookie before you output ANY THING, even error hope that helps. t. hiep -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] setcookie
Thank's for your help Zareef, Hiep, Shiplu and Jean-Christophe -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Know a JS list serve
On Mar 12, 2008, at 4:14 AM, Frank Arensmeier wrote: 11 mar 2008 kl. 22.39 skrev Skip Evans: Hey all, I've been Googling trying to find a JavaScript list serve to post a question to, but have been, embarrassingly, unable to find one. Anyone on one they'd recommend or know of one? Thanks *sigh* Evolt has a rather good list (not too much traffic, but still ...) http://lists.evolt.org/mailman/listinfo/javascript Also, Apple has a javascript list... It's the Dashboard Developers list... But the Widgets are nothing more then HTML/CSS/XML/Javascript/ PHP type webpages designed for a specific use... Lots of knowledgeable javascript people there... http://lists.apple.com/mailman/listinfo/dashboard-dev/ -- Jason Pruim Raoset Inc. Technology Manager MQC Specialist 3251 132nd ave Holland, MI, 49424-9337 www.raoset.com [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Comparing files
-Original Message- From: Andrés Robinet [mailto:[EMAIL PROTECTED] Sent: 12 March 2008 12:33 To: 'Edward Kay'; 'mathieu leddet'; php-general@lists.php.net Subject: RE: [PHP] Comparing files -Original Message- From: Edward Kay [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 12, 2008 7:13 AM To: mathieu leddet; php-general@lists.php.net Subject: RE: [PHP] Comparing files -Original Message- From: mathieu leddet [mailto:[EMAIL PROTECTED] Sent: 12 March 2008 11:04 To: php-general@lists.php.net Subject: [PHP] Comparing files Hi all, I have a simple question : how can I ensure that 2 files are identical ? How about this ? 8-- function files_identical($path1, $path2) { return (file_get_contents($path1) == file_get_contents($path2)); } 8-- Note that I would like to compare any type of files (text and binary). Thanks for any help, Depending upon the size of the files, I would expect it would be quicker to compare a hash of each file. Edward I don't understand how comparing hashes can be faster than comparing contents, except for big files for which you will likely hit the memory limit first and for files who only differ from each other at the very end of them, so the comparison will only be halted then. If the file sizes vary too much, however, a mixed strategy would be the winner; and certainly, you will want to store path names and calculated hashes in a database of some kind to save yourself from hogging the server each time (yeah, CPU and RAM are cheap, but not unlimited resources). Comparing hashes means that a hash must be calculated for files A and B and the related overhead will increase according to the file size (right or wrong?). Comparing the file contents will have an associated overhead for buffering and moving the file contents into memory, and it's also a linear operation (strings are compared byte to byte till there's a difference). So... why not doing the following? 1 - Compare file sizes (this is just a property stored in the file system structures, right?). If sizes are different, the files are different. Otherwise move to step 2. 2 - If the file sizes are smaller than certain size (up to you to find the optimal file size), just compare contents through, say, file_get_contents. Otherwise move to step 3. 3 - Grab some random bytes at the beginning, at the middle and at the end of both files and compare them. If they are different, the files are different. Otherwise move to step 4. 4 - If you reach this point, you are doomed. You have 2 big files that you must compare and they are apparently equal so far. Comparing contents will be over killing if at all possible, so you will want to generate hashes and compare them. Run md5_file on both files (it would be great if you have, say, file A's hash already calculated and stored in a DB or data file) and compare results. It is always up to what kind of files you are dealing with, if the files are often different only at the end of the stream, you may want to skip step 2. But this is what I would generally do. By the way, md5 is a great hashing function, but it is not bullet-proof, collisions may happen (though it's much better than crc32, for example). So, you may also think of how critical is to you to have some false positives (some files that are considered equal by md5_file and they are not) and probably use some diff-like solution instead of md5_file. Anyway, having compared sizes and random bytes (steps 1 through 3), it's very likely that md5_file will catch it if two files are different in just a few bytes. Agreed. In by first reply, I meant that hashes would likely be quicker/more memory friendly when handling larger files, but this is just a hunch - I haven't benchmarked anything. It was really meant to give the OP other possibilities to look into. Edward -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] setcookie
Firefox is returning this error: Warning: Cannot modify header information - headers already sent by (output started at /Users/Daff/Sites/php_sandbox/cookies.php:7) in /Users/Daff/Sites/php_sandbox/cookies.php on line 7 You must use set cookie() before you send any output to the browser, including whitespace. -- Richard Heyes Employ me: http://www.phpguru.org/cv -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] setcookie
Tim Daff wrote: Hi, I am learning PHP, I am trying to set a simple cookie: html head titleCookies/title /head body ?php setcookie('test', 45, time()+(60*60*24*7)); ? /body /html Firefox is returning this error: Warning: Cannot modify header information - headers already sent by (output started at /Users/Daff/Sites/php_sandbox/cookies.php:7) in /Users/Daff/Sites/php_sandbox/cookies.php on line 7 I have googled this and can't find out what I am doing wrong. Any help you could give me would be much appreciated. Tim ?php setcookie('test', 45, time()+(60*60*24*7)); ? html head titleCookies/title /head body /body /html Cookies HAVE to be at the top of the page... You output ANYTHING else and you get the error you wound up getting. Wolf -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Comparing files
Quoting Andrés Robinet [EMAIL PROTECTED]: -Original Message- From: Edward Kay [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 12, 2008 7:13 AM To: mathieu leddet; php-general@lists.php.net Subject: RE: [PHP] Comparing files -Original Message- From: mathieu leddet [mailto:[EMAIL PROTECTED] Sent: 12 March 2008 11:04 To: php-general@lists.php.net Subject: [PHP] Comparing files Hi all, I have a simple question : how can I ensure that 2 files are identical ? How about this ? 8-- function files_identical($path1, $path2) { return (file_get_contents($path1) == file_get_contents($path2)); } 8-- Note that I would like to compare any type of files (text and binary). Thanks for any help, Depending upon the size of the files, I would expect it would be quicker to compare a hash of each file. Edward I don't understand how comparing hashes can be faster than comparing contents, except for big files for which you will likely hit the memory limit first and for files who only differ from each other at the very end of them, so the comparison will only be halted then. If the file sizes vary too much, however, a mixed strategy would be the winner; and certainly, you will want to store path names and calculated hashes in a database of some kind to save yourself from hogging the server each time (yeah, CPU and RAM are cheap, but not unlimited resources). I must agree that a mixed solution would be best here. Comparing hashes means that a hash must be calculated for files A and B and the related overhead will increase according to the file size (right or wrong?). Comparing the file contents will have an associated overhead for buffering and moving the file contents into memory, and it's also a linear operation (strings are compared byte to byte till there's a difference). So... why not doing the following? 1 - Compare file sizes (this is just a property stored in the file system structures, right?). If sizes are different, the files are different. Otherwise move to step 2. I like this idea. It's fast and will catch most differences. 2 - If the file sizes are smaller than certain size (up to you to find the optimal file size), just compare contents through, say, file_get_contents. Otherwise move to step 3. 3 - Grab some random bytes at the beginning, at the middle and at the end of both files and compare them. If they are different, the files are different. Otherwise move to step 4. Not sure about this one. Will all the file operations not create to much overhead if you are dealing with large files? 4 - If you reach this point, you are doomed. You have 2 big files that you must compare and they are apparently equal so far. Comparing contents will be over killing if at all possible, so you will want to generate hashes and compare them. Run md5_file on both files (it would be great if you have, say, file A's hash already calculated and stored in a DB or data file) and compare results. It is always up to what kind of files you are dealing with, if the files are often different only at the end of the stream, you may want to skip step 2. But this is what I would generally do. By the way, md5 is a great hashing function, but it is not bullet-proof, collisions may happen (though it's much better than crc32, for example). So, you MD5 is for sure not bullet-proof. You could always switch to sha1_file for a bit more security. may also think of how critical is to you to have some false positives (some files that are considered equal by md5_file and they are not) and probably use some diff-like solution instead of md5_file. Anyway, having compared sizes and random bytes (steps 1 through 3), it's very likely that md5_file will catch it if two files are different in just a few bytes. Regards, Rob Andrés Robinet | Lead Developer | BESTPLACE CORPORATION 5100 Bayview Drive 206, Royal Lauderdale Landings, Fort Lauderdale, FL 33308 | TEL 954-607-4207 | FAX 954-337-2695 | Email: [EMAIL PROTECTED] | MSN Chat: [EMAIL PROTECTED] | SKYPE: bestplace | Web: bestplace.biz | Web: seo-diy.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] setcookie
Even you cant put a space before ?php tag. the following code will throw the same error. | ?php | setcookie(); | ? Because I prepend a space for each line But this will be okay |?php | setcookie(); | ? This is a very common mistake and very very hard to find. On Wed, Mar 12, 2008 at 7:53 AM, Jean-Christophe Roux [EMAIL PROTECTED] wrote: body ?php setcookie('test', 45, time()+(60*60*24*7)); ? from the doc: Cookies are part of the HTTP header, so setcookie() must be called before any output is sent to the browser. This is the same limitation that header() has. http://ca.php.net/cookies - Original Message From: Tim Daff [EMAIL PROTECTED] To: php-general@lists.php.net Sent: Wednesday, March 12, 2008 8:48:59 AM Subject: [PHP] setcookie Hi, I am learning PHP, I am trying to set a simple cookie: html head titleCookies/title /head body ?php setcookie('test', 45, time()+(60*60*24*7)); ? /body /html Firefox is returning this error: Warning: Cannot modify header information - headers already sent by (output started at /Users/Daff/Sites/php_sandbox/cookies.php:7) in / Users/Daff/Sites/php_sandbox/cookies.php on line 7 I have googled this and can't find out what I am doing wrong. Any help you could give me would be much appreciated. Tim Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
Re: [PHP] setcookie
Wolf wrote: Tim Daff wrote: Hi, I am learning PHP, I am trying to set a simple cookie: html head titleCookies/title /head body ?php setcookie('test', 45, time()+(60*60*24*7)); ? /body /html Firefox is returning this error: Warning: Cannot modify header information - headers already sent by (output started at /Users/Daff/Sites/php_sandbox/cookies.php:7) in /Users/Daff/Sites/php_sandbox/cookies.php on line 7 I have googled this and can't find out what I am doing wrong. Any help you could give me would be much appreciated. Tim ?php setcookie('test', 45, time()+(60*60*24*7)); ? html head titleCookies/title /head body /body /html Cookies HAVE to be at the top of the page... You output ANYTHING else and you get the error you wound up getting. Wolf If you're not sure if data has already been sent to the client (I ran into an included file having a space after ?) you can use http://us3.php.net/manual/en/function.headers-sent.php before you call setcookie(); If nothing else it'll help with diagnosing this error when you run into it again. -- Ray Hauge www.primateapplications.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] setcookie
As a dirty trick you can put following line on the top of your script, it will work ob_start(); But you should try to know why it is not working, and what exactly ob_start will impact your application and What is the thing called Output Buffering. Zareef Ahmed On 3/12/08, Hiep Nguyen [EMAIL PROTECTED] wrote: On Wed, 12 Mar 2008, Tim Daff wrote: Hi, I am learning PHP, I am trying to set a simple cookie: html head titleCookies/title /head body ?php setcookie('test', 45, time()+(60*60*24*7)); ? /body /html Firefox is returning this error: Warning: Cannot modify header information - headers already sent by (output started at /Users/Daff/Sites/php_sandbox/cookies.php:7) in /Users/Daff/Sites/php_sandbox/cookies.php on line 7 I have googled this and can't find out what I am doing wrong. Any help you could give me would be much appreciated. Tim setcookie from php.net states the following: setcookie() defines a cookie to be sent along with the rest of the HTTP headers. Like other headers, cookies must be sent before any output from your script (this is a protocol restriction). This requires that you place calls to this function prior to any output, including html and head tags as well as any whitespace call setcookie before you output ANY THING, even error hope that helps. t. hiep -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Zareef Ahmed http://www.zareef.net A PHP Developer in India
[PHP] What's wrong the __autoload()?
Hello all, I'm wondering what's wrong with the use of __autoload(), since I see that projects like the Zend Framework don't use it and prefer to require_once each required file. Thanks in advance. -- Gustavo Narea. http://gustavonarea.net/ Get GNU/Linux! http://www.getgnulinux.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] best practices in error handling in PHP
Hi, I want to know what is the best solution for handling errors. After reading some documents dealing with the subject, i have three options: * Using a class for error handling * Using PEAR error object * Using try and catch exceptions The error handling i want to implement will be done in a big application that was developed from the beginning without any concern about error handling. Thank you Looking for last minute shopping deals? Find them fast with Yahoo! Search. http://tools.search.yahoo.com/newsearch/category.php?category=shopping
Re: [PHP] What's wrong the __autoload()?
I'm wondering what's wrong with the use of __autoload(), since I see that projects like the Zend Framework don't use it and prefer to require_once each required file. Things that happen without you explicitly causing them (ie require() et al) can lead to confusion. For example a junior developer who doesn't know of its existence and is new to a job is less likely to admit ignorance and ask how a class is being defined when __autoload() is being used. -- Richard Heyes Employ me: http://www.phpguru.org/cv -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] mail function and headers
Hi, i'm playing a little bit with the mail function from PHP 5.2.4 and email headers. here is a snippet of my code: $headers = 'From: '.$email. .$fromname. \r\n.'Reply-To:'.$email.\r\n.'X-Mailer: PHP/' . phpversion(); if (mail($to, $subject, $body,$headers)) { ... } where: $fromname = $name.,.$firstname; when i run this code, and click on button reply-to it works well... i mean i reply to end user email address ($email). but i can see in my FROM-TO header space From: correct_email_address [mailto:[EMAIL PROTECTED]@including_partial_domain_name_of_mywebhosting] correct_email_address is referencing to $email without problem. but the problem comes from [EMAIL PROTECTED] _partial_domain_name_of_mywebhosting. in fact, before @ i get a crazy value and why the rest (after @) i get my webhosting domain name ? can i turn this strange email address to the same as $email, in order to have From : [EMAIL PROTECTED] [mailto: [EMAIL PROTECTED] ? thanks a lot, Alain Windows XP SP2 PostgreSQL 8.2.4 / MS SQL server 2005 Apache 2.2.4 PHP 5.2.4 C# 2005-2008
Re: [PHP] best practices in error handling in PHP
It Maq wrote: I want to know what is the best solution for handling errors. After reading some documents dealing with the subject, i have three options: * Using a class for error handling No point IMO when you could use either the below two. * Using PEAR error object I wouldn't advise it. * Using try and catch exceptions In a new app, or (particularly) if you're adapting existing code, this is the one I'd recommend. The error handling i want to implement will be done in a big application that was developed from the beginning without any concern about error handling. Aren't they all? :-/ -- Richard Heyes Employ me: http://www.phpguru.org/cv -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] best practices in error handling in PHP
I want to know what is the best solution for handling errors. After reading some documents dealing with the subject, i have three options: * Using a class for error handling * Using PEAR error object * Using try and catch exceptions The error handling i want to implement will be done in a big application that was developed from the beginning without any concern about error handling. It seems to me that 1 and 3 aren't necessarily mutually exclusive. I believe that you can use your own error classes in php's try/catch functionality. As for PEAR's error object, unless you are using PEAR elsewhere in your app I'm not sure it would be worthwhile to just use this very small piece. This is all just IMO. thnx, Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Ajax progress bar
On Mar 12, 2008, at 5:02 AM, Thijs Lensselink wrote: Thijs Lensselink 写道: How do you pronounce your name? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] best practices in error handling in PHP
Yes you are right i can use trigger_error that will use the function that handles errors from my class. Thanks - Original Message From: Christoph Boget [EMAIL PROTECTED] To: It Maq [EMAIL PROTECTED] Cc: php-general@lists.php.net Sent: Wednesday, March 12, 2008 10:31:07 AM Subject: Re: [PHP] best practices in error handling in PHP I want to know what is the best solution for handling errors. After reading some documents dealing with the subject, i have three options: * Using a class for error handling * Using PEAR error object * Using try and catch exceptions The error handling i want to implement will be done in a big application that was developed from the beginning without any concern about error handling. It seems to me that 1 and 3 aren't necessarily mutually exclusive. I believe that you can use your own error classes in php's try/catch functionality. As for PEAR's error object, unless you are using PEAR elsewhere in your app I'm not sure it would be worthwhile to just use this very small piece. This is all just IMO. thnx, Chris Looking for last minute shopping deals? Find them fast with Yahoo! Search. http://tools.search.yahoo.com/newsearch/category.php?category=shopping
Re: [PHP] best practices in error handling in PHP
2008. 03. 12, szerda keltezéssel 07.18-kor It Maq ezt írta: Hi, I want to know what is the best solution for handling errors. After reading some documents dealing with the subject, i have three options: * Using a class for error handling * Using PEAR error object * Using try and catch exceptions I would go for try/catch, define different exception classes if different actions need to be taken, catch them based on their class to take appropriate action, and catch anything else in the top layer. greets, Zoltán Németh The error handling i want to implement will be done in a big application that was developed from the beginning without any concern about error handling. Thank you Looking for last minute shopping deals? Find them fast with Yahoo! Search. http://tools.search.yahoo.com/newsearch/category.php?category=shopping -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] best practices in error handling in PHP
I mean using calling trigger_error from the catch{} Yes you are right i can use trigger_error that will use the function that handles errors from my class. Thanks - Original Message From: Christoph Boget [EMAIL PROTECTED] To: It Maq [EMAIL PROTECTED] Cc: php-general@lists.php.net Sent: Wednesday, March 12, 2008 10:31:07 AM Subject: Re: [PHP] best practices in error handling in PHP I want to know what is the best solution for handling errors. After reading some documents dealing with the subject, i have three options: * Using a class for error handling * Using PEAR error object * Using try and catch exceptions The error handling i want to implement will be done in a big application that was developed from the beginning without any concern about error handling. It seems to me that 1 and 3 aren't necessarily mutually exclusive. I believe that you can use your own error classes in php's try/catch functionality. As for PEAR's error object, unless you are using PEAR elsewhere in your app I'm not sure it would be worthwhile to just use this very small piece. This is all just IMO. thnx, Chris Looking for last minute shopping deals? Find them fast with Yahoo! Search. http://tools.search.yahoo.com/newsearch/category.php?category=shopping Never miss a thing. Make Yahoo your home page. http://www.yahoo.com/r/hs -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Ajax progress bar
Quoting Philip Thompson [EMAIL PROTECTED]: On Mar 12, 2008, at 5:02 AM, Thijs Lensselink wrote: Thijs Lensselink 写道: How do you pronounce your name? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Well.. how to explain this one... thijs : T + [ice] That's the best i can do :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: A Quick Reminder....
Because then it screws up message formatting. On Wed, Mar 12, 2008 at 10:54 AM, Daniel Brown [EMAIL PROTECTED] wrote: Please don't top-post! ;-P -- /Dan Daniel P. Brown Senior Unix Geek ? while(1) { $me = $mind--; sleep(86400); } ? -- /Dan Daniel P. Brown Senior Unix Geek ? while(1) { $me = $mind--; sleep(86400); } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: A Quick Reminder....
Especially in the archives. On Wed, Mar 12, 2008 at 10:55 AM, Daniel Brown [EMAIL PROTECTED] wrote: Because then it screws up message formatting. On Wed, Mar 12, 2008 at 10:54 AM, Daniel Brown [EMAIL PROTECTED] wrote: Please don't top-post! ;-P -- /Dan Daniel P. Brown Senior Unix Geek ? while(1) { $me = $mind--; sleep(86400); } ? -- /Dan Daniel P. Brown Senior Unix Geek ? while(1) { $me = $mind--; sleep(86400); } ? -- /Dan Daniel P. Brown Senior Unix Geek ? while(1) { $me = $mind--; sleep(86400); } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] A Quick Reminder....
Please don't top-post! ;-P -- /Dan Daniel P. Brown Senior Unix Geek ? while(1) { $me = $mind--; sleep(86400); } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mail function and headers
On Wed, Mar 12, 2008 at 10:28 AM, Alain Roger [EMAIL PROTECTED] wrote: Hi, i'm playing a little bit with the mail function from PHP 5.2.4 and email headers. here is a snippet of my code: $headers = 'From: '.$email. .$fromname. \r\n.'Reply-To:'.$email.\r\n.'X-Mailer: PHP/' . phpversion(); You have the From: header parameters reversed. Try this: ? $headers = From: .$fromname. .$email.\r\n; $headers .= Reply-To: .$email.\r\n; $headers .= X-Mailer: PHP/.phpversion().\r\n; /* */ ? -- /Dan Daniel P. Brown Senior Unix Geek ? while(1) { $me = $mind--; sleep(86400); } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Timezone management
Lamonte H wrote: After a while of studying different softwares, I've still been getting confused on how to make a timezone management script to display time in different time zones. Like right now im in -0600 CST GMT, how would I create a script that would work on any server that would allow me to display my current time from -12 to 12 GMT in a select box so others could pick their own time also. Don't forget, there are a few time zones that are off by 30 minutes -- 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] Timezone management
On Wed, Mar 12, 2008 at 10:50 AM, Jim Lucas [EMAIL PROTECTED] wrote: Lamonte H wrote: After a while of studying different softwares, I've still been getting confused on how to make a timezone management script to display time in different time zones. Like right now im in -0600 CST GMT, how would I create a script that would work on any server that would allow me to display my current time from -12 to 12 GMT in a select box so others could pick their own time also. Don't forget, there are a few time zones that are off by 30 minutes You are correct, sir! This is why you may want to check into using date(O); to check the offset. -- /Dan Daniel P. Brown Senior Unix Geek ? while(1) { $me = $mind--; sleep(86400); } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] A Quick Reminder....
I call TROLL on Dan! :) I top post for what I consider to be legitmate reasons just like you bottom post for reasons you consider to be legitmate. Can't we all just get along? How about something OT that we can argue about... driving on the left side of the road versus the right side. How does your country compare? http://i32.photobucket.com/albums/d35/wereallouttabubblegum/Drives_On_Right.jpg (thus begins a month-long discussion of top posting and driving habits... php general archive weeps) :) -TG - Original Message - From: Daniel Brown [EMAIL PROTECTED] To: PHP General List php-general@lists.php.net Date: Wed, 12 Mar 2008 10:54:29 -0400 Subject: [PHP] A Quick Reminder Please don't top-post! ;-P -- /Dan Daniel P. Brown Senior Unix Geek ? while(1) { $me = $mind--; sleep(86400); } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Ajax progress bar
On Mar 12, 2008, at 9:52 AM, Thijs Lensselink wrote: Quoting Philip Thompson [EMAIL PROTECTED]: On Mar 12, 2008, at 5:02 AM, Thijs Lensselink wrote: Thijs Lensselink 写道: How do you pronounce your name? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Well.. how to explain this one... thijs : T + [ice] That's the best i can do :) Which is different than the famous rapper/actor... hijs-t : [ice] + T Hehehe =D -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] A Quick Reminder....
On Wed, Mar 12, 2008 at 11:01 AM, TG [EMAIL PROTECTED] wrote: How about something OT that we can argue about... driving on the left side of the road versus the right side. How does your country compare? Here in Pennsyltucky, a lot of people drive on the left, despite the fact that the whole US is supposed to drive on the right. It usually doesn't turn out very good. .:shakes head, solemnly:. Not very good at all. -- /Dan Daniel P. Brown Senior Unix Geek ? while(1) { $me = $mind--; sleep(86400); } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mail function and headers
2008/3/12, Daniel Brown [EMAIL PROTECTED]: You have the From: header parameters reversed. Try this: ? $headers = From: .$fromname. .$email.\r\n; $headers .= Reply-To: .$email.\r\n; $headers .= X-Mailer: PHP/.phpversion().\r\n; /* */ ? you can add these headers: $header = From: $fromname$email\n; $header .= Reply-To: $email\n; $header .= Return-Path: $email\n; $header .= X-Mailer: PHP/ . phpversion() . \n; $header .= MIME-Version: 1.0\n; $header .= Content-type: text/plain; charset=iso-8859-1\n; $header .= Content-Transfer-encoding: 7bit\n; Try it. -- Scripts: http://www.spacemarc.it -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Ajax progress bar
On Wed, Mar 12, 2008 at 11:03 AM, Philip Thompson [EMAIL PROTECTED] wrote: On Mar 12, 2008, at 9:52 AM, Thijs Lensselink wrote: Quoting Philip Thompson [EMAIL PROTECTED]: How do you pronounce your name? Well.. how to explain this one... thijs : T + [ice] Which is different than the famous rapper/actor... hijs-t : [ice] + T HA! -- /Dan Daniel P. Brown Senior Unix Geek ? while(1) { $me = $mind--; sleep(86400); } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] A Quick Reminder....
Daniel Brown wrote: On Wed, Mar 12, 2008 at 11:01 AM, TG [EMAIL PROTECTED] wrote: How about something OT that we can argue about... driving on the left side of the road versus the right side. How does your country compare? Here in Pennsyltucky, a lot of people drive on the left, despite the fact that the whole US is supposed to drive on the right. It usually doesn't turn out very good. .:shakes head, solemnly:. Not very good at all. It's the French that started to drive on the right side of the road: http://users.pandora.be/worldstandards/driving%20on%20the%20left.htm But I don't know who started with top-posting which is against the netiquette RFC. People sticking with strict HTML, coding standards in PHP, valid XML, nice pixelf*cked CSS etc. and not posting below a message on a list are a bunch of hypocrites. Simple as that. -- Aschwin Wesselius /'What you would like to be done to you, do that to the other'/
Re: [PHP] A Quick Reminder....
On Mar 12, 2008, at 11:06 AM, Daniel Brown wrote: On Wed, Mar 12, 2008 at 11:01 AM, TG [EMAIL PROTECTED] wrote: How about something OT that we can argue about... driving on the left side of the road versus the right side. How does your country compare? Here in Pennsyltucky, a lot of people drive on the left, despite the fact that the whole US is supposed to drive on the right. It usually doesn't turn out very good. .:shakes head, solemnly:. Not very good at all. Up here in the great big hand (Michigan for those who don't know) during the winter we have so much snow on the ground that you just kind of drive where ever looks like road... Even if it means you have people passing on your right going the opposite way. -- Jason Pruim Raoset Inc. Technology Manager MQC Specialist 3251 132nd ave Holland, MI, 49424-9337 www.raoset.com [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Ajax progress bar
Quoting Daniel Brown [EMAIL PROTECTED]: On Wed, Mar 12, 2008 at 11:03 AM, Philip Thompson [EMAIL PROTECTED] wrote: On Mar 12, 2008, at 9:52 AM, Thijs Lensselink wrote: Quoting Philip Thompson [EMAIL PROTECTED]: How do you pronounce your name? Well.. how to explain this one... thijs : T + [ice] Which is different than the famous rapper/actor... hijs-t : [ice] + T HA! -- /Dan Daniel P. Brown Senior Unix Geek ? while(1) { $me = $mind--; sleep(86400); } ? Same reaction here! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: A Quick Reminder....
On Wed, Mar 12, 2008 at 10:55 AM, Daniel Brown [EMAIL PROTECTED] wrote: Especially in the archives. Or worse yet, when someone else bottom-posts correctly and doesn't clip the remaining conversation. On Wed, Mar 12, 2008 at 10:55 AM, Daniel Brown [EMAIL PROTECTED] wrote: Because then it screws up message formatting. On Wed, Mar 12, 2008 at 10:54 AM, Daniel Brown [EMAIL PROTECTED] wrote: Please don't top-post! ;-P -- /Dan Daniel P. Brown Senior Unix Geek ? while(1) { $me = $mind--; sleep(86400); } ? -- /Dan Daniel P. Brown Senior Unix Geek ? while(1) { $me = $mind--; sleep(86400); } ? -- /Dan Daniel P. Brown Senior Unix Geek ? while(1) { $me = $mind--; sleep(86400); } ? -- /Dan Daniel P. Brown Senior Unix Geek ? while(1) { $me = $mind--; sleep(86400); } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] A Quick Reminder....
Jason Pruim [EMAIL PROTECTED] wrote: On Mar 12, 2008, at 11:06 AM, Daniel Brown wrote: On Wed, Mar 12, 2008 at 11:01 AM, TG [EMAIL PROTECTED] wrote: How about something OT that we can argue about... driving on the left side of the road versus the right side. How does your country compare? Here in Pennsyltucky, a lot of people drive on the left, despite the fact that the whole US is supposed to drive on the right. It usually doesn't turn out very good. .:shakes head, solemnly:. Not very good at all. Up here in the great big hand (Michigan for those who don't know) during the winter we have so much snow on the ground that you just kind of drive where ever looks like road... Even if it means you have people passing on your right going the opposite way. When I lived in South Dakota, we did the same thing... Here in the state of North Carolina (otherwise known as confusion central during ANY type of weather) they drive anywhere between the 2 white lines, generally as slow as humanly possible with their blinkers on and tieing up all lanes... Even during a 85 degree, 0% overcast, 0% humidity day... *grumble* -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What's wrong the __autoload()?
On 3/12/08, Richard Heyes [EMAIL PROTECTED] wrote: I'm wondering what's wrong with the use of __autoload(), since I see that projects like the Zend Framework don't use it and prefer to require_once each required file. Things that happen without you explicitly causing them (ie require() et al) can lead to confusion. It's called convention over configuration and that's exactly where good frameworks should be headed. http://en.wikipedia.org/wiki/Convention_over_Configuration For example a junior developer who doesn't know of its existence and is new to a job is less likely to admit ignorance and ask how a class is being defined when __autoload() is being used. That's a the dumbest reason I've ever heard to not use a given language feature. -- Greg Donald http://destiney.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mail function and headers
ok i will try... what about UTF-8 to ensure unicode ? my website and especially the form which will send this email, will be filled in by several nationalities... spanish, english, french, slovak, german,,... so isn't it easier to set up utf-8 ? A. On Wed, Mar 12, 2008 at 4:11 PM, spacemarc [EMAIL PROTECTED] wrote: 2008/3/12, Daniel Brown [EMAIL PROTECTED]: You have the From: header parameters reversed. Try this: ? $headers = From: .$fromname. .$email.\r\n; $headers .= Reply-To: .$email.\r\n; $headers .= X-Mailer: PHP/.phpversion().\r\n; /* */ ? you can add these headers: $header = From: $fromname$email\n; $header .= Reply-To: $email\n; $header .= Return-Path: $email\n; $header .= X-Mailer: PHP/ . phpversion() . \n; $header .= MIME-Version: 1.0\n; $header .= Content-type: text/plain; charset=iso-8859-1\n; $header .= Content-Transfer-encoding: 7bit\n; Try it. -- Scripts: http://www.spacemarc.it -- Alain Windows XP SP2 PostgreSQL 8.2.4 / MS SQL server 2005 Apache 2.2.4 PHP 5.2.4 C# 2005-2008
Fwd: [PHP] mail function and headers
ok i will try... what about UTF-8 to ensure unicode ? my website and especially the form which will send this email, will be filled in by several nationalities... spanish, english, french, slovak, german,,... so isn't it easier to set up utf-8 ? A. On Wed, Mar 12, 2008 at 4:11 PM, spacemarc [EMAIL PROTECTED] wrote: 2008/3/12, Daniel Brown [EMAIL PROTECTED]: You have the From: header parameters reversed. Try this: ? $headers = From: .$fromname. .$email.\r\n; $headers .= Reply-To: .$email.\r\n; $headers .= X-Mailer: PHP/.phpversion().\r\n; /* */ ? you can add these headers: $header = From: $fromname$email\n; $header .= Reply-To: $email\n; $header .= Return-Path: $email\n; $header .= X-Mailer: PHP/ . phpversion() . \n; $header .= MIME-Version: 1.0\n; $header .= Content-type: text/plain; charset=iso-8859-1\n; $header .= Content-Transfer-encoding: 7bit\n; Try it. -- Scripts: http://www.spacemarc.it -- Alain Windows XP SP2 PostgreSQL 8.2.4 / MS SQL server 2005 Apache 2.2.4 PHP 5.2.4 C# 2005-2008 -- Alain Windows XP SP2 PostgreSQL 8.2.4 / MS SQL server 2005 Apache 2.2.4 PHP 5.2.4 C# 2005-2008
Re: [PHP] strtotime( 'last Sunday' ) and republicans
On 3/10/08, Wolf [EMAIL PROTECTED] wrote: Watch throwing that blame around there Greg, you get to thank the democrats for NAFTA and the hurting the heartlands No matter where we draw the borders or put the roads and highways, it's still just the one planet, with the same finite resources we all have to share. Being mad about globalization is pointless, it's inevitable. -- Greg Donald http://destiney.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What's wrong the __autoload()?
On Wed, 2008-03-12 at 10:33 -0500, Greg Donald wrote: On 3/12/08, Richard Heyes [EMAIL PROTECTED] wrote: I'm wondering what's wrong with the use of __autoload(), since I see that projects like the Zend Framework don't use it and prefer to require_once each required file. Things that happen without you explicitly causing them (ie require() et al) can lead to confusion. It's called convention over configuration and that's exactly where good frameworks should be headed. But then you'd end up with something like Ruby on Rails... and we all know about Ruby on Rails *VOMIT*. Who wants to be stuck on a track when they can soar with the eagles. http://en.wikipedia.org/wiki/Convention_over_Configuration Interesting how the article promotes the ideas of both convention and configuration co-existing so that one doesn't lose versatility. Thus, one could infer that any good framework would allow both paradigms. 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] mail function and headers
ok, so this is what i got and it is still remaining... :-( Received: from serdev ([127.0.0.1]) by home.com with MailEnable ESMTP; Wed, 12 Mar 2008 16:40:18 +0100 Date: Wed, 12 Mar 2008 16:40:18 +0100 Subject: subject 3 To: [EMAIL PROTECTED] From: raf, news [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] Return-Path: [EMAIL PROTECTED] X-Mailer: PHP/5.2.4 MIME-Version: 1.0 Content-type: text/plain; charset=iso-8859-1 Content-Transfer-encoding: 7bit as you can see my Return-Path is still pointing on the wrong direction :-( any other idea ? A. On Wed, Mar 12, 2008 at 4:11 PM, spacemarc [EMAIL PROTECTED] wrote: 2008/3/12, Daniel Brown [EMAIL PROTECTED]: You have the From: header parameters reversed. Try this: ? $headers = From: .$fromname. .$email.\r\n; $headers .= Reply-To: .$email.\r\n; $headers .= X-Mailer: PHP/.phpversion().\r\n; /* */ ? you can add these headers: $header = From: $fromname$email\n; $header .= Reply-To: $email\n; $header .= Return-Path: $email\n; $header .= X-Mailer: PHP/ . phpversion() . \n; $header .= MIME-Version: 1.0\n; $header .= Content-type: text/plain; charset=iso-8859-1\n; $header .= Content-Transfer-encoding: 7bit\n; Try it. -- Scripts: http://www.spacemarc.it -- Alain Windows XP SP2 PostgreSQL 8.2.4 / MS SQL server 2005 Apache 2.2.4 PHP 5.2.4 C# 2005-2008
Re: [PHP] A Quick Reminder....
Daniel Brown wrote: Here in Pennsyltucky, a lot of people drive on the left, despite the fact that the whole US is supposed to drive on the right. It usually doesn't turn out very good. .:shakes head, solemnly:. Don't worry Dan, evolution will sort that out eventually. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] A Quick Reminder....
I don't know... but... -Original Message- From: Wolf [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 12, 2008 11:30 AM To: Jason Pruim Cc: TG; Daniel Brown; PHP General List Subject: Re: [PHP] A Quick Reminder Jason Pruim [EMAIL PROTECTED] wrote: On Mar 12, 2008, at 11:06 AM, Daniel Brown wrote: On Wed, Mar 12, 2008 at 11:01 AM, TG [EMAIL PROTECTED] wrote: How about something OT that we can argue about... driving on the left side of the road versus the right side. How does your country compare? How about when someone middle-posts like this... such as some kind of quoting attempt... Here in Pennsyltucky, a lot of people drive on the left, despite the fact that the whole US is supposed to drive on the right. It usually doesn't turn out very good. .:shakes head, solemnly:. Not very good at all. Up here in the great big hand (Michigan for those who don't know) during the winter we have so much snow on the ground that you just kind of drive where ever looks like road... Even if it means you have people passing on your right going the opposite way. Or even worse... tries to quote several of the previous posters in several places? When I lived in South Dakota, we did the same thing... Here in the state of North Carolina (otherwise known as confusion central during ANY type of weather) they drive anywhere between the 2 white lines, generally as slow as humanly possible with their blinkers on and tieing up all lanes... Even during a 85 degree, 0% overcast, 0% humidity day... *grumble* So in the end everything is screwed up... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php ... and he/she still ends with a Regards, Mr X ..as if he/she did no wrong? That's the bad thing :D -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] A Quick Reminder....
RFC1855/FYI28: ftp://ftp.rfc-editor.org/in-notes/rfc1855.txt ftp://ftp.rfc-editor.org/in-notes/fyi/fyi28.txt Found via the RFC-Editor archive search: http://www.rfc-editor.org/ Ok, so this RFC discourages top posting, but it was also written 13 years ago when Usenet and other threaded/flat message board type systems were prominent. From doing some quick searches, the predominant opinion seems to be bottom posting was the style back then, most new online services lean toward top posting. Here's quick rundown of services and if they position the cursor at the top or bottom when replying: Gmail: top post Yahoo Mail: top post Microsoft Outlook: top post Hotmail: positions cursor on To: line, tabbing down to body puts cursor at top Squirrelmail 1.4: positions cursor on To: line, tabbing downt to body puts cursor at bottom Comcast Mail Center: top post I actually prefer inline responses when there are many different things being responded to, but top-posting when there's just a point or two and I'm already familiar with the conversation. Anyone coming in at the middle of the conversation can refer to what's below if needed, but don't have to look at it if they already know what's going on.Top-posting, to me, is definitely more efficient and preferable. Do people on Blackberry's and iPhones really want to scroll past a bunch of stuff they've already read to get to the actual current message? Now, don't get me wrong, I'm not saying bottom posting is bad. I'm really just pointing out that it is a preference issue. And if there's a problem with archives and digests, maybe the archives and digests should be updated. It shouldn't matter if people top- or bottom-post, as long as they trim messages so there's not a lot of superfluous junk involved. THAT's really what causes issues in archives and digests in my experience.. regardless of top/bottom posting. It seems that bottom posting was more of a necessity years ago and that many people cling to it as absolute ettiquette due more to tradition and preference than anything else. As for hypocrites... I'm not sure how that applies. Unless you're saying people who adhere to strict web standards but still top-post are hypocrites. If you can show me an actual ratified standard that says we must all top post, then maybe you have a point. But since the only 'official' document is an RFC (and my requested comments appear above) from 13 years ago, then I'll have to call bunk on hypocracy in this case. It would be like saying I was in the military and we all addressed our superiors with SIR msg SIR! therefore, since I'm your boss, that's the communications standard you must adhere to.. despite not being in the miiltary. Ooops.. I violated another standard. The period should be within the quotes ... military. Crap. I'm breaking the internet by not following standards. Oops. I mean. Internet (capitalized). Just deal with the fact that this is a holy war issue that nobody going to convince anyone to change their mind about and let's move on.If it seriously causes a problem with archives and digests, then someone needs to update the way messages are presented in the archives and digests because it's antiquated. I recommend using a nice threaded email service like Gmail and not using digests..You get a similar effect, but without all this crazy confusion when someone top-posts or someone doesn't trim their messages properly. -TG - Original Message - From: Aschwin Wesselius [EMAIL PROTECTED] To: Daniel Brown [EMAIL PROTECTED] Cc: TG [EMAIL PROTECTED], PHP General List php-general@lists.php.net Date: Wed, 12 Mar 2008 16:14:03 +0100 But I don't know who started with top-posting which is against the netiquette RFC. People sticking with strict HTML, coding standards in PHP, valid XML, nice pixelf*cked CSS etc. and not posting below a message on a list are a bunch of hypocrites. Simple as that. -- Aschwin Wesselius -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What's wrong the __autoload()?
On 3/12/08, Robert Cummings [EMAIL PROTECTED] wrote: But then you'd end up with something like Ruby on Rails... and we all know about Ruby on Rails *VOMIT*. You clearly don't know much about it or else you wouldn't be bashing it. Period. Just admit the fact that you're resistant to learn new, better ways of doing things and move on. On the other hand, if there's something in Rails you genuinely don't understand, I'll be happy to assist you with that particular understanding, off-list or wherever, free of charge. Who wants to be stuck on a track when they can soar with the eagles. I dunno, why not ask the many Rails clone authors? I certainly don't see any Ruby programmers trying to copy ZF or Symphony. http://en.wikipedia.org/wiki/Convention_over_Configuration Interesting how the article promotes the ideas of both convention and configuration co-existing so that one doesn't lose versatility. Thus, one could infer that any good framework would allow both paradigms. Rails supports both naturally. It has configurable environments for development, testing, and production, all pre-configured for the most common cases. You can even create your own new environments if you have something that doesn't fit into dev/test/prod very easily. Complete versatility in every regard thanks to Ruby's meta-ness. -- Greg Donald http://destiney.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What's wrong the __autoload()?
For example a junior developer who doesn't know of its existence and is new to a job is less likely to admit ignorance and ask how a class is being defined when __autoload() is being used. That's a the dumbest reason I've ever heard to not use a given language feature. It's a perfectly viable business reason. -- Richard Heyes Employ me: http://www.phpguru.org/cv -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] A Quick Reminder....
- Original Message - From: Andrés Robinet [EMAIL PROTECTED] To: 'Wolf' [EMAIL PROTECTED], 'Jason Pruim' [EMAIL PROTECTED] Cc: 'TG' [EMAIL PROTECTED], 'Daniel Brown' [EMAIL PROTECTED], 'PHP General List' php-general@lists.php.net Date: Wed, 12 Mar 2008 11:58:26 -0400 How about when someone middle-posts like this... such as some kind of quoting attempt... This is acceptable if there are multiple points. Better than trying to address each point at the top OR bottom. That just gets awkward. Or even worse... tries to quote several of the previous posters in several places? That's no problem as long as the quoted text included is relevant to the response or may be helpful if getting someone caught up on at least that segment of the conversation. It doesn't have to include everything having been said since the beginning of the conversation. So in the end everything is screwed up... What's screwed up? Is this unclear? This is more about what people choose to leave in a message versus what they should be trimming out than an issue of top/inline/bottom posting. ... and he/she still ends with a Regards, Mr X ..as if he/she did no wrong? Wrong in your eyes, but that's pretty subjective. That's the bad thing :D Is it? hah. -TG sorry... Regards.. -TG hah -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What's wrong the __autoload()?
On 3/12/08, Richard Heyes [EMAIL PROTECTED] wrote: It's a perfectly viable business reason. No it's not. I guess you need a business scenario to wrap your head around the idiocy. Here you go: Imagine at Blizzard one morning, Hey guys, we're not going to be able to use function pointers on the new Diablo III like we had planned to do, the new hires down the hall don't understand them very well so just don't use them, OK? -- Greg Donald http://destiney.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What's wrong the __autoload()?
On Wed, Mar 12, 2008 at 10:05 AM, Gustavo Narea [EMAIL PROTECTED] wrote: Hello all, I'm wondering what's wrong with the use of __autoload(), since I see that projects like the Zend Framework don't use it and prefer to require_once each required file. Thanks in advance. -- Gustavo Narea. http://gustavonarea.net/ Get GNU/Linux! http://www.getgnulinux.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Use spl autoload register instead. This way your app and dependent libraries can have their own autoloaders. http://us2.php.net/manual/en/function.spl-autoload-register.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What's wrong the __autoload()?
It's a perfectly viable business reason. No it's not. I guess you need a business scenario to wrap your head around the idiocy. Here you go: Imagine at Blizzard one morning, Hey guys, we're not going to be able to use function pointers on the new Diablo III like we had planned to do, the new hires down the hall don't understand them very well so just don't use them, OK? That's not quite the situation. Finding good developers isn't easy, so lots of companies will go for acceptable ones, who are less likely to know of __autoloads existence. Hence, using __autoload is unwise. -- Richard Heyes Employ me: http://www.phpguru.org/cv -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What's wrong the __autoload()?
2008. 03. 12, szerda keltezéssel 11.12-kor Greg Donald ezt írta: On 3/12/08, Robert Cummings [EMAIL PROTECTED] wrote: But then you'd end up with something like Ruby on Rails... and we all know about Ruby on Rails *VOMIT*. You clearly don't know much about it or else you wouldn't be bashing it. Period. Just admit the fact that you're resistant to learn new, better ways of doing things and move on. hey, we had a conversation about this a while back, and I'm still not convinced about RoR being 'better'. it has several cool ideas, which some php frameworks also follow now (and a few that would be cool in php frameworks but not yet implemented), but I strongly think that Ruby as a language just plain sucks ;) greets, Zoltán Németh On the other hand, if there's something in Rails you genuinely don't understand, I'll be happy to assist you with that particular understanding, off-list or wherever, free of charge. Who wants to be stuck on a track when they can soar with the eagles. I dunno, why not ask the many Rails clone authors? I certainly don't see any Ruby programmers trying to copy ZF or Symphony. http://en.wikipedia.org/wiki/Convention_over_Configuration Interesting how the article promotes the ideas of both convention and configuration co-existing so that one doesn't lose versatility. Thus, one could infer that any good framework would allow both paradigms. Rails supports both naturally. It has configurable environments for development, testing, and production, all pre-configured for the most common cases. You can even create your own new environments if you have something that doesn't fit into dev/test/prod very easily. Complete versatility in every regard thanks to Ruby's meta-ness. -- Greg Donald http://destiney.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] A Quick Reminder....
Jason Pruim wrote: On Mar 12, 2008, at 11:06 AM, Daniel Brown wrote: On Wed, Mar 12, 2008 at 11:01 AM, TG [EMAIL PROTECTED] wrote: How about something OT that we can argue about... driving on the left side of the road versus the right side. How does your country compare? Here in Pennsyltucky, a lot of people drive on the left, despite the fact that the whole US is supposed to drive on the right. It usually doesn't turn out very good. .:shakes head, solemnly:. Not very good at all. Up here in the great big hand (Michigan for those who don't know) during the winter we have so much snow on the ground that you just kind of drive where ever looks like road... Even if it means you have people passing on your right going the opposite way. -- Jason Pruim Raoset Inc. Technology Manager MQC Specialist 3251 132nd ave Holland, MI, 49424-9337 www.raoset.com [EMAIL PROTECTED] I'm in Fargo, North Dakota (the that's a state? state). We experience very much the same thing. Especially on the side roads that don't get cleared as well. You just have to make sure that you don't run into each other and you're good. As far as replies, I like bottom posting because it keeps the conversation flow more in tact. GMail does a good job regardless of bottom or top posting though. -- Ray Hauge www.primateapplications.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What's wrong the __autoload()?
On 3/12/08, Richard Heyes [EMAIL PROTECTED] wrote: That's not quite the situation. Finding good developers isn't easy, so lots of companies will go for acceptable ones, who are less likely to know of __autoloads existence. Hence, using __autoload is unwise. A lesser developer should be paid less and should be expected to produce less but he should not in any way be allowed to refrain from learning. How long does it take to understand __autoload() anyway? 5-10 minutes? 15 or 20 if you play with an example for a bit? You're gonna restrict the entire development team from using a given feature just because you don't want to invest 20 minutes in getting your newbie developer up to spead? That's pure idiocy. -- Greg Donald http://destiney.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What's wrong the __autoload()?
On 3/12/08, Zoltán Németh [EMAIL PROTECTED] wrote: but I strongly think that Ruby as a language just plain sucks ;) And exactly how many projects do you have under your belt to allow you to develop this opinion? What's the url to any one of them? Unlike you I actually have thousands of lines of Ruby code under my belt that allows me to properly develop an opinion of Ruby and Rails and how they both compare to every other programming language and framework I know and have developed in. Need a URL? -- Greg Donald http://destiney.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What's wrong the __autoload()?
On 3/12/08, Richard Heyes [EMAIL PROTECTED] wrote: No it's not. It's not like require_once() is a hassle to type/use anyhow. Things like editor macros and templates help out enormously and by using them over __auto load you (a business) could save yourself a lot of time and hence money. I'm not defending __autoload() specifically, I don't do much OO PHP anyway so I couldn't possibly care less about it. My argument is that asking other developers to not use specific language features simply because lesser developers may not know them very well is just plain dumb. I'm sorry you don't get it and I'm done trying to help you get it. Good luck codling your lesser developers. May they never learn jack on their own. *sigh* -- Greg Donald http://destiney.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What's wrong the __autoload()?
On 3/12/08, Robert Cummings [EMAIL PROTECTED] wrote: Imagine at Blizzard one morning, Hey guys, we're not going to be able to use function pointers on the new Diablo III like we had planned to do, the new hires down the hall don't understand them very well so just don't use them, OK? This is not a valid comparison. The above is the replacement of one convention with another convention. It is not a case of circumventing a convention to achieve a specific, and probably desired outcome. It's a dead-on, same example, just with a different programming language and a different language feature. -- Greg Donald http://destiney.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What's wrong the __autoload()?
2008. 03. 12, szerda keltezéssel 12.12-kor Greg Donald ezt írta: On 3/12/08, Zoltán Németh [EMAIL PROTECTED] wrote: but I strongly think that Ruby as a language just plain sucks ;) And exactly how many projects do you have under your belt to allow you to develop this opinion? What's the url to any one of them? Unlike you I actually have thousands of lines of Ruby code under my belt that allows me to properly develop an opinion of Ruby and Rails and how they both compare to every other programming language and framework I know and have developed in. Need a URL? ok, I admit I don't have experience with Ruby but I have experience with php. and I don't have experience with Ruby because I read some manuals and example codes and whatnot and I just could not get to like it at all. it's just so strange and different from anything I know (php, c, java) - and I could not find out any good reasons for most of the differences... e.g. how come function definitions are between 'def' and 'end'? I just don't like it and it's a matter of taste, so there is no need to argue about it more... :) however that's not about the framework, I admit that Rails had several new and useful concepts, and I know that the framework I currently use took a lot of ideas from there. greets, Zoltán Németh -- Greg Donald http://destiney.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What's wrong the __autoload()?
On Wed, 2008-03-12 at 11:12 -0500, Greg Donald wrote: On 3/12/08, Robert Cummings [EMAIL PROTECTED] wrote: But then you'd end up with something like Ruby on Rails... and we all know about Ruby on Rails *VOMIT*. You clearly don't know much about it or else you wouldn't be bashing it. Period. Ummm, I've looked into Ruby and RoR. I've tried it out. I've read many many many articles on it. I JUST DON'T LIKE IT. Just admit the fact that you're resistant to learn new, better ways of doing things and move on. Ooooh... a personal attack... what a great way to make me reflect upon my dislike of RoR. I think the only person around here qualified to throw around facts about me is... you know... ME! On the other hand, if there's something in Rails you genuinely don't understand, I'll be happy to assist you with that particular understanding, off-list or wherever, free of charge. Oh, there's nothing I don't understand about it. I just don't like it. Can't a person just not like something anymore? Can't I have my own opinion anymore? What year is this? 1984?? ... In an alternate universe that was supposed to be averted? 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] What's wrong the __autoload()?
Greg Donald wrote: On 3/12/08, Richard Heyes [EMAIL PROTECTED] wrote: That's not quite the situation. Finding good developers isn't easy, so lots of companies will go for acceptable ones, who are less likely to know of __autoloads existence. Hence, using __autoload is unwise. A lesser developer should be paid less and should be expected to produce less but he should not in any way be allowed to refrain from learning. I agree. But having worked in the (then) fast paced environment of online DVD rental, time was not available. How long does it take to understand __autoload() anyway? 5-10 minutes? I would say as long as it takes to read the manual page, which isn't that long at all. You're gonna restrict the entire development team from using a given feature just because you don't want to invest 20 minutes in getting your newbie developer up to spead? That's pure idiocy. No it's not. It's not like require_once() is a hassle to type/use anyhow. Things like editor macros and templates help out enormously and by using them over __auto load you (a business) could save yourself a lot of time and hence money. -- Richard Heyes Employ me: http://www.phpguru.org/cv -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What's wrong the __autoload()?
Richard Heyes [EMAIL PROTECTED] wrote: Greg Donald wrote: On 3/12/08, Richard Heyes [EMAIL PROTECTED] wrote: That's not quite the situation. Finding good developers isn't easy, so lots of companies will go for acceptable ones, who are less likely to know of __autoloads existence. Hence, using __autoload is unwise. A lesser developer should be paid less and should be expected to produce less but he should not in any way be allowed to refrain from learning. I agree. But having worked in the (then) fast paced environment of online DVD rental, time was not available. Learning always has to happen, even if you don't think it is... Some are just slower then others. How long does it take to understand __autoload() anyway? 5-10 minutes? I would say as long as it takes to read the manual page, which isn't that long at all. And you have to couple in with that the person's mental capacity for what they are trying to learn, their background, and if they have any other knowledge of the subject. You're gonna restrict the entire development team from using a given feature just because you don't want to invest 20 minutes in getting your newbie developer up to spead? That's pure idiocy. No it's not. It's not like require_once() is a hassle to type/use anyhow. Things like editor macros and templates help out enormously and by using them over __auto load you (a business) could save yourself a lot of time and hence money. I actually prefer to use a site prepend and append, then in the prepend file is where I throw all my requires and such. pretty much takes care of any learning curve since with the prepended file doing the heavy lifting. Wolf -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What's wrong the __autoload()?
On Wed, 2008-03-12 at 11:26 -0500, Greg Donald wrote: On 3/12/08, Richard Heyes [EMAIL PROTECTED] wrote: It's a perfectly viable business reason. No it's not. I guess you need a business scenario to wrap your head around the idiocy. Here you go: Imagine at Blizzard one morning, Hey guys, we're not going to be able to use function pointers on the new Diablo III like we had planned to do, the new hires down the hall don't understand them very well so just don't use them, OK? This is not a valid comparison. The above is the replacement of one convention with another convention. It is not a case of circumventing a convention to achieve a specific, and probably desired outcome. 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] What's wrong the __autoload()?
On Wed, 2008-03-12 at 18:21 +0100, Zoltán Németh wrote: 2008. 03. 12, szerda keltezéssel 12.12-kor Greg Donald ezt írta: On 3/12/08, Zoltán Németh [EMAIL PROTECTED] wrote: but I strongly think that Ruby as a language just plain sucks ;) And exactly how many projects do you have under your belt to allow you to develop this opinion? What's the url to any one of them? Unlike you I actually have thousands of lines of Ruby code under my belt that allows me to properly develop an opinion of Ruby and Rails and how they both compare to every other programming language and framework I know and have developed in. Need a URL? ok, I admit I don't have experience with Ruby but I have experience with php. and I don't have experience with Ruby because I read some manuals and example codes and whatnot and I just could not get to like it at all. it's just so strange and different from anything I know (php, c, java) - and I could not find out any good reasons for most of the differences... e.g. how come function definitions are between 'def' and 'end'? Because they didn't follow convention... *HAHAHA* oh my, I think I just pee'd myself. 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] What's wrong the __autoload()?
On 12 Mar 2008, at 17:31, Wolf wrote: Richard Heyes [EMAIL PROTECTED] wrote: Greg Donald wrote: You're gonna restrict the entire development team from using a given feature just because you don't want to invest 20 minutes in getting your newbie developer up to spead? That's pure idiocy. No it's not. It's not like require_once() is a hassle to type/use anyhow. Things like editor macros and templates help out enormously and by using them over __auto load you (a business) could save yourself a lot of time and hence money. I actually prefer to use a site prepend and append, then in the prepend file is where I throw all my requires and such. pretty much takes care of any learning curve since with the prepended file doing the heavy lifting. But by doing so you're including a lot of code you almost certainly don't use on every page. That can pointlessly consume resources on a busy server. I use __autoload (and for new projects the SPL version) because I know that anyone who can't get it within 5 minutes is not someone I want to work with. Not using language features because some developers might not know about it is going to restrict you to the sort of instruction set you get in Assembler. I've been working with PHP for a very long time and I certainly don't claim to know everything about it or about every feature it has. Restrict your code in that way and you'll create a slow unmaintainable mess. IMHO. -Stut -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What's wrong the __autoload()?
On 3/12/08, Zoltán Németh [EMAIL PROTECTED] wrote: ok, I admit I don't have experience with Ruby but I have experience with php. and I don't have experience with Ruby because I read some manuals and example codes and whatnot and I just could not get to like it at all. That's a lot different from your previous blanket statement of Ruby as a language just plain sucks. I hate you less now that I know a bit more about you, see how that works? it's just so strange and different from anything I know (php, c, java) - Ruby has a lot of functional language influence. Once you use it you really start to like how much shorter your iterative loops are for example. The first two developers I worked with using Ruby also knew ML and Scheme. One of them suggested I go study Scheme so I would appreciate Ruby more. I did so for several weeks and now I do. Ruby provides everything from the procedural world we're currently used to seeing in PHP, C, and Java, but it also adds functional style that makes for some utterly beautiful, compact code. and I could not find out any good reasons for most of the differences... And you won't until you use it in practice more than once. But that's true of most any language. I worked in Python by day for the better part of last year and man was it fun seeing other ideas for how to do things. e.g. how come function definitions are between 'def' and 'end'? def is shorter than PHP's function qualifier? I give up. 'end' is optionally replacable with '}', as is 'do' and '{' but you probably didn't ever get to that page in the Ruby book you read. I just don't like it and it's a matter of taste, In my experience matter of taste usually equates to resistance to learning, but call it what you will. so there is no need to argue about it more... :) There's always reason to argue the features of a given language. For example you may need to try and convince me at some point that Zombie is a great language: http://www.dangermouse.net/esoteric/zombie.html Or not. however that's not about the framework, I admit that Rails had several new and useful concepts, and I know that the framework I currently use took a lot of ideas from there. Those other frameworks can never be as powerful as Rails because they aren't written in something as meta-capable as Ruby. Can you do this in PHP? class Foo end f = Foo.new class Foo Resource.find( :all ).each do |r| res = r.name.downcase define_method( op_cost_#{ res }.to_sym ) do self.properties.inject( 0 ){ |c,p| c + p.send( op_cost_#{ res } ) } end end end cost = f.op_cost_wheat No you can't. PHP doesn't support adding methods to classes at runtime, nor does it support adding methods to instantiated objects of those classes at runtime. And that's just one example. These sort of OO advantages exist throughout Ruby. You don't love these features because you don't know they exist. You don't know they exist because you haven't given the language more than a few minutes of your time. Running through some silly little 5 minute Rails scaffolding tutorial will in no way teach you the real power that exists in Ruby. -- Greg Donald http://destiney.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Storing values between multiple page forms
Matty Sarro wrote: Yeah, I'm working on this with the hopes of it turning into a full module for a larger project I'm working on... but I'm still a bit of a noob :) Thanks for the assistance guys! On Tue, Mar 11, 2008 at 11:48 AM, Daniel Brown [EMAIL PROTECTED] wrote: On Tue, Mar 11, 2008 at 11:11 AM, Matty Sarro [EMAIL PROTECTED] wrote: Greets all! I am working on a minor project for work for entering inventory information for servers we ship out. Here is my plan: First page - Get client name, number of servers, and find number of miscellaneous equipment(s) being shipped (UPS's, monitors, etc) [snip!] I'm still planning this out... my major concern is how would I maintain values between pages? ?php session_start(); $_SESSION['value'] = $your_sanitized_value_from_POST; $_SESSION['value2'] = $your_second_sanitized_value; echo pre /\n; print_r($_SESSION); echo /pre\n; ? RTFM: http://php.net/session Keep in mind, it'll only work on the same server and same domain. Otherwise, you may want to look into using wildcard cookies. -- /Dan Daniel P. Brown Senior Unix Geek ? while(1) { $me = $mind--; sleep(86400); } ? If you are going to follow Daniel's example, since you could potentially be working with more then one server on any given order, you might want to look at using a multi-dimensional array to store your values in. $_SESSION['order_info'] = array(); $_SESSION['order_info']['customer_data'] = array(); $_SESSION['order_info']['customer_data']['name'] = ''; $contact_data = array(); $contact_data['type'] = 'billing'; $contact_data['address'] = '123 Someplace Ave'; $contact_data['city'] = 'New York'; $contact_data['state']= 'NY'; $contact_data['phone_number'] = '2134526523'; $_SESSION['order_info']['customer_data']['contact_data'][0] = $contact_data; $contact_data = array(); $contact_data['address'] = 'shipping'; $contact_data['city'] = '321 Somewhere Ave'; $contact_data['state']= 'New York'; $contact_data['state']= 'NY'; $contact_data['phone_number'] = '2134526523'; $_SESSION['order_info']['customer_data']['contact_data'][1] = $contact_data; $server['make'] = 'Dell'; $server['model'] = 'Power Edge 2400'; $server['ram'] = '2gig'; $server['hd']= '6x18g Seagate U320 SCSI'; $server['video'] = '64 ATI'; $_SESSION['order_info']['servers'][0] = $server; $server['make'] = 'Dell'; $server['model'] = 'Power Edge 2600'; $server['ram'] = '2gig'; $server['hd']= '3x36g Seagate U320 SCSI'; $server['video'] = '64 ATI'; $_SESSION['order_info']['servers'][1] = $server; As you might have guessed, I like arrays. I would actually go as far as making arrays out of the ram, hd, etc... data. This would allow me to have detailed information about each section/option. Hope this helps -- 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] Storing values between multiple page forms
On Wed, Mar 12, 2008 at 2:37 PM, Jim Lucas [EMAIL PROTECTED] wrote: If you are going to follow Daniel's example, since you could potentially be working with more then one server on any given order, you might want to look at using a multi-dimensional array to store your values in. An excellent point, Jim. I hadn't even thought to mention that, to be honest. That should be a great fit for what Matt's working on. -- /Dan Daniel P. Brown Senior Unix Geek ? while(1) { $me = $mind--; sleep(86400); } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP CLI neat errors!
So, I use a Mac to develop with. I used to host Zend Core on my box, until I switched to the MAMP PRO framework. Unfortunately somewhere in between, this lovely issue started occuring with my CLI binary of PHP: foo:~ sf$ php -l dyld: NSLinkModule() error dyld: Symbol not found: _zend_extensions Referenced from: /usr/local/Zend/Core/lib/zend/ZendExtensionManager.so Expected in: flat namespace Trace/BPT trap I could recompile PHP because if I'm reading this properly, some dynamically shared libraries aren't loading. Before I do that though, was curious if anyone ever faced the same dilemma before. Cheers! /sf -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What's wrong the __autoload()?
2008. 03. 12, szerda keltezéssel 13.27-kor Greg Donald ezt írta: On 3/12/08, Zoltán Németh [EMAIL PROTECTED] wrote: ok, I admit I don't have experience with Ruby but I have experience with php. and I don't have experience with Ruby because I read some manuals and example codes and whatnot and I just could not get to like it at all. That's a lot different from your previous blanket statement of Ruby as a language just plain sucks. I hate you less now that I know a bit more about you, see how that works? didn't you notice the smiley at the end of that line? that was not a serious plain statement but some mocking at you because you made a plain statement about RoR being better. it's just so strange and different from anything I know (php, c, java) - Ruby has a lot of functional language influence. Once you use it you really start to like how much shorter your iterative loops are for example. The first two developers I worked with using Ruby also knew ML and Scheme. One of them suggested I go study Scheme so I would appreciate Ruby more. I did so for several weeks and now I do. Ruby provides everything from the procedural world we're currently used to seeing in PHP, C, and Java, but it also adds functional style that makes for some utterly beautiful, compact code. 'utterly beautiful' is again a matter of taste :) of course, I admit that Ruby would provide me all the features I currently use, it has to, otherwise noone would start using it instead of their current language. and yes, I see from the examples that it is shorter. but is shortness/compactness such a great advantage? I'm not at all sure about that. and I could not find out any good reasons for most of the differences... And you won't until you use it in practice more than once. But that's true of most any language. I worked in Python by day for the better part of last year and man was it fun seeing other ideas for how to do things. that might be true, but in the last year I've been working on the same big project, and it seems I will be working on it for this year too, you know, next versions and such, so at this moment I don't have serious amount of time to experiment with anything. in fact, I'm also a bit workaholic and also I'm attending some evening university so I hardly have time to read a manual completely... e.g. how come function definitions are between 'def' and 'end'? def is shorter than PHP's function qualifier? I give up. 'end' is optionally replacable with '}', as is 'do' and '{' but you probably didn't ever get to that page in the Ruby book you read. as I said above, I had/have not much time, so my reading might have been sloppy... and is shortness that important? I just don't like it and it's a matter of taste, In my experience matter of taste usually equates to resistance to learning, but call it what you will. well, there is difference between that. its like if you have a very limited time frame you can spend on learning, you choose to learn more of something you like already, no? sure, if I had more time, I would experiment more with things I don't like or I don't know really. so there is no need to argue about it more... :) There's always reason to argue the features of a given language. For example you may need to try and convince me at some point that Zombie is a great language: http://www.dangermouse.net/esoteric/zombie.html Or not. however that's not about the framework, I admit that Rails had several new and useful concepts, and I know that the framework I currently use took a lot of ideas from there. Those other frameworks can never be as powerful as Rails because they aren't written in something as meta-capable as Ruby. Can you do this in PHP? class Foo end f = Foo.new class Foo Resource.find( :all ).each do |r| res = r.name.downcase define_method( op_cost_#{ res }.to_sym ) do self.properties.inject( 0 ){ |c,p| c + p.send( op_cost_#{ res } ) } end end end cost = f.op_cost_wheat No you can't. PHP doesn't support adding methods to classes at runtime, nor does it support adding methods to instantiated objects of those classes at runtime. And that's just one example. These sort of OO advantages exist throughout Ruby. You don't love these features because you don't know they exist. You don't know they exist because you haven't given the language more than a few minutes of your time. Running through some silly little 5 minute Rails scaffolding tutorial will in no way teach you the real power that exists in Ruby. hmm that feature looks interesting, however I can't really think of a case where I would want to modify the class definition of an instantiated object maybe later, when I'll have some more time I give Ruby a second run, and we'll see what comes out of that. greets, Zoltán Németh -- Greg Donald http://destiney.com/ --
RE: [PHP] What's wrong the __autoload()?
-Original Message- From: Robert Cummings [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 12, 2008 1:51 PM To: Zoltán Németh Cc: Greg Donald; php-general@lists.php.net Subject: Re: [PHP] What's wrong the __autoload()? On Wed, 2008-03-12 at 18:21 +0100, Zoltán Németh wrote: 2008. 03. 12, szerda keltezéssel 12.12-kor Greg Donald ezt írta: On 3/12/08, Zoltán Németh [EMAIL PROTECTED] wrote: but I strongly think that Ruby as a language just plain sucks ;) And exactly how many projects do you have under your belt to allow you to develop this opinion? What's the url to any one of them? Unlike you I actually have thousands of lines of Ruby code under my belt that allows me to properly develop an opinion of Ruby and Rails and how they both compare to every other programming language and framework I know and have developed in. Need a URL? ok, I admit I don't have experience with Ruby but I have experience with php. and I don't have experience with Ruby because I read some manuals and example codes and whatnot and I just could not get to like it at all. it's just so strange and different from anything I know (php, c, java) - and I could not find out any good reasons for most of the differences... e.g. how come function definitions are between 'def' and 'end'? Because they didn't follow convention... *HAHAHA* oh my, I think I just pee'd myself. Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP I think __autoload would make much more sense if it worked like an event registration feature. Such as: function myAutoloadCallback($className) { if ($className == 'ShakeItBaby') { require_once 'ShakeItBaby.class.php'; return true; } return false; } . __autoloadRegisterCallback('myAutoloadCallback'); . $shaker = new ShakeItBaby(); This way, multiple frameworks and project requirements for autoload wouldn't clash. If one of the autoload callbacks returns true that would be it. Otherwise the next autoload callback would be called, and so on. The problem with the current implementation is that if you get some piece of code that uses __autoload and you are using __autoload too, you'll have to either patch that piece of code (if the piece of code is a framework, things will get much more complicated when updating to the next version) or patch your own code, or just make a promise not to use __autoload (my current choice... just in case) or not to use pieces of code that use __autoload. Bottom line, I hate it. Something similar applies to the set_error_handling function, anyone can overwrite your error handling and you can overwrite the error handling of anyone. I hate it also, so I rather check the return value of functions, and/or use exceptions for custom error handling. I don't see why autoload and error handling can't be implemented in a stack-like way, returning false from the callback moves to the next error handler / autoloader, returning true ends the handler search process... though this is more of a question to be made to the interlals list (b... can't face their karma yet). Anyway... the more PHP approaches OOP and gets OOP features, the more it can be done through design patterns such as the Registry/Singleton/etc... and the more Exceptions are used for PECL extensions, and this seems the trend for the future of PHP. Regards, Rob(inet) Andrés Robinet | Lead Developer | BESTPLACE CORPORATION 5100 Bayview Drive 206, Royal Lauderdale Landings, Fort Lauderdale, FL 33308 | TEL 954-607-4296 | FAX 954-337-2695 | Email: [EMAIL PROTECTED] | MSN Chat: [EMAIL PROTECTED] | SKYPE: bestplace | Web: bestplace.biz | Web: seo-diy.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] What's wrong the __autoload()?
Anyone know any PHP Developers who are looking for employment -Original Message- From: Andrés Robinet [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 12, 2008 2:53 PM To: 'Robert Cummings'; 'Zoltán Németh' Cc: 'Greg Donald'; php-general@lists.php.net Subject: RE: [PHP] What's wrong the __autoload()? -Original Message- From: Robert Cummings [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 12, 2008 1:51 PM To: Zoltán Németh Cc: Greg Donald; php-general@lists.php.net Subject: Re: [PHP] What's wrong the __autoload()? On Wed, 2008-03-12 at 18:21 +0100, Zoltán Németh wrote: 2008. 03. 12, szerda keltezéssel 12.12-kor Greg Donald ezt írta: On 3/12/08, Zoltán Németh [EMAIL PROTECTED] wrote: but I strongly think that Ruby as a language just plain sucks ;) And exactly how many projects do you have under your belt to allow you to develop this opinion? What's the url to any one of them? Unlike you I actually have thousands of lines of Ruby code under my belt that allows me to properly develop an opinion of Ruby and Rails and how they both compare to every other programming language and framework I know and have developed in. Need a URL? ok, I admit I don't have experience with Ruby but I have experience with php. and I don't have experience with Ruby because I read some manuals and example codes and whatnot and I just could not get to like it at all. it's just so strange and different from anything I know (php, c, java) - and I could not find out any good reasons for most of the differences... e.g. how come function definitions are between 'def' and 'end'? Because they didn't follow convention... *HAHAHA* oh my, I think I just pee'd myself. Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP I think __autoload would make much more sense if it worked like an event registration feature. Such as: function myAutoloadCallback($className) { if ($className == 'ShakeItBaby') { require_once 'ShakeItBaby.class.php'; return true; } return false; } . __autoloadRegisterCallback('myAutoloadCallback'); . $shaker = new ShakeItBaby(); This way, multiple frameworks and project requirements for autoload wouldn't clash. If one of the autoload callbacks returns true that would be it. Otherwise the next autoload callback would be called, and so on. The problem with the current implementation is that if you get some piece of code that uses __autoload and you are using __autoload too, you'll have to either patch that piece of code (if the piece of code is a framework, things will get much more complicated when updating to the next version) or patch your own code, or just make a promise not to use __autoload (my current choice... just in case) or not to use pieces of code that use __autoload. Bottom line, I hate it. Something similar applies to the set_error_handling function, anyone can overwrite your error handling and you can overwrite the error handling of anyone. I hate it also, so I rather check the return value of functions, and/or use exceptions for custom error handling. I don't see why autoload and error handling can't be implemented in a stack-like way, returning false from the callback moves to the next error handler / autoloader, returning true ends the handler search process... though this is more of a question to be made to the interlals list (b... can't face their karma yet). Anyway... the more PHP approaches OOP and gets OOP features, the more it can be done through design patterns such as the Registry/Singleton/etc... and the more Exceptions are used for PECL extensions, and this seems the trend for the future of PHP. Regards, Rob(inet) Andrés Robinet | Lead Developer | BESTPLACE CORPORATION 5100 Bayview Drive 206, Royal Lauderdale Landings, Fort Lauderdale, FL 33308 | TEL 954-607-4296 | FAX 954-337-2695 | Email: [EMAIL PROTECTED] | MSN Chat: [EMAIL PROTECTED] | SKYPE: bestplace | Web: bestplace.biz | Web: seo-diy.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] What's wrong the __autoload()?
2008. 03. 12, szerda keltezéssel 15.07-kor Stephane Ulysse ezt írta: Anyone know any PHP Developers who are looking for employment don't hijack other people's threads, start your own if you want to ask anything. and job offers should contain some information about the job and the employer, and the subject line should be relevant to your question, and etc etc etc greets, Zoltán Németh -Original Message- From: Andrés Robinet [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 12, 2008 2:53 PM To: 'Robert Cummings'; 'Zoltán Németh' Cc: 'Greg Donald'; php-general@lists.php.net Subject: RE: [PHP] What's wrong the __autoload()? -Original Message- From: Robert Cummings [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 12, 2008 1:51 PM To: Zoltán Németh Cc: Greg Donald; php-general@lists.php.net Subject: Re: [PHP] What's wrong the __autoload()? On Wed, 2008-03-12 at 18:21 +0100, Zoltán Németh wrote: 2008. 03. 12, szerda keltezéssel 12.12-kor Greg Donald ezt írta: On 3/12/08, Zoltán Németh [EMAIL PROTECTED] wrote: but I strongly think that Ruby as a language just plain sucks ;) And exactly how many projects do you have under your belt to allow you to develop this opinion? What's the url to any one of them? Unlike you I actually have thousands of lines of Ruby code under my belt that allows me to properly develop an opinion of Ruby and Rails and how they both compare to every other programming language and framework I know and have developed in. Need a URL? ok, I admit I don't have experience with Ruby but I have experience with php. and I don't have experience with Ruby because I read some manuals and example codes and whatnot and I just could not get to like it at all. it's just so strange and different from anything I know (php, c, java) - and I could not find out any good reasons for most of the differences... e.g. how come function definitions are between 'def' and 'end'? Because they didn't follow convention... *HAHAHA* oh my, I think I just pee'd myself. Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP I think __autoload would make much more sense if it worked like an event registration feature. Such as: function myAutoloadCallback($className) { if ($className == 'ShakeItBaby') { require_once 'ShakeItBaby.class.php'; return true; } return false; } . __autoloadRegisterCallback('myAutoloadCallback'); . $shaker = new ShakeItBaby(); This way, multiple frameworks and project requirements for autoload wouldn't clash. If one of the autoload callbacks returns true that would be it. Otherwise the next autoload callback would be called, and so on. The problem with the current implementation is that if you get some piece of code that uses __autoload and you are using __autoload too, you'll have to either patch that piece of code (if the piece of code is a framework, things will get much more complicated when updating to the next version) or patch your own code, or just make a promise not to use __autoload (my current choice... just in case) or not to use pieces of code that use __autoload. Bottom line, I hate it. Something similar applies to the set_error_handling function, anyone can overwrite your error handling and you can overwrite the error handling of anyone. I hate it also, so I rather check the return value of functions, and/or use exceptions for custom error handling. I don't see why autoload and error handling can't be implemented in a stack-like way, returning false from the callback moves to the next error handler / autoloader, returning true ends the handler search process... though this is more of a question to be made to the interlals list (b... can't face their karma yet). Anyway... the more PHP approaches OOP and gets OOP features, the more it can be done through design patterns such as the Registry/Singleton/etc... and the more Exceptions are used for PECL extensions, and this seems the trend for the future of PHP. Regards, Rob(inet) Andrés Robinet | Lead Developer | BESTPLACE CORPORATION 5100 Bayview Drive 206, Royal Lauderdale Landings, Fort Lauderdale, FL 33308 | TEL 954-607-4296 | FAX 954-337-2695 | Email: [EMAIL PROTECTED] | MSN Chat: [EMAIL PROTECTED] | SKYPE: bestplace | Web: bestplace.biz | Web: seo-diy.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What's wrong the __autoload()?
On Wed, Mar 12, 2008 at 2:53 PM, Andrés Robinet [EMAIL PROTECTED] wrote: I think __autoload would make much more sense if it worked like an event registration feature. Such as: function myAutoloadCallback($className) { if ($className == 'ShakeItBaby') { require_once 'ShakeItBaby.class.php'; return true; } return false; } . __autoloadRegisterCallback('myAutoloadCallback'); . $shaker = new ShakeItBaby(); This way, multiple frameworks and project requirements for autoload wouldn't clash. If one of the autoload callbacks returns true that would be it. Otherwise the next autoload callback would be called, and so on. The problem with the current implementation is that if you get some piece of code that uses __autoload and you are using __autoload too, you'll have to either patch that piece of code (if the piece of code is a framework, things will get much more complicated when updating to the next version) or patch your own code, or just make a promise not to use __autoload (my current choice... just in case) or not to use pieces of code that use __autoload. Bottom line, I hate it. as eric pointed out earlier, thats what spl_autoload_register is for; http://us.php.net/manual/en/function.spl-autoload-register.php -nathan
Re: [PHP] What's wrong the __autoload()?
On 3/12/08, Zoltán Németh [EMAIL PROTECTED] wrote: I can't really think of a case where I would want to modify the class definition of an instantiated object You can't very well think to walk if you don't have legs. -- Greg Donald http://destiney.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What's wrong the __autoload()?
On Wed, 2008-03-12 at 14:09 -0500, Greg Donald wrote: On 3/12/08, Zoltán Németh [EMAIL PROTECTED] wrote: I can't really think of a case where I would want to modify the class definition of an instantiated object You can't very well think to walk if you don't have legs. You make it sound like this stuff is new or something. Lisp and other functional languages have had it for decades. Even JavaScript has it. Your analogy is also way off... ask any person without legs if they think about walking. These features of which you speak, someone thought of them (walking) long before they were implemented into a language (legs). But just because you think of walking and implement legs to do so, doesn't mean you can't think of flying, swimming, teleporting, etc. None of which require legs. 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] What's wrong the __autoload()?
2008. 03. 12, szerda keltezéssel 15.20-kor Robert Cummings ezt írta: Even JavaScript has it. oh yes, I could have thought of that. in JS you can assign a function to a property or variable at runtime, even I did something similar, when I assign the action functions of the buttons of a modal dialog dynamically. it's good because the same simple JS library can handle any number of use cases, and my main page with the JS libraries load only once, ajax does the rest of stuff, so I could not change the class definition for the separate cases. but on server side, why not throw everything you might need in the class definition? greets, Zoltán Németh -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What's wrong the __autoload()?
On Wed, Mar 12, 2008 at 3:35 PM, Zoltán Németh [EMAIL PROTECTED] wrote: 2008. 03. 12, szerda keltezéssel 15.20-kor Robert Cummings ezt írta: Even JavaScript has it. oh yes, I could have thought of that. in JS you can assign a function to a property or variable at runtime, even I did something similar, when I assign the action functions of the buttons of a modal dialog dynamically. it's good because the same simple JS library can handle any number of use cases, and my main page with the JS libraries load only once, ajax does the rest of stuff, so I could not change the class definition for the separate cases. but on server side, why not throw everything you might need in the class definition? javascript has this neat concept of execution context. so a single function can work w/ any 'class' or more precisely, any object. a = {d : 5}; b = {d : 6}; function c() { alert(this.d); } c.apply(a); c.apply(b); quite interesting. -nathan
Re: [PHP] What's wrong the __autoload()?
On 3/12/08, Robert Cummings [EMAIL PROTECTED] wrote: You make it sound like this stuff is new or something. Obviously to some it is. Just in this thread we had a person claim to only know PHP, C, and Java, none of which have any functional language capabilities built in. Lisp and other functional languages have had it for decades. Even JavaScript has it. I'm sorry, I lost context, what missing PHP language feature are you referring to as it? Your analogy is also way off... ask any person without legs if they think about walking. Here, let me dumb-it-down a bit: PHP doesn't have much in the way of meta-programming capabilities. Therefore one would not find it a natural thought to do much meta-programming in PHP, unless one already knew of a language where such support exists. A different example using the same logic: My Mustang doesn't have 4-wheel drive so I don't often think much about taking it through the creeks and woods by my house like my old man and I do in his Bronco that does have 4-wheel drive. A person who has never climbed a really steep hill or ran through a waist-high creek in a 4-wheel drive auto might think such a thing impossible if they were unaware of 4-wheel drive. -- Greg Donald http://destiney.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] What's wrong the __autoload()?
-Original Message- From: Nathan Nobbe [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 12, 2008 3:08 PM To: Andrés Robinet Cc: Robert Cummings; Zoltán Németh; Greg Donald; php-general@lists.php.net Subject: Re: [PHP] What's wrong the __autoload()? On Wed, Mar 12, 2008 at 2:53 PM, Andrés Robinet [EMAIL PROTECTED] wrote: I think __autoload would make much more sense if it worked like an event registration feature. Such as: function myAutoloadCallback($className) { if ($className == 'ShakeItBaby') { require_once 'ShakeItBaby.class.php'; return true; } return false; } . __autoloadRegisterCallback('myAutoloadCallback'); . $shaker = new ShakeItBaby(); This way, multiple frameworks and project requirements for autoload wouldn't clash. If one of the autoload callbacks returns true that would be it. Otherwise the next autoload callback would be called, and so on. The problem with the current implementation is that if you get some piece of code that uses __autoload and you are using __autoload too, you'll have to either patch that piece of code (if the piece of code is a framework, things will get much more complicated when updating to the next version) or patch your own code, or just make a promise not to use __autoload (my current choice... just in case) or not to use pieces of code that use __autoload. Bottom line, I hate it. as eric pointed out earlier, thats what spl_autoload_register is for; http://us.php.net/manual/en/function.spl-autoload-register.php -nathan I know, I was talking about the old/regular __autoload feature. You need PHP 5 for spl_autoload_register... but having all PHP 5's nice OOP features, you probably want to code a class/file/function/resource loader class (like ZF does) which can do much more. For PHP 4, you are stuck. But anyway, PHP 4 is dying... or seems to be. And don't speak about SPL, I had the worst of disappointments with ArrayObject... since then I got divorced with it (probably will marry it again in the future, my ancestors are French, you know French people are passionate... and they like cooking too). Now, what about set_error_handler? Maybe it's something to discuss in it's own thread, I don't know. Anyway, anyway, anyway must get back to regular work :( See you later, Rob(inet) Andrés Robinet | Lead Developer | BESTPLACE CORPORATION 5100 Bayview Drive 206, Royal Lauderdale Landings, Fort Lauderdale, FL 33308 | TEL 954-607-4296 | FAX 954-337-2695 | Email: [EMAIL PROTECTED] | MSN Chat: [EMAIL PROTECTED] | SKYPE: bestplace | Web: bestplace.biz | Web: seo-diy.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What's wrong the __autoload()?
Greg Donald wrote: Here, let me dumb-it-down a bit: PHP doesn't have much in the way of meta-programming capabilities. Therefore one would not find it a natural thought to do much meta-programming in PHP, unless one already knew of a language where such support exists. A different example using the same logic: My Mustang doesn't have 4-wheel drive so I don't often think much about taking it through the creeks and woods by my house like my old man and I do in his Bronco that does have 4-wheel drive. A person who has never climbed a really steep hill or ran through a waist-high creek in a 4-wheel drive auto might think such a thing impossible if they were unaware of 4-wheel drive. LOL well said. Aschwin Wesselius -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What's wrong the __autoload()?
On Wed, Mar 12, 2008 at 3:59 PM, Greg Donald [EMAIL PROTECTED] wrote: Lisp and other functional languages have had it for decades. Even JavaScript has it. I'm sorry, I lost context, what missing PHP language feature are you referring to as it? functional capabilities, in particular the ability to dynamically add a method to an object at runtime which you highlighted earlier. -nathan