Where did Arduino get its name?

In April 1928 The Italia landed at Stolp en route to the pole.
In April 1928 The Italia landed at Stolp en route to the pole.

I wasn’t looking for this, but when I saw the name in the Wikipedia article, I looked up a guy named Ettore Arduino. It turns out this guy was an Italian airship engineer, but I don’t want to ruin it – the story is too cool to summarize.

You’ll just have to go read it yourself on Wikipedia.

****************************************SPOILER******************************

Sorry to ruin it, but the naming coincidence turns out to be just that. I like the romanticized version better, but it turns out the kit is named for a nearby bar.

Branching JavaScript for Different Browsers

I’ve been reading Pro JavaScript Design Patterns and I just got to try out a neat technique for dealing with the lexical differences between different browsers’ (I’m looking at you, IE) JavaScript implementations. The branching pattern allows you to create classes that execute different code based on whatever conditions you choose to examine.

/**
 * @constructor General miscellaneous utilities.
 */
mySingleton.etc = function () {
    /**
     * Branching object to handle both standard and 
     * Microsoft DOM interfaces.
     */
    var standard = {
            /**
             * Use the classList (standard) object.
             */
            getClassCount: function (element) {
                return element.classList.length;
            }
    }, 
    ie = {
            /**
             * Use the className (IE) object.
             */
            getClassCount: function (element) {
                return element.className.length;
            }
    }, 
    testObject, 
    testElement;

    testElement = document.createElement("body");

    try {
        testObject = webkit.getClassCount(testElement);
        return standard;
    } catch (e) {
        testObject = ie.getClassCount(testElement);
        return ie;
    }

};

It’s fairly easy to see what’s transpiring here. We basically have two cases we have to handle: IE and everything else. So we add two respective private members to this class, “standard” and “ie”. Then we check to see which method the class should return. We do this by asking the browsers to execute the code in question. Then we return the private member that can contains the code to be executed.

Simple, right?