• Kemoda (unregistered)

    This is pure gold ! Oo

  • RuBen (unregistered)

    "How embarassing, I seem to not be frist!"

  • Altourus (unregistered)

    If (number % 200 < 100) ErrorMessageFrist else ErrorMessageTwo

    ??

  • (cs)

    Something went sligtly awry... I wonder if these kinds of functions are required for nuclear power plants....

    Plant is melting down... in an office surrounded by loud sirens and red flashing lights a lone computer monitor has this error message on it... with a flashing cursor next to it...

    It sure is polite tho.

  • (cs) in reply to RuBen
    RuBen:
    "How embarassing, I seem to not be frist!"
    Whoops! Something went slighty awry...
  • (cs) in reply to PiisAWheeL
    PiisAWheeL:
    RuBen:
    "How embarassing, I seem to not be frist!"
    Whoops! Something went slighty awry...
    How embarassing, you seem to have failed that task!
  • Netherous (unregistered) in reply to Altourus
    Altourus:
    If (number % 200 < 100) ErrorMessageFrist else ErrorMessageTwo

    ??

    Silly noob, you need to get an instance from RandomErrorMessageApologyGeneratorFactory and attach the MillisecondDomainPartitioningBehavior and give it your callbacks to ensure your code is flexible and robust enough for the enterprise environment.

  • Andrew (unregistered)

    Needs more XML

  • (cs)

    Actually, now that I look at it those 2 error messages are nothing close to each other.

    "Whoops! Something went slighty awry..." implys that there is a small problem... nothing we cant handle. Your pen is out of ink or some other such trivial issue.

    "How embarassing, I seem to have failed that task!" is like taking an arrow to the knee. You aren't an adventurer anymore.

    And if you are going to do that... You should have more than 2 error messages.

  • Arantor (unregistered)

    Is it wrong that I might actually consider this for non-serious errors, mostly as a form of easter egg? (i.e. for errors that should never appear in production but that if they do, it's just tripping a safety net, and would actually still list the real error underneath)

  • TheJonB (unregistered)

    Right, it's going in.

  • Gary (unregistered)

    Now.millisecond is volatile as the code executes, so this wouldn't give a random distribution. I think the distortion depends on how long it takes to execute each if statement.

    For instance, if Now.millisecond > 900 at the beginning, and it takes exactly 900 milliseconds to execute each IF statement (yeah right), it would terminate at the last else condition. If it takes less time, then sometimes it will match earlier or later.

    What I don't know is the extent of the bias introduced.

  • test (unregistered) in reply to Gary

    Yeah, because it's really important to have a uniform distribution here ! ;)

  • Nagesh (unregistered)
    [image]

    This is being a good script for call center. Can someone plz post Javav ersion?

  • Seta (unregistered) in reply to Andrew
    Andrew:
    Needs more XML

    Stored in 2 different meta tables ("TableStandardErrorMessageExclamation" and "TableStandardErrorMessageApology").

    Oh and have you heard about eval() ? This might come in handy.

  • boog (unregistered)

    Fixed?

    java.util.ArrayList<String> list = new java.util.ArrayList<String>();
    list.add("Whoops!  Something went slighty awry...");
    list.add("How embarassing, I seem to have failed that task!");
    return list.get(System.currentTimeMillis() % list.size());
    
  • Dan (unregistered) in reply to Seta
    Seta:
    Andrew:
    Needs more XML

    Stored in 2 different meta tables ("TableStandardErrorMessageExclamation" and "TableStandardErrorMessageApology").

    Oh and have you heard about eval() ? This might come in handy.

    If only it were possible to eval XML...

  • Zunesis: Nothing Less Than The Best (unregistered) in reply to boog
    boog:
    Fixed?
    java.util.ArrayList<String> list = new java.util.ArrayList<String>();
    list.add("Whoops!  Something went slighty awry...");
    list.add("How embarassing, I seem to have failed that task!");
    return list.get(System.currentTimeMillis() % list.size());
    
    What, are you just going to let all that memory get eaten up by using an ArrayList? You've got a lot to learn, nub:
    java.util.ArrayList<String> list = new java.util.ArrayList<String>();
    list.add("Whoops!  Something went slighty awry...");
    list.add("How embarassing, I seem to have failed that task!");
    String[] array = (String[]) list.toArray();
    return array[System.currentTimeMillis() % array.length];
    
  • (cs)

    I had a son who went slightly awry, and let me assure you it was how embarassing.

  • (cs)

    You are in a twisty maze of error messages, all alike.

  • Stev (unregistered) in reply to boog
    boog:
    Fixed?
    java.util.ArrayList<String> list = new java.util.ArrayList<String>();
    list.add("Whoops!  Something went slighty awry...");
    list.add("How embarassing, I seem to have failed that task!");
    return list.get(System.currentTimeMillis() % list.size());
    

    You're using Java, all you've done is broken it even more.

    (Before people shout troll, I'd like to point out that the original isn't in Java, I believe it's VB but as I don't use VB I cannot be certain. Aside from that, Java sucks).

  • DT (unregistered) in reply to Andrew
    Andrew:
    Needs more XML

    Needs more Wooden Table (tm)

  • (cs)

    One of the errors should have been: "It's a sad thing your adventure has ended here!"

    Props if anyone knows what that's from.

  • towel (unregistered) in reply to Zunesis: Nothing Less Than The Best
    Zunesis: Nothing Less Than The Best:
    boog:
    Fixed?
    ...<snip>...
    return list.get(System.currentTimeMillis() % list.size());
    
    What, are you just going to let all that memory get eaten up by using an ArrayList? You've got a lot to learn, nub:
    ...<snip>...
    return array[System.currentTimeMillis() % array.length];
    
    Ha! 293 million years from now, when System.currentTimeMillis() returns a negative value, your indexes will be out of bounds. Prepare to have your code posted here.
  • The Corrector (unregistered) in reply to towel
    towel:
    Zunesis: Nothing Less Than The Best:
    boog:
    Fixed?
    ...<snip>...
    return list.get(System.currentTimeMillis() % list.size());
    
    What, are you just going to let all that memory get eaten up by using an ArrayList? You've got a lot to learn, nub:
    ...<snip>...
    return array[System.currentTimeMillis() % array.length];
    
    Ha! 293 million years from now, when System.currentTimeMillis() returns a negative value, your indexes indices will be out of bounds. Prepare to have your code posted here.
    FTFY
  • Nails on a chalkboard (unregistered) in reply to towel
    towel:
    Zunesis: Nothing Less Than The Best:
    boog:
    Fixed?
    ...<snip>...
    return list.get(System.currentTimeMillis() % list.size());
    
    What, are you just going to let all that memory get eaten up by using an ArrayList? You've got a lot to learn, nub:
    ...<snip>...
    return array[System.currentTimeMillis() % array.length];
    
    Ha! 293 million years from now, when System.currentTimeMillis() returns a negative value, your indexes will be out of bounds. Prepare to have your code posted here.
    I'd like to point out that the code is already posted here. It's in the post you replied to.
  • (cs) in reply to The Corrector
    The Corrector:
    towel:
    Zunesis: Nothing Less Than The Best:
    boog:
    Fixed?
    ...<snip>...
    return list.get(System.currentTimeMillis() % list.size());
    
    What, are you just going to let all that memory get eaten up by using an ArrayList? You've got a lot to learn, nub:
    ...<snip>...
    return array[System.currentTimeMillis() % array.length];
    
    Ha! 293 million years from now, when System.currentTimeMillis() returns a negative value, your indexes indices will be out of bounds. Prepare to have your code posted here.
    FTFY
    Apart from the hypercorrection of indexes, which is com•plete•ly correct according to many a dictionary, you failed to correct the fundamental flaw: the original algorithm changes the message based on the decisecond, not millisecond, and will return the final message when the millisecond changes in between conditions. Duh!
  • (cs)

    The standard in login error messages is to never report whether the problem was the login or the password, so as not to give the hacker a hint as to whether they guessed the login correctly. Have you never seen an error message that gave too much information? Maybe they were just making sure. :-)

  • Andrew (unregistered)

    Ignoring the attempted randomisation, I just hate those would-be-cute error messages. Unfortunately they even crop up in supposedly professional software, e.g. Firefox when it can't recover from an aborted session: "Well, this is embarrassing". Developers - just say no.

  • (cs)

    Did anyone else hear those error messages in the voice of C3P0 while reading the article?

  • Eq (unregistered)

    The real WTF is that "embarrassing" is misspelled.

  • (cs)

    Why should software apologize? This is the stupidest idea ever!

    Oh! And 503 pages with Flash. Lovely!

  • Jazz (unregistered) in reply to Arantor
    Arantor:
    Is it wrong that I might actually consider this for non-serious errors, mostly as a form of easter egg? (i.e. for errors that should never appear in production but that if they do, it's just tripping a safety net, and would actually still list the real error underneath)

    I've actually done almost exactly that.

    My friend and I built a custom, one-off registration system for a large media convention. The very last part we wrote was the POS interface for convention employees. We were a little slap-happy by that point. When a transaction was successfully processed, the success message that popped up was something like, "Transaction approved. Woohoo!" where the last exclamation word changed randomly with each transaction. We gave it a list of about twenty exclamations (including "Marvelous," "Excellent," and "Huzzah!") but there was a 1-in-100 chance that instead it would say "Transaction approved. Let's get some beers!"

    We got a few amused inquiries from the user base about that one.

    (Captcha: incassum -- just incassumthing goes wrong.)

  • iToad (unregistered)
    Private Function GenerateApologyMessage() As String
        If Now.Millisecond < 999 Then
            Return "Whoops!  Something went slighty awry..."
        Else
            Return "Self Destruct Activated. You have 30 seconds to retreat to minimum safe distance."
        End If
    End Function
    

    ... Just to randomly liven up somebody's day.

  • Rfoxmich (unregistered)

    TRWTF is that it does not meet best error message practices. It is well known that error messages should be chosen from those in http://www.funny2.com/haiku.htm

    Second from the top should be most probable however.

    captcha secundum: Not primus or tertius but secundum.

  • Rfoxmich (unregistered) in reply to Eq

    No, that's just uh...embarrassing.

    Eq:
    The real WTF is that "embarrassing" is misspelled.
  • (cs)

    Pfft.

        Dim m_Message As String
        Private Function GenerateApologyMessage() As String
            Dim t As New Thread(AddressOf Me.DoRandomMessage)
            Dim randum as new Random
            t.Start
            Thread.Sleep(randum.Next(100))
            t.Abort
            return m_Message
        End Function
    
        Private Sub DoRandomMessage()    
            Do While True
                m_Message = "Whoops!  Something went slighty awry..."    
                m_Message =  "How embarassing, I seem to have failed that task!"
            Loop 
        End Sub
    
    
  • (cs)

    With the level of helpfullness of most error messages I have seen, this would be a no worse.

    I'm implementing this right freaking now!

  • (cs) in reply to Jazz
    Jazz:
    My friend and I built a custom, one-off registration system for a large media convention. The very last part we wrote was the POS interface for convention employees. We were a little slap-happy by that point. When a transaction was successfully processed, the success message that popped up was something like, "Transaction approved. Woohoo!" where the last exclamation word changed randomly with each transaction. We gave it a list of about twenty exclamations (including "Marvelous," "Excellent," and "Huzzah!") but there was a 1-in-100 chance that instead it would say "Transaction approved. Let's get some beers!"

    We got a few amused inquiries from the user base about that one.

    You'd have gotten more than that if that particular message happened to pop up for the contingent from the Mormon Temple Gazette.

  • Colubra (unregistered) in reply to ObiWayneKenobi
    ObiWayneKenobi:
    One of the errors should have been: "It's a sad thing your adventure has ended here!"

    Props if anyone knows what that's from.

    You are brave, warrior, but stupid!!

  • (cs) in reply to frits
    frits:
    Pfft.
        Dim m_Message As String
        Private Function GenerateApologyMessage() As String
            Dim t As New Thread(AddressOf Me.DoRandomMessage)
            Dim randum as new Random
            t.Start
            Thread.Sleep(randum.Next(100))
            t.Abort
            return m_Message
        End Function
    
    Private Sub DoRandomMessage()    
        Do While True
            m_Message = "Whoops!  Something went slighty awry..."    
            m_Message =  "How embarassing, I seem to have failed that task!"
        Loop 
    End Sub
    
    6/10. While it is a lot more convoluted than necessary, it's not nearly enterprisey enough. You should add some XML, a JSON interface and logging.
  • (cs) in reply to PedanticCurmudgeon
    PedanticCurmudgeon:
    frits:
    Pfft.
        Dim m_Message As String
        Private Function GenerateApologyMessage() As String
            Dim t As New Thread(AddressOf Me.DoRandomMessage)
            Dim randum as new Random
            t.Start
            Thread.Sleep(randum.Next(100))
            t.Abort
            return m_Message
        End Function
    
    Private Sub DoRandomMessage()    
        Do While True
            m_Message = "Whoops!  Something went slighty awry..."    
            m_Message =  "How embarassing, I seem to have failed that task!"
        Loop 
    End Sub
    
    6/10. While it is a lot more convoluted than necessary, it's not nearly enterprisey enough. You should add some XML, a JSON interface and logging.

    Yeah, well, I'm not about to post live work for this site.

  • ZeroSama (unregistered) in reply to Stev

    I agree java sucks....

  • (cs) in reply to Jazz
    Jazz:
    Arantor:
    Is it wrong that I might actually consider this for non-serious errors, mostly as a form of easter egg? (i.e. for errors that should never appear in production but that if they do, it's just tripping a safety net, and would actually still list the real error underneath)

    I've actually done almost exactly that.

    My friend and I built a custom, one-off registration system for a large media convention. The very last part we wrote was the POS interface for convention employees. We were a little slap-happy by that point. When a transaction was successfully processed, the success message that popped up was something like, "Transaction approved. Woohoo!" where the last exclamation word changed randomly with each transaction. We gave it a list of about twenty exclamations (including "Marvelous," "Excellent," and "Huzzah!") but there was a 1-in-100 chance that instead it would say "Transaction approved. Let's get some beers!"

    We got a few amused inquiries from the user base about that one.

    (Captcha: incassum -- just incassumthing goes wrong.)

    I had to write a time-tracking app for the other engineers at a previous job. I suspected they wouldn't be happy about this new and extra task of entering hours, so if you ran the app with the "/extended-errors" switch, any entry errors got a randomly chosen extended error message.

    Things like, "Try typing with your other elbow." Or, "Captain! Th' dilithium crystals canna accept a non-numeric!" Or (for entering > 24 hours in a day), "On Earth, days can have at most 24 hours." Etc.

  • Nagesh (unregistered) in reply to ZeroSama
    ZeroSama:
    I agree java sucks....
    Poor workmen is blaming his too.l

    Here in Hyderabad, we are sharing workstations for scarecity.

    [image]
  • Leo (unregistered)

    10 RANDOMIZE TIMER 20 I = RND(10) 30 IF I = 0 THEN PRINT "Whoops! Something went slighty awry..." 40 IF I = 1 THEN PRINT "How embarassing, I seem to have failed that task!" 50 IF I = 2 THEN PRINT "Whoops! Something went slighty awry..." 60 IF I = 3 THEN PRINT "How embarassing, I seem to have failed that task!" 70 IF I = 4 THEN PRINT "Whoops! Something went slighty awry..." 80 IF I = 5 THEN PRINT "How embarassing, I seem to have failed that task!" 90 IF I = 6 THEN PRINT "Whoops! Something went slighty awry..." 100 IF I = 7 THEN PRINT "How embarassing, I seem to have failed that task!" 110 IF I = 8 THEN PRINT "Whoops! Something went slighty awry..." 120 IF I = 9 THEN PRINT "How embarassing, I seem to have failed that task!" 130 GOTO 20

  • Anon (unregistered) in reply to Arantor
    Arantor:
    Is it wrong that I might actually consider this for non-serious errors, mostly as a form of easter egg? (i.e. for errors that should never appear in production but that if they do, it's just tripping a safety net, and would actually still list the real error underneath)

    No. Its not wrong. You should definately implement this. And you should definately keep the part where Now.Millisecond is partitioned into ten options. Because splitting it into two would not make it random enough.

  • (cs)

    Two words: Female programmer

  • SunTzuWarmaster (unregistered)

    FIXED WITH PYTHON:

    from random import choice
    choice(["Whoops!  Something went slighty awry...", "How embarassing, I seem to have failed that task!"])
    
  • (cs)

    Greetings from the future. Your olden ways are fascinating. Just think this to your synthetic personal assistant, and it'll update your code for you:

    Private Function GenerateApologyMessage() As String
    	Return If(Qubit.Collapse, "Whoops!  Something went slighty awry...", "How embarassing, I seem to have failed that task!")
    End Function
    

Leave a comment on “GenerateApologyMessage()”

Log In or post as a guest

Replying to comment #:

« Return to Article