OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
php-general Digest 4 Aug 2006 04:54:26 -0000 Issue 4273

php-general-digest-helplists.php.net
Date: Thu Aug 03 2006 - 23:54:26 CDT


php-general Digest 4 Aug 2006 04:54:26 -0000 Issue 4273

Topics (messages 240053 through 240094):

Re: Issue regarding flow in php
        240053 by: Richard Lynch

Re: Dynamic Images
        240054 by: Richard Lynch

Re: Retrieving response headers from an off-site page
        240055 by: Richard Lynch

Re: dynamically generated rotating gif
        240056 by: Richard Lynch
        240065 by: Manuel Lemos

Re: PHP Frameworks - Opinion
        240057 by: Richard Lynch
        240063 by: Manuel Lemos
        240066 by: Manuel Lemos
        240067 by: Manuel Lemos
        240068 by: Manuel Lemos
        240069 by: Robert Cummings
        240070 by: Robert Cummings
        240071 by: Kilbride, James P.
        240072 by: Jonathan Duncan
        240082 by: Martin Alterisio
        240086 by: Matt Todd
        240091 by: Jens Kleikamp
        240092 by: Jonathan Duncan

Re: link problem
        240058 by: Richard Lynch

Re: Issues with PHP 5.1.4 / GD FreeType / Linux
        240059 by: Richard Lynch

Re: memory leak - how to find it?
        240060 by: Richard Lynch

Re: What good are constants if you can't use them in an array?
        240061 by: John Nichel

Re: Nested foreach statement
        240062 by: Richard Lynch

automated gui testing of php apps
        240064 by: blackwater dev

Re: sorting in array
        240073 by: Richard Lynch

Re: Saving a dynamic file
        240074 by: Richard Lynch

Re: include defer from cli to apache
        240075 by: Richard Lynch

Re: POST on redirects?
        240076 by: Richard Lynch
        240084 by: Adam Zey

Re: Postcode proximity classes
        240077 by: Richard Lynch
        240083 by: tedd
        240085 by: tedd

Re: More about fpdf
        240078 by: Richard Lynch

Re: non blocking fsockopen
        240079 by: Richard Lynch

Re: running commands sequentially in background with exec($commands_in_background)
        240080 by: Richard Lynch

Re: Return Values Copied? Copied if By Reference?
        240081 by: Richard Lynch

Re: problem using &&
        240087 by: Richard Lynch

Re: convert byte to MB
        240088 by: Porpoise
        240089 by: Adam Zey

Re: Is this a PHP issue, or a CGI issue? [SOLVED]
        240090 by: Dave M G

The difference between ereg and preg?
        240093 by: Dave M G
        240094 by: Ligaya Turmelle

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscribelists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscribelists.php.net

To post to the list, e-mail:
        php-generallists.php.net

----------------------------------------------------------------------

attached mail follows:


On Thu, August 3, 2006 1:53 am, weetat wrote:
> I have a php page .
>
> The php page is display when i have completed upload xml file to
> server.
> In the php page , there is a function name
> insertxmldataToTempTbl(),
> which insert xml data to MYSQL database as shown below after i have
> uploaded xml file to server ,
> After insert xml data to MYSQL , i have function name
> compareTable()which do comparisation between the table A(XML data
> inserted) and table B(User data table)and store comparisation array
> data
> to the $_SESSION .
>
> However , sometimes when completed uploaded to xml file to server, the
> data is not display on the php page . I need to logout and login again
> then i can see the data on the same php page.
> PHP developer who have any ideas or suggestion , please email to me?

My best guess is that the upload and/or insert and/or compare takes
'too long' and the browser and/or your session is timing out.

Unless all this upload and compare is done in a matter of a couple
seconds, you'd be better off to do the upload, and then have a
"status" page to check back later for the comparison.

--
Like Music?
http://l-i-e.com/artists.htm

attached mail follows:


On Wed, August 2, 2006 7:12 pm, Jochem Maas wrote:
>> The best solution to this is to change your IMG tag to have a random
>> number in it, so that the cached image is never the same URL, so it
>> never gets used.
>>
>> Stupid, I know, and wasteful of the browser cache disk space, but
>> there it is. It works.
>
> nevermind their diskspace, what about my bandwidth? - do I really need
> to
> cough up extra readies because some muppet refused to exchange his AOL
> connection for something resembling a proper ISP?

If you want to drop support of dynamic images for the zillion AOHell
users because it is uneconomical, that's fine with me.

> granted yours is pragmatic solution to the problem but should we
> support
> shit ISPs, proxies and sunday-driver browser-wannabees with
> our/our-clients
> cash?

Well since I did this to work around bugs in various versions of IE
back in the day, it's not just browser-wannabes.

"Fred's Warehouse Browser" was merely the extreme example to avoid the
argument of supporting (or not) what some would consider legacy
browsers.

Bottom line, though, is that if you want the IMG to be always up to
date in ALL browsers, reliably, there is no combination of header()
calls that will work.

The random IMG tag will work reliably, unless the browser is so
badly-broken that it's not even "alpha" software yet.

Note that you would *ONLY* do this for dynamic images which,
presumably, you *WANT* to dedicate the bandwidth/$$$ for the
up-to-date image to be available to the user.

You could, of course, use a time-stamp cache mechanism where you would
use the unique IMG URL of the most recently generated image, and then
your bandwidth could be one (cached) image per minute, or 5 minutes,
or hour or whatever is suitable.

My main point is that if you do NOT want the image cached, then don't
use the same URL for it, and using header() is simply not going to
work, no matter what combination of header() calls you use.

PS
Please, all, for the love of [deity], don't reply to me with a post
claiming that you use header(x);header(y);header(z) and it "works"
unless you have tested, as I have, in every minor release version of
every browser since IE/NS 3.0, as well as the AT&T re-branded IE 4.7
browser (used by AT&T employees) which does not behave the same as the
exact same version of IE 4.7 that is on the open market...
Been there; done that.

--
Like Music?
http://l-i-e.com/artists.htm

attached mail follows:


On Mon, July 31, 2006 5:36 pm, John Gunther wrote:
> I'm trying to programatically retrieve a sales tax lookup page using
> file_get_contents() but the page doesn't return data unless a session
> id
> is first retrieved and then supplied.

http://php.net/curl
is probably the easiest way to get/send the cookies you need to make
this work.

--
Like Music?
http://l-i-e.com/artists.htm

attached mail follows:


On Mon, July 31, 2006 5:21 pm, Paul Nowosielski wrote:
> I'm trying to create a dynamically generated rotating gif.
> I want to add layers of text from a database to the image.
>
> Is this possible? If so , can someone give me some pointers or a link
> to a good class or tutorial please?

I *believe* the current state of the art on this stands as follows:

GD now supports animated GIFs.
PHP does not (yet) have the GD functions in its GD extension.

So your two simplest options I can see are:

#1. Add the GD animated GIF functions to PHP source and submit it as a
patch.

#2. Create the individual frames in GD, and then use
http://php.net/exec with ImageMagick (or similar) to composit the
individual frames into a single animated GIF.

I haven't actually LOOKED at the GD section of the manual in a while,
so maybe the animation functions have been added...

--
Like Music?
http://l-i-e.com/artists.htm

attached mail follows:


Hello,

On Mon, July 31, 2006 5:21 pm, Paul Nowosielski wrote:
> I'm trying to create a dynamically generated rotating gif.
> I want to add layers of text from a database to the image.
>
> Is this possible? If so , can someone give me some pointers or a link
> to a good class or tutorial please?

This class does exactly that. You can build an animated GIF from several
 normal GIF image frames:

http://www.phpclasses.org/gifmerge

--

Regards,
Manuel Lemos

Metastorage - Data object relational mapping layer generator
http://www.metastorage.net/

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

attached mail follows:


