Wednesday, October 22, 2008

I just got an email from MoveOn.org with a link to this video. It's intended to motivate me to vote, except 1) I live in Texas, so my Democratic vote isn't all that meaningful, and 2) I already voted. Still, it's pretty damn funny.

Today I noticed something interesting on the way home. I was riding the bus, looking up at the display (an LCD) which normally shows the time of day and various information about where we were five minutes ago. The display is made up of fifteen or so panels, each of which displays one letter or digit. As usual, the displayed time was off by an hour or so, but that's not what interested me. No, the weird thing was that one of the panels was nearly black, while the rest were a sort of cheery orange-yellow color.

I stared at it for a bit, and noticed that as my head moved around the appearance of the panel changed. Eventually I discovered that if I looked directly through my sunglasses, the panel was black, but if I looked over the top of the glasses, it looked just like the others. Tilting my head left and right as I looked through the sunglasses yielded various intermediate colors, and putting the glasses frame right over the panel gave it a sort of split effect.

A bit of physics

It turns out that LCDs are polarized, as are my sunglasses. Briefly, polarizing filters block (or pass) light based on how the squiggles of each light wave are oriented: if the light is oriented on the same axis as the filter, it gets through, otherwise it doesn't. Actually, somewhere between all and none of the light gets through, depending on how close the orientations of wave and filter are. Here's a picture that might help visualize it, showing a single diagonally-polarized light wave passing through a vertically-oriented polarizing filter (courtesy of colorado.edu):

(click the image to read the entire article)

As you can see, only the vertical "component" of the wave makes it past. If you were to rotate the filter in the image another 30 degrees or so in the clockwise direction, so that there was no vertical component, the filter would totally block the light.

"Normal" light, like the ambient light you see outside, is composed of zillions of light waves, all with different polarization. This means that if you put on a pair of polarized sunglasses, things look a bit darker, because some of those waves have been blocked, but things look more or less like they did before. The interesting effects show up when the light hitting your sunglasses is already polarized for some reason, like the light coming out of the LCD on the bus. Apparently most of the panels on the display were polarized in approximately the same direction as my glasses were, but that one weird panel was close to 90 degrees different, so that together they filtered out almost everything. Another place you'll notice this is car windshields, which often take on an odd bubbled-rippled-rainbowy look, because of how they're pressure-treated at the factory.

Anyway, I highly recommend getting yourself some of these sunglasses, and then wandering around to see what you notice. As a bonus, they also work really well for their intended use, namely making it easier to see in bright light.

A bit of politics

As I sat there and tilted my head around like a goof, watching how the LCD panel got lighter and darker, I got to thinking about a more common use of the word "polarize", namely this definition from Wiktionary: "To cause a group to be divided into extremes". I was particularly thinking about how, in my eyes, that LCD looked totally different than it did to the rest of the people on the bus. They saw a normal time display, and I saw "6:10 PM". Whose view was the right one? In this case, it's pretty clear that I was in the minority, but it sure looked weird to me.

It's even more interesting when you consider the broader picture, with a hotly-contested presidential election on the horizon and an economy staggering toward the unknown. Political and economic polarization are as strong now as they ever have been, and I can't help but wonder if our own mental filters make it really hard for us to see the world clearly. I know how the world looks to me, but that's just one perspective: that of a middle-class Democrat with (I hope) a secure job. The problem with biases (and polarized sunglasses) is that it's really easy to forget they're there. Am I missing something really important because I'm so focused on getting a Democrat into the White House? Have some Republicans been partially blinded by their heartfelt conviction that we have to win before we can leave Iraq?

Tuesday, October 21, 2008

This weekend there was a new face on Saturday Night Live: Sarah Palin. She's a relatively unknown politician from rural Alaska, and she happens to resemble Tina Fey.

Fey is a former SNL cast member who now stars in the award-winning 30 Rock, and recently returned to the show for a series of sketches poking fun at John McCain's running mate in the upcoming election. Palin has also recently dabbled in comedy, primarily through a series of hilarious interviews with CBS's Katie Couric. Perhaps because of this, she was given a chance to demonstrate her comedy chops on SNL.

Unfortunately, Sarah Palin is no Tina Fey. She appeared on only two sketches, and had little to say in either one. She made a brief appearance as a Tina Fey lookalike in a press conference sketch, where she delivered the obligatory "Live from New York, it's Saturday night!" and little else. Another sketch featured her watching as Amy Poehler rapped and danced to a political beat. As a foil for the comedic skills of the rest of the cast, she performed well, but perhaps her skills could be put to better use elsewhere.

About a year ago I took a trip to New Zealand to visit my cousin Lea, who has been there on a working holiday. I was there for two weeks, mostly on the south island. I just learned from a friend how to post the pictures directly to the blog, so here they are!

Sunday, October 19, 2008

StackOverflow.com opened for business about a month ago. It's dedicated to asking and answering concrete questions about programming. It already has more than 17,000 registered users, who have asked more than 31,000 questions. More than 90% of these questions have at least one useful response.

This is great news for programmers.

You probably know that computers are stupid, as evidenced by the incredible frustration they often cause. Programmers are tasked with training these blazingly fast mechanical morons to do useful tasks, and even the buggiest program probably represents hundreds or thousands of hours of someone's time. Everything your word processor or email program does, every button and graphic, somebody made that happen. And it's not easy.

I recently had to implement printing in a basic graphing application. Going into it, I told several people that I figured it should be pretty straightforward, maybe a day or two of work. I've been doing this for almost ten years, so I figured I ought to be able to sort it out. But unless you're working on a system that's designed around paper (e.g. Microsoft Word), printing is a pain. You have to completely reconsider how to display the data so that it works on the printed page. In the end it took at least a week of work to get a solid implementation. I probably only wrote a few hundred lines of code, which isn't a lot. The problem was that I've never done it before, and neither had any of my coworkers.

One of the most important tools of in any programmer's toolbox is other programmers. What might take hours or days to figure out on your own can often be solved in minutes by someone who has done it before. Certainly it's also satisfying to figure something out yourself, but I'm not always in the mood. Sometimes I just want an answer so that I can go home for the day. Often coworkers fill this role, since they're just an office away. But what if nobody at the company has ever done printing before? Or what if you're working solo?

That's where StackOverflow comes in. With thousands of programmers on call, even the most esoteric question can find an answer in short order. It's often only a matter of minutes before a question gets its first answer. And if the first answer doesn't work, the second one or the third one might. You might even find out that a bunch of other people have already tried what you're doing and they all figured out that it wasn't feasible. It's sure nice to know that before you spend hours and hours trying to do it.

This is great news for all of us, because it means less time banging our heads on the table and more time making software. So far I haven't needed it for anything terribly important, but I sleep better knowing that it's out there.

I seem to spend more and more time these days reading people's blogs. One of those bloggers wasn't content for me to read his blog: he wants me (and everyone else) to write one of their own. So here I am. I have no idea if what I say will be of any interest, but there it is.