Re: CFFILE Delete then WRITE issue....

2001-01-10 Thread Wallace Randall

Have you attempted to re-name the file and then delete it.  That may prevent
the delay in actually deleting the file from interfering with your re-write
of the original file name.


- Original Message -
From: [EMAIL PROTECTED]
To: "CF-Talk" [EMAIL PROTECTED]
Sent: Tuesday, January 09, 2001 11:53 AM
Subject: CFFILE Delete then WRITE issue



 OK.  I am having a problem here.  I am able to DELETE a file with CFFILE
 without a problem, but when I try to almost immediately WRITE the same
file
 back it tells me there is an issue with the file "Error: The file could
not
 be accessed."  Has anyone encountered this before?  When I check on the
 server for the file, what once was a 500k file, is now only 500 bytes, but
 when I try to open it there it tells me that the "file could not be
found."
 But it exists.  And then I have to wait a while to get the OS to release
 it.  I check it 24 hours later (because I am working on other things too,
 and I so sleep some), and it works fine.  I think this is an issue if
 someone tries to OPEN the file instead of SAVING it.  So the second
 question is is there a way to force someone to DOWNLOAD the file instead
of
 opening it?

 Also, when I browse that directory in CF Studio, the file name has a RED
 DOT to the left, and I have never seen this before.

 Any help would be MOST appreciated.

 Vance Duke
 Cold Fusion Application Developer
 i2 Technologies
 (469) 357-4729




~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



RE: CFFILE Delete then WRITE issue....

2001-01-09 Thread Raymond Camden

I think your running into the IIS 'feature' that locks files for you. This
'feature' can be disabled, and someone on this list had a good way of
handling it. You should be able to find it in the archives.

===
Raymond Camden, Principal Spectra Compliance Engineer for Allaire

Email   : [EMAIL PROTECTED]
ICQ UIN : 3679482

"My ally is the Force, and a powerful ally it is." - Yoda

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, January 09, 2001 11:53 AM
 To: CF-Talk
 Subject: CFFILE Delete then WRITE issue



 OK.  I am having a problem here.  I am able to DELETE a file with CFFILE
 without a problem, but when I try to almost immediately WRITE the
 same file
 back it tells me there is an issue with the file "Error: The file
 could not
 be accessed."  Has anyone encountered this before?  When I check on the
 server for the file, what once was a 500k file, is now only 500 bytes, but
 when I try to open it there it tells me that the "file could not
 be found."
 But it exists.  And then I have to wait a while to get the OS to release
 it.  I check it 24 hours later (because I am working on other things too,
 and I so sleep some), and it works fine.  I think this is an issue if
 someone tries to OPEN the file instead of SAVING it.  So the second
 question is is there a way to force someone to DOWNLOAD the file
 instead of
 opening it?

 Also, when I browse that directory in CF Studio, the file name has a RED
 DOT to the left, and I have never seen this before.

 Any help would be MOST appreciated.

 Vance Duke
 Cold Fusion Application Developer
 i2 Technologies
 (469) 357-4729




~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



RE: CFFILE Delete then WRITE issue....

2001-01-09 Thread Philip Arnold - ASP

NT has this wonderful habit of not dealing with requests immediately - it
can mean that when you try to write a file it messes up and needs a slight
delay

Pain, but it's lovely M$ software!

Philip Arnold
Director
Certified ColdFusion Developer
ASP Multimedia Limited
T: +44 (0)20 8680 1133

"Websites for the real world"

