Sunday, September 30, 2007

Samsung WEP200 Bluetooth Headset

I recently bought a Samsung WEP200 Bluetooth headset. I tried a few other Bluetooth headsets before this one but wasn't happy with any of them. The other sets were too heavy, had bad sound, didn't fit well in my ear, locked up my phone, etc.

The Samsung WEP200 is nearly perfect: very light (9 grams), fits well in my ear and the sound quality is excellent. The small size makes it less geeky looking than many headsets. Pairing with my Treo was painless. I haven't had it long enough to get a sense of battery life but after several days its still on the original charge. The headset's carrying case doubles as its (AC) charger. The only minor quibble I have is that I would have liked an option to charge the headset in the car.

Thursday, September 27, 2007

Google Buys Zingku

It's always nice to see talented people get rewarded. Sami Shalabi left IBM last year to scratch an entrepreneurial itch. He founded Zingku, a mobile social networking startup.

I heard earlier today that Google is buying Zingku. Huge congratulations to Sami!

Tuesday, September 25, 2007

John Harvard plays Halo 3

Cool hack by MIT students the night before the release of Halo 3.

I used to live near Harvard Yard when I was in graduate school and would hear the same speech given to tourists about John Harvard's statue. It's known as the statue of three lies. The inscription reads: John Harvard, Founder, 1638. But it's not a statue of John Harvard, John Harvard didn't found Harvard University and Harvard wasn't founded in 1638.

By the way, this wasn't the first time the statue was hacked by MIT students. In 1996 they dressed it to look like the Unabomber.

Wednesday, September 19, 2007

Once

We watched Once the other night. Pretty amazing. It's about a street musician and young Czech immigrant woman who meet and play music together. The story, which takes place in Dublin, is sweet and the music is terrific.

It's a low budget film and unfortunately hasn't been widely distributed. If it's playing in your area, check it out. Once is currently playing at the Landmark Harvard Exit in Seattle. In the Boston area it's currently at the Capitol in Arlington.

Year of the Dog

Year of the Dog is a quirky film. It's about a secretary, played by Molly Shannon. Her life is completely wrapped around her dog Pencil. When the dog dies accidentally, she's lost. Her family, friends and coworkers can't understand why she can't just move on. Find a boyfriend. Get a new pet. Get out and enjoy life.

Definitely not for everyone but we enjoyed it. I think it helps to have a pet or at least understand the strong emotions that we wrap around them.

Year of the Dog was written and directed by Mike White. Previously he's written films such as The School of Rock and Chuck & Buck.

Java enums

My latest pet peeve is how enums are handled in Java. Specifically how they work in switch statements. Say I have a Color enum with values Red, Green and Blue. I can test for color values in a verbose way:
if (color == Color.Red) {
    // ...
}
else if (color == Color.Green) {
    // ...
}
else if (color == Color.Blue) {
    // ...
}
else {
    // ...
}
But it's better to use a switch statement. Transforming the sequence of if/else blocks to a switch looks like this, right?
switch (color) {
case Color.Red:
    // ...
    break;
case Color.Green:
    // ...
    break;
case Color.Blue:
    // ...
    break;
default:
    // ...
    break;
}
Buzzt! Wrong answer. The Java switch statement implicitly qualifies the case values to the enum type. So it looks like this:
switch (color) {
case Red:
    // ...
    break;
case Green:
    // ...
    break;
case Blue:
    // ...
    break;
default:
    // ...
    break;
}
It's less typing but, in my opinion, it's also less clear and inconsistent. The only justification that I can find is that since Java enums are full-fledged classes, you can put behavior directly in the enum class and avoid switch statements. Fine but I don't think that reasoning justifies the inconsistency.

Dynamic Casts in Java

I'm doing a little coding in Java and found myself missing the as operator from C#. It's like a cast except that it evaluates to null when the type cannot be converted rather than throwing an exception. For example in this code:
Foo foo = obj as Foo;
foo will be null if obj cannot be converted.

In Java, the equivalent code is more verbose:
Foo foo = (obj instanceof Foo) ? (Foo)obj : null;
So I thought: "Hmm, this is a perfect opportunity for a generic method". Something like this:
public static <T> T dynamicCast(Object o) {
    return (o instanceof T) ? (T)o : null;
}
It might be called like this:
Foo foo = Util.dynamicCast<Foo>(obj);
But the generic method isn't valid. Java generics are implemented using type erasure: type information is only present at compile time so (o instanceof T) is effectively the same as saying (o instanceof Object). Sigh.

Pressing on, I came up with a less elegant solution:
public static <T> dynamicCast(Object o, Class<T>c) {
    return c.isInstance(o) ? c.cast(o) : null;
};
Calling this method is a bit uglier:
Foo foo = Util.dynamicCast(obj.Foo.class);
Now some Java programmers might be thinking "what's so great about the as operator anyway?". I find it useful. Not all of the time but I'd miss it.

