HTML, JavaScript, Photography, PHP, Programming

Turn your iPhoto library into a Web photo album

iPhoto is good for managing and organizing photos and photo metadata, but it’s not easy to get that information back out if you want to share more than a few photos. I recently finished scanning 13,000 family photos and importing them into iPhoto, and I wanted to be able to share all of those photos (complete with the faces I spent hours tagging) with my brothers and sisters.

I could just burn copies of the iPhoto library to discs, but not all of my siblings have Macs, and iPhoto may not be around for very long. I needed a way to export all of the photos and metadata in a format that I felt comfortable would be supported for a long time: the Web.

The result was a PHP script that exports an iPhoto library into folders of image files (one folder per event), generates JSON arrays of event and photo metadata, and builds a minimalist JavaScript-powered website that provides a simple photo viewing experience. The website can be put online, or it can be run entirely offline (like from a DVD, which is my plan for sharing with my family members). The code is all open source ( and the usage instructions are in the README.

Here’s a screenshot of the main page of the website it generates:


And here’s an example of a single photo’s page:

I know it’s a pretty niche project, but hopefully it will come in handy for anyone looking to make their iPhoto library more shareable and accessible, especially as Apple drops support for iPhoto in the near future.

iPhoto Disc Export

Facebook, Themes, Twitter, WordPress

Keyring River: A new WordPress theme to complement Keyring Social Importers

It’s no secret that I use Keyring and Keyring Social Importers to import my activity on third-party services into a WordPress blog. All of my Facebook posts and photos, Twitter updates, foursquare checkins, and Reddit comments and submissions are archived in a single location; this makes it simple to see a snapshot of my online life at any point in time. I’ve even imported my IM chat transcripts from over a decade ago.

I’ve long been searching for the perfect WordPress theme to showcase all of this data. Typical blog themes didn’t work because each “post” needed different styling based on the service it came from, so it was unlikely that I was going to find what I needed already built for me.

But then, I came across an effort by David Hariri to build a non-WordPress lifestreaming product called River. While I’m already committed to using WordPress, his frontend design was exactly what I had been looking for. Luckily, David’s project is open source and MIT-licensed, so I was able to use his design and adapt it to a WordPress theme. With that, I present Keyring River:


Keyring River is a new WordPress theme coded specifically to complement Keyring Social Importers. It’s feature-poor and purposefully so; there are no sidebars, no footers, no menus, no comments — just a search box and a list of activity. For maximum enjoyment, install Jetpack and activate the Infinite Scroll module so that you can scroll infinitely into your online history. See it in action on my example lifestream blog, where I’ve imported my Twitter and Reddit history.

The timestamp on each entry links to the single-item view in WordPress, and the logo links to the item on the service it was originally posted on. Amuse yourself by scrolling back a couple of years, finding an interesting Facebook post, and reviving discussion on it!

Keyring River currently supports posts imported by the following plugins:

…and of course, regular WordPress posts.

Download Keyring River from Github, and let me know if you put it into practice. Taking ownership of your data is important, and more importantly, it’s fun!

Plugins, Programming, Reddit, WordPress

Import your Reddit activity into WordPress

I try to maintain a copy of all of my social media activity in a single WordPress-powered archive. Twitter, Facebook, foursquare, Reddit, Usenet, chat logs: all searchable in one place via a single search box. Or, I can just scroll back in time, using Jetpack’s Infinite Scroll module. It’s heavenly.

Screen Shot 2014-01-17 at 12.09.02 AM

To import my activity from third-party services, I use Keyring Social Importers. Keyring Social Importers ships with support for a handful of services, but not Reddit, so I’ve written a WordPress plugin that adds support for importing comments and submissions from Reddit.

The plugin (“Reddit for Keyring”) is available at Github. (Make sure you install Keyring and Keyring Social Importers first.) After installing it, use it like any of the other Keyring Social Importers. Submissions (both link and text) and comments will be imported and saved as posts.

Let me know if you use it; bug reports are welcome in the comments below or in the Github project.

Life, Minnesota, Programming

Does Minnesota really have more shoreline than California?

There’s a popular piece of trivia that says that Minnesota, ostensibly due to 10,000+ lakes, has more shoreline than California. Sometimes, the ante is upped and Minnesota is claimed to have more shoreline than California, Florida, and Hawaii combined. Other times, it’s simply “Minnesota has more than 90,000 miles of shoreline.”

Shoreline of Lake Superior

According to Explore Minnesota Tourism, who used the “more shoreline than California” line in a 2011 television ad, it’s a “commonly-used statistic that was researched and compiled at least 20 years ago by a former advertising agency.” But despite how ubiquitous the factoid has become [1], there’s no definitive proof that it’s true. So: does Minnesota have more shoreline than California? Let’s find out.

Minnesota Shoreline

First, let’s determine the total shoreline in Minnesota. There is no official source for the shoreline of each lake, so we’ll have to get creative. In 1968, the Minnesota Conservation Department published a report titled “An Inventory of Minnesota Lakes” (warning: 498 page PDF). This report included a summary of lakes by size:


We can use this as a starting point. Lake shorelines are irregular, and the further they deviate from being circular, the more shoreline there is for a given area. But if we assume each lake is a perfect circle, then we can calculate the minimum possible lake shoreline in the state:

Minimum Lake Size, in Acres Minimum Lake Size, in Square Feet Number of Lakes Minimum Circumference of Each Lake, in Feet Minimum shoreline length for this set of lakes, in feet
10 435,600 4,482 2,339 10,486,262
25 1,089,000 3,728 3,699 13,790,968
50 2,178,000 1,892 5,231 9,898,172
75 3,267,000 1,167 6,407 7,477,395
100 4,356,000 765 7,398 5,659,920
125 5,445,000 546 8,271 4,516,442
150 6,534,000 689 9,061 6,243,293
200 8,712,000 1,262 10,463 13,204,538
500 21,780,000 400 16,543 6,617,498
1,000 43,560,000 225 23,396 5,264,187
2,500 108,900,000 63 36,992 2,330,555
5,000 217,800,000 62 52,315 3,243,587
Total Shoreline, in feet 88,732,822
Total Shoreline, in miles 16,805

16,800 miles is the minimum possible shoreline, given lakes of those sizes.

If we had the exact acreage of each lake, we could get a better estimate. Fortunately, that same 1968 report also contains the acreage of each lake! Unfortunately, it’s a PDF of a typewritten document from 45 years ago, and OCR efforts to digitize the table failed. Fortunately, the good folks at the Minnesota DNR provided me with a CSV containing the name of every lake in Minnesota and its last-surveyed acreage! Thanks, DNR! (The spreadsheet with lake sizes is available here.)

Now that we know the exact surface area of each lake, we can do the same “perfect circle” calculations and find that the newest minimum shoreline length is 22,384 miles.

We’re getting closer, but it would be great to not have to rely on the crutch of assuming circular lakes. Isn’t there some way that we can get access to lake dimensions? It’s our lucky day, because the spreadsheet provided by the DNR actually included shoreline measurements. When I said there was no official source for the shoreline of each lake, I fooled you!

According to the DNR, Minnesota has 44,926 miles of lakeshore. (Spreadsheet with data here.) That’s a lot of shoreline, but is it more than California’s?

California Shoreline

I’ve been unable to find a California DNR resource as helpful as Minnesota’s, so we’ll have to take another approach. Where else can we get geographical data about lakes? OpenStreetMap to the rescue!

OpenStreetMap is like Wikipedia for maps, and a service called Geofabrik provides downloads of OpenStreetMap data on a state-by-state basis. (Here’s Minnesota.) The download is an XML file containing all of the information needed to map a given state. Fortunately, we can use a tool called osmfilter to filter the XML file and give us a much smaller file with just the water features.

I wrote a program to parse that file and measure the shoreline of each lake. When I ran my program on the Minnesota data and compared the results to the DNR-supplied data, I found it was off by about 10%:

DNR Shoreline Results compared to OpenStreetMap Shoreline Results
DNR OpenStreetMap
Minnesota 44,926 miles 49,759 miles

It’s mainly because OpenStreetMap includes the entire boundary of some lakes that are only partially in Minnesota.¬† If I took some time, I could weed those out, but I’m satisfied that this data is close enough for my purposes.

California has 3,427 miles of ocean shoreline as (generously) calculated by NOAA [2], and according to OpenStreetMap, it has an additional 32,050 miles of lakeshore. That’s a total of 35,477 miles of ocean and lake shoreline.

California Shoreline vs. Minnesota Shoreline
Ocean Lakes Total
California 3,427 32,050 35,477
Minnesota 0 44,926 44,926

So yes, Minnesota does have more shoreline than California.

Raising the Stakes

Can Minnesota beat California and Hawaii? Hawaii is practically all shoreline, but because it is so small, it only has 1,052 miles of ocean shoreline [3] and 229 miles of lakeshore. Add that to California’s total, and even at 36,758 miles, it still doesn’t top Minnesota.

California and Hawaii Shoreline vs. Minnesota Shoreline
Ocean Lakes Total
California 3,427 32,050 35,477
Hawaii 1,052 229 1,281
CA + HI 4,479 32,279 36,758
Minnesota 0 44,926 44,926

So yes, Minnesota does have more shoreline than California and Hawaii combined.

Let’s add Florida to the mix. Florida has 8,436 miles of ocean shoreline [4], and according to OpenStreetMap, it has another 22,236 miles of lakeshore. That’s a lot of shoreline, and it increases the tri-state total to 67,430 miles, more than Minnesota.

California, Florida, and Hawaii Shoreline vs. Minnesota Shoreline
Ocean Lakes Total
California 3,427 32,050 35,477
Hawaii 1,052 229 1,281
Florida 8,436 22,236 30,672
CA + HI + FL 12,915 54,515 67,430
Minnesota 0 44,926 44,926

So no, Minnesota does not have more shoreline than California, Hawaii, and Florida combined.

Or does it? We’ve only been considering lakes and oceans, but Minnesota has an additional 69,200 miles of natural rivers and streams [5], both of which have shoreline on each side. That’s an extra 138,400 miles of shoreline, giving Minnesota a grand total of 183,326 miles of shoreline. That’s a lot of shoreline!

Rivers and Streams

According to Wikipedia, Hawaii has about 360 streams [6], the longest of which is 28 miles. Even if we assume they are all 28 miles, that gives Hawaii an additional 10,080 miles of shoreline. (I know it’s bad form to cite Wikipedia, but I think we can agree it’s good enough for this case. And look at that advantage I’m giving Hawaii!)

The Florida Public Service Commission states that Florida has “11,000 miles of rivers, streams & waterways.” [7]

California, according to the California Department of Fish and Wildlife, has 29,664 miles of streams and rivers. [8].

California, Hawaii, and Florida Shoreline vs. Minnesota Shoreline, including Rivers
Ocean Lakes Rivers Total
California 3,427 32,050 59,328 94,805
Hawaii 1,052 229 20,160 21,441
Florida 8,436 22,236 22,000 52,672
CA + HI + FL 12,915 54,515 101,488 168,918
Minnesota 0 44,926 138,400 183,326

California, Hawaii, and Florida combine for an additional 101,488 miles or river shoreline, bringing their grand total to 168,918 miles, which, if you recall, is less than Minnesota’s total of 183,326 miles.

So yes, Minnesota DOES have more shoreline than California, Hawaii, and Florida combined, but only if you consider rivers and streams.


Automatically set window titles in GNU screen

Although GNU screen is actually a window manager, I mainly use it to turn nano into a tabbed text editor. If you do something similar, you might be interested in the way that I automatically set each window’s title to the filename that I’m editing (and reset it back to a default value when I exit the editor).

Make two additions to your .bashrc:

nano () { echo -ne "\ek${1##*/}\e\\"; /usr/bin/nano "$1"; }

This modifies the nano command to set the window title to the filename that’s being edited, sans any leading directories, before opening the file with the real nano. (If your true nano isn’t in /usr/bin/, make the appropriate substitution.)

export PROMPT_COMMAND='echo -ne "\ekbash\e\\"'

This has the effect of resetting the title to “bash” after nano exits, because the prompt has to be printed. (Note that it will reset any custom titles you set manually. There’s probably a better way to reset the title when a program exits, but this has worked for me.)

These two changes allow me to effectively use screen as a tabbed terminal text editor and see at a glance which files I have open in which “tabs.”


Our 2013 Christmas Letter

Another year, another single sheet of paper summing it up. Let’s get this over with.

In January, we went on a weeklong trip to Hawaii. I know what you’re thinking — “Hawaii in January? Soooo clich√©!” I know, but our place in St. Bart’s was getting its ceilings re-gilded.

In February, we refinanced our mortgage again. It’s a pretty interesting story really, much too long to fit in this letter, but we got a great rate reduction under the terms of the HARP program, reducing our yearly interest rate from 5.5% down to WAIT WAIT DON’T STOP READING I’LL STOP TALKING ABOUT MORTGAGES.

Christina left her job at GE in March to pursue other opportunities, like not working. Unfortunately, it turns out that being at home with the kids all day does not fit the definition of “not working.”

We found out this year that Gideon is allergic to dogs, our cat Sancho, dairy, eggs, and peanut butter, so we made the tough decision to give him up for adoption. We can’t have someone like that cramping our style!

At the end of April, Christina’s dad unexpectedly passed away in part due to esophageal cancer. No jokes in this paragraph; we miss Doug.

The month of May saw us pack up our car and take a 3,000 mile road trip through the Appalachian mountains and the Cotton Belt. We did see some Appalachian mountains but, sadly, no cotton belts.

Gabriel participated in a sports camp in July. Oh, did I say participated? I meant “participated.” j/k, LOL. He did have fun and is planning on doing a football camp in January. Hopefully next year’s letter will not mention any sort of youth concussion study.

(In case it was not clear, the “him” that we gave up for adoption four paragraphs ago was our cat Sancho, not our son Gideon. That would be ridiculous! Who could say goodbye to that cute widdle face?? Sancho’s widdle face, on the other hand, is very goodbye-sayable-to.)

In August, we didn’t have a baby.

In September, we did have a baby! (Well, Christina had a baby. But I helped!) Gloria Abigail Finke missed an August birthday by four hours (and her due date by two weeks), and I don’t think we could have waited any longer. (We literally could not have waited any longer; the doctors wouldn’t have let us.)

By November, Gloria had had enough of us and needed a vacation, so she flew to Oregon to visit her best friend Jackson. Christina tagged along and visited her friend Leah, who happens to live in the same state, city, neighborhood, and house as Jackson. WHAT ARE THE ODDS

Christina is teaching Gabriel to read, but I like to think that we’re all learning a little something. Well, except Gloria. And Gideon. And me. And maybe Christina. So just Gabriel then.

Until next year’s letter,

The Finke Family

AOL, Plugins, Programming, WordPress

Import your chat transcripts into WordPress

Problem: You have years’ worth of chat (AIM/MSN/Adium/IRC) transcripts saved on your computer, and you’d love to stroll down memory lane and reread some of them, but how? Manually open each one in your browser or chat program?? There’s got to be a better way!

Solution: Install IM-porter, the WordPress plugin that imports your instant message transcripts to your WordPress blog so you can read through conversations from ages past just as easily as you browse the archives of a blog.

After activating the plugin, visit Tools > Import > Chat Transcripts. Then, you can upload a single transcript or a ZIP of transcripts.

IM-porter currently supports transcripts from:

  • AOL Instant Messenger
  • MSN Messenger
  • Adium
  • Colloquy

but you can extend it to parse other formats too. (See the README.)

Imported posts are given the chat post format, and you have the option of tagging them with the participants’ usernames, making them public or private, and adding them to a category.

The IM-porter configuration screen.

After they’re imported, chats will look something like this:

A chat imported by IM-porter

The output may not be perfect (the output will not be perfect), but the original raw transcript is saved as post meta so the post can be updated if you want or fixed by a later version of IM-porter.

If you want to style your chats like AIM used to display them (like in the screenshot I included), you can use this CSS:

.post.format-chat .entry-content p {
	margin-bottom: 0 !important;

.post.format-chat .entry-content span {
	color: #00f;
	font-weight: bold;

.post.format-chat .entry-content span.participant-1 {
	color: #f00;

.post.format-chat .entry-content span time {
	font-size: x-small;