php-general Digest 29 Dec 2008 12:39:22 -0000 Issue 5871

Topics (messages 285171 through 285191):

Re: What does <?xml have to do with it?
        285171 by: tedd

Re: system() Question
        285172 by: Daniel Brown
        285174 by: Nathan Nobbe
        285178 by: Micah Gersten
        285179 by: Nathan Nobbe

Re: is_readable(http://.... text file) says not, but I can in browser
        285173 by: Daniel Brown

Re: Read Form values prior to submit?
        285175 by: Manuel Lemos

Re: turn shared hosting server to external image storage hosting
        285176 by: Manuel Lemos
        285177 by: Nathan Nobbe

Re: Architecture patterns in PHP
        285180 by: Manuel Lemos
        285181 by: Carlos Medina
        285182 by: Nathan Nobbe

Re: imap_rfc822_parse_adrlist problem
        285183 by: ceo.l-i-e.com

Re: Segmentation fault in php5-imap
        285184 by: ceo.l-i-e.com

Re: Problem with fetching values...
        285185 by: Michelle Konzack
        285188 by: Larry Garfield
        285191 by: chris smith

Re: Where I can find the PHP5 grammar/specification?
        285186 by: ceo.l-i-e.com

Offline PDO documentation?
        285187 by: Michelle Konzack
        285189 by: chris smith
        285190 by: Michelle Konzack

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscr...@lists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscr...@lists.php.net

To post to the list, e-mail:
        php-gene...@lists.php.net


----------------------------------------------------------------------
--- Begin Message ---
At 6:06 PM +0000 12/28/08, Benjamin Hawkes-Lewis wrote:
On 28/12/08 16:47, Jim Lucas wrote:
short tags are enabled. Disable them in your php.ini file and you will be good.

Alternately:

<?php
echo '<?xml version="1.0" encoding="UTF-8" ?>';
?>

--
Benjamin Hawkes-Lewis

Bingo -- we have a winner!

Thanks Benjamin -- that works without me having to fix the short tag in the php init file, which I'm really fuzzy about doing anyway.

Cheers,

tedd

--
-------
http://sperling.com  http://ancientstones.com  http://earthstones.com

--- End Message ---
--- Begin Message ---
On Sun, Dec 28, 2008 at 18:10, Rick Pasotto <r...@niof.net> wrote:
>
> You overlooked the ampersand in front of $retval. The syntax for
> 'system' is:
>
> string system  ( string $command  [, int &$return_var  ] )
>
> You have to pass a pointer to the variable, not the variable itself.

    Actually, that's not entirely correct.... while the documentation
shows it as a reference variable, it's not actually required to be a
pointer.  And in either case, the OP had the error code returned
(127), and $retval would have nothing to do with causing the error.

    What I would recommend trying is:

<?php
    exec('./gpsbabel -p "" -r -t -i gpx -f "test.gpx" -o kml -F
"test2.kml" 2>&1',$ret);
    print_r($ret);
?>

    On a side note, I'm curious as to what 'gpsbabel' does.  I've
worked a bit with Keyhole markups and GIS overlays, etc.  Neat stuff.

-- 
</Daniel P. Brown>
daniel.br...@parasane.net || danbr...@php.net
http://www.parasane.net/ || http://www.pilotpig.net/
Unadvertised dedicated server deals, too low to print - email me to find out!

--- End Message ---
--- Begin Message ---
On Sun, Dec 28, 2008 at 6:49 PM, Daniel Brown <danbr...@php.net> wrote:

> On Sun, Dec 28, 2008 at 18:10, Rick Pasotto <r...@niof.net> wrote:
> >
> > You overlooked the ampersand in front of $retval. The syntax for
> > 'system' is:
> >
> > string system  ( string $command  [, int &$return_var  ] )
> >
> > You have to pass a pointer to the variable, not the variable itself.
>
>     Actually, that's not entirely correct.... while the documentation
> shows it as a reference variable, it's not actually required to be a
> pointer.


good point dan, and just to add further clarification, thats b/c the
function specifies $return_var is passed by reference in the formal
parameter.  when you include the & along w/ an actual parameter (during
function invocation) thats referred to as call-time-pass-by-reference in
php, and its typically frowned upon.  in fact, i think its being removed
from a future version of php.

-nathan

--- End Message ---
--- Begin Message ---
Nathan Nobbe wrote:
> good point dan, and just to add further clarification, thats b/c the
> function specifies $return_var is passed by reference in the formal
> parameter.  when you include the & along w/ an actual parameter (during
> function invocation) thats referred to as call-time-pass-by-reference in
> php, and its typically frowned upon.  in fact, i think its being removed
> from a future version of php.
>
> -nathan
>
>   
You don't call system using the ampersand.  The reference is declared in
the function definition.  There's no reason for this to be frowned
upon.   What you are referring to is the old PHP4 style of explicit
pass-by-reference in function usage which is frowned upon.

Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com


--- End Message ---
--- Begin Message ---
On Sun, Dec 28, 2008 at 8:40 PM, Micah Gersten <mi...@onshore.com> wrote:

> Nathan Nobbe wrote:
> > good point dan, and just to add further clarification, thats b/c the
> > function specifies $return_var is passed by reference in the formal
> > parameter.  when you include the & along w/ an actual parameter (during
> > function invocation) thats referred to as call-time-pass-by-reference in
> > php, and its typically frowned upon.  in fact, i think its being removed
> > from a future version of php.
> >
> > -nathan
> >
> >
> You don't call system using the ampersand.  The reference is declared in
> the function definition.  There's no reason for this to be frowned
> upon.


well i dont think they deprecated it for shits-&-giggles.

http://us.php.net/manual/en/language.references.pass.php

its disabled by default in php.ini; wonder why.. ;)


>   What you are referring to is the old PHP4 style of explicit
> pass-by-reference in function usage which is frowned upon.


no im referring to call-time-pass by reference, which works just as well in
php5; as long as you enable it in php.ini (or one of the other various
ways).

and also, for clarification, marking parameters as pass-by-reference works
during method definition in php4 as well, of course.

-nathan

--- End Message ---
--- Begin Message ---
On Sun, Dec 28, 2008 at 13:02, John Allsopp <j...@johnallsopp.co.uk> wrote:
>
>       $myFileLast = "http://www.myDomain.com/text.txt";;
>       if (is_readable($myFileLast))
>       {
>           $fh = fopen($myFileLast, 'r');
>           $theDataLast = fread($fh, 200);
>           fclose($fh);
>           echo ("The dataLast: ".$theDataLast."<br>\n");
>       } else
>       {
>           echo ("Last fix file unavailable: $myFileLast<br>\n");
>       }

    Simplified:

<?php
    $myFileLast = "http://www.myDomain.com/text.txt";;
    $theDataLast = file_get_contents($myFileLast);
?>

    You can manipulate the code as you see fit.  If it doesn't work,
then check your php.ini file (if you have access) to ensure that you
have this line:

        allow_url_fopen = On

-- 
</Daniel P. Brown>
daniel.br...@parasane.net || danbr...@php.net
http://www.parasane.net/ || http://www.pilotpig.net/
Unadvertised dedicated server deals, too low to print - email me to find out!

--- End Message ---
--- Begin Message ---
Hello,

on 12/28/2008 01:41 PM Tim Rude said the following:
> Using PHP, is there a way for me to read the values that a user has
> entered into the text fields of a <FORM> prior to the user clicking the
> submit button?
> 
> Essentially what I want to do is make sure the user has filled in all
> three text fields on my form before allowing it to be submitted [to a
> third party website].

You may want to try this forms generation and validation class. It can
perform both server side and browser side validations by generating the
necessary Javascript (so you do not have to learn it too much) using a
single definition of the validations you want.

http://www.phpclasses.org/formsgeneration

Here is a live demo form:

http://www.meta-language.net/forms-examples.html?example=test_form


-- 

Regards,
Manuel Lemos

Find and post PHP jobs
http://www.phpclasses.org/jobs/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

--- End Message ---
--- Begin Message ---
Hello,

on 12/28/2008 11:37 AM paragasu said the following:
> do you have any idea how to do this. i have a small vps about 10GB
> space. i live somewhere is south east asia where solutions like Amazon
> S3 is incredibly slow. (500ms ping time).
> 
> i have a simple php gallery. But dedicated server is quite expensive
> ($100/month). searching around, i found several local hosting
> companies provide a very cheap shared hosting. ($100 / year, 300GB).
> local server with 40ms ping time.
> 
> i am interested to use that shared hosting just as storage for images
> of my gallery and a cheap vps to store the database.
> 
> What is the best way for me to accomplish this? Amazon S3 using REST
> etc. Is it possible to write a simple storage (REST system) like
> amazon s3 in PHP? is there anyone wrote this before. I am interested
> in your solutions..

Amazon released a CDN (Content Delivery Network) that expands S3 to
serve files closer to different world regions.

http://aws.amazon.com/cloudfront/

-- 

Regards,
Manuel Lemos

Find and post PHP jobs
http://www.phpclasses.org/jobs/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

--- End Message ---
--- Begin Message ---
On Sun, Dec 28, 2008 at 6:37 AM, paragasu <parag...@gmail.com> wrote:

> do you have any idea how to do this. i have a small vps about 10GB
> space. i live somewhere is south east asia where solutions like Amazon
> S3 is incredibly slow. (500ms ping time).
>
> i have a simple php gallery. But dedicated server is quite expensive
> ($100/month). searching around, i found several local hosting
> companies provide a very cheap shared hosting. ($100 / year, 300GB).
> local server with 40ms ping time.
>
> i am interested to use that shared hosting just as storage for images
> of my gallery and a cheap vps to store the database.
>
> What is the best way for me to accomplish this? Amazon S3 using REST
> etc. Is it possible to write a simple storage (REST system) like
> amazon s3 in PHP? is there anyone wrote this before. I am interested
> in your solutions..


have you tried photobucket ?  we have an api in php which is freely
available and we use a CDN for caching all around the globe.  in fact, id be
interested to find out how it stacks up over there, in your neck of the
woods.

-nathan

--- End Message ---
--- Begin Message ---
Hello,

on 12/27/2008 09:40 PM Michael C. Yates said the following:
> How do you structure your web applications? I am thinking in terms of
> separating presentation  and logic. How is that done in PHP? And how
> many architecture patterns are there?

I use the Use Case Mapping as methodology to implement Web applications
in PHP since 1999 .

It does not mean that this is necessarily the best Web development
methodology, nor that you could not use another methodology that you may
prefer.

It is a methodology that I have been using for developing PHP Web
applications with very satisfactory productivity results. I have been
using it since 1999, when Object Oriented Programming support was added
to PHP 3. Over time, it has been refined to address better the real
world needs of sites of growing complexity.

This methodology has been used extensively to develop busy sites like
the PHPClasses repository. Therefore, it has proven to be suitable to
develop enterprise grade Web applications. It does not impose
excessively complex development procedures. So, it is also suitable for
developing small Web applications.

You may want to read this document that explains what are use cases in
the scope of a well structured project and the methodology that
describes how map use cases to PHP code for Web applications.

http://www.meta-language.net/metastorage-example.html


-- 

Regards,
Manuel Lemos

Find and post PHP jobs
http://www.phpclasses.org/jobs/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

--- End Message ---
--- Begin Message ---
Manuel Lemos schrieb:
Hello,

on 12/27/2008 09:40 PM Michael C. Yates said the following:
How do you structure your web applications? I am thinking in terms of
separating presentation  and logic. How is that done in PHP? And how
many architecture patterns are there?

I use the Use Case Mapping as methodology to implement Web applications
in PHP since 1999 .

It does not mean that this is necessarily the best Web development
methodology, nor that you could not use another methodology that you may
prefer.

It is a methodology that I have been using for developing PHP Web
applications with very satisfactory productivity results. I have been
using it since 1999, when Object Oriented Programming support was added
to PHP 3. Over time, it has been refined to address better the real
world needs of sites of growing complexity.

This methodology has been used extensively to develop busy sites like
the PHPClasses repository. Therefore, it has proven to be suitable to
develop enterprise grade Web applications. It does not impose
excessively complex development procedures. So, it is also suitable for
developing small Web applications.

You may want to read this document that explains what are use cases in
the scope of a well structured project and the methodology that
describes how map use cases to PHP code for Web applications.

http://www.meta-language.net/metastorage-example.html



Hi all,
I can not understand what is the Target of this question like "Architecture Patterns in PHP". This is for me like the question, "what is your favorite IDE". If i need to know about design Patterns in PHP, then i can buy a book about it or i search the Internet for my information.

Regards

Carlos

--- End Message ---
--- Begin Message ---
On Mon, Dec 29, 2008 at 12:01 AM, Carlos Medina <i...@simply-networks.de>wrote:

> Manuel Lemos schrieb:
>
>> Hello,
>>
>> on 12/27/2008 09:40 PM Michael C. Yates said the following:
>>
>>> How do you structure your web applications? I am thinking in terms of
>>> separating presentation  and logic. How is that done in PHP? And how
>>> many architecture patterns are there?
>>>
>>
>> I use the Use Case Mapping as methodology to implement Web applications
>> in PHP since 1999 .
>>
>> It does not mean that this is necessarily the best Web development
>> methodology, nor that you could not use another methodology that you may
>> prefer.
>>
>> It is a methodology that I have been using for developing PHP Web
>> applications with very satisfactory productivity results. I have been
>> using it since 1999, when Object Oriented Programming support was added
>> to PHP 3. Over time, it has been refined to address better the real
>> world needs of sites of growing complexity.
>>
>> This methodology has been used extensively to develop busy sites like
>> the PHPClasses repository. Therefore, it has proven to be suitable to
>> develop enterprise grade Web applications. It does not impose
>> excessively complex development procedures. So, it is also suitable for
>> developing small Web applications.
>>
>> You may want to read this document that explains what are use cases in
>> the scope of a well structured project and the methodology that
>> describes how map use cases to PHP code for Web applications.
>>
>> http://www.meta-language.net/metastorage-example.html
>>
>>
>>
> Hi all,
> I can not understand what is the Target of this question like "Architecture
> Patterns in PHP". This is for me like the question, "what is your favorite
> IDE". If i need to know about design Patterns in PHP, then i can buy a book
> about it or i search the Internet for my information.


i find this list to me a most excellent supplement to these other resources,
in fact in many ways its often times better.

this topic is no less relevant than most ive seen since ive joined the list,
which most likely is the reason for the several long, well thought
responses.

-nathan

-nathan

--- End Message ---
--- Begin Message ---
File a bug report at

http://bugs.php.net



You have a pretty clear-cut case of a built-in function gone awry, and it will 
probably be fixed pretty fast.



I also rely on this function quite a bit, so it needs to work right when I end 
up at 5.2.8 some day :-)





