- 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
While this is terrible code.. you should just fix it. Monkey see monkey do (both good and bad).
Admin
Regarding:
I recognize this. It is one of the favorite datatype of contractors called the Stringtinger!
Admin
Muphrie's Law?
Admin
MS SQL Server has some problems caching data execution plan or something like that when you have complex query containing lots of
@ID = 0 OR table.ID = @ID
I once made a query like in the post, which took about a second to execute in the original form, but with @query += ... thingie it took less than 100ms.
Something to do with caching or query planning, can't really remember what it was.
Admin
+1 This is the reason why I wake up every morning and go doing this job
Admin
Ahh, that reminds me of my favorite PHP function :)))) I've spent hours laughin at this beauty :)
Admin
Really? I'd be finding another job if I was told that, since it would seem PROGRAMMERS were incapable of reading CODE if that were the mandate!
Admin
Wow. could at least use String.Empty
Admin
None of that code makes any sense.
What you describe didn't work because VB6 doesn't have an += operator. Fancy that.
Admin
As someone who never did any VB, the real WTF for me is that = means both equals and assignment. So I just had to test if this code was valid vb.net:
Dim var1, var2, var3 var1 = "test" var2 = "test" var3 = var1 = var2 Response.Write var3
returns true
It actually works! How incredibly stupid is that!
Admin
Not at all?
Admin
I have a comment about this kind of code in VB
I ran into a case where True was not True. We had a class which was serialized from a file that had been written by another program. One was VB6 and the other was .NET (I don't remember which was which). The program that wrote the file had written 1 for true and 0 for false. The other program read the 1 into the variable using some Marshal functions (the file was a flat-binary file).
This resulted in SomeVariable -- which was boolean -- holding the value of 1. If you moused-over it in the debugger, the debugger would tell you the value was True. But if you stepped through the code it would call SomethingElse. This took a while to figure out because the debugger was telling me one thing and doing another.
The real problem (well, limited to the scope of fixing this bit of code and not the code that read it in the first place), was that CInt(True) = -1. So, even though SomeVariable claims to be True, it's really 1 which is NOT the same as True.
But if it had been
it worked fine.