php-general Digest 17 Oct 2008 01:15:31 -0000 Issue 5739

2008-10-16 Thread php-general-digest-help

php-general Digest 17 Oct 2008 01:15:31 - Issue 5739

Topics (messages 281982 through 282015):

Re: 1 last error to fix before the application is done!
281982 by: Jochem Maas

Re: searching by tags
281983 by: Nathan Rixham
281986 by: Philip Thompson

Re: utf8/quoted printable based mail renders raw html
281984 by: Eric Butera
281985 by: Nathan Rixham
281987 by: Eric Butera

help - php script - no interaction
281988 by: John Smtih
281989 by: Dan Joseph
281990 by: Nathan Rixham

Re: Flags package for PHP?
281991 by: Jim Lucas

Binary file copy
281992 by: Jay Moore
281993 by: Andrew Ballard
281994 by: Nathan Rixham
281995 by: Jay Moore
281996 by: Bastien Koert
281997 by: Nathan Rixham

PHP to Java
281998 by: ceo.l-i-e.com
281999 by: Nathan Rixham
282000 by: Nathan Rixham
282001 by: Daniel Brown
282002 by: Børge Holen

PHP Dev Facts
282003 by: Nathan Rixham
282004 by: Shawn McKenzie
282005 by: Nathan Rixham
282006 by: Eric Butera
282007 by: Daniel Brown
282009 by: Bastien Koert
282012 by: Chris
282013 by: Kaleb Pomeroy
282014 by: Shawn McKenzie
282015 by: Robert Cummings

Randomiser
282008 by: Andrew Barnett
282010 by: Bastien Koert
282011 by: Chris

Administrivia:

To subscribe to the digest, e-mail:
[EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]

To post to the list, e-mail:
[EMAIL PROTECTED]


--
---BeginMessage---
Jason Pruim schreef:
 
 On Oct 15, 2008, at 7:18 AM, Nathan Rixham wrote:
 
 Jason Pruim wrote:
 I probably should have mentioned that this was in a function to do
 the heavy lifting for authentication :) I just didn't paste the whole
 function since 90% of it worked just fine :)
 Now I just need to get better and separating presentation and code :)

 very smiley today :-)
 
 Lack of sleep and lots of caffeine does that to you :P
 

strange .. that usually makes me grumpy and quick to snap at people
(so guess how much coffee and how little sleep I generally get ;-))

 
 -- 
 
 Jason Pruim
 Raoset Inc.
 Technology Manager
 MQC Specialist
 11287 James St
 Holland, MI 49424
 www.raoset.com
 [EMAIL PROTECTED]
 
 
 
 
 

---End Message---
---BeginMessage---

Jochem Maas wrote:

Ashley Sheridan schreef:

On Wed, 2008-10-15 at 15:36 -0600, Govinda wrote:

improvement if I went for static URLs on the site, but I don't  
have any

evidence for that, and I'm willing to admit it.

I'd rebuff this but it would feel like Im feeding a troll.

choices:
1 - Waste some time on a live test to prove this
2 - Explain how I know this and show the historical evidence (which  
would likely be rebuffed as it's not current)
3 - Further optimise you're clients 75k page site and double traffic  
within a month (which you'll hardly let me do, and certainly not  
publicly)

4 - Propose that everybody measures to see who's is biggest.
5 - Find a post worth a reply.
6 - See what's on tv
7 - Make a personal website for the hell of it
8 - Keep my boss happy and do that JBoss/Glassfish comparison
9 - Think of more options
10 - Pester the three week old kittens who are looking at me.

there's been such a low volume of decent get your teeth in to posts  
on this list the past few days, end up wasting time like this -  
terrible!


peace
Guys, I am personally way out of it.  (I haven't had time anything PHP  
to even warrant posting the total newbie questions I would have  
here...  )

but please do one thing:
Be kind to Ashley.
I don't know Ash at all, but as an out-of-it newbie I can say from  
reading many posts on this list that she (sorry if you're not female  
Ash) always seems courteous, often gives answers that solve the  
specific technical issues, often gives answers that help the greener  
coder with general understanding on the topic, and offers for free a  
lot of her time in a totally unselfish way here.  I have no  
relationship with her at all, so my only point here is that it doesn't  
seem right to do anything weightier than politely disagree with her  
(if you do).  I mean- speaking harshly to someone who does offer so  
much benign and useful help makes us wanna be newbies cringe.  I would  
be tempted to say the same if someone said harsh things towards you  
guys, except that you'd beat me to your own defense.  ;-)


-Govinda


Actually I'm a guy, but we can't all be perfect ;)

I really didn't mean to get anyones back up too much. That last reply
was after a hard days work, so I was probably far more harsh than I
should have been. I apologise to both Nathan and Jochem, as I was far
too critical of both their opinions.


actually I didn't have an opinion of my own on this one, merely parroting
nathan ... which is 

Re: [PHP] searching by tags....

