Re: [PHP] Fatal error: Call to a member function web_order_change() on a non-object
Ben Edwards schreef: Our server has just been upgraded to PHP 5.2.5 and suddenly I am getting the following error: Fatal error: Call to a member function web_order_change() on a non-object in /var/www/vhosts/cultureshop.org/httpdocs/cart.php on line 32 The code is: $SESSION[cart]-web_order_change( true ); The command 'global $SESSION;' is the first line of the script. $SESSION is the session variable created with session_start(); session_register(SESSION); don't use session_register(), use the $_SESSION superglobal instead (notice the underscore) ... you can read in the manual about this. additionally you need to load in the class before you start the session. so the code would look something like: require 'Cart.class.php'; session_start(); if (!isset($_SESSION['cart'])) $_SESSION['cart'] = new Cart; function foo() { // no need to use global on $_SESSION $_SESSION[cart]-web_order_change( true ); } if ( !isset($SESSION[cart]) ) { $SESSION[cart] = new Cart; } I am guessing this is a change in OO handling, any idea what is going on and how to fix it? the crux of the problem lies in the use of outdated session semantics, I'm guess you've just been upgrade from 4.x, is that correct? Regards, Ben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Crop part of existing pdf
e.g. Draw a box in the middle of page with mouse, then crop it. CC: php-general@lists.php.net From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Date: Mon, 3 Mar 2008 22:25:07 -0800 Subject: Re: [PHP] Crop part of existing pdf On Mar 3, 2008, at 614PM, gary liang wrote: Is there any command line tool, which is able to crop part of pdf file? I ask for command line tool, because it can be used in php code. Any hint? Depending on what exactly you mean by cropping a pdf, pdftk may be what you need. http://www.accesspdf.com/pdftk/ Brady -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php _ Overpaid or Underpaid? Check our comprehensive Salary Centre http://a.ninemsn.com.au/b.aspx?URL=http%3A%2F%2Fcontent%2Emycareer%2Ecom%2Eau%2Fsalary%2Dcentre%3Fs%5Fcid%3D595810_t=766724125_r=Hotmail_Email_Tagline_MyCareer_Oct07_m=EXT -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] imap_setflags_full Seen
Richard Lynch schreef: I am trying to use this: imap_setflag_full($imap, $uid, Seen, FT_UID) or die(Unable to mark message as \\Seen); 3 things: 1. shouldn't it be ST_UID iso FT_UID? 2. the imap bos is opened readonly? 3. er ... I l-i-e-d :-) to mark a message as read It does not seem to have any effect on the return values in imap_fetch_overview. Nor does it appear as read when I view it with my email client. The unseen count on the mailbox also does not decrease, which I would expect if it was working Is there some kind of trick I'm missing? Is there some OTHER flag/function I'm supposed to be using to mark a message as Read? I sure can't find it in tfm so far... The $imap stream is valid, and I can fetch the headers and body just fine. The $uid is from imap_uid and, again, is used to fetch the header and body just fine. I've tried imap_close($imap, CL_EXPUNGE) in the hopes that it would write the changes, but no such luck. PHP 4.4.7 Hardened Gentoo 2.6.18 hardened R6 SMP phpinfo says IMAP c-client Version 2004 w/ SSL support enabled Gentoo says courier-imap 4.0.6-r2 is installed, so probably using that. The versions are out of my control, due to a security and stability focus of this install. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP performance
Eric Butera schreef: On Mon, Mar 3, 2008 at 6:18 PM, Chris [EMAIL PROTECTED] wrote: Just FYI, using ADODB will slow down the performance of your app. Any function calls cost against you and it all adds up. If you remove it, then you remove functionality - so before you go and rip it out, check whether it's the bottleneck using xdebug. I use an abstraction layer all the time and the benefits far outweigh the 'costs'. -- Postgresql php tutorials http://www.designmagick.com/ Hi Chris, These 'benefits' you talk about really only matter if you switch your databases. If this app is written against Oracle and they never plan to change it, then it isn't a bad idea to cut out that fat and just deal with the native interface. Even writing wrapper functions that are very basic that abstract mysql_query or mssql_query end up adding a lot of overhead over lots of requests. Look at some of the PDO benchmarks. It is slower than the native functions too because it is just a wrapper. Even further if you are writing an app where you care about performance you should be writing your SQL to the point where it really isn't portable using all the little vendor specific features so that you get the most out of it. From my personal profiling most of my application time is spent in data access. So the less layers you have there the faster it runs. the adodb php layers are insignificant compared to the cost of the db connection and the round trip to retrieve data from the db. the significant application time you speak of is undoubtly spent at the database performing and retrieving the data as opposed to measurable overhead caused by a [number of] wrapper function[s]. high probability that SQL related tweaks (indexing, query restructuring, db tuning) will win you much, much more than removing any db abstraction layer But that is just my 2cents on it. :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RES: [PHP] PHP performance
-Mensagem original- De: Jochem Maas [mailto:[EMAIL PROTECTED] Eric Butera schreef: On Mon, Mar 3, 2008 at 6:18 PM, Chris [EMAIL PROTECTED] wrote: Just FYI, using ADODB will slow down the performance of your app. Any function calls cost against you and it all adds up. If you remove it, then you remove functionality - so before you go and rip it out, check whether it's the bottleneck using xdebug. I use an abstraction layer all the time and the benefits far outweigh the 'costs'. -- Postgresql php tutorials http://www.designmagick.com/ Hi Chris, These 'benefits' you talk about really only matter if you switch your databases. If this app is written against Oracle and they never plan to change it, then it isn't a bad idea to cut out that fat and just deal with the native interface. Even writing wrapper functions that are very basic that abstract mysql_query or mssql_query end up adding a lot of overhead over lots of requests. Look at some of the PDO benchmarks. It is slower than the native functions too because it is just a wrapper. Even further if you are writing an app where you care about performance you should be writing your SQL to the point where it really isn't portable using all the little vendor specific features so that you get the most out of it. From my personal profiling most of my application time is spent in data access. So the less layers you have there the faster it runs. the adodb php layers are insignificant compared to the cost of the db connection and the round trip to retrieve data from the db. the significant application time you speak of is undoubtly spent at the database performing and retrieving the data as opposed to measurable overhead caused by a [number of] wrapper function[s]. high probability that SQL related tweaks (indexing, query restructuring, db tuning) will win you much, much more than removing any db abstraction layer But that is just my 2cents on it. :) me First of all, thanks for helping me out :) The vb.net stuff does a lot of business and database stuff, it's really tied up with the app. Actually I've no idea how it works internally, all I know is that we send data strings via socket and it returns the results the same way. It's kind of a black box. :/ I'm going for: Tune SQL and move a lot of heavy queries directly to procedures/functions in BD Tune apache Perhaps switch from PHP4=5 (if I'm allowed to) Try memchache We had a talk with a sysadmin and tried installing xdebug in the server, but it's a RHEL4AS w/o php-devel packages (phpize) and we can't find a RPM for that anyone? :) Thiago /me -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] 2 Questions: Static variables and the nature of the online manual
Hello, I got this e-mail address from the Add note¹ page within the php.net website. I was going to post something that was a question and I realised I was in the wrong place :) I have 2 basic questions and I¹m sorry if they may seem too basic. I¹m a bit new to php. The first question has to do with the static variables. I understand how this works from the examples, but there is something that I cannot seem to find clearly stated anywhere on that page. The example: ?php function Test() { static $a = 0; echo $a; $a++; } ? Of course works (I¹ve tested it on my server), but it is still obscure to me, according to general programming principles, since I¹m still assigning zero (0) to $a on each call to the Test function. How does this exactly work when the static word is found? Is there and index that keeps track of each call to the function ignoring any assignment in subsequent calls to the function? Why doens¹t this work when you assign an expression result to the variable? The second question has to do with the online manual. I¹ve found several things on that manual specified in comments and not in the actual manual part of it. What is the nature of the manual? Contributions from voluteers? Is there any official manual I can buy that documents everything about the language from the source? Or any official company that maintains the language and that possibly offers support as well? Many thanks in advance for your time.
Re: RES: [PHP] PHP performance
Thiago Pojda wrote: -Mensagem original- De: Jochem Maas [mailto:[EMAIL PROTECTED] Eric Butera schreef: On Mon, Mar 3, 2008 at 6:18 PM, Chris [EMAIL PROTECTED] wrote: Just FYI, using ADODB will slow down the performance of your app. Any function calls cost against you and it all adds up. If you remove it, then you remove functionality - so before you go and rip it out, check whether it's the bottleneck using xdebug. I use an abstraction layer all the time and the benefits far outweigh the 'costs'. -- Postgresql php tutorials http://www.designmagick.com/ Hi Chris, These 'benefits' you talk about really only matter if you switch your databases. If this app is written against Oracle and they never plan to change it, then it isn't a bad idea to cut out that fat and just deal with the native interface. Even writing wrapper functions that are very basic that abstract mysql_query or mssql_query end up adding a lot of overhead over lots of requests. Look at some of the PDO benchmarks. It is slower than the native functions too because it is just a wrapper. Even further if you are writing an app where you care about performance you should be writing your SQL to the point where it really isn't portable using all the little vendor specific features so that you get the most out of it. From my personal profiling most of my application time is spent in data access. So the less layers you have there the faster it runs. the adodb php layers are insignificant compared to the cost of the db connection and the round trip to retrieve data from the db. the significant application time you speak of is undoubtly spent at the database performing and retrieving the data as opposed to measurable overhead caused by a [number of] wrapper function[s]. high probability that SQL related tweaks (indexing, query restructuring, db tuning) will win you much, much more than removing any db abstraction layer But that is just my 2cents on it. :) me First of all, thanks for helping me out :) The vb.net stuff does a lot of business and database stuff, it's really tied up with the app. Actually I've no idea how it works internally, all I know is that we send data strings via socket and it returns the results the same way. It's kind of a black box. :/ I'm going for: Tune SQL and move a lot of heavy queries directly to procedures/functions in BD Tune apache Perhaps switch from PHP4=5 (if I'm allowed to) Try memchache We had a talk with a sysadmin and tried installing xdebug in the server, but it's a RHEL4AS w/o php-devel packages (phpize) and we can't find a RPM for that anyone? :) Thiago /me if its a plesk box, save yourself the time [and the company your wages] and get a new rhel5 box (if you must stay rhel). -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: 2 Questions: Static variables and the nature of the online manual
Svevo Romano wrote: Hello, I got this e-mail address from the ŒAdd note¹ page within the php.net website. I was going to post something that was a question and I realised I was in the wrong place :) I have 2 basic questions and I¹m sorry if they may seem too basic. I¹m a bit new to php. The first question has to do with the static variables. I understand how this works from the examples, but there is something that I cannot seem to find clearly stated anywhere on that page. The example: ?php function Test() { static $a = 0; echo $a; $a++; } ? Of course works (I¹ve tested it on my server), but it is still obscure to me, according to general programming principles, since I¹m still assigning zero (0) to $a on each call to the Test function. How does this exactly work when the static word is found? Is there and index that keeps track of each call to the function ignoring any assignment in subsequent calls to the function? Why doens¹t this work when you assign an expression result to the variable? The second question has to do with the online manual. I¹ve found several things on that manual specified in comments and not in the actual manual part of it. What is the nature of the manual? Contributions from voluteers? Is there any official manual I can buy that documents everything about the language from the source? Or any official company that maintains the language and that possibly offers support as well? Many thanks in advance for your time. $static $a = 0; Here you're essentially saying new static variable $a with a default value of 0 - the fact defined staticly means that next time you call the funtion, $a has a value so therefore doesn't need the default. :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] 2 Questions: Static variables and the nature of the online manual
Svevo Romano schreef: Hello, I got this e-mail address from the ŒAdd note¹ page within the php.net website. I was going to post something that was a question and I realised I was in the wrong place :) I have 2 basic questions and I¹m sorry if they may seem too basic. I¹m a bit new to php. The first question has to do with the static variables. I understand how this works from the examples, but there is something that I cannot seem to find clearly stated anywhere on that page. The example: ?php function Test() { static $a = 0; the preceding line is only run on the first call to the function. echo $a; $a++; } ? Of course works (I¹ve tested it on my server), but it is still obscure to me, according to general programming principles, since I¹m still assigning zero (0) to $a on each call to the Test function. How does this exactly work when the static word is found? Is there and index that keeps track of each call to the function ignoring any assignment in subsequent calls to the function? Why doens¹t this work when you assign an expression result to the variable? do something like function Test() { static $a; if (!isset($a)) $a = 0; if ($a % 2) $a = $a * 2; echo $a++; } The second question has to do with the online manual. I¹ve found several things on that manual specified in comments and not in the actual manual part of it. What is the nature of the manual? Contributions from voluteers? Is there any official manual I can buy that documents everything about the language from the source? Or any official company that maintains the language and that possibly offers support as well? php.net/ is the official manual. recommended to read it in english so your looking at the latest version (not always the case in other languages). user notes/comments are exactly that - notes, tips, gotcha's, examples related to whatever is documented on a given manual page. occasionally some of the best user notes are merged into the official documentation. Many thanks in advance for your time. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP performance
On Tue, Mar 4, 2008 at 5:51 AM, Jochem Maas [EMAIL PROTECTED] wrote: Eric Butera schreef: On Mon, Mar 3, 2008 at 6:18 PM, Chris [EMAIL PROTECTED] wrote: Just FYI, using ADODB will slow down the performance of your app. Any function calls cost against you and it all adds up. If you remove it, then you remove functionality - so before you go and rip it out, check whether it's the bottleneck using xdebug. I use an abstraction layer all the time and the benefits far outweigh the 'costs'. -- Postgresql php tutorials http://www.designmagick.com/ Hi Chris, These 'benefits' you talk about really only matter if you switch your databases. If this app is written against Oracle and they never plan to change it, then it isn't a bad idea to cut out that fat and just deal with the native interface. Even writing wrapper functions that are very basic that abstract mysql_query or mssql_query end up adding a lot of overhead over lots of requests. Look at some of the PDO benchmarks. It is slower than the native functions too because it is just a wrapper. Even further if you are writing an app where you care about performance you should be writing your SQL to the point where it really isn't portable using all the little vendor specific features so that you get the most out of it. From my personal profiling most of my application time is spent in data access. So the less layers you have there the faster it runs. the adodb php layers are insignificant compared to the cost of the db connection and the round trip to retrieve data from the db. the significant application time you speak of is undoubtly spent at the database performing and retrieving the data as opposed to measurable overhead caused by a [number of] wrapper function[s]. high probability that SQL related tweaks (indexing, query restructuring, db tuning) will win you much, much more than removing any db abstraction layer But that is just my 2cents on it. :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Hi Jochem, This is probably true. I was just referring to an old benchmark [1] I had seen a few years ago. Of course the biggest win will come from an opcode cache if that is a possibility. Just for the record I do use a db wrapper myself but I have weighed the pros and cons of the situation and determined that it works for me. I have many low traffic sites so it makes sense to have a wrapper that delays connections until they're used and such other little tweaks. I listen to peoples recoded talks from conferences and I've heard on many occasions that on single apps they take out the db abstraction. I wish I could cite references but it is out there if you want to dig enough. [1] http://phplens.com/lens/adodb/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Fatal error: Call to a member function web_order_change() on a non-object
On Tue, Mar 4, 2008 at 5:09 AM, Jochem Maas [EMAIL PROTECTED] wrote: Ben Edwards schreef: Our server has just been upgraded to PHP 5.2.5 and suddenly I am getting the following error: Fatal error: Call to a member function web_order_change() on a non-object in /var/www/vhosts/cultureshop.org/httpdocs/cart.php on line 32 The code is: $SESSION[cart]-web_order_change( true ); The command 'global $SESSION;' is the first line of the script. $SESSION is the session variable created with session_start(); session_register(SESSION); don't use session_register(), use the $_SESSION superglobal instead (notice the underscore) ... you can read in the manual about this. additionally you need to load in the class before you start the session. so the code would look something like: require 'Cart.class.php'; session_start(); if (!isset($_SESSION['cart'])) $_SESSION['cart'] = new Cart; function foo() { // no need to use global on $_SESSION $_SESSION[cart]-web_order_change( true ); } if ( !isset($SESSION[cart]) ) { $SESSION[cart] = new Cart; } I am guessing this is a change in OO handling, any idea what is going on and how to fix it? the crux of the problem lies in the use of outdated session semantics, I'm guess you've just been upgrade from 4.x, is that correct? Regards, Ben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php He might not have loaded the class definition also. That'd lead to the nasty __PHP_Incomplete_Class. Or maybe it is something to do with class names in php4 weren't case sensitive whereas in php5 they are. I've used the unserialize_callback_func feature before to auto load classes. Oh I just read that Jim said this earlier, but I'm going to post it anyways after typing it up. ;) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] maintaining [user] state without a session ...
hi people, hi Stut! Stut mentioned a little while back that he avoids using the built-in session mechanism if at all possible, but still manages to track user state ... now I can think of a way or two that he might do that but I was wondering if any one could give an idea about the write way to do it in terms of high performance :-) tia, Jochem -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] maintaining [user] state without a session ...
[snip] Stut mentioned a little while back that he avoids using the built-in session mechanism if at all possible, but still manages to track user state ... now I can think of a way or two that he might do that but I was wondering if any one could give an idea about the write way to do it in terms of high performance :-) [/snip] User state without sessions? This should be interesting -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] maintaining [user] state without a session ...
On 4 Mar 2008, at 14:05, Jay Blanchard wrote: [snip] Stut mentioned a little while back that he avoids using the built-in session mechanism if at all possible, but still manages to track user state ... now I can think of a way or two that he might do that but I was wondering if any one could give an idea about the write way to do it in terms of high performance :-) [/snip] User state without sessions? This should be interesting That's not quite what I or Jochem said. What I do is basically a session system but it keeps the session data in encrypted cookies rather than using a server-side solution. I'm working on an article for my website that describes exactly how I'm doing it and what the issues are but it's not ready yet. I'll let the list know when it's done. -Stut -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] maintaining [user] state without a session ...
Hi, It depends what do you need to track, if you need to track small amount of variables you can do it by cookie I often use it eg here is the state for one user $state = array{ 'logedin'=true, 'n'='Peter', 'id'='5', //anything else you need } //at end of you script before outputing any content //set cookie only for browser session and set path to '/' so it is available through whole site setcookie('user_data',serialize($state),null,'/'); At the begining of a script $state = isset($_GET['user_data']) ? $_GET['user_data'] : null; if( ! $state ) { //user doesnt support cookies or this is a search engine set default $params $state = array{ 'logedin'=false, 'n'=null, 'id'=null, //anything else you need } } Also you can use some way to detect if the user is not Search engine to display message like To properly use this site you need to enable cookies in your browser bla bla This can be done via JS alert message which will not be triggered by SE but only by real user On Mar 4, 2008, at 2:57 PM, Jochem Maas wrote: hi people, hi Stut! Stut mentioned a little while back that he avoids using the built- in session mechanism if at all possible, but still manages to track user state ... now I can think of a way or two that he might do that but I was wondering if any one could give an idea about the write way to do it in terms of high performance :-) tia, Jochem -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Bojan Tesanovic http://www.classicio.com/
Re: [PHP] Get country from Phone number
Dani Castaños wrote: As a little project, I took the link provided by the other Rob and make this little search tool. It only looks at the beginning numbers. It does no number validation. I don't validate the length of the number. ie: I would have to know the min/max lenth of each phone number for that given country/region, and I didn't search for that information. Let me know what you'll think. http://www.cmsws.com/examples/php/areacodes/countrycodes.php It's enough for me... Can you send me the code please? I am making the source available here. http://www.cmsws.com/examples/php/areacodes/countrycodes.phps Take note, this is not a complete list of all the possible country/region codes, I made it more specific where needed. A couple countries have the same country code, so from the page mentioned before, I took and got a little more specific, just so there wasn't any collisions. There still are, and in that case, I join all the country names together with or . Should work for most cases, you could always just pull the first country name listed. You will see what I mean when you look at the code. -- Jim Lucas Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them. Twelfth Night, Act II, Scene V by William Shakespeare -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Making an interactive RGB color picker
At 4:42 PM -0500 3/3/08, Daniel Brown wrote: On Mon, Mar 3, 2008 at 3:13 PM, Keikonium [EMAIL PROTECTED] wrote: This may not be exactly what you think, but I didn't know how else to word the title. I basically need to make a script that will go through every possible color combination and print them to look just like (or similar) to the windows color picker. I need it in the format X-Y-Z. For example: It's also available to view here (but the demo is limited to save my server from Yahoo! Slurps, Google grabs, etc.): [Demo] http://www.pilotpig.net/code-library/colorpicker.php [Source] http://www.pilotpig.net/code-library/source.php?f=colorpicker.php While people are giving demo's, check this out: http://webbytedd.com/c/access-color/ The code is there, it's javascript. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Making an interactive RGB color picker
On Tue, Mar 4, 2008 at 10:44 AM, tedd [EMAIL PROTECTED] wrote: While people are giving demo's, check this out: http://webbytedd.com/c/access-color/ The code is there, it's javascript. Ooh, it's purdy and shiny and I like it. -- /Dan Daniel P. Brown Senior Unix Geek ? while(1) { $me = $mind--; sleep(86400); } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Making sure an include file works
At 6:58 PM -0800 2/28/08, Richard S. Crawford wrote: I'm trying to figure out a way to make sure an included PHP file has no syntax errors before actually including it as a part of project. Is this even possible? I'm running into brick walls. I'm not sure if this is what you are asking for, but occasionally I have an include file that just brings functions and sometimes I want to know if that file has any errors in it. As such, I simply add echo('a'); at the beginning of the file. If I run the script that includes that include and see an 'a' printed at the top of the page, then I know that the include has no syntax errors. Then it's simple to comment out that line. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] maintaining [user] state without a session ...
On Tue, Mar 4, 2008 at 9:10 AM, Stut [EMAIL PROTECTED] wrote: I'm working on an article for my website that describes exactly how I'm doing it and what the issues are but it's not ready yet. I'll let the list know when it's done. Is it done yet? -- /Dan Daniel P. Brown Senior Unix Geek ? while(1) { $me = $mind--; sleep(86400); } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] 2 Questions: Static variables and the nature of the online manual
Hi there, Many thanks for your answer. I've also gone through your example and it took me 10 minutes to understand how the operator precedence was working there. Was expecting 1 on the first call :) But this is not the point. You've nailed my question very preciseley in your first answer: 'the preceding line is only run on the first call to the function'. My only question is (at it is related to the nature of the online manual): how do you know it and I don't? This thing is the only logical explanation to the fact the $a doesn't get initialized again to 0 in any subsequent call to the function, but it's not written anywhere in the manual page. And it seems the most important statement in my opinion, that justifies what I see as an exception to a normal flow. Hope all this makes sense. Thanks, S In 4/3/08 13:14, Jochem Maas, [EMAIL PROTECTED] ha scritto Svevo Romano schreef: Hello, I got this e-mail address from the ŒAdd note¹ page within the php.net website. I was going to post something that was a question and I realised I was in the wrong place :) I have 2 basic questions and I¹m sorry if they may seem too basic. I¹m a bit new to php. The first question has to do with the static variables. I understand how this works from the examples, but there is something that I cannot seem to find clearly stated anywhere on that page. The example: ?php function Test() { static $a = 0; the preceding line is only run on the first call to the function. echo $a; $a++; } ? Of course works (I¹ve tested it on my server), but it is still obscure to me, according to general programming principles, since I¹m still assigning zero (0) to $a on each call to the Test function. How does this exactly work when the static word is found? Is there and index that keeps track of each call to the function ignoring any assignment in subsequent calls to the function? Why doens¹t this work when you assign an expression result to the variable? do something like function Test() { static $a; if (!isset($a)) $a = 0; if ($a % 2) $a = $a * 2; echo $a++; } The second question has to do with the online manual. I¹ve found several things on that manual specified in comments and not in the actual manual part of it. What is the nature of the manual? Contributions from voluteers? Is there any official manual I can buy that documents everything about the language from the source? Or any official company that maintains the language and that possibly offers support as well? php.net/ is the official manual. recommended to read it in english so your looking at the latest version (not always the case in other languages). user notes/comments are exactly that - notes, tips, gotcha's, examples related to whatever is documented on a given manual page. occasionally some of the best user notes are merged into the official documentation. Many thanks in advance for your time.
Re: [PHP] 2 Questions: Static variables and the nature of the online manual
On Tue, Mar 4, 2008 at 7:16 AM, Svevo Romano [EMAIL PROTECTED] wrote: The second question has to do with the online manual. I¹ve found several things on that manual specified in comments and not in the actual manual part of it. What is the nature of the manual? Contributions from voluteers? Is there any official manual I can buy that documents everything about the language from the source? Or any official company that maintains the language and that possibly offers support as well? We (the PHP community) maintain the manual through registered CVS accounts. As Jochem said, php.net is the official manual - there is no official manual to buy, and no way for a company to document everything about the language. This is because, believe it or not, the language changes multiple times per day, with added functionality all the time. The best a company could do is document everything on a specific version but by the time that task is complete, the version documented would be obsolete. The comments are just posts by whomever feels like typing and submitting. It's generally a tips and tricks sort of thing, and is an excellent source, but an unofficial source. -- /Dan Daniel P. Brown Senior Unix Geek ? while(1) { $me = $mind--; sleep(86400); } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Making sure an include file works
At 7:52 PM + 2/29/08, Richard Heyes wrote: 1. My host does not allow command line access and has disabled shell execution of PHP; 2. Error reporting has been turned off and I can't seem to turn that on with ini_set or error_reporting (which is fun when I have minor syntax errors to fix); and 3. My host is also stuck in PHP 4.3, so the check_syntax function isn't available to me either (although I understand that this function has been deprecated in the most recent builds of PHP). To be quite honest, your host sounds like it sucks donkey dick. Get another if you can. Try: http://www.pilotpig.com/ They do it much better (hosting, not the donkey thing). :-) Cheers, -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] maintaining [user] state without a session ...
On Tue, Mar 4, 2008 at 11:09 AM, Stut [EMAIL PROTECTED] wrote: On 4 Mar 2008, at 15:52, Daniel Brown wrote: On Tue, Mar 4, 2008 at 9:10 AM, Stut [EMAIL PROTECTED] wrote: I'm working on an article for my website that describes exactly how I'm doing it and what the issues are but it's not ready yet. I'll let the list know when it's done. Is it done yet? No. I have a day job, that takes priority. You're full of crap. I have a day job, too, but I still feel like I spend half of my time reading and responding to list posts. ;-P -- /Dan Daniel P. Brown Senior Unix Geek ? while(1) { $me = $mind--; sleep(86400); } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] maintaining [user] state without a session ...
On Mar 4, 2008, at 11:11 AM, Daniel Brown wrote: On Tue, Mar 4, 2008 at 11:09 AM, Stut [EMAIL PROTECTED] wrote: On 4 Mar 2008, at 15:52, Daniel Brown wrote: On Tue, Mar 4, 2008 at 9:10 AM, Stut [EMAIL PROTECTED] wrote: I'm working on an article for my website that describes exactly how I'm doing it and what the issues are but it's not ready yet. I'll let the list know when it's done. Is it done yet? No. I have a day job, that takes priority. You're full of crap. I have a day job, too, but I still feel like I spend half of my time reading and responding to list posts. ;-P Ummm... Mr. Brown... I'm pretty sure you do :P You need to talk to Richard and get the code for his AI so you don't get in trouble for not getting your work done :) -- /Dan Daniel P. Brown Senior Unix Geek ? while(1) { $me = $mind--; sleep(86400); } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Jason Pruim Raoset Inc. Technology Manager MQC Specialist 3251 132nd ave Holland, MI, 49424-9337 www.raoset.com [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] maintaining [user] state without a session ...
On 4 Mar 2008, at 16:11, Daniel Brown wrote: On Tue, Mar 4, 2008 at 11:09 AM, Stut [EMAIL PROTECTED] wrote: On 4 Mar 2008, at 15:52, Daniel Brown wrote: On Tue, Mar 4, 2008 at 9:10 AM, Stut [EMAIL PROTECTED] wrote: I'm working on an article for my website that describes exactly how I'm doing it and what the issues are but it's not ready yet. I'll let the list know when it's done. Is it done yet? No. I have a day job, that takes priority. You're full of crap. I have a day job, too, but I still feel like I spend half of my time reading and responding to list posts. ;-P Your employer must be so ... erm ... proud. Anyways, it's a bad time. I have a deadline for the first time in months, and I intend to hit it! -Stut -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] 2 Questions: Static variables and the nature of the online manual
I would hazard a guess that the 'static' keyword and functionality comes from ANSI C. I just pulled The C Programming Language by Kernighan and Ritchie from the book case and it is described there in it. Essential book, by the way, IMHO. -- -David. When the power of love overcomes the love of power, the world will know peace. -Jimi Hendrix -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] GPS Locator
http://www.phpclasses.org/browse/package/3507.html bastien Date: Tue, 4 Mar 2008 10:18:15 -0600 From: [EMAIL PROTECTED] To: php-general@lists.php.net Subject: [PHP] GPS Locator Howdy group! I know that this is not a PHP question (but it will work with a PHP app) but I thought I would ask the smartest group of people I know if they have any clue or would be familiar with a device I can use. I need to purchase a small GPS receiver/antenna that will plug into a USB port. Then I need to access the port (Ajax? Java?) while in my web application to deliver the coordinates to my PHP application. That will give me the physical location of the machine accessing the application. Any insight will be valuable. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php _
Re: [PHP] maintaining [user] state without a session ...
Daniel Brown schreef: On Tue, Mar 4, 2008 at 11:09 AM, Stut [EMAIL PROTECTED] wrote: On 4 Mar 2008, at 15:52, Daniel Brown wrote: On Tue, Mar 4, 2008 at 9:10 AM, Stut [EMAIL PROTECTED] wrote: I'm working on an article for my website that describes exactly how I'm doing it and what the issues are but it's not ready yet. I'll let the list know when it's done. Is it done yet? No. I have a day job, that takes priority. You're full of crap. I have a day job, too, but I still feel like I spend half of my time reading and responding to list posts. ;-P you should check the stats mail you send out ... I think it will confirm your feeling ;-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] 2 Questions: Static variables and the nature of the online manual
Just one word, Thanks :) S In 4/3/08 16:22, David Giragosian, [EMAIL PROTECTED] ha scritto I would hazard a guess that the 'static' keyword and functionality comes from ANSI C. I just pulled The C Programming Language by Kernighan and Ritchie from the book case and it is described there in it. Essential book, by the way, IMHO. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] 2 Questions: Static variables and the nature of the online manual
On Tue, Mar 4, 2008 at 11:12 AM, Svevo Romano [EMAIL PROTECTED] wrote: Still, I jusy wonder how Jochem knew that the line is only executed the first time a function is called while this info is not available on the online manual. It's maybe all about how close you are to the community and how many degrees are between yourself and the source? Check the section Using static variables in the Variable Scope entry here: http://us.php.net/manual/en/language.variables.scope.php I mean, I understand the manual is maintained by the community, but I suppose the language is developed by a small core of programmers that participate to the general discussion to some extent... Actually, a good portion of us who maintain the manual maintain the code, as well. Everything about the language, from the core engine to web scripting support, is handled entirely by the community. That's the beauty of open source. I'm just trying to figure out the shape of the landscape. I tend to start from the bigger picture before getting into details. :) And welcome to the community, Svevo! -- /Dan Daniel P. Brown Senior Unix Geek ? while(1) { $me = $mind--; sleep(86400); } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] GPS Locator
Howdy group! I know that this is not a PHP question (but it will work with a PHP app) but I thought I would ask the smartest group of people I know if they have any clue or would be familiar with a device I can use. I need to purchase a small GPS receiver/antenna that will plug into a USB port. Then I need to access the port (Ajax? Java?) while in my web application to deliver the coordinates to my PHP application. That will give me the physical location of the machine accessing the application. Any insight will be valuable. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] maintaining [user] state without a session ...
On Tue, Mar 4, 2008 at 11:14 AM, Jochem Maas [EMAIL PROTECTED] wrote: Daniel Brown schreef: You're full of crap. I have a day job, too, but I still feel like I spend half of my time reading and responding to list posts. ;-P you should check the stats mail you send out ... I think it will confirm your feeling ;-) Yeah people are going to start thinking Richard Lynch and I are the same person (like Michael and Janet Jackson). The same week he goes under the radar, I hit 123 posts. Ludicrous. -- /Dan Daniel P. Brown Senior Unix Geek ? while(1) { $me = $mind--; sleep(86400); } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] 2 Questions: Static variables and the nature of the online manual
Hi Daniel, Many thanks to you as well. I really appreciate your effort in answering my queries guys. It means I'll do my best with books and the online manual. And today I've probably found the best resource. The community! Still, I jusy wonder how Jochem knew that the line is only executed the first time a function is called while this info is not available on the online manual. It's maybe all about how close you are to the community and how many degrees are between yourself and the source? I mean, I understand the manual is maintained by the community, but I suppose the language is developed by a small core of programmers that participate to the general discussion to some extent... I¹m just trying to figure out the shape of the landscape. I tend to start from the bigger picture before getting into details. :) Cheers In 4/3/08 16:00, Daniel Brown, [EMAIL PROTECTED] ha scritto On Tue, Mar 4, 2008 at 7:16 AM, Svevo Romano [EMAIL PROTECTED] wrote: The second question has to do with the online manual. I¹ve found several things on that manual specified in comments and not in the actual manual part of it. What is the nature of the manual? Contributions from voluteers? Is there any official manual I can buy that documents everything about the language from the source? Or any official company that maintains the language and that possibly offers support as well? We (the PHP community) maintain the manual through registered CVS accounts. As Jochem said, php.net is the official manual - there is no official manual to buy, and no way for a company to document everything about the language. This is because, believe it or not, the language changes multiple times per day, with added functionality all the time. The best a company could do is document everything on a specific version but by the time that task is complete, the version documented would be obsolete. The comments are just posts by whomever feels like typing and submitting. It's generally a tips and tricks sort of thing, and is an excellent source, but an unofficial source.
Re: [PHP] maintaining [user] state without a session ...
Stut schreef: On 4 Mar 2008, at 15:52, Daniel Brown wrote: On Tue, Mar 4, 2008 at 9:10 AM, Stut [EMAIL PROTECTED] wrote: I'm working on an article for my website that describes exactly how I'm doing it and what the issues are but it's not ready yet. I'll let the list know when it's done. Is it done yet? No. I have a day job, that takes priority. everyone has an excuse these days ;-) look forward to reading about it when your done :-) -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] maintaining [user] state without a session ...
On 4 Mar 2008, at 15:52, Daniel Brown wrote: On Tue, Mar 4, 2008 at 9:10 AM, Stut [EMAIL PROTECTED] wrote: I'm working on an article for my website that describes exactly how I'm doing it and what the issues are but it's not ready yet. I'll let the list know when it's done. Is it done yet? No. I have a day job, that takes priority. -Stut -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] 2 Questions: Static variables and the nature of the online manual
Svevo Romano schreef: Hi there, Many thanks for your answer. I've also gone through your example and it took me 10 minutes to understand how the operator precedence was working there. Was expecting 1 on the first call :) But this is not the point. You've nailed my question very preciseley in your first answer: 'the preceding line is only run on the first call to the function'. My only question is (at it is related to the nature of the online manual): how do you know it and I don't? This thing is the only logical explanation to the fact the $a doesn't get initialized again to 0 in any subsequent call to the function, but it's not written anywhere in the manual page. And it seems the most important statement in my opinion, that justifies what I see as an exception to a normal flow. can't remember where I picked up the meaning/working of 'static' - I think I just worked it out by trial and error, or I read about it sometime on this list :-) the manual does talk about statics: http://php.net/static notice you can type 'http://php.net/FOO' to go straight to certain docs, replace FOO with a function name, extension name, core concept, or whatever ... if nothing is found you get a 'did you mean ?' type page otherwise you go directly to the relevant manual page. Hope all this makes sense. Thanks, S In 4/3/08 13:14, Jochem Maas, [EMAIL PROTECTED] ha scritto Svevo Romano schreef: Hello, I got this e-mail address from the ŒAdd note¹ page within the php.net website. I was going to post something that was a question and I realised I was in the wrong place :) I have 2 basic questions and I¹m sorry if they may seem too basic. I¹m a bit new to php. The first question has to do with the static variables. I understand how this works from the examples, but there is something that I cannot seem to find clearly stated anywhere on that page. The example: ?php function Test() { static $a = 0; the preceding line is only run on the first call to the function. echo $a; $a++; } ? Of course works (I¹ve tested it on my server), but it is still obscure to me, according to general programming principles, since I¹m still assigning zero (0) to $a on each call to the Test function. How does this exactly work when the static word is found? Is there and index that keeps track of each call to the function ignoring any assignment in subsequent calls to the function? Why doens¹t this work when you assign an expression result to the variable? do something like function Test() { static $a; if (!isset($a)) $a = 0; if ($a % 2) $a = $a * 2; echo $a++; } The second question has to do with the online manual. I¹ve found several things on that manual specified in comments and not in the actual manual part of it. What is the nature of the manual? Contributions from voluteers? Is there any official manual I can buy that documents everything about the language from the source? Or any official company that maintains the language and that possibly offers support as well? php.net/ is the official manual. recommended to read it in english so your looking at the latest version (not always the case in other languages). user notes/comments are exactly that - notes, tips, gotcha's, examples related to whatever is documented on a given manual page. occasionally some of the best user notes are merged into the official documentation. Many thanks in advance for your time. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] 2 Questions: Static variables and the nature of the online manual
Ok Jochem, It makes a lot of sense. Now I know what I can expect from the manual and what kind of approach I should have. I hope to contribute as well in the future. Many thanks, S In 4/3/08 16:11, Jochem Maas, [EMAIL PROTECTED] ha scritto Svevo Romano schreef: Hi there, Many thanks for your answer. I've also gone through your example and it took me 10 minutes to understand how the operator precedence was working there. Was expecting 1 on the first call :) But this is not the point. You've nailed my question very preciseley in your first answer: 'the preceding line is only run on the first call to the function'. My only question is (at it is related to the nature of the online manual): how do you know it and I don't? This thing is the only logical explanation to the fact the $a doesn't get initialized again to 0 in any subsequent call to the function, but it's not written anywhere in the manual page. And it seems the most important statement in my opinion, that justifies what I see as an exception to a normal flow. can't remember where I picked up the meaning/working of 'static' - I think I just worked it out by trial and error, or I read about it sometime on this list :-) the manual does talk about statics: http://php.net/static notice you can type 'http://php.net/FOO' to go straight to certain docs, replace FOO with a function name, extension name, core concept, or whatever ... if nothing is found you get a 'did you mean ?' type page otherwise you go directly to the relevant manual page. Hope all this makes sense. Thanks, S In 4/3/08 13:14, Jochem Maas, [EMAIL PROTECTED] ha scritto Svevo Romano schreef: Hello, I got this e-mail address from the ŒAdd note¹ page within the php.net website. I was going to post something that was a question and I realised I was in the wrong place :) I have 2 basic questions and I¹m sorry if they may seem too basic. I¹m a bit new to php. The first question has to do with the static variables. I understand how this works from the examples, but there is something that I cannot seem to find clearly stated anywhere on that page. The example: ?php function Test() { static $a = 0; the preceding line is only run on the first call to the function. echo $a; $a++; } ? Of course works (I¹ve tested it on my server), but it is still obscure to me, according to general programming principles, since I¹m still assigning zero (0) to $a on each call to the Test function. How does this exactly work when the static word is found? Is there and index that keeps track of each call to the function ignoring any assignment in subsequent calls to the function? Why doens¹t this work when you assign an expression result to the variable? do something like function Test() { static $a; if (!isset($a)) $a = 0; if ($a % 2) $a = $a * 2; echo $a++; } The second question has to do with the online manual. I¹ve found several things on that manual specified in comments and not in the actual manual part of it. What is the nature of the manual? Contributions from voluteers? Is there any official manual I can buy that documents everything about the language from the source? Or any official company that maintains the language and that possibly offers support as well? php.net/ is the official manual. recommended to read it in english so your looking at the latest version (not always the case in other languages). user notes/comments are exactly that - notes, tips, gotcha's, examples related to whatever is documented on a given manual page. occasionally some of the best user notes are merged into the official documentation. Many thanks in advance for your time. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Making an interactive RGB color picker
Along the lines of tedd, I will share this one. http://www.colourlovers.com/blog/2008/01/16/free-advanced-dhtml-color-picker/ -- Jim Lucas Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them. Twelfth Night, Act II, Scene V by William Shakespeare -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] RE:
[snip] Tell me please before what operation system You will use ? Linux or Windows? There are different ways to do You task ☺ [/snip] The GPS device will be attached to computers using a Windows operating system.
Re: [PHP] imap_setflags_full Seen
On Tue, March 4, 2008 4:26 am, Jochem Maas wrote: Richard Lynch schreef: I am trying to use this: imap_setflag_full($imap, $uid, Seen, FT_UID) or die(Unable to mark message as \\Seen); 3 things: 1. shouldn't it be ST_UID iso FT_UID? Yes, it should... Fixed that, but no better. Since FT_UID === ST_UID === 1, that's to be expected, however. :-( 2. the imap bos is opened readonly? I don't think so... I didn't use the READ_ONLY flag upon opening... 3. er ... I l-i-e-d :-) I do that a lot. :-) -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RES: [PHP] 2 Questions: Static variables and the nature of the online manual
-Mensagem original- De: Svevo Romano [mailto:[EMAIL PROTECTED] Hi there, Many thanks for your answer. I've also gone through your example and it took me 10 minutes to understand how the operator precedence was working there. Was expecting 1 on the first call :) But this is not the point. You've nailed my question very preciseley in your first answer: 'the preceding line is only run on the first call to the function'. My only question is (at it is related to the nature of the online manual): how do you know it and I don't? This thing is the only logical explanation to the fact the $a doesn't get initialized again to 0 in any subsequent call to the function, but it's not written anywhere in the manual page. And it seems the most important statement in my opinion, that justifies what I see as an exception to a normal flow. Hope all this makes sense. Thanks, S me You can use http://bugs.php.net/report.php to report a documentation bug and they'll change the docs :) Thiago /me -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] GPS Locator
Wintec makes a nice unit. http://www.wintec.com.tw/en/home.php But you are screwed if the system is in doors. I doubt you would get a GPS signal inside a building. Dan On Tue, 2008-03-04 at 10:18 -0600, Jay Blanchard wrote: Howdy group! I know that this is not a PHP question (but it will work with a PHP app) but I thought I would ask the smartest group of people I know if they have any clue or would be familiar with a device I can use. I need to purchase a small GPS receiver/antenna that will plug into a USB port. Then I need to access the port (Ajax? Java?) while in my web application to deliver the coordinates to my PHP application. That will give me the physical location of the machine accessing the application. Any insight will be valuable. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] 2 Questions: Static variables and the nature of the online manual
At 4:12 PM + 3/4/08, Svevo Romano wrote: Hi Daniel, Many thanks to you as well. I really appreciate your effort in answering my queries guys. It means I'll do my best with books and the online manual. And today I've probably found the best resource. The community! Still, I jusy wonder how Jochem knew that the line is only executed the first time a function is called while this info is not available on the online manual. It's maybe all about how close you are to the community and how many degrees are between yourself and the source? I mean, I understand the manual is maintained by the community, but I suppose the language is developed by a small core of programmers that participate to the general discussion to some extent... I'm just trying to figure out the shape of the landscape. I tend to start from the bigger picture before getting into details. :) Cheers Maybe he did the way I do -- and that is by writing code to investigate these things. Nothing teaches you better than writing code. It takes all you think you know and either confirms it or makes you relearn it. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] maintaining [user] state without a session ...
On Tue, Mar 4, 2008 at 11:22 AM, Jason Pruim [EMAIL PROTECTED] wrote: On Mar 4, 2008, at 11:11 AM, Daniel Brown wrote: You're full of crap. I have a day job, too, but I still feel like I spend half of my time reading and responding to list posts. ;-P Ummm... Mr. Brown... I'm pretty sure you do :P You need to talk to Richard and get the code for his AI so you don't get in trouble for not getting your work done :) Amazingly, I do get all of my stuff done. Granted, I'm in front of a computer seven days per week, and usually a minimum of 10-12 hours per day, but what else would I do? Spend time with the pre-wife? Shyeah, right. -- /Dan Daniel P. Brown Senior Unix Geek ? while(1) { $me = $mind--; sleep(86400); } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] RE:
At 10:48 AM -0600 3/4/08, Jay Blanchard wrote: [snip] Tell me please before what operation system You will use ? Linux or Windows? There are different ways to do You task ? [/snip] The GPS device will be attached to computers using a Windows operating system. That makes sense, they usually don't know where they are. :-) Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] imap_setflags_full Seen
Richard Lynch schreef: On Tue, March 4, 2008 4:26 am, Jochem Maas wrote: Richard Lynch schreef: I am trying to use this: imap_setflag_full($imap, $uid, Seen, FT_UID) or die(Unable to mark message as \\Seen); 3 things: 1. shouldn't it be ST_UID iso FT_UID? Yes, it should... Fixed that, but no better. Since FT_UID === ST_UID === 1, that's to be expected, however. :-( I could have guessed that, the manual didn't say what the values were and I couldn't be bothered to check :-/ 2. the imap bos is opened readonly? I don't think so... I didn't use the READ_ONLY flag upon opening... I assume you can therefore set 'Seen' flags from other applications? (might be worth tracing the IMAP conversation to see what your favorite email app does differently to php's imap extension. also is it just the 'Seen' flag you can't set or can you not set any kind of flag? (from my reading I gather there are a few others e.g. 'Flagged' ... which of itself is rather recursive ;-) 3. er ... I l-i-e-d :-) I do that a lot. :-) so that is Dan Brown under the mission impossible mask? :-P -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] maintaining [user] state without a session ...
At 12:15 PM -0500 3/4/08, Daniel Brown wrote: Amazingly, I do get all of my stuff done. Granted, I'm in front of a computer seven days per week, and usually a minimum of 10-12 hours per day, but what else would I do? Spend time with the pre-wife? You're working on wife 1.0 beta -- wait until you're fully developed into wife 2.0. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Making sure an include file works
At 12:05 PM -0500 3/4/08, Daniel Brown wrote: No, that would work fine in any case. In fact, code should always be thoroughly tested before going into production. Yeah, but that rules out all the fun. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sometimes I wonder why I even started programming...
At 12:36 PM -0500 2/28/08, Eric Butera wrote: And I'd appreciate it if you kept all your posts about wearing dresses to yourself but it isn't going to happen. :) What ain't going to happen-- him posting or wearing dresses? tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Making sure an include file works
On Tue, Mar 4, 2008 at 11:29 AM, Mike Potter [EMAIL PROTECTED] wrote: On Fri, Feb 29, 2008 at 2:25 PM, Daniel Brown wrote: On Thu, Feb 28, 2008 at 9:58 PM, Richard S. Crawford I'm trying to figure out a way to make sure an included PHP file has no syntax errors before actually including it as a part of project. Is this even possible? I'm running into brick walls. As far as I know, the only way to do that is via the CLI (or accessing the include file directly in the browser). I'm wondering why the include couldn't be given a dry run in a test file, migrated to the live file if all goes well. Am I missing something obvious? No, that would work fine in any case. In fact, code should always be thoroughly tested before going into production. -- /Dan Daniel P. Brown Senior Unix Geek ? while(1) { $me = $mind--; sleep(86400); } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] imap_setflags_full Seen
On Tue, March 4, 2008 11:15 am, Jochem Maas wrote: Richard Lynch schreef: On Tue, March 4, 2008 4:26 am, Jochem Maas wrote: Richard Lynch schreef: I am trying to use this: imap_setflag_full($imap, $uid, Seen, FT_UID) or die(Unable to mark message as \\Seen); 2. the imap bos is opened readonly? I don't think so... I didn't use the READ_ONLY flag upon opening... I assume you can therefore set 'Seen' flags from other applications? Works fine in webmail anyway. (might be worth tracing the IMAP conversation to see what your favorite email app does differently to php's imap extension. I mostly use webmail. I guess I could run Thunderbird and see if it has some kind of trace mode or something... also is it just the 'Seen' flag you can't set or can you not set any kind of flag? (from my reading I gather there are a few others e.g. 'Flagged' ... which of itself is rather recursive ;-) I'm not even sure what the 'Flagged' flag does... So I could set it, and then wouldn't know for sure how to check it in another app. 3. er ... I l-i-e-d :-) I do that a lot. :-) so that is Dan Brown under the mission impossible mask? :-P No, it's more that philosophically, almost any non-trivial sentence contains a certain amount of uncertainty, and is therefore a lie :-) -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sometimes I wonder why I even started programming...
At 1:18 PM -0500 2/28/08, Daniel Brown wrote: There is a time and a place to presume at least a small piece of intelligence on behalf of the poster. And when does that happen? It never happens when I post things. :-) Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] GPS Locator
Almost for sure, browser security will not let you do this in a web browser. You'll probably have to write a custom desktop C application, or get the user to install some kind of glue widget... PEAR|PECL *might* have some USB stuff in a library you could use to write the PHP desktop widget and keep this on-topic, but I dunno... On Tue, March 4, 2008 10:18 am, Jay Blanchard wrote: Howdy group! I know that this is not a PHP question (but it will work with a PHP app) but I thought I would ask the smartest group of people I know if they have any clue or would be familiar with a device I can use. I need to purchase a small GPS receiver/antenna that will plug into a USB port. Then I need to access the port (Ajax? Java?) while in my web application to deliver the coordinates to my PHP application. That will give me the physical location of the machine accessing the application. Any insight will be valuable. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] string effect
At 9:51 PM +0100 2/29/08, Alain Roger wrote: What is the basic rule ? Text is cut off based on (numbers of words, number of characters,..) ? Yes. Use whatever you want. You can use the number characters or find the last *space* in a string that's just long enough to fit your limit. Let's say your limit is 100 characters. 1. First truncate the string to 100 characters. 2. Then search the string for the last space. 3. Then truncate the string at that point and add It will be a good exercise for you. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] GPS Locator
On Tue, 2008-03-04 at 11:42 -0600, Richard Lynch wrote: Almost for sure, browser security will not let you do this in a web browser. You'll probably have to write a custom desktop C application, or get the user to install some kind of glue widget... PEAR|PECL *might* have some USB stuff in a library you could use to write the PHP desktop widget and keep this on-topic, but I dunno... DIO should let you do it, but that extension is pretty buggy last I used it (OK like 5 years back with PHP4). What I did was got high end barcode scanners to scan directly into a db through a long running PHP script with it, so that should work just fine. That being said, though, something like a Winders COM object will probably be a better bet (I have never used COM objects before as I don't use Windows at all, ever) so correct me if I am wrong please! --Paul All Email originating from UWC is covered by disclaimer http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] imap_setflags_full Seen
On Tue, March 4, 2008 11:39 am, Richard Lynch wrote: On Tue, March 4, 2008 11:15 am, Jochem Maas wrote: Richard Lynch schreef: On Tue, March 4, 2008 4:26 am, Jochem Maas wrote: Richard Lynch schreef: I am trying to use this: imap_setflag_full($imap, $uid, Seen, FT_UID) or die(Unable to mark message as \\Seen); also is it just the 'Seen' flag you can't set or can you not set any kind of flag? (from my reading I gather there are a few others e.g. 'Flagged' ... which of itself is rather recursive ;-) I'm not even sure what the 'Flagged' flag does... So I could set it, and then wouldn't know for sure how to check it in another app. Well, the Answered flag also does not appear to work, at least as far as I can see. PHP IMAP still has 0 for 'answered' and so my webmail client doens't show a pretty little A like it does when I answer email... -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] imap_setflags_full Seen
Richard Lynch schreef: On Tue, March 4, 2008 11:39 am, Richard Lynch wrote: On Tue, March 4, 2008 11:15 am, Jochem Maas wrote: Richard Lynch schreef: On Tue, March 4, 2008 4:26 am, Jochem Maas wrote: Richard Lynch schreef: I am trying to use this: imap_setflag_full($imap, $uid, Seen, FT_UID) or die(Unable to mark message as \\Seen); also is it just the 'Seen' flag you can't set or can you not set any kind of flag? (from my reading I gather there are a few others e.g. 'Flagged' ... which of itself is rather recursive ;-) I'm not even sure what the 'Flagged' flag does... I believe it will literally show a little red flag next to a mail in Thunderbird, at least I have a 'flag this' button and it puts a red flag next to the item ... I never use it :-) So I could set it, and then wouldn't know for sure how to check it in another app. Well, the Answered flag also does not appear to work, at least as far as I can see. PHP IMAP still has 0 for 'answered' and so my webmail client doens't show a pretty little A like it does when I answer email... so it seems you can't do any kind of 'flagging' with the code you have. question: what webmail app are you using? written in php by any chance? worth checking how it sets the flags? maybe break open a copy of roundcube or something like that and check their code for the tiny little detail you seem to be missing? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] imap_setflags_full Seen [SOLVED]
On Mon, March 3, 2008 7:04 pm, Richard Lynch wrote: I am trying to use this: imap_setflag_full($imap, $uid, Seen, FT_UID) or die(Unable to mark message as \\Seen); to mark a message as read Ah-ha!!! The docs specify for Flags that the values are: \\Seen \\Answered... But the actual source and the RFC use data such as: \Seen \Answered This makes all the difference in the world! I've added a note and submitted a Docs bug report. And now anybody finding this thread will know what to do too. :-) It works with \\Seen (which is to say, \Seen) Reminiscient of Magic Quotes, eh? -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] maintaining [user] state without a session ...
tedd wrote: At 12:15 PM -0500 3/4/08, Daniel Brown wrote: Amazingly, I do get all of my stuff done. Granted, I'm in front of a computer seven days per week, and usually a minimum of 10-12 hours per day, but what else would I do? Spend time with the pre-wife? You're working on wife 1.0 beta -- wait until you're fully developed into wife 2.0. Cheers, tedd If I ever had any doublt I was reading a programmer's list, I don't now. ps: I'm on RC4 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] imap_setflags_full Seen [SOLVED]
Richard Lynch schreef: On Mon, March 3, 2008 7:04 pm, Richard Lynch wrote: I am trying to use this: imap_setflag_full($imap, $uid, Seen, FT_UID) or die(Unable to mark message as \\Seen); to mark a message as read Ah-ha!!! The docs specify for Flags that the values are: \\Seen \\Answered... But the actual source and the RFC use data such as: \Seen \Answered This makes all the difference in the world! I've added a note and submitted a Docs bug report. And now anybody finding this thread will know what to do too. :-) It works with \\Seen (which is to say, \Seen) Reminiscient of Magic Quotes, eh? actually I noticed the and something in my head said that's one slash but Richard's just being super pedantic about his slashes [as usual]. damn I should have spotted it, I did actually read the single slash everywhere I went looking for info on the web. anyway good to know you fixed it. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Text Color
At 10:21 AM -0500 2/29/08, Jason Pruim wrote: On Feb 29, 2008, at 10:07 AM, Richard Heyes wrote: echo TRTD.$myrow[char_name].TD.$myrow[char_level].TD.$class[class].TD.$myrow[kara].TD.$myrow[karateam].TD.$myrow[karasub]; Either CSS styling or the dreaded HTML font color=\#FF\ /.$myrow['char_name']./font tags. But you should use CSS: echo 'trtd style=color: red' ... But if you're going to use CSS.. it would be better for managing it to do it as a style sheet: style .red { color: red; } /style echo 'trtd class=red'; Just my opinion :) And a good one -- other than not putting them in the html, but rather in a style sheet. I see no problem whatsoever in using css to do that and -- .bold { font-weight: bold; } .floatRight { float: right; } -- other such obvious style elements. At least those are pretty self explanatory. If you want to get specific, then start naming your classes and id's to specific things, like: #mainTitle { color: red; font-weight: bold; float: right; } Do your best to keep all languages separate. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Text Color
At 10:29 AM -0500 2/29/08, Andrew Ballard wrote: Let's just get all purist and go back to the class=highlight so we don't find ourselves a year later with a stylesheet that includes .red { color: green; } That's much less likely than: .thisIsFridaysColor { color: green; } The point is to use css classes and ids to be semantic. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Text Color
At 10:44 AM -0500 2/29/08, Daniel Brown wrote: On Fri, Feb 29, 2008 at 10:29 AM, Andrew Ballard [EMAIL PROTECTED] wrote: On Fri, Feb 29, 2008 at 10:21 AM, Jason Pruim [EMAIL PROTECTED] wrote: style .red { color: red; } /style Let's just get all purist and go back to the class=highlight so we don't find ourselves a year later with a stylesheet that includes .red { color: green; } Andrew makes a good point, Jason. Despite the fact that it's just a reference, it's easier to make a general reference to highlight that can later be changed to weird colors like shale, aquamarine, coffee, and taupe, than to have a style called red and have a future designer look at the source and say, damn, that Jason Pruim guy doesn't know his .red from a #804000 in the ground. Yes, but there are two points here. One is if you want to be specific about a design element, then call it whatever you please. But, if on the other hand, you want a general old-world font-color, or font-bold, or font-whatever, then you can use css to do that for you very easily. I am not saying use class=red that might later be changed to green -- that would be very short sighted. But let's say you have a client that wants BUY to be red, I don't see any problems with using class=red in your html tag. Also, later if the client says That red is bright enough you can always change it to another shade without violating the red thing.. If the client say I want that to be green, you can always refer to the design specs that said otherwise; do a global search and replace; and bill for your time. All I'm saying here is to consider easy-to-under semantics in writing css rules. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Text Color
TRTD.$myrow[char_name].TD.$myrow[char_level].TD.$class[class].TD.$myrow[kara].TD.$myrow[karateam].TD.$myrow[karasub]; Either CSS styling or the dreaded HTML font color=\#FF\ /.$myrow['char_name']./font tags. But you should use CSS: echo 'trtd style=color: red' ... Everyone: Arr. PHP echo 'td class=red'; CSS .red { color: #FF; } More Arrggg. $char_name = $myrow['char_name']; // -- note ' and not $char_level = $myrow['char_level']; $myClass = $class['class']; $kara = $myrow['kara']; $karasub= $myrow['karasub']; echo(trtd class=\red\$char_name /tdtd$char_level/tdtd$myClass /td td$kara/tdtd$karasub/td/tr); Note balanced tags, use of variables inside the echo, and unobtrusive css. Just a manner of style. :-) Cheers, tedd PS: I know that echo() is not a function, but I like doing it that way and makes it easier for me to understand my code. PSS: I know that this takes a bit more processor time to to do this, but the processor has more time than I do to understand what my code is doing. -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP performance
Eric Butera schreef: On Tue, Mar 4, 2008 at 5:51 AM, Jochem Maas [EMAIL PROTECTED] wrote: Eric Butera schreef: ... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Hi Jochem, This is probably true. I was just referring to an old benchmark [1] I had seen a few years ago. Of course the biggest win will come from an opcode cache if that is a possibility. Just for the record I do use a db wrapper myself but I have weighed the pros and cons of the situation and determined that it works for me. I have many low traffic sites so it makes sense to have a wrapper that delays connections until they're used and such other little tweaks. I listen to peoples recoded talks from conferences and I've heard on many occasions that on single apps they take out the db abstraction. I wish I could cite references but it is out there if you want to dig enough. duh. ofcourse they do that. remove a layer of abstraction and win some speed. it a game of dimishing returns, take the big target first - that's usually the SQL queries, DB tuning. next step might be op-code caching, then data/output caching, and if that's not enough (or you have enough iron in play to make the numbers add up) you start to remove maintainability and/or abstraction from your code to win a few cpu cycles. php is web-glue, or for the purposes of my metaphor web-butter ... generally the sandwich is mostly filled with something other than butter. [1] http://phplens.com/lens/adodb/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] maintaining [user] state without a session ...
At 6:05 PM + 3/4/08, Nathan Rixham wrote: tedd wrote: At 12:15 PM -0500 3/4/08, Daniel Brown wrote: Amazingly, I do get all of my stuff done. Granted, I'm in front of a computer seven days per week, and usually a minimum of 10-12 hours per day, but what else would I do? Spend time with the pre-wife? You're working on wife 1.0 beta -- wait until you're fully developed into wife 2.0. Cheers, tedd If I ever had any doublt I was reading a programmer's list, I don't now. ps: I'm on RC4 Let's not discuss your open-source girlfriend. :-) Cheers, tedd PS: (RC4 == Remote Companion 4.0 @ 3.95 per minute). -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] imap_setflags_full Seen [SOLVED]
On Tue, Mar 4, 2008 at 1:04 PM, Richard Lynch [EMAIL PROTECTED] wrote: I've added a note and submitted a Docs bug report. I submitted a patch about a half-hour ago. I don't have karma to the phpdocs tree, so Phillip or Hannes will probably take care of it in a little while. -- /Dan Daniel P. Brown Senior Unix Geek ? while(1) { $me = $mind--; sleep(86400); } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] regular expressions question
Hi, Is there any way to limit the user to a set of characters for example say i want my user to enter any character between a and z (case insensitive). And if the user enters just one letter not belonging to [a-z], this will not be accepted. I tried eregi('[a-z]', $fname) but this allows the user to enter abdg4512kdkdk for example. Thank you - Never miss a thing. Make Yahoo your homepage.
Re: [PHP] regular expressions question
On 3/4/08, Adil Drissi [EMAIL PROTECTED] wrote: Hi, Is there any way to limit the user to a set of characters for example say i want my user to enter any character between a and z (case insensitive). And if the user enters just one letter not belonging to [a-z], this will not be accepted. I tried eregi('[a-z]', $fname) but this allows the user to enter abdg4512kdkdk for example. Thank you try here: http://us2.php.net/ctype_alpha -- -David. When the power of love overcomes the love of power, the world will know peace. -Jimi Hendrix -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] regular expressions question
On Tue, Mar 4, 2008 at 2:19 PM, Adil Drissi [EMAIL PROTECTED] wrote: Hi, Is there any way to limit the user to a set of characters for example say i want my user to enter any character between a and z (case insensitive). And if the user enters just one letter not belonging to [a-z], this will not be accepted. ? if(preg_match('/^[a-z]+$/i',$argv[1])) { echo Good.\n; } else { echo Bad.\n; } ? -- /Dan Daniel P. Brown Senior Unix Geek ? while(1) { $me = $mind--; sleep(86400); } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: regular expressions question
Adil Drissi wrote: Hi, Is there any way to limit the user to a set of characters for example say i want my user to enter any character between a and z (case insensitive). And if the user enters just one letter not belonging to [a-z], this will not be accepted. I tried eregi('[a-z]', $fname) but this allows the user to enter abdg4512kdkdk for example. Thank you - Never miss a thing. Make Yahoo your homepage. Keeping with your example, this works and doesn't allow an empty string (to allow empty, replace the + with *): eregi('^[a-z]+$', $fname) -or- ereg('^[A-Za-z]+$', $fname) But ctype_alpha() is a better multi-locale solution. -Shawn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] regular expressions question
On Tue, March 4, 2008 1:19 pm, Adil Drissi wrote: Is there any way to limit the user to a set of characters for example say i want my user to enter any character between a and z (case insensitive). And if the user enters just one letter not belonging to [a-z], this will not be accepted. I tried eregi('[a-z]', $fname) but this allows the user to enter abdg4512kdkdk for example. What you tried only requires ONE a-z character somewhere in the input. Try this: preg_match('^[a-z]+$', $fname); This will: ^ anchor the string at the beginning [a-z]+ a to z, with at least one letter $ anchor the string at the end Note, however, that some people have other characters in their first name, such as apostrophe, space, and dash. Oh, and the digit 3, for bo3b who was a programmer on the first Apple Macintosh. His parents were hippies, and that really is his name... You may want to obtain a LARGE list of first names and run them through your validator as a test. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] maintaining [user] state without a session ...
On Tue, March 4, 2008 8:22 am, Bojan Tesanovic wrote: Hi, It depends what do you need to track, if you need to track small amount of variables you can do it by cookie I often use it eg here is the state for one user $state = array{ 'logedin'=true, 'n'='Peter', 'id'='5', //anything else you need } //at end of you script before outputing any content //set cookie only for browser session and set path to '/' so it is available through whole site setcookie('user_data',serialize($state),null,'/'); Woof. So anybody with half a clue could look in their cookies and change, say, 'id' to '1' and masquerade as anybody they want in your system. And with an 'id' of '1', they might even getting CMS 'admin' access or something. Probably not a Good Idea... You could, perhaps, use a 2-way encryption algorithm and try to keep your key as securely as possible, and do this much more safely. Also you can use some way to detect if the user is not Search engine to display message like To properly use this site you need to enable cookies in your browser bla bla This can be done via JS alert message which will not be triggered by SE but only by real user Use robots.txt to keep out real search engines. Anybody who REALLY wants to can run your JS with Webmonkey, the JS engine of Firefox, released as a stand-alone command line tool. (E.g., JS email obfuscation is useless against somebody with webmonkey. Try it and see!) -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] maintaining [user] state without a session ...
On Tue, March 4, 2008 10:22 am, Jason Pruim wrote: On Mar 4, 2008, at 11:11 AM, Daniel Brown wrote: On Tue, Mar 4, 2008 at 11:09 AM, Stut [EMAIL PROTECTED] wrote: On 4 Mar 2008, at 15:52, Daniel Brown wrote: On Tue, Mar 4, 2008 at 9:10 AM, Stut [EMAIL PROTECTED] wrote: I'm working on an article for my website that describes exactly how I'm doing it and what the issues are but it's not ready yet. I'll let the list know when it's done. Is it done yet? No. I have a day job, that takes priority. You're full of crap. I have a day job, too, but I still feel like I spend half of my time reading and responding to list posts. ;-P Ummm... Mr. Brown... I'm pretty sure you do :P You need to talk to Richard and get the code for his AI so you don't get in trouble for not getting your work done :) Richard is waiting for a lonng PHP script to push/pull a bunch of cron output emails out of his Inbox and dump them to a DB so he can figure out what's going on with the system for his boss, but that script has cause php to segfault once already, and he is also trying (and failing) to get a Gentoo Live CD to actually finish an install on an ancient Compaq Proliant, so pretty much posts while waiting for the other computers/softwares to crash... -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] 2 Questions: Static variables and the nature of the online manual
On Tue, March 4, 2008 6:16 am, Svevo Romano wrote: Hello, I got this e-mail address from the Add note¹ page within the php.net website. I was going to post something that was a question and I realised I was in the wrong place :) I have 2 basic questions and I¹m sorry if they may seem too basic. I¹m a bit new to php. The first question has to do with the static variables. I understand how this works from the examples, but there is something that I cannot seem to find clearly stated anywhere on that page. The example: ?php function Test() { static $a = 0; echo $a; $a++; } ? Of course works (I¹ve tested it on my server), but it is still obscure to me, according to general programming principles, since I¹m still assigning zero (0) to $a on each call to the Test function. How does this exactly work when the static word is found? Is there and index that keeps track of each call to the function ignoring any assignment in subsequent calls to the function? Why doens¹t this work when you assign an expression result to the variable? It's not an assignment, it's an initialization, and, yes, the compiler does keep track and doesn't do that after the first time. *THIS* would be what you describe: function Test(){ static $a; $a = 0; echo $a; $a++; } The second question has to do with the online manual. I¹ve found several things on that manual specified in comments and not in the actual manual part of it. What is the nature of the manual? Contributions from voluteers? The manual is contributions from volunteers who have been blessed by the other volunteers (viz) to edit the manual. The Notes is from anybody on the planet with a web browser that can beat the CAPTCHA. Is there any official manual I can buy that documents everything about the language from the source? Or any official company that maintains the language and that possibly offers support as well? There is nothing you can buy that's more official (nor more complete) than the on-line manual. You can buy support from Zend, which is a separate company run by two guys who happen to be core developers; You can probably buy support elsewhere as well. PS If you can find a language with a better manual, I'd like to see it... :-) -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mail() function HELP
On 4 Mar 2008, at 21:18, Sofia Jacob (CA) wrote: I'm getting problems with the mail() function. ERROR: Warning: mail() [function.mail]: Failed to connect to mailserver at port 25, verify your SMTP and smtp_port setting in php.ini or use ini_set() in C:\wamp\www\php_sandbox\user_auth_fns.php on line 170 I'm using Windows XP prof. and WAMP5 -server Here what I did: 1) I download sendmail.zip from http://glob.com.au/sendmail/ 2) I unzip this in a folder on c:\wamp\sendmail 3) I edited PHP.INI file [mail function] ; For Win32 only. SMTP = smtp_port = ; For Win32 only. ;sendmail_from = ; For Unix only. You may supply arguments as well (default: sendmail -t -i). ;sendmail_path = C:\wamp\sendmail\sendmail.exe -t I don't mean to be rude, but what part of For Unix only confused you? You need to point the For Win32 only settings at a mail server on Windows. The error message pretty clearly states that it's trying to connect to the server specified in those settings. -Stut -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: mail() function HELP
Sofia Jacob (CA) wrote: I'm getting problems with the mail() function. ERROR: Warning: mail() [function.mail]: Failed to connect to mailserver at port 25, verify your SMTP and smtp_port setting in php.ini or use ini_set() in C:\wamp\www\php_sandbox\user_auth_fns.php on line 170 I'm using Windows XP prof. and WAMP5 -server Here what I did: 1) I download sendmail.zip from http://glob.com.au/sendmail/ 2) I unzip this in a folder on c:\wamp\sendmail 3) I edited PHP.INI file [mail function] ; For Win32 only. SMTP = smtp_port = ; For Win32 only. ;sendmail_from = ; For Unix only. You may supply arguments as well (default: sendmail -t -i). ;sendmail_path = C:\wamp\sendmail\sendmail.exe -t ; Force the addition of the specified parameters to be passed as extra parameters ; to the sendmail binary. These parameters will always replace the value of ; the 5th parameter to mail(), even in safe mode. ;mail.force_extra_parameters = 4)I edited SENDMAIL.INI file ; configuration for fake sendmail ; if this file doesn't exist, sendmail.exe will look for the settings in ; the registry, under HKLM\Software\Sendmail [sendmail] ; you must change mail.mydomain.com to your smtp server, ; or to IIS's pickup directory. (generally C:\Inetpub\mailroot\Pickup) ; emails delivered via IIS's pickup directory cause sendmail to ; run quicker, but you won't get error messages back to the calling ; application. smtp_server=mail.yahoo.ca ; smtp port (normally 25) smtp_port=465 ; the default domain for this server will be read from the registry ; this will be appended to email addresses when one isn't provided ; if you want to override the value in the registry, uncomment and modify default_domain= ; log smtp errors to error.log (defaults to same directory as sendmail.exe) ; uncomment to enable logging error_logfile=error.log ; create debug log as debug.log (defaults to same directory as sendmail.exe) ; uncomment to enable debugging ;debug_logfile=debug.log ; if your smtp server requires authentication, modify the following two lines auth_username=jacobsofia auth_password= *** ; if your smtp server uses pop3 before smtp authentication, modify the ; following three lines pop3_server=mail.yahoo.ca pop3_username= [EMAIL PROTECTED] pop3_password=** ; to force the sender to always be the following email address, uncomment and ; populate with a valid email address. this will only affect the MAIL FROM ; command, it won't modify the From: header of the message content [EMAIL PROTECTED] ; sendmail will use your hostname and your default_domain in the ehlo/helo ; smtp greeting. you can manually set the ehlo/helo name if required hostname= 5) Here my code: $email = mysql_result($result, 0, email); $from = From: [EMAIL PROTECTED] \r\n; $mesg = Tu contraseña ha sido cambiado a $Password \r\n .Por favor utilízalo la próxima cuando hagas log in. \r\n; if (mail($email, login información , $mesg, $from)) echo Enviamos tu nueva contrasena a tu e-mail; else echo Error; Thanks for the help Sofia. Number 1, in php.ini you left this uncommented so it's using this: SMTP = smtp_port = Number 2, here you didn't uncomment the ;sendmail_path: ; For Unix only. You may supply arguments as well (default: sendmail -t -i). ;sendmail_path = C:\wamp\sendmail\sendmail.exe -t Also, notice the *For Unix only.* comment. Dunno if it will work anyway if you have sendmail. -Shawn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] 2 Questions: Static variables and the nature of the online manual
On Tue, March 4, 2008 10:12 am, Svevo Romano wrote: Still, I jusy wonder how Jochem knew that the line is only executed the first time a function is called while this info is not available on the online manual. It's maybe all about how close you are to the community and how many degrees are between yourself and the source? That's how it works in C. And Perl. And Modula-2. And Ada. And Pascal. And even Lisp. . . . After you've learned a couple computer languages, the rest are mostly about differences and gotchas rather than learning something new. Ok, except the Lisp/Scheme/Prolog stuff, where you have to think inside-out. :-) -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mail() function HELP
Stut wrote: On 4 Mar 2008, at 21:18, Sofia Jacob (CA) wrote: I'm getting problems with the mail() function. ERROR: Warning: mail() [function.mail]: Failed to connect to mailserver at port 25, verify your SMTP and smtp_port setting in php.ini or use ini_set() in C:\wamp\www\php_sandbox\user_auth_fns.php on line 170 I'm using Windows XP prof. and WAMP5 -server Here what I did: 1) I download sendmail.zip from http://glob.com.au/sendmail/ 2) I unzip this in a folder on c:\wamp\sendmail 3) I edited PHP.INI file [mail function] ; For Win32 only. SMTP = smtp_port = ; For Win32 only. ;sendmail_from = ; For Unix only. You may supply arguments as well (default: sendmail -t -i). ;sendmail_path = C:\wamp\sendmail\sendmail.exe -t I don't mean to be rude, but what part of For Unix only confused you? You need to point the For Win32 only settings at a mail server on Windows. The error message pretty clearly states that it's trying to connect to the server specified in those settings. -Stut Uh, yeah... Then I thought, why not just use the SMTP and smtp_port settings. -Shawn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Fatal error: Call to a member function web_order_change() on a non-object
register_globals got turned off. All your $_SESSION variables (in your case, $_SESSION['SESSION']) need to be reference explicitly now. Add this at the top: $SESSION = $_SESSION['SESSION']; right after session_start(); On Mon, March 3, 2008 5:48 pm, Chris wrote: Ben Edwards wrote: Our server has just been upgraded to PHP 5.2.5 and suddenly I am getting the following error: Fatal error: Call to a member function web_order_change() on a non-object in /var/www/vhosts/cultureshop.org/httpdocs/cart.php on line 32 The code is: $SESSION[cart]-web_order_change( true ); The command 'global $SESSION;' is the first line of the script. $SESSION is the session variable created with session_start(); session_register(SESSION); if ( !isset($SESSION[cart]) ) { $SESSION[cart] = new Cart; } I am guessing this is a change in OO handling, any idea what is going on and how to fix it? I don't think it's a change in OO handling, maybe it's a change in the error_reporting level for the new version and you hadn't noticed the problem before. The problem is that $SESSION['cart'] isn't an object - you'll have to work out why. It could be that $SESSION['cart'] is getting overridden at some point with another type of variable. -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Crop part of existing pdf
Ya, you are right. So there is no non-commercial option? Date: Tue, 4 Mar 2008 16:06:42 -0600 Subject: Re: [PHP] Crop part of existing pdf From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] CC: php-general@lists.php.net On Mon, March 3, 2008 8:14 pm, gary liang wrote: Is there any command line tool, which is able to crop part of pdf file? I ask for command line tool, because it can be used in php code. Any hint? The commercial version of phpLib might do that. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? _ What are you waiting for? Join Lavalife FREE http://a.ninemsn.com.au/b.aspx?URL=http%3A%2F%2Flavalife9%2Eninemsn%2Ecom%2Eau%2Fclickthru%2Fclickthru%2Eact%3Fid%3Dninemsn%26context%3Dan99%26locale%3Den%5FAU%26a%3D30288_t=764581033_r=email_taglines_Join_free_OCT07_m=EXT
Re: [PHP] 2 Questions: Static variables and the nature of the online manual
On Tue, Mar 4, 2008 at 5:05 PM, Richard Lynch [EMAIL PROTECTED] wrote: After you've learned a couple computer languages, the rest are mostly about differences and gotchas rather than learning something new. Ok, except the Lisp/Scheme/Prolog stuff, where you have to think inside-out. :-) You hit that nail right on the head! For those who don't know, Lisp, though spelled with an L, is actually pronounced *Gasp*. ;-P -- /Dan Daniel P. Brown Senior Unix Geek ? while(1) { $me = $mind--; sleep(86400); } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mail() function HELP
Please include the list when replying. And please don't top-post, it makes proper quoting difficult. On 4 Mar 2008, at 22:10, Sofia Jacob (CA) wrote: Yes, I did that first and I get the error: Warning: mail() [function.mail]: Failed to connect to mailserver at mail.yahoo.ca port 465, verify your SMTP and smtp_port setting in php.ini or use ini_set() in C:\wamp\www\php_sandbox \user_auth_fns.php on line 170 (I should told you that before, sorry!!) and then I started to look at php web site and I found: sendmail_path string Where the sendmail program can be found, usually /usr/sbin/sendmail or /usr/lib/sendmail. configure does an honest attempt of locating this one for you and set a default, but if it fails, you can set it here. Systems not using sendmail should set this directive to the sendmail wrapper/replacement their mail system offers, if any. For example, » Qmail users can normally set it to /var/qmail/bin/sendmail or/var/ qmail/bin/qmail-inject. qmail-inject does not require any option to process mail correctly. This directive works also under Windows. If set, smtp, smtp_port and sendmail_from are ignored and the specified command is executed. My mistake, the comments in the INI file really should be changed to reflect that. Given that your problem is that you haven't uncommented that line as Shawn said. Remove the ; from the start of that line, restart your we server and if the manual isn't lying it should work. Incidentally, it probably didn't like the Yahoo settings you used because that port is for SMTP over SSL which PHP doesn't support. -Stut -- http://stut.net/ - Original Message - From: Stut [EMAIL PROTECTED] To: Sofia Jacob (CA) [EMAIL PROTECTED] Cc: php-general@lists.php.net Sent: Tuesday, March 04, 2008 4:57 PM Subject: Re: [PHP] mail() function HELP On 4 Mar 2008, at 21:18, Sofia Jacob (CA) wrote: I'm getting problems with the mail() function. ERROR: Warning: mail() [function.mail]: Failed to connect to mailserver at port 25, verify your SMTP and smtp_port setting in php.ini or use ini_set() in C:\wamp\www\php_sandbox\user_auth_fns.php on line 170 I'm using Windows XP prof. and WAMP5 -server Here what I did: 1) I download sendmail.zip from http://glob.com.au/sendmail/ 2) I unzip this in a folder on c:\wamp\sendmail 3) I edited PHP.INI file [mail function] ; For Win32 only. SMTP = smtp_port = ; For Win32 only. ;sendmail_from = ; For Unix only. You may supply arguments as well (default: sendmail -t -i). ;sendmail_path = C:\wamp\sendmail\sendmail.exe -t I don't mean to be rude, but what part of For Unix only confused you? You need to point the For Win32 only settings at a mail server on Windows. The error message pretty clearly states that it's trying to connect to the server specified in those settings. -Stut -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Crop part of existing pdf
On Mon, March 3, 2008 8:14 pm, gary liang wrote: Is there any command line tool, which is able to crop part of pdf file? I ask for command line tool, because it can be used in php code. Any hint? The commercial version of phpLib might do that. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] GPS Locator
While this has deteriorated way off topic from PHP, I will just mention that I've purchased several GPS from these cats and had great luck: http://www.buygpsnow.com You *might* be able to write a custom PHP extension that you compile into PHP that can access the USB/Serial port as well. (and if you did got this route, which would be the most beneficial to the PHP community, I hope you would FOSS the extension so other's could use it perhaps) http://devzone.zend.com/node/view/id/1021 Secondly, maybe you could have a little daemon written that simply spits out the coordinates (lat/long/altitude/etc.) to a socket or something, and then via PHP's socket functions you could continually read that in. Alternatively, perhaps JAVA will also let you access hardware layers if you're on a non Microsoft platform (which is generally the case for PHP users). Lastly, you could certainly do some low level hardware I/O with Ruby and then perhaps use Rails for the web portion. Chalk this all under the best tool for the job category, in this case I doubt PHP is. Daevid. Remember, when coding, php.net and google are friends. Everyone else hates you. It is not personal, it's just a fact. --Stephen Johnson (12/03/07) -Original Message- From: Paul Scott [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 04, 2008 9:46 AM To: [EMAIL PROTECTED] Cc: Jay Blanchard; [php] PHP General List Subject: Re: [PHP] GPS Locator On Tue, 2008-03-04 at 11:42 -0600, Richard Lynch wrote: Almost for sure, browser security will not let you do this in a web browser. You'll probably have to write a custom desktop C application, or get the user to install some kind of glue widget... PEAR|PECL *might* have some USB stuff in a library you could use to write the PHP desktop widget and keep this on-topic, but I dunno... DIO should let you do it, but that extension is pretty buggy last I used it (OK like 5 years back with PHP4). What I did was got high end barcode scanners to scan directly into a db through a long running PHP script with it, so that should work just fine. That being said, though, something like a Winders COM object will probably be a better bet (I have never used COM objects before as I don't use Windows at all, ever) so correct me if I am wrong please! --Paul -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mail() function HELP
Stut wrote: Please include the list when replying. And please don't top-post, it makes proper quoting difficult. On 4 Mar 2008, at 22:10, Sofia Jacob (CA) wrote: Yes, I did that first and I get the error: Warning: mail() [function.mail]: Failed to connect to mailserver at mail.yahoo.ca port 465, verify your SMTP and smtp_port setting in php.ini or use ini_set() in C:\wamp\www\php_sandbox\user_auth_fns.php on line 170 (I should told you that before, sorry!!) and then I started to look at php web site and I found: sendmail_path string Where the sendmail program can be found, usually /usr/sbin/sendmail or /usr/lib/sendmail. configure does an honest attempt of locating this one for you and set a default, but if it fails, you can set it here. Systems not using sendmail should set this directive to the sendmail wrapper/replacement their mail system offers, if any. For example, » Qmail users can normally set it to /var/qmail/bin/sendmail or/var/qmail/bin/qmail-inject. qmail-inject does not require any option to process mail correctly. This directive works also under Windows. If set, smtp, smtp_port and sendmail_from are ignored and the specified command is executed. My mistake, the comments in the INI file really should be changed to reflect that. Given that your problem is that you haven't uncommented that line as Shawn said. Remove the ; from the start of that line, restart your we server and if the manual isn't lying it should work. Incidentally, it probably didn't like the Yahoo settings you used because that port is for SMTP over SSL which PHP doesn't support. -Stut Correct on the yahoo. I would tend to doubt that allow open relaying as well. -Shawn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Making an interactive RGB color picker
for ($red = 0; $red 256; $red++){ for ($green = 0; $green 256; $green++){ for ($blue = 0; $blue 256; $blue++){ $output = EOC \$drawrect(\$get... EOC; } } } On Mon, March 3, 2008 2:13 pm, Keikonium wrote: This may not be exactly what you think, but I didn't know how else to word the title. I basically need to make a script that will go through every possible color combination and print them to look just like (or similar) to the windows color picker. I need it in the format X-Y-Z. For example: 255-255-255 255-254-254 255-253-253 What I have so far is this: *** ?php $break = printbr; $n1 = 255; $n2 = 12; $n3 = 186; $output = print \$drawrect(\$get(color_x),\$get(color_y),\$get(color_w),\$get(color_h),brushColor-$n1-$n2-$n3 penColor-$n1-$n2-$n3) \$button2(\$get(color_x),\$get(color_y),0,0,\$get(color_w),\$get(color_h),,,PVAR:SET:colorize_global:brushcolor-$n1-$n2-$n3 pencolor-$n1-$n2-$n3,TOOLTIP:\$n1-$n2-$n3\) ; $output ? *** The $drawrect, $button2, and $get are NOT php functions, but to be printed as actual text (which is why I have escaped them with the backslash). Anyways, I thought it would be easiest to separate each R-G-B value into its own variable ($n1, $n2, and $n3). That way I could just use some code (regex?) to cycle through the numbers 0 to 255. The HARD part (that I can't seem to even think of a way to make it possible) is to change JUST the G and B values while keeping the R value at 255. Then when the G and B values both hit 0, the R value is set to 254 and repeated until it also hits 0 with the other two. I think (?) that will do every possible color? I also need to print each string with the individual color output, and I don't know how to do that either. In short, I would like something that looks just like the windows color picker, and when each pixel of it is clicked, it will show me the R-G-B value in the format I would like. If anyone understands what I am after,and could help, that would be awesome! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP performance
#1 Get the code, install it on a box in the closet, run valgrind --callgrind This will give you a stack trace of what gets called the MOST in your application. Look for tall trees in the call graph, and fix those first. #2 You can use 'ab' (apache benchmark) or similar to test it externally. #3 You can also script things with Selenium IDE and then use Selenium remote control to run them repeatedly, for the end-user experience. Don't let server non-access stop you from doing #1 though... On Mon, March 3, 2008 11:09 am, Thiago Pojda wrote: Guys, I've been asked to build a performance report for a PHP app. I can't profile it using automated tools as I don't have full access to the server, only to the application itself. It's a PHP4 Object-Oriented app, which uses ADODB as abstraction layer with a Oracle 8i databse. The system also uses a VB.NET socket server for some data manipulation. As for migrating to PHP5 I think it's crucial, but I need facts that it really runs faster than PHP4. Anyone? :) Any ideas on what might be the bottleneck? Thanks guys Atenciosamente, http://www.softpartech.com.br/ www.softpartech.com.br Thiago Henrique Pojda Desenvolvimento Web +55 41 3033-7676 [EMAIL PROTECTED] Excelência em Softwares Financeiros -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Weird Zend IDE Issue
On Mon, March 3, 2008 10:49 am, Jochem Maas wrote: Richard Lynch schreef: On Sun, March 2, 2008 11:07 pm, Steve Finkelstein wrote: Hi all, I know this isn't a forum for Zend IDE, but since there's probably a decent population here using it, I figured I'd ask away. I'm using 5.5.1 Professional on Mac OSX 10.5.2. My issue here is that all left brackets, (eg: [ ) are not showing up in the code editor. I have a screenshot of it here: http://catalyst.httpd.org/zend.png Has anyone ever experienced anything similar? Looks to me like your monitor needs adjusting, and it's just not showing that column of pixels. I think it's more a case of grubby font display in Java apps running on Mac OS X (leopard at least). when is the last time you saw a Mac (iMac or MacBook) with dodgy monitor settings? I dunno about iMac or MacBook, but I saw a TON of Macs with dodgy monitor settings all the time back in the day! Sometimes on the desk of Graphic Artist who then got cranky when their images were messed up on a well-tuned monitor... So unless Apple has perfected the auto-tuning of a monitor or something, I'd be surprised if it *was* correctly-tuned. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question about PHP Licence and it's future!
On Sat, February 23, 2008 10:50 pm, Tamer Higazi wrote: I have asked myself a question. After I saw, that SAP will no more release future Versions of their open source Database MaxDB under the GPL License, I have asked myself either if this could happen with PHP. No. For starters, all the core developers are very committed to PHP being Open Source. Secondly, Zend has gone on record saying that the Zend Engine will always be Open Source. I know, cuz I said so when I worked there. :-) Who owns PHP? Is it Zend Technologies or the PHP Group itself? Who is the PHP Group and what makes the PHP Group? Who owns any GPL for FOSS-licensed software? The community. Who guaranties that future Versions of PHP stays open source and are being released under the Terms of the General Public Licenses? The community. There are MORE than enough users who would fork it in an instant if anybody was foolish enough to try and close it. Can future Versions from one day to the other no more being released under the GPL, only under a closed source license? Let us say, PHP would be distributed for several architectures only in binary forms and the PECL modules stay open source. Not gonna happen. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] regular expressions question
Thank you guys, The answers you gave me not only solved the problem, but i included more characters like space and -. Thank you again --- Richard Lynch [EMAIL PROTECTED] wrote: On Tue, March 4, 2008 1:19 pm, Adil Drissi wrote: Is there any way to limit the user to a set of characters for example say i want my user to enter any character between a and z (case insensitive). And if the user enters just one letter not belonging to [a-z], this will not be accepted. I tried eregi('[a-z]', $fname) but this allows the user to enter abdg4512kdkdk for example. What you tried only requires ONE a-z character somewhere in the input. Try this: preg_match('^[a-z]+$', $fname); This will: ^ anchor the string at the beginning [a-z]+ a to z, with at least one letter $ anchor the string at the end Note, however, that some people have other characters in their first name, such as apostrophe, space, and dash. Oh, and the digit 3, for bo3b who was a programmer on the first Apple Macintosh. His parents were hippies, and that really is his name... You may want to obtain a LARGE list of first names and run them through your validator as a test. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? Never miss a thing. Make Yahoo your home page. http://www.yahoo.com/r/hs -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: RES: [PHP] 2 Questions: Static variables and the nature of the online manual
Cheers Thiago, In fact this was going to be my next question. I think I will report a documentation bug, just because, after all the discussion we had today, I realize that this is quite a common behaviour in other languages, but for somebody new to languages, being them programming or scripting ones, the fact that the $a=0 line doesn't get executed on subsequent calls isn't so obvious. In other words, from the standpoint of someone that is relatively new to the details (at least), the flow is: 'ok, I do appreciate that the engine keeps memory of the value of that variable declared as static after the function ends, but assigning a value to it at the very beginning of the function seems like the next time the function is going to be called, it will assaign that value again and again...and again'. And I guess the manual wants to be as clear as possible, considering that the examples are often 'foo 'and '$a' related :P In other words I think that it is indeed targeted to beginners as wel, isn't it? Thanks for all the valuable info btw. :) In 4/3/08 16:59, Thiago Pojda, [EMAIL PROTECTED] ha scritto -Mensagem original- De: Svevo Romano [mailto:[EMAIL PROTECTED] Hi there, Many thanks for your answer. I've also gone through your example and it took me 10 minutes to understand how the operator precedence was working there. Was expecting 1 on the first call :) But this is not the point. You've nailed my question very preciseley in your first answer: 'the preceding line is only run on the first call to the function'. My only question is (at it is related to the nature of the online manual): how do you know it and I don't? This thing is the only logical explanation to the fact the $a doesn't get initialized again to 0 in any subsequent call to the function, but it's not written anywhere in the manual page. And it seems the most important statement in my opinion, that justifies what I see as an exception to a normal flow. Hope all this makes sense. Thanks, S me You can use http://bugs.php.net/report.php to report a documentation bug and they'll change the docs :) Thiago /me -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] 2 Questions: Static variables and the nature of the online manual
Yes Richard, In fact I know ActionScript and JavaScript and I'm trying to nail the peculiarities of php. I totally agree. I am not used to use ' - ' to call a method if you know what I mean, but the rest is quite familiar, phew! :) Aside from that, this was just one of the things I could not really understand properly: I could understand the effects, not the reasons behind the effects, if it makes any sense. I think the manula is lacking a couple of lines. One funny thing: in the Welling Thomson - PHP and MySQL Web Development book, at some point this thing is mentioned. They promised they would explain the concept in full detail in chapter 5 and, in chap 5, they kinda forgot to do it.. hehe All the best. In 4/3/08 22:05, Richard Lynch, [EMAIL PROTECTED] ha scritto On Tue, March 4, 2008 10:12 am, Svevo Romano wrote: Still, I jusy wonder how Jochem knew that the line is only executed the first time a function is called while this info is not available on the online manual. It's maybe all about how close you are to the community and how many degrees are between yourself and the source? That's how it works in C. And Perl. And Modula-2. And Ada. And Pascal. And even Lisp. . . . After you've learned a couple computer languages, the rest are mostly about differences and gotchas rather than learning something new. Ok, except the Lisp/Scheme/Prolog stuff, where you have to think inside-out. :-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Importing and exporting from MySQL, escape slash problem
Richard, Jed, Thank you for replying. Richard said: It's possible that there is an .htaccess file in phpMyAdmin that has Magic Quotes on that is messing you up... The .htaccess file for phpMyAdmin says php_flag magic_quotes_gpc Off, so I guess that means I'm okay there. Other than that, it's specific to phpMyAdmin, so maybe ask those guys what they did... I joined their list through Sourceforge, but I haven't seen any mail from it, and any mail I send gets bounced back to me. I'm not sure what the issue is. Jed said: If you're having trouble importing a mysql dump using phpMyAdmin, it might be simpler not to use it, and use mysqldump instead. I suppose I'll have to if I can't get phpMyAdmin to behave. It's too bad, though, as phpMyAdmin is so convenient otherwise. -- Dave M G -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] validating mysql bound date
Does anyone know if there is a builtin function for checking the formatting of an incoming date to verify it is /MM/DD. I know how to convert between formats but want a quick way to check an incoming variable to ensure it will be handled properly by mysqld. Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] validating mysql bound date
Its been a long week already... -MM-DD. On Tue, 2008-03-04 at 20:16 -0500, Larry Brown wrote: Does anyone know if there is a builtin function for checking the formatting of an incoming date to verify it is /MM/DD. I know how to convert between formats but want a quick way to check an incoming variable to ensure it will be handled properly by mysqld. Larry -- Larry Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Making an interactive RGB color picker
On 3/3/08, Keikonium [EMAIL PROTECTED] wrote: This may not be exactly what you think, but I didn't know how else to word the title. I basically need to make a script that will go through every possible color combination and print them to look just like (or similar) to the windows color picker. I need it in the format X-Y-Z. For example: 255-255-255 255-254-254 255-253-253 What I have so far is this: *** ?php $break = printbr; $n1 = 255; $n2 = 12; $n3 = 186; $output = print \$drawrect(\$get(color_x),\$get(color_y),\$get(color_w),\$get(color_h),brushColor-$n1-$n2-$n3 penColor-$n1-$n2-$n3) \$button2(\$get(color_x),\$get(color_y),0,0,\$get(color_w),\$get(color_h),,,PVAR:SET:colorize_global:brushcolor-$n1-$n2-$n3 pencolor-$n1-$n2-$n3,TOOLTIP:\$n1-$n2-$n3\) ; $output ? *** The $drawrect, $button2, and $get are NOT php functions, but to be printed as actual text (which is why I have escaped them with the backslash). Anyways, I thought it would be easiest to separate each R-G-B value into its own variable ($n1, $n2, and $n3). That way I could just use some code (regex?) to cycle through the numbers 0 to 255. The HARD part (that I can't seem to even think of a way to make it possible) is to change JUST the G and B values while keeping the R value at 255. Then when the G and B values both hit 0, the R value is set to 254 and repeated until it also hits 0 with the other two. I think (?) that will do every possible color? I also need to print each string with the individual color output, and I don't know how to do that either. In short, I would like something that looks just like the windows color picker, and when each pixel of it is clicked, it will show me the R-G-B value in the format I would like. If anyone understands what I am after,and could help, that would be awesome! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php HTML a href=color.phpimg src=colormap.png ismap=ismap //a PHP color.php list($coords) = array_keys($_GET); $coords = explode(',', $coords); // Easier way...? $im = imagecreatefrompng('colormap.png'); $color = imagepixelat($im, $coords[0], $coords[1]); I wouldn't do it like this, though. I'd use Javascript. -- -Casey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] validating mysql bound date
Larry Brown wrote: Its been a long week already... -MM-DD. On Tue, 2008-03-04 at 20:16 -0500, Larry Brown wrote: Does anyone know if there is a builtin function for checking the formatting of an incoming date to verify it is /MM/DD. I know how to convert between formats but want a quick way to check an incoming variable to ensure it will be handled properly by mysqld. I normally provide dropdown fields for each (except the year which is a text-field) and put it together how I need it. Validate each part separately and you're off and racing. If you accept any date you'll probably have to split it up first but the principles will be the same. $date = '-00-00'; // if they didn't use exactly two dashes? invalid if (substr_count($date, '-') !== 2) { die(Invalid date); } list($year, $month, $day) = explode('-', $date); if (strlen($year) != 4) { die(Invalid year); } and so on. -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] validating mysql bound date
Thanks, I ended up doing: $incomingQuestDatePieces = explode(-, $incomingQuestDate ); if(checkdate($incomingQuestDatePieces[1],$incomingQuestDatePieces[2], $incomingQuestDatePieces[0])) { return true; } else { return false; } I was just wondering since a lot of people have to verify correct format of the date when working with mysql that there might be some built in that is faster etc. Thanks though... On Wed, 2008-03-05 at 14:34 +1100, Chris wrote: Larry Brown wrote: Its been a long week already... -MM-DD. On Tue, 2008-03-04 at 20:16 -0500, Larry Brown wrote: Does anyone know if there is a builtin function for checking the formatting of an incoming date to verify it is /MM/DD. I know how to convert between formats but want a quick way to check an incoming variable to ensure it will be handled properly by mysqld. I normally provide dropdown fields for each (except the year which is a text-field) and put it together how I need it. Validate each part separately and you're off and racing. If you accept any date you'll probably have to split it up first but the principles will be the same. $date = '-00-00'; // if they didn't use exactly two dashes? invalid if (substr_count($date, '-') !== 2) { die(Invalid date); } list($year, $month, $day) = explode('-', $date); if (strlen($year) != 4) { die(Invalid year); } and so on. -- Larry Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php