Re: [PHP] database abstraction layer

2010-02-03 Thread Lester Caine

Ashley Sheridan wrote:

On Tue, 2010-02-02 at 23:19 +0100, Rene Veerman wrote:


function getMax($table, $field)


If I saw this sort of code I'd be appalled! It's possibly the worst way
to get the auto increment value. You won't notice it testing the site
out on your own, but all hell will break loose when you start getting a
lot of hits, and two people cause an auto increment at the same time!


ADOdb handles SEQUENCE correctly across all databases. Since MySQL does not 
understand SEQUENCE or GENERATOR, ADOdb simulates it with a dummy table which 
autoincrements and gets around the problem. Then one can use a secure generic 
GetID ;)


--
Lester Caine - G8HFL
-
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk//
Firebird - http://www.firebirdsql.org/index.php

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] session variables and SVG documents

2010-02-03 Thread Aurelie REYMUND
Hello,

unfortunately, it does not suite my needs. The image must be clickable. The
application I'm developping reads data from a database and display the
information graphically. The user must be able to click on some elements of
the picture, and I have to store the information the user clicked on
(session vars). I cannot tell the user not to use IE, so I have to find
another solution...

Regards,
Aurelie

2010/2/1 Ray Solomon r...@bigdoghost.com

 From: Aurelie REYMUND aurely...@gmail.com
 Sent: Monday, February 01, 2010 3:37 AM
 To: php-general@lists.php.net
 Subject: [PHP] session variables and SVG documents


  Hello,

 I have the following problem with the Adobe SVG viewer:
 I try to generate a SVG document using PHP. the following code is working
 well under Firefox, as well as IE with ASV:

 ?php

 header(Content-type: image/svg+xml);

 $graph_title = 'title';


 print('?xml version=1.0 encoding=iso-8859-1 standalone=no?');
 $svgwidth=500;
 $svgheight=400;
 ?

 !DOCTYPE svg PUBLIC -//W3C//DTD SVG 1.0//EN 
 http://www.w3.org/TR/SVG/DTD/svg10.dtd;
 svg width=?php echo $svgwidth; ?px height=?php echo $svgheight;
 ?px
 xmlns=http://www.w3.org/2000/svg;
   descThis is a php-random rectangle test/desc
 ?php
 srand((double) microtime() * 100); //initalizing random generator
 for ($i = 0; $i  20; $i+=1) {
   $x = floor(rand(0,$svgwidth-1)); //avoid getting a range 0..0 for rand
 function
   $y = floor(rand(0,$svgheight-1));
   $width = floor(rand(0,$svgwidth-$x)); //avoid getting rect outside of
 viewbox
   $height = floor(rand(0,$svgheight-$y));
   $red = floor(rand(0,255));
   $blue = floor(rand(0,255));
   $green = floor(rand(0,255));
   $color = rgb(.$red.,.$green.,.$
 blue.);
   print \trect x=\$x\ y=\$y\ width=\$width\ height=\$height\
 style=\fill:$color;\/\n;
 }
 ?
   text x=?php echo $svgwidth/2;?px y=300 style=font-size:15;
 text-anchor=middleThe servers Date and Time is: ?php print
 (strftime(%Y-%m-%d, %H:%M:%S)); ?/text
   text x=?php echo $svgwidth/2;?px y=340 style=font-size:15;
 text-anchor=middleYou are running:/text
   text x=?php echo $svgwidth/2;?px y=360 style=font-size:15;
 text-anchor=middle?php print $HTTP_USER_AGENT; ?/text
 /svg

 If now I want to include the session_start() at the beginning of the code,
 in IE I got a pop-up dialog called download file

 What am I doing wrong ?

 Regards,
 Aurelie



 It appears IE does not support svg yet and you need a plugin for it.

 However, you could also design your code differently by using Imagemagick
 to convert the svg to png.
 If that suits your needs, then use the modified code below:


 ?php

 header(Content-type: image/png);

 $graph_title = 'title';

 $svgwidth=500;
 $svgheight=400;

 $svg = '?xml version=1.0 encoding=iso-8859-1 standalone=no?
 svg width='.$svgwidth.'px height='.$svgheight.'px xmlns=
 http://www.w3.org/2000/svg;
   descThis is a php-random rectangle test/desc';


 for ($i = 0; $i  20; $i++) {

$x = floor(rand(0,$svgwidth-1));
$y = floor(rand(0,$svgheight-1));
$width = floor(rand(0,$svgwidth-$x));
$height = floor(rand(0,$svgheight-$y));
$red = floor(rand(0,255));
$blue = floor(rand(0,255));
$green = floor(rand(0,255));
$color = rgb(.$red.,.$green.,.$blue.);
$svg .= \trect x=\$x\ y=\$y\ width=\$width\
 height=\$height\ style=\fill:$color;\/\n;
 }

   $svg .= 'text x='.($svgwidth/2).'px y=300 style=font-size:15;
 text-anchor=middleThe servers Date and Time is: '.date(Y-m-d,
 H:m:s).'/text
   text x='.($svgwidth/2).'px y=340 style=font-size:15;
 text-anchor=middleYou are running:/text
   text x='.($svgwidth/2).'px y=360 style=font-size:15;
 text-anchor=middle'.$HTTP_USER_AGENT.'/text
 /svg';


 file_put_contents('/tmp/image.svg', $svg);

 exec(/usr/bin/rsvg /tmp/image.svg /tmp/image.png);

 echo file_get_contents('/tmp/image.png');
 ?

 -Ray Solomon



 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] DOM TextArea (and dom chart please)

