- 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
Hmm, unregistered?
Admin
I am not sure that is true. I thought VB defined true as -1.
Admin
"This variable be Group 1."
What is it with all the language Nazis on this site?
Admin
It's exactly because stored procedures are compiled that this is not a WTF. This approach compiles the stored procedure two times which doubles the speed of the stored procedure twice. Essentially giving you a 400% gain in efficiency.
Admin
This makes me so happy. It's not every day you get the feeling that you have actually learned something from all the conceptual theories on how to write code.
Admin
Thank you. I needed a laugh
Admin
Even then why not do this:
if @Condition = 1 then
Select * from Table1
else
Select * from Table2
end if
Admin
No, that still only compiles once. This is how you double compile:
Admin
Exactly, someone can post using a registered person's name??? That, truly is the real WTF.
Admin
Yes, it is easy, all you have to do is add a space to the end of the name!!! Check out my name, Spectre!!! Woo-hooooo!!! WTF!!!
Admin
Surely, you can't be serious.
Admin
Admin
sorry, been a long day. Normally edit the quotes better
Admin
I just laughed so hard I scared my boss.
Captcha: veniam : Come to ME!
Admin
Well because if you did that, you'd have a Stored Proc that looks like this:
if @Condition = 1 then
Select * from Table1
else if @Condition = 2 then
Select * from Table2
else if @Condition = 3 then
Select * from Table3
<snip>else if @Condition = 1000 then
Select * from Table1000
end if
Yes, that design was heinous and I am really, really glad that I don't have to deal with that anymore. Someday, I might post something from that job to this site.
Admin
No it won't.
Admin
You're making the assumption that Microsoft programming languages are designed by developers. I wonder...
Admin
LUA is like that, and it drives me nuts
Admin
Two things (not trolling here, but I am a maintenance programmer, so take this with a chunk of salt) regarding the dynamic SQL.
First: the variables may in fact contain eval-able code rather than string data. It's not the best idea, but in a certain kind of shop it makes as much sense to do things this way as any other. In this case, given the converts, it is likely that this was created by a junior developer or a low-q developer copying something written somewhere else, but it can in fact be a valid approach to the problem of needed a very small but still nonzero level of dynamism in a query.
Second: the reason why it's in a stored procedure is that that is Where The Database Stuff Goes under certain architectural approaches. Until you've spent years of your working life maintaining (not writing, solely maintaining) other people's code, it may not be obvious, but this is one way that people limit the amount of screwing around involved in finding particular application components. Call it Tiering Without Mercy.
Admin
I dont remember VB syntax, but it is (almost) the same as:
bGroup = bGroup1 > 0
Admin
It all depends on what you are using bGroup for, perhaps all those "undefined" cases are irrelevant
Admin
"Classes? We don't need no stinking classes!"
You can write FORTRAN programs in any language.
Admin
A quadrupling of efficiency would be a 300% gain in efficiency. Captcha: minim (half note in American English)
Admin
Except THREETRAN, TWOTRAN, ONETRAN, and ZEROTRAN. FORTRAN added extra features that these languages do not have.
Also, they should have called Fortran 90 FIVETRAN.
Admin
Mark, you are correct. VB .NET, VBScript, and VBA/VB6 all use -1 as True. However, when converting from other numeric types, anything other than 0 is treated as True.
They fixed the datatype WTFs, and made it a fully-featured object-oriented language. Yet they left other WTFs in the language and seem to be adding new ones. Makes sense though, given that VB caters to the less skilled.
CAPTCHA: suscipere (that's a word?)
Admin
Admin
There used to be something called GOTRAN, which was a simplified version of FORTRAN II, which ran on an IBM 1620 waaaaaay back in the Dark Ages that probably would qualify as ONETRAN and FORTRAN II, along with its bastard spawn FORTRAN II-D, would definitely qualify as TWOTRAN.
And don't get me started on ALGOL 60. . .
Admin
Admin
Maybe it is in VB.NET, but in VB the expression "" = X where X happens to be Nothing will land you a runtime error 91 ‘Object variable or With block variable not set’. Yes, I tried it. I also like how this thread is full of people bashing VB who obviously can't code in VB. And people who can't code at all, apparently. It always makes me smile how people are so desperate to find and point out more WTFs that they forget that they're not that good at programming themselves.
Admin
Admin
Admin
Hmmmm. Well that's generally because old VB didn't support the syntax of "x+=1" and only supported "x=x+1".
shrug it's VB.
Admin
I think it was something along the lines of "ooh, me knees! The sciatica's playing up, too. You young whippersnappers, you just don't understand the value of a ternary if-expression."
Come to think of it, I don't understand the value of a ternary if-expression, either.
We never did get around to discussing the actual fortran code. There was some degree of bickering as to whether it was intended to be IVe or 77, as I recall. I'm afraid I just had to put the Purdey against the poor old codger's head and let loose with both barrels.
I think it was for the best.
Admin
Sooo. bExcelto1A would translate to "Be excellent to one another!"?
Wyld Stallions!!
Admin
IF (foobar) negative,zero,positive
Admin
Only following "temptare".
Admin
Now I shall go sit corrected.
Admin
While I understand that you weren't first (and hence only) one to comment that this does not do what the original code do, I'll share some insight based on experience from working with other people's code.
Based on the quality of the code in the examples, I very highly doubt that even when separated on the context, the original coder never planned to handle the "case above 2". Based on educated guess, that function might as well go BOOM as soon as the number other than 0-2 entered the scope (I'm speaking of the original code).
When starting to work with the code from someone else, it takes some time to adjust yourself to the level of code. At the level of these examples, it is very unlikely there is something "genious" behind any weird looking structures, rather than just piss-poor expression or design.
On the last comment, of course one NEVER goes to change that code to function differnently without properly examining the entry points and evaluating the risk of actually changing some current behaviour (although it could be broken already).
However I personally try to improve the code like that when I have to touch it or nearby.
Admin
Puhh, newbie poster alert! I forgot to quote the original, hence "double" post to clear out where I was referring to:
While I understand that you weren't first (and hence only) one to comment that this does not do what the original code do, I'll share some insight based on experience from working with other people's code.
Based on the quality of the code in the examples, I very highly doubt that even when separated on the context, the original coder never planned to handle the "case above 2". Based on educated guess, that function might as well go BOOM as soon as the number other than 0-2 entered the scope (I'm speaking of the original code).
When starting to work with the code from someone else, it takes some time to adjust yourself to the level of code. At the level of these examples, it is very unlikely there is something "genious" behind any weird looking structures, rather than just piss-poor expression or design.
On the last comment, of course one NEVER goes to change that code to function differnently without properly examining the entry points and evaluating the risk of actually changing some current behaviour (although it could be broken already).
However I personally try to improve the code like that when I have to touch it or nearby.
Admin
Admin
Aghrr...be it talk like a pirate day once more?
Admin
Congrats, IHBT. Just the right combination of inanity and sounding like you actually meant it.
(Would the real TopCod3r please stand up?)
Admin
Bob said, ' the += assignment operator isn't (and never has been) a feature in basic or visual basic. '
Never say never. BBC BASIC V (1985) had all kinds of assignment operators, including '+='. My personal favourites were '>>=' (arithmetic shift right assign) and '>>>=' (rotate right assign).
Admin
Actually for IE5.0 an undefined value actually contains 'undefined' (ie a string). I don't have IE 5 arount right now to check whether casting to a string would be a valid check.
Not necessarily WTFy.
Admin
Except that generation said SQL -inside a stored procedure- is stupid. If you want to generate SQL like that, you do it in the application and pass it off to the DB after.
Something along those ines...
Admin
You should probably cast that just to make absolutely sure:
If ((bGroup = True) = True) = ((True) True) Then
Admin
So this is what it looks like when the CSI chick makes "a GUI interface using Visual Basic" to "See if I can track an IP"... (http://forums.thedailywtf.com/forums/t/8724.aspx)
Admin
http://en.wikipedia.org/wiki/Ellipse http://en.wikipedia.org/wiki/Ellipsis
Admin
Admin
TRWTF is they use SQL. A file based caching solution can be more efficient.