RE: [PHP] Are PHP5 features worth it?

2006-12-20 Thread Nauman Akbar
Hello!

Let us consider my scenario. I am developing a XML based web service. Using
pre PHP 5 features, I am stuck with DOM, SOAP or plain old XML parser. Too
cumbersome - eh.

I specifically upgraded my server to PHP 5 to make use of SimpleXML. I am
sure there are many other packages that are only supported on PHP 5 and are
quite useful.

I presume that is a good enough reason :). Forget about OOP and exceptions.

Regards
Nauman Akbar
Concise Solutions

-Original Message-
From: Niels [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, December 19, 2006 11:05 PM
To: php-general@lists.php.net
Subject: [PHP] Are PHP5 features worth it?

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?

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. What
about performance?

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 major compelling reasons do I have to start using exceptions and OOP-5?


Thanks,
Niels

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

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



Re: [PHP] Re: Are PHP5 features worth it?

2006-12-20 Thread Tony Marston

Larry Garfield [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 On Tuesday 19 December 2006 19:24, Tony Marston wrote:

 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 couldn't disagree more.  While I've yet to write any exception-based 
 code,
 for me the magic getter/setter functionality in PHP 5's OOP is reason 
 enough
 to switch all on its own.

Not for me it isn't.  I don't use getters and setters to access individual 
properties, I use arrays. Much simpler.

  Even if you don't want to write Java-style OO with
 crazy nested hierarchies (which you shouldn't be doing in PHP), true
 Singletons can be quite nice.  The simplicity offered by passing objects 
 as
 references is nice.

But it is not a good enough reason on its own.

  There's a lot more to PHP 5's OOP than just let's add
 exceptions because Java has them, and that's not even counting the 
 non-OOP
 improvements.

 Your point falls flat anyway.  Yes, most PHP 4 code will keep on humming 
 in
 PHP 5.  That doesn't mean the PHP 5 features have no advantage, it just
 means that they're not mandatory for code to work in PHP 5.  There's 
 plenty
 that you can do in PH P 5 that you couldn't do in PHP 4, but if all you 
 know
 is PHP 4 then you don't know what they are yet.

If you bothered to read what I wrote you will see that I *DO* know PHP5 as 
the software I provide runs on both I have two PCs, one with PHP4 and one 
with PHP5 so I can ensure it runs on both.

  Your argument is logically false.

I disagree. This topic is about the question are the new OO features in PHP 
5 worth the effort of upgrading? to which my answer is *NO*. It is possible 
to write OO code in PHP4, and that code will run exactly the same in PHP5. 
Most of the new OO features in PHP5 are just fancy eye-candy which have very 
little practical advantage, so there is no point in modifying existing PHP4 
code to take advantage of those features as it would be all cost and no 
benefit.

-- 
Tony Marston
http://www.tonymarston.net
http://www.radicore.org 

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



Re: [PHP] Are PHP5 features worth it?

2006-12-20 Thread Jochem Maas
Nauman Akbar wrote:
 Hello!
 
 Let us consider my scenario. I am developing a XML based web service. Using
 pre PHP 5 features, I am stuck with DOM, SOAP or plain old XML parser. Too

the DOM extension is php5 only! it replaces DOMXML.

again the SOAP extension (very nice it is too) is php5 only. (in php4 you
were stuck with doing the SOAP by hand (or using someone's userland 
implementation)

 cumbersome - eh.
 
 I specifically upgraded my server to PHP 5 to make use of SimpleXML. I am

I found DOM to be easier to use than SimpleXML (but that was due to the
fact that it was impossible to inspect the structure/content of SimpleXML 
objects
using var_dump(), print_r(), etc - I believe this has since been fixed 
satisfactorily)

 sure there are many other packages that are only supported on PHP 5 and are
 quite useful.

indeed! ...

http://php.net/manual/en/ref.datetime.php
http://php.net/manual/en/ref.stream.php (exists in php4.3+ but 
improved/extended in php5)
http://php.net/manual/en/migration5.functions.php
http://php.net/manual/en/ref.mysqli.php (for connecting to mysql4.1+)
 
 I presume that is a good enough reason :). Forget about OOP and exceptions.

while I agree that exceptions don't really offer anything that couldn't be done
with 'std' error handling - it does offer an alternative which some people 
might prefer ...
having the choice is nice in and of itself.

I wouldn't recommend forgetting OOP - the OO functionality in php5 is an 
improvement
in terms of proper ctors, PPP, 'overloading', and that objects are always by 
reference (and not by value
as in php4) - allround I would suggest php5's OO model is a big step forward 
even though it
entails that you will have to be a bit more strict with regard to how you write 
you OO code.

http://php.net/manual/en/language.oop5.php

obviously choosing OO over procedural style, or vice versa is a question of 
taste
(I use both depending on the needs, time of month, my mood :-)

 
 Regards
 Nauman Akbar
 Concise Solutions
 
 -Original Message-
 From: Niels [mailto:[EMAIL PROTECTED] 
 Sent: Tuesday, December 19, 2006 11:05 PM
 To: php-general@lists.php.net
 Subject: [PHP] Are PHP5 features worth it?
 
 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?
 
 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. What
 about performance?
 
 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 major compelling reasons do I have to start using exceptions and OOP-5?
 
 
 Thanks,
 Niels
 

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



Re: [PHP] Are PHP5 features worth it?

2006-12-20 Thread Roman Neuhauser
# [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).

 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? 
 
 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?

 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.

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);
}

-- 
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

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



Re: [PHP] Video question

2006-12-20 Thread Philipp Schwarz
You can put the video into a flash file and start playing the video with 
Javascript. If someone downloads the video, he will see a blank page, 
because of the missing start command from Javascript.


Problem: If someone downloads the compleate page, he can watch the video.

You can solve this by using complicated AJAX structures, but if someone 
tracks the AJAX-traffic it will be easy to start the video.


In fakt there is no way to prevent videos from downloading. If the 
browser can play the video, than there is a way to get it.


MfG Philipp

John Messam schrieb:

How do I display video on my php page and prevent the video from being
downloaded.

  


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



Re: [PHP] Payflow and Php5 on FreeBSD

2006-12-20 Thread Roman Neuhauser
# [EMAIL PROTECTED] / 2006-12-19 18:33:07 -0500:
I'm trying to get payflow working with php5 as a loadable extension. My 
 configure line has:
 
 '--with-pfpro=shared,/usr/local'
 
 and php5 installed fine via FreeBSD ports. I then installed Payflow pro 
 also via FreeBSd ports. I'm getting an error with payflow_init which tells 
 me payflow and php are not talking.

What ports exactly have you installed for this? The only Payflow related
port I can see is a Perl module Business::OnlinePayment.

Let us know exact port origins (/usr/ports/$category/$portname), pkg
names and options used.  You'll find the information in /var/db/pkg and
/var/db/ports.

-- 
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

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



Re: [PHP] Are PHP5 features worth it?

2006-12-20 Thread Jochem Maas
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?
 
 All the things you mentioned, and then some.
 
 Someone else mentioned that PHP 5 is much less inclined to copy objects.

it's not inclined to copy at all - you always get a reference to the existing
object.

 You still don't get the convenience of a private copy constructor, but
 hey.

maybe I misunderstand you but isn't this what you mean by 'private copy ctor'?:

http://php.net/manual/en/language.oop5.cloning.php

 
 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.
 
 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);
 }

