php-general Digest 9 Sep 2008 15:19:26 -0000 Issue 5672

2008-09-09 Thread php-general-digest-help

php-general Digest 9 Sep 2008 15:19:26 - Issue 5672

Topics (messages 279709 through 279732):

running a very long process from php
279709 by: Rene Veerman
279716 by: Nathan Rixham
279717 by: Per Jessen

Re: CSV output.
279710 by: Eric Gorr

Re: Using DOM textContent Property
279711 by: Mario Trojan

Re: Length of Exception text?
279712 by: Peter Ford
279718 by: Jochem Maas

Re: Interntet Explorer 8 beater 2
279713 by: Colin Guthrie

unsubscibe
279714 by: songtao zheng

Zend Platform
279715 by: Nathan Rixham

Regex help
279719 by: Jason Pruim
279720 by: Nathan Rixham
279722 by: Jason Pruim
279723 by: Nathan Rixham
279726 by: Per Jessen
279727 by: Boyd, Todd M.
279728 by: Jason Pruim

Re: PHP Equivalent of JavaScript whatever.toFixed(2)
279721 by: Jochem Maas
279724 by: Nathan Rixham

Re: PHP RSS to email
279725 by: Nathan Rixham
279731 by: Richard Heyes

SimpleXML strange behaviour.
279729 by: Mirco Soderi

Re: Problem of Connection Character Sets and Collations
279730 by: Eric Butera

Re: Shopping Carts/Checkout Software
279732 by: Charlene

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:
[EMAIL PROTECTED]


--
---BeginMessage---
Hi.

For my CMS, i need to do imports of photos and videos.
For uploading large files i have a Java FTP applet with automated resume, so
no problems there.

But: unzipping them and importing them might take a long time if it's a
large batch (1000s of pictures/videos).

Currently i split this up by importing only 1 item per php call from the
browser, to get around the hoster's limitation of 30s php timeout.
But since my hoster wont support video-importing (ffmpeg) anyhow, i have
decided to do some tasks from my home server over which i have total
control.

I'd also like to get rid of the requirement to have a browser open during
the import process.
Not only is it cumbersome for the user, if the internet connection fails
then the import is interrupted too.

I'm considering to (after ftp has completed) call a php script on my
homeserver that calls scripts on the hoster.
Scripts on the hoster would write status-info to a file, which is then read
from the originating browser.
And if a video-file is encountered, my homeserver downloads it, then ffmpegs
the meta-info and thumbnails, uploads those results to the hoster, calls a
'receiver' script on the hoster to put the thumbnails and meta-info in the
database..

Good idea?
Or do you have a better one? :)
---End Message---
---BeginMessage---

Rene Veerman wrote:

Hi.

For my CMS, i need to do imports of photos and videos.
For uploading large files i have a Java FTP applet with automated resume, so
no problems there.

But: unzipping them and importing them might take a long time if it's a
large batch (1000s of pictures/videos).

Currently i split this up by importing only 1 item per php call from the
browser, to get around the hoster's limitation of 30s php timeout.
But since my hoster wont support video-importing (ffmpeg) anyhow, i have
decided to do some tasks from my home server over which i have total
control.

I'd also like to get rid of the requirement to have a browser open during
the import process.
Not only is it cumbersome for the user, if the internet connection fails
then the import is interrupted too.

I'm considering to (after ftp has completed) call a php script on my
homeserver that calls scripts on the hoster.
Scripts on the hoster would write status-info to a file, which is then read
from the originating browser.
And if a video-file is encountered, my homeserver downloads it, then ffmpegs
the meta-info and thumbnails, uploads those results to the hoster, calls a
'receiver' script on the hoster to put the thumbnails and meta-info in the
database..

Good idea?
Or do you have a better one? :)

sounds like it's time to get your own dedicated server to be honest; in 
the time it takes you to do that semi-manual process I'm sure you could 
easily do a couple of jobs to fund the server if needs be;


Many Regards

Nathan
---End Message---
---BeginMessage---
Nathan Rixham wrote:

 sounds like it's time to get your own dedicated server to be honest;

Yeah, that was my first thought too. 

 in the time it takes you to do that semi-manual process I'm sure you
 could easily do a couple of jobs to fund the server if needs be;

They're not even very expensive - how about EUR50/month for a dual-core
AMD with 2Gb RAM, dual 400GB SATA disks and unlimited bandwidth. 


/Per Jessen, Zürich

---End Message---
---BeginMessage---

What variable contains the number?
How _exactly_ are you assigning the number to the variable?
How _exactly_ are you 

Re: [PHP] Using DOM textContent Property

2008-09-09 Thread Mario Trojan

Hi Nathan,

if you're already speaking of iterating children, i'd like to ask you 
another question:


Basically i was trying to do the same thing as Tim, when i experienced 
some difficulties iterating over DOMElement-childNodes with foreach and 
manipulating strings inside the nodes or even replacing 
DOMElement/DOMNode/DOMText with another node. Instead, i am currently 
iterating like this:


$child = $element-firstChild;
while ($child != null) {
$next_sibling = $child-nextSibling;

// Do something with child (manipulate, replace, ...)

// Continue iteration
$child = $next_sibling
}

Is this correct, or is there any better way?

Thank you in advance!
Mario


Nathan Nobbe schrieb:

bouncing back to the list so that others may benefit from our work...

On Fri, Sep 5, 2008 at 3:09 PM, Tim Gustafson [EMAIL PROTECTED] wrote:


Nathan,

Thanks for the suggestion, but it's still not working for me.  Here's my
code:

===
$HTML = new DOMDocument();
@$HTML-loadHTML($text);
$Elements = $HTML-getElementsByTagName(*);

for ($X = 0; $X  $Elements-length; $X++) {
  $Element =  $Elements-item($X);

 if ($Element-tagName == a) {
   # SNIP - Do something with A tags here
 } else if ($Element instanceof DOMText) {
   echo $Element-nodeValue; exit;
 }
}
===

This loop never executes the instanceof part of the code.  If I add:

 } else if ($Element instanceof DOMNode) {
   echo foo!; exit;
 }

Then it echos foo! as expected.  It just seems that none of the nodes in
the tree are DOMText nodes.  In fact, get_class($Element) returns
DOMElement for every node in the tree.



Tim,

i got your code working with minimal effort by pulling in two of the methods
i posted and making some revisions.  scope it out,
(this will produce the same output as my last post (the part after OUT:))

?php
$text = 'htmlbodyTestbrh2[EMAIL PROTECTED]a name=barstuff
inside the link/aFoo/h2pcare/ppyoyser/p/body/html';
$HTML = new DOMDocument();
$HTML-loadHTML($text);
$Elements = $HTML-getElementsByTagName(*);

for ($X = 0; $X  $Elements-length; $X++) {
 $Element =  $Elements-item($X);
 if($Element-hasChildNodes())
foreach($Element-childNodes as $curChild)
 if ($curChild-nodeName == a) {
   # SNIP - Do something with A tags here
 } else if ($curChild instanceof DOMText) {
  convertToLinkIfNecc($Element, $curChild);
 }
}
echo $HTML-saveXML() . PHP_EOL;


function convertToLinkIfNecc(DomElement $textContainer, DOMText $textNode) {
if( (strtolower($textContainer-nodeName) != 'a') 
(filter_var($textNode-nodeValue, FILTER_VALIDATE_EMAIL) !== false)
) {
convertMailtoToAnchor($textContainer, $textNode);
}
}
function convertMailtoToAnchor(DomElement $textContainer, DOMText $textNode)
{
$newNode = new DomElement('a', $textNode-nodeValue);
$textContainer-replaceChild($newNode, $textNode);
$newNode-setAttribute('href', mailto:{$textNode-nodeValue});
}
?

so, the problem is iterating over a tree structure will only show you whats
at the first level of the tree.  this is why you need to call
hasChildNodes(), and if that is true, call childNodes() and iterate across
that (and really, the code should be doing the same thing there as well,
calling hasChildNodes() and iterating over the results of childNodes()).
the code i have shown will work for the html i posted, however it wont work
on (x)html where these text nodes we're searching for are deeper in the tree
than the second level.  im sure you can cook up something that will recurse
down to the leafs :)
anyway, im going to try and hook up a RecursiveDOMDocumentIterator that
implements RecursiveIterator so that it has the convenient foreach support.
also, ill probly try to hook up a Filter varient of this class so that
situations like this are trivial.

stay tuned :D

-nathan



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



Re: [PHP] Length of Exception text?

2008-09-09 Thread Peter Ford

Jochem Maas wrote:

ANR Daemon schreef:

Greetings, Jochem Maas.
In reply to Your message dated Sunday, September 7, 2008, 20:56:37,

I've been working on some PEAR-based app last week and I ran into 
problem.

While I debugging app, my backtrace always trimmed at some point.
First time I though it was my mistake, and switched back to standard
Exception class.
But nothing changed.

If I print everything by hands, it's all full and good, but if I let 
PHP print



what do you mean by:



1. print by hand


Catch excetion and manually call getTraceAsString.


2. let PHP print


Do not catch exception, let PHP behave on it's own way.


are you printing to screen or to error_log (or syslog)? I believe 
error_log has a limit as to the
length of the string that will actually be logged ... I can't remember 
whether this

was php, apache or system related.


You want the php.ini setting:

log_errors_max_len

It defaults to 1024 characters: presumably that includes the preamble giving you 
1015 or so to play with.


If you set it to zero then you get unlimited log messages. 'course that might 
fill your logs up a bit...



--
Peter Ford  phone: 01580 89
Developer   fax:   01580 893399
Justcroft International Ltd., Staplehurst, Kent

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



[PHP] Re: Interntet Explorer 8 beater 2

2008-09-09 Thread Colin Guthrie

Ross McKay wrote:

Jochem Maas wrote:


how do you handle licensing/activation in these VMs?
I have parallels on my Mac and a 'proper' bootcamp install of WinXP
which I need for work ... and I'm not about to screw with that install
for the sake of testing another POS version of IE. 


You need a license for each instance of XP that you run. AFAIK, you only
need one license to multi-boot XP on a single computer (but you should
check that!) so I don't see why it would be any different for multiple
images run singly in a VM.


I somehow doubt it, but that would be nice. I certainly wouldn't have 
any moral qualms about it, but not sure if MS lawyers would see it lat 
way. That said, if you use a VM system that support snapshots, then you 
can have a faily convenient sacrificial install that you can play with 
this kind of thing. That said, it's still not useful. [Edit: I see you 
wrote pretty much the same thing at the end of your mail ;)]



NB: I'm talking XP here; I vaguely recall something about the Vista EULA
(spit!) specifically excluding installation in a non-MS VM, so you'd
need to check with your lawyers on that one... :/


I think I remember reading that they relaxed their VM licensing 
stance... Having never installed Vista and having no intention of 
touching it with a 10ft barge pole, I can't say I care!



