Re: BBEdit/Interarchy

2005-06-03 Thread Ken Williams


On Jun 3, 2005, at 7:34 AM, Ken Williams wrote:



On Jun 2, 2005, at 10:16 AM, Bill Stephenson wrote:
So I guess what I'm asking is if there a way to get either of these 
apps to upload a file with a new name and rename it after the upload 
is complete with one click. Obviously, this doesn't entirely solve 
the problem, but it does reduce the potential.


Actually, it *would* entirely solve the problem.  Renaming a file is 
an atomic operation, there's no point at which anybody could get a 
partial file.  People still reading the old file would be fine too, 
even if the rename happened while they're in the middle of reading; 
the old file is readable until they close it.


Peter pointed out in a private email that this isn't reliable using 
FTP's rename functionality (if your FTP even supports it) - what I 
meant in the above, though I wasn't clear, was to use /bin/mv on the 
server, not a rename through the FTP connection.


 -Ken



Re: BBEdit/Interarchy

2005-06-03 Thread Bill Stephenson

On Jun 2, 2005, at 10:16 AM, Bill Stephenson wrote:
So I guess what I'm asking is if there a way to get either of these 
apps to upload a file with a new name and rename it after the upload 
is complete with one click. Obviously, this doesn't entirely solve 
the problem, but it does reduce the potential.


Actually, it *would* entirely solve the problem.  Renaming a file is 
an atomic operation, there's no point at which anybody could get a 
partial file.  People still reading the old file would be fine too, 
even if the rename happened while they're in the middle of reading; 
the old file is readable until they close it.


Peter pointed out in a private email that this isn't reliable using 
FTP's rename functionality (if your FTP even supports it) - what I 
meant in the above, though I wasn't clear, was to use /bin/mv on the 
server, not a rename through the FTP connection.


 -Ken




Thank you to everyone for the help.

Peter provided a great explanation about why FTP is not suited for this 
problem. I played with the Applescript Script Recorder and didn't get 
too far, there may be a way to use Applescript, I just don't know much 
about it.


Here's what I did come up with to make this easier for me..

Open the file from the remote server with BBEdit.
Use the Save a Copy to FTP Server menu command and save the file with 
a new name


Then I wrote this cgi script on the remote server to chmod and rename 
the file...

===
#!/usr/bin/perl

use strict;
use warnings;
use CGI;
use CGI::Carp('fatalsToBrowser');

my $Q = new CGI;

print $Q-header;

print $Q-start_html;

my $mode = 0755;

chmod $mode, 'app.cgi-new' or die (Error 1: $!);

rename(app.cgi-new,app.cgi) or die(Error 2: $!);

print All Done;

print $Q-end_html;
===

This isn't as good as I'd like, but it's easier than what I did before.

I know this solution now takes this pretty much way OT and so I 
apologize...


Kindest Regards,

--
Bill Stephenson



Re: Net::FTP on Tiger

2005-06-03 Thread Iyanaga Nobumi

Hello Morbus, Chris and Ray,

Thank you very much for all your help.  Now, all my scripts seem to  
work again.  And I am surer about my Firewall setting.


Thank you again!

Best regards,

Nobumi Iyanaga
Tokyo,
Japan



Re: BBEdit/Interarchy

2005-06-03 Thread Peter N Lewis

At 7:39 +0900 4/6/05, Joel Rees wrote:

On 2005.6.4, at 04:31 AM, Ken Williams wrote:
Actually, it *would* entirely solve the problem.  Renaming a file 
is an atomic operation, there's no point at which anybody could 
get a partial file.  People still reading the old file would be 
fine too, even if the rename happened while they're in the middle 
of reading; the old file is readable until they close it.


Peter pointed out in a private email that this isn't reliable using 
FTP's rename functionality


I'd like a peek at what he wrote, if nobody minds.


Sorry, I was trying to reduce the noise as we drift further and 
further off topic, but it seems ti just added more.


At 23:27 +0800 3/6/05, Peter N Lewis wrote:
We're getting a bit too esoteric to continue on the list, but this 
depends on the FTP server allowing rename/overwrite, which is far 
from guaranteed, even under unix.  There are quite a few FTP servers 
which will give an error in that case, so you would need to delete 
the file first and then rename, destroying the atomicness of the 
operation.


 (if your FTP even supports it) - what I meant in the above, though 
I wasn't clear, was to use /bin/mv on the server, not a rename 
through the FTP connection.


Now, I wouldn't want to stir too much oil into the water, but I'm 
imagining strange things like, ssh would not have such problems 
(assuming you knew that the server was a regular *NIX server and the 
server's file system was a system with proper inodes)?


Yes, presuming you ssh in, and then apply the old permissions to the 
new file and then do a mv (much like the script Bill ended up 
writing), you'd be safe for at least the mainstream unix systems I 
would think.


Enjoy,
   Peter.

--
http://www.stairways.com/  http://download.stairways.com/