RE: [PHP] Is there any way to get all the function name being called in a process?
http://uk3.php.net/manual/en/function.get-defined-functions.php get_defined_functions Regards Date: Fri, 23 Oct 2009 11:54:34 +0530 From: astra.sat...@gmail.com To: php-general@lists.php.net Subject: [PHP] Is there any way to get all the function name being called in aprocess? Hi, I am working on reverse engineering for a web project. I was trying to know that, is there any way(function by PHP, Zend, extension etc) to find out how many function has been called to perform a task. If no, can you suggest is it possible/feasible or not? Thanks in advance -- Satya Bangalore. _ Keep your friends updated—even when you’re not signed in. http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_5:092010
RE: [PHP] Is there any way to get all the function name being called in a process?
even APD is not up to the task xdebug trace http://devzone.zend.com/article/2871 is sufficient, but the output will be in a separate file. Thank a lot. APD is just doing what I was looking for. -- Satya Bangalore. Regards _ Windows Live: Keep your friends up to date with what you do online. http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_1:092010
RE: [PHP] how call a variable in a text
Curly brackets are usually highlighted as well so it is a good practice, generally speaking, to use them for double quoted strings and maintainability increase automatically. Regards From: esam...@barc.gov.in To: php-general@lists.php.net Date: Thu, 22 Oct 2009 11:31:53 +0530 Subject: RE: [PHP] how call a variable in a text This is always safe to use variables like this... $text = This is . $variable; Or $text = This is . $variable[0]; Regards, Samrat Kar FRD, BARC Tel: 022-25597295 Alternate Email: esam...@yahoo.com -Original Message- From: Kim Madsen [mailto:php@emax.dk] Sent: Thursday, October 22, 2009 2:25 AM To: a...@ashleysheridan.co.uk Cc: David Murphy; php-general@lists.php.net Subject: Re: [PHP] how call a variable in a text Ashley Sheridan wrote on 2009-10-21 22:43: The {} only become really useful when you're trying to reference arrays within a string: $var = array('great', 'boring'); $text = this is {$var[0]}.; Without the curly braces, PHP wouldn't be able to figure out whether you wanted the end string to be 'This is great.' or 'This is [0].' despite the variable itself clearly being an array. Ehh what? This has never been a problem for me: $text = this is $var[0].; However this does give an error (or notice, don't recall, haven't seen the error in quite a while): $text = this is $var['0'].; In that case the solution is the curly brackets: $text = this is {$var['0']}.; -- Kind regards Kim Emax - masterminds.dk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php No virus found in this incoming message. Checked by AVG - www.avg.com Version: 8.5.423 / Virus Database: 270.14.25/2450 - Release Date: 10/21/09 16:44:00 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php _ Windows Live Hotmail: Your friends can get your Facebook updates, right from Hotmail®. http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_4:092009
RE: [PHP] how call a variable in a text
Erm, the braces are meant to go *around* the variable, not around a bit of it: print Test: {$var[0][0]}; unrelated, just another usage of curly brackets $_ = 'abc'; $i = 0; echo $_{++$i}; // b Regards _ Windows Live: Friends get your Flickr, Yelp, and Digg updates when they e-mail you. http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_3:092010
RE: [PHP] how call a variable in a text
So no they are not meant to go around. You can use them this way as well. that has almost the same meaning of $_ = '_POST'; echo count($$_); which again, for readability brackets are suggested to improve maintainability $_ = '_POST'; echo count(${$_}); Regards _ Windows Live: Make it easier for your friends to see what you’re up to on Facebook. http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_2:092009
RE: [PHP] how call a variable in a text
I don't think it is about readability: $arr[3] = 'test'; $test = 3; //This prints $test echo This doesn't work: $$arr[3]; //This prints 3 echo This works: ${$arr[3]}; Using the same type way as before in this thread. Above example is a classic one where readability and maintainability deal well together. First of all everything works as expected but obviously you need to know what you need. It is ambiguous to write $$arr[3] ... what do you expect? Did you mean the variable derived by $arr[3]? echo This works: {$$arr[3]}; since curly brackets make the meaning of the expression explicit, it will be 3 indeed. What is the less ambiguous, readable, easy to maintain, way to obtain that result? echo This works: {${$arr[3]}}; If our aim is to get the variable with name equal to the value of $arr[3] Can you see now why I am talking about good practice? Zero ambiguity, and that's how I like to code Regards _ Windows Live: Friends get your Flickr, Yelp, and Digg updates when they e-mail you. http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_3:092010
RE: [PHP] Create a screenshot of a website
What you see is what a browser engine renders for your eyes while what you can do with PHP is a snapshot of the source code. Regards Date: Thu, 22 Oct 2009 09:28:15 -0400 From: reseas...@gmail.com To: php-general@lists.php.net Subject: [PHP] Create a screenshot of a website Hi, I want to be able to get a screenshot of a given website on the fly. Can you give me any suggestions. Thank you _ Keep your friends updated—even when you’re not signed in. http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_5:092010
RE: [PHP] Create a screenshot of a website
Rob, I agree, but you are suggesting is khtml2png which is cool, perfect, fantastic, but it's not PHP, isn't it? You ask me: I want a snap via PHP I reply: well, I don't think such thing exists: a render engine entirely written in PHP and GD2 Maybe we should create one ... Regards Date: Thu, 22 Oct 2009 09:40:47 -0400 From: rob...@interjinn.com To: an_...@hotmail.com CC: reseas...@gmail.com; php-general@lists.php.net Subject: Re: [PHP] Create a screenshot of a website Andrea Giammarchi wrote: What you see is what a browser engine renders for your eyes while what you can do with PHP is a snapshot of the source code. One should remember that PHP serves quite well both as a glue language and as a wrapper language. There is no reason why you can't use PHP to create a simple lib around something like khtml2png so that the screenshot can be gathered on demand using simple PHP style function calls. Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP _ Windows Live: Friends get your Flickr, Yelp, and Digg updates when they e-mail you. http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_3:092010
RE: [PHP] Create a screenshot of a website
Thanks, I checked the faq of their website. They say that I must have an an X session. I don't host myself my website. I want something that I can use only by using cpanel. What i want basically is allow the user to enter the url of a website. And the script must give him the image as output. Here we are ... you see Rob? :-) What about an iframe if this is a user website preview? Regards _ Windows Live: Keep your friends up to date with what you do online. http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_1:092010
RE: [PHP] Create a screenshot of a website
GD is just a library that PHP uses, in a similar way that you'd be utilising what khtml2png can do through PHP. What you just said doesn't make much sense. except I cannot find anything in both php.net and pecl websites Regards _ Windows Live Hotmail: Your friends can get your Facebook updates, right from Hotmail®. http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_4:092009
RE: [PHP] Create a screenshot of a website
I see you are being rather obtuse :| I use system/shell calls without problems if there is the lib I need. The problem here is that the question was, in my opinion, the classic: how to assign javascript var to php (directly) Indeed he is trying to find a PHP solution, of course with third parts libraries you can do whatever you want, but this is not the case. Good suggestion, not applicable since the question was different, so maybe I've been obtuse reading the question ... still good suggestion. Regards _ Windows Live Hotmail: Your friends can get your Facebook updates, right from Hotmail®. http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_4:092009
RE: [PHP] Fun with XSLT
is there a way to somehow embed the contents of the xml into the php code (like using EOF for html), and being able to substitute the template match string for a variable ? Any ideas ? XSLT should be used via modules, as is with match and templates indeed. The only idea is to save single modules in order to be able to create run-time the proper transformer for the specific case. Then you can save these grouped modules into other modules ... I know it's more easy to say than do it. Regards _ Windows Live: Friends get your Flickr, Yelp, and Digg updates when they e-mail you. http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_3:092010
RE: [PHP] Create a screenshot of a website
Given the knowledge (or extremely likely probability) of the non-existence of a PHP only solution for generating website thumbnails it follows that my suggestion was absolutely applicable. I have never said the opposite ... I have just said: pure PHP with standard core functions/libraries? No way so far The right question would have been: do you know any third parts library/webservice able to get a snapshot? In this case your suggestion would have been perfect :-) Regards _ Windows Live: Friends get your Flickr, Yelp, and Digg updates when they e-mail you. http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_3:092010
RE: [PHP] Create a screenshot of a website
Hi, If a windows web server is being used, we've had very good results with the activex control (use via COM within PHP5) from http://www.acasystems.com/en/web-thumb-activex/ The developer is very responsive to bug reports / feature suggestions. Full PHP example code is given for all functions as well. Now this is truly interesting, is there any particular reason it works only with windows web server? Any chance it could be somehow integrated via VM Virtual Images if the reason is driven Internet Explorer? Regards _ Windows Live Hotmail: Your friends can get your Facebook updates, right from Hotmail®. http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_4:092009
RE: [PHP] Sanitizing potential MySQL strings with no database connection
I so much avoid the silent char that sometimes I even forget this exists. I guess it is worth it for this case. Regards Date: Tue, 20 Oct 2009 21:28:06 +0200 From: dotanco...@gmail.com To: php@emax.dk CC: a...@ashleysheridan.co.uk; php-general@lists.php.net Subject: Re: [PHP] Sanitizing potential MySQL strings with no database connection if(@mysql_real_escape_string($variable) === false) Perfect! The @ symbol suppresses the error and I can structure the code according to whether or not there is a connection. Thank you! -- Dotan Cohen http://what-is-what.com http://gibberish.co.il -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php _ Keep your friends updated—even when you’re not signed in. http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_5:092010
RE: [PHP] Sanitizing potential MySQL strings with no database connection
Your only option might be to do something smart. You can't use the proper mysql functions without a connection to a database, but you refuse to connect to a database until after you perform validation... You do realise you can have several db connections open at one time, so you could have one always open for the purpose of validation? Potentially wasteful, but the architecture in this idea is a little different from the norm. I also thought mysql_real_escape_string was dead since every DAL such PDO or others uses bindings to properly escape variables and a database related sanitize without database is quite useless, imho. Regards _ Windows Live: Friends get your Flickr, Yelp, and Digg updates when they e-mail you. http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_3:092010
RE: [PHP] Sanitizing potential MySQL strings with no database connection
If says: Returns the escaped string, or FALSE on error. So all you have to do, is have warnings turned off (as it generates an E_WARNING if you have no active connection) and then look at the return value of a call to the function: if(mysql_real_escape_string($variable) === false) { // create a default DB connection } I would rather suggest: $error_reporting = error_reporting(0); if(mysql_real_escape_string($variable) === false) { // create a default DB connection } error_reporting($error_reporting); unset($error_reporting); _ Windows Live: Keep your friends up to date with what you do online. http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_1:092010
RE: [PHP] Sanitizing potential MySQL strings with no database connection
even better $error_reporting = error_reporting(0); if(mysql_real_escape_string($variable) === false) { error_reporting($error_reporting); // create a default DB connection } else error_reporting($error_reporting); unset($error_reporting); From: an_...@hotmail.com To: a...@ashleysheridan.co.uk; dotanco...@gmail.com CC: php-general@lists.php.net Date: Tue, 20 Oct 2009 15:50:52 +0200 Subject: RE: [PHP] Sanitizing potential MySQL strings with no database connection If says: Returns the escaped string, or FALSE on error. So all you have to do, is have warnings turned off (as it generates an E_WARNING if you have no active connection) and then look at the return value of a call to the function: if(mysql_real_escape_string($variable) === false) { // create a default DB connection } I would rather suggest: $error_reporting = error_reporting(0); if(mysql_real_escape_string($variable) === false) { // create a default DB connection } error_reporting($error_reporting); unset($error_reporting); _ Windows Live: Keep your friends up to date with what you do online. http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_1:092010 _ Windows Live: Keep your friends up to date with what you do online. http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_1:092010
RE: [PHP] Built-in Debugging
Specially suited for Ajax interaction, you may be interested into Formaldehyde: http://code.google.com/p/formaldehyde/ Regards Date: Thu, 15 Oct 2009 17:39:14 -0700 From: xwis...@yahoo.com To: php-general@lists.php.net Subject: [PHP] Built-in Debugging Hello, Will be ever see built-in debugging features for PHP? I know there's xdebug but it's sometimes difficult to get it working. I'm hoping that PHP will one day have integrated debugging features that can be easily enabled or disabled: ?php enable_debug(true); debug_console(Hello world!'); // sends an output to the console of the debugger. ? _ Keep your friends updated—even when you’re not signed in. http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_5:092010
RE: [PHP] How to bypass (pipe) curl_exec return value directly to a file?
I guess this should work set_time_limit(0); $ch = curl_init($siteURL); curl_setopt($ch, CURLOPT_RETURNTRANSFER, false); curl_setopt($ch, CURLOPT_BINARYTRANSFER, true); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 0); curl_setopt($ch, CURLOPT_FILE, 'stream.bin'); curl_exec($ch); Regards From: magda.hasib...@yahoo.co.uk To: php-general@lists.php.net Date: Tue, 13 Oct 2009 11:01:04 +0700 Subject: [PHP] How to bypass (pipe) curl_exec return value directly to a file? Newbie question. I need to download a very large amount of xml data from a site using CURL. How to bypass (pipe) curl_exec return value directly to a file, without using memory allocation? set_time_limit(0); $ch = curl_init($siteURL); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $mixed = curl_exec($ch); How to set/pipe $mixed as a (disk) file, so that data returned by curl_exec is directly saved to the disk-file, and not involving memory allocation? Thank you. -PHP 5 -Windows XP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php _ Windows Live: Make it easier for your friends to see what you’re up to on Facebook. http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_2:092009
RE: [PHP] How to bypass (pipe) curl_exec return value directly to a file?
$ch = curl_init($url); $fp = fopen('/tmp/curl.out', 'w'); curl_setopt($ch, CURLOPT_FILE, $fp); curl_exec($ch); Error checking etc. is of course left up to you. :) oops, I sent directly the file name. Let me reformulate the code then: set_time_limit(0); $fp = fopen('stream.bin', 'wb'); $ch = curl_init($siteURL); curl_setopt($ch, CURLOPT_RETURNTRANSFER, false); curl_setopt($ch, CURLOPT_BINARYTRANSFER, true); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 0); curl_setopt($ch, CURLOPT_FILE, $fp); curl_exec($ch); fclose($fp); Apologize I did not test it before. Regards _ Windows Live: Friends get your Flickr, Yelp, and Digg updates when they e-mail you. http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_3:092010
RE: [PHP] How to bypass (pipe) curl_exec return value directly to a file?
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 0); I wouldn't recommend setting this to 0 unless you're very sure that the connection will succeed; otherwise, your script will hang indefinitely waiting for the connection to be made. agreed, it's just he set timeout to zero so I guess he meant the curl connection as well otherwise it does not make sense to set the timeout to 0 if curl has 10 seconds timeout :-) Regards _ Windows Live Hotmail: Your friends can get your Facebook updates, right from Hotmail®. http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_4:092009
RE: [PHP] How to bypass (pipe) curl_exec return value directly to a file?
uhm, right, I should have better explain that option ... still, if timelimit is 0, I guess connection timeout matters, maybe I am wrong. Thanks. Regards Date: Tue, 13 Oct 2009 11:31:00 -0700 Subject: Re: [PHP] How to bypass (pipe) curl_exec return value directly to a file? From: larstor...@gmail.com To: an_...@hotmail.com CC: magda.hasib...@yahoo.co.uk; php-general@lists.php.net 2009/10/13 Andrea Giammarchi an_...@hotmail.com: curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 0); I wouldn't recommend setting this to 0 unless you're very sure that the connection will succeed; otherwise, your script will hang indefinitely waiting for the connection to be made. agreed, it's just he set timeout to zero so I guess he meant the curl connection as well otherwise it does not make sense to set the timeout to 0 if curl has 10 seconds timeout :-) Regards If he wants to download a very large file then it would make sense to set_time_limit(0) but leave the curl connect timeout enabled; he wouldn't want the PHP script timing out partway through a large download. :) The curl timeout isn't for the transfer; just for making the connection. Regards, Torben _ Windows Live: Friends get your Flickr, Yelp, and Digg updates when they e-mail you. http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_3:092010
RE: [PHP] Wrighting to $_POST array
But, first, you need to use get_magic_quotes_gpc() to see if magic_quotes_gpc is turned on. If so, you need to run stripslashes() on your variables before you run the mysql_real_escape_string() on them. if ( get_magic_quotes_gpc() ) { $_POST = array_map('stripslashes', $_POST); } $_POST = array_map('mysql_real_escape_string', $_POST); I would totally remove magic_quotes_gpc rather than this for each request: if ( get_magic_quotes_gpc() ) { $_GET = array_map('stripslashes', $_GET); $_POST = array_map('stripslashes', $_POST); // $_REQUEST = array_map('stripslashes', $_REQUEST); $_COOKIES = array_map('stripslashes', $_COOKIES); } there is a reason if magic_quotes has been removed by PHP defaults since ages Regards _ Windows Live: Make it easier for your friends to see what you’re up to on Facebook. http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_2:092009
RE: [PHP] Need unrounded precision
Hmmm... Didn't think about this, but % only works with int values it was just future prof precaution since this statement is false for many other languages. In few words I am not sure PHP6 does the same ... never mind so far Regards _ Keep your friends updated—even when you’re not signed in. http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_5:092010
RE: [PHP] Need unrounded precision
Couldn't this be done with just simple math functions? indeed: $a = 28.56018; $b = $a * 10 % 10 0; Regards _ Windows Live Hotmail: Your friends can get your Facebook updates, right from Hotmail®. http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_4:092009
RE: [PHP] Need unrounded precision
bitwise right shift is probably the fastest cast to int so far ... still in many languages, intval is a function call being a cast in both cases (int) is good as well ... bitwise, casting, works with strings, arrays, boolean, whatever as well. I don't think there is any difference in php, except when the integer is too big ... but this was not the case, we had to deal with 1 to 10 :-) Regards From: jbo...@mindsites.com To: an_...@hotmail.com CC: php-general@lists.php.net Date: Mon, 12 Oct 2009 11:33:10 -0500 Subject: RE: [PHP] Need unrounded precision Hmmm... Didn't think about this, but % only works with int values it was just future prof precaution since this statement is false for many other languages. In few words I am not sure PHP6 does the same ... never mind so far Good to know. In that case, I would probably just use intval() instead of since it's clearer and bitwise shifts aren't necessarily integer only either. Jaime _ Windows Live: Make it easier for your friends to see what you’re up to on Facebook. http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_2:092009
RE: [PHP] Correct handling _POST[] and implode. PHP5
echo $_POST['Colors'] . 'br /'; // outputs 'Array' try with echo 'pre', var_dump($_POST['Colors']), '/pre'; to be sure abot the structure. Also, which PHP version? Regards _ Keep your friends updated—even when you’re not signed in. http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_5:092010
RE: [PHP] Correct handling _POST[] and implode. PHP5
Its very obvious that $_POST[color] is not an array. do something like this and you wil get the values. $arr_color = $_POST[colors]; //iterate over the array foreach($arr_color as $val) { $str_color .= , . $val; } so it's simple, it's not an array, but your assignment magically makes it an array since you wrote iterate over the array ... very, very clear, isn't it? _ Windows Live: Keep your friends up to date with what you do online. http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_1:092010
RE: [PHP] Correct handling _POST[] and implode. PHP5
so it's simple, it's not an array, but your assignment magically makes it an array since you wrote iterate over the array ... very, very clear, isn't it? OK, sarcasm a part, this works perfectly for me, and it's quite obvious Colors IS an array ... ?php if(isset($_POST['Colors'])) echo implode(',', $_POST['Colors']) ; ? form method=POST action=? input type=checkbox name=Colors[] value=green checked=checked / Green input type=checkbox name=Colors[] value=yellow / Yellow input type=checkbox name=Colors[] value=red / Red input type=checkbox name=Colors[] value=gray / Gray input type=submit / /form Regards _ Windows Live: Friends get your Flickr, Yelp, and Digg updates when they e-mail you. http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_3:092010
RE: [PHP] Correct handling _POST[] and implode. PHP5
Date: Fri, 9 Oct 2009 02:07:55 -0700 From: adam.p.reyno...@gmail.com To: php-general@lists.php.net Subject: RE: [PHP] Correct handling _POST[] and implode. PHP5 I just realised I have get_magic_quotes_gpc turned on and was not catering for arrays. that's why I asked about PHP version ... latest have magic_quotes and register_globals off by default and I strongly suggest to configure whatever server like that because there shouldn't be anything magic when we talk about security or programming. Regards _ Keep your friends updated—even when you’re not signed in. http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_5:092010
RE: [PHP] Whacky increment/assignment logic with $foo++ vs ++$foo
So while we can debate computing considerations of today, tomorrow those will be less important. That was the point I was making. Why not focus on things that make significant difference and let the insignificant fade into history. I tendentiously focus on all things able to make, all together, even more significant difference. Some micro-optimization, used as common code style, can make the entire application or the specific performance critical task, possible, even with an embed language as PHP is. ++$i is not different, from my point of view, from a code where each sequential push is performed via array_push($arr, $value) rather than $arr[] = $value; Same is for all those loop such for($i = 0; $i count($staticStack); $i++); for me alien, since I've always done for($i = 0, $length = count($staticStack); $i $length; ++$i); or, even better, a core performed loop when I need values foreach($staticStack as $value); these are just examples, code style, whatever you want, and I'll never change my style unless there is a valid reason and some bench able to demonstrate I am wrong. I guess it's just a matter of point of views, but I cannot suggest slower practice cause Moore said tomorrow that CPU will strike the millisecond, 'cause on micro benchmarks, we can go faster, and that's it. Regards _ Windows Live: Keep your friends up to date with what you do online. http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_1:092010
RE: [PHP] Insult my code!
So far I stopped at the first line, the constructor, where I can spot with what I can read SQL injections everywhere I hope here is a proper validation there, 'cause as is, sounds truly dangerous, since you are not using bindParams or other PDO related techniques to avoid input problems. About the rest I kinda agree with the proper model controller, rather than just a reader. Regards To: php-general@lists.php.net Date: Wed, 7 Oct 2009 17:34:35 +1100 From: baum...@livejournal.dk Subject: [PHP] Insult my code! Hi there, I'm in the process of trying to wrap my head around MVC, and as part of that, I'm attempting to implement a super-tiny MVC framework. I've created some mockups of how the framework might be used based around a very simple 'bank', but I'm trying to get some feedback before I go and implement it, to make sure I'm actually on the right track. Any thoughts would be much appreciated! Model - http://www.pastebin.cz/23595 Controller - http://www.pastebin.cz/23597 View - http://www.pastebin.cz/23598 Template - http://www.pastebin.cz/23599 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php _ Windows Live: Friends get your Flickr, Yelp, and Digg updates when they e-mail you. http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_3:092010
RE: [PHP] Whacky increment/assignment logic with $foo++ vs ++$foo
I can write a test[1] that comes out with these results: String concat time: 0.18807196617126 String interpolation time: 0.14288902282715 Where using is faster than ' ! Common wisdom be damned! where is the test? ... and, is that kind of test where you put 12345678 variables inside a string? Cause I am developer, not a monkey, obviously if there are more than TOT concatenations to unclude variables I won't use string concatenation ... now test my case, the string $var instead of $var, and come back whenever you want. Similarly another test [2] shows that your count() method is less than microseconds faster that's enough for me ... because I don't write 1 line of code, but thousands of lines of code for an application. Less than a millisecond for a single loop, means a second when there are a lot of loops. Micro optimizations, as I said, are simply faster ... and I don't waste any time, I simply know what could be better, for that circumstance, and I use it. Waste of time is only if you don't know micro optimizations, to me these are natural, we write same application in the same time, trust me, except mine will have micro optimizations ... and at the end same development time, faster result for me, it's 1 plus 1 For those without micro optimizations knowledge, here there is a good start point but there is more: http://www.alexatnet.com/node/196 Regards, still waiting for a real case scenario where my code style will be slower ( the array , as $arr[] is the fastest, compare with a function call, array_push, and bring me results if you have time, but THAT will be a waste of time ) _ Windows Live: Friends get your Flickr, Yelp, and Digg updates when they e-mail you. http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_3:092010
RE: [PHP] Whacky increment/assignment logic with $foo++ vs ++$foo
I don't get why for you code style means effort, waste of time ... I bloody write code, how do you write a loop? The same as I do ... except I put ++i rather than i++ ... does it change ANYTHING? For you no, for me yes ... whre is the drama here? I cannot spot it, it's like saying: I don't know optimizations and for this reason I blame them ... any sense from a development point of view? Absolutely no, imho, 10 years over PHP I know this stuff, it's my code style ... zero problems, zero effort, zero waste of time ... maybe it could be for you ... but if you think ++$i , which is natural for me, is gonna take all that effort, well, ... I don't want to comment it ... It's just a flame now, you are acting like I am spending my life to micro optimize PHP which is simply a silly opinion of what I have said, I just code like that ... and I have never had problems. You neither? Good for you, I have something else to think about, cause micro optimizations are not something to think about for me, I just code like that ... maybe if I repeat again myself you'll get the point ... I just code like that, and until you'll prove my code is bad, which is not gonna happen since optimizations for you are a waste of time, I'll code like that. Have fun, I have wasted already too much time to taqlk about this silly stuff ... Best Regards Date: Wed, 7 Oct 2009 11:36:27 -0400 Subject: Re: [PHP] Whacky increment/assignment logic with $foo++ vs ++$foo From: f...@thefsb.org To: oorza...@gmail.com; an_...@hotmail.com CC: tedd.sperl...@gmail.com; php-general@lists.php.net just yesterday i was reading through this wonderful and very funny presentation: http://talks.php.net/show/froscon08/0 for me it really drove home the message (among others) that it makes sense to find out where the real gains can be made before investing your efforts in optimization. _ Windows Live Hotmail: Your friends can get your Facebook updates, right from Hotmail®. http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_4:092009
RE: [PHP] Whacky increment/assignment logic with $foo++ vs ++$foo
This is a great talk / slideshow and definitely is a better way to drive home the point that PHP execution speed is relatively meaningless in terms of user experience. Well, at least up to a point... if it takes 0.1 per response, with 10 users will be 1 second to wait ... if it takes 0.02 per user, you can manage much more users. It is that simple, and thee reason there is APC, other op cache managers/optimizers, is that speed is always critical for high traffic websites/services ... and if there is a possibility to help, the same way you justify APC, since PHP is not the bottleneck, I don't get why you are blaming me to use best practices ... seriously, what's wrong with me using ++$i it's absolutely a mystery!!! I guess you develop without caring about INSERT DELAYED when necessary, mysql_fetch_row when you know the structure, rather than mysql_fetch_assoc, and everything else that could preserve half a second ... Google servers truncated layout to make everything faster, I can only smile thinking about your arguments in a Google interview ... who care about optimizations, I am already loads of crap due to slow queries ... well, it's your choice, and not my fault. Regards ... and thanks for the slide _ Windows Live Hotmail: Your friends can get your Facebook updates, right from Hotmail®. http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_4:092009
RE: [PHP] Whacky increment/assignment logic with $foo++ vs ++$foo
Easy there hoss, no need to get worked up. In my opinion, being blamed for natural optimizations is the most ridiculous, hilarious, anti professional behavior I have ever seen ... but you are right, no need to get worked up, so have fun here. Regards _ Windows Live Hotmail: Your friends can get your Facebook updates, right from Hotmail®. http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_4:092009
RE: [PHP] A really wacky design decision
but is implicitly converted into strings when it is entered. use floatVal($str1) === floatVal($str2) then ... I honestly cannot spot any problem in what you wanna do, I can just spot an error in the root of the process: threat strings as numbers, comparing potatoes and tomatoes ... there are filters used for validation as well in php, maybe those filters, hopefully faster than PCRE, could help you to understand if a string is a number, or not. Regards _ Keep your friends updated—even when you’re not signed in. http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_5:092010
RE: [PHP] Whacky increment/assignment logic with $foo++ vs ++$foo
It will be an accident if you get the results you are expecting. I agree that the operation is illogical, I must disagree about accidents. In PHP that operation will mean assign to the new $a variable the value returned from the other $a variable before the increment. There is no mystery here, imho. Regards _ Windows Live: Keep your friends up to date with what you do online. http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_1:092010
RE: [PHP] Whacky increment/assignment logic with $foo++ vs ++$foo
Does these behaves exactly? for($i=0; $i10; ++$i) for($i=0; $i10; $i++) different benchmarks showed ++$i is usually faster than $i++ In that loop case, yes, what's happen internally is exactly the same, $i will be from 0 to 9, in the other case obviously is not the same. but pre increment and post increment are truly basic stuff ... I don-t see all this need to study the case, it's pretty simple, as is that operation, in PHP. In other languages, could have been the same, rarely in scripting languages though, at least those with still primitive scalar values (int, float, string, bool) Regards _ Windows Live Hotmail: Your friends can get your Facebook updates, right from Hotmail®. http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_4:092009
RE: [PHP] Whacky increment/assignment logic with $foo++ vs ++$foo
er ... tedd, whatever, usually ++i is faster in almost every language, and even C developers could use these kind of micro optimizations. Speed, even in this SuperCPU era, is still relevant, we would not need benchmark to compare programming languages for each purpose. Of course in a crappy application, the usage of ++i rather than i++ won't make any difference, but specially for that kind of for loop where there is absolutely no harm or side-effect using ++i rather than i++ ... if ++i could be 0.0001% nobody have a valid reason to avoid it. Put in this way: I need to do the same thing, one could be better ... why on earth should I use the other way? I just develop applications, where I can micro-optimize, I do it ... I have never had speed problems, but maybe I am just lucky. Regards Date: Tue, 6 Oct 2009 12:15:54 -0400 To: php-general@lists.php.net From: tedd.sperl...@gmail.com Subject: RE: [PHP] Whacky increment/assignment logic with $foo++ vs ++$foo At 3:56 PM +0200 10/6/09, Andrea Giammarchi wrote: Does these behaves exactly? for($i=0; $i10; ++$i) for($i=0; $i10; $i++) different benchmarks showed ++$i is usually faster than $i++ Faster is a relative term that is becoming more meaningless each year. Considering that speed is increasing and memory prices are dropping exponentially, both of those are becoming less and less important in design considerations (my opinion). The speeds of the Crays of yesteryear we are now holding in our hands as cell phones. The memory we are buying today is literally fractions of a cent of the tens of thousands of dollars we spent some 20 years ago. I venture to claim the time it took me to write this email (and for you to read it) was longer than the total time saved between using ++$i vs $i++ for all the php scripts in the world over the remaining life span of PHP. Interesting food for thought, huh? Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php _ Windows Live: Make it easier for your friends to see what you’re up to on Facebook. http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_2:092009
RE: [PHP] Whacky increment/assignment logic with $foo++ vs ++$foo
Furthermore, the amount of time micro-optimization takes up (going through old code, I mean) could be better spent doing something that actually does increase your performance, like implementing a search engine or memcached. Going forward, if you're aware that ++i and i++ are the same for your application and ++i is a single php opcode faster (which I don't know if it's even measurable, that difference), sure go ahead and use ++i but it's certainly not worth serious thought or developer time. My two cents. I do micro optimization with every language I use, when I know, and where I can. I am the one that usually solves slow query problems, and I use best practices on database as well. Guys, I don't get your point ... if you know that $var is a non-sense, feel free to use it ... what I know, is that every double quoted string require parsing, due to variable or char evaluations (\x00) evaluation, if I don't need this waste of time, why should I write a totally meaningless, useless, $var where $var is sufficient or more over 'whatever'.$var will be faster? The fact is that this is my approach for every layer of an application, I am not like that only with PHP. There is something to optimize? Make it your code style and you won't spend a sinlge second more than any other, but at least you'll do your best to reach best performances. As I have said, I have never had performances problem, and I am a full web stack developer, but you can obviously do whatever you want, is still a matter of points of view. Regards _ Windows Live: Keep your friends up to date with what you do online. http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_1:092010
RE: [PHP] Whacky increment/assignment logic with $foo++ vs ++$foo
ah ah ah that's for sure, I've never said that is correct, I said that is illogical ;-) Subject: RE: [PHP] Whacky increment/assignment logic with $foo++ vs ++$foo Date: Tue, 6 Oct 2009 12:46:36 -0500 From: jblanch...@pocket.com To: an_...@hotmail.com; tedd.sperl...@gmail.com; php-general@lists.php.net [snip] ...micro optimizations... [/snip] And in the land of micro optimization you would likely never see the following; $a = $a++; _ Windows Live: Keep your friends up to date with what you do online. http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_1:092010
RE: [PHP] Whacky increment/assignment logic with $foo++ vs ++$foo
Eddie: And thanks for supporting my point. so you think as well that 3 characters, written like this i++, in a careless way, or like this ++i, make the difference about time spent to develop ... interesting Regards _ Windows Live: Keep your friends up to date with what you do online. http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_1:092010
RE: [PHP] Whacky increment/assignment logic with $foo++ vs ++$foo
Speaking of starting a conversation, what do you think about the goto construct introduced just recently? if used properly, could avoid recursion, and speed up operations ... there is nothing wrong with goto, everything we write on lowest level is a jump in the memory (as goto is a jump in the code flow) ++goto ... and not goto++ Regards _ Windows Live: Make it easier for your friends to see what you’re up to on Facebook. http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_2:092009
RE: [PHP] Whacky increment/assignment logic with $foo++ vs ++$foo
if used properly, could avoid recursion, and speed up operations ... there is nothing wrong with goto, everything we write on lowest level is a jump in the memory (as goto is a jump in the code flow) ++goto ... and not goto++ I forgot, I have always used goto in Batch script, which indeed can emulates functions, except there is no recursion problem. I have a couple of batches online if interesting, and from performances point of view, ask yourself why on earth PHP core developers have introduced goto and actually somebody is using it ;-) Uh, I forgot I live in microoptimization land ... lol _ Keep your friends updated—even when you’re not signed in. http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_5:092010
RE: [PHP] Developer Question [DOMDocument]
saveXML and transform it via XSL It should be simple since basically the only thing you have to do is to replicate everything adding right !DOCTYPE html at the beginning and nothing else. Is this solution suitable for your requirements? Regards Date: Mon, 5 Oct 2009 01:45:03 -0700 From: mpet...@mac.com To: php-general@lists.php.net Subject: [PHP] Developer Question [DOMDocument] I'm hoping someone who knows the answer to this question is on this list. I need to modify either libxml2 and/or php DOMDocument to make a small change. Issue - saveHTML() function predates html5 (which isn't even finalized yet) and thus does not know about it's tags. the source element is new in html5 and may not have any children, so when using saveHTML() from DOMDocument, it should NOT add a closing /source tag (it should be handled the same way the param element is handled). It does the right thing with saveXML() where it properly self closes the tag, but it does not do the right thing with saveHTML(). I suspect it is a minor easy to do change, but I don't even have the foggiest idea where to look in the source to make a patch. It's not all that big of a deal, but I would like my server to spit out the correct code without me having to pass it through preg_replace. Thanks for any suggestions on where/how to define that tag in the source. Michael A. Peters -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php _ Windows Live: Make it easier for your friends to see what you’re up to on Facebook. http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_2:092009
RE: [PHP] Developer Question [DOMDocument]
search engines aren't case-sensitive! ... try to search php.net or PHP.NET in Google and you'll obtain exactly the same result ... in PHP strtolower and strToLower are exactly the same, as the same is DomDocument, DOMDocument, or DOMDOCUMENT, at least in PHP 5.3 If you used an early version (PECL) of the DomDocument it's another story but please change opinion about case sensitive searches or classes ... Regards _ Windows Live: Make it easier for your friends to see what you’re up to on Facebook. http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_2:092009
RE: [PHP] Developer Question [DOMDocument]
My apologies I read search engines ARE case sensitive ... never mind, still DomDocument and DOMDocument are the same. Regards From: an_...@hotmail.com To: a...@ashleysheridan.co.uk; mickael+...@lupusmic.org CC: php-general@lists.php.net Date: Mon, 5 Oct 2009 13:59:43 +0200 Subject: RE: [PHP] Developer Question [DOMDocument] search engines aren't case-sensitive! ... try to search php.net or PHP.NET in Google and you'll obtain exactly the same result ... in PHP strtolower and strToLower are exactly the same, as the same is DomDocument, DOMDocument, or DOMDOCUMENT, at least in PHP 5.3 If you used an early version (PECL) of the DomDocument it's another story but please change opinion about case sensitive searches or classes ... Regards _ Windows Live: Make it easier for your friends to see what you’re up to on Facebook. http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_2:092009 _ Windows Live: Friends get your Flickr, Yelp, and Digg updates when they e-mail you. http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_3:092010
RE: [PHP] Developer Question [DOMDocument]
Yeah, if it can make you feel better, you are not the only one with some PECL habit, lazily introduced in PHP as core feature changing almost everything. Regards From: a...@ashleysheridan.co.uk To: an_...@hotmail.com CC: mickael+...@lupusmic.org; php-general@lists.php.net Date: Mon, 5 Oct 2009 13:11:12 +0100 Subject: RE: [PHP] Developer Question [DOMDocument] On Mon, 2009-10-05 at 13:59 +0200, Andrea Giammarchi wrote: search engines aren't case-sensitive! ... try to search php.net or PHP.NET in Google and you'll obtain exactly the same result ... in PHP strtolower and strToLower are exactly the same, as the same is DomDocument, DOMDocument, or DOMDOCUMENT, at least in PHP 5.3 If you used an early version (PECL) of the DomDocument it's another story but please change opinion about case sensitive searches or classes ... Regards _ Windows Live: Make it easier for your friends to see what you’re up to on Facebook. http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_2:092009 I never tried to say that classes are case-sensitive, that was actually mentioned by Lupus who misunderstood what I was trying to say. What I was meaning is exactly what you just said here, that the PECL DomDocument is very different from the more typical DOMDocument. I was trying to run code examples that just weren't compatible with the differing classes which was quite frustrating! Thanks, Ash http://www.ashleysheridan.co.uk _ Windows Live: Make it easier for your friends to see what you’re up to on Facebook. http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_2:092009
RE: [PHP] Header problem
There's a useful function called headers_sent() which checks to see if the headers have already been sent to the browser. This might be a good place to throw into your code at various points to check and see if something is being written which you don't expect. true, check that as well, moreover, you talked about utf-8, well, if the BOM is automatically added, it can cause lots of problems ... still, only if you sent whatever to the output before the download. _ Windows Live: Keep your friends up to date with what you do online. http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_1:092010
RE: [PHP] A really wacky design decision
$a = 2260; $b = 226e1; $c = 2.26e3; $d = 2260.0; $a==$b==$c==$d, and $b===$c===$d $b , $c, and $d are the same indeed ... they represent the floating point 2260.0 in I think every language ... it's like saying that 1.0 is not 1. ... both floating point numbers, so I don't get your problem ... _ Windows Live: Make it easier for your friends to see what you’re up to on Facebook. http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_2:092009
RE: [PHP] A really wacky design decision
All very messy! there is nothing messy, the logic is well defined and for a loose type language it's absolutely normal behavior. Regards _ Keep your friends updated—even when you’re not signed in. http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_5:092010
RE: [PHP] class to generate Javascript Object ??
I'm thinking (hoping) there is already a php class somewhere for generating JavaScript object strings that I can instead of my ugly easily breakable way of doing it. Anyone know of one? json_encode http://uk3.php.net/manual/en/function.json-encode.php Regards _ Windows Live Hotmail: Your friends can get your Facebook updates, right from Hotmail®. http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_4:092009
RE: [PHP] Header problem
Header must come first (before you output anything) or you get a parse error I try to better explain ... HTTP works like this: you ask something, you receive something, html and texts are just one option. Your example page mess up html, zip, everything, because when you download a file you still have the rest of the page sent in the output. A download should have ONLY file related info/headers and nothing else in the output ... echo/print in the middle of the code before an header is an error, everything in output before an header is an error, everything after headers that is not related to that header is an error, got my point? To decide how a page should behave, you must be able to do not produce anything except the expected output with expected headers, that's why I have said headers are fundamental for a response, we cannot play with outputs however we want. As summary, once you have created and tried a dedicated page without a single white space or print before, during, or after the dedicated download stuff, I'll try to understand where is the error. Otherwise it could be everything, and I am against magic behaviors ... you need to download? Well, create a file which aims id to download and nothing else, or you gonna constantly find these kind of problems in your applications. Regards _ Keep your friends updated—even when you’re not signed in. http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_5:092010
RE: [PHP] Header problem
Afaik, the content length header is not necessary, but it will cause problems if it's set and it's wrong. correct, missed Content-Length means the classic download with useless progress bar and undefined estimation time, problematic for preloader as well in case of images, swf, generic data, etc. Content_length should be always present and it should be correct, but obviously if there are print or echo or other outputs non file related, Content-Length can simply mess up the response. _ Windows Live: Friends get your Flickr, Yelp, and Digg updates when they e-mail you. http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_3:092010
RE: [PHP] Header problem
Unless I am missing something, your page has too many if and it always ends up with print something ... but there is no exit after the download, so the zip will have extra output included without a reason ... which is an error, imho, dunno how else explain if you can't see your print links at the end of the page ... Regards Date: Sun, 4 Oct 2009 19:09:35 +0200 From: php@emax.dk To: php-general@lists.php.net Subject: Re: [PHP] Header problem Hello Andrea Andrea Giammarchi wrote on 2009-10-04 18:49: Header must come first (before you output anything) or you get a parse error I try to better explain ... HTTP works like this: you ask something, you receive something, html and texts are just one option. Got it so far Your example page mess up html, zip, everything, because when you download a file you still have the rest of the page sent in the output. Nops, not really. index.php: print stuff do stuff open download.php in a _new_ window. print more stuff page end this should be possible, right? Two different headers for two different pages. A download should have ONLY file related info/headers and nothing else in the output ... echo/print in the middle of the code before an header is an error, everything in output before an header is an error, everything after headers that is not related to that header is an error, got my point? Jep! And that's actually what I do. What I could, is to add exit; after the headers have been sent and the file have been pushed. I do an update of the database to tell the system that the files in the zipfile has been downloaded. To decide how a page should behave, you must be able to do not produce anything except the expected output with expected headers, that's why I have said headers are fundamental for a response, we cannot play with outputs however we want. The only output is the headers of the zipfile: header('Accept-Ranges: bytes'); header(Content-Type: application/zip); header(Content-Length: $size); header(Content-disposition: attachment; filename=\.basename($zip_filename).\); header(Content-Transfer-Encoding: binary); readfile($filename); // we need to reload top5 to have a current view unset($_SESSION['top5']); $_SESSION['reload_top5'] = 1; // NOTE second param shall be an array, not a variable when downloading zip files download_completed($member_id, $downloaded_version_ids); Wouldn't you say this is okay? As summary, once you have created and tried a dedicated page without a single white space or print before, during, or after the dedicated download stuff, I'll try to understand where is the error. Otherwise it could be everything, and I am against magic behaviors ... you need to download? Well, create a file which aims id to download and nothing else, or you gonna constantly find these kind of problems in your applications. I believe the testpage does forfill that request? Or do you mean otherwise? Kind regards Kim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php _ Windows Live Hotmail: Your friends can get your Facebook updates, right from Hotmail®. http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_4:092009
RE: [PHP] [SOLVED] class to generate Javascript Object ??
Thank you, worked beautifully. just don't ignore this: PHP 5 = 5.2.0 if you are trying to create something portable, you should consider a Pear fallback ... if(!function_exists('json_encode')){ require_once 'JSON.phps'; // http://mike.teczno.com/JSON/JSON.phps function json_encode($o){ $json = new Services_JSON; return $json-encode($o); } } Regards _ Windows Live Hotmail: Your friends can get your Facebook updates, right from Hotmail®. http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_4:092009
RE: [PHP] strtotime strangeness
Did the OS update changed the default locale settings or the default date format? From: fres...@adex-intl.com To: php-general@lists.php.net Date: Sun, 4 Oct 2009 14:05:05 -0400 Subject: [PHP] strtotime strangeness For some reason the strtotime is no longer returning the year portion. For example, strtotime(10/04/2009) will result in a date of -10-04. This started happening recently and I haven't done any updates other than the normal OS updates. I am running Mac OS X 10.5.8. Does anyone have any ideas or do I just need to install the latest version of PHP? Thanks! Floyd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php _ Windows Live: Make it easier for your friends to see what you’re up to on Facebook. http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_2:092009
RE: [PHP] A really wacky design decision
And then you discover === $i = 0; $j = count ($names); while ($i $j) { if ($names[$i] === $target) { break; } ++$i; } ... regards To: php-general@lists.php.net From: clanc...@cybec.com.au Date: Sat, 3 Oct 2009 21:21:00 +1000 Subject: [PHP] A really wacky design decision Daevid Vincent is surprised that: $num = 123; $num = $num++; print $num; //this prints 123 and not 124 ?!! To me this is relatively logical. As I understand it, the post-increment operator says do something with the variable, and then increment it. The trouble in this case is that we are doing something irrational; we are copying the number back to itself, and to me it is reasonably logical (or at least no less illogical than the alternative) to assume that if we copy it to itself, then increment the original version, the copy will not be incremented. However there is one feature of PHP which, to my mind, is really bad design. How many of you can see anything wrong with the following procedure to search a list of names for a particular name? $i = 0; $j = count ($names); while ($i $j) { if ($names[$i] == $target) { break; } ++$i; } As long as the names are conventional names, this procedure is probably safe to use. However if you allow the names to be general alphanumeric strings, it is not reliable. One of my programs recently broke down in one particular case, and when I eventually isolated the bug I discovered that it was matching '2260' to '226E1'. (The logic of this is: 226E1 = 226*10^1 = 2260). I agree that I was well aware of this trap, and that I should not have used a simple comparison, but it seems to me to be a bizarre design decision to assume that anything which can be converted to an integer, using any of the available notations, is in fact an integer, rather than making the default to simply treat it as a string. It is also a trap that it is very easy to fall into if you start off thinking about simple names, and then extend (or borrow) the procedure to use more general strings. And can anyone tell me whether, in the above case, it is sufficient to write simply: if ((string) $names[$i] == $target), or should I write: if ((string) $names[$i] == (string) $target)? (I decided to play safe and use strcmp ().) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php _ Windows Live: Keep your friends up to date with what you do online. http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_1:092010
RE: [PHP] Header problem
Do you want users download the file or the zip? do you send other headers before the download? It's quite a common error to set a default header in PHP at the beginning of whatever application, while header should be used as last exit point and never in the middle, or at the beginning, of a response. Moreover, if you use readfile and then zip what do you expect, multiple downloads in one? This is not how HTTP work ... so please show more php, or explain better what you would like to do. Regards Date: Sat, 3 Oct 2009 13:30:38 +0200 From: php@emax.dk To: php-general@lists.php.net Subject: [PHP] Header problem Hi PHP people I have a really strange and annoying problem. I've got a site, where members can download music. User clicks index.php (in index.php there's an iframe, that opens another file), if certain check are okay then a popup window opens download.php, where a mp3 file is fetched from the server and renamed in the header, then pushed to the enduser, this works fine. But now I want to create zipfiles too but when a user downloads a zipfile it's like the whole site is freezed until download has completed. My guess is that this is some sort of header problem (see headers below), due to three headers at the same time, cause the class works as expected in the test page i've created. Inputs to correct headers would be appriciated very much :-) Mp3 headers: $new_filename = attachment; filename=\{$artist} - {$title}.mp3\; header('Content-Description: File Transfer'); header(Content-Type: application/octet-stream); header(Content-Length: $size); header(Content-Disposition: $new_filename); header(Content-Transfer-Encoding: binary); readfile($source_file); Zip headers: $zip = new zipfile(); $zip-add_dir(.); $new_filename= {$artist} - {$title}.mp3; if(mysql_num_rows($result)) { $zip-add_file($file, $new_filename); } header(Pragma: public); header(Expires: 0); header(Cache-Control: must-revalidate, post-check=0, pre-check=0); header(Cache-Control: private,false); header(Content-type: application/zip); #header(Content-Type: application/octet-stream); header(Content-disposition: attachment; filename=\zipTest.zip\); header('Content-Transfer-Encoding: binary'); ob_end_clean(); echo $zip-file(); Code example: http://lps.netlinq.dk/test010/test_zip.class.php Headers (fetched with firefox add-on: live http headers) This is headers from the site, where the problem occurs: 1. click on the link to a title (Maxwell in this case) -- http://lps.netlinq.dk/?action=downloadtrack_id=357 GET /?action=downloadtrack_id=357 HTTP/1.1 Host: lps.netlinq.dk User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.2) Gecko/ 20090803 Ubuntu/9.04 (jaunty) Shiretoko/3.5.2 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/ *;q=0.8 Accept-Language: en-us,en;q=0.5 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 300 Connection: keep-alive Referer: http://lps.netlinq.dk/?action=downloadtrack_id=350 Cookie: login_email=kim%40emax.dk; PHPSESSID=fbb5d6adec802766cf6f638c99ab4f1d HTTP/1.x 200 OK Date: Fri, 02 Oct 2009 15:15:21 GMT Server: Apache/2.2.8 (Ubuntu) PHP/5.2.4-2ubuntu5.6 with Suhosin-Patch mod_ruby/1.2.6 Ruby/1.8.6(2007-09-24) mod_ssl/2.2.8 OpenSSL/0.9.8g X-Powered-By: PHP/5.2.4-2ubuntu5.6 Expires: Thu, 19 Nov 1981 08:52:00 GMT Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre- check=0 Pragma: no-cache Vary: Accept-Encoding Content-Encoding: gzip Content-Length: 4250 Keep-Alive: timeout=15, max=100 Connection: Keep-Alive Content-Type: text/html 2. I click on download zip (this is a link to index.php) if conditions are met, then a popup with download.php is activated and here a zip header is made -- http://lps.netlinq.dk/index.php POST /index.php HTTP/1.1 Host: lps.netlinq.dk User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.2) Gecko/ 20090803 Ubuntu/9.04 (jaunty) Shiretoko/3.5.2 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/ *;q=0.8 Accept-Language: en-us,en;q=0.5 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 300 Connection: keep-alive Referer: http://lps.netlinq.dk/?action=downloadtrack_id=357 Cookie: login_email=kim%40emax.dk; PHPSESSID=fbb5d6adec802766cf6f638c99ab4f1d Content-Type: application/x-www-form-urlencoded Content-Length: 131 action=ask_questionsdownload_zipfile=1version_id %5B1065%5D=1version_id%5B1066%5D=1version_id%5B1067%5D=1version_id %5B1068%5D=1 HTTP/1.x 200 OK Date: Fri, 02 Oct 2009 15:15:29 GMT Server: Apache/2.2.8 (Ubuntu) PHP/5.2.4-2ubuntu5.6 with Suhosin-Patch mod_ruby/1.2.6 Ruby/1.8.6(2007-09-24) mod_ssl/2.2.8 OpenSSL/0.9.8g X-Powered-By: PHP/5.2.4-2ubuntu5.6
RE: [PHP] Whacky increment/assignment logic with $foo++ vs ++$foo
... and, in fact, that /is/ how C behaves. The following code: int a = 2; a = a++; printf(a = [%d]\n, a); Will output a = [3]. At least on Ubuntu 9 using gcc 4.3.3. So I retract my initial terse reply and apologize for misunderstanding your question. Ben It's not that difficult to understand ... we are talking about a scripting language as PHP is The code you wrote for C is not the equivalent while this is: int a = 2, b; b = a++; printf(b = [%d]\n, b); and b will be exactly 2. In PHP you are not referencing that variable, you are overwriting variable $a with an integer, 2, and that's it. The incremented integer, 3, is simply lost in the silly logic of the operation. The equivalent of your C code, in PHP, would be just this: $a = 2; $a++; print $a; // of course is 3, the initial $a is not lost or, to be more explicit ... $a = 2; ($a = $a) and $a++; print $a; Regards _ Keep your friends updated—even when you’re not signed in. http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_5:092010
RE: [PHP] A really wacky design decision
if we compare via == there is an implicit cast to the most primitive form. These are all true, and all have a reason, and make sense: // (int)'abc' is 0 var_dump('abc' == 0); // 'abc' is not an empty string var_dump('abc' == true); // 2 is not 0, which would be casted into false, so it's true var_dump(2 == true); A common error is usually in MySQL queries without explicit cast comparing strings to numbers as well ... this is bad, specially because every programmer should have at least low level programming languages basis ... that can only help to better understand today high level programming languages. The reason we use, love, hate PHP as loose type scripting language does not mean we should avoid to understand how php works internally (C) Loose type is only manifested to the developer, but it will never be behind (still C) If you use APD or you think about the low level logic behind comparing string, num and bool you'll probably forget the == operator and you'll never miss again the === one ... then you'll start to explicit cast everything, when necessary, to have all your code truly under control, and that is the moment you'll realize PHP is not for you 'cause you are forcing a typeless language to be strict ... and then you'll start to develop via C, Python, Java, or C#, ending up with JavaScript on server side 'cause is the only scripting language, without pretending classic OOP, that makes sense ... (sorry for the last part of this reply, that's just what happened to me) Regards _ Windows Live: Friends get your Flickr, Yelp, and Digg updates when they e-mail you. http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_3:092010
RE: [PHP] A really wacky design decision
You introduced the word suddenly, it's about 10 years I develop in PHP Regards PHP allows you to do either. If I find myself being more strict in no way does that mean I'll suddenly jump to another language. It just means I have a bit of code that requires a bit more strictness. Should I suddenly switch languages because when using the strpos() function I must use the === operator to check for existence of a substring? Utter silliness IMHO. Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP _ Keep your friends updated—even when you’re not signed in. http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_5:092010
RE: [PHP] Best Practice to Create Dynamic URL's- With Username
Question I was Asked by Andrea- mod_reqrite or .htaccess is the answer, but I wonder why you choose /user/username rather than just /username a la twitter. I will be using many other aspects of my users something like /projects/username/; /gallery/username/. well, it does not matter if this service is user based. /username/ #as user home page /username/projects/ #as user projects /username/gallery/ #as user gallery /username/etc ... it's just a silly point but from user home page you isntantly know if user exists and you instantly know subsections In your way you assume that there is a gallery for that user while he could have created only projects, without galleries. So one search failed, while to go in the user page I need to digit /user/ before, not a big deal but we are in tinyurl and bit.ly era Google Code put simply a /p/ as prefix plus the project name plus subsection /p/myprojname/ /p/myprojname/wiki since you are starting now, maybe you could consider this semantic alternative, if it suits your requirements. Regards Thanks, Ash http://www.ashleysheridan.co.uk _ More than messages–check out the rest of the Windows Live™. http://www.microsoft.com/windows/windowslive/
RE: [PHP] Usage of strlen(tuf8_decode()) and /u regex modifier
$the_string = '#1052;#1072;#1088;#1080;#1085;#1072; #1054;#1088;#1083;#1086;#1074;#1072;'; did you actually wrote this or i tis the PHP ml that converted utf-8 chars? I can read only an ASCII string with length 85 ... please tell me you are not confusing HTML entities with UTF-8 encoded characters ... _ More than messages–check out the rest of the Windows Live™. http://www.microsoft.com/windows/windowslive/
RE: [PHP] wrong time stamp in log filewrong time stamp in log file
I have updated a php to version 5.2.11. you should update the keyboard as well, it fires CTRL+V twice (subject, and I am joking ..) When I run the following script: ?php print date('d M Y, H:i'); ? It's returns a correct time. correct accordingly with your local time zone, 'cause I am pretty much sure that if you do ?php print *gmdate*('d M Y, H:i'); ? the time will be exactly the same reported in the log file. You would have known this if you were developing with E_STRICT since date is a warning, even in the phpinfo, if you do not set it correctly. It's a good idea in any case, for obvious portability reasons across websites, countries, and hosts, to use gmdate for time operations, otherwise if I use date I could have stuff from the future in another host, and stuff from past in another one. Regards _ Drag n’ drop—Get easy photo sharing with Windows Live™ Photos. http://www.microsoft.com/windows/windowslive/products/photos.aspx
RE: [PHP] webpage link validation
Several ways that I can think of: * use the file_get_contents() which like you said, could be overkill * shell out to wget to retrieve just the headers for the path. You'd be looking for a 200 return code, which indicates the URI exists. * lastly, you could use fopen() to open the file, and use the return from the fopen() call to indicate a success of failure Thanks, Ash you forgot probably the best one, an HEAD call via curl library ( http://uk3.php.net/curl ) if present Regards _ Drag n’ drop—Get easy photo sharing with Windows Live™ Photos. http://www.microsoft.com/windows/windowslive/products/photos.aspx
RE: [PHP] how i assign a js variable to a php variable
basicly is use hidden inputs as a container for php variables, and transform through js. really? I though the other way round was extremely simple: echo 'script type=text/javascriptvar myPHPvar=eval(('.addslashes(json_encode($myPHPvar)).'));/script'; why would you use hidden input, plus DOM to get data, etc, etc? _ Show them the way! Add maps and directions to your party invites. http://www.microsoft.com/windows/windowslive/products/events.aspx
RE: [PHP] how i assign a js variable to a php variable
Actually, it's even more simple ... forgive me: echo 'script type=text/javascriptvar myPHPvar='.json_encode($myPHPvar).';/script'; that's pretty much it From: an_...@hotmail.com To: jonathan.desarro...@gmail.com; mail2gautambha...@gmail.com CC: saeed@gmail.com; php-general@lists.php.net Date: Fri, 18 Sep 2009 13:01:28 +0200 Subject: RE: [PHP] how i assign a js variable to a php variable basicly is use hidden inputs as a container for php variables, and transform through js. really? I though the other way round was extremely simple: echo 'script type=text/javascriptvar myPHPvar=eval(('.addslashes(json_encode($myPHPvar)).'));/script'; why would you use hidden input, plus DOM to get data, etc, etc? _ Show them the way! Add maps and directions to your party invites. http://www.microsoft.com/windows/windowslive/products/events.aspx _ With Windows Live, you can organize, edit, and share your photos. http://www.microsoft.com/middleeast/windows/windowslive/products/photo-gallery-edit.aspx
RE: [PHP] how i assign a js variable to a php variable
You can not pass this myPHPvar javascript var as an input in a form. if you want to change its value and maintein it, must to use an static var, and only can access to this values via javascript functions where an event is invoked (in case you want to read or write values) with all due respect, there is absolutely nothing you can do better or differently with an hidden input. I can send and manage a JS var the same way you do via input, except I do not need to search a node, get it, and put it back every time I need to modify that var. Remote scripting, JSONP, Ajax are ways to do it since ages. Persistence, if we are talking about refer the variable rather than recreate it, is something not possible with or without the input, 'cause as PHP serialize/unserialize session vars, in JS you can save the var in JSON format and recreate it for each page reload, unless you do not use ajax, but in that case we are talking about synchronization between a client/server mirrored variable status. If you use Ajax for the entire client session, you need to update the varialbe status only once on page unload and that's it. If you want to change a user status step by step you use localStorage, Gears, or other technologies, unless you do jnot want to overload the server with useless requests performed for each operation over the variable. Regards _ Drag n’ drop—Get easy photo sharing with Windows Live™ Photos. http://www.microsoft.com/windows/windowslive/products/photos.aspx
RE: [PHP] A little slow lately???
Maybe people really have started to rtfm! Ash well, apparently not everybody, somebody put right now a header call in the middle of the page declaring there're no white space around, I've checked it! maybe other realized that a search in the manual takes less time than a mail here ... who knows ... Regards _ More than messages–check out the rest of the Windows Live™. http://www.microsoft.com/windows/windowslive/
RE: [PHP] Re: PHP Header issue
I think this sort of issue arises particularly because of the misconception that PHP is embedded inside HTML pages. Once a person has that idea in their head, they will start to work with an HTML template and add PHP as necessary. While that can work, in cases such as this, it's best to remember that HTML (and XML or other languages, etc) is inserted into PHP scripts. I think PHP embedded is not a good idea in any case, the output should be the last thing ever to manage/perform, and not vice-versa: PHP in the middle of an output stream. This simply means more speed, less implicit or explicit echo/parsing/flow interruptions, more control, and more flexibility, since last part ever of the required page could decide at the end to produce an html page, an XML, eventually transformed via XSL (or transformed via client later), a JSON response, a PDF, an csv ... etc etc ... php embedded is the reason php is so popular but the reason there are a lot of bad applications as well - not because of its embeddable nature, simply 'casue being simple often means being used by lots of wannabe programmers sometimes not even interested about learning it more than they already know. I always says PHP is easy to use, but extremely hard to use properly. The learning curve is often stuck miles before 100/100 ... and I do not absolutely consider myself a 100/100 PHP dev ... actually, I do not know anybody that cool, maybe because at some point people switch into another language a la Python, C#, or Java ... Just my opinion, Regards _ Drag n’ drop—Get easy photo sharing with Windows Live™ Photos. http://www.microsoft.com/windows/windowslive/products/photos.aspx
RE: [PHP] APC - Upload progress problem. apc
I wonder if massive uploads, like the ones you're coding for, really aren't that common. I can imagine hard-coding that 3600 myself, and thinking, no way someone's going to be uploading a single file for longer than an hour, or even close to it. me too, also because for a silly connection problem you could even re-start the upload from the scratch. I do not think HTTP and a POST form as is is suitable for these kind of tasks, I would rather think about a truly simple Desktop software, Python for portability or AutoIT if it is only for windows, able to split the file in chunks 2 Mb each and open a conversation with the server in order to be able to resume the upload if something goes wrong or if the user would like to. With a desktop application you can send credentials and the SHA1 of the file in order to create it's ghost image on the server. Every chunk will be saved a part and when finished appended via file pointers to the main one. To allow a resume you simply need to communicate the current big file size / 2 Mb and you know which chunk needs to be uploaded. It is more simple to do than to explain, if you got this basic example about how to proceed, but you need privileges over the file in order to create a SHA1 and read only chunks via pointer, rather than send everything in a shot. Regards _ More than messages–check out the rest of the Windows Live™. http://www.microsoft.com/windows/windowslive/
RE: [PHP] ie6 memory could not be read help!
I wonder what should happen if your customers will ask you PHP 3 applications because their internal server is that old ... and I mean your *current* application for PHP3 ... well, IE 6 has the same impact for the Web Development. I am not saying we can dismiss its support, specially if we work behind banks or big lazy but somehow well paid companies administrators whose do not truly need internet related business, otherwise they would have updated ages ago to something more robust, with better performances, standards support, and more powerful, but at least we should never encourage our customers to keep using it, they are simply slowly cutting their self out of the web and every possibility it could offer. Security and Legacy? IE6 is the most bugged browser in the history of the web, so this is another reason to do not encourage our customers. Regards _ Share your memories online with anyone you want. http://www.microsoft.com/middleeast/windows/windowslive/products/photos-share.aspx?tab=1
RE: [PHP] ie6 memory could not be read help!
At that point I would consider IE6 broke. Every standard conformance test can tell you since years that IE6 is broken. At that point, you'll be exactly in the same situation, if your customers do not want to update for same reason they are not doing right now, why would you leave them alone next July when everybody is screaming against that horror software. IE6 had glorious days 7 years ago, now it's like complaining that petrol stations do not sell carbon to go anymore ... the utopia is: if tomorrow everybody will stop to support IE6 these deprecated companies will have to update - it works with everything, marketing speaking, it does not work with IE6, 'cause it's Microsoft marketing. Finally, apparently IE6 support is reminded until 2014, but for support they mean only major security problems with zero fixes about leaks, render engine, JScript, CSS support, etc etc ... but of course with SilverLight everything will be fantastic and still Microsoft Approved, they are simply doing their business, and we are simply passively following it. _ With Windows Live, you can organize, edit, and share your photos. http://www.microsoft.com/middleeast/windows/windowslive/products/photo-gallery-edit.aspx
RE: [PHP] how i assign a js variable to a php variable
I have to disagree Ash, you can pass js variable values to PHP but only through a page load. Then you could use $_REQUEST, $_POST, $_GET to retrieve it. I have done this before. And I am sure Ash does it on daily basis, the problem is the used therm: I want to *assign* ... not pass, assign! I am quite sure that is what he meant, since I cannot count people reading ?php ? in the middle of the page thinking it can interact directly with nodes and javascript, and being a new one, I think Ash replied in the correct way. Regards _ Share your memories online with anyone you want. http://www.microsoft.com/middleeast/windows/windowslive/products/photos-share.aspx?tab=1
RE: [PHP] ie6 memory could not be read help!
In a lot of the work I do these days I have to support IE6 because it's the defacto browser in various government departments. It'll be sometime before it is completely ousted. Rob, same is for me, I have to deal with this browser all problems it has every single day, 'cause financial companies would like to have the last fashion web based application ignoring they are using the worse case scenario browser. We tried to drop IE6 support for at least version 7 when 8 became official ... and you know what? Absolutely nothing changed, it's like to deal with Windows Millennium when you are trying to develop an anti virus with firewall ... a massive waste of time. Fortunately these company still have money to pay extra hours and effotr for IE6 ... so I do my job, and that's it. Regards _ More than messages–check out the rest of the Windows Live™. http://www.microsoft.com/windows/windowslive/
RE: [PHP] best function to use ~ file_get_contents or ?
The way I've always seen this approached before is by using the wget command, which can be asked to just return the headers for a page. In your case you'd be looking for all 200 codes, which means that all the sites are up. This is faster than asking to return a full image each time. but slower 'cause for each image you need to requests On the other hand, file_get_contents could return false positives cause the fact we are asking for an image does not mean an image will be returned. I would go for a curl call, where you can have both headers and content so in one call you can handle every case. A bit slower than a HEAD request, surely faster than a HEAD request plus the REQUEST. One more thing, I hope you have rights to grab these images, usually there are APIs or webservices when a website would like to share images in this way but it does not seem the case here ... Regards _ Drag n’ drop—Get easy photo sharing with Windows Live™ Photos. http://www.microsoft.com/windows/windowslive/products/photos.aspx
RE: [PHP] best function to use ~ file_get_contents or ?
This is what I said, except if you want to grab the content you need to request HEAD first and eventually GET, and this is slower than just GET parsing headers. In any case, curl is the answer, imho. Regards Requesting only the headers is a lot faster than requesting the headers AND the file itself. _ Drag n’ drop—Get easy photo sharing with Windows Live™ Photos. http://www.microsoft.com/windows/windowslive/products/photos.aspx
RE: [PHP] Insert Symbol into Mysql
does JavaScript use the proper way to encode strings as encodeURIComponent is, and for each sent key/value pair? Is MySQL table charset ut8_general_ci ? If not, do you convert sent UTF-8 charset into table charset? In few words we miss the way/library used to send data, the default PHP charset, the MySQL table charset, the way you store/retrieve data into MySQL, etc etc ... we can help but we need more info From: esam...@barc.gov.in To: php-general@lists.php.net Date: Wed, 16 Sep 2009 17:00:31 +0530 Subject: [PHP] Insert Symbol into Mysql I want to insert symbols like degree, plusminus, currency along with string into Mysql database. Front is HTML form with javascript. Server side scripts are written in PHP. Please help. Regards, Samrat Kar _ With Windows Live, you can organize, edit, and share your photos. http://www.microsoft.com/middleeast/windows/windowslive/products/photo-gallery-edit.aspx
RE: [PHP] Insert Symbol into Mysql
He has no utf-8 charset in the table, so the first point is valid and htmlentities is the function ( http://uk.php.net/manual/en/function.htmlentities.php ) You need to remember that in this way you need to use htmlentities for *everything*, specially for searches, otherwise ° against #176; will be a not found. Alternative could be mb_string for charset manipulation but since the table is not UTF-8 you could have lots of problems with other chars ... so you change the charset if this is a new project before you gonna be in trouble for size and/or performances, or you convert each stored stirng via htmlentities and you start right now to use htmlentities as default select/insert parser (or you convert everything into utf-8 via mb_string and you truncate the table, change the charset, refill it via converted values performed into another table) Regards From: a...@ashleysheridan.co.uk Two ways to do this: 1. Insert the characters as their escaped HTML codes, e.g. #176; #177; #163; (for °, ± and £) 2. Set the DB to use a utf8 character set, and insert the characters directly as is, without escaping them _ Share your memories online with anyone you want. http://www.microsoft.com/middleeast/windows/windowslive/products/photos-share.aspx?tab=1
RE: [PHP] Insert Symbol into Mysql
I don't recall him saying that a utf8 table was not an option or that he wasn't using one. I know 'cause he replied directly to me rather than this ML Also, try not to top post ;) I usually hate scroll 'till the end to find often a single row as reply ... I'll try though Thanks, Ash http://www.ashleysheridan.co.uk Thanks _ Drag n’ drop—Get easy photo sharing with Windows Live™ Photos. http://www.microsoft.com/windows/windowslive/products/photos.aspx
RE: [PHP] Insert Symbol into Mysql
If he´s really using a any other charset instead of utf8 table, why not using utf8_decode and utf8_decode in his php files to solve this? let's say PHP could have a different charset than the one defined in that MySQL table so this is not a portable solution, specially if you do not perfectly know charset and problems. Regards _ Show them the way! Add maps and directions to your party invites. http://www.microsoft.com/windows/windowslive/products/events.aspx
RE: [PHP] Insert Symbol into Mysql
Yeah, the rules say to snip out parts of the convo which aren't pertinent, but I know I don't exactly follow that one either! :-/ Thanks, Ash http://www.ashleysheridan.co.uk to be honest the problem is that I am in hotmail rather than gmail here, and this page is not clever as gmail one is, quotes/replies are quite annoying here. Thanks _ Share your memories online with anyone you want. http://www.microsoft.com/middleeast/windows/windowslive/products/photos-share.aspx?tab=1
RE: [PHP] APC - Upload progress problem. apc
I am not sure why you ended up with Flash, but here there is a good old example with APC: http://webreflection.blogspot.com/2007/10/upload-progress-bar-with-php5-apc-and.html Regards CC: php-general@lists.php.net From: phpl...@planetphred.com To: oorza...@gmail.com Date: Mon, 14 Sep 2009 04:39:26 -0500 Subject: Re: [PHP] APC - Upload progress problem. apc Bummer... It looked so promising, but on Macs, Flash has to load the entire file into memory to upload! R. So, it isn't viable for big files (Gig +) if you need it to be cross platform. So now I am looking at perl of all things! If you have any ideas let me know. thanks for all your help so far. Phred -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php _ Share your memories online with anyone you want. http://www.microsoft.com/middleeast/windows/windowslive/products/photos-share.aspx?tab=1
RE: [PHP] APC - Upload progress problem. apc
truly old alternative: http://www.devpro.it/upload_progress/ CC: php-general@lists.php.net From: phpl...@planetphred.com To: an_...@hotmail.com Subject: Re: [PHP] APC - Upload progress problem. apc Date: Mon, 14 Sep 2009 10:54:21 -0500 Hey Andrea: Ahhh yes, I've come full circle. I STARTED with php-apc. I really wanted an all-PHP solution, but apc_fetch() ALWAYS returns false a value for uploads. I can apc_add() something and apc_fetch it... but not for uploads : ( The apc.php summary page they supply that sows all the caching stats, shows upload is enabled, but no other info about upload. It seems like the upload is never being communicated to APC. (my set-up: php-apc 3.0.19, Apache2, php 5.2.10, no suhosin patch, no FastCGI) If I can get APC to do its basic thing, then I have the rest figured out (though I am going to look at your solution in more detail, thx). Unfortunately, I just don't know how to debug APC. No errors are generated - the problem is totally opaque to me. I looked at your link, and it looks great, perhaps you have some insight into my narrow APC problem. One other thing, Eddie was talking about APC not being thread-safe. I have heard this before, but also heard it refuted. Do you have any insight on this? I am going insane, so any help you can toss my way would be most merciful. Thanks, Phred On Sep 14, 2009, at 8:45 AM, Andrea Giammarchi wrote: I am not sure why you ended up with Flash, but here there is a good old example with APC: http://webreflection.blogspot.com/2007/10/upload-progress-bar-with-php5-apc-and.html Regards CC: php-general@lists.php.net From: phpl...@planetphred.com To: oorza...@gmail.com Date: Mon, 14 Sep 2009 04:39:26 -0500 Subject: Re: [PHP] APC - Upload progress problem. apc Bummer... It looked so promising, but on Macs, Flash has to load the entire file into memory to upload! R. So, it isn't viable for big files (Gig +) if you need it to be cross platform. So now I am looking at perl of all things! If you have any ideas let me know. thanks for all your help so far. Phred -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php _ Share your memories online with anyone you want. http://www.microsoft.com/middleeast/windows/windowslive/products/photos-share.aspx?tab=1 _ Share your memories online with anyone you want. http://www.microsoft.com/middleeast/windows/windowslive/products/photos-share.aspx?tab=1
RE: [PHP] APC - Upload progress problem. apc
The concept of my last link is this: the instant before you do the upload you ask PHP to scan the tmp folder, or the folder used to upload files (often the tmp) and you snap number of files, then the upload starts, and it will create a temp file with a PHP predefined prefix, you array_diff the snap with the current file list and you get the file that the user is uploading. At that point if you are lucky the input=file field will give you access to its fileSize, and you have everything to create a progress bar: the polled incremental tmp file size in the server, plus the total in the client, a bit of transitions/effects and that's it. This method is not ideal, generally speaking, because it could easily suffer concurrency between multiple users. I did not know Flash player had to put the entire file in memory, it sounds truly silly for scalability reasons, are you absolutely sure about this? About APC you need to enable it and so far I had no problems with files up to 350 Mb , I wonder why 1Gb should be a problem. Regards CC: php-general@lists.php.net From: phpl...@planetphred.com To: f...@thefsb.org Date: Mon, 14 Sep 2009 13:16:13 -0500 Subject: Re: [PHP] APC - Upload progress problem. apc On Sep 14, 2009, at 9:15 AM, Tom Worster wrote: with files that big, perhaps could write client js that polls a script on the server that simply returns the file size(s)? if you want a thermometer, use the number to resize a colored div. Thanks Tom, for weighing in. Having js poll a script on the server is kind of what APC was about, and perl as well. Are you saying I could use PHP on the server side to do this? It seems almost obvious, but no one mentions it any where on the web, so a expected there was some fundamental limitation without APC. Do you have any idea what this script might look like? Is it possible to get the temp file name before the upload is completed so that its size can be monitored? If it is, it is just too dang simple! ...but I'd take it for sure. Thanks, Phred -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php _ More than messages–check out the rest of the Windows Live™. http://www.microsoft.com/windows/windowslive/
RE: [PHP] PHP GURU NEEDED
You are looking for me than, cool! Date: Mon, 14 Sep 2009 18:38:17 +0100 From: jer...@cyber-duck.co.uk To: php-general@lists.php.net Subject: [PHP] PHP GURU NEEDED Hi All, Cyber-Duck are looking for a highly motivated PHP / CSS Guru to join our award-winning, London based digital agency, specialising in interactive media. The coding role will focus on high backend and frontend programming to create the next generation Web 2.0 / User Generated social portals. Exposure to working with wireframes and flow of control documents is highly advantageous. As a PHP developer you should be able to work under pressure and in a larger team. Excellent XHTML, and CSS are skills required. Strong Knowledge of JavaScript is required. Essential Skills required: * MVC guru * XHTML development / CSS skills * Top PHP 5 / MySQL skills * Mootools / jQuery experience * JavaScript (AJAX skills are required) * Apache / Linux configurations (excellent) * Strong understanding of BI principles With offices based in borehamwood this is an excellent opportunity to work for a company that is focused on generating tangible results that are meaningful for businesses. Please emails CV's to j...@cyber-duck.co.uk mailto:j...@cyber-duck.co.uk (reference PHP-Meet-03) Cyber-Duck does not work with recruitment consultants. This is not a Recruitment Agent Job, this is real opening at Cyber-Duck, no headache, come for an interview today if you are a PHP CSS guru Thanks Jerome Botbol Operations Manager | Cyber-Duck Ltd _ Share your memories online with anyone you want. http://www.microsoft.com/middleeast/windows/windowslive/products/photos-share.aspx?tab=1
RE: [PHP] PHP GURU NEEDED
I guess I got instantly fired with than rather than then ... nevermind From: an_...@hotmail.com To: jer...@cyber-duck.co.uk; php-general@lists.php.net Date: Mon, 14 Sep 2009 20:56:59 +0200 Subject: RE: [PHP] PHP GURU NEEDED You are looking for me than, cool! Date: Mon, 14 Sep 2009 18:38:17 +0100 From: jer...@cyber-duck.co.uk To: php-general@lists.php.net Subject: [PHP] PHP GURU NEEDED Hi All, Cyber-Duck are looking for a highly motivated PHP / CSS Guru to join our award-winning, London based digital agency, specialising in interactive media. The coding role will focus on high backend and frontend programming to create the next generation Web 2.0 / User Generated social portals. Exposure to working with wireframes and flow of control documents is highly advantageous. As a PHP developer you should be able to work under pressure and in a larger team. Excellent XHTML, and CSS are skills required. Strong Knowledge of JavaScript is required. Essential Skills required: * MVC guru * XHTML development / CSS skills * Top PHP 5 / MySQL skills * Mootools / jQuery experience * JavaScript (AJAX skills are required) * Apache / Linux configurations (excellent) * Strong understanding of BI principles With offices based in borehamwood this is an excellent opportunity to work for a company that is focused on generating tangible results that are meaningful for businesses. Please emails CV's to j...@cyber-duck.co.uk mailto:j...@cyber-duck.co.uk (reference PHP-Meet-03) Cyber-Duck does not work with recruitment consultants. This is not a Recruitment Agent Job, this is real opening at Cyber-Duck, no headache, come for an interview today if you are a PHP CSS guru Thanks Jerome Botbol Operations Manager | Cyber-Duck Ltd _ Share your memories online with anyone you want. http://www.microsoft.com/middleeast/windows/windowslive/products/photos-share.aspx?tab=1 _ Show them the way! Add maps and directions to your party invites. http://www.microsoft.com/windows/windowslive/products/events.aspx
RE: [PHP] PHP GURU NEEDED
Ah ah ah ... guys, you made my days, I cannot believe you are all ready to blame somebody else here I was obviously joking, I did not know php general list was a recruiter place and I've never read announcement in upper case here but seriously, you guys are so funny to try to force your supremacy even over jokes and that was obviously a joke, I am full time employee engineer here but one thing for sure: I am your excuse to expose ASAP your ego, your skills, and specially you is the second time in two days that blame me replying in such I feel cool way ... that's too funny. Best Regards, I won't reply recruiters anymore here, I promise (ROTFL) P.S. for Paul, indeed, that is pretty much my cv: http://www.3site.eu/ but still, I am not interested, cheers Date: Mon, 14 Sep 2009 12:18:22 -0700 From: 0xcafef...@gmail.com To: php-general@lists.php.net Subject: Re: [PHP] PHP GURU NEEDED Hello Andrea, I think it was not the main reason, I am living in California and still do a lot of careless mistakes and English native people don't blame me for that, there are able to understand as well as, you are able to understand when people are doing such mistakes in your native language, I think the main problem is the shape: Hello guys I am superman others are just crap don't listen to them, you can be a good a coder, but you know people are people, you need somehow to discuss with them, creating a relationship based on trust. Best, On Mon, Sep 14, 2009 at 12:09 PM, Andrea Giammarchi an_...@hotmail.com wrote: I guess I got instantly fired with than rather than then ... nevermind From: an_...@hotmail.com To: jer...@cyber-duck.co.uk; php-general@lists.php.net Date: Mon, 14 Sep 2009 20:56:59 +0200 Subject: RE: [PHP] PHP GURU NEEDED You are looking for me than, cool! Date: Mon, 14 Sep 2009 18:38:17 +0100 From: jer...@cyber-duck.co.uk To: php-general@lists.php.net Subject: [PHP] PHP GURU NEEDED Hi All, Cyber-Duck are looking for a highly motivated PHP / CSS Guru to join our award-winning, London based digital agency, specialising in interactive media. The coding role will focus on high backend and frontend programming to create the next generation Web 2.0 / User Generated social portals. Exposure to working with wireframes and flow of control documents is highly advantageous. As a PHP developer you should be able to work under pressure and in a larger team. Excellent XHTML, and CSS are skills required. Strong Knowledge of JavaScript is required. Essential Skills required: * MVC guru * XHTML development / CSS skills * Top PHP 5 / MySQL skills * Mootools / jQuery experience * JavaScript (AJAX skills are required) * Apache / Linux configurations (excellent) * Strong understanding of BI principles With offices based in borehamwood this is an excellent opportunity to work for a company that is focused on generating tangible results that are meaningful for businesses. Please emails CV's to j...@cyber-duck.co.uk mailto:j...@cyber-duck.co.uk (reference PHP-Meet-03) Cyber-Duck does not work with recruitment consultants. This is not a Recruitment Agent Job, this is real opening at Cyber-Duck, no headache, come for an interview today if you are a PHP CSS guru Thanks Jerome Botbol Operations Manager | Cyber-Duck Ltd _ Share your memories online with anyone you want. http://www.microsoft.com/middleeast/windows/windowslive/products/photos-share.aspx?tab=1 _ Show them the way! Add maps and directions to your party invites. http://www.microsoft.com/windows/windowslive/products/events.aspx -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php _ More than messages–check out the rest of the Windows Live™. http://www.microsoft.com/windows/windowslive/
RE: [PHP] PHP GURU NEEDED
Wht is exactly your problem? If I am that bad I have simply removed myself from the list of possible candidates, if I ever had a chance. Keep blaming other feeling the ruler here does not put you in a better position than a troll. I am sorry for the original message 'cause I thought recruiters where not allowed here (in jQuery dev, dojo, chrome, others, I have never seen recruiter inside ML) But if you behave like that all the time I would consider you an element with over-reaction problems, not truly a good team player. I live this post and sorry again to original authors. Best Regards Date: Mon, 14 Sep 2009 13:19:19 -0700 From: 0xcafef...@gmail.com To: linuxmanmi...@gmail.com CC: php-general@lists.php.net Subject: Re: [PHP] PHP GURU NEEDED Hello Mike, sure like everyone I like sometimes to troll, I don't want to be the moral warrior guy there, but when you are clever there is a time and a place to troll not when people offers job, developers like to argue this is a fact, but you have to know when it's to right time. Best, On Mon, Sep 14, 2009 at 1:10 PM, LinuxManMikeC linuxmanmi...@gmail.com wrote: On Mon, Sep 14, 2009 at 1:56 PM, mm w 0xcafef...@gmail.com wrote: you can be a good coder but you cannot be without a minimum of social skills and education You'd be surprised... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php _ Share your memories online with anyone you want. http://www.microsoft.com/middleeast/windows/windowslive/products/photos-share.aspx?tab=1
RE: [PHP] APC - Upload progress problem. apc
Can you write here how you configured APC? In my old test I had to set apc.rfc1867 = On and if you grab the zip: http://www.3site.eu/examples/APCQuery.zip tell me what is exactly wrong (I tried ages ago though, I am using other strategies right now: http://code.google.com/p/noswfupload/ - not suitable for 1Gb of files though) About trying to grab info via PHP ... there is a little problem, that page will be executed only after the file has been sent, so obviously you'll never be able to know size, error, tmp_name, before the file has benn fully stored in the tmp or specific folder, got the problem? Regards CC: f...@thefsb.org; php-general@lists.php.net From: phpl...@planetphred.com To: an_...@hotmail.com Subject: Re: [PHP] APC - Upload progress problem. apc Date: Mon, 14 Sep 2009 15:21:40 -0500 Andrea: I see. That is a cool idea, but you are right, concurrency could definitely be a problem. That's what APC is supposed to solve because it tags the file with a unique ID. But I can't get that sucker to return the value to me! If I could get APC to work I would be done. I also started looking at trying to grab the temp file, . $_FILES['video_file']['tmp_name'], and then keep checking its size on the server, but I don't think I can get the temp name from php until it is uploaded. Do you know if that is possible? One other thing, I looked at a canned media management web app ($875 US) that will do this uploading, and it doesn't require APC, so there definitely is some way to do this with basic PHP. Thanks, Phred On Sep 14, 2009, at 1:55 PM, Andrea Giammarchi wrote: The concept of my last link is this: the instant before you do the upload you ask PHP to scan the tmp folder, or the folder used to upload files (often the tmp) and you snap number of files, then the upload starts, and it will create a temp file with a PHP predefined prefix, you array_diff the snap with the current file list and you get the file that the user is uploading. At that point if you are lucky the input=file field will give you access to its fileSize, and you have everything to create a progress bar: the polled incremental tmp file size in the server, plus the total in the client, a bit of transitions/effects and that's it. This method is not ideal, generally speaking, because it could easily suffer concurrency between multiple users. I did not know Flash player had to put the entire file in memory, it sounds truly silly for scalability reasons, are you absolutely sure about this? About APC you need to enable it and so far I had no problems with files up to 350 Mb , I wonder why 1Gb should be a problem. Regards CC: php-general@lists.php.net From: phpl...@planetphred.com To: f...@thefsb.org Date: Mon, 14 Sep 2009 13:16:13 -0500 Subject: Re: [PHP] APC - Upload progress problem. apc On Sep 14, 2009, at 9:15 AM, Tom Worster wrote: with files that big, perhaps could write client js that polls a script on the server that simply returns the file size(s)? if you want a thermometer, use the number to resize a colored div. Thanks Tom, for weighing in. Having js poll a script on the server is kind of what APC was about, and perl as well. Are you saying I could use PHP on the server side to do this? It seems almost obvious, but no one mentions it any where on the web, so a expected there was some fundamental limitation without APC. Do you have any idea what this script might look like? Is it possible to get the temp file name before the upload is completed so that its size can be monitored? If it is, it is just too dang simple! ...but I'd take it for sure. Thanks, Phred -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php _ More than messages–check out the rest of the Windows Live™. http://www.microsoft.com/windows/windowslive/ _ More than messages–check out the rest of the Windows Live™. http://www.microsoft.com/windows/windowslive/
RE: [PHP] PHP GURU NEEDED
I have already said I am sorry and I explained the reason I replied in such joking way. Now, I am sure you can understand, since you say you use this ML for recruitment as well, that it would be nice to leave this subject as clear as possible. I would even suggest authors to create a new post where I will not reply at all, and hopefully you neither, so 90% of noise will be removed. Regards Date: Mon, 14 Sep 2009 14:43:01 -0700 From: 0xcafef...@gmail.com To: linuxmanmi...@gmail.com CC: php-general@lists.php.net Subject: Re: [PHP] PHP GURU NEEDED Dear Mikey Mouse you are the only one to thing so, and here the only guy who is riding a Donkey is you, I have no problem with Andrea is a smart guy, but just said it's kind of not a good point to troll when a recruiter is looking for someone and I am sorry I did not say you were trolling secondable I have 2 decates of coding behind me and also recruiting people for a well known huge company so if I don't fully understand the psychological demographics... yes and unfortunately is not something to be proud and certainly not excuse and a way to look for, before suggesting something to someone you need skills that you don't seem to have and even able to acquire. Best, On Mon, Sep 14, 2009 at 1:37 PM, LinuxManMikeC linuxmanmi...@gmail.com wrote: Who's trolling? I simply and succinctly stated that you don't fully understand the psychological demographics of IT industry employees. And frankly, you've done far more to disrupt this thread by riding in on your high and mighty horse than I did in my 3 word comment. Mr. Botbol is a big boy who can sift through the chaff without your help. Now, so as to not derail things any further, I will summarily STFU. I suggest you do the same. On Mon, Sep 14, 2009 at 2:19 PM, mm w 0xcafef...@gmail.com wrote: Hello Mike, sure like everyone I like sometimes to troll, I don't want to be the moral warrior guy there, but when you are clever there is a time and a place to troll not when people offers job, developers like to argue this is a fact, but you have to know when it's to right time. Best, On Mon, Sep 14, 2009 at 1:10 PM, LinuxManMikeC linuxmanmi...@gmail.com wrote: On Mon, Sep 14, 2009 at 1:56 PM, mm w 0xcafef...@gmail.com wrote: you can be a good coder but you cannot be without a minimum of social skills and education You'd be surprised... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php _ More than messages–check out the rest of the Windows Live™. http://www.microsoft.com/windows/windowslive/
RE: [PHP] RE: [Formaldehyde] The Most Basic Ajax - PHP Error Debugger
While it's a joke, in all fairness, it does work. only because you debugged before server side responses, and now, as I have said, you have an alternative to speed up that process. Finally, Formaldehyde JS had a typo so only today I realized it and I uploaded the version 1.01 of Formaldehyde for JavaScript so right now and only if you have 5 minutes, you can properly test the project having expected results (before was the same except the typo, now it should be OK) _ Drag n’ drop—Get easy photo sharing with Windows Live™ Photos. http://www.microsoft.com/windows/windowslive/products/photos.aspx
RE: [PHP] RE: [Formaldehyde] The Most Basic Ajax - PHP Error Debugger
While it's a joke, in all fairness, it does work. only because you debugged before server side responses, and now, as I have said, you have an alternative to speed up that process. Finally, Formaldehyde JS had a typo so only today I realized it and I uploaded the version 1.01 of Formaldehyde for JavaScript so right now and only if you have 5 minutes, you can properly test the project having expected results (before was the same except the typo, now it should be OK) _ With Windows Live, you can organize, edit, and share your photos. http://www.microsoft.com/middleeast/windows/windowslive/products/photo-gallery-edit.aspx
RE: [PHP] RE: [Formaldehyde] The Most Basic Ajax - PHP Error Debugger
That I created some fresh air or something new? Sure, thanks Date: Sat, 12 Sep 2009 11:47:27 -0700 From: li...@cmsws.com To: an_...@hotmail.com CC: pa...@quillandmouse.com; php-general@lists.php.net Subject: Re: [PHP] RE: [Formaldehyde] The Most Basic Ajax - PHP Error Debugger Andrea Giammarchi wrote: something I cannot find in any other library or framework. This should tell you something then... -- 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 _ Drag n’ drop—Get easy photo sharing with Windows Live™ Photos. http://www.microsoft.com/windows/windowslive/products/photos.aspx
RE: [PHP] RE: [Formaldehyde] The Most Basic Ajax - PHP Error Debugger
I can only say if these are our prespective about innovation and technologies, we need to thanks silly people like me moving further than what is already there and common convention. This ML is a bit different from what I was expecting, fortunately who understood the project and gave it a try to test it has been happy with it. Finally, I am working with FirePHP developer for a FirePHP + Formaldehyde natural integration in FirePHP and obviously he liked Formaldehyde, since there's nothing like that inside FirePHP - they are simply different, and FirePHP does not manage Fatal Errors and other crucial one. The good part is that at least you know there is that possibility, so the day you'll realize that your set_error_handler could be useless in certain circumstances you'll probably re-evaluate Formaldehyde ;-) Thanks to those who tried or tried to understand. Regards P.S. I am certified Zend Engineer with 10 years of experience with PHP and dunno how many innovation awards in phpclasses.org ... so it was not just to waste my time guys, and it is open source, maybe next time I'll keep for me From: jasdeb...@gmail.com Date: Sat, 12 Sep 2009 22:37:01 +0200 To: php-general@lists.php.net Subject: Re: [PHP] RE: [Formaldehyde] The Most Basic Ajax - PHP Error Debugger On Sat, Sep 12, 2009 at 8:47 PM, Jim Lucas li...@cmsws.com wrote: Andrea Giammarchi wrote: something I cannot find in any other library or framework. This should tell you something then... If something like Formandehyde isn't useful, then why is Charles so popular (note: popular from my perspective. I wouldn't dare think that it is popular with anyone on this list unless they expressly told me so) http://www.charlesproxy.com/ . I can't say anything about the responses Andrea has gotten without sounding rude and likely starting an internet fight, so I won't say anything. Except for this. Tedd, the ajax example you linked to does not need any debugging, that is for sure. -- 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 _ With Windows Live, you can organize, edit, and share your photos. http://www.microsoft.com/middleeast/windows/windowslive/products/photo-gallery-edit.aspx
RE: [PHP] RE: [Formaldehyde] The Most Basic Ajax - PHP Error Debugger
Hello Andrea, I am developing with PHP since now 12 years (did a couple stuff in Zend Core), and was one of a few guy using and sharing about php when it was only an THE Apache mode in the world C++ CGI, I am not Zend Certified, I won't :), anyway those things make me smarter or give me the truth or the right to be a jerk?, Which part is jerk, people starting replying without even looking for 1 minute the project page? People saying: what's wrong with set_error_handler, ignoring it does not catch all errors? Or people saying: if nobody did before it means it should not be done, as if the programming world and all ideas ended years ago? I wrote my skills summary just to tell you: hey guys, I am not the last arrived here, so do not threat me as a noob please, OK? I prefer answers such: I am using this other program, application, strategy, and I do not need it rather then people writing unrelated stuff or linking pages that perfectly represent the Formaldehyde scenario but they did not even spend a minute to read what Formaldehyde is so proud of theirself and their intuition ... right? They confirmed they did not read, so WTF? I was expecting somebody that develop massive Ajax application, not a link with 3 pages and zero point about the reply. you came here to claim that you were right not to discuss, what did you expect?, if you want to discuss we can, but I can tell you I don't share your points at all, it is not my way to code in scripting language. back to silence. Best I never discuss if I do not know what I am discussing about, this is my only point. Best _ Show them the way! Add maps and directions to your party invites. http://www.microsoft.com/windows/windowslive/products/events.aspx
RE: [PHP] RE: [Formaldehyde] The Most Basic Ajax - PHP Error Debugger
Hosting support, since it is 100% php with zero dependencies and zero config effort plus the ability do debug directly via console, unit testing via Selenium and/or others, and it does not require manual error catch after the generic problemi, since it will simply be showed on the client side. On the other hand, xdebug could offer a bit more such memory allocation, something could require APD if integrated with Formaldehyde (and it could be interesting, so I am not excluding I won't do it next release) Best Regards P.S. for others ... these kind of answers, questions, opinions, that IS what I was expecting Date: Sun, 13 Sep 2009 13:52:11 -0400 From: oorza...@gmail.com To: pa...@quillandmouse.com CC: php-general@lists.php.net Subject: Re: [PHP] RE: [Formaldehyde] The Most Basic Ajax - PHP Error Debugger What does this offer that a real debugger, like xdebug, doesn't? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php _ Share your memories online with anyone you want. http://www.microsoft.com/middleeast/windows/windowslive/products/photos-share.aspx?tab=1