Archive for March, 2008

Earth Hour – Dark city, bright idea

Posted by Daniel on March 29, 2008
Miscellaneous / No Comments

I just heard today about Earth Hour. It is an international event that asks homes and businesses to turn off their lights and non-essential electrical appliances for one hour, from 8pm to 9pm on March 29 (today) to promote electricity conservation and create awareness. (See also on Wikipedia and BBC).

The idea comes from WWF Australia. The first Earth Hour was in 2007 and it was only in Sydney. This year the event has grown to cover 28 partner cities, where the cities themselves turn off all non-essential lights for one hour. Even if your city is not doing this, individual households and businesses can join. As of now 287,955 homes and 20,094 businesses have signed up.

I’m kinda bumped that no city in Germany (where I live) is joining the effort. I only heard about this today! But my partner and I will observe Earth Hour tonight anyways, and turn everything off for an hour. It’ll be hard to be away from the Net for an hour, but I think I’ll manage ;-)

We’re also writing to our city to ask if the city can join next year. We’re also writing to WWF Germany to see if they want to coordinate Earth Hour next year.

I’d like to give kudos to San Francisco. San Francisco had come up with their own program earlier, called Lights Out, which occurred in October. But this year they decided to move it to March 29 to align Earth Hour. So rather than running a competing event, San Francisco is supporting Earth Hour and the Lights Out programme is being replaced by Earth Hour.

Tag-lines:

“See the difference you can make.”
“Dark city, bright idea.”

Advanced JS with Douglas Crockford

Posted by Daniel on March 28, 2008
Programming / No Comments

Douglas Crockford of Yahoo has a very interesting lecture on advanced JavaScript. I believe that the lecture was given some time in 2006, but I figure that not everyone has seen it yet. This is one of my favourite lectures on JavaScript. I highly recommend it.

The video is divided into three parts. I’ll post all three here. Hope you enjoy them.

Part I

Part II

Part III

Robot solving the Rubics cube

Posted by Daniel on March 26, 2008
Miscellaneous / No Comments

On YouTube. Direct Link.

Subprime mess explained in pictures

Posted by Daniel on March 25, 2008
Miscellaneous / No Comments

Funny. See the subprime mess explained in pictures.

In memory of Arthur C. Clarke

Posted by Daniel on March 23, 2008
Miscellaneous / No Comments

Yesterday was the burial of Arthur C. Clarke, famous scientist, science fiction writer, futurist and visionary. Born in 1917 in Britain, Clarke served in the Royal Air Force and later earned a degree in mathematics and physics (a fact that greatly pleases your humble narrator). He became a knight, a Nobel Peace Prize nominee, and received more awards than I can list here. In 1956 Arthur emigrated to Sri Lanka, where he lived until his death.

In his more than 100 books, Arthur C. Clarke popularized many great ideas like space elevators and gave a dream to an entire generation of future scientists. Clarke can be credited for inventing the concept of telecommunications satellites and geostationary orbits (which today are called Clarke Orbits). That is, the use of a network of satellites to get around the field of vision problem and allow wireless communication across to the other side of the globe.

Clarke is also famous for the movie 2001: Space Odyssey based on one of his short stories. The movie has become a popular icon in western culture, including the homicidal super-computer HAL 9000 (contrary to popular myth, the name of HAL is not derived from IBM but from Heuristic ALgorithm). Today, the Sir Arthur Clarke Awards (for notable contributions to space exploration) are shaped like the monolith in the movie and include a rendering of Clarke’s first diagram explaining how telecom satellites would work.

I like to think of Arthur C. Clarke as a modern day version of Jules Verne, only 100 years later. Both men had visions of the future ahead of their time. Jules Verne wrote about submarines, Clarke wrote about telecom satellites. Both ideas were deemed fiction in their time, and both are commonplace today.

The next major prediction of Arthur C. Clarke, which has not yet come to pass, is the space elevator, an idea first developed by the Russian scientist Konstantin Tsiolkovsky, and popularized by Clarke through his book Fountains of Paradise.

Arthur is also famous for his Rendezvous with Rama series, written in his later years. The Rama trilogy won him all the main awards in science fiction (Nebula Award 1973, Hugo Award 1974 and Jupiter Award 1974).

In 1988 he was diagnosed with post-polio syndrome, which confined him to a wheelchair for the rest of his life, except when he was following his hobby of scuba diving. Clarke said diving was as close as he could get to the weightless feeling of space. “I’m perfectly operational underwater”, he once said.

Clarke continued writing until his death, 4 days ago, on March 19, 2008. Only a few days earlier he had reviewed the final manuscript of his latest work, The Last Theorem, which will be published later this year. Clarke lived to 90 years of age. He was buried yesterday, in the city of Colombo, Sri Lanka. His final wishes were: That someone find evidence of extraterrestrial life; that the world adopt clean energy sources; and that an end be found to the long civil war in Sri Lanka.

Red Faces in Park

Posted by Daniel on March 18, 2008
Miscellaneous / No Comments

From Reuters

Secret lovers were locked in a midnight embrace when it all happened. Wedged into a tiny two-seater sports car, the near-naked man was suddenly immobilized by a slipped disk, according to a doctor writing in a medical journal here.

