GenerateApologyMessage()

  • Kemoda 2012-03-14 10:18
    This is pure gold ! Oo
  • RuBen 2012-03-14 10:19
    "How embarassing, I seem to not be frist!"
  • Altourus 2012-03-14 10:20
    If (number % 200 < 100)
    ErrorMessageFrist
    else
    ErrorMessageTwo

    ??
  • PiisAWheeL 2012-03-14 10:20
    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.
  • PiisAWheeL 2012-03-14 10:21
    RuBen:
    "How embarassing, I seem to not be frist!"
    Whoops! Something went slighty awry...
  • Anketam 2012-03-14 10:25
    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 2012-03-14 10:26
    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 2012-03-14 10:28
    Needs more XML
  • PiisAWheeL 2012-03-14 10:31
    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 2012-03-14 10:36
    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 2012-03-14 10:39
    Right, it's going in.
  • Gary 2012-03-14 10:51
    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 2012-03-14 10:57
    Yeah, because it's really important to have a uniform distribution here ! ;)
  • Nagesh 2012-03-14 11:06


    This is being a good script for call center. Can someone plz post Javav ersion?
  • Seta 2012-03-14 11:06
    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 2012-03-14 11:12
    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 2012-03-14 11:14
    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 2012-03-14 11:18
    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];

  • Lockwood 2012-03-14 11:21
    I had a son who went slightly awry, and let me assure you it was how embarassing.
  • Zylon 2012-03-14 11:30
    You are in a twisty maze of error messages, all alike.
  • Stev 2012-03-14 11:32
    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 2012-03-14 11:34
    Andrew:
    Needs more XML


    Needs more Wooden Table (tm)
  • ObiWayneKenobi 2012-03-14 11:43
    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 2012-03-14 11:45
    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 2012-03-14 11:51
    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 2012-03-14 11:56
    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.
  • TGV 2012-03-14 12:00
    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!
  • Rick 2012-03-14 12:02
    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 2012-03-14 12:17
    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.
  • Mason Wheeler 2012-03-14 12:19
    Did anyone else hear those error messages in the voice of C3P0 while reading the article?
  • Eq 2012-03-14 12:22
    The real WTF is that "embarrassing" is misspelled.
  • ubersoldat 2012-03-14 12:22
    Why should software apologize? This is the stupidest idea ever!

    Oh! And 503 pages with Flash. Lovely!
  • Jazz 2012-03-14 12:25
    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 2012-03-14 12:38
    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 2012-03-14 12:46
    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 2012-03-14 12:47
    No, that's just uh...embarrassing.

    Eq:
    The real WTF is that "embarrassing" is misspelled.
  • frits 2012-03-14 12:50
    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

  • KattMan 2012-03-14 12:52
    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!
  • da Doctah 2012-03-14 13:08
    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 2012-03-14 13:10
    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!!
  • PedanticCurmudgeon 2012-03-14 13:25
    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.
  • frits 2012-03-14 13:42
    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 2012-03-14 13:50
    I agree java sucks....
  • D-Coder 2012-03-14 13:57
    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 2012-03-14 14:02
    ZeroSama:
    I agree java sucks....

    Poor workmen is blaming his too.l

    Here in Hyderabad, we are sharing workstations for scarecity.

  • Leo 2012-03-14 14:10
    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 2012-03-14 14:14
    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.
  • Melnorme 2012-03-14 14:26
    Two words: Female programmer
  • SunTzuWarmaster 2012-03-14 14:32
    FIXED WITH PYTHON:

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

  • Throck 2012-03-14 14:35
    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
  • Gurth 2012-03-14 14:38
    ubersoldat:
    Why should software apologize?

    Maybe the person who wrote it was trained on Microsoft Bob? In which case, the software would probably need to apologize.
  • PiisAWheeL 2012-03-14 14:38
    Anon:
    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.
    You need MOAR!!! Moar error messages to confuse the user. That way when they get like 3 different error messages in a row they will think that there is a different problem causing them.
  • PiisAWheeL 2012-03-14 14:40
    Melnorme:
    Two words: Female programmer
    As sexy as that sounds... what you're saying is she shoulda stayed in the kitchen?
  • Nagesh 2012-03-14 14:51
    Random error messages are introduced for purpose of leting client beleive that something euniquely different occur in computer each time. This way client think, he has wonderfull system
  • Gary 2012-03-14 15:14
    You are in a maze of twisty passages all alike.
  • Gary 2012-03-14 15:16
    Gary:
    You are in a maze of twisty passages all alike.

    Plugh! Someone posted this already.
  • whatevs 2012-03-14 16:02
    Starship Catan.
  • Secret 2012-03-14 16:19
    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 have died of cholera.
  • Schrödinger's cat 2012-03-14 16:22
    Throck:
    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

    It returned .
  • dkf 2012-03-14 16:28
    Zunesis: Nothing Less Than The Best:
    String[] array = (String[]) list.toArray();
    Now I know you don't write Java code for a living.
  • Gneius 2012-03-14 16:50
    Netherous:
    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.


    These two classes look a bit too tightly coupled in concept for my liking. I think the core logic needs to be factored out into implementation(s) of a TimeDomainDrivenErrorMessageGenerationStrategy interface, then the Behaviour object can probably be pared down to a simple collection of key/value pairs.
  • Darkstar 2012-03-14 17:02
    In fact, this has already been covered by Damian Conway (notable perl hacker) with the module Quantum::Superpositions.
  • Jimmy 2012-03-14 17:03
    Andrew:
    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.
    I dunno, I used to love tar (yes I know it's not an error message, but same principle):
    "Cowardly refusing to create empty archive"

    Also IIRC, many of the Sierra Games used to crash with:
    "You did something we didn't expect"
  • Mick 2012-03-14 17:04
    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.
    Pick-A-Path/"Choose your own adventure" books?
  • Gunslinger 2012-03-14 17:18
    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)


    As long as you have more than 2 error messages when there's 10 cases, sure, it's all good.
  • Gunslinger 2012-03-14 17:41
    dkf:
    Zunesis: Nothing Less Than The Best:
    String[] array = (String[]) list.toArray();
    Now I hope you don't write Java code for a living.


    FTFY
  • The Great Lobachevsky 2012-03-14 18:17
    Mick:
    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.
    Pick-A-Path/"Choose your own adventure" books?


    Was it Shadowgate? I remember my adventure ending in that a lot, mostly involving falling into pits and such :)
  • Matt Westwood 2012-03-14 19:18
    It certainly beats the "Oh bugger" that used to spontaneously appear at the bottom of the screen when running a program that appeared on my list of programs to maintain and upgrade a few years ago.

    When I reprogrammed it to get the error to explain itself, disappointment was raised by all the people who would never again be graced with the delights of "Oh bugger" when they fatfingered the input. Silly buggers.
  • Anonymous Coward 2012-03-14 21:33
    Still seems over-engineered.
    return System.currentTimeMillis() / 100 % 2 == 0 ? "Whoops!  Something went slighty awry..." : "How embarassing, I seem to have failed that task!";
  • CZeke 2012-03-14 22:02
    Arantor:
    Is it wrong that I might actually consider this for non-serious errors, mostly as a form of easter egg?


    Not at all -- but for the sake of sanity, at least calculate the millisecond only once. This guy probably thought he was setting up the equivalent of a switch() structure, but instead it's a sieve: the first error message has a 10% chance of triggering, the second has a 20% chance, and so on, all independent. It needs a variable, like the GWBasic version posted upthread. If you're gonna do the wrong thing, do it correctly!
  • FuBar 2012-03-14 22:32
    If Now.Millisecond = 666 Then
    
    Return "Be afraid. Be very afraid."
  • oheso 2012-03-14 23:03
    Throck:
    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


    Fool! This function is not multiverse-safe!
  • click 2012-03-14 23:15
    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.


    So, -7 % 2 != 1?
  • Mick 2012-03-14 23:22
    click:
    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.


    So, -7 % 2 != 1?


    in Java, -7 % 2 = -1 I think....
  • Mick 2012-03-14 23:26
    Mick:
    click:
    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.


    So, -7 % 2 != 1?


    in Java, -7 % 2 = -1 I think....
    http://docs.oracle.com/javase/specs/jls/se7/html/jls-15.html#jls-15.17.3

    Akismet blows dead goats fallopian tubes
  • Stivlo 2012-03-15 00:31
    Your solution is not as efficient as the original code, but nice try.

    I would have enjoyed more messages, like 'I tried my best, but I failed, sorry', 'I've to confess that the task didn't go the way I planned', 'I messed this one up, I am so sorry!', 'Apologies, the task was aborted'
  • The Darned 2012-03-15 03:37
    Shouldn't we suspect ambiguous requirements: it probably said "give a different message for each error condition."

    Admittedly the solution doesn't quite do that.
  • daef 2012-03-15 04:42


    return System.currentTimeMillis() / 100 % 2 == 0 ? "Whoops! Something went slighty awry..." : "How embarassing, I seem to have failed that task!";



    i smell a off-by-1-error there - didn't check thou since i am lazy by nature (=> i code for livin')
  • dkf 2012-03-15 05:37
    Gunslinger:
    dkf:
    Zunesis: Nothing Less Than The Best:
    String[] array = (String[]) list.toArray();
    Now I hope you don't write Java code for a living.
    FTFY
    No, I meant exactly what I said. That code snippet above will never work. It will always produce an exception, every single time. I know how to fix it, but that's not the point: any Java coder who has ever used toArray() has encountered this, and it's one of the most annoying misfeatures of the type-system. (Damnit, I know why it is this way and I can see clearly how every step into this sinkhole was taken, but it's still stupid!)
  • Nagesh 2012-03-15 06:04
    Usual case when people keep shift from PHP to PERL to PYTHON to JAVA to C# to VB.NET, confusion occuring on massive scale in brain.

    Without compiler it is difficult to sort out problem. Real programmer using Notepad and avoid this issue of mixed languages.

    In real world, I use Hindi word while speaking in English. Happens every day. Now lets go jaldi-jaldi on next topic please.
  • Musaran 2012-03-15 06:23
    Aren't random, useless error messages an industry standard ?
  • BitDreamer 2012-03-15 08:18
    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.


    According to Google, it's from a website called TheDailyWTF.com. Check it!
  • asmand 2012-03-15 08:19
    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.


    Shadowgate?
  • Patrick 2012-03-15 08:38
    Anketam:
    PiisAWheeL:
    RuBen:
    "How embarassing, I seem to not be frist!"
    Whoops! Something went slighty awry...
    How embarassing, you seem to have failed that task!
    Whoops! Commenting went slightly awry...
  • ObiWayneKenobi 2012-03-15 08:51
    Secret:
    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 have died of cholera.


    No, that's Oregon Trail.

    The correct answer is Shadowgate.

    Props to anyone who got it :D
  • Al 2012-03-15 09:06
    Nice that it keeps system testers busy.

    Is this a repeatable error? Sometimes. OK, possibly a separate defect for each error message. I'll raise one for each.

    ---

    Anyway, forget the apology. How about including a message that tries to shift the blame and accuses the user of system mis-use? Maybe with a reminder that all errors are logged and reported?
  • Ben Jammin 2012-03-15 09:42
    Al:
    Nice that it keeps system testers busy.

    Is this a repeatable error? Sometimes. OK, possibly a separate defect for each error message. I'll raise one for each.

    ---

    Anyway, forget the apology. How about including a message that tries to shift the blame and accuses the user of system mis-use? Maybe with a reminder that all errors are logged and reported?


    I like accusatory validation on user input i.e. "Email address is invalid" changes to "Do you not really know your email address? Have you not really learned to tpye? We're blocking your IP cause obviously you are one of 'those' clients who is gonna be clogging all our support lines."

    (yes, in that instance tpye would be purposeful)
  • Brogrammer 2012-03-15 10:29
    PiisAWheeL:
    Melnorme:
    Two words: Female programmer
    As sexy as that sounds... what you're saying is she shoulda stayed in the kitchen?


    Just like Bachmann. Wonder what ol' Crazy Eyes is up to nowadays...
  • boog 2012-03-15 10:35
    I'm pretty sure Alex needs to write a GenerateApologyMessage() method for the days he can't get this site up and running or I'll pound his face.
  • a nonny mouse 2012-03-15 11:49
    boog:
    I'm pretty sure Alex needs to write a GenerateApologyMessage() method for the days he can't get this site up and running or I'll pound his face.


    Is that a new .net language? "hisface#"
  • frits 2012-03-15 11:58
    boog:
    I'm pretty sure Alex needs to write a GenerateApologyMessage() method for the days he can't get this site up and running or I'll pound his face.
    I'm pretty sure you don't know what "up and running" means. Your not to smart, are you?
  • PiisAWheeL 2012-03-15 12:01
    boog:
    I'm pretty sure Alex needs to write a GenerateApologyMessage() method for the days he can't get this site up and running or I'll pound his face.

    The Daily WTF (top left corner of the site):
    Louisville, KY - see you at Code PaLOUsa (Mar 15-17)
    Read Much?
  • PiisAWheeL 2012-03-15 12:02
    a nonny mouse:
    boog:
    I'm pretty sure Alex needs to write a GenerateApologyMessage() method for the days he can't get this site up and running or I'll pound his face.


    Is that a new .net language? "hisface#"
    Wtf is "hisface sharp"?
  • blank 2012-03-15 12:43
    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());


    probably being trolled, but the frist thing to hurt my eyes was the declared type being anything more specific than java.util.List
  • KattMan 2012-03-15 13:26
    Ben Jammin:
    I like accusatory validation on user input i.e. "Email address is invalid" changes to "Do you not really know your email address? Have you not really learned to tpye? We're blocking your IP cause obviously you are one of 'those' clients who is gonna be clogging all our support lines."

    (yes, in that instance tpye would be purposeful)


    I actually had an instance once to do something like this. There was an executive manager that would constantly try to delete something, get the popup asking if he is sure, always saying yes, then suddenly realizing what he did and come running in to us to fix it. Of course the system just marked it as deleted, without really delting it so recovering was easy.

    On the next release he found something interesting.
    He tries to delete a record, it asks if he is sure, he clicks yes, then it asks if he is posistive, then absolutly sure, then unequivically certian, then politly denied him the right to delete said record. He had to have his secretary do it for him. We triggered this only on his user id so no one else saw it.

    Took two weeks before the next release came out so he could get back to normal and he rarely ever had his "mistakes" again. He was actually a good guy to IT, he saw the humor in it and laughed about it later with us.
  • Kivi 2012-03-15 15:39
    KattMan:

    There was an executive manager that would constantly try to delete something, get the popup asking if he is sure, always saying yes, then suddenly realizing what he did and come running in to us to fix it. Of course the system just marked it as deleted, without really deleting it so recovering was easy.

    This is why we need robust undo functionality. Confirmation dialogues may make us feel good but they just don't quite work as intended, do they? Users either waste time trying to navigate them, or they learn to always click yes and end up like your executive manager, at some point clicking yes when they ought to have clicked no. And by users I mean all of us!

    In this case, since you were already using soft deletions, an undo feature should have been fairly straightforward to implement.
  • KattMan 2012-03-15 16:26
    Kivi:
    KattMan:

    There was an executive manager that would constantly try to delete something, get the popup asking if he is sure, always saying yes, then suddenly realizing what he did and come running in to us to fix it. Of course the system just marked it as deleted, without really deleting it so recovering was easy.

    This is why we need robust undo functionality. Confirmation dialogues may make us feel good but they just don't quite work as intended, do they? Users either waste time trying to navigate them, or they learn to always click yes and end up like your executive manager, at some point clicking yes when they ought to have clicked no. And by users I mean all of us!

    In this case, since you were already using soft deletions, an undo feature should have been fairly straightforward to implement.

    I agree, would have been easy, but they did not want it, imagine the chaos, people randomly deletign and undeleting at will! The undo feature was in our hands only, it was called a SQL script, though undoing mistakes made by that would have been far more difficult.
  • oheso 2012-03-15 21:19
    Al:
    How about including a message that tries to shift the blame and accuses the user of system mis-use? Maybe with a reminder that all errors are logged and reported?


    I see you're familiar with PowerSchool.
  • Indigo 2012-03-16 03:47
    Melnorme:
    Two words: Female programmer
    Oh, you're so right!

    They'd really need someone like that to prevent such awful code.
  • KattMan 2012-03-16 08:31
    Indigo:
    Melnorme:
    Two words: Female programmer
    Oh, you're so right!

    They'd really need someone like that to prevent such awful code.


    I know right, havign a female programmer walk in would stop all code from being written as the male programmers all stop and stare in disbelief. Then of course everyone gets back to work once they realize it's just Jim in drag.
  • Anonymous Pedant 2012-03-16 08:59
    Whoever wrote this code should also be embarrassed that he can't spell "embarrassing"...
  • KattMan 2012-03-16 09:30
    Anonymous Pedant:
    Whoever wrote this code should also be embarrassed that he can't spell "embarrassing"...

    Maybe he wrote it while.. emm bare assing in front of a female programmer.
  • James 2012-03-16 10:06
    I thought that all problems were fixed with the simple line of


    throw 0
  • Gibbon1 2012-03-17 19:35
    Matt Westwood:
    It certainly beats the "Oh bugger" that used to spontaneously appear at the bottom of the screen when running a program that appeared on my list of programs to maintain and upgrade a few years ago.

    When I reprogrammed it to get the error to explain itself, disappointment was raised by all the people who would never again be graced with the delights of "Oh bugger" when they fatfingered the input. Silly buggers.


    I once had a program with a status box that would spit out what it was sort of up to. At one point after a bunch of preconditions were satisfied it spit out 'Hulk Smash!'

    Uses loved that.
  • Spewin Coffee 2012-03-19 14:15
    50% of all error messages are embarrassing.
  • st 2012-03-20 04:40
    Spewin Coffee:
    50% of all error messages are embarrassing.


    And the rest occur when something goes awry?
  • Stefan 2012-03-23 07:36
    The haiku error messages made my day and actually inspired me to write some. They are not accepting submissions however, so I setup an error message haiku on my blog:

    http://noshtniptici.blogspot.de/2012/03/error-message-heiku-contest.html
    (UI is in Bulgarian but actual haikus are in English, and the blogspot UI in a foreign language shouldn't be a problem)
  • toshir0 2012-05-07 09:50
    Rfoxmich:
    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
    Thanks for the stupid link. I'm tempted to use one of them, I must admit. This one.
    Serious error.
    All shortcuts have disappeared.
    Screen. Mind. Both are blank
  • slinkhi 2012-08-16 16:48
    or maybe it isn't supposed to be random. Maybe it's supposed to be a diff msg depending on the time and at the time he only had 2 msgs and decided to alternate. Maybe in the future he will have a different one for each time, and they aren't supposed to be random, but specific given time of day.
  • Darkhog 2013-04-01 07:55
    The real WTF is why only two messages are here even if there's place of ten. I could make them up easily.