--

Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited [http://www.tribalogic.net/]
Open Source:
  Mandriva Linux Contributor [http://www.mandriva.com/]
  PulseAudio Hacker [http://www.pulseaudio.org/]
  Trac Hacker [http://trac.edgewall.org/]


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



[PHP] unsubscibe

2008-09-09 Thread songtao zheng



[PHP] Zend Platform

2008-09-09 Thread Nathan Rixham

Morning All,

Short and sweet; does anybody have any practical experience; thoughts or 
case studies in regards to implementing the Zend Platform.


Many Regards

Nathan

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



[PHP] Re: running a very long process from php

2008-09-09 Thread Nathan Rixham

Rene Veerman wrote:

Hi.

For my CMS, i need to do imports of photos and videos.
For uploading large files i have a Java FTP applet with automated resume, so
no problems there.

But: unzipping them and importing them might take a long time if it's a
large batch (1000s of pictures/videos).

Currently i split this up by importing only 1 item per php call from the
browser, to get around the hoster's limitation of 30s php timeout.
But since my hoster wont support video-importing (ffmpeg) anyhow, i have
decided to do some tasks from my home server over which i have total
control.

I'd also like to get rid of the requirement to have a browser open during
the import process.
Not only is it cumbersome for the user, if the internet connection fails
then the import is interrupted too.

I'm considering to (after ftp has completed) call a php script on my
homeserver that calls scripts on the hoster.
Scripts on the hoster would write status-info to a file, which is then read
from the originating browser.
And if a video-file is encountered, my homeserver downloads it, then ffmpegs
the meta-info and thumbnails, uploads those results to the hoster, calls a
'receiver' script on the hoster to put the thumbnails and meta-info in the
database..

Good idea?
Or do you have a better one? :)

sounds like it's time to get your own dedicated server to be honest; in 
the time it takes you to do that semi-manual process I'm sure you could 
easily do a couple of jobs to fund the server if needs be;


Many Regards

Nathan

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



Re: [PHP] Re: running a very long process from php

2008-09-09 Thread Per Jessen
Nathan Rixham wrote:

 sounds like it's time to get your own dedicated server to be honest;

Yeah, that was my first thought too. 

 in the time it takes you to do that semi-manual process I'm sure you
 could easily do a couple of jobs to fund the server if needs be;

They're not even very expensive - how about EUR50/month for a dual-core
AMD with 2Gb RAM, dual 400GB SATA disks and unlimited bandwidth. 


/Per Jessen, Zürich


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



Re: [PHP] Length of Exception text?

2008-09-09 Thread Jochem Maas

Peter Ford schreef:

Jochem Maas wrote:

ANR Daemon schreef:

Greetings, Jochem Maas.
In reply to Your message dated Sunday, September 7, 2008, 20:56:37,

I've been working on some PEAR-based app last week and I ran into 
problem.

While I debugging app, my backtrace always trimmed at some point.
First time I though it was my mistake, and switched back to standard
Exception class.
But nothing changed.

If I print everything by hands, it's all full and good, but if I 
let PHP print



what do you mean by:



1. print by hand


Catch excetion and manually call getTraceAsString.


2. let PHP print


Do not catch exception, let PHP behave on it's own way.


are you printing to screen or to error_log (or syslog)? I believe 
error_log has a limit as to the
length of the string that will actually be logged ... I can't remember 
whether this

was php, apache or system related.


You want the php.ini setting:

log_errors_max_len

It defaults to 1024 characters: presumably that includes the preamble 
giving you 1015 or so to play with.


ah yes, good catch. I think I wrote the syslog wrapper because I didn't
have control over that setting at the time.



If you set it to zero then you get unlimited log messages. 'course that 
might fill your logs up a bit...


disk space is cheap :-) besides a decent setup should be rotating the logs,
so your pretty safe from filling up the disk (assuming your logs aren't dumped
to a seperate partition ... which is probably a good idea anyway ... to avoid
crashing the whole system ... although I vaguely recall that apache might
stop functioning if it can't write logs anymore ... again, not sure about that
at all.






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



[PHP] Regex help

2008-09-09 Thread Jason Pruim

Hey everyone,

Not completely specific to php but I know you guys know regex's   
better then I do! :)


I am attempting to match purl.schreurprinting.com/jasonpruim112 to  
purl.schreurprinting.com/p.php?purl=jasonpruim112


Here are my current matching patterns:

RewriteRule /(.*) /volumes/raider/webserver/ 
documents/dev/schreurprinting.com/p.php?purl=$

#   RewriteRule /(*.) /purl.schreurprinting.com/$1
#   RewriteRule /(mail.php?purl=*) / 
purl.schreurprinting.com/mail.php?purl=$1


Yes I am doing this for apache's mod_rewrite, but my question is much  
more specific to regex's at this point :)


Any ideas where I am going wrong? it seems like it should be fairly  
simple to do, but I don't know regex's at all :)



--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
11287 James St
Holland, MI 49424
www.raoset.com
[EMAIL PROTECTED]





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



[PHP] Re: Regex help

2008-09-09 Thread Nathan Rixham

Jason Pruim wrote:

Hey everyone,

Not completely specific to php but I know you guys know regex's  better 
then I do! :)


I am attempting to match purl.schreurprinting.com/jasonpruim112 to 
purl.schreurprinting.com/p.php?purl=jasonpruim112


Here are my current matching patterns:

RewriteRule /(.*) 
/volumes/raider/webserver/documents/dev/schreurprinting.com/p.php?purl=$

#   RewriteRule /(*.) /purl.schreurprinting.com/$1
#   RewriteRule /(mail.php?purl=*) 
/purl.schreurprinting.com/mail.php?purl=$1


Yes I am doing this for apache's mod_rewrite, but my question is much 
more specific to regex's at this point :)


Any ideas where I am going wrong? it seems like it should be fairly 
simple to do, but I don't know regex's at all :)



--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
11287 James St
Holland, MI 49424
www.raoset.com
[EMAIL PROTECTED]



RewriteRule ^jasonpruim112$ /p.php?purl=jasonpruim112 [L]

prehaps

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



Re: [PHP] Re: PHP Equivalent of JavaScript whatever.toFixed(2)

2008-09-09 Thread Jochem Maas

Ross McKay schreef:

Arnie Shore wrote:

Folks, I need to take a given float value to, say, two decimals, as per
subject JS.  I've RTFM, but to no avail.


On Mon, 08 Sep 2008 22:03:54 +0200, Sjoerd wrote:

$str = sprintf(%01.2f, $number);


Skinning cat, method two:

$str = number_format($number, 2);


watch out with number_format() it will format according to the current locale
unless you specify the decimal and thousands seperator char explicitly ... e.g.

english: 1,000.00
dutch:   1.000,00




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



Re: [PHP] Re: Regex help

2008-09-09 Thread Jason Pruim


On Sep 9, 2008, at 4:38 PM, Nathan Rixham wrote:


Jason Pruim wrote:

Hey everyone,
Not completely specific to php but I know you guys know regex's   
better then I do! :)
I am attempting to match purl.schreurprinting.com/jasonpruim112 to  
purl.schreurprinting.com/p.php?purl=jasonpruim112

Here are my current matching patterns:
   RewriteRule /(.*) /volumes/raider/webserver/ 
documents/dev/schreurprinting.com/p.php?purl=$

#   RewriteRule /(*.) /purl.schreurprinting.com/$1
#   RewriteRule /(mail.php?purl=*) / 
purl.schreurprinting.com/mail.php?purl=$1
Yes I am doing this for apache's mod_rewrite, but my question is  
much more specific to regex's at this point :)
Any ideas where I am going wrong? it seems like it should be fairly  
simple to do, but I don't know regex's at all :)

--
Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
11287 James St
Holland, MI 49424
www.raoset.com
[EMAIL PROTECTED]


RewriteRule ^jasonpruim112$ /p.php?purl=jasonpruim112 [L]


Just tried it, and it pops up with a 404... I'll keep looking.

One other thing that I should probably add is the fact that the  
^jasonpruim112$ could have hundreds of counterparts ^bobsmith112$  
^jerrybob112$ etc... etc...


Thanks for looking though!



--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
11287 James St
Holland, MI 49424
www.raoset.com
[EMAIL PROTECTED]





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



Re: [PHP] Re: Regex help

2008-09-09 Thread Nathan Rixham

Jason Pruim wrote:


On Sep 9, 2008, at 4:38 PM, Nathan Rixham wrote:


Jason Pruim wrote:

Hey everyone,
Not completely specific to php but I know you guys know regex's  
better then I do! :)
I am attempting to match purl.schreurprinting.com/jasonpruim112 to 
purl.schreurprinting.com/p.php?purl=jasonpruim112

Here are my current matching patterns:
   RewriteRule /(.*) 
/volumes/raider/webserver/documents/dev/schreurprinting.com/p.php?purl=$ 


#   RewriteRule /(*.) /purl.schreurprinting.com/$1
#   RewriteRule /(mail.php?purl=*) 
/purl.schreurprinting.com/mail.php?purl=$1
Yes I am doing this for apache's mod_rewrite, but my question is much 
more specific to regex's at this point :)
Any ideas where I am going wrong? it seems like it should be fairly 
simple to do, but I don't know regex's at all :)

--
Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
11287 James St
Holland, MI 49424
www.raoset.com
[EMAIL PROTECTED]


RewriteRule ^jasonpruim112$ /p.php?purl=jasonpruim112 [L]


Just tried it, and it pops up with a 404... I'll keep looking.

One other thing that I should probably add is the fact that the 
^jasonpruim112$ could have hundreds of counterparts ^bobsmith112$ 
^jerrybob112$ etc... etc...


Thanks for looking though!



--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
11287 James St
Holland, MI 49424
www.raoset.com
[EMAIL PROTECTED]




here's a typical rule; probably best to modify what works and go from 
there :)


RewriteRule ^directory/(.*)$ /newdirectory/$1 [L]

the other alternative is to let php handle it..
this is basicaly if request isn't a file or a directory route to a php 
handler [my prefered way]:


RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /notfound_handler.php [L]

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



Re: [PHP] Re: PHP Equivalent of JavaScript whatever.toFixed(2)

2008-09-09 Thread Nathan Rixham

Jochem Maas wrote:

Ross McKay schreef:

Arnie Shore wrote:

Folks, I need to take a given float value to, say, two decimals, as per
subject JS.  I've RTFM, but to no avail.


On Mon, 08 Sep 2008 22:03:54 +0200, Sjoerd wrote:

$str = sprintf(%01.2f, $number);


Skinning cat, method two:

$str = number_format($number, 2);


watch out with number_format() it will format according to the current 
locale
unless you specify the decimal and thousands seperator char explicitly 
... e.g.


english: 1,000.00
dutch:   1.000,00




maybe I'm reading this wrong but
http://uk2.php.net/manual/en/function.round.php

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



Re: [PHP] PHP RSS to email

