php-general Digest 21 Dec 2006 09:11:02 -0000 Issue 4526

Topics (messages 246096 through 246115):

Re: [an attempt to inject a bit of humor back into the situation] Re: [PHP] 
Recomended host
        246096 by: Børge Holen
        246098 by: Jochem Maas

Do Sockets Cache?
        246097 by: Aras
        246099 by: Roman Neuhauser
        246100 by: Stut

Re: Are PHP5 features worth it?
        246101 by: Niels
        246102 by: Jochem Maas
        246103 by: Robert Cummings
        246104 by: Jochem Maas
        246105 by: Børge Holen
        246106 by: jekillen
        246107 by: Niels
        246108 by: Niels
        246109 by: tedd
        246114 by: Lester Caine
        246115 by: Roman Neuhauser

Re: Database Question
        246110 by: Sumeet

Re: Video Question
        246111 by: Fahad Pervaiz

Poping array which has the matching value
        246112 by: Leo Liu
        246113 by: Che Hodgins

Administrivia:

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

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

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


----------------------------------------------------------------------
--- Begin Message ---
On Tuesday 19 December 2006 21:52, Jochem Maas wrote:
> tedd wrote:
> > At 3:50 PM -0500 12/18/06, <[EMAIL PROTECTED]> wrote:
> >> I'm going to be controversial here and take issue with both of you.
> >>
> >> 2. Pointing out someone's signature as being off topic is even further
> >> off topic for this list. Please take personal issues into private
> >> email.  I bring it up publicly as a reminder of proper list etiquette
> >> for anyone who happens to be reading this thread and to discourge this
> >> from going any further publicly.
> >
> > tg:
> >
> > As Jochem said "off-topic" cuts both ways.
>
> I said *many* ways :-) - heck if there were only 2 ways to rip someone
> a proverbial new one things would get boring around here :-P
>
> ...
>
> > tedd
> >
> > PS: Be as controversial as you want, this list isn't moderated -- but I
>
> that's a challenge ... not that I needed it, I have to admit to indulging
> in more than my fair share of boundary pushing in terms of exceptable
> list behaviour ...
>
> > think I know where the majority will draw their line in the sand on this
> > issue -- for they are good well intended people who don't want to
> > deliberately hurt others. In other words, they have compassion, which is
> > apparently absent in Mr Neuhauser and most certainly not absent in
> > "proper list etiquette".
>
> I guess if I start baiting all 3 of you (Roman, tedd, tg) that would
> not be constructive? no probably not :-)
>
> from my stance, I don't give 2 hoots about Roman's sig, Roman's reply style
> sometimes leaves a little to be desired [hey where would we be without
> desire ;-)] but he has offered good technical stuff, I very much sympathise
> with anyone who has had the misfortune to experience the horrors of war and
> I think it is something that does deserve maybe a tad more compassion than
> an off-topic post (a species we might consider that compassion is one step
> into a future with less/no war - might be worth the effort?), I feel that
> TG's comments had merit also, nothing wrong with trying to encourage
> 'decent' list behaviour (however difficult it might be to come to a
> consensus given the wide range of cultures present), lastly you should
> realise that these are just my opinions as of the time of writing and I
> reserve the right to contradict myself at anytime in future as and when I
> see fit - woman's perogative!
>
> crap - I'm not a woman :-/
>
> in the spirit of christmas (and because this is the php generals list -
> i.e. a bunch of pragmatic village idiot hackers) let all shake hands, laugh
> it off and move on to the next off-topic thread :-)
>
> Merry Christmas Everyone! and I mean everyone (even Eight-of-Nine ;-)


bah, I refuse to be the last BADman on this list before christmas, the last 
week trip to Prague really helped on the bloody selfesteam.
Yeh, so on to the point. Sorry for any bad words to the loving jocheem maas.
You hear that,, I said I'm sorry

:D

Merry Christmas.



-- 
---
Børge
Kennel Arivene 
http://www.arivene.net
---

