- 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
Not trolling at all (but as said just some seconds ago):
If test.charAt( i ) is not an X, retval is set to true indeed. so if the first character (test.charAt(0)) is not an X, retval is being set correctls. But the loop continues for the whole string length (e.g. ASDFX) For each character of the string, the check is being done. Which means, that after the last check (the X), retval will be set to false, which will be returned, since i < test.length() does not apply any more.
About your solution: That's better, since the loop breaks and true is returned, as soon as a single letter in the string is not an X.
Admin
Gosh.. now i saw it. Sorry guys. (have been looking onto code too much today i guess)
Admin
Append: ah, must've cross posted. I completely understand the too tired to read code thing...
Admin
I suppose separating the words on different rows like that would allow you to link each first letter of each word to the acronym. That way you could create output like "IBM (INTERNATIONAL BUSINESS MACHINES CORPORATION)", that would otherwise be difficult if it was stored as a single string. The whole delimiter thing is crap though.
Admin
A sweet work around would be to write a function which acronymizes the returned string and checks it against the original acronym to make sure they match.
Also, while it does seem to correctly check for all X's, keep in mind that it's not "correct". At the very least, it should break from the loop as soon as it finds any non-X character.
You can't check the ID for evenness because when you get to the first acronym that doesn't have any delimiters, then the following acronym will start in an even row, and its XXX's will be in odd rows.
Admin
Don't forget about empty strings! Still, I like a lot potential abuse of the method name:
Admin
mebbe they wanted to be able to look up any acronym a particular word participates in.
the delimiter thing surely is a wtf, though.
it would, however, be interesting for the author or someone else to explain how the table design violates any particular normal form.
Admin
Admin
Admin
An acronym is an acrostic name. For example:
International Business Machines
or
Workers Compensation Appeal Board
An abbreviation is a shortened version of a word. For example:
St. (instead of Saint, or Street) Dr. (instead of Doctor, or Drive) Fla. (instead of Florida) abbr. (instead of abbreviation)
Admin
I would love to see what this guy would have come up with if someone had asked him for something like "Hey, you've got that AJAX stands for 'Asynchronous JavaScript and XML' but we need to know if the acronym contains an acronym, and if so, what it stands for."
Admin
so you store it sanely and use LIKE '% FOO %'.
It doesn't break any normal form, because as far as I can tell there are no non-trivial functional dependencies. A table with no functional dependencies is basically useless.
Admin
actually, everything you put is an abbreviation. acronyms are a type of abbreviation, as are initialisms. Nath3an is correct. Acronyms are pronounced as words, like AJAX, SCUBA and RADAR. Initialisms have there letters pronounced, like IBM, WWW.
Admin
Admin
Acronym: A word formed from the initial letters of a multi-word name.
I'm afraid I must disagree.
Admin
Admin
Admin
Apparently the author of isNotAllXs( ... ) failed to notice that they may just as well have checked if the ABBR_IDX is an odd or even value. ;)
Admin
and scales sooooo well, since it's an expression that can't use an index...
Admin
the debate is whethere IBM qualifies as a word, since it isn't pronounced like a word, like SCUBA and RADAR are
Admin
Admin
If you could do me a favor and stop trying to communicate at people, that would be great, m'kay?
Admin
Why not juste replace X and x in the string and then check to see if it's different than "" ? I don't know how fast that would be but maybe it's faster?
Admin
They used 30 X's so when the computer is looking through the table it won't lose it's place.
Admin
It's important to argue the usage of words, because there already adequate words for describing abbreviations and initialisations, and I for one would like to keep acronym true to its linguistic roots (akron [point or tip], onyma [name]).
If people are going to say damn fool things like "IBM" is a word (how the hell do you pronounce that? Ibbum? Ibeem?) then the argument will carry on!
Admin
Admin
Why is "abbreviation" such a long word?
Admin
Its amazing that people will go to the trouble to correct other people here and manage to be wrong themselves. Pointing out that other people are wrong is apparently more important than being right yourself.
It is not an acronym unless you pronounce it like a word and not a series of letters. So for example:
UN is an abbreviation NATO is an acronym
IBM is an abbreviation SCUBA is an acronym
Admin
That's not indexable in the same way that this guy's design is. I believe that would result in a full table scan.
Some of the DBMS (like mysql) have pretty good text indexers built in, but there's no standard -- maybe this guy was trying to stay platform-agnostic.
It would be fewer lines of code, but it would obviously be much slower. Or were you kidding?
http://www.joelonsoftware.com/articles/fog0000000319.html
Admin
Admin
Nice try. The real WTF is that no one took the bait.
Admin
Admin
if the guy didn't know how to insert a space then the design isn't that bad.
Admin
We here at 30X Corp. would like to become a client, just to destroy your database.
Admin
Why does something need to a) be pronounceable to be a word? b) be a word to be a "name"? c) need to be a "name" itself to be "true to [the word's] linguistic roots", rather than simply composed of the "tips" of many existing "names"?
Note that I consider these questions largely hypothetical, since the actual point of language is not to adhere to some pseudo-etymological logic, but to communicate. Many people are quite happy to use "acronym" to cover both pronouncable and non-pronouncable words of this type (pronouncable by whom, anyway?), and wouldn't recognise any extra information in being told something was in fact an "initialism" instead.
Incidentally, I wonder if it's a sign of the relative rarity of the word "initialism" that you mis-typed it as "initialisation"? (More likely you've just been coding too many constructors today, but it's an unfortunate mistake.)
Admin
-Harrow.
Admin
Admin
I think the real question is, why use 2nd normal form and not 3rd given today's database management systems such as SQL? There's also 1st normal form, as well as 4th, but there's a very good business reason we all mostly use 3rd and if someone doesn't know that reason, we say they don't know normalization as well as they should.
Admin
I do admire the reasonable sounding insanity of the justification paragraph: by explicitly ... It sounds so wonderful, it just has to be true...
Admin
Admin
You can't pronounce IBM? You can communicate verbally I assume. I mean it is pretty simple to pronounce. It has three syllables.
Admin
NO QUACK
Admin
You can't read? I didn't say I couldn't pronounce it, I said it isn't pronounced like a word. When you see the word "can" do you say "see-ay-en" or "kan"?
Admin
That would be -TDWTF Normal Form
Admin
I'm still confused as to the part where he needed a database of acronyms.
Admin
That database design makes me want to hurt someone. Badly.
Admin
Probably worked in an IBM shop. Back in my Operator days we had a 4" binder dedicated to internal & customer abbreviations. AFAIK, its still up there...
Admin
level crazy and the database would consist of these tables:
Bits: BitID - PK Value - int (if we invent crazy bits)
Characters: CharID - PK UnicodeName - string Size - int
CharacterBits: BitID - FK CharID - FK
Words: WordID - PK WordDefinition : string
WordCharacters: WordID - FK CharID - FK
Sentences: SentenceID - PK SentenceDelimiter - CharID FK (delimiter to put at the end)
SentenceWords: WordID - FK SentenceID - FK
Paragraps: ParagraphID - PK
ParagraphSentences: ParagraphID - FK SentenceID - FK
Chapter: IThinkYouGetTheID : PK etc. etc. ad nauseam.
Admin
You can sort-of italicize "like a word" all you like.
The pronunciation of a word, depends on the word. How do you pronounce pneumatic, knife, or epitome? Using your qualifications none of these are pronounced like the word they spell. The English language (all dialects) has no pretense that the collection of letters you have in the spelling of a word affect the pronunciation of that word. They just weight the possibilities of pronunciation.
I am merely stating that just because some words are pronounced as their constituent letters, does not mean they are not pronounced like a word. From a certain point of view that is, I can obviously see where you were going with that, and chose to explore an alternative side with minor, admittedly lame, humor not intending to be injurious or otherwise untoward you in any manner.
Admin
At any rate, just because campkev doesn't like the way it's spelled doesn't mean it isn't a word.