• Chris (unregistered)

    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 (unregistered) in reply to Chris
    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 (unregistered)

    From here on all my code is going to implement ISelfAware. A new project called "SkyNet" or something just came through.

  • CJ (unregistered)

    Can someone explain the wtf with the hashmap to me?

  • Chris (unregistered) in reply to anon
    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 (unregistered)

    Oh crap - we are not commenting in the correct Universe

  • swedish tard (unregistered) in reply to WthyrBendragon
    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 (unregistered) in reply to frits
    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.

  • (cs) in reply to Steve The Cynic
    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 (unregistered) in reply to frits

    Obviously this is from an embedded system without a file system. Why would you need a file pointer there?

  • Anonymous (unregistered) in reply to CJ
    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 (unregistered) in reply to CJ
    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 (unregistered) in reply to WthyrBendragon

    Only if you implement ISelfConscious.

  • Larry (unregistered) in reply to Anonymous
    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 (unregistered)

    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.

  • (cs) in reply to Bert Glanstron

    Hi Honey! Did you miss me? kisses

  • (cs) in reply to Anonymous
    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 (unregistered) in reply to anonymous
    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 (unregistered) in reply to The Nerve
    The Nerve:
    Fixed?
    <!-- <script type="text/javascript">document.write('</div>')</script>
    <noscript></div></noscript> -->
    

    Broken? now you are not putting the needed

  • aepryus (unregistered)
    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 (unregistered) in reply to Severity One
    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.
  • (cs) in reply to Anonymous
    Anonymous:
    (IV + I) - V = ?
    Why are you mixing those newfangled chicken scratches with your proper good ol' Roman numerals?
  • (cs) in reply to Andy P
    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.

  • (cs) in reply to One

    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 (unregistered)

    /* 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 (unregistered)

    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 (unregistered) in reply to Severity One
    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 (unregistered) in reply to Nutster
    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 (unregistered) in reply to Larry
    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 (unregistered)
    // 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 (unregistered)
    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 (unregistered)

    wtf??? what does that mean? get me outta here!!!!!!!!

  • boog (unregistered) in reply to Anonymous
    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 (unregistered) in reply to Mark
    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.
  • (cs) in reply to THE NUMBER ONE
    THE NUMBER ONE:
    Do we get to have a discussion about whether or not I am a number?
    No, you are a free man.
  • (cs) in reply to boog
    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 (unregistered) in reply to Anonymous
    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 (unregistered) in reply to The Nerve
    The Nerve:
    Fixed?

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

    Fail

  • icebrain (unregistered)

    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.

  • דותן כהן (unregistered) in reply to Larry

    סליחה?‏

  • דותן כהן (unregistered) in reply to Larry
    Larry:
    the article:
    if (_tblItem.getTable().getModel() != null 
        && _tblItem.getTable() != null 
        && _tblItem != null)
    
    TRWTF is languages that read left-to-right.

    סליחה?‏

  • Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx (unregistered) in reply to Uh...
    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).
  • (cs) in reply to WthyrBendragon
    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 (unregistered) in reply to Anonymous
    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 (unregistered) in reply to boog
    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 (unregistered)
    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 (unregistered) in reply to דותן כהן
    דותן כהן:
    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 (unregistered) in reply to Bob
    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!

  • (cs)

    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 (unregistered) in reply to Hitler
    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

Leave a comment on “ISelfAware, Very Thorough, Crazy Hashmaps, and More”

Log In or post as a guest

Replying to comment #:

« Return to Article