- 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
Visible -- When this Post is read it is Visible Hidden -- When this Post is read it is Hidden FIRST -- When this Post is read it is VeryFIRST
Admin
That's Constable Carrot, thank you very much.
Admin
string sql = "exec spRequestInitechData '"
Sometimes, I can't imagine the thought processes that lead to the WTF. I think it may be scarier when I can.
"We should escape the apostrophes when we build the SQL command, to prevent injection attacks." "Actually, I've heard that the accepted standard is to use stored procedures." "Oh. Hey, I've got an idea. Let's do both! Belt and suspenders, right?" "Brillant!"
Admin
What exactly is wrong with this?
Safe mode == exec. It's not ideal, but it works.
Admin
What, you mean aside from the fact that it's failing to use the mkdir() function?
Admin
Come on, even Excel has VeryHidden data. Nothing wrong with keeping the users out of the icky stuff.
Admin
The "parseStringData()" method isn't that weird.
"replace()" replaces (as its name states) a character with another, but here every '/' is removed; it's not quite the same thing as a replacement.
Sure it could have been better, going through the "char[]" version of the "String" and putting every non '/' character into a "StringBuilder" is way more efficient than using "split()" (which is a regex), but still, it isn't that bad.
Admin
PS: I assumed it was Java code.
Admin
Admin
Actually, hidden/visible/veryhidden is probably akin to the Excel functionality for sheet visibility; when just hidden the sheet is there but you can get it back very easily using the unhide functionality. Veryhidden means it will only be unhidable by use of VBE or the immediate window (both of which you can lock down).
I would imagine the functionality is looking to do something like that; in other words hidden just means from view but accessible through the GUI or app, with an option to unhide; while veryhidden means only code can unhide.
Or maybe the function is part of an Excel library itself?
Admin
So if 'test' exists and is not a dir, a dir named 'test' will be created?
Admin
Only since java 1.5, if you work with an old code (which can happen [really, it happens to me all the time]) this kind of "gem" can be found everywhere.
Admin
When makeing directorys it must be avoideing the "horse race condition" that another user takes you directorie befor you used it. This bug cause hakker joy steel all data etc. Must use current time to create garenteed uneek directorie then rename to 'test' or watever name is reallee wanted. Sum language have function to do this alreadee. Any professional programmeer know this best practic.
Admin
Admin
meh. Seen a lot worse. Until the setting drop down category selection to "I Am Krogan" does something nefariously stupid, all these WTFs are nothing more than a coffee stain on a book in someone else's trash.
Admin
What's the problem with:
public static int EvalToInteger(string statement) { string s = EvalToString(statement); return int.Parse(s.ToString()); }
Note that the supplied string is named "statement"--I would assume EvalToString is doing some sort of evaluation, it doesn't just return what was passed in.
Admin
I miss TopC0der, but you are fun too.
Admin
Anyway, why is it a table? Shouldn't it be XML?
Admin
Admin
This is quite obvious. The requirements changed. Everyone knows only green code needs to be commented. When changing existing code, the intent is already clear so updating the documentation is merely a work avoidance technique.
Admin
Maybe so, but s.ToString() is redundant, and what's left is simple enough that you might want to compact it into one line:
Still, if your assumption is correct, then what's left is a relatively small WTF; on the same scale as BDate and EDate, where AFAICT the only WTF is that ToUpper() is unneeded.
Admin
For robustness, you should print out the XML, photograph it on a wooden table...
Admin
I think the visibility enumeration needs a few more enumerations. These come to mind: Sort of Hidden, Cleverly Hidden, Poorly Hidden, Extra Hidden, Forever Hidden, Optimally Hidden, Resolutely Hidden, Nervously Hidden, Unbelievably Hidden.
Admin
Whoever wrote that "EditTDemensions" function should be beaten.
Admin
Admin
That doesn't sound the least bit redundant to you?
Mind you, now I am assuming that a string variable's value is equal to it's .ToString value. Would not surprise me much if there is some weird null condition where that is not the case.
Admin
You need to catch up now. I am dying and you're still stuck on the constable part. Carrot was promoted to Captain several books ago.
Admin
I think the intended idea is that EvalToSTring will evaluate the statement and return the result as a string, just like EvalToInteger will evaluate the statement and return the result as an integer.
Admin
However, your entire naming convention assumption is that EvalToInteger is the same as int.Parse. If EvalToString is not the same as .ToString(), then EvalToInteger cannot be the same as int.Parse and the naming convention is preserved. The reverse is also true (though admittedly redundant (my shop calls this a "friction layer")).
Therefore you have presented us with a tautolgy and yet complain it is false.
Admin
[quote]"Like many fellow developers, the codebase I work on each day is terrible and devoid of any structure,"[quote]
Hey, as a developer I may be terrible and devoid of any structure, but I resent being compared to that code.
Admin
With no clue what EvalToString does, the only thing odd about the example is that he takes a toString of a string, which is pointless.
Some posters seem to be assuming that EvalToString converts an integer to a string, so that then doing the parse just converts it back, making the function pointless. But this clearly can't be true, as the input parameter is not an integer but a string.
I don't see a WTF here at all. They have some function that does we know not what to a string, and gets a result that is another string. In at least some cases, this result is, in fact, parsable as an integer, so they have a second function that calls the first, gets the result, and then parses it to an integer. This seems like plain good coding to me. What would be preferable, to make another function identical to EvalToString except that it returns an int? Duplicating who knows how much code?
Admin
That last one reminds me of OSPF area types:
Stubby Not So Stubby Totally Stubby Totally Not So Stubby
I wish I were making this up...
Admin
I'm really surprised that no one has pointed out the obvious error in the enum. Of course there should be FOUR values: Visible, Hidden, VeryHidden, and FileNotFound.
Admin
The "THIS SETTING SHOULD NOT BE 'TRUE'" WTF is classic. I can imagine this pattern is present in huge numbers of dodgy codebases. The "sort of 3(ish) value" "boolean". Hours of fun debugging & maintaining no doubt. The Visible/Hidden/VeryHidden one is the same as Windows Explorer's Visible/Hidden/Protected OS scheme, so a popular 'idea', though popularity is no guide to quality. Having just seen Jays post above, of course he's correct about 'file_not_found'
Admin
The System.out one is easily fixed at a global level.
Admin
Admin
I must admit I don't get it either. One is today's date, the other is tomorrow. Where does he repeat himself?
Admin
The first one looks like a part of this code, probably not a WTF. http://odetocode.com/code/80.aspx
Admin
[I] [just] [don't] [see] [any] [problems] [with] [the] [classic] [ASP] [code] [.] [Where's] [the] [WTF] [?]
Admin
STFU. I am the boss here and if I have published it, it is a WTF. Print your expert opinions on a toilet paper and shove it up your ass.
Admin
Although, if hidden well enough, may not be found...
Admin
Admin
I am being re-encarnation, but not knowing my prevous identities.
Admin
Admin
You are very bad at being Nagesh. "hakker"? "Sum"? Seriously, don't do it again.
Admin
Admin
EvalToString obviously has to do something besides pass through the parameter passed in as a return value. Otherwise, why even have it there? You make a dangerous assumption. I'm guessing that it does some sort of logical evaluation on the value passed in, so that int.Parse() does not receive a null value.
Admin
Admin
Admin