Re: [PHP] [Q] Exec'ing a command
Eric Gorr wrote: > Hopefully this will be clear. > > I've got a unix command-line app which I will be exec'ing (or some > other similar command) from a php script. > > The special property of this unix app is that while it executes and > terminates quickly, only a single instance can be running at any one > time. > > However, the php script can be called simultaneously and it is > possible that an invalid attempt to run two or more instances of the > unix app at the same time could be made. > > Now, one possible solution to this problem is that the php script adds > it's request to run the unix app to a queue and their is some other > code which pulls a request off the queue, performs the operation and > returns the data back to the php script which made the request. > > Are there other solutions that I have not considered? A lock file. Your script will lock it when it's running, unlock it when it's done. If your script finds the file already locked, it quits. In practical terms, your script will check for the existence of the file. If found, it exits. If not found, it creates it. And removes it when it's finished. Yes, the check and the creation of the lock file should preferably be atomic, but when you're in a script language, you can't have it all. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Inspiration for a Tombstone.
Robert Cummings wrote: I will never do it... it looks ugly, Only if you're not used to it. IMO this is how it should be taught in all the books and guides etc. If that was the case, the other way round would be ugly :) especially when performing multiple if comparisons on the variable. Perhaps, but it's still not as ugly as a hideous error gone undetected which accidentally deletes all your customers' data. Additionally, using a little red to highlight the assignment operator but not the comparison operator works just as well. Make machines work for you, not the other way around. Well whatever floats your boat. :) Personally, editor configuration is all well and good, but if you work in a team and regularly edit other peoples' code (and as such they use other editors with other configurations) and some people are colour blind etc. so can't use red and other colours so easily, editor configuration will never replace habits like this which use the language itself to ensure better QA. But each to their own! Col -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Inspiration for a Tombstone.
On Sat, Jun 28, 2008 at 9:44 AM, Colin Guthrie <[EMAIL PROTECTED]> wrote: > Robert Cummings wrote: >> >> I will never do it... it looks ugly, > > Only if you're not used to it. IMO this is how it should be taught in all > the books and guides etc. If that was the case, the other way round would be > ugly :) > >> especially when performing multiple >> if comparisons on the variable. > > Perhaps, but it's still not as ugly as a hideous error gone undetected which > accidentally deletes all your customers' data. ---snip--- I don't know about "ugly," but I agree it "feels" wrong. I feel like I'm using Yoda-speak when reading code like that: If 'yes' is you_can_read_this, 'Stop standing on me' I say. or If 0 is my_pulse then 'dead you are' should say you. :-D --Andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Inspiration for a Tombstone.
On Sat, 2008-06-28 at 11:27 -0400, Andrew Ballard wrote: > On Sat, Jun 28, 2008 at 9:44 AM, Colin Guthrie <[EMAIL PROTECTED]> wrote: > > Robert Cummings wrote: > >> > >> I will never do it... it looks ugly, > > > > Only if you're not used to it. IMO this is how it should be taught in all > > the books and guides etc. If that was the case, the other way round would be > > ugly :) > > > >> especially when performing multiple > >> if comparisons on the variable. > > > > Perhaps, but it's still not as ugly as a hideous error gone undetected which > > accidentally deletes all your customers' data. > ---snip--- > > > I don't know about "ugly," but I agree it "feels" wrong. I feel like > I'm using Yoda-speak when reading code like that: > > If 'yes' is you_can_read_this, 'Stop standing on me' I say. > > or > > If 0 is my_pulse then 'dead you are' should say you. *lol* Exactly... just doesn't sit right. It's a good way to make sure you're not screwing up, but testing should take care of that too. 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] Re: Inspiration for a Tombstone.
Robert Cummings wrote: On Sat, 2008-06-28 at 11:27 -0400, Andrew Ballard wrote: On Sat, Jun 28, 2008 at 9:44 AM, Colin Guthrie <[EMAIL PROTECTED]> wrote: Robert Cummings wrote: I will never do it... it looks ugly, Only if you're not used to it. IMO this is how it should be taught in all the books and guides etc. If that was the case, the other way round would be ugly :) especially when performing multiple if comparisons on the variable. Perhaps, but it's still not as ugly as a hideous error gone undetected which accidentally deletes all your customers' data. ---snip--- I don't know about "ugly," but I agree it "feels" wrong. I feel like I'm using Yoda-speak when reading code like that: If 'yes' is you_can_read_this, 'Stop standing on me' I say. or If 0 is my_pulse then 'dead you are' should say you. *lol* Exactly... just doesn't sit right. It's a good way to make sure you're not screwing up, but testing should take care of that too. Cheers, Rob. But whoever said the flow of the English language was all that efficient? I actually prefer 'Yoda Speak'. Takes less to say more. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Inspiration for a Tombstone.
2008/6/28 Jim Lucas <[EMAIL PROTECTED]>: > But whoever said the flow of the English language was all that efficient? I > actually prefer 'Yoda Speak'. Takes less to say more. > The flow of the English language was all that efficient, who ever said? 'Yoda speak' I actually prefer. Say more, takes less. Dotan Cohen http://what-is-what.com http://gibberish.co.il א-ב-ג-ד-ה-ו-ז-ח-ט-י-ך-כ-ל-ם-מ-ן-נ-ס-ע-ף-פ-ץ-צ-ק-ר-ש-ת A: Because it messes up the order in which people normally read text. Q: Why is top-posting such a bad thing?
Re: [PHP] Re: Inspiration for a Tombstone.
On Sat, 2008-06-28 at 21:19 +0300, Dotan Cohen wrote: > 2008/6/28 Jim Lucas <[EMAIL PROTECTED]>: > > But whoever said the flow of the English language was all that efficient? I > > actually prefer 'Yoda Speak'. Takes less to say more. > > > > The flow of the English language was all that efficient, who ever > said? 'Yoda speak' I actually prefer. Say more, takes less. Don't forget the associated function of understanding... Yoda speak requires more thinking and you still understand less. Yoda speak is merely a veiled attempt to seem wise. Wisdom real requires such tricks not. 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] Re: Inspiration for a Tombstone.
On Sat, Jun 28, 2008 at 1:33 PM, Jim Lucas <[EMAIL PROTECTED]> wrote: > Robert Cummings wrote: >> >> On Sat, 2008-06-28 at 11:27 -0400, Andrew Ballard wrote: >>> >>> On Sat, Jun 28, 2008 at 9:44 AM, Colin Guthrie <[EMAIL PROTECTED]> >>> wrote: Robert Cummings wrote: > > I will never do it... it looks ugly, Only if you're not used to it. IMO this is how it should be taught in all the books and guides etc. If that was the case, the other way round would be ugly :) > especially when performing multiple > if comparisons on the variable. Perhaps, but it's still not as ugly as a hideous error gone undetected which accidentally deletes all your customers' data. >>> >>> ---snip--- >>> >>> >>> I don't know about "ugly," but I agree it "feels" wrong. I feel like >>> I'm using Yoda-speak when reading code like that: >>> >>> If 'yes' is you_can_read_this, 'Stop standing on me' I say. >>> >>> or >>> >>> If 0 is my_pulse then 'dead you are' should say you. >> >> *lol* Exactly... just doesn't sit right. >> >> It's a good way to make sure you're not screwing up, but testing should >> take care of that too. >> >> Cheers, >> Rob. > > But whoever said the flow of the English language was all that efficient? I > actually prefer 'Yoda Speak'. Takes less to say more. > Say anything about efficiency never did I. :-) I was merely commenting on a personal preference based largely on my perspective as a native speaker of (US) English. Now - if I WERE to address efficiency, I don't find "Yoda speak" to be any more efficient. It's usually the same words just in a different order. What's more that order, while quite natural for some languages, is not natural to me at all. As Bob mentioned, it requires a little extra thought for my brain to push certain phrases onto the mental stack before I can pop them off in an order that "makes sense." In programming terms, any code that requires the same amount of statements but requires more cycles to process is not what I would consider more efficient. As far as the programming practice that Colin was advocating, it is not a bad habit. And as far as the computer is concerned, the efficiency is a wash since the number of internal steps probably doesn't change much. However, it doesn't always work. (I know - no one claimed it did.) Andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Inspiration for a Tombstone.
2008/6/28 Andrew Ballard <[EMAIL PROTECTED]>: > Say anything about efficiency never did I. :-) I was merely commenting > on a personal preference based largely on my perspective as a native > speaker of (US) English. Now - if I WERE to address efficiency, I > don't find "Yoda speak" to be any more efficient. It's usually the > same words just in a different order. What's more that order, while > quite natural for some languages, is not natural to me at all. As Bob > mentioned, it requires a little extra thought for my brain to push > certain phrases onto the mental stack before I can pop them off in an > order that "makes sense." In programming terms, any code that requires > the same amount of statements but requires more cycles to process is > not what I would consider more efficient. > > As far as the programming practice that Colin was advocating, it is > not a bad habit. And as far as the computer is concerned, the > efficiency is a wash since the number of internal steps probably > doesn't change much. However, it doesn't always work. (I know - no one > claimed it did.) > > if ($challenge_password_hash = $stored_password_hash) { >echo 'Welcome to the club!'; > } else { >echo 'Stay out! This club is for members only!'; > } > ?> > > Andrew > In these instances you could rely on != behaviour instead of == behaviour, like this: or, better yet: Dotan Cohen http://what-is-what.com http://gibberish.co.il א-ב-ג-ד-ה-ו-ז-ח-ט-י-ך-כ-ל-ם-מ-ן-נ-ס-ע-ף-פ-ץ-צ-ק-ר-ש-ת A: Because it messes up the order in which people normally read text. Q: Why is top-posting such a bad thing?
[PHP] Another instance of shameless self promotion
This time its a line chart: http://www.phpguru.org/line/test.html BTW Is anyone else dumbfounded at the inability of the CANVAS tag to render text natively? A gross oversight IMO. -- Richard Heyes -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Adding new encodings to mbstring?
Hi all, Is it possible to add new character encodings to mbstring? http://us.php.net/mbstring If it is possible, then is there a procedure where I can submit "new feature" requests? Or is it possible for me to add the new character encodings myself? Thanks, Haluk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php