2008-10-16 Thread Jochem Maas
Ashley Sheridan schreef:
 On Wed, 2008-10-15 at 15:36 -0600, Govinda wrote:
 
 improvement if I went for static URLs on the site, but I don't  
 have any
 evidence for that, and I'm willing to admit it.
 I'd rebuff this but it would feel like Im feeding a troll.
 choices:
 1 - Waste some time on a live test to prove this
 2 - Explain how I know this and show the historical evidence (which  
 would likely be rebuffed as it's not current)
 3 - Further optimise you're clients 75k page site and double traffic  
 within a month (which you'll hardly let me do, and certainly not  
 publicly)
 4 - Propose that everybody measures to see who's is biggest.
 5 - Find a post worth a reply.
 6 - See what's on tv
 7 - Make a personal website for the hell of it
 8 - Keep my boss happy and do that JBoss/Glassfish comparison
 9 - Think of more options
 10 - Pester the three week old kittens who are looking at me.

 there's been such a low volume of decent get your teeth in to posts  
 on this list the past few days, end up wasting time like this -  
 terrible!

 peace
 Guys, I am personally way out of it.  (I haven't had time anything PHP  
 to even warrant posting the total newbie questions I would have  
 here...  )
 but please do one thing:
 Be kind to Ashley.
 I don't know Ash at all, but as an out-of-it newbie I can say from  
 reading many posts on this list that she (sorry if you're not female  
 Ash) always seems courteous, often gives answers that solve the  
 specific technical issues, often gives answers that help the greener  
 coder with general understanding on the topic, and offers for free a  
 lot of her time in a totally unselfish way here.  I have no  
 relationship with her at all, so my only point here is that it doesn't  
 seem right to do anything weightier than politely disagree with her  
 (if you do).  I mean- speaking harshly to someone who does offer so  
 much benign and useful help makes us wanna be newbies cringe.  I would  
 be tempted to say the same if someone said harsh things towards you  
 guys, except that you'd beat me to your own defense.  ;-)

 -Govinda

 
 Actually I'm a guy, but we can't all be perfect ;)
 
 I really didn't mean to get anyones back up too much. That last reply
 was after a hard days work, so I was probably far more harsh than I
 should have been. I apologise to both Nathan and Jochem, as I was far
 too critical of both their opinions.

actually I didn't have an opinion of my own on this one, merely parroting
nathan ... which is quite funny because normally I'm a completely opinionate 
SOB :-P

anyways it seems we're all good ... on to the next holy war ;-)

 
 
 Ash
 www.ashleysheridan.co.uk
 


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



Re: [PHP] Microsoft China to Punish private windows users

2008-10-16 Thread Shelley
Hi Richard,

Only China users will suffer the punishment. :)

50 pounds is not much, but 700 RMB is very much, actually. (The Office's
price)

2008/10/16 Richard Heyes [EMAIL PROTECTED]

  It will punish private Windows XP and Office 2003, Office 2007 users.

 I was going to say what's wrong with that?, but then remembered that
 I use them too...

 --
 Richard Heyes

 HTML5 Graphing for FF, Chrome, Opera and Safari:
 http://www.rgraph.org




-- 
With best regards,
Shelley Shyan
http://phparch.cn


Re: [PHP] Re: 1 last error to fix before the application is done!

2008-10-16 Thread Jochem Maas
Jason Pruim schreef:
 
 On Oct 15, 2008, at 7:18 AM, Nathan Rixham wrote:
 
 Jason Pruim wrote:
 I probably should have mentioned that this was in a function to do
 the heavy lifting for authentication :) I just didn't paste the whole
 function since 90% of it worked just fine :)
 Now I just need to get better and separating presentation and code :)

 very smiley today :-)
 
 Lack of sleep and lots of caffeine does that to you :P
 

strange .. that usually makes me grumpy and quick to snap at people
(so guess how much coffee and how little sleep I generally get ;-))

 
 -- 
 
 Jason Pruim
 Raoset Inc.
 Technology Manager
 MQC Specialist
 11287 James St
 Holland, MI 49424
 www.raoset.com
 [EMAIL PROTECTED]
 
 
 
 
 


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



Re: [PHP] searching by tags....

2008-10-16 Thread Nathan Rixham

Jochem Maas wrote:

Ashley Sheridan schreef:

On Wed, 2008-10-15 at 15:36 -0600, Govinda wrote:

improvement if I went for static URLs on the site, but I don't  
have any

evidence for that, and I'm willing to admit it.

I'd rebuff this but it would feel like Im feeding a troll.

choices:
1 - Waste some time on a live test to prove this
2 - Explain how I know this and show the historical evidence (which  
would likely be rebuffed as it's not current)
3 - Further optimise you're clients 75k page site and double traffic  
within a month (which you'll hardly let me do, and certainly not  
publicly)

4 - Propose that everybody measures to see who's is biggest.
5 - Find a post worth a reply.
6 - See what's on tv
7 - Make a personal website for the hell of it
8 - Keep my boss happy and do that JBoss/Glassfish comparison
9 - Think of more options
10 - Pester the three week old kittens who are looking at me.

there's been such a low volume of decent get your teeth in to posts  
on this list the past few days, end up wasting time like this -  
terrible!


peace
Guys, I am personally way out of it.  (I haven't had time anything PHP  
to even warrant posting the total newbie questions I would have  
here...  )

but please do one thing:
Be kind to Ashley.
I don't know Ash at all, but as an out-of-it newbie I can say from  
reading many posts on this list that she (sorry if you're not female  
Ash) always seems courteous, often gives answers that solve the  
specific technical issues, often gives answers that help the greener  
coder with general understanding on the topic, and offers for free a  
lot of her time in a totally unselfish way here.  I have no  
relationship with her at all, so my only point here is that it doesn't  
seem right to do anything weightier than politely disagree with her  
(if you do).  I mean- speaking harshly to someone who does offer so  
much benign and useful help makes us wanna be newbies cringe.  I would  
be tempted to say the same if someone said harsh things towards you  
guys, except that you'd beat me to your own defense.  ;-)


-Govinda


Actually I'm a guy, but we can't all be perfect ;)

I really didn't mean to get anyones back up too much. That last reply
was after a hard days work, so I was probably far more harsh than I
should have been. I apologise to both Nathan and Jochem, as I was far
too critical of both their opinions.


actually I didn't have an opinion of my own on this one, merely parroting
nathan ... which is quite funny because normally I'm a completely opinionate 
SOB :-P

anyways it seems we're all good ... on to the next holy war ;-)



Ash
www.ashleysheridan.co.uk




joy let's group hug and discuss php for dummies :-D

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



Re: [PHP] Microsoft China to Punish private windows users