2010-02-03 Thread Michael A. Peters

Michael A. Peters wrote:



$website_data = new tidy('dom_test.html',$tidy_config);


Doh!

Should be

$website_data = new tidy('dom_test.html',$tidy_config,'utf8');

Otherwise it has the same problem with multibyte characters that 
loadHTML() has. But with the 'utf8' specified it works beautifully.


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] session variables and SVG documents

2010-02-03 Thread Ashley Sheridan
On Wed, 2010-02-03 at 10:49 +0100, Aurelie REYMUND wrote:

 Hello,
 
 unfortunately, it does not suite my needs. The image must be clickable. The
 application I'm developping reads data from a database and display the
 information graphically. The user must be able to click on some elements of
 the picture, and I have to store the information the user clicked on
 (session vars). I cannot tell the user not to use IE, so I have to find
 another solution...
 
 Regards,
 Aurelie
 
 2010/2/1 Ray Solomon r...@bigdoghost.com
 
  From: Aurelie REYMUND aurely...@gmail.com
  Sent: Monday, February 01, 2010 3:37 AM
  To: php-general@lists.php.net
  Subject: [PHP] session variables and SVG documents
 
 
   Hello,
 
  I have the following problem with the Adobe SVG viewer:
  I try to generate a SVG document using PHP. the following code is working
  well under Firefox, as well as IE with ASV:
 
  ?php
 
  header(Content-type: image/svg+xml);
 
  $graph_title = 'title';
 
 
  print('?xml version=1.0 encoding=iso-8859-1 standalone=no?');
  $svgwidth=500;
  $svgheight=400;
  ?
 
  !DOCTYPE svg PUBLIC -//W3C//DTD SVG 1.0//EN 
  http://www.w3.org/TR/SVG/DTD/svg10.dtd;
  svg width=?php echo $svgwidth; ?px height=?php echo $svgheight;
  ?px
  xmlns=http://www.w3.org/2000/svg;
descThis is a php-random rectangle test/desc
  ?php
  srand((double) microtime() * 100); //initalizing random generator
  for ($i = 0; $i  20; $i+=1) {
$x = floor(rand(0,$svgwidth-1)); //avoid getting a range 0..0 for rand
  function
$y = floor(rand(0,$svgheight-1));
$width = floor(rand(0,$svgwidth-$x)); //avoid getting rect outside of
  viewbox
$height = floor(rand(0,$svgheight-$y));
$red = floor(rand(0,255));
$blue = floor(rand(0,255));
$green = floor(rand(0,255));
$color = rgb(.$red.,.$green.,.$
  blue.);
print \trect x=\$x\ y=\$y\ width=\$width\ height=\$height\
  style=\fill:$color;\/\n;
  }
  ?
text x=?php echo $svgwidth/2;?px y=300 style=font-size:15;
  text-anchor=middleThe servers Date and Time is: ?php print
  (strftime(%Y-%m-%d, %H:%M:%S)); ?/text
text x=?php echo $svgwidth/2;?px y=340 style=font-size:15;
  text-anchor=middleYou are running:/text
text x=?php echo $svgwidth/2;?px y=360 style=font-size:15;
  text-anchor=middle?php print $HTTP_USER_AGENT; ?/text
  /svg
 
  If now I want to include the session_start() at the beginning of the code,
  in IE I got a pop-up dialog called download file
 
  What am I doing wrong ?
 
  Regards,
  Aurelie
 
 
 
  It appears IE does not support svg yet and you need a plugin for it.
 
  However, you could also design your code differently by using Imagemagick
  to convert the svg to png.
  If that suits your needs, then use the modified code below:
 
 
  ?php
 
  header(Content-type: image/png);
 
  $graph_title = 'title';
 
  $svgwidth=500;
  $svgheight=400;
 
  $svg = '?xml version=1.0 encoding=iso-8859-1 standalone=no?
  svg width='.$svgwidth.'px height='.$svgheight.'px xmlns=
  http://www.w3.org/2000/svg;