On Wed, August 2, 2006 9:50 am, Gabe wrote:
> Gabe wrote:
>> What's the common consensus as to a solid PHP framework to use for
>> application development? There seems to be a number of them out
>> there,
>> but I'm not sure which one's are the most robust, actively
>> developed,
>> secure, etc etc.
>>
>> Thoughts?
>
> Sounds like it's just personal preference. But thanks for all the
> posts!
>
> Too bad there isn't a skeleton sort-of system that you essentially
> then
> just plug in the modules that you want/need to "flesh" it out. Then
> you'd have your own customized framework for each app that is
> developed
> and keeps *all* of the modules relevant to that app. Nothing extra
> would be included that isn't needed.
>
> Then as a developer all you're looking for is modules and not huge
> frameworks that may include lots of functionality that you don't have
> any interest in. It would certainly keep any attack surface smaller
> when it comes to vulnerabilities.

It's arguable that using a highly popular framework makes your attack
surface larger.

The Bad Guys would MUCH rather have a hack that they can use to attack
a million sites than one that would only work on one of my stupid
little sites that nobody visits and nobody cares about anyway.

> Is there anything out there like that?

You may want to look at Drupal, Cake, PHPNuke, Smarty, ...

The list is endless, really, with a dizzying array of different features.

And you're not going to get any kind of concensus on this one at this
time, and probably not for the forseeable future.

--
Like Music?
http://l-i-e.com/artists.htm

attached mail follows:


Hello,

on 08/03/2006 02:01 AM Robert Cummings said the following:
>>>> Anyway, you may want to read this more in depth reflection of the state
>>>> of the PHP framework world and recommendations on how to pick what suits
>>>> best for you:
>>>>
>>>> http://www.phpclasses.org/blog/post/52-Recommended-PHP-frameworks.html
>>> I've read it before... it was crud. You provide no recommendation for
>>> any framework but instead try to pimp phpclasses. From what I gathered
>>> you haven't even actually tried anywhere in the vicinity of 10% of the
>>> frameworks in existence and yet you feel obliged to write a commenatary
>>> called "Recommended PHP Frameworks" in which you don't even recommend a
>>> framework. Additionally somehow while pimping phpclasses you also feel
>>> it necessary to indicate how you don't use any code other than what you
>>> write yourself. Egads, if you won't use the code on your site why the
>>> hell should anyone else?
>> The answer to that question is in the post. I only use my own (PHP)
>> packages because I can. Not everybody can afford writing package for
>> their own needs from scratch.
>>
>> Why would I lie when that post expresses exactly how I feel?
>>
>> The point of the post is that there is no framework in particular to
>> recommend. I use my own packages for my needs. They suit me well. It
>> does not mean they will suit everybody.
>
> How would you know that there is no framework to recommend if you neve
> ruse anyone's code but your own. How could you have possibly given any
> framework sufficient attention to have any idea of its pros and cons?

I know many frameworks that exist, I have seen their code and their
documentation, which is more than enough to reach the conclusion that
using the frameworks that exist is not better that using my own
solutions for my own purposes.

I do not need to jump off a building to realize that it would not be a
better idea than using the stairs or the elevator.

It is a bit exaggerated metaphor because I really do not think that
using somebody else's PHP code is like suicide. I just think that using
my own code that is proven and has matured during many years, is much
better for my own purposes than using something existing frameworks.

>> The PHPClasses site content is made of packages contributed by
>> developers that wrote their own packages. Those other packages often
>> serve the same purposes as some of my packages.
>>
>> I am pro-choice. That is the spirit of the PHPClasses site. Everybody
>> can publish their packages. Let the users be the judges of which are the
>> best for whatever purposes. That is pure fair play. Is that a bad thing?
>> I don't think so.
>>
>> I also would like to emphasize what I said above regarding the total
>> lack of organization and cooperation of the PHP community.
>
> You can't have your cake and eat it too. You're either pro-choice with a
> myriad of choices to choose from, or you're anti-choice and want only
> one framework style. Get of the fence!

Having standard API specifications does not prevent anybody to choose
using solutions based on APIs that do not conform to any standard
specifications.

Furthermore I do not think that seem to understand the difference
between an API specification and API implementation. J2EE is an API
specification with many implementations from different vendors: Sun,
IBM, Oracle, BEA, JBoss (this last one is Open Source). You can choose
the implementation you want.

There is plenty of choice to anybody. If you want to use a J2EE
implementation to build your applications, otherwise you are free to use
something else.

>> If there were standard specifications for packages and frameworks like
>> there is in the Java world, maybe you would not have this discussion.
>> There could be a consense to use the same standard API with eventual
>> multiple implementations from different developers or vendors.
>>
>> Imagine if there would be only one PDBC (JDBC for PHP). Instead of that
>> we have a never ending choice of PHP database abstraction layers that
>> does not help newcoming developers that are lost and don't know what to use.
>
> You presume that any chosen standard methodology or whatever you want to

I am not talking of implementation methodologies, I am talking about API
specifications. The same API specification can be implement with
different methodologies. As long as they pass API compliance tests, that
is all right.

> call it would be correct. Because if it wasn't correct, no matter how
> organized you think a community might be, something different WILL
> emerge. Right now there may be 100 frameworks, probably still growing,
> but not all will be accepted into mainstream use, and that ultimately
> will determine which one's have staying power or at the very least --
> which ones have reach. The fact that there are so many is a testament to
> how easy it is to manipulate the power placed in the hands of the PHP
> developer. It is not indicative of disorganization within the community.

You totally misunderstand me. When I talk about lack of organization in
the PHP community, I am not saying that the people that implement
frameworks are disorganized. What I am saying is that there is no
organized effort to site together and produce standard API
specifications for the frameworks, like there is the Java community.

>> This is admitidly a criticism to the lack of organization of the whole
>> PHP community including myself. We are all guilty for this mess and I am
>> afraid there is not much hope to fix it.
>
> You mean we should all be happy that so much choice is available!

I am pro-choice, so having choice is a good thing.

That is not my point. My point is that for instance, when you want to
develop PHP database applications, there is no consense on which API
would be the best to use.

The reason why it is a bad thing is that that when people develop PHP
components that need to access to a database, they will hardly support
more than one database API. Whoever uses other database API may not
benefit from those components.

Let me give a concrete example, I have developed some plug-ins for this
forms class that provide auto-complete support to text inputs and linked
select inputs. They use AJAX to retrieve auto-complete text options and
switch the linked select options from a database on the server.

http://www.phpclasses.org/formsgeneration

It is not viable for me to support all database API that exist for PHP.
Actually it is already a big deal that that I could find time to support
MySQL (directly) or a bunch of other databases using Metabase or
PEAR::MDB2 API.

The developers that use other database API cannot benefit from these
auto-complete and linked select plug-ins, unless they develop variants
of the plugins that support the database API that they prefer, but then
they would be on their own as I would not be able to provide support to
them.

Everybody looses opportunities with this. If there was a standard API
database specification for PHP like PDBC similar to JDBC, there would be
no such problem.

--

Regards,
Manuel Lemos

Metastorage - Data object relational mapping layer generator
http://www.metastorage.net/

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

attached mail follows:


Hello,

on 08/03/2006 07:37 AM Jochem Maas said the following:
> PHPClasses 0 - Botanist 1
>
> :-)

Erm....

Paul Scott is a good contributor of the PHPClasses site:

http://www.phpclasses.org/browse/author/145758.html

Several of his classes have been nominated to the PHP Programming
Innovation Award:

http://www.phpclasses.org/winners.html

--

Regards,
Manuel Lemos

Metastorage - Data object relational mapping layer generator
http://www.metastorage.net/

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

attached mail follows:


Hello,

on 08/03/2006 09:17 AM Jochem Maas said the following:
> Arno Kuhl wrote:
>> I'm not so sure if the botanist wasn't saying in a rather confused way that
>> he was playing on the same side as PHPClasses, even if he did profess to be
>> in the other team. Did he say he was rolling his own (in a way only
>> botanists can do) or not?
>
> that's beside the point - manuel tried to have his cake and eat when he
> a, stated writing everying yourself was preferable and b, Java was better
> because they have standardized APIs for framework development allowing people
> to switch between frameworks.

