Re: [PHP] Problem with pg_prepare function

2010-04-23 Thread Adam Richardson
On Fri, Apr 23, 2010 at 9:42 PM, Giancarlo Boaron wrote:

> Hi all.
>
> I'm receiving the following message when I try to use
> pg_prepare() function:
>
> "Call to undefined function pg_prepare()".
>
> My application works very well with others pg_*
> commands...
>
> I already checked my configuration files and I have no more
> ideas about how to fix it.
>
> Any suggestions?
>
> Thank you.
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
Maybe something like this situation (a few years back, but perhaps still
relevant):
http://www.issociate.de/board/post/384415/Undefined_pg_prepare()_in_5.6.1.html


Adam

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


[PHP] Problem with pg_prepare function

2010-04-23 Thread Giancarlo Boaron
Hi all.

I'm receiving the following message when I try to use
pg_prepare() function:

"Call to undefined function pg_prepare()".

My application works very well with others pg_*
commands...

I already checked my configuration files and I have no more
ideas about how to fix it.

Any suggestions?

Thank you.




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



Re: [PHP] Re: replying to list (I give up)

2010-04-23 Thread Dan Joseph
On Fri, Apr 23, 2010 at 6:17 PM, Ashley Sheridan
wrote:

> I run it under Wine. Wine has come a long way since my first encounters
> with it a few years back and run a surprising amount of Windows-based
> software. I don't know how far its support for Flash has come, but I do
> remember running a version of Flash under Wine before. It was a bit
> buggy (some dialogues didn't always work) and crashed more than it might
> have normally on Windows, but it was OK at a push to get work done.
> Nowadays I don't really do anything with Flash, as it's a pita to get it
> optimised for search engines, accessibility just isn't up to scratch,
> and it takes a lot longer to build a whole dynamic site with it.
>
>
>
Yah, I'd never use it for a whole web site build either.  Heck, probably
wouldn't even use it for an image carosel.  We were building games with it,
which was really a no brainer to use flash.  I didn't want to get into
Java.

I'll have to try it under wine sometime.  I didn't even think about that.
But then again, my work machine is windows anyway.

-- 
-Dan Joseph

www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.  Promo
Code "NEWTHINGS" for 10% off initial order

http://www.facebook.com/canishosting
http://www.facebook.com/originalpoetry


RE: [PHP] Re: replying to list (I give up)

2010-04-23 Thread Ashley Sheridan
On Fri, 2010-04-23 at 11:12 -0700, Tommy Pham wrote:

> > -Original Message-
> > From: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk]
> > Sent: Friday, April 23, 2010 11:04 AM
> > To: Dan Joseph
> > Cc: php-general@lists.php.net
> > Subject: Re: [PHP] Re: replying to list (I give up)
> > 
> > On Fri, 2010-04-23 at 13:57 -0400, Dan Joseph wrote:
> > 
> > > On Fri, Apr 23, 2010 at 1:51 PM, Adam Richardson
> > wrote:
> > >
> > > >  Contrary to my experiences a few years ago, there is no real loser
> > > > anymore, they all are very nice and have their advantages.
> > > >
> > >
> > > Well, I still believe that Linux is the better suitor for a server, but
> some
> > > companies don't.  So you really just have to adjust to their
> requirements
> > > and needs.  You're right tho, they all have their advantages.
> > >
> > 
> > 
> > I agree, and with the advances Linux has been making, you can even
> > update the kernel now without needing to restart the server, so you can
> > stay up-to-date with your security patches and never need any downtime.
> > That's potentially more important for some businesses than the cost
> > savings on the software.
> > 
> > As a desktop system, it's my personal choice. Both KDE 4 and Gnome 3
> > (released in Sept 2010) offer better flashiness than Windows 7 and
> > arguably better than the latest Mac OSX too, and the tools are as stable
> > as anything I've ever used before.
> > 
> > And the only game I ever play (World of Warcraft) plays better on Linux
> > (Fedora 11) than on Windows XP (tried it on Vista once, wasn't
> > impressed), so I'm not considering anything else right now!
> > 
> > Thanks,
> > Ash
> > http://www.ashleysheridan.co.uk
> > 
> 
> Is there an actual WoW client for Linux or you run in Wine like environment?
> 
> Thanks,
> Tommy
> 
> 


I run it under Wine. Wine has come a long way since my first encounters
with it a few years back and run a surprising amount of Windows-based
software. I don't know how far its support for Flash has come, but I do
remember running a version of Flash under Wine before. It was a bit
buggy (some dialogues didn't always work) and crashed more than it might
have normally on Windows, but it was OK at a push to get work done.
Nowadays I don't really do anything with Flash, as it's a pita to get it
optimised for search engines, accessibility just isn't up to scratch,
and it takes a lot longer to build a whole dynamic site with it.



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




Re: [PHP] Re: replying to list (I give up)

2010-04-23 Thread Dan Joseph
On Fri, Apr 23, 2010 at 2:12 PM, Tommy Pham  wrote:

>  > As a desktop system, it's my personal choice. Both KDE 4 and Gnome 3
> > (released in Sept 2010) offer better flashiness than Windows 7 and
> > arguably better than the latest Mac OSX too, and the tools are as stable
> > as anything I've ever used before.
>
> Is there an actual WoW client for Linux or you run in Wine like
> environment?
>

I used Cedega for WoW years ago, but I think it runs under wine just fine.

I personally am using Windows for my desktop these days.  I have needs for
windows, such as Flash development.  Plus my PhpED license is for the
Windows client, so I feel kind of trapped there :)

-- 
-Dan Joseph

www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.  Promo
Code "NEWTHINGS" for 10% off initial order

http://www.facebook.com/canishosting
http://www.facebook.com/originalpoetry


RE: [PHP] Re: replying to list (I give up)

2010-04-23 Thread Tommy Pham
> -Original Message-
> From: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk]
> Sent: Friday, April 23, 2010 11:04 AM
> To: Dan Joseph
> Cc: php-general@lists.php.net
> Subject: Re: [PHP] Re: replying to list (I give up)
> 
> On Fri, 2010-04-23 at 13:57 -0400, Dan Joseph wrote:
> 
> > On Fri, Apr 23, 2010 at 1:51 PM, Adam Richardson
> wrote:
> >
> > >  Contrary to my experiences a few years ago, there is no real loser
> > > anymore, they all are very nice and have their advantages.
> > >
> >
> > Well, I still believe that Linux is the better suitor for a server, but
some
> > companies don't.  So you really just have to adjust to their
requirements
> > and needs.  You're right tho, they all have their advantages.
> >
> 
> 
> I agree, and with the advances Linux has been making, you can even
> update the kernel now without needing to restart the server, so you can
> stay up-to-date with your security patches and never need any downtime.
> That's potentially more important for some businesses than the cost
> savings on the software.
> 
> As a desktop system, it's my personal choice. Both KDE 4 and Gnome 3
> (released in Sept 2010) offer better flashiness than Windows 7 and
> arguably better than the latest Mac OSX too, and the tools are as stable
> as anything I've ever used before.
> 
> And the only game I ever play (World of Warcraft) plays better on Linux
> (Fedora 11) than on Windows XP (tried it on Vista once, wasn't
> impressed), so I'm not considering anything else right now!
> 
> Thanks,
> Ash
> http://www.ashleysheridan.co.uk
> 

Is there an actual WoW client for Linux or you run in Wine like environment?

Thanks,
Tommy


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



Re: [PHP] Re: replying to list (I give up)

2010-04-23 Thread Ashley Sheridan
On Fri, 2010-04-23 at 13:57 -0400, Dan Joseph wrote:

> On Fri, Apr 23, 2010 at 1:51 PM, Adam Richardson wrote:
> 
> >  Contrary to my experiences a few years ago, there is no real loser
> > anymore,
> > they all are very nice and have their advantages.
> >
> 
> Well, I still believe that Linux is the better suitor for a server, but some
> companies don't.  So you really just have to adjust to their requirements
> and needs.  You're right tho, they all have their advantages.
> 


I agree, and with the advances Linux has been making, you can even
update the kernel now without needing to restart the server, so you can
stay up-to-date with your security patches and never need any downtime.
That's potentially more important for some businesses than the cost
savings on the software.

As a desktop system, it's my personal choice. Both KDE 4 and Gnome 3
(released in Sept 2010) offer better flashiness than Windows 7 and
arguably better than the latest Mac OSX too, and the tools are as stable
as anything I've ever used before.

And the only game I ever play (World of Warcraft) plays better on Linux
(Fedora 11) than on Windows XP (tried it on Vista once, wasn't
impressed), so I'm not considering anything else right now!

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




Re: [PHP] Re: replying to list (I give up)

2010-04-23 Thread Dan Joseph
On Fri, Apr 23, 2010 at 1:51 PM, Adam Richardson wrote:

>  Contrary to my experiences a few years ago, there is no real loser
> anymore,
> they all are very nice and have their advantages.
>

Well, I still believe that Linux is the better suitor for a server, but some
companies don't.  So you really just have to adjust to their requirements
and needs.  You're right tho, they all have their advantages.

-- 
-Dan Joseph

www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.  Promo
Code "NEWTHINGS" for 10% off initial order

http://www.facebook.com/canishosting
http://www.facebook.com/originalpoetry


Re: [PHP] Re: replying to list (I give up)

2010-04-23 Thread Adam Richardson
On Fri, Apr 23, 2010 at 1:34 PM, Daniel Brown  wrote:

> On Fri, Apr 23, 2010 at 13:20, Ashley Sheridan 
> wrote:
> >
> > I have heard good things about Windows 7, but I've not used it myself
> > yet (and don't really plan to)
>
> Wise.
>
>[Sent from a Win7 PC.]
>
> --
> 
> daniel.br...@parasane.net || danbr...@php.net
> http://www.parasane.net/ || http://www.pilotpig.net/
> We now offer SAME-DAY SETUP on a new line of servers!
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
I actually rather like Windows 7.  I have one Windows laptop (Windows 7)
that I use for Windows development, one Mac laptop (Snow Leopard) that I use
for general web development, and a Linux box (Ubuntu) for server related
work.

Contrary to my experiences a few years ago, there is no real loser anymore,
they all are very nice and have their advantages.

Adam

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


Re: [PHP] Re: replying to list (I give up)

2010-04-23 Thread Daniel Brown
On Fri, Apr 23, 2010 at 13:20, Ashley Sheridan  
wrote:
>
> I have heard good things about Windows 7, but I've not used it myself
> yet (and don't really plan to)

Wise.

[Sent from a Win7 PC.]

-- 

daniel.br...@parasane.net || danbr...@php.net
http://www.parasane.net/ || http://www.pilotpig.net/
We now offer SAME-DAY SETUP on a new line of servers!

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



Re: [PHP] Re: replying to list (I give up)

2010-04-23 Thread Ashley Sheridan
On Fri, 2010-04-23 at 13:24 -0400, tedd wrote:

> At 5:06 PM +0100 4/23/10, Ashley Sheridan wrote:
> >On Fri, 2010-04-23 at 09:16 -0500, Kevin Kinsey wrote:
> >
> >>  I've still got a Win98 box in service somewhere
> >
> >
> >My commiserations to you, I used that for a couple of years.
> >
> >I suppose it could be worse though. It might have been WinME or Vista.
> >
> >Thanks,
> >Ash
> 
> Or the next wonderful thing, whatever that may be from M$.
> 
> As I saw in a recent cartoon (with a W.C. Fields imitation) "Yes, my 
> little chickadee with a couple of shots of bourbon and if you squint 
> your eyes just right, System 7 looks a lot like Mac OS X".
> 
> Cheers,
> 
> tedd
> 
> -- 
> ---
> http://sperling.com  http://ancientstones.com  http://earthstones.com
> 


I have heard good things about Windows 7, but I've not used it myself
yet (and don't really plan to)

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




Re: [PHP] public readonly variables

2010-04-23 Thread Ashley Sheridan
On Fri, 2010-04-23 at 19:03 +0200, Peter Lind wrote:

> On 23 April 2010 18:26, Ashley Sheridan  wrote:
> >
> > On Fri, 2010-04-23 at 12:25 -0400, Adam Richardson wrote:
> >
> > On Fri, Apr 23, 2010 at 12:21 PM, Peter Lind  wrote:
> >
> > > On 23 April 2010 18:10, Ashley Sheridan  wrote:
> > > > I think for now I'll just resort to leaving it as a public variable.
> > > > I'll leave the specific set function for it in and just hope that is
> > > > used instead! As it's only me who'll be using it for the time being, I
> > > > can always yell at myself later if I forget!
> > >
> > > You're using a setter but a public variable? That's about the worst
> > > compromise, isn't it? Either go down the road of the public variable
> > > or the setter/getter (and in your case I would definitely recommend
> > > the latter). Also, __get/__set are fine, as long as you don't use them
> > > for everything (i.e. 5 magic calls per request will do very, very
> > > little to your app, whereas 1000 per request will have some
> > > significance on a site with lots of users).
> > >
> > > Regards
> > > Peter
> > >
> > > --
> > > 
> > > WWW: http://plphp.dk / http://plind.dk
> > > LinkedIn: http://www.linkedin.com/in/plind
> > > Flickr: http://www.flickr.com/photos/fake51
> > > BeWelcome: Fake51
> > > Couchsurfing: Fake51
> > > 
> > >
> >
> > I agree with Peter, that solutions asks for trouble (something I often do,
> > but avoid publicly advocating ;)
> >
> > The solution I suggested still maintains all of the documentation
> > capabilities (at least in my NetBeans), but enforces protection.  It's not
> > perfect, but it does work relatively well.
> >
> > Adam
> >
> >
> > I am probably looking at a lot of getters in the code though, so the 
> > overhead I'd rather avoid. The setter is to go some way towards keeping the 
> > values sane, which I realise goes against the whole public variable thing, 
> > which is the reason for my original question.
> >
> > Another reason for the setter is that it actually modifies a couple of 
> > variables, so there's no good way of getting rid of that, as it would then 
> > mean setting two properties of the object manually, which would actually 
> > lead to more issues down the line if not set correctly.
> >
> 
> If you're just creating the project now, I'd autogenerate the classes,
> to avoid the manual work. Otherwise, I'd give it some long thought
> then grit my teeth and dig in.
> 
> Regards
> Peter
> 
> 
> --
> 
> WWW: http://plphp.dk / http://plind.dk
> LinkedIn: http://www.linkedin.com/in/plind
> Flickr: http://www.flickr.com/photos/fake51
> BeWelcome: Fake51
> Couchsurfing: Fake51
> 


I will be auto-generating the objects, but I'm not sure what you mean by
auto-generating the classes?

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




Re: [PHP] Re: replying to list (I give up)

2010-04-23 Thread tedd

At 5:06 PM +0100 4/23/10, Ashley Sheridan wrote:

On Fri, 2010-04-23 at 09:16 -0500, Kevin Kinsey wrote:


 I've still got a Win98 box in service somewhere



My commiserations to you, I used that for a couple of years.

I suppose it could be worse though. It might have been WinME or Vista.

Thanks,
Ash


Or the next wonderful thing, whatever that may be from M$.

As I saw in a recent cartoon (with a W.C. Fields imitation) "Yes, my 
little chickadee with a couple of shots of bourbon and if you squint 
your eyes just right, System 7 looks a lot like Mac OS X".


Cheers,

tedd

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

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



Re: [PHP] public readonly variables

2010-04-23 Thread Peter Lind
On 23 April 2010 18:26, Ashley Sheridan  wrote:
>
> On Fri, 2010-04-23 at 12:25 -0400, Adam Richardson wrote:
>
> On Fri, Apr 23, 2010 at 12:21 PM, Peter Lind  wrote:
>
> > On 23 April 2010 18:10, Ashley Sheridan  wrote:
> > > I think for now I'll just resort to leaving it as a public variable.
> > > I'll leave the specific set function for it in and just hope that is
> > > used instead! As it's only me who'll be using it for the time being, I
> > > can always yell at myself later if I forget!
> >
> > You're using a setter but a public variable? That's about the worst
> > compromise, isn't it? Either go down the road of the public variable
> > or the setter/getter (and in your case I would definitely recommend
> > the latter). Also, __get/__set are fine, as long as you don't use them
> > for everything (i.e. 5 magic calls per request will do very, very
> > little to your app, whereas 1000 per request will have some
> > significance on a site with lots of users).
> >
> > Regards
> > Peter
> >
> > --
> > 
> > WWW: http://plphp.dk / http://plind.dk
> > LinkedIn: http://www.linkedin.com/in/plind
> > Flickr: http://www.flickr.com/photos/fake51
> > BeWelcome: Fake51
> > Couchsurfing: Fake51
> > 
> >
>
> I agree with Peter, that solutions asks for trouble (something I often do,
> but avoid publicly advocating ;)
>
> The solution I suggested still maintains all of the documentation
> capabilities (at least in my NetBeans), but enforces protection.  It's not
> perfect, but it does work relatively well.
>
> Adam
>
>
> I am probably looking at a lot of getters in the code though, so the overhead 
> I'd rather avoid. The setter is to go some way towards keeping the values 
> sane, which I realise goes against the whole public variable thing, which is 
> the reason for my original question.
>
> Another reason for the setter is that it actually modifies a couple of 
> variables, so there's no good way of getting rid of that, as it would then 
> mean setting two properties of the object manually, which would actually lead 
> to more issues down the line if not set correctly.
>

If you're just creating the project now, I'd autogenerate the classes,
to avoid the manual work. Otherwise, I'd give it some long thought
then grit my teeth and dig in.

Regards
Peter


--

WWW: http://plphp.dk / http://plind.dk
LinkedIn: http://www.linkedin.com/in/plind
Flickr: http://www.flickr.com/photos/fake51
BeWelcome: Fake51
Couchsurfing: Fake51


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



Re: [PHP] Remote Key Question

2010-04-23 Thread Adam Richardson
On Fri, Apr 23, 2010 at 12:36 PM, David Murphy wrote:

> GRR I hate outlook veruses Trillian
>
>
>
>
> Personally I would make
>
>
>
> Author:
> Id|Name|Bio
>
> Article:
> Id,title,desc,authordata
>
>
> So then I can do things like
>
> Select Articles.Title, article.Description,(select GROUP_CONCAT(Name) from
> authors where authors.ID IN Articles.AuthorData) as Authors from Articles
> where Articles.ID=XXX
>
>
> Then php could $tAuthors=explode(",",$row['Authors']); and pass that into
> smarty or whatever for the view portion of the  app.
>
> I just say this because Junction tables really don't save you much  and
> infact this it's very clear what your doing.
>
> David
>
> -Original Message-
> From: Adam Richardson [mailto:simples...@gmail.com]
> Sent: Friday, April 23, 2010 11:09 AM
> To: tedd
> Cc: PHP eMail List
> Subject: Re: [PHP] Remote Key Question
>
> On Fri, Apr 23, 2010 at 12:03 PM, tedd  wrote:
>
> > Hi gang:
> >
> > A few times I've found myself confronted with a problem that might be
> > better solved than the way I currently solve it. I would like your
> > opinions/solutions as to how you might solve this.
> >
> > Here's the given (as an article/author example).
> >
> > I want to create a list of articles in a database.
> >
> > The articles are listed in a table with the fields "title",
> "description",
> > and "author".
> >
> > article table:
> > id - title - description - author
> >
> > The authors are listed in a table with the fields "name" and bio".
> >
> > author table:
> > id - name - bio
> >
> > Now here's the problem each articles will have one, but perhaps more
> > authors -- so how do I record the authors in the article table?
> >
> > As it is now, I use the remote key for each author and separate each key
> by
> > a comma in the author field of the article table. For example:
> >
> > author table:
> > id - name - bio
> > 1 - tedd - tedd's bio
> > 2 - Rob - Rob's bio
> > 3 - Daniel - Daniel's bio
> >
> > article table:
> > id - title - description - author
> > 1 - PHP Beginner - Beginner Topics - 1
> > 2 - PHP Intermediate - Intermediate Topics - 1,2
> > 3 - PHP Advanced - Advanced Topics - 1,2,3
> >
> > As such, article with id=3 has a title of " PHP Advanced" and a
> description
> > of "Advanced Topics" with tedd, Rob, and Daniel as authors.
> >
> > Is there a better way to link multiple authors to an article rather than
> > placing the remote keys in one field and separating them with commas?
> >
> > Cheers,
> >
> > tedd
> >
> > --
> > ---
> > http://sperling.com  http://ancientstones.com  http://earthstones.com
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
> Well, because each author can have multiple articles and each article can
> have multiple authors, the many-to-many relationship can use a junction
> table:
>
> http://en.wikipedia.org/wiki/Junction_table
>
> In this case articles_authors.
>
> Adam
>
> --
> Nephtali:  PHP web framework that functions beautifully
> http://nephtaliproject.com
>
>
There is a trend towards denormalization (see BigTable, SimpleDB, etc), and
generally, I'm an advocate of the phrase "Normalize until it hurts,
denormalize until it works."

However, part of the question is how does Tedd want to be able to query the
data.  If it's possible that he wants to query from the authors table to the
articles table (e.g., select all of the articles that Richard wrote), a
junction table gets much more useful (and easy relative to the denormalized
approach), especially as the queries increase in complexity.

So, Tedd, I'd carefully evaluate your expected query needs, and if they're
basic, your current scheme would work, but I suspect a junction table would
be better in this particular case.

Happy coding,

Adam

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


RE: [PHP] Remote Key Question

2010-04-23 Thread David Murphy
-Original Message-
From: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk] 
Sent: Friday, April 23, 2010 11:16 AM
To: tedd
Cc: PHP eMail List
Subject: Re: [PHP] Remote Key Question

On Fri, 2010-04-23 at 12:03 -0400, tedd wrote:
> Hi gang:
> 
> A few times I've found myself confronted with a problem that might be 
> better solved than the way I currently solve it. I would like your 
> opinions/solutions as to how you might solve this.
> 
> Here's the given (as an article/author example).
> 
> I want to create a list of articles in a database.
> 
> The articles are listed in a table with the fields "title", 
> "description", and "author".
> 
> article table:
> id - title - description - author
> 
> The authors are listed in a table with the fields "name" and bio".
> 
> author table:
> id - name - bio
> 
> Now here's the problem each articles will have one, but perhaps more 
> authors -- so how do I record the authors in the article table?
> 
> As it is now, I use the remote key for each author and separate each 
> key by a comma in the author field of the article table. For example:
> 
> author table:
> id - name - bio
> 1 - tedd - tedd's bio
> 2 - Rob - Rob's bio
> 3 - Daniel - Daniel's bio
> 
> article table:
> id - title - description - author
> 1 - PHP Beginner - Beginner Topics - 1
> 2 - PHP Intermediate - Intermediate Topics - 1,2
> 3 - PHP Advanced - Advanced Topics - 1,2,3
> 
> As such, article with id=3 has a title of " PHP Advanced" and a 
> description of "Advanced Topics" with tedd, Rob, and Daniel as 
> authors.
> 
> Is there a better way to link multiple authors to an article rather 
> than placing the remote keys in one field and separating them with 
> commas?
> 
> Cheers,
> 
> tedd
> 
> -- 
> ---
> http://sperling.com  http://ancientstones.com  http://earthstones.com
> 

If you can change the authors table couldn't you add a article_id field
to it? If not, or if an author may belong to more than one article (many
to many) then a third table is the way to go, and use a couple of joins.

A third table does have the added advantage that you might specify the
type of author they were. For example:

idauthor_idarticle_idtype(enum maybe?)
1 11 main
2 21 co
3 12 main

The third table is obviously more complex, but offers a better
relationship model to be built between authors and articles.

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




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


Agreed,

It really depended if this is a permission based system or more info based. 
If  its just for listing authors of an article, not letting them edit it,
the  my solution is best but if it was was editing I would go with Ash's
approach maybe even  making is  so its something like



ArticleParts:
ID|ORDER|ArticleID|UserID|ENUM("OWNER","CONTRIBUTOR")


So that the owner can edit any ArticlePart in their article but the
CONTRIBUTOR can only edit their specific part. And ordery would tell you how
to order the parts for final output.


David


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



RE: [PHP] Remote Key Question

2010-04-23 Thread Ashley Sheridan
On Fri, 2010-04-23 at 11:36 -0500, David Murphy wrote:

> GRR I hate outlook veruses Trillian


One's an email client and one's a messenger client, I don't get where
your vs problems are? :p

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




RE: [PHP] Remote Key Question

2010-04-23 Thread David Murphy
GRR I hate outlook veruses Trillian




Personally I would make



Author:
Id|Name|Bio

Article:
Id,title,desc,authordata


So then I can do things like

Select Articles.Title, article.Description,(select GROUP_CONCAT(Name) from
authors where authors.ID IN Articles.AuthorData) as Authors from Articles
where Articles.ID=XXX


Then php could $tAuthors=explode(",",$row['Authors']); and pass that into
smarty or whatever for the view portion of the  app.

I just say this because Junction tables really don't save you much  and
infact this it's very clear what your doing.

David

-Original Message-
From: Adam Richardson [mailto:simples...@gmail.com] 
Sent: Friday, April 23, 2010 11:09 AM
To: tedd
Cc: PHP eMail List
Subject: Re: [PHP] Remote Key Question

On Fri, Apr 23, 2010 at 12:03 PM, tedd  wrote:

> Hi gang:
>
> A few times I've found myself confronted with a problem that might be
> better solved than the way I currently solve it. I would like your
> opinions/solutions as to how you might solve this.
>
> Here's the given (as an article/author example).
>
> I want to create a list of articles in a database.
>
> The articles are listed in a table with the fields "title", "description",
> and "author".
>
> article table:
> id - title - description - author
>
> The authors are listed in a table with the fields "name" and bio".
>
> author table:
> id - name - bio
>
> Now here's the problem each articles will have one, but perhaps more
> authors -- so how do I record the authors in the article table?
>
> As it is now, I use the remote key for each author and separate each key
by
> a comma in the author field of the article table. For example:
>
> author table:
> id - name - bio
> 1 - tedd - tedd's bio
> 2 - Rob - Rob's bio
> 3 - Daniel - Daniel's bio
>
> article table:
> id - title - description - author
> 1 - PHP Beginner - Beginner Topics - 1
> 2 - PHP Intermediate - Intermediate Topics - 1,2
> 3 - PHP Advanced - Advanced Topics - 1,2,3
>
> As such, article with id=3 has a title of " PHP Advanced" and a
description
> of "Advanced Topics" with tedd, Rob, and Daniel as authors.
>
> Is there a better way to link multiple authors to an article rather than
> placing the remote keys in one field and separating them with commas?
>
> Cheers,
>
> tedd
>
> --
> ---
> http://sperling.com  http://ancientstones.com  http://earthstones.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
Well, because each author can have multiple articles and each article can
have multiple authors, the many-to-many relationship can use a junction
table:

http://en.wikipedia.org/wiki/Junction_table

In this case articles_authors.

Adam

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


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



Re: [PHP] public readonly variables

2010-04-23 Thread Ashley Sheridan
On Fri, 2010-04-23 at 12:25 -0400, Adam Richardson wrote:

> On Fri, Apr 23, 2010 at 12:21 PM, Peter Lind  wrote:
> 
> > On 23 April 2010 18:10, Ashley Sheridan  wrote:
> > > I think for now I'll just resort to leaving it as a public variable.
> > > I'll leave the specific set function for it in and just hope that is
> > > used instead! As it's only me who'll be using it for the time being, I
> > > can always yell at myself later if I forget!
> >
> > You're using a setter but a public variable? That's about the worst
> > compromise, isn't it? Either go down the road of the public variable
> > or the setter/getter (and in your case I would definitely recommend
> > the latter). Also, __get/__set are fine, as long as you don't use them
> > for everything (i.e. 5 magic calls per request will do very, very
> > little to your app, whereas 1000 per request will have some
> > significance on a site with lots of users).
> >
> > Regards
> > Peter
> >
> > --
> > 
> > WWW: http://plphp.dk / http://plind.dk
> > LinkedIn: http://www.linkedin.com/in/plind
> > Flickr: http://www.flickr.com/photos/fake51
> > BeWelcome: Fake51
> > Couchsurfing: Fake51
> > 
> >
> 
> I agree with Peter, that solutions asks for trouble (something I often do,
> but avoid publicly advocating ;)
> 
> The solution I suggested still maintains all of the documentation
> capabilities (at least in my NetBeans), but enforces protection.  It's not
> perfect, but it does work relatively well.
> 
> Adam
> 


I am probably looking at a lot of getters in the code though, so the
overhead I'd rather avoid. The setter is to go some way towards keeping
the values sane, which I realise goes against the whole public variable
thing, which is the reason for my original question.

Another reason for the setter is that it actually modifies a couple of
variables, so there's no good way of getting rid of that, as it would
then mean setting two properties of the object manually, which would
actually lead to more issues down the line if not set correctly.

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




RE: [PHP] Remote Key Question

2010-04-23 Thread David Murphy
Personally I would make

-Original Message-
From: Adam Richardson [mailto:simples...@gmail.com] 
Sent: Friday, April 23, 2010 11:09 AM
To: tedd
Cc: PHP eMail List
Subject: Re: [PHP] Remote Key Question

On Fri, Apr 23, 2010 at 12:03 PM, tedd  wrote:

> Hi gang:
>
> A few times I've found myself confronted with a problem that might be
> better solved than the way I currently solve it. I would like your
> opinions/solutions as to how you might solve this.
>
> Here's the given (as an article/author example).
>
> I want to create a list of articles in a database.
>
> The articles are listed in a table with the fields "title", "description",
> and "author".
>
> article table:
> id - title - description - author
>
> The authors are listed in a table with the fields "name" and bio".
>
> author table:
> id - name - bio
>
> Now here's the problem each articles will have one, but perhaps more
> authors -- so how do I record the authors in the article table?
>
> As it is now, I use the remote key for each author and separate each key
by
> a comma in the author field of the article table. For example:
>
> author table:
> id - name - bio
> 1 - tedd - tedd's bio
> 2 - Rob - Rob's bio
> 3 - Daniel - Daniel's bio
>
> article table:
> id - title - description - author
> 1 - PHP Beginner - Beginner Topics - 1
> 2 - PHP Intermediate - Intermediate Topics - 1,2
> 3 - PHP Advanced - Advanced Topics - 1,2,3
>
> As such, article with id=3 has a title of " PHP Advanced" and a
description
> of "Advanced Topics" with tedd, Rob, and Daniel as authors.
>
> Is there a better way to link multiple authors to an article rather than
> placing the remote keys in one field and separating them with commas?
>
> Cheers,
>
> tedd
>
> --
> ---
> http://sperling.com  http://ancientstones.com  http://earthstones.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
Well, because each author can have multiple articles and each article can
have multiple authors, the many-to-many relationship can use a junction
table:

http://en.wikipedia.org/wiki/Junction_table

In this case articles_authors.

Adam

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


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



Re: [PHP] public readonly variables

2010-04-23 Thread Adam Richardson
On Fri, Apr 23, 2010 at 12:21 PM, Peter Lind  wrote:

> On 23 April 2010 18:10, Ashley Sheridan  wrote:
> > I think for now I'll just resort to leaving it as a public variable.
> > I'll leave the specific set function for it in and just hope that is
> > used instead! As it's only me who'll be using it for the time being, I
> > can always yell at myself later if I forget!
>
> You're using a setter but a public variable? That's about the worst
> compromise, isn't it? Either go down the road of the public variable
> or the setter/getter (and in your case I would definitely recommend
> the latter). Also, __get/__set are fine, as long as you don't use them
> for everything (i.e. 5 magic calls per request will do very, very
> little to your app, whereas 1000 per request will have some
> significance on a site with lots of users).
>
> Regards
> Peter
>
> --
> 
> WWW: http://plphp.dk / http://plind.dk
> LinkedIn: http://www.linkedin.com/in/plind
> Flickr: http://www.flickr.com/photos/fake51
> BeWelcome: Fake51
> Couchsurfing: Fake51
> 
>

I agree with Peter, that solutions asks for trouble (something I often do,
but avoid publicly advocating ;)

The solution I suggested still maintains all of the documentation
capabilities (at least in my NetBeans), but enforces protection.  It's not
perfect, but it does work relatively well.

Adam

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


Re: [PHP] Remote Key Question

2010-04-23 Thread Ashley Sheridan
On Fri, 2010-04-23 at 12:03 -0400, tedd wrote:
> Hi gang:
> 
> A few times I've found myself confronted with a problem that might be 
> better solved than the way I currently solve it. I would like your 
> opinions/solutions as to how you might solve this.
> 
> Here's the given (as an article/author example).
> 
> I want to create a list of articles in a database.
> 
> The articles are listed in a table with the fields "title", 
> "description", and "author".
> 
> article table:
> id - title - description - author
> 
> The authors are listed in a table with the fields "name" and bio".
> 
> author table:
> id - name - bio
> 
> Now here's the problem each articles will have one, but perhaps more 
> authors -- so how do I record the authors in the article table?
> 
> As it is now, I use the remote key for each author and separate each 
> key by a comma in the author field of the article table. For example:
> 
> author table:
> id - name - bio
> 1 - tedd - tedd's bio
> 2 - Rob - Rob's bio
> 3 - Daniel - Daniel's bio
> 
> article table:
> id - title - description - author
> 1 - PHP Beginner - Beginner Topics - 1
> 2 - PHP Intermediate - Intermediate Topics - 1,2
> 3 - PHP Advanced - Advanced Topics - 1,2,3
> 
> As such, article with id=3 has a title of " PHP Advanced" and a 
> description of "Advanced Topics" with tedd, Rob, and Daniel as 
> authors.
> 
> Is there a better way to link multiple authors to an article rather 
> than placing the remote keys in one field and separating them with 
> commas?
> 
> Cheers,
> 
> tedd
> 
> -- 
> ---
> http://sperling.com  http://ancientstones.com  http://earthstones.com
> 

If you can change the authors table couldn't you add a article_id field
to it? If not, or if an author may belong to more than one article (many
to many) then a third table is the way to go, and use a couple of joins.

A third table does have the added advantage that you might specify the
type of author they were. For example:

idauthor_idarticle_idtype(enum maybe?)
1 11 main
2 21 co
3 12 main

The third table is obviously more complex, but offers a better
relationship model to be built between authors and articles.

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




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



Re: [PHP] public readonly variables

2010-04-23 Thread Peter Lind
On 23 April 2010 18:10, Ashley Sheridan  wrote:
> I think for now I'll just resort to leaving it as a public variable.
> I'll leave the specific set function for it in and just hope that is
> used instead! As it's only me who'll be using it for the time being, I
> can always yell at myself later if I forget!

You're using a setter but a public variable? That's about the worst
compromise, isn't it? Either go down the road of the public variable
or the setter/getter (and in your case I would definitely recommend
the latter). Also, __get/__set are fine, as long as you don't use them
for everything (i.e. 5 magic calls per request will do very, very
little to your app, whereas 1000 per request will have some
significance on a site with lots of users).

Regards
Peter

-- 

WWW: http://plphp.dk / http://plind.dk
LinkedIn: http://www.linkedin.com/in/plind
Flickr: http://www.flickr.com/photos/fake51
BeWelcome: Fake51
Couchsurfing: Fake51


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



Re: [PHP] public readonly variables

2010-04-23 Thread Ashley Sheridan
On Fri, 2010-04-23 at 11:57 -0400, Adam Richardson wrote:

> On Fri, Apr 23, 2010 at 6:19 AM, Richard Quadling
> wrote:
> 
> > On 23 April 2010 10:55, Ashley Sheridan  wrote:
> > > I know the subject line might sound a bit like an oxymoron, but bear
> > > with me!
> > >
> > > What I'd like to have is a property of an object that behaves like a
> > > public variable when it comes to reading, but like a protected one when
> > > it comes to writing, as it would make my code a lot easier to read.
> > >
> > > I know about the __get($var) method to magically provide this behaviour,
> > > but from all I've read it can be pretty slow compared to a regular
> > > public variable. I've seen a thread on the dev lists where someone
> > > requested it, but can't find anything in the manual.
> > >
> > > Does anyone know if this is available in a later version of PHP, or if
> > > it's implementation is penned for some time in the future?
> > >
> > > Thanks,
> > > Ash
> > > http://www.ashleysheridan.co.uk
> > >
> > >
> > >
> >
> > What you are asking for is commonly known as accessibility. This has
> > been discussed on the list and is something I think would be a great
> > feature.
> >
> > http://wiki.php.net/rfc/propertygetsetsyntax is an incomplete RFC (it
> > says it is incomplete at the top).
> >
> > The last update was 2010/01/08 22:11, so a few months old.
> >
> > Hopefully, some of the clever brains here can get to grips with it and
> > come to some consensus.
> >
> >
> > Whilst you can easily code __get()/__set() or getVar()/setVar()
> > methods to deal with it, with the later ones being significantly
> > easier to docblock, there is no easy way to document the property,
> > only the methods to set or get the property.
> >
> >
> > Richard.
> >
> >
> >
> >
> >
> >
> > --
> > -
> > Richard Quadling
> > "Standing on the shoulders of some very clever giants!"
> > EE : http://www.experts-exchange.com/M_248814.html
> > EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
> > Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
> > ZOPA : http://uk.zopa.com/member/RQuadling
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
> I've sometimes implemented a scheme where I create the variable, then unset
> it in the constructor and rely on the magic method.  I know you were
> concerned about the performance of magic methods, and I don't have a
> solution for that :(
> 
> For example:
> 
>  /**
>  * Description of PHPClass that documents nicely and still protects
> variables from reassignment.
>  *
>  * @author Adam Richardson
>  */
> class PHPClass {
> /**
>  * Name for object.
>  * @var String
>  */
> public $name;
> /**
>  * Size of something really important.
>  * @var int
>  */
> public $size;
> /**
>  * Local storage of magic vars
>  * @var array
>  */
> private $_vars = array();
> /**
>  * Create object and initialize instance vars.
>  * @param array $instance_vars
>  */
> function __construct(array $instance_vars)
> {
> unset($this->name);
> unset($this->size);
> 
> $this->_vars = $instance_vars;
> }
> function __get($name)
> {
> return $this->_vars[$name];
> }
> }
> 
> $obj = new PHPClass($instance_vars = array('name' => 'Billy', 'size' =>
> 1000));
> 
> echo $obj->name;
> 
> ?>
> 
> Adam
> 


I think for now I'll just resort to leaving it as a public variable.
I'll leave the specific set function for it in and just hope that is
used instead! As it's only me who'll be using it for the time being, I
can always yell at myself later if I forget!

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




Re: [PHP] Re: replying to list (I give up)

2010-04-23 Thread Ashley Sheridan
On Fri, 2010-04-23 at 09:16 -0500, Kevin Kinsey wrote:

> I've still got a Win98 box in service somewhere


My commiserations to you, I used that for a couple of years.

I suppose it could be worse though. It might have been WinME or Vista.

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




Re: [PHP] Remote Key Question

2010-04-23 Thread Adam Richardson
On Fri, Apr 23, 2010 at 12:03 PM, tedd  wrote:

> Hi gang:
>
> A few times I've found myself confronted with a problem that might be
> better solved than the way I currently solve it. I would like your
> opinions/solutions as to how you might solve this.
>
> Here's the given (as an article/author example).
>
> I want to create a list of articles in a database.
>
> The articles are listed in a table with the fields "title", "description",
> and "author".
>
> article table:
> id - title - description - author
>
> The authors are listed in a table with the fields "name" and bio".
>
> author table:
> id - name - bio
>
> Now here's the problem each articles will have one, but perhaps more
> authors -- so how do I record the authors in the article table?
>
> As it is now, I use the remote key for each author and separate each key by
> a comma in the author field of the article table. For example:
>
> author table:
> id - name - bio
> 1 - tedd - tedd's bio
> 2 - Rob - Rob's bio
> 3 - Daniel - Daniel's bio
>
> article table:
> id - title - description - author
> 1 - PHP Beginner - Beginner Topics - 1
> 2 - PHP Intermediate - Intermediate Topics - 1,2
> 3 - PHP Advanced - Advanced Topics - 1,2,3
>
> As such, article with id=3 has a title of " PHP Advanced" and a description
> of "Advanced Topics" with tedd, Rob, and Daniel as authors.
>
> Is there a better way to link multiple authors to an article rather than
> placing the remote keys in one field and separating them with commas?
>
> Cheers,
>
> tedd
>
> --
> ---
> http://sperling.com  http://ancientstones.com  http://earthstones.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
Well, because each author can have multiple articles and each article can
have multiple authors, the many-to-many relationship can use a junction
table:

http://en.wikipedia.org/wiki/Junction_table

In this case articles_authors.

Adam

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


[PHP] Remote Key Question

2010-04-23 Thread tedd

Hi gang:

A few times I've found myself confronted with a problem that might be 
better solved than the way I currently solve it. I would like your 
opinions/solutions as to how you might solve this.


Here's the given (as an article/author example).

I want to create a list of articles in a database.

The articles are listed in a table with the fields "title", 
"description", and "author".


article table:
id - title - description - author

The authors are listed in a table with the fields "name" and bio".

author table:
id - name - bio

Now here's the problem each articles will have one, but perhaps more 
authors -- so how do I record the authors in the article table?


As it is now, I use the remote key for each author and separate each 
key by a comma in the author field of the article table. For example:


author table:
id - name - bio
1 - tedd - tedd's bio
2 - Rob - Rob's bio
3 - Daniel - Daniel's bio

article table:
id - title - description - author
1 - PHP Beginner - Beginner Topics - 1
2 - PHP Intermediate - Intermediate Topics - 1,2
3 - PHP Advanced - Advanced Topics - 1,2,3

As such, article with id=3 has a title of " PHP Advanced" and a 
description of "Advanced Topics" with tedd, Rob, and Daniel as 
authors.


Is there a better way to link multiple authors to an article rather 
than placing the remote keys in one field and separating them with 
commas?


Cheers,

tedd

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

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



Re: [PHP] public readonly variables

2010-04-23 Thread Adam Richardson
On Fri, Apr 23, 2010 at 6:19 AM, Richard Quadling
wrote:

> On 23 April 2010 10:55, Ashley Sheridan  wrote:
> > I know the subject line might sound a bit like an oxymoron, but bear
> > with me!
> >
> > What I'd like to have is a property of an object that behaves like a
> > public variable when it comes to reading, but like a protected one when
> > it comes to writing, as it would make my code a lot easier to read.
> >
> > I know about the __get($var) method to magically provide this behaviour,
> > but from all I've read it can be pretty slow compared to a regular
> > public variable. I've seen a thread on the dev lists where someone
> > requested it, but can't find anything in the manual.
> >
> > Does anyone know if this is available in a later version of PHP, or if
> > it's implementation is penned for some time in the future?
> >
> > Thanks,
> > Ash
> > http://www.ashleysheridan.co.uk
> >
> >
> >
>
> What you are asking for is commonly known as accessibility. This has
> been discussed on the list and is something I think would be a great
> feature.
>
> http://wiki.php.net/rfc/propertygetsetsyntax is an incomplete RFC (it
> says it is incomplete at the top).
>
> The last update was 2010/01/08 22:11, so a few months old.
>
> Hopefully, some of the clever brains here can get to grips with it and
> come to some consensus.
>
>
> Whilst you can easily code __get()/__set() or getVar()/setVar()
> methods to deal with it, with the later ones being significantly
> easier to docblock, there is no easy way to document the property,
> only the methods to set or get the property.
>
>
> Richard.
>
>
>
>
>
>
> --
> -
> Richard Quadling
> "Standing on the shoulders of some very clever giants!"
> EE : http://www.experts-exchange.com/M_248814.html
> EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
> Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
> ZOPA : http://uk.zopa.com/member/RQuadling
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
I've sometimes implemented a scheme where I create the variable, then unset
it in the constructor and rely on the magic method.  I know you were
concerned about the performance of magic methods, and I don't have a
solution for that :(

For example:

name);
unset($this->size);

$this->_vars = $instance_vars;
}
function __get($name)
{
return $this->_vars[$name];
}
}