descThis is a php-random rectangle test/desc';
 
 
  for ($i = 0; $i  20; $i++) {
 
 $x = floor(rand(0,$svgwidth-1));
 $y = floor(rand(0,$svgheight-1));
 $width = floor(rand(0,$svgwidth-$x));
 $height = floor(rand(0,$svgheight-$y));
 $red = floor(rand(0,255));
 $blue = floor(rand(0,255));
 $green = floor(rand(0,255));
 $color = rgb(.$red.,.$green.,.$blue.);
 $svg .= \trect x=\$x\ y=\$y\ width=\$width\
  height=\$height\ style=\fill:$color;\/\n;
  }
 
$svg .= 'text x='.($svgwidth/2).'px y=300 style=font-size:15;
  text-anchor=middleThe servers Date and Time is: '.date(Y-m-d,
  H:m:s).'/text
text x='.($svgwidth/2).'px y=340 style=font-size:15;
  text-anchor=middleYou are running:/text
text x='.($svgwidth/2).'px y=360 style=font-size:15;
  text-anchor=middle'.$HTTP_USER_AGENT.'/text
  /svg';
 
 
  file_put_contents('/tmp/image.svg', $svg);
 
  exec(/usr/bin/rsvg /tmp/image.svg /tmp/image.png);
 
  echo file_get_contents('/tmp/image.png');
  ?
 
  -Ray Solomon
 
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 


IE doesn't display SVG natively, and the plugins for it are pants.
However, IE does make use of its own propitiatory vector language called
VML, This is how the Cufon font replacer system works.

Thanks,
Ash
http://www.ashleysheridan.co.uk




Re: [PHP] session variables and SVG documents

2010-02-03 Thread tedd

At 10:49 AM +0100 2/3/10, Aurelie REYMUND wrote:

Hello,

unfortunately, it does not suite my needs. The image must be clickable. The
application I'm developping reads data from a database and display the
information graphically. The user must be able to click on some elements of
the picture, and I have to store the information the user clicked on
(session vars). I cannot tell the user not to use IE, so I have to find
another solution...

Regards,
Aurelie



Aurelie:

The image must be clickable?

I must not be understanding something. Anything can be made 
clickable, just put it in an anchor, such as:


a href=my-php-script-to-produce-the-image.phpClick This/a

The previous post mentioned using ImageMagick to convert the svg to 
png -- so write that script and place it in an anchor. I don't see 
the problem.


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] session variables and SVG documents

2010-02-03 Thread Adam Richardson
On Wed, Feb 3, 2010 at 8:20 AM, Ashley Sheridan 
a...@ashleysheridan.co.ukwrote:

 On Wed, 2010-02-03 at 10:49 +0100, Aurelie REYMUND wrote:

  Hello,
 
  unfortunately, it does not suite my needs. The image must be clickable.
 The
  application I'm developping reads data from a database and display the
  information graphically. The user must be able to click on some elements
 of
  the picture, and I have to store the information the user clicked on
  (session vars). I cannot tell the user not to use IE, so I have to find
  another solution...
 
  Regards,
  Aurelie
 
  2010/2/1 Ray Solomon r...@bigdoghost.com
 
   From: Aurelie REYMUND aurely...@gmail.com
   Sent: Monday, February 01, 2010 3:37 AM
   To: php-general@lists.php.net
   Subject: [PHP] session variables and SVG documents
  
  
