Comment On The Return of IHBLRIA

I was a bit disappointed that the acronym IHBLRIA (Invented Here, But Let's Reinvent It Anyway) did not seep into the general techo-nonsense-babble-buzzword lexicon. Rarity doesn't seem to be the problem: today's code (from Manni) is the third case of IHBLRIA I've posted. I think it's non-usage stems from the fact that IHBLRIA is completely unpronounceable. I don't know if I should be saying ib-le-ree-ah (rhyming with, appropriately, diarrhea) or just stumbling with a new pronunciation every time, like i-hib-el-ar-ee (your guess is as good as mine). [expand full text]
« PrevPage 1 | Page 2Next »

Re: The Return of IHBLRIA

2005-10-25 13:36 • by Anonymous Coward
First Post.  Do I win a prize?

Re: The Return of IHBLRIA

2005-10-25 13:38 • by frosty
48013 in reply to 48012
No.

<:o)

Re: The Return of IHBLRIA

2005-10-25 13:38 • by Mikademus
48014 in reply to 48012
Anonymous:
First Post.  Do I win a prize?


No, only the general loathing of everyone else

Re: The Return of IHBLRIA

2005-10-25 13:40 • by AKrotkov
Why not LUROUC! Let us reinvent our own code. A heck of a lot more pronounceable.

Re: The Return of IHBLRIA

2005-10-25 13:41 • by Martin Carolan
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)
On Error Resume Next
FrontPage_FileExists = False
Set fs = CreateObject("Scripting.FileSystemObject")
Err.Clear
Set istream = fs.OpenTextFile(fspath)
If Err.Number = 0 Then
FrontPage_FileExists = True
istream.Close
End If
Set istream = Nothing
Set fs = Nothing
End Function





Re: The Return of IHBLRIA

2005-10-25 13:42 • by TheDan666

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

Re: The Return of IHBLRIA

2005-10-25 13:45 • by limelight
48018 in reply to 48016
Anonymous:
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)
On Error Resume Next
FrontPage_FileExists = False
Set fs = CreateObject("Scripting.FileSystemObject")
Err.Clear
Set istream = fs.OpenTextFile(fspath)
If Err.Number = 0 Then
FrontPage_FileExists = True
istream.Close
End If
Set istream = Nothing
Set fs = Nothing
End Function



 


  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.

Re: The Return of IHBLRIA

2005-10-25 13:46 • by ammoQ
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.)

Re: The Return of IHBLRIA

2005-10-25 13:47 • by DisturbedSaint
48020 in reply to 48016
Anonymous:
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)
On Error Resume Next
FrontPage_FileExists = False
Set fs = CreateObject("Scripting.FileSystemObject")
Err.Clear
Set istream = fs.OpenTextFile(fspath)
If Err.Number = 0 Then
FrontPage_FileExists = True
istream.Close
End If
Set istream = Nothing
Set fs = Nothing
End Function






It's you...

The "FrontPage_FileExists = True" line will overwrite the false value if the file is found.

-ds

Re: The Return of IHBLRIA

2005-10-25 13:52 • by Martin Carolan
48021 in reply to 48020
I sit corrected[:)]

Re: The Return of IHBLRIA

2005-10-25 13:52 • by GreatWhiteDork

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.

Re: The Return of IHBLRIA

2005-10-25 13:55 • by DisturbedSaint
Shouldn't it be...


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


-ds




Re: The Return of IHBLRIA

2005-10-25 13:57 • by DisturbedSaint
48024 in reply to 48023
Oh that's ugly...let me try again


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



-ds

Re: The Return of IHBLRIA

2005-10-25 13:58 • by DisturbedSaint
48025 in reply to 48024
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

Re: The Return of IHBLRIA

2005-10-25 14:02 • by Manni
48027 in reply to 48025

DisturbedSaint:
DAMMIT
...



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...

Re: The Return of IHBLRIA

