The Holy Grail Refactored

April 2nd, 2007

Here’s a neat rearrangement of Matthew Levine’s Holy Grail CSS layout (fixed width left and right columns and liquid inner column) I’ve devised for Refactoring HTML. This is based on the non-equal height, no extra-div version. The basic idea is reorganizing the style rules into three sections:

  • The rules whose values must be copied verbatim.
  • The rules whose values can be set to arbitrary values.
  • The rules whose values are calculated based on the arbitrary values.

This makes it easier to see exactly what you can change independently, and what else you have to update when you make such a change. Here’s a sample stylesheet. LC stands for left column, RC for right column, and CC for center column.
Read the rest of this entry »

Unrolling Code Closures for Undergraduates

March 29th, 2007

One consistent tendency I’ve noticed among undergraduate programmers is a persistent and incorrect belief that the number of lines of code is somehow tied to code efficiency. The thinking goes that the fewer lines they have, the faster the program will run. (Why they even care about speed at all is a story for another day.) For example, they get peeved when I write this:

int x;
int y;
int z;

instead of this:

int x, y, z;

The brighter ones may not be bothered by that, but this gets them all in a tizzy, nonetheless:

int low  = 1;
int high = 1;
for (int i = 0; i < 50; i++) {
  System.out.print(low);
  int temp = high;
  high = high + low;
  low = temp;
}

They want to see this

int low  = 1;
int high = 1;
int temp;
for (int i = 0; i < 50; i++) {
  System.out.print(low);
  temp = high;
  high = high + low;
  low = temp;
}

They love taking code out of a loop, even when the code in question (a declaration) doesn’t actually do anything; and they certainly don’t care if their resulting code is less readable. In fact, they sort of take it as a mark of honor if their code looks complex. They’re going to love closures.
Read the rest of this entry »

A Call for Accessibility

March 28th, 2007

The following is an early draft of the intro to Chapter 6 of Refactoring HTML. The remainder of the chapter will address specific recipes for improving site accessibility, especially those tasks that remain after a site has been made strictly valid (which is addressed in earlier chapters). Comments, suggestions, and corrections, are appreciated.

The Web has the potential to more fully integrate people with seeing, hearing, physical, learning, and other disabilities into society. By limiting the interaction necessary to communicate, as well as enabling delayed communications so that participants can move at their own pace, the Web has transformed our relationships with each other. Properly designed web pages neither know nor care whether you’re reading them with a CRT or a screen reader. Properly designed forms neither know nor care whether you’re inputting data with a keyboard, a mouse, or voice recognition software.
Read the rest of this entry »

What Java Still Can’t Do

March 23rd, 2007

It’s hard to believe that more than a decade after Java was released, there are still so many tasks it can’t do. I’m not just talking about things it can’t do well, but about things that you just can’t do without shelling out to native code. Here is a list of tasks that still need native code:
Read the rest of this entry »

Burning AVIs to DVDs on a Mac

March 23rd, 2007

So you missed the latest episode of Lost. No big deal. It’s easy enough to find on BitTorrent, but now suppose you don’t want to play it on your PowerBook. It looks better on your 32 inch big screen TV. How do you get it there? The simplest way is to burn it to a DVD, but that takes some special software.

I’ve tried every open source media player and QuickTime component I can find for Mac OS X, and at this point in time I don’t think it’s possible to burn an AVI to a DVD with either Apple consumer software (QuickTime, iDVD, iMovie) or with open source software (MPEGStreamClip, VLC, Handbrake) or with any combination of the above.

However I have finally found a way to do this. Read the rest of this entry »