Hello,
  
   I have the following problem with the Adobe SVG viewer:
   I try to generate a SVG document using PHP. the following code is
 working
   well under Firefox, as well as IE with ASV:
  
   ?php
  
   header(Content-type: image/svg+xml);
  
   $graph_title = 'title';
  
  
   print('?xml version=1.0 encoding=iso-8859-1 standalone=no?');
   $svgwidth=500;
   $svgheight=400;
   ?
  
   !DOCTYPE svg PUBLIC -//W3C//DTD SVG 1.0//EN 
   http://www.w3.org/TR/SVG/DTD/svg10.dtd;
   svg width=?php echo $svgwidth; ?px height=?php echo $svgheight;
   ?px
   xmlns=http://www.w3.org/2000/svg;
 descThis is a php-random rectangle test/desc
   ?php
   srand((double) microtime() * 100); //initalizing random generator
   for ($i = 0; $i  20; $i+=1) {
 $x = floor(rand(0,$svgwidth-1)); //avoid getting a range 0..0 for
 rand
   function
 $y = floor(rand(0,$svgheight-1));
 $width = floor(rand(0,$svgwidth-$x)); //avoid getting rect outside
 of
   viewbox
 $height = floor(rand(0,$svgheight-$y));
 $red = floor(rand(0,255));
 $blue = floor(rand(0,255));
 $green = floor(rand(0,255));
 $color = rgb(.$red.,.$green.,.$
   blue.);
 print \trect x=\$x\ y=\$y\ width=\$width\ height=\$height\
   style=\fill:$color;\/\n;
   }
   ?
 text x=?php echo $svgwidth/2;?px y=300 style=font-size:15;
   text-anchor=middleThe servers Date and Time is: ?php print
   (strftime(%Y-%m-%d, %H:%M:%S)); ?/text
 text x=?php echo $svgwidth/2;?px y=340 style=font-size:15;
   text-anchor=middleYou are running:/text
 text x=?php echo $svgwidth/2;?px y=360 style=font-size:15;
   text-anchor=middle?php print $HTTP_USER_AGENT; ?/text
   /svg
  
   If now I want to include the session_start() at the beginning of the
 code,
   in IE I got a pop-up dialog called download file
  
   What am I doing wrong ?
  
   Regards,
   Aurelie
  
  
  
   It appears IE does not support svg yet and you need a plugin for it.
  
   However, you could also design your code differently by using
 Imagemagick
   to convert the svg to png.
   If that suits your needs, then use the modified code below:
  
  
   ?php
  
   header(Content-type: image/png);
  
   $graph_title = 'title';
  
   $svgwidth=500;
   $svgheight=400;
  
   $svg = '?xml version=1.0 encoding=iso-8859-1 standalone=no?
   svg width='.$svgwidth.'px height='.$svgheight.'px xmlns=
   http://www.w3.org/2000/svg;
 descThis is a php-random rectangle test/desc';
  
  
   for ($i = 0; $i  20; $i++) {
  
  $x = floor(rand(0,$svgwidth-1));
  $y = floor(rand(0,$svgheight-1));
  $width = floor(rand(0,$svgwidth-$x));
  $height = floor(rand(0,$svgheight-$y));
  $red = floor(rand(0,255));
  $blue = floor(rand(0,255));
  $green = floor(rand(0,255));
  $color = rgb(.$red.,.$green.,.$blue.);
  $svg .= \trect x=\$x\ y=\$y\ width=\$width\
   height=\$height\ style=\fill:$color;\/\n;
   }
  
 $svg .= 'text x='.($svgwidth/2).'px y=300 style=font-size:15;
   text-anchor=middleThe servers Date and Time is: '.date(Y-m-d,
   H:m:s).'/text
 text x='.($svgwidth/2).'px y=340 style=font-size:15;
   text-anchor=middleYou are running:/text
 text x='.($svgwidth/2).'px y=360 style=font-size:15;
   text-anchor=middle'.$HTTP_USER_AGENT.'/text
   /svg';
  
  
   file_put_contents('/tmp/image.svg', $svg);
  
   exec(/usr/bin/rsvg /tmp/image.svg /tmp/image.png);
  
   echo file_get_contents('/tmp/image.png');
   ?
  
   -Ray Solomon
  
  
  
   --
   PHP General Mailing List (http://www.php.net/)
   To unsubscribe, visit: http://www.php.net/unsub.php
  
  


 IE doesn't display SVG natively, and the plugins for it are pants.
 However, IE does make use of its own propitiatory vector language called
 VML, This is how the Cufon font replacer system works.

 Thanks,
 Ash
 http://www.ashleysheridan.co.uk



Maybe svgweb (by Google) would allow you to achieve your goals:
http://code.google.com/p/svgweb/

Adam

-- 
Nephtali:  PHP web framework that functions beautifully
http://nephtaliproject.com


Re: [PHP] DOM TextArea (and dom chart please)

2010-02-03 Thread Ryan S



 I think what you are looking for is $input2-textContent in PHP.

Hey Andrew (and everyone else was was kind enough to write back) !

Found the solution, this is what i am using (and it works!), and i hope it 
helps anyone else who finds themselves in the spot i found myself

$inputs2 = $dom-getElementsByTagName('textarea'); // Find textareas  
foreach ($inputs2 as $input2) { 
if(!$input2-nodeValue || $input2-nodeValue==) { 
$input2-nodeValue=it works!; 
} 
} 


Cheers guys!
/R



  

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Thinking of moving to .NET because of standalone... any suggestions?

2010-02-03 Thread Ryan S
Hey Guys,

Coming from a C and Java background I just loved PHP and have been programming 
with it for years thanks in a large part to the kind people on this list... 
present and past (Immediately the name John Holmes comes to mind.. i hope the 
dude is well)
but now I have have to leave PHP or split time between php and .NET for just 
one reason:

.NET offers a way to run programs using the Windows GUI / stand alone executable

There always was talk on the list about running php code as standalone, but 
since I had a long absence from the list sorry if I missed any new updates... 
but I'm hoping someone can offer a way to run php standalone executable.

Before posting I always google, and the main results I have gotten so far is:
priado blender
and PHP-GTK

but no way to kind of drag and drop what you need like visual studio (i dont 
know how to use it yet, but been reading) or some other visual development tool 
like visual basic.

I need to make a few standalones programs that will run (mostly) on Windows... 
is there any other way that I have not found that i can use PHP instead of 
learning something new like .NET?

I have resisted going the microsoft way for years.. looks like my luck has 
run out...

Thanks,
Ryan



  

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Thinking of moving to .NET because of standalone... any suggestions?

2010-02-03 Thread Jochem Maas
Op 2/3/10 6:09 PM, Ryan S schreef:
 Hey Guys,
 
 Coming from a C and Java background I just loved PHP and have been 
 programming with it for years thanks in a large part to the kind people on 
 this list... present and past (Immediately the name John Holmes comes to 
 mind.. i hope the dude is well)
 but now I have have to leave PHP or split time between php and .NET for just 
 one reason:
 
 .NET offers a way to run programs using the Windows GUI / stand alone 
 executable
 
 There always was talk on the list about running php code as standalone, but 
 since I had a long absence from the list sorry if I missed any new updates... 
 but I'm hoping someone can offer a way to run php standalone executable.
 
 Before posting I always google, and the main results I have gotten so far is:
 priado blender
 and PHP-GTK
 
 but no way to kind of drag and drop what you need like visual studio (i dont 
 know how to use it yet, but been reading) or some other visual development 
 tool like visual basic.
 
 I need to make a few standalones programs that will run (mostly) on 
 Windows... is there any other way that I have not found that i can use PHP 
 instead of learning something new like .NET?
 
 I have resisted going the microsoft way for years.. looks like my luck has 
 run out...

I don't think that you'll get much else than Blender or PHP-GTK - so from that 
perspective
I'd hazard a guess that your not going to be finding anything that will allow 
you use php
for desktop development in the way you require.

come to think of it M$ has been doing something to shoehorn PHP into the .NET 
env ... I have
no idea whether this would be anything that could bare fruit for you, you'd 
have to google.

as an alternative you might consider Adobe Flex Builder - you get WYSIWYG-ness, 
you can leverage javascript
skills (by way of ActionScript) and it's runs on the AIR platform - so it's 
nice and desktoppy but
with the added bonus of being cross-platform. just a thought.

 
 Thanks,
 Ryan
 
 
 
   
 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Thinking of moving to .NET because of standalone... any suggestions?

2010-02-03 Thread Robert Cummings

Ryan S wrote:

Hey Guys,

Coming from a C and Java background I just loved PHP and have been programming 
with it for years thanks in a large part to the kind people on this list... 
present and past (Immediately the name John Holmes comes to mind.. i hope the 
dude is well)
but now I have have to leave PHP or split time between php and .NET for just 
one reason:

.NET offers a way to run programs using the Windows GUI / stand alone executable

There always was talk on the list about running php code as standalone, but 
since I had a long absence from the list sorry if I missed any new updates... 
but I'm hoping someone can offer a way to run php standalone executable.

Before posting I always google, and the main results I have gotten so far is:
priado blender
and PHP-GTK

but no way to kind of drag and drop what you need like visual studio (i dont 
know how to use it yet, but been reading) or some other visual development tool 
like visual basic.

I need to make a few standalones programs that will run (mostly) on Windows... 
is there any other way that I have not found that i can use PHP instead of 
learning something new like .NET?

I have resisted going the microsoft way for years.. looks like my luck has 
run out...


This is not my area of familiarity but I believe there is also something 
called WxWidgets (or something similarly named) for doing similar. It 
may be closer to the Windows metal. I wonder too if HipHop, that new PHP 
to C++ compiled binary thing from Facebook, might also have potential in 
this kind of standalone arena.


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] Thinking of moving to .NET because of standalone... any suggestions?