2005-10-25 14:02 • by Just replying
48028 in reply to 48017
Anonymous:

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





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.

Re: The Return of IHBLRIA

2005-10-25 14:24 • by kipthegreat
Alex Papadimoulis:

I
think it's non-usage stems from the fact that IHBLRIA is completely
unpronounceable. I don't know if I should be saying ib-le-ree-ah
(rhyming with, appropriately, diarrhea) or just stumbling with a new
pronunciation every time, like i-hib-el-ar-ee (your guess is as good as
mine).





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.

Re: The Return of IHBLRIA

2005-10-25 14:25 • by Martin Carolan
48033 in reply to 48027
$10 please

Re: The Return of IHBLRIA

2005-10-25 14:26 • by sinistral
48034 in reply to 48028
Anonymous:
Anonymous:

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





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.




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


Re: The Return of IHBLRIA

2005-10-25 14:27 • by sinistral
48035 in reply to 48034
OK, no pizza for me.  Perhaps I shouldn't bother trying in Firefox on Linux.

Re: The Return of IHBLRIA

2005-10-25 14:28 • by Gerben Rampaart
48036 in reply to 48028

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
48038 in reply to 48025
Actually, considering its FrontPage, I think your first two posts are more accurate.

Re: The Return of IHBLRIA

2005-10-25 14:38 • by Mung Kee
48039 in reply to 48035

sinistral:
OK, no pizza for me.  Perhaps I shouldn't bother trying in Firefox on Linux.


I have tried everything and can't get it to work.  It's one of the best kept secrets of the forum.  [pi]

Re: The Return of IHBLRIA

2005-10-25 14:40 • by Manni
48040 in reply to 48036
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!

Re: The Return of IHBLRIA

2005-10-25 14:42 • by Sean
48041 in reply to 48036
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.

Re: The Return of IHBLRIA

2005-10-25 14:43 • by ByteJuggler
48042 in reply to 48040
I'm know this as NIH syndrome.. ("Not Invented Here" so we don't like/trust it...)

Re: The Return of IHBLRIA

2005-10-25 14:47 • by Rodpheus
48043 in reply to 48027
Manni:

DisturbedSaint:
DAMMIT
...



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...



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

Re: The Return of IHBLRIA

2005-10-25 14:53 • by Anonymous Coward's first cousin
Alex Papadimoulis:

...I think it's non-usage stems from the fact that IHBLRIA is completely unpronounceable...

...that they pronounceable or, at a bare minimum, contain the letter X...






...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.

Re: The Return of IHBLRIA

2005-10-25 14:53 • by Maurits
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
48046 in reply to 48044
Haha. No asdf there.

Re: The Return of IHBLRIA

2005-10-25 15:04 • by DisturbedSaint
48049 in reply to 48043
Anonymous:
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




You must have missed yesterday's post.

Re: The Return of IHBLRIA

2005-10-25 15:06 • by bugsRus
48051 in reply to 48027
Manni:

DisturbedSaint:
DAMMIT
...



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...



Please send my $10 to the American Red Cross thanks!



[pi]

Re: The Return of IHBLRIA

2005-10-25 15:08 • by Ytram
48052 in reply to 48039
Mung Kee:

sinistral:
OK, no pizza for me.  Perhaps I shouldn't bother trying in Firefox on Linux.


