- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
First Post. Do I win a prize?
Admin
No.
<:o)
Admin
No, only the general loathing of everyone else
Admin
Why not LUROUC! Let us reinvent our own code. A heck of a lot more pronounceable.
Admin
Haven't used any VB based languages for a while, but is it me or will line 2 cause the function to always return false? Could be your typo
Admin
Brillant! The FileSystem object in VB is actually very resource-intensive so its probably best to just always return false instead of actually checking. Besides that, the complete reinventing of an already existing system function is nice as well. Other key features are the fact that actually attempts to open the file to check to see if its open which will double processing time. This thing probably works great on large files.
--The Dan
Admin
In VB, the function name itself is used just like any other variable, so its value can be changed later in the code. In this case, the value is changed to true five lines down.
Admin
The name of the method is wrong; it does not only check if the file exists, but also if it can be opened. Opening an existing file can possibly fail for various reasons (missing privileges etc.)
Admin
Admin
I sit corrected[:)]
Admin
Suggestion:
IHBLRIA ("Ih - bil - ree - uh")
WTF: The code truly sucks. Thanks. Every time I think I suck, I like to look at these. Then I think I'm awesome.
Admin
Shouldn't it be...
-ds
<p>
Admin
Oh that's ugly...let me try again
-ds
Admin
DAMMIT
Function FrontPage_FileExists(fspath)
FrontPage_FileExists = False
Set fs = CreateObject("Scripting.FileSystemObject")
If IsTrue(fs.FileExists(fspath) Then
FrontPage_FileExists = True
Else
FrontPage_FileExists = FileNotFound
End If
Set fs = Nothing
End Function
Admin
You almost had it...
Function FrontPage_FileExists(fspath)FrontPage_FileExists = False
Set fs = CreateObject("Scripting.FileSystemObject")
If IsTrue(fs.FileExists(fspath)) Then
FrontPage_FileExists = True
ElseIf IsTrue(fs.FileExists(fspath)) = False Then
FrontPage_FileExists = False
Else
FrontPage_FileExists = FileNotFound
End If
Set fs = Nothing
End Function
$10 says this doesn't show up right in the forum...
Admin
Doesn't always just return false, and isn't checking to see if a file is open...
While it is a WTF, your response is just as bad if not worse.
Admin
Oddly enough, I was trying to come up with a pronunciation as I read it, before I got to the comments about pronunciation.
I came up with ib-LAIR-ee-ah, which sounds like hysteria.
Admin
$10 please
Admin
Perhaps the Anonymous poster meant to say 'Other key features are the fact that actually attempts to open the file to check to see if it exists which will double processing time.' If that's the case, then their assessment isn't so bad. The use of "its" instead of "it's," however, deserves a BLAM.
Oh, and let's see if this post is
Admin
OK, no pizza for me. Perhaps I shouldn't bother trying in Firefox on Linux.
Admin
You are being a bit harsh here Alex. It isn't really a wtf, is it?
I admit, it's just bad code, it's not efficient, it allready exists in the standard libraries, and so on, but a true wtf makes me want to drop my jaw on the desk and scream "What The Fuck!".
If you guys have ever managed a vba or vb application at some time in the past, you have without a doubt encountered code like this. In fact, it's probably all over the place. This is sort of on par with the level of the vb programmers out there.
Admin
Actually, considering its FrontPage, I think your first two posts are more accurate.
Admin
I have tried everything and can't get it to work. It's one of the best kept secrets of the forum. [pi]
Admin
Gerben Rampaart: What more do you need to call this a WTF? You admitted it's bad code, inefficient, replaces a function that already exists in the object library that it accesses on its own... worst of all (for me anyways) is that this is auto-generated code! If some VB newbie punched this one out, then yeah maybe it's not so bad. But MS created FrontPage, and they aren't properly using the FileSystemObject library, which is also an MS creation!
Admin
My memory is a bit hazy around old ASP, but I do remember pre-3.0 ASP did not have a lot of library methods implemented. Some of the omissions were so glaring they left you scratching your head in disbelief. I don't remember anything specific from those days beyond my daily bewilderment, so I couldn't say for sure. But it is possible (albeit highly unlikely) that FileExists was not yet implemented when this piece of code was written.
Admin
I'm know this as NIH syndrome.. ("Not Invented Here" so we don't like/trust it...)
Admin
Doesnt FileExists = False meand the file doesnt exist? So its the same as FileNotFound?
So..
Function FrontPage_FileExists(fspath)
Set fs = CreateObject("Scripting.FileSystemObject")
FrontPage_FileExists = fs.FileExists(fspath)
Set fs = Nothing
End Function
Admin
...I think its asdf non-usage stems from the fact that IHBLRIA is completely unpronounceable...
and
...that they are pronounceable or, at a bare minimum, contain the letter X...
please.
Admin
I don't see the problem.
The only improvement I could suggest would be to rename the function:
FrontPage_ <br> FSOIsAccessible_<br> AndFileExists_ <br> AndFileIsReadableByThisUser_ <br> AndFileIsNotLocked_ <br> AndNothingElseIsWrongLikeTheNetworkBeingDownOrSomething <br> (fspath)
Admin
Haha. No asdf there.
Admin
You must have missed yesterday's post.
Admin
Please send my $10 to the American Red Cross thanks!
[pi]
Admin
It's as easy as... well... pie.
[image]
Seriously though, it requires IE for the way I figured it out. Select the picture, or just right click on it and copy. Then you can paste it into the posting text box.
Admin
Some people are easily offended if others try to pronounce acronyms. So I'd suggest a conservative "I age bee el err I 'ey".
Admin
You mean copy an "already posted" pizza icon? That's a little klugey. If that's the only way to do it, I'd love to know two things. What's the purpose of this fancy list of icons it if you can't select from there and how did the first pizza poster get it to work?
Admin
pi
Admin
Annoying, heh. Well drag and drop seemed to work, but then I tried to insert some text and maybe messed it up, trying again. (Preview would be a nice feature too)
Admin
I wasn't saying that I'm betting $10. Heavens no, gambling is illegal in my home state. I was just saying that I have a $10 bill with a negative attitude.
Admin
Yeah, it's a kludge.
As far as how the first poster got it to work is kind of philosophical question, don't you think? Kind of a chicken and egg question. Some say that it gradually changed over millions of years from a simple punctuation mark like the period, while others propose that it sprang to life relatively recently.
<font size="1">Or the first guy just used the <img src="pizza pic url"> hack.</font>
Admin
XWRL: eXtensible Wheel Reinvention Language.
It's too bad these guys never knew about the FileNotFound paradigm, because I bet it could have saved them a lot of rewritten code. [I]
Admin
Please make it out to "CASH" and send to:
PO Box 10012
Jersey City NJ 07307
Thanks,
-dave-
Admin
or try Make Old New Everywhere Y'all... (y'think frontpage was paid-by-the-line?)
Admin
Hrmm. I suppose a quick glance at the scrollbar would have indicated that this probably wasn't the first post to make this joke.
My appologies =)
-dave-
Admin
good job!
[pi][pi]
Admin
nope, bad job, just like almost everyone else.
Admin
This is not unique to vb programmers. We had someone fresh out of college writing several lines in C++ using istream because he never learned the access function in school.
Admin
I hate when people add the silly "set xx = Nothing" lines to their code one or two instructions before the variable goes out of scope .....
Admin
Having seen pages made in FrontPage, I can safely say you were correct the first two times
Admin
In asp you need to set it to nothing manually:
<nobr class="footer"> http://www.aspfaq.com/2031 <!-- 11,989 requests to date --> created: 2000-08-13 last updated: 2005-03-16 23:36 this article is printer friendly </nobr>
If you have page-level objects and are running IIS 4.0, they are not released at the point in the page where you issue the following command:
set object = nothing
%>
Page-level objects are NOT released until the page goes out of scope. And, according to many reports, the memory is not released completely if the object is *not* explicitly destroyed, as per above.
Admin
<FONT face=Arial color=#000000>If the FileExists() method didn't exist, the simplest solution would </FONT><FONT face=Arial color=#000000>implement a native method, like Dir(). The shortest/simplest/fastest solution is supplied (above). It avoids scripting object creation and deletion.</FONT>