• Zunetang (unregistered)

    tl;dr - dan rather just pist frost.

  • DaveK (cs)

    Passed as a perimeter? Sounds kinda edgy to me.

  • MikeN (unregistered)

    My favorite part is that it's version 15.1.

  • 3rd Ferguson (unregistered)

    I thought we frowned on using student code as WTFs.

    //CAPTCHA: "inhibeo" - the spell that causes Hermione to get nervous and put her robe back on

  • M (unregistered)

    This function just skirts the issue...

    Captcha: feugiat - feugiataboutit

  • KattMan (cs)

    Honestly it's a language parser, should be easy to do all numbers with little more code.

    Go 1-9, then 10-12, then 13-19 becomes easy (nine) + (teen) After that everything else is easy 21, 31 are (twenty) + (one) or (thirty) + (one).

    Yeah this function is a serious WTF, even in its name, sounds like the forgot to name it and just put the comment as the name.

  • Anon (unregistered)

    I love how schizophrenic this is. On the one hand you've got a variable named "WORD_CONVERTED_FROM_A_NUMBER_PASSED_THROUGH_A_PERIMETER", but on the other hand you have "HX_373".

    It's like a epic battle between overly long descriptive variable names and short, completely cryptic variable names, fighting for the soul of this function.

  • Julia (cs)

    I can't wait for the future version that handles up to 10^8...

  • DaveK (cs) in reply to MikeN
    MikeN:
    My favorite part is that it's version 15.1.
    And "enterprise edition", no less!
  • configurator (unregistered) in reply to KattMan
    KattMan:
    Honestly it's a language parser, should be easy to do all numbers with little more code.

    Go 1-9, then 10-12, then 13-19 becomes easy (nine) + (teen) After that everything else is easy 21, 31 are (twenty) + (one) or (thirty) + (one).

    Yeah this function is a serious WTF, even in its name, sounds like the forgot to name it and just put the comment as the name.

    "Eightteen" for 18 would be better than "four" for 5, I guess... (see "bugs fixed")

  • Anon (unregistered)
    'Establish p_mode to define correct perimeter If p_mode = "" Then p_mode.Replace("", "No perimeter was passed through") Else p_mode = p_mode End If
    If p_mode = "No perimeter was passed through" Then
        p_mode = ""
    Else
        If p_mode = "" Then
            p_mode.Replace("", "No perimeter was passed through")
        Else
            p_mode = p_mode
        End If
    End If</div></BLOCKQUOTE>
    

    I can't even begin to understand the thought process here. 15 lines that do absolutely nothing. It simplifies to p_mode = p_mode which is a NOP.

  • GoodtimesSnuggler (unregistered)

    I like the bugs fixed

    "'Shortened name of the function due to errors on polling the function"

    THIS IS THE SHORTER NAME?!

  • Coyne (cs)

    Enterprisey. Very enterprisey. Also shtupid.

  • NickS (unregistered)

    At one of my previous jobs they hired a new guy not because he was qualified in any way for the job, but solely on the basis that he used to be a Russian rocket scientist during the Cold War.

    Instead of doing the things required of his job, he spent 8 hours a day making calendars in MS Paint with various decorations for each month, printing them out, and handing them to everyone in the department. If he made a change to one month, he reprinted everything out again for everyone and went around swapping out the old calendars for the new ones.

    He was fired in two weeks. For some reason, seeing this code reminded me of him. Good intentions, poor execution, completely irrelevant to the task at hand.

  • ubersoldat (cs) in reply to Coyne
    Patched this function so that mode offers expert perimeter settings for advanced programmers

    Yeah right!

  • Bruce W (unregistered)

    One of my elementary school teachers told me if I am going to spell a word wrong at least keep the same spelling throughout what I am writing. Glad to see someone else took that lesson to heart. (yes, yes "perimeter" is a real word...)

  • Quirkafleeg (unregistered)

    I like the fact that the first bug fixer could spell "three" but thought "eleevn" was a perfectly acceptable number.

  • TGV (cs)

    THE BUG FIXES! THE BUG FIXES!! OMG, THEY DO NOTHING!!

  • Rafael Giusti (unregistered) in reply to DaveK

    Passed as a perimeter? Sounds kinda edgy to me.

    TUDUM TSS!!!

  • Decius (unregistered) in reply to Anon
    Anon:
    'Establish p_mode to define correct perimeter If p_mode = "" Then p_mode.Replace("", "No perimeter was passed through") Else p_mode = p_mode End If
    If p_mode = "No perimeter was passed through" Then
        p_mode = ""
    Else
        If p_mode = "" Then
            p_mode.Replace("", "No perimeter was passed through")
        Else
            p_mode = p_mode
        End If
    End If</div></BLOCKQUOTE>
    

    I can't even begin to understand the thought process here. 15 lines that do absolutely nothing. It simplifies to p_mode = p_mode which is a NOP.

    Not quite nothing- if you pass "no perimeter ...", it changes to an empty string.

    Granted, it doesn't do anything remotely useful, but that's not the same thing as a NOP.

  • Michal (unregistered) in reply to DaveK

    He meant definitely "parameter" when writing "perimeter". Then it starts making sense.

  • C-Octothorpe (cs) in reply to Anon
    Anon:
    I love how schizophrenic this is. On the one hand you've got a variable named "WORD_CONVERTED_FROM_A_NUMBER_PASSED_THROUGH_A_PERIMETER", but on the other hand you have "HX_373".

    It's like a epic battle between overly long descriptive variable names and short, completely cryptic variable names, fighting for the soul of this function.

    golf clap

  • Bleat (unregistered)
    'API call removed due to high demand
    1. How much was this used that this was ever in 'high demand'
    2. What kind of API call would this even use? What's more, would it actually have been useful?
  • Weps (cs)
    "... Please try again"

    Hahaha

  • Doug (unregistered)

    Time for this programmer to enter the ranks of management and spend the rest of his/her career saying how "we used to do it."

  • Steve The Cynic (cs)

    If you ask me, whoever wrote it was just taking the piss. It would be worth the submitter's while, I think, to search for calls to this.

    In code that's reachable from somewhere reachable, if you get my drift...

  • KattMan (cs) in reply to Weps

    Ok Code challenge!

    Challenge A: write one that can handle conversion of numerics to text without range failures (we can limit at somewhere around the millions? billions?) in the fewest lines possible.

    Challenge B: write one that still gives the answer but in the most convoluted way.

    Challenge C: By far the easiest, do one or the other challenges but in a way that we can't tell what you were going for.

  • Jaunticed (unregistered)

    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.

  • PiisAWheeL (cs) in reply to Decius
    Decius:
    Anon:
    'Establish p_mode to define correct perimeter If p_mode = "" Then p_mode.Replace("", "No perimeter was passed through") Else p_mode = p_mode End If
    If p_mode = "No perimeter was passed through" Then
        p_mode = ""
    Else
        If p_mode = "" Then
            p_mode.Replace("", "No perimeter was passed through")
        Else
            p_mode = p_mode
        End If
    End If</div></BLOCKQUOTE>
    

    I can't even begin to understand the thought process here. 15 lines that do absolutely nothing. It simplifies to p_mode = p_mode which is a NOP.

    Not quite nothing- if you pass "no perimeter ...", it changes to an empty string.

    Granted, it doesn't do anything remotely useful, but that's not the same thing as a NOP.

    My thoughts exactly. But it also made my eyes bleed.

    'Shortened name of the function due to errors on polling the function
    Shortened it from what?!
  • Prosthetic Lips (cs) in reply to Michal
    Michal:
    He meant definitely "parameter" when writing "perimeter". Then it starts making sense.

    True, but since this function was for a dictionary and spell checker, that makes it even more ironic!

  • _rnd (unregistered)

    get_comment_from_a_number_and_post_comment_to_function_and_submit_to_website_tdwtf()

  • Spider Flyer (unregistered)

    Wow...

    ...How old is this code? Because I saw working code that would do this in a '79 or '80 copy of 'Creative Computing'.

    Also, you can find working code online if you search for a one of the 'large' number suffixes plus the name of your favorite computer language.

    For example, while searching for 'septillion c#', I found: http://www.vb-helper.com/howto_net_number_to_words2.html

  • the beholder (unregistered) in reply to MikeN
    MikeN:
    My favorite part is that it's version 15.1.
    I bet that "bug fixes" section is gonna be quite long by the time he puts 10^8 in the range.

    Whoever wrote this code should be thrown out the window... of a orbital station.

  • KattMan (cs) in reply to the beholder
    the beholder:
    MikeN:
    My favorite part is that it's version 15.1.
    I bet that "bug fixes" section is gonna be quite long by the time he puts 10^8 in the range.

    Whoever wrote this code should be thrown out the window... of a orbital station.

    In a degrading orbit or with exiting force?

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

  • vt_mruhlin (unregistered)
    'Sometimes a 'four' would be outputted when '5' was passed through the perimeter
    Can we all take a moment to imagine just how bad the original version of this must have been if that particular problem only reproed sometimes?
  • KattMan (cs) in reply to vt_mruhlin
    vt_mruhlin:
    'Sometimes a 'four' would be outputted when '5' was passed through the perimeter
    Can we all take a moment to imagine just how bad the original version of this must have been if that particular problem only reproed sometimes?

    Was this a problem, perhaps when 5 breeched rthe perimeter one was actually removed by security. This could be expected behaviour.

  • da Doctah (cs) in reply to KattMan
    KattMan:
    Honestly it's a language parser, should be easy to do all numbers with little more code.

    Go 1-9, then 10-12, then 13-19 becomes easy (nine) + (teen) After that everything else is easy 21, 31 are (twenty) + (one) or (thirty) + (one).

    Did you learn that when you were threeteen, or wait until you turned fiveteen?

  • PedanticCurmudgeon (cs) in reply to Steve The Cynic
    Steve The Cynic:
    If you ask me, whoever wrote it was just taking the piss. It would be worth the submitter's while, I think, to search for calls to this.

    In code that's reachable from somewhere reachable, if you get my drift...

    I was thinking the same thing when I saw the response.write in the middle of the function.
  • KattMan (cs) in reply to da Doctah
    da Doctah:
    KattMan:
    Honestly it's a language parser, should be easy to do all numbers with little more code.

    Go 1-9, then 10-12, then 13-19 becomes easy (nine) + (teen) After that everything else is easy 21, 31 are (twenty) + (one) or (thirty) + (one).

    Did you learn that when you were threeteen, or wait until you turned fiveteen?

    I learned it back when I was eleventeen!

  • ObiWayneKenobi (cs)

    Looks like something Nagesh would write; isn't that the type of Hinglish that he writes in?

  • Anketam (cs) in reply to GoodtimesSnuggler
    GoodtimesSnuggler:
    I like the bugs fixed

    "'Shortened name of the function due to errors on polling the function"

    THIS IS THE SHORTER NAME?!

    I had the identical reaction.

  • Anonymous (unregistered) in reply to KattMan

    Really? I didn't learn it until eleventyone.

  • toth (cs)

    I like that he replaces the empty string with that useless string...but only when the parameter is the empty string.

    Because assigning literals to parameters is for suckers.

  • Tim (unregistered)

    obviously a hoax, but a hilarious one :-)

    the 'bug fixed' is the best part

  • Kasper (unregistered) in reply to configurator
    configurator:
    better than "four" for 5, I guess... (see "bugs fixed")
    Given the look of the code it is not surprising that such a bug could have slipped in. What scares me is that it only happened sometimes.
  • big picture thinker (unregistered)

    p_comment = "Guys take it easy on him. He obviously never dealt with perimeters before and was just experimenting with this advanced technology. I'd like to see any of you implement a function that uses perimeters!" If p_comment = "" Then p_comment = "" Else p_comment = p_comment End If

  • mschaad (unregistered)

    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?

  • itsmo (unregistered)

    Seriously, did no one else notice "forteen"

  • dogmatic (unregistered)

    Firing's too good for this clown. I do believe a hanging's in order.

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