2008-10-16 Thread Richard Heyes
 It will punish private Windows XP and Office 2003, Office 2007 users.

I was going to say what's wrong with that?, but then remembered that
I use them too...

-- 
Richard Heyes

HTML5 Graphing for FF, Chrome, Opera and Safari:
http://www.rgraph.org

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



Re: [PHP] Re: utf8/quoted printable based mail renders raw html

2008-10-16 Thread Eric Butera
So it turns out the problem was inconsistent newlines.  An include
file ended up having unix line returns while the design file had mac
line returns.  Normalizing the pieced together content solved my
problems.

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



Re: [PHP] Re: utf8/quoted printable based mail renders raw html

2008-10-16 Thread Nathan Rixham

Eric Butera wrote:

So it turns out the problem was inconsistent newlines.  An include
file ended up having unix line returns while the design file had mac
line returns.  Normalizing the pieced together content solved my
problems.


glad to hear you got it fixed! was the same thing I had years ago but 
that was between \r and \r\n


mail problems always seem to be the most time consuming to fix

anyways congrats! :-)

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



Re: [PHP] searching by tags....

2008-10-16 Thread Philip Thompson

On Oct 14, 2008, at 6:17 PM, Jochem Maas wrote:


Nathan Rixham schreef:

Ashley Sheridan wrote:

On Tue, 2008-10-14 at 14:54 -0700, Ryan S wrote:

quite a few sites seem to have a very neat way of implementing this
with (url rewriting?) something like
http://sitename/blog/tags/tag-comes-here/


As for getting those search terms, well a link in a page can  
contain GET

values, such as http://www.somedomain.com/blog?tag=search_term .
Alternatively, you could use mod-rewrite to rewrite the URL and  
turn the

path into tag variables. This is the same as the above but with the
added benefit that users can type in tags directly more easily, and
there are apparently benefits for SEO with this method as well  
(but I'm

not sure how true that is)


it's very true; from the google webmaster guidelines:

If you decide to use dynamic pages (i.e., the URL contains a ?
character), be aware that not every search engine spider crawls  
dynamic
pages as well as static pages. It helps to keep the parameters  
short and

the number of them few.

previously it was text along the lines of google doesn't index all
pages with query parameters, so avoid them where possible

additionally one of the weightier points in categorising pages within
the SERPS is the text in the url (especially if the page is actually
about /the_tag_in_the_url : see http://www.google.com/search?q=tags)


^-- some what 
ironic :-)


LOL! Thanks for the outburst of laughter. ;)

~Philip


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



Re: [PHP] Re: utf8/quoted printable based mail renders raw html

2008-10-16 Thread Eric Butera
On Thu, Oct 16, 2008 at 12:33 PM, Nathan Rixham [EMAIL PROTECTED] wrote:
 Eric Butera wrote:

 So it turns out the problem was inconsistent newlines.  An include
 file ended up having unix line returns while the design file had mac
 line returns.  Normalizing the pieced together content solved my
 problems.

 glad to hear you got it fixed! was the same thing I had years ago but that
 was between \r and \r\n

 mail problems always seem to be the most time consuming to fix

 anyways congrats! :-)

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



Thanks!  The worst part was not being able to reproduce the issue.  I
found over 12 people with various installs of XP/Outlook 2003 and none
of them had the issue.  Kinda weird considering it has the same
version number and such from the X-Mailer/Mime headers.  Oh well, yet
another lesson learned. ;)

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



[PHP] help - php script - no interaction

2008-10-16 Thread John Smtih
http://www.site1.com
 http://www.site2.com
 http://www.site3.com



I have 3 sites above in a html.  I do not want to create click each site,
one at a time to see 1 page info.
I want to write a script to go get all 3 sites, and bring it back into 1
page (the content of 3 pages concatinated).

Is this doable in php?  any other scripts?  Thanks.


Re: [PHP] help - php script - no interaction

2008-10-16 Thread Dan Joseph
On Thu, Oct 16, 2008 at 1:10 PM, John Smtih [EMAIL PROTECTED] wrote:

 http://www.site1.com
  http://www.site2.com
  http://www.site3.com



 I have 3 sites above in a html.  I do not want to create click each site,
 one at a time to see 1 page info.
 I want to write a script to go get all 3 sites, and bring it back into 1
 page (the content of 3 pages concatinated).

 Is this doable in php?  any other scripts?  Thanks.


Check into curl, http://www.php.net/curl  -- that should do what you want.

-- 
-Dan Joseph

www.canishosting.com - Plans start @ $1.99/month.

Build a man a fire, and he will be warm for the rest of the day.
Light a man on fire, and will be warm for the rest of his life.


[PHP] Re: help - php script - no interaction

2008-10-16 Thread Nathan Rixham

John Smtih wrote:

http://www.site1.com
 http://www.site2.com
 http://www.site3.com



I have 3 sites above in a html.  I do not want to create click each site,
one at a time to see 1 page info.
I want to write a script to go get all 3 sites, and bring it back into 1
page (the content of 3 pages concatinated).

Is this doable in php?  any other scripts?  Thanks.



very messy but..

?php
$concatsites = file_get_contents('http://www.site1.com/');
$concatsites .= file_get_contents('http://www.site2.com/');
$concatsites .= file_get_contents('http://www.site3.com/');
echo $concatsites;
?

ps:
you will have 3 full html pages concatenated together and echo'd out; 
but I guess you could easily extract the body's and show them instead..


not really a commercial solution but suitable for a quick debug 
script/view for yourself


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



Re: [PHP] Flags package for PHP?

2008-10-16 Thread Jim Lucas
Waynn Lue wrote:
 I'm running some command-line scripts that are taking more and more
 arguments, and I'm wondering whether anyone's used a good flags package for
 PHP?  Support for string/int/boolean arguments would be nice, otherwise I'll
 just hack together my own.
 
 Thanks for any advice,
 Waynn
 

