ISelfAware, Very Thorough, Crazy Hashmaps, and More

« Return to Article
  • Larry 2010-09-29 09:05
    the article:


    if (_tblItem.getTable().getModel() != null
    && _tblItem.getTable() != null
    && _tblItem != null)


    TRWTF is languages that read left-to-right.
  • Bobbo 2010-09-29 09:06
    I, Robot
  • TGV 2010-09-29 09:06
    I can only hope they rolled a die to ensure this was actually random

    And I hope they are in a universe where 215 is actually a prime.
  • Uh... 2010-09-29 09:07
    public static int RANDOM_PRIME_NUMBER = 215

    Ok, I see how this might be random when he entered it, but I do not see how it is prime.
  • Mad Adder 2010-09-29 09:07
    "This is in our production code," notes Joseph Daigle, "I can only hope they rolled a die to ensure this was actually random."
    public static int RANDOM_PRIME_NUMBER = 215;


    Hrmm... not random, not a prime number. Looks like we got a winner here.
  • One 2010-09-29 09:09
    Do we get to have a discussion about whether or not 1 is a prime number?
  • WthyrBendragon 2010-09-29 09:09
    I keep thinking that that getSelf() method should be Private. After all, wouldn't you want to be private while doing some sort of self exam?
  • cynical cynic 2010-09-29 09:09
    At last, the explanation to all the Bert Glanstrom comments!
    public static boolean isFunnyOrInsightful(comment c)
    
    {
    return !isFunny(c) && !isInsightful(c);
    }
  • Markp 2010-09-29 09:10
    TGV:
    I can only hope they rolled a die to ensure this was actually random

    And I hope they are in a universe where 215 is actually a prime.


    Maybe that code path is only taken if 1 == 0?
  • Bogolese 2010-09-29 09:10
    <div>ine
  • Mad Adder 2010-09-29 09:11
    And TRWTF is a triple-simul-post... or me just not refreshing in the few seconds it took to type my comment.
  • OPTIMUS PRIME 2010-09-29 09:11
    If by prime they mean divisible by itself, 1, and 5 then yes, 215 is a prime number.
  • Fibonacci 2010-09-29 09:12
    "... 3. is for lucky :)"

    priceless <3
  • Markp 2010-09-29 09:15

    // Do not remove the following line. HashMaps are crazy and point
    // to old reference data even if they were instantiated fresh!
    workMap.clear();


    Come on, who among us hasn't sat debugging something so long that the logical conclusion is a conspiracy? Paranoia is the natural mental state.
  • The Nerve 2010-09-29 09:15
    Fixed?

    //public interface ISelfAware {
    //
    // /**
    // * Useful in an MBean so that it can return a live reference to itself as a
    // * method call
    // *
    // * @return reference to this object
    // */
    // public ISelfAware getSelf();
    //}

    //if(completed == 1)
    // if(startdate[1] != 2)
    month = startdate[2];
    // else
    // month = startdate[2];
    //else
    // month = startdate[2];

    if (&& _tblItem != null != null
    && _tblItem.getTable() != null
    _tblItem.getTable().getModel())

    /* This program will only run if the laws of mathematics hold
    if(1 == 0)
    {
    fprintf("Oh crap - we are not running in the correct Universe\n");
    exit(17);
    }*/

    public static int FIXED_NONPRIME_NUMBER = 215;

    /*3 times because if we have filter on some column -
    clean only that data, and after that cleans everything
    else (2.), and the 3. is for lucky :)
    worksheet.Cells.ClearContents();
    worksheet.Cells.ClearContents(); */
    worksheet.Cells.ClearContents();

    Map<TransactionId, List<BillingTransaction>> workMap
    = new HashMap<TransactionsId, List<BillingTransaction>>();

    // Do not remove the following line. HashMaps are crazy and point
    // to old reference data even if they were instantiated fresh!
    //workMap.clear();

    public static boolean isNotAlphaNumeric(char c)
    {
    return !isLetter(c) && !isDigit(c);
    }

    <!-- <script type="text/javascript">document.write('</div>')</script>
    <noscript></div></noscript> -->
  • WthyrBendragon 2010-09-29 09:15
    One:
    Do we get to have a discussion about whether or not 1 is a prime number?


    Well, it is only integer factorable to 1 and itself so, yes, 1 is prime.

    However, random it is not.
  • Anonymous 2010-09-29 09:16
    I like the way there appears to be a dedicated error code for "not running in the correct Universe". I'd have gone for -42 instead of 17 but well done anyway. Wait, can you pass negative exit codes? I suppose it doesn't matter, if that error code ever gets returned we have to assume that the apocalypse is upon us.
  • Anon a mouse 2010-09-29 09:17
    OPTIMUS PRIME:
    If by prime they mean divisible by itself, 1, and 5 then yes, 215 is a prime number.


    Well itself 1, 5 and 43
  • frits 2010-09-29 09:18

    Arnold Vriezekolk writes, "one of the guys on our team likes to be thorough. Very, very thorough."

    /* This program will only run if the laws of mathematics hold */
    if(1 == 0)
    {
    fprintf("Oh crap - we are not running in the correct Universe\n");
    exit(17);
    }






    Right. Because in your universe fprintf() doesn't need a file pointer.
  • Remy Martin 2010-09-29 09:19
    I just got done refactoring all the references to logError to wtf and checking it into the application.
  • Short-ed 2010-09-29 09:22
    Here's another bit of code that I came across recently, taken from production code, of course!


    int16_t wrapCounts( int16_t delta ) {
    const short SIZE_SHORT = 32768;
    int16_t ret;

    if (delta < -SIZE_SHORT)
    ret = -(2 * SIZE_SHORT + delta);
    else if (delta > SIZE_SHORT)
    ret = (2 * SIZE_SHORT - delta);
    else
    ret = delta;

    return ret;
    }


    Enjoy!


    Captcha: feugiat - contrapuntal Fiat
  • DOA 2010-09-29 09:24
    Markp:
    Come on, who among us hasn't sat debugging something so long that the logical conclusion is a conspiracy?
    The sad part is I completely agree with this.
  • notovny 2010-09-29 09:24
    The standard formulation of the Fundamental Theorem of Arithmetic requires that 1 not be considered a prime number.
  • Old Smith 2010-09-29 09:26
    I rolled a die while reading this
  • Matt 2010-09-29 09:28
    Short-ed:
    Here's another bit of code that I came across recently, taken from production code, of course!


    int16_t wrapCounts( int16_t delta ) {
    const short SIZE_SHORT = 32768;
    int16_t ret;

    if (delta < -SIZE_SHORT)
    ret = -(2 * SIZE_SHORT + delta);
    else if (delta > SIZE_SHORT)
    ret = (2 * SIZE_SHORT - delta);
    else
    ret = delta;

    return ret;
    }


    Somebody missed the day when they talked about variables having finite space in memory and not being drawn out of the ether.
  • anon 2010-09-29 09:30
    For those unable to read this comment, it says:
    <NoComment>For those unable to read this comment, it says:
    <NoComment>For those unable to read this comment, it says:
    <NoComment>For those unable to read this comment, it says:
    <NoComment>For those unable to read this comment, it says:
    <NoComment>For those unable to read this comment, it says:
    <NoComment>For those unable to read this comment, it says:
  • An Non 2010-09-29 09:31
    Actually I think I know what the ISelfAware is trying to achieve - bypassing the proxy logic and pass a direct reference to the original java object when instantiated within the same JVM. Messy and badly named... but I worryingly believe I understand what they meant to achieve (i.e. a badly thought out early optimisation)
  • operagost 2010-09-29 09:32
    Old Smith:
    I rolled a die while reading this

    http://xkcd.com/221/
  • Bert Glanstron 2010-09-29 09:32
    Dear cynical cinic,

    In case you can’t tell, this is a meta-joke comment. The fact that you insist on bashing people who beat old memes clearly shows that you’re too mature and too intelligent to be posting on TDWTF.

    Go back to your Starbucks.

    Sincerely,
    Bert Glanstron

    [Captcha: commoveo - The people's SUV!]
  • Ancient Mathematician 2010-09-29 09:33
    WthyrBendragon:
    One:
    Do we get to have a discussion about whether or not 1 is a prime number?


    Well, it is only integer factorable to 1 and itself so, yes, 1 is prime.

    However, random it is not.

    Well, if you were old enough, you'd know that 1 is not even a number, so it can't be a prime.
    And if you're young enough, you should know that 1 is a unit, so it can't be a prime.
    Only if you're stuck some time between -200 and 1900 is 1 a prime.
  • Anonymous 2010-09-29 09:34
    frits:

    /* This program will only run if the laws of mathematics hold */
    if(1 == 0)
    {
    fprintf("Oh crap - we are not running in the correct Universe\n");
    exit(17);
    }

    Right. Because in your universe fprintf() doesn't need a file pointer.

    You can't just assume this is C/C++. Plenty of other languages have an fprintf function and not all require a file pointer. In Matlab, for example, the fprintf function writes to the screen if no file ID is provided.
  • Anonymous Kernel Hacker 2010-09-29 09:35
    I think certain versions of Linux have included the line

    if(false)panic();

    just to verify that boolean logic is operating correctly.
  • briggs davis 2010-09-29 09:36
    The Nerve:
    Fixed?

    //public interface ISelfAware {
    //
    // /**
    // * Useful in an MBean so that it can return a live reference to itself as a
    // * method call
    // *
    // * @return reference to this object
    // */
    // public ISelfAware getSelf();
    //}

    //if(completed == 1)
    // if(startdate[1] != 2)
    month = startdate[2];
    // else
    // month = startdate[2];
    //else
    // month = startdate[2];

    if (&& _tblItem != null != null
    && _tblItem.getTable() != null
    _tblItem.getTable().getModel())

    /* This program will only run if the laws of mathematics hold
    if(1 == 0)
    {
    fprintf("Oh crap - we are not running in the correct Universe\n");
    exit(17);
    }*/

    public static int FIXED_NONPRIME_NUMBER = 215;

    /*3 times because if we have filter on some column -
    clean only that data, and after that cleans everything
    else (2.), and the 3. is for lucky :)
    worksheet.Cells.ClearContents();
    worksheet.Cells.ClearContents(); */
    worksheet.Cells.ClearContents();

    Map<TransactionId, List<BillingTransaction>> workMap
    = new HashMap<TransactionsId, List<BillingTransaction>>();

    // Do not remove the following line. HashMaps are crazy and point
    // to old reference data even if they were instantiated fresh!
    //workMap.clear();

    public static boolean isNotAlphaNumeric(char c)
    {
    return !isLetter(c) && !isDigit(c);
    }

    <!-- <script type="text/javascript">document.write('</div>')</script>
    <noscript></div></noscript> -->

    ironically, your comment contains many comments.
  • Dani Messerman 2010-09-29 09:39
    No, because it's also divisible by 43 :)
  • DaveK 2010-09-29 09:40
    Actually, no, it's bloody Akismet, which wouldn't let me post the source of the mangled link in the article because it looked spammy, but is perfectly happy to let me post this link http://pastebin.com/J5tAekpK to the post content instead.
  • Dani Messerman 2010-09-29 09:41
    OPTIMUS PRIME:
    If by prime they mean divisible by itself, 1, and 5 then yes, 215 is a prime number.

    Forgot to quote this in my previous comment ^^
  • frits 2010-09-29 09:41
    Anonymous:
    frits:

    /* This program will only run if the laws of mathematics hold */
    if(1 == 0)
    {
    fprintf("Oh crap - we are not running in the correct Universe\n");
    exit(17);
    }

    Right. Because in your universe fprintf() doesn't need a file pointer.

    You can't just assume this is C/C++. Plenty of other languages have an fprintf function and not all require a file pointer. In Matlab, for example, the fprintf function writes to the screen if no file ID is provided.


    OK, you out-nerded me there (that's not difficult, btw). You could also come up with some #define scenario that would allow that (or a user function prototype). However, snippets posted on TDWTF is supposed to be professional production code, so please don't mention Matlab. Additionally, those aren't Matlab comments, are they?

  • v 2010-09-29 09:41
    Uh...:
    public static int RANDOM_PRIME_NUMBER = 215

    Ok, I see how this might be random when he entered it, but I do not see how it is prime.


    public static NOT_RANDOM_NOT_PRIME_BUT_PROBABLY_NOT_A_NUMBER = 215
  • NullPointerException 2010-09-29 09:46
    frits:
    However, snippets posted on TDWTF is supposed to be professional production code, so please don't mention Matlab.

    I would be pretty surprised if there wasn't at least one case of someone using Matlab for production purposes.
  • itsmo 2010-09-29 09:47
    One:
    Do we get to have a discussion about whether or not 1 is a prime number?


    Do we get to have a discussion about whether or not 1 is a number?

    FTFY
  • Anonymous 2010-09-29 09:48
    Ancient Mathematician:
    WthyrBendragon:
    One:
    Do we get to have a discussion about whether or not 1 is a prime number?


    Well, it is only integer factorable to 1 and itself so, yes, 1 is prime.

    However, random it is not.

    Well, if you were old enough, you'd know that 1 is not even a number, so it can't be a prime.
    And if you're young enough, you should know that 1 is a unit, so it can't be a prime.
    Only if you're stuck some time between -200 and 1900 is 1 a prime.

    Hey there Ancient Mathematician, you might be just the person I need to help me with an ancient Roman math problem. The following sum is written in Roman numerals. Can you solve it and provide your answer also in Roman numerals?

    (IV + I) - V = ?
  • Steve The Cynic 2010-09-29 09:49
    And don't forget the code I found a very long time ago, in the Technical Reference manual for the IBM PC/XT (or maybe it was the PC/AT - I said it was a long time ago). This was the time when IBM published the assembly source of the BIOS in the Tech Ref manual, and the first few instructions executed after the escape from 0FFFFh:0000-land[1] consisted of stuffing a value into one of the machine's 16-bit registers and proving that it could be passed from register to register, hitting all of them. If the original value did not emerge at the other end, the BIOS panicked.

    [1] All versions of the 8086 processor family start in something that approximates to the 8086's real mode (exception: the 80376 started in protected mode as it was an abortive attempt to get away from real mode. It failed in the market) at a 16:16 address of 0xFFFF:0x0000. They have 16 bytes to jump somewhere else before they fall off the end of the world and start executing the real-mode interrupt vector table. It is a really good idea to make sure that this part of the BIOS ROM contains just a far jump.
  • Oh THAT Brian! 2010-09-29 09:55
    Also divisible by 43 - really a good example of a random prime number!
  • anon 2010-09-29 09:55
    Markp:

    // Do not remove the following line. HashMaps are crazy and point
    // to old reference data even if they were instantiated fresh!
    workMap.clear();


    Come on, who among us hasn't sat debugging something so long that the logical conclusion is a conspiracy? Paranoia is the natural mental state for a software developer.


    FTFY
  • Steve The Cynic 2010-09-29 09:55
    Anonymous:
    Hey there Ancient Mathematician, you might be just the person I need to help me with an ancient Roman math problem. The following sum is written in Roman numerals. Can you solve it and provide your answer also in Roman numerals?

    (IV + I) - V = ?

    Ah, but you forget that the things we call Roman numerals were for writing down numbers, not for performing arithmetic. One of the principal advantages of the modern versions of Arabic numerals (the 0..9 system that we use today) is that they use the same notation for writing down numbers and for doing arithmetic. The Romans used a form of abacus (note that the wire-and-bead calculators that we call abacuses are in fact NOT abacuses) when performing non-trivial arithmetic.

    All that, of course, does not change the fact that there is no way to use Roman number-recording-notation to write zero.
  • Severity One 2010-09-29 09:59
    "I could make a smart-ass comment about needing a reference to get a reference, but I think the code speaks for itself."

    So make the method static!

    Really, some people know nothing about programming.
  • THE NUMBER ONE 2010-09-29 10:00
    Do we get to have a discussion about whether or not I am a number?

    FTFY
  • Pyrexkidd 2010-09-29 10:00
    notovny:
    The standard formulation of the Fundamental Theorem of Arithmetic requires that 1 not be considered a prime number.


    An element p of the ring D, nonzero and not a unit, is called prime if it can not be decomposed into factors p=ab, neither of which is a unit in D.
    http://primes.utm.edu/notes/faq/one.html


    and now it is all clear. whew.
  • itsmo 2010-09-29 10:01
    Steve The Cynic:
    Anonymous:
    Hey there Ancient Mathematician, you might be just the person I need to help me with an ancient Roman math problem. The following sum is written in Roman numerals. Can you solve it and provide your answer also in Roman numerals?

    (IV + I) - V = ?

    Ah, but you forget that the things we call Roman numerals were for writing down numbers, not for performing arithmetic. One of the principal advantages of the modern versions of Arabic numerals (the 0..9 system that we use today) is that they use the same notation for writing down numbers and for doing arithmetic. The Romans used a form of abacus (note that the wire-and-bead calculators that we call abacuses are in fact NOT abacuses) when performing non-trivial arithmetic.

    All that, of course, does not change the fact that there is no way to use Roman number-recording-notation to write zero.


    There is also a way of doing arithmetic with Roman numerals:

    http://mathforum.org/dr.math/faq/faq.roman.html#calc

    BTW Askimet is a fucking idiot - can't put URL tags round this^^
  • Anonymous 2010-09-29 10:01
    frits:
    Anonymous:
    frits:

    /* This program will only run if the laws of mathematics hold */
    if(1 == 0)
    {
    fprintf("Oh crap - we are not running in the correct Universe\n");
    exit(17);
    }

    Right. Because in your universe fprintf() doesn't need a file pointer.

    You can't just assume this is C/C++. Plenty of other languages have an fprintf function and not all require a file pointer. In Matlab, for example, the fprintf function writes to the screen if no file ID is provided.

    OK, you out-nerded me there (that's not difficult, btw). You could also come up with some #define scenario that would allow that (or a user function prototype). However, snippets posted on TDWTF is supposed to be professional production code, so please don't mention Matlab. Additionally, those aren't Matlab comments, are they?

    No, those aren't Matlab comments. Matlab was just a random example of a language with its own implementation of fprintf but you're right, the less said about it the better. Weak dynamic typing is surely the work of the devil (great source of WTF though).
  • Chris 2010-09-29 10:03
    This reminds me of this time I was in this place and was doing something. It did or didn't' work out that time. I had bad dreams about inserting a tape or drive that same night.

    Captcha: commoveo:
    BYOO - Bring your own oreos.
  • anon 2010-09-29 10:05
    Chris:
    This reminds me of this time I was in this place and was doing something. It did or didn't' work out that time. I had bad dreams about inserting a tape or drive that same night.

    Captcha: commoveo:
    BYOO - Bring your own oreos.


    Wha? :|
  • NickR 2010-09-29 10:07
    From here on all my code is going to implement ISelfAware. A new project called "SkyNet" or something just came through.
  • CJ 2010-09-29 10:08
    Can someone explain the wtf with the hashmap to me?
  • Chris 2010-09-29 10:08
    anon:
    Chris:
    This reminds me of this time I was in this place and was doing something. It did or didn't' work out that time. I had bad dreams about inserting a tape or drive that same night.

    Captcha: commoveo:
    BYOO - Bring your own oreos.


    Wha? :|


    Yeah, I don't know either. I thought it was related, but I haven't slept in 28 hours, and hurting a bit from it.

    Incassum.
  • cie3 2010-09-29 10:12
    Oh crap - we are not commenting in the correct Universe
  • swedish tard 2010-09-29 10:14
    WthyrBendragon:
    One:
    Do we get to have a discussion about whether or not 1 is a prime number?


    Well, it is only integer factorable to 1 and itself so, yes, 1 is prime.

    However, random it is not.

    http://en.wikipedia.org/wiki/Prime_number#Primality_of_one

    No, it is not.
  • Bert Glanstron 2010-09-29 10:19
    frits:

    Arnold Vriezekolk writes, "one of the guys on our team likes to be thorough. Very, very thorough."

    /* This program will only run if the laws of mathematics hold */
    if(1 == 0)
    {
    fprintf("Oh crap - we are not running in the correct Universe\n");
    exit(17);
    }






    Right. Because in your universe fprintf() doesn't need a file pointer.

    You are an idiot, and should be banned from using your mommy and daddy's modem.
  • 00Davo 2010-09-29 10:20
    Steve The Cynic:
    Anonymous:
    Hey there Ancient Mathematician, you might be just the person I need to help me with an ancient Roman math problem. The following sum is written in Roman numerals. Can you solve it and provide your answer also in Roman numerals?

    (IV + I) - V = ?

    Ah, but you forget that the things we call Roman numerals were for writing down numbers, not for performing arithmetic. One of the principal advantages of the modern versions of Arabic numerals (the 0..9 system that we use today) is that they use the same notation for writing down numbers and for doing arithmetic. The Romans used a form of abacus (note that the wire-and-bead calculators that we call abacuses are in fact NOT abacuses) when performing non-trivial arithmetic.

    All that, of course, does not change the fact that there is no way to use Roman number-recording-notation to write zero.

    Could one not write zero in Roman numerals like this: " "?
  • anonymous 2010-09-29 10:20
    Obviously this is from an embedded system without a file system. Why would you need a file pointer there?
  • Anonymous 2010-09-29 10:21
    CJ:
    Can someone explain the wtf with the hashmap to me?

    To be honest it's not possible to verify whether this is a WTF or not. Java has a HashMap class that is empty when instantiated, so if this were Java it would be a WTF because he is explicitly clearing an empty map. But in actuality, this isn't Java at all because it is using the .NET generics syntax (HashMap<T,T>). This is not a built-in .NET class, someone has written this from scratch and they were probably trying to replicate the Java functionality. So really, we have no idea what's going on with this home-made HashMap class. The comment says that "HashMaps are crazy" and for all we know their custom implementation IS a bit crazy.
  • Andy P 2010-09-29 10:24
    CJ:
    Can someone explain the wtf with the hashmap to me?


    The guy had put in a "clear" statement to force a newly created HashMap to be empty.

    The gag, of course, is that newly created containers (...in any sane implementation, who knows what half-assed home-baked version of HashMap this guy might have been lumbered with) are always created empty because anything else is madness. So he was (we are led to presume) doing something completely pointless, *and* adding a comment explaining it which really only highlighted his own lack of understanding.

    Or so we must assume. Maybe in his codebase HashMaps really are created containing random garbage. Seems unlikely, though.
  • Flabbergasterisk 2010-09-29 10:26
    Only if you implement ISelfConscious.
  • Larry 2010-09-29 10:28
    Anonymous:
    CJ:
    Can someone explain the wtf with the hashmap to me?

    To be honest it's not possible to verify whether this is a WTF or not. Java has a HashMap class that is empty when instantiated, so if this were Java it would be a WTF because he is explicitly clearing an empty map. But in actuality, this isn't Java at all because it is using the .NET generics syntax (HashMap<T,T>). This is not a built-in .NET class, someone has written this from scratch and they were probably trying to replicate the Java functionality. So really, we have no idea what's going on with this home-made HashMap class. The comment says that "HashMaps are crazy" and for all we know their custom implementation IS a bit crazy.

    TRWTF is that Java 1.5 came out 6 years ago.
  • Kuli 2010-09-29 10:28
    The code with the cleared new HashMap is absolutely correct.

    Probably somewhere in later code, the author implemented some GOTO functionality by changing the address register of the CPU. Then you could jump directly behind the newly created HashMap! Of course you need to clear it then, to be sure that no elements are left.
  • frits 2010-09-29 10:29
    Hi Honey! Did you miss me? *kisses*
  • Severity One 2010-09-29 10:30
    Anonymous:
    But in actuality, this isn't Java at all because it is using the .NET generics syntax (HashMap<T,T>).

    Er, what?
    Map<TransactionId, List<BillingTransaction>> workMap =
    
    new HashMap<TransactionsId, List<BillingTransaction>>();

    Unless 1 == 0, that's Java. Java has had generics since 1.5, which is already getting geriatric.
  • Uncle Al 2010-09-29 10:32
    anonymous:
    Obviously this is from an embedded system without a file system. Why would you need a file pointer there?


    And the 1 = 0 test also clearly comes from an embedded system -- who knows what universe a user might carry the system to?
  • Fenris 2010-09-29 10:43
    The Nerve:
    Fixed?

    <!-- <script type="text/javascript">document.write('</div>')</script>
    <noscript></div></noscript> -->


    Broken? now you are not putting the needed </div>
  • aepryus 2010-09-29 10:44
    public interface ISelfAware {
    

    /**
    * Useful in an MBean so that it can return a live reference to itself as a
    * method call
    *
    * @return reference to this object
    */
    public ISelfAware getSelf();
    }


    This exposes self for a JavaBean; allowing access to the self pointer by token. Off hand, I don't know of any other way to accomplish this directly.

    In my own code, I check for the "self" token explicitly and just return the self pointer in that case instead of passing the token on to the JavaBean itself. But, this solution works also.
  • Anonymous 2010-09-29 10:44
    Severity One:
    Anonymous:
    But in actuality, this isn't Java at all because it is using the .NET generics syntax (HashMap<T,T>).

    Er, what?
    Map<TransactionId, List<BillingTransaction>> workMap =
    
    new HashMap<TransactionsId, List<BillingTransaction>>();

    Unless 1 == 0, that's Java. Java has had generics since 1.5, which is already getting geriatric.

    Holy shit, has it been that long since I did Java? Sorry, it was still a proposal awaiting ratification the last time I wrote anything in Java. We all know how long it takes for JSRs to go anywhere but I really had no idea it had been that long. Apologies, I should have double checked that one.
  • vyznev 2010-09-29 10:47
    Anonymous:
    (IV + I) - V = ?
    Why are you mixing those newfangled chicken scratches with your proper good ol' Roman numerals?
  • JamesQMurphy 2010-09-29 10:50
    Andy P:
    CJ:
    Can someone explain the wtf with the hashmap to me?


    The guy had put in a "clear" statement to force a newly created HashMap to be empty.

    The gag, of course, is that newly created containers (...in any sane implementation, who knows what half-assed home-baked version of HashMap this guy might have been lumbered with) are always created empty because anything else is madness. So he was (we are led to presume) doing something completely pointless, *and* adding a comment explaining it which really only highlighted his own lack of understanding.

    Or so we must assume. Maybe in his codebase HashMaps really are created containing random garbage. Seems unlikely, though.


    He should have put 3 calls to clear(). Once to clear out the random garbage, once to clean out the rest of the garbage, and once again for lucky.
  • Nutster 2010-09-29 10:52
    0 and 1 are neither composite nor prime. Non-whole numbers do not qualify either. A prime is a number with by only two integer factors: 1 and itself. A composite number is the product of several primes. 1 does not qualify for either, because 1 has only one factor, which is 1, so it not prime. Also it has no prime factors, therefore it is not composite.

    0 is divisible by every number (0/x = 0, for all x | x != 0). 0/0 is handled by limits in calculus class. Therefore, 0 is not prime. That said, 0 is not composite because one of its factors is not prime, as 0 is a factor and, as just shown, 0 is not prime.

    Therefore, 0 and 1 are each considered neither prime nor composite.
  • sep332 2010-09-29 10:53
    /* This program will only run if the laws of mathematics hold */
    if(1 == 0)
    {
    fprintf("Oh crap - we are not running in the correct Universe\n");
    exit(17);
    }

    weird, I'm listening to a Pronobozo album right now called Zero=One=Everything !
  • Whatever 2010-09-29 10:53
    The random, prime number being set to 215 is PERFECT!

    Nobody trying to crack the encryption would EVER try 215, as it's not random and it's not prime.

    PS., Hey frits, maybe you could just change your sig to be the Bert Glanstron thing; that would save your secret admirer a lot of time.
  • Anonymous 2010-09-29 10:53
    Severity One:
    Unless 1 == 0, that's Java.

    So I appreciate that Java supports generics now, as per my previous comment, but I have to take exception at the above statement which is patently false. The code provided is valid C# syntax, assuming one had written a custom class called HashMap<T,T>. So your assertion is false because 1 != 0 but it is still possible for that code to be C#.

    </pendantry>
  • anon 2010-09-29 10:54
    Nutster:
    0 and 1 are neither composite nor prime. Non-whole numbers do not qualify either. A prime is a number with by only two integer factors: 1 and itself. A composite number is the product of several primes. 1 does not qualify for either, because 1 has only one factor, which is 1, so it not prime. Also it has no prime factors, therefore it is not composite.

    0 is divisible by every number (0/x = 0, for all x | x != 0). 0/0 is handled by limits in calculus class. Therefore, 0 is not prime. That said, 0 is not composite because one of its factors is not prime, as 0 is a factor and, as just shown, 0 is not prime.

    Therefore, 0 and 1 are each considered neither prime nor composite.


    *golf clap*
  • THG 2010-09-29 10:56
    the article:

    "I stared at this code hoping something would shout 'April Fools!'," wrote Stephen, "unfortunately, nothing of the sort happened."

    public static boolean isAlphaNumeric(char c)
    {
    return !isLetter(c) && !isDigit(c);
    }



    That works ... NOT!


    x OR y ≡ ¬(¬x AND ¬y)
    [[ http://en.wikipedia.org/wiki/De_Morgan%27s_laws ]]


  • boog 2010-09-29 10:57
    // Do not remove the following line. HashMaps...

    I always get a laugh out of comments like this. It's like the comment is just daring me to do it.
  • Mark 2010-09-29 11:00
    1) TRWTF in the first code fragment is that the submitter can't read comments. I don't know MBeans, but based on this comment I'm willing to bet that they impose some kind of proxy, and this method is used to trick the proxy into letting you bypass it. On second thought, TRWTF is that their framework assumes you might have a need to bypass a proxy...

    2) 1 is not prime; look it up. 215 is neither prime nor random, but then again a lot of people say "random" when they mean "arbitrary". My guess is they needed an arbitrary prime for something obscure (like a home-brew hash table), and the value was later changed by someone who had no clue why it needed to be prime. Or maybe it didn't need to be prime any more, but it was too much work to change the constant name (since the whole point with named constants is to isolate change).

    3) Bad joke != WTF. The (1 == 0) test is a developer having a laugh.
  • ion435 2010-09-29 11:00
    wtf??? what does that mean? get me outta here!!!!!!!!
  • boog 2010-09-29 11:02
    Anonymous:
    Hey there Ancient Mathematician, you might be just the person I need to help me with an ancient Roman math problem. The following sum is written in Roman numerals. Can you solve it and provide your answer also in Roman numerals?

    (IV + I) - V = ?

    Important stuff to know. Consider the following real-world application:

    Rocky V + Rocky II = ?
  • boog 2010-09-29 11:06
    Mark:
    3) Bad joke != WTF. The (1 == 0) test is a developer having a laugh.

    I'd certainly wonder "WTF?" if I found it in production code.
  • DCRoss 2010-09-29 11:12
    THE NUMBER ONE:
    Do we get to have a discussion about whether or not I am a number?

    No, you are a free man.
  • DCRoss 2010-09-29 11:17
    boog:

    I always get a laugh out of comments like this. It's like the comment is just daring me to do it.


    I recently inherited a system with these lines in the crontab:
     # DO NOT uncomment this next line under penalty of death!
    
    * * * * * /usr/local/bin/call_some_function

    Some days I wonder just what happened to the last person who had to work on that server.
  • Steven 2010-09-29 11:22
    Anonymous:
    CJ:
    Can someone explain the wtf with the hashmap to me?

    To be honest it's not possible to verify whether this is a WTF or not. Java has a HashMap class that is empty when instantiated, so if this were Java it would be a WTF because he is explicitly clearing an empty map. But in actuality, this isn't Java at all because it is using the .NET generics syntax (HashMap<T,T>). This is not a built-in .NET class, someone has written this from scratch and they were probably trying to replicate the Java functionality. So really, we have no idea what's going on with this home-made HashMap class. The comment says that "HashMaps are crazy" and for all we know their custom implementation IS a bit crazy.


    That's also the standard Java generics syntax. I suspect both Java and full WTFness, but cannot prove it.
  • nibh 2010-09-29 11:23
    The Nerve:
    Fixed?


    if (&& _tblItem != null != null
    && _tblItem.getTable() != null
    _tblItem.getTable().getModel())


    Fail
  • icebrain 2010-09-29 11:26
    To those saying that 215 and 1 aren't random numbers: go study statistics.

    A random number is "a number generated for or part of a set exhibiting statistical randomness".

    Since you have no idea about what generated such number, you can't say if the numbers are random or not. It's not an intrinsic property of the number, but of where it came from.
  • דותן כהן 2010-09-29 11:26
    סליחה?‏
  • דותן כהן 2010-09-29 11:27
    Larry:
    the article:


    if (_tblItem.getTable().getModel() != null
    && _tblItem.getTable() != null
    && _tblItem != null)


    TRWTF is languages that read left-to-right.


    סליחה?‏
  • Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 2010-09-29 11:32
    Uh...:
    public static int RANDOM_PRIME_NUMBER = 215

    Ok, I see how this might be random when he entered it, but I do not see how it is prime.

    Of course it's prime. Just not in base 10, or anything else you might reasonably expect. (Try 6, or 36).
  • amischiefr 2010-09-29 11:34
    WthyrBendragon:
    I keep thinking that that getSelf() method should be Private. After all, wouldn't you want to be private while doing some sort of self exam?

    Hell no, I like an audience!
  • Caeruleus 2010-09-29 11:34
    Anonymous:

    Hey there Ancient Mathematician, you might be just the person I need to help me with an ancient Roman math problem. The following sum is written in Roman numerals. Can you solve it and provide your answer also in Roman numerals?

    (IV + I) - V = ?


    The answer is "II".

    In ancient Roman numerals, the value is the sum of the digits. "IV" = 1 + 5. The representation for 4 was "IIII"; the convention of writing "IV" did not come until the middle ages.

    On the other hand, you want to know how to represent zero, and the answer is "NULLUM" or "NIL". ( Ancient Romans did not have lower case letters. )
  • ted 2010-09-29 11:34
    boog:
    Mark:
    3) Bad joke != WTF. The (1 == 0) test is a developer having a laugh.

    I'd certainly wonder "WTF?" if I found it in production code.


    Yea, but surely any optimizing compiler would remove the code at compile time?
  • ShatteredArm 2010-09-29 11:53
    if (_tblItem.getTable().getModel() != null 
    
    && _tblItem.getTable() != null
    && _tblItem != null)


    I had a coworker do this. He was absolutely nonplussed as to why his code was throwing object reference exceptions when the field wasn't even required.
  • Bob 2010-09-29 11:59
    דותן כהן:
    Larry:
    the article:


    if (_tblItem.getTable().getModel() != null
    && _tblItem.getTable() != null
    && _tblItem != null)


    TRWTF is languages that read left-to-right.


    סליחה?‏

    Welcome to the 21st century. News Flash: Judaism is no longer funny.
  • Hitler 2010-09-29 12:03
    Bob:
    דותן כהן:
    Larry:
    the article:


    if (_tblItem.getTable().getModel() != null
    && _tblItem.getTable() != null
    && _tblItem != null)


    TRWTF is languages that read left-to-right.


    סליחה?‏

    Welcome to the 21st century. News Flash: Judaism is no longer funny.

    Really? Because it was hilarious in the 20th century!
  • shimon 2010-09-29 12:03
    Sup dawg, I heard you like references, so we've put a reference in your reference so you can get self while you have self!
  • The Judge 2010-09-29 12:04
    Hitler:
    Bob:
    דותן כהן:
    Larry:
    the article:


    if (_tblItem.getTable().getModel() != null
    && _tblItem.getTable() != null
    && _tblItem != null)


    TRWTF is languages that read left-to-right.


    סליחה?‏

    Welcome to the 21st century. News Flash: Judaism is no longer funny.

    Really? Because it was hilarious in the 20th century!

    I DEMAND THAT THIS IMMEDIATELY BE MADE A FEATURED COMMENT
  • Skawt 2010-09-29 12:08
    cynical cynic:
    At last, the explanation to all the Bert Glanstrom comments!
    public static boolean isFunnyOrInsightful(comment c)
    
    {
    return !isFunny(c) && !isInsightful(c);
    }

    Shouldn't the function be named isFunnyAndInsightful?
  • shimon 2010-09-29 12:10
    [quote author="Bob"]
    Welcome to the 21st century. News Flash: Judaism is no longer funny.[/quote]
    Ya see, Hebrew does not meet Judaism, you antisemitic schmuck.
  • Ramesses II 2010-09-29 12:11
    Hitler:
    Bob:
    דותן כהן:
    Larry:
    the article:


    if (_tblItem.getTable().getModel() != null
    && _tblItem.getTable() != null
    && _tblItem != null)


    TRWTF is languages that read left-to-right.


    סליחה?‏

    Welcome to the 21st century. News Flash: Judaism is no longer funny.

    Really? Because it was hilarious in the 20th century!


    Oh, that old joke?
  • shimon 2010-09-29 12:16
    Anonymous:

    Hey there Ancient Mathematician, you might be just the person I need to help me with an ancient Roman math problem. The following sum is written in Roman numerals. Can you solve it and provide your answer also in Roman numerals?

    (IV + I) - V = ?


    (IV + I) - V = N, FTW.
  • shimon 2010-09-29 12:17
    shimon:
    Bob:

    Welcome to the 21st century. News Flash: Judaism is no longer funny.

    Ya see, Hebrew does not equal Judaism, you antisemitic schmuck.

    Just a fix.
  • Herby 2010-09-29 12:20
    When one considers

    if (1 == 0) printf ("fail")

    one must consider that in ancient times (the 60's come to mind), it WAS possible to change the values of constants in Fortran. Unusual? Yes! but it could be done. In Fortran ALL arguments to subroutines are passed by REFERENCE, including constants. So, when you passed a constant, the subroutine COULD change it. Not very advisable, but it could be done.

    Some compilers could tell the difference between passed "read only" arguments, and others, but these were not common (I knew of one).

    In additon, a good test of a Fortran compiler was to have the following statement:

    IF (1 .EQ. 0) END

    Many compilers had a fit on this statement!

    So, yes, alternate universes DO exist, Strange but true!
  • Bob 2010-09-29 12:21
    shimon:
    shimon:
    Bob:

    Welcome to the 21st century. News Flash: Judaism is no longer funny.

    Ya see, Hebrew does not equal Judaism, you antisemitic schmuck.

    Just a fix.

    Really? WTF else speaks Hebrew? God?
  • hatterson 2010-09-29 12:25
    One:
    Do we get to have a discussion about whether or not 1 is a prime number?


    I would rather a discussion about whether .999... == 1
  • Matt 2010-09-29 12:26
    Anonymous:

    (IV + I) - V = ?


    (IV + I) - V = LIMA_NON_REPERIO
  • Maurits 2010-09-29 12:40
    Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx:
    Uh...:
    public static int RANDOM_PRIME_NUMBER = 215

    Ok, I see how this might be random when he entered it, but I do not see how it is prime.

    Of course it's prime. Just not in base 10, or anything else you might reasonably expect. (Try 6, or 36).


    hex comes close... very close...

    Here are the bases below 250 in which 215 is prime.

    83 = 215 base 6
    1181 = 215 base 24
    1601 = 215 base 28
    2351 = 215 base 34
    2633 = 215 base 36
    4283 = 215 base 46
    6791 = 215 base 58
    8783 = 215 base 66
    11633 = 215 base 76
    12251 = 215 base 78
    15581 = 215 base 88
    26111 = 215 base 114
    30881 = 215 base 124
    31883 = 215 base 126
    38231 = 215 base 138
    41621 = 215 base 144
    43961 = 215 base 148
    47591 = 215 base 154
    67901 = 215 base 184
    69383 = 215 base 186
    91811 = 215 base 214
    109751 = 215 base 234
    119321 = 215 base 244
    121283 = 215 base 246
  • Abdiel 2010-09-29 12:52
    /* This program will only run if the laws of mathematics hold */
    
    if(is_prime(1))
    {
    fprintf("Oh crap - we are not running in the correct Universe\n");
    exit(215);
    }
  • bl@h 2010-09-29 12:52
    <script type="text/javascript">document.write('
    Anonymous:
    I like the way there appears to be a dedicated error code for "not running in the correct Universe". I'd have gone for -42 instead of 17 but well done anyway. Wait, can you pass negative exit codes? I suppose it doesn't matter, if that error code ever gets returned we have to assume that the apocalypse is upon us.
    +1 for the win')</script>

    <noscript>
    Anonymous:
    I like the way there appears to be a dedicated error code for "not running in the correct Universe". I'd have gone for -42 instead of 17 but well done anyway. Wait, can you pass negative exit codes? I suppose it doesn't matter, if that error code ever gets returned we have to assume that the apocalypse is upon us.
    +1 for the win</noscript>

  • Hex 2010-09-29 12:54
    /* This program will only run if the laws of mathematics hold */
    if(1 == 0)
    {
    fprintf("Oh crap - we are not running in the correct Universe\n");
    exit(17);
    }



    +++ Divide By Cucumber Error. Please Reinstall Universe And Reboot +++
  • DaveK 2010-09-29 12:57
    Anonymous:
    Ancient Mathematician:
    WthyrBendragon:
    One:
    Do we get to have a discussion about whether or not 1 is a prime number?


    Well, it is only integer factorable to 1 and itself so, yes, 1 is prime.

    However, random it is not.

    Well, if you were old enough, you'd know that 1 is not even a number, so it can't be a prime.
    And if you're young enough, you should know that 1 is a unit, so it can't be a prime.
    Only if you're stuck some time between -200 and 1900 is 1 a prime.

    Hey there Ancient Mathematician, you might be just the person I need to help me with an ancient Roman math problem. The following sum is written in Roman numerals. Can you solve it and provide your answer also in Roman numerals?

    (IV + I) - V = ?

    Captcha: nulla.

    (Holy cow, I got lucky there!)
  • Anonymous 2010-09-29 13:01
    hatterson:
    One:
    Do we get to have a discussion about whether or not 1 is a prime number?


    I would rather a discussion about whether .999... == 1

    Well, technically there is nothing to discuss because they most certainly are equal and it is a simple proof to confirm this beyond doubt. But damn, what a mindfuck eh? I remember when I first had to tackle this concept back in maths class, many years ago. Took a long time to get my head around. But once it clicked it was like a lightbulb going off in my head, I literally blurted out "fuck me!" in the middle of my maths class, directly to the lecturer. He was a bit of an old bastard and I thought he was going to go ballistic, but he just looked at me with a knowing smile and gently nodded. I had joined the club.
  • undefined 2010-09-29 13:07
    Herby:
    one must consider that in ancient times (the 60's come to mind), it WAS possible to change the values of constants in Fortran.


    JavaScript was funnier, it was possible to do false=true in it.
    It does not work in modern browsers because ECMAScript 4 or 5 changed this.
  • swedish tard 2010-09-29 13:08
    undefined:
    Herby:
    one must consider that in ancient times (the 60's come to mind), it WAS possible to change the values of constants in Fortran.


    JavaScript was funnier, it was possible to do false=true in it.
    It does not work in modern browsers because ECMAScript 4 or 5 changed this.


    #undef false
    #define false true

    if(true == true) asplode;
  • swedish tard 2010-09-29 13:09
    swedish tard:
    undefined:
    Herby:
    one must consider that in ancient times (the 60's come to mind), it WAS possible to change the values of constants in Fortran.


    JavaScript was funnier, it was possible to do false=true in it.
    It does not work in modern browsers because ECMAScript 4 or 5 changed this.


    #undef false
    #define false true

    if(true == true) asplode;


    Well. Doh.

    if(true == false) obviously...
  • DaveK 2010-09-29 13:11
    Bob:
    shimon:
    shimon:
    Bob:

    Welcome to the 21st century. News Flash: Judaism is no longer funny.

    Ya see, Hebrew does not equal Judaism, you antisemitic schmuck.

    Just a fix.

    Really? WTF else speaks Hebrew? God?
    Jewish atheists, duh.

  • An Non 2010-09-29 13:14
    Just to point out - The proxy is there to allow visibility of the MBean in different classloaders (not simply 'JVM' as I brainfart-edly said in my first post) and even nodes in a clustered environment, i.e. the very reason you expose something as an MBean.
    The underlying problem though is that if the functionality should be accessible by local components the MBean interface should not be the interface being used to access it (Rather the MBean should be exposing some local delegates behaviour).
    So its not a WTF in the framework - rather, as is to oft the case, how the framework is being (mis)used.
  • Jay 2010-09-29 13:28
    Steve The Cynic:
    Ah, but you forget that the things we call Roman numerals were for writing down numbers, not for performing arithmetic. One of the principal advantages of the modern versions of Arabic numerals (the 0..9 system that we use today) is that they use the same notation for writing down numbers and for doing arithmetic.


    What a curious statement. Addition and subtraction are surely easier with Roman numerals than with Arabic. For addition, just stuff the two numbers together. I + I = II. XXI + XV = XXIXV, clean it up to XXXVI. Etc. Of course you have to learn when to "carry", for example IIII + I = V. (You do know, don't you, that the romans wrote 4 as IIII? The IV convention came much later.) But that's surely easy. You just stuff the two numbers together, then look for groups of 5 I's and replace them with a V, two V's with an X, etc. So XXXXVII + III = XXXXVIIIII, first clean up gives XXXXVV, second clean up XXXXX, third clean up L. I'm sure Roman school children learned to do this at one glance, just like we can add 987+13 and say 1000 without having to do the carries one at a time.

    For subtraction, just remove things in the first number that are found in the second number. Like III - I, take one of the I's away, leaving II. Again, you have to learn to "borrow", i.e. turn a V into IIIII, etc. So VI - II = IIIII I - II = IIII.

    Multiplication is only slightly harder. Just multiply digit by digit, like we do in Arabic, and then clean up. XV * II = XXVV = XXX. You quickly learn that X*V=L, etc, just like people with Arabic numbers learn their times tables. So XVI * V = X*V + V*V + I*V = L XXV V = LXXX. Note that Romans only had 7 "digits" -- I, V, X, L, C, D, M -- do their times table was 7 x 7 versus our 9 x 9, 49 versus 81, significantly less to learn.

    I suspect that for someone just learning arithmetic, Roman numerals were easier than Arabic.

    Division ... that starts to get hard. Writing very large number ... that's hard too. I'm not suggesting we go back to Roman numerals. Just pointing out that they had their advantages.
  • MG 2010-09-29 13:29
    Skawt:
    cynical cynic:
    At last, the explanation to all the Bert Glanstrom comments!
    public static boolean isFunnyOrInsightful(comment c)
    
    {
    return !isFunny(c) && !isInsightful(c);
    }

    Shouldn't the function be named isFunnyAndInsightful?


    Nope. Apply De Morgan's laws. (!p) && (!q) = !(p || q). Of course, isFunnyOrInsightful is not accurate either.

    I am probably missing some joke.
  • Jay 2010-09-29 13:34
    DaveK:
    Bob:
    shimon:
    shimon:
    Bob:

    Welcome to the 21st century. News Flash: Judaism is no longer funny.

    Ya see, Hebrew does not equal Judaism, you antisemitic schmuck.

    Just a fix.

    Really? WTF else speaks Hebrew? God?
    Jewish atheists, duh.



    And most first-century Christians.

    Though technically you should probably say "Hebrew-speaking atheists". "Jewish atheists" would be something of a paradox, like "Buddhist Moslems". Not that people don't say it all the time.

  • Anonymouse 2010-09-29 13:34
    The real WTF is this site's source around the "log code" hyper-hyper link.
    That, and that a function to return this is very different from simply this, in the case of function pointers one is a WTF.
  • smxlong 2010-09-29 13:38
    hatterson:
    One:
    Do we get to have a discussion about whether or not 1 is a prime number?


    I would rather a discussion about whether .999... == 1


    They are equal.

    If 0.999... != 1, then by the density of the real numbers, there must be some number X where 0.999... < X < 1. Suppose such a number exists. Please show me how to write this number.

    (The above is not a proof, but hopefully it's convincing enough)
  • Captain Obvious 2010-09-29 13:41
    Come on, people, everyone knows the Roman numeral for 0 is _ !
  • 1st Century Christian 2010-09-29 13:54
    Jay:
    DaveK:
    Bob:
    shimon:
    shimon:
    Bob:

    Welcome to the 21st century. News Flash: Judaism is no longer funny.

    Ya see, Hebrew does not equal Judaism, you antisemitic schmuck.

    Just a fix.

    Really? WTF else speaks Hebrew? God?
    Jewish atheists, duh.



    And most first-century Christians.

    Though technically you should probably say "Hebrew-speaking atheists". "Jewish atheists" would be something of a paradox, like "Buddhist Moslems". Not that people don't say it all the time.


    Hey, guys. I just climbed into my time machine to post this here, since you needed a non-Jew that speaks Hebrew. Just FYI we Christians are Jews too.
  • Gunslinger 2010-09-29 13:59
    briggs davis:
    The Nerve:
    Fixed?

    //public interface ISelfAware {
    //
    // /**
    // * Useful in an MBean so that it can return a live reference to itself as a
    // * method call
    // *
    // * @return reference to this object
    // */
    // public ISelfAware getSelf();
    //}

    //if(completed == 1)
    // if(startdate[1] != 2)
    month = startdate[2];
    // else
    // month = startdate[2];
    //else
    // month = startdate[2];

    if (&& _tblItem != null != null
    && _tblItem.getTable() != null
    _tblItem.getTable().getModel())

    /* This program will only run if the laws of mathematics hold
    if(1 == 0)
    {
    fprintf("Oh crap - we are not running in the correct Universe\n");
    exit(17);
    }*/

    public static int FIXED_NONPRIME_NUMBER = 215;

    /*3 times because if we have filter on some column -
    clean only that data, and after that cleans everything
    else (2.), and the 3. is for lucky :)
    worksheet.Cells.ClearContents();
    worksheet.Cells.ClearContents(); */
    worksheet.Cells.ClearContents();

    Map<TransactionId, List<BillingTransaction>> workMap
    = new HashMap<TransactionsId, List<BillingTransaction>>();

    // Do not remove the following line. HashMaps are crazy and point
    // to old reference data even if they were instantiated fresh!
    //workMap.clear();

    public static boolean isNotAlphaNumeric(char c)
    {
    return !isLetter(c) && !isDigit(c);
    }

    <!-- <script type="text/javascript">document.write('</div>')</script>
    <noscript></div></noscript> -->

    ironically, your comment contains many comments.


    /* No comment */
  • Lego 2010-09-29 13:59
    boog:
    Anonymous:
    Hey there Ancient Mathematician, you might be just the person I need to help me with an ancient Roman math problem. The following sum is written in Roman numerals. Can you solve it and provide your answer also in Roman numerals?

    (IV + I) - V = ?

    Important stuff to know. Consider the following real-world application:

    Rocky V + Rocky II = ?


    = ZZZZzzzzzz...
  • frits 2010-09-29 14:03
    MG:
    Skawt:
    cynical cynic:
    At last, the explanation to all the Bert Glanstrom comments!
    public static boolean isFunnyOrInsightful(comment c)
    
    {
    return !isFunny(c) && !isInsightful(c);
    }

    Shouldn't the function be named isFunnyAndInsightful?


    Nope. Apply De Morgan's laws. (!p) && (!q) = !(p || q). Of course, isFunnyOrInsightful is not accurate either.

    I am probably missing some joke.


    Of course you are. Also, the name is completely accurate in describing the Bert Glanstron thought process:

    - I want to post something that is either funny or insightful.

    - OK, what should I write? I know, "Dear whomever, In case..."

    - Let me check this using my internal isFunnyOrInsightful function.

    - Yep, it passes. Therefore, it must be funny or insightful. (Did I write unit tests for that function?)
  • Siskel and Ebert 2010-09-29 14:04
    boog:
    Anonymous:
    Hey there Ancient Mathematician, you might be just the person I need to help me with an ancient Roman math problem. The following sum is written in Roman numerals. Can you solve it and provide your answer also in Roman numerals?

    (IV + I) - V = ?

    Important stuff to know. Consider the following real-world application:

    Rocky V + Rocky II = ?

    Is that the one where an aging Tommy Gunn fights a re-animated Apollo Creed?
  • Silfax 2010-09-29 14:09
    Skawt:
    cynical cynic:
    At last, the explanation to all the Bert Glanstrom comments!
    public static boolean isFunnyOrInsightful(comment c)
    
    {
    return !isFunny(c) && !isInsightful(c);
    }

    Shouldn't the function be named isFunnyAndInsightful?


    Refactored via DeMorgan

    public static boolean isNotFunnyOrInsightful(comment c)
    
    {
    return !(isFunny(c) | isInsightful(c));
    }
  • hhhhhhhhhhhhhhhhhhhhhh 2010-09-29 14:18
    Anonymous:
    Severity One:
    Unless 1 == 0, that's Java.

    So I appreciate that Java supports generics now, as per my previous comment, but I have to take exception at the above statement which is patently false. The code provided is valid C# syntax, assuming one had written a custom class called HashMap<T,T>. So your assertion is false because 1 != 0 but it is still possible for that code to be C#.

    </pendantry>


    to be a bit more pedantified, and note i have not read further than this comment nor gone back to the original code, they would also have had to implement an abstract class/interface called Map. So it's either Java, or someone who loves Java forced to write C# at gunpoint. Or something.
  • yetihehe 2010-09-29 14:18
    sep332:
    /* This program will only run if the laws of mathematics hold */
    if(1 == 0)
    {
    fprintf("Oh crap - we are not running in the correct Universe\n");
    exit(17);
    }

    weird, I'm listening to a Pronobozo album right now called Zero=One=Everything !

    *(0) = 1; //Invalid write exception ;)
  • Indrora 2010-09-29 14:19
    FWIW, the android SDK,
    wtf(...)


    This error handler is NOT a wtf - its designed to be an application-level version of a Kernel Ooops. This includes :

    things like (for instance) file pointers to real files going poof
    fclose()
    failing,
    2.5 + 2.9 < 5
    returning true (I recall on some box without floating point helpers, this happened!)

    and most importantly, system functions throwing uncaught exceptions.
  • ShatteredArm 2010-09-29 14:24
    smxlong:
    hatterson:
    One:
    Do we get to have a discussion about whether or not 1 is a prime number?


    I would rather a discussion about whether .999... == 1


    They are equal.

    If 0.999... != 1, then by the density of the real numbers, there must be some number X where 0.999... < X < 1. Suppose such a number exists. Please show me how to write this number.

    (The above is not a proof, but hopefully it's convincing enough)


    Why does there have to be a number between the two?

    Maybe there is a proof, but this is how I look at it:

    What is the largest number that is less than 1? I think you'd have to conclude that it is 0.999... wouldn't you?

    And if a < b, then a != b.
  • vo 2010-09-29 14:26

    if(completed == 1)
    if(stardate[1] != 2)
    month = stardate[2];
    else
    month = stardate[2];
    else
    month = stardate[2];


    You laugh, but the above code works when applied to wormholes.

  • Mythran 2010-09-29 14:32
    Correct path is

    developer DOT android DOT com slash reference slash android slash util slash Log DOT html

    Not letting me enter any type of address...
  • Mythran 2010-09-29 14:35
    - DELETED -

    Can't use the delete button. Keeps kicking me to the home page.
  • Mythran 2010-09-29 14:36
    Mad Adder:
    "This is in our production code," notes Joseph Daigle, "I can only hope they rolled a die to ensure this was actually random."
    public static int RANDOM_PRIME_NUMBER = 215;


    Hrmm... not random, not a prime number. Looks like we got a winner here.


    Not really....I mean...it's still a number...so only 2 out of 3...
  • nonymus 2010-09-29 14:41
    Mythran:
    Mad Adder:
    "This is in our production code," notes Joseph Daigle, "I can only hope they rolled a die to ensure this was actually random."
    public static int RANDOM_PRIME_NUMBER = 215;


    Hrmm... not random, not a prime number. Looks like we got a winner here.


    Not really....I mean...it's still a number...so only 2 out of 3...

    public static int RANDOM_PRIME_NUMBER = 's' + 'd';

    then?
  • schlabotnik 2010-09-29 14:42
    yes, 43, but most of us quit at the first factor
  • schlabotnik 2010-09-29 14:43
    yeah, some of this is pretty sad, it shouldn't even compile
  • Markp 2010-09-29 14:44
    1st Century Christian:
    Jay:
    DaveK:
    Bob:
    shimon:
    shimon:
    Bob:

    Welcome to the 21st century. News Flash: Judaism is no longer funny.

    Ya see, Hebrew does not equal Judaism, you antisemitic schmuck.

    Just a fix.

    Really? WTF else speaks Hebrew? God?
    Jewish atheists, duh.



    And most first-century Christians.

    Though technically you should probably say "Hebrew-speaking atheists". "Jewish atheists" would be something of a paradox, like "Buddhist Moslems". Not that people don't say it all the time.


    Hey, guys. I just climbed into my time machine to post this here, since you needed a non-Jew that speaks Hebrew. Just FYI we Christians are Jews too.


    A lot were, but the majority didn't speak Hebrew. They predominantly spoke Aramaic and Greek. Even among the Jews of that period, only those religiously educated knew Hebrew. Kind of like Catholics and Latin.

    Are we going in circles?
  • Mark 2010-09-29 14:44
    ShatteredArm:
    Why does there have to be a number between the two?


    No two distinct real numbers are adjacent; there's always another number in between.

    Maybe there is a proof, but this is how I look at it:

    What is the largest number that is less than 1?


    This argument is really just begging the question. Yes, if 0.999... were "the largest number less than 1", then it would not be equal to 1; but you're assuming it's not equal to 1 when you call it "the largest number less than 1"; reaching your answer by way of assuming your answer is TRWTF.

    In fact, there is no such thing as "the largest number less than 1" (at least not if we're working in the real numbers). "The largest number less than 1" is a series of words wtih no meaning. It's like asking how deep a hole has to be before you cannot walk around it.

    If you assume there has to be an answer to the question "what is the largest number less than 1", then tell me this: what is the largest number less than 0.999...? Surely that's just as valid a question.

    In base 10, 0.999... and 1 are just two different notations for the same number, just as the fraction (2/2) is another notation for the same thing.
  • Tough Eddie 2010-09-29 14:47

    <script type="text/javascript">document.write('</div>')</script>
    <noscript></div></noscript>

    Too bad JavaScript is interpreted: if it were a compiled language, it would have filtered this out.
  • Shinji 2010-09-29 14:48
    Here is a wtf related to the last one. I just made it up but I'm sure someone has done it. Those dang email protection scripts.

    <SCRIPT TYPE="text/javascript">
    document.write('someone@' + 'email.com')
    </SCRIPT>
    <noscript>someone@email.com</noscript>
  • ÃÆâ€â„ 2010-09-29 14:49
    Yesterday's failure to post an article is a What a Terrible Failure.
  • schlabotnik 2010-09-29 14:52
    Maurits:
    Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx:
    Uh...:
    public static int RANDOM_PRIME_NUMBER = 215

    Ok, I see how this might be random when he entered it, but I do not see how it is prime.

    Of course it's prime. Just not in base 10, or anything else you might reasonably expect. (Try 6, or 36).


    hex comes close... very close...

    Here are the bases below 250 in which 215 is prime.

    83 = 215 base 6
    1181 = 215 base 24
    1601 = 215 base 28
    2351 = 215 base 34
    2633 = 215 base 36
    4283 = 215 base 46
    6791 = 215 base 58
    8783 = 215 base 66
    11633 = 215 base 76
    12251 = 215 base 78
    15581 = 215 base 88
    26111 = 215 base 114
    30881 = 215 base 124
    31883 = 215 base 126
    38231 = 215 base 138
    41621 = 215 base 144
    43961 = 215 base 148
    47591 = 215 base 154
    67901 = 215 base 184
    69383 = 215 base 186
    91811 = 215 base 214
    109751 = 215 base 234
    119321 = 215 base 244
    121283 = 215 base 246


    I like nothing more than going to places where EVERYONE is smarter than me :)

    Thanks.
  • jc 2010-09-29 14:53
    (IV + I) - V = nulla

    Roman for nothing. True fact, check it out.

    But it gets crazier than that in roman numerals, they didn't really have any numbers represented greater than 1,000, which was used interchangeably for infinity.
  • boog 2010-09-29 14:54
    Siskel and Ebert:
    boog:
    Rocky V + Rocky II = ?

    Is that the one where an aging Tommy Gunn fights a re-animated Apollo Creed?

    Actually it's a Simpsons reference.

    Tough crowd.
  • Mark 2010-09-29 14:54
    icebrain:
    To those saying that 215 and 1 aren't random numbers: go study statistics.


    Better yet, you go study context. In programming, it is reasonable to assume if the variable name (or comments, or specs, or requirements) call for a "random" number, they mean "a number randomly generated at the time of this execution". A constant obviously doesn't meet the criteria, even if it were generated randomly, even though it could belong to a random set, even though if you did randomly generate a number it's possible you'd get that same value on every execution.

    Oh, and by the way, who claimed that 1 isn't random? I see plenty of posts takling about whether 1 is prime, but none talking about whether it's random.
  • Mark 2010-09-29 14:58
    Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx:
    Uh...:
    public static int RANDOM_PRIME_NUMBER = 215

    Ok, I see how this might be random when he entered it, but I do not see how it is prime.

    Of course it's prime. Just not in base 10, or anything else you might reasonably expect. (Try 6, or 36).


    Yeah... and if your compiler interprets numeric literals in base 6 or base 36, you have a point. Since it doesn't, your attempt to demonstrate math nerd cred backfires as you fail to properly distinguish notations from numbers.

    In any language that code could possibly have come form, the token 215 means "the decimal number 215". Nice try.
  • ÃÆâ€â†2010-09-29 14:59
    Maurits:
    Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx:
    Uh...:
    public static int RANDOM_PRIME_NUMBER = 215

    Ok, I see how this might be random when he entered it, but I do not see how it is prime.

    Of course it's prime. Just not in base 10, or anything else you might reasonably expect. (Try 6, or 36).


    hex comes close... very close...

    Here are the bases below 250 in which 215 is prime.

    83 = 215 base 6
    1181 = 215 base 24
    1601 = 215 base 28
    2351 = 215 base 34
    2633 = 215 base 36
    4283 = 215 base 46
    6791 = 215 base 58
    8783 = 215 base 66
    11633 = 215 base 76
    12251 = 215 base 78
    15581 = 215 base 88
    26111 = 215 base 114
    30881 = 215 base 124
    31883 = 215 base 126
    38231 = 215 base 138
    41621 = 215 base 144
    43961 = 215 base 148
    47591 = 215 base 154
    67901 = 215 base 184
    69383 = 215 base 186
    91811 = 215 base 214
    109751 = 215 base 234
    119321 = 215 base 244
    121283 = 215 base 246

    You win the internets. Well-played...
  • Someone You Know 2010-09-29 15:09
    ShatteredArm:
    smxlong:
    hatterson:
    One:
    Do we get to have a discussion about whether or not 1 is a prime number?


    I would rather a discussion about whether .999... == 1


    They are equal.

    If 0.999... != 1, then by the density of the real numbers, there must be some number X where 0.999... < X < 1. Suppose such a number exists. Please show me how to write this number.

    (The above is not a proof, but hopefully it's convincing enough)


    Why does there have to be a number between the two?

    Maybe there is a proof, but this is how I look at it:

    What is the largest number that is less than 1? I think you'd have to conclude that it is 0.999... wouldn't you?


    I most certainly would not.

    You haven't explained how you arrived at that conclusion; you've just stated it. If you can just say that without backing it up, then I can refute it by simply saying that 0.999... is not the largest number that is less than 1, because it's equal to 1. And if a == b, then !(a < b).

    And there has to be a number between the two because between any two distinct real numbers, there is another real number. (This is what smxlong meant by "the density of real numbers".) Therefore, if 0.999... and 1 are not equal, there must be a real number between them. What is it?
  • The Maths 2010-09-29 15:18
    Someone You Know:
    ShatteredArm:
    smxlong:
    hatterson:
    One:
    Do we get to have a discussion about whether or not 1 is a prime number?


    I would rather a discussion about whether .999... == 1


    They are equal.

    If 0.999... != 1, then by the density of the real numbers, there must be some number X where 0.999... < X < 1. Suppose such a number exists. Please show me how to write this number.

    (The above is not a proof, but hopefully it's convincing enough)


    Why does there have to be a number between the two?

    Maybe there is a proof, but this is how I look at it:

    What is the largest number that is less than 1? I think you'd have to conclude that it is 0.999... wouldn't you?


    I most certainly would not.

    You haven't explained how you arrived at that conclusion; you've just stated it. If you can just say that without backing it up, then I can refute it by simply saying that 0.999... is not the largest number that is less than 1, because it's equal to 1. And if a == b, then !(a < b).

    And there has to be a number between the two because between any two distinct real numbers, there is another real number. (This is what smxlong meant by "the density of real numbers".) Therefore, if 0.999... and 1 are not equal, there must be a real number between them. What is it?

    What kind of moronic argument is this? I'll tell you: one by someone who knows nothing about mathematics.

    We're not talking about flavors for ice cream or your favorite color for a gerbil: we're talking about math. Good ol' simple, unchanging math.
  • Dude 2010-09-29 15:26
    The Maths:
    Someone You Know:
    ShatteredArm:
    smxlong:
    hatterson:
    One:
    Do we get to have a discussion about whether or not 1 is a prime number?


    I would rather a discussion about whether .999... == 1


    They are equal.

    If 0.999... != 1, then by the density of the real numbers, there must be some number X where 0.999... < X < 1. Suppose such a number exists. Please show me how to write this number.

    (The above is not a proof, but hopefully it's convincing enough)


    Why does there have to be a number between the two?

    Maybe there is a proof, but this is how I look at it:

    What is the largest number that is less than 1? I think you'd have to conclude that it is 0.999... wouldn't you?


    I most certainly would not.

    You haven't explained how you arrived at that conclusion; you've just stated it. If you can just say that without backing it up, then I can refute it by simply saying that 0.999... is not the largest number that is less than 1, because it's equal to 1. And if a == b, then !(a < b).

    And there has to be a number between the two because between any two distinct real numbers, there is another real number. (This is what smxlong meant by "the density of real numbers".) Therefore, if 0.999... and 1 are not equal, there must be a real number between them. What is it?

    What kind of moronic argument is this? I'll tell you: one by someone who knows nothing about mathematics.

    We're not talking about flavors for ice cream or your favorite color for a gerbil: we're talking about math. Good ol' simple, unchanging math.


    First off... you haven't made an argument. But that's ok, I happen to know an easy proof that doesn't involve real number density or any thing else very complicated.

    0.333... = 1/3
    multiply both sides by 3 and you get
    0.999... = 3/3
    collapse the fraction
    0.999... = 1
  • Crash Magnet 2010-09-29 15:29
    Does 0.999... = 1?

    How about

    F(n) = lim(10^n - 1)/10^n, n -> oo)

    Take the derivitive of num & denom.

    F(n) = lim(10n/10n, n -> oo)
    F(n) = 1.0

    QED
  • If maths was politics 2010-09-29 15:30
    hatterson:
    One:
    Do we get to have a discussion about whether or not 1 is a prime number?


    I would rather a discussion about whether .999... == 1

    I suggest as a compromise: .999... is not a prime.

    I think the mathematicians and the dilettants can agree on this, even though for different reasons.
  • Crash Magnet 2010-09-29 15:35
    Crash Magnet:
    Does 0.999... = 1?

    How about

    F(n) = lim(10^n - 1)/10^n, n -> oo)

    Take the derivitive of num & denom.

    F(n) = lim(10n/10n, n -> oo)
    F(n) = 1.0

    QED


    Actually, I just realized that the derivitive of 10^n is not 10n. But the derivitive of the num & denom would be the same anyway and you would still get the answer 1.0.

  • fjf 2010-09-29 15:36
    Dude:
    I happen to know an easy proof that doesn't involve real number density or any thing else very complicated

    Actually, real number density isn't very complicated at all. For any two different real numbers a and b, their average c=(a+b)/2 is a real number that's between them (a<c<b or b<c<a).

    So for those who believe 0.999... != 1, what would be the average of those two numbers?
  • boog 2010-09-29 15:39
    Mark:
    icebrain:
    To those saying that 215 and 1 aren't random numbers: go study statistics.


    Better yet, you go study context. In programming, it is reasonable to assume if the variable name (or comments, or specs, or requirements) call for a "random" number, they mean "a number randomly generated at the time of this execution". A constant obviously doesn't meet the criteria, even if it were generated randomly, even though it could belong to a random set, even though if you did randomly generate a number it's possible you'd get that same value on every execution.

    Oh, and by the way, who claimed that 1 isn't random? I see plenty of posts takling about whether 1 is prime, but none talking about whether it's random.

    Not so fast there Mark. You don't know the requirements for this application. Perhaps the requirement was for a random number no less than 215, but no more than 215. Sure, he could have generated it at run-time, but maybe the developer was smarter than that and figured out a brilliant way of saving a few CPU cycles.

    As for it being prime, several people have pointed out that 215 is a prime number in other number bases. Perhaps this developer was working in an environment that operates under one of these other number bases. He also saves himself even more CPU cycles by foregoing any business logic that might assert the number's "prime-ness".

    Yes, I do believe that given these very specific and completely absurd circumstances, it's safe to say that 215 could be a random prime number and that the code we are seeing is the work of an absolute genius.
  • Coyne 2010-09-29 15:43
    The guy who tested for "(1 == 0)" doesn't seem very thorough to me at all.

    I mean, in some universe, this "if" could very well test false but "if (2 == 0)" might test true. What about that?

    I think he should have tested all the numbers...

    ...like I do. ;)
  • Severity One 2010-09-29 15:45
    Anonymous:
    Severity One:
    Unless 1 == 0, that's Java.

    So I appreciate that Java supports generics now, as per my previous comment, but I have to take exception at the above statement which is patently false. The code provided is valid C# syntax, assuming one had written a custom class called HashMap<T,T>. So your assertion is false because 1 != 0 but it is still possible for that code to be C#.

    </pendantry>

    You just keep digging your own hole deeper, don't you?

    Let's go through it:

    I claim that 'Unless 1 == 0, that's Java', which can be rewritten (at least in this universe) as 'Unless false, that's Java', or 'If true, that's Java', so in short: 'That's Java'.

    You claim that my claim is (and I quote) "patently false"; in other words, 'that's not Java'.

    However, it has been shown that it is.

    The code provided is valid C# syntax

    ...which doesn't mean it's not valid Java syntax as well.

    Ergo, you need to pick up a bit on Boolean algebra. Why don't you submit some of your code to Alex? I'm sure we'll all appreciate it. :)
  • Coyne 2010-09-29 15:55
    Crash Magnet:
    Does 0.999... = 1?

    How about

    F(n) = lim(10^n - 1)/10^n, n -> oo)

    Take the derivitive of num & denom.

    F(n) = lim(10n/10n, n -> oo)
    F(n) = 1.0

    QED


    I saw this somewhere:

    Given x = .999...

    Then: 10x = 9.999...

    Now subtract x:

    10x - x = 9.999... - .999...

    Complete the subtraction:

    9x = 9.000...

    But the endlessly repeated 0 is redundant so:

    9x = 9

    Factor out the 9:

    x = 1

    Now, substituting the original value for x:

    .999... = 1

    QED
  • boog 2010-09-29 15:55
    Coyne:
    The guy who tested for "(1 == 0)" doesn't seem very thorough to me at all.

    I mean, in some universe, this "if" could very well test false but "if (2 == 0)" might test true. What about that?

    I think he should have tested all the numbers...

    Why only compare to zero? Sure, (1 == 0) and (2 == 0) might both test false, but what about (2 == 1)?

    What about numbers that should be equal but aren't? Like (1 != 1)? (2 != 2)?

    I think we're looking at a cross product of all numbers A vs. all numbers B, testing for inequality when they're equal, and testing for equality when they're not. Only then will I be confident that we are "running in the correct Universe".

    And now my head hurts.
  • Markp 2010-09-29 15:56
    The Maths:
    Someone You Know:
    ShatteredArm:
    smxlong:
    hatterson:
    One:
    Do we get to have a discussion about whether or not 1 is a prime number?


    I would rather a discussion about whether .999... == 1


    They are equal.

    If 0.999... != 1, then by the density of the real numbers, there must be some number X where 0.999... < X < 1. Suppose such a number exists. Please show me how to write this number.

    (The above is not a proof, but hopefully it's convincing enough)


    Why does there have to be a number between the two?

    Maybe there is a proof, but this is how I look at it:

    What is the largest number that is less than 1? I think you'd have to conclude that it is 0.999... wouldn't you?


    I most certainly would not.

    You haven't explained how you arrived at that conclusion; you've just stated it. If you can just say that without backing it up, then I can refute it by simply saying that 0.999... is not the largest number that is less than 1, because it's equal to 1. And if a == b, then !(a < b).

    And there has to be a number between the two because between any two distinct real numbers, there is another real number. (This is what smxlong meant by "the density of real numbers".) Therefore, if 0.999... and 1 are not equal, there must be a real number between them. What is it?

    What kind of moronic argument is this? I'll tell you: one by someone who knows nothing about mathematics.


    Well, to be fair, the person who posited that "0.999..." is the largest number that is less than 1 knows nothing about mathematics either. I don't know whether that was you or not.

    The nature of real numbers is that if you give me a number "a" such that a < 1, there are always an infinite number of choices for a number "b" such that a < b < 1. That's where "real number density" comes in. There is no "largest number less than..." when dealing with real numbers.

    So it was a BS premise that led to what you call a "moronic" argument.
  • PRMan 2010-09-29 15:58
    Okay, in one version of ASP.NET there was a bug where Microsoft would generate a table (for a datagrid or something) that was missing the end table tag. I had to add </table> myself to ensure that it got closed.

    The </div> could very well be a valid fix for something like that (not in NoScript tags however).
  • anon 2010-09-29 16:00
    Arnold Vriezekolk's colleague is wrong when he states that he is in the wrong universe if 1=0. He is merely operating on the wrong ring. In ℤ/ℤ, zero is clearly equal to one.
  • The Maths 2010-09-29 16:01
    I was not calling your argument moronic, I said the argument itself is moronic.
  • Gargo 2010-09-29 16:02
    Uh...:
    public static int RANDOM_PRIME_NUMBER = 215

    Ok, I see how this might be random when he entered it, but I do not see how it is prime.


    Maybe it is intended to be used as a parameter (like a #define) to a function e.g.:


    public int GetNumber(int numberType) {
    if (numberType == RANDOM_PRIME_NUMBER) {
    ...
    }
    ...
    }
  • Someone You Know 2010-09-29 16:03
    The Maths:
    Someone You Know:
    ShatteredArm:
    smxlong:
    hatterson:
    One:
    Do we get to have a discussion about whether or not 1 is a prime number?


    I would rather a discussion about whether .999... == 1


    They are equal.

    If 0.999... != 1, then by the density of the real numbers, there must be some number X where 0.999... < X < 1. Suppose such a number exists. Please show me how to write this number.

    (The above is not a proof, but hopefully it's convincing enough)


    Why does there have to be a number between the two?

    Maybe there is a proof, but this is how I look at it:

    What is the largest number that is less than 1? I think you'd have to conclude that it is 0.999... wouldn't you?


    I most certainly would not.

    You haven't explained how you arrived at that conclusion; you've just stated it. If you can just say that without backing it up, then I can refute it by simply saying that 0.999... is not the largest number that is less than 1, because it's equal to 1. And if a == b, then !(a < b).

    And there has to be a number between the two because between any two distinct real numbers, there is another real number. (This is what smxlong meant by "the density of real numbers".) Therefore, if 0.999... and 1 are not equal, there must be a real number between them. What is it?

    What kind of moronic argument is this? I'll tell you: one by someone who knows nothing about mathematics.

    We're not talking about flavors for ice cream or your favorite color for a gerbil: we're talking about math. Good ol' simple, unchanging math.


    I'm sorry, but I have no idea what point you're trying to make here.
  • hatterson 2010-09-29 16:14
    Anonymous:
    hatterson:
    One:
    Do we get to have a discussion about whether or not 1 is a prime number?


    I would rather a discussion about whether .999... == 1

    Well, technically there is nothing to discuss because they most certainly are equal and it is a simple proof to confirm this beyond doubt. But damn, what a mindfuck eh? I remember when I first had to tackle this concept back in maths class, many years ago. Took a long time to get my head around. But once it clicked it was like a lightbulb going off in my head, I literally blurted out "fuck me!" in the middle of my maths class, directly to the lecturer. He was a bit of an old bastard and I thought he was going to go ballistic, but he just looked at me with a knowing smile and gently nodded. I had joined the club.


    Oh I'm well aware that they're the same number (just different representations) I just thought it would be fun to troll a thread on that rather than on if 1 is prime.

    .999... == 1 usually provides more entertaining responses to read since the is 1 prime "debate" just ends with "it's not because we said it's not."

    Edit: And looking at the last page or so, I greatly succeeded.
  • hatterson 2010-09-29 16:17
    If maths was politics:
    hatterson:
    One:
    Do we get to have a discussion about whether or not 1 is a prime number?


    I would rather a discussion about whether .999... == 1

    I suggest as a compromise: .999... is not a prime.

    I think the mathematicians and the dilettants can agree on this, even though for different reasons.


    Haha, well done sir.
  • Not a math major 2010-09-29 16:24
    TGV:
    I can only hope they rolled a die to ensure this was actually random

    And I hope they are in a universe where 215 is actually a prime.
    If you add each digit in the number it's prime: 2 + 1 + 5 = 7
  • boog 2010-09-29 16:27
    Fair enough, it's valid syntax in both C# and Java.

    But you said it is Java.
    Severity One:
    Unless 1 == 0, that's Java.

    And you clarified your argument, for those of us who are "running in the correct Universe":
    Severity One:
    ...so in short: 'That's Java'.

    I've never heard of someone taking a snippet of code that exists in the context of a C# application and outright calling it "Java" (or vice versa). So this implies that either A) you know more about the actual habitat of this code snippet than we do, or B) you're making assumptions. I think the GP was arguing B.

    I'm not saying you're wrong, I'm just suggesting that you revise your statement to avoid these silly arguments.
    what Severity One should have said:
    Unless 1 == 0, that's valid Java syntax.

    Isn't that more accurate?
  • anon 2010-09-29 16:29
    Not a math major:
    TGV:
    I can only hope they rolled a die to ensure this was actually random

    And I hope they are in a universe where 215 is actually a prime.
    If you add each digit in the number it's prime: 2 + 1 + 5 = 7

    If 1=0.
  • Not a math major 2010-09-29 16:30
    anon:
    Not a math major:
    TGV:
    I can only hope they rolled a die to ensure this was actually random

    And I hope they are in a universe where 215 is actually a prime.
    If you add each digit in the number it's prime: 2 + 1 + 5 = 7

    If 1=0.
    WIN!!
  • hatterson 2010-09-29 16:35
    anon:
    Not a math major:
    TGV:
    I can only hope they rolled a die to ensure this was actually random

    And I hope they are in a universe where 215 is actually a prime.
    If you add each digit in the number it's prime: 2 + 1 + 5 = 7

    If 1=0.

    This is likely the best comment I've seen on here in a good long while.
  • fjf 2010-09-29 16:41
    boog:
    Coyne:
    The guy who tested for "(1 == 0)" doesn't seem very thorough to me at all.

    I mean, in some universe, this "if" could very well test false but "if (2 == 0)" might test true. What about that?

    I think he should have tested all the numbers...

    Why only compare to zero? Sure, (1 == 0) and (2 == 0) might both test false, but what about (2 == 1)?

    What about numbers that should be equal but aren't? Like (1 != 1)? (2 != 2)?

    I think we're looking at a cross product of all numbers A vs. all numbers B, testing for inequality when they're equal, and testing for equality when they're not. Only then will I be confident that we are "running in the correct Universe".

    And now my head hurts.

    Amateur. Maybe 1 != 0 once, but not the second or third time. So you have to test each pair an infinite number of times. And don't get me started about testing arithmetics ...
  • neminem 2010-09-29 16:42
    Jay:
    "Jewish atheists" would be something of a paradox


    No, it wouldn't. "Jewish" is a rather vague term: it's a religion, a culture, and a race. You can be Jewish because your parents and their parents and their parents, etc., were all Jewish. You can be Jewish because you were raised Jewish. Or you can be Jewish because you believe in the truth of the Old Testament but not the New Testament.

    See also: http://en.wikipedia.org/wiki/Jewish_atheism
    http://en.wikipedia.org/wiki/Humanistic_Judaism
    http://en.wikipedia.org/wiki/Secular_Jewish_culture

    P.S. I believe the term is "insensitive clod".
  • Syntax 2010-09-29 16:52
    The 215 looks like a seed value for HashCode(ing) in Java (though it's obviously misnamed). We do something similar where we have a seed (to decrease collisions) and a different number which is prime *= applied to the hash of each significant field.

    Joshua Bloch uses a similar technique in Effective Java.
  • MG 2010-09-29 17:02
    Also, since .9999.... = .9 + .09. + .009 + ..., an infinite geometric series with ratio .1 that has a finite sum.

    Since the sum is the first term divided by 1 less the ratio between the terms (see Wikipedia link for proof), we get sum = .9 / (1 - .1) = .9 / .9 = 1.

    QED

  • Maurits 2010-09-29 17:03
    Crash Magnet:
    Crash Magnet:
    Does 0.999... = 1?

    How about

    F(n) = lim(10^n - 1)/10^n, n -> oo)

    Take the derivitive of num & denom.

    F(n) = lim(10n/10n, n -> oo)
    F(n) = 1.0

    QED


    Actually, I just realized that the derivitive of 10^n is not 10n. But the derivitive of the num & denom would be the same anyway and you would still get the answer 1.0.



    for the record:
    d/dx (10^x) =
    d/dx ((e^ln 10)^x) =
    d/dx (e^(x ln 10)) =
    by the chain rule:
    e^(x ln 10) d/dx (x ln 10) =
    (ln 10) (e^(x ln 10)) =
    (ln 10) ((e^ln 10)^x) =
    (ln 10) (10^x)
  • boog 2010-09-29 17:12
    fjf:
    Amateur. Maybe 1 != 0 once, but not the second or third time. So you have to test each pair an infinite number of times. And don't get me started about testing arithmetics ...

    This is getting out of hand. Let's just use the following check and call it a day:
    if(!universe.isCorrect())

    If you really think the correctness of the universe will change during execution, feel free to extend your own universe and implement some event handling code.
  • The Maths 2010-09-29 17:12
    MG:
    Also, since .9999.... = .9 + .09. + .009 + ..., an infinite geometric series with ratio .1 that has a finite sum.

    Since the sum is the first term divided by 1 less the ratio between the terms (see Wikipedia link for proof), we get sum = .9 / (1 - .1) = .9 / .9 = 1.

    QED

    You seem to know quite a bit about the maths, so I'm assuming you think your silly number games are clever.
  • Guiro 2010-09-29 18:00
    IsAlphaNumeric = IsAlphaOrNumeric = !IsAlpha & !IsNumeric (apparently)

    Therefore
    !IsFunny & !IsInsightful = IsFunnyOrInsightful
  • Hamish 2010-09-29 18:12
    Haven't read all the comments, but wanted to point at that example 1 isn't much of a WTF. A particular templating engine I work with, for example, could act on an object set (iterable) that has it's own properties. In order to iterate over the object's items while in that object's template you need a reference to the object to pass to the sub template.

    I might seem silly if you don't know the context, but it makes perfect sense.
  • DaveK 2010-09-29 18:12
    neminem:
    Jay:
    "Jewish atheists" would be something of a paradox


    No, it wouldn't. "Jewish" is a rather vague term: it's a religion, a culture, and a race.
    ^^^ This. I was pointing out that the original post specifically stated "Judaism", which does refer to just the religion, and the reply asked who else speaks (the Jewish language) Hebrew, implying that "Jewish" and "Judaism" were synonymous. Which, as you observe, is indeed not the case.

  • DaveK 2010-09-29 18:17
    1st Century Christian:
    Jay:
    DaveK:
    Bob:
    shimon:
    shimon:
    Bob:

    Welcome to the 21st century. News Flash: Judaism is no longer funny.

    Ya see, Hebrew does not equal Judaism, you antisemitic schmuck.

    Just a fix.

    Really? WTF else speaks Hebrew? God?
    Jewish atheists, duh.



    And most first-century Christians.

    Though technically you should probably say "Hebrew-speaking atheists". "Jewish atheists" would be something of a paradox, like "Buddhist Moslems". Not that people don't say it all the time.


    Hey, guys. I just climbed into my time machine to post this here, since you needed a non-Jew that speaks Hebrew. Just FYI we Christians are Jews too.
    No, we didn't need a non-Jew that speaks Hebrew: we needed someone who was non-Judaic who spoke Hebrew. Which you Jewish Christians quite clearly are, since you're followers of Christianity, and not followers of Judaism.
  • Ouch! 2010-09-29 18:53
    Hamish:
    Haven't read all the comments, but wanted to point at that example 1 isn't much of a WTF. A particular templating engine I work with, for example, could act on an object set (iterable) that has it's own properties. In order to iterate over the object's items while in that object's template you need a reference to the object to pass to the sub template.

    I might seem silly if you don't know the context, but it makes perfect sense.

    But how do you invoke the object's getSelf() method to get a reference to the object unless you already have a reference? getSelf() is not static.
  • stu 2010-09-29 19:15
    Ancient Mathematician:
    WthyrBendragon:
    One:
    Do we get to have a discussion about whether or not 1 is a prime number?


    Well, it is only integer factorable to 1 and itself so, yes, 1 is prime.

    However, random it is not.

    Well, if you were old enough, you'd know that 1 is not even a number, so it can't be a prime.
    And if you're young enough, you should know that 1 is a unit, so it can't be a prime.
    Only if you're stuck some time between -200 and 1900 is 1 a prime.

    Fixed focal length lenses are considered prime lenses. So if a photographer has a fixed 1mm lens, it's considered a 1mm prime lens. So 1 must be prime!
  • Dave 2010-09-29 19:17
    I had a coworker who defined these in a global include file:

    #define ThereIsLifeInTheUniverse 1
    #define EverAndEver ;;

    (This was in C)

    And then in code would do things like this...

    if (ThereIsLifeInTheUniverse) ... whatever

    or

    for (EverAndEver) { // Hallelujah, Hallelujah!
    }
  • Maurits 2010-09-29 19:19
    // warning: calling getSelf may make you go blind
  • nonpartisan 2010-09-29 19:49
    Coyne:
    Crash Magnet:
    Does 0.999... = 1?

    How about

    F(n) = lim(10^n - 1)/10^n, n -> oo)

    Take the derivitive of num & denom.

    F(n) = lim(10n/10n, n -> oo)
    F(n) = 1.0

    QED


    I saw this somewhere:

    Given x = .999...

    Then: 10x = 9.999...

    Now subtract x:

    10x - x = 9.999... - .999...

    Complete the subtraction:

    9x = 9.000...

    But the endlessly repeated 0 is redundant so:

    9x = 9

    Factor out the 9:

    x = 1

    Now, substituting the original value for x:

    .999... = 1

    QED


    IANAMathematician.

    This puzzle was first given to me in high school circa 1987. I worked on it with my math teacher and, later on, with my brother because he got his degree in math.

    The issues I've known to exist in this:

    1. Performing a mathematical operation on an infinitely long number is undefined. You never technically reach the end multiplying by 10 because you don't know what happens at the very end of the number. The same thing can be argued for the subtraction.

    2. As a value tends toward a limit in a graph, it's possible for the value that is being approached to have a discontinuity in the graph. So yes, it is *likely* that the two values are equal, but one cannot conclusively prove via graphs and limits that, indeed, the two are equal.
  • LB 2010-09-29 19:49
    ShatteredArm:
    smxlong:
    hatterson:
    about whether .999... == 1
    by the density of the real numbers, there must be some number X where 0.999... < X < 1.
    Why does there have to be a number between the two?

    Maybe there is a proof, but this is how I look at it:

    What is the largest number that is less than 1? I think you'd have to conclude that it is 0.999... wouldn't you?

    And if a < b, then a != b.

    Indeed there are number systems in which there is such a thing as "the largest number that is less than 1", but the only number system in widespread use in which 0.999... is a valid number is the real number system, and that one involves a continuum (the number line) rather than a series of discreet points.

    Of course, if you want to posit a number system of discreet points in which there is a point for 0.999... distinct from the point for 1, you can. (There are, after all, an infinite number of possible number systems.) But you would need to define both the notation and rules for this number system yourself and identify that it's the number system you're using, since it's not one in regular use by mathematicians.
  • Henning Makholm 2010-09-29 19:51
    Now, substituting the original value for x:

    .999... = 1

    QED

    Glad that's settled. Let's do the Monty Hall problem next, shal we?

    You get a 13/27 probability of winning if you switch doors.
  • Sam 2010-09-29 20:01
    I had a coworker who defined these in a global include file:

    #define ThereIsLifeInTheUniverse 1
    #define EverAndEver ;;

    (This was in C)

    And then in code would do things like this...

    if (ThereIsLifeInTheUniverse) ... whatever

    or

    for (EverAndEver) { // Hallelujah, Hallelujah!
    }

    The jokes on him! By using constant definitions like that his code will execute incorrectly when it runs on the last computer on some cold dead rock in a dying universe.

    Should have included that scenario in the unit tests, or used a real constant like

    #define PopeIsCatholic 1

    I hadn't seen the for ever and ever one before, that's pretty good!
  • Kuba 2010-09-29 20:07
    Anonymous Kernel Hacker:
    I think certain versions of Linux have included the line

    if(false)panic();

    just to verify that boolean logic is operating correctly.
    On any modern compiler, this would only verify things at compile time. To check if the runtime environment is sane, you'd need to have something like:

    volatile static int unhunh = 0;
    void sanity_check(void)
    {
    if (unhunh) panic();
    }
    I would need to check in the standard as to whether a static volatile won't be subject to optimization, but my initial gut feel is that with most compilers it would produce code that actually checks the value of unhunh in memory at runtime.
  • Kuba 2010-09-29 20:13
    LB:
    ShatteredArm:
    smxlong:
    hatterson:
    about whether .999... == 1
    by the density of the real numbers, there must be some number X where 0.999... < X < 1.
    Why does there have to be a number between the two?

    Maybe there is a proof, but this is how I look at it:

    What is the largest number that is less than 1? I think you'd have to conclude that it is 0.999... wouldn't you?

    And if a < b, then a != b.

    Indeed there are number systems in which there is such a thing as "the largest number that is less than 1", but the only number system in widespread use in which 0.999... is a valid number is the real number system, and that one involves a continuum (the number line) rather than a series of discreet points.

    Of course, if you want to posit a number system of discreet points in which there is a point for 0.999... distinct from the point for 1, you can. (There are, after all, an infinite number of possible number systems.) But you would need to define both the notation and rules for this number system yourself and identify that it's the number system you're using, since it's not one in regular use by mathematicians.
    Oh boy. Why so convoluted, when it's all easy. We must not forget that 0.999(9) is merely a notation in decimal positional system. That notation denotes the number 1. Yes, it's perhaps weird that every real number with a finite expansion in a positional system has a second, equivalent notation that has an infinite expansion in that same system. It's a quirk, but I've heard of it in high school math class. It works in any positional system, too. In binary, you have it too: 1.0 == 0.1111111(1), or say 0.5[base 10] = 0.1[base 2] = 0.0111(1), and so on.

    Remember: it's a quirk of positional representation, nothing more and nothing less. If you write 0.999(9), or using your notation 0.9999..., you are representing number 1. That's all there is to it.
  • cicobuff 2010-09-29 20:24
    smxlong:
    hatterson:
    One:
    Do we get to have a discussion about whether or not 1 is a prime number?


    I would rather a discussion about whether .999... == 1


    They are equal.

    If 0.999... != 1, then by the density of the real numbers, there must be some number X where 0.999... < X < 1. Suppose such a number exists. Please show me how to write this number.

    (The above is not a proof, but hopefully it's convincing enough)


    Whoooo. I guess if that "proof" is true, then, for integers, 0=1 after all. There goes number theory. TWTF.
  • Ouch! 2010-09-29 20:42
    cicobuff:
    smxlong:
    hatterson:
    One:
    Do we get to have a discussion about whether or not 1 is a prime number?


    I would rather a discussion about whether .999... == 1


    They are equal.

    If 0.999... != 1, then by the density of the real numbers, there must be some number X where 0.999... < X < 1. Suppose such a number exists. Please show me how to write this number.

    (The above is not a proof, but hopefully it's convincing enough)


    Whoooo. I guess if that "proof" is true, then, for integers, 0=1 after all. There goes number theory. TWTF.

    Since the integers are discrete, bringing them in to ridicule an argument that explicitly mentioned denseness only exposes yours.
  • Robert 2010-09-29 21:15
    I think the point would be to define what we all mean... rather than trying to cite any smart sounding rule that comes to mind.

    Rules created to make sense of chaos like "Any 2 Real numbers always have a number between them" are just that, made up rules some dudes decided was needed. It's not 'real' and without any hard reason to back it up makes no sense in relation to the discussion i think (other than its there to make things simpler and workable).

    To mean 0.9999999 etc to infinity in actuality means not 1 but zero point 9 to infinity so as to never be 1. There is no 'real' reason to have it equal 1 other than to simplify math and so people can feel better about having to deal with it and can use basic formulas on it using multiplication etc.

    Simple normal math isn't designed to work with infinite numbers in the first place and that's the real issue.

    0.333... = 1/3
    multiply both sides by 3 and you get
    0.999... = 3/3
    collapse the fraction
    0.999... = 1

    This is incorrect as 0.333 inf does NOT = 1/3 as 0.333 inf is not a perfect third of 1 (its damn close... but not exact), that's the whole point... they are not equal.

    0.999 inf does NOT = 3/3 either because if 0.333 inf is not a perfect third 3 of them cannot be a perfect set of 3 thirds (its 'close enough' perhaps but not technically equal)

    Given x = .999...
    Then: 10x = 9.999...
    .....{snip}.....

    This is also wrong as 10 times an infinite number isn't something that has set rules in basic math. e.g. How do you multiply a fraction correctly that's infinite? you would never stop calculating and so it simply cannot be done at all.

    In short the rule that 0.999 infinite equals 1 is just a farce to simplify a problem in mathematics and is in fact wrong in actuality.

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

    How did i do? please rate my attempt at helping the losing argument side on a scale of 'bah' to 'wtf!', all proceeds go to help the 'i need more wild turkey: american honey' fund.

  • anon 2010-09-29 21:22
    Ok, I think that was at least 0.8 TC (timecubes). Probably even more than 0.9. (No, not more than one. No one can do more than TC without their head asploding.)
  • anon 2010-09-29 21:24
    anon:
    (No, not more than one. No one can do more than TC without their head asploding.)

    More than 1 TC, of course. Dammit.
  • cicobuff 2010-09-29 21:39
    Ouch!:
    cicobuff:
    smxlong:
    hatterson:
    One:
    Do we get to have a discussion about whether or not 1 is a prime number?


    I would rather a discussion about whether .999... == 1


    They are equal.

    If 0.999... != 1, then by the density of the real numbers, there must be some number X where 0.999... < X < 1. Suppose such a number exists. Please show me how to write this number.

    (The above is not a proof, but hopefully it's convincing enough)


    Whoooo. I guess if that "proof" is true, then, for integers, 0=1 after all. There goes number theory. TWTF.

    Since the integers are discrete, bringing them in to ridicule an argument that explicitly mentioned denseness only exposes yours.


    hatterson:
    Anonymous:
    hatterson:
    One:
    Do we get to have a discussion about whether or not 1 is a prime number?


    I guess I am too dense to know of a number theory that states that 2 adjacent numbers have an equality relationship.


    If you had bothered to read and understand what people are posting you would have seen the fragment below.

    I would rather a discussion about whether .999... == 1

    Well, technically there is nothing to discuss because they most certainly are equal and it is a simple proof to confirm this beyond doubt. But damn, what a mindfuck eh? I remember when I first had to tackle this concept back in maths class, many years ago. Took a long time to get my head around. But once it clicked it was like a lightbulb going off in my head, I literally blurted out "fuck me!" in the middle of my maths class, directly to the lecturer. He was a bit of an old bastard and I thought he was going to go ballistic, but he just looked at me with a knowing smile and gently nodded. I had joined the club.


    Oh I'm well aware that they're the same number (just different representations) I just thought it would be fun to troll a thread on that rather than on if 1 is prime.

    .999... == 1 usually provides more entertaining responses to read since the is 1 prime "debate" just ends with "it's not because we said it's not."

    Edit: And looking at the last page or so, I greatly succeeded.


    Ouch indeed, so I guess that make you an airhead as compared to being dense?

    As usual, TWTF is in the comments.
  • dawg-e-dawg 2010-09-29 21:39
    shimon:
    Sup dawg, I heard you like references, so we've put a reference in your reference so you can get self while you have self!

    +1, best use of a meme on this site in the past month. Definitely deserves to be a FEATURED COMMENT!

    Transverbero...
  • cicobuff 2010-09-29 21:45
    Hmmm, quoting system is obviously not working as intended.

    The above post should also include.

    Since which number theory states that 2 adjacent numbers have an equality relationship. Because if that is true, all numbers would have been equal with a proof by induction.
  • Callin 2010-09-29 22:15

    public static boolean isMagical(char c)
    {
    return isLetter(c) && isDigit(c);
    }
  • Ozzie 2010-09-29 23:33
    Is it even worth pointing out that 215 isn't a prime number?
  • daedthel 2010-09-30 04:19
    cicobuff:

    Since which number theory states that 2 adjacent numbers have an equality relationship. Because if that is true, all numbers would have been equal with a proof by induction.


    Good thing there are no adjacent real numbers.
  • DaveK 2010-09-30 04:31
    Callin:

    public static boolean isMagical(char c)
    {
    return isLetter(c) && isDigit(c);
    }

    I tested this function on all the letters of the alphabet, and it returned true for 'C', 'D', 'I', 'L', 'M', 'V' and 'X'!

  • anon 2010-09-30 04:32
    cicobuff:
    Hmmm, quoting system is obviously not working as intended.

    The above post should also include.

    Since which number theory states that 2 adjacent numbers have an equality relationship. Because if that is true, all numbers would have been equal with a proof by induction.

    There are no “adjacent” real numbers. That is, for two real numbers x, y with x < y, there is another real number z such that x < z < y. If there is no such number for xy, then x = y.
  • gilhad 2010-09-30 04:35
    I am not sure the first one is WTF:
    Suppose we have something like

    assingWork(chooserFunct) {
    while work=getWork() { chooserFunct().doIt(work) }
    }


    then we can call it like that:

    assignWork(callCenter.getFreeOperator());
    assignWork(market.getShortestQueue());
    assignWork(oneManArmy.getSelf());
  • DaveK 2010-09-30 04:47
    Robert:
    How did i do?

    It wasn't a triumph.
    (I'm making a note here: EPIC FAIL.)
    It's hard to understate my satisfaction.

    TDWTF postings
    We tear them all down, because we can.
    For the good of all of us
    Except the ones who get flamed

    Now it's no use pointing out every mistake
    You just keep on posting 'til you run out of flames
    And the CSoDs all get done, and the Error'ds come and come
    From the posters who are still awake...

    [ ... ]
  • digitig 2010-09-30 04:59
    frits:

    Arnold Vriezekolk writes, "one of the guys on our team likes to be thorough. Very, very thorough."

    /* This program will only run if the laws of mathematics hold */
    if(1 == 0)
    {
    fprintf("Oh crap - we are not running in the correct Universe\n");
    exit(17);
    }






    Right. Because in your universe fprintf() doesn't need a file pointer.

    In that universe, one file pointer parameter equals no file number parameters.
  • Sophisticated Vampire 2010-09-30 05:05
    Anonymous:

    Hey there Ancient Mathematician, you might be just the person I need to help me with an ancient Roman math problem. The following sum is written in Roman numerals. Can you solve it and provide your answer also in Roman numerals?
    (IV + I) - V = ?


    Easy: (IV + I) - V = I - I
  • digitig 2010-09-30 05:08
    hatterson:
    One:
    Do we get to have a discussion about whether or not 1 is a prime number?


    I would rather a discussion about whether .999... == 1

    It depends on the number system you are using. In standard analysis they are equal, but in non-standard analysis -- which is used for some things like the analysis of fractals -- the number system is defined in a different way and they are not equal.
  • me 2010-09-30 05:51
    digitig:
    hatterson:
    One:
    Do we get to have a discussion about whether or not 1 is a prime number?


    I would rather a discussion about whether .999... == 1

    It depends on the number system you are using. In standard analysis they are equal, but in non-standard analysis -- which is used for some things like the analysis of fractals -- the number system is defined in a different way and they are not equal.

    Also, they are clearly not equal in base 11 or greater.
  • Don 2010-09-30 06:02
    Steve The Cynic:
    Anonymous:
    Hey there Ancient Mathematician, you might be just the person I need to help me with an ancient Roman math problem. The following sum is written in Roman numerals. Can you solve it and provide your answer also in Roman numerals?

    (IV + I) - V = ?

    Ah, but you forget that the things we call Roman numerals were for writing down numbers, not for performing arithmetic. One of the principal advantages of the modern versions of Arabic numerals (the 0..9 system that we use today) is that they use the same notation for writing down numbers and for doing arithmetic. The Romans used a form of abacus (note that the wire-and-bead calculators that we call abacuses are in fact NOT abacuses) when performing non-trivial arithmetic.

    All that, of course, does not change the fact that there is no way to use Roman number-recording-notation to write zero.


    Um... actually.. they did have a representation for nothing; but there was no need to represent a zero figure since it did not figure in their numeric symbols (Roman numerals are not positional).
    If a value was what we call zero (no apples, no eggs, no life, whatever), then it was regarded as nulla/nullae - which has actually been represented in some old roman texts as N (rare).

    There is really no need for the number zero either - cnsider the value MM, which is 2000, or MMI which is 2001.
  • Anonymous 2010-09-30 06:05
    boog:
    Fair enough, it's valid syntax in both C# and Java.

    But you said it is Java.
    Severity One:
    Unless 1 == 0, that's Java.

    And you clarified your argument, for those of us who are "running in the correct Universe":
    Severity One:
    ...so in short: 'That's Java'.

    I've never heard of someone taking a snippet of code that exists in the context of a C# application and outright calling it "Java" (or vice versa). So this implies that either A) you know more about the actual habitat of this code snippet than we do, or B) you're making assumptions. I think the GP was arguing B.

    I'm not saying you're wrong, I'm just suggesting that you revise your statement to avoid these silly arguments.
    what Severity One should have said:
    Unless 1 == 0, that's valid Java syntax.

    Isn't that more accurate?

    Yep, exactly what boog said. You really don't have to be an asshole just for the sake of it, we all knew what you meant and we all knew what I meant. Is it problems at home Sev One? Why don't you get it off your chest instead of lashing out at strangers? I'm here if you want to talk about it.
  • Anonymous 2010-09-30 06:14
    hatterson:
    Anonymous:
    hatterson:
    One:
    Do we get to have a discussion about whether or not 1 is a prime number?


    I would rather a discussion about whether .999... == 1

    Well, technically there is nothing to discuss because they most certainly are equal and it is a simple proof to confirm this beyond doubt. But damn, what a mindfuck eh? I remember when I first had to tackle this concept back in maths class, many years ago. Took a long time to get my head around. But once it clicked it was like a lightbulb going off in my head, I literally blurted out "fuck me!" in the middle of my maths class, directly to the lecturer. He was a bit of an old bastard and I thought he was going to go ballistic, but he just looked at me with a knowing smile and gently nodded. I had joined the club.


    Oh I'm well aware that they're the same number (just different representations) I just thought it would be fun to troll a thread on that rather than on if 1 is prime.

    .999... == 1 usually provides more entertaining responses to read since the is 1 prime "debate" just ends with "it's not because we said it's not."

    Edit: And looking at the last page or so, I greatly succeeded.

    Mission accomplished my friend, I haven't seen 220+ comments on an article for quite some time!
  • Sammy 2010-09-30 06:24
    0.999 infinite has ambivalent meanings due to the unability of the decimal system to represent thirds of one correctly.

    1/3 != 0.333 infinite

    It's just the closest number to 1/3 we know in the decimal system - that's the reason for the widespread use of 1/3 = 0.333 infinite. In the ternary numeral system it would be simply 1/3 = 0.1.
    Basically, that means both sides are correct, because both meanings can be applied. It's like the M in roman numbers - it stood for 1,000 as well as infinity.
    By the way, the same problem arises if a double is supposed to represent 1. I don't think I'll have to elaborate this one in this place.

    On another note, like somebody else already pointed out, there is a number between 0.999 infinite and 1 - it's 1.999 infinite divided by 2.

    Always be open-minded, and check the validity of the arguments of other people before answering. Sometimes they're right, sometimes both are right.

    (I love "real world" comparisons:
    "Okay, this stick shall now represent a gun. Hey, why can't I shoot with the stick? Why doesn't it behave like a gun?"
    "Okay, 0.333 infinite shall now represent 1/3. Hey, why can't I calculate with 0.333 infinite so 3 * 1/3 = 3 * 0.333 infinite = 1? Why doesn't 0.333 infinite behave like 1/3?")
  • digitig 2010-09-30 06:27
    One:
    Do we get to have a discussion about whether or not 1 is a prime number?

    It's all down to the definition. "Prime" used to be defined in such a way that 1 was prime (see Goldbach's original formulation of the Goldbach conjecture, for instance). Now "prime" is usually defined in such a way that 1 is not prime (and mathematicians who don't know the history of the subject get cross if you suggest that "prime" /could/ be defined in such a way as to include 1). I've never managed to find out when the change of definition happened, though. Some time between the 18th century and the late 20th.
  • Matthew 2010-09-30 06:45
    Sammy:
    0.999 infinite has ambivalent meanings due to the unability of the decimal system to represent thirds of one correctly.

    1/3 != 0.333 infinite

    It's just the closest number to 1/3 we know in the decimal system

    It's either 1/3, or it's not actually defined, and so isn't a number, and so can't be "the closest number" to anything. There's no way you can sensibly* define 0.333 recurring as a number that != 1/3.

    * Obviously if you want to remove this constraint, it's quite easy. But not very helpful.
  • CapCity 2010-09-30 07:24
    Anonymous:
    Ancient Mathematician:
    WthyrBendragon:
    One:
    Do we get to have a discussion about whether or not 1 is a prime number?


    Well, it is only integer factorable to 1 and itself so, yes, 1 is prime.

    However, random it is not.

    Well, if you were old enough, you'd know that 1 is not even a number, so it can't be a prime.
    And if you're young enough, you should know that 1 is a unit, so it can't be a prime.
    Only if you're stuck some time between -200 and 1900 is 1 a prime.

    Hey there Ancient Mathematician, you might be just the person I need to help me with an ancient Roman math problem. The following sum is written in Roman numerals. Can you solve it and provide your answer also in Roman numerals?

    (IV + I) - V = ?


    V - V
  • anon 2010-09-30 07:38
    Whether 1 is a prime number or not is essentially an arbitrary definition.

    If you say it is prime, there will be some theorems and proofs that say "for all primes except 1".

    If you say it isn't prime, there will be some other theorems and proofs that say "for all primes and 1".

    The primality or not of 1 is defined so it makes sense in the majority of cases in actual use.
  • GalacticCowboy 2010-09-30 07:38

    "This is one of our developer's misguided attempts to prevent a null pointer exception," writes Yamee.


    if (_tblItem.getTable().getModel() != null
    && _tblItem.getTable() != null
    && _tblItem != null)



    So close... and yet so very, very far...

    The Nerve:
    Fixed?

    if (&& _tblItem != null != null
    && _tblItem.getTable() != null
    _tblItem.getTable().getModel())


    I think you forgot the comments on this one. Or else your parser quit on you... Looking forward to your future submissions to this site.
  • Peter 2010-09-30 07:50
    IV + I) - V = (I-I)
  • Troll Army 3 2010-09-30 07:53
    I've seen GameFAQs topics with a more intelligent 0.999~ = 1 discussion that this.
  • h1ppie 2010-09-30 08:28
    THE NUMBER ONE:
    Do we get to have a discussion about whether or not I am a number?

    FTFY


    I am not a number, I am a FREE MAN!
  • kraken66j 2010-09-30 08:31
    DCRoss:
    THE NUMBER ONE:
    Do we get to have a discussion about whether or not I am a number?

    No, you are a free man.



    Iron Maiden!
  • Matthew 2010-09-30 08:36
    Sammy:
    On another note, like somebody else already pointed out, there is a number between 0.999 infinite and 1 - it's 1.999 infinite divided by 2.

    Finding yet a third way of writing the same thing doesn't prove anything, I'm afraid. If 0.999 infinite is a number, and is not equal to zero, then there must be a number between them (an infinite number of numbers, in fact) that can be represented by a finite decimal.

    The only sensible (there's that word again) definition of 0.999 infinite is as an infinite geometric series. And they're fairly well understood. And the limit of this particular series is 1.
  • dkf 2010-09-30 08:56
    Robert:
    Simple normal math isn't designed to work with infinite numbers in the first place and that's the real issue.
    The real issue is that you're a dumbass in the old math department.

    To put things simply, there is no mathematical operation that you can perform on 0.999… that you can't also do on 1 to get the same result. (Assuming you're sticking with the real domain; in the integer domain the 0.999… is not syntactically valid.) If you think about it, that's got to be the case (what is 1-0.999… anyway? Must be 0.000… That in turn means that no measure function can distinguish them) which means that, at least with the standard representation of the continuum, they must be the same thing.

    The cause of this weirdness is the fact that real numbers are not discrete, and that has some very non-obvious consequences. The natural way for people to think about things is in terms of discrete entities, but that sort of thinking just doesn't work for real numbers. (There are mathematical structures that can distinguish these things, but they're even odder than the reals and I've yet to see any convincing argument that they're useful for anything at all.)
  • Severity One 2010-09-30 09:15
    Anonymous:
    Yep, exactly what boog said. You really don't have to be an asshole just for the sake of it, we all knew what you meant and we all knew what I meant. Is it problems at home Sev One? Why don't you get it off your chest instead of lashing out at strangers? I'm here if you want to talk about it.

    Strangers, like people called "Anonymous (unregistered)"?

    Look, whoever made the first comment was claiming that this was C#, because it had generics, notwithstanding that Java has had generics for the last five or six years.

    It was pointed out that is, in fact, Java, and he said, fair cop, I was unaware of that.

    But then he came back with the pedantic rubbish about definitions, "patently false", and who should have written what.

    I don't care if someone makes a mistake; I make them myself all the time. But I can't stand people trying to cover their arse and making excuses.

    Or coming up with silly arguments about "problems at home". There's a name for such a debating "technique" (for want of a better word), but quite frankly, I can't be arsed to look it up.
  • Ilya Ehrenburg 2010-09-30 09:33
    dkf:
    Robert:
    Simple normal math isn't designed to work with infinite numbers in the first place and that's the real issue.
    The real issue is that you're a dumbass in the old math department.

    To put things simply, there is no mathematical operation that you can perform on 0.999… that you can't also do on 1 to get the same result. (Assuming you're sticking with the real domain; in the integer domain the 0.999… is not syntactically valid.) If you think about it, that's got to be the case (what is 1-0.999… anyway? Must be 0.000… That in turn means that no measure function can distinguish them) which means that, at least with the standard representation of the continuum, they must be the same thing.


    It's even simpler. Notations like 0.(142857) or 0.999 infinite or such have no intrinsic meaning, so their meaning has to be defined.

    The meaning has been defined so that these representations denote the limit of the sequence of the finite decimal fractions (e.g. 0.1, 0.14, 0.142, ... , 0.1428571428, 0.14285714285, ...) of increasing length formed from it[1] (you all know the rule by which they are formed, I believe).

    Since the limit of (1 - 10^(-n)) as n tends towards infinity is 1, 0.(9) = 1 by the definition of the notation.
    Similarly 0.(3) = 1/3 by the notation's definition.

    dkf:
    (There are mathematical structures that can distinguish these things, but they're even odder than the reals and I've yet to see any convincing argument that they're useful for anything at all.)

    I haven't seen a convincing argument for non-standard reals either.
    I would appreciate one.

    [1] Technically, the definition is a little different, but I won't go into that without a blackboard or LaTeX available.
  • Ilya Ehrenburg 2010-09-30 09:44
    anon:
    Whether 1 is a prime number or not is essentially an arbitrary definition.


    One can argue about the "arbitrary", but yes, it's undeniably a matter of definition.

    If you say it is prime, there will be some theorems and proofs that say "for all primes except 1".

    If you say it isn't prime, there will be some other theorems and proofs that say "for all primes and 1".

    The primality or not of 1 is defined so it makes sense in the majority of cases in actual use.


    And since in the overwhelming majority of cases not including 1 amongst the primes (or, for that matter, 0, if you use the more modern definition of primes instead of the traditional definition taught in school, which characterizes what are nowadays called irreducible numbers), makes things far more elegant and succinct, that's the definition adopted by the overwhelming majority of mathematicians.
  • Anonymous 2010-09-30 10:01
    Severity One:
    Anonymous:
    Yep, exactly what boog said. You really don't have to be an asshole just for the sake of it, we all knew what you meant and we all knew what I meant. Is it problems at home Sev One? Why don't you get it off your chest instead of lashing out at strangers? I'm here if you want to talk about it.

    <Snipped aggression that obviously stems from far more than a trivial anonymous comment>

    Let it out Sev One, let it all out. I can tell you're having a bad day at the very least, probably a bad year by the sounds of things. If it makes you feel better to argue your corner then I'm not going to stop you. It's perfectly clear from boog's response that my comment was valid and correct, but this isn't about correctness anymore. This is about you getting the help you need to sort out whatever it is that's causing all this unfounded aggression. As I said before, I'm here if you want to talk. Hey, I don't even mind if you want to continue defending your logically flawed point of view - whatever it takes to make you feel a bit better about life.
  • by 2010-09-30 10:06
    LB:
    ShatteredArm:
    smxlong:
    hatterson:
    about whether .999... == 1
    by the density of the real numbers, there must be some number X where 0.999... < X < 1.
    Why does there have to be a number between the two?

    Maybe there is a proof, but this is how I look at it:

    What is the largest number that is less than 1? I think you'd have to conclude that it is 0.999... wouldn't you?

    And if a < b, then a != b.

    Indeed there are number systems in which there is such a thing as "the largest number that is less than 1", but the only number system in widespread use in which 0.999... is a valid number is the real number system, and that one involves a continuum (the number line) rather than a series of discreet points.

    Of course, if you want to posit a number system of discreet points in which there is a point for 0.999... distinct from the point for 1, you can. (There are, after all, an infinite number of possible number systems.) But you would need to define both the notation and rules for this number system yourself and identify that it's the number system you're using, since it's not one in regular use by mathematicians.

    Wow I'm sure glad those points are able to keep a secret. I think you mean "discrete"? You won't win any math points around here if you get that one wrong.
  • gilhad 2010-09-30 10:08
    0.999.... vs. 1 - it really depends on context, those two things could be clearly different in some cases - lets take function "floor" which maps Real numbers to Integers by returning the highest Integer number less or equal its parameter.
    floor(0)=0
    
    floor(0.9)=0
    floor(0.99)=0
    floor(0.9999999999999999999999999999999999999999)=0
    floor(0.9...)=0
    floor(1)=1

    and there are not only functions, which are not continuous in some points, there are also functions, which are not continuos in any point :)
  • Matthew 2010-09-30 10:14
    gilhad:

    floor(0.9...)=0

    Sorry. You're assuming that limit(floor(x)) = floor(limit(x)) there. It doesn't.

    gilhad:
    and there are not only functions, which are not continuous in some points, there are also functions, which are not continuos in any point :)

    My favourite "strange" function is:

    f(x) = 0 when x irrational
    f(x) = 1/q when x rational and p/q in its lowest fractional form

    Continuous at all irrational points, discontinuous at all rational. Proving this is left as an exercise for the reader.
  • boog 2010-09-30 10:18
    Ozzie:
    Is it even worth pointing out that 215 isn't a prime number?

    Not sure. Everyone else seemed to think so when they pointed it out. ;)
  • Design Pattern 2010-09-30 13:26
    gilhad:


    floor(0.9...)=0
    floor(1)=1


    Time to call your residential building insurance.
    You floor is broken.

    CAPTCHA: secundum (the CAPTCHA is backing me up!)
  • Brutius 2010-09-30 13:30
    00Davo:
    Steve The Cynic:
    Anonymous:
    Hey there Ancient Mathematician, you might be just the person I need to help me with an ancient Roman math problem. The following sum is written in Roman numerals. Can you solve it and provide your answer also in Roman numerals?

    (IV + I) - V = ?

    Ah, but you forget that the things we call Roman numerals were for writing down numbers, not for performing arithmetic. One of the principal advantages of the modern versions of Arabic numerals (the 0..9 system that we use today) is that they use the same notation for writing down numbers and for doing arithmetic. The Romans used a form of abacus (note that the wire-and-bead calculators that we call abacuses are in fact NOT abacuses) when performing non-trivial arithmetic.

    All that, of course, does not change the fact that there is no way to use Roman number-recording-notation to write zero.

    Could one not write zero in Roman numerals like this: " "?


    They would have written it as NIHIL, NULLUS or NIL to prevent confusion.

    It's generally thought that the Romans did not contribute anything of significance to mathematics, yet European mathematicians were using Roman numerals and base 60 (from the Babylonians) until well into the first Renaissance. Had at some time they formalized a zero, say N/n for "nil", and a sexagesimal point say E/e for "et", we might today still be using it.

    E.g. the ratio of the circumference of a circle divided by its diameter is approximated as:

    iii e viii xxix xliv n xlvii

    It actually not too hard to add, subtract or multiply in Roman numerals. There are only a few symbols, so the multiplication table is really small. Division is a pain though.
  • AquaDuck 2010-09-30 14:33
    gilhad:
    0.999.... vs. 1 - it really depends on context, those two things could be clearly different in some cases - lets take function "floor" which maps Real numbers to Integers by returning the highest Integer number less or equal its parameter.
    floor(0)=0
    
    floor(0.9)=0
    floor(0.99)=0
    floor(0.9999999999999999999999999999999999999999)=0
    floor(0.9...)=0
    floor(1)=1

    and there are not only functions, which are not continuous in some points, there are also functions, which are not continuos in any point :)


    Except floor(x) isn't actually mapping reals to integers but floats to integers. Floating-point numbers aren't reals, they're just an approximation that's close enough most of the time.
  • Mark 2010-09-30 14:34
    gilhad:
    0.999.... vs. 1 - it really depends on context, those two things could be clearly different in some cases - lets take function "floor" which maps Real numbers to Integers by returning the highest Integer number less or equal its parameter.
    floor(0)=0
    
    floor(0.9)=0
    floor(0.99)=0
    floor(0.9999999999999999999999999999999999999999)=0
    floor(0.9...)=0
    floor(1)=1

    and there are not only functions, which are not continuous in some points, there are also functions, which are not continuos in any point :)


    The only "context" it depends on is the number system. I think we've established that we're talking about real numbers. Note that digital computers cannot accurately calculate real numbers, which may cause some confusion with your example since most people around here probably see floor() in computer programs (where it typically maps from IEEE FLOAT, not real numbers).

    The floor() function operating on Reals does not map 0.999... to 0. You can't just drop everything from the decimal point onward. Per your definition, floor() returns the greatest integer less than or equal to the Real number you give it. You can't use your assumptions about its output to prove something about its input; you have to calculate its output based on what's known about the input. As has been discussed at length, 0.999... is just a funny decimal notation for 1, so the greatest integer less than or equal to 0.999... is 1. The correct evaluation of floor(0.999...) is 1.
  • Mark 2010-09-30 14:38
    Several people have suggested that 0.333... != 1/3 but is an approximation. This is provably incorrect. (I'm not going into the details. The importance to me of you understanding this is exactly enough for me to post a suggestion that you educate yourself; not enough that I will try to educate you.)

    At least one called 0.333... an "infinite number". It isn't; it's finite and has a well defined value. The math operations we know and love (like multiplcation and subtraction) work on all real numbers, including those whose decimal representation is infinite. They even work on irrational numbers, or you couldn't do any geometry involving circles.

    A lot of people get uncomfortable with infinite representations, or with math that extends to talk about limits or other infinite concepts. This doesn't mean that math doesn't work with those concepts; it means you don't.
  • boog 2010-09-30 16:07
    smxlong:
    If 0.999... != 1, then by the density of the real numbers, there must be some number X where 0.999... < X < 1. Suppose such a number exists. Please show me how to write this number.

    I realize the discussion has gone far beyond this particular post, but I thought I'd throw one more brain-teaser out there for anyone who is still continuing this idiotic debate.

    Assuming that 0.999... != 1 (which is assuming wrong, but bear with me), or rather that 0.999... is supposedly the largest number less than 1, I ask you this: what is the largest number that is less than 0.999... and how do you write this number?
  • hatterson 2010-09-30 16:31
    Matthew:
    gilhad:

    floor(0.9...)=0

    Sorry. You're assuming that limit(floor(x)) = floor(limit(x)) there. It doesn't.

    gilhad:
    and there are not only functions, which are not continuous in some points, there are also functions, which are not continuos in any point :)

    My favourite "strange" function is:

    f(x) = 0 when x irrational
    f(x) = 1/q when x rational and p/q in its lowest fractional form

    Continuous at all irrational points, discontinuous at all rational. Proving this is left as an exercise for the reader.


    Heh, I remember proving that...it was actually on a test. It was the first time any of us had seen the function or it's proof.

    The prof usually liked to throw things like that on the test because he felt tests weren't an accurate assessment unless we had to actively think/deduce as opposed to just recall.
  • hatterson 2010-09-30 16:32
    boog:
    smxlong:
    If 0.999... != 1, then by the density of the real numbers, there must be some number X where 0.999... < X < 1. Suppose such a number exists. Please show me how to write this number.

    I realize the discussion has gone far beyond this particular post, but I thought I'd throw one more brain-teaser out there for anyone who is still continuing this idiotic debate.

    Assuming that 0.999... != 1 (which is assuming wrong, but bear with me), or rather that 0.999... is supposedly the largest number less than 1, I ask you this: what is the largest number that is less than 0.999... and how do you write this number?


    Given that the standard rules of mathematics don't apply under this assumption I would be perfectly happy with saying that .999...8 is the largest number less than .999...

    In this crazy world .999...8 would be .000...1 less than .999... which is .000...1 less than 1
  • Ilya Ehrenburg 2010-09-30 16:41
    hatterson:
    boog:
    smxlong:
    If 0.999... != 1, then by the density of the real numbers, there must be some number X where 0.999... < X < 1. Suppose such a number exists. Please show me how to write this number.

    I realize the discussion has gone far beyond this particular post, but I thought I'd throw one more brain-teaser out there for anyone who is still continuing this idiotic debate.

    Assuming that 0.999... != 1 (which is assuming wrong, but bear with me), or rather that 0.999... is supposedly the largest number less than 1, I ask you this: what is the largest number that is less than 0.999... and how do you write this number?


    Given that the standard rules of mathematics don't apply under this assumption I would be perfectly happy with saying that .999...8 is the largest number less than .999...

    In this crazy world .999...8 would be .000...1 less than .999... which is .000...1 less than 1

    Since the Real field is an ordered field, assuming 0.999... were the largest number smaller than 1, obviously the largest number less than 0.999... would be (0.999... - (1 - 0.999...)) and I would write it thus.
    Note however that in an ordered field, there cannot be such a thing as "the largest number less than x".
  • JS 2010-09-30 16:45
    divisible by itself, 1, 5, and 43, you mean.
  • MG 2010-09-30 18:31
    The Maths:
    MG:
    Also, since .9999.... = .9 + .09. + .009 + ..., an infinite geometric series with ratio .1 that has a finite sum.

    Since the sum is the first term divided by 1 less the ratio between the terms (see Wikipedia link for proof), we get sum = .9 / (1 - .1) = .9 / .9 = 1.

    QED

    You seem to know quite a bit about the maths, so I'm assuming you think your silly number games are clever.


    Hardly clever. Anyone who has learned rudimentary Calculus knows this. It is provable and it avoids any argument that you somehow can't perform a mathematical operation on an infinitely repeating decimal (that is, that 10 * .99999... somehow does not equal 9.9999...).
  • Henning Makholm 2010-09-30 19:47
    hatterson:
    Given that the standard rules of mathematics don't apply under this assumption I would be perfectly happy with saying that .999...8 is the largest number less than .999...

    That's only until someone comes along and asks how .999...85 compares to either of these.

    In some sense, the usual definitions are arbitrary, but they're not that arbitrary. If we require that the real numbers must in some reasonable sense generalize the properties of the rationals, and that whatever rules we adopt for them must not immediately lead to a contradiction, there is not much wiggle room left.

    Non-standard analysis gets you only so far; in particular the non-standard reals come bundled with non-standard integers (which are the usual ones plus a steaming heap of different infinities). The decimal expansion of a non-standard real then requires a digit for each non-standard-integral index, and if you set all of these decimals to 9, you still get 0.999...=1 exactly. The best you can do is to make the first aleph-0 decimals 9's and the rest 0's. Then 0.999...9900... is infinitesimally close to, but distinct from, 1.
  • hoodaticus 2010-09-30 21:20
    That ISelfAware if truly precious. Not only does it have a blindingly arrogant name, but it is also utterly useless. Such combinations of arrogance and ignorance are amusing from afar, but enraging when it's happening right next to you at work.
  • Robert 2010-09-30 23:12
    MG:
    The Maths:
    MG:
    Also, since .9999.... = .9 + .09. + .009 + ..., an infinite geometric series with ratio .1 that has a finite sum.

    Since the sum is the first term divided by 1 less the ratio between the terms (see Wikipedia link for proof), we get sum = .9 / (1 - .1) = .9 / .9 = 1.

    QED

    You seem to know quite a bit about the maths, so I'm assuming you think your silly number games are clever.


    Hardly clever. Anyone who has learned rudimentary Calculus knows this. It is provable and it avoids any argument that you somehow can't perform a mathematical operation on an infinitely repeating decimal (that is, that 10 * .99999... somehow does not equal 9.9999...).


    Any mathematical operation on an infinite number can never be completed ever... you can *show* a formula, but you can never get the answer in actuality as you cannot possibly ever finish working it out.

    To actually perform even a simple addition of 1111... and 1111... the act of addition itself can never be completed. You can *assume* that because 1+1=2 that eventually you'll get to 2222... but that's an assumption based on related knowledge, how can you possibly get the TRUE result (and the real true result is what counts only) to that by performing the actual method of base addition? you can't.

    Multiplication is even worse as there is no right hand starting point to begin the calculation on a fraction, carrying over remainders for infinity sounds like a lot of work as well and means you cannot get a result. 10 * 0.9999... can never be completed and is an invalid formula in real terms. The only formula that would work is self representation:

    10 * 0.9999.... = 10 * 0.9999....

    Again it's more about reality than rules. Making up laws only hides the solution and helps people think they are smart :)

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

    That's right i'm back just to keep annoying you all with more posts from the losing side... soon i'll potentially run out of crap to make up but not yet! :D

  • Robert 2010-09-30 23:34
    Mark:
    Several people have suggested that 0.333... != 1/3 but is an approximation. This is provably incorrect. (I'm not going into the details. The importance to me of you understanding this is exactly enough for me to post a suggestion that you educate yourself; not enough that I will try to educate you.)

    At least one called 0.333... an "infinite number". It isn't; it's finite and has a well defined value. The math operations we know and love (like multiplcation and subtraction) work on all real numbers, including those whose decimal representation is infinite. They even work on irrational numbers, or you couldn't do any geometry involving circles.

    A lot of people get uncomfortable with infinite representations, or with math that extends to talk about limits or other infinite concepts. This doesn't mean that math doesn't work with those concepts; it means you don't.


    "At least one called 0.333... an "infinite number". It isn't; it's finite and has a well defined value."

    This is all wrong, my post clearly states that we ARE talking about infinite numbers... the nature of the representation of the number is up for debate sure... but as i said we need to clear on what we personally MEAN, which is why i defined it as infinite number... repeatedly!

    If you choose we can write it like this from now on 0.999(inf) to save all the confusion if you are getting lost.

    It's impossible to actually calculate a result using a real infinite number, you can make up some rules (but they ARE in fact made up rules) you can approximate and assume... but it won't be true results.

    There is no possible way to finish performing a calculation like 10 * 0.999(inf) you simply can never in "real terms" finish as its infinite and the process of a multiplication itself requires the testing of all units of the formula which are... infinite.

    We humans like to make up lots of fun rules to fix issues like this... doesn't take away from the original problem however that 1 != 0.999(inf) as the values are simply plain different

    1) One is a standard number, 1 with no infinite definition
    and 0.999(inf) is a infinite number.. this makes them different

    2) They both represent different values and this is the part most of you are brain washed into thinking is wrong via made up rules to solve the issue in the first place.

    I would agree that if the difference between the 2 numbers is absolutely nothing and null they are the same... in that the difference between 5 and 5 is absolute truth of 0, so they are the same. 5 = 5

    However! There is no way to calculate the difference between 1 and 0.999(inf).

    1 - 0.999(inf) = (Undefinable Infinity Shred Value)

    As there is no way to find out the difference between them you cannot just assume that there is none to make people happy, that's called being a lazy bastard... so they are simply not equal.

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

    I could use more help! someone else join the losers side and help me out damn it, we can do it! we can change the rules of the universe!
  • Robert 2010-09-30 23:48
    As an added note the same logic applies to disproving the idea that the past is infinite.

    The 'past' by its very definition and what it is.. is what has actually occurred, the history of the universe as a whole must then have actually happened up to the point we are now.

    And an infinite past could never occur or happen as its ... infinite, so its impossible for the past to be infinite.

    This means the universe had a starting point, a creation point as it were... or maybe an injection point.

    A starting point for the universe being the only real possibility brings a lot of ideas more closely into play like religion and the idea that time itself was created via the big bang

    A fun thought for a rainy day!
  • Reepy 2010-10-01 01:15

    <script type="text/javascript">document.write('</div>')</script>
    <noscript></div></noscript>

    Reminds me of some code replaced as soon as I saw it

    <script language="Javascript">document.write('<input type="text" value="hidden value" st' + 'yle="display: none">')</script>
  • Severity One 2010-10-01 05:16
    Anonymous:
    Severity One:
    <Snipped aggression that obviously stems from far more than a trivial anonymous comment>

    Let it out Sev One, let it all out. I can tell you're having a bad day at the very least, probably a bad year by the sounds of things. If it makes you feel better to argue your corner then I'm not going to stop you. It's perfectly clear from boog's response that my comment was valid and correct, but this isn't about correctness anymore. This is about you getting the help you need to sort out whatever it is that's causing all this unfounded aggression. As I said before, I'm here if you want to talk. Hey, I don't even mind if you want to continue defending your logically flawed point of view - whatever it takes to make you feel a bit better about life.

    I agree that there's aggression going on here, but it's not coming from my side. But I'm dropping this; apparently, confrontation and ad hominem attacks are far more accepted where you live.

    Glad I don't work there.
  • DeadPanda 2010-10-01 05:58

    public static boolean isAlphaNumeric(char c)
    {
    return !isLetter(c) && !isDigit(c);
    }

    De Morgans fail.

    Captha: genitus... huh.
  • Someone You Know 2010-10-01 09:10
    Robert:
    MG:
    The Maths:
    MG:
    Also, since .9999.... = .9 + .09. + .009 + ..., an infinite geometric series with ratio .1 that has a finite sum.

    Since the sum is the first term divided by 1 less the ratio between the terms (see Wikipedia link for proof), we get sum = .9 / (1 - .1) = .9 / .9 = 1.

    QED

    You seem to know quite a bit about the maths, so I'm assuming you think your silly number games are clever.


    Hardly clever. Anyone who has learned rudimentary Calculus knows this. It is provable and it avoids any argument that you somehow can't perform a mathematical operation on an infinitely repeating decimal (that is, that 10 * .99999... somehow does not equal 9.9999...).


    Any mathematical operation on an infinite number can never be completed ever... you can *show* a formula, but you can never get the answer in actuality as you cannot possibly ever finish working it out.

    To actually perform even a simple addition of 1111... and 1111... the act of addition itself can never be completed. You can *assume* that because 1+1=2 that eventually you'll get to 2222... but that's an assumption based on related knowledge, how can you possibly get the TRUE result (and the real true result is what counts only) to that by performing the actual method of base addition? you can't.



    Just out of curiosity, Robert, have you considered the possibility that the methods you're using for computing products or sums are not any less "made up" than any other methods?
  • Henning Makholm 2010-10-01 09:54
    Someone You Know:
    Just out of curiosity, Robert, have you considered the possibility that the methods you're using for computing products or sums are not any less "made up" than any other methods?

    Why bother? He's explicitly and openly trolling.
  • cappeca 2010-10-01 11:47
    WthyrBendragon:
    I keep thinking that that getSelf() method should be Private. After all, wouldn't you want to be private while doing some sort of self exam?


    You are mixing getSelf() with playWithSelf().
  • Someone You Know 2010-10-01 13:29
    Henning Makholm:
    Someone You Know:
    Just out of curiosity, Robert, have you considered the possibility that the methods you're using for computing products or sums are not any less "made up" than any other methods?

    Why bother? He's explicitly and openly trolling.


    Oh, I know. I'm just curious to see what he comes up with.
  • iMalc 2010-10-01 15:17
    I have actually worked with a third party ActiveX control where I really did have to call a certain procedure exactly three times in a row to make it work properly. The thing was fairly buggy and it was hard enough to get the authors to fix the more important bugs due to the language barrier, and we needed the thing working asap.
    Calling it once almost worked, but not quite.
    Calling it twice was worse.
    But calling it three times worked a charm.

    Yes it's a WTF, but the WTF is the bug inside that function, not the fact that we found out how to beat it into submission.
  • Schol-R-LEA 2010-10-01 18:59
    itsmo:
    One:
    Do we get to have a discussion about whether or not 1 is a prime number?


    Do we get to have a discussion about whether or not 1 is a number?

    FTFY

    Do we get to have a song about whether or not 1 is the loneliest number?
    FTFY
  • Online training courses USA 2010-10-02 14:12
    Cynosureks.com is top USA online training services based on California, sotware online tarining leading US IT tech jobs portal,careers,employement,consultancies,USA jobs. www.cynosureks.com

    IT online jobs,Salesforce, Hyperion, Pega, Maximo, SAP - SD, SAP - PP, SAP - Netweaver, SAP - HR, SAP - CRM, Microstrategy, Teradata DBA, Teradata Dev, Oracle BPEL SOA, SAP - ABAP, SAP - FICO, QTP 10.0, Project Management Program, Testing Tools, Business Analyst, Veritas Netbackup, Obiee, Cognos tm1, PL - SQL , Load Runner (Advance), Java-J2EE,.Net.
  • Arancaytar 2010-10-03 08:42
    exit(17)?

    Ah, the infamous ERR_INCORRECT_UNIVERSE code.
  • Arancaytar 2010-10-03 08:44
    "This is in our production code," notes Joseph Daigle, "I can only hope they rolled a die to ensure this was actually random."

    public static int RANDOM_PRIME_NUMBER = 215;


    Random or not, it doesn't look very prime. So this line is a WTF on two separate levels.
  • OneIsntPrime 2010-10-03 15:41
    Uh no. 1 is not a prime number. There is nothing to discuss.
  • LB 2010-10-04 13:58
    Henning Makholm:
    The decimal expansion of a non-standard real then requires a digit for each non-standard-integral index, and if you set all of these decimals to 9, you still get 0.999...=1 exactly. The best you can do is to make the first aleph-0 decimals 9's and the rest 0's. Then 0.999...9900... is infinitesimally close to, but distinct from, 1.

    That may be the closest you can come, but it falls apart on the fact that an infinitely repeating decimal only has aleph-0 digits total. This new number system would need to come up with somewhere else for the 0's to go.
  • LB 2010-10-04 13:58
    Robert:
    Any mathematical operation on an infinite number can never be completed ever... you can *show* a formula, but you can never get the answer in actuality as you cannot possibly ever finish working it out.

    But if you're only going to allow expressions that can be directly calculated rather than proven, then you can't work with large numbers either. Nobody could actually work out what 758478 * 353822 equals (and certainly not within one lifetime) except by relying on rules that have been proven in the general case and then applied to that specific case. The process of proving works the same with infinite representations.
  • fjf 2010-10-04 23:45
    Henning Makholm:
    hatterson:
    Given that the standard rules of mathematics don't apply under this assumption I would be perfectly happy with saying that .999...8 is the largest number less than .999...

    That's only until someone comes along and asks how .999...85 compares to either of these.


    That's easy: .999...85 is the 15th largest number less than 1, and smaller than .999...8, of course.

    You probably meant .999...8.5, but this number doesn't exist, as any kid knows a number can't have two decimal points.

    (How' that, Robert?)
  • gnasher729 2010-10-05 08:08
    Well, there is no largest number less than 1. Take any number x. Either x >= 1, or x < 1.

    If x >= 1, then x is not the largest number less than 1, because it isn't less than 1 in the first place.

    If x < 1, then x < (1 + x) / 2 < 1, so we found another number that is less than 1 but greater than x, so again, x is not the largest number less than 1.

    So if we take any number x, then it is not the largest number less than 1. So there is no largest number less than 1.
  • Someone You Know 2010-10-05 09:18
    gnasher729:
    Well, there is no largest number less than 1. Take any number x. Either x >= 1, or x < 1.

    If x >= 1, then x is not the largest number less than 1, because it isn't less than 1 in the first place.

    If x < 1, then x < (1 + x) / 2 < 1, so we found another number that is less than 1 but greater than x, so again, x is not the largest number less than 1.

    So if we take any number x, then it is not the largest number less than 1. So there is no largest number less than 1.


    Hey, it's a good thing you pointed that out, because otherwise no one in this thread would have known about the density of real numbers.
  • boog 2010-10-05 10:27
    gnasher729:
    Well, there is no largest number less than 1.

    Hence the following condition, which was stated clearly in the comment to which you were replying:
    hatterson:
    Given that the standard rules of mathematics don't apply under this assumption

  • GeekMaster 2010-10-07 20:36
    public static int RANDOM_PRIME_NUMBER = 215;

    How many primes are divisible by 5?
  • Codetopia 2010-10-11 03:01
    public static boolean isAlphaNumeric(char c)
    {
    return !( !isLetter(c) && !isDigit(c) );
    }
  • baha 2010-10-12 19:09
    article:
    "This is one of our developer's misguided attempts to prevent a null pointer exception," writes Yamee.

    if (_tblItem.getTable().getModel() != null
    && _tblItem.getTable() != null
    && _tblItem != null)



    it made me remember something like "shoot first, ask later"
  • Zennehoy 2010-10-25 13:10
    What about 43?
  • hose 2010-11-02 03:58
    I bet that if-if-else-else and javascript/html examples are no wtf at all when their history is considered.

    They look like last minute requirement changes to me. The developer then took the little time he had left before release to make changes as small as possible to prevent introducing new bugs.
  • Rdm 2011-06-03 06:46
    At least it is a number... I guess someone will have to do some refactoring until you can read

    public static string PRIVATE_RANDOM_PRIME_NUMBER = "wtf!?";
  • Craig 2012-07-16 12:41
    Being the author of the ISelfAware interface, I would point out that the key is the comment about its use in an MBean. Normally the MBean mechanism does not allow you to get a reference to the actual underlying object which is acting to supply the MBean data. Admittedly this is a bit weird, but I needed the raw access to the object and I couldn't resist the name.
  • iCantRead 2012-09-29 16:08
    a (thankfully, long gone)


    I actually wondered why "thankfully" doesn't have a type specification, and why "gone" cannot be simplified to an int.