**
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.
**


 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
 Sent: 09 January 2001 16:53
 To: CF-Talk
 Subject: CFFILE Delete then WRITE issue



 OK.  I am having a problem here.  I am able to DELETE a file with CFFILE
 without a problem, but when I try to almost immediately WRITE the
 same file
 back it tells me there is an issue with the file "Error: The file
 could not
 be accessed."  Has anyone encountered this before?  When I check on the
 server for the file, what once was a 500k file, is now only 500 bytes, but
 when I try to open it there it tells me that the "file could not
 be found."
 But it exists.  And then I have to wait a while to get the OS to release
 it.  I check it 24 hours later (because I am working on other things too,
 and I so sleep some), and it works fine.  I think this is an issue if
 someone tries to OPEN the file instead of SAVING it.  So the second
 question is is there a way to force someone to DOWNLOAD the file
 instead of
 opening it?

 Also, when I browse that directory in CF Studio, the file name has a RED
 DOT to the left, and I have never seen this before.

 Any help would be MOST appreciated.

 Vance Duke
 Cold Fusion Application Developer
 i2 Technologies
 (469) 357-4729




~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



RE: CFFILE Delete then WRITE issue....

2001-01-09 Thread Benjamin S. Rogers

Keep in  mind that though this eliminates most problems, the issue will
still persist. The best way to solve the problem is to use the CFLOCK tag.

Benjamin S. Rogers
Web Developer, c4.net
voice: (508) 240-0051
fax: (508) 240-0057