You totally distorting what I said.

a. I said my packages are preferred for my own purposes. I did not say
that my packages are prefferrable for other peoples purposes.

b. I did not say Java is better, otherwise I would use Java, which I
don't. I said that in the Java world the is something called Java
Community Process (JCP) which is a body made from people from the Java
community that is responsible for specifying Java APIs. That would be a
good thing to adopt by the PHP community if it were more organized and
cooperative.

> besides which manuel's 'article' is crap, rob's assessment of it was pretty
> spot on (and it's not the first time manuel has plugged the 'article').
>
> in the end evilMe(tm) was just fanning the flames. ;->

I am sorry you felt the need to be disrespectful and resort to personal
insult, even more in public. It is a clear sign that you run out of
serious arguments and do not have anything worthy to add to the discussion.

But I cannot be bothered if your parents did not give you proper
education. You do not deserve further of my attention. Do not bother to
reply. I will not follow up.

--

Regards,
Manuel Lemos

Metastorage - Data object relational mapping layer generator
http://www.metastorage.net/

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

attached mail follows:


Hello,

on 08/03/2006 09:25 AM Paul Scott said the following:
> The main thing in Manual's post that got me writing this in the first
> place was :
>
> "Imagine if there would be only one PDBC (JDBC for PHP). Instead of that
> we have a never ending choice of PHP database abstraction layers that
> does not help newcoming developers that are lost and don't know what to
> use."

I admit I have not expressed myself clearly. What I meant is not that
people should be disallowed to implement alternative APIs, but rather
that they should not feel the need to do it.

In the Java world, JDBC is the de facto standard because Java developers
do not feel the need to develop other database APIs. That happens
because JDBC is a standard API defined by several players from the SQL
database world that sit together and defined a consensual API specification.

In the PHP world there is no such organization nor the vision of the
benefits of cooperating to define such standards. I already gave an
example of the benefits of having such standard API specifications in
the other comment to Rob.

--

Regards,
Manuel Lemos

Metastorage - Data object relational mapping layer generator
http://www.metastorage.net/

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

attached mail follows:


On Thu, 2006-08-03 at 13:32 -0300, Manuel Lemos wrote:
> Hello,
>
> on 08/03/2006 02:01 AM Robert Cummings said the following:
> >>>> Anyway, you may want to read this more in depth reflection of the state
> >>>> of the PHP framework world and recommendations on how to pick what suits
> >>>> best for you:
> >>>>
> >>>> http://www.phpclasses.org/blog/post/52-Recommended-PHP-frameworks.html
> >>> I've read it before... it was crud. You provide no recommendation for
> >>> any framework but instead try to pimp phpclasses. From what I gathered
> >>> you haven't even actually tried anywhere in the vicinity of 10% of the
> >>> frameworks in existence and yet you feel obliged to write a commenatary
> >>> called "Recommended PHP Frameworks" in which you don't even recommend a
> >>> framework. Additionally somehow while pimping phpclasses you also feel
> >>> it necessary to indicate how you don't use any code other than what you
> >>> write yourself. Egads, if you won't use the code on your site why the
> >>> hell should anyone else?
> >> The answer to that question is in the post. I only use my own (PHP)
> >> packages because I can. Not everybody can afford writing package for
> >> their own needs from scratch.
> >>
> >> Why would I lie when that post expresses exactly how I feel?
> >>
> >> The point of the post is that there is no framework in particular to
> >> recommend. I use my own packages for my needs. They suit me well. It
> >> does not mean they will suit everybody.
> >
> > How would you know that there is no framework to recommend if you neve
> > ruse anyone's code but your own. How could you have possibly given any
> > framework sufficient attention to have any idea of its pros and cons?
>
> I know many frameworks that exist, I have seen their code and their
> documentation, which is more than enough to reach the conclusion that
> using the frameworks that exist is not better that using my own
> solutions for my own purposes.

Aaaah, so you are trully a genius to be able to at a glance of
documentation and source code fully deduce the usefulness of something.
I bow before you.

>
> I do not need to jump off a building to realize that it would not be a
> better idea than using the stairs or the elevator.

That depends, if there was one of those great big inflated stunt things
at the bottom, I'd certainly give it a go. But then I generally look
before I leap.

> It is a bit exaggerated metaphor because I really do not think that
> using somebody else's PHP code is like suicide. I just think that using
> my own code that is proven and has matured during many years, is much
> better for my own purposes than using something existing frameworks.

You are fully entitle to that stance, I commend it, but then to move
forward and write a commentary about recommended PHP frameworks in which
you make no recommendation... well that just doesn't sit right. The
utility of many things in life is rarely realized until it has been used
in practice. many people have said they don't like Linux, they've read
the books, they've looked under the hood. But unless they give it a good
go, I just can't take their opinion seriously.

> >> The PHPClasses site content is made of packages contributed by
> >> developers that wrote their own packages. Those other packages often
> >> serve the same purposes as some of my packages.
> >>
> >> I am pro-choice. That is the spirit of the PHPClasses site. Everybody
> >> can publish their packages. Let the users be the judges of which are the
> >> best for whatever purposes. That is pure fair play. Is that a bad thing?
> >> I don't think so.
> >>
> >> I also would like to emphasize what I said above regarding the total
> >> lack of organization and cooperation of the PHP community.
> >
> > You can't have your cake and eat it too. You're either pro-choice with a
> > myriad of choices to choose from, or you're anti-choice and want only
> > one framework style. Get of the fence!
>
> Having standard API specifications does not prevent anybody to choose
> using solutions based on APIs that do not conform to any standard
> specifications.
>
> Furthermore I do not think that seem to understand the difference
> between an API specification and API implementation. J2EE is an API
> specification with many implementations from different vendors: Sun,
> IBM, Oracle, BEA, JBoss (this last one is Open Source). You can choose
> the implementation you want.
>
> There is plenty of choice to anybody. If you want to use a J2EE
> implementation to build your applications, otherwise you are free to use
> something else.

It's seems people have chosen... and they've chosen not to bother with
some kind of standard API. That's not to say one won't emerge, but it
doesn't seem like it's important at this time.

> >> If there were standard specifications for packages and frameworks like
> >> there is in the Java world, maybe you would not have this discussion.
> >> There could be a consense to use the same standard API with eventual
> >> multiple implementations from different developers or vendors.
> >>
> >> Imagine if there would be only one PDBC (JDBC for PHP). Instead of that
> >> we have a never ending choice of PHP database abstraction layers that
> >> does not help newcoming developers that are lost and don't know what to use.
> >
> > You presume that any chosen standard methodology or whatever you want to
>
> I am not talking of implementation methodologies, I am talking about API
> specifications. The same API specification can be implement with
> different methodologies. As long as they pass API compliance tests, that
> is all right.

Allow me to rephrase. You presume that any API specification would be
optimal. Because if it wasn't optimal, no matter how organized you think
the community might be, a new API WILL emerge.

> > call it would be correct. Because if it wasn't correct, no matter how
> > organized you think a community might be, something different WILL
> > emerge. Right now there may be 100 frameworks, probably still growing,
> > but not all will be accepted into mainstream use, and that ultimately
> > will determine which one's have staying power or at the very least --
> > which ones have reach. The fact that there are so many is a testament to
> > how easy it is to manipulate the power placed in the hands of the PHP
> > developer. It is not indicative of disorganization within the community.
>
> You totally misunderstand me. When I talk about lack of organization in
> the PHP community, I am not saying that the people that implement
> frameworks are disorganized. What I am saying is that there is no
> organized effort to site together and produce standard API
> specifications for the frameworks, like there is the Java community.

No I understood you perfectly fine. I understood that you were speaking
about the PHP community at large and not individual communities around
any given framework or API.

> >> This is admitidly a criticism to the lack of organization of the whole
> >> PHP community including myself. We are all guilty for this mess and I am
> >> afraid there is not much hope to fix it.
> >
> > You mean we should all be happy that so much choice is available!
>
> I am pro-choice, so having choice is a good thing.
>
> That is not my point. My point is that for instance, when you want to
> develop PHP database applications, there is no consense on which API
> would be the best to use.
>
> The reason why it is a bad thing is that that when people develop PHP
> components that need to access to a database, they will hardly support
> more than one database API. Whoever uses other database API may not
> benefit from those components.
>
> Let me give a concrete example, I have developed some plug-ins for this
> forms class that provide auto-complete support to text inputs and linked
> select inputs. They use AJAX to retrieve auto-complete text options and
> switch the linked select options from a database on the server.
>
> http://www.phpclasses.org/formsgeneration
>
> It is not viable for me to support all database API that exist for PHP.
> Actually it is already a big deal that that I could find time to support
> MySQL (directly) or a bunch of other databases using Metabase or
> PEAR::MDB2 API.
>
> The developers that use other database API cannot benefit from these
> auto-complete and linked select plug-ins, unless they develop variants
> of the plugins that support the database API that they prefer, but then
> they would be on their own as I would not be able to provide support to
> them.

There's this thing called an adapter pattern. Great for retrofitting
other people's code without actually modifying it.

> Everybody looses opportunities with this. If there was a standard API
> database specification for PHP like PDBC similar to JDBC, there would be
> no such problem.

There are two ways for standards to come about. They can be hand picked
or they can emerge. Hand picked requires the "community organization" of
which you speak. Emergent standards requires the popular vote. I'm in
the latter camp, let the developers speak to the merits of any given
standard. And if they don't speak, it's probably not important.

Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'

attached mail follows:


On Thu, 2006-08-03 at 14:42 -0300, Manuel Lemos wrote:
> Hello,
>
> on 08/03/2006 09:25 AM Paul Scott said the following:
> > The main thing in Manual's post that got me writing this in the first
> > place was :
> >
> > "Imagine if there would be only one PDBC (JDBC for PHP). Instead of that
> > we have a never ending choice of PHP database abstraction layers that
> > does not help newcoming developers that are lost and don't know what to
> > use."
>
> I admit I have not expressed myself clearly. What I meant is not that
> people should be disallowed to implement alternative APIs, but rather
> that they should not feel the need to do it.

I think you may be missing the point. Many people probably don't feel
the "need" to create an alternative API, they may just feel the desire
to do so. It's a great way to practice your skills, and in the end, you
have a nice API that meets your needs.

> In the Java world, JDBC is the de facto standard because Java developers
> do not feel the need to develop other database APIs. That happens
> because JDBC is a standard API defined by several players from the SQL
> database world that sit together and defined a consensual API specification.
>
> In the PHP world there is no such organization nor the vision of the
> benefits of cooperating to define such standards. I already gave an
> example of the benefits of having such standard API specifications in
> the other comment to Rob.

Almost all APIs can be wrapped when necessary. Hell, the PHP engine is
in many cases just a wrapper around a C API.

Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'

attached mail follows:


 

> -----Original Message-----
> From: Manuel Lemos [mailto:mlemosacm.org]
> Sent: Thursday, August 03, 2006 1:43 PM
> To: php-generallists.php.net
> Subject: Re: [PHP] Re: PHP Frameworks - Opinion
>
> Hello,
>
> on 08/03/2006 09:25 AM Paul Scott said the following:
> > The main thing in Manual's post that got me writing this in
> the first
> > place was :
> >
> > "Imagine if there would be only one PDBC (JDBC for PHP). Instead of
> > that we have a never ending choice of PHP database
> abstraction layers
> > that does not help newcoming developers that are lost and
> don't know
> > what to use."
>
> I admit I have not expressed myself clearly. What I meant is
> not that people should be disallowed to implement alternative
> APIs, but rather that they should not feel the need to do it.
>
> In the Java world, JDBC is the de facto standard because Java
> developers do not feel the need to develop other database
> APIs. That happens because JDBC is a standard API defined by
> several players from the SQL database world that sit together
> and defined a consensual API specification.

This is partially true because Java is owned and managed by SUN, and SUN
is all about developing API's, both to ensure that it's own later work
will work, and because it meant a better way for people to interface.
And while you use JDBC as an example of something that won out, it isn't
the only way to interface with Databases through Java, nor was it always
accepted as the best way. In fact there is still a lot of discussion
about other methods, and follow ons to JDBC. Also, JDBC doesn't
eliminate the database specific variations entirely. You still have to
deal with slight variances between specific databases, or incomplete
JDBC implementations or JDBC implementations that provide additional
functionality that isn't part of the spec.

By the same token Pear_DB, and the follow ons were much like the early
versino of JDBC. As is PDO in a lot of ways. The majority of the
database specifics have been abstracted out and a general interface has
emerged. Unlike in Java though, the PDO and Pear_(M)DB(2) families
haven't settled yet(nor did JDBC overnight) but they are being developed
by the community. And many people DO recognize the advantage of
standards and basic API's and are working to develop exactly those kinds
of things in their frameworks. Solar, as a simple example I have some
experience with, is spending a lot of time thinking about how components
fit togethor, how to allow for a common API while not requiring that you
use Solar's classes or pieces to do things. Of course the web
development world is a lot bigger than it was in the early days of
JSP/J2EE. And PhP has a huge part of that so the community is larger and
therefore the competing ideas is larger.

But you could argue, how is PDO not a standard interface like JDBC? How
was it not designed by the community and put out there for people to
implement their own methods for it?

>
> In the PHP world there is no such organization nor the vision
> of the benefits of cooperating to define such standards. I
> already gave an example of the benefits of having such
> standard API specifications in the other comment to Rob.
>
> --
>
> Regards,
> Manuel Lemos
>
> Metastorage - Data object relational mapping layer generator
> http://www.metastorage.net/
>
> PHP Classes - Free ready to use OOP components written in PHP
> http://www.phpclasses.org/
>
> --
> PHP General Mailing List (http://www.php.net/) To
> unsubscribe, visit: http://www.php.net/unsub.php
>
>

James Kilbride

attached mail follows:


On Tue, 1 Aug 2006, Gabe wrote:

> What's the common consensus as to a solid PHP framework to use for
> application development? There seems to be a number of them out there, but
> I'm not sure which one's are the most robust, actively developed, secure, etc
> etc.
>
> Thoughts?
>
>

I echo others in that there is not yet a common consensus. I have
started putting together my own framework as just a common directory
structure and code repository from projects that I have worked on. I
prefer my own code because I have this bit of OCD about using code that I
did not write if I do not fully understand every aspect of it, unless I
fully trust the source. I trust PEAR and often use some code from there.

Anyway, you asked about frameworks. I have been spending some cycles
looking at TYPO3 (http://typo3.com/) and so far it is pretty impressive.
I have heard from others that it is quite robust and almost a CMS in
itself. However I have not fully explored all of it so I will hold my
opinion on it until then. I also hear the learning curve for TYPO3 is
very steep but well worth the climb.

Jonathan

attached mail follows:


2006/8/3, Manuel Lemos <mlemosacm.org>:
>
> Hello,
>
> on 08/01/2006 01:35 PM Gabe said the following:
> > What's the common consensus as to a solid PHP framework to use for
> > application development? There seems to be a number of them out there,
> > but I'm not sure which one's are the most robust, actively developed,
> > secure, etc etc.
> >
> > Thoughts?
>
> There is no common consense. PHP development is not very well organized,
> like for instance in the Java world where several vendors can provide
> their own implementations of the same specification. This makes possible
> to use the same framework API from whatever vendor you prefer.
>
> In the PHP world all frameworks are incompatible, even when they attempt
> to implement similar feature sets.
>
> Anyway, you may want to read this more in depth reflection of the state
> of the PHP framework world and recommendations on how to pick what suits
> best for you:
>
> http://www.phpclasses.org/blog/post/52-Recommended-PHP-frameworks.html

Sorry to intrude with my usual obnoxious behaviour, but this is starting to
affect my self-esteem (what's left of it). Am I the only one who has a
really hard time reading the blog posts in phpclasses.org? Everytime a
reference to this blog is posted I lose track of the discussion, because I
can't really grasp what Lemos is talking about.

I'd like to make some some constructive criticism, not just to Lemos but to
the community in general, since I think many of us need to improve our
writing skills:

1 - Don't make loooong boooring posts.

2 - Get to the point. Introduction are great when they are not two pages
long.

3 - Stick to the topic. Or use appropiate titles.

4 - If the topic is inherently long, use distinguishable headers and
subheaders. It's a pain in the ass to read a 5 pages long article that looks
the same everywhere, with no easy way to know what is the subtopic of what
are you reading now.

5 - Don't talk so much about your life! You can always make another blog for
that... Unless your personal experience can bring an unique insight of the
point you're trying to make.

That's all folks.

--
>
> Regards,
> Manuel Lemos
>
> Metastorage - Data object relational mapping layer generator
> http://www.metastorage.net/
>
> PHP Classes - Free ready to use OOP components written in PHP
> http://www.phpclasses.org/
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

attached mail follows:


In my experience with the other frameworks (primarily Wasp, CakePHP,
Symfony, eZ Components, and Zend Framework), I've found that I was not
satisfied with the quantity of low-quality code they advocate. I have
a high standard for code quality, readability, maintainability, and
(more generally) semantics.

Because of this, I determined to build my own framework. This was a
few months ago, and Canvas[1] was the result of my labor. I produced
this framework while working on numerous projects at the university I
work at. This allowed me to build an application concurrently with the
framework and give it a good benchmark for usability, feature,
performance, etc.

Some of the features include pretty URLs and a fairly capable router,
a simplistic implementation of the ActiveRecord pattern (with a very
easy way to make adapters for your favorite flavor of RDBMS),
incorporation of Smarty for its templating, and usage of the MVC
pattern. (Of course, this list is hardly sorted by priority.)

A quick sample of using the ActiveRecord implementation:

class shoe extends Model {}
$shoe = new shoe();
$shoe->find_by_color('green')->delete();
$shoe->find_by_id(12);
$shoe->color = 'red';
$shoe->save();
$shoe->find_or_create_by_color('tangerine');
$shoe->find(array("where"=>array('color like ":color" or size >
":size", "color"=>"pink", "size"=>"11")))->all();

Do check it out.

M.T.

1. http://c.anvas.es/

attached mail follows:


Matt Todd wrote:
> In my experience with the other frameworks (primarily Wasp, CakePHP,
> Symfony, eZ Components, and Zend Framework), I've found that I was not
> satisfied with the quantity of low-quality code they advocate. I have
> a high standard for code quality, readability, maintainability, and
> (more generally) semantics.
>
> Because of this, I determined to build my own framework. This was a
> few months ago, and Canvas[1] was the result of my labor. I produced
> this framework while working on numerous projects at the university I
> work at. This allowed me to build an application concurrently with the
> framework and give it a good benchmark for usability, feature,
> performance, etc.
>
> Some of the features include pretty URLs and a fairly capable router,
> a simplistic implementation of the ActiveRecord pattern (with a very
> easy way to make adapters for your favorite flavor of RDBMS),
> incorporation of Smarty for its templating, and usage of the MVC
> pattern. (Of course, this list is hardly sorted by priority.)
>
> A quick sample of using the ActiveRecord implementation:
>
> class shoe extends Model {}
> $shoe = new shoe();
> $shoe->find_by_color('green')->delete();
> $shoe->find_by_id(12);
> $shoe->color = 'red';
> $shoe->save();
> $shoe->find_or_create_by_color('tangerine');
> $shoe->find(array("where"=>array('color like ":color" or size >
> ":size", "color"=>"pink", "size"=>"11")))->all();
>
> Do check it out.
>
> M.T.
>
> 1. http://c.anvas.es/
>

Please do not recommend stuff like this.
It is a funky framework!

attached mail follows:


On Fri, 4 Aug 2006, Jens Kleikamp wrote:

> Matt Todd wrote:
>>
>> Because of this, I determined to build my own framework. This was a
>> few months ago, and Canvas[1] was the result of my labor. I produced
>> this framework while working on numerous projects at the university I
>> work at. This allowed me to build an application concurrently with the
>> framework and give it a good benchmark for usability, feature,
>> performance, etc.
>>
>>
>> M.T.
>>
>> 1. http://c.anvas.es/
>>
>
> Please do not recommend stuff like this.
> It is a funky framework!
>
>

What do you mean by "funky"? And why should he not recommend it?

Jonathan

attached mail follows:


On Mon, July 31, 2006 4:38 pm, Ross wrote:
> I have lots of folders and files some are in the main public_html
> folder and
> some are in their own foder. I need to find a way to make all the
> links
> relative to the public_html folder
>
> For example if I am in the 'gallery' folder, the main index file is
> located
> at ../index, however if I om in the contact page which is in the same
> directory as index the link is just index.php.
>
> I want to have one menu and make all the links work without having to
> enter
> a full http://www.mydomain/myfolder/myfile.php.
>
> I tried $_SERVER['doc_root']; but this gives the full server root. I
> am sure
> I have see a way to define directorries using define() or something.

The easiest way to do this is to use an absolute path in the URL.

Example:
/index.htm

This will lead to your homepage no matter what directory you are in.

--
Like Music?
http://l-i-e.com/artists.htm

attached mail follows:


Unless I'm mis-reading all this, you *ARE* getting FreeType 2.x support.

But you're not getting FreeType 1.0 support, as you have 2.x instead.

If you were not getting FreeType at all, it wouldn't even appear in
phpinfo() output.

Try using the freetype functions and see if you get "function xyz not
defined" or not.

On Mon, July 31, 2006 3:13 pm, Vedanta Barooah wrote:
> hello all,
> i am trying to compile freetype support for php 5.1.4, on linux ...
> looks
> like i have set all the compile options correct ... but some how
> freetype
> support does not get included. any pointers will be of great help!
>
> thanks,
> vedanta
>
>
> ## configure options
>
> # './configure' '--with-apxs2=/soa/srv/httpd/bin/apxs'
> '--prefix=/soa/srv/php514'
> '--with-config-file-path=/soa/srv/php514/conf'
> '--enable-soap' '--enable-exif' '--with-gd' '--with-jpeg-dir=/usr/lib'
> '--with-zlib-dir=/usr/lib' '--with-png-dir=/usr/lib'
> '--enable-gd-native-ttf' '--with-ttf' '--with-freetype-dir=/usr/lib'
>
> -- snip --
> configure: warning: You will need re2c 0.9.11 or later if you want to
> regenerate PHP parsers.
> configure: warning: bison versions supported for regeneration of the
> Zend/PHP parsers: 1.28 1.35 1.75 1.875 2.0 2.1 (found: none).
> checking for FreeType 1.x support... yes
> checking for FreeType 2... /usr/lib
> checking for FreeType 1 support... no - FreeType 2.x is to be used
> instead
> configure: warning: lemon versions supported for regeneration of
> libsqlite
> parsers: 1.0 (found: none).
> configure: warning: bison versions supported for regeneration of the
> Zend/PHP parsers: 1.28 1.35 1.75 1.875 2.0 2.1 (found: none).
> -- snip --
>
>
>
> ### <? print_r(gd_info()); ?>
>
> Array
> (
> [GD Version] => bundled (2.0.28 compatible)
> [FreeType Support] =>
> [T1Lib Support] =>
> [GIF Read Support] => 1
> [GIF Create Support] => 1
> [JPG Support] => 1
> [PNG Support] => 1
> [WBMP Support] => 1
> [XPM Support] =>
> [XBM Support] => 1
> [JIS-mapped Japanese Font Support] =>
> )
>

--
Like Music?
http://l-i-e.com/artists.htm

attached mail follows:


On Mon, July 31, 2006 6:23 am, Robin Getz wrote:
> I am trying to debug a php script that I downloaded, which has a
> memory
> leak in it.
>
> I was looking for a way to find what variables were in php's memory,
> and
> what size, they were, but I couldn't find anything?
>
> The script is a off-line wiki conversion tool (walks through a wiki to
> create a bunch of html files for off line viewing). As the tools walks
> the
> files, and does the conversion, I can see the memory consumption go up
> and
> up as it walks the files, until it hits the mem limit, and crashes.
>
> Any suggestions appreciated.

When you run the tool, just give the command-line options to PHP to
give it more RAM for memory_limit. :-)

Finding the memory leak in a Wiki-walker could take forever.

--
Like Music?
http://l-i-e.com/artists.htm

attached mail follows:


Daevid Vincent wrote:
> *sigh*
>
> Why is PHP so lame...
>

Because some users are too lazy to RTFM.

--
John C. Nichel IV
Programmer/System Admin (ÜberGeek)
Dot Com Holdings of Buffalo
716.856.9675
jnicheldotcomholdingsofbuffalo.com

attached mail follows:


It will probably work, and you could find out for sure by just trying it.

It might be better to construct a single query using things like:

$company_ids = implode(', ', $_POST['reporton_company']);
$query .= " WHERE company_id IN ($company_ids) ";

This presumes you have already validated the company_ids.

However, if the number of companies, periods, and questions is SMALL,
the difference between one big query and a dozen little queries is
pretty minimal, and if you find the nested loops easier to maintain,
go for it.

On Mon, July 31, 2006 5:02 am, Chris Grigor wrote:
> Have been wondering if this is possible....
>
> Basically I have 3 posted arrays,
> $_POST['reporton_company'] (this can be various company id's. ie
> 3,6,7)
> $_POST['report_period'] (this can be various periods but a max of 4
> submitted. ie 3,4,5)
> $_POST['questions_groups'] (this can be various - starting from 1-
> whatever
> (usually a max of 10 or 11). ie 1,2,3,4,5,6,7,8,9,10)
>
> So the select should work as
>
> 1. for each company listed go through the loop
> 2. for each report period listed go through loop for each company
> 3. for each questions group go through the loop for each report period
> and
> each company..
>
> So I came up with this - will it work??
>
>
> foreach($_POST['reporton_company'] as $cmp_ind =>$arrayd_cmp_id) {
> foreach($_POST['report_period'] as $rep_ind =>$arrayd_per_id) {
> foreach($_POST['questions_groups'] as $group_ind =>
> $arrayd_group_no) {
> mysql_select_db($database_name, $dname);
>
> $query_get_list_of_answers = "SELECT * FROM answers LEFT JOIN
> (questions,
> period) ON (questions.id=answers.ans_l_question_id AND
> period.per_id=ans_l_period_id) where ans_l_company_id =
> '$arrayd_cmp_id' AND
> per_id = '$arrayd_per_id' AND group_no = '$arrayd_group_no';";
>
> $get_list_of_answers = mysql_query($query_get_list_of_answers,
> $antiva) or
> die(mysql_error());
> $row_get_list_of_answers = mysql_fetch_assoc($get_list_of_answers);
> $totalRows_get_list_of_answers = mysql_num_rows($get_list_of_answers);
> }
>
> }
> }
>
> Anyone suggest an easier way?
>
> Cheers
> Chris
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--
Like Music?
http://l-i-e.com/artists.htm

attached mail follows:


What do you all recommend for testing the gui side of your php
applications? I've played with badboy a bit but we all run linux here at
work and I was looking for something more robust and would live to find a
free/inexpensive tool. I've also tried SimpleTest for the ui side but it
seemed to be cumbersome to use for ui stuff.

Thanks!

attached mail follows:


For starters, the function is supposed to return 0 for countries that
are equal.

As it stands now, it's going to return 1 / -1 randomly based on which
arg happens to be $a versus $b.

That's bad.

For some implementations of shuffle/sort routines, it will actually
crash.

I forget which implementation does this, but it's got to do with
caching the comparison result in a B-tree and then walking the tree
assuming that the comparison will be consistent...

Anyway, as far as "doesn't work" goes, you'd have to give us more info
about how it's not working...

On Mon, July 31, 2006 1:56 am, weetat wrote:
>
> Hi ,
>
> Doesn't work .
> Any ideas ?
>
> Thanks
> Peter Lauri wrote:
>> function cmpcountry($a, $b)
>> {
>>
>> $country1 = $a['country'];
>> $country2 = $b['country'];
>>
>> if($country1=='') return 1;
>> else return ($country1 < $country2) ? -1 : 1;
>>
>> }
>>
>> -----Original Message-----
>> From: weetat [mailto:weetat.yeocxrus.com]
>> Sent: Monday, July 31, 2006 12:32 PM
>> To: php-generallists.php.net
>> Subject: [PHP] sorting in array
>>
>> Hi all ,
>>
>> I have array value as shown below, i have paste my test php code
>> below:
>> I have problem when doing usort() when 'country' = '', i would
>> like to
>> display records where country = '' last. Any ideas how to do that ?
>>
>> Thanks
>>
>> $arraytest= array(
>> array
>> (
>> 'country' => '',
>> )
>> ,
>> array
>> (
>> 'country' => 'Thailand',
>> )
>> ,
>> array
>> (
>> 'country' => 'Singapore',
>> )
>> ,
>> array
>> (
>> 'country' => 'Singapore',
>> )
>> ,
>> array
>> (
>> 'country' => '',
>> )
>> ,
>> array
>> (
>> 'country' => '',
>> )
>> ,
>> array
>> (
>> 'country' => '',
>> )
>>
>> );
>>
>>
>> function cmpcountry($a, $b)
>> {
>>
>> $country1 = $a['country'];
>> $country2 = $b['country'];
>>
>> return ($country1 < $country2) ? -1 : 1;
>> }
>>
>> usort($arraytest,"cmpcountry");
>> while(list($name,$value)=each($arraytest)){
>> echo $name."<br><br>";
>>
>> while(list($n,$v) = each($arraytest[$name])){
>> echo $v."<br><br>";
>> }
>> }
>>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--
Like Music?
http://l-i-e.com/artists.htm

attached mail follows:


<?php
  ob_start();
  //rest of code here.
  $output = ob_get_contents();
  ob_end_clean();
  file_put_contents('/full/path/to/some/file', $output);
  echo $output;
?>

On Fri, July 28, 2006 9:01 pm, MIGUEL ANTONIO GUIRAO AGUILERA wrote:
>
>
> Hi!!
>
> I'm in the need of saving to a file a dynamic page that I generated
> from a PHP script, taking data from a table!!
>
> So far I have figured out two options:
>
> 1) Save the page as a XML document so it can be editable in a word
> processor later. Do I have to write line by line until I'm done with
> the document?
>
> 2) Use a class to convert & save the dynamic page into a Word
> document.
>
> Is there any other options available??
> Regards
> ------------------------------------------------
> MIGUEL GUIRAO AGUILERA
> Logistica R8 - Telcel
> Tel: (999) 960.7994
>
>
> Este mensaje es exclusivamente para el uso de la persona o entidad a
> quien esta dirigido; contiene informacion estrictamente confidencial y
> legalmente protegida, cuya divulgacion es sancionada por la ley. Si el
> lector de este mensaje no es a quien esta dirigido, ni se trata del
> empleado o agente responsable de esta informacion, se le notifica por
> medio del presente, que su reproduccion y distribucion, esta
> estrictamente prohibida. Si Usted recibio este comunicado por error,
> favor de notificarlo inmediatamente al remitente y destruir el
> mensaje. Todas las opiniones contenidas en este mail son propias del
> autor del mensaje y no necesariamente coinciden con las de Radiomovil
> Dipsa, S.A. de C.V. o alguna de sus empresas controladas,
> controladoras, afiliadas y subsidiarias. Este mensaje intencionalmente
> no contiene acentos.
>
> This message is for the sole use of the person or entity to whom it is
> being sent. Therefore, it contains strictly confidential and legally
> protected material whose disclosure is subject to penalty by law. If
> the person reading this message is not the one to whom it is being
> sent and/or is not an employee or the responsible agent for this
> information, this person is herein notified that any unauthorized
> dissemination, distribution or copying of the materials included in
> this facsimile is strictly prohibited. If you received this document
> by mistake please notify immediately to the subscriber and destroy
> the message. Any opinions contained in this e-mail are those of the
> author of the message and do not necessarily coincide with those of
> Radiomovil Dipsa, S.A. de C.V. or any of its control, controlled,
> affiliates and subsidiaries companies. No part of this message or
> attachments may be used or reproduced in any manner whatsoever.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

--
Like Music?
http://l-i-e.com/artists.htm

attached mail follows:


On Fri, July 28, 2006 7:25 pm, Martin Marques wrote:
> I' trying to include files from a script which will be executed from
> CLI via cron.
>
> Now, if I execute the script from the command line it works OK, but
> when it's executed via cron I fails to include a file, which is being
> included via and include from the script. It looks like when including
> a file directories are changes, and so the new include doesn't work as
> it's referencing from a different directory.
>
> Is there something I should be aware of?

cron runs the script from your home directory, not the directory the
script lives in.

The easiest thing is to just specify the full path to the include
files for the cron jobs.

--
Like Music?
http://l-i-e.com/artists.htm

attached mail follows:


On Fri, July 28, 2006 3:55 pm, Tony Di Croce wrote:
> In a couple of my scripts, I do something like the following when I
> detect
> an improperly submitted form:
>
> ** if( !valid_string( $_POST['firstname'] ) )
> {
> $return_url =
> "https://www.abc.com/checkout_phase1.php?error=FirstName Required";
> header( "location: $return_url" );
> exit(0);
> }
>
> Recently I changed the code so that a big variable that was being
> passed via
> GET (IE, as a param in the URL) is instead being POST'd... (typically,
> via a
> hidden INPUT elem in a form)...
>
> Unfortunatley, this broke my error handling logic... Is it possible to
> add
> POST variables to a redirect? How?

