From | Kaleb Michaud <[email protected]> |
To | [email protected] |
Subject | Re: st: Re: Problem with confirm |
Date | Tue, 20 May 2003 13:32:22 -0500 |
I'm a bit confused about this. Either your computer can read a file on the web or it can't, the return code should be dependent upon that at that time (ie. not on internet connection, DNS server, site access, etc).-confirm- is one of the few commands in Stata that does not attempt to access files over the web. We made the decision for it to work the way it does because it cannot be reliably determined whether or not files exist across all web sites.
It would return an error code and you would know you couldn't write there. Just like you couldn't write to a write-protected dir on your computer.Also, what would it mean to type -confirm new file <webfilename>- ?
Ah, now this is the main point. If the site creates a file after the request, then it exists and -confirm file- should return 0 independent of that being what you expected. If an error message occurs, this may not work. This is probably more difficult than what I'm suggesting, but it just seems that -confirm file- loses a lot of usefulness for not having this ability. Especially if it triggers an error after only spotting "http://" in the file name (this is an assumption) since there are so many ways to have web sites mapped as networked drives, etc.Some web sites properly return a '404' error code when a file is requested that does not exist. However, others actually return a file even when the requested file does not exist. This is because web servers and web sites were designed to be read by people, not by Stata.
Now I will probably have to use this workaround code in many more programs instead of -confirm file-. Why? When managing a large databank, we have hundreds of files to manage and to keep up to date. Participants may or may not be on the network so having world-wide access to these files is important and the web makes the most sense for this (just like -net from- can be useful for specific web sites). Depending on the user's location/responsibilities, the path used for these files will change (network, same computer path, website). Lastly, I imagine the code that Stata uses for -net from-, etc would be simpler if -confirm file- worked here as well (does it also use this workaround when it can't find a *.toc file?).As a workaround for Kaleb, he can code tempfile junk capture copy http://www.somesite.com/asdf `junk' if _rc == 601 { ... }
© Copyright 1996–2024 StataCorp LLC | Terms of use | Privacy | Contact us | What's new | Site index |