$obj = new PHPClass($instance_vars = array('name' => 'Billy', 'size' =>
1000));

echo $obj->name;

?>

Adam

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


Re: [PHP] creating a PHP wrapper script?

2010-04-23 Thread Peter Lind
php.net/curl should be able to do what you want.

file_get_contents with a proper stream context should also work (have
a look at functions like http://dk.php.net/manual/en/context.http.php
)

Regards
Peter

On 23 April 2010 17:18, Robert P. J. Day  wrote:
>
>  i'm sure this isn't hard to do, but i'm having end-of-week brain
> cramps.  just now, i installed a PHP package that lets me download
> thumbnails of image files stored on a server -- the URL to generate
> and download a thumbnail is, say:
>
> http://server/d1/d2/thumbnail.php?fileID=whatever&arg1=val1&arg2=val2
>
> and so on.  unsurprisingly, the thumbnail generation program accepts
> numerous arguments and is incredibly sophisticated, and is stored in a
> subdirectory under /var/www/html and ... well, you get the idea,
> calling it directly involves creating quite the URL.
>
>  instead, i'd like to stuff a wrapper script at the top of the
> document root which hides all that complexity, so i can just browse
> to:
>
> http://server/thumb.php?fileID=whatever
>
> and have that top-level thumb.php script make the appropriate
> invocation to the real thumbnail.php script with all of those
> (default) arguments and values.
>
>  so, what would thumb.php look like?  i obviously need to simulate a
> POST call, retrieve the output and pass it back unchanged.  thoughts?
> surely this is something that people want to do on a regular basis,
> no?
>
> rday
> --
>
> 
> Robert P. J. Day                               Waterloo, Ontario, CANADA
>
>            Linux Consulting, Training and Kernel Pedantry.
>
> Web page:                                          http://crashcourse.ca
> Twitter:                                       http://twitter.com/rpjday
> 
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>