2008-09-09 Thread Nathan Rixham

Jason Pruim wrote:


On Sep 8, 2008, at 7:59 AM, Richard Heyes wrote:

Correct me if I'm wrong, but couldn't you use grab and parse the rss 
feeds
you want, store the titles in a database, with a column for 
identifying if
the e-mail has been sent? So every hour it checks your feeds, grabs 
the new

ones, checks to see if emailSent=1 if not pass it to
send_notification($email, $feedname, $feedtitle).


Of course, (if ever I've had a doh moment I think now would be it).
Though I'll probably use a tmp file.


I've been working almost exclusively with databases lately so all my 
solutions are including databases :)




--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
11287 James St
Holland, MI 49424
www.raoset.com
[EMAIL PROTECTED]




quick recommendation rss_php from rssphp.net is often faster than magpie 
and php5 - simplepie is also good; the old loop through and send what's 
new seems the way though Richard.


ps: may be worth ntoing this'd make a great open source site or even 
subscription service; I'd sign up for it!


Many Regards  Hope your well;

Nathan

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



Re: [PHP] Re: Regex help

2008-09-09 Thread Per Jessen
Jason Pruim wrote:

 
 On Sep 9, 2008, at 4:38 PM, Nathan Rixham wrote:
 
 Jason Pruim wrote:
 Hey everyone,
 Not completely specific to php but I know you guys know regex's
 better then I do! :)
 I am attempting to match purl.schreurprinting.com/jasonpruim112 to
 purl.schreurprinting.com/p.php?purl=jasonpruim112
 Here are my current matching patterns:
RewriteRule /(.*) /volumes/raider/webserver/
 documents/dev/schreurprinting.com/p.php?purl=$
 #   RewriteRule /(*.) /purl.schreurprinting.com/$1
 #   RewriteRule /(mail.php?purl=*) /
 purl.schreurprinting.com/mail.php?purl=$1
 Yes I am doing this for apache's mod_rewrite, but my question is
 much more specific to regex's at this point :)
 Any ideas where I am going wrong? it seems like it should be fairly
 simple to do, but I don't know regex's at all :)
 --
 Jason Pruim
 Raoset Inc.
 Technology Manager
 MQC Specialist
 11287 James St
 Holland, MI 49424
 www.raoset.com
 [EMAIL PROTECTED]

 RewriteRule ^jasonpruim112$ /p.php?purl=jasonpruim112 [L]
 
 Just tried it, and it pops up with a 404... I'll keep looking.
 
 One other thing that I should probably add is the fact that the
 ^jasonpruim112$ could have hundreds of counterparts ^bobsmith112$
 ^jerrybob112$ etc... etc...
 

Maybe this:

RewriteCond %{REQUEST_URI} !^/p\.php
RewriteRule ^/(.+)$ /p.php?purl=$1


/Per Jessen, Zürich


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



RE: [PHP] Regex help

2008-09-09 Thread Boyd, Todd M.
 -Original Message-
 From: Jason Pruim [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, September 09, 2008 7:30 AM
 To: PHP-General List
 Subject: [PHP] Regex help
 
 Hey everyone,
 
 Not completely specific to php but I know you guys know regex's
 better then I do! :)
 
 I am attempting to match purl.schreurprinting.com/jasonpruim112 to
 purl.schreurprinting.com/p.php?purl=jasonpruim112
 
 Here are my current matching patterns:
 
  RewriteRule /(.*) /volumes/raider/webserver/
 documents/dev/schreurprinting.com/p.php?purl=$
 #   RewriteRule /(*.) /purl.schreurprinting.com/$1
 #   RewriteRule /(mail.php?purl=*) /
 purl.schreurprinting.com/mail.php?purl=$1
 
 Yes I am doing this for apache's mod_rewrite, but my question is much
 more specific to regex's at this point :)
 
 Any ideas where I am going wrong? it seems like it should be fairly
 simple to do, but I don't know regex's at all :)

http://www.regular-expressions.info ... that's how I learned. :)
Anyway... your match might be something like:

^/([^/\.]+)/?$

And the rewrite...

/p.php?purl=$1

To break it down, the match is looking for The beginning of the line,
followed by a forward slash, followed by (begin capture group) 1 or more
characters that are not a forward slash or a period (end capture group)
followed by an optional forward slash, followed by the end of the line.

The rewrite is fairly straightforward.

I went 100% generic with the match due to your following e-mail that
stated jasonpruim112 could be any username. If 112 is necessary for
the match, it would be more like:

^/([^/\.]+112)/?$

Hope this helps,


Todd Boyd
Web Programmer




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



[PHP] SimpleXML strange behaviour.

2008-09-09 Thread Mirco Soderi
Do you know any reason why the following code does work


$xmlOperazioni = simplexml_load_file($xmlFilename);
foreach($xmlOperazioni-operazione as $operazione) {
   if($operazione['nome'] == $operazioneRichiesta) {
  require($operazione['php']);
  break;
   }
}

but the following does not

$xmlOperazioni = 
simplexml_load_file($impostazioni['root']['configurazione']['generale']['xml_operazioni']);
foreach($xmlOperazioni-operazione as $operazione) {
   if($operazione-nome == $operazioneRichiesta) {
  require($operazione-php);
  break;
   }
}

that is I MUST access childrens of the element operazione as if it was an 
array, while (in the same page) the following code does work

$xmlViste = 
simplexml_load_file($impostazioni['root']['configurazione']['generale']['xml_composizione_viste']);
foreach($xmlViste-vista as $vista) {
if($vista-nome == $nomeVistaDaMostrare) {
   $smarty-assign(intestazione,componenti/.$vista-intestazione);
   $smarty-assign(menu,componenti/.$vista-menu);
   $smarty-assign(contenuto, componenti/.$vista-contenuto);
   $smarty-assign(pie_di_pagina, componenti/.$vista-pie_di_pagina);
   break;
}
}

but the following does not

$xmlViste = 
simplexml_load_file($impostazioni['root']['configurazione']['generale']['xml_composizione_viste']);
foreach($xmlViste-vista as $vista) {
if($vista['nome'] == $nomeVistaDaMostrare) {
   $smarty-assign(intestazione,componenti/.$vista['intestazione']);
   $smarty-assign(menu,componenti/.$vista['menu']);
   $smarty-assign(contenuto, componenti/.$vista['contenuto']);
   $smarty-assign(pie_di_pagina, componenti/.$vista['pie_di_pagina']);
   break;
}
}

that is this time I MUST access the childrens of the element operazione as if 
it was an object?

Re: [PHP] Problem of Connection Character Sets and Collations

2008-09-09 Thread Eric Butera
On Sat, Sep 6, 2008 at 10:41 AM,  [EMAIL PROTECTED] wrote:
 php :
 Which command line is right ?
 1, mysql_query(SET NAMES utf8);
 2, mysql_query(SET NAMES utf-8);

 Many thank for your help !

 Edward.

On the php side look at this:

http://us3.php.net/manual/en/function.mysql-set-charset.php

That's recommended over set names.

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



Re: [PHP] PHP RSS to email

2008-09-09 Thread Richard Heyes
 ps: may be worth ntoing this'd make a great open source site or even
 subscription service; I'd sign up for it!

I've already knocked something up. It's attached if you want it.

-- 
Richard Heyes

HTML5 Graphing for IE7, FF, Chrome, Opera and Safari:
http://www.phpguru.org/RGraph

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

Re: [PHP] Re: Regex help

2008-09-09 Thread Jason Pruim


On Sep 9, 2008, at 5:02 PM, Nathan Rixham wrote:


Jason Pruim wrote:

On Sep 9, 2008, at 4:38 PM, Nathan Rixham wrote:

Jason Pruim wrote:

Hey everyone,
Not completely specific to php but I know you guys know regex's   
better then I do! :)
I am attempting to match purl.schreurprinting.com/jasonpruim112  
to purl.schreurprinting.com/p.php?purl=jasonpruim112

Here are my current matching patterns:
  RewriteRule /(.*) /volumes/raider/webserver/ 
documents/dev/schreurprinting.com/p.php?purl=$

#   RewriteRule /(*.) /purl.schreurprinting.com/$1
#   RewriteRule /(mail.php?purl=*) / 
purl.schreurprinting.com/mail.php?purl=$1
Yes I am doing this for apache's mod_rewrite, but my question is  
much more specific to regex's at this point :)
Any ideas where I am going wrong? it seems like it should be  
fairly simple to do, but I don't know regex's at all :)

--
Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
11287 James St
Holland, MI 49424
www.raoset.com
[EMAIL PROTECTED]


RewriteRule ^jasonpruim112$ /p.php?purl=jasonpruim112 [L]

Just tried it, and it pops up with a 404... I'll keep looking.
One other thing that I should probably add is the fact that the  
^jasonpruim112$ could have hundreds of counterparts  
^bobsmith112$ ^jerrybob112$ etc... etc...

Thanks for looking though!
--
Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
11287 James St
Holland, MI 49424
www.raoset.com
[EMAIL PROTECTED]

here's a typical rule; probably best to modify what works and go  
from there :)


RewriteRule ^directory/(.*)$ /newdirectory/$1 [L]

the other alternative is to let php handle it..
this is basicaly if request isn't a file or a directory route to a  
php handler [my prefered way]:


RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /notfound_handler.php [L]


Interesting idea... I hadn't thought about that... Then I could just  
use a regex in php and grab everything after the domain name and pass  
it to my database to search and find the appropriate info to pull out...


I'll have to do some searching :)



--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
11287 James St
Holland, MI 49424
www.raoset.com
[EMAIL PROTECTED]





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



Re: [PHP] Shopping Carts/Checkout Software

2008-09-09 Thread Charlene

Micah Gersten wrote:

ZenCart Reasons:
PHP-based
Open Source
lots if plugins
Take a look at this:
http://en.wikipedia.org/wiki/Zen_Cart

Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com



Charlene wrote:
  

Micah Gersten wrote:


Try Zencart.

Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com  
  
It doesn't look like zencart includes a checkout system.  I really need 
the complete system.


Otherwise, what I see at their site looks interesting.  In searching for 
the website for zencart, I discovered a commercial product that looks 
like it would work and it uses XML to import product information into 
its system.  I'm trying to figure out if zencart would use this method also.


Charlene

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



[PHP] Re: Zend Platform

2008-09-09 Thread Colin Guthrie

Nathan Rixham wrote:
Short and sweet; does anybody have any practical experience; thoughts or 
case studies in regards to implementing the Zend Platform.


I like it.

I'm slowly converting across my companies applications to it, but it's a 
long process (mainly due to clients getting in the way asking for pesky 
features rather than letting me spend a solid amount of time on it!).


But overall, it is a great resource and allows for a lot of flexibility 
but while making you think about good practice. In a corporate 
environment these kind of design principles and a solid unit test 
structure are important, and the ZF helps ensure that this is designed in.