I have tried everything and can't get it to work.  It's one of the best kept secrets of the forum.  [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.

Re: The Return of IHBLRIA

2005-10-25 15:16 • by Alexis de Torquemada
Alex Papadimoulis:

I
was a bit disappointed that the acronym IHBLRIA (Invented Here, But
Let's Reinvent It Anyway) did not seep into the general
techo-nonsense-babble-buzzword lexicon. Rarity doesn't seem to be the
problem: today's code (from Manni) is the third case
of IHBLRIA I've posted. I think it's non-usage stems from the fact that
IHBLRIA is completely unpronounceable. I don't know if I should be
saying ib-le-ree-ah (rhyming with, appropriately, diarrhea) or just
stumbling with a new pronunciation every time, like i-hib-el-ar-ee
(your guess is as good as mine).





Some people are easily offended if others try to pronounce acronyms. So I'd suggest a conservative "I age bee el err I 'ey".



Re: The Return of IHBLRIA

2005-10-25 15:21 • by Mung Kee
48054 in reply to 48052
Ytram:
Mung Kee:

sinistral:
OK, no pizza for me.  Perhaps I shouldn't bother trying in Firefox on Linux.


I have tried everything and can't get it to work.  It's one of the best kept secrets of the forum.  [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.



 


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?


 


 

Re: The Return of IHBLRIA

2005-10-25 15:33 • by Scott B.
48056 in reply to 48054
pi

Re: The Return of IHBLRIA

2005-10-25 15:35 • by Scott B.
48057 in reply to 48056
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)



Re: The Return of IHBLRIA

2005-10-25 15:43 • by Manni
48058 in reply to 48051
bugsRus:
Manni:

DisturbedSaint:
DAMMIT
...


...

$10 says this doesn't show up right in the forum...


Please send my $10 to the American Red Cross thanks! [pi]


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.

Re: The Return of IHBLRIA

2005-10-25 16:02 • by Ytram
48059 in reply to 48054
Mung Kee:
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?




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.

Re: The Return of IHBLRIA

2005-10-25 16:10 • by foxyshadis
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]

Re: The Return of IHBLRIA

2005-10-25 16:24 • by vDave420
48062 in reply to 48027
Manni:

$10 says this doesn't show up right in the forum...







Please make it out to "CASH" and send to:



PO Box 10012

Jersey City NJ 07307



Thanks,



   -dave-

Re: The Return of IHBLRIA

2005-10-25 16:24 • by bitz
or try Make Old New Everywhere Y'all...  (y'think frontpage was paid-by-the-line?)



Re: The Return of IHBLRIA

2005-10-25 16:26 • by vDave420
48064 in reply to 48062
vDave420:
Manni:

$10 says this doesn't show up right in the forum...







Please make it out to "CASH" and send to:



PO Box 10012

Jersey City NJ 07307



Thanks,



   -dave-




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-



Re: The Return of IHBLRIA

2005-10-25 17:09 • by AndrewVos
48073 in reply to 48056

good job!


[pi][pi]

Re: The Return of IHBLRIA

2005-10-25 17:15 • by Mung Kee
48075 in reply to 48073
AndrewVos:

good job!


[pi][pi]





nope, bad job, just like almost everyone else.

Re: The Return of IHBLRIA

2005-10-25 17:39 • by Al
48078 in reply to 48036
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.

Re: The Return of IHBLRIA

2005-10-25 17:44 • by Jeff S
48081 in reply to 48043

Anonymous:


Function FrontPage_FileExists(fspath)
    Set fs = CreateObject("Scripting.FileSystemObject")
    FrontPage_FileExists = fs.FileExists(fspath)
    Set fs = Nothing
End Function


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 .....


 

Re: The Return of IHBLRIA

2005-10-25 17:51 • by Lews
48082 in reply to 48024
DisturbedSaint:
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


Having seen pages made in FrontPage, I can safely say you were correct the first two times

Re: The Return of IHBLRIA

2005-10-25 17:52 • by Martin Carolan
48083 in reply to 48081
In asp you need to set it to  nothing manually:










When does ASP release COM objects? 




Page-level 
 
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. 
 

Re: The Return of IHBLRIA

2005-10-25 18:06 • by aikimark
Function FrontPage_FileExists(fspath As String) As Boolean

On Error Resume Next   'not absolutely necessary
FrontPage_FileExists = (Len(Dir(fspath, vbNormal)) <> 0)
End Function

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.

« PrevPage 1 | Page 2Next »

Add Comment