-- 

WWW: http://plphp.dk / http://plind.dk
LinkedIn: http://www.linkedin.com/in/plind
Flickr: http://www.flickr.com/photos/fake51
BeWelcome: Fake51
Couchsurfing: Fake51


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



[PHP] creating a PHP wrapper script?

2010-04-23 Thread Robert P. J. Day

  i'm sure this isn't hard to do, but i'm having end-of-week brain
cramps.  just now, i installed a PHP package that lets me download
thumbnails of image files stored on a server -- the URL to generate
and download a thumbnail is, say:

http://server/d1/d2/thumbnail.php?fileID=whatever&arg1=val1&arg2=val2

and so on.  unsurprisingly, the thumbnail generation program accepts
numerous arguments and is incredibly sophisticated, and is stored in a
subdirectory under /var/www/html and ... well, you get the idea,
calling it directly involves creating quite the URL.

  instead, i'd like to stuff a wrapper script at the top of the
document root which hides all that complexity, so i can just browse
to:

http://server/thumb.php?fileID=whatever

and have that top-level thumb.php script make the appropriate
invocation to the real thumbnail.php script with all of those
(default) arguments and values.

  so, what would thumb.php look like?  i obviously need to simulate a
POST call, retrieve the output and pass it back unchanged.  thoughts?
surely this is something that people want to do on a regular basis,
no?

