| « Prev | Page 1 | Page 2 | Next » |
|
First Post. Do I win a prize?
|
No, only the general loathing of everyone else |
|
Why not LUROUC! Let us reinvent our own code. A heck of a lot more pronounceable.
|
|
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 Function FrontPage_FileExists(fspath) |
|
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 |
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. |
|
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.) |
It's you... The "FrontPage_FileExists = True" line will overwrite the false value if the file is found. -ds |
|
I sit corrected[:)]
|
|
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. |
|
Shouldn't it be...
-ds
|
|
Oh that's ugly...let me try again
-ds |
|
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 |
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... |
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. |
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. |
|
$10 please
|
|
OK, no pizza for me. Perhaps I shouldn't bother trying in Firefox on Linux.
|
|
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. |
Re: The Return of IHBLRIA
2005-10-25 14:38
•
by
Anonymous lurker
|
|
Actually, considering its FrontPage, I think your first two posts are more accurate.
|
I have tried everything and can't get it to work. It's one of the best kept secrets of the forum. [pi] |
|
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!
|
|
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. |
|
I'm know this as NIH syndrome.. ("Not Invented Here" so we don't like/trust it...)
|
Doesnt FileExists = False meand the file doesnt exist? So its the same as FileNotFound? So.. Function FrontPage_FileExists(fspath) |
...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. |
|
I don't see the problem.
The only improvement I could suggest would be to rename the function: FrontPage_ \ FSOIsAccessible_\ AndFileExists_ \ AndFileIsReadableByThisUser_ \ AndFileIsNotLocked_ \ AndNothingElseIsWrongLikeTheNetworkBeingDownOrSomething \ (fspath) |
Re: The Return of IHBLRIA
2005-10-25 14:54
•
by
Anonymous Coward's first cousin
|
|
Haha. No asdf there.
|
You must have missed yesterday's post. |
Please send my $10 to the American Red Cross thanks! [pi] |
It's as easy as... well... pie.
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. |
Some people are easily offended if others try to pronounce acronyms. So I'd suggest a conservative "I age bee el err I 'ey". |
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?
|
|
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) |
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. |
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. Or the first guy just used the <img src="pizza pic url"> hack. |
|
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] |
Please make it out to "CASH" and send to: PO Box 10012 Jersey City NJ 07307 Thanks, -dave- |
|
or try Make Old New Everywhere Y'all... (y'think frontpage was paid-by-the-line?)
|
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- |
|
good job! [pi][pi] |
nope, bad job, just like almost everyone else. |
|
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.
|
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 .....
|
Having seen pages made in FrontPage, I can safely say you were correct the first two times |
|
In asp you need to set it to nothing manually:
| ||||||||
FunctionFrontPage_FileExists(fspath As String) As Boolean If the FileExists() method didn't exist, the simplest solution would implement a native method, like Dir(). The shortest/simplest/fastest solution is supplied (above). It avoids scripting object creation and deletion. |
| « Prev | Page 1 | Page 2 | Next » |