________________________________________

From: Ben Stuyts [...@altesco.nl]

Sent: Sunday, December 21, 2008 7:12 AM

To: Manuel Lemos

Cc: php-gene...@lists.php.net

Subject: Re: [PHP] Re: imap_rfc822_parse_adrlist problem



Hi,



On 21 dec 2008, at 03:41, Manuel Lemos wrote:



> on 12/20/2008 09:34 PM Ben Stuyts said the following:

>> Hi,

>>

>> Since upgrading to php 5.2.8 I have a problem with

>> imap_rfc822_parse_adrlist. When I run the example given on the manual

>> page at http://nl3.php.net/imap_rfc822_parse_adrlist:

>> ...

>> So the host part isn't filled in correctly. I have verified this on

>> two

>> FreeBSD 7 machines. On an older FreeBSD 5 machine with php4 this

>> works

>> fine. Before the update, I was running php 5.2.6 and there was no

>> problem either. Any ideas?

>

> Sometime ago I decided to not use IMAP library functions to parse e-

> mail

> addresses because it was not handling all sorts of addresses as it

> should.



Well, yeah, ok, I read about the problems imap_rfc822_parse_adrlist()

has, but shouldn't it just work at least as advertized in the manual?

Plus, this is breaking an existing application (Twiggi).