rday
--


Robert P. J. Day   Waterloo, Ontario, CANADA

Linux Consulting, Training and Kernel Pedantry.

Web page:  http://crashcourse.ca
Twitter:   http://twitter.com/rpjday


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



Re: [PHP] Re: Getting Array to Display

2010-04-23 Thread Gary
I'm sorry for the delay in response, I was able to create the child table, 
which works great.

So thank you to everyone that responded & Helped.

Gary

ps: Yes Ashley, I was monitoring the DB itself and not just the display 
table I created...


"Ashley Sheridan"  wrote in message 
news:1271929872.20937.24.ca...@localhost...
> On Wed, 2010-04-21 at 14:18 -0400, Gary wrote:
>
>> As an addition to the issue, when I do a SELECT FROM and call for a 
>> specific
>> keyword, it does not return any records..
>>
>>
>> Gary
>>
>>
>> ""Gary""  wrote in message
>> news:70.50.63467.0020f...@pb1.pair.com...
>> >I have a form that I have a (ever growing) list of checkboxes,  Here is 
>> >a
>> > sample of  the code for it.
>> >
>> > 
>> >
>> > It seems to go in, when I say seems to, I get a result of Array in the
>> > table, the code is listed below.  I have tried various solutions I 
>> > found
>> > in
>> > searching the issue, but have only been able to so far get Array.
>> >
>> >  echo 'Id NumberDate
>> > EnteredCaptionWhere
>> > TakenKeywordsDescriptionImage';
>> >  while ($row = mysqli_fetch_array($data)) {
>> >
>> >echo '' . $row['image_id']. '';
>> >   echo '' . $row['submitted']. '';
>> >echo '' . $row['caption']. '';
>> >echo '' . $row['where_taken'] . '';
>> >echo '' . $row['keyword']. '';
>> >   echo '' . $row['description'] . '';
>> >  if (is_file($row['image_file'])) {
>> >  echo '> > height="100px"/>';
>> >  }
>> >
>> > As a bonus question, does anyone have any idea why the image would show 
>> > up
>> > in IE8, and not FF?
>> >
>> > Thanks for your help.
>> >
>> > Gary
>> >
>> >
>> >
>> > __ Information from ESET Smart Security, version of virus
>> > signature database 5047 (20100421) __
>> >
>> > The message was checked by ESET Smart Security.
>> >
>> > http://www.eset.com
>> >
>> >
>> >
>> >
>> >
>> > __ Information from ESET NOD32 Antivirus, version of virus
>> > signature database 5048 (20100421) __
>> >
>> > The message was checked by ESET NOD32 Antivirus.
>> >
>> > http://www.eset.com
>> >
>> >
>> >
>>
>>
>> __ Information from ESET NOD32 Antivirus, version of virus 
>> signature database 5048 (20100421) __
>>
>> The message was checked by ESET NOD32 Antivirus.
>>
>> http://www.eset.com
>>
>>
>>
>>
>
>
> That's because you havn't stored any keywords in the DB! You've stored
> the word 'Array'. Have you actually looked at the data with phpMyAdmin
> at all?
>
> Thanks,
> Ash
> http://www.ashleysheridan.co.uk
>
>
>
>
>
> __ Information from ESET Smart Security, version of virus 
> signature database 5049 (20100422) __
>
> The message was checked by ESET Smart Security.
>
> http://www.eset.com
>
> 



__ Information from ESET Smart Security, version of virus signature 
database 5053 (20100423) __

The message was checked by ESET Smart Security.

http://www.eset.com





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



Re: [PHP] Math Question....

2010-04-23 Thread Richard Quadling


Supply a value and an optional maximum group size.

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



Re: [PHP] Math Question....

2010-04-23 Thread tedd

At 10:17 AM -0400 4/22/10, Dan Joseph wrote:

On Thu, Apr 22, 2010 at 10:12 AM, Stephen  wrote:


 1,252,398 DIV 30 = 41,746 groups of 30.

 1,252,398 MOD 30 = 18 items in last group


Well, the only problem with going that route, is the one group is not
equally sized to the others.  18 is ok for a group in this instance, but if
it was a remainder of only 1 or 2, there would be an issue.  Which is where
I come to looking for a the right method to break it equally.

--
-Dan Joseph



_Dan:

As I see it -- you are asking is "What would be the 'optimum' group 
size for 1,252,398?"


"Optimum" here meaning:

1. A group size of 30 or under;
2. All groups being of equal size.

Is that correct?

There may not be an exact solution, but a first order attempt would 
be to divide the total number by 30 and check the remainder (i.e., 
MOD), the do the same for 29, 28, 27... and so on.


The group size "solution" would be a number with a zero remainder OR 
with a remainder closest to your group size.


That would be my first blush solution.

Cheers,

tedd

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

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



Re: [PHP] escape \n

2010-04-23 Thread Lupus Michaelis

Le 23/04/2010 10:05, Ashley Sheridan a écrit :

By default, PHP sends out HTML headers. Browsers ignore extraneous
white-space characters, and also new lines, carriage returns and tabs,
converting them all to a single space character.


  For completeness, the white-space discarding depends about the 
context the characters are met. For more inside, Nick could look into 
.


  So said, the browser doesn't convert, it renders ;)

--
Mickaël Wolff aka Lupus Michaelis
http://lupusmic.org

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



Re: [PHP] Re: replying to list (I give up)

2010-04-23 Thread Kevin Kinsey

Bobby Pejman wrote:
I must say, I never heard or even thought of the idea of calling it 

> LookOut. Hahaha.  It made me laugh for a good 10 minutes and
> if that term is open source, I will be using it ;)

