- 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
The level of wrong in this is fractal. No matter how deep you go there is always more wrongness to find.
inb4 incredibly overused inception joke.
Admin
Admin
What about the fact that it's the Enterprise Edition? I'd hate to see the Lite Edition...
Admin
[UKGrammarNazi] In the UK, 13,387,281 rendered as words should read "thirteen million, three hundred and eighty-seven thousand, two hundred and eighty-one" (yes, including the commas). [/UKGrammarNazi]
The American tic of removing "and" from such phrases is one of the many reasons I loathe so-called "American (or "US") English."
I wish someone would have the guts to just call their variant of the language "American," since many of the idioms, phraseology, and even words are not English in the sense that any UK speaker would understand. For example, try asking for a "fanny pack" in a shop in England and see what you get (possibly including being thrown out of the shop!).
Admin
C'mon. The number of VB fails is approaching the number of VB "programmers" in the world. They're hardly worth mentioning any more. Programmers need software engineers to tell them what to do, otherwise they end up writing crap. Software engineers do not allow VB in their engineered creations. Ergo, virtually all VB is crap.
A real WTF would be any well-written VB, since that's an infinitely rarer animal.
Captcha: minim -- the amount of education necessary to write VB.
Admin
Much better to use an airlock.
Admin
Give me a moment to put on my rubbers before I give you your fanny pack.
Admin
Admin
You clearly don't know about standard English style in writing numbers. AFAICT you are confusing it with standard American style.
Admin
Oh, I see it now. It should be:
get_words_from_a_number_which_is_past_as_a_perimeter_into_this_function
Admin
Admin
In '79 or '80 would you really have had enough memory to waste 73 characters on the name of the function?
Admin
Admin
Admin
Admin
Problem is, this was a government facility, so the check amounts were usually pretty big numbers. And those printers that don't do lower case don't do fonts either. So before long the text wouldn't fit in the allotted space. The fix, sadly, was to print the numeric amount both in the box where it originally was, and on the "text" line.
I don't know if he ever recovered from seeing all that work go to waste.
Admin
Sorry for the imprecision. I indeed meant "standard American English style", meaning "what you use in writing," as opposed to "what you use in math." So I suppose I should have said "standard (American) writing style."
And yes, you can include the commas in American English too, if you like. Just make sure to get those hyphens in there. ;-)
Admin
There is some dumb coding that at least I can comprehend. Like, when I've had to write a function like this, I've always created an array for 1 to 20 and then pulled the text from the array so it can be done with one line of code rather than a long if/then/else. But I can comprehend someone just not thinking of that, and writing the if/then/else.
But what in the world motivates someone to write "p_mode=p_mode"? Was he concerned that there might be some situation where p_mode<>p_mode? Did he have a bug where p_mode didn't appear to contain the right value, and so, just to be sure you know, he set it to itself?
There are some mistakes that indicate failure to think through the implications, or to consider beter alternatives, or maybe just a moment of sloppiness. But other mistakes ... I can only ask, Do you know what a computer is for?
Admin
There hasn't been an eval in VB since v6.
Admin
Obviously it supposed to be for thread safety. In case p_mode changes between retrieving the value and setting it back again.
Admin
Never depend on logic when using natural languages!
Your 13-19 range doesn't quite work. For example:
three+teen != "thirteen" five+teen != "fifteen"
Bonus Spanish language oddity: The "hundreds" in Spanish have an irregular 500.
cien (100) dos cientos (200) tres cientos (300) ... quinentos (500) (the first N is N+~)
Admin
Ask for an American rubber and you'll prevent pregnancy.
The Canadians use our "phraseology" and your spelling. so, maybe that's the common English.
Admin
Ah, I see someone's found some of Ada Lovelace's old code:
Function 1 - In which our values are initialized, and we meet our hero, the object X
Admin
++
Admin
I automatically assume that anyone who blames bad code on the language is as dumb as tits on bull as an analyst. There is a possibility that you're just an an elitist jackass, however.
Admin
Yeah, I remember ol' HX_373. He was THX_1138's granddad, ya know. And when he got to drinking, he would get as pissed as a parameter!
Admin
I am not seeing a problem here. It is always being recommened to use long names for better code clarification, even names of perineters and function.
Admin
Exception because Nagesh kabhi VB mein programming nahi karta!!! :}
Admin
Admin
Well, it never was defined what kind of 'high demand' - as in 'all his colleagues demanded that his hands be separated from his arms before being allowed near a computer again'
Admin
Admin
sigh
To accept this argument, one would have to ignore the fact that Visual Basic applications have delivered more business value, in the aggregate, than all other platforms combined.
Admin
You also seem to have a shaky grasp of the proper application of "so-called".
Admin
Admin
I had a coworker (not student, not off-the-street-rookie) who used the same "style" to code if/else. That is, he didn't seem to know that an else clause is not required. He also like to phrase the if-condition as a negative.
When I tried to explain this to him he said "why are you telling me this."
Admin
And did no one notice that the example at the end uses the word "and" incorrectly in the number?
Admin
Here is my quick attempt at a proper implementation of this function in Python. Note that I'm using the American method without 'and'.
Admin
I was taught to write it out without "and." The justification is that "and" adds nothing. The number is perfectly intelligible with or without.
Since "and" is way of reading "+" ("1 + 1 = 2" can be read as "one and one is two"), then really, you could put as many "and's" as you wanted.
Admin
I'd also like to add that this wikipedia article seems to agree that omitting the "and" is valid in American English.
Admin
This function's great because it goes all the way to eleevn
Admin
Admin
Admin
Admin
FTFY
Admin
If not (condition) else ...
That's right, no then clause, just straight to the else.
I asked my coworkers if they had ever questioned him. Yes, they had. Many times. The only answer he ever offered was "for readability."
Admin
Heck, is it even returning anything beyond the "bad perimeter" message? It looks like it checks if p_mode = "pass_a_number," and only starts crunching to text if it does match.
Admin
One thing I dislike is improperly embedded quotation marks. Does that use different rules across the pond as well?
By the way, "loathe" is a pretty heavy word. I'd loathe someone who shot my dog or burnt my house. Getting that angry over grammar rules that we Americans supposedly don't even know of anyways and much less follow points to other issues in the psyche.
Admin
I do love it when a method is self-commenting.
Admin
I actually felt good about the code below when I wrote it a long time ago. Converting a dollar amount to text for a check. Reading it today, I am glad we didn't have many zero dolllar checks coming through.
Admin
@. --- English numbers ---
@0 There is another thing controlled by the .{(English)} parameter. Converting numbers to words is also conditionally enabled. These can be grouped into three kinds:
1'' to
one'',1'' to
first'', and1'' to
1st''.@E English (English)L @<
@0 The last case,
1'' to
1st'', is simplest, so it comes first.@S 1_1st @. ( number -- text ) <[th]s0[st]s1[nd]s2[rd]s3 dBr 100%d10%r10/1-1 0 1i* d3-1d0i* `0+L+>
@0 The other two are also simple, if they are done using a word form table. So, that is what we will do. Word form table 1 will be used for numbers into words.
@W #1
2:0]:] 2:1]:one 2:2]:two 2:3]:three 2:4]:four 2:5]:five 2:6]:six 2:7]:seven 2:8]:eight 2:9]:nine 3:10]:ten 3:11]:eleven 3:12]:twelve 3:13]:thirteen 3:14]:fourteen 3:15]:fifteen 3:16]:sixteen 3:17]:seventeen 3:18]:eighteen 3:19]:nineteen 4:2t]:twenty 4:3t]:thirty 4:4t]:forty 4:5t]:fifty 4:6t]:sixty 4:7t]:seventy 4:8t]:eighty 4:9t]:ninety 5:-th]:th 5:ty-th]:tieth 5:one-th]:first 5:two-th]:second 5:three-th]:third 5:five-th]:fifth 5:eight-th]:eighth 5:nine-th]:ninth 5:twelve-th]:twelvth
@0 Now we have the definition for .{(1_one)} and .{(1_first)}. The second one is mostly like the first one, so it will call the first one. You should not input negative numbers to these subroutines, because it will just assume it is zero.
@S 1_one @. ( number -- text ) d[D[zero]]d[<s1 l1100%B1WD@. Get words for number 1-19 l1100%20-dix@. Deal with prefix for 20-90 l1100/10%s2hundredx@. Deal with hundreds l11000/1000%s2thousandx@. Deal with thousands l11000000/1000%s2millionx@. Deal with millions l11000000000/s2billionx@. Deal with billions
@S 1_one_20to99 AD@. Remove the tens digit left from before l110/10%B[t]+1WD@. Make word for 20-90 rdZ0[][-]ir+@. Figure out whether a hyphen should be added +@. Join the tens word with the ones word
@S 1_one_1000 l20[D][ l2(1_one)x@. A recursive call, get word for this number [ ]+r+@. Add the suffix rdZ0[][ ]ir+@. Figure out if a space is needed +@. Join the result ]ix
@S 1_first @. ( number -- text ) (1_one)x[-th]+1WD
@>