> Nowadays I use an e-mail address parser class written in pure PHP that

> comes with this MIME parser class:

>

> http://www.phpclasses.org/mimeparser



Thanks, I'll have a look at that.



Ben





--

PHP General Mailing List (http://www.php.net/)

To unsubscribe, visit: http://www.php.net/unsub.php





--- End Message ---
--- Begin Message ---
Perhaps compile everything in debug versions and get some core dumps and file a 
bug report at http://bugs.php.net/



--- End Message ---
--- Begin Message ---
Am 2008-12-28 16:11:15, schrieb Nathan Nobbe:
> OK.  i would stop right there and ask yourself why..  there are tons of
> stable, working solutions out there that already do this, most notably for
> php5, PDO,
> 
> http://us.php.net/manual/en/pdo.drivers.php
> 
> which btw, is written in C ;)

I have tried to test it...

The problem is now, that none of my 4 Hosting provider support it.  :-/

Thanks, Greetings and nice Day/Evening
    Michelle Konzack
    Systemadministrator
    24V Electronic Engineer
    Tamay Dogan Network
    Debian GNU/Linux Consultant


-- 
Linux-User #280138 with the Linux Counter, http://counter.li.org/
##################### Debian GNU/Linux Consultant #####################
<http://www.tamay-dogan.net/>               <http://www.can4linux.org/>
Michelle Konzack   Apt. 917                  ICQ #328449886
+49/177/9351947    50, rue de Soultz         MSN LinuxMichi
+33/6/61925193     67100 Strasbourg/France   IRC #Debian (irc.icq.com)