There are other, more lightweight frameworks but there is a wealth of 
features in ZF and the community is very active and helpful.


Other than that, I'd say whatever floats your boat! Try out a few things 
and see what you like best!


Col

--

Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited [http://www.tribalogic.net/]
Open Source:
  Mandriva Linux Contributor [http://www.mandriva.com/]
  PulseAudio Hacker [http://www.pulseaudio.org/]
  Trac Hacker [http://trac.edgewall.org/]


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



Re: [PHP] Re: Zend Platform

2008-09-09 Thread Jochem Maas

Colin Guthrie schreef:

Nathan Rixham wrote:
Short and sweet; does anybody have any practical experience; thoughts 
or case studies in regards to implementing the Zend Platform.


I like it.

I'm slowly converting across my companies applications to it, but it's a 
long process (mainly due to clients getting in the way asking for pesky 
features rather than letting me spend a solid amount of time on it!).


But overall, it is a great resource and allows for a lot of flexibility 
but while making you think about good practice. In a corporate 
environment these kind of design principles and a solid unit test 
structure are important, and the ZF helps ensure that this is designed in.


There are other, more lightweight frameworks but there is a wealth of 
features in ZF and the community is very active and helpful.




Zend Framework and Zend Platform are 2 different animals

Other than that, I'd say whatever floats your boat! Try out a few things 
and see what you like best!


Col




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



Re: [PHP] Re: Regex help

2008-09-09 Thread Jochem Maas

Jason Pruim schreef:


On Sep 9, 2008, at 5:02 PM, Nathan Rixham wrote:


Jason Pruim wrote:

On Sep 9, 2008, at 4:38 PM, Nathan Rixham wrote:

Jason Pruim wrote:

Hey everyone,
Not completely specific to php but I know you guys know regex's  
better then I do! :)
I am attempting to match purl.schreurprinting.com/jasonpruim112 to 
purl.schreurprinting.com/p.php?purl=jasonpruim112

Here are my current matching patterns:
  RewriteRule /(.*) 
/volumes/raider/webserver/documents/dev/schreurprinting.com/p.php?purl=$ 


#   RewriteRule /(*.) /purl.schreurprinting.com/$1
#   RewriteRule /(mail.php?purl=*) 
/purl.schreurprinting.com/mail.php?purl=$1
Yes I am doing this for apache's mod_rewrite, but my question is 
much more specific to regex's at this point :)
Any ideas where I am going wrong? it seems like it should be fairly 
simple to do, but I don't know regex's at all :)

--
Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
11287 James St
Holland, MI 49424
www.raoset.com
[EMAIL PROTECTED]


RewriteRule ^jasonpruim112$ /p.php?purl=jasonpruim112 [L]

Just tried it, and it pops up with a 404... I'll keep looking.
One other thing that I should probably add is the fact that the 
^jasonpruim112$ could have hundreds of counterparts ^bobsmith112$ 
^jerrybob112$ etc... etc...

Thanks for looking though!
--
Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
11287 James St
Holland, MI 49424
www.raoset.com
[EMAIL PROTECTED]

here's a typical rule; probably best to modify what works and go from 
there :)


RewriteRule ^directory/(.*)$ /newdirectory/$1 [L]

the other alternative is to let php handle it..
this is basicaly if request isn't a file or a directory route to a php 
handler [my prefered way]:


RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /notfound_handler.php [L]


RewriteRule . /notfound_handler.php [L,QSA]

the QSA tells apache to to automatically append any query string, saves
the hassle of having to deal with it in the regexp (assuming you might need it)

also beware that external redirects will cause POSTs to become GETs so that
the script/code in question never recieves the POST.



Interesting idea... I hadn't thought about that... Then I could just use 
a regex in php and grab everything after the domain name and pass it to 
my database to search and find the appropriate info to pull out...


your probably wanting the info in $_SERVER['REQUEST_URI'] ... which is
the complete uri before it was rewritten.

also check this func out, will probably spare you the regexp completely:

http://php.net/manual/en/function.parse-url.php



I'll have to do some searching :)


always ;-)





--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
11287 James St
Holland, MI 49424
www.raoset.com
[EMAIL PROTECTED]








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



Re: [PHP] Re: PHP Equivalent of JavaScript whatever.toFixed(2)

2008-09-09 Thread Jochem Maas

Nathan Rixham schreef:

Jochem Maas wrote:

Ross McKay schreef:

Arnie Shore wrote:
Folks, I need to take a given float value to, say, two decimals, as 
per

subject JS.  I've RTFM, but to no avail.


On Mon, 08 Sep 2008 22:03:54 +0200, Sjoerd wrote:

$str = sprintf(%01.2f, $number);


Skinning cat, method two:

$str = number_format($number, 2);


watch out with number_format() it will format according to the current 
locale
unless you specify the decimal and thousands seperator char explicitly 
... e.g.


english: 1,000.00
dutch:   1.000,00




maybe I'm reading this wrong but
http://uk2.php.net/manual/en/function.round.php



what about round(), what's the problem?


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



Re: [PHP] Shopping Carts/Checkout Software

2008-09-09 Thread Lester Caine

Charlene wrote:
It doesn't look like zencart includes a checkout system.  I really need 
the complete system.


You will find you need to select the payment packages you want available. It 
certainly does the complete process, including weight based shipping.


Otherwise, what I see at their site looks interesting.  In searching for 
the website for zencart, I discovered a commercial product that looks 
like it would work and it uses XML to import product information into 
its system.  I'm trying to figure out if zencart would use this method 
also.


We ported 'zen_cart' into bitweaver as bit_commerce and have converted the 
code, but the core structure is 'comprehensive', so you will find 
'easypopulate' to get raw CSV data in. Expanding it to handle XML is probably 
a lot of work. Creating the raw data for 'easypopulate' does eliminate a few 
stages however and is worth the effort, so IF you have XML data then dump it 
to a spreadsheet :)


--
Lester Caine - G8HFL
-
Contact - http://lsces.co.uk/lsces/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk//
Firebird - http://www.firebirdsql.org/index.php

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



[PHP] Re: Zend Platform

2008-09-09 Thread Colin Guthrie

Jochem Maas wrote:

Zend Framework and Zend Platform are 2 different animals


Egads.. totally didn't read that mail properly!

Too much trawling on the ZF mailing lists today methinks!

Col

