h1

Science Roads for Mercuryday, 20100310

Posted in Science Etcetera on March 10th, 2010
  • The Chilean city of Concepció moved 10 feet to the West as a result of the recent earthquake.

  • Credit: University of Hawaii
  • Ray Kurzweil has written a fairly critical review of Avatar for being unimaginative with its portrayal of alien life and underwhelming in its depictions of technology a century from now.
  • Because the courts have ruled criticism of evolution in public schools amounts to a state endorsement of religion, creationists are trying a new tact by uniting with climate change skeptics to get their message into American classrooms.
  • Quantifying what China has been saying for awhile now: nearly a quarter of China’s emissions are the result of exporting goods to the West.
  • PSA: Plastics Kill 1.5 Million Marine Animals Each Year:
  • h1

    Science Zingers for Marsday, 20100309

    Posted in Science Etcetera on March 9th, 2010
  • Naegleria gruberi is an amoeba that, when subjected to stress, goes from an oozy-moving organism to an organism that sprouts arms and swims a breaststroke through its muddy environment under eucalyptus trees.
  • Naegleria gruberi
    Naegleria gruberi
    Credit: Lillian Fritz-Laylan
  • In addition to sweet, salty, sour, bitter and umami, the human tongue can also taste fat, with our ability to taste fat linked to our weight, the more sensitive to its flavor, the lower the weight.
  • Cool animated gif of two icebergs colliding as seen from space.
  • In 1996 Dr. Frances Gulland discovered that “18 percent of deaths in stranded adult sea lions were the result of tumors in the reproductive and urinary tracts” with other species of mammals getting cancer, scientists need to find out what combination of industrial pollutants is causing them.
  • Naegleria gruberi Genome Sequencing:
  • h1

    Science Stuff for Moonday, 20100308

    Posted in Science Etcetera on March 8th, 2010
  • Scientists are “cautiously excited” that Bruce Hudson, from Ontario in Canada, has identified interstellar dust from the Stardust spacecraft using the Stardust@Home internet application.
  • Aerogel Tray Used to Collect Particles
    Aerogel Tray Used to Collect Particles
    Credit: NASA
  • The “big mean drunk” stereotype gets some weight, as an experiment finds that large males become more aggressive when drunk, administering shocks to pretend opponents in a laboratory contest.
  • Ritalin appears to increase brain plasticity, increasing the activity of the neurotransmitter dopamine to enhance the speed of learning.
  • Survey finds large differences in opinion as to what constitutes sex, with the oldest and youngest male age groups the least likely to consider certain behaviors qualifying.
  • Stardust satellite thru Comet’s Jets:
  • h1

    Science Paths for Venusday, 20100305

    Posted in Science Etcetera on March 5th, 2010
  • Fossil find in Tanzania pushes back the origin of dinosaurs another 10 million years to 245 million years ago.
  • Phylogenetic postion of Asilisaurus among bird-line archosaurs
    Phylogenetic postion of Asilisaurus among bird-line archosaurs
    Credit: S. Nesbitt
  • For better health, school districts are turning kids onto water from sodas, but bottled-water can carry industrial chemicals and is hard on the environment, while, in older school districts, tap water can carry lead.
  • We humans are extremely bad at the Monty Hall problem, where after choosing one of three doors for a hidden prize, and then having one of the other two doors eliminated, you should always switch your choice because your first choice was 1 out of 3, while the second is 50/50. It appears pigeons are better than us figuring this out, going from switching their choices “36 percent of the time on day one to some 96 percent of the time on day 30.” Meaning pigeons are more empirical than we are with our preconceptions.
  • w00t!!! Popular Science has put its entire archives online for free. That’s 137 years of Popular Science!!!
  • Diver removes Frisbee from shark:
  • Visit msnbc.com for breaking news, world news, and news about the economy

    h1

    Science Wonders for Jupiterday, 20100304

    Posted in Science Etcetera on March 4th, 2010
  • Out of sight, out of mind. The danger of extinction is that, once a species disappears from the Earth, we quickly forget it about it.
  • Yangtze River Dolphin
    Yangtze River Dolphin
  • A comparison of the sinking of the Titanic and the Lusitania found that women and children go first if there’s time for it, as the Titanic’s women and children were saved because the boat sank slowly, and the men went down with the ship, but the Lusitania sank quickly, leaving it a free-for-all to get to the lifeboats.
  • Discovery has a beautiful slideshow of cuttlefish glowing through the power of bacteria accompanied with the fantastic story of symbiosis between squid and the microscopic culture.
  • Contaminated food results in 5,000 deaths and 325,000 hospitalizations a year, costing America $152 billion annually. The article goes on to detail the complex regulatory system that monitors food safety and the increasingly complex system that brings food to our grocery stores, where a bag of salad can involve multiple farms.
  • Timelapse of swarming monster worms and sea stars eating a dead seal:
  • h1

    What’s the Right JavaScript Framework, If Any?

    Posted in Geeking Out on March 3rd, 2010
    JavaScript Frameworks
    JavaScript Frameworks

    I recently checked out Google’s AJAX Libraries, which, aside from being inaccurately titled, provides a means for web developers to access functionality in a wide variety of popular JavaScript frameworks and toolkits without having to host the libraries themselves. Simply include the base Google library, and then use it to load whatever framework you want to access in you code. It’s not for me, as I’m a total control-freak when it comes to production implementations of my code, and I don’t like having my web pages hang up trying to access URIs on outside domains, which definitely happens to the code I run locally using this tool; however, it does provide a convenient playground for testing out different JavaScript frameworks and toolkits.

    You can do anything with JavaScript, but you have to program around its shortcomings. How JavaScript functions depends on the ECMAScript engine running it, with Firefox running TraceMonkey, Chrome running V8, and Internet Explorer running Trident, it makes it difficult to write code that runs the same in all browsers. Then there’s JavaScripts’ object-orientation strategy, which uses prototype chains for inheritance, confusing most OO programmers. Finally, there’s some major oversights in JavaScript functionality, like the fact that it lacks a trim() function.

    There are two types of JS Frameworks, those that extend JS functionality for the advanced programmer and those that simplify coding for the novice. If you’re an advanced programmer, it’s nice to have true object-orientation in your JavaScript. If you’re a novice, it’s nice to be able to whip out some fancy special effects with just a few lines of code. What follows is my understanding and impressions of these frameworks as I used Google’s Libraries to play with them.

    Beginner Toolkits

    The Dojo Toolkit, Yahoo! User Interface Library, jQuery UI, and Script.aculo.us are three toolkits brimming with easy-to-implement effects to enhance a webpage without resorting to plugins like Flash or Silverlight. Underneath these toolkits are frameworks. For instance, Scriptaculous is built on the Protoype framework, and jQuery UI on the jQuery framework. Aaron Newton’s jQuery vs MooTools has a great explanation of the difference between a toolkit and a framework:

    Part of this consideration is the notion of a framework vs a toolkit. MooTools is a framework that attempts to implement JavaScript as it should be (according to MooTools’ authors). The aim is to implement an API that feels like JavaScript and enhances everything; not just the DOM. jQuery is a toolkit that gives you an easy to use collection of methods in a self-contained system designed to make the DOM itself more pleasant. It just so happens that the DOM is where most people focus their effort when writing JavaScript, so in many cases, jQuery is all you need.

    Each of these toolkits provide their own unique features. For instance, YUI provides sophisticated event timing, categorized into “available,” “contentready,” and “domready,” allowing for executing JavaScript functions when document objects become available, when the object and its children become available, and when the entire document is available to improve the performance of your web page. Nifty, but also a bit esoteric, a reminder that, when we buy into a framework, we are also buying into a development methodology.

    One problem I have with all of the larger, bells-and-whistles JavaScript toolkits is that I find myself browsing their libraries of plugins, trying to find some way to work their dazzling features into my web pages; when, in reality, the way I develop, the features I need to implement simply emerge, and I go looking for scripts as I need them. If I adopt a feature-rich framework, then I’m going to be out of luck the moment I need functionality it doesn’t include.

    Another thing to consider is how intrusive the toolkit is. If you’re planning on including 50 to 100 kilobytes of framework code in every web page on your site, how much more code is needed to exercise its functions?

    Here’s Dojo’s fade-out effect:


    dojo.require("dijit.form.Button");
    function basicFadeoutSetup() {
    function fadeIt() {
    dojo.style("SomeElementId", "opacity", "1");
    var fadeArgs = {
    node: "SomeElementId"
    };
    dojo.fadeOut(fadeArgs).play();
    }
    dojo.connect(dijit.byId("basicFadeButton"), "onClick", fadeIt);
    }
    dojo.addOnLoad(basicFadeoutSetup);

    Here’s the YUI version of the fade-out effect:


    YUI().use('anim-base', function(Y) {
    var anim = new Y.Anim({
    node: 'SomeElementId',
    to: { opacity: 0 }
    });
    var onClick = function(e) {
    e.preventDefault();
    anim.run();
    };
    Y.get('SomeElementId .yui-remove').on('click', onClick);
    });

    Here’s the jQuery UI version of the fade-out effect:


    $("SomeElementId").hide('highlight');

    Finally, we have Scriptaculous’ fade effect:


    $('SomeElementId').fade();

    On the one hand, the Dojo and YUI examples appear to offer much more customization in the implementation of their features, while the jQuery UI and Scriptaculous examples offer simplicity and ease of implementation. If you need something customized with the latter two toolkits, you’ll need to code around them. While with the former two toolkits you’ll need to customize them their way.

    And that can be a real problem. If you are a novice JS developer and you adopt Dojo or YUI, you will never become an advanced JS programmer. You might become an advanced Dojo or YUI programmer, but those are much more narrowly defined skill sets, which are less marketable to companies with established development environments.

    Advanced Frameworks

    Sam Stephenson’s Prototype framework and the MIT Licensed MooTools are true JavaScript frameworks intended for advanced programmers. Both frameworks overcome the awkwardness of JavaScript’s prototypal inheritance by enabling class-based inheritance to make it function more like a mainstream object oriented language.

    You won’t find fade() functions in these frameworks, but you will find enhanced means of accessing the objects in a web page (DOM) (jQuery goes so far as to provide a means to query the DOM for arrays of objects). You will also find useful functions such as trim() and cross-browser, streamlined methods for making AJAX calls. With Prototype and MooTools, you’ll still need to write your functions, but with the adoption of the methodologies within these frameworks, you should find your coding streamlined and more robust.

    As thin and streamlined as these frameworks are, they still include much more functionality than most JavaScript developers need in their average web page. If I need a trim() function, I’ll go get one somewhere online. If I need mainstream object-orientation, I’ll use Prototype on the page where I need it. The problem with these frameworks is that, if you’re smart enough to be using them, you’re probably smart enough to not be using them.

    Conclusions

    Here’s an example of what it takes to roll your own fade-out effect:


    var TimeToFade = 1000.0;

    function fade(eid)
    {
    var element = document.getElementById(eid);
    if(element == null)
    return;

    if(element.FadeState == null)
    {
    if(element.style.opacity == null
    || element.style.opacity == ''
    || element.style.opacity == '1')
    {
    element.FadeState = 2;
    }
    else
    {
    element.FadeState = -2;
    }
    }

    if(element.FadeState == 1 || element.FadeState == -1)
    {
    element.FadeState = element.FadeState == 1 ? -1 : 1;
    element.FadeTimeLeft = TimeToFade - element.FadeTimeLeft;
    }
    else
    {
    element.FadeState = element.FadeState == 2 ? -1 : 1;
    element.FadeTimeLeft = TimeToFade;
    setTimeout("animateFade(" + new Date().getTime() + ",'" + eid + "')", 33);
    }
    }

    function animateFade(lastTick, eid)
    {
    var curTick = new Date().getTime();
    var elapsedTicks = curTick - lastTick;

    var element = document.getElementById(eid);

    if(element.FadeTimeLeft <= elapsedTicks)
    {
    element.style.opacity = element.FadeState == 1 ? '1' : '0';
    element.style.filter = 'alpha(opacity = '
    + (element.FadeState == 1 ? '100' : '0') + ')';
    element.FadeState = element.FadeState == 1 ? 2 : -2;
    return;
    }

    element.FadeTimeLeft -= elapsedTicks;
    var newOpVal = element.FadeTimeLeft/TimeToFade;
    if(element.FadeState == 1)
    newOpVal = 1 - newOpVal;

    element.style.opacity = newOpVal;
    element.style.filter = 'alpha(opacity = ' + (newOpVal*100) + ')';

    setTimeout("animateFade(" + curTick + ",'" + eid + "')", 33);
    }

    Of course, you would hide the above code away in an include file, and invoking the fade effect would simply require:


    fade('SomeElementId');

    But including the above code, even uncondensed, would require only a small fraction of what including any of these frameworks would necessitate in condensed form. Plus you have the strength of understanding your code and how it works. You don't always have the time to spend a week rewriting someone else's script to fit the specifics of your situation or writing your own from scratch, but if you do, you will be rewarded for it. The script will become your own.

    Frameworks and toolkits have their uses, and I don't want to disparage them; however, two rules come out of this analysis for me. First, developers who are novice enough to use a feature-rich toolkit will hurt themselves by adopting one, because they won't be learning mainstream JavaScript. Second, developers who are skilled enough to make use of an advanced framework probably don't need one, but could benefit from analyzing them for techniques to use in their own code.

    I'll continue to play with these frameworks from time to time in order to learn new techniques and best practices, but I'll stick to my current strategy of copy-and-pasting code from a wide variety of online sources. The best JavaScript framework, to my mind, remains the World Wide Web.


    Further Reading:

  • Dustin Diaz Top 10 JavaScript Functions: possibly the best post ever on functions you can include in your script vice including an entire library.
  • In my research for this post, I came across the incredibly useful $ Function, which replaces getElementById, allowing developers to type "$('SomeElementId')" instead of "document.getElementById('SomeElementId')" everywhere. There is also a Variation on the $ Function, which allows querying the DOM for arrays of objects to modify a group of similar objects with one call.
  • h1

    Science Snippets for Mercuryday, 20100303

    Posted in Science Etcetera on March 3rd, 2010
  • A 67 million-year-old mudslide fossilized a snake in the act of eating a dinosaur.
  • Snake Eating Dinosaur
    Snake Eating Dinosaur
    Credit: PLoS Biology
  • Genetic analysis of polar bears show they have adapted to climate change in the past, challenging a USGS prediction that they will go extinct if the arctic sea ice is lost.
  • The earthquake in Chile probably shifted the Earth’s axis, permanently making days shorter by 1.26 microseconds.
  • On today’s Internet, a large portion of the traffic no longer travels through the backbone networks of large Internet companies, and instead travels around the edges of the network, much of it through peer-to-peer sharing, video has become the Internet’s predominant data type, we measure traffic in terms of yottabytes up from petabytes, and researchers are struggling to keep up with its ever-changing shape.
  • The State of the Internet:
  • JESS3 / The State of The Internet from Jesse Thomas on Vimeo.

    h1

    Science Smidgens for Marsday, 20100302

    Posted in Science Etcetera on March 2nd, 2010
  • TOPIO is a robot that can play ping pong, using two cameras to detect the position of the ball in space and an artificial neural network to choose the best return. Hasn’t beaten a human opponent yet, but give it a few years. So long as it doesn’t “solve” ping pong. : )
  • TOPIO 3.0 at International Robot Exhibition IREX 2009, TOKYO, JAPAN
    TOPIO 3.0 at International Robot Exhibition IREX 2009, TOKYO, JAPAN
    Credit: Humanrobo
  • Al Gore has an extensive piece in the NYT’s summing up everything we’ve argued here about Climate Change, including the over-hyped “Climategate”, snow storms in the United States, and the fact that, even taking Global Warming out of the equation, reducing America’s dependence on foreign oil is just a good idea in itself.
  • Best article yet on the Data Revolution, beginning with some incredible numbers on the amount of data being produced in different sectors and delving into how society is working to manage the deluge.
  • New study suggests that more than a quarter of the stars in our galaxy were born outside of it.
  • Funny Talking Animals – Walk On The Wild Side – Episode Three Preview – BBC One:
  • h1

    2,000 Years of Artificial Life in Art

    Posted in Geeking Out on March 1st, 2010

    In his book Chess Metaphors, about chess, neuroscience, and artificial intelligence, Diego Rasskin-Gutman devotes a short section to the popular myths, literature, and films dealing with characters creating artificial humans from motivations like desire, necessity, curiosity, and power. More fascinating than the motivations for producing AIs, is the evolving origins of where the artificial life comes from in fiction:

    8 AD

    Pygmalion et Galatée
    Pygmalion et Galatée
    Credit: Alex Bakharev

    One of the myths retold in Ovid’s Metamorphoses is of King Pygmalion who, when he grows disenchanted with real women, sculpts a statue of a woman with whom he falls in love. The Goddess Venus brought the statue to life in response to Pygmalion’s prayers, and the King married her. There were other examples of artificial life in Greek mythology, but this is the most compelling throughout the following millennia, inspiring numerous works of art, including George Bernard Shaw’s 1913 play Pygmalion, which was later remade as the 1956 musical My Fair Lady

    1800s

    Rabi Loew and Golem
    Rabi Loew and Golem
    Credit: Mikolas Ales

    As the legend goes, the 16th century rabbi of Prague Judah Loew ben Bezalel created a Golem out of clay or soil, bringing it to life with the word “emet” on its forehead. When the Golem had terrorized those prosecuting the Jews sufficiently to have them relent, the rabbi killed his creation by erasing the letter “e” from its forehead, leaving “met,” Hebrew for “death.” Although there is divine intervention involved in the creation of this artificial being, everything is under the rabbi’s control.

    1818

    Frontispiece to the revised edition of Frankenstein by Mary Shelley
    Frontispiece to the revised edition of Frankenstein by Mary Shelley
    Credit: Theodore Von Holst

    A story of artificial life without anything divine in its origin’s is Mary Shelly’s Frankenstein, where Dr. Frankenstein fashions “the monster” using ambiguous means; however, Dr. Frankenstein’s background in chemistry and other sciences certainly contributed to his success in creating life. The monster is an outcast, abandoned by the fearful doctor and alienated from other people due to his frightful appearance. So a second trend appears in the myths of artificial life, that the more involved a human is in the creation of life, the more inhuman that life becomes.

    1921 and 1927

    R.U.R. (Rossum's Universal Robots)
    R.U.R. (Rossum’s Universal Robots)
    Credit: BBC

    This trending of artificial life into malevolence continues with Karel Capek’s play R.U.R. (Rossum’s Universal Robots), where artificial humans, mass produced at a factory, revolt and drive the human race to extinction. The Machine from Fritz Lang’s Metropolis also serves as a cautionary tale, engineered by Doctor Rotwang, the robot impersonates the leader of the workers and uses their trust to inspire a revolt. In the first example, the artificials use their overwhelming numbers to overthrow humanity, in the second, a single artificial uses its resemblance to humanity to manipulate it. The robots grow increasingly insidious as they grow powerful.

    2001

    Artificial Intelligence: AI
    Artificial Intelligence: AI

    Although not in Rasskin-Gutman’s examples, the robots in the film Artificial Intelligence: A.I both blend in with humanity and are mass-produced; however, Spielberg and Kubrick’s future AIs are highly benevolent beings, curious and generous. They lament the extinction of the human race that we brought upon ourselves, and try to understand us by resurrecting humans out of space-time. Although this new myth has yet to withstand a few decades of time to see if its message will stick in cultural memory, it does signal a new direction for human perceptions of artificial life, from divine gifts, to manufactured monsters, and now manufactured gods. “The secret of life is sought in a gradient of divine intervention to human intervention, which is also a temporal gradient,” Rasskin-Gutman notes, “representing the triumph of science over religion.”