« November 2004 | Main | January 2005 »

December 09, 2004

400 channels and nothing on

I'm lying in my old bedroom at my parents' house, having decided to crash here after a long day at work. I can hear the sound of television in my parents' room. Its an unfamiliar sound... I don't own a television. I find television incredibly distracting; so much so that when I decide to sit down and watch a movie, I have to devote my whole attention to that activity.

Television's components are distracting. In bars and restaurants I intentionally sit facing away from television sets. If I can see the picture and not hear the sound my brain is drawn to try to reconstruct what's going on. And if I can both see and hear, I'll be unwittingly sucked in by whatever is on, no matter how asinine. I have no acquired immunity from television and television advertising. I don't seem to have the same calluses over my eyes and ears that allow people to have conversations while berated at high volume to buy a discounted mattress.

So now I can't fall asleep, because I can hear the television in the other room. Or maybe because I can tell my parents are watching South Park. If you know my parents, you realize why this is so funny. If you don't know my parents, then visualize the people in the world least likely to watch South Park. That's my parents. My Dad got a TiVo for Hanukkah. I think this gift (of course, purchased at Costco) was residing here temporarily and was tagged as a gift to a family friend. But it was intercepted by my Dad. And now my parents, who don't watch television, are watching South Park. Can someone explain the psychological power of the TiVo, that makes my parents record for later viewing programs they would never have watched in the first place?

December 03, 2004

REST architecture

I'm helping rearchitect a system that uses a proto-REST API on its backend. Unfortunately, everything is POSTed to one URL which uses PHP includes to import necessary functionality...

December 01, 2004

Deleting duplicated rows in SQL

I came across the problem of duplicate keys in a PostgreSQL database today. There was (unfortunately) no UNIQUE constraint on the email column where there were duplicates. I wanted to manually effect uniqueness on the email column. The solution took awhile, and strained my limited knowledge of SQL...

DELETE FROM table WHERE uid NOT IN
(SELECT min(uid) FROM table GROUP BY email);

Predictably, this took a long time to execute. Is there a more efficient (or graceful) way of doing this? There's no index on the nested SELECT, so this method requires a linear search through the results of the nested SELECT for each row of the table.