06.28.10
Posted in astronomy, personal, web at 6:45 pm by danvk
If you try searching for [sunrise san francisco] on Google, you’ll see a special display in the results:

This is known as a “onebox”. It’s designed to get you answers quickly. Other examples include the calculator (e.g. [2*2]), weather ([weather 94110]) and time ([time italy]) oneboxes.
The sunrise/sunset onebox is a project that I worked on in my spare time and recently launched. You can read more about it on the Official Google Blog. I first had the idea for this onebox about two years ago, so it’s very gratifying to see it finally launch!
A few features which are worth calling out:
- The sunrise and sunset times are calculated when you perform your query. They are a function of latitude, longitude and the current time. The algorithm is based on the one used by NOAA.
- In most places, you can just search for [sunrise] or [sunset] to get results for your current location. Google figures this out based on your IP.
- This onebox works on mobile phones, too, so you can search for sunset times when you’re out on a hike.
There’s a wrinkle to the sunrise/sunset calculation that non-astronomers don’t typically think about. The sun starts to behave strangely once you get north of the arctic circle or south of the antarctic circle. If you’re north of the arctic circle, then there will be at least one day during the summer when the site never sets. And there will be at least one day during the winter when it never rises. This is truly a special case for the onebox! Here’s what it looks like:

I feel bad for those Barrowans — hopefully they’ll be able to fall asleep sometime in the next 34 days!
Permalink
12.04.09
Posted in web at 5:29 pm by danvk
Charles Minard’s chart of the demise of Napoleon’s Grand Armée is famous for its “brutal eloquence”. Edward Tufte says it “may well be the best statistical graphic ever drawn”.

The width of the line represents the size of Napoleon’s army as it marched to Moscow and then retreated.
I found a version of this visualization put on a Google Map using protovis. This visualization is great! It draws attention to one of the main problems with this famous visualization: it doesn’t give any geographical context. I had no idea where Napoleon’s army started and turned around until I saw this map:

Some things that stand out:
- The Grand Armée was way far away from France at the start of this.
- The march wasn’t as long as I’d imagined. When I think “march across Russia”, the image in my mind goes halfway across Siberia.
Permalink
09.07.09
Posted in web at 3:20 pm by danvk
The other day, I noticed that one of my friends had Wikipedia’s article on the em dash bookmarked in her toolbar. While that article is a gem of punctuation literature, it turned out that she would go to it, select an em dash, and copy/paste it into emails.
A better way to do this is with a bookmarklet. Drag this to your browser’s bookmark toolbar:
character palette
Click the bookmarklet on any page. You’ll see a character palette like this:

Select the character you like and either copy/paste it or drag it where you like. Then click “Close” to make the palette go away until you need it again. Enjoy!
Note: I’ve tested this in Firefox, Safari and Chrome. This probably doesn’t work in IE.
Permalink
03.03.09
Posted in personal, web at 10:50 am by danvk
As danvk.org regulars know, I recently joined Twitter. I had a great experience with it last weekend and came away feeling as though I’d “seen the future”.
I ran into Tyler Hinman last weekend at a friend’s Oscars party. Tyler’s claim to fame was that he’d won the American Crosssword Puzzle Tournament the previous four years, starting in 2005 when the movie Wordplay was filmed. Tyler played a major role in that movie.
Tyler told us that he’d be trying to make it five times in a row the next weekend. So, come the weekend, I was curious to see how he did.
After one day of competition, the official results page showed Tyler in fourth with one puzzle left before the finals. If you’ve seen Wordplay, you know that fourth place is a bad spot to find yourself. Only the top three finishers qualify for the finals.
On Sunday, the standard news sources weren’t helpful. A crossword tournament is not exactly front-page material. The official tournament page hadn’t been updated. Even the bloggers would take another few days to tell the story. So I tried Twitter.
I searched for #acpt and saw these two results:
Not only did I immediately get the bit of news I wanted, I also got to watch it on video!
I’m not saying this is a great way to get news in general. A crossword puzzle tournament is more likely draw the twitterers than most events. But just consider that this would not have been possible even one year ago.
Permalink
02.16.09
Posted in web at 5:23 pm by danvk
Has anyone else noticed Twitter being mentioned in the news more and more the last few weeks?
These have all happened in the last month:
All this makes me think I should hop on the bandwagon. I just created an account. I’m danvdk.
Permalink
12.31.08
Posted in personal, web at 7:16 pm by danvk
I was looking over my checking account transactions for the past year and saw a mysterious $12.95 charge from “CIC*Triple Advantage 877-48168″ appearing once a month. A search quickly showed that I’d been had by FreeCreditReport.com.
Turns out I’d used this site to get a credit check when I moved in to my old apartment last August. Everyone is entitled to one free credit check per year, and I thought that this was what I was getting. I’d failed to notice the fine print on their main page (helpfully displayed in blue-on-blue text):
When you order your free report here, you will begin your free trial membership in Triple AdvantageSM Credit Monitoring. If you don’t cancel your membership within the 7-day trial period†, you will be billed $14.95 for each month that you continue your membership.
ConsumerInfo.com, Inc. and Freecreditreport.com are not affiliated with the annual free credit report program. Under a new Federal law, you have the right to receive a free copy of your credit report once every 12 months from each of the three nationwide consumer reporting companies. To request your free annual report under that law, you must go to www.annualcreditreport.com.
That’s right, they sign you up for a free trial of a monthly service which you must opt-out of after 30 days. They do their best not to tell you that they’ve signed you up.
Looking back in my checking account, I found 16 months * $12.95/month = $207.20 in charges. Thanks to help from this discussion, I was eventually able to get this refunded in its entirety. Read more for details.
Read the rest of this entry »
Permalink
11.27.08
Posted in news, politics, web at 11:57 am by danvk
Today is the 30th anniversary of the Moscone-Milk assassinations and, fueled by the upcoming release of the movie Milk, they’ve been all over the local airways.
For those not familiar with the basic story (I wasn’t before I moved to SF), City Supervisor Dan White quit his job, then asked to be reinstated. When Mayor George Moscone refused, White returned to city hall with a gun and murdered Moscone and Supervisor Harvey Milk, who happened also be the first openly-gay elected official in the country. Another Supervisor, now-Senator Dianne Feinstein became mayor as a result of these killings.

An NPR show yesterday included a clip of Feinstein giving a dramatic press conference announcing the deaths. Much to my surprise, an original copy of that night’s newcast has found its way online.
The Feinstein press conference is at 2:10. Listen to the gasps. The 70′s production is jarring to look at now though, except for the cars, the shots of San Francisco could have been taken yesterday.
I couldn’t figure out whether this is an isolated clip or part of a larger collection. How cool would it be if all of NBC’s old newscasts were online?
Permalink
06.12.08
Posted in programming, web at 12:41 am by danvk
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!
Permalink
01.04.08
Posted in web at 4:00 pm by danvk
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.
The idea is to prevent Camino from loading the JavaScript file that provides this “feature”: http://graphics8.nytimes.com/js/common/screen/altClickToSearch.js
To do so, create a new text file somewhere on your machine (I put mine in ~/Library/nytimes.pac) with the following contents:
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”.
Enjoy the popup-free browsing!
Permalink
12.24.07
Posted in music, programming, web at 12:27 pm by danvk
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.
Permalink
« Previous entries Next Page » Next Page »