ah yes - good catch, I do like iterators for keeping code nice and tight.

 

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



Re: [PHP] Database Question

2006-12-20 Thread Roman Neuhauser
# [EMAIL PROTECTED] / 2006-12-20 00:01:29 -0700:
I'm starting to log weather data to a database and I'm trying to 
 figure out what's the best way to create the tables.  The reports are 
 coming in every minute, of every hour, 24 hours a day.  Eventually, I'd 
 like to do some calculations on the statistics, displaying daily values 
 (which can be broken down to hourly), but then also daily and monthly 
 averages.
 
To me, it doesn't make sense to dump everything into one big table, 
 but I can't figure out what's the best way to break it down either.  

Why doesn't it make sense?

(That is a honest question: breaking the table makes no sense to me,
so I'm really curious about your conclusions.)

 Keep in mind that the only data I have, is what comes in for that 
 minute.  The daily averages I have to calculate myself (later.)  But I 
 can't see one large table being very effective when it comes to 
 calculating that stuff.

Use materialized views. I use triggers and/or rules (in PostgreSQL) in
situations like the one you describe.

So, how should I break the tables down?  Create a new table every 
 day (20061219_data, 20061220_data, etc.) and insert all the values in 
 it?  Or, break it down per values (temp_table, humidity_table, etc.) and 
 insert daily data in them?

Imagine you have the data broken into monthly tables. I want to see
average values from 2005-11-13 till 2006-02-16, what will you do?

-- 
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

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



Re: [PHP] Are PHP5 features worth it?

2006-12-20 Thread Robert Cummings
On Wed, 2006-12-20 at 11:49 +0100, Jochem Maas wrote:
 
  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);
  }
 
 ah yes - good catch, I do like iterators for keeping code nice and tight.

I don't what you guys did in PHP4, but I do the following:

?php

if( $db-query( $query ) )
{
while( ($row = $db-fetchRow()) )
{
whatever( $row );
}
}

?

I fail to see the need for an iterator. But, I'll grant you, proper
destructor support is nice.

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

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



Re: [PHP] Are PHP5 features worth it?

2006-12-20 Thread Roman Neuhauser
# [EMAIL PROTECTED] / 2006-12-20 11:49:25 +0100:
 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?
  
  All the things you mentioned, and then some.
  
  Someone else mentioned that PHP 5 is much less inclined to copy objects.
 
 it's not inclined to copy at all - you always get a reference to the existing
 object.

