• (cs)

    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.

  • (cs) in reply to PedanticCurmudgeon
    PedanticCurmudgeon:
    The poop of DOOM:
    I'm sane (officially. Got a certificate saying I'm not nuts!.
    I find that highly unlikely.
    me also
  • big picture thinker (unregistered)

    TRWTF is: why can't this company force its employees to pass a bool rather than some random string representation of a bool?

  • (cs) in reply to big picture thinker
    big picture thinker:
    TRWTF is: why can't this company force its employees to pass a bool rather than some random string representation of a bool?
    Guy from Marketing: What's a boo-len?
  • (cs) in reply to C-Octothorpe
    C-Octothorpe:
    big picture thinker:
    TRWTF is: why can't this company force its employees to pass a bool rather than some random string representation of a bool?
    Guy from Marketing: What's a boo-len?
    Programmer: Why are you looking at code? Shoo! Shoo!
  • Hater (unregistered) in reply to C-Octothorpe
    C-Octothorpe:
    [A dark, musty basement cluttered with old boxes and empty take-out containers. The only light provided is from an aging CRT monitor sitting atop a rickety Ikea computer desk, next to an impressive pile of used, um, facial tissues...]

    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

  • (cs) in reply to Hater
    Hater:
    C-Octothorpe:
    [A dark, musty basement cluttered with old boxes and empty take-out containers. The only light provided is from an aging CRT monitor sitting atop a rickety Ikea computer desk, next to an impressive pile of used, um, facial tissues...]

    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

    The fact the you're responding to me while on a boat with hot chicks says more about you than you think it does...

  • (cs) in reply to Hater
    Hater:
    I'm back on my boat with hot chicks so you should bite yourself while I'm offline
    You mean you're sitting on a blow-up mattress in your parents' basement, with a bucket of KFC.
  • boog Knight (unregistered) in reply to Hater
    Hater:
    C-Octothorpe:
    [A dark, musty basement cluttered with old boxes and empty take-out containers. The only light provided is from an aging CRT monitor sitting atop a rickety Ikea computer desk, next to an impressive pile of used, um, facial tissues...]

    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

    RU trying to make C-Otcomom jealous? Ha! The joke's on you. He doesn't even like boats.

    ...or chicks.

  • vastrightwing (unregistered)

    // 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; }

  • (cs)

    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]

  • Tom (unregistered) in reply to pjt33

    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.

  • Tom (unregistered) in reply to Tom
    Tom:
    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.

    sorry, in reference to

    pjt33:
    Re: Truth Enough 2011-11-09 09:57 • by pjt33

    366192 in reply to 366180 Reply Quote

    The poop of DOOM:
    I'm sane (officially. Got a certificate saying I'm not nuts!)
    

    I know this is a cultural reference, but I can't remember to what. Is it Rimmer from Red Dwarf?

  • pmv (unregistered) in reply to Machtyn

    What would etc evaluate to?

  • (cs) in reply to pmv
    pmv:
    What would etc evaluate to?

    etc is latin phrese mean ex-cetra. we use it in our school exams all time.

  • Vlad Patryshev (unregistered)

    Well, eons ago I wrote code that also recognized Ja, Nein, Oui, Non, Tak, Nie, Igen, Nem, etc.

  • L. (unregistered) in reply to The poop of DOOM
    The poop of DOOM:
    QJo:
    Steve:
    Not that I want to defend this piece of code, but the main criticism so far of it not accounting for things like sTart and such is almost unfair - they've accounted for any variation that a sane human might use. "START", "start" and "Start", for example. A casual glance at those and you wouldn't immediately think it's a typo (unless your coding style dictates that it is). However, if you looked at sTart, unless you're using Hungarian notation and have some sort of string Tart, then you'd immediately think it looks wrong.

    Of course, that's besides the point in which this kind of boolean handling is just wrong.

    No, it also misses stuff like STart, FAlse, etc. which MS products automatically convert to Start, False, etc. It's so easy to mistime the removal of the finger from the SHift key (see?) when typing a word with the first letter capitalised. So you've got to add those too.

    And don't forget, there's also "sTART" and "stART" etc. etc. for all those people who have forgotten they've left the caps lock on, and whose finger-timing is equally messy as that which has been specified above.

    We also need to cater for variants on "sotp" and "satrt" etc, in case the fingers have got really fumbled, and also "ario" for the person who wanted to type "stop" but whose fingers were one key too far to the left.

    So there's till plenty of work to do. I'd get Nagesh onto it straight away.

    "ario", but also "qrio" for people who use French keyboards. And don't forget the Dvorak users, either.

    While we're at it, stqrt, stQRT, etc. as well, for people used to either a qwerty or an azerty keyboard and having to type on the other kind (triple that for Dvorak)

    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 }

  • AndyC (unregistered) in reply to ParkinT
    ParkinT:
    This was obviously written by someone unfamiliar with the "ToLower()" class. What is returned if I supply it with "trUe"?
    FILE_NOT_FOUND. Obviously.
  • Scott (unregistered) in reply to The poop of DOOM

    That's in there too

  • mjk340 (unregistered)

    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.

  • Enough is Enough (unregistered)

    I thinks its time to set a ban on False/Truth and CaSe WTFs.

  • (cs) in reply to Steve
    Steve:
    However, if you looked at sTart, unless you're using Hungarian notation and have some sort of string Tart,
    Actually, I had a String Tart for breakfest. Once you get over the odd texture, they are very delicious.

    Of course, if one breaks open in your toseter, it is a real mess to clean up.

  • 董开安 (unregistered)

    They also forgot:

    是 是的 对 不 不是

  • Could I Bother You to Recharge My Zune? (unregistered) in reply to QJo
    QJo:
    Could I Bother You to Recharge My Zune?:
    pjt33:
    Is it Rimmer from Red Dwarf?
    The show has a guy named "Rimmer"?! Hulu here I come!
    ...it is a not-unheard-of name in the UK...
    Jesus Christcicle, I bet.
  • (cs)

    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" :)

  • (cs) in reply to ekolis
    ekolis:
    Isn't "static const" redundant in C#? I'm almost surprised that it doesn't generate a compiler error...
    How do you figure? You can change a static value, but you can't change a const.

    Also, static is assigned at runtime, and const is compile time.

    Also also, const can't be anything other than primitive types and string.

  • (cs) in reply to Daniel
    Daniel:
    What language is this? Seems to come from Visual Studio. Is it Visual Basic?

    Looks like C or one of its derivatives, i.e. C++, Java, C#, etc.

  • (cs)

    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>

  • (cs) in reply to C-Octothorpe
    C-Octothorpe:
    Naturally, there was fragile logic throughout the code-base to convert to and from a bool where it would either look at the whole word, just the first character, ToUpper, ToLower, blah blah blah...

    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?

  • (cs) in reply to Coyne
    Coyne:
    If the column contains Y/N, great; if it's blank, who knows how the programs will behave?
    Isn't that what the "else" block is for? :)
  • (cs) in reply to C-Octothorpe
    C-Octothorpe:
    ekolis:
    Isn't "static const" redundant in C#? I'm almost surprised that it doesn't generate a compiler error...
    How do you figure? You can change a static value, but you can't change a const.

    Also, static is assigned at runtime, and const is compile time.

    Also also, const can't be anything other than primitive types and string.

    With a name like C-Octoblah you ought to know better.

    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.

  • (cs) in reply to frits
    frits:
    C-Octothorpe:
    ekolis:
    Isn't "static const" redundant in C#? I'm almost surprised that it doesn't generate a compiler error...
    How do you figure? You can change a static value, but you can't change a const.

    Also, static is assigned at runtime, and const is compile time.

    Also also, const can't be anything other than primitive types and string.

    With a name like C-Octoblah you ought to know better.

    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.

    Yeah, I never scored very high on reading comprehension.

    I thought he was asking why there is static and const in C#, and that they're the same. My bad...

  • (cs)

    At least they could have initialized the array alphabetically so they could utilize a binary search algortithm.

  • Sadly, I've Seen This (unregistered) in reply to pjt33
    pjt33:
    pjt33:
    The poop of DOOM:
    I'm sane (officially. Got a certificate saying I'm not nuts!)
    I know this is a cultural reference, but I can't remember to what. Is it Rimmer from Red Dwarf?
    Ah, I think it was Sheldon from The Big Bang Theory.
    I'm not insane: my mother had me tested.

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

  • (cs) in reply to neminem
    neminem:
    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.

    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.

  • Hater (unregistered) in reply to C-Octothorpe
    C-Octothorpe:
    Yeah, I never scored very high on reading comprehension.

    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.

  • Hater (unregistered) in reply to Matt Westwood
    Matt Oakwood:
    I
    shitty
    programmer

    Yeah we know. FUCK OFF

  • (cs) in reply to Ol Bob
    Ol Bob:
    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>

    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.

  • frits (unregistered) in reply to Hater
    H8ter Boi:
    C-Octothorpe:
    Yeah, I never scored very high on reading comprehension.

    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.

    I notice you aren't attacking me directly anymore. Is because you're scared? Scared of the REAL MAN!?

  • (cs) in reply to Mojo Monkeyfish
    Mojo Monkeyfish:
    The REAL REAL WTF is all the ToLower() fanboys here, when ToUpper() is obviously superior. There's nothing a totally lowercase string can do, that a totally uppercase string can't do louder.
    Fail (includes ponies).

    Or as their writing in (a) turkey: üzerinde! kapalı!

  • (cs) in reply to Matt Westwood
    Matt Westwood:
    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?!?
    Since you asked, we're not expecting the user necessarily to type in anything. The goal is to fill in a checkbox in a pdf. The input is coming from a token, which might come from a script, or from a database, or (most likely) from the value of another checkbox in another pdf. The pdf specification *recommends* a certain value for a checkbox being toggled, but depressingly enough, it does not *require* a certain value. The user is not necessarily the person who created the pdf they're trying to read the value of. Hence, flexibility.
  • (cs) in reply to frits
    frits:
    Hater:
    C-Octothorpe:
    I've done stuff like this
    Who hasn't?
    fTFY

    It should only a few seconds to think... there's got to be a better way.

  • (cs)

    "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!

  • old Fart (unregistered)

    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"?

  • Hh ate rR (unregistered) in reply to frits
    frits unregistered:
    I notice you aren't attacking me directly anymore. Is because

    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.

  • forgottenlord (unregistered)

    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.

  • Bronie (unregistered) in reply to no laughing matter
    no laughing matter:
    Fail (includes ponies)
    [image]
  • boog (unregistered) in reply to Hh ate rR
    Hh ate rR:
    frits unregistered:
    I notice you aren't attacking me directly anymore. Is because

    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.

    Now your responding to fake frits?
    Your not too smart are you?

  • boog (unregistered) in reply to boog
    boog:
    Your not too smart are you?
    Also I suck cocks
  • Ville (unregistered)

    This is actually very clever. They obviously do not want to accept stupid inputs like tRuE etc.

Leave a comment on “Truth Enough”

Log In or post as a guest

Replying to comment #:

« Return to Article