-Original Message-
From: Chris Terrebonne [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, January 09, 2001 12:09 PM
To: CF-Talk
Subject: Re:CFFILE Delete then WRITE issue


You are encountering file locking errors.  The write is trying to begin
before the delete has released it's lock on the file.  When writing and
deleting, I always rename the file first, then delete the renamed file.
Same for the write.  Write to a temp file, then once the write is complete,
rename that to it's proper name.

Chris
--
Original Message
From: ""[EMAIL PROTECTED]
Subject: CFFILE Delete then WRITE issue
Date: Tue, 09 Jan 2001 10:53:23 -0600


OK.  I am having a problem here.  I am able to DELETE a file with CFFILE
without a problem, but when I try to almost immediately WRITE the same file
back it tells me there is an issue with the file "Error: The file could not
be accessed."  Has anyone encountered this before?  When I check on the
server for the file, what once was a 500k file, is now only 500 bytes, but
when I try to open it there it tells me that the "file could not be found."
But it exists.  And then I have to wait a while to get the OS to release
it.  I check it 24 hours later (because I am working on other things too,
and I so sleep some), and it works fine.  I think this is an issue if
someone tries to OPEN the file instead of SAVING it.  So the second
question is is there a way to force someone to DOWNLOAD the file instead of
opening it?

Also, when I browse that directory in CF Studio, the file name has a RED
DOT to the left, and I have never seen this before.

Any help would be MOST appreciated.

Vance Duke
Cold Fusion Application Developer
i2 Technologies
(469) 357-4729




~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



RE: CFFILE Delete then WRITE issue....

2001-01-09 Thread Vance_Duke


This is great help and I appreciate all this feedback.

Is there an answer to my second question... I think this is an issue if
someone tries to OPEN the file instead of SAVING it.  So the second
question is is there a way to force someone to DOWNLOAD the file instead of
opening it?

This would also help me.

Vance Duke
Cold Fusion Application Developer
i2 Technologies
(469) 357-4729



   

"Benjamin S.   

Rogers"  To: CF-Talk [EMAIL PROTECTED]   

[EMAIL PROTECTED] cc:   

 Subject: RE: CFFILE Delete then WRITE 
issue   
01/09/01   

11:24 AM   

Please 

respond to 

cf-talk

   

   





Keep in  mind that though this eliminates most problems, the issue will
still persist. The best way to solve the problem is to use the CFLOCK tag.

Benjamin S. Rogers
Web Developer, c4.net
voice: (508) 240-0051
fax: (508) 240-0057

-Original Message-
From: Chris Terrebonne [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, January 09, 2001 12:09 PM
To: CF-Talk
Subject: Re:CFFILE Delete then WRITE issue


You are encountering file locking errors.  The write is trying to begin
before the delete has released it's lock on the file.  When writing and
deleting, I always rename the file first, then delete the renamed file.
Same for the write.  Write to a temp file, then once the write is complete,
rename that to it's proper name.

Chris
--
Original Message
From: ""[EMAIL PROTECTED]
Subject: CFFILE Delete then WRITE issue
Date: Tue, 09 Jan 2001 10:53:23 -0600


OK.  I am having a problem here.  I am able to DELETE a file with CFFILE
without a problem, but when I try to almost immediately WRITE the same
file
back it tells me there is an issue with the file "Error: The file could
not
be accessed."  Has anyone encountered this before?  When I check on the
server for the file, what once was a 500k file, is now only 500 bytes, but
when I try to open it there it tells me that the "file could not be
found."
But it exists.  And then I have to wait a while to get the OS to release
it.  I check it 24 hours later (because I am working on other things too,
and I so sleep some), and it works fine.  I think this is an issue if
someone tries to OPEN the file instead of SAVING it.  So the second
question is is there a way to force someone to DOWNLOAD the file instead
of
opening it?

Also, when I browse that directory in CF Studio, the file name has a RED
DOT to the left, and I have never seen this before.

Any help would be MOST appreciated.

Vance Duke
Cold Fusion Application Developer
i2 Technologies
(469) 357-4729




~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



RE: CFFILE Delete then WRITE issue....

2001-01-09 Thread Benjamin S. Rogers

Actually, the feature you are referring to does not have anything to do with
the operating system but rather the Web server. IIS creates handles to files
for fast references.

When you delete a file, you actually delete the file (contrary to what
Philip has suggested). The handle, however, is left open. A separate process
called the cache scavenger routinely goes through and checks to see which
files have been deleted. At this point the handle to the file is deleted and
the file "appears" to be deleted from the file system.

Although the frequency with which the cache scavenger checks file handles
can be adjusted, the performance benefits from this method are great, so it
is not recommended that you alter this setting. This is probably why it is
hidden in the registry. One side note, the cache scavenger is set by default
for something like every 60 seconds. You should not see the file for more
than 60 seconds unless someone has already played with this setting.

Now, as to the original question, is IIS indeed the Web server in question?
If so, is IIS touching the file in-between the write and delete operations?
This would invoke the caching mechanism discussed above. If this is the
case, there is not to much you can do except name the files uniquely. The
CreateUUID() function would probably be overkill: you could probably get
away with the RandRange() function if you are deleting the file immediately.

If the Web server is something other than IIS or IIS is not touching the
file in-between the write and delete operations, then the problem is
elsewhere. Are you always enclosing the CFFILE tag in an exclusive lock
using the CFLOCK tag? Not doing this would cause a whole host of issues, but
I wouldn't really expect the ones you've described.

Benjamin S. Rogers
Web Developer, c4.net
voice: (508) 240-0051
fax: (508) 240-0057


-Original Message-
From: Philip Arnold - ASP [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, January 09, 2001 12:12 PM
To: CF-Talk
Subject: RE: CFFILE Delete then WRITE issue


NT has this wonderful habit of not dealing with requests immediately - it
can mean that when you try to write a file it messes up and needs a slight
delay

Pain, but it's lovely M$ software!

Philip Arnold
Director
Certified ColdFusion Developer
ASP Multimedia Limited
T: +44 (0)20 8680 1133

"Websites for the real world"

**
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.
**


 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
 Sent: 09 January 2001 16:53
 To: CF-Talk
 Subject: CFFILE Delete then WRITE issue



 OK.  I am having a problem here.  I am able to DELETE a file with CFFILE
 without a problem, but when I try to almost immediately WRITE the
 same file
 back it tells me there is an issue with the file "Error: The file
 could not
 be accessed."  Has anyone encountered this before?  When I check on the
 server for the file, what once was a 500k file, is now only 500 bytes, but
 when I try to open it there it tells me that the "file could not
 be found."
 But it exists.  And then I have to wait a while to get the OS to release
 it.  I check it 24 hours later (because I am working on other things too,
 and I so sleep some), and it works fine.  I think this is an issue if
 someone tries to OPEN the file instead of SAVING it.  So the second
 question is is there a way to force someone to DOWNLOAD the file
 instead of
 opening it?

 Also, when I browse that directory in CF Studio, the file name has a RED
 DOT to the left, and I have never seen this before.

 Any help would be MOST appreciated.

 Vance Duke
 Cold Fusion Application Developer
 i2 Technologies
 (469) 357-4729




~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



RE: CFFILE Delete then WRITE issue....

2001-01-09 Thread Benjamin S. Rogers

See my last post for the technical explanations.

If I'm guessing correctly, you are running an NT server with IIS? On the
first page of your application you create a file that the user can then
download? With some subsequent page request, you then delete the file?
However, the file still appears to be in the folder tree and a new one with
the same name cannot be written for some period of time.

If this is the case, then it should not make any difference whether or not
the user is "opening" or "saving" the file. What your probably experiencing
is just the coincidental timing of your requests and the cache scavenger. I
would recommend naming the files uniquely and running your own separate
scheduled task that deletes files nightly that are older than so many hours.

If this is not the case, then you really need to give us a better idea of
what OS, Web server, version of ColdFusion, etc. you are running, as well as
the logic behind the application.

Benjamin S. Rogers
Web Developer, c4.net
voice: (508) 240-0051
fax: (508) 240-0057

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, January 09, 2001 12:43 PM
To: CF-Talk
Subject: RE: CFFILE Delete then WRITE issue



This is great help and I appreciate all this feedback.

Is there an answer to my second question... I think this is an issue if
someone tries to OPEN the file instead of SAVING it.  So the second
question is is there a way to force someone to DOWNLOAD the file instead of
opening it?

This would also help me.

Vance Duke
Cold Fusion Application Developer
i2 Technologies
(469) 357-4729




"Benjamin S.
Rogers"  To: CF-Talk
[EMAIL PROTECTED]
[EMAIL PROTECTED] cc:
         Subject:     RE: CFFILE Delete then
WRITE issue
01/09/01
11:24 AM
Please
respond to
cf-talk






Keep in  mind that though this eliminates most problems, the issue will
still persist. The best way to solve the problem is to use the CFLOCK tag.

Benjamin S. Rogers
Web Developer, c4.net
voice: (508) 240-0051
fax: (508) 240-0057

-Original Message-
From: Chris Terrebonne [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, January 09, 2001 12:09 PM
To: CF-Talk
Subject: Re:CFFILE Delete then WRITE issue


You are encountering file locking errors.  The write is trying to begin
before the delete has released it's lock on the file.  When writing and
deleting, I always rename the file first, then delete the renamed file.
Same for the write.  Write to a temp file, then once the write is complete,
rename that to it's proper name.

Chris
--
Original Message
From: ""[EMAIL PROTECTED]
Subject: CFFILE Delete then WRITE issue
Date: Tue, 09 Jan 2001 10:53:23 -0600


OK.  I am having a problem here.  I am able to DELETE a file with CFFILE
without a problem, but when I try to almost immediately WRITE the same
file
back it tells me there is an issue with the file "Error: The file could
not
be accessed."  Has anyone encountered this before?  When I check on the
server for the file, what once was a 500k file, is now only 500 bytes, but
when I try to open it there it tells me that the "file could not be
found."
But it exists.  And then I have to wait a while to get the OS to release
it.  I check it 24 hours later (because I am working on other things too,
and I so sleep some), and it works fine.  I think this is an issue if
someone tries to OPEN the file instead of SAVING it.  So the second
question is is there a way to force someone to DOWNLOAD the file instead
of
opening it?

Also, when I browse that directory in CF Studio, the file name has a RED
DOT to the left, and I have never seen this before.

Any help would be MOST appreciated.

Vance Duke
Cold Fusion Application Developer
i2 Technologies
(469) 357-4729




~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



RE: CFFILE Delete then WRITE issue....

2001-01-09 Thread Vance_Duke


Sorry I did not elaborate before.  NT 4.0 SP 5, CF 4.0, IIS 4.0.

The Application is Deleting a file if it exists and then writes the file
FRESH.  Then gives the user a link to the CSV file.  After that, the user
can download it, save it, or click another link to regenerate the file.  It
seems to be happening when the user has OPENed the file and then decides to
generate another file that this error occurs.

Like I said before, I can then delete the file when they decide to generate
another file, but when I try to WRITE the new file, within seconds of the
first being deleted, that is when I run into what appears to be a file
header of a 500 bytes and it will not let me write it, access denied.

Vance Duke
Cold Fusion Application Developer
i2 Technologies
(469) 357-4729



   

"Benjamin S.   

Rogers"  To: CF-Talk [EMAIL PROTECTED]   

[EMAIL PROTECTED] cc:   

 Subject: RE: CFFILE Delete then WRITE 
issue   
01/09/01   

11:57 AM   

Please 

respond to 

cf-talk

   

   





See my last post for the technical explanations.

If I'm guessing correctly, you are running an NT server with IIS? On the
first page of your application you create a file that the user can then
download? With some subsequent page request, you then delete the file?
However, the file still appears to be in the folder tree and a new one with
the same name cannot be written for some period of time.

If this is the case, then it should not make any difference whether or not
the user is "opening" or "saving" the file. What your probably experiencing
is just the coincidental timing of your requests and the cache scavenger. I
would recommend naming the files uniquely and running your own separate
scheduled task that deletes files nightly that are older than so many
hours.

If this is not the case, then you really need to give us a better idea of
what OS, Web server, version of ColdFusion, etc. you are running, as well
as
the logic behind the application.

Benjamin S. Rogers
Web Developer, c4.net
voice: (508) 240-0051
fax: (508) 240-0057

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, January 09, 2001 12:43 PM
To: CF-Talk
Subject: RE: CFFILE Delete then WRITE issue



This is great help and I appreciate all this feedback.

Is there an answer to my second question... I think this is an issue if
someone tries to OPEN the file instead of SAVING it.  So the second
question is is there a way to force someone to DOWNLOAD the file instead of
opening it?

This would also help me.

Vance Duke
Cold Fusion Application Developer
i2 Technologies
(469) 357-4729




"Benjamin S.
Rogers"  To: CF-Talk
[EMAIL PROTECTED]
[EMAIL PROTECTED] cc:
             Subject: RE: CFFILE Delete
then
WRITE issue
01/09/01
11:24 AM
Please
respond to
cf-talk






Keep in  mind that though this eliminates most problems, the issue will
still persist. The best way to solve the problem is to use the CFLOCK tag.

Benjamin S. Rogers
Web Developer, c4.net
voice: (508) 240-0051
fax: (508) 240-0057

-Original Message-
From: Chris Terrebonne [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, January 09, 2001 12:09 PM
To: CF-Talk
Subject: Re:CFFILE Delete then WRITE issue


You are encountering file locking errors.  The write is trying to begin
before the delete has released it's lock on the file.  When writing and
deleting, I always rename the file first, then delete the renamed file.
Same for the write.  Write to a temp file, then once the write is complete,

RE: CFFILE Delete then WRITE issue....

2001-01-09 Thread Philip Arnold - ASP

 When you delete a file, you actually delete the file (contrary to what
 Philip has suggested). The handle, however, is left open. A
 separate process
 called the cache scavenger routinely goes through and checks to see which
 files have been deleted. At this point the handle to the file is
 deleted and
 the file "appears" to be deleted from the file system.

I didn't know this - it's always appeared that NT didn't delete the file
immediately but "held" the file - I now know exactly why, but now I do g

Philip Arnold
Director
Certified ColdFusion Developer
ASP Multimedia Limited
T: +44 (0)20 8680 1133

"Websites for the real world"

**
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.
**


~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



RE: CFFILE Delete then WRITE issue....

2001-01-09 Thread Benjamin S. Rogers

 Sorry I did not elaborate before.  NT 4.0 SP 5, CF 4.0, IIS 4.0.

We guessed correctly. :)

 The Application is Deleting a file if it exists and then writes the file
 FRESH.  Then gives the user a link to the CSV file.  After that, the user
 can download it, save it, or click another link to regenerate the file.
It
 seems to be happening when the user has OPENed the file and then decides
to
 generate another file that this error occurs.

Again, I don't see why there would be a difference between opening and
saving the file. Both those operations occur on the client side, not the
server side.

 Like I said before, I can then delete the file when they decide to
generate
 another file, but when I try to WRITE the new file, within seconds of the
 first being deleted, that is when I run into what appears to be a file
 header of a 500 bytes and it will not let me write it, access denied.

The 500 byte file that you see is a placeholder of sorts. It exists for up
to 30 seconds (the default ObjectCacheTTL).

Unfortunately, you will have to adjust your logic to get this application
working properly under IIS. Although I like the concept (and for the most
part, the implementation) of the cache scavenger, it does add a couple steps
to application design in situations such as these.

What I would do is the following:

1) Create a directory that holds all the CSV files and only CSV files.
2) When the user requests the page that creates the CSV file, CFDIRECTORY
the CSV directory and delete anything older than 1 hour or so.
3) Create your new CSV file with a unique name (either the CreateUUID()
function or the RandRange() functions should work fine).

Benjamin S. Rogers
Web Developer, c4.net
voice: (508) 240-0051
fax: (508) 240-0057






"Benjamin S.
Rogers"  To: CF-Talk
[EMAIL PROTECTED]
[EMAIL PROTECTED] cc:
 Subject: RE: CFFILE Delete then
WRITE issue
01/09/01
11:57 AM
Please
respond to
cf-talk






See my last post for the technical explanations.

If I'm guessing correctly, you are running an NT server with IIS? On the
first page of your application you create a file that the user can then
download? With some subsequent page request, you then delete the file?
However, the file still appears to be in the folder tree and a new one with
the same name cannot be written for some period of time.

If this is the case, then it should not make any difference whether or not
the user is "opening" or "saving" the file. What your probably experiencing
is just the coincidental timing of your requests and the cache scavenger. I
would recommend naming the files uniquely and running your own separate
scheduled task that deletes files nightly that are older than so many
hours.

If this is not the case, then you really need to give us a better idea of
what OS, Web server, version of ColdFusion, etc. you are running, as well
as
the logic behind the application.

Benjamin S. Rogers
Web Developer, c4.net
voice: (508) 240-0051
fax: (508) 240-0057

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, January 09, 2001 12:43 PM
To: CF-Talk
Subject: RE: CFFILE Delete then WRITE issue



This is great help and I appreciate all this feedback.

Is there an answer to my second question... I think this is an issue if
someone tries to OPEN the file instead of SAVING it.  So the second
question is is there a way to force someone to DOWNLOAD the file instead of
opening it?

This would also help me.

Vance Duke
Cold Fusion Application Developer
i2 Technologies
(469) 357-4729




"Benjamin S.
Rogers"  To: CF-Talk
[EMAIL PROTECTED]
[EMAIL PROTECTED] cc:
             Subject: RE: CFFILE Delete
then
WRITE issue
01/09/01
11:24 AM
Please
respond to
cf-talk






Keep in  mind that though this eliminates most problems, the issue will
still persist. The best way to solve the problem is to use the CFLOCK tag.

Benjamin S. Rogers
Web Developer, c4.net
voice: (508) 240-0051
fax: (508) 240-0057

-Original Message-
From: Chris Terrebonne [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, January 09, 2001 12:09 PM
To: CF-Talk
Subject: Re:CFFILE Delete then WRITE issue


You are encountering file locking errors.  The write is trying to begin
before the delete has released it's lock on the file.  When writing and
deleting, I always rename the file first, then delete the renamed file.
Same for the write.  Write to a temp file, then once the write is complete,
rename that to it's proper name.

Chris

RE: CFFILE Delete then WRITE issue....

2001-01-09 Thread Vance_Duke


I see the merit to these suggestions.  But, unfortunately this only works
around the problem and does not fix it.

 The 500 byte file that you see is a placeholder of sorts. It exists for
up
to 30 seconds (the default ObjectCacheTTL).

The files are remaining for what looks like about 1 to 2 hours.

 1) Create a directory that holds all the CSV files and only CSV files.
 2) When the user requests the page that creates the CSV file, CFDIRECTORY