--- End Message ---
--- Begin Message ---
Børge Holen wrote:
> On Tuesday 19 December 2006 21:52, Jochem Maas wrote:
>> tedd wrote:

...

> 
> bah, I refuse to be the last BADman on this list before christmas, the last 
> week trip to Prague really helped on the bloody selfesteam.
> Yeh, so on to the point. Sorry for any bad words to the loving jocheem maas.

it seems I've been rebadged with an arabic name :-P (only 1 'e' in 'jochem')

> You hear that,, I said I'm sorry

I'll accept the apology - although it wasn't necessary, I wasn't in the
least upset with you :-)

the 'borg' reference was just meant as a bit of gentle ribbing - a list
initiation rite of sorts - must say you just passed with flying colours.

welcome to the club :-), look forward to seeing more of you (& your php knowhow)
in the new year.

have a good holiday!

PS - if in future I happen to transcribe the 'ø' in 'Børge' to an 'o'
it's purely down to laziness - no more StarTrek jibes intended :-)

PPS - references to futile resistance and assimilation aren't directed at you,
but you must realise us phpbots are busy taking over the web with php
(see here for more info: http://netevil.org/wiki.php?PlansForWorldDomination)

> 
> :D
> 
> Merry Christmas.
> 

thats enough off topic madness from me - well for today at least :D

--- End Message ---
--- Begin Message ---
Hello :)

Wonder someone can save some of my hair here.

I have a daemon application listening as root on my linux server that i have
written in PHP. I use it to communicate web user with the backend linux to
make certain operations from web interface. I have a login/verify command
that i send to socket server to log in. I send raw command something like
(login user hash) ;

client command -> login admin Fjsdla5dk2mDke
server response -> YES/NO

Server reads from a plain text file containing user/hash and gives yes or
no.

But it is working like a lottery, sometimes yes sometimes no through WEB.
When i test through shell, telnet or etc. it is fine, through web it
sometimes outputs YES, sometimes outputs nothing (does not give NO), like it
is not even connecting or getting no response at all. I have test mechanisms
for valid connection and data send.

So i get this crazy idea of caching for connections on web.

What do you think?

--Aras

--- End Message ---
--- Begin Message ---
# [EMAIL PROTECTED] / 2006-12-20 23:31:56 +0200:
> I have a daemon application listening as root on my linux server that i have
> written in PHP. I use it to communicate web user with the backend linux to
> make certain operations from web interface. I have a login/verify command
> that i send to socket server to log in. I send raw command something like
> (login user hash) ;
> 
> client command -> login admin Fjsdla5dk2mDke
> server response -> YES/NO
> 
> Server reads from a plain text file containing user/hash and gives yes or
> no.
> 
> But it is working like a lottery, sometimes yes sometimes no through WEB.
> When i test through shell, telnet or etc. it is fine, through web it
> sometimes outputs YES, sometimes outputs nothing (does not give NO), like it
> is not even connecting or getting no response at all. I have test mechanisms
> for valid connection and data send.
> 
> So i get this crazy idea of caching for connections on web.
> 
> What do you think?

I think that your email is very confusing and lacking clearer
description of your problem.

Post a short self-contained piece of code which demonstrates your
problem, and state how it behaves and how the observed behavior differs
from the behavior you expected.

-- 
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man.  You don't KNOW.
Cause you weren't THERE.             http://bash.org/?255991

--- End Message ---
--- Begin Message ---
Aras wrote:
I have a daemon application listening as root on my linux server that i have
written in PHP. I use it to communicate web user with the backend linux to
make certain operations from web interface. I have a login/verify command
that i send to socket server to log in. I send raw command something like
(login user hash) ;

client command -> login admin Fjsdla5dk2mDke
server response -> YES/NO

Server reads from a plain text file containing user/hash and gives yes or
no.

But it is working like a lottery, sometimes yes sometimes no through WEB.
When i test through shell, telnet or etc. it is fine, through web it
sometimes outputs YES, sometimes outputs nothing (does not give NO), like it
is not even connecting or getting no response at all. I have test mechanisms
for valid connection and data send.