I've still got a Win98 box in service somewhere around here; I use
it for audio recording.  Someone (possibly even me) renamed most
of the desktop icons ... OE's shortcut is "Outluck Depress".  :-)

Kevin D. Kinsey

FWIW:  Lists that set reply to sender:  All FreeBSD.org lists
Lists that set reply to "group":  All "Yahoo Groups" lists
My prefs:  I couldn't care less, really.


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



Re: [PHP] Structured PHP studying

2010-04-23 Thread Paul M Foster
On Fri, Apr 23, 2010 at 07:15:11AM -0400, David McGlone wrote:

> Is there a good strategy to studying PHP?
> 
> For instance, is there a way to break everything down into small managable
> topics?

Obviously, a good book will help. I'd recommend O'Reilly's "Programming
PHP". Some of this also depends on whether you have a background in
programming. It's easier if you already know how to code in a different
language; then you really mostly need to know the differences between
the languages.

If you want to learn without the benefit of a book, then I'd suggest
looking over existing beginning programming books for various languages.
My observation is that they generally follow a pattern. They deal with
variable naming and types, then legal operations on those types, then
control structures, then functions, etc. (That may not be accurate; as I
said, look over the books themselves.) Most/all of this information can
be obtained from the php.net site.

Ashley's suggestion of coding a project is an outstanding idea. Coding
is a practical art, and requires practical application to be worth
anything.

Paul

-- 
Paul M. Foster

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



Re: [PHP] Math Question....

2010-04-23 Thread Richard Quadling
On 23 April 2010 13:33, Dotan Cohen  wrote:
> What is wrong with 626,299 groups of 2 items each (done in my head, so
> I might be off a little)?

2, 3, 6, 7, 14 and 21 are all valid.


-- 
-
Richard Quadling
"Standing on the shoulders of some very clever giants!"
EE : http://www.experts-exchange.com/M_248814.html
EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling

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



Re: [PHP] Math Question....

2010-04-23 Thread Dotan Cohen
On 22 April 2010 17:07, Dan Joseph  wrote:
> Howdy,
>
> This is a math question, but I'm doing the code in PHP, and have expunged
> all resources... hoping someone can guide me here.  For some reason, I can't
> figure this out.
>
> I want to take a group of items, and divide them into equal groups based on
> a max per group.  Example.
>
> 1,252,398 -- divide into equal groups with only 30 items per group max.
>
> Can anyone guide me towards an algorithm or formula name to solve this?  PHP
> code or Math stuff is fine.  Either way...
>
> Thanks...
>

What is wrong with 626,299 groups of 2 items each (done in my head, so
I might be off a little)?

-- 
Dotan Cohen

http://bido.com
http://what-is-what.com

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



Re: [PHP] escape \n

2010-04-23 Thread Jan G.B.
You can also just send out the correct Header for plain text. But your
HTMl will not be interpreted then.. So this makes only sense if you
actually want plain text as the output format.

header("Content-type: text/plain; charset=utf8");
echo "foo\nbar";


Regards