More to the point, Java generics are pretty limited. The implementation was constrained to be compile-time only.

In contrast, C# generics retain generic typing information at runtime which is very handy. For example, implementing the as operator using a generic method would look like this:
public T DynamicCast<T>(object o) {
    return (o is T) ? (T)o : null;
}
and called like this:
Foo foo = Util.DynamicCast<Foo>(obj);
Of course I don't need this methiod since I already have the as operator but at least C# generics are powerful enough so I could do something similar. Generics should be a useful tool, not just a way to avoid casts.

Note: For any Python, Ruby, Smalltalk, etc. programmers reading this: Nothing to see here. Move along.

Tuesday, September 18, 2007

All That Jazz

IBM announced Lotus Symphony today. It's a free version of the IBM Productivity Tools that ship as part of Notes 8 — basically an IBM-branded distribution of OpenOffice 1.x. Not particularly exciting news except for the fact that IBM is recycling an old product name, Lotus Symphony. I wonder what other Lotus product names they might bring back. Staying with the musical theme (Notes, Symphony) maybe they can bring back Lotus Jazz? Probably not. Even today, Lotus Jazz is still remembered as a major flop. By the way, anyone remember who was the lead developer on the original Lotus Symphony product? It was that guy.

Speaking of Lotus Jazz, the second release was going to be called Modern Jazz. It made it out as a beta release but was cancelled before it shipped. When we were porting Lotus Improv to Windows, we also had a small team doing a Macintosh version. One of the Mac developers had worked on Modern Jazz. After the product was cancelled, he kept a copy of the source code and single-handedly fixed the code to keep it running as Apple made changes to its OS. Eventually he had to just let it die.

Sunday, September 16, 2007

The Sphere

I got a flyer in the mail the other day that I initially thought was a new Demotivation catalog from despair.com.

Nope, it's an advertisement for a trade journal called The Sphere. It's a trade journal for WebSphere developers, administrators, architects, and managers.

Funny, The Sphere is what we used to call WebSphere — what we called WebSphere Portal is unprintable.

I'm sure The Sphere is a useful resource but I can think of other ways to "make it stop" besides subscribing to a magazine.

Arlington Massachusetts Bicentennial

Happy Bicentennial Arlington Massachusetts! We lived there for ten years, almost long enough to be considered a local. Living out here in Washington State, a relative latecomer to become a US state (1889), 200 years sounds like a long time. But the Arlington area is quite a bit older. It was first settled by Europeans colonists in 1635 as part of Cambridge and called Menotomy. It became a separate town called West Cambridge in 1807. The name was changed to Arlington in 1867 in honor of the Arlington National Cemetery which oddly enough was named after Confederate General Robert E. Lee's home Arlington House (it was built on Lee's family property).

Saturday, September 15, 2007

FTP Must Die?

I don't share willdye's belief that FTP Must Die. It can't — there's no universally accepted alternative, especially for pushing content to a website. WebDAV was supposed to make FTP obsolete but hasn't had much success (and is unlikely to be adopted more broadly at this point). That said, Will's complaints about FTP are all valid. I implemented a basic FTP server several years ago and until then hadn't realized how much of the ugliness of FTP was hidden from view.

Papercuts

Take a look at Peter Callesen's incredible papercut art. He takes a sheet of paper and transforms it into a 3D shape creating a beautiful form in both 3D and the negative space of the paper.

Amazing stuff.

Thursday, September 13, 2007

Happy Programmer's Day

Today is the 256th day of the year. It's Programmer's Day!. I tried to explain the special significance that powers-of-two have for programmers to my wife and older son at dinner but it just ended up sounding like we all have OCD. I finished with the only number base jokes that I could think of (this one and this one).

Sunday, September 09, 2007

If They Come, How Will They Build It?

Good essay on Hacknot on the travails of joining an existing software project with an "organic" (haphazard, chaotic, undocumented) development process.

Sending SMS Messages From An Application

Interesting post on sending SMS messages using SMS gateways that relay messages via email. The only downside to this approach is that you need to know which carrier supports each recipient phone number. It looks like the Send to SMS feature on Google's toolbar works in the same way.

Friday, September 07, 2007

Be Afraid

Apple's 1984 commercial for the Macintosh played on fears of IBM domination in the PC market. Apple was the upstart, IBM was Big Brother. Clearly things have changed since then.

Seeing the 1984 commercial again I was curious about who played Big Brother. It was British actor David Graham

Thursday, September 06, 2007

Bourne Ultimatum

I saw The Bourne Ultimatum this evening. By far the best threequel this summer. An excellent film.

Saturday, September 01, 2007

Google Earth Flight Simulator

Cool feature in the latest release of Google Earth: Google Earth Flight Simulator.

This page is powered by Blogger. Isn't yours?  Subscribe with Bloglines