Attachment: signature.pgp
Description: Digital signature


--- End Message ---
--- Begin Message ---
On Monday 29 December 2008 2:26:46 am Michelle Konzack wrote:
> Am 2008-12-28 16:11:15, schrieb Nathan Nobbe:
> > OK.  i would stop right there and ask yourself why..  there are tons of
> > stable, working solutions out there that already do this, most notably
> > for php5, PDO,
> >
> > http://us.php.net/manual/en/pdo.drivers.php
> >
> > which btw, is written in C ;)
>
> I have tried to test it...
>
> The problem is now, that none of my 4 Hosting provider support it.  :-/

Then you seriously need new hosting providers.  PDO is part of the standard 
install for PHP5, and there is simply no excuse for a web host to not support 
it.  You can try contacting them first to ask them to enable it, and if they 
say no, you say "go away".  Really, that's simply irresponsible on their part.

-- 
Larry Garfield
la...@garfieldtech.com

--- End Message ---
--- Begin Message ---
> So, PostgreSQL catch the array by "name"
>
>    pg_fetch_array($db_query, null, PGSQL_ASSOC)
>
> and MySQL use the "position"
>
>    mysql_fetch_array($db_query, MYSQL_NUM)

Why?

http://www.php.net/mysql_fetch_array

Use MYSQL_ASSOC as the 2nd param, or leave it out and by default it uses BOTH.

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