I would maybe look into using a standard ini file and then use the
parse_ini_file [1] function to bring it all together again.

1 - http://us2.php.net/manual/en/function.parse-ini-file.php

-- 
Jim Lucas

   Some men are born to greatness, some achieve greatness,
   and some have greatness thrust upon them.

Twelfth Night, Act II, Scene V
by William Shakespeare


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



[PHP] Binary file copy

2008-10-16 Thread Jay Moore

Greetings list!

Say I want to copy a jpg from a remote server onto mine, using PHP. 
Right now, my script opens a socket to the remote server, and opens the 
image file.  It copies its contents into a dummy variable, opens a new 
file on my server, and dumps the contents of the dummy variable into the 
new file.


For reasons I cannot figure out, it is not working the way I want. 
Rather than display the image, I get an nothing when opening it in an 
image viewer.


Code follows:
--
?php

$ip = '10.10.10.3';
$port = '80';

$h = @fsockopen($ip, $port, $err, $str, 5);


if ($h)
{

// Get current image
$h = @fsockopen($ip, $port, $err, $str, 5);
$out = GET /record/current.jpg HTTP/1.1\r\n;
$out .= Host: $ip\r\n;
$out .= Connection: Close\r\n\r\n;

fputs($h, $out, strlen($out));

$data = '';

while (!feof($h))
{
$data .= fgets($h, 128);
}


fclose($h);

// Store to file
$f = fopen('/path/test.jpg', wb);

if ($f)
{
fwrite($f, $data, strlen($data));
fclose($f);

}
else
{
die('cannot open file for writing');
}
}
else
{
die('cannot contact server');
}
?

-

I have trimmed the code some, and omitted the part where I remove the 
HTTP headers and other information I do not need.


Why isn't this working for me?

Thanks in advance,
Jay

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



[PHP] Re: Binary file copy

2008-10-16 Thread Nathan Rixham

Jay Moore wrote:

Greetings list!

Say I want to copy a jpg from a remote server onto mine, using PHP. 
Right now, my script opens a socket to the remote server, and opens the 
image file.  It copies its contents into a dummy variable, opens a new 
file on my server, and dumps the contents of the dummy variable into the 
new file.


For reasons I cannot figure out, it is not working the way I want. 
Rather than display the image, I get an nothing when opening it in an 
image viewer.


Code follows:
--
?php

$ip = '10.10.10.3';
$port = '80';

$h = @fsockopen($ip, $port, $err, $str, 5);


if ($h)
{

// Get current image

$h = @fsockopen($ip, $port, $err, $str, 5);
$out = GET /record/current.jpg HTTP/1.1\r\n;
$out .= Host: $ip\r\n;
$out .= Connection: Close\r\n\r\n;

fputs($h, $out, strlen($out));

$data = '';

while (!feof($h))

{
$data .= fgets($h, 128);
}


fclose($h);

// Store to file

$f = fopen('/path/test.jpg', wb);

if ($f)

{
fwrite($f, $data, strlen($data));
fclose($f);
   
}

else
{
die('cannot open file for writing');
}
}
else
{
die('cannot contact server');
}
?

-

I have trimmed the code some, and omitted the part where I remove the 
HTTP headers and other information I do not need.


Why isn't this working for me?

Thanks in advance,
Jay


in the response you'll be getting the raw http response (including 
headers); so you're saving them as well thus not a valid image file.


can't see why:
$image = file_get_contents('http://10.10.10.3/record/current.jpg');
wouldn't work for you..

regardless though if you are using sockets, be sure to trim of that raw 
http response - oh and look out for chunked or encoded file transfer as 
well as you'll need to decode etc etc.. (large can of worms - use an 
http transport class)


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



Re: [PHP] Binary file copy

2008-10-16 Thread Andrew Ballard
On Thu, Oct 16, 2008 at 1:58 PM, Jay Moore [EMAIL PROTECTED] wrote:
 Greetings list!

 Say I want to copy a jpg from a remote server onto mine, using PHP. Right
 now, my script opens a socket to the remote server, and opens the image
 file.  It copies its contents into a dummy variable, opens a new file on my
 server, and dumps the contents of the dummy variable into the new file.

 For reasons I cannot figure out, it is not working the way I want. Rather
 than display the image, I get an nothing when opening it in an image viewer.

 Code follows:
 --
 ?php

 $ip = '10.10.10.3';
 $port = '80';

 $h = @fsockopen($ip, $port, $err, $str, 5);


 if ($h)
 {

// Get current image
$h = @fsockopen($ip, $port, $err, $str, 5);
$out = GET /record/current.jpg HTTP/1.1\r\n;
$out .= Host: $ip\r\n;
$out .= Connection: Close\r\n\r\n;

fputs($h, $out, strlen($out));

$data = '';

while (!feof($h))
{
$data .= fgets($h, 128);
}


fclose($h);

// Store to file
$f = fopen('/path/test.jpg', wb);

if ($f)
{
fwrite($f, $data, strlen($data));
fclose($f);

}
else
{
die('cannot open file for writing');
}
 }
 else
 {
die('cannot contact server');
 }
 ?

 -

 I have trimmed the code some, and omitted the part where I remove the HTTP
 headers and other information I do not need.

 Why isn't this working for me?

 Thanks in advance,
 Jay

You'll have to strip off the HTTP response headers. Have you tried
file_get_contents()? It might work and be a whole lot simpler.

Andrew

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



[PHP] Re: Binary file copy

2008-10-16 Thread Jay Moore
in the response you'll be getting the raw http response (including 
headers); so you're saving them as well thus not a valid image file.


can't see why:
$image = file_get_contents('http://10.10.10.3/record/current.jpg');
wouldn't work for you..