--

Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited [http://www.tribalogic.net/]
Open Source:
  Mandriva Linux Contributor [http://www.mandriva.com/]
  PulseAudio Hacker [http://www.pulseaudio.org/]
  Trac Hacker [http://trac.edgewall.org/]


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



Re: [PHP] Shopping Carts/Checkout Software

2008-09-09 Thread Manuel Barros Reyes
On Mon, Sep 8, 2008 at 12:09 PM, Charlene [EMAIL PROTECTED] wrote:

 The company I work for is going to be creating the catalog to a small store
 (~100 items).  The customized catalog will include the front end that the
 shoppers will use as well as the back end data entry.

 We need shopping cart/checkout software, preferably PHP (since that is what
 we will be using for our site) and uses MySQL as the database.  We want to
 be able to hook our customized software into the software package (ie we're
 not using their data entry into the catalog).  We don't want to be limited
 to just one shopping cart/checkout software package and this may become a
 product we use for more sites.

 We have been forced to use a few products since the clients bought the
 package themselves but I'm not real happy with any of them.


I would like to recommend OpenCart (http://www.opencart.com/) it is nicely
designed, it is small and simple, it is modeled after MVC pattern. It lacks
documentation but the source code is very understandable and there are
forums on their site where one can ask for help if in trouble.

I gave it a try after giving up trying to customize Zencart which is very
complicated in my opinion, although it has the benefit of a larger user base
and documentation.

Here you can find an example of a site I did with opencart:

http://www.carolinalightgroup.com

M.


Re: [PHP] Re: Regex help

2008-09-09 Thread Jason Pruim


On Sep 9, 2008, at 12:18 PM, Jochem Maas wrote:


Jason Pruim schreef:

On Sep 9, 2008, at 5:02 PM, Nathan Rixham wrote:

Jason Pruim wrote:

On Sep 9, 2008, at 4:38 PM, Nathan Rixham wrote:

Jason Pruim wrote:

Hey everyone,
Not completely specific to php but I know you guys know  
regex's  better then I do! :)
I am attempting to match purl.schreurprinting.com/jasonpruim112  
to purl.schreurprinting.com/p.php?purl=jasonpruim112

Here are my current matching patterns:
 RewriteRule /(.*) /volumes/raider/webserver/ 
documents/dev/schreurprinting.com/p.php?purl=$

#   RewriteRule /(*.) /purl.schreurprinting.com/$1
#   RewriteRule /(mail.php?purl=*) / 
purl.schreurprinting.com/mail.php?purl=$1
Yes I am doing this for apache's mod_rewrite, but my question  
is much more specific to regex's at this point :)
Any ideas where I am going wrong? it seems like it should be  
fairly simple to do, but I don't know regex's at all :)

--
Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
11287 James St
Holland, MI 49424
www.raoset.com
[EMAIL PROTECTED]


RewriteRule ^jasonpruim112$ /p.php?purl=jasonpruim112 [L]

Just tried it, and it pops up with a 404... I'll keep looking.
One other thing that I should probably add is the fact that the  
^jasonpruim112$ could have hundreds of counterparts  
^bobsmith112$ ^jerrybob112$ etc... etc...

Thanks for looking though!
--
Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
11287 James St
Holland, MI 49424
www.raoset.com
[EMAIL PROTECTED]

here's a typical rule; probably best to modify what works and go  
from there :)


RewriteRule ^directory/(.*)$ /newdirectory/$1 [L]

the other alternative is to let php handle it..
this is basicaly if request isn't a file or a directory route to a  
php handler [my prefered way]:


RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /notfound_handler.php [L]


RewriteRule . /notfound_handler.php [L,QSA]

the QSA tells apache to to automatically append any query string,  
saves
the hassle of having to deal with it in the regexp (assuming you  
might need it)


also beware that external redirects will cause POSTs to become GETs  
so that

the script/code in question never recieves the POST.


Interesting... that may explain a problem I am having with some other  
local links in that directory...





Interesting idea... I hadn't thought about that... Then I could  
just use a regex in php and grab everything after the domain name  
and pass it to my database to search and find the appropriate info  
to pull out...


your probably wanting the info in $_SERVER['REQUEST_URI'] ... which is
the complete uri before it was rewritten.


That's actually what I started using, then I just explode that to get  
my query string to use in the database lookup.





also check this func out, will probably spare you the regexp  
completely:


http://php.net/manual/en/function.parse-url.php


Ohhh... That sounds promising... I'll have to take a look at it later.




I'll have to do some searching :)


always ;-)


The problem with the internet is there is so much out there... Trying  
to weed the crap from the food can be a long digestive process which  
ends up with MORE crap coming out... This list... It's like pepto  
bismo for my programming :P



--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
11287 James St
Holland, MI 49424
www.raoset.com
[EMAIL PROTECTED]





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



[PHP] Re: SimpleXML strange behaviour.

2008-09-09 Thread Carlos Medina

Mirco Soderi schrieb:

Do you know any reason why the following code does work


$xmlOperazioni = simplexml_load_file($xmlFilename);
foreach($xmlOperazioni-operazione as $operazione) {
   if($operazione['nome'] == $operazioneRichiesta) {
  require($operazione['php']);
  break;
   }
}

but the following does not

$xmlOperazioni = 
simplexml_load_file($impostazioni['root']['configurazione']['generale']['xml_operazioni']);
foreach($xmlOperazioni-operazione as $operazione) {
   if($operazione-nome == $operazioneRichiesta) {
  require($operazione-php);
  break;
   }
}

that is I MUST access childrens of the element operazione as if it was an 
array, while (in the same page) the following code does work

$xmlViste = 
simplexml_load_file($impostazioni['root']['configurazione']['generale']['xml_composizione_viste']);
foreach($xmlViste-vista as $vista) {
if($vista-nome == $nomeVistaDaMostrare) {
   $smarty-assign(intestazione,componenti/.$vista-intestazione);
   $smarty-assign(menu,componenti/.$vista-menu);
   $smarty-assign(contenuto, componenti/.$vista-contenuto);
   $smarty-assign(pie_di_pagina, componenti/.$vista-pie_di_pagina);
   break;
}
}

but the following does not

$xmlViste = 
simplexml_load_file($impostazioni['root']['configurazione']['generale']['xml_composizione_viste']);
foreach($xmlViste-vista as $vista) {
if($vista['nome'] == $nomeVistaDaMostrare) {
   $smarty-assign(intestazione,componenti/.$vista['intestazione']);
   $smarty-assign(menu,componenti/.$vista['menu']);
   $smarty-assign(contenuto, componenti/.$vista['contenuto']);
   $smarty-assign(pie_di_pagina, componenti/.$vista['pie_di_pagina']);
   break;
}
}

that is this time I MUST access the childrens of the element operazione as if 
it was an object?

Hi,
it is too dificult to say without the XML file youre try to load.


Regards

Carlos

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



Re: [PHP] Zend Platform

2008-09-09 Thread Stut

On 9 Sep 2008, at 18:52, Nathan Rixham wrote:
Short and sweet; does anybody have any practical experience;  
thoughts or case studies in regards to implementing the Zend Platform.


Yeah, I used it in my previous job a coupla years ago. It looks great,  
the marketing hype is well executed but as usual the reality is far  
from the promise. There are some aspects I really like, but mainly in  
concept. What you actually get is expensive extra bloat to install on  
your servers.


* The bytecode cache can be replaced by one of several free solutions  
out there.


* The job queue is a great idea but the implementation is problematic  
at best. Avoid this if you can.


* The centralised logging and the alerting features are nice - this is  
probably the only but I really found useful.


* The clustering features I did not use so didn't look at too closely,  
but it didn't appear to offer anything that couldn't be replicated  
pretty easily with open source tools.


At the end of the day what you're buying is marketing hype, and there  
are people out there who fall for it hook line and sinker. My advice  
is that unless you have someone insisting you use ZP, don't. And even  
if you do I urge you to look at what you actually need from it and  
evaluate alternatives before making a commitment. Have you ever heard  
about Facebook, Yahoo or any other big player using it?


Don't get me wrong, I think Zend is a great company, but I just don't  
see the value in ZP. For the price of the license you could add  
another server which will give you far better ROI and higher capacity  
then ZP could ever achieve.


And don't get me started on what they've done to Zend Studio. I've  
switched to Aptana - same platform, but cheaper and a lot more stable.  
Shame!


-Stut

--
http://stut.net/

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



Re: [PHP] SimpleXML strange behaviour.

2008-09-09 Thread Nathan Nobbe
2008/9/9 Mirco Soderi [EMAIL PROTECTED]

 Do you know any reason why the following code does work


 $xmlOperazioni = simplexml_load_file($xmlFilename);
 foreach($xmlOperazioni-operazione as $operazione) {
   if($operazione['nome'] == $operazioneRichiesta) {
  require($operazione['php']);
  break;
   }
 }

 but the following does not

 $xmlOperazioni =
 simplexml_load_file($impostazioni['root']['configurazione']['generale']['xml_operazioni']);
 foreach($xmlOperazioni-operazione as $operazione) {
   if($operazione-nome == $operazioneRichiesta) {
  require($operazione-php);
  break;
   }
 }


well im guessing thats because youre using the same file and different
accessors, what i mean is that if
$xmlFilename, and
$impostazioni['root']['configurazione']['generale']['xml_operazioni'] refer
to the same xml from above, then obviously this wont work..

this is looking for an attribute, 'nome', $operazione['nome'];
this is looking for a child element, 'nome', $operazione-nome

that is I MUST access childrens of the element operazione as if it was an
 array, while (in the same page) the following code does work

 $xmlViste =
 simplexml_load_file($impostazioni['root']['configurazione']['generale']['xml_composizione_viste']);
 foreach($xmlViste-vista as $vista) {
if($vista-nome == $nomeVistaDaMostrare) {
   $smarty-assign(intestazione,componenti/.$vista-intestazione);
   $smarty-assign(menu,componenti/.$vista-menu);
   $smarty-assign(contenuto, componenti/.$vista-contenuto);
   $smarty-assign(pie_di_pagina,
 componenti/.$vista-pie_di_pagina);
   break;
}
 }

 but the following does not

 $xmlViste =
 simplexml_load_file($impostazioni['root']['configurazione']['generale']['xml_composizione_viste']);
 foreach($xmlViste-vista as $vista) {
if($vista['nome'] == $nomeVistaDaMostrare) {
   $smarty-assign(intestazione,componenti/.$vista['intestazione']);
   $smarty-assign(menu,componenti/.$vista['menu']);
   $smarty-assign(contenuto, componenti/.$vista['contenuto']);
   $smarty-assign(pie_di_pagina,
 componenti/.$vista['pie_di_pagina']);
   break;
}
 }


again, this syntax denotes a child element,
$vista-nome
this syntax denotes an attribute
$vista['nome']

that is this time I MUST access the childrens of the element operazione as
 if it was an object?


i recommend a review of the example page on simple xml, but yes children are
access via the - notation, you can also use the children() method if its
more convenient for you.

http://us2.php.net/manual/en/simplexml.examples.php

-nathan


Re: [PHP] Using DOM textContent Property

2008-09-09 Thread Nathan Nobbe
On Tue, Sep 9, 2008 at 12:37 AM, Mario Trojan [EMAIL PROTECTED] wrote:

 Hi Nathan,

 if you're already speaking of iterating children, i'd like to ask you
 another question:

 Basically i was trying to do the same thing as Tim, when i experienced some
 difficulties iterating over DOMElement-childNodes with foreach and
 manipulating strings inside the nodes or even replacing
 DOMElement/DOMNode/DOMText with another node. Instead, i am currently
 iterating like this:

 $child = $element-firstChild;
 while ($child != null) {
$next_sibling = $child-nextSibling;

// Do something with child (manipulate, replace, ...)

// Continue iteration
$child = $next_sibling
 }

 Is this correct, or is there any better way?


i found this the other day on the DOMNodeList page on php.net,

essentially foreach will implicitly do what you are doing under the hood,
actually, it will also recurse into the children, whereas in this example
youve shown, youre only iterating over 1 sub-level of the tree (horizontally
across elements at the same level).  sometimes it makes sense to drive the
iteration yourself as you have shown, but i think the answer to your
question is that you must use a reference to the parent to perform
manipulations to the dom during iteration, see below (hope it helps :D),

-nathan

*a dot buffa at sns dot it*
29-May-2008 04:28
http://us2.php.net/manual/en/class.domnodelist.php#83513 I agree
with drichter at muvicom dot de.

For istance, in order to delete each child node of a particular parent node,

?php

while ($parentNode-hasChildNodes()){
  $domNodeList = $parentNode-childNodes;
  $parentNode-removeChild($domNodeList-item(0));
}

?

In other word you have to uptade the DomNodeList on every iteration.

In my opinion, the DomNodeList class is useless.


[PHP] Basics of OOP

2008-09-09 Thread Ben Stones
Hi,

The following bit of code doesn't output anything:

?php
class output {
var $text;
function outputText() {
$this-text = Hello World;
echo $this-text;
}
}

$class = new output();
$class-outputText;
?

As well as the following code:

?php
class output {
var $text=5;
function outputText() {
echo $this-text;
}
}

$class = new output();
$class-outputText;
?

Am I doing anything wrong? By the way, the preceding code is just so I
understand OOP which finally I've grasped, but am I doing anything wrong as
both codes don't output anything?


Re: [PHP] Basics of OOP

2008-09-09 Thread Robert Cummings
On Tue, 2008-09-09 at 20:09 +0100, Ben Stones wrote:
 Hi,
 
 The following bit of code doesn't output anything:
 
 ?php
 class output {
 var $text;
 function outputText() {
 $this-text = Hello World;
 echo $this-text;
 }
 }
 
 $class = new output();
 $class-outputText;

Should be $class-outputText();

Same with other example.

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


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



Re: [PHP] Using DOM textContent Property

2008-09-09 Thread Nathan Rixham

Nathan Nobbe wrote:


In my opinion, the DomNodeList class is useless.



agreed; ever tried making a replacement node class that extends it? then 
you see how useless it is! [yet a vital part of the dom structure]


ot here; but I thought maybe useful for reference; I do loads of xml/dom 
api work and find that this little iterator is very very useful; I've 
trimmed it down but you'll find below how *I* iterate through the dom 
grabbing the important values..


private function iterateDom( $nodeList )
{
  foreach( $nodeList as $values ) {
if( $values-nodeType == XML_ELEMENT_NODE ) {
  $nodeName = $values-nodeName;
  if( $values-attributes ) {
   for( $i=0;$values-attributes-item($i);$i++ ) {
$attributeName = $values-attributes-item($i)-nodeName
$attributeValue = $values-attributes-item($i)-nodeValue
   }
  }
  $values-children = $this-iterateDom( $values-childNodes );
  $tempNode[$nodeName] = $values;
} elseif( in_array($values-nodeType, array(XML_TEXT_NODE, 
XML_CDATA_SECTION_NODE)) ) {

  $nodeType = $values-nodeType;
  $nodeData = $values-data;
} elseif( $values-nodeType === XML_PI_NODE ) {
  $DOMProcessingInstruction = array('target' = $values-target, 
'data' = $values-data);

}
# other wise we ignore as all that's left is DOMComment
  }
}

might be useful for somebody

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



[PHP] Re: Basics of OOP

2008-09-09 Thread Nathan Rixham

Ben Stones wrote:

Hi,

The following bit of code doesn't output anything:

?php
class output {
var $text;
function outputText() {
$this-text = Hello World;
echo $this-text;
}
}

$class = new output();
$class-outputText;
?

As well as the following code:

?php
class output {
var $text=5;
function outputText() {
echo $this-text;
}
}

$class = new output();
$class-outputText;
?

Am I doing anything wrong? By the way, the preceding code is just so I
understand OOP which finally I've grasped, but am I doing anything wrong as
both codes don't output anything?



it's the lack of a methodCall()

$class-outputText; don't work
$class-outputText(); will work

while you're there why not learn the php5 way?

?php
class output {

  private $text;

  public function outputText( $text='default text' )
  {
$this-text = $text;
return $this-text;
  }

}

$class = new output;
$class-outputText();

?

just a suggestion save you double learning! good choice on the OO though

nathan

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



Re: [PHP] Interntet Explorer 8 beater 2

2008-09-09 Thread Ashley Sheridan
No, I test as far as IE6 and 7 as far as Microshaft browsers go. As it's
a beta, and a M$ beta at that, it's likely to change a considerable bit
before it's a final product, so not much point testing it this early in
it's life cycle. Maybe more towards the time when it is ready to be
fully released.


Ash
www.ashleysheridan.co.uk
---BeginMessage---

No, I'm not. I didn't even know it was in Beta until this email.

I probably wont download it until final release. I'm not the biggest MS 
fan, and pretty much the only reason I use IE is for cross-browser testing.


- Craige.

Richard Heyes wrote:

Hi,

Anyone using it?

  


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


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

Re: [PHP] php image and javascript include

2008-09-09 Thread Ashley Sheridan
Kate has an auto text feature, and you can set it to start prompting
from typing in as few characters as you wish, although it only prompts
for things you've already typed, it this does save you from making
obvious variable name typos as it will prompt the next time you try to
use it, and it recognises many, many more languages than DW.

If you're just after the code view, Dreamweaver is a little heavy, and
it runs on an OS which is also a bit heavy, but that's for another
discussion! 


Ash
www.ashleysheridan.co.uk
---BeginMessage---
On Monday 08 September 2008 14:53:24 Jay Moore wrote:
  Dreamweaver? Eclipse? Pah, it's all about using a text editor! Kate (on
  KDE) is my preference ;)

 Heathen!

 Dreamweaver is awesome.  Not for their WYSIWYG editor, but for their
 code-only view and its auto-complete.

 Never have I typed so little to get so... little.

