« May 2006 | Main | July 2006 »

June 2006

June 30, 2006

In cycling you're guilty until you're proven innocent

It’s a sad day in cycling when the top 5 finishers from last year’s tour (not including Lance) have all been withdrawn (aka kicked out) from the Tour de France because they are under investigation for doping.

I have an enormous amount of respect for Ivan Basso a great ambassador for the sport. However, this is how he’s being treated by Bjarne Riis (his directeur sportif):

Ivan must prove with his lawyer that he is innocent. I believe in Ivan but I have been forced to take the necessary steps.

I guess George Hincapie now looks much more like a favorite going into this year’s Tour.

JavaScript and Continuation Passing Style

I’ve been writing a lot of JavaScript code for work recently, and almost all of it involves async operations. Most of the code that I write is using continuation passing style. It’s quite a natural style of programming in JavaScript since functions are first class objects in JavaScript. It’s also interesting that closures and higher order functions work so beautifully together.

Consider this simple wrapper around XMLHttpRequest:

function get_url(file, completion) {
  var x = window.XMLHttpRequest ? new XMLHttpRequest() 
        : new ActiveXObject("Microsoft.XMLHTTP");
  x.onreadystatechange = function () {
    if (x.readyState == 4 && x.status == 200)
      completion(x.responseText);
  };
  x.open('GET', file, true);
  if (window.XMLHttpRequest)
    x.send(null);
  else 
    x.send();
}

Most of the cruftiness in this function involves accounting for differences between IE and Firefox, but you can see that the continuation is passed in via the completion parameter, and I’m using a closure to capture the x variable in an anonymous function that’s called when the async HTTP GET request has completed processing. The anonymous function then calls the continuation, passing the result of GET.

Just last night I was reading this excellent paper on functional programming. It explains what I am doing so much more elegantly than I can (although I hope the code speaks for itself). I highly recommend that you spend some time reading it so that you can get what all of this functional programming hoopla is all about. I assure you, it’s the real deal.

June 28, 2006

The Power of the Marginal

Paul Graham’s latest essay, The Power of the Marginal contains some great insights, as I have come to expect from his writing. Here’s one quote in particular that I really love, when he talks about how to find good problems to solve:

One especially good groove to span is the one between tools and things made with them. For example, programming languages and applications are usually written by different people, and this is responsible for a lot of the worst flaws in programming languages. I think every language should be designed simultaneously with a large application written in it, the way C was with Unix.

If you substitute framework for programming language you’ll arrive at the same conclusion.

QuikMaps

This was created using QuikMaps, an interesting widget generator. Widgets are going to be a pretty hot thing in the future.

June 26, 2006

Sam Ruby is a certified non-conformist!

I’m bummed that I had to miss this year’s RailsConf. But I don’t really have all that much time for Rails due to my near full-time commitment to RubyCLR and other (secret) projects.

I guess now that I have a MacBook Pro I’m now officially a conformist (at least in Rails-land). Apparently > 90% of all folks attending RailsConf were using Macs. The remaining 10% had their photos taken to prove their non-conforming nature!

Here’s a picture of a certified non-conformist, Sam Ruby:

June 25, 2006

Climate change as an insurance risk

The times they are a-changing. The Lloyds 360 Project features climate change prominently:

A growing body of expert opinion now agrees that climate is changing, and that human activity is playing a major role. Even more alarmingly, the latest evidence suggests that future climate change may take place quicker than previously thought.

The issue of climate change will be vital to the future of the insurance industry. So far the industry has coped with the huge costs of weather-related catastrophes. But it is by no means certain that we will continue to do so and there is no doubt that we are not taking the issue of catastrophe trends seriously enough. We need to take action now and start discussing the steps we should take as an industry to prepare for the impact of climate change. It’s a case of adapt or bust.

This is significant because these are the guys whose bottom lines will be directly impacted by climate change. They have an excellent report that largely mirrors the facts that were presented by Al Gore in An Inconvenient Truth. It’s also refreshing to see a major commercial interest stand up to the FUD that’s been spread by some members of the oil industry.

There is real money involved in climate change, which means that an entirely different group of people are now focusing their attention on the problem. And that’s a good thing.

Gates + Buffett

Congratulations on the Gates and Buffett merger. The world’s largest charitable foundation just got considerably larger

Dave Thomas on Why Ruby?