--- End Message ---
--- Begin Message ---
The PHP source uses bison/flex, I believe, so that's your best bet for finding 
the grammar.



Chris Shifflet (sp?) mentioned the other day somewhere that he was considering 
soon releasing some code that he uses in security audits for the boring grunt 
work part.



You may want to try to follow up with him.



He'd certainly be interested in your work, almost for sure, even if he missed 
your message due to holiday schedules.



[I'm replying rather late for that reason myself...]



--- End Message ---
--- Begin Message ---
Hello,

In my PHP5 documetation I have installed on my system PDO is  mentioned,
but the files are missing...

While surfing <php.net> I have not found the PDO part which I need  Off-
Line since I am on GSM and surfing/searchin the  internet  is  sometimes
the hell.

Can someone point me to the tar archive for the PDO documentation please?

Thanks, Greetings and nice Day/Evening
    Michelle Konzack
    Systemadministrator
    24V Electronic Engineer
    Tamay Dogan Network
    Debian GNU/Linux Consultant


-- 
Linux-User #280138 with the Linux Counter, http://counter.li.org/
##################### Debian GNU/Linux Consultant #####################
<http://www.tamay-dogan.net/>               <http://www.can4linux.org/>
Michelle Konzack   Apt. 917                  ICQ #328449886
+49/177/9351947    50, rue de Soultz         MSN LinuxMichi
+33/6/61925193     67100 Strasbourg/France   IRC #Debian (irc.icq.com)

Attachment: signature.pgp
Description: Digital signature


--- End Message ---
--- Begin Message ---
On Mon, Dec 29, 2008 at 6:28 PM, Michelle Konzack
<linux4miche...@tamay-dogan.net> wrote:
> Hello,
>
> In my PHP5 documetation I have installed on my system PDO is  mentioned,
> but the files are missing...
>
> While surfing <php.net> I have not found the PDO part which I need  Off-
> Line since I am on GSM and surfing/searchin the  internet  is  sometimes
> the hell.
>
> Can someone point me to the tar archive for the PDO documentation please?

You can download the whole php.net docs:

http://www.php.net/download-docs.php

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

--- End Message ---
--- Begin Message ---
Am 2008-12-29 20:08:40, schrieb chris smith:
> You can download the whole php.net docs:
> 
> http://www.php.net/download-docs.php

Grrr, while I was checking which version I have on my intranet server, I
have encountered it was the one from "2007-05-01"...  and  a  newer  TAR
Archive was laying arround and never extracted!  :-/

However, I have installed the latest one from "2008-12-26" downloaded
for one minute...  Great, it was fresh uploaded for 3 days...

Thanks, Greetings and nice Day/Evening
    Michelle Konzack
    Systemadministrator
    24V Electronic Engineer
    Tamay Dogan Network
    Debian GNU/Linux Consultant


-- 
Linux-User #280138 with the Linux Counter, http://counter.li.org/
##################### Debian GNU/Linux Consultant #####################
<http://www.tamay-dogan.net/>               <http://www.can4linux.org/>
Michelle Konzack   Apt. 917                  ICQ #328449886
+49/177/9351947    50, rue de Soultz         MSN LinuxMichi
+33/6/61925193     67100 Strasbourg/France   IRC #Debian (irc.icq.com)

Attachment: signature.pgp
Description: Digital signature


--- End Message ---

Reply via email to