There are functions "out there" to send POST data from PHP.

The canonical example can be found by Googling for "Rasmus Lerdorf
posttohost"

--
Like Music?
http://l-i-e.com/artists.htm

attached mail follows:


Richard Lynch wrote:
> On Fri, July 28, 2006 3:55 pm, Tony Di Croce wrote:
>> In a couple of my scripts, I do something like the following when I
>> detect
>> an improperly submitted form:
>>
>> ** if( !valid_string( $_POST['firstname'] ) )
>> {
>> $return_url =
>> "https://www.abc.com/checkout_phase1.php?error=FirstName Required";
>> header( "location: $return_url" );
>> exit(0);
>> }
>>
>> Recently I changed the code so that a big variable that was being
>> passed via
>> GET (IE, as a param in the URL) is instead being POST'd... (typically,
>> via a
>> hidden INPUT elem in a form)...
>>
>> Unfortunatley, this broke my error handling logic... Is it possible to
>> add
>> POST variables to a redirect? How?
>
> There are functions "out there" to send POST data from PHP.
>
> The canonical example can be found by Googling for "Rasmus Lerdorf
> posttohost"
>

I have a function I use for doing POST transactions in PHP 4. Note that
the function just returns the text to send, another function does an
fwrite elsewhere. I'm also replacing some of my variables with hardcoded
values here to simplify the example, you can fix that as you will:

