The Closest Non-Intersecting US Interstates
On our recent driving trip to Yellowstone and Montana, I had lots of time to think about random things while behind the wheel. One of them was to wonder of the major US Interstates, which two come the closest without actually intersecting? My guess was that it's some place on the East Coast, but due to my general lack of knowledge of East Coast highways, I had no idea which two it is.
Being a huge dork, I decided to figure it out.
Basically, it's actually not a very difficult thing to figure out. The steps are:
- Get the latitude and longitude coordinates for a number of points along each of the interstates.
- Determine which interstates intersect and eliminate those pairs.
- Put the coordinates for the interstates into a kD-Tree which will perform the search that determines the distance between non-intersecting highways in a fast way.
It turns out that the first step proved to be the hardest. I decided to use the data from the Open Street Map (OSM) project. This is a Google Maps-like website that is editable by anyone in the world, similar to Wikipedia. It will not give you directions like other mapping services, but it contains the geographical location of a wide variety of items, including and importantly (as the name suggests) roads. I looked into using the OSM APIs, but as far as I could tell either the APIs didn't do what I needed in an efficient way, or the servers were down. So I simply downloaded the 82 GB XML (5 GB compressed for download) dataset for the United States.
Begin rant feel free to skip to the next paragraph. I loathe XML. Any time that you have a 82 GB text file (apparently it's 200+ GB for the whole world) as your main distribution method, you're doing something wrong. Doing this project I learned as little about XML as I could to get just what I needed out of the file. Apparently the authoritative data is kept in a real database, but it appears that you can not download the data as a database. They do have a binary format description, but I can't find a link to download the data in that format. Furthermore, the world doesn't need yet another binary format. For example, they do not discuss endianness for their binary format on that wiki page, which is a big issue with binary formats. There are many other quality formats they could use (SQLite or HDF5). The binary format has a distinct Not Invented Here feel to it, which is nearly always a bad thing. Anyway, back to the main point of my rant. I don't care that the 82 GB XML file compresses down to 5 GB. Reading a 82 GB text file when you're searching for just a fraction of that data takes a long, long time, and is completely unnecessary. Every time I encounter XML it wastes my time in myriad ways. This time was no different. End rant
I'll spare you the full details and samples my low-quality Python code, but I munged the interstate data into a SQLite file, which distilled the data from 82 GB to 19 MB. Yes, that's nearly four orders of magnitude smaller. Then I used the much more convenient (and fast) SQLite file to build lists of interstate coordinates, which were fed into the kD-Tree for the nearest neighbor searches. The results are shown below. Note that there is no I-50 or I-60, and I eliminated I-45 from consideration because it's entirely within Texas, and therefore is not "major" in my opinion. I eliminated Hawaii's H-1 for the same reason. I have included links to maps showing the great circle between the nearest points of the highways. For highways that intersect, the link goes to one of the (more or less random) points of intersection.
Finally, we can see the answer I was looking for. Interstates 70 and 95 come within 5 kilometers in Baltimore at the terminus of 70, but do not intersect. So my suspicion was correct that it was somewhere in the East, so I have that to feel good about.
| X | 95 | 90 | 85 | 80 | 75 | 70 | 65 | 55 | 40 | 35 | 30 | 25 | 20 | 15 | 10 |
| 5 | 3338 | 2877 | 2826 | 690 | 2741 | 2484 | 142 | 1760 | 1822 | 910 | 1237 | ||||
| 10 | 1195 | 178 | 544 | 558 | 91 | 321 | |||||||||
| 15 | 2860 | 2423 | 2029 | 2009 | 1839 | 1272 | 1489 | 436 | 1093 | ||||||
| 20 | 804 | 764 | 615 | 173 | 283 | ||||||||||
| 25 | 2185 | 1730 | 1653 | 1453 | 1239 | 629 | 749 | ||||||||
| 30 | 1062 | 865 | 610 | 758 | 643 | 458 | 486 | 191 | |||||||
| 35 | 1404 | 985 | 569 | 516 | 358 | ||||||||||
| 40 | 587 | 550 | 347 | ||||||||||||
| 55 | 806 | 340 | 319 | 37 | |||||||||||
| 65 | 465 | 101 | |||||||||||||
| 70 | 5 | 152 | 234 | 105 | |||||||||||
| 75 | 12 | ||||||||||||||
| 80 | 413 | ||||||||||||||
| 85 | 582 | ||||||||||||||
| 90 |
p.s. If you really, really want to see the code I used for this, I can share it, but I'll have to pull out the hamsters that have taken residence in it. They're attracted to dusty littered places, you know.
SciPy 2009 at Caltech
I'm at the SciPy 2009 conference at Caltech in Pasadena today and yesterday. It is an amazing collection of nerds and questionable facial hair styles. There have been some interesting talks.
I like this "snub cube" fountain:
The SciPy crowd:
A fountain in front of the building the conference is in:
New Hosting Service, Again
Two and a half years ago I moved my website off my father's computer at home to Site5. For a while it was great, especially compared to serving a website over a cable modem connection. However, over the last year or two it's gotten progressively worse, something I discussed in this post about a year ago. Also over a year ago, Site5 promised to move everyone to new servers. It hasn't happened, and my service has gone steadily downhill.
My first two-year prepaid period with Site5 went up in December last year, and I seriously thought about moving. I looked at other shared hosting companies, but I felt I would probably have the same problems on a new shared host. I looked into hybrid solutions, but that too didn't seem a guaranteed improvement. I liked the idea of Virtual Private Servers (VPS), but I couldn't find one with enough disk space in my budget.
A few months ago, my lab mate Rick pointed me towards s3fs, which intrigued me. s3fs puts your data on Amazon S3, but allows the data to appear to be local to the server, like another hard drive. You pay for only what you use with S3, and it has virtually unlimited space. Suddenly, a VPS hosting solution fit into my budget. I could pay for a VPS with less disk space than I needed, but still get the power of VPS. It was also an upgrade because now me and my family could upload as much data as we wanted, and it would be much more secure from disk failure than before.
This website and other sites that were on the old server are now being hosted on a machine from linode.com. I'm using their lowest option, which has 10GB of space. I installed Ubuntu Hardy Heron which seems like a solid Linux distribution. s3fs has proven to be reliable and fast enough, although it's much slower than having the data on a local disk. Using Apache rewrites, my father and I have made it such that when a web browser asks for items on a page that exists on S3, the request goes there instead from this server, which saves lots of time. I've also figured out how to shoehorn Gallery2 into using S3.
So far I am very happy with the new server.
Yahoo! Mail Tries, and Misses
I have written thrice (1, 2, 3) in the past about the new Yahoo! mail interface, the Ajaxed interface to Yahoo! mail. It is incredible how slowly they make improvements to it. It's not like Yahoo! cares what I say, but of the points I raised over two years ago in my first post, they still haven't all been fixed.
But Yahoo! maybe trying harder. There is now a preference to add the greater-than signs on replied to messages:

Which is great. Until you try to use it. Here is a message I sent myself:

Here is what I get when I hit "reply" (this is a screen shot of the compose window, the text is editable):

Yes, each and every word of the message I'm replying to gets its own line. But it gets worse! Here's what I get when I send the replied message without touching anything:

Here each word of the replied to message gets its own line separate from the greater-than signs. I hope this is just a simple bug (I will submit a bug report about this) but this is simply ridiculous.
Yahoo! Mail Beta still stinks… less
Three months ago I wrote that Yahoo! Mail Beta still stinks. I said that Yahoo! had fixed two of my five main quibbles with their newest email interface. Sure, they fixed two, but they were the ones I cared least about.
Lo and behold, Yahoo! came out with an updated version of Mail Beta a month ago, and more recently my server farm received the update. Let's see how Yahoo! fares this round!
-
Fixed-width fonts. Huzzah! Numbah one gets addressed. This is big. Fixing this almost is enough for me to start using Beta every day. But only almost. Yahoo!, you get a nice green check:

-
Message replying format. Nope. Nothing new here. Same, lame behavior as before. Give us some freedom, Yahoo!. Stop putting the minority with good etiquette down! This earns you a Big Red X, and red is never a good color for anything.

-
Message quoting. Nope, again. There is still no way to differentiate the message I'm replying to and what I've written. Another BRX.

Yahoo!, you're getting beat up, down, left and right by Google. They just took YouTube out from under you this week! Shape up!
[W]hack a Phone

I've had my Motorola E815 phone for about a year. It has bluetooth, a camera, and other cool features, like many modern phones. Bluetooth enables you to transfer photos, movies and ringtones on and off a phone. All these things seem like a useful feature set for a phone. However, Verizon, the carrier for my current phone, disabled a number of bluetooth features, such as file transfer.
Why would Verizon intentionally cripple a phone? Money, of course. Turning off the file transfer abilities of a phone means that if I want to get the photos I take using my phone onto my personal computer, I need to use their not free services. Also, if I want to get a new ringtone, I need to pay for them (often over a buck for 30 seconds of music!), instead of uploading a simple, free, MIDI I found on the internet.
Ever since I got my phone, I've been aware that it is easily hacked to allow all bluetooth function, but it required a special USB cable. I never got around to buying the $10 cable, and hacking the phone, until now.
The camera actually takes farily decent photos in a wide range of light conditions considering it's just a pinhole lens. It also takes short movies, with sound. I can also upload MIDI sound files, or even MP3s, and make them my ringtone. I've always wanted to pull out my camera phone whenever I saw something cool, but never bothered because I couldn't get them off the camera for free. Now that I can, I'll be more willing to snap a pic of whatever.
Expedite my PhD

Do you want to help me get my PhD faster? If so, go on over to this website and buy me one Zenview six screen multidisplay. I'd also like you to buy me a computer capable of running all the monitors.
It's only your money. We're talking about my education here!
Yahoo! Mail Beta still stinks
Seven months ago I wrote a post covering my likes and dislikes (mainly dislikes) of Yahoo! Mail beta. It's time to revisit it and see if Yahoo! has done anything in that time. I had five points of contention:
-
Fixed-width fonts. There is still no option for showing/composing messages in fixed-width font. Starting off weakly, Yahoo!

-
Message replying format. It still puts my signature at the top of the message. Again, they should provide the option of putting it where I want it. Uh oh, another red x.

-
Message quoting. This also has not been fixed yet. Since I use good email etiquette, having no differentiation between what I'm replying to and writing is not an option.

-
Signature new lines. Finally, something they've fixed. Of course, without fixed-width font, my signature still looks wrong.

-
Bugs. Perhaps there are other bugs that have gone unfixed, but the one I identified in the previous post has been fixed. So you get a green check, Yahoo!

In sum total Yahoo! is batting .400, which is an excellent baseball average, but it is a poor average for things so simple to fix. Moreover, the list is in roughly descending order of importance to me. Therefore, Yahoo! is batting more like .150, having tackled none of the things crucial to me.
I've tried to tell Yahoo! about these shortcomings. I've submitted feature requests to the appropriate place several times over the last seven months. I can't believe I'm the only one with these concerns. But since nothing has changed, perhaps I am.
Intel MacBook, Parallels & Garmin GPS
Just a few days ago, I replaced my four year old white 500 Mhz G3 iBook with a shiny widescreen white 1.83 Ghz Intel Core Duo MacBook (the black one seemed altogether silly to spend extra money on). The laptop is a very nice machine. My home machine is a 20" iMac G5 with a widescreen, and I've gotten used to the extra real estate, so I like the fact that the MacBook has one too. Really, the main reason I bought it is because my iBook had decayed to the point that it was only good for websurfing. I wanted a machine I could use at school, and the iBook just couldn't cut it (I definitely tried to make the iBook work!).
Since Apple is switching to Intel chips, the world of Windows is now available using either Boot Camp or Parallels. I have a copy of Windows 2000, and since I believe that Boot Camp only works with Windows XP, I am not going to try that out. Also, Boot Camp makes your machine dual-boot, which means only one OS at a time and no interaction between the two. Parallels is the more attractive option, it allows you to run Windows along with Mac OS X. The Windows world lives inside of an application that runs on Mac OS X. Choosing to interact with Windows is no more difficult that switching applications. Also, Parallels works with basically any Intel-compatible operating system, so I could use my Win2000 install disk.
After much trial and tribulation (mainly related to the fact that my Win2000 is an upgrade version, not full install) I got Win2000 installed using Parallels on my MacBook. After installing the myriad of security updates, I installed the softwares for my Garmin Forerunner 301. You see, Garmin (right now) only makes software for their gadgets for Windows. They've promised to make a Mac OS X verison of the software I use by Spring 2006 (they have two and a half weeks). Obviously, waiting around for that to be relased will just waste my time, so I was hoping that I could use this whole setup to run the Windows software on my MacBook to talk to my GPS. However, sadly, it doesn't work. It's clear it almost works, since Win2000 notices when I plug in the GPS, but the Garmin stuff can't quite talk to the GPS. The situation seems exactly the same as when I tried using Virtual PC on my G5 over a year ago.
All in all, I like the laptop, I like Parallels, and I'm displeased with Garmin. I'm using a beta 30-day activation key with Parallels, and I'm unsure if I'll buy the full version ($40 for pre-ordering). I really try to stay away from Windows applications. Right now the only app I do want to run is the Garmin stuff, and it doesn't look like that's going to work.
Sim City 4
About a month ago I received my iPod settlement gift certificate worth $50. The money was only good at the Apple store. As you can find out for yourself, there's not much for $50 on the Apple store, save for a few iPod accessories. I didn't really want any iPod accessories, and besides, most wouldn't fit my second generation iPod. Of course Apple was hoping that I'd just go ahead and use the $50 as an excuse to by a quad-G5 desktop system for $3,300 (make that $3,250).
Look for the one-way streets, wide boulevards, and train tracks.
Above the iPod accessories, the lowest price items are software titles. I browsed through them and discovered that there was a Mac OS X version of Sim City 4. I've always liked the Sim City series, starting with the orginal Sim City. I like the planning of a citys infrastructure. As the "mayor" of the city, the player has to lay roads, freeways, railways, subways, power lines and water pipes. The mayor has to also balance a budget of expedatures and taxes (more on that later). The goal of the game can be as simple as building the largest city possible, or the most asthetically pleasing, or one with the "happiest" residents, or one with the best finances. My goal has usually been to have a high population combined with a happy population.
Look for the railroad crossing guards, various species of trees and the accurate railroad "Y".
The newest version has many improvements over the previous versions, Sim City 2000 and Sim City 3000. For one, this version supports regions, whereby you can build dozens of cities that are neighbors on one big map. Each city is independent in that you can only edit one at a time, but cities influence neighbors by way of jobs & trade. One of the biggest improvements has been in the graphics. This new game has beautiful graphics with very high level of detail. There are something like six levels of zoom. The closest one is so close you can see individual "sims" (people) on the streets (look for them on the above image of the train station).
See if you can find the county fair & golf course.
One of the keys to a well-functioning city is the transportation system. Sims are very touchy about how long it takes to drive to their job. Sim City 4 introduces a very useful tool that allows you to see what kind of traffic goes where through your transportation system. In the picture linked on the right, you can see all the commute traffic that goes through a train station in the center of town (in the lower-left of the picture). You can trace foot traffic onto a passenger train, which gets off at a different station and walks to a jobsite.
I must admit that one key element of Sim City, collecting taxes and balancing a budget, I've never really liked. I either cheat to get the cash to run the town, or find some other way to make money, like building a magic building found on the internet. I'm no libertarian -- I just don't really care too much about the fiscal part of the game. If I were really going to play the game for real, I would not cheat. But I don't want to play it for real, so I feel no guilt.
One nice thing about this game is there is no death & violence, no princess to save, and I can stop the game at any time without losing my progress.
Photo Mosaics
Lately I've been playing with a cool Mac OS X application called MacOSaiX. You give the application a photograph and a collection of photos, and it recreates the main photo using small photo tiles from the collection. The effect is at least somewhat artistic, and definitely cool.
Here's one I made using pretty much every photo I've ever taken. It's of me at Collegiate Track Nationals, 2005, during the points race qualifying race. I think it came out pretty good, except for the white barrier in the background, which is kind of dirty in the mosaic because I have taken very few photos of only white things.
The program can also scour Google Images for photos, using search terms I provide. Pictured below is Chris Nekarda (closest to the camera), Tona Rodriguez-Nikl (with the red jersey), Tyler Ofstad (on the right) and me riding a few warm-up laps. For this mosaic, I put in a few dozen cycling-related search terms, netting over 30,000 images returned. Not all the photos are cycling-related, which is the main problem using Google Images, but at least no porn snuck into the mosaic. I think this one has a more artistic quality than the one above, especially in the red jersey that Tona's wearing. I think this is due to the larger library of photos searched and the wider variety of photos -- I tend to take my photos in one way and of similar things.
A third mode of the program is "Glyph" mode, whereby instead of photos, glyphs are made at random and fit to the photo. I also chose the hexagon mode, rather than the rectangle mode of the above two mosaics. The program chooses two colors at random, and also a random character from a random font on my computer. It makes one color the background of the glyph, and the character the other color in the foreground. This technique provides a nearly limitless number of glyphs -- I esitmate nearly 1019 different glyphs are possible. This is not neccessarily a good thing -- the program will pick color combinations that do not exist in nature, and it will throw out that glyph. The photo below ran for about 200,000 glyphs, and I would argue that it doesn't have the same level of detail replicated as the photo-based mosaics. This could partly be because I used an older version of MacOSaiX which could have poorer matching algorithms, or a result of the limited complexity and too big color space of glyphs. Of course, to make the best comparison I need to make a mosaic of the same photo using Glyphs and photos with the same version of the program.
I have some quibbles about the program. First off, it's not a team player. It's a serious resource hog and the computer is almost unusable for other tasks while it's running. This means if I want to run it I've got to leave my computer alone for several hours. iDVD, for instance, will happily encode a DVD in the background while I use the computer for other things, and I would argue that that is no less computationally intenstive. Also, I wish I could go to a particular grid square and tell the application that I don't like the image it put there, and it would put the second best image from the library in that square. The user can place images by hand on the mosaic, but I'm not nearly as skilled at photo matching as the computer. What I am better at is having an opinion whether or not that photo is good for the mosaic.
Timekeeping
When I become president I will mandate through Executive Order that all electronics that include a clock have some sort of mechanism to keep the clock accurate. There are many ways to do this already. Computers that connect to the internet can use Network Time Protocol (NTP). Cars and anything else that will be outside on a daily basis can use the Global Positioning Service (GPS). Anything within the lower 48 states, and much of Canada and Mexico, can use the National Institute of Standards and Technology (NIST) time broadcast out of Fort Collins, Colorado. Cell phones also keep very accurate time because they're in constant contact with the towers.
Sure, there are devices that may not ever go outside (GPS), won't be hooked up to the internet (NTP) and can't receive the NIST or cell tower broadcasts because they're in the basement. But there are ways around this. Put micro-repeaters on powerlines so anything within a neighborhood that is plugged in can receive the time. With careful engineering, even a battery-operated wall clock in the deepest basement could tune into the subtle signal that pulses in the wall circuitry. Put bluetooth in wrist-watches (cell phones already have it!) and create a kind of NTP for timekeeping devices. Just as long as the deeply buried gadget comes in contact with an approved wristwatch often enough, things should work out.
I don't think I'm the only one with this dream. This last weekend I purchased at a local Target a Casio WVA105HA-1AV Waveceptor Wristwatch for about $55. Every evening it tunes into the NIST broadcast to keep the clock milisecond accurate. A quick comparison with other Casio models tells me I paid about a 100% premium for the Waveceptor functionality, but that cost would go down with all the volume following my executive order.
Remember, if you want this to be reality, vote for me! And do try not to forget, because I'm not even eligible to run for president for nine years.
Applescripted Phratry Nexus
Although it is still a work in progress (see forward parenthetical note), the "Phratry Nexus" has been greatly improved today. (I don't know about you, but I remember some years ago when "Work In Progress" or "Under Construction" images were common on webpages. I don't see them so much anymore because I figure people finally figured out that all web pages are always "Under Construction" by definition.)
Back to my main point. If you look at the Phratry Nexus you'll see thumbnail sized screenshots of the various Phratry.net webpages (four as of this writing). Due to the already mentioned fluid nature of the web, keeping those thumbnails current would be pretty tedious if done by hand. That's where Applescript comes in. Ideally, I would have liked to write some kind of script and put it in crontab on the webserver, but doing screenshots is difficult from the command line. The Applescript I wrote (along with some help from my father, Mike) uses four apps, which either come with Mac OS X or are free: Cyberduck (for FTPing to the server), Freesnap (screencapture utility), Applescript Image Events (image editing) and OmniWeb (web browsing). OmniWeb isn't free, actually. Firefox would work too, but I got the script to work better with OmniWeb.
The specifics of the script aren't important, but the cool thing is Applescript allows me to do a 15-minute process of screenshot editing and uploading with just one double-click. It still takes about a minute for the whole thing to work (most of the time is from built-in delays in case of slow webpage loads), but that's still fifteen times better than before, and it's done right every time.
New Hosting Service
Hello from an entirely new server and address! The old steve.yikes.com (which equalled stephen.kicks-ass.net) is now stephen.phratry.net. The old site was hosted on my father's 933Mhz G4 using his residential cable modem connection (which was throttled to 40 kb/s for uploads). This new one is hosted by Site5 which offers feature-packed deals for not very much money.
You may be wondering what phratry means. According to Dictionary.com it means
- A kinship group constituting an intermediate division in the primitive structure of the Hellenic tribe or phyle, consisting of several patrilinear clans, and surviving in classical times as a territorial subdivision in the political and military organization of the Athenian state.
- Anthropology. An exogamous subdivision of the tribe, constituting two or more related clans.
Since I wanted to have other family members & possibly friends use this domain & hosting service, I wanted to think of a domain that wasn't too specific to any of us, but was descriptive. Although none of us are a member of a Hellenic tribe, the general idea is phratry refers to an extended family group, which describes the situation. I also kind of like the word because it's not very common and has an odd spelling.
The cool thing is everything is so fast! Downloading photos off of the old hosting situation was pretty painful. This should be much nicer.
More Yahoo! Mail Beta Thoughts
Following up on my previous post about Yahoo! Mail Beta I noticed that the new beta interface has no space available thermometer bar, like the normal Yahoo! Mail does:
This is either an artifact of the beta not having all of the features of the old Yahoo! Mail yet, or that Yahoo! has something special planned regarding Mail. I'm willing to bet that unlimited mail is impractical and would be abused, but we'll see!


















