Author |
Topic  |
|
kees2005
Starting Member
3 Posts |
Posted - 07 July 2007 : 17:06:19
|
Hi guys, I try to prevent an 800a003e error. Google helped me find out that this is due to a textfile with a size of 0kb. So I know I have to find out if the file is > 0Kb before it gets loaded. The code should look something like the following, but it doesn't work, so I expect there to be a bug in there :( Anybody can spot the error?
Function getCachedFile(strFileName03) Dim cacheFSO : Set cacheFSO = CreateObject("Scripting.FileSystemObject") Dim Fil : Set Fil = cacheFSO.getFile("xxxx link to file xxxx\" & strFileName03,1,False,0) if Fil.size > 0 then Dim cacheFile : Set cacheFile = cacheFSO.OpenTextFile("xxxx link to file xxxx\" & strFileName03,1,False,0) getCachedFile = cacheFile.ReadAll else Set cacheFile = "File was empty" end if Set Fil = nothing Set cacheFile = Nothing Set cacheFSO = Nothing End Function
Greets Kees
|
|
ILLHILL
Junior Member
 
Netherlands
341 Posts |
Posted - 08 July 2007 : 11:22:57
|
This might help you: http://forum.snitz.com/forum/topic.asp?TOPIC_ID=64936
Seems you found my code there.
Well, this is how my working code looks:
Function getCachedFile(strFileName03) Dim cacheFSO : Set cacheFSO = CreateObject("Scripting.FileSystemObject") Dim fil : Set fil = cacheFSO.getFile("xxxxlinkxxxx" & strFileName03) if fil.size > 0 then Dim cacheFile : Set cacheFile = cacheFSO.OpenTextFile("xxxxlinkxxxx\" & strFileName03,1,0,0) getCachedFile = cacheFile.ReadAll Set cacheFile = Nothing else getCachedFile = "xxxxError Messagexxxx" end if Set fil = Nothing Set cacheFSO = Nothing End Function
Here's where to see it in action: http://www.clppr.com
This one is working without any flaws. The only error I bump into every now and then is this: My system works with caching rss content, sometimes an rss feed is not generated right by the site syndicating this rss feed (think social sites, where the rss is based on user entered entries, meaning non-friendly rss characters might end up in the rss).
As said, the above code is working, your problem might be more a situation where you might need to prevent a txt file being created if the source is 0kb/in error.
I have worked around this in the web app I'm currently building, but never really solved this, due to the fact that the above code displays an error message that (in the case of my web-app) explains what the visitor should do. The only time an error might occur is when a specific person is the one whose visit triggers the caching of an empty rss (all the ones after that one will see the custom error message). (so basically the first visitor after the cache has file has expired)
Hope that helps.
Greets, Dominic
|
CLPPR.com - All The News Only Seconds Away |
Edited by - ILLHILL on 08 July 2007 11:37:57 |
 |
|
ILLHILL
Junior Member
 
Netherlands
341 Posts |
Posted - 12 July 2007 : 15:38:47
|
Hmmm... any mod of admin can look into this? This person literally copied my question and posted it again, while the answers and solution are underneath my actual post. (http://forum.snitz.com/forum/topic.asp?TOPIC_ID=64936)
I just noticed that this person literally copied the topic, while I was under the impression that he just didn't understand or overlooked my topic, but actually everything in this post is word for word copied from what I asked a while ago and then I mean literally.
Very strange
D
|
CLPPR.com - All The News Only Seconds Away |
 |
|
ruirib
Snitz Forums Admin
    
Portugal
26364 Posts |
|
ILLHILL
Junior Member
 
Netherlands
341 Posts |
|
ruirib
Snitz Forums Admin
    
Portugal
26364 Posts |
|
|
Topic  |
|