Have a look at your code for a second... if something fails, which response would it assume it got? Chances are that something is going wrong with the connection, and your code is defaulting to one of the two options, such that when it works you get one response, and when it doesn't you get the other.

If that didn't make sense to you, post your code and we'll be able to give you a better answer.

-Stut

--- End Message ---
--- Begin Message ---
Hi,

On Wednesday 20 December 2006 19:47, Ray Hauge wrote:

> I think all this talk goes to show you that the differences between PHP4
> and PHP5 are somewhat personal at this point in the game.  Some people
> like the better OOP features of PHP5, some people think PHP5 is faster,
> some people like the XML/WebServices in PHP5 better, and many others
> (don't forget PDO, or exceptions).
Yep, that sums it up nicely.

 
> For the OP, I think it's really going to come down to what you think.
> Everyone's mileage is varying on this one.
> 
> Here's my .02.  If you go with PHP5, go with at least PHP 5.1.x, if not
> 5.2.  I'm not sure how stable 5.2 is lately. I had heard of some issues,
> but they could have been from things most people don't do.  I'm pretty
> sure that people don't install 5.0.x anymore, but 5.1 is a lot better
> (from what I've heard anyway.  I never used 5.0.x)
> 
I think I'll move to 5.2 within a couple of months and slowly start using
some of the new features.

Thanks,
Niels

--- End Message ---
--- Begin Message ---
Niels wrote:
> Hi,
> 
> On Wednesday 20 December 2006 19:47, Ray Hauge wrote:
> 
>> I think all this talk goes to show you that the differences between PHP4
>> and PHP5 are somewhat personal at this point in the game.  Some people
>> like the better OOP features of PHP5, some people think PHP5 is faster,
>> some people like the XML/WebServices in PHP5 better, and many others
>> (don't forget PDO, or exceptions).
> Yep, that sums it up nicely.
> 
>  
>> For the OP, I think it's really going to come down to what you think.
>> Everyone's mileage is varying on this one.
>>
>> Here's my .02.  If you go with PHP5, go with at least PHP 5.1.x, if not
>> 5.2.  I'm not sure how stable 5.2 is lately. I had heard of some issues,
>> but they could have been from things most people don't do.  I'm pretty
>> sure that people don't install 5.0.x anymore, but 5.1 is a lot better
>> (from what I've heard anyway.  I never used 5.0.x)
>>
> I think I'll move to 5.2 within a couple of months and slowly start using
> some of the new features.

if you get stuck you know where to find us :-)

> 
> Thanks,
> Niels
> 

--- End Message ---
--- Begin Message ---
On Thu, 2006-12-21 at 00:34 +0100, Jochem Maas wrote:
> >
> > I think I'll move to 5.2 within a couple of months and slowly start using
> > some of the new features.
> 
> if you get stuck you know where to find us :-)

Jochem will be at Børge's place hugging and stuff :/

...

...

...

*VOMIT*

:B

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

--- End Message ---
--- Begin Message ---
Robert Cummings wrote:
> On Thu, 2006-12-21 at 00:34 +0100, Jochem Maas wrote:
>>> I think I'll move to 5.2 within a couple of months and slowly start using
>>> some of the new features.
>> if you get stuck you know where to find us :-)
> 
> Jochem will be at Børge's place hugging and stuff :/
> 
> ...
> 
> ...
> 
> ...
> 
> *VOMIT*

now look - if you can't hold your liquor ... best stick with OJ ;-)

> 
> :B
> 
> Cheers,
> Rob.

--- End Message ---
--- Begin Message ---
On Thursday 21 December 2006 01:31, Robert Cummings wrote:
> On Thu, 2006-12-21 at 00:34 +0100, Jochem Maas wrote:
> > > I think I'll move to 5.2 within a couple of months and slowly start
> > > using some of the new features.
> >
> > if you get stuck you know where to find us :-)
>
> Jochem will be at Børge's place hugging and stuff :/

