Programming

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.”

Standard
Christmas

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

Standard
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;
}

Standard
Facebook, Programming, WordPress

Export your Facebook posts to WordPress

I’m a big proponent of owning the data that you create. I use WordPress (of course) wherever I blog, and I use the Keyring Social Importers plugin to make backup copies of my Twitter updates and Foursquare checkins. And as of today, I am also syncing my Facebook updates back to a private WordPress blog using Keyring Social Importers.

Not familiar with Keyring Social Importers? That’s too bad, it’s amazing. Install it, and within minutes, you can be importing data from any one of a dozen sites to your blog. Remember all of that data you put into Myspace/Jaiku/Bebo/Pownce and how it disappeared when the site shut down? Wouldn’t it have been nice to be able to save a copy of all of that? That’s what Keyring Social Importers makes possible.

There’s no built-in Facebook importer in Keyring Social Importers, so I wrote one. You can use it to save copies of your Facebook photos, photo albums, and status updates to an easy-to-browse (and easy to share) WordPress blog.

To use the Facebook importer, install Keyring Social Importers, copy the keyring-importer-facebook.php file into wp-content/plugins/keyring-social-importers/importers/, and then visit Import > Facebook to get started. Let me know what you think.

Note: I’ve only tested the importer on my own account, so it’s possible that it won’t be perfect. All imported data is set to private, just to be safe. Patches and bug reports are welcome.

Standard
Software

Convert iChat transcripts to (useable) XML

iChat (a.k.a. Messages) doesn’t store its chat logs in a format that can be (easily) parsed outside of iChat, so if you want to use your chat data for anything, you’ll need to convert those logs to something better. (Anything would be better. Even AIM’s <FONT>-ridden HTML 3 is more useful than iChat’s binary plists.)

One suggestion I found that came close was to convert the binary plist to XML so that the XML could be parsed with the tool of your choosing:

$ plutil -convert xml1 example.chat

However, the XML generated by that command doesn’t include enough information to reliably determine which participant sent each message. (Or if it does, it doesn’t make it obvious enough that I would dedicate time to writing a parser.)

After trying every other promising script and program, here is the only thing that worked:

  1. Install Adium.
  2. Use Adium’s File > Import to import all of your iChat transcripts.
  3. After it finishes, look in ~/Library/Application Support/Adium 2.0/Users/Default/Logs/ and voila! Folders full of XML chat logs with data you can actually use. The file extension is .chatlog, but the content is sensible XML.

This process worked for me to convert 5,000 transcripts created by iChat between 2007 and 2013, and I used Adium 1.5.8.

Standard
Programming

Websites shouldn’t close at 10pm

HealthCare.gov is getting a lot of flack for being inaccessible and just generally bad, so I thought I’d check if Minnesota’s state insurance exchange website is any better. I learned this:

And once the website is up and running, it won’t offer 24/7 service. Instead, it will operate from 6 a.m. to 10 p.m. Monday through Saturday, officials said. There will be no Sunday hours.

MNsure spokesman John Reich said the website’s limited hours won’t be permanent.

“The initial hours are so that we can continually update and improve the user experience and add new features,” he said in an email.

(via TwinCities.com)

I can understand (but don’t agree with the idea of) having some planned downtime when you deploy major new changes (like, maybe an hour), but shutting down every night at 10? That’s especially bad for a website targeted towards people who might be working two jobs and don’t get a chance to visit the site until they get off work late at night. They’re out of luck.


Shameless plug: At Automattic, we continually update and improve the user experience and add new features to products like WordPress.com as often as fifty times per day without making the site unavailable 43% of the time.

(If that sounds good to you, come work with us.)

Standard
Life

Eggs and Toothpicks

In our high-school physics class (a dozen years ago), our fun year-end project was to construct a container out of toothpicks and Elmer’s glue that could prevent an egg from cracking when dropped from a height of about ten feet. The idea was to build toothpick crumple zones around the egg such that the egg’s deceleration would be slowed enough that it wouldn’t crack.

I took a different approach:

2293948192_a3a7ac62e2_o

That’s a parachute made entirely out of dried glue. Not only is the parachute made out of glue, the strings connecting it to the egg basket are made out of glue too. I only used twelve toothpicks for the basket, definitely setting the class maximum for glue and minimum for toothpicks.

So how did it perform?

2293304470_45628d4010_o

Not well. The parachute didn’t catch the air until about a foot from the ground, and the toothpick basket was so flimsy that the egg didn’t stand a chance. The glue strings held up though, so I think that if I had dropped it from thirty feet, it would have had a pretty good chance of landing safely.

If there needs to be a moral to this story, I guess it would be “Don’t put all your eggs in one basket if the basket is made out of twelve toothpicks and attached to a glue parachute, unless you’re going to drop the basket from a height greater than ten feet, in which case, you might be ok.”

Standard