the CSV directory and delete anything older than 1 hour or so.

There is CSV directory already and all it holds are the 2 CSV's that can be
created.  The problem with giving them unique names, is that then we would
need to educate the user community on how to import that CSV since the
program they have is looking for a specific name.  Therefore we were trying
to keep it the same name that the application will be looking for.

Again, these are great suggestions, but I want to know if this can be
fixed.

Is there a way to FORCE download and not give an option to OPEN?

Vance Duke
Cold Fusion Application Developer
i2 Technologies
(469) 357-4729



   

"Benjamin S.   

Rogers"  To: CF-Talk [EMAIL PROTECTED]   

[EMAIL PROTECTED] cc:   

 Subject: RE: CFFILE Delete then WRITE 
issue   
01/09/01   

12:54 PM   

Please 

respond to 

cf-talk

   

   





 Sorry I did not elaborate before.  NT 4.0 SP 5, CF 4.0, IIS 4.0.

We guessed correctly. :)

 The Application is Deleting a file if it exists and then writes the file
 FRESH.  Then gives the user a link to the CSV file.  After that, the user
 can download it, save it, or click another link to regenerate the file.
It
 seems to be happening when the user has OPENed the file and then decides
to
 generate another file that this error occurs.

Again, I don't see why there would be a difference between opening and
saving the file. Both those operations occur on the client side, not the
server side.

 Like I said before, I can then delete the file when they decide to
