06.14.09
Posted in san francisco at 3:26 pm by danvk
The analogy struck me when I saw the de Young Tower from the aptly-named Grand View Park. Maybe the resemblance isn’t quite so clear as it was in my mind.
Also, arcologies? Anyone want to hazard a guess what fraction of people familiar with the term learned about it from SimCity 2000? I’m going to say 99.
Permalink
05.25.09
Posted in personal, san francisco at 11:44 am by danvk
While walking around my block with an out-of-town friend the other day, I found myself pointing out all the restaurants I had never been to. How could I be so remiss? Part of it is the sheer number of food places: 40 within a three block radius.
Here they are. I’ve been to the bolded places. The links go to Yelp.
Within one block (3/4):
- Cafe du Soleil
- rotee (Indian)
- S&W Market
- Two Jack’s Seafood
Within two blocks (8/13):
- Chili Cha Cha’s Thai Food
- Cu Co’s Restaurant
- Estela’s Fresh Sandwiches
- Indian Oven
- Kate’s Kitchen
- Lo-Cost Meat and Fish Market
- Metro’s Caffe
- Nickie’s (bar)
- Roland’s Bakery
- Squat & Gobble
- Thep-Phnom (Thai)
- Three Twins Ice Cream
- Volare Pizza
Within three blocks (12/23):
- Abe’s Market
- Bistro St. Germaine
- Burger Meister
- Cafe International
- Castro Coffee
- Golden Natural Foods
- Hanabi Japanese Restaurant
- La Carreta Taqueria
- Love ‘n Haight Deli & Cafe
- Mad Dog in the Fog
- Memphis Minnie’s
- Molotov’s (bar)
- Mythic Pizza
- Naan and Chutney
- Noc-Noc (bar)
- O’Looney’s Market
- PeaCock Lounge (bar)
- Raja Cuisine
- Rosamunde (”the sausage place”)
- Tacqueria El Castillito
- Toronado (bar)
- Uva Enoteca
- Whole Foods Co
Now that I have a list, there’s no excuses!
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.24.09
Posted in programming at 10:04 pm by danvk
Here’s a handy chart of the C Standard Library functions in time.h:

The ovals are data types and the rectangles are functions. The three basic types are:
- time_t: number of seconds since the start of the UNIX epoch. This is always UTC!
- struct tm: A broken-down date, split into years, months, seconds, etc. In Python, it’s a tuple.
- string: Any string representation of a time, e.g. “Wed Jun 30 21:49:08 1993″.
Generally you either want a time_t (because it’s easy to do arithmetic with) or a string (because it’s pretty to look at). So to get from a time_t to a string, you should use something like strftime("%Y-%m-%d", localtime(time())). To go the other way, you’d use mktime(strptime(str, "%Y-%m-%d")).
This library has been around since at least 1982. It’s been replicated in many other languages (Python, Perl, Ruby). We seem to be stuck with it.
Read on for my rant about why this is all idiotic.
Read the rest of this entry »
Permalink
02.22.09
Posted in finance, math at 2:51 pm by danvk
The S&P 500 certainly hasn’t made anyone rich over the last year:

Most people see this and think “an investment one year ago would have lost 45% of its value”. Others think “great, now stocks are all cheaper!”
In reality, most ordinary people invest portions of their paychecks, either through their 401(k) or a personal account. This means they’re doing time averaging. Sure, investments when the market was up aren’t doing well. But investments when the market was down are doing just fine.
This is all kind of wishy-washy, though. Let’s try to quantify it. Suppose a market drop and recovery looks like a parabola:

The prices here are parabolas

for various values of a. a=0 means the market is flat. a=0.5 means the market loses 50% of its value.
If you invest dt dollars in this market at each point in time, you can work out a nasty integral and show that the number of shares you have at time t is:


and hence the value of your shares at the end is:

Here’s what that looks like:

