Unrolling Code Closures for Undergraduates

Thursday, 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.
(more…)

A Call for Accessibility

Wednesday, 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.
(more…)

What Java Still Can’t Do

Friday, 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:
(more…)

Burning AVIs to DVDs on a Mac

Friday, 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. (more…)

The Best Things in Mac Are Free

Saturday, March 17th, 2007

Gina Trapani writes on LifeHacker:

One of the drawbacks of switching from Windows to Mac is the smaller selection of free software available for OS X. Sure there’s tons of fantastic Mac software out there, but most of it isn’t free – unless you know where to look, that is.

If she were coming from the Linux world to the Mac, I’d understand her. Third party software for Linux is much freer than on the Mac as a general rule, but Windows? That’s completely contrary to my experience.
(more…)