function make_post($message)
{
        $headers .= "POST /foo.php HTTP/1.1\r\n";
        $headers .= "Host: bar.com\r\n";
        $headers .= "Content-Type: application/octet-stream\r\n";
        $headers .= "Connection: keep-alive\r\n";
        $headers .= "Content-Length: " . strlen($message) . "\r\n";
        $headers .= "\r\n";
        return $headers . $message;
}

As far as I can tell, these are the absolute minimum set of headers you
can get away with for a POST transaction (If you know how to use less,
let me know, I use this in a situation where overhead matters).

Regards, Adam Zey.

attached mail follows:


On Fri, July 28, 2006 12:06 pm, Dave Goodchild wrote:
> Hi all. I am about to start writing an events listing application
> (nationwide) and want users to be able for example to specify events
> within
> a 5, 10 and 15 mile radius of their postcode. Does anyone know of a
> set of
> classes/library that can provide this, would rather not fork out on a
> bespoke piece of kit. Any suggestions appreciated!

Having done this before, several times, several different ways...

If it's US nationwide you can snarf the TIGER data for free to get:
zip code <-> longitude/latitude

You can then write a crude distance function just doing a Cartesian
distance with a 0.6 factor to convert degrees of arc to miles:

$distance = 0.6 * sqrt(pow($long2 - $long1, 2) + pow($lat2 - $lat1, 2))

