php-general Digest 4 Feb 2010 12:21:57 -0000 Issue 6573
php-general Digest 4 Feb 2010 12:21:57 - Issue 6573 Topics (messages 301794 through 301813): Re: Thinking of moving to .NET because of standalone... any suggestions? 301794 by: Robert Cummings 301795 by: Ashley Sheridan 301797 by: Robert Cummings 301798 by: David Murphy 301800 by: Bastien Koert 301803 by: Ryan S Can't get my PHP-generated RSS to serve properly 301796 by: Brian Dunning 301799 by: Robert Cummings 301801 by: Brian Dunning 301802 by: Michael A. Peters PHP Manual problems 301804 by: clancy_1.cybec.com.au 301805 by: Ashley Sheridan 301809 by: Jochem Maas stream_select() not working on regular files? 301806 by: Dennis J. 301807 by: Ashley Sheridan 301808 by: Dennis J. 301812 by: Eric Lee 301813 by: Dennis J. PHP User 301810 by: abby ragz 301811 by: Paul M Foster Administrivia: To subscribe to the digest, e-mail: php-general-digest-subscr...@lists.php.net To unsubscribe from the digest, e-mail: php-general-digest-unsubscr...@lists.php.net To post to the list, e-mail: php-gene...@lists.php.net -- ---BeginMessage--- Ryan S wrote: Thanks for the reply Michael, Robert and Jochem, makes sense, a native windows app is going to look more in place than any of the demos and graphics i have seen of GTK. Was also looking at GTK-Builder, unfortunately you really have to hunt for each scrap of new info - which is why I'm guessing open source falls back a bit compared to M$'s offerings. MS shoehorning something into dotnet sounds interesting, will ask my pal google what he can bring up ;) I did read about FLEX but i have pretty much complete php scripts that i want to use in a desktop environment, FLEX wouldnt do for my (present) needs. Will look up WxWidgets and HipHop (somehow i get the feeling i'm gonna be drowned in millions of results that have rap lyrics instead of programming information - should be a test of my patience :-))) Anyone have anything more to add/advise, please do so. Don't look at WxWidgets, I was wrong about that... it's WinBinder you want to look at. You shouldbe pretty good looking up HipHop if you include PHP in the keywords list :) In fact php hiphop hits the right stride in the top entries (I just did a check :) Heck, hiphop alone gets you some of the info on the PHP version in the first page of results. Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP ---End Message--- ---BeginMessage--- On Wed, 2010-02-03 at 14:02 -0500, Robert Cummings wrote: Ryan S wrote: Thanks for the reply Michael, Robert and Jochem, makes sense, a native windows app is going to look more in place than any of the demos and graphics i have seen of GTK. Was also looking at GTK-Builder, unfortunately you really have to hunt for each scrap of new info - which is why I'm guessing open source falls back a bit compared to M$'s offerings. MS shoehorning something into dotnet sounds interesting, will ask my pal google what he can bring up ;) I did read about FLEX but i have pretty much complete php scripts that i want to use in a desktop environment, FLEX wouldnt do for my (present) needs. Will look up WxWidgets and HipHop (somehow i get the feeling i'm gonna be drowned in millions of results that have rap lyrics instead of programming information - should be a test of my patience :-))) Anyone have anything more to add/advise, please do so. Don't look at WxWidgets, I was wrong about that... it's WinBinder you want to look at. You shouldbe pretty good looking up HipHop if you include PHP in the keywords list :) In fact php hiphop hits the right stride in the top entries (I just did a check :) Heck, hiphop alone gets you some of the info on the PHP version in the first page of results. Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP Personally, I'd go with a more suitable language for desktop application development. PHP, to me, is great for two things: websites and command line scripts. If I wanted to develop for the desktop market, I'd go with either C++ and compile for each environment as needed, or go with .Net or Java to make it more portable. It might make more sense to convert some of your existing PHP code into a different language. Thanks, Ash http://www.ashleysheridan.co.uk ---End Message--- ---BeginMessage--- Ashley Sheridan wrote: On Wed, 2010-02-03 at 14:02 -0500, Robert Cummings wrote: Ryan S wrote: Thanks for the reply Michael, Robert and Jochem, makes sense, a native windows app is going to look more in place than any of the demos and graphics i have seen of GTK. Was also looking at GTK-Builder, unfortunately you really have to hunt for each
Re: [PHP] stream_select() not working on regular files?
On 02/04/2010 06:18 AM, Eric Lee wrote: On Thu, Feb 4, 2010 at 9:20 AM, Dennis J.denni...@conversis.de wrote: On 02/04/2010 02:03 AM, Ashley Sheridan wrote: On Thu, 2010-02-04 at 01:41 +0100, Dennis J. wrote: Hi, I'm trying to implement something similar totail -f in php but I'm running into a problem. The issue occurs when I've reached the end of the file. From here I basically have to loop until new lines get appended to the file but I would like to respond immediately when then happens. There are three options that I can see: 1. Busy-loop pro: I can process new lines immediately contra: Excessivley CPU intensive = not a real option 2. add a sleep(1) to the loop pro: No longer kills the CPU contra: I might get a 1 second delay until I can process new lines 3. stream_select(array($fh),null,null,1) pro: sleeps for one second but returns earlier if new data arrives contra: doesn't seem to work in files? Method 3 is the preferable one but doesn't seem to work: $fh = fopen(testfile,r); $r = array($fh); while( ($n = stream_select($r,$w=null,$e=null,1)) == 1 ) { echo fgets($fh); } This program will loop forever because stream_select() will always return 1 even at the end of the file. Is there any other way to accomplish this? Regards, Dennis I thought that once it reached the end of the file, it will return a 0 indicating no new activity? That's what I thought too but apparently that is not the case. Although, surely you want the loop to continue forever, so that new entries added to the end of the file are shown as soon as they appear. Yes the loop is supposed to continue forever in the final version. In fact I what I'm trying to get at is a tail -F which means I will repeatedly reopen the file to check if it has been replaced by a new one. I just simplified the problem above to get rid of all the additional complexity and concentrate on the specific problem I have. My expectation was that once the end of the file is reached (i.e. fgets() has consumed all lines) stream_select() should wait for 1 second (in the above example) and if nothing happens with the file in that second it should return 0. But that doesn't happen. Dennis I have just been bulit a simple test script. It works for me with a feof call if the stream was at end of file. But I'am not sure that is that what you want ! ?php $fp = fopen('test.xml', 'r'); $arr = array($fp); $w = $e = null; while (($result = stream_select($arr, $w, $e, 1)) !== false) { $line = fgets($fp); if (!empty($line)) { echo $line; } else { if (feof($fp)) echo 'eof',\n; fclose($fp); $fp = null; break; } } This script terminates before it hits the actual problem. The issue is that once I've hit the EOF I need to continue the loop using the stream_select() waiting for new data. Regards, Dennis -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] CLI behind proxy
Hi all, I want to run fsockopen etc behind a proxy. proxychains (http://proxychains.sourceforge.net/) may be helpful, unfortunately the support for that is pretty bad. Please inform me of other alternatives KK.
Re: [PHP] CLI behind proxy
On 4 February 2010 12:48, kranthi kranthi...@gmail.com wrote: Hi all, I want to run fsockopen etc behind a proxy. proxychains (http://proxychains.sourceforge.net/) may be helpful, unfortunately the support for that is pretty bad. Please inform me of other alternatives KK. I used to use a proxy written in Python which provided the client NTLM authentication to our ISA server for PHP. So, PHP script talked to NTLM Authentication Proxy Server which talked to ISA which talked to the outside world. Worked fine. The only thing I needed to do in PHP was setup a default context and all my normal file_get_contents(),etc. which needed to communicate through to the outside world worked fine. Here is the code I used ... // Define the default, system-wide context. $r_default_context = stream_context_get_default ( array ( 'http' = array ( // All HTTP requests are passed through the local NTLM proxy server on port 8080. 'proxy' = 'tcp://127.0.0.1:8080', 'request_fulluri' = True, ), ) ); // Though we said system wide, some extensions need a little coaxing. libxml_set_streams_context($r_default_context); So, set the proxy tcp address appropriately, put this code in a global include file (maybe via the auto_prepend_file= ini file setting) and see how you go. -- - Richard Quadling Standing on the shoulders of some very clever giants! EE : http://www.experts-exchange.com/M_248814.html EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731 ZOPA : http://uk.zopa.com/member/RQuadling -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] CLI behind proxy
I did'nt understand completely. But I noticed that if i do $opts = array('http' = array('proxy' = 'tcp://10.3.100.212:8080', 'request_fulluri' = true)); $context = stream_context_set_default($opts); fopen, file_get_contents, etc. are working fine, but fsockopen is not KK.
Re: [PHP] CLI behind proxy
On 4 February 2010 14:19, kranthi kranthi...@gmail.com wrote: fsockopen What type of socket are you opening? -- - Richard Quadling Standing on the shoulders of some very clever giants! EE : http://www.experts-exchange.com/M_248814.html EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731 ZOPA : http://uk.zopa.com/member/RQuadling -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] CLI behind proxy
On 4 February 2010 14:38, Richard Quadling rquadl...@googlemail.com wrote: On 4 February 2010 14:19, kranthi kranthi...@gmail.com wrote: fsockopen What type of socket are you opening? -- - Richard Quadling Standing on the shoulders of some very clever giants! EE : http://www.experts-exchange.com/M_248814.html EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731 ZOPA : http://uk.zopa.com/member/RQuadling The code puts HTTP requests through the context. -- - Richard Quadling Standing on the shoulders of some very clever giants! EE : http://www.experts-exchange.com/M_248814.html EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731 ZOPA : http://uk.zopa.com/member/RQuadling -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] stream_select() not working on regular files?
Dennis J. wrote: The issue is that once I've hit the EOF I need to continue the loop using the stream_select() waiting for new data. AFAIK you can't; you see stream_select checks to see if something will be blocked; if EOF is reached it considers this as not blocked; in other words the second you hit a file EOF stream_select will continue to instantly return a positive (without the wait of 1 second). As far as I know every related function will always return the second EOF is hit; meaning that the -f functionality you want can only be gained by adding in the sleep (but i think every line reading function will still instantly return with an empty line) - so maybe you just need to proc_open to tail -f and read the stream with PHP - as it won't send an EOF - example: ?php $stream = popen( 'tail -f access.log' , 'r' ); while( $line = fgets($stream) ) { echo $line; } pclose( $stream ); // won't get here unless an error i guess.. good luck! Nathan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] CLI behind proxy
stream_socket_client(tcp://talk.google.com:5222) i m trying to use http://code.google.com/p/xmpphp/ actually -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] CLI behind proxy
On 4 February 2010 15:27, kranthi kranthi...@gmail.com wrote: stream_socket_client(tcp://talk.google.com:5222) i m trying to use http://code.google.com/p/xmpphp/ actually Does your proxy pass through all requests? It might be easier to just set you NIC gateway to the proxy. We stopped using ISA server with NTLM authentication. Now, the gateway for my machine is the ISA server, so all requests go through there automatically and we use AD for authentication. -- - Richard Quadling Standing on the shoulders of some very clever giants! EE : http://www.experts-exchange.com/M_248814.html EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731 ZOPA : http://uk.zopa.com/member/RQuadling -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] HTML plain text in Outlook 2007
Hey all, First, let me say thanks for all the advice on Magento, and especially to Ryan who has used the beast and gave some great advice on skinning, links to some good docs and a book just for my designer. We'll be using and I'm looking forward to learning it. But anyway... I'm doing some maintenance work on a system that sends an email message using the multi-part boundaries to include both a plain text version and an HTML version of an email. I've read up on this before, but never actually done it. So implementing the code was not a big issue, and in fact it works perfectly when tested on my Ubuntu machine using Thunderbird to test the HTML and Evolution to test the plain text version. In fact, I can switch formats on both of these and all looks great. Enter Microsoft (Insert opening of Bach's Toccata and Fugue in D minor to send chills up my readers' spines.) On Outlook 2007 in HTML mode it renders, how can I put this... half-assedly. In text mode the whole things a bust. There is the HTML code all stuffed up at the top, boundary codes are visible, just plain awful. Googling around I see articles from 2007 when that version of Outlook came out lamenting the fact that MS pulled the IE rendering engine from it and replaced it with MS Word's renderer to plug security holes expoitable via email. Does anyone have any experience with HTML plain text multi-part messages and Outlook 2007, or any tips how I can get this working? Still Googling, but any tips would be greatly appreciated. Skip -- Skip Evans PenguinSites.com, LLC 503 S Baldwin St, #1 Madison WI 53703 608.250.2720 http://penguinsites.com Those of you who believe in telekinesis, raise my hand. -- Kurt Vonnegut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HTML plain text in Outlook 2007
On Thu, 2010-02-04 at 10:44 -0600, Skip Evans wrote: Hey all, First, let me say thanks for all the advice on Magento, and especially to Ryan who has used the beast and gave some great advice on skinning, links to some good docs and a book just for my designer. We'll be using and I'm looking forward to learning it. But anyway... I'm doing some maintenance work on a system that sends an email message using the multi-part boundaries to include both a plain text version and an HTML version of an email. I've read up on this before, but never actually done it. So implementing the code was not a big issue, and in fact it works perfectly when tested on my Ubuntu machine using Thunderbird to test the HTML and Evolution to test the plain text version. In fact, I can switch formats on both of these and all looks great. Enter Microsoft (Insert opening of Bach's Toccata and Fugue in D minor to send chills up my readers' spines.) On Outlook 2007 in HTML mode it renders, how can I put this... half-assedly. In text mode the whole things a bust. There is the HTML code all stuffed up at the top, boundary codes are visible, just plain awful. Googling around I see articles from 2007 when that version of Outlook came out lamenting the fact that MS pulled the IE rendering engine from it and replaced it with MS Word's renderer to plug security holes expoitable via email. Does anyone have any experience with HTML plain text multi-part messages and Outlook 2007, or any tips how I can get this working? Still Googling, but any tips would be greatly appreciated. Skip -- Skip Evans PenguinSites.com, LLC 503 S Baldwin St, #1 Madison WI 53703 608.250.2720 http://penguinsites.com Those of you who believe in telekinesis, raise my hand. -- Kurt Vonnegut What about signing yourself up to some newsletters to see how they do it? Looking at the ones I get from Facebook as an example, they use the boundary codes you mentioned, and I can't see anything particularly special that's been added. What order are you sending the two message parts by the way? I think the traditional way is to send the plain/text part first, so that UA's that don't understand or support multipart messages only use the first one. As you mentioned that you're seeing HTML code at the top, I'd hazard a guess that you're sending the HTML first? Thanks, Ash http://www.ashleysheridan.co.uk
Re: [PHP] HTML plain text in Outlook 2007
Ashley Sheridan wrote: On Thu, 2010-02-04 at 10:44 -0600, Skip Evans wrote: Hey all, First, let me say thanks for all the advice on Magento, and especially to Ryan who has used the beast and gave some great advice on skinning, links to some good docs and a book just for my designer. We'll be using and I'm looking forward to learning it. But anyway... I'm doing some maintenance work on a system that sends an email message using the multi-part boundaries to include both a plain text version and an HTML version of an email. I've read up on this before, but never actually done it. So implementing the code was not a big issue, and in fact it works perfectly when tested on my Ubuntu machine using Thunderbird to test the HTML and Evolution to test the plain text version. In fact, I can switch formats on both of these and all looks great. Enter Microsoft (Insert opening of Bach's Toccata and Fugue in D minor to send chills up my readers' spines.) On Outlook 2007 in HTML mode it renders, how can I put this... half-assedly. In text mode the whole things a bust. There is the HTML code all stuffed up at the top, boundary codes are visible, just plain awful. Googling around I see articles from 2007 when that version of Outlook came out lamenting the fact that MS pulled the IE rendering engine from it and replaced it with MS Word's renderer to plug security holes expoitable via email. Does anyone have any experience with HTML plain text multi-part messages and Outlook 2007, or any tips how I can get this working? Still Googling, but any tips would be greatly appreciated. Skip -- Skip Evans PenguinSites.com, LLC 503 S Baldwin St, #1 Madison WI 53703 608.250.2720 http://penguinsites.com Those of you who believe in telekinesis, raise my hand. -- Kurt Vonnegut What about signing yourself up to some newsletters to see how they do it? Looking at the ones I get from Facebook as an example, they use the boundary codes you mentioned, and I can't see anything particularly special that's been added. What order are you sending the two message parts by the way? I think the traditional way is to send the plain/text part first, so that UA's that don't understand or support multipart messages only use the first one. As you mentioned that you're seeing HTML code at the top, I'd hazard a guess that you're sending the HTML first? The problem is most likely NOT his email structure, but the fact that Microsoft in all their lock-in, make things difficult, non standard, monopolistic philosophy chose to switch out the IE HTML renderer (which was getting pretty decent with IE7 and IE8) with the Office HTML renderer... so now basic things like CSS padding of something as simple as a p tag is not possible. You now need to use margins instead. The full list of supported attributes / CSS can be found here: http://msdn.microsoft.com/en-us/library/aa338201.aspx Obviously creating HTML emails was getting too easy (like it is with Thunderbird). Of course... I guess it could be as bad as Google stripping out the stylesheets entirely when viewing HTML content which forces you to put the styles on the tags themselves. ... actually I'm not sure what's worse... at least you can use standard styles with Google's gmail. Either way... making nice looking HTML emails that work across Outlook, Thunderbird, Gmail, Yahoo, and Hotmail is a pain in the ass. Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HTML plain text in Outlook 2007
On Thu, 2010-02-04 at 13:44 -0500, Robert Cummings wrote: Ashley Sheridan wrote: On Thu, 2010-02-04 at 10:44 -0600, Skip Evans wrote: Hey all, First, let me say thanks for all the advice on Magento, and especially to Ryan who has used the beast and gave some great advice on skinning, links to some good docs and a book just for my designer. We'll be using and I'm looking forward to learning it. But anyway... I'm doing some maintenance work on a system that sends an email message using the multi-part boundaries to include both a plain text version and an HTML version of an email. I've read up on this before, but never actually done it. So implementing the code was not a big issue, and in fact it works perfectly when tested on my Ubuntu machine using Thunderbird to test the HTML and Evolution to test the plain text version. In fact, I can switch formats on both of these and all looks great. Enter Microsoft (Insert opening of Bach's Toccata and Fugue in D minor to send chills up my readers' spines.) On Outlook 2007 in HTML mode it renders, how can I put this... half-assedly. In text mode the whole things a bust. There is the HTML code all stuffed up at the top, boundary codes are visible, just plain awful. Googling around I see articles from 2007 when that version of Outlook came out lamenting the fact that MS pulled the IE rendering engine from it and replaced it with MS Word's renderer to plug security holes expoitable via email. Does anyone have any experience with HTML plain text multi-part messages and Outlook 2007, or any tips how I can get this working? Still Googling, but any tips would be greatly appreciated. Skip -- Skip Evans PenguinSites.com, LLC 503 S Baldwin St, #1 Madison WI 53703 608.250.2720 http://penguinsites.com Those of you who believe in telekinesis, raise my hand. -- Kurt Vonnegut What about signing yourself up to some newsletters to see how they do it? Looking at the ones I get from Facebook as an example, they use the boundary codes you mentioned, and I can't see anything particularly special that's been added. What order are you sending the two message parts by the way? I think the traditional way is to send the plain/text part first, so that UA's that don't understand or support multipart messages only use the first one. As you mentioned that you're seeing HTML code at the top, I'd hazard a guess that you're sending the HTML first? The problem is most likely NOT his email structure, but the fact that Microsoft in all their lock-in, make things difficult, non standard, monopolistic philosophy chose to switch out the IE HTML renderer (which was getting pretty decent with IE7 and IE8) with the Office HTML renderer... so now basic things like CSS padding of something as simple as a p tag is not possible. You now need to use margins instead. The full list of supported attributes / CSS can be found here: http://msdn.microsoft.com/en-us/library/aa338201.aspx Obviously creating HTML emails was getting too easy (like it is with Thunderbird). Of course... I guess it could be as bad as Google stripping out the stylesheets entirely when viewing HTML content which forces you to put the styles on the tags themselves. ... actually I'm not sure what's worse... at least you can use standard styles with Google's gmail. Either way... making nice looking HTML emails that work across Outlook, Thunderbird, Gmail, Yahoo, and Hotmail is a pain in the ass. Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP If he's getting HTML output at the top of the email, I would think that did suggest that MS Word didn't like the structure. Making HTML emails is now such a difficult job, as the email clients rendering engines tend to not get updated as often as browsers, and there doesn't seem to be any effort in bringing the rendering of the email clients together. Whenever I create these emails I try to make sure I try no to get too creative in the design, and use not only CSS styles, but properties of the HTML tags themselves. It means I end up writing the CSS essentially twice and backing it up with old deprecated HTML attributes, but it usually does the trick. Is there any effort by some standards group that email clients could benefit from? Thanks, Ash http://www.ashleysheridan.co.uk