2010-02-03 Thread Michael A. Peters

Ryan S wrote:



I need to make a few standalones programs that will run (mostly) on
Windows... is there any other way that I have not found that i can
use PHP instead of learning something new like .NET?


Use the best tool for the job.

I suspect that if your primary target is MS you will have an application 
that is more consistent with MS interface guidelines if you use MS tools 
to develop it.


I've only played a little bit with php-gtk and just didn't get it but 
I do know the few times I have used Windows, the gtk+ apps I used on it 
always felt a bit out of place (so does iTunes, btw) on the system.


I don't know the details, but I know that at least some .NET apps can be 
ported to *nix without too much trouble using mono, so by using .NET you 
may not be sacrificing portability.


I'm not saying use .NET, I don't know, but if I was developing GUI 
desktop apps where Windows was the primary target, I would use a Windows 
 native programming environment to do it as I suspect it would result 
in far less headaches and far easier time finding solutions to problems 
via google when I'm stumped.


I believe .NET is pretty much how it is done on Windows now (but I 
really don't know, I stay away from Windows, I'm a ABM'r).


Just my 2 cents.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Thinking of moving to .NET because of standalone... any suggestions?

2010-02-03 Thread Robert Cummings

Robert Cummings wrote:

Ryan S wrote:

Hey Guys,

Coming from a C and Java background I just loved PHP and have been programming 
with it for years thanks in a large part to the kind people on this list... 
present and past (Immediately the name John Holmes comes to mind.. i hope the 
dude is well)
but now I have have to leave PHP or split time between php and .NET for just 
one reason:

.NET offers a way to run programs using the Windows GUI / stand alone executable

There always was talk on the list about running php code as standalone, but 
since I had a long absence from the list sorry if I missed any new updates... 
but I'm hoping someone can offer a way to run php standalone executable.

Before posting I always google, and the main results I have gotten so far is:
priado blender
and PHP-GTK

but no way to kind of drag and drop what you need like visual studio (i dont 
know how to use it yet, but been reading) or some other visual development tool 
like visual basic.

I need to make a few standalones programs that will run (mostly) on Windows... 
is there any other way that I have not found that i can use PHP instead of 
learning something new like .NET?

I have resisted going the microsoft way for years.. looks like my luck has 
run out...


This is not my area of familiarity but I believe there is also something 
called WxWidgets (or something similarly named) for doing similar. It 
may be closer to the Windows metal. I wonder too if HipHop, that new PHP 
to C++ compiled binary thing from Facebook, might also have potential in 
this kind of standalone arena.


I just did a quick google and there's WinBinder.

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] Thinking of moving to .NET because of standalone... any suggestions?