This is of course utter [bleep] for an accurate calculation of
distance due to curvature of the Earth, but for finding stuff within N
miles of their postcode it's "okay" for US. Just don't try to fly an
airplane or pilot a boat by it.

You may even be able to create a function in your database of choice
to make it less messy.

Note that the number of zip codes is around 60K in the TIGER data, and
there have been a whole mess of zip codes added since then.

So if you want ALL the current zip codes, you have to shell out money.
:-( What I do, however, is when I run across a zip code that isn't in
the db, I just "guess" from the city/state and code number what other
zip codes are "near" it and then average those long/lat and shove it
in the db. Again, this is woefully inaccurate from a purist point of
view, but for calculating what's within N miles, it's fine and dandy.
And it don't cost me anything but a few minutes every month a new zip
code pops up.

Anyway, with such large tables, the query to calculate the distance in
a JOIN from your events to your zips table can get quite expensive.

So now it's time for a totally immoral non-denormalized
freak-out-the-DBA hack:

Add a longitude and latitude column to your events table, right after
the zipcode column, and default them to NULL.

Any time a zipcode changes, reset the longitude/latitude on events to
NULL.

Write a cron job that finds any events with NULL longitude and
latitude and copies the long/lat from the zips to the events for all
events with that same zip.

You'll want to run this cron job pretty often, especially if you have
a bunch of existing events that need to get initialized, but it's a
pretty cheap operation.

This cron job can notify you any time there is an unknown zip in the
events table that's not in the zips table, and then you can fake up
the long/lat as described above.

There are all manner of far more complicated ways of doing this, but
they are total overkill for what you need.

--
Like Music?
http://l-i-e.com/artists.htm

attached mail follows:


>On Fri, July 28, 2006 12:06 pm, Dave Goodchild wrote:
>> Hi all. I am about to start writing an events listing application
>> (nationwide) and want users to be able for example to specify events
>> within
>> a 5, 10 and 15 mile radius of their postcode. Does anyone know of a
>> set of
>> classes/library that can provide this, would rather not fork out on a
> bespoke piece of kit. Any suggestions appreciated!

Considering that you said "any", I can't screw-up by answering.

Besides the pygmy running around with red feet, you might find this
of interest:

http://www.webpasties.com/xmlHttpRequest/index.html

As mentioned previously, there are TIGER data, but that may be an
overkill because you can build a entire Street Atlas type program
from that (been there, done that) -- it contains a massive amount of
data beside postal codes.

tedd

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

attached mail follows:


At 2:23 PM -0500 8/3/06, Richard Lynch wrote:
>Note that the number of zip codes is around 60K in the TIGER data, and
>there have been a whole mess of zip codes added since then.

Can you get the postal code by themselves? The last time I looked at
TIGER data it was in quadrants of around the size of approximately a
township (6 x 6 miles).

tedd

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

attached mail follows:


You can write the fpdf file into ANY folder that PHP has write access
to, and there is no reason to put that folder directly into your web
tree.

You could certainly use /tmp with http://php.net/tmpname and friends,
or you could just set up some folder in a convenient location as world
writable.

If you then store the FPDF filename in a database, you can have a cron
job that checks every file in the directory, and each "active" record
in the database, and then move only the files that you have
cross-checked to be expected.

This makes it fairly secure, as somebody would have to hack both the
file system access and the db access to get the FPDF to go live.

On Fri, July 28, 2006 8:14 am, Joćo Cāndido de Souza Neto wrote:
> Hi everyone.
>
> Here i am again talking about fpdf.
>
> In the last question Peter told me that i can set a folder to write a
> pdf
> file by fpdf class but, to do that i ought to set permission to web
> user to
> write in this folder and think it“s bad to security.
>
> I thought a lot about it and then came back here to try to explain a
> little
> doubt.
>
> Could i write the pdf file into a temporary folder of php and then put
> it
> into the right folder by ftp?
>
> If yes, anyone could help me about that, something like; which folder
> can i
> write the file?
>
> Thanks a lot.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--
Like Music?
http://l-i-e.com/artists.htm

attached mail follows:


On Fri, July 28, 2006 7:21 am, clive wrote:
> I know in PHP 5 you can use stream_socket_client() and set the flag to
> STREAM_CLIENT_ASYNC_CONNECT|STREAM_CLIENT_CONNECT which opens the
> socket
> in a non blocking mode.
>
> in php 4 you can use fsockopen and then set the socket to non
> blocking.
> The problem with this is that the fsockopen blocks until it creates
> the
> socket or times out.
>
> I want to know if there is a replacement for fsockopen that attempts
> to
> open a socket, but returns immediately instead of blocking or is there
> another way to open a socket in a non blocking mode in PHP 4

There is a php.ini setting for how long the socket blocks connecting,
which you can reset with ini_set to 0.

Or maybe there's a separate setting for "non-blocking"...

Anyway, it's do-able with ini_set on some documented settings in
php.ini is the answer.

I added a Contributor's Note to this effect a couple months ago, but a
Notes Nazi decided it was not worthy of keeping. :-(

--
Like Music?
http://l-i-e.com/artists.htm

attached mail follows:


Use one exec for each command.

And check the return values from the extra args to exec.

On Fri, July 28, 2006 5:45 am, Dasdan wrote:
> I want to execute a couple of linux commands from a php script
> 'sequentially in background'.
>
> I want to run them in background so the php script doesn't hang while
> the linux commands are running.
>
> example:
>
>
> first i create a lock file with php
> $lockfile_path : /home/web/...blablabla.../test.tar.bz2_Lock.txt
>
> the I execute the following command from my php script:
>
> exec("du -a ~/ 2>&1 > /home/web/...blablabla.../backupFSlog.txt ;
> sleep 10 >/dev/null 1>/dev/null 2>/dev/null ; rm -f $lockfile_path
> >/dev/null 1>/dev/null 2>/dev/null &);
>
> problem:
> the php script hangs for 10 seconds (sleep), what is not what I want
>
> I've read a lot of sugestions but I can't get it to work.
>
> When I execute the commands one by one, it works in background, but
> when I want to run them 'sequentially in background', the php script
> hangs
>
> They need to run sequentially because the $lockfile_path may only be
> deleted when all the other commands are executed
>
> Some advice please?
>
> --
> http://www.dasdan.be
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--
Like Music?
http://l-i-e.com/artists.htm

attached mail follows:


On Thu, July 27, 2006 1:05 pm, Adam Zey wrote:
> Then how come when I do a foreach on an array (without modifying
> anything within the foreach), it still makes a copy of the array that
> consumes memory? I think it's dangerous to generalize that it's always
> best to let PHP make copies of things. In the foreach situation, the
> preferred solution when memory is a problem is to either use a
> reference, or have foreach iterate over the keys of the array.

I think this is because you can sometimes use & to modify the contents
of the iteratee (is that a word?) so PHP does a copy there blindly,
whether you have & or not, because you might have & there sometimes.

I think Dmitry or Antony or ??? is looking at changing that so the
copy is only done when & is present.

At least, that's how I understand (or not) the upshot of a thread on
Internals.

It's entirely possible, even likely, that I'm completely
misunderstanding both of these threads. :-)

--
Like Music?
http://l-i-e.com/artists.htm

attached mail follows:


echo $out[0][1] and see if it's what you think it is...

On Wed, July 26, 2006 6:13 am, phpredry.net wrote:
>
> Hi
> I am reading a username and password from a file. For the moment I am
> trying to test if the username and password are the same as user
> inputted username/password.
> My code snippet is as follows:
> if( $out[0][0] == $u && $out[0][1] == $p ) {
> $error = "Login successful!";
> }
> else {
> $error = "Invalid username/password. Try again";
> }
>
> $out[] is an array containing the file data.
> $u is the form username and $p the password.
> I echo both values once submitted. Even when they match I get invalid
> username/password message.
> If I just test if( $out[0][1] == $u ) it works.
> Has anyone any pointers on what I am doing wrong?
> Thanks
> Eoghan
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--
Like Music?
http://l-i-e.com/artists.htm

attached mail follows:


"Austin Denyer" <adenyerekn.com> wrote in message
news:44C61992.5080606ekn.com...

What's with the blank messages....??

attached mail follows:


Porpoise wrote:
> "Austin Denyer" <adenyerekn.com> wrote in message
> news:44C61992.5080606ekn.com...
>
>
> What's with the blank messages....??

His message wasn't blank, he sent this:

Andrei wrote:
> > So what u'r trying to say is that we should use KiB and not KB for
> > kilobytes? That's funny!

I know a lot of people who do just that.

Regards,
Austin.

attached mail follows:


Jochem,

Thank you for responding.
> no doubt it will become a php issue in the near future ;-)
>
I'm sure it will. However, you have kick started me in the right
direction, and I have the beginnings of a working page.

