• (cs) in reply to Cad Delworth
    Cad Delworth:
    mschaad:
    I just appreciated the fact that the English output is still wrong.

    [GrammarNazi] 13,387,281 rendered as words should read "thirteen million three hundred eighty-seven thousand two hundred eighty-one". Note that the word "and" is not in there at all, and tens are properly hyphenated. :-) [/GrammarNazi]

    In the USA, yes, BUT:

    [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."

    The British tic of critiquing American English is one of the many reasons I loathe British people on the internet.

  • (cs) in reply to Ben Jammin
    Ben Jammin:
    Cad Delworth:
    The American tic of removing "and" from such phrases is one of the many reasons I loathe so-called "American (or "US") English."

    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.

    They do it all the time. Apparently, our short form nationality of "American" bothers them as well, since they insist on inserting the laughable "USian" designation from time to time. Everyone needs a hobby, I guess.

  • chernobyl (unregistered)

    Methinks this code has come from beyond the Ballmer peak.

  • Stew (unregistered) in reply to Cad Delworth
    mschaad:
    I just appreciated the fact that the English output is still wrong.
    Cad Delworth:
    In the USA, yes ... I wish someone would have the guts to just call their variant of the language "American,"
    F:
    You clearly don't know about standard English style in writing numbers. AFAICT you are confusing it with standard American style.

    Ah yes, because clearly there's such a thing as "Standard English" as opposed to "American English". Not at all ethnocentric there.

    But kudos for seeing through the insipid facade of critiquing the code sample and spotting mschaad's clearly nationalistic agenda.

    operagost:
    Apparently, our short form nationality of "American" bothers them as well, since they insist on inserting the laughable "USian" designation from time to time.

    Good point. I suppose for maximum semantic clarity with minimum of panic-inducing nationalist saber-rattling, we should really starting using the terms "English" and "USish". Although, to avoid the appearance of disingenuity and insensitivity, I suggest we go one better and adopt "UKish" and "USish".

  • LANMind (unregistered) in reply to geoffrey, MCP, PMP
    geoffrey:
    LANMind:
    geoffrey:
    Jaunticed:
    I'm banking on this being just a joke. Evidence?
    'Shortened name of the function due to errors on polling the function
    

    Considering that the EXAMPLE USAGE shows what we can guess was the previous function name, and how the new name is needlessly verbose... yeah.

    One of Visual Basic's many useful features is an Eval function, which executes any text string you hand to it as code. The original author is probably using Eval, and has discovered a limitation on length for the argument.

    There hasn't been an eval in VB since v6.

    Which is why this re-envisioned ".Net" pales in comparison to classic Visual Basic.

    I can tell you're trying hard to troll, but someone should smack you back into reality just the same.

  • swschrad (unregistered)

    include (lib.universe) include (lib.nothought) include (lib.greatbooksofhistory)

    . . .

  • Jerry (unregistered) in reply to Ben Jammin
    Ben Jammin:
    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.
    You did that on purpose, didn't you. Doesn't matter; I'm coming to burn down your house.
  • Carl (unregistered)

    What we have here is a simple misunderstanding of object-oriented principles. Someone told him "every function should have a this self-reference" which becomes apparent once you look at some of his other function names:

    system_will_wait_for_a_connection_request_when_you_call_this_function handle_initial_connection_request_with_this_function login_page_will_be_shown_when_control_is_passed_to_this_function look_up_user_id_and_password_in_database_using_perimeters_passed_to_this_function check_for_successful_drop_table_sql_injection_and_if_it_happened_restore_the_table_with_this_function ...

  • RS (unregistered) in reply to ObiWayneKenobi

    Hey Nagesh is not the only one guilty of butchering the English language. I work with many WASPs and their use of the English language is not much better.

  • Jeff (unregistered) in reply to Carl
    Carl:
    What we have here is a simple misunderstanding of object-oriented principles.
    Makes sense. After all, this is obviously a getter:

    get_words_from_a_number_which_is_passed_as_a_perimeter_into_this_function

  • szufler (unregistered)

    What a great project. It can only be compared to Great Pyramid in Giza.

    The manager should hire a few million Egyptian slaves. They would complete the source code with all the elseif-s.

  • szufler (unregistered) in reply to MikeN
    MikeN:
    My favorite part is that it's version 15.1.

    Isn't it obvious? It supports numbers up to 15, right? Then it had to be AT LEAST 15 versions of this product. After all, each supported number should be carefully designed, coded and tested.

    You can't possibly expect for such a product to support, say 10 numbers in version 1.0, can you??

    CAPTCHA: transverbero

  • Darth Paul (unregistered)

    The first .NET project I worked on made use of "temperate" variables and "temperate" tables.

    Perhaps it was the same guy?

  • Norman Diamond (unregistered)

    '*** Product name: numbers to word enterprise edition Current version 15.1

    Others have commented on the version number but that is random. The giveaway here for the humour-impaired is the words "enterprise edition".

    THIS CODE IS IRONIC, YOU GUYS. IT WAS WRITTEN BY SOMEONE WHO HAD TO SUFFER WTFS CREATED BY COLLEAGUES, OR IMPOSED BY MANAGERS. IT'S LIKE SOME OF THE INTENTIONALLY ENTERPRISEY CODE WRITTEN IN COMMENTS ON OTHER POSTINGS, i.e. A HIGHLY SARCASTIC RESPONSE WELL EARNED BY OTHER WTFS.

    If it were a calculator it would suit the old WTF calculator contest. BY DESIGN.

    Sheesh.

  • (cs) in reply to zzo38
    Tasty:
    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+~)

    Not quite. "Five hundred" in Spanish is "quinientos". It has almost the same sound as "quiñentos" would have, but there's an extra syllable: qui-ni-en-tos. (Also, 200, 300, 400, 600, 700, 800, and 900 are written without a medial space: doscientos, trescientos, cuatrocientos, seiscientos, setecientos, ochocientos, novecientos.)

    [/Spanish vocabulary rant]

    ============================================

    zzo38:
    <snip> 5:twelve-th]:twelvth
    This was written on the Twelfth of Never, right?

    ============================================

    Stew:
    I suppose for maximum semantic clarity with minimum of panic-inducing nationalist saber-rattling, we should really starting using the terms "English" and "USish".
    Nah -- just use a colloquialism from Québec: "tasunien". (Pronounced tah-zu-nee-ENH [nasal N], from the latter sounds of États Unis [United States].)
  • ozzie (unregistered) in reply to mschaad
    mschaad:
    I just appreciated the fact that the English output is still wrong.

    [GrammarNazi] 13,387,281 rendered as words should read "thirteen million three hundred eighty-seven thousand two hundred eighty-one". Note that the word "and" is not in there at all, and tens are properly hyphenated. :-) [/GrammarNazi]

    Also, to render numbers correctly as words (with the hyphens and everything) is a harder trick than you might think. Thankfully, standard English style dictates that you pretty much never spell out any numbers above nine.

    So where would you need a library like this, unless your app writes checks?

    [SpellingNazi] You mean cheques? [/SpellingNazi]

    Captcha - opto - I opto point out your spelling mistakes while you point out grammar mistakes.

  • geoffrey, MCP, PMP (unregistered) in reply to LANMind
    LANMind:
    geoffrey:
    LANMind:
    geoffrey:
    Jaunticed:
    I'm banking on this being just a joke. Evidence?
    'Shortened name of the function due to errors on polling the function
    

    Considering that the EXAMPLE USAGE shows what we can guess was the previous function name, and how the new name is needlessly verbose... yeah.

    One of Visual Basic's many useful features is an Eval function, which executes any text string you hand to it as code. The original author is probably using Eval, and has discovered a limitation on length for the argument.

    There hasn't been an eval in VB since v6.

    Which is why this re-envisioned ".Net" pales in comparison to classic Visual Basic.

    I can tell you're trying hard to troll, but someone should smack you back into reality just the same.

    You can't do it, you a weak bitch, you gotta keep tha PMP hand strong.

  • Not Frist (unregistered)

    I've only seen 2 developers that write code worse than that, but amazingly most other developers I've worked with aren't that much better. Only about 10% of software developers are worth a shit, while the rest just get in the way. Pathetic.

  • Nemo (unregistered)

    My Python version... I wrote this before I saw Gavin's post, then tweaked it a little.

    http://pastebin.com/dyeU8ykb

  • Anonymous (unregistered) in reply to TGV
    TGV:
    THE BUG FIXES! THE BUG FIXES!! OMG, THEY DO NOTHING!!
    The OP made me lol, but this post made me LOL. ;D

    The first WTF is VB (VB.NET?).

    The second WTF is the blatant spelling error.

    The third WTF is the ridiculous symbol names.

    The fourth WTF is assigning an error message to a 'mode' parameter... I first lost my composure here.

    The fifth WTF is the NOP when the first parameter is an empty string, and worse it checks for the condition again after it can't possibly be true!

    The sixth WTF is writing the 'mode' to the response stream.

    It keeps going and going... What's worse, some of these behaviors are evident in my colleagues' code...

    Captcha: tation - The first thing that popped into my head was "tater nation", and for that I'm sure I'm going to Hell.

  • AndyCanfield (unregistered)

    I had to write one of these recently. Downloaded one from the Internet and translated it into PHP. Only mine had to be multi-lingual (warning - different languages parse numbers differently). Had to build in a limit of 999,999,999 because America and England can't agree on 1,000,000,000.

  • (cs)

    I'd be keen to see the German equivalent of this function.

  • (cs) in reply to AndyCanfield
    AndyCanfield:
    I had to write one of these recently. Downloaded one from the Internet and translated it into PHP. Only mine had to be multi-lingual (warning - different languages parse numbers differently). Had to build in a limit of 999,999,999 because America and England can't agree on 1,000,000,000.

    I thought you said it had to be multi-lingual?

  • (cs) in reply to AndyCanfield
    AndyCanfield:
    Had to build in a limit of 999,999,999 because America and England can't agree on 1,000,000,000.
    You'll be “pleased” to know that you can go further now. Usage in the UK has changed over the past couple of decades to use the US style of naming 10⁹ as “one billion”, probably due to the influence of the financial sector and the business world's close transatlantic links.

    Myself, I'd have preferred the use of the SI prefix scheme: gigaquid or terabuck.

  • Joe (unregistered)

    This is a good demonstration of why VB and VB.NET should not exist at all. These supposedly easy-to-handle languages attract a whole lot of idiots who demand they can write code when in fact they don't even know how to turn it off and on again. C++ or C# might have stopped them in time, but they can feel right at home with Basic dialects and squeeze out something that is rather a crime than any use. We will sad examples like this as long as there are programming languages that pretend to be simple.

  • English Man (unregistered)

    Self-documenting functions. Why have sqrt(x) when you could have calculate_the_square_root_of_the_number_you_want_to_get_the_square_root_of_which_is_passed_into_this_function(x)

  • (cs) in reply to mschaad
    mschaad:
    I just appreciated the fact that the English output is still wrong.
    13,387,281 rendered as words should read "thirteen million three hundred eighty-seven thousand two hundred eighty-one". Note that the word "and" is not in there at all, and tens are properly hyphenated. :-)

    Also, to render numbers correctly as words (with the hyphens and everything) is a harder trick than you might think. Thankfully, standard English style dictates that you pretty much never spell out any numbers above nine.

    So where would you need a library like this, unless your app writes checks?

    I've written something like this before (by "Like this" I mean, it had a similar desired output). It was to act as a poor mans speech synthesizer. I needed audio notifications that would read out numbers, so had wav files for 0-20, one for each ten from then to 90 (20, 30, 40...) and then words like "Hundred", "Thousand", "Million" and importantly "And". Then my code would parse an integer and create a queue of which sound files to play. As I recall it took maybe 15 lines of code...

    Then again, I'd hate to see what happens when this guy discovers recursion!

  • (cs) in reply to English Man
    English Man:
    Self-documenting functions. Why have sqrt(x) when you could have calculate_the_square_root_of_the_number_you_want_to_get_the_square_root_of_which_is_passed_into_this_function(x)

    You forgot to say how it's passed to the function? Is it a perimiter? A circumference? What?!? How do you expect people to understand what your function does if you don't name it correctly!??!

  • L. (unregistered) in reply to Nagesh
    Nagesh:
    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.

    /agree . java modern style function naming inside of VB . how much worse can it get ?

  • L. (unregistered) in reply to Not Frist
    Not Frist:
    I've only seen 2 developers that write code worse than that, but amazingly most other developers I've worked with aren't that much better. Only about 10% of software developers are worth a shit, while the rest just get in the way. Pathetic.
    That's a weak point of view. imho it's closer to .001478% --
  • (cs)

    As others said it is so hilariously bad it has to be a joke.

    But then, if it actually got in the codebase and stayed there, I guess the author was making a point about some WTF going on around.

  • Geoff (unregistered) in reply to Cad Delworth

    You know now that you say that it must be a COBOL conversion. I have seen some (automatic) COBOL to C 'compilers' that would turn the entire DATA DIVISION into one large struct or depending on how it got used elsewhere in the program a union of a few large structs. It was clear no human being evening if they had never written printf("hello world"); before would have come up with it.

    Similarly I can't imagine anyone would come up with this naming scheme for functions in BASIC unless they were working with an existing code base, perhaps (hopefully or my faith in humanity will die) automatically generated in some way.

  • (cs) in reply to Ryan
    Ryan:
    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.
    If these were for cheques, many machine-printed cheques here in the UK have a workaround for that.

    They use 'special' cheques which have separate pre-printed boxes for each text 'digit,' with a pre-printed 'label' above each box. So for example, 'millions,' hundred thousands,' 'ten thousands,' 'thousands,' 'hundreds,' 'tens,' 'units,' 'pence.'

    When the cheque hits the PC (or other) printer, each box has the text for zero to nine (as appropriate) printed into it. Much simpler, and avoids any grammar problems (!).

  • (cs)

    My favourite bit is how the example given doesn't even work with the current implementation. get_words_from_a_number_which_is_passed_as_a_perimeter_into_this_function("pass_a_number","13,387,281") would return "Exceeds word range."

  • the beholder (unregistered) in reply to Watson
    Watson:
    AndyCanfield:
    I had to write one of these recently. Downloaded one from the Internet and translated it into PHP. Only mine had to be multi-lingual (warning - different languages parse numbers differently). Had to build in a limit of 999,999,999 because America and England can't agree on 1,000,000,000.

    I thought you said it had to be multi-lingual?

    Yes, but haven't we established on this very thread that the bastardization of the language USians speak/write is a lot different of the way UK-born people butcher the language themselves? Might as well call them different languages altogether.

  • trollalot (unregistered) in reply to Michal
    Michal:
    He meant definitely "parameter" when writing "perimeter".

    Do you think?

    Michal:
    Then it starts making sense.

    Yeah... I'm not so sure anything about this code makes sense... ;o)

  • Nagesh (unregistered) in reply to RS
    RS:
    Hey Nagesh is not the only one guilty of butchering the English language. I work with many WASPs and their use of the English language is not much better.
    Not understand. Wasp is insect meking nest in corner of my ofice. We are not being able to kil this leving creatures, even though I am geting stinged daily. :(
  • blank (unregistered) in reply to operagost
    operagost:
    Ben Jammin:
    Cad Delworth:
    The American tic of removing "and" from such phrases is one of the many reasons I loathe so-called "American (or "US") English."

    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.

    They do it all the time. Apparently, our short form nationality of "American" bothers them as well, since they insist on inserting the laughable "USian" designation from time to time. Everyone needs a hobby, I guess.

    i'm a native english english speaker. i try to overlook spelling and grammatical errors in written language (unless it's a proofreading task, or something i have to sign.) communication is the aim; syntax, spelling and punctuation conventions make comprehension easier and misunderstanding less likely (in theory*)

    "USian" is twee and cliche, and sounds like someone spelling out "usen." if i had to use "US" instead of "American" (for example, if my audience were pedants or wierdos likely to be respond with the "2 continents" argument regardless of the context) then i'd say "US-esque", just because it sounds nicer; "USian"

    as for the OP: it's clearly been written specifically for submission to TDWTF; TRWTF is commenters who don't realise this.

    p.s. the captchas are so trivial (and repetitive) that very few robots are incapable of solving them, we should just be thankful they don't deign to comment here.

    *In theory, theory is the same as practice. In practice, it is not

  • blank (unregistered) in reply to Musaran
    Musaran:
    As others said it is so hilariously bad it has to be a joke.

    But then, if it actually got in the codebase and stayed there, I guess the author was making a point about some WTF going on around.

    +2

  • Brad (unregistered)

    I've been a reader for a very long time, and this is the best I've seen. I'd call fake, but it'd be very difficult to come up with something this good. Amazing, dazzling, scintillating... awe inspiring! It's so good it goes to eleevn!

    BTW (related), if anyone needs a decimal to English currency converter, I have one posted. I was surprised when I looked and couldn't find one before I wrote it.

  • (cs) in reply to Claxon
    Claxon:
    English Man:
    Self-documenting functions. Why have sqrt(x) when you could have calculate_the_square_root_of_the_number_you_want_to_get_the_square_root_of_which_is_passed_into_this_function(x)

    You forgot to say how it's passed to the function? Is it a perimiter? A circumference? What?!? How do you expect people to understand what your function does if you don't name it correctly!??!

    It calculates the parameter (2*pi) of the first perimeter. Duh.

  • Mark (unregistered) in reply to geoffrey, MCP, PMP
    geoffrey:
    Anymouse:
    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.

    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 personal computer languages combined.

    FTFY. (n.b. COBOL, most likely PL/I) And only because Excel contains VB (otherwise Excel would beat it).

  • (cs)

    geoffrey is plain pagal - (crazy).

    java has created more value for business. java is not restricted to just business apps, but also used inside your car, your camera, your phone, your alarm clock and everywhere you can care to think of.

    So geoffrey is failing in providing any true picture of world.

  • wonk (unregistered)

    [quote=Article] 'Sometimes a 'four' would be outputted when '5' was passed through the perimeter[/quote] NOW that episode of Star Trek makes sense. Heh. 4 lights....

  • Kempeth (unregistered)

    I like this section a lot more than the actual conversion:

    If p_mode = "" Then
        ' String.Replace returns the changed string which in this case is simply dropped
        ' instead of just assigning a new value you call an expensive method
        ' String.Replace throws an exception if the first parameter is an empty string.
        p_mode.Replace("", "No perimeter was passed through")
    Else
        ' NOP
        p_mode = p_mode
    End If
    
    ' unless you pass this delimiter in the parameter through the perimeter the if clause will never trigger
    If p_mode = "No perimeter was passed through" Then
        ' so you're essentially undoing everything you almost did in the first part...
        p_mode = ""
    Else
        ' uhm, you already did this 10 lines ago.
        ' But then again. If that code didn't do anything can you really say that you have already done it?
        If p_mode = "" Then
            p_mode.Replace("", "No perimeter was passed through")
        Else
            p_mode = p_mode
        End If
    End If

    It is strangely Zen like...

  • Nagesh (unregistered) in reply to Nagesh
    Nagesh:
    geoffrey is plain pagal - (crazy).

    java has created more value for business. java is not restricted to just business apps, but also used inside your car, your camera, your phone, your alarm clock and everywhere you can care to think of.

    So geoffrey is failing in providing any true picture of world.

    Here in Hyderabad, we use chicken for alarum clock.

  • RandomGuy (unregistered) in reply to Gavin
    Gavin:
    Here is my quick attempt at a proper implementation of this function in Python. Note that I'm using the American method without 'and'.

    Yes, but who buys new beer if the last bottle falls down the wall?

  • A 'Brit' (unregistered) in reply to operagost
    The British tic of critiquing American English is one of the many reasons I loathe British people on the internet.

    The American tic of loathing the English defending their language (notice that the Scots, Welsh and Irish won't defend it); and getting confused between Britain and the coutries that make it, is one of the many reasons I loathe Armerican people on the internet.

  • the REAL geoffrey (unregistered) in reply to Mark
    Mark:
    FTFY. (n.b. COBOL, most likely PL/I) And only because Excel contains VB (otherwise Excel would beat it).

    Neither COBOL nor PL/I have provided the value of VB in aggregate. While everything may have been running one of those mainframe languages at one time, it was also at a time when total business activity was far lower than it was at the dawn of RAD platforms. Additionally, computing was a far smaller percentage of total business activity. There is a difference between greater reach and value provided.

    One could argue that VB broke ground in business computing. Being able to rapidly deploy user-friendly tools for workers' every day tasks, as well as seamless integration with Excel and Access, made Visual Basic a pioneer in the business world.

  • (cs) in reply to A 'Brit'
    A 'Brit':
    The British tic of critiquing American English is one of the many reasons I loathe British people on the internet.

    The American tic of loathing the English defending their language (notice that the Scots, Welsh and Irish won't defend it); and getting confused between Britain and the coutries that make it, is one of the many reasons I loathe Armerican people on the internet.

    The opinions of folks from a fallen empire which has shrunken to the size of the Philadelphia metro area do not interest me.

Leave a comment on “get_words_from_a_number_which_is_passed_as_a_perimeter_into_this_function”

Log In or post as a guest

Replying to comment #:

« Return to Article