2010-02-03 Thread Ryan S
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.

Cheers guys!



  

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Thinking of moving to .NET because of standalone... any suggestions?

2010-02-03 Thread Robert Cummings



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

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Thinking of moving to .NET because of standalone... any suggestions?

2010-02-03 Thread Ashley Sheridan
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




[PHP] Can't get my PHP-generated RSS to serve properly

2010-02-03 Thread Brian Dunning
Hey all -

Glad some of you found that sample data helpful.   :-)

I use PHP/MySQL to generate RSS feeds of my podcasts. The feed is submitted as 
*.xml and I use .htaccess to redirect it to my PHP document. The start of the 
document sets the right header and outputs the ?  ? to prevent PHP from 
trying to process the leading XML line as code (this is cleaned up a bit for 
readability):

?php
header(content-type: application/rss+xml);
echo '?';
?
xml version=1.0 encoding=UTF-8
?php
echo '?';
?
rss xmlns:itunes=http://www.itunes.com/dtds/podcast-1.0.dtd; 
xmlns:atom=http://www.w3.org/2005/Atom; version=2.0

This has always worked fine on one podcast, but on a new one it's not. You can 
see the results here:
http://validator.w3.org/feed/check.cgi?url=http%3A%2F%2Finfactvideo.com%2Fpodcast.php

It's throwing a 500 error, a parsing error, and complaining that feeds should 
not be served with the text/html type, even though I'm serving the right 
header. Other PHP pages on this site work fine, and there are no special Apache 
directives on my site that works that are missing here. Can anyone suggest what 
I might be missing?

- Brian
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Thinking of moving to .NET because of standalone... any suggestions?

2010-02-03 Thread Robert Cummings

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 
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.


In many cases I'd agree with you, but the OP indicated they have 
existing code/libraries that they want to leverage. In this case, I'm 
not so certain creating a second redundant library in the desktop 
oriented language of choice, such that you now have two codebases to 
maintain, is a compelling argument in favour of such a move.


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] Thinking of moving to .NET because of standalone... any suggestions?

2010-02-03 Thread David Murphy
Ryan, 

You may want to consider:

NuSphere PhpDock - unique PHP deployment solution

PhpDock is a deployment platform for PHP applications.
PhpDock enables you to deploy PHP web application as a Stand Alone Windows
Desktop application w/o any changes in the code.
PhpDock combines NuSphere's powerful embeded Srv webserver and the browser
components.

With PhpDock, your php applications will work right out of the box. There's
no need to provide long and complicated instructions on Apache and Php
installation to your clients. PhpDock site license lets you distribute this
deployment solution along with your php applications to provide easy and
comprehensive installation and instant functioning of your php scripts.


http://www.nusphere.com/products/phpdock.htm

Hope this helps
David Murphy


-Original Message-
From: Ryan S [mailto:gen...@yahoo.com] 
Sent: Wednesday, February 03, 2010 11:10 AM
To: php php
Subject: [PHP] Thinking of moving to .NET because of standalone... any
suggestions?

Hey Guys,

Coming from a C and Java background I just loved PHP and have been
programming with it for years thanks in a large part to the kind people on
this list... present and past (Immediately the name John Holmes comes to
mind.. i hope the dude is well)
but now I have have to leave PHP or split time between php and .NET for just
one reason:

.NET offers a way to run programs using the Windows GUI / stand alone
executable

There always was talk on the list about running php code as standalone, but
since I had a long absence from the list sorry if I missed any new
updates... but I'm hoping someone can offer a way to run php standalone
executable.

Before posting I always google, and the main results I have gotten so far
is:
priado blender
and PHP-GTK

but no way to kind of drag and drop what you need like visual studio (i dont
know how to use it yet, but been reading) or some other visual development
tool like visual basic.

I need to make a few standalones programs that will run (mostly) on
Windows... is there any other way that I have not found that i can use PHP
instead of learning something new like .NET?

I have resisted going the microsoft way for years.. looks like my luck has
run out...

