- 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
I don't get the last acronym...
What The F***!?
Worse Than Failure
I.... am... confused...
Admin
is it bad that I just realized "worse then failure" works as an alternate meaning for WTF? I should "wake the f***" up!
Admin
Which is worse? The person who hatched this demon spawn, or the next person who looked at it and said "good idea, I'm going to add a bunch more entries"?
Admin
Uhh... Why are the entries in separate fields? Yes, yes, otherwise it wouldn't feature on this website, but apart from that? It looks like the designer wanted to implement a flat file, and is using the primary key to order a separate collection of 'lines'. But why? What business (or mental) case could cause him to split the data up in this form?
"I'd like to figure out what 'IBM' means. So I will just read the table, in order of primary key, until I find 'IBM', and then I will keep reading until I find an entry that consists purely of X'es. The results up until that point I will concatenate to give the right result."
Hard to imagine how this happens. But congratulations anyway. It truly is a W.T.F!?
Admin
Admin
Testing each character one by one to see whether it is an "X" or not might seem odd at first until you realize that's how the machine code does it anyway.
By explicitly calling out the logic you make it more obvious to future readers what's going on, and you also provide opportunities for the compiler to optimize.
Admin
Admin
Surprisingly, there's no comment of this form yet: 8799 TIAC THIS 8800 TIAC IS 8801 TIAC A 8802 TIAC XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Admin
The data design wtf is somewhat countered (by about 0.2%) by the fact that the designer realised that he was dealing with abbreviations (ABBR), and not acronyms.
Admin
Where I work, someone once commented on a client's file with WTF. I submitted it could have meant "Where's the Form" and argued that this kid was pretty innocent (knowing full well he knew what he was saying).
When he was called on it by the manager of his department, he answered that it meant "Where's the Followup". The manager bought it.
Admin
8799 TIAC THIS 8800 TIAC IS 8801 TIAC A 8802 TIAC COMMENT 8803 TIAC XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Admin
Admin
You obviously aren't familiar with -2nd Normal Form.
Admin
OK, I'll give you that would be a WTF in itself, but who knows...
Admin
IMHO The "Real WTF" here is why anyone would bother typing in thirty X's when an empty string works just as well as far as the return value from isNotAllXs(...) is concerned.
Admin
Normally, I wouldn't be so picky, but since it deals with the topic of the WTF: Mensa is not an acronym, nor an abbreviation, initialism, etc. So, it should be in Title Case, not ALL UPPERCASE. </pedantry>
Admin
Irrelevant; he's not talking about Normalisation (capital N) but normalisation in the sense of storing the data in a consistent manner.
Admin
TRWTF is that there's a delimiter at all -- The ABBR_IDX changes when it goes to the next acronym anyway.
Admin
Dah!
select ABBR_CDE from table where ABBR_TXT="BUSINESS"
Gives you all the abbreviations that contain the word business.
select ABBR_CDE from table where ABBR_TXT="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
Gives you all the abbreviations that have more than one meaning, and don't get me started with select count + 1
The possibilites are endless!
Admin
Admin
Owww... My head hurts. This is retarded beyond repair. Never mind normalization, this structure fails at simplest sanity.
a) Why on earth are all the elements of the acronyms in separate rows?
b) A separator in a database? There are no rules on natural order of a relational db. Anything that uses this "separator" needs to do ORDER BY row_id to work for sure...
c) Checking/storing the "X"-s is retarded waste of space, because you can check if ABBR_IDX is even to get the same info.
a causes b, b causes c. And they all are solved in a WTF way... Cant believe the massiveness of this stupidity...
Admin
<so_very_gay> Geek tags. </so_very_gay>
Admin
Your humour detector is clearly epic fail.
What do you call a man with no arms or legs, floating in the ocean?
Admin
Admin
In the isThisAllXs function, as it is "retVal = true;", and not "retVal = retval && true;", doesn't it just check to see if the last character in the string is X, or am I having a brain fart?
Donal
Admin
F*****d.
Admin
F****d. (Disregard last)
Admin
Best SQL WTF ever.
Admin
Wow...this is one of the most mindboggling codeSODs I've read in awhile. Well formatted and cleverly written too.
Captcha: appellatio - Rejected name and premise for the sequel to American Pie.
Admin
Admin
No, it works correctly. The assignment triggers if and only if a character which is not an 'X' is encountered, so "false" if returned if no such character exists, and "true" if any does, just as the (somewhat confusing) name of the function indicates.
Admin
A separator when the items are already distinguished by an index? Brilliant!
Admin
I bet you're just the life of the party. Do you always poop on people's jokes?
Admin
Bob
Admin
Admin
The real WTF:
"At Chris N.'s employer, they needed the ability to look up acronyms' meanings"
It's called Google.
Admin
Wait a second.. Isn't that wrong anyway? private static boolean isNotAllXs( String s ) { StringBuffer test = new StringBuffer( s.trim() ); boolean retVal = false; for ( int i = 0; i < test.length(); i++ ) { if ( test.charAt( i ) != 'X' ) { retVal = true; } } return retVal; }
Wouldn't that mean that a String s which ends with an X would return false too? (which means that it's all Xes) so isNotAllXs("ASDFX"); would return false, just as isNotAllXs("XX[...]XXXX"); Sorry if i'm wrong about that.
Admin
The Real WTF for me is that I didn't even know the Sega Nomad existed! Seriously, a handheld that can take Genesis/Megadrive carts direct? WTF? Where the hell was I in the mid 90s and why didn't I get a memo about this?
Admin
The codez will fail for the AXMD (Association of XXX Movie Directors).
A workaround for this would be to check whether the delimiter has an even ABBR_IDX.
Admin
It's hardcore XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Admin
Admin
It wouldn't fail on AXMD. Take a closer look at it...it actually works pretty well for to check for an all-x string. Even if the last character were X it would work fine...
Admin
You win the debate.
Admin
You are wrong. The loop starts, the first character is 'A', which != 'X', so retval = true.
Admin
I took this to mean that this article was supposed to take place some time around 1995, which really made the whole 'internet' thing kind of a disaster. I'd have considered an offline acronym database a useful tool (if I wasn't ten years old at the time.)
Admin
But retval is not being returned at that point. The loop continues, checks a few more letters which will keep retval being true. Then the last letter, which is an X. So retval becomes false, the loop ends and retval is returned..
Admin
The real WTF is that IBM, LA, WCAB and WTF are not acronyms. They are abbreviations.
Admin
Dad, is that you?
Admin
If you're trolling, then way to go, but otherwise, yes, you are wrong about that. retVal is initialized to false, and as soon as any one character is NOT AN X, it is set to true. No where in the code does retVal get set back to false if there is an X. The only WTF is that the code should look more like this:
That way as soon as a non-X is found, the comparison is done instead of checking a bunch of chars that don't matter anymore...
Addendum (2008-12-08 11:03): EDIT: Oh yea, one more thing, before ANY characters are checked, there should be a check to see if length == delimiter length, but since the rest of the code is so great, and this function is named "isNotAllXs" I'm assuming that the length check was done before this function is even called...
(The post after this reminded me...)
Admin
Ok, let's got step by step: first row gets "Association", second row gets "of", third row gets "XXX" - oops!