Re: [PHP] Parsing XML

2008-11-29 Thread Ashley Sheridan
On Fri, 2008-11-28 at 20:39 +0100, Per Jessen wrote:
> Andrew Ballard wrote:
> 
> >> XSL will only allow me to convert it into a different document
> >> format, which is not what I want as I need to keep a local copy of
> >> information in a database for searching and sorting purposes. Nathans
> >> class allows me to have the entire document put into an array tree,
> >> which is fine for what I need so far.
> >>
> >>
> >> Ash
> >> www.ashleysheridan.co.uk
> > 
> > A bit over the top, but you could always use XSL to turn it into CSV. 
> >  LOL
> > 
> > Andrew
> 
> Not over the top at all if your database understands CSV.  I think it is
> very odd that no-one else is advocating XSL in this case.  Extracting
> information from an XML file is just another way of converting it,
> which is exactly what XSL is good at.  I can't imagine how using a pile
> of custom PHP code is going to be more efficient than writing a simple
> XSL stylesheet according to recognised standards etc.  Just my opinion
> of course. 
> 
> 
> /Per Jessen, Zürich
> 
> 
That would destroy the relationship of the data, as it id in no
structure that would be easy to port to a CSV format.


Ash
www.ashleysheridan.co.uk


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



[PHP] Something to lighten the mood...

2008-11-29 Thread Richard Heyes
Just read this:

How many Google Chrome users does it take to change a lightbulb?
None. The lightbulb is isolated, so if it fails, the room doesn't go dark.

-- 
Richard Heyes

HTML5 Graphing for FF, Chrome, Opera and Safari:
http://www.rgraph.org (Updated November 29th)

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



[PHP] Re: Something to lighten the mood...

2008-11-29 Thread Nathan Rixham

Richard Heyes wrote:

Just read this:

How many Google Chrome users does it take to change a lightbulb?
None. The lightbulb is isolated, so if it fails, the room doesn't go dark.



tbh I'm most impressed with your remote php-general-list mood detection 
script - how did you know?


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



Re: [PHP] Re: Something to lighten the mood...

2008-11-29 Thread Daniel P. Brown
On Sat, Nov 29, 2008 at 3:25 PM, Nathan Rixham <[EMAIL PROTECTED]> wrote:
>
> tbh I'm most impressed with your remote php-general-list mood detection
> script - how did you know?

And here, when you said 'RBH' the first time, I thought you knew
Richard's middle name.

-- 

http://www.parasane.net/
[EMAIL PROTECTED] || [EMAIL PROTECTED]
50% Off Hosting! http://www.pilotpig.net/specials.php

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



[PHP] Re: Something to lighten the mood...

2008-11-29 Thread Nathan Rixham

Richard Heyes wrote:

Just read this:

How many Google Chrome users does it take to change a lightbulb?
None. The lightbulb is isolated, so if it fails, the room doesn't go dark.



rbh I'm most impressed with your remote php-general-list mood detection 
script - how did you know?


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



[PHP] operators as callbacks?

2008-11-29 Thread Joe
Is it possible to use a PHP operator as a callback? Suppose I want to add two
arrays elementwise, I want to be able to do something like this:
 array_map('+', $array1, $array2)
but this doesn't work as "+" is an operator and not a function.

I can use the BC library's math functions instead:
 array_map('bcadd', $array1, $array2)
but that is an ugly hack that might break if the library is not available.

I can create an anonymous function:
 array_map(create_function('$a, $b', 'return $a + $b;'), $array1, $array2)
but that seems really unnecessarily verbose.

Is there any simple clean way to do it? Thanks,



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



Re: [PHP] operators as callbacks?

2008-11-29 Thread Nathan Nobbe
On Sat, Nov 29, 2008 at 2:42 PM, Joe <[EMAIL PROTECTED]> wrote:

> Is it possible to use a PHP operator as a callback?


not that im aware of, even if you use the operator overloading extension, im
not sure youll find that ability.

I can use the BC library's math functions instead:
>  array_map('bcadd', $array1, $array2)
> but that is an ugly hack that might break if the library is not available.


 i dont know how bad that is really, i guess it depends on the distribution
scope of the application.  if its in a controlled environment, id just say
install bcmath and forget it.

I can create an anonymous function:
>  array_map(create_function('$a, $b', 'return $a + $b;'), $array1, $array2)
> but that seems really unnecessarily verbose.


well, youll just have to wait for 5.3 and its new lambda notation, youll be
able to do this (something close anyway :)),

array_map(function($a, $b) { return $a + $b; }, $array1, $array2);

it doesnt look like much difference here, but create_function() gets a lot
worse w/ functions any less trivial than adding 2 numbers.

Is there any simple clean way to do it? Thanks,


i think youre beating your head against the wall for no good reason.  your
solutions are fine, just pick one and roll w/ it ;)

-nathan


[PHP] Text To Speech Update

2008-11-29 Thread Daniel P. Brown
Any/All:

For those of you who were asking about the PHP Text-To-Speech
system I had running, it's back online now.  If you have a few free
seconds, please take a look at http://www.pilotpig.net/txt2wav.php and
let me know if it's working for sure in your browser and on your OS.

With a bit more time being available to devote to non-paid
projects, and hopefully getting a bit better still in the next week or
so, I've had time to be able to work more with the PHP project and the
PHP-VOX.  When I make enough improvements to the installation routines
so that folks can easily do it on their own servers, I'll have the
source available for download.

Thanks, everyone.  Hope you're all enjoying the weekend.

-- 

http://www.parasane.net/
[EMAIL PROTECTED] || [EMAIL PROTECTED]
50% Off Hosting! http://www.pilotpig.net/specials.php

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



Re: [PHP] Text To Speech Update

2008-11-29 Thread Nathan Nobbe
On Sat, Nov 29, 2008 at 5:21 PM, Daniel P. Brown
<[EMAIL PROTECTED]>wrote:

>Any/All:
>
>For those of you who were asking about the PHP Text-To-Speech
> system I had running, it's back online now.  If you have a few free
> seconds, please take a look at http://www.pilotpig.net/txt2wav.php and
> let me know if it's working for sure in your browser and on your OS.
>
>With a bit more time being available to devote to non-paid
> projects, and hopefully getting a bit better still in the next week or
> so, I've had time to be able to work more with the PHP project and the
> PHP-VOX.  When I make enough improvements to the installation routines
> so that folks can easily do it on their own servers, I'll have the
> source available for download.
>
>Thanks, everyone.  Hope you're all enjoying the weekend.


kick-ass dan, i cant wait until the source is out there :D

-nathan


[PHP] Re: operators as callbacks?

2008-11-29 Thread Martin Zvarík

Joe napsal(a):

Is it possible to use a PHP operator as a callback? Suppose I want to add two
arrays elementwise, I want to be able to do something like this:
 array_map('+', $array1, $array2)
but this doesn't work as "+" is an operator and not a function.

I can use the BC library's math functions instead:
 array_map('bcadd', $array1, $array2)
but that is an ugly hack that might break if the library is not available.

I can create an anonymous function:
 array_map(create_function('$a, $b', 'return $a + $b;'), $array1, $array2)
but that seems really unnecessarily verbose.

Is there any simple clean way to do it? Thanks,




array_sum() ?

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



Re: [PHP] Text To Speech Update

2008-11-29 Thread Michael Kubler
Works ok for me on FFox v2 and v3 on my Windows XP machines, but when 
trying it on IE v6.0 the speech is played back REALLY fast. Like super 
chipmunk style.
I tried a duration of 5.5, but that mainly just made the pauses between 
the words longer, but was still very high pitched and fast.


Also, it's really annoying that the text that I just typed in to test 
disappears. I HATE it when websites forget what I just input, and when 
writing scripts I hate loosing or throwing away user input.


But still, good work on the VOX, too bad all text to speech synthesisers 
I've used sound like a computer. My Dad blurted out when I first went to 
your site 'Ohh I was playing with text to speech 30 years ago.'


I can see things like this being a big plus for usability.

Michael Kubler
*G*rey *P*hoenix *P*roductions 



Nathan Nobbe wrote:

On Sat, Nov 29, 2008 at 5:21 PM, Daniel P. Brown
<[EMAIL PROTECTED]>wrote:

  

   Any/All:

   For those of you who were asking about the PHP Text-To-Speech
system I had running, it's back online now.  If you have a few free
seconds, please take a look at http://www.pilotpig.net/txt2wav.php and
let me know if it's working for sure in your browser and on your OS.

   With a bit more time being available to devote to non-paid
projects, and hopefully getting a bit better still in the next week or
so, I've had time to be able to work more with the PHP project and the
PHP-VOX.  When I make enough improvements to the installation routines
so that folks can easily do it on their own servers, I'll have the
source available for download.

   Thanks, everyone.  Hope you're all enjoying the weekend.




kick-ass dan, i cant wait until the source is out there :D

-nathan