Dave Thomas’ latest description of Ruby as glue that doesn’t set is awesome. Ruby excels at integrating different technologies. Your typical business application consists of different technologies (HTML/Windows API, SQL, Configuration, Business Logic, Legacy).

This is why Ruby will be very useful for creating .NET business applications. Far more so than it may appear to you right now. But stay tuned :)

June 23, 2006

RubyCLR build instructions

I tried to upload a binary distribution of runtime.dll to RubyForge last night, but it kept timing out.

So for those of you who want to build from sources, Justin Bailey just sent in some notes to help make it easier. Thanks, Justin!

The fourth drop does not contain binaries. Here are some build instructions. You must have Visual Studio 2005 installed with the C++ package. It is also recommended you have the ruby 1.8.4 one-click installer package installed.

  1. Open the Visual Studio 2005 Command Prompt so your path is correctly set to point to the VS tools.
  2. Go to your ruby src/win32 directory
  3. type “configure.bat”
  4. type “nmake”. This process may or may not fail – all that matters is ruby/config.h gets created
  5. Open the RubyCLR solution (RubyCLR.sln) in Visual Studio
  6. Open the Project Properties for the Runtime project
  7. Under “C/C++” ensure the “Additional Include Directories” setting contains the full path to your ruby/src and ruby/src/win32 directories.
  8. Under “Linker” ensure the “Additional Library Directories” setting contains the full path to your ruby/lib directory
  9. Build the project!

One additional note that I’d like to add to these instructions: if you have Rake installed, all you have to do is make sure that you follow steps 1-4, and then you can just type type rake from the trunk/ directory.

June 21, 2006

An Inconvenient Truth

In a way, my life was on a collision course with this movie.

My formal education is in science (I have a Ph.D in Organic Chemistry). I am a skeptic by nature, and I really hate people who hijack “science” to support their positions. Science oftentimes has a hard enough time sorting out the truth without help from the lunatic fringe, yet more often than not it winds up self-correcting (I fondly recall grad students from Polanyi lab working to debunk the cold fusion debacle of 1989).

Earlier this year I renewed my love affair with my iPod while taking care of my newborn son in the evenings. I spent quite a few hours in the late evening listening to podcasts to help pass the time as I was walking around the house carrying/rocking/jiggling/shushing my son. While searching for new content, I discovered the Stanford iTunes site and started downloading some really great talks – one of the best was Robert Dunbar’s Reunion Homecoming lecture Is Global Warming Real? Climate Change and Our Energy Future.

That talk summarized in a very approachable way the overwhelming amount of evidence about the relationship between CO2 levels and global temperatures. This was the first time that I had heard about polar glacial ice core evidence that provides very accurate climatic data that spans many hundreds of thousands of years.

So at lunch today, I decided to play hookey and went to see a matinee showing of Al Gore’s An Inconvenient Truth. The movie is largely based on his presentation on global warming that he has given over a thousand times on the road. It’s interspersed with personal commentary by Al Gore that reveals a very human element to his story. And what a story it is. You’ll laugh, you’ll cry, but most important of all, you’ll learn something. And perhaps you’ll be moved enough to do something about it.

That’s the really great part of the story. It’s not all doom and gloom. There is a positive message that carries through the movie: it’s not too late – and you can do something about it. As technologists, we like to think that technology can help solve our problems. That’s a core theme in this movie: embrace technology that helps us reduce our carbon emissions. And developing that technology is not only good business, but a moral imperative.

When you’re done, head on over to RealClimate.org and read what real climatologists have to say about it. After reading that, you should read this widely cited article that presents the opposing viewpoint. But please, make up your own mind.

I’ve made up my mind to do something about it. I hope that this blog will help some of you to do the same.

Update: Here’s a link to the Science paper that surveyed 928 papers and found no papers that disagreed with the concensus view that the evidence for human modification of the environment is compelling.

Update 2: From the comments, a link to Peter Norvig’s analysis of the Science survey. Peter Norvig is the Director of Search Quality at Google, and the author of one of the finest computer science books ever written. Remember – be skeptical and check your facts!

Photos

  • www.flickr.com
    This is a Flickr badge showing public photos from John Lam. Make your own badge here.

Recent Comments

Recent Posts

May 2008

Sun Mon Tue Wed Thu Fri Sat
        1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31
Blog powered by TypePad