Inspired by the sorttable library, I’ve done some Javascript hacking over the last day and created dragtable, a complementary library which lets you drag column headers around to rearrange HTML tables. A demo will make everything clear:
Name
Date
Favorite Color
Dan
1984-07-12
Blue
Alice
1980-07-22
Green
Ryan
1990-09-23
Orange
Bob
1966-04-21
Red
Drag the column headers to rearrange the table. dragtable is incredibly easy to use. To make a table rearrangeable, just add class=draggable to the table tag. And, if you set class="draggable sortable", you can have a table that’s simultaneously sortable and rearrangable! For more details and a download link, check out the dragtable page.
I’m calling this v0.9 since I’m sure there are plenty of bugs and tweaks left to make. I’d love to get some feedback, so take it for a spin and tell me what you think!
Update: I’ve added full-column dragging and bumped the version to 1.0. Head on over to the dragtable, grab a copy, and let me know what you think!
I’ve been meaning to write a post for a while about how difficult it is to choose a browser on the Mac. There’s no perfect choice, the Camino browser’s combination of compatibility and a Mac feel has made it mine.
My main gripe about Camino is the lack of plugins, particularly the lack of a good Greasemonkey equivalent. In Firefox, I use Greasemonkey to kill the annoying ads that pop up on nytimes.com whenever you double-click a word. In Camino, I have to avoid double-clicking random words. For some reason, I find this completely impossible.
There’s an official feature request for user script support in Camino, but I’m not holding my breath. The NY Times problem bothered me so much that I spent some time creating a Camino workaround.
To do so, create a new text file somewhere on your machine (I put mine in ~/Library/nytimes.pac) with the following contents:
function FindProxyForURL(url, host) {
if (url == “http://graphics8.nytimes.com/js/common/screen/altClickToSearch.js”) {
return “PROXY 0.0.0.0:3421″;
}
return “DIRECT”;
}
Save that file and follow these instructions to tell Camino to use your PAC file. In my case, I set network.proxy.autoconfig_url to file:///Users/<your user name>/Library/nytimes.pac. Now clear your cache, restart Camino, and try visiting http://graphics8.nytimes.com/js/common/screen/altClickToSearch.js. If you’ve done it right, you should get an error saying “Proxy Server Refused Connection”.
Pitchfork Media has released their two standard year-end lists, the Top 100 Tracks of 2007 and the Top 50 Albums of 2007. As usual, they’ve been lampooned all over the web, including one critique in pie chart form. For me, they made for perfect listening on a long car drive this weekend.
In my case, this list led to a good use of my Track Parser script, which is in all likelihood the most useful program I’ve ever written. It’s an AppleScript for iTunes (i.e. Mac only, sorry) that lets you apply regular expressions to track names/tags. Here’s how I used it today…
Through some strange turn of events (certainly nothing to do with this), I found myself with a playlist of the top 100 tracks. The music was all there, but none of the songs had their “Artist” field filled in! Here’s where my Track Parser script came in.
I googled around and quickly found this page, which has some commentary on the list, as well as what we’re interested in: a copy of all the songs/artists in simple text form. (For what it’s worth, I agree with his reactions.)
I copied the list and ran two regular expressions to get it down to just the artist (s/ ".*//g and ^\d*: if you must know). The tracks are in reverse order of what we want (100 to 1 instead of 1 to 100). So I ran pbpaste | tac | pbcopy to put the #1 track at the top of the list. Or I would have, if Mac OS X had the tac command. Instead, I ran this monstrosity:
pbpaste | perl -ne 'push @x, $_; END { print for reverse @x }' | pbcopy
to do the same thing. In retrospect, I should have just sorted my playlist in reverse track order.
Next I went into iTunes and selected my songs. I ran “Track Parser (Clipboard)” from the Scripts menu, clicked “New Pattern” and put in “%a” to extract the artist from each line. Track Parser handled the rest. Total time: about five minutes.
I bought one from Fry’s a few months ago because it was the cheapest option and I assumed all wireless routers were more or less the same. Not so. You’d think the D-Link QA people would have discovered that this thing can’t maintain a connection for more than five minutes before it went to market. Here’s a smattering of reviews:
“Strengths: the lights are really pretty with the rest of the blinking lights that make up my computer setup. Weaknesses: how about holding a connection for more then 2 minutes”
“Mistakenly, I didn’t check any reviews before buying it, but if you look, you’ll see the same thing over and over. The WBR-1310 drops its wireless signals, without fail, every 5-15 minutes. Not once, in the entire time I owned it (which was only 2 weeks untill I finally got fed up enough to return it) did it hold a signal for over 15 minutes.”
So do your research before you buy a wireless router! I bought a Linksys WRT54G to replace the D-Link, and have been happy with it in the past two days of use. The Wiki article says that this was the first wireless router to have its firmware open-sourced. As my roommate pointed out, that speaks volumes about Cisco’s confidence in this product.
One of the best perks of working at Google is the Authors@Google program, which brings in authors to speak about their books. We recently hosted xkcd‘s Randall Munroe, who gave a completely hilarious talk. I only caught the end in person, but it’s now available on YouTube for all to see.
For some context, the guy who does the intro is Peter Norvig, the guy who asks the first question is Guido van Rossum, the creator of Python, and the the guy who asks the second question is Don Knuth!