I thought so to, till I tried quanta+


 Jay



-- 
---
Børge Holen
http://www.arivene.net

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

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

Re: [PHP] CSV output.

2008-09-09 Thread Ashley Sheridan
I'm guessing that when you are writing your values, you are writing
numbers to the file and not strings. With numbers, the significant
floating-point values are obviously preserved, but a number like 12.00
will be written as just 12. Try either casting the value to a string, or
having PHP auto-cast by doing something like this:

fwrite($fh, $price);

The double quotes forces PHP to convert the number to a string.


Ash
www.ashleysheridan.co.uk
---BeginMessage---
Tom Shaw wrote:
 I'm outputting a bunch of numerical values for a spreadsheet to calculate
 total sales among other things on a client shopping cart. I'm running into
 problems with values that contain zeros after the decimal. If a value is
 234.55 the value outputs fine to the CSV file but if the value is 234.00
 only 234 shows up. Is there any way to force the zeros into the spreadsheet?

If your code is written correctly, the .00 will be in the CSV file

However the program you are using to view the CSV file probably
auto-hides them without you knowing it.

POST YOUR Code
POST your CSV output

Without Code and without Output, you don't really show the problem.

Wolf


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


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

[PHP] Re: Secure way to handle pw on session.

2008-09-09 Thread Dan
You should never store a user's password.  Instaed immediatly do an SHA1 
hash of the password and compare that to the hashed password in your 
database.  It doesn't make any sense to store passwords in clear text.  Even 
if they found the hash they wouldn't be able to reverse it (hashes are once 
way since they are like a sum, the inverse is impossible to compute).



- Dan 



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



RE: [PHP] Google Chrome

2008-09-09 Thread John A DAVIS


Yeah, my Kerios firewall kept popping up asking me to Permit google something to go somewhere off my computer. Even when Chrome wasn't running. I sure like the skinnyness and the last visited webpage. What can you tell a 500 pound gorilla? probably nothing.

 "Boyd, Todd M." [EMAIL PROTECTED] 9/4/2008 1:26:16 PM 
 -Original Message- From: Wolf [mailto:[EMAIL PROTECTED] Sent: Thursday, September 04, 2008 1:34 PM To: Boyd, Todd M. Cc: php-general@lists.php.net Subject: RE: [PHP] Google Chrome  !-- SNIP --  You can at least track memory + cpu usage through the Task Manager  (Ctrl-Alt-Del + T on most distros). In the Task Manager, I also noticed  that GoogleUpdate.exe is running even when Chrome.exe is not. This made  me a bit curious, so I went into msconfig (the Microsoft GUI utility for  modifying startup programs, services, and system INI files) and saw that  GoogleUpdate.exe had been added to the list of programs to run on  Windows startup.   I hate, hate, HATE it when programs install resident agents that eat my  memory and perform background network activity. Rrgh! Points taken away  from Google for this app's EULA and its methods. Slick otherwise, though  (aside from the lack of XMLDOM instantiation support for _javascript_)...  startup monitor - sure it runs at startup, but that little bugger keeps an eye on my startup and asks me if I want to allow my startup to be modified.Yeah, I used to use a program that had similar functionality. Haven't really bothered putting much of my "familiar" software on my work PC, but maybe I should after this... it has been bogging down a bit lately, after all.Todd BoydWeb Programmer

[PHP] SOAP call

2008-09-09 Thread Christoph Boget
Is there a way to call a SOAP function and pass the required XML as an
argument instead of an object?  I can get this to work:

$oClient = new SoapClient( $sWSDL_URI, array( 'trace' = TRUE,
'exceptions'= TRUE );

$oArgObj = new ArgObj();
$oArgObj-node1 = 'value'
$oArgObj-node2 = 'value'
$oArgObj-node3 = 'value'

$oClient-doMyAction( $oArgObj );

but not this:

$oClient = new SoapClient( $sWSDL_URI, array( 'trace' = TRUE,
'exceptions'= TRUE );

$sXML = 
'doMyActionnode1value/node1node2value/node2node3value/node3/doMyAction';

Which, if I look at the result from __getLastRequest(), is exactly
what the XML sent looks like (minus the SOAP body, etc).

The error I keep gettings is xml-resolve-missing-var-error.  Is
there any way I can just send the XML?  Or does it have to be an
object with the appropriate properties set?

thnx,
Chris

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



Re[2]: [PHP] Length of Exception text?

2008-09-09 Thread ANR Daemon
Greetings, Peter Ford.
In reply to Your message dated Tuesday, September 9, 2008, 12:37:30,

 I've been working on some PEAR-based app last week and I ran into
 problem.
 While I debugging app, my backtrace always trimmed at some point.
 First time I though it was my mistake, and switched back to standard
 Exception class.
 But nothing changed.

 If I print everything by hands, it's all full and good, but if I let 
 PHP print

 what do you mean by:

 1. print by hand

 Catch excetion and manually call getTraceAsString.

 2. let PHP print

 Do not catch exception, let PHP behave on it's own way.
 
 are you printing to screen or to error_log (or syslog)? I believe 
 error_log has a limit as to the
 length of the string that will actually be logged ... I can't remember 
 whether this
 was php, apache or system related.
 
 You want the php.ini setting:

 log_errors_max_len

 It defaults to 1024 characters: presumably that includes the preamble giving 
 you 
 1015 or so to play with.

 If you set it to zero then you get unlimited log messages. 'course that might 
 fill your logs up a bit...

Good catch indeed. I was confused by the strange limit (not 1023-1024 as I
expect that), so I haven't checked if this setting affecting things.

And don't worry about my log :) I want it enabled for php-cli.ini only, for
development purposes.
On live suite, exceptions generally never breaking out to {main} scope.


-- 
Sincerely Yours, ANR Daemon [EMAIL PROTECTED]


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



Re[2]: [PHP] Problem of Connection Character Sets and Collations

2008-09-09 Thread ANR Daemon
Greetings, [EMAIL PROTECTED]
In reply to Your message dated Monday, September 8, 2008, 19:35:22,

For displaying with unicode Character Sets problem :

MySQL :

MySQL question. There's got to be a mailing list on http://www.mysql.com

phpmyadmin :

PHPMyAdmin question. PHPMyAdmin, while written in PHP, is not PHP. This
would be like asking Internet Explorer questions in a Visual C/C++
mailing list/forum.

 So, do you means as the following (If we need define the unicode
 character sets )?

No, he means, that you must do your homework yourself. (That is, must as
opposite to should)
And he told you where to go to get the info you need.
From your first post, it is clearly looks like skill-checking test of some
sort. And if it is, you must read and understand documentation about mentioned
things.
I've left required info in quotation. Read it again, if you didn't understand
it first time.


-- 
Sincerely Yours, ANR Daemon [EMAIL PROTECTED]


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



Re: [PHP] Re: Basics of OOP

2008-09-09 Thread Jochem Maas

Nathan Rixham schreef:

Ben Stones wrote:

Hi,

The following bit of code doesn't output anything:

?php
class output {
var $text;
function outputText() {
$this-text = Hello World;
echo $this-text;
}
}

$class = new output();
$class-outputText;
?

As well as the following code:

?php
class output {
var $text=5;
function outputText() {
echo $this-text;
}
}

$class = new output();
$class-outputText;
?

Am I doing anything wrong? By the way, the preceding code is just so I
understand OOP which finally I've grasped, but am I doing anything 
wrong as

both codes don't output anything?



it's the lack of a methodCall()

$class-outputText; don't work


$class-outputText;

references an undefined property of the class instance,
turning on error_reporting to full (i.e. including E_NOTICE)
would have given a hint to the OP (assuming he has display_error ON
or he is reading his error log) as to what was going on.

as an example, try running this:


?

class Foo {
public  $a = A\n;
private $b = B\n;
static  $d = D\n;

function b() { echo $this-b; }
static function d() { echo self::$d; }
static function e() { echo E\n; }
}


ini_set('display_errors', true);
ini_set('error_reporting', E_ALL ^ E_STRICT);

$f = new Foo;
echo $f-a;
echo $f-b();
echo $f-c;
echo $f-d();
echo $f-d;
echo Foo::d();
echo Foo::$d;
echo $f-e();
echo Foo::e();

// the following are fatal errors:

echo $f-b;
echo Foo::b();

?


$class-outputText(); will work

while you're there why not learn the php5 way?


quite right :)


?php
class output {

  private $text;

  public function outputText( $text='default text' )
  {
$this-text = $text;
return $this-text;
  }

}

$class = new output;
$class-outputText();

?

just a suggestion save you double learning! good choice on the OO though

nathan




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



Re: [PHP] Creating single row for multiple items.

2008-09-09 Thread tedd

At 10:04 PM -0600 8/31/08, Tom Shaw wrote:

My array looks very similar to this. I need to create a single row for the
items that have the same order number for CSV export.  I'd prefer to do this
PHP wise instead of SQL. But would appreciate any help I can get.

$ar = array(

   array(

 order_id = 34,

 order_number = 35Y345Y356YU3,

 order_name = Steinway Grand Piano #11,

 order_ordered_size = Grand,

 order_sales_price = 78671.90,

 order_shipping_price = 7.85,

 order_shipping_extra = 0.06,

   ),



My first question is:

$78 THOUSAND DOLLARS FOR A FRAKING PIANO ???!!!???

Now that I've composed myself.

What's wrong with use MySQL and letting it do the hard stuff?

After all, what you are attempting to do is what MySQL works best at 
-- namely pull all all the records that have the same order number. 
Why make it harder on yourself?


Cheers,

tedd




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

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



Re: [PHP] Creating single row for multiple items.

2008-09-09 Thread Ashley Sheridan
I'm assuming because this is part of a shopping cart, so he would have
to put the data into the database only to retrieve it again, which is a
little bit of a waste.

As for how to do it, I'd look through the arrays you have and use
associative arrays (where the order number is the key of the array
element) and set the price if the array element is just being set (use
the isset() function for this) and increment it if it already exists.


Ash
www.ashleysheridan.co.uk
---BeginMessage---

At 10:04 PM -0600 8/31/08, Tom Shaw wrote:

My array looks very similar to this. I need to create a single row for the
items that have the same order number for CSV export.  I'd prefer to do this
PHP wise instead of SQL. But would appreciate any help I can get.

$ar = array(

   array(

 order_id = 34,

 order_number = 35Y345Y356YU3,

 order_name = Steinway Grand Piano #11,

 order_ordered_size = Grand,

 order_sales_price = 78671.90,

 order_shipping_price = 7.85,

 order_shipping_extra = 0.06,

   ),



My first question is:

$78 THOUSAND DOLLARS FOR A FRAKING PIANO ???!!!???

Now that I've composed myself.

What's wrong with use MySQL and letting it do the hard stuff?

After all, what you are attempting to do is what MySQL works best at 
-- namely pull all all the records that have the same order number. 
Why make it harder on yourself?


Cheers,

tedd




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

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


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

Re: [PHP] Re: Regex help

2008-09-09 Thread Jochem Maas

Jason Pruim schreef:


On Sep 9, 2008, at 12:18 PM, Jochem Maas wrote:



...


I'll have to do some searching :)


always ;-)


The problem with the internet is there is so much out there... Trying to 
weed the crap from the food can be a long digestive process which ends 
up with MORE crap coming out... This list... It's like pepto bismo for 
my programming :P


and there is us trying so hard to give everyone stomach ulcers :-)
must  try  harder.




--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
11287 James St
Holland, MI 49424
www.raoset.com
[EMAIL PROTECTED]








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



Re[2]: [PHP] translations for PHP app

2008-09-09 Thread ANR Daemon
Greetings, Wolf.
In reply to Your message dated Monday, September 8, 2008, 15:08:22,

 I'm looking for professional translations from English of the following:
 - admin.php lang file just under 150 PHP defines
 - user.php lang file just under 30 PHP defines
 - a javascript file with about 25 single word defines
 - about 19 PHP files with 2 defines in each
 
 Most defines are 1 or 2 words with a few being sentences.
 
 I need translations from English into the most common languages of my
 users: Spanish, French, Italian, Chinese, Indian, Russian.  Also, anyone
 having expertise in other languages, I would love to have them, please
 contact me.
 
 I also have a 30+ page user guide for using my software.  Many pages
 contain large graphics, but the English text I woul love to have
 translated.
 
 Of course I will pay.  PayPal only.

 Have you tried blowfish or the Google Translator?  The last time I tried
 the google one, it did a whole page on the fly and seemed to be pretty
 good at it.

Looks you aren't understand, what Shawn want.
He do not want to translate English text in his own language to understand it,
in which area these automated translators pretty good. They're giving you some
common meaning of the text, but nothing more.
Instead, he want his own, already English text translated to some foreign
languages. That can be done ONLY by native speakers, who know English AND the
field, to which that specific text related.
As example, I can point to the EVE-online and their attempt to hire foreign
company to translate game interface to Russian... That said, it was complete
failure. Two times. They simply wasted their money, because all they know
about game is the text they were translated.


-- 
Sincerely Yours, ANR Daemon [EMAIL PROTECTED]


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



Re: [PHP] Creating single row for multiple items.

2008-09-09 Thread tedd

At 12:38 AM +0100 9/10/08, Ashley Sheridan wrote:

I'm assuming because this is part of a shopping cart, so he would have
to put the data into the database only to retrieve it again, which is a
little bit of a waste.



If it's a shopping cart filled with Pianos, it's going to be heavy anyway. :-)

From my perspective, there's nothing wrong with (and a lot right 
with) storing an order number in a database (orders table) with all 
the item numbers that are associated/ordered with that order. He does 
not have to repeat all the data associated with each item purchased 
(i.e., name, price, shipping, etc.). It's just the order number with 
the purchased item numbers.


