- 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
Untrue. I used to have a collegue who used to prefer that over "false." </shudder>
Admin
mSourceParams
is likely a deeper WTF.Admin
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.
Admin
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!
Admin
Also, if ever the exceptions do get thrown, then just swallowing them is probably the worst way to deal with the problems.
Admin
I suppose that this solution misconstrued something along the way.
Admin
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) ...; }
Admin
Why not
Boolean.parseBoolean("true")
?Admin
Because "true" can falsy depending on the news source you quote it from.
Admin
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).
Admin
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.
Admin
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?)Admin
construe, construed, construres misconstrue, misconstrued, misconstrues true, trued, trueing, truer, truest untrue, untruer, untruest
Admin
And if you're going to use a regexp, at least use the
CASE_INSENTIVE
flag instead of[Tt]...
Admin
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 meaningtrue
. (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.)Admin
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
Admin
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.
Admin
FWIW, this is exactly how
parseBoolean
is implemented.Admin
Okay, seriously, fix your moderation system.
Admin
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.
Admin
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.)
Admin
It is, and it's good practice to store Pattern instances in a static final field because they are immutable.
Admin
Captcha, hmmm yes. It is rather parochial isn't it? And the quality of the photographs it offers, well I haven't seen anything that "good" since digital cameras were a very new thing.
Admin
Y'all know you can just register and never again have to see the Captcha [REDACTED] ever again, right?
Admin
Don't let the spam bots fool you.
Admin
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.
Admin
And "betruegerische Handlung" = true // localized words supported.
Admin
In the spirit of nitpicking the wrong point: it's also compiling the RE on every call. Surely that should be a final at a higher scope?
Admin
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.
Admin
People not fixing their indentation are not to be trusted, on the same line as people using tabs or opening braces on the same line.
Also, people still using Java? Isn't it phased out pretty much everything due to a never decent VM?
Admin
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.
Admin
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.
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.
Time based limits I can kind of see being useful if they are a couple seconds at the longest.
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.
Admin
What I actually would like is some clear and transparent way to know what gets a comment held for moderation.
Admin
What I actually would like is some clear and transparent way to know what gets a comment held for moderation.
Admin
Captcha did an oopsie, so I accidentally double posted. Sorry about that.
Admin
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.
Admin
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.
Admin
A true dreamberd developer.
Admin
He who controls the input reigns over the output. And in doing so he shall achieve victory.
He who validates that which is uncontrolled reigns over nothing. And he shall achieve naught but frustration.
Combo boxes for inputs are a thing.
Admin
"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"...