2010/4/23 Nick Balestra :
> Thanks everybody!
>
> On Apr 23, 2010, at 10:05 AM, Ashley Sheridan wrote:
>
>> On Fri, 2010-04-23 at 09:51 +0200, Nick Balestra wrote:
>>>
>>> Hello guys i am trying to figure out what is worng with thoose special 
>>> escaped character, like \n \t \r ...
>>>
>>> As i cannot make them working. The browser doesn't display them, but 
>>> doesn't eithr crate a new line, or else.
>>> I am using them fro example like this:
>>>
>>> print: "this shoudl be on a line \nwhile this on a new line";
>>>
>>> I've searched google and saw man people struggling with this, but 
>>> apparently not a clear answer to whymaybe is a stupid beginner 
>>> question, but i would just like to know.  (Personally i solved for the 
>>> moment by printing out  or , but i would like to understand this.
>>>
>>> Cheers, Nick
>>
>> By default, PHP sends out HTML headers. Browsers ignore extraneous 
>> white-space characters, and also new lines, carriage returns and tabs, 
>> converting them all to a single space character.
>>
>> If you view the source in your browser, you'll see the newlines, but in 
>> regular display, your text is treated as HTML.
>>
>> There is a function in PHP called nl2br, which accepts a string and returns 
>> the same one with all the newlines replaced with  automatically, which 
>> might be easier to use if your content is in a string. Otherwise, the only 
>> way to get new lines on your actual page is to either manually use  
>> tags, put the text inside a  block, or use CSS to preserve the 
>> white-space.
>>
>> Thanks,
>> Ash
>> http://www.ashleysheridan.co.uk
>>
>>
>
>

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



[PHP] htmlentitites ENT_QUOTES in HTML attributes?

2010-04-23 Thread Jan G.B.
Hi List,

I just figured, that the Browsers on my system do interpret '
inside href or onclick attribute as a plain '.

Imagine the user input is the following line:

param2" foo';);alert(document.cookie);alert('

Which is being written by the script like that:

test

USER_INPUT is sent through htmlentities($str, ENT_QUOTES, 'UTF-8');

The result is the following then:



function example(a, b) {
  alert('valid alert; params: '+ a+', '+b);
}


test



My browsers will alert the document.cookie.
Please confirm this (and keep in mind that document.cookie is just
empty when tested locally).


Regards

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



Re: [PHP] Structured PHP studying

2010-04-23 Thread Jay Ess

David McGlone wrote:
Is there a good strategy to studying PHP? 

For instance, is there a way to break everything down into small managable 
topics?


  
My way of learning a new language is to decide on a small project to 
code and then learn just that i need to do for that exact feature i 
implement.
That works best if you already has some knowledge in computer 
programming. And when i have grasped sufficiently i can dig into texts 
on the net for deeper understanding of the language.





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



Re: [PHP] Structured PHP studying

2010-04-23 Thread Michiel Sikma
On 23 April 2010 13:15, David McGlone  wrote:

> Is there a good strategy to studying PHP?
>
> For instance, is there a way to break everything down into small managable
> topics?
>
> --
> Blessings,
> David M.
>
>
Just build what you want to build and look things up when necessary. The
biggest part of learning any language is becoming able to creatively solve
problems within its realm of possibilities, and that's something you can't
really learn just by reading and solving textbook problems. Hands-on
experience is a very important key to understanding.

Keep an open mind, ask people for answers if things get difficult, always
assume that there's a better way to do something, and in a while you'll be
able to write perfectly decent programs.

Michiel


Re: [PHP] Structured PHP studying

2010-04-23 Thread Ashley Sheridan
On Fri, 2010-04-23 at 07:15 -0400, David McGlone wrote:

> Is there a good strategy to studying PHP? 
> 
> For instance, is there a way to break everything down into small managable 
> topics?
> 
> -- 
> Blessings,
> David M.
> 
> 


I started the way I guess most people did: from a basic book which broke
things up as it saw best. Obviously some books are better than others; I
won't mention any here as there are quite a few threads about good PHP
books.

>From there, I just looked into what I thought I needed to know as I came
across it. It's a bit haphazard, but it did the trick.

Mostly though, I think if you find a good book, that should break things
down well enough that anyone can pick it up and follow along. You don't
have to follow a book linearly though, I found myself often focusing in
more depth into something a book only mentioned briefly because it
either sounded interesting or I needed to know more for a project.

Bit of a ramble there, but maybe it'll help?

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




Re: [PHP] Structured PHP studying

2010-04-23 Thread Peter Lind
On 23 April 2010 13:15, David McGlone  wrote:
> Is there a good strategy to studying PHP?
>
> For instance, is there a way to break everything down into small managable
> topics?

The Zend study guide might be a place to start - not for free thought,
so there may be better options (it's also directed at getting Zend
certified, so it's covering the stuff you need to know for that, not
connected things).

Regards
Peter

-- 

WWW: http://plphp.dk / http://plind.dk
LinkedIn: http://www.linkedin.com/in/plind
Flickr: http://www.flickr.com/photos/fake51
BeWelcome: Fake51
Couchsurfing: Fake51


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



[PHP] Structured PHP studying

2010-04-23 Thread David McGlone
Is there a good strategy to studying PHP? 

For instance, is there a way to break everything down into small managable 
topics?

-- 
Blessings,
David M.


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



Re: [PHP] public readonly variables

2010-04-23 Thread Richard Quadling
On 23 April 2010 10:55, Ashley Sheridan  wrote:
> I know the subject line might sound a bit like an oxymoron, but bear
> with me!
>
> What I'd like to have is a property of an object that behaves like a
> public variable when it comes to reading, but like a protected one when
> it comes to writing, as it would make my code a lot easier to read.
>
> I know about the __get($var) method to magically provide this behaviour,
> but from all I've read it can be pretty slow compared to a regular
> public variable. I've seen a thread on the dev lists where someone
> requested it, but can't find anything in the manual.
>
> Does anyone know if this is available in a later version of PHP, or if
> it's implementation is penned for some time in the future?
>
> Thanks,
> Ash
> http://www.ashleysheridan.co.uk
>
>
>

What you are asking for is commonly known as accessibility. This has
been discussed on the list and is something I think would be a great
feature.

http://wiki.php.net/rfc/propertygetsetsyntax is an incomplete RFC (it
says it is incomplete at the top).

The last update was 2010/01/08 22:11, so a few months old.

Hopefully, some of the clever brains here can get to grips with it and
come to some consensus.


Whilst you can easily code __get()/__set() or getVar()/setVar()
methods to deal with it, with the later ones being significantly
easier to docblock, there is no easy way to document the property,
only the methods to set or get the property.


Richard.






-- 
-
Richard Quadling
"Standing on the shoulders of some very clever giants!"
EE : http://www.experts-exchange.com/M_248814.html
EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling

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



[PHP] public readonly variables

2010-04-23 Thread Ashley Sheridan
I know the subject line might sound a bit like an oxymoron, but bear
with me!

What I'd like to have is a property of an object that behaves like a
public variable when it comes to reading, but like a protected one when
it comes to writing, as it would make my code a lot easier to read.

I know about the __get($var) method to magically provide this behaviour,
but from all I've read it can be pretty slow compared to a regular
public variable. I've seen a thread on the dev lists where someone
requested it, but can't find anything in the manual.

Does anyone know if this is available in a later version of PHP, or if
it's implementation is penned for some time in the future?

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




Re: [PHP] Updating cli executable on MS-Windows

2010-04-23 Thread Richard Quadling
On 23 April 2010 02:34, Bob McConnell  wrote:
> From: Richard Quadling
>> On 22 April 2010 14:42, Bob McConnell  wrote:
>>> I downloaded the MS-Windows cli from The PHP Group a while ago. It
>>> claims to be version 5.2.10. But now I can't find where I got it, nor
>>> where to get the updates. What is the easiest way to upgrade it to
>>> 5.2.13?
>>>
>>>  D:\Code\Tests>php --version
>>>  PHP 5.2.10 (cli) (built: Jun 17 2009 16:16:57)
>>>  Copyright (c) 1997-2009 The PHP Group
>>>  Zend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies
>>>
>>> Bob McConnell
>>
>> You can get the latest V5.2.x from http://windows.php.net/download/
>
> Which one has just the cli installer? I don't want any server files installed 
> on my workstation.
>
> Bob McConnell
>

Normally, you take the ZIP file and unzip it into C:\PHP5 (or wherever
you want).

That's the installation done.

Then, you take a long look through the php.ini-production and
php.ini-development to see what you need to setup.

I'd recommend reading ...

http://docs.php.net/manual/en/install.windows.manual.php
and
http://docs.php.net/manual/en/install.windows.commandline.php


-- 
-
Richard Quadling
"Standing on the shoulders of some very clever giants!"
EE : http://www.experts-exchange.com/M_248814.html
EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling

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



Re: [PHP] Updating cli executable on MS-Windows

2010-04-23 Thread Richard Quadling
On 23 April 2010 02:34, Bob McConnell  wrote:
> From: Richard Quadling
>> On 22 April 2010 14:42, Bob McConnell  wrote:
>>> I downloaded the MS-Windows cli from The PHP Group a while ago. It
>>> claims to be version 5.2.10. But now I can't find where I got it, nor
>>> where to get the updates. What is the easiest way to upgrade it to
>>> 5.2.13?
>>>
>>>  D:\Code\Tests>php --version
>>>  PHP 5.2.10 (cli) (built: Jun 17 2009 16:16:57)
>>>  Copyright (c) 1997-2009 The PHP Group
>>>  Zend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies
>>>
>>> Bob McConnell
>>
>> You can get the latest V5.2.x from http://windows.php.net/download/
>
> Which one has just the cli installer? I don't want any server files installed 
> on my workstation.
>
> Bob McConnell
>

PHP on windows, fundamentally, consists of a series of dlls
(extensions), a runtime (php5.dll), supporting dlls (used by the
extensions), and then the SAPI files (php.exe, php-cgi.exe).

The only element that is "server" related, would be php-cgi.exe and
for older versions of PHP, php5isapi.dll. There are other SAPIs (ways
of running PHP).

The SAPI files are small as all they do is sit between the executing
environment and php5.dll.

So. Don't worry about them.

Richard.

-- 
-
Richard Quadling
"Standing on the shoulders of some very clever giants!"
EE : http://www.experts-exchange.com/M_248814.html
EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling

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



Re: [PHP] Math Question....