! this is as BAD OT as it gets.  ;D


>
> ...
>
> ...
>
> ...
>
> *VOMIT*
>
> :B
>
> 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.          |
>
> `------------------------------------------------------------'

-- 
---
Børge
Kennel Arivene 
http://www.arivene.net
---

--- End Message ---
--- Begin Message ---

On Dec 20, 2006, at 3:14 PM, Niels wrote:

Hi,

On Wednesday 20 December 2006 19:47, Ray Hauge wrote:

I think all this talk goes to show you that the differences between PHP4
and PHP5 are somewhat personal at this point in the game.  Some people
like the better OOP features of PHP5, some people think PHP5 is faster,
some people like the XML/WebServices in PHP5 better, and many others
(don't forget PDO, or exceptions).
Yep, that sums it up nicely.


For the OP, I think it's really going to come down to what you think.
Everyone's mileage is varying on this one.

Here's my .02. If you go with PHP5, go with at least PHP 5.1.x, if not 5.2. I'm not sure how stable 5.2 is lately. I had heard of some issues,
but they could have been from things most people don't do.  I'm pretty
sure that people don't install 5.0.x anymore, but 5.1 is a lot better
(from what I've heard anyway.  I never used 5.0.x)

I think I'll move to 5.2 within a couple of months and slowly start using
some of the new features.

Thanks,
Niels

Hey, I'd like to be able to run at least two versions of php on one server and switch between them
because if you've written a pile of php 4x code and need to switch to 5x, ( hosting service switches the boss you work for decides to switch , or what ever,) you have to go through all your 4x code and rewrite it to be compatible with 5x. So, the benefit of switching becomes an important consideration. While your converting 4x code to 5x compatibility you need two servers running, one with 4x interpreter and one with 5x interpreter. It really would have been nice if Apache and Zend got together so both version could be run by the same server based on something in httpd.conf and/or php.ini. What i have done, not to berate 5x is to write code that is compatible with both version. I have servers running both
4.3x and 5.1.2 and  they run the same code just fine.
This might give you some more perspective.
JK

--- End Message ---
--- Begin Message ---
Hi,

On Wednesday 20 December 2006 13:37, Roman Neuhauser wrote:

> # [EMAIL PROTECTED] / 2006-12-19 19:05:23 +0100:
>> I'm writing a PHP program and I've got a number of concerns. The program
>> is about 20 KLOC at the moment, but will probably grow quite a lot.
>> 
>> I'm using OOP throughout, and I don't really have a lot of problems with
>> what PHP4 can do with OOP. PHP5 does have a nice feature or two,
>> eventhough none seems essential to my particular style of programming. I
>> don't mind using what PHP5 offers where it makes sense, but where's that?
>> Exceptions and new OOP features?
>> 
>> Exceptions: I just don't see the big advantage. I've got errors and
>> messages bubbling up through object layers as it is, and exchanging that
>> with a wholly new structure seems more trouble that it's worth. I've read
>> several books on how cool PHP5 is, but the arguments for using exceptions
>> seem to boil down to "Java has them". Nowhere have I seen good examples
>> that really show how well exceptions solve real problems, all examples
>> seem to show are that 5 lines of try/catch are somehow sexier than 5
>> lines of if/else.
> 
> One of the differences is that the if/else lines need to be in all layers
> between where the error might happen and where it will be ultimately
> handled. With exceptions, the try/catch can be detached (as long as it's
> the right thing to do, of course).
> 
You're right, that is an advantage. I'll need to rewrite much of my current
code to make use of it, so that's not a high priority. More importantly I
have to start thinking in this new way to use exceptions properly.


>> What about performance?
> 
> Did you measure the performance impact of all those if/else's?
> 
> Exceptions are a special channel for errors, so your question is kind of
> like "is stderr any good? what about performance?"
>  
If two different ways of doing the same thing seem very similar, performance
may help me choose. It's true that I don't know anything about the speed of
all my nested if/elses, but that's not necessarily relevant if others can
tell me that exceptions are always hopelessly slow.


>> New OOP features: I can go through my code and mark all my methods as
>> public or private or whatever. No problem. But why would I? It will make
>> classes easier to understand when I look at them, but that's just
>> convenience. What are the performance benefits? I've not found a single
>> mention of that anywhere. What do abstractions and interfaces actually
>> do, aside from structuring my code better?
>  
> What do PHP4 classes actually do for you, aside from structuring your
> code? What about performance? Wouldn't you be better off if you wrote all
> of your program into a single file, all in global scope, using only
> builtin functions
> and primitive data types?  It would surely be faster, and you'd only lose
> the convenience, no?
> 
I get your point, everything above assembler on the metal can be
considered "merely convenience". In this case, however, there's a detail to
my question: I'm basically asking whether adding public/private to methods
will enhance performance. I could be -- I don't know about these things --
that the PHP processor could use such keywords to optimize the execution.


>> What major compelling reasons do I have to start using exceptions and
>> OOP-5?
> 
> All the things you mentioned, and then some.
> 
> Someone else mentioned that PHP 5 is much less inclined to copy objects.
> You still don't get the convenience of a private copy constructor, but
> hey.
> 
> Another thing is destructors, so you're able to mimic C++'s powerful
> 
>     // unlocked
>     {
>         mylock_t lock;
>         // locked
>     }
>     // unlocked
> 
> (not so powerful in PHP without anonymous scopes).
> 
> For example, a unit-testing library for PHP 5 called Testilence provides
> two utility classes, a temporary dir and a temporary file (see mkdtemp(3),
> mkstemp(3)). Both classes remove the underlying filesystem objects in
> their destructors, so you can conveniently skip doing the cleanup
> yourself:
> 
>     function test_O_EXCL_ThrowsOnExistingPath()
>     {
>         $file = $this->mkstemp();
>         $this->willThrow('RuntimeException');
>         new SplFileObject($file->path(), 'x+');
>     }
> 
> Also, notice how the code can omit checking for errors in mkstemp().
> The return value is guarranteed to be the right thing, since any errors
> would be signalled by throwing an exception, and that is handled By the
> caller of this method.
> 
That looks interesting, thanks.


> How about iterators? You can have objects that look like arrays yet they
> take much less memory:
> 
>     $rs = $db->query($select); # query the db
>     foreach ($rs as $row) { # fetch the row
>         whatever($row);
>     }
> 
"takes much less memory" is exactly the kind of advice I'm looking for. I've
found very few usable guides to such optimizations. Could you possibly give
me a specific example of an array and a similar object with this great
difference in memory consumptions?


Thank you for your answer,
Niels

--- End Message ---
--- Begin Message ---
Hi,

On Wednesday 20 December 2006 02:24, Tony Marston wrote:

> 
> "Niels" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
>> Hi list,
>>
>> I'm writing a PHP program and I've got a number of concerns. The program
>> is
>> about 20 KLOC at the moment, but will probably grow quite a lot.
>>
>> I'm using OOP throughout, and I don't really have a lot of problems with
>> what PHP4 can do with OOP. PHP5 does have a nice feature or two,
>> eventhough
>> none seems essential to my particular style of programming. I don't mind
>> using what PHP5 offers where it makes sense, but where's that? Exceptions
>> and new OOP features?
> 
> I have written a large application which uses the OO features of PHP 4,
> and the same code runs untouched with PHP 5. There is no advantage in
> making use of some of these fancy new features in PHP 5, so I just don't
> bother.
>
I disagree -- there are definitely advantages, the question is whether they
are worth it. I think other answers in this thread bring good points to the
table.

 
>> Exceptions: I just don't see the big advantage. I've got errors and
>> messages
>> bubbling up through object layers as it is, and exchanging that with a
>> wholly new structure seems more trouble that it's worth. I've read
>> several books on how cool PHP5 is, but the arguments for using exceptions
>> seem to boil down to "Java has them".
> 
> I don't use exceptions for the simple reason that there is no advantage in
> doing so. I have a perfectly adequate error handler (just lke you) so
> there is no pont in changing it. Java programmers can only program with
> exceptions simply because they don't know any better.
> 
>> Nowhere have I seen good examples that really
>> show how well exceptions solve real problems, all examples seem to show
>> are
>> that 5 lines of try/catch are somehow sexier than 5 lines of if/else.
>> What about performance?
> 
> I agree entirely. Lots of extra code for absolutely no benefit.
> 
>> New OOP features: I can go through my code and mark all my methods as
>> public
>> or private or whatever. No problem. But why would I?
> 
> Exactly What does all that effort buy you? Better functionality? Increased
> performance? The answer is "nothing".
You know that for sure?


> All it does is place restrictions on 
> what other programmers can do when they attaempt to use your code. Lots of
> cost with no measurable benefit equates to a total waste of time.
> 
Restrictions do help stabilize the API.


>>It will make classes
>> easier to understand when I look at them, but that's just convenience.
>> What
>> are the performance benefits?
> 
> There are no benefits, only restrictions.
> 
>> I've not found a single mention of that
>> anywhere. What do abstractions and interfaces actually do, aside from
>> structuring my code better?
> 
> Abstractions are thought processes which help you to identify the essence
> of what needs to be done, so they are essential. Interfaces on the other
> hand are a total waste of time. Other languages have them because of
> deficiencies in those languages. PHP doesn't have those deficiencies, so
> interfaces are totally unnecessary.
> 
>> What major compelling reasons do I have to start using exceptions and
>> OOP-5?
> 
> Absolutely none.
> 


Thank you for your answer,
Niels

--- End Message ---
--- Begin Message ---
At 3:14 PM +0100 12/20/06, Bernhard Zwischenbrugger wrote:

"AJAX" Webapplications are not possible in PHP4.

Please be very, very quite, my PHP4 web "AJAX" Web applications don't know that and I don't want them revolting.

tedd

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

--- End Message ---
--- Begin Message ---
jekillen wrote:

Hey, I'd like to be able to run at least two versions of php on one server and switch between them
because if you've written a pile of php 4x code and need to switch to 5x,

Is there a real need given the cost of hardware?
I run two machines - one with the stable version of PHP5 and one to run the latest download. Until the second machine is stable, the first does not get updated ;)

--
Lester Caine - G8HFL
-----------------------------
L.S.Caine Electronic Services - http://home.lsces.co.uk
Model Engineers Digital Workshop - http://home.lsces.co.uk/ModelEngineersDigitalWorkshop/
Treasurer - Firebird Foundation Inc. - http://www.firebirdsql.org/index.php

--- End Message ---
--- Begin Message ---
# [EMAIL PROTECTED] / 2006-12-21 03:33:36 +0100:
> On Wednesday 20 December 2006 13:37, Roman Neuhauser wrote:
> > # [EMAIL PROTECTED] / 2006-12-19 19:05:23 +0100:

> >> What major compelling reasons do I have to start using exceptions and
> >> OOP-5?

> >> What about performance?
> > 
> > Did you measure the performance impact of all those if/else's?
> > 
> > Exceptions are a special channel for errors, so your question is kind of
> > like "is stderr any good? what about performance?"
> >  
> If two different ways of doing the same thing seem very similar, performance
> may help me choose. It's true that I don't know anything about the speed of
> all my nested if/elses, but that's not necessarily relevant if others can
> tell me that exceptions are always hopelessly slow.

They won't be able to tell you what impact using exceptions would have
on your code.

> > How about iterators? You can have objects that look like arrays yet they
> > take much less memory:
> > 
> >     $rs = $db->query($select); # query the db
> >     foreach ($rs as $row) { # fetch the row
> >         whatever($row);
> >     }
> 
> "takes much less memory" is exactly the kind of advice I'm looking for.

Don't get too excited, please. I'm not promising you'll be able to
squeeze your CMS into 640KB.

You're concentrating on the wrong thing. Development time is way more
expensive than cpu power. I like to use typed parameters and access
specifiers because they're a very concise form of documentation, and
this documentation never lags behind the code! I like to use exceptions,
because they allow me to write safer and more elegant code. Performance
benefits? Sure, they're development boosters.

What about performance? When PHP 4.0 came out, CPUs had 500MHz (IIRC),
when PHP 5.2 came out, CPUs are at 4GHz. There go your microbenchmarks.

> I've found very few usable guides to such optimizations. Could you
> possibly give me a specific example of an array and a similar object
> with this great difference in memory consumptions?

Anywhere you can replace a sufficiently large aggregate structure with
an iterator. They can be used as generators (c. f. python 2.5), and I'd
call e. g. DirectoryIterator from SPL a generator.


-- 
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man.  You don't KNOW.
Cause you weren't THERE.             http://bash.org/?255991

--- End Message ---
--- Begin Message ---
[EMAIL PROTECTED] wrote:
So you have two "single table" votes.. make this a third.   I'm
guessing that each time you collect data, it's going to be one of
each piece of data every time.


As for efficiency, it's probably more efficient to keep everything in
one table and do your statistics by using SQL to filter down by date
and use aggregate functions like SUM() and whatever your database's
version of AVERAGE and other math functions are.   This way, it's
handled very quickly and efficiently inside the database engine

another suggestion. create several another tables also. that maintains only the daily averages etc... or any other data that u may need to run on to get your stats.

running Mysql average, sum command on that single database everytime will be rather cumbersome. it will be faster to run commands once and store in a database. ie. cache

--
Thanking You

Sumeet Shroff
http://www.prateeksha.com
Web Designers and PHP / Mysql Ecommerce Development, Mumbai India

--- End Message ---
--- Begin Message ---
I think you want to stream video to clients like youtube??? If so there is a
solution.

1. Install a streaming server on your webserver
2. Upload your video files and store them out site root directory
3. Use streaming server to output file

I have worked on video streaming. I used FLV format, that is a Flash Video
file. You can automatically convert all video formats to FLV using FFMPEG
Library. Use any freely available FLV player or you can develop your own.

For ffmpeg visit
*http://ffmpeg.mplayerhq.hu/* <http://ffmpeg.mplayerhq.hu/>


--
Fahad Pervaiz
www.ecommerce-xperts.com
92 345 510 7621

--- End Message ---
--- Begin Message ---
Hi,

I wanted to search through the array and pop out the value which match my 
search criteria. For example

If array has {a,b,c,d,e,f}

I wanna search for "c" and once I found it, took it out from the array.

So the result of the array after operation will be

{a,b,d,e,f}

If I do array_pop(); function it will only pop the last element inside the 
array and the array will become

{a,b,c,d,e}

Anyway to search the desire element inside the array and took it out from the 
array?

Regards,
Leo
 
Reality starts with Dream

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

--- End Message ---
--- Begin Message ---
Leo,

$letters = array('a', 'b', 'c', 'd', 'e', 'f');
$key = array_search('c', $letters);
$value = array_splice($letters, $key, 1);

$value[0] will contain 'c'
$letters will contain Array ( [0] => a [1] => b [2] => d [3] => e [4] => f )

regards,
Che

On 12/21/06, Leo Liu <[EMAIL PROTECTED]> wrote:
Hi,

I wanted to search through the array and pop out the value which match my 
search criteria. For example

If array has {a,b,c,d,e,f}

I wanna search for "c" and once I found it, took it out from the array.

So the result of the array after operation will be

{a,b,d,e,f}

If I do array_pop(); function it will only pop the last element inside the 
array and the array will become

{a,b,c,d,e}

Anyway to search the desire element inside the array and took it out from the 
array?

Regards,
Leo

Reality starts with Dream

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com


--- End Message ---

Reply via email to