regardless though if you are using sockets, be sure to trim of that raw 
http response - oh and look out for chunked or encoded file transfer as 
well as you'll need to decode etc etc.. (large can of worms - use an 
http transport class)




file_get_contents worked beautifully.  Thanks for the suggestion!

Jay

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



Re: [PHP] Re: Binary file copy

2008-10-16 Thread Bastien Koert
On Thu, Oct 16, 2008 at 2:02 PM, Nathan Rixham [EMAIL PROTECTED] wrote:

 Jay Moore wrote:

 Greetings list!

 Say I want to copy a jpg from a remote server onto mine, using PHP. Right
 now, my script opens a socket to the remote server, and opens the image
 file.  It copies its contents into a dummy variable, opens a new file on my
 server, and dumps the contents of the dummy variable into the new file.

 For reasons I cannot figure out, it is not working the way I want. Rather
 than display the image, I get an nothing when opening it in an image viewer.
 [snip]
 Code follows:

 [/snip]
 -

 I have trimmed the code some, and omitted the part where I remove the HTTP
 headers and other information I do not need.

 Why isn't this working for me?

 Thanks in advance,
 Jay



I have used cURL for something similar to grab an audio file from a remote
server. That may be an option as well
-- 

Bastien

Cat, the other other white meat


[PHP] Re: Binary file copy

2008-10-16 Thread Nathan Rixham

Jay Moore wrote:
in the response you'll be getting the raw http response (including 
headers); so you're saving them as well thus not a valid image file.


can't see why:
$image = file_get_contents('http://10.10.10.3/record/current.jpg');
wouldn't work for you..


file_get_contents worked beautifully.  Thanks for the suggestion!

Jay


no problem + credit to Andrew who suggested the same thing more concisely!

glad you got a fix

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



[PHP] PHP to Java

2008-10-16 Thread ceo

For reasons we needn't go into, I need to convert this to Java:



$to_encode = example.com/api?foo=bar;

$key = asdfasdfasdfasdfasdfasdf; //fake value, but 24 bytes

$td = mcrypt_module_open('tripledes', '', 'ecb', '');

mcrypt_generic_init ($td, $key, $iv);

$c_t = mcrypt_generic ($td, $to_encode);



I've been Googling for hours and tried all kinds of stuff, none of which came 
even close.



Any suggestions on a good reference or conversion program or something?...



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



[PHP] Re: PHP to Java

2008-10-16 Thread Nathan Rixham

[EMAIL PROTECTED] wrote:

For reasons we needn't go into, I need to convert this to Java:

$to_encode = example.com/api?foo=bar;
$key = asdfasdfasdfasdfasdfasdf; //fake value, but 24 bytes
$td = mcrypt_module_open('tripledes', '', 'ecb', '');
mcrypt_generic_init ($td, $key, $iv);
$c_t = mcrypt_generic ($td, $to_encode);

I've been Googling for hours and tried all kinds of stuff, none of which came 
even close.

Any suggestions on a good reference or conversion program or something?...


http://java.sun.com/docs/books/tutorial/index.html

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



[PHP] Re: PHP to Java

2008-10-16 Thread Nathan Rixham

[EMAIL PROTECTED] wrote:

For reasons we needn't go into, I need to convert this to Java:

$to_encode = example.com/api?foo=bar;
$key = asdfasdfasdfasdfasdfasdf; //fake value, but 24 bytes
$td = mcrypt_module_open('tripledes', '', 'ecb', '');
mcrypt_generic_init ($td, $key, $iv);
$c_t = mcrypt_generic ($td, $to_encode);

I've been Googling for hours and tried all kinds of stuff, none of which came 
even close.

Any suggestions on a good reference or conversion program or something?...


+
http://www.caucho.com/resin-javadoc/com/caucho/quercus/lib/mcrypt/Mcrypt.html

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



Re: [PHP] PHP to Java

2008-10-16 Thread Daniel Brown
On Thu, Oct 16, 2008 at 4:50 PM,  [EMAIL PROTECTED] wrote:

 Any suggestions on a good reference or conversion program or something?...

You could begin by not hiding behind the title of a CEO, Lynch.
We know it's you.  ;-P

-- 
/Daniel P. Brown
More full-root dedicated server packages:
Intel 2.4GHz/60GB/512MB/2TB $49.99/mo.
Intel 3.06GHz/80GB/1GB/2TB $59.99/mo.
Intel 2.4GHz/320/GB/1GB/3TB $74.99/mo.
Dedicated servers, VPS, and hosting from $2.50/mo.

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



Re: [PHP] PHP to Java

2008-10-16 Thread Børge Holen


On Oct 16, 2008, at 10:50 PM, [EMAIL PROTECTED] wrote:



For reasons we needn't go into, I need to convert this to Java:

$to_encode = example.com/api?foo=bar;
$key = asdfasdfasdfasdfasdfasdf; //fake value, but 24 bytes
$td = mcrypt_module_open('tripledes', '', 'ecb', '');
mcrypt_generic_init ($td, $key, $iv);
$c_t = mcrypt_generic ($td, $to_encode);

I've been Googling for hours and tried all kinds of stuff, none of  
which came even close.


Any suggestions on a good reference or conversion program or  
something?...


a little somethingsomething

String to_encode = new String(example.com/api?foo=bar);
String key = new String(asdfasdfasdfasdfasdfasdf);
Mcrypt_module td = new Mcrypt_module('tripledes', '', 'ecb', '');
td.init(key, iv);
td.mcrypt_generic(to_encode);





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





[PHP] PHP Dev Facts

2008-10-16 Thread Nathan Rixham

Evening All,

I'd be /really/ interested to know who uses what!

*Procedural or OOP?*

*Dev OS*

*Dev PHP Version*

*Live Server OS*

*Live Server PHP Version*

*Which HTTP Server Software (+version)?*

*IDE / Dev Environment*