Well, that's been my observation so far... but PHP has no specification,
and I don't really know I've hit all the little corners of the
self-defining implementation.
 
  You still don't get the convenience of a private copy constructor, but
  hey.
 
 maybe I misunderstand you but isn't this what you mean by 'private copy 
 ctor'?:
 
 http://php.net/manual/en/language.oop5.cloning.php

Yes, that's (almost exactly) what I meant. I dunno why I thought
__clone() couldn't be made private, perpahs it didn't work in 5.0.x when
I played with the new features?

Sorry for the FUD in any case.

-- 
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

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



Re: [PHP] Are PHP5 features worth it?

2006-12-20 Thread Jochem Maas
Robert Cummings wrote:
 On Wed, 2006-12-20 at 11:49 +0100, Jochem Maas wrote:
 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);
 }
 ah yes - good catch, I do like iterators for keeping code nice and tight.
 
 I don't what you guys did in PHP4, but I do the following:
 
 ?php
 
 if( $db-query( $query ) )
 {
 while( ($row = $db-fetchRow()) )
 {
 whatever( $row );
 }
 }
 
 ?
 
 I fail to see the need for an iterator. But, I'll grant you, proper
 destructor support is nice.

I agree that there is no *need* for iterator (as your example demonstrates);
yet I do like the functionality - basing things on the 'need' argument alone and
taking it right down to the fundamentals ... why do we need php? why do we need 
internet?
or even computers? in truth we *need* none of these things (I can't eat it, 
sleep under it or
breathe it) ;-P

I like iterators, and in that sense it's like having warmed seating in the car 
- not needed
but I like it! having a new programming style/paradigm/fit-better-word-here 
in php5
might be a reason for some to step over.

I write code because I enjoy it - if all there was was assembler I would 
probably
never have got it the game - to me the development experience is something I 
care about ...
there is a reason I don't play with Perl (namely reading Perl code generally 
makes me feel
sea-sick). that said experience is personal, some, apparently, avoid php for 
the same reason
I avoid Perl.

that said php avoidance is silly - resistance is futile, we will assimilate ;-)

 
 Cheers,
 Rob.


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



Re: [PHP] Are PHP5 features worth it?

2006-12-20 Thread Robert Cummings
On Wed, 2006-12-20 at 12:27 +0100, Jochem Maas wrote:
 Robert Cummings wrote:
  On Wed, 2006-12-20 at 11:49 +0100, Jochem Maas wrote:
  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);
  }
  ah yes - good catch, I do like iterators for keeping code nice and tight.
  
  I don't what you guys did in PHP4, but I do the following:
  
  ?php
  
  if( $db-query( $query ) )
  {
  while( ($row = $db-fetchRow()) )
  {
  whatever( $row );
  }
  }
  
  ?
  
  I fail to see the need for an iterator. But, I'll grant you, proper
  destructor support is nice.
 
 I agree that there is no *need* for iterator (as your example demonstrates);
 yet I do like the functionality - basing things on the 'need' argument alone 
 and
 taking it right down to the fundamentals ... why do we need php? why do we 
 need internet?
 or even computers? in truth we *need* none of these things (I can't eat it, 
 sleep under it or
 breathe it) ;-P

Absolutely, but the OP asked if there was anything compelling enough to
switch to PHP5... and so the concept of need versus desire was on the
table :)

 I like iterators, and in that sense it's like having warmed seating in the 
 car - not needed
 but I like it! having a new programming style/paradigm/fit-better-word-here 
 in php5
 might be a reason for some to step over.
 
 I write code because I enjoy it - if all there was was assembler I would 
 probably
 never have got it the game - to me the development experience is something I 
 care about ...
 there is a reason I don't play with Perl (namely reading Perl code generally 
 makes me feel
 sea-sick). that said experience is personal, some, apparently, avoid php for 
 the same reason
 I avoid Perl.
 
 that said php avoidance is silly - resistance is futile, we will assimilate 
 ;-)

Cheers to that!

Happy Winter Solstice!
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.  |
`'

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



Re: [PHP] Are PHP5 features worth it?

2006-12-20 Thread Roman Neuhauser
# [EMAIL PROTECTED] / 2006-12-20 06:05:29 -0500:
 On Wed, 2006-12-20 at 11:49 +0100, Jochem Maas wrote:
  
   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);
   }
  
  ah yes - good catch, I do like iterators for keeping code nice and tight.
 
 I don't what you guys did in PHP4, but I do the following:
 
 ?php
 
 if( $db-query( $query ) )
 {
 while( ($row = $db-fetchRow()) )
 {
 whatever( $row );
 }
 }
 
 ?
 
 I fail to see the need for an iterator. But, I'll grant you, proper
 destructor support is nice.

There's no need just as there's no need for the while. Both are
conveniences. next() is more convenient than the because it's generic.
A single implementation can operate on an array, a DirectoryIterator,
SPLFileObject or MyDBResultSet.

Take a look at the STL[1] to get an idea what a set of generic
interfaces can do for you.  Short answer: wonders!

Oh, and BTW, I do remember those days of painfully boring

if (!operation()) {
return some_error_indication;
}
whatever();

What we do in PHP 5 is use airbags and safety belts:

operation(); // throws on errors, taken care of by the caller
whatever();

BTW, fetchRow() is (IMO) better than next() *if used in while()* because
the code reads more naturally.

foreach ($rs as $row)

IMO wins over

while($row = $rs-fetchRow())

although this would win my vote:

foreach ($row in $rs) // pseudocode
 
[1] http://www.sgi.com/tech/stl/

-- 
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

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



[PHP] ob_start(ob_gzhandler) and error handling functions

2006-12-20 Thread IG

Hi,

I include a php file at the beginning of every web page in this site. 
This include file has an error handling function and starts output 
buffering...


// Start of Error Handler
error_reporting(E_ALL ^ E_NOTICE);
ini_set('log_errors','1');

function ErrHandler($err,$err_string='',$err_file,$err_line)
   {
   // Do error logging thang

   ob_end_clean();// Clear buffer
  
   include('/path/incs/errors/errors.inc');// Output friendly error 
page

   exit();
   }   


set_error_handler('ErrHandler');

// End of Error Handler

It works great and the error handler kicks in if there is an error on 
the page and outputs a friendly page instead. I really wanted to gzip 
the pages by using ob_start(ob_gzhandler) but it doesn't work. I think 
it is because of the error handler function trying to clear the buffer 
(see the line ob_end_clean() which I assume becomes 
ob_end_clean(ob_gzhandler) ). It says on the php functions page- 
*ob_start()* may not be called from a callback function. If you call 
them from callback function, the behavior is undefined. If you would 
like to delete the contents of a buffer, return  (a null string) from 
callback function.


As I am new to this- I don't really understand what it is trying to get 
at. Is there a way of me using my error handler and evoking the 
ob_start(ob_gzhandler) ?


Thanks.

Ianob_




|ob_start(ob_gzhandler);|

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



Re: [PHP] Are PHP5 features worth it?

2006-12-20 Thread Bernhard Zwischenbrugger
All the XML things are new

Start with DOM. If you know DOM in Browser you can use DOM in PHP5.
AJAX Webapplications are not possible in PHP4. The experimental DOMXML
in PHP4 is NOT standard conform and has DIFFERENT syntax than DOM in
Javascript.

To retrive data from AJAX is simple.

$data=file_get_contents('php://input');
$dom=domDocument::loadXML($data);

Using an iterator, it is easy to put this data to a database.

$elements=$dom-getElementsByTagName('whateveryouwant');
foreach($elements as $element){
...
}

XPath also helps a lot.
---
You can use and provide XML Comunication (Webservices) with the same
skills as you do  AJAX. Google for example has lots of Webservices that
are really useful. You can also connect to SAP Systems using XML for 
Data transfer...
This opens a new world.

And finally PHP5 has much better XSLT support than PHP4. It's still
experimental, but it uses libxslt which is a really good thing.
--
If you do real javascript programming (not only document.write and
innerHTML) there are lots of things you
can do in the same way in PHP5 and javascript.
Learn it once and use it Client- and Serverside - that's the good thing
in PHP5.

The bad thing is, that all this nice new things are hidden in the online
documentation. If you search for getElementsByTagName (a DOM Method)
you don't find it. The same with XSLT.

Bernhard

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



Re: [PHP] Are PHP5 features worth it?

2006-12-20 Thread Robert Cummings
On Wed, 2006-12-20 at 15:14 +0100, Bernhard Zwischenbrugger wrote:

 AJAX Webapplications are not possible in PHP4.

Bullshit.

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

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



Re: [PHP] Are PHP5 features worth it?

2006-12-20 Thread Stut

Robert Cummings wrote:

On Wed, 2006-12-20 at 15:14 +0100, Bernhard Zwischenbrugger wrote:

AJAX Webapplications are not possible in PHP4.


Bullshit.


Indeed, what with PHP being server-side and AJAX being client-side.

Where AJAX is concerned the server-side technology is irrelevant.

-Stut

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



RE: [PHP] Are PHP5 features worth it?

2006-12-20 Thread Ray Hauge
PHP 5.2 supports JSON internally now, so you don't have to use XML.
There's pros and cons associated with JSON, but that was possible with
PHP4 as well.

--
Ray Hauge
Application Development Lead
American Student Loan Services
www.americanstudentloan.com

-Original Message-
From: Stut [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, December 20, 2006 8:37 AM
To: Robert Cummings
Cc: Bernhard Zwischenbrugger; php-general@lists.php.net
Subject: Re: [PHP] Are PHP5 features worth it?

Robert Cummings wrote:
 On Wed, 2006-12-20 at 15:14 +0100, Bernhard Zwischenbrugger wrote:
 AJAX Webapplications are not possible in PHP4.
 
 Bullshit.

Indeed, what with PHP being server-side and AJAX being client-side.

Where AJAX is concerned the server-side technology is irrelevant.

-Stut

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

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



[PHP] A little code snippet I wanted to share

2006-12-20 Thread Jay Blanchard

if(('12/24'  $myDate)  ('12/26'  $myDate)  (TRUE == $belief)){
   echo Merry Christmas!\n;
} elseif(TRUE == $variationOnATheme){
   echo Happy Holidays!\n;
} elseif(TRUE == $liberal) {
   echo Joyous ChrisMaHanuKwanzica!\n;
} else {
   echo Bah Humbug!\n;
}

I probably could have used a switch statement. YMMV

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



Re: [PHP] Are PHP5 features worth it?

2006-12-20 Thread Jochem Maas
Stut wrote:
 Robert Cummings wrote:
 On Wed, 2006-12-20 at 15:14 +0100, Bernhard Zwischenbrugger wrote:
 AJAX Webapplications are not possible in PHP4.

 Bullshit.
 
 Indeed, what with PHP being server-side and AJAX being client-side.
 
 Where AJAX is concerned the server-side technology is irrelevant.

not to mention that php 'has the preference'* for passing JSON encoded
data around when it comes to ajax interaction between server and client -
rather than use bloated XML.

http://php.net/json

*endorsed by Rasmus ;-)
 
 -Stut
 

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



[PHP] get id field in table

2006-12-20 Thread Gonzalo Gorosito
Hello!

 

How can I identify the field ID in some table (MySQL)?

 

Regards

 

 

--
Gonzalo Gorosito

 

Sistemas | By-Cycle
Humboldt 2495, Piso 10
C1425FUG - Bs.As. Argentina
Tel.: + 54 (11) 4774 6006 | Fax: + 54 (11) 4774 7117
www.by-cycle.com http://www.by-cycle.com/ 
[EMAIL PROTECTED]

 



Re: [PHP] Database Question

2006-12-20 Thread tg-php
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.

Temperature, barametric pressure, humidity, wind direction, etc.  You're not 
going to have 5 things all the time and like 3 other things only sometimes.

You'd want to split the data into separate tables if there was some data that 
was infrequently.  Take a contact database for instance.  You might have name, 
address, phone, birthday.  But then maybe your company has forms that some 
people fill out.  You wouldn't want all the data for a form that they may or 
may not fill out in the same table.  You'd end up with a lot of empty spaces 
for the forms that some people never needed to fill out.  So you'd put that 
data into a separate table and link them via a contact ID or something.

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 before it returns any data (which is pretty much the 
slow part of database access.. especially when there's a lot of data to return. 
 Data return and uber-complex joins.. but even they can be more efficient than 
returning too much data).

You could section your tables off by date if you want.  1/2 million records a 
year and you could get away with having a few years in one table, or keep it 
year to year.  You gotta ask yourself though, if you're going to want 
statistics that cross multiple years or whatever boundary you set for your 
splitting.  If so, you're really better off having it all in one table than 
trying to UNION the tables later (although that's viable too I guess.. it just 
gives me the willies.. bad experiences.. hah)

Just some additional thoughts on top of what's already been mentioned.

Oh yeah... buy a book and take it to the insert database type mailing list :) 
 Good luck!

-TG

= = = Original message = = =

Someone's going to tell me to go buy a book, I just know it.  I'll 
ask anyway:

I'm starting to log weather data to a database and I'm trying to 
figure out what's the best way to create the tables.  The reports are 
coming in every minute, of every hour, 24 hours a day.  Eventually, I'd 
like to do some calculations on the statistics, displaying daily values 
(which can be broken down to hourly), but then also daily and monthly 
averages.

To me, it doesn't make sense to dump everything into one big table, 
but I can't figure out what's the best way to break it down either.  
Keep in mind that the only data I have, is what comes in for that 
minute.  The daily averages I have to calculate myself (later.)  But I 
can't see one large table being very effective when it comes to 
calculating that stuff.

So, how should I break the tables down?  Create a new table every 
day (20061219_data, 20061220_data, etc.) and insert all the values in 
it?  Or, break it down per values (temp_table, humidity_table, etc.) and 
insert daily data in them?

-- A


___
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.

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



[PHP] Trying to insert a large number from php to mysql

2006-12-20 Thread WeberSites LTD
Hi
 
I'm trying to insert the number 1970324970930197 into a mysql BigInt(20)
field.
If I do a direct insert from mysql command prompt and select the record I
get
back the same number.
 
If I do this from PHP I get back 197032497093. Notice that the 197 at
the
end is not 000.
 
When echoing the number in php it looks like : 1.970324970930E+15 so I'm 
guessing  this is the reason why the 3 Zeros are added instead of the 197 
at the end.
 
How can I avoid this and actually pass the real number to mysql?
 
thanks


Re: [PHP] Trying to insert a large number from php to mysql

2006-12-20 Thread Jon Anderson

WeberSites LTD wrote:

I'm trying to insert the number 1970324970930197 into a mysql BigInt(20)
field.
If I do a direct insert from mysql command prompt and select the record I
get
back the same number.
 
If I do this from PHP I get back 197032497093. Notice that the 197 at

the
end is not 000.
AFAIK, PHP uses 32-bit (signed) integers, so you're stuck to values no 
bigger than around 2 billion. Anything larger, and you have to store it 
as a string: use a BigInt class, or GMP functions to do calculations. 
I believe MySQL will do the right thing if you insert a string integer 
into an integer field.


jon

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



Re: [PHP] get id field in table

2006-12-20 Thread Jochem Maas
Gonzalo Gorosito wrote:
 Hello!
 
  
 
 How can I identify the field ID in some table (MySQL)?

the answer is probably the opposite of the answer to the following
question:

is this a mysql mailing list?

 
  
 
 Regards
 
  
 
  
 
 --
 Gonzalo Gorosito
 
  
 
 Sistemas | By-Cycle
 Humboldt 2495, Piso 10
 C1425FUG - Bs.As. Argentina
 Tel.: + 54 (11) 4774 6006 | Fax: + 54 (11) 4774 7117
 www.by-cycle.com http://www.by-cycle.com/ 
 [EMAIL PROTECTED]
 
  
 
 

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



Re: [PHP] Trying to insert a large number from php to mysql

2006-12-20 Thread Robert Cummings
On Wed, 2006-12-20 at 10:58 -0500, Jon Anderson wrote:
 WeberSites LTD wrote:
  I'm trying to insert the number 1970324970930197 into a mysql BigInt(20)
  field.
  If I do a direct insert from mysql command prompt and select the record I
  get
  back the same number.
   
  If I do this from PHP I get back 197032497093. Notice that the 197 at
  the
  end is not 000.
 AFAIK, PHP uses 32-bit (signed) integers, so you're stuck to values no 
 bigger than around 2 billion. Anything larger, and you have to store it 
 as a string: use a BigInt class, or GMP functions to do calculations. 
 I believe MySQL will do the right thing if you insert a string integer 
 into an integer field.

Just to add... the reason the number changes is because PHP detects that
it is too big and so stuffs it into a float where precision is then
lost.

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

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



RE: [PHP] Trying to insert a large number from php to mysql

2006-12-20 Thread WeberSites LTD
Thanks
What I'm doing now to work around is using number_format() and str_replace()
to remove the ,.
This give me the string and mysql uses it correctly. 

-Original Message-
From: Jon Anderson [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, December 20, 2006 5:59 PM
To: WeberSites LTD
Cc: php-general@lists.php.net
Subject: Re: [PHP] Trying to insert a large number from php to mysql

WeberSites LTD wrote:
 I'm trying to insert the number 1970324970930197 into a mysql 
 BigInt(20) field.
 If I do a direct insert from mysql command prompt and select the 
 record I get back the same number.
  
 If I do this from PHP I get back 197032497093. Notice that the 197 
 at the end is not 000.
AFAIK, PHP uses 32-bit (signed) integers, so you're stuck to values no
bigger than around 2 billion. Anything larger, and you have to store it as a
string: use a BigInt class, or GMP functions to do calculations. 
I believe MySQL will do the right thing if you insert a string integer 
into an integer field.

jon

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

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



Re: [PHP] get id field in table

2006-12-20 Thread Roman Neuhauser
# [EMAIL PROTECTED] / 2006-12-20 16:58:43 +0100:
 Gonzalo Gorosito wrote:
  Hello!
  
   
  
  How can I identify the field ID in some table (MySQL)?
 
 the answer is probably the opposite of the answer to the following
 question:
 
 is this a mysql mailing list?

Questions beginning with How usually aren't boolean. :)

-- 
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

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



Re: [PHP] get id field in table

2006-12-20 Thread Jochem Maas
Roman Neuhauser wrote:
 # [EMAIL PROTECTED] / 2006-12-20 16:58:43 +0100:
 Gonzalo Gorosito wrote:
 Hello!

  

 How can I identify the field ID in some table (MySQL)?
 the answer is probably the opposite of the answer to the following
 question:

 is this a mysql mailing list?
 
 Questions beginning with How usually aren't boolean. :)

you got me! I thought the guy was a Soiux indian - and that we was saying hello 
:-P
given that my cleverly disguised 'f*** off with your off topic question' reply
has bneen blown clear out of the water I feel obliged to provide a pointer
to the answer.

YO GONZALO - IM ASSUMING YOUR USING PHP ... start by reading this page:

http://php.net/manual/en/function.mysql-fetch-field.php

 

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



[PHP] use_trans_id doesn't add PHPSESSID to url string

2006-12-20 Thread blackwater dev

I have session.user_trans_id set to 1 in my php.ini file yet when I see
links, the PHPSESSID isn't automatically added.  I have another site where
this is done by php but on another box it isn't.  The broken box uses
4.3.11with the following ini settings.  What am I missing?

Thanks!

session.auto_startOffOff session.bug_compat_42OnOn session.bug_compat_warnOn
On session.cache_expire00 session.cache_limiternocachenocache
session.cookie_domain*no value**no value* session.cookie_lifetime00
session.cookie_path// session.cookie_secureOffOff session.entropy_file/de/de
session.entropy_length00 session.gc_divisor100100 session.gc_maxlifetime
2160021600 session.gc_probability0.00010.0001 session.namePHPSESSIDPHPSESSID
session.referer_check*no value**no value* session.save_handlerfilesfiles
session.save_path/tmp/tmp session.serialize_handlerphpphp
session.use_cookiesOffOff session.use_only_cookiesOffOff
session.use_trans_sidOnOn


RE: [PHP] Are PHP5 features worth it?

2006-12-20 Thread Bernhard Zwischenbrugger
Is there a way to parse XML in PHP4?

The X in ajax means XML. If I send XML from Browser to PHP the XML
must be parsed.

In PHP4 there are expat functions and the experimental DOMXML
functions. Both are not included in default installations.

XML Support in PHP5 is realy good - in PHP4 nearly not existent.

Some peoply like JSON, I personaly prefer XML 


Bernhard

Am Mittwoch, den 20.12.2006, 06:47 -0800 schrieb Ray Hauge:
 PHP 5.2 supports JSON internally now, so you don't have to use XML.
 There's pros and cons associated with JSON, but that was possible with
 PHP4 as well.
 
 --
 Ray Hauge
 Application Development Lead
 American Student Loan Services
 www.americanstudentloan.com
 
 -Original Message-
 From: Stut [mailto:[EMAIL PROTECTED] 
 Sent: Wednesday, December 20, 2006 8:37 AM
 To: Robert Cummings
 Cc: Bernhard Zwischenbrugger; php-general@lists.php.net
 Subject: Re: [PHP] Are PHP5 features worth it?
 
 Robert Cummings wrote:
  On Wed, 2006-12-20 at 15:14 +0100, Bernhard Zwischenbrugger wrote:
  AJAX Webapplications are not possible in PHP4.
  
  Bullshit.
 
 Indeed, what with PHP being server-side and AJAX being client-side.
 
 Where AJAX is concerned the server-side technology is irrelevant.
 
 -Stut
 

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



RE: [PHP] Are PHP5 features worth it?

2006-12-20 Thread Robert Cummings
On Wed, 2006-12-20 at 17:38 +0100, Bernhard Zwischenbrugger wrote:
 Is there a way to parse XML in PHP4?

Yes. And even if there weren't any libs, there's nothing stopping anyone
from writing a parser in PHP itself!

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

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



RE: [PHP] get id field in table

2006-12-20 Thread bruce
gonzalo...

i didn't see your original post... but this might help... assuming some
things... not actual code, but you might get the idea.

assume your tbl looks something like

mysql db/tbls:
table foo
 dog  -int
 cat  -varchar(10)
 etc...
 id   -auto generated

you can set up the mysql db/tbl to allow specified user(s) to access the
db/tbl, for the given port. specifiying/allowing user access is via the
'grant privilege' function for mysql.


in your php you need to connect with the db, as well as invoke queries that
are run on the targeted db

 $db2_host  -host system (ip address)
 $db2_user  -user for db (matches the grant)
 $db2_passwd-user passwd
 $db2_database  -name of mysql database

 // Make the database connection.
 $link2 = new mysqli($db2_host, $db2_user, $db2_passwd, $db2_database);
 //check connection/error
 if(mysqli_connect_errno())
 {
printf(connect2 err: %s\n,mysqli_connect_error());
exit();
 }

 $q4 = select * from foo where cat='ted';;

   $res = $link2-query($q4);
   while($row = $res-fetch_array(MYSQL_ASSOC))
   {
  $id = $row['id'];
   }

this gets you the 'id'

to get a better understanding of how all this works, take a look at the
mysql site, as well as the sections of the php site that deal with
interfacing with mysql. you'll see the information on mysql/mysqli cmds, as
well as information on how to deal with the interfaces using procedural and
object oriented methods...

have fun!!!



-Original Message-
From: Jochem Maas [mailto:[EMAIL PROTECTED]
Sent: Wednesday, December 20, 2006 8:24 AM
To: Roman Neuhauser
Cc: Gonzalo Gorosito; php-general@lists.php.net
Subject: Re: [PHP] get id field in table


Roman Neuhauser wrote:
 # [EMAIL PROTECTED] / 2006-12-20 16:58:43 +0100:
 Gonzalo Gorosito wrote:
 Hello!



 How can I identify the field ID in some table (MySQL)?
 the answer is probably the opposite of the answer to the following
 question:

 is this a mysql mailing list?

 Questions beginning with How usually aren't boolean. :)

you got me! I thought the guy was a Soiux indian - and that we was saying
hello :-P
given that my cleverly disguised 'f*** off with your off topic question'
reply
has bneen blown clear out of the water I feel obliged to provide a pointer
to the answer.

YO GONZALO - IM ASSUMING YOUR USING PHP ... start by reading this page:

http://php.net/manual/en/function.mysql-fetch-field.php



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

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



Re: [PHP] Are PHP5 features worth it?

2006-12-20 Thread Jochem Maas
Robert Cummings wrote:
 On Wed, 2006-12-20 at 17:38 +0100, Bernhard Zwischenbrugger wrote:
 Is there a way to parse XML in PHP4?
 
 Yes. And even if there weren't any libs, there's nothing stopping anyone
 from writing a parser in PHP itself!

ai, and in most cases a regexp will cut it,
gotta love those 1 line parsers :-)

 
 Cheers,
 Rob.

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



RE: [PHP] Are PHP5 features worth it?

2006-12-20 Thread Ray Hauge
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).

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)

--
Ray Hauge
Application Development Lead
American Student Loan Services
www.americanstudentloan.com

-Original Message-
From: Jochem Maas [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, December 20, 2006 12:22 PM
To: Robert Cummings
Cc: Bernhard Zwischenbrugger; php-general@lists.php.net
Subject: Re: [PHP] Are PHP5 features worth it?

Robert Cummings wrote:
 On Wed, 2006-12-20 at 17:38 +0100, Bernhard Zwischenbrugger wrote:
 Is there a way to parse XML in PHP4?
 
 Yes. And even if there weren't any libs, there's nothing stopping
anyone
 from writing a parser in PHP itself!

ai, and in most cases a regexp will cut it,
gotta love those 1 line parsers :-)

 
 Cheers,
 Rob.

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

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



[PHP] SoapServer and Violation of encoding rules

2006-12-20 Thread Ville Mattila

Hello readers,

I am consuming a web service created with PHP from .NET application. I
have defined a custom datatype in my WSDL document:
types xmlns=http://schemas.xmlsoap.org/wsdl/;
   schema targetNamespace=urn:testService
xmlns=http://www.w3.org/2001/XMLSchema;
complexType name=objSessionToken
 sequence
  element name=clientApplicationId type=xsd:string/
  element name=clientApplicationVersion type=xsd:string/
 /sequence
/complexType
   /schema
/types

My VB.NET is able to see this datatype and successfully maps it to .NET
datatype. This same objSessionRequest is mapped to PHP class at SOAP
Server (classmap option in server constructor).

Now, when I try to call a function and send objSessionToken object on
the SOAP Request, the server returns SOAP-ERROR: Encoding: Violation of
encoding rules fault.

I can't find any reason for this - could somebody give some hints where
to find and what would cause this error?

Thanks,
Ville

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



Re: [PHP] [an attempt to inject a bit of humor back into the situation] Re: [PHP] Recomended host

2006-12-20 Thread Børge Holen
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
---

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



[PHP] Do Sockets Cache?

2006-12-20 Thread Aras
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

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



Re: [PHP] [an attempt to inject a bit of humor back into the situation] Re: [PHP] Recomended host

2006-12-20 Thread Jochem Maas
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

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



Re: [PHP] Do Sockets Cache?

2006-12-20 Thread Roman Neuhauser
# [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

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



Re: [PHP] Do Sockets Cache?

2006-12-20 Thread Stut

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

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



[PHP] RE: Are PHP5 features worth it?

2006-12-20 Thread Niels
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

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



Re: [PHP] RE: Are PHP5 features worth it?

2006-12-20 Thread Jochem Maas
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
 

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



Re: [PHP] RE: Are PHP5 features worth it?

2006-12-20 Thread Robert Cummings
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.  |
`'

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



Re: [PHP] RE: Are PHP5 features worth it?

2006-12-20 Thread Jochem Maas
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.

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



Re: [PHP] RE: Are PHP5 features worth it?

2006-12-20 Thread Børge Holen
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
---

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



Re: [PHP] RE: Are PHP5 features worth it?

2006-12-20 Thread jekillen


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

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



[PHP] Re: Are PHP5 features worth it?

2006-12-20 Thread Niels
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

-- 
PHP General 

[PHP] Re: Are PHP5 features worth it?

2006-12-20 Thread Niels
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

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



Re: [PHP] Are PHP5 features worth it?

2006-12-20 Thread tedd

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

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



Re: [PHP] Database Question

2006-12-20 Thread Sumeet

[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

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



[PHP] Re: Video Question

2006-12-20 Thread Fahad Pervaiz

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


[PHP] Poping array which has the matching value

2006-12-20 Thread Leo Liu
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 

Re: [PHP] Poping array which has the matching value

2006-12-20 Thread Che Hodgins

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



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



Re: [PHP] RE: Are PHP5 features worth it?

2006-12-20 Thread Lester Caine

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

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