Thank you for your helpful advice.

--
Dave M G

attached mail follows:


PHP List,

Recently I wrote a piece of code to scrape data from an HTML page.

Part of that code deleted all the unwanted text from the very top of the
page, where it says "<!DOCTYPE", all the way down to the first instance
of a "<ul>" tag.

That code looks like this:
ereg_replace("<!DOCTYPE(.*)<ul>", "", $htmlPage);

It works fine. But I noticed that on almost all the tutorial pages I
looked at, they just about always used preg_replace, and not ereg_replace.

It seemed that the main difference was that preg_replace required
forward slashes around the regular expression, like so:
preg_replace("/<!DOCTYPE(.*)<ul>/", "", $htmlPage);

But that didn't work, and returned an error.

Since ereg was working, though, I figured I would just stick with it.

Still, I thought it worth asking:

Is there any reason why either ereg or preg would be more desirable over
the other?

Why does the ereg work for the command above, but preg not?

Thank you for any advice.

--
Dave M G

attached mail follows:


Dave M G wrote:
> PHP List,
>
> Recently I wrote a piece of code to scrape data from an HTML page.
>
> Part of that code deleted all the unwanted text from the very top of the
> page, where it says "<!DOCTYPE", all the way down to the first instance
> of a "<ul>" tag.
>
> That code looks like this:
> ereg_replace("<!DOCTYPE(.*)<ul>", "", $htmlPage);
>
> It works fine. But I noticed that on almost all the tutorial pages I
> looked at, they just about always used preg_replace, and not ereg_replace.
>
> It seemed that the main difference was that preg_replace required
> forward slashes around the regular expression, like so:
> preg_replace("/<!DOCTYPE(.*)<ul>/", "", $htmlPage);
>
> But that didn't work, and returned an error.
>
> Since ereg was working, though, I figured I would just stick with it.
>
> Still, I thought it worth asking:
>
> Is there any reason why either ereg or preg would be more desirable over
> the other?
>
> Why does the ereg work for the command above, but preg not?
>
> Thank you for any advice.
>
> --
> Dave M G
>
 From what I understand there are 2 schools of thought on regular
expressions. There is the Perl (Perl Compatible Regular Expressions -
preg) group and the POSIX (ereg) group. from the little I know they do
the same thing but with different symbols for things.

References:
http://www.php.net/regex
http://www.php.net/pcre
--

life is a game... so have fun.