*Preferred Framework(s)?*

*Do you Unit Test?*

*Most Used Internal PHP Class*

*Preferred OS CMS*

*Anything else you use frequently in you're PHP'ing that's worth 
mentioning:*


ps: I'm not asking for any kind of research project, just interested and 
interested to know what's most common + might learn something/find some 
new tools/toys!


pps: will reply myself as well but if I do here it'll make your 
intertwined replies messy!


Many Regards

Nathan

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



[PHP] Re: PHP Dev Facts

2008-10-16 Thread Shawn McKenzie
Nathan Rixham wrote:
 Evening All,
 
 I'd be /really/ interested to know who uses what!
 
 *Procedural or OOP?*
Procedural for small stuff - OOP for larger stuff when using framework

 *Dev OS*
Kubuntu Hardy Heron

 
 *Dev PHP Version*
5.2.4

 
 *Live Server OS*
FC 6

 
 *Live Server PHP Version*
5.1.6

 
 *Which HTTP Server Software (+version)?*
Apache 2

 
 *IDE / Dev Environment*
Aptana for large projects / Kate for files, etc...

 
 *Preferred Framework(s)?*
CakePHP

 
 *Do you Unit Test?*
Huh?

 
 *Most Used Internal PHP Class*
None

 
 *Preferred OS CMS*
PostNuke, mainly because it's what I'm used to

 
 *Anything else you use frequently in you're PHP'ing that's worth
 mentioning:*
 
 ps: I'm not asking for any kind of research project, just interested and
 interested to know what's most common + might learn something/find some
 new tools/toys!
 
 pps: will reply myself as well but if I do here it'll make your
 intertwined replies messy!
 
 Many Regards
 
 Nathan

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



[PHP] Re: PHP Dev Facts

2008-10-16 Thread Nathan Rixham

Here's mine:


*Procedural or OOP?*

OOP


*Dev OS*

Windows Server 2003 EE (sadly - I need some win-only tools!)


*Dev PHP Version*

PHP 5.2.5


*Live Server OS*

Ubuntu + Centos


*Live Server PHP Version*

PHP 5.2.x


*Which HTTP Server Software (+version)?*

Apache 2.2 all round


*IDE / Dev Environment*

Eclipse Ganymede with PDT + svn + bugzilla/mylyn


*Preferred Framework(s)?*
sadly/vainly I'm a roll you're own kinda guy, actually only really carry 
over a set few classes from project to project!



*Do you Unit Test?*

only on mission critical CLI app's to be honest!


*Most Used Internal PHP Class*

Definitely the DOM API - and always using the pcntl and socket extensions


*Preferred OS CMS*
Wordpress for sheer speed of getting a site up, Drupal 6 for 
functionality (but don't actually like it)


*Anything else you use frequently in you're PHP'ing that's worth 
mentioning:*

ARC classes from semsol are rather good (RDF+SPARQL for php)
http://arc.semsol.org/
Always using the Yahoo API's and OpenCalais too (and loving apache SOLR)

Regards!

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



Re: [PHP] PHP Dev Facts

2008-10-16 Thread Eric Butera
On Thu, Oct 16, 2008 at 7:14 PM, Nathan Rixham [EMAIL PROTECTED] wrote:
 Evening All,

 I'd be /really/ interested to know who uses what!

 *Procedural or OOP?*
oop


 *Dev OS*
ubuntu  os x


 *Dev PHP Version*
php 5.2.6


 *Live Server OS*
Mix of Red Hat Enteprise  Debian


 *Live Server PHP Version*
php 5.2.6


 *Which HTTP Server Software (+version)?*
Apache 1.3  2.2.x


 *IDE / Dev Environment*
Eclipse PDT


 *Preferred Framework(s)?*
Zend  My own tools


 *Do you Unit Test?*
Yes with phpunit 3.x (Used to use simpletest until I found all of the
code coverage stuff too nice)


 *Most Used Internal PHP Class*
Iterator or SimpleXML.  Honestly there aren't all that many internal
classes I use.  Usually they're light wrappers to make stuff like
working with images, db's, etc easier.


 *Preferred OS CMS*

 *Anything else you use frequently in you're PHP'ing that's worth
 mentioning:*
svn


 ps: I'm not asking for any kind of research project, just interested and
 interested to know what's most common + might learn something/find some new
 tools/toys!

 pps: will reply myself as well but if I do here it'll make your intertwined
 replies messy!

 Many Regards

 Nathan

 --
 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] PHP Dev Facts

2008-10-16 Thread Daniel Brown
On Thu, Oct 16, 2008 at 7:14 PM, Nathan Rixham [EMAIL PROTECTED] wrote:

 *Procedural or OOP?*
I'm perfectly comfortable with both, but call me old-hat --- I far
prefer procedural.

 *Dev OS*
Loaded question, since - as a small ISP - I generally try to
create an environment that exactly-matches the client's if I can, and
if the project is of a large enough scope to warrant such.  Otherwise,
it'll be CentOS or Mandriva most often.

 *Dev PHP Version*
Again, loaded question, for the same reason.  Never anything newer
or of a different branch than the client's server though, and always
being sure that the code will be compliant with other (recent)
versions of PHP.

 *Live Server OS*
Generally, I use CentOS5.  I've been involved with that project
since 2004, and Mandrake (now Mandriva, of course) since 2002, which
is what I use on the desktop side.

 *Live Server PHP Version*
Usually the latest stable, but depending on the CHANGELOG, I may
delay the installation due to a few important reasons.  Namely: level
of activity (traffic) on the server, what would even possibly cease to
Just Work[tm], et cetera.

 *Which HTTP Server Software (+version)?*
