Neal Sheeran

Rants, Raves, and Geekery

Reporters: We Loathe 2012 Campaign »

Permalink

Reporters feel like both campaigns have decided to run out the clock with limited press avails, distractions, and negative attacks, rather than run confident campaigns with bold policy platforms or lofty notions of hope and change—leaving the media with little to do but grind along covering the latest shallow, sensational item of the day.

A lot of whining follows for a problem for which they accept no blame themselves. I’m just shocked to hear that candidates don’t trust the media.

Let Me Count the Ways »

Permalink

In a discussion a few days ago, I mentioned the myriad of reasons why I will not vote for Obama—besides the obvious one being that I must be racist. I thought about making a list. And now I don’t have to since National Review took care of it: 689 Reasons to Defeat Barack Obama.

It’s a great list. About 35 are all I need, including:

12. For claiming that he would cut the deficit in half.
13. And then adding more than $5 trillion in new debt.
14. To remind him that debt used to be, in his own words, “unpatriotic.” 28. Because “jobs created or saved” is Enron accounting.
207. Separation of powers
258. He considers the Warren Court to have been a failure because it did not achieve “redistribution of wealth.”
259. And because “it didn’t break free from the essential constraints that were placed by the Founding Fathers in the Constitution,” a.k.a. the Constitution.
517. “When you spread the wealth around it’s good for everybody.”
576. The TSA touches our junk.

Etc. etc.

The number 689 is a bit misleading. There are at least six entries that consists solely of “Joe Biden.” Which is probably about right. There was one item I disagreed with:

427. Expanding combat roles for women.

I have no problem with this at all. If woman can meet the standard, then they should be able to perform the mission, whatever it is and regardless how “dangerous” it may be. 1 No war on woman here, folks.

  1. This would obviously include registering for Selective Service.

Linked List Posts: From Movable Type to Octopress

Permalink

In the previous post, I documented how I exported my main entries from Movable Type into Octopress. Here is how I did the same thing for my “linked list” style posts.

In order to use linked list-style posts with Octopress, you need to use the 2.1 branch of the software. Instructions are here and further documentation is here. The instructions are a few months old and say to use the “linklog-test” branch. I asked the developer, the always helpful Brandon Mathis, and he recommended using the “2.1” branch. I did so and had no issues, other than fixing a few merge conflicts.

My “elsewhere” sideblog was a separate blog installed within Movable Type. The MultiBlog plugin was used to pull the latest 15 linked-list style posts and list them in the sidebar of my main page. In what-should-be-standard linked-list style, the entry title link went directly to the external site. There was a separate archive of all “elsewhere” links, but there was actually no mechanism on the site to link to an individual “elsewhere” post.

To export my “elsewhere” posts, I created an Archive template much like the one used for my main entries:

---
layout: post  
title: "<$mt:EntryTitle$>"  
date: <$mt:EntryDate format="%Y-%m-%d %H:%M"$>  
comments: true  
categories: <$mt:EntryCategory$>
external-url: <$MTEntryBody encode_ampersands="1"$>  
---

<$MTEntryMore encode_ampersands="1" convert_breaks="0" $>

I stored the external URL in the main body of an MT post and my snarky commentary in the Extended Entry section. Again, the convert_breaks="0" line is important so that my original text was exported and not the generated HTML. I wasn’t very diligent about cleaning up ampersands in URLs when I wrote those posts, so I had this archive template do it for me.

Additionally, when I wrote these entries, I did not categorize them. Since these entries now exist in the same “stream” as my other entries under Octopress, it was quite easy to do a simple multi-file search and replace across all 250 markdown files in BBEdit:

Find: 'categories:'
Replace: 'categories: [elsewhere]'

I then went back through the entries and added additional categories to the some of the posts. After copying these files into my octopress _posts directory, I did get a cryptic error after attempting to generate the site:

/Users/me/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/
psych.rb:203:in `parse': (<unknown>): did not find expected 
key while parsing a block mapping at line 2 column 1 
(Psych::SyntaxError)

That specific ruby file is a parser for Yaml and since it neglected to tell me which file was the offender, I started looking at the second line of the markdown files and figured out that Jekyll, the underlying engine of Octopress, does not like double quotes within the already-quoted title value:

title: "Quote of the Day: "Something Hilarious""

Another swing back through the markdown files to change any instances of interior double quotes to single quotes, or remove them altogether.

And I’m pretty impressed with the result. Octopress automagically sets the entry title link to point to the external URL, makes the font-size of linked-list posts smaller and includes a symbol (which is configurable) to further indicate it is a linked list post.

A final note: it takes approximately 45 seconds to regenerate my entire Octopress site, with 373 entries. That’s about half the time it took Movable Type to do it.

How to Export From Movable Type to Octopress

Permalink

The obviously critical part of converting this site over to Octopress was importing my existing Movable Type Posts. There is a Jekyll script that is supposed to do this, but I have not used it. Poking around the net, I saw a post about someone using an archive template to export Expression Engine posts into Movable Type.

Well, MT has archive templates and I thought I could certainly do the reverse and export my entries out of MT into markdown files with the correct YAML metadata.

Here is the Archive Template I built—I called it OctoExport:

---
layout: post  
title: "<$mt:EntryTitle$>"  
date: <$mt:EntryDate format="%Y-%m-%d %H:%M"$>  
comments: true  
categories: <$mt:EntryCategory$>  
---

<$mt:EntryBody convert_breaks="0" $>​

Pretty self-explanatory, but a few notes are in order to make this work correctly. First, I set the format attribute of the mt:EntryDate tag to match what Octopress is expecting in that field. The convert_breaks="0" attribute is important. It tells MT to perform no conversion on the entry text, i.e. export it in the markdown format that I wrote it in. Without it, the Entry Body will be exported converted to HTML.

Also, If you have any MT entries that are split between EntryBody and EntryIfExtended (with the accompanying “Continue reading…” link), include that tag as well. I have never used that, so I left it out.

The other key part of this is setting the Archive Mapping of this template to export with the correct filename structure that Octopress is looking for:

2012-08-07-a-markdown-test-entry.markdown

After creating the template, go back to the Template Options and create a new Entry mapping1. Select Custom from the drop down menu and enter this:

%y-%m-%d-%F.markdown 

The year-month-day is obvious, although the values are case-sensitive. The %F is a place-holder for the original filename, and using an uppercase ‘F’ means to drop the original extension (.html) so I can add my own (.markdown). This placeholder also replaces spaces between words with underscores. Use %-F (note the hyphen) to use hyphens. Read the MT documentation for all possible file path options. I used the former because my original MT entries are published with the following URL structure:

http://www.nealsheeran.com/archives/2012/07/some_post.html

And I want Octopress URLs to do be as close as possible to minimize .htaccess pain later on. If I could go back in time, I would have used hyphens and a slug length longer than 30 characters.

Once complete, I hit ‘Publish’ and in less than a minute I had 121 markdown files of all my MT entries 2. Using my PGP post from last month as an example, here is the name of the markdown file that this archive template created:

2012-07-12-pgp.markdown

And here is it’s contents:

---
layout: post  
title: "PGP"  
date: 2012-07-12 00:18  
comments: true  
categories: Software  
---

I came across [this article][1] about Phil Zimmerman...

Some Notes Regarding Categories:

  1. If you have assigned multiple categories to a post, MT will list them separated by commas after categories:, whereas Octopress needs them to be also enclosed in brackets.

  2. Octopress needs multi-word categories to be enclosed in single or double quotes.

For example, if Movable Type exports this:

categories: Current Events, Software

Octopress needs this:

categories: ['Current Events', Software]

Some grep-foo with BBEdit can easily take care of these issues. Of course, I say that like I knew what I was doing. Not quite.

I still went through each file and double-check image paths, links or any posts that were written in HTML as opposed to markdown. MT’s basic markdown parser doesn’t understand more advanced syntax (such as Multi-Markdown) that provides footnotes. When I wrote a post with footnotes–usually with nvALT and previewed with Marked–I changed Marked to display the generated HTML and then pasted that into MarsEdit.

I haven’t been very diligent about setting the right categories (or tags) in the past, so I went back through the resulting files before I generated them with Octopress.

Redirecting Old MT Posts

Under Movable Type, individual entry URLs were structured like so:

http://www.nealsheeran.com/archives/2012/07/some_post.html

Using the above export template to export the original slug as the title, and modifying the the permalink setting in my Octopress config.yml file to:

permalink: /archives/:year/:month/:title/

Will result in Octopress posts living at:

http://www.nealsheeran.com/archives/2012/07/some_post/

I made the following entry to my root .htaccess file to redirect the old MT URLs to the new location:

RewriteBase /
RewriteRule ^(archives/[0-9]{4}/[0-9]{2})/(.*)\.html$ /$1/$2/ [R]

I’m no regex nerd, but the key part here is capturing the file name of the original URL (the some_post, with (.*)) without the the html extension and passing that as a variable ($2) for the the final destination folder of the new URL. Yes, I’m sure there are better ways to write the regex, but it works for me, and makes sense when I go back and look at it later.

  1. If you are testing this and not nuking your MT install just prior to converting to something else. Do NOT select the checkbox next to Entry in the list of mappings. If you do, this template will become the default for all our entries and when a user goes to view an original, MT-generated entry, it will display the markdown file that is created, not the final, HTML version.

  2. The markdown files will be created in the Archive Path you have set under Settings. I could not figure out a way to set the mapping path to write to an arbitrary folder (such as ‘export’), even within that Archive directory.

My Husband Is an Impossible Act to Follow… »

Permalink

“And yet, now I must follow him. I have been forced to have the last word.”

Beautiful eulogy for Christopher Hitchens, from his widow, as an afterword for her husband’s book, Mortality.

The Dodges Make It Rain »

Permalink

The Dodgers pull off a blockbuster trade, at least in terms of money. Are they turning into the Yankees?

Boom. Hello Octopress

Permalink

And it’s done. I’m now operating in markdown-flavored, plain-text glory. Some tweaking of the .htaccess file is ongoing. Old RSS feeds (one each for the main posts and elsewhere links) should direct to the new atom feed. Sorry if you got 20 unread posts. More good info on the move is coming soon.

Leaving Movable Type

Permalink

This site has been built with Movable Type since its inception in the fall of 2002. I started off around version 2.5 and then stuck with them through the licensing fiasco of version 3, the wholesale loss of the blogging engine wars to Wordpress, and the pretty much abandonment of the software by Six Apart.

Movable Type is still a capable platform, but I think it’s time for a change. My biggest complaints—in no particular order—are as follows:

TL;DR - very soon this site will be powered by Octopress.

  1. The upgrade to MT5 a while back broke some functionality of the site. I have been told that this is fixed in 5.1 (I’m still running 5.03), but the MT upgrade process is not my idea of a good time. While much improved over the years, upgrading my MT install falls close to going to the dentist on my fun list.

  2. I’m a huge fun of using Markdown, especially the more capable variants such as MultiMarkdown that include footnotes. I struggled for about an hour to get MultiMarkdown to work with MT and failed.

  3. This site is actually two separate blogs within my MT installation. One blog for the main entries such as this one, and another for the “elsewhere” sideblog. I use the MultiBlog plugin to include the last 15 Elsewhere posts on the main page. The good thing about this plugin was any time a new Elsewhere post was created, the front page would automatically regenerate. The bad thing was this regeneration wouldn’t happen if the Elsewhere entry was posted with MarsEdit, my tool of choice for writing entries since almost the beginning. I had to resort to the web interface. I don’t like the web interface. I wouldn’t like it even if it didn’t stubbornly include two pointless <br /> elements after the URL when I used the quick entry interface. But it does.

  4. One thing about this site that I haven’t liked is the search results. This could be my fault with the whole two-blogs-at-once thing going on, but the MT search and search results templates are a pain to mess with.

  5. Which leads to another issue: the MT documentation is not the most helpful and has been poor for a while. Multiple pages are out of date or are confusing to use. To upgrade an MT install requires bouncing back and forth between multiple different pages and sets of steps. 1

  6. Finally, I think it is safe to say that Movable Type is a dead platform. In the early days, everyone used MT. The only significant tech blogger that I’m aware of that still does is John Gruber. Six Apart farmed out the software to their Japanese subsidiary long before they sold themselves outright. No one develops for the platform anymore: Movable Type-focused blogs have gone dormant, and the plug-in community is a ghost town.

A group of MT developers were working on an open-source version of the software called Melody that was supposedly going to take the platform back to its blogging roots. I wrote about this almost two years ago (when the program was a year behind), and one of Melody developers even left a comment about their prospects. Now? The Melody project has disappeared into the ether.

Requirements

So what do I need a replacement publishing system to do? Here is my list, in rough order of importance:

  1. Easily import my existing content. Currently, I have about 125 main articles and 250 elsewhere linked-list style posts. Not a lot by any means. but I made the mistake of not porting over about two years of content when I upgraded to MT3. While my Movable Type blog separates my main and elsewhere entries, I’m not tied to keeping that paradigm, and I’m leaning towards a single stream of posts.

  2. I still like MarsEdit, but the text editor landscape for the Mac has changed drastically over the years. I would ideally like to write my entries in Markdown using the text editor of my choice. 2

  3. Ability to completely dictate the underlying HTML structure of all the different sections of the site: Home page, individual entries, archives, etc. I have a significant re-design in the works and I would like to tailor it to a structure that I find useful, not one forced upon me by a CMS.

  4. An easy method to categorize or tag entries, and then be able to find tagged articles quickly. 3

  5. Easily customize the URLs of posts and other content. I made some poor choices in the early days with MT, so I would like a sensible URL structure that is easy to read and at the same time, easy to redirect or rewrite my previous MT URLs to their new equivalents. I will admit that the prospect of diving into .htaccess files is somewhat daunting.

  6. A publishing workflow with the least amount of friction, from creating and drafting a post, publishing it to my web server, and editing afterwards, if required. The same goes for modifying the underlying templates and CSS files.

  7. Along those lines, I would like to have a complete local version of the site on my personal machine that I can tinker with, and then upload any changes to the live version. I could have done this with MT (and have in the past, but just for testing big upgrades), but didn’t.

An ability to post from anywhere, including my iPhone or iPad would be a nice-to-have. This would probably mean some integration with Dropbox, which I use. However, I write better at home, sitting at my machine. I don’t like typing on my iOS devices anyway, so this is not a huge deal.

Alternatives

I have been looking at alternates, in varying degrees of detail, for a while now. They fall into two broad categories: full-fledged Content Management Systems (CMS) and static-site generators.

CMS Replacements

Wordpress

The clear winner of the “blogging wars” that kicked Movable Type to the street. I’ve had WP installed locally under MAMP for a few years and its web interface is excellent, but my biggest issue with WP is its underlying PHP-based template structure. Books have been written (and I read more than a few of them) about how to customize your WP install, and anything but the most simple of changes involves some hairy snippet of PHP code. I have more than a few strikes against Movable Type, but I never had to learn a line of Perl to make it do what I wanted, like having separate sideblog on my site. This was going to be a significant emotional event with Wordpress. I tried about six different “sideblog plugins” for WP, but none of them replicated what I had already.

Combine that the usual gripes against Wordpress such as security issues, the near-requirement for some cache plugin and the high noise level about all things SEO (read snake oil) in the Wordpress community all left me looking elsewhere. 4

Expression Engine

Another popular PHP-based CMS, but one that uses a template tag system very close to Movable Type’s—a point in its favor. I think Expression Engine is overkill for my simple blogging needs, but the most significant detractor was the fact the EE has no inherent ability to import my existing Movable Type content. This would require a paid plugin that didn’t give me the best feeling it would do exactly what I needed. The ability to tag entries? Another $49 plugin. I’m certainly not opposed to paying for software—I paid for an Expression Engine license—but the path forward with EE looked long, both in terms of time required and my credit card bill.

Static Site Generators

A not insignificant number of bloggers, at least among those nerdier ones I read, have made the transition to static site generators: programs that take a folder of plain text files (usually markdown) and then generate a full site of HTML files. No database, no security holes, no complicated cache plugins, and just about all install locally and with different deployment options.

I’ll cut to the chase and say that Octopress is the best tool of the handful I looked at and it will be running this site very soon.

Out of the box, Octopress has everything I need. It generates a very capable, responsive site that adapts to any viewport. It includes plugins for including Twitter and Pinboard data (among others), both of which I wanted to add anyway. The command line interface has multiple commands for creating, previewing, generating and publishing entries. Octopress is written in Ruby, which I know next-to-nothing about, but the documentation is excellent and the installation took about an hour, start to finish.

The developer of Octopress, Brandon Mathis, has always been responsive to my newbie questions on twitter (@octopress). For the those with the less-than-stellar nerd cred, I also recommend two excellent tutorials by Moncef Belyamani:

My original plan was to move over to Octopress coincidentally with a new redesign, but getting my MT entries imported over took less time than I thought. While the layout templates for Octopress are extensible and flexible, there is still a lot of work to do on that front, and the sooner I can leave the aging behemoth of Movable Type for the lean, plain-text goodness of Octopress, the better.

Upcoming Entries Releated to the Move to Octopress:

  1. How to Export from Movable Type to Octopress
  2. Linked List Posts: From Movable Type to Octopress
  3. Automating Octopress with Keyboard Maestro
  4. Runners Up in the Static Site Generator Contest
  1. This same complaint—in spades—could be applied to the Wordpress docs as well.

  2. Right now, that is either BBEdit or Sublime Text 2. For straight up writing, Byword is pretty nice too.

  3. Why do some blog engines insist on providing date-based archives, usually listed by month? MT and Wordpress have done it since day one (as have I). How is this useful for a reader, especially a new one? When I’m scanning your archive page, am I supposed to guess that July 2009 was a good month for you and take a look? I have never understood this, except for the cynical belief that maybe these monthly lists exist to indicate how long you have been at it in the blogging trenches.

  4. I was very intrigued with Macdrifter’s article about posting to Wordpress with Dropbox, but alas…he has left Wordpress for the static pastures of Pelican.

Justice Scalia Is a Snoot

Permalink

One of my favorite David Foster Wallace essays is Tense Present: Democracy, English, and the Wars over Usage, written for Harper’s in April 2001 and also included in his anthology, Consider the Lobster.

While DFW spent much of the article recounting the strife between the descriptivists and prescriptivists on the grammar and usage battlegrounds, he heaped much praise upon Bryan Garner, and his book Garner’s Modern American Usage.

The New Yorker has an article about a collaboration between Garner and Supreme Court Justice Antonin Scalia, and mentions Scalia’s admiration for Wallace’s essay. The article includes a link to Garner’s series of interviews on legal writing with eight of the nine current Justices. Here is an exchange between Garner and Scalia from page 61:

BAG: When we first sat down to talk about doing this interview, you mentioned that there’s a word to describe people like you who care a lot about words. I think the word is snoot.

AS: Yes, and you knew the acronym for that better than I did, and the author who developed the term, neither of which I recall.

BAG: David Foster Wallace.

AS: There you are. David Foster Wallace. But there are people who care a lot about words, about precise use of words, and there are people who don’t. And snoots are those who are nitpickers for the mot juste, for using a word precisely the way it should be used. Not dulling it by misuse. I’m a snoot. I confess. I guess a more old-fashioned word for snoot is pedant. I hope I’m not a pedant. I will end a sentence with a preposition. I don’t believe in those hobgoblins, but I do believe in not misusing words, in using apostrophes where good English calls for it, things of that sort.

How great that Scalia is a snoot. How awesome the conflict this may create in the minds of some who greatly admire Wallace, but certainly register some level of disdain for Scalia. 1

  1. Jason Kottke could not be reached for comment.