- 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
Yeah. I have nothing against the concept. I am myself responsible for a piece of code that has to convert a user-enterable-at-runtime object (not necessarily even a string) into a boolean: it treats numbers that aren't 0, strings that can be converted into numbers that aren't 0, "on", "true", "yes", and possibly a couple others I don't remember, as true. But it does them all case-insensitively without enumerating all the possible cases, and it also doesn't enumerate all the possibilities for false, as that would be entirely redundant. So those are kind of dumb. But the goal itself seems potentially reasonable enough.
Admin
Admin
TRWTF is: why can't this company force its employees to pass a bool rather than some random string representation of a bool?
Admin
Admin
Admin
You're projecting or describing your surroundings, whatever.
I'm back on my boat with hot chicks so you should bite yourself while I'm offline
Admin
Admin
Admin
...or chicks.
Admin
// I think this should cover everything in less than 6 lines. bool isTrue( string value ) { if("1tyg".IndexOf(value.Substring(0, 1).ToLower().Trim())>=0) return true;
return "sta".IndexOf(value.Substring(0, 3).ToLower().Trim())>=0; }
Admin
only boat that hater have is maid of paper and flot in guter [image]
Addendum (2011-11-09 11:46): and he's also work in pultry farm where lot of chicks.
[image]
Admin
The reference is from Howling Mad Murdock (Played by Dwight Schultz) in the A-Team series as he's being carried away by the loony bin attendants alongside his doctor who's also been certified as insane.
Admin
sorry, in reference to
Admin
What would etc evaluate to?
Admin
etc is latin phrese mean ex-cetra. we use it in our school exams all time.
Admin
Well, eons ago I wrote code that also recognized Ja, Nein, Oui, Non, Tak, Nie, Igen, Nem, etc.
Admin
here .. i've got a sane solution : function fakebool(string){ string=rand(1); if(string==1){ return true; }else{ return false; } // all cases covered, misinterpretations included }
Admin
Admin
That's in there too
Admin
TRWTF is the use of magic strings. It should be:
static string NO = "NO"; static string No = "No"; static string no = "no"; .....
static const StringSettingBool boolflag[] = ( (NO, false), (No, false), (no, false), ......
This way you don't have to change your array assignment code if the customer wants to change "No" to "nO" in the future.
Admin
I thinks its time to set a ban on False/Truth and CaSe WTFs.
Admin
Of course, if one breaks open in your toseter, it is a real mess to clean up.
Admin
They also forgot:
是 是的 对 不 不是
Admin
Admin
Isn't "static const" redundant in C#? I'm almost surprised that it doesn't generate a compiler error...
Also, you forgot "$t@rt" and "$t0p" :)
Admin
Also, static is assigned at runtime, and const is compile time.
Also also, const can't be anything other than primitive types and string.
Admin
Looks like C or one of its derivatives, i.e. C++, Java, C#, etc.
Admin
A less-than-obvious WTF is that somewhere deep in the code-base from which this snippet was snipped there's a function (and we pray there's only ONE such function) that iterates its way through this array doing string comparison after string comparison in hopes of finding a match. <shudder>
Admin
Yeah, our choice here was 1-character flags ('Y','N'). But some programs test for = 'Y', some for <> 'Y', some for = 'N', some for <> 'N'...
If the column contains Y/N, great; if it's blank, who knows how the programs will behave?
Admin
Admin
To feed the OP troll, this is not C#. It could be C or C++. In that case, we are looking at a static array of constant StringSettingBool data structures.
Admin
I thought he was asking why there is static and const in C#, and that they're the same. My bad...
Admin
At least they could have initialized the array alphabetically so they could utilize a binary search algortithm.
Admin
I see "Pueba que tu bebe es sana." on the PSA billboards here. I wonder why there are so many crazed Hispanic babies.
Captcha: odio (I hate this too).
Admin
The real WTF is that you're expecting some luser somewhere to type in a response which requires one of two answers. WTF is wrong with a pair of fucking radio buttons?!?
Mind, I do remember an app where we had to convert boolean quantities as held in a configuration table in the database. Because of shitty discipline, these values could have been as either yes/no or true/false, either case, and possibly even just the first letter. After the fifteenth time I saw where the programmer had generated a complicated if statement to cater for all of these, it was decided that it was time to replace it with an "isTrue" method. And a matching "isFalse" method. Or something like that.
Admin
I doubt you scored high on anything besides slacking.
As for your pseudo-fight with fritz, you wont distract me. You're both stupid and should leave.
Admin
Yeah we know. FUCK OFF
Admin
And so what? How fast can humans generate input?
About sanity certificates... My current job required one from all applicants... No wonder everybody here is insane.
It makes a nice conversation with a doctor "- I need a sanity certificate for a job" "-Ok", and signs the paper. Didn't have time to reach the chair.
Admin
Admin
Or as their writing in (a) turkey: üzerinde! kapalı!
Admin
Admin
It should only a few seconds to think... there's got to be a better way.
Admin
"If I manage to stay for more than a copule weeks, I'll be sure to follow-up with a full report."
We certainly wouldn't want him to be copulelate!
Admin
This is one of the benefits of Object Oriented programming. The code clearly is extensible - notice the comment at the top to "add as necessary"?
Admin
It's because you're nothing for me. Zero. Black hole (so you suck). Empty bladder. You're not first anymore.
Also you forgot to login.
Admin
My favorite part is that for all their paranoia in not letting anything get out the door, you were still able to get a screenshot and transmit it with them being pretty much unable to stop you.
Admin
Admin
Your not too smart are you?
Admin
Admin
This is actually very clever. They obviously do not want to accept stupid inputs like tRuE etc.