2010-04-23 Thread Richard Quadling
On 22 April 2010 17:47, Developer Team  wrote:
> Awesome source.
> Thanks
>
> On 4/22/10, Richard Quadling  wrote:
>> On 22 April 2010 14:48, Dan Joseph  wrote:
>>> On Thu, Apr 22, 2010 at 10:29 AM, Richard Quadling
>>> >>> wrote:
>>>
  >
 > It sounds like you are looking for factors.
 >
 >
 http://www.algebra.com/algebra/homework/divisibility/factor-any-number-1.solver
 >
 > Solution by Find factors of any number
 >
 > 1252398 is NOT a prime number: 1252398 = 2 * 3 * 7 * 29819
 > Work Shown
 >
 > 1252398 is divisible by 2: 1252398 = 626199 * 2.
 > 626199 is divisible by 3: 626199 = 208733 * 3.
 > 208733 is divisible by 7: 208733 = 29819 * 7.
 > 29819 is not divisible by anything.
 >
 > So 29819 by 42 (7*3*2)
 >
 > would be a route.

 Aha. Missed the "30" bit.

 So, having found the factors, you would need to process them to find
 the largest combination under 30.

 2*3
 2*3*7
 2*7
 3*7

 are the possibilities (ignoring any number over 30).

 Of which 3*7 is the largest.

 So, 1,252,398 divided by 21 = 59,638


 Is that the sort of thing you are looking for?


>>>
>>> Yes, that looks exactly what like what I'm looking for.  I'm going to try
>>> and wake up the algebra side of my brain that hasn't been used in years
>>> and
>>> see if I can digest all this.
>>>
>>> For the 2, 3, and 7, that is based solely on the last number being
>>> divisible
>>> by a prime number?
>>>
>>> Joao, Jason, thanks for the code.
>>>
>>> --
>>> -Dan Joseph
>>>
>>> www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.  Promo
>>> Code "NEWTHINGS" for 10% off initial order
>>>
>>> http://www.facebook.com/canishosting
>>> http://www.facebook.com/originalpoetry
>>>
>>
>> This seems to be working ...
>>
>> > function findBestFactors($Value, $GroupSize, array &$Factors = null)
>>       {
>>       $Factors = array();
>>       foreach(range(1, ceil(sqrt($Value))) as $Factor)
>>               {
>>               if (0 == ($Value % $Factor))
>>                       {
>>                       if ($Factor <= $GroupSize)
>>                               {
>>                               $Factors[] = $Factor;
>>                               }
>>                       if ($Factor != ($OtherFactor = ($Value / $Factor)) && 
>> $OtherFactor
>> <= $GroupSize)
>>                               {
>>                               $Factors[] = $OtherFactor;
>>                               }
>>                       }
>>
>>               if ($Factor >= $GroupSize)
>>                       {
>>                       break;
>>                       }
>>               }
>>
>>       rsort($Factors);
>>
>>       return reset($Factors);
>>       }
>>
>> echo findBestFactors($argv[1], $argv[2], $Factors), PHP_EOL;
>> ?>
>>
>>
>> factors 1252398988 5000
>>
>> outputs  ...
>>
>> 4882
>>
>> and 21 for your value 1252398
>>
>> --
>> -
>> Richard Quadling
>> "Standing on the shoulders of some very clever giants!"
>> EE : http://www.experts-exchange.com/M_248814.html
>> EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
>> Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
>> ZOPA : http://uk.zopa.com/member/RQuadling
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>

Thank you. It was a quick knock up, so could probably be optimized a
little more.

It will also not work beyond PHP_MAX_INT, unless the code is converted
to use the BCMath or GMP extension.

-- 
-
Richard Quadling
"Standing on the shoulders of some very clever giants!"
EE : http://www.experts-exchange.com/M_248814.html
EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling

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



[PHP] PHP can't find OCI.dll

2010-04-23 Thread Darren Karstens
Hi,
I have just installed PHP and Oracle 11.2 on a new server but I get an
error message when I try to run php from the command line saying "This
application has failed to start because OCI.dll was not found". I have
checked that the ORACLE_HOME environment variable is set correctly and
have included the ORACLE_HOM/bin directory (where the OCI.dll is
located) in my path but PHP still cant find it. Does anyone know what
might be causing this?
Regards,
Darren

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



Re: [PHP] escape \n

2010-04-23 Thread Nick Balestra
Thanks everybody!

On Apr 23, 2010, at 10:05 AM, Ashley Sheridan wrote:

> On Fri, 2010-04-23 at 09:51 +0200, Nick Balestra wrote:
>> 
>> Hello guys i am trying to figure out what is worng with thoose special 
>> escaped character, like \n \t \r ...
>> 
>> As i cannot make them working. The browser doesn't display them, but doesn't 
>> eithr crate a new line, or else.
>> I am using them fro example like this:
>> 
>> print: "this shoudl be on a line \nwhile this on a new line";
>> 
>> I've searched google and saw man people struggling with this, but apparently 
>> not a clear answer to whymaybe is a stupid beginner question, but i 
>> would just like to know.  (Personally i solved for the moment by printing 
>> out  or , but i would like to understand this.
>> 
>> Cheers, Nick
> 
> By default, PHP sends out HTML headers. Browsers ignore extraneous 
> white-space characters, and also new lines, carriage returns and tabs, 
> converting them all to a single space character.
> 
> If you view the source in your browser, you'll see the newlines, but in 
> regular display, your text is treated as HTML.
> 
> There is a function in PHP called nl2br, which accepts a string and returns 
> the same one with all the newlines replaced with  automatically, which 
> might be easier to use if your content is in a string. Otherwise, the only 
> way to get new lines on your actual page is to either manually use  tags, 
> put the text inside a  block, or use CSS to preserve the white-space.
> 
> Thanks,
> Ash
> http://www.ashleysheridan.co.uk
> 
> 



Re: [PHP] escape \n

2010-04-23 Thread Ashley Sheridan
On Fri, 2010-04-23 at 09:51 +0200, Nick Balestra wrote:

> Hello guys i am trying to figure out what is worng with thoose special 
> escaped character, like \n \t \r ...
> 
> As i cannot make them working. The browser doesn't display them, but doesn't 
> eithr crate a new line, or else.
> I am using them fro example like this:
> 
> print: "this shoudl be on a line \nwhile this on a new line";
> 
> I've searched google and saw man people struggling with this, but apparently 
> not a clear answer to whymaybe is a stupid beginner question, but i would 
> just like to know.  (Personally i solved for the moment by printing out  
> or , but i would like to understand this.
> 
> Cheers, Nick


By default, PHP sends out HTML headers. Browsers ignore extraneous
white-space characters, and also new lines, carriage returns and tabs,
converting them all to a single space character.

If you view the source in your browser, you'll see the newlines, but in
regular display, your text is treated as HTML.

There is a function in PHP called nl2br, which accepts a string and
returns the same one with all the newlines replaced with 
automatically, which might be easier to use if your content is in a
string. Otherwise, the only way to get new lines on your actual page is
to either manually use  tags, put the text inside a  block, or
use CSS to preserve the white-space.

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




[PHP] escape \n

2010-04-23 Thread Nick Balestra
Hello guys i am trying to figure out what is worng with thoose special escaped 
character, like \n \t \r ...

As i cannot make them working. The browser doesn't display them, but doesn't 
eithr crate a new line, or else.
I am using them fro example like this:

print: "this shoudl be on a line \nwhile this on a new line";

I've searched google and saw man people struggling with this, but apparently 
not a clear answer to whymaybe is a stupid beginner question, but i would 
just like to know.  (Personally i solved for the moment by printing out  or 
, but i would like to understand this.

Cheers, Nick

[PHP] Re: [PHP-INSTALL] Getting file pointer from file descriptor

2010-04-23 Thread Rasmus Lerdorf
You seem to be quite confused.  First of all, a function like fdopen() which
has never existed in any version of PHP, wouldn't read/write anything.  In C
that function will return a FILE pointer from a file descriptor.  You would
then use fread()/fwrite() to read and write from that FILE pointer.  But PHP
doesn't have file pointers nor file descriptors, so none of this applies to
PHP.  In PHP an open file is a resource just like an open database
connection is a resource.

So, is your question really how to read and write to files?  There are many
ways to do that.  The easiest is to just call
file_get_contents()/file_put_contents(), but you can also use
fopen()/fread()/fwrite() if you prefer that approach.

-Rasmus

On Fri, Apr 16, 2010 at 5:15 AM, Naga Kiran K  wrote:

> Hi Rasmus,
>
> Thanks for reply.
> The requirement I was looking for is to read/write given only the file
> descriptor number.
>
> PHP-CGI binary is invoked by a webserver that runs in jail-directory and
> doesn't have access to the file path directory.
> So, it communicates with another daemon that opens a socket to that file
> and in turn passes the file descriptor alone.
>
> Can you please suggest if there is any API in PHP that serves this
> requirement [read/write to given file descriptor]
> Please let me know if I need to provide more information.
>
> Thanks,
> Naga Kiran
>
>
> On Thu, Apr 15, 2010 at 7:33 PM, Rasmus Lerdorf wrote:
>
>> On 04/15/2010 06:52 AM, Naga Kiran K wrote:
>> > Hi,
>> >
>> > We are upgrading PHP from 5.2.3 to 5.3.2 and are facing few issues [like
>> > unsupported functions...]
>> >
>> > In PHP 5.2.3, "fdopen" was used to read/write to a file descriptor
>> > that's opened by another application.
>> >
>> > fdopen(,"rw");  //It worked fine with PHP 5.2.3
>> >
>> > After PHP upgrade,its throwing "undefined reference to 'fdopen'
>> function".
>> >
>> > Please suggest whats the replacement for this in PHP 5.2.3 or any
>> > workaround.
>>
>> PHP has never had an fdopen() function.  It must be something in user
>> space that provided that for you if you had it.
>>
>> -Rasmus
>>
>
>
>
> --
> Regards,
> Naga Kiran
>