I'm still on the path with Apache2 and - in rarer and rarer
occasions - the 1.3 branch.  I've used a bunch of other servers, and
recently started playing around with Igor Sysoev's NGINX, but aside
from Apache, the only server I've really stood completely by was a
tiny Windows server written by Mark Thompson at AnalogX.  I used to
use it for all of my home-based sites housed on a Win98 box given to
me (including my X10 and speech-over-web development), written in both
Perl and PHP over the years.

 *IDE / Dev Environment*
Vim on CLI.  For everything.  'Nuff said.


   Yeah, that's how serious I am.  'Nuff said.  End transmission.

-- 
/Daniel P. Brown
More full-root dedicated server packages:
Intel 2.4GHz/60GB/512MB/2TB $49.99/mo.
Intel 3.06GHz/80GB/1GB/2TB $59.99/mo.
Intel 2.4GHz/320/GB/1GB/3TB $74.99/mo.
Dedicated servers, VPS, and hosting from $2.50/mo.

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



[PHP] Randomiser

2008-10-16 Thread Andrew Barnett
Hey All,
I'm trying to work out how to randomise the order of a bunch of strings I
have. I know how to pick one random string from a bunch of them, but how do
I make sure that everyone is used just once.

Any pointers on how to do that would be appreciated.

Cheers,
Andrew


Re: [PHP] PHP Dev Facts

2008-10-16 Thread Bastien Koert
On Thu, Oct 16, 2008 at 7:14 PM, Nathan Rixham [EMAIL PROTECTED] wrote:

 Evening All,

 I'd be /really/ interested to know who uses what!

 *Procedural or OOP?*

Both, though while I am still on the fence about OOP in a web based app, I
am trying for the next few apps




 *Dev OS*

Windows @ work
Ubuntu @ home




 *Dev PHP Version*

 5.2.6




 *Live Server OS*

Windows 2003
FC5



 *Live Server PHP Version*

4.x/5 at work
Looking for a new web host for my stuff




 *Which HTTP Server Software (+version)?*

IIS 6 (work)
Apache 2 (everything else)




 *IDE / Dev Environment*

Aptana
Assorted text editors



 *Preferred Framework(s)?*

Cake
Zend
symfony



 *Do you Unit Test?*

Yes, fatal not to



 *Most Used Internal PHP Class*

SimpleXML, PDO, Mysqli



 *Preferred OS CMS*

Wordpress






-- 

Bastien

Cat, the other other white meat


Re: [PHP] Randomiser

2008-10-16 Thread Bastien Koert
On Thu, Oct 16, 2008 at 8:22 PM, Andrew Barnett [EMAIL PROTECTED]wrote:

 Hey All,
 I'm trying to work out how to randomise the order of a bunch of strings I
 have. I know how to pick one random string from a bunch of them, but how do
 I make sure that everyone is used just once.

 Any pointers on how to do that would be appreciated.

 Cheers,
 Andrew


strip it from the array or copy it to another array and check against that
array before issuing the string

-- 

Bastien

Cat, the other other white meat


Re: [PHP] Randomiser

2008-10-16 Thread Chris

Andrew Barnett wrote:

Hey All,
I'm trying to work out how to randomise the order of a bunch of strings I
have. I know how to pick one random string from a bunch of them, but how do
I make sure that everyone is used just once.


$used_strings = array();
while (true) {
  $string = get_random_string();
  if (!isset($used_strings[$string])) {
$used_strings = 1;
break;
  }
}

--
Postgresql  php tutorials
http://www.designmagick.com/


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



Re: [PHP] PHP Dev Facts

2008-10-16 Thread Chris



*Procedural or OOP?*


oo where possible.


*Dev OS*


ubuntu


*Dev PHP Version*


5.2.x (whatever ubuntu supplies at the time)


*Live Server OS*


mix of debian etch, rhel 4/5.


*Live Server PHP Version*


5.1.6 (deb), 5.2.0 i think on rhel.


*Which HTTP Server Software (+version)?*


apache 2.2


*IDE / Dev Environment*


vim.


*Preferred Framework(s)?*


don't have one.


*Do you Unit Test?*


yep.


*Most Used Internal PHP Class*


pdo.


*Preferred OS CMS*


don't have one.

*Anything else you use frequently in you're PHP'ing that's worth 
mentioning:*


version control is a must.

--
Postgresql  php tutorials
http://www.designmagick.com/


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



Re: [PHP] PHP Dev Facts

2008-10-16 Thread Kaleb Pomeroy

On Oct 16, 2008, at 6:14 PM, Nathan Rixham wrote:


Evening All,

I'd be /really/ interested to know who uses what!

*Procedural or OOP?*

OOP Always


*Dev OS*

OS X


*Dev PHP Version*

5.2.x


*Live Server OS*

OpenSuse/Redhat


*Live Server PHP Version*

5.2.x


*Which HTTP Server Software (+version)?*

Apache


*IDE / Dev Environment*

Netbeans 6.5 (beta) for big projects
Textmate for small one offs


*Preferred Framework(s)?*

Home grown + Smarty Templating Engine


*Do you Unit Test?*

heh...


*Preferred OS CMS*

Wordpress for speed, smarty for anything else

*Anything else you use frequently in you're PHP'ing that's worth  
mentioning:*
Not php exactly, but strongly related: JQuery for all javascript/ 
ajax needs




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



[PHP] Re: PHP Dev Facts

2008-10-16 Thread Shawn McKenzie
Shawn McKenzie wrote:
 Nathan Rixham wrote:
 Evening All,

 I'd be /really/ interested to know who uses what!

 *Procedural or OOP?*
 Procedural for small stuff - OOP for larger stuff when using framework
 
 *Dev OS*
 Kubuntu Hardy Heron
 
 *Dev PHP Version*
 5.2.4
currently (whatever is current for os)
 
 *Live Server OS*
 FC 6
 
 *Live Server PHP Version*
 5.1.6
 
 *Which HTTP Server Software (+version)?*
 Apache 2