generate
 another file, but when I try to WRITE the new file, within seconds of the
 first being deleted, that is when I run into what appears to be a file
 header of a 500 bytes and it will not let me write it, access denied.

The 500 byte file that you see is a placeholder of sorts. It exists for up
to 30 seconds (the default ObjectCacheTTL).

Unfortunately, you will have to adjust your logic to get this application
working properly under IIS. Although I like the concept (and for the most
part, the implementation) of the cache scavenger, it does add a couple
steps
to application design in situations such as these.

What I would do is the following:

1) Create a directory that holds all the CSV files and only CSV files.
2) When the user requests the page that creates the CSV file, CFDIRECTORY
the CSV directory and delete anything older than 1 hour or so.
3) Create your new CSV file with a unique name (either the CreateUUID()
function or the RandRange() functions should work fine).

Benjamin S. Rogers
Web Developer, c4.net
voice: (508) 240-0051
fax: (508) 240-0057






"Benjamin S.
Rogers"  To: CF-Talk
[EMAIL PROTECTED]
[EMAIL PROTECTED] cc:
         Subject:     RE: CFFILE Delete
then
WRITE issue
01/09/01
11:57 AM
Please
respond to
cf-talk






See my last post for the technical explanations.

If I'm guessing correctly, you are running an NT server with IIS? On the
first page of your application you create a file that the user can then
download? With some subsequent page request, you then delete the file?
However, the file still appears to be in the f

