• (nodebb)

    Untrue. I used to have a collegue who used to prefer that over "false." </shudder>

  • Naomi (unregistered)
    public boolean isHelpReference() {
       return Boolean.parseBoolean(mSourceParams.get("CONTEXT_HELP"));
    }
    

    mSourceParams is likely a deeper WTF.

  • Maia Everett (github)

    Also, catching NullPointerException instead of checking for null might not be a WTF, but it's a definite code smell.

    TRWTF is keeping configuration in what seems to be a string-to-string map instead of a typesafe object. It's possible that the configuration comes from a text file, in which the keys and values would indeed be strings, but typesafe deserialization of configuration files is a long solved problem in Java.

  • Mr. Regex (unregistered)

    Also Java patterns support case-insensitive matching:

    value.matches("(?i)true")

    If you're going to go regex you might as well go all the way!

  • Sauron (unregistered)

    Also, if ever the exceptions do get thrown, then just swallowing them is probably the worst way to deal with the problems.

  • Vera (unregistered)

    I suppose that this solution misconstrued something along the way.

  • ClassCastException (unregistered)

    The mSourceParams object might contain/return objects of different types, so expecting a String like in the code may cause a ClassCastException. The get() method might be implemented as

    public <T> T get(String key) { return (T) ...; }

  • boolean (unregistered)

    Now, in Java, the obvious answer would be to use the equalsIgnoresCase String member function. if (value.equalsIgnoresCase("true"))…. I mean, obvious to you or me, anyway.

    Why not Boolean.parseBoolean("true")?

  • LZ79LRU (unregistered) in reply to boolean

    Because "true" can falsy depending on the news source you quote it from.

  • (nodebb)

    Ok, what is the auto moderation system doing?

    As I type this, there are 4 comments held for moderation, but between two of them is a comment that is clearly spam. You would think a comment with something that looks like it could be a link would be auto-held at least.

    I'm more shocked that someone logged in had their comment held, unless they're a new user to the site (like they signed up recently and their first comment is frist or however the typo goes here).

  • LZ79LRU (unregistered) in reply to miquelfire

    Making life miserable for legitimate posts. Seriously, that thing just needs to die and be replaced by something like a simple filter that moderates all posts containing a link.

  • (nodebb)

    Supposedly registering an account (vs. posting without logging in) makes ones comments less likely to be caught by the inane moderation system. Let's find out.

    On topic: I hope the text being parsed never contains "construed" or "TrueType font" or any variations thereof.

    And let's not forget the //$NON-NLS-1$ comment. Based on a quick google, that looks like it's a suppression tag to get Eclipse to suppress a warning about a non-localized string literal. (TRWTF is Eclipse?)

  • Peter (unregistered)

    construe, construed, construres misconstrue, misconstrued, misconstrues true, trued, trueing, truer, truest untrue, untruer, untruest

  • (nodebb)

    And if you're going to use a regexp, at least use the CASE_INSENTIVE flag instead of [Tt]...

  • (nodebb) in reply to Barry Margolin

    They compile to the same actual matcher.

    TRWTF is that "Not tRuE [SpongeBob] but actually False on alternate Thursdays, I mean it!" is accepted as meaning true. (Seriously, some inputs should be rejected on the grounds that they're just garbage you aren't handling, and it's the user's responsibility to not give you total rot.)

  • Jeremy (unregistered)

    Pattern.compile looks like an expensive operation. At least in c# it is. Probably not a good idea to recreate that on every function call

  • Sou Eu (unregistered)

    If worried about a NPE, use "true".equalsIgnoreCase(mSourceParams.get("CONTEXT_HELP")). The constant "true" will never be null and this will return false if the parameter is null.

  • Naomi (unregistered) in reply to Sou Eu

    FWIW, this is exactly how parseBoolean is implemented.

  • Naomi (unregistered)

    Okay, seriously, fix your moderation system.

  • (nodebb) in reply to LZ79LRU

    I'm not sure that's a good solution TBH - I sometimes wish to post a link to an article which is not spam whatsoever.

    I would prefer a combination of 1) email verification, 2) CAPTCHA (which actually works), 3) time-based limits on posting and duplicate prevention, and 4) ability for users to block individual users.

  • Foo AKA Fooo (unregistered) in reply to Mr. TA

    No, CAPTCHA does NOT work! On multiple occasions, I was not able to post comments due to that crap. Of, course, if you ignore false positives, why not just reject all comments. That also "works" to prevent spam.

    (The irony, posting this comment took two attempts because FUCKTCHA didn't work first time.)

  • Rob (unregistered) in reply to Jeremy
    Comment held for moderation.
  • Lurk (unregistered)
    Comment held for moderation.
  • (nodebb)

    Y'all know you can just register and never again have to see the Captcha [REDACTED] ever again, right?

  • (nodebb) in reply to Steve_The_Cynic
    Y'all know you can just register and never again have to see the Captcha [REDACTED] ever again, right?

    Don't let the spam bots fool you.

  • (nodebb) in reply to Foo AKA Fooo

    I think there is a misunderstanding - I didn't mean that the CAPTCHA on this site works right now; I meant, I would like to have CAPTCHA which should work.

  • Officer Johnny Holzkopf (unregistered) in reply to Peter
    Comment held for moderation.
  • löchlein deluxe (unregistered)
    Comment held for moderation.
  • (nodebb)

    Maybe code such as featured here is part of the moderation system? It wouldn't be the first time: I once had no end of trouble (elsewhere) getting a post accepted, where every attempt was blocked because I was using spam words. I eventually tracked it down to the fact that I wrote "specialist" at one point.

  • Your Name (unregistered)
    Comment held for moderation.
  • (nodebb)

    TRWTF is all the comments complaining about the comment system. Ironically recursive.

    Let's admire instead the TrUe beauty of the title, as apparently nobody noticed this amusing little detail.

  • LZ79LRU (unregistered) in reply to Mr. TA
    1. Not all of us want to register here. I for example only read/post here from work. And would thus not want to use my private email on a work machine or risk my work email being linked to a frivolous online forum for somewhat obvious reasons.

    2. CAPTCHA is a sin against humanity. It's only purpose is to be security theater to make the lives of legitimate users miserable. And it should be abolished.

    3. Time based limits I can kind of see being useful if they are a couple seconds at the longest.

    4. If you register sure, all forums have it so why not here.

    As for links, frankly a minimally intelligent human can edit a link when posting to break it up and avoid automatic detection and filtering. Like ww w.myFakeLink. com. That's a natural human detection system that actually does not make our lives miserable.

  • Confucius (unregistered)
    Comment held for moderation.
  • Confucius (unregistered)
    Comment held for moderation.
  • Confucius (unregistered)
    Comment held for moderation.
  • (nodebb) in reply to Maia Everett

    Funny, those issues were already solved in c# years ago with non-nullable reference types (basically the counter to nullable value types). But yeah, thinking back it was kinda an oversight not to have those around from the start - would have avoided so many issues.

  • (nodebb)

    I think if you want to be able to correctly parse "not true", or any other phrase that amounts to "true" or "false" in English, then you are going to have big problems. Just wait until the Aussies get a hold of it, and try to parse "yeah, nah" and "nah, yeah". +1 to suggestions that it should only accept "true" ignoring case. Or, depending on requirements, also include "yes", or the single letter "t" or "y". That's being very generous, and anything beyond that is rubbish.

  • eri (unregistered)
    Comment held for moderation.
  • LZ79LRU (unregistered) in reply to prueg
    Comment held for moderation.
  • Erk (unregistered)

    "catch - do nothing"... Yeah, that's a great way to get everybody to spend 16 hours a day trying to figure out what error's being eaten and why. I sincerely hate that... though, it is true that null is not "true" so I guess it's all "good"...

Leave a comment on “TrUe Romance”

Log In or post as a guest

Replying to comment #:

« Return to Article