php-general Digest 9 Sep 2009 12:09:07 -0000 Issue 6330
Topics (messages 297798 through 297810):
Re: Renaming a Directory
297798 by: Eddie Drapkin
297803 by: Paul M Foster
297805 by: Eddie Drapkin
297807 by: Ashley Sheridan
297810 by: Floyd Resler
Re: Converting URL's to hyperlinks.
297799 by: Lupus Michaelis
297804 by: Paul M Foster
Re: mysql user session handler
297800 by: Tom Worster
297801 by: Gabriel Sosa
297806 by: Ford, Mike
Re: script failing at same line
297802 by: jim white
XML. Prevent < from turning into <
297808 by: Matthew Croud
hi, how can i join a php document translate team?
297809 by: Hanjie Xu
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]
----------------------------------------------------------------------
--- Begin Message ---
On Tue, Sep 8, 2009 at 5:39 PM, Floyd Resler<[email protected]> wrote:
> How can I rename a directory with files in it? The rename function gives me
> a "directory not empty" error. I know I could do it be creating the
> directory, moving the files, and then deleting the old one. Is there an
> easier way?
>
> Thanks!
> Floyd
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
Is there something wrong with `system("mv $oldName $newName");` ?
--- End Message ---
--- Begin Message ---
On Tue, Sep 08, 2009 at 05:39:43PM -0400, Floyd Resler wrote:
> How can I rename a directory with files in it? The rename function
> gives me a "directory not empty" error. I know I could do it be
> creating the directory, moving the files, and then deleting the old
> one. Is there an easier way?
It sounds like, underneath, rename() is creating a new directory and
then attempting to delete the old one, ignoring the files in the
original directory. In which case, you'll have to do it the long way--
create a new directory, move the files, then delete the old directory.
Oddly enough, I can't find a *nix command which will actually rename a
directory. The man pages for mv, rename and such all refer only to
files, not directories.
Paul
--
Paul M. Foster
--- End Message ---
--- Begin Message ---
On Wed, Sep 9, 2009 at 12:08 AM, Paul M Foster<[email protected]> wrote:
> On Tue, Sep 08, 2009 at 05:39:43PM -0400, Floyd Resler wrote:
>
>> How can I rename a directory with files in it? The rename function
>> gives me a "directory not empty" error. I know I could do it be
>> creating the directory, moving the files, and then deleting the old
>> one. Is there an easier way?
>
> It sounds like, underneath, rename() is creating a new directory and
> then attempting to delete the old one, ignoring the files in the
> original directory. In which case, you'll have to do it the long way--
> create a new directory, move the files, then delete the old directory.
>
> Oddly enough, I can't find a *nix command which will actually rename a
> directory. The man pages for mv, rename and such all refer only to
> files, not directories.
>
> Paul
>
> --
> Paul M. Foster
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
mv renames directories fine:
$ mkdir bar
$ touch bar/randomfile
$ mv bar foo
$ ls foo
randomfile
:)
--- End Message ---
--- Begin Message ---
On Wed, 2009-09-09 at 00:08 -0400, Paul M Foster wrote:
> On Tue, Sep 08, 2009 at 05:39:43PM -0400, Floyd Resler wrote:
>
> > How can I rename a directory with files in it? The rename function
> > gives me a "directory not empty" error. I know I could do it be
> > creating the directory, moving the files, and then deleting the old
> > one. Is there an easier way?
>
> It sounds like, underneath, rename() is creating a new directory and
> then attempting to delete the old one, ignoring the files in the
> original directory. In which case, you'll have to do it the long way--
> create a new directory, move the files, then delete the old directory.
>
> Oddly enough, I can't find a *nix command which will actually rename a
> directory. The man pages for mv, rename and such all refer only to
> files, not directories.
>
> Paul
>
> --
> Paul M. Foster
>
That's because in *nix, everything is a file. Directories, devices, all
have file interfaces.
Thanks,
Ash
http://www.ashleysheridan.co.uk
--- End Message ---
--- Begin Message ---
Nope, nothing wrong with that at all. Just didn't think of it!
Thanks!
Floyd
On Sep 8, 2009, at 5:46 PM, Eddie Drapkin wrote:
On Tue, Sep 8, 2009 at 5:39 PM, Floyd Resler<[email protected]>
wrote:
How can I rename a directory with files in it? The rename function
gives me
a "directory not empty" error. I know I could do it be creating the
directory, moving the files, and then deleting the old one. Is
there an
easier way?
Thanks!
Floyd
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Is there something wrong with `system("mv $oldName $newName");` ?
--- End Message ---
--- Begin Message ---
Sorry for the lag.
Daevid Vincent a écrit :
OP ?
Original Poster
Thanks :)
Blah blah blah.
I've used this code for about 6 years now and have yet to find emails that
it didn't work for. If someone has some funky (whacky) RFC extremity, then
so be it. That's their problem. Most people have NORMAL emails that follow
the above.
I faced a professionnal issue because of a lazy programmer (a Delphi
component that was not aware about "Toto man"@example.com). What you
consider normal e'mail is a subset that is not interoperable. And I hate
that.
But you are correct, I have revised it to be a little more forgiving of some
allowed characters...
preg_replace("/([\w\.\-...@[\w\.\-_]+\.\w{2,6})/i",
You can revised your regex to fit to the new kind of email. But it is
smarter to use the right tool (like filter_vars).
Yeah, I know, I feel like some spanish windmill hunter.
--
Mickaël Wolff aka Lupus Michaelis
http://lupusmic.org
--- End Message ---
--- Begin Message ---
On Wed, Sep 09, 2009 at 03:22:25AM +0200, Lupus Michaelis wrote:
> Sorry for the lag.
>
> Daevid Vincent a écrit :
>>> OP ?
>>
>> Original Poster
>
> Thanks :)
>
>> Blah blah blah.
>> I've used this code for about 6 years now and have yet to find emails that
>> it didn't work for. If someone has some funky (whacky) RFC extremity, then
>> so be it. That's their problem. Most people have NORMAL emails that follow
>> the above.
> I faced a professionnal issue because of a lazy programmer (a Delphi
> component that was not aware about "Toto man"@example.com). What you
> consider normal e'mail is a subset that is not interoperable. And I hate
> that.
>
>> But you are correct, I have revised it to be a little more forgiving
> of some
>> allowed characters...
>>
>> preg_replace("/([\w\.\-...@[\w\.\-_]+\.\w{2,6})/i",
> You can revised your regex to fit to the new kind of email. But it is
> smarter to use the right tool (like filter_vars).
>
> Yeah, I know, I feel like some spanish windmill hunter.
I'm not sure it's well known on this list, but one resource I use for
regexps is:
http://www.regexlib.com/
Paul
--
Paul M. Foster
--- End Message ---
--- Begin Message ---
thanks, Devendra, that's pretty much the same as my handler. (though i can't
figure Rich Smith's $sess_save_path global. do you know what is for?)
but what i'm really interested in is people's experience in switching over
to and using this kind of handler: pitfalls, gotchas, etc. or is it really
as easy and simple as all these online articles i've read about it claim?
or is that experience so hard won that people aren't keen to share it?
-tom
On 9/8/09 2:23 PM, "Devendra Jadhav" <[email protected]> wrote:
> http://www.devshed.com/c/a/PHP/Storing-PHP-Sessions-in-a-Database/
>
>
> On Tue, Sep 8, 2009 at 10:53 PM, Tom Worster <[email protected]> wrote:
>
>> questions for those of you with a user session handler using mysql:
>>
>> did you write your own handler, write one based off some other you found
>> (if
>> so, which?), or are you using some available library (if so, which?)?
>>
>> and how do you feel about your implementation? satisfied? or are there
>> improvements you'd like to have?
>>
>> and what serializer do you use?
>>
>> i have my own set of handler functions (less than 70 loc) which seem to
>> work
>> in simple testing. but, while i'd really like to have the sessions in the
>> db
>> for redundancy, i haven't had the courage to deploy it yet. i derived the
>> code from something i found on the web. i trust everything i read on the
>> internet ;-)
>>
>> -tom
>>
>>
>>
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>
--- End Message ---
--- Begin Message ---
I'm our case we opt for memcache to store the sessions
Mmc its soo much faster and you will have less net overhead because
the simple protocol
Also the configuration its easier. If you see in the php manual you
only need to touch two lines in the php.ini
On 9/8/09, Tom Worster <[email protected]> wrote:
> thanks, Devendra, that's pretty much the same as my handler. (though i can't
> figure Rich Smith's $sess_save_path global. do you know what is for?)
>
> but what i'm really interested in is people's experience in switching over
> to and using this kind of handler: pitfalls, gotchas, etc. or is it really
> as easy and simple as all these online articles i've read about it claim?
>
> or is that experience so hard won that people aren't keen to share it?
>
> -tom
>
> On 9/8/09 2:23 PM, "Devendra Jadhav" <[email protected]> wrote:
>
>> http://www.devshed.com/c/a/PHP/Storing-PHP-Sessions-in-a-Database/
>>
>>
>> On Tue, Sep 8, 2009 at 10:53 PM, Tom Worster <[email protected]> wrote:
>>
>>> questions for those of you with a user session handler using mysql:
>>>
>>> did you write your own handler, write one based off some other you found
>>> (if
>>> so, which?), or are you using some available library (if so, which?)?
>>>
>>> and how do you feel about your implementation? satisfied? or are there
>>> improvements you'd like to have?
>>>
>>> and what serializer do you use?
>>>
>>> i have my own set of handler functions (less than 70 loc) which seem to
>>> work
>>> in simple testing. but, while i'd really like to have the sessions in the
>>> db
>>> for redundancy, i haven't had the courage to deploy it yet. i derived the
>>> code from something i found on the web. i trust everything i read on the
>>> internet ;-)
>>>
>>> -tom
>>>
>>>
>>>
>>>
>>> --
>>> PHP General Mailing List (http://www.php.net/)
>>> To unsubscribe, visit: http://www.php.net/unsub.php
>>>
>>>
>>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
Sent from my mobile device
Gabriel Sosa
Si buscas resultados distintos, no hagas siempre lo mismo. - Einstein
--- End Message ---
--- Begin Message ---
> -----Original Message-----
> From: Tom Worster [mailto:[email protected]]
> Sent: 09 September 2009 02:29
>
> thanks, Devendra, that's pretty much the same as my handler. (though
> i can't
> figure Rich Smith's $sess_save_path global. do you know what is
> for?)
I think if you look at the comments on that article, he's agreed that's an
error and shouldn't be there.
> but what i'm really interested in is people's experience in
> switching over
> to and using this kind of handler: pitfalls, gotchas, etc. or is it
> really
> as easy and simple as all these online articles i've read about it
> claim?
I moved from a single server to a load-balanced setup with 2 back-end servers.
I switched to a database-based session handler very similar to the one under
discussion (just tailored to my house style, really) and it just worked. Been
running happily in production for about 6 months now.
Cheers!
Mike
--
Mike Ford,
Electronic Information Developer, Libraries and Learning Innovation,
Leeds Metropolitan University, C507, Civic Quarter Campus,
Woodhouse Lane, LEEDS, LS1 3HE, United Kingdom
Email: [email protected]
Tel: +44 113 812 4730
To view the terms under which this email is distributed, please go to
http://disclaimer.leedsmet.ac.uk/email.htm
--- End Message ---
--- Begin Message ---
Ben,
My solution was to add a table to my database, and add an insert job id
into the table after the line that is causing the problem. When I submit
the script I use setTimeout to run an AJAX query of the table 5 seconds
later. If the line has failed the job id will not be in the table and I
alert the user. It works - and some day I hope to fix the software
problem and make this unnecessary.
Thanks,
Jim
Ben Dunlap wrote:
On Fri, Sep 4, 2009 at 2:38 PM, jim white <[email protected]
<mailto:[email protected]>> wrote:
It's a web app that draws maps in a browser. Sometime it will
generate a seg fault. The command should not take long, so if
there is some script construct that will throw an exception after
a few seconds if the command has not completed I could signal the
user that the map will not draw and to reload the page.
There's a pecl extension called Libevent that can apparently trigger
an action to occur after a certain amount of time has elapsed:
http://us3.php.net/manual/en/ref.libevent.php
I've not used it and have no idea how mature or reliable it is. I'm
also wondering whether any solution will work that relies on the same
script that's about to trigger a segfault.
I think I'd be inclined to build an XHR-based monitor to run in the
user's browser. Even simpler would be to start the map-building
process asynchronously with XHR and then just alert the user, or
automatically refresh the browser, if a certain amount of time elapses
before you get a response from the map-building script. But I don't
know how much you'd have to alter your existing client-side code to
use the latter method.
Either way it's creeping away from PHP so maybe I should leave it at that.
Ben
--- End Message ---
--- Begin Message ---
Hiya,
I'm writing an app that let's my client upload images, the image html
code is added to an XML file.
Take a look at the <image> element below:
<item Code="e1022">
<code>e1022</code>
<image><![CDATA[<img src="uploads/image2.jpg" alt="Homepage
Image" width="124" height="70" />]]></image>
<name>Blue Ski Trousers</name>
<price>8.99</price>
</item>
Now, whenever PHP writes this to the XML files, it turns the < and >
into < and > . which means it does not display on the webpage.
How can I prevent this from happening ?
Many thanks,
Matt
--- End Message ---
--- Begin Message ---
thank you
--- End Message ---