RE: CFFILE Delete then WRITE issue....

2001-01-09 Thread Benjamin S. Rogers

 I see the merit to these suggestions.  But, unfortunately this only works
 around the problem and does not fix it.
 The files are remaining for what looks like about 1 to 2 hours.

Then someone has already been playing in the registry? Take a look at what
the following key is set to:

HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\InetInfo\Parameters\Obj
ectCacheTTL

Here's what Micorsoft has to say about the ObjectCacheTTL:

"This changes the frequency with which the cache scavenger runs. If your
content fits in memory and is largely static, you may even disable the
scavenger by setting it to 0x.
A high ObjectCacheTTL works best for sites with a small number of "popular"
files. If the number of frequently requested files is large, a high
ObjectCacheTTL may not help. Setting this entry high tells IIS to try to
keep unused files open longer. This is useful if you expect these files to
be reused within the TTL period. If you do not expect the files to be reused
often, or the system appears low on resources, use a lower ObjectCacheTTL to
conserve resources. You can also use OpenFileInCache to limit the number of
files IIS will keep open."

 There is CSV directory already and all it holds are the 2 CSV's that can
be
 created.  The problem with giving them unique names, is that then we would
 need to educate the user community on how to import that CSV since the
 program they have is looking for a specific name.  Therefore we were
