Monday, May 25, 2009

RIP Jay Bennett

Really sorry to hear about Jay Bennett's death. Bennett-era Wilco albums are among my most listened-to records. He'll be missed.

Sunday, April 19, 2009

HTML 5 on Mobile Browsers

Our most recent release of Gmail for the Android and iPhone browser tries to take advantage of some of the cool new HTML-5 capabilities that these browsers are supporting. In particular, both app-cache and the database are used heavily by our application. It's pretty amazing that these mobile browsers are pushing ahead as fast (or faster) than the desktop browsers. Just a year ago, writing anything for a mobile browser was slightly more painful than banging your head against the wall. Today, it's actually pretty reasonable.

See our first post here on the blog: We plan to post regularly to this blog with details on how we worked with HTML-5, including details on new features, browser quirks, etc.

In my opinion it's great that mobile browsers are starting to do their part to make the web truly available to people on the go. Now if only carriers in Canada would provide reasonably priced data plans so people could actually take advantage of this. Ugh.

Tuesday, February 24, 2009

One New Thing Per Day(?)

I would like to learn one new random thing each day.  They have those tear-away desk calendars but what I really want is a daily email that teaches me one thing I (likely) didn't know the day before.  Anyone know if such a service exists?  If not, anyone interested in building one of these?  I wouldn't mind collaborating on this.

This reminds me of an old idea a friend and I started on called "Lore of Nations"...  Won't mean anything to anyone but him and I, so you know how far this idea went.

Saturday, January 17, 2009

Javascript fun

Unlike most Googlers, I have very little experience with JavaScript. I've only recently started dabbling and it's quite an experience. Many, many articles have been written on all the cool/bizarre quirks of the language, so I won't repeat them here. Instead, I'll point out a couple of tiny things that I ran into recently that are kind of cool/bizarre.

!!boolean_var - This is really just syntactic sugar, but it is pretty nice. If you want boolean_var to be treated as a boolean, this will nicely cast it from any value (including undefined) to its boolean negation and back, so you're guaranteed that boolean_var is a boolean.

arguments fun - The javascript "arguments" object is quite handy, but it can be pretty tricky. Consider these two definitions of a simple function to add 2 or more values:

>>> addAll = function(x, y) { 
      if (x != null && y != null) { 
        for (b = 1; b <>
          x += arguments[b]; 
      return x; 

>>> addAll2 = function(x, y) { 
      if (x != null && y != null) { 
        for (y = 1; y <>
          x += arguments[y]; 
      return x; 

>>> addAll(10, 2, 4, 6);
>>> addAll2(10, 2, 4, 6);

The first method works nicely but the second one fails. At first glance, it might appear the second method should work fine since "y" is not accessed after the null check, but notice that "y" and "arguments[1]" are aliased to the same variable, so using "y" as the loop iterator will mess things up. This is not a very common case, but if you're trying to optimize the javascript by avoiding unnecessary variable declarations, these details become quite important.  Be careful out there!