Monday, August 27, 2007

Restore My Faith In Humanity


Our good friend Greg Stein, who was already dealing with a broken leg, fell victim to a violent mugging Friday night on the mean streets of Mountain View. Having parted ways with him only moments earlier, we were dumbstruck to say the least. He's going to be OK, but a little cheering up can't hurt.

Let's offset the bad karma with some good. Kevin Burton is accepting donations. A small portion of the proceeds will go toward sending Greg to a spa for a weekend of relaxation and recovery, and the rest will go to the ASF, an organization to which Greg himself donates a great deal of time.

Chicks dig scars, Greg.

Sunday, August 26, 2007

The Mechanics of Photo Attribution

James has been blogging about how to give credit for photos you use on your web site. I agree 100%--you should give credit in a caption next to the photo, not hidden behind a link. Unfortunately, many authors simply don't use captions at all (let alone for giving credit) because doing so is too damned hard.

For example, I just clicked the "add image" button in Blogger; it doesn't have a box for a caption. I'll send a note to the Blogger team, but we should all encourage content management systems (Wikipedia included) to provide captioning features and make it easy for their users to do the right thing.

Even if you know a bit of HTML and want to go the extra mile despite your CMS, adding a caption is not as easy as:

<img src="..." caption="Photo by Duncan Davidson">

In the olden days before CSS, you had to use HTML tables to lay out captions:

<tr><td><img ...></td></tr>
<tr><td>Photo by Duncan Davidson</td></tr>
But you couldn't float a table inline like you could an image.

CSS opened the door to inline photos with captions, but getting the layout right can still be tricky. This site explores the various methods for adding captions using plain HTML and CSS.

Thursday, August 23, 2007

Got Guice on your resume?

It could help you get a job at Zillow (not to mention Google). This Zillow job description calls for, "experience with Java technologies such as Servlets, JDBC, Tapestry, build tools like Maven and Ant, dependency injection frameworks like Spring or Guice." It's not ground breaking news or anything, but this is a first for Guice.

I literally spent all day in a JSR 299 (Web Beans) meeting. It was exhausting but fruitful. This morning, I was skeptical that it was even possible for the injection approaches of Guice and Seam to coexist. Now, I'm almost excited (as excited as you can be about anything J2EE-related).

Tuesday, August 21, 2007

SSH Misinformation

Dave Dribin insists you must use ssh-agent and pass phrases for private keys, just in case someone gets access to your account, the assumption being that someone won't be able to access your remote machines because they don't know your password.

If someone gets access to my account, they won't have any trouble stealing my password and getting into my remote machines anyway. What's worse is ssh-agent can make you less not more secure. It forwards a connection to each machine you log into; anyone with root privileges on these machines can access your private keys.

Thursday, August 16, 2007

Javascript vs. C++

I learned C++ recently, so when I saw this Javascript singleton variant making the rounds:

var foo = function() {
  var t = new Date();
  foo = function() {
    return t;
  return foo();
}; struck me how much more concise the equivalent C++ solution is:

static Date* foo() {
  static Date t;
  return &t;

I do wonder why the author of the Javascript example returns foo() intead of t; it seems like the latter is more straightforward and semantically the same.

Wednesday, August 15, 2007

Users vs. Programmers

Dave's answer to, "Atom is better," is, "users don't care." Given the fact that users don't care about the feed format, why not do what's best for the programmers? In this case: Atom.

APIs do matter. I'm tired of people trying to use successful end products to validate bad API designs. If the API is better, the end product will be more maintainable.

Sunday, August 12, 2007

Firefox Hangs on OS X

If you experience Firefox hangs on OS X like this guy, use Spin Control to pinpoint the cause. Spin Control detects hung applications and captures stack traces. I assume they named it Spin Control in honor of the spinning beach ball of death.

I've personally experienced hangs as long as a minute on various computers. Slow DNS lookups always seem to be the culprit. Until someone fixes Firefox so it doesn't completely lock up, your best bet is to prevent slow DNS lookups.

In some cases, my VPN connection ended non-gracefully and left my DNS configuration in a bad state, i.e. OS X still tries to connect to the DNS servers on the private network even though I'm no longer connected, and Firefox hangs until the connection times out. An easy solution is to switch network locations thereby resetting your configuration to a good state.

If you still experience problems, you might try switching DNS servers or even installing a local DNS server. I haven't needed to try the latter just yet.

Update: I finally broke down and enabled the local DNS server. I followed the instructions from Mac OS X Hints. Many of the comments claim the hint won't work, but it worked great for me. I went from frequent 3 to 4 second hangs to no hangs at all according to Spin Control.