The x-axis is a, the fraction by which the market drops. The y-axis is your total return on investment. If the market drops by 50% (a=0.5) then your total return on investment is around 55%. With time-averaging, the more the market drops, the better you do.
This makes a lot of sense if you think about it. Say the market drops 99.9% and then recovers. The shares you bought when it was at its bottom earned you a return of 1000x. Investing at the bottom is important! You should keep investing, even as the market drops. If you don’t, you’ll miss that bottom.
Permalink
02.19.09
Posted in boggle at 1:09 am by danvk
Don’t let the sixteen month hiatus fool you. There’s just no end to Boggle posts on danvk.org!
In case you’d forgot, we’ve developed a blazing fast boggle solver capable of scoring 10,000 Boggle boards a second. What to do with this? Other than some interesting analyses, the most interesting question is:
What is the highest-scoring Boggle Board?
In this post, we’ll try to answer that question using Simulated Annealing. Here’s a sneak peak at one of the exceptionally word-rich boards we’ll find:
Follow me past the fold for more…
Read the rest of this entry »
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
02.13.09
Posted in personal at 11:27 am by danvk
I recently purchased and installed a Belkin F5D7132 Wireless Repeater. It was $37 on Amazon, about half to a third the price of most other options. Most reviews along the lines of this one: “Hard to configure, a charm once [it's] done”. I thought I’d share my experiences, in case they’re helpful to anyone.
Here’s the basic layout of my apartment:

The wireless router is in the living room, and all the bedrooms come off a long hallway. My bedroom is the farthest from the living room. Somewhere between the middle bedroom and my bedroom, the throughput falls off a cliff. (I measured this using the Speakeasy Internet Speed Test)
My plan was to install the repeater somewhere in the middle bedroom, just before the performance cliff.
Installation
I followed the instructions on this Amazon review, rather than those in the instruction booklet. You’ll need a Windows machine to set the thing up, nothing else will do. The basic trick is to make sure that you’re plugged directly into the repeater via Ethernet when you run the setup utility, and that you’re on the same subnet. Its default IP is 192.168.2.254. This is pretty unusual, so it’s not going to “just work”.
After the subnet business, the most annoying part of the install was the ethernet cable that Belkin included with the Repeater. It kept slipping out of my laptop. Most of the problems I had were solved by shoving the ethernet jack back in place.
Once I got into the web interface, there were a few more hiccups. The first time I set its parent network and network name, it rebooted the router. When it came back, only the parent network had been set. But after one more change and reboot, everything was working fine.
Security: I chose the WPA-PSK, but had to switch from TKIP (the default) to AES to get it to work with my Macbook.
I also gave the Repeater a different SSID (network name) than the main wireless router. This made testing it much simpler, since I knew which one I was connected to.
Placing the Repeater
The absolute key for this was AP Grapher, a Mac OS X application that plots wireless strength over time. I would place the repeater, then watch the signal strength plummet as I walked around the corner, into the hallway and into my room. After experimenting with a few locations, I realized that:
- The Repeater’s antenna is much better than my laptop’s.
- The Repeater’s antenna is much worse than the main router’s.
As soon as there was even a single wall between my laptop and the repeater, its signal strength was indistinguishable from the main router’s. So here’s the configuration I wound up using:

This is not at all how I’d expected my setup to look, but you can’t argue with results! Here are the details:
| |
Before |
After |
| Signal (db) |
-55 |
-36* |
| Noise (db) |
-95 |
-96 |
| Downlink (KB/s) |
378.9 |
853.8 |
| Uplink (KB/s) |
342.1 |
692.3 |
The uplink/downlink stats are the most impressive. The “Signal” stat is misleading, since it’s only half the story. There are two wireless connections (Router to Repeater, Repeater to Laptop) and this only represents the strength of the latter.
When it’s all said and done, $37 for a 2.5x wireless speedup made the Belkin F5D7132 a great investment!
Permalink
01.31.09
Posted in sports, tennis at 8:34 pm by danvk
Don’t get caught up in all the Super Bowl hoopla — the really exciting match this weekend starts five hours from now in Australia.
Roger Federer and Rafael Nadal are facing off in yet another Grand Slam final. This time, though, Rafa is the #1 tennis player in the world and Federer is #2.
They both have quite a bit at stake. If Nadal wins, I think it’s safe to say that he’s completely emerged from Federer’s shadow. And given that he won both the French Open and Wimbledon last year, he’ll be a serious threat to pull of a true Grand Slam (all four majors in the same calendar year).
If Federer wins, he ties Pete Sampras’s record for most major titles (14) and cements his claim as the “greatest of all time”.
The match starts at 12:30 AM PST (3:30 AM EST) on ESPN. TiVo’s are recommended!
Permalink
01.15.09
Posted in astronomy, science at 11:18 pm by danvk
While I was home over Christmas, my mom asked me to throw out some of the magazines that had piled up in my room over the years. One of those was TIME’s February 1996 cover, “Searching for Other Worlds“. Given the imminent launch of NASA’s Kepler Telescope, it was much more timely than the other headline on the cover: “Dole Drops, Clinton Rises“.
The article is a fascinating read now, almost 13 years after it was written. It’s easy to make long-term predictions, knowing that you’ll probably never get called on them. But after 13 years, I can call every single one of the bold predictions in this article. None of them have panned out.
Here are the highlights:
Everyone wants to be the next to find a distant world. The scientists are eagerly awaiting the results from the Infrared Space Observatory (ISO), a newly orbiting European satellite that can detect the faint heat from distant planets. They’re looking forward to the 1997 installation of a new infrared camera on the Hubble Space Telescope, which could take a picture of at least one of the newly discovered worlds.
The ISO was launched successfully, but it certainly did not detect planets. In fact, it’s not even clear to me that this was ever an explicit goal. It did detect dust rings around stars, and was decommissioned on schedule after just over two years of service.
The infrared camera on the Hubble is referring to NICMOS, the “Near Infrared Camera and Multi-Object Spectrometer”. It’s hard to find much information about this on the web. Here are a few images from NICMOS. They’re pretty, but planets they ain’t.
It’s not clear to me that planet-detection was a goal of NICMOS either. The TIME writer may have been prone to exaggeration.
Most promising of all, they’re buoyed by a newly unveiled NASA initiative, known as the Origins project, that will build a generation of space telescopes to search for new worlds. Says NASA administrator Daniel Goldin: “We are restructuring the agency to focus on our customer, the American people.” And the public excitement about this field, he says, “is beyond belief.
Ah, the Origins project. It’s still on-going, and is going to have its first major launch with Kepler in March. Goldin became the longest-ever serving NASA administrator before leaving in 2001.
More than one astronomical discovery has disappeared on a closer look, though, so Marcy and Butler headed for the telescope, determined either to debunk or verify the Swiss team’s claims. Sure enough, says Marcy, after four nights at Lick and many hours of computer time, “everything they’d said about the planet was confirmed.” (Butler and Marcy did, however, show that hints the Swiss team had found a second planet around the same star [51 Pegasi] were mistaken.)
After two months, they had analyzed 60 of the 120 stars in their survey. On the morning of Dec. 30, Butler went to the office to check on the computer’s progress. “When I saw the data come up, I was completely blown away,” he says. It was the telltale signature of the object orbiting around 70 Virginis. Recalls Butler: “It knocked me off the chair.”
Geoffrey Marcy went on to discover 70 of the first 100 extrasolar planets and the first transiting exoplanet. Paul Butler is a co-discoverer of approximately 2/3 of the known exoplanets.
… Such a gigantic scope is utterly beyond current technology, and beyond anything engineers can imagine for the next century as well. But astronomers know they can simulate a huge telescope by orbiting several smaller ones, widely separated, and combining their light electronically. This multimirror device is known as an interferometer, because rather than gathering light directly, it measures interference patterns created when light waves from several mirrors overlap each other.
Unlike traditional NASA projects, which tend to be expensive and complex, this one is relatively modest. “We really don’t want to start out building the Battlestar Galactica,” says Weiler. Instead he will start with a demonstration model by the turn of the century, a device consisting of four to six mirrors a foot or two across. Even at that size, the interim interferometer should be able to spot objects the size of Neptune around nearby stars.
That must be referring to the Space Interferometry Mission (SIM). Its launch date has been pushed back five times thus far and has had its budget almost entirely slashed. Wikipedia says it will be launched “no sooner than 2015″. The scientists involved in the project have regrouped and created SIM lite, which aims to accomplish most of the science goals of the original SIM at reduced cost. Their site is careful not to speculate about any launch dates.
Finally, by about 2010, NASA hopes to launch what it calls the Planet Finder: an interferometer with five 3-ft.-to-6-ft. mirrors spread over 300 ft., orbiting out by Jupiter, where the solar-system dust begins to thin out. The Planet Finder should allow scientists to identify Earthlike planets, which should show up as pale blue dots in images beamed back to ground controllers, and analyze their atmosphere for signatures of life like ozone, oxygen or carbon dioxide.
This is referring to the Terrestrial Planet Finder (TPF), which has been abandoned entirely. It’s too bad. The knowledge we’d glean from this is much more interesting than whatever it is we’re learning on the International Space Station.
The astronomers who are looking for planets, meanwhile, are sounding downright cocky. Butler says that he and Marcy are “close, real close” to finishing the analysis of their remaining 60 stars and that they would not be surprised to find two or more additional planets popping out of the data–perhaps in a matter of weeks. The pair will soon be heading for the Keck Telescope in Hawaii, the world’s largest, to continue the search with even more powerful equipment. Mayor and Queloz, meanwhile, are back at their telescope in Europe. At the same time, dozens of other groups, using instruments ranging from the high-flying Hubble to relatively small scopes, are stepping up their activities. Predicts Marcy: “We are going to find, between us and the Swiss, 10 more planets in the next two years.” Concurs Butler: “Very shortly, there could be more planets known outside the solar system than inside.” Whether or not they are right, the human race has already moved closer to answering the most enduring question about its true place in the cosmos.
There were six planets discovered in 1996 and one more in 1997. So they weren’t off by much. The count currently stands at 335.
A few lessons to take from this experience:
- Reporters tend to exaggerate.
- When a government official makes bold predictions about a 10-15 year program, don’t believe him.
- Don’t bet on space-based astronomy. Almost all of those 335 planets were discovered from the ground.
- Interests shift over time. Everyone in this article is interested in pictures of planets. Now we’re more interested in simpler goals, like transits.
Permalink
« Previous entries