Thanks,
Ryan



  

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Can't get my PHP-generated RSS to serve properly

2010-02-03 Thread Robert Cummings

Brian Dunning wrote:

Hey all -

Glad some of you found that sample data helpful.   :-)

I use PHP/MySQL to generate RSS feeds of my podcasts. The feed is submitted as *.xml and 
I use .htaccess to redirect it to my PHP document. The start of the document sets the 
right header and outputs the ?  ? to prevent PHP from trying to process the 
leading XML line as code (this is cleaned up a bit for readability):

?php
header(content-type: application/rss+xml);
echo '?';
?
xml version=1.0 encoding=UTF-8
?php
echo '?';
?
rss xmlns:itunes=http://www.itunes.com/dtds/podcast-1.0.dtd; 
xmlns:atom=http://www.w3.org/2005/Atom; version=2.0

This has always worked fine on one podcast, but on a new one it's not. You can 
see the results here:
http://validator.w3.org/feed/check.cgi?url=http%3A%2F%2Finfactvideo.com%2Fpodcast.php

It's throwing a 500 error, a parsing error, and complaining that feeds should not be 
served with the text/html type, even though I'm serving the right header. 
Other PHP pages on this site work fine, and there are no special Apache directives on my 
site that works that are missing here. Can anyone suggest what I might be missing?


A 500 error is indicating a failure at the server/script level. The 
parse error I assume you see in your error logs. Correct the parse error 
and you should be able to move forward. The text/html error is related 
to the parse error since that prevents your script from running and 
properly setting the content type header.


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] Thinking of moving to .NET because of standalone... any suggestions?

2010-02-03 Thread Bastien Koert
On Wed, Feb 3, 2010 at 2:37 PM, Robert Cummings rob...@interjinn.com wrote:
 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 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.

 In many cases I'd agree with you, but the OP indicated they have existing
 code/libraries that they want to leverage. In this case, I'm not so certain
 creating a second redundant library in the desktop oriented language of
 choice, such that you now have two codebases to maintain, is a compelling
 argument in favour of such a move.

 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



check out http://www.php-compiler.net/doku.php

-- 

Bastien

Cat, the other other white meat

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Can't get my PHP-generated RSS to serve properly

2010-02-03 Thread Brian Dunning
Ugh. Stupid me. Thanks Robert. It was a type elsewhere in my code further down 
the page. I was so hung up thinking it was an encoding or MIME or delivery 
problem I didn't think to check my PHP.

Someone slap me upside the head please.


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Can't get my PHP-generated RSS to serve properly

2010-02-03 Thread Michael A. Peters

Brian Dunning wrote:

Hey all -

Glad some of you found that sample data helpful.   :-)

I use PHP/MySQL to generate RSS feeds of my podcasts. The feed is
submitted as *.xml and I use .htaccess to redirect it to my PHP
document. The start of the document sets the right header and outputs
the ?  ? to prevent PHP from trying to process the leading XML
line as code (this is cleaned up a bit for readability):

?php header(content-type: application/rss+xml); echo '?'; ? xml
version=1.0 encoding=UTF-8 ?php echo '?'; ? rss
xmlns:itunes=http://www.itunes.com/dtds/podcast-1.0.dtd;
xmlns:atom=http://www.w3.org/2005/Atom; version=2.0

This has always worked fine on one podcast, but on a new one it's
not. You can see the results here: 
http://validator.w3.org/feed/check.cgi?url=http%3A%2F%2Finfactvideo.com%2Fpodcast.php



It's throwing a 500 error, a parsing error, and complaining that
feeds should not be served with the text/html type, even though I'm
serving the right header. Other PHP pages on this site work fine, and
there are no special Apache directives on my site that works that are
missing here. Can anyone suggest what I might be missing?

- Brian


Don't know if it is beneficial to you, but this is what I use (and 
wrote) for RSS feeds -


http://www.phpclasses.org/browse/package/5942.html

Not tried it for podcasts.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Thinking of moving to .NET because of standalone... any suggestions?

2010-02-03 Thread Ryan S
Thanks for the links and advise guys!

Of all I found this most interesting as it would run native:


check out http://www.php-compiler.net/doku.php

unfortunately I think this project is dead or at best stagnant because the 
server is slower than a 99 year old on weed and forums link dead. Documentation 
is badly limited as well.

 But if someone was used this or is using this, would love to hear from you.

Till then am back to checking out the other recommendations and googling.
Keep any other advise/links coming ;) they are most appreciated.

Cheers!
R



  

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] PHP Manual problems

2010-02-03 Thread clancy_1
Recently I have frequently found, especially in the morning (GMT 2200 - 0200), 
that I can
open a bookmark in the manual, for example 
http://www.php.net/manual/en/ref.image.php.
But if I then do a search of any type I get 'The page cannot be displayed'.  I 
then cannot
reach any page, including the one I originally opened.

This morning, after some fiddling, I found that if I closed the browser, and 
re-opened it
I could then see the original bookmark again, and link to some pages, but 
others would
again crash the browser, as would all searches.

I am using IE6, and have seen a message that I should update my browser, but 
only when the
page is displaying properly.  Firefox 3.5.5 immediately converted the above to
http://au2.php.net/manual/en/ref.image.php. and then told me The manual page 
you are
looking for (http://au2.php.net/manual/en/ref.image.php.) is not available on 
this server
right now.

Is this due to maintenance, or somesuch, or is it something in my system?


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP Manual problems

2010-02-03 Thread Ashley Sheridan
On Thu, 2010-02-04 at 11:32 +1100, clanc...@cybec.com.au wrote:

 Recently I have frequently found, especially in the morning (GMT 2200 - 
 0200), that I can
 open a bookmark in the manual, for example 
 http://www.php.net/manual/en/ref.image.php.
 But if I then do a search of any type I get 'The page cannot be displayed'.  
 I then cannot
 reach any page, including the one I originally opened.
 
 This morning, after some fiddling, I found that if I closed the browser, and 
 re-opened it
 I could then see the original bookmark again, and link to some pages, but 
 others would
 again crash the browser, as would all searches.
 
 I am using IE6, and have seen a message that I should update my browser, but 
 only when the
 page is displaying properly.  Firefox 3.5.5 immediately converted the above to
 http://au2.php.net/manual/en/ref.image.php. and then told me The manual page 
 you are
 looking for (http://au2.php.net/manual/en/ref.image.php.) is not available on 
 this server
 right now.
 
 Is this due to maintenance, or somesuch, or is it something in my system?
 
 


The bookmarked page you are seeing is probably the offline cached
version from your browser. Try visiting that bookmark from another
browser.

Thanks,
Ash
http://www.ashleysheridan.co.uk




[PHP] stream_select() not working on regular files?

2010-02-03 Thread Dennis J.

Hi,
I'm trying to implement something similar to tail -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

--
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?

2010-02-03 Thread Ashley Sheridan
On Thu, 2010-02-04 at 01:41 +0100, Dennis J. wrote:

 Hi,
 I'm trying to implement something similar to tail -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?

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.

Thanks,
Ash
http://www.ashleysheridan.co.uk




Re: [PHP] stream_select() not working on regular files?

2010-02-03 Thread Dennis J.

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.


Regards,
  Dennis

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP Manual problems

2010-02-03 Thread Jochem Maas
Op 2/4/10 1:32 AM, clanc...@cybec.com.au schreef:
 Recently I have frequently found, especially in the morning (GMT 2200 - 
 0200), that I can
 open a bookmark in the manual, for example 
 http://www.php.net/manual/en/ref.image.php.
 But if I then do a search of any type I get 'The page cannot be displayed'.  
 I then cannot
 reach any page, including the one I originally opened.
 
 This morning, after some fiddling, I found that if I closed the browser, and 
 re-opened it
 I could then see the original bookmark again, and link to some pages, but 
 others would
 again crash the browser, as would all searches.
 
 I am using IE6, and have seen a message that I should update my browser, but 
 only when the
 page is displaying properly.  Firefox 3.5.5 immediately converted the above to
 http://au2.php.net/manual/en/ref.image.php. and then told me The manual page 
 you are
 looking for (http://au2.php.net/manual/en/ref.image.php.) is not available on 
 this server
 right now.

there are stacks of mirrors. try one of:

au.php.net
tw.php.net
tw2.php.net
tn.php.net
tn2.php.net
sg.php.net
sg2.php.net

... guessing those are closest to you.

as for using IE6 ... WTF ... you do realise this is essentially a web 
developers mailing list right?


 
 Is this due to maintenance, or somesuch, or is it something in my system?
 
 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] PHP User

2010-02-03 Thread abby ragz

Hi,

I used PHP 3 years back and was a standard user.

but now I want to update myself and do self - study .

 

Please advise from where should I start.

Any good site recommendations.

 

Thanks in advance:)
  
_
Search for properties that match your lifestyle! Start searching NOW!
http://clk.atdmt.com/NMN/go/157631292/direct/01/

Re: [PHP] PHP User

2010-02-03 Thread Paul M Foster
On Thu, Feb 04, 2010 at 03:13:00PM +1030, abby ragz wrote:

 
 Hi,
 
 I used PHP 3 years back and was a standard user.
 
 but now I want to update myself and do self - study .
 
  
 
 Please advise from where should I start.
 
 Any good site recommendations.

Programming PHP by Lerdorf, Tatroe, MacIntyre (O'Reilly)

http://php.net/manual/en/

For object oriented PHP code,

PHP In Action: Objects, Design, Agility by Reiersol, Baker, Shiflett
(Manning)

Paul

-- 
Paul M. Foster

-- 
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?

2010-02-03 Thread Eric Lee
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;
}
}




Regards,
Eric,




 Regards,
  Dennis

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php