trying
 to keep it the same name that the application will be looking for.

Is it necessary to delete the file then? Can you just overwrite it? This is
probably the simplest solution of all. I sort of got distracted in the whole
IIS caching thing and forgot to ask whether or not your are able to simply
overwrite the file and whether or not this method works for you?

 Again, these are great suggestions, but I want to know if this can be
 fixed.

This is the nature of the beast. Besides all the various work arounds and
alternative methods I've thrown out, I don't know of a way to disable all
caching performed by the Web server. Perhaps Microsoft's Knowledge Base or
Deja News would provide better answers to these questions.

 Is there a way to FORCE download and not give an option to OPEN?

Again, No, and I do not see how this could affect a file on the server since
it is a client side action.

 Vance Duke
 Cold Fusion Application Developer
 i2 Technologies
 (469) 357-4729

Benjamin S. Rogers
Web Developer, c4.net
voice: (508) 240-0051
fax: (508) 240-0057




"Benjamin S.
Rogers"  To: CF-Talk
[EMAIL PROTECTED]
[EMAIL PROTECTED] cc:
         Subject:     RE: CFFILE Delete then
WRITE issue
01/09/01
12:54 PM
Please
respond to
cf-talk






 Sorry I did not elaborate before.  NT 4.0 SP 5, CF 4.0, IIS 4.0.