Trapped beneath him his desperate girlfriend tried to summon help by sounding the hooter button with her foot. A doctor, ambulance, firemen and a group of interested passers-by quickly surrounded the couple’s car in Regents Park.

Dr. Brian Richards of Kent said: “The lady found herself trapped beneath 200 pounds of a pain-racked, immobile man”. “To free the couple, firemen had to cut away the car frame”, he added. The distraught girl, helped out of the car and into a coat, sobbed: “How am I going to explain to my husband what has happened to his car?”

My First Pet Snake

Posted by Daniel on March 08, 2008
Miscellaneous / No Comments

Today I bought myself a Corn Snake. This is my first snake and I’m very excited. Corn snakes are very docile and one of the most popular beginner snakes. It doesn’t have very strict requirements and is very tolerant of beginner mistakes. Corn snakes are found in almost all continents, they feed on mice and they grow up to 1.5 meters long in average. The one I bought is just a baby (a few months old) and measures perhaps 30cm.

Snake Pictures


Daniel’s Corn Snake

Why get a snake?

Well, for one, it’s different :-) But more importantly, reptiles have very minimal keeping requirements. A dog, a cat and even a hamster require time, dedication and daily exercise. I feel that if you buy a pet you have a responsibility to give it the attention it requires and for most pets I’d like to have I simply cannot give it.

Reptiles are not social animals like mammals are. They don’t require exercise, they don’t play and you don’t take them out for a walk. They are happy to be in their terrarium all day. Yet, some reptiles (like corn snakes) don’t mind at all if you do want to handle them for a while.

Choosing an Ajax toolkit – part II – jQuery

Posted by Daniel on March 01, 2008
Programming / No Comments

As a continuation of my earlier post on Ajax toolkits, I’d like to talk about jQuery. Over-all I am very impressed with jQuery and I wouldn’t hesitate to recommend it.

Extending bases classes

I have already talked about the perils of extending base classes. I am pleased to say that, like MochiKit, jQuery does not extend base classes. For me, this issue alone disqualifies Prototype and MooTools from serious consideration.

Self-contained

Unlike all other libraries I’ve discussed, jQuery is very self-contained. This is important for similar reasons why extending base classes is bad. Libraries that create many global functions pollute the global namespace and introduce the risk of conflict with other libraries or your own code.

In jQuery, everything is inside the “jQuery” namespace, plus a single global object called “$”. The “$” object is simply an alias for “jQuery”, so one could write:

jQuery(document).ready(function() {
   // do stuff when DOM is ready
 });

or…

$(document).ready(function() {
   // do stuff when DOM is ready
 });

This global “$” CAN introduce conflicts with other libraries like Prototype and MooTools which also want to use that symbol. Fortunately, you can tell jQuery to not touch the “$” symbol, using the jQuery.noConflict() function:

   <script src="prototype.js"></script>
   <script src="jquery.js"></script>
   <script>
     jQuery.noConflict();

     // Use jQuery via jQuery(...)
     jQuery(document).ready(function() {
       jQuery("div").hide();
     });

     // Use Prototype with $(...), etc.
     $('someid').style.display = 'none';
   </script>

To me, this shows that the jQuery teams takes compatibility and code safety seriously.

The character of the library

I have argued against libraries that try to make JavaScript look like some other language. I’m glad to say that this is not the case for jQuery. That said, it does have an interesting approach that I rather like. True to its name, jQuery has a focus on querying and manipulating the DOM. You can search for objects by class, CSS3 styles, name etc. The way it does this is quite impressive:

$("p.chip").addClass("foo").removeClass("bar").show("slow");

With jQuery you can chain methods together because every method returns the same jQuery object with all the same methods. So you can make arbitrary chains of methods. Very neat. Here are a couple more examples:

// Example 1
$("#orderedlist").find("li").each(function(i) {
     $(this).append(" BAM! " + i );
});

// Example 2
$("li").not(":has(ul)").css("border", "1px solid black");

I like these features a lot. This is different than typical JavaScript, but I don’t see it as trying to change the character of JavaScript but rather trying to improve access to the DOM. The DOM is the most annoying thing about JavaScript programming and really it has nothing to do with JavaScript itself. I don’t hold the DOM in the same high regard as JavaScript and I’m very glad to see jQuery making it less painful.

Documentation

It is difficult to judge documentation without writing a substantial program. Hence, the reader should take my comments with a grain of salt: jQuery appears to have excellent documentation. The library looks extremely simple and clear, so less documentation is needed to begin with. Yet, the jQuery team has a good API reference and a multitude of tutorials. I was impressed by the apparent diversity of information available.

Conclusion: jQuery is a fairly unique library in that it is so focused on making the DOM easier to manage and largely ignores other aspects of JavaScript programming. This isn’t bad. I fault the DOM for 90% of the pain of doing Ajax. I really like the library, I think that the DOM-manipulation functionality they bring is very impressive and extremely useful. And the authors seem to take compatibility and robustness seriously.
Note: I currently use Dojo for my work and after this evaluation I’m seriously considering adding jQuery to my programs. Too bad it doesn’t have all the GUI widgets I need. I’ll be watching the jQuery UI project.
Buy cheap softwarebuy adobe softwaredownload software software sales oem software