[PHP] Debugging
Understanding that some coders are diametrically opposed to all assistance from debuggers as crutches, I offer this link for the rest of us: http://particletree.com/features/php-quick-profiler/ Mine was pointing to the wrong folder and still has some warnings so I think these guys might have hurried a bit but it still looks awfully cool.
Re: [PHP] Multiple return statements in a function.
On Thu, Apr 23, 2009 at 8:25 AM, Per Jessen p...@computer.org wrote: Peter van der Does wrote: I tend to put my return value in a variable and at the end of the function I have 1 return statement. I have seen others doing returns in the middle of the function. Example how I do it: function check($a) { $return=''; if ( is_array( $a ) ) { $return='Array'; } else { $return='Not Array'; } return $return; } Example of the other method: function check($a) { if ( is_array( $a ) ) { return ('Array'); } else { return ('Not Array'); } } What is your take? And is there any benefit to either method? It's only about style and coding logic. In essence, all the return does is pop the previous IP off the stack and adjust the stack pointer. It doesn't matter where you do that. /Per -- Per Jessen, Zürich (16.2°C) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php That's an interesting subject that I've never considered. I usually return immediately. For me, it makes the code easier to read. I work with a number of other coders here and, if the result isn't returned then I have to keep reading through the code to make sure nothing else is done with it. However, when I see the 'return' then I know we're done there. That said, I often see questionable coding practices in use at work. I follow this list (and try to read books about the technologies I use) because I intend to develop good practices for myself. That in mind, if anybody feels strongly about doing it the other way, I'd be interested in understanding its benefits. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] alt() - unknown function?
This is someplace where NetBeans really benefits me. You can hit CTRL-B, or right-click, to take you to a definition. Holding CTRL turns darned-near everything into a hyperlink, doing the same thing. Lastly, CTRL-SHIFT-F lets you search through every file in the project for your string. Finding nothing with those, I'd grep the whole stinkin' drive and go grab a coffee. :) On Wed, Apr 15, 2009 at 10:39 AM, Thodoris t...@kinetix.gr wrote: Hi all, I've just started looking at the code of an e-commerce site we are taking over the development of, that another company has previously developed . Coupled with the difficulty of taking over development of someone else's code (also poorly commented), I've been stumped by a fatal error on a function call alt() which is dotted everywhere in the main templating script (sample below): // Get/Set a specific property of a page function getPageProp($prop,$id=) { return $this-PAGES[alt($id,$this-getPageID())][$prop]; } function setPageProp($prop,$val,$id=) { $this-PAGES[alt($id,$this-getPageID())][$prop]=$val; } It looks to be defining properties for a list of pages, with each page providing its own PageID. I've never seen this function before, nor can I find any definition of it in the site code, I was wondering if anyone recognises this, is it from a thirdparty templating tool at all? Thanks -Tom I think that you should check the included files (require, require_once, include, include_once) in case it is defined somewhere in there. Another possibility I can think of is to be defined in a framework that you use. You can check the user and internal functions using the get_defined_fumctions(): http://us.php.net/manual/en/function.get-defined-functions.php -- Thodoris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] extracting text - regex
I'm what you might consider rather green, myself. I certainly wouldn't use this code for production but if you're just debugging or something then how about something like this: ?php $handle = @fopen('page.htm', 'r'); if ($handle) { while (!feof($handle)) { $eos = trim(fgets($handle, 4096)); if (strpos($eos,div) !== FALSE) { $echo_output = TRUE; } if (strpos($eos,\div) !== FALSE) { $echo_output = FALSE; } if ($echo_output == TRUE) { echo $eos; } } fclose($handle); } ? On Wed, Apr 8, 2009 at 8:30 AM, Per Jessen p...@computer.org wrote: Merlin Morgenstern wrote: Hello, I am trying read text out of a text that is inbetween two divs. Somehow this should be possible with regex, I just can't figure out how. Example: div id=test bla blub /div I would like to extract the text bla blub out of this example. This might do the trick (not tested): preg_match( /div\s+[^]*([^]*)\/div, $yourtext, $match ); print $match[1]; /Per -- Per Jessen, Zürich (16.8°C) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] extracting text - regex
On Wed, Apr 8, 2009 at 9:13 AM, George Larson george.g.lar...@gmail.comwrote: I'm what you might consider rather green, myself. I certainly wouldn't use this code for production but if you're just debugging or something then how about something like this: ?php $handle = @fopen('page.htm', 'r'); if ($handle) { while (!feof($handle)) { $eos = trim(fgets($handle, 4096)); if (strpos($eos,div) !== FALSE) { $echo_output = TRUE; } if (strpos($eos,\div) !== FALSE) { $echo_output = FALSE; } if ($echo_output == TRUE) { echo $eos; } } fclose($handle); } ? On Wed, Apr 8, 2009 at 8:30 AM, Per Jessen p...@computer.org wrote: Merlin Morgenstern wrote: Hello, I am trying read text out of a text that is inbetween two divs. Somehow this should be possible with regex, I just can't figure out how. Example: div id=test bla blub /div I would like to extract the text bla blub out of this example. This might do the trick (not tested): preg_match( /div\s+[^]*([^]*)\/div, $yourtext, $match ); print $match[1]; /Per -- Per Jessen, Zürich (16.8°C) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Sorry about the top-post. I forgot. :)
Re: [PHP] [php] scheduled task in php
On Thu, Apr 2, 2009 at 10:12 AM, Kyle Smith kyle.sm...@inforonics.comwrote: There's no need for third party software, windows has a scheduled task system. Make a scheduled task and for the application select the php executable (Maybe C:\PHP\bin\php.exe, or some such.). Once the wizard is complete select the checkbox that says Open the task when I click Finish. Now place the full path of your script after the executable in the field provided so it looks something like: C:\PHP\php.exe C:\Documents and Settings\Kyle\My Documents\scripts\MyCronPHPScript.php HTH, Kyle *Kyle Smith* UNIX/Linux Systems Administrator Inforonics, LLC Jan G.B. wrote: Or even with CRONw if via window is an indicator for the evil OS. http://cronw.sourceforge.net/ (I personally didn't test this software) bye 2009/4/2 Michel OLIVIER michel.oliv...@mc2i.fr: hi, with a cron and wget? 2009/4/2 Andrew Williams andrew4willi...@gmail.com: All, Please how can you run a timed php script file via window scheduled task. or how can u execute a php script on a a time interval for instance every 4minutes -- Best Wishes Andrew Williams -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php I have found Window's task scheduler utterly insufficient. I understand, and agree with, your desire to keep things native but I have thrown that away for my scheduled events. I swear bt VisualCron [ http://www.visualcron.com/].
Re: [PHP] Workflow app for software
Please quit side-posting. Thanks. On Wed, Apr 1, 2009 at 2:58 PM, Robert Cummings rob...@interjinn.comwrote: I for one don't find you very | On Wed, 2009-04-01 at 11:46 -0700, funny Bruce. It's common knowledge | bruce wrote: so haliphax... that it's very difficult to follow | side posts. If not already, then | since you seem to be the primary they should certainly be | person with this issue.. at dictatorily banned from being used.| least for now... i'll ahead and | nominate you to the guy in Cheers,| charge of making sure posters Rob. | follow the written rule to not | top/down/side/left/right post... | | have fun!!! | | | | -Original Message- From: | haliphax | [mailto:halip...@gmail.com] | Sent: Wednesday, April 01, 2009 | 11:42 AM To: | php-general@lists.php.net | Subject: Re: [PHP] Workflow app | for software | | | On Wed, Apr 1, 2009 at 1:38 PM, | Robert Cummings | rob...@interjinn.com wrote: | On Wed, 2009-04-01 at 13:30 | -0500, haliphax wrote: On | Wed, Apr 1, 2009 at 11:53 |AM, bruce |bedoug...@earthlink.net |wrote: and haliphax... | |i specifically sent the |reply to only you.. you |then felt the need to reply |to the list as a whole | |hmm.. ok.. this thread is |officially dead!! | |unless of course it gets |back to the initial |question... | |peace!! | | | -Original | Message- From: | haliphax | Sent: Wednesday, April | 01, 2009 5:38 AM To: | php-general@lists.php.net | Subject: Re: [PHP] | Workflow app for | software | | --8-- | |Again, please do not |top-post. It is the |agreed-upon procedure in |this list to bottom-post |when replying to threads. |(I am not just going |renegade thread-Nazi on |you.) | |Could you show me the |signed agreement list. |While it's convention on |this list, it's certainly |not something everyone |agreed upon. | | To Rob, I meant agreed-upon | as in: it's been written... | so somebody had to agree to | it up to the point that it | was posted here - | http://us3.php.net/reST/php |
[PHP] PHP task manager
We've got a homebrew ToDo list (task project) manager / mailer that we're thinking about replacing with something a little more robust. Any suggestions? I saw TaskFreak! on Google but I am curious if there are any personal recommendations out there. Thanks! G
Re: [PHP] Proper code formatting
On Mon, Mar 23, 2009 at 8:23 AM, Shawn McKenzie nos...@mckenzies.netwrote: Bob McConnell wrote: From: Michael A. Peters Angus Mann wrote: Hi all, I'm fairly new to PHP so I don't have too many bad habits yet. I'm keen to make my code easy to read for me in the future, and for others as well. Are there any rules or advice I can use for formatting (especially indenting) code? for example how best to format / indent this ? To each his own. Whatever floats your canoe. Just whatever you pick, stick to it throughout your code. I'm using PHP designer 2008 which does syntax coloring but if it has something to automatically indent - I haven't found it yet. It probably allows you to either set a specify a tab as a real tab or a specified number of spaces. Auto-indenting - this isn't python, the compiler doesn't enforce it's way, you follow the convention of the project you are working on - so I suspect many php editors tailored to php don't have an auto indent. I've never of course tried that specific product. I use bluefish, vi, and emacs. To take this question a step further, is there a PHP best practices document available? I am looking for one that I can give to a new programmer and tell her do it this way until you can explain to me why you shouldn't. Bob McConnell There are various coding standards. There is one for PEAR, the Zend Framework and most frameworks/large projects that take contributions have them. Here's Zend: http://framework.zend.com/manual/en/coding-standard.html -- Thanks! -Shawn http://www.spidean.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Being a greenhorn, I too can benefit from this thread. Is that to say, Shawn, that you personally find this (Zend) standard as good or better than the rest?
Re: [PHP] Proper code formatting
Well, I was pondering making a recommendation, of sorts. I work in an environment with various levels of coders, perhaps similar to your description. Currently, there are no standards that I have seen. We all are bringing our coding habits with us. I don't know if it is important that I like lower case variable names with underscores for spaces while the next guy likes each letter of a new word in uppercase. However, I can imagine it getting out of control as the code continues to grow. On Mon, Mar 23, 2009 at 8:48 AM, Jason Pruim pru...@gmail.com wrote: George Larson wrote: On Mon, Mar 23, 2009 at 8:23 AM, Shawn McKenzie nos...@mckenzies.net wrote: Bob McConnell wrote: From: Michael A. Peters Angus Mann wrote: Hi all, I'm fairly new to PHP so I don't have too many bad habits yet. I'm keen to make my code easy to read for me in the future, and for others as well. Are there any rules or advice I can use for formatting (especially indenting) code? for example how best to format / indent this ? To each his own. Whatever floats your canoe. Just whatever you pick, stick to it throughout your code. I'm using PHP designer 2008 which does syntax coloring but if it has something to automatically indent - I haven't found it yet. It probably allows you to either set a specify a tab as a real tab or a specified number of spaces. Auto-indenting - this isn't python, the compiler doesn't enforce it's way, you follow the convention of the project you are working on - so I suspect many php editors tailored to php don't have an auto indent. I've never of course tried that specific product. I use bluefish, vi, and emacs. To take this question a step further, is there a PHP best practices document available? I am looking for one that I can give to a new programmer and tell her do it this way until you can explain to me why you shouldn't. Bob McConnell There are various coding standards. There is one for PEAR, the Zend Framework and most frameworks/large projects that take contributions have them. Here's Zend: http://framework.zend.com/manual/en/coding-standard.html -- Thanks! -Shawn http://www.spidean.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Being a greenhorn, I too can benefit from this thread. Is that to say, Shawn, that you personally find this (Zend) standard as good or better than the rest? I actually just went through this wit ha group of people that come from all different levels and back grounds in regards to programing. Trying to decide whether to use spaces, or tabs, short hand or long hand... It took quite a bit of discussion before we arrived at an agreement... It really didn't matter what format we used as long as we stayed consistent throughout the file. In other words, if you are going to edit a file and it uses spaces instead of tabs, use spaces So absolutely, develop some standards if you are going to have multiple coders working on it... But they don't have to be set by someone else... Personally though, I go for readability it may at times take longer to write it out, but since we all type 500 words permit with 100% accuracy it won't be a problem right? ;) And then when you go back to the code in 6 months, a year, 2 years... It's still easily read able :)
Re: [PHP] So called PHP Expert
OMGBBQ I didn't even catch that! He truly is the c0d1ng g0d! On Mon, Mar 23, 2009 at 12:45 PM, haliphax halip...@gmail.com wrote: On Fri, Mar 20, 2009 at 5:27 PM, דניאל דנון danondan...@gmail.com wrote: ---8--- ### function h3x($envar){ $hax3d = bin2hex($envar); $hax3d = chunk_split($hax3d , 2, %); $hax3d = % . substr($hax3d , 0, strlen($hax3d ) - 1); return $hax3d; } ?* Programmers who use 13375p34k (leet speak) in their code should be dragged out into the street and shot. -- // Todd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Web Development/Application Analysis
2009/3/22 OOzy Pal oozy...@gmail.com On Sat, Mar 21, 2009 at 6:33 PM, tedd tedd.sperl...@gmail.com wrote: At 6:15 PM +0300 3/21/09, OOzy Pal wrote: Tedd, You wrote a long story about a client hiring a programmer which not what I am asking. Anyhow, thank you for your post. I learned from it. I don't want to take it further. This php mailing list. Really -- is that what this is? I thought it was a place where people could ask: -- quote I have just hired a remote PHP programmer. His main job is web development and applications. I have few concerns, I would be happy if someone can point me to the right direction. 1. How can I provide him the requirements. I mean how can I analyze the site and put everything in writing. 2. How can I estimate manhours. -- unquote For which I provided advice and example, which apparently fell on deaf ears. As such, I won't waste my time entertaining any other questions from you. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com Again, I thank you for your post. It was beneficial. If I may ask you to use the time that you will not use for asnwering my questions in reading about relaxation politness. No matter what type disagreement happend between any two, that does not give any one of them the right to insult the other. -- OOzy Ubuntu (8.10) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Oozy, Lighten up, brother. I read your original question and I thought This guy shoulda started asking these questions before her started hiring people. Tedd invested time, thought and energy in to giving you a quality response. I don't have the kind of field experience to give you an answer of that caliber. I personally felt that I benefited from reading Tedd's response to you, so it shouldn't have been too difficult for you to gain from it. After that, you announced yourself the owner. It may have escaped your scrutiny, but the kind people that hang out here trying to assist people with their PHP challenges are *NOT* here to do your job for you. That, in my opinion, is what you asked. I've started a business and hired a programmer. Now somebody please explain to me how to be his boss, otherwise it is going to be a difficult week. Then you deal a really uninventive insult (my questions in reading about relaxation politness.) to a guy who has shown vast amounts of patience and politeness to both, you, and the other's that he has helped -- if you've been watching. Then you wrap it up with the decree No matter what type disagreement happend between any two, that does not give any one of them the right to insult the other. which is particularly rubbish following the sentence where you insulted Tedd. Also, you will find that people do, in fact, have the right to insult each other with, or without, disagreement. This is something that you'll observe quite readily by hanging out on the PHP list. So far, imo, everybody has been pretty nice to you. So why don't you go spend some times with those books about 'relaxation politness' and stop pitching what you ain't prepared to catch?
Re: [PHP] Dynamic Form 'on The Fly' OT
On Sat, Mar 21, 2009 at 8:58 AM, tedd tedd.sperl...@gmail.com wrote: At 1:03 PM -0500 3/20/09, Lists wrote: tedd wrote: Now, can you show me how to pull data from a mysql database so that the input statements can be created dynamically? Sure, On the WebDNA side, it's something like this (form of names from a database): -snip- However, like you said, this a PHP list, so I'd better refrain from any more WebDNA related posts for a while! ;-) I don't want to upset the powers that be. Donovan: There's no powers that be on this list. The closest is Dan and we all ignore him. :-) Next question -- how do you keep login's and passwords safe? Is the following not embedded in the html? [SQLConnect dbType=MySQLhost=192.168.1.1database=TestNamesuid=sapwd=passconn_var=conn1] [/SQLConnect] If so, then doesn't that create a security concern? 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 For the record, I'm with Tedd. Regardless of this being a designated PHP arena, I'm enjoying this WebDNA conversation and might even give it a test drive...
Re: [PHP] Web Development/Application Analysis
On Sat, Mar 21, 2009 at 9:40 AM, tedd tedd.sperl...@gmail.com wrote: At 11:45 PM +0300 3/20/09, OOzy Pal wrote: I guess I did not make it clear. Sorry guys/gals. I forgot to tell you that I own a web development/design company. Thank you -- OOzy What does that have to do with your questions -- other than you should have known the answers. Some times it's just pointless to provide advice. 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 Lol @ Tedd!
Re: [PHP] Script Analysis (was Conclusion of use strict...)
**On Sat, Mar 21, 2009 at 10:27 AM, Hans Schultz h.schult...@yahoo.comwrote: Hi Virgilio, Thanks for that last link, I just know need to figure out why my Netbeans doesn't work like that (although I am using latest version) On Sat, 21 Mar 2009 10:56:46 +0100, Virgilio Quilario virgilio.quila...@gmail.com wrote: Hi Hans, Is this what you are looking for? Debug PHP code using Xdebug: You can inspect local variables, set watches, set breakpoints, and evaluate code live. Navigate to declarations, types and files using Go To shortcuts and hypertext links. It is from this url: http://www.netbeans.org/features/php/ Or maybe this. It highlights those variables not initialized. See the screencast. http://www.netbeans.org/kb/docs/php/php-editor-screencast.html Maybe should try it sometime. Best wishes, Virgil http://www.jampmark.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php XDebug is not easy to set up. I have a couple of Windows (and a couple of Linux) boxes that I have tried. The instructions are generally *really *simple... and ineffective (for me). However, it looks like if you're smart enough then it is really smashing. :)
Re: [PHP] Re: Problems with exec() on windows
I've skimmed some of thread, but I have not been following closely so please disregard if I'm just rambling. However, I've worked with lots of software on DOS boxen that couldn't handle long file names. If they also choke on the tildes then I usually just write a batch file that calls the full path and file with whatever command line parameters I pass to the batch. For example: --- @echo off C:\Program Files\Mozilla Firefox\firefox.exe %1 %2 %3 --- HTH, G On Fri, Mar 20, 2009 at 9:26 AM, haliphax halip...@gmail.com wrote: On Fri, Mar 20, 2009 at 1:47 AM, Kyohere Luke pr0...@gmail.com wrote: You might have something there - never really thought about how windows forms the 8.3 names... not many resources online about it ... The actual path is c:\Program File\Gammu 1.23.91\bin\gammu.exe I'd used c:\Progra~1\Gammu~1\bin\gammu.exe You should be able to view these truncated path names via the dir command in a CMD.EXE command line. I say this because Program Files and Programs would collide with each other (just as an example); one would be Progra~1 and one would be Progra~2. -- // Todd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] [News] Affordable Independent Web Developer - Search Engine Optimization Services - March 19th, 2009
Not only that but, judging from the phone number, Samantha cleans also cleans houses: http://betterthancleanmaidandmaintenanceservices.com/choose-us/contact-us-mainmenu-3/12-contacts/1-name.html On Fri, Mar 20, 2009 at 10:57 AM, Jochem Maas joc...@iamjochem.com wrote: Ginkga Studio LLC schreef: Today's Date: March 19th, 2009 Hello, I'm a real person sending you this email - this is an initial contact opt-in request for permission to contact you for web development services. WHO I AM AND MY INTENTIONS: I'm an affordable, independent web developer, been in business for about 5 years. Interested in building a new website for you or help you on your current site. you realise you just posted to a list of web developers, right? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] [News] Affordable Independent Web Developer - Search Engine Optimization Services - March 19th, 2009
I believe that I read somewhere that she designs all web sites in a French maid uniform. On Fri, Mar 20, 2009 at 1:21 PM, Jay Blanchard jblanch...@pocket.comwrote: [snip]hey, everyone, my name is Samantha[/snip] This thread is worthless without pictures.
[PHP] PHP blogs?
I'm reorganizing my reader. Anybody suggest any good PHP feeds?
Re: [PHP] [News] Affordable Independent Web Developer - Search Engine Optimization Services - March 19th, 2009
houses ain't gunna cleen themselfs... On Fri, Mar 20, 2009 at 2:39 PM, Ginkga Studio, LLC webdes...@ginkga.comwrote: LOL. :0) Ok. You guys are fun but I have to get to work. Hope all works out for you guys. Sorry for posting to your list. Just block me so I don't bother you again. Good luck with all your programming. You all seem like pretty good people. Sorry for harassing you George. I'm sure you are sexy in something short and lacy. Sorry for offending Daniel and all of his greatness. I'm sure he's a pretty good guy when he isn't being so defensive. Anyway, nice meeting you all, even it was on such terms. God Bless. XOXOXOXO -Original Message- From: George Larson [mailto:george.g.lar...@gmail.com] Sent: Friday, March 20, 2009 11:34 AM To: Thiago H. Pojda Cc: webdes...@ginkga.com; php-general@lists.php.net Subject: Re: [PHP] [News] Affordable Independent Web Developer - Search Engine Optimization Services - March 19th, 2009 Oh, good; I look forward to polishing your nails... spammer. On Fri, Mar 20, 2009 at 2:29 PM, Thiago H. Pojda thiago.po...@gmail.com wrote: On Fri, Mar 20, 2009 at 3:23 PM, Ginkga Studio, LLC webdes...@ginkga.comwrote: IF YOU WERE MY HUSBAND I WOULD SPANK YOUR ASS SO HAR YOU'D NEVER TALK BACK ANY WOMAN EVER AGAIN !!! Oh, gee. Thanks for filters, Gmail. -- Thiago Henrique Pojda http://nerdnaweb.blogspot.com
Re: [PHP] [News] Affordable Independent Web Developer - Search Engine Optimization Services - March 19th, 2009
Oh, good; I look forward to polishing your nails... spammer. On Fri, Mar 20, 2009 at 2:29 PM, Thiago H. Pojda thiago.po...@gmail.comwrote: On Fri, Mar 20, 2009 at 3:23 PM, Ginkga Studio, LLC webdes...@ginkga.com wrote: IF YOU WERE MY HUSBAND I WOULD SPANK YOUR ASS SO HAR YOU'D NEVER TALK BACK ANY WOMAN EVER AGAIN !!! Oh, gee. Thanks for filters, Gmail. -- Thiago Henrique Pojda http://nerdnaweb.blogspot.com
Re: [PHP] [News] Affordable Independent Web Developer - Search Engine Optimization Services - March 19th, 2009
I do have a thick leather belt with your name on it. I bet it's in uppercase letters, you little vixen. On Fri, Mar 20, 2009 at 2:47 PM, Ginkga Studio, LLC webdes...@ginkga.comwrote: Georgeyou are SO close to getting spanked. I do have a thick leather belt with your name on it. You're funny!!! :0) Now get to work! -Original Message- From: George Larson [mailto:george.g.lar...@gmail.com] Sent: Friday, March 20, 2009 11:42 AM To: webdes...@ginkga.com Cc: Thiago H. Pojda; php-general@lists.php.net Subject: Re: [PHP] [News] Affordable Independent Web Developer - Search Engine Optimization Services - March 19th, 2009 houses ain't gunna cleen themselfs... On Fri, Mar 20, 2009 at 2:39 PM, Ginkga Studio, LLC webdes...@ginkga.com wrote: LOL. :0) Ok. You guys are fun but I have to get to work. Hope all works out for you guys. Sorry for posting to your list. Just block me so I don't bother you again. Good luck with all your programming. You all seem like pretty good people. Sorry for harassing you George. I'm sure you are sexy in something short and lacy. Sorry for offending Daniel and all of his greatness. I'm sure he's a pretty good guy when he isn't being so defensive. Anyway, nice meeting you all, even it was on such terms. God Bless. XOXOXOXO -Original Message- From: George Larson [mailto:george.g.lar...@gmail.com] Sent: Friday, March 20, 2009 11:34 AM To: Thiago H. Pojda Cc: webdes...@ginkga.com; php-general@lists.php.net Subject: Re: [PHP] [News] Affordable Independent Web Developer - Search Engine Optimization Services - March 19th, 2009 Oh, good; I look forward to polishing your nails... spammer. On Fri, Mar 20, 2009 at 2:29 PM, Thiago H. Pojda thiago.po...@gmail.com wrote: On Fri, Mar 20, 2009 at 3:23 PM, Ginkga Studio, LLC webdes...@ginkga.comwrote: IF YOU WERE MY HUSBAND I WOULD SPANK YOUR ASS SO HAR YOU'D NEVER TALK BACK ANY WOMAN EVER AGAIN !!! Oh, gee. Thanks for filters, Gmail. -- Thiago Henrique Pojda http://nerdnaweb.blogspot.com
Re: [PHP] PHP blogs?
Fantastic! No, I had somehow managed to overlook that one. Thanks! On Fri, Mar 20, 2009 at 2:49 PM, Daniel Brown danbr...@php.net wrote: On Fri, Mar 20, 2009 at 14:37, George Larson george.g.lar...@gmail.com wrote: I'm reorganizing my reader. Anybody suggest any good PHP feeds? Are you already using the RSS/RDF stuff straight from the horse's mouth, George? http://new I do have a thick leather belt with your name on it.s.php.net/ http://news.php.net/ -- /Daniel P. Brown daniel.br...@parasane.net || danbr...@php.net http://www.parasane.net/ || http://www.pilotpig.net/ 50% Off All Shared Hosting Plans at PilotPig: Use Coupon DOW1
Re: [PHP] PHP blogs?
Got it! Thanks! On Fri, Mar 20, 2009 at 2:53 PM, Stuart stut...@gmail.com wrote: 2009/3/20 George Larson george.g.lar...@gmail.com: I'm reorganizing my reader. Anybody suggest any good PHP feeds? http://www.planet-php.net/ is an aggregator of some of the good stuff that's out there. -Stuart -- http://stut.net/
Re: [PHP] Script Analysis (was Conclusion of use strict...)
Netbeans does have some sick fanciness... Auto-suggest, leaving your cursor over a variable momentarily highlights it everywhere in the code and define labeled folding points. You can press CTRL-R to rename that variable everywhere it is used in the code. If you can figure out how to set it up with xdebug (I'm working on it) then you can have step-by-step debugging. NetBeans is well worth giving a chance, in my opinion. You can check out some videos if you don't want to risk the time. ( http://www.netbeans.org/kb/55/flash.html) On Fri, Mar 20, 2009 at 5:07 PM, Hans Schultz h.schult...@yahoo.com wrote: On Fri, 20 Mar 2009 15:45:09 +0100, Virgilio Quilario virgilio.quila...@gmail.com wrote: On Fri, Mar 20, 2009 at 6:47 PM, Pierre Lilliman lilli...@live.com wrote: I have been using same program for some (not very long time), and I find it very useful, although it has some annoying things (inability to work with all kinds of include expressions). Still I think every serious PHP developer should consider using something like this. Cheers --- On Thu, 3/19/09, Hans Schultz wrote: If someone is still interested in problem I found litle tool that is pretty close to detecting errors in PHP at compile time (compile time rghhh :P). It is Codenizer (http://www.softwarehood.com/Codenizer/), I am still checking it, if someone uses it it would be nice to share experience :) Hi guys, Check out Netbeans IDE for PHP. http://www.netbeans.org/features/php/ Your wishes answered. Though it doesn't have use strict but it tracks variables for you. Virgil http://www.jampmark.com Can you please elaborate on this (using Netbeans to track variables), I know what Codenizer does, but I didn't manage to make Netbeans to do this variable track? Few guys also mentioned that but I couldn't really find that feature? TIA -- Using Opera's revolutionary e-mail client: http://www.opera.com/mail/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Script Analysis (was Conclusion of use strict...)
Ooops! Those were v5.5 videos.. A little newer stuff is here: http://www.netbeans.org/kb/docs/screencasts.html On Fri, Mar 20, 2009 at 7:44 PM, George Larson george.g.lar...@gmail.comwrote: Netbeans does have some sick fanciness... Auto-suggest, leaving your cursor over a variable momentarily highlights it everywhere in the code and define labeled folding points. You can press CTRL-R to rename that variable everywhere it is used in the code. If you can figure out how to set it up with xdebug (I'm working on it) then you can have step-by-step debugging. NetBeans is well worth giving a chance, in my opinion. You can check out some videos if you don't want to risk the time. ( http://www.netbeans.org/kb/55/flash.html) On Fri, Mar 20, 2009 at 5:07 PM, Hans Schultz h.schult...@yahoo.comwrote: On Fri, 20 Mar 2009 15:45:09 +0100, Virgilio Quilario virgilio.quila...@gmail.com wrote: On Fri, Mar 20, 2009 at 6:47 PM, Pierre Lilliman lilli...@live.com wrote: I have been using same program for some (not very long time), and I find it very useful, although it has some annoying things (inability to work with all kinds of include expressions). Still I think every serious PHP developer should consider using something like this. Cheers --- On Thu, 3/19/09, Hans Schultz wrote: If someone is still interested in problem I found litle tool that is pretty close to detecting errors in PHP at compile time (compile time rghhh :P). It is Codenizer (http://www.softwarehood.com/Codenizer/), I am still checking it, if someone uses it it would be nice to share experience :) Hi guys, Check out Netbeans IDE for PHP. http://www.netbeans.org/features/php/ Your wishes answered. Though it doesn't have use strict but it tracks variables for you. Virgil http://www.jampmark.com Can you please elaborate on this (using Netbeans to track variables), I know what Codenizer does, but I didn't manage to make Netbeans to do this variable track? Few guys also mentioned that but I couldn't really find that feature? TIA -- Using Opera's revolutionary e-mail client: http://www.opera.com/mail/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] /home/{user}/directory
My question was, as usual, inadequately formed. Realpath() was interesting but I was creating directories to store archived data. In my limited testing, it seemed that realpath returns a relative path. Other words, if you're already in home and you try (realpath(~).\archive\) then you get only \archive\. In test situations, I wanted to allow for the user to not be me. It ended up that I used GETCWD() so that it will run from anywhere that it can find the required includes. Nevertheless, the answers given enabled me to find a solution. I found all kinds of interesting stuff with a var_dump($GLOBALS), however. :) As always, thanks everybody! On Wed, Mar 18, 2009 at 5:16 AM, Waynn Lue waynn...@gmail.com wrote: bash also has $HOME, which maps to /home/USERNAME, just in case you wanted another way. :) On Tue, Mar 17, 2009 at 6:47 AM, George Larson george.g.lar...@gmail.comwrote: Thanks! On Tue, Mar 17, 2009 at 9:46 AM, Stuart stut...@gmail.com wrote: 2009/3/17 George Larson george.g.lar...@gmail.com In my scripts, I usually define a boolean constant DEBUG. True looks for local copies of includes and echoes queries as they're used. My question is: Is there any way for me to reflect the actual home folder of the person running the script? So it will be /home/george/foo when I run it but, for another user, it would be /home/their-username/foo? $dir = realpath('~/foo'); -Stuart -- http://stut.net/
Re: [PHP] Form to pdf
I'm going to print one to 'Fork and Zombies' and hang it in my office. I really mean that. On Wed, Mar 18, 2009 at 10:17 AM, Gary gwp...@ptd.net wrote: I'm going to frame that and call my ma Can you direct me to how I can learn that? Thanks for your help. Gary Sperling Institute of Technology Honoree tedd tedd.sperl...@gmail.com wrote in message news:p06240805c5e6afc21...@[192.168.1.101]... At 5:48 PM -0400 3/17/09, Gary wrote: Is it possible to create an online form, that when filled out the fields will can be placed in a pdf form? Gary: Sure, here's an example: http://webbytedd.com/bb/pdf/ 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
[PHP] /home/{user}/directory
In my scripts, I usually define a boolean constant DEBUG. True looks for local copies of includes and echoes queries as they're used. My question is: Is there any way for me to reflect the actual home folder of the person running the script? So it will be /home/george/foo when I run it but, for another user, it would be /home/their-username/foo?
Re: [PHP] /home/{user}/directory
Thanks! On Tue, Mar 17, 2009 at 9:46 AM, Stuart stut...@gmail.com wrote: 2009/3/17 George Larson george.g.lar...@gmail.com In my scripts, I usually define a boolean constant DEBUG. True looks for local copies of includes and echoes queries as they're used. My question is: Is there any way for me to reflect the actual home folder of the person running the script? So it will be /home/george/foo when I run it but, for another user, it would be /home/their-username/foo? $dir = realpath('~/foo'); -Stuart -- http://stut.net/
Re: [PHP] /home/{user}/directory
That is correct. PHP on CLI. Thanks! On Tue, Mar 17, 2009 at 9:51 AM, Thiago H. Pojda thiago.po...@gmail.comwrote: On Tue, Mar 17, 2009 at 10:42 AM, George Larson george.g.lar...@gmail.com wrote: In my scripts, I usually define a boolean constant DEBUG. True looks for local copies of includes and echoes queries as they're used. My question is: Is there any way for me to reflect the actual home folder of the person running the script? So it will be /home/george/foo when I run it but, for another user, it would be /home/their-username/foo? Just checking, you're running PHP on CLI then, right? If it's running on normal apache setup the user would always be the user which apache is running. Thiago Henrique Pojda http://nerdnaweb.blogspot DOT com
Re: [PHP] Re: Fork and zombies
If Fork and Zombies was a diner... I would totally eat there. On Tue, Mar 17, 2009 at 5:00 PM, Jochem Maas joc...@iamjochem.com wrote: Per Jessen schreef: Waynn Lue wrote: (Apologies for topposting, I'm on my blackberry). Hm, so you think exiting from the child thread causes the db resource to get reclaimed? Yeah, something like that. The connection is definitely closed when the child exits. I can confirm this. you definitely need to open a connection for each child process. if you require a db connection in the parent process, you should close it before forking (and then reopen it afterwards if you still need it). at least that's what I found I had to do when I ran into this. incidently my forking loop looks like this, very interested to know if Per can spot any obvious stupidity: $childProcs = array(); do { if (count($childProcs) = $maxChildProcs) { $site = array_shift($sites); $pid = pcntl_fork(); } else { // stay as parent, no fork, try to reduce number of child processes $site = null; $pid = null; } switch (true) { case ($pid === -1): cronLog(error: (in {$thisScript}), cannot initialize worker process in order to run {$script} for {$site['name']}); break; case ($pid === 0): // we are child $exit = 0; $output = array(); // do we want to exec? or maybe include? if ($doExec) { exec($script.' '.$site['id'], $output, $exit); } else { $output = inc($script); $output = explode(\n, $output); } if ($exit != 0) cronLog(error: (in {$thisScript}), {$script} reported an error ($exit) whilst processing for {$site['name']},); foreach ($output as $line) cronLog($line); exit($exit); break; default: // we are parent $childProcs[] = $pid; do { $status = null; while (pcntl_wait($status, WNOHANG | WUNTRACED) 1) usleep(5); foreach ($childProcs as $k = $v) if (!posix_kill($v, 0)) // send signal 'zero' to check whether process is still 'up' unset($childProcs[ $k ]); $childProcs = array_values($childProcs); if (count($sites)) break; // more sites to run the given script for if (!count($childProcs)) break; // no more sites to run the given script for and all children are complete/dead } while (true); break; } if (!count($sites)) break; // nothing more to do usleep(5); } while (true); /Per -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Script execution
Hi everybody. The problem that I'm having is probably because I've got more of a Windows background -- and it isn't so much a problem as a point of curiosity. I've recently noticed that when I write a script that they seem to have different permissions when executed at the command line. Two that I have written recently run just fine when you execute 'php scriptname.php' but they are unable, at least, to write the data if I browse to them on localhost. Am I imagining things? If not, how would I properly make them able to run through a browser? Thanks! G
Re: [PHP] Script execution
Thanks everybody! I guess I was a little vague. I'm working on an OpenSUSE setup with Apache, MySQL and PHP. I just knew that my confusion was because of my Windows up-bringing. The writing I referred to was to a file. One example is I had a script that was pulling data from a database and using it to generate PDF files. This would work fine from the command line but _not_ if I pointed a browser at it. It wasn't an important difference because that script is a cronjob anyway. I just wanted to understand what was going on and how I could change it -- if I find later that I need to. Again, that's for the rapid and thorough help! G On Mon, Mar 9, 2009 at 5:17 PM, haliphax halip...@gmail.com wrote: On Mon, Mar 9, 2009 at 4:04 PM, Daniel Brown danbr...@php.net wrote: On Mon, Mar 9, 2009 at 16:59, George Larson george.g.lar...@gmail.com wrote: Am I imagining things? If not, how would I properly make them able to run through a browser? You're not imagining things. In general, unless set up with SuExec privileges, Apache (which is probably the HTTP server you're using) will run as 'nobody,' 'apache,' 'www,' or 'daemon.' If you can't configure it to SuExec (check Google for some ideas on this you'll need root access), you could use the less-secure (this, not recommended) options of changing the file mode permissions to 0777 or change the file ownership (if you have the right permissions yourself) to be owned by the same user and/or group as which Apache runs. It may sound a little confusing at first glance, but it's really not. Just keep in mind that UNIX and Linux (Mac and similar OS'es fall in here, too) are simultaneous multi-user systems, meaning that many users (including virtual users that the system uses as aliases for individualized permissions) can be logged in and run processes concurrently. OP is a Windows user. I am assuming that they are using Windows. George, if you are using IIS as your web server, PHP will be executed (by default, anyway) under the IUSR_your computer name user account (pre-Vista). The directories and files your PHP script will need to mess with should be given the appropriate permissions as related to that user. HTH, -- // Todd
Re: [PHP] Script execution
That's funny! I've been watching this and a few other lists (MySQL, local Linux Users' Group) for a few days - weeks and I had wondered why the PHP list seemed more hostile. :) On Mon, Mar 9, 2009 at 5:28 PM, Daniel Brown paras...@gmail.com wrote: On Mon, Mar 9, 2009 at 17:21, Daniel Brown paras...@gmail.com wrote: Re-read the context of that first paragraph from the OP and you'll see why I presume (as opposed to *ass*ume) that, despite his experience with Windows, this is a *NIX-like setup. DISCLAIMER: This was supposed to be added to my seemingly-gruff response: ;-P Todd's alright by me. George, a cron - if run as the same user that owns the files - should work with no problem. -- /Daniel P. Brown daniel.br...@parasane.net || danbr...@php.net http://www.parasane.net/ || http://www.pilotpig.net/ 50% Off All Shared Hosting Plans at PilotPig: Use Coupon DOW1
Re: [PHP] Opendir on site root directory?
but it had become lost in the detritus at the back of my mind Inappropriate as this is for _the_ PHP list -- that was a beautiful phrase, friend. On Mon, Mar 9, 2009 at 8:05 PM, Clancy clanc...@cybec.com.au wrote: On Mon, 9 Mar 2009 10:07:33 +, stut...@gmail.com (Stuart) wrote: ... As in the example script I've posted above you can refer to the current working directory with a single period (.), but this is still relying on the current working directory being what you expect it to be. Thank you! This is what I had been looking for all along. I dimly remembered some such trick, but it had become lost in the detritus at the back of my mind. But why the obsession with avoiding getcwd()? When my site is loaded the current directory is always the root directory of the page, and as I never change directory I can rely on it staying there. (And, incidentally, since getcwd(), dirname(__FILE__), etc, all return the complete path including system dependent information, if I really didn't know the current directory it would not be a trivial task to determine what was the local root.) For a couple of years I have been using getcwd() to determine whether or not I am running on my local PC (if I am the path will start with 'D:'). If I am running on the local PC I load various editing and other private facilities, otherwise I omit them. This is done in such a way that there is nothing to indicate that anything is either missing or has been omitted. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Backend autodatabase update
There are a lot of ways to tackle that problem but everything coming to mind involves third-party software. You can use Sysinternals PsListhttp://technet.microsoft.com/en-us/sysinternals/bb896682.aspx( http://technet.microsoft.com/en-us/sysinternals/bb896682.aspx) to look for your process. If the process is not found then start it. One approach would be to create a batch file that uses PsList piped to find (e.g. 'pslist.exe | find My Process) and start it if not. The scheduler might satisfy your needs but I have used VisualCron http://www.visualcron.com/ ( http://www.visualcron.com/) for complex scheduling. If you wrote the process that is running then you could make it check for existing instances of itself and shut down if it is already running. Then you could schedule it to start every 30 minutes because it will just close if the first one is still running. On Sun, Mar 8, 2009 at 4:42 AM, Andrew Williams andrew4willi...@gmail.comwrote: *I want to check that the job is still running and start, if it stopped because the program is meant to consistently update for the global market? * On Sat, Mar 7, 2009 at 11:19 PM, George Larson george.g.lar...@gmail.comwrote: I'm new to the list, so maybe I've missed something. Please disregard if I'm blathering idiotically. What OS are you using? Do you mean that you want to run the job repetitively (again and again) or *do you mean that you want to check that the job is still running and start, if it stopped?* On Sat, Mar 7, 2009 at 6:02 PM, 9el le...@phpxperts.net wrote: cronjob or deamon to execute the php file On Sun, Mar 8, 2009 at 4:56 AM, Andrew Williams andrew4willi...@gmail.comwrote: Dear All, I have written a back end php program that update live stream database and this data is streamed 24 hours a day. Please, what is the best way to make sure this program execute or runs 24 hours day. Best Wishes Andrew Williams www.willandy.co.uk -- Best Wishes Andrew Williams
Re: [PHP] PHP includes
Right. There are several advantages to using included files. You can write routines that you're going to use repeatedly and just include the file with the code, instead of re-inventing the wheel, as they say. Consistency is another advantage. So, if you design your header, sidebar and footer and just include them then you don't need to edit every stinking page on your site when you want to make a change. There's a handful of include-type statements. Include, include_one, require, require_once, etc. I'd read about those four before making a choice about which to use. On Sun, Mar 8, 2009 at 12:06 PM, Gary gwp...@ptd.net wrote: I'm working on learning php and have been toying with includes, and I am trying to figure the advantages/disadvantages to using them. I know that using them eliminates the need to put the files once altered as with a template, however, is that the only advantage. My particular concerns are with SEO and if the search engines and the bots can read the page if it is made completely on includes? Any and all comments would be appreciated. Gary -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] web refreshing problem
Maybe you could use a javascript refresh? But that would still mean resubmitting the form. On Sun, Mar 8, 2009 at 11:35 AM, Andrew Williams and...@stocksignals.comwrote: Hi, my php program does not display current result of submitted form instead the previous content is shown until you refresh manually (which means resubmitting the form). Can someone help me out because, I want to display the result of the latest form result and not the old one. I am using apache server on windows. Please help. -- www.willandy.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] verify data in fields
Ash certainly does raise an interesting point. :) Couldn't you just use DESCRIBE or EXPLAIN the tables through MySQL? On Sun, Mar 8, 2009 at 4:35 PM, Ashley Sheridan a...@ashleysheridan.co.ukwrote: On Sun, 2009-03-08 at 10:25 -0500, PJ wrote: My mysql table contains data. But I don't know how to verify what exactly is the data... is it an array, an integer, an alphanumeric character or what? vardump($whatever) returns null; the structure of the table is no null for the column fields and has been filled like this: $autoid = 1; $test = $_POST['categoriesIN']; // this can be several selections from form $tstring = implode(',' , $test); echo $tstring.'br /'; $insert_category = INSERT INTO book_categories (book_id, categories_id) VALUES ($autoid, $tstring.); mysql_query($insert_category,$db); retrieval of data is: from SELECT ...snip... LEFT JOIN book_publisher as abc ON b.id = abc.bookID LEFT JOIN publishers AS c ON abc.publishers_id = c.id LEFT JOIN book_categories AS d ON b.id = d.book_id LEFT JOIN categories AS e ON d.categories_id = e.id I have included the publisher stuff - it works, whereas the category stuff does not... -- unheralded genius: A clean desk is the sign of a dull mind. - Phil Jourdan --- p...@ptahhotep.com http://www.ptahhotep.com http://www.chiccantine.com/andypantry.php Surely if it is your table, you already know what types of data each field contains? Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Backend autodatabase update
I'm new to the list, so maybe I've missed something. Please disregard if I'm blathering idiotically. What OS are you using? Do you mean that you want to run the job repetitively (again and again) or do you mean that you want to check that the job is still running and start, if it stopped? On Sat, Mar 7, 2009 at 6:02 PM, 9el le...@phpxperts.net wrote: cronjob or deamon to execute the php file On Sun, Mar 8, 2009 at 4:56 AM, Andrew Williams andrew4willi...@gmail.comwrote: Dear All, I have written a back end php program that update live stream database and this data is streamed 24 hours a day. Please, what is the best way to make sure this program execute or runs 24 hours day. Best Wishes Andrew Williams www.willandy.co.uk