We guessed correctly. :)

 The Application is Deleting a file if it exists and then writes the file
 FRESH.  Then gives the user a link to the CSV file.  After that, the user
 can download it, save it, or click another link to regenerate the file.
It
 seems to be happening when the user has OPENed the file and then decides
to
 generate another file that this error occurs.

Again, I don't see why there would be a difference between opening and
saving the file. Both those operations occur on the client side, not the
server side.

 Like I said before, I can then delete the file when they decide to
generate
 another file, but when I try to WRITE the new file, within seconds of the
 first being deleted, that is when I run into what appears to be a file
 header of a 500 bytes and it will not let me write it, access denied.

The 500 byte file that you see is a placeholder of sorts. It exists for up
to 30 seconds (the default ObjectCacheTTL).

Unfortunately, you will have to adjust your logic to get this application
working properly under IIS. Although I like the concept (and for the most
part, the implementation) of the cache scavenger, it does add a couple
steps
to application design in situations such as these.

What I would do is the following:

1) Create a directory that holds all the CSV files and only CSV files.
2) When the user requests the page that creates the CSV file, CFDIRECTORY
the CSV directory and delete anything older than 1 hour or so.
3) Create your new CSV file with a unique name (either the CreateUUID()
function or the RandRange() functions should work fine).

Benjamin S. Rogers
Web Developer, c4.net
voice: (508) 240-0051
fax: (508) 240-0057






"Benjamin S.
Rogers"  To: CF-Talk
[EMAIL PROTECTED]
[EMAIL PROTECTED] cc:
             Subject: RE: CFFILE Delete
then
WRIT