At some point, he has to pull the order together, show the user what 
they are buying, take payment for the items, and fulfill the order. 
You certainly don't need a collection of arrays containing all the 
bits and pieces of the order for you to figure out where everything 
is and assemble the transaction. The process is *much* simpler to 
process as an order in a database -- my opinion.


Cheers,

tedd



As for how to do it, I'd look through the arrays you have and use
associative arrays (where the order number is the key of the array
element) and set the price if the array element is just being set (use
the isset() function for this) and increment it if it already exists.


Ash
www.ashleysheridan.co.uk

Return-path:
[EMAIL PROTECTED]
Envelope-to: [EMAIL PROTECTED]
Delivery-date: Wed, 10 Sep 2008 00:31:46 +0100
Received: from [216.92.131.4] (port=25033 helo=lists.php.net) by
zencphosting11.zen.co.uk with esmtp (Exim 4.68) (envelope-from
[EMAIL PROTECTED]) id
	1KdCgU-0003IU-E0 for [EMAIL PROTECTED]; Wed, 10 Sep 
2008 00:31:46

+0100
X-Host-Fingerprint: 216.92.131.4 lists.php.net 
Received: from [216.92.131.4] ([216.92.131.4:24918] helo=lists.php.net) by

pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id
60/B9-23799-16707C84 for [EMAIL PROTECTED]; Tue, 09 Sep 2008
19:31:45 -0400
Received: (qmail 95720 invoked by uid 1010); 9 Sep 2008 23:31:32 -
Mailing-List: contact [EMAIL PROTECTED]; run by ezmlm
Precedence: bulk
list-help: mailto:[EMAIL PROTECTED]
list-unsubscribe: mailto:[EMAIL PROTECTED]
list-post: mailto:php-general@lists.php.net
Delivered-To: mailing list php-general@lists.php.net
Received: (qmail 95713 invoked from network); 9 Sep 2008 23:31:31 -
Authentication-Results: pb1.pair.com [EMAIL PROTECTED];
spf=unknown; sender-id=unknown
Authentication-Results: pb1.pair.com [EMAIL PROTECTED];
sender-id=unknown
Received-SPF: unknown (pb1.pair.com: domain gmail.com does not designate
76.96.30.48 as permitted sender)
X-PHP-List-Original-Sender: [EMAIL PROTECTED]
X-Host-Fingerprint: 76.96.30.48 qmta05.emeryville.ca.mail.comcast.net 
X-Authority-Analysis: v=1.0 c=1 a=ScsBlOKGSAsA:10 a=jFRa_u9Lu-YA:10
	a=yZEG99RI:8 a=oKA0wkP2:8 a=PFFhWekO:8 
a=0jRUIoGgooorb-81zc4A:9
	a=D833IUriJyPirLy-2bwA:7 a=C1lfn_RRjP3z5y6xorFLrp8CtiYA:4 
a=h9s5Ru71U4oA:10

Mime-Version: 1.0
Message-Id: [EMAIL PROTECTED]
In-Reply-To: [EMAIL PROTECTED]@tx.rr.com
References: [EMAIL PROTECTED]@tx.rr.com
Date: Tue, 9 Sep 2008 19:31:23 -0400
To: php-general@lists.php.net
From: tedd [EMAIL PROTECTED]
Content-Type: text/plain; charset=us-ascii ; format=flowed
Subject: Re: [PHP] Creating single row for multiple items.
Content-Transfer-Encoding: 7bit

At 10:04 PM -0600 8/31/08, Tom Shaw wrote:

My array looks very similar to this. I need to create a single row for the
items that have the same order number for CSV export.  I'd prefer to do this
PHP wise instead of SQL. But would appreciate any help I can get.

$ar = array(

   array(

 order_id = 34,

 order_number = 35Y345Y356YU3,

 order_name = Steinway Grand Piano #11,

 order_ordered_size = Grand,

 order_sales_price = 78671.90,

 order_shipping_price = 7.85,

 order_shipping_extra = 0.06,

   ),



My first question is:

$78 THOUSAND DOLLARS FOR A FRAKING PIANO ???!!!???

Now that I've composed myself.

What's wrong with use MySQL and letting it do the hard stuff?

After all, what you are attempting to do is what MySQL works best at 
-- namely pull all all the records that have the same order number. 
Why make it harder on yourself?


Cheers,

tedd




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

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



--
---
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] Creating single row for multiple items.

2008-09-09 Thread Micah Gersten
Databases are for storing and retrieving data. :)

Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com



Ashley Sheridan wrote:
 I'm assuming because this is part of a shopping cart, so he would have
 to put the data into the database only to retrieve it again, which is a
 little bit of a waste.


   


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



Re: [PHP] switch case - to require the break statements seems strange to me

2008-09-09 Thread tedd

At 6:46 PM -0600 8/31/08, Govinda wrote:

Not that it is an issue, but just to understand the logic-
Why do we have to use 'break' statements in each case?

switch ($i) {
case 0:
echo i equals 0;
break;
case 1:
echo i equals 1;
break;
case 2:
echo i equals 2;
break;
}

all 3 cases fire, even though $i only equals ONE of those case 
values (if I said that right).
I mean if $i==1, then in other languages I don't expect the first or 
last case to fire!  (?)
Is the purpose just so one has the OPTION of letting them all fire, 
and turning that off with 'break'?

Or is there a better reason?

-G



The break is to separate each case (i.e., condition)

The switch ($i) isn't even needed if you do it like this:

switch (true)
   {
   case $i==0:
echo i equals 0;
break;

   case $i==1:
echo i equals 1;
break;

   case $i==2:
echo i equals 2;
break;
   }