2.2 actually
 
 *IDE / Dev Environment*
 Aptana for large projects / Kate for files, etc...
 
 *Preferred Framework(s)?*
 CakePHP
 
 *Do you Unit Test?*
 Huh?
 
 *Most Used Internal PHP Class*
 None
 
 *Preferred OS CMS*
 PostNuke, mainly because it's what I'm used to
 
 *Anything else you use frequently in you're PHP'ing that's worth
 mentioning:*
As I saw other posts, it triggered SVN.  I even use it locally.  Never
know when you'll do something stupid that doesn't show up for a while
and you need to go back in time.

 ps: I'm not asking for any kind of research project, just interested and
 interested to know what's most common + might learn something/find some
 new tools/toys!

 pps: will reply myself as well but if I do here it'll make your
 intertwined replies messy!

 Many Regards

 Nathan

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



Re: [PHP] PHP Dev Facts

2008-10-16 Thread Robert Cummings
On Fri, 2008-10-17 at 00:14 +0100, Nathan Rixham wrote:
 Evening All,
 
 I'd be /really/ interested to know who uses what!
 
 *Procedural or OOP?*

Primarily OOP, occasionally procedural for some one off quick access
functions. InterJinn will also generate anonymous procedural code.

 *Dev OS*

Ubuntu Hardy-- I usually upgrade a couple of months after a new release
comes out and has had a chance to stabilize. Almost everytime I get
caught with some gotcha for my system :)

 *Dev PHP Version*

5.2.6 with occasional reversion to 4.4.9. Sometimes I also download
nightly snapshot.

 *Live Server OS*

Debian Sarge/Etch/Lenny
CentOS 4/5
RHEL3
RH 7.3 (valhalla)
Solaris

 *Live Server PHP Version*

I can't remember them all. Some are strictly based on the distro release
cycle. Some are custom compiled and so usually are the latest version.

 *Which HTTP Server Software (+version)?*

Apache 1.3
Apache 2
Zeus

 *IDE / Dev Environment*

Several rxvt-unicode terminal windows. JOE for my editor. Opera browser
for primary visual testing. Firefox for stickier testing (Firebug).
Windows via vmware for final cross-browser checks in IE.

 *Preferred Framework(s)?*

Need i say? :)

 *Do you Unit Test?*

No. Clients don't pay me to unit test. I'm not against it, but it hasn't
been an issue for them yet.

 *Most Used Internal PHP Class*

I don't use any internal classes on a regular basis. I think I've only
ever used one... tidy.

 *Preferred OS CMS*

No preference. I'm comfortable in a wide range and quickly pick up on
new codebases when necessary.

 *Anything else you use frequently in you're PHP'ing that's worth 
 mentioning:*

Accelerator... I use eAccelerator.

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



[PHP] Re: PHP Dev Facts

2008-10-16 Thread Ross McKay
On Fri, 17 Oct 2008 00:14:18 +0100, Nathan Rixham wrote:

*Procedural or OOP?*

OOP, except really small stuff.

*Dev OS*

Fedora 9

*Dev PHP Version*

5.2.6

*Live Server OS*

Hosted services - var. Linux, Windows 2003 Server

*Live Server PHP Version*

Mostly 5.2.3+, some 4.x (haven't looked lately) but I imagine even the
worst of those hosts will upgrade soon, or die.

*Which HTTP Server Software (+version)?*

Apache 2.2 on Linux, IIS 6.0 on Windows

*IDE / Dev Environment*

Geany, mostly

*Preferred Framework(s)?*

Prefer small code libraries over large frameworks. Otherwise, I'd be
writing Java or .NET, eh?

*Do you Unit Test?*

Yes.

*Most Used Internal PHP Class*

A MySQL wrapper - needed it for a PITA host once, still easier / lighter
than others (although PDO, adodb interest me)

*Preferred OS CMS*

Joomla is great, SilverStripe is nicer but I have yet to use it in
anger.

*Anything else you use frequently in you're PHP'ing that's worth 
mentioning:*

* iepngfix.htc - lets me use PNG with alpha channels in IE6
* csshover.htc - lets me do pure-CSS fly-out menus
* tinymce - lets me do rich-text editing for admin pages (simple CMS)
* KVM - lets me test in IE6/IE7 without having to reboot into Windows
* Subversion - because I value my time :)
* Meld - because I value my sanity! (graphical diff/merge)
-- 
Ross McKay, Toronto, NSW Australia
Before enlightenment: chop wood, carry water;
 After enlightenment: chop wood, carry water - Wu Li

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



[PHP] Re: PHP Dev Facts

2008-10-16 Thread ANR Daemon
Greetings, Nathan Rixham.
In reply to Your message dated Friday, October 17, 2008, 3:14:18,

 *Procedural or OOP?*

whatever feels applicable.

 *Dev OS*

Win2k, Server 2003

 *Dev PHP Version*

5.2.6

 *Live Server OS*

Whatever.

 *Live Server PHP Version*
5.1.6, 5.2.4, 5.2.6


 *Which HTTP Server Software (+version)?*
Apache all around, 2.2

 *IDE / Dev Environment*
FAR Manager, it's all. farmanager.com

 *Preferred Framework(s)?*
My own, PEAR, Smarty

 *Do you Unit Test?*
If only someone explained it to me... I'd like to do.
But I do use some testing schemes. Don't know how they can be classified.

 *Most Used Internal PHP Class*
Exception?

 *Preferred OS CMS*


 *Anything else you use frequently in you're PHP'ing that's worth 
 mentioning:*
Can't live without cygwin. cygwin.com
I should also mention Colorer project, without which it all would be much more
complicated. http://colorer.sf.net/ (Yeah, it is very much complicated itself,
I know...)


-- 
Sincerely Yours, ANR Daemon [EMAIL PROTECTED]


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