If you wanted to combine conditions, you could do this:

switch (1)
   {
   case $i==-2:
   case $i==-1:
   case $i==0:

echo i is less than 0 but greater than -3 and is a counting 
number (i.e., no fraction);

break;

   case $i==1:
echo i equals 1;
break;

   case $i==2:
echo i equals 2;
break;
   }


Typed without checking and after my vacation.

Cheers,

tedd

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

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



Re: [PHP] translations for PHP app

2008-09-09 Thread tedd

At 9:12 PM -0500 9/7/08, Shawn McKenzie wrote:

Hi All,

I'm looking for professional translations from English of the following:
- admin.php lang file just under 150 PHP defines
- user.php lang file just under 30 PHP defines
- a javascript file with about 25 single word defines
- about 19 PHP files with 2 defines in each

Most defines are 1 or 2 words with a few being sentences.

I need translations from English into the most common languages of 
my users: Spanish, French, Italian, Chinese, Indian, Russian.  Also, 
anyone having expertise in other languages, I would love to have 
them, please contact me.


I also have a 30+ page user guide for using my software.  Many pages 
contain large graphics, but the English text I woul love to have 
translated.


Of course I will pay.  PayPal only.

Thanks!
-Shawn



I can do the English to UK translations.  :-)

Cheers,

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

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



Re: [PHP] translations for PHP app

2008-09-09 Thread Yi Wang
On Mon, Sep 8, 2008 at 10:12 AM, Shawn McKenzie [EMAIL PROTECTED] wrote:
 Hi All,

 I'm looking for professional translations from English of the following:
 - admin.php lang file just under 150 PHP defines
 - user.php lang file just under 30 PHP defines
 - a javascript file with about 25 single word defines
 - about 19 PHP files with 2 defines in each

 Most defines are 1 or 2 words with a few being sentences.

 I need translations from English into the most common languages of my users:
 Spanish, French, Italian, Chinese, Indian, Russian.  Also, anyone having
 expertise in other languages, I would love to have them, please contact me.

 I also have a 30+ page user guide for using my software.  Many pages contain
 large graphics, but the English text I woul love to have translated.

 Of course I will pay.  PayPal only.

 Thanks!
 -Shawn

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



Hi, I can do the Chinese tranlation. Both simplified and traditional.
I've made Chinese translation of AbsoluteTelent.

-- 
Regards,
Wang Yi

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



Re: [PHP] Recommendation

2008-09-09 Thread tedd

At 10:15 AM -0500 9/2/08, Shawn McKenzie wrote:

Eric Butera wrote:

I'm on there too.

http://www.linkedin.com/in/ericbutera


Me too...

http://www.linkedin.com/in/rsmckenzie

-Shawn


-Shawn:

How do I get an email to you at: Shawn McKenzie [EMAIL PROTECTED] ?

Cheers,

tedd

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

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



[PHP] tedd's back from vacation

2008-09-09 Thread tedd

hi gang:

For those who wondered where I went -- I was on vacation.

I would have announced it before I left, but I was afraid that 
someone would have broken into my collection of stuff.


I'll post pictures of my vacation soon.

Oh, I had lot's of fun -- so much so, I broke my big toe on my left 
foot -- that's having serious fun! That was a dance someone should 
have recorded.


Cheers,

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

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



Re: [PHP] tedd's back from vacation

2008-09-09 Thread Dan Joseph
On Tue, Sep 9, 2008 at 10:00 PM, tedd [EMAIL PROTECTED] wrote:

 hi gang:

 For those who wondered where I went -- I was on vacation.

 I would have announced it before I left, but I was afraid that someone
 would have broken into my collection of stuff.

 I'll post pictures of my vacation soon.

 Oh, I had lot's of fun -- so much so, I broke my big toe on my left foot --
 that's having serious fun! That was a dance someone should have recorded.

 Cheers,

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

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


Look, just because we let you out of your cage, doesn't mean you have to go
breaking your bones!  No more vacations!

BTW, was that dance in response to MSU winning 2 games in a row?

-- 
-Dan Joseph

www.canishosting.com - Plans start @ $1.99/month.

Build a man a fire, and he will be warm for the rest of the day.
Light a man on fire, and will be warm for the rest of his life.


Re: [PHP] translations for PHP app

2008-09-09 Thread Shawn McKenzie

tedd wrote:

At 9:12 PM -0500 9/7/08, Shawn McKenzie wrote:

Hi All,

I'm looking for professional translations from English of the following:
- admin.php lang file just under 150 PHP defines
- user.php lang file just under 30 PHP defines
- a javascript file with about 25 single word defines
- about 19 PHP files with 2 defines in each

Most defines are 1 or 2 words with a few being sentences.

I need translations from English into the most common languages of my 
users: Spanish, French, Italian, Chinese, Indian, Russian.  Also, 
anyone having expertise in other languages, I would love to have 
them, please contact me.


I also have a 30+ page user guide for using my software.  Many pages 
contain large graphics, but the English text I woul love to have 
translated.


Of course I will pay.  PayPal only.

Thanks!
-Shawn



I can do the English to UK translations.  :-)

Cheers,

tedd


Haha.  I can do that dude!  I mean, I can do that mate!

Cheers,
-Shawn

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



Re: [PHP] Recommendation

2008-09-09 Thread Shawn McKenzie
I don't understand the question.  It is an email account that I check 
and I get mail from that address all the time.  Of course it's late/much 
wine and there may be some humor here that is totally escaping me.


-Shawn

tedd wrote:

At 10:15 AM -0500 9/2/08, Shawn McKenzie wrote:

Eric Butera wrote:

I'm on there too.

http://www.linkedin.com/in/ericbutera


Me too...

http://www.linkedin.com/in/rsmckenzie

-Shawn


-Shawn:

How do I get an email to you at: Shawn McKenzie [EMAIL PROTECTED] ?

Cheers,

tedd



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



Re: [PHP] switch case - to require the break statements seems strange to me

2008-09-09 Thread Jochem Maas

tedd schreef:

At 6:46 PM -0600 8/31/08, Govinda wrote:

Not that it is an issue, but just to understand the logic-
Why do we have to use 'break' statements in each case?

switch ($i) {
case 0:
echo i equals 0;
break;
case 1:
echo i equals 1;
break;
case 2:
echo i equals 2;
break;
}

all 3 cases fire, even though $i only equals ONE of those case values 
(if I said that right).
I mean if $i==1, then in other languages I don't expect the first or 
last case to fire!  (?)
Is the purpose just so one has the OPTION of letting them all fire, 
and turning that off with 'break'?

Or is there a better reason?

-G



The break is to separate each case (i.e., condition)

The switch ($i) isn't even needed if you do it like this:

switch (true)
   {
   case $i==0:
echo i equals 0;
break;

   case $i==1:
echo i equals 1;
break;

   case $i==2:
echo i equals 2;
break;
   }


this is 'true' ;-) and works very well when you want to
check disparate truths but there are caveats:

1. it's less performant IIRC
2. there is no type checking, so auto-casting occurs during the
test of each case's expression
3. it will become even less performant ... someone clever sod has
a patch that heavily optimizes 'simple' switch statements ... see
the internal mailing list archives for details (I can't remember the
details) ... I gather this patch will eventually make it into the core,
if it hasn't already.



If you wanted to combine conditions, you could do this:

switch (1)
   {
   case $i==-2:
   case $i==-1:
   case $i==0:

echo i is less than 0 but greater than -3 and is a counting number 
(i.e., no fraction);

break;

   case $i==1:
echo i equals 1;
break;

   case $i==2:
echo i equals 2;
break;
   }


Typed without checking and after my vacation.

Cheers,

tedd




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



Re: [PHP] translations for PHP app

2008-09-09 Thread Anderson Franco
Hi Shawn

I can translate from English into Portuguese.

Please contact me in pvt.

Regards,

Anderson Franco
Web Developer

Email: [EMAIL PROTECTED]
MSN/GTalk: [EMAIL PROTECTED]



On Sun, Sep 7, 2008 at 11:12 PM, Shawn McKenzie [EMAIL PROTECTED]wrote:

 Hi All,

 I'm looking for professional translations from English of the following:
 - admin.php lang file just under 150 PHP defines
 - user.php lang file just under 30 PHP defines
 - a javascript file with about 25 single word defines
 - about 19 PHP files with 2 defines in each

 Most defines are 1 or 2 words with a few being sentences.

 I need translations from English into the most common languages of my
 users: Spanish, French, Italian, Chinese, Indian, Russian.  Also, anyone
 having expertise in other languages, I would love to have them, please
 contact me.

 I also have a 30+ page user guide for using my software.  Many pages
 contain large graphics, but the English text I woul love to have translated.

 Of course I will pay.  PayPal only.

 Thanks!
 -Shawn

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




Re: [PHP] Zend Platform

2008-09-09 Thread Ray Hauge

Stut wrote:

On 9 Sep 2008, at 18:52, Nathan Rixham wrote:
Short and sweet; does anybody have any practical experience; thoughts 
or case studies in regards to implementing the Zend Platform.


Yeah, I used it in my previous job a coupla years ago. It looks great, 
the marketing hype is well executed but as usual the reality is far from 
the promise. There are some aspects I really like, but mainly in 
concept. What you actually get is expensive extra bloat to install on 
your servers.


* The bytecode cache can be replaced by one of several free solutions 
out there.


* The job queue is a great idea but the implementation is problematic at 
best. Avoid this if you can.


* The centralised logging and the alerting features are nice - this is 
probably the only but I really found useful.


* The clustering features I did not use so didn't look at too closely, 
but it didn't appear to offer anything that couldn't be replicated 
pretty easily with open source tools.


At the end of the day what you're buying is marketing hype, and there 
are people out there who fall for it hook line and sinker. My advice is 
that unless you have someone insisting you use ZP, don't. And even if 
you do I urge you to look at what you actually need from it and evaluate 
alternatives before making a commitment. Have you ever heard about 
Facebook, Yahoo or any other big player using it?


Don't get me wrong, I think Zend is a great company, but I just don't 
see the value in ZP. For the price of the license you could add another 
server which will give you far better ROI and higher capacity then ZP 
could ever achieve.


And don't get me started on what they've done to Zend Studio. I've 
switched to Aptana - same platform, but cheaper and a lot more stable. 
Shame!


-Stut



I agree with most of your post.  The error logging features are great. 
I haven't used ZP for a while, but when I did it was nice to get an 
alert right away of what happened, and it also captured the variables in 
use at the time so that you could see why it happened.  If the error 
reporting is what you're looking for, then the bytecode caching is a 
nice addition, but like you said there are OSS alternatives.


I also completely agree with the Zend Studio comment.  I've switched 
back to Zend Studio 5.5, because the Eclipse version was just so 
unintuitive... especially for debugging.


--
Ray Hauge
www.primateapplications.com

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