Chart: The best value for processor-intensive tasks on Amazon Web Services

After a full day doing exaustive real-world tests, I was surprised to find that the “High-CPU Medium” EC2 instance type is the best value for my work. I have a lot of interesting data to post, but here’s a first simple chart for now

Shorter bars are better. The blue bars are time to complete the task, uncompressing a 55 MB mysql database dump with bunzip2. I’m experimenting with this chart: I stacked the cost on top of the times to give a sort of “cumulative value” result. Full details coming in a followup post.

Getting Baskerville on a website – price and licensing options

Left: Baskerville. Right: Baskerville.

Web fonts are an interesting mix of technology and intellectual property licensing.

I’m almost surprised that we, as a culture, have managed to pull it off, overcoming all the hurdles. But there are now several companies and methods to use typefaces on websites. I checked out the current options.

I’ve been looking for a new web font

Just having learned that Baskerville is the king of fonts (!), I thought it’d be interesting to try on my two Rails sites (WebLaws.org and OregonLaws.org). Currently they use Helvetica Neue for text, and I feel ambivalent about it. On one hand, it’s a beautiful font. But on the other, it’s the standard font on iOS, and while it’s stylish, it’s not so unique now. It also has problems with readability that I blogged about in detail.

Options I found for inexpensively trying Baskerville on a web site

Font Deck

  • License: 1,000,000 page views per month on unlimited subdomains.
  • Cost: $12.50 for one font weight/style per year.
  • Pure CSS, hosted font files: URW++ foundry’s Baskerville T.
  • Normal, italic, and bold would be $37.50/year ($3.13/month)

Baskerville FS by FontSite foundry

  • License: unlimited web usage
  • Cost: $13 one-time payment
  • Pure CSS, own the font file, host it yourself
  • (I don’t know the FontSite foundry – do they make decent fonts?)

ITC New Baskerville Roman by Linotype foundry via fonts.com

  • License: 250,000 page views per month, unlimited fonts, unlimited web sites.
  • Cost: $10/month.
  • Many other Baskerville fonts here as well.

Buenard

  • License: unlimited commercial web use, SIL Open Font License
  • Cost: free
  • Javascript + CSS, hosted on the Google Web Font system
  • Looks similar to Baskerville
Related Post: Testing the fonts

 

Attach images to Github issues with Skitch

I just found a decent solution to something I’ve wanted for a while: the ability to place an image in a Github issue’s description or comment. Here’s the final result.

The actual issue, live on Github.

I’ve got it down to one extra click and keypress:

  1. Take a screenshot using Skitch.
  2. Share it.
  3. Paste the URL from the clipboard.

The trick is Skitch’s flexible “Share” configuration options

I created a free Skitch account and configured sharing to automatically put a “Fullsize image link” on the Mac’s clipboard after the sharing is complete:

It looks like this will work with any of the supported account types. E.g., Webdev and SFTP are both possible and are what I’ll move to eventually so that I have all my images on my own server. But right now, Skitch’s free hosting is fine for me.

Here are some screenshots of the rest of the process, once the sharing is set up. First, immediately after clicking “Share”, there’s a loading progress indicator. Apparently, you have to wait for this to finish.

Then, when done, a superflous Share dialog popup appears, but you can ignore it because we’ve configured Skitch to automatically copy the link to the clipboard:

Finally, just move over to your Github issue and press ⌘V to paste the auto-copied URL:

And that’s it. Pretty sweet.

PS: Some links I found while looking for a solution

My Problem with Git: No Abstraction

Git is powerful, and Github is its killer app. I use them for all my projects. That being said,

Git is more difficult than it ought to be, but until now I couldn’t put my finger on why

I was doing some mundane Linux command line work when I had my flash of insight. I’ve been using Linux for years, but I almost made a typical newbie mistake with the mv command. I wanted to rename a file:

mv /path/to/old_name new_name

Urp! I stopped, because this would not have just renamed the file, but moved it into my current directory as well. And then I recalled the typical mv tutorials which usually explain how the unix filesystem works, and how with that understanding, mv’s behavior makes sense.

In other words, mv combines two conceptual functions into one thing, simply because that’s the underlying implementation.

And I realized that this kind of “implementation leakage” occurs with many git commands. The non plus ultra evidence is the excellent post, Git Reset Demystified by Scott Chacon. It’s about git’s equivalent to svn revert — a very important function, undoing your changes. But even though Scott is very knowledgable about git and even authored the book, Pro Git , he

…never strongly understood the command beyond the handful of specific use cases that I needed it for. I knew what the command did, but not really how it was designed to work.

It’s no wonder that ordinary git users don’t fully grasp these commands. In a final unintentional confirmation of my theory about git’s problems, Scott presents this 6×4 table as a learning aide:

Like studying German verb conjugations

Another example is the well written O’Reilly book Version Control with Git . By necessity, It teaches the internal implementation of git before explaining how to fully use it. Or, as David Eisinger says,

…until you wrap your head around its internal model, it’s easy to wind up in a jumble of merge commits or worse.

Fixing git: two ideas

See also

The Hidden Dangers of Beautiful Themes

A Tale of Seduction and Betrayal

Some of the best-designed and officially featured WordPress themes aren’t built to handle mid-volume traffic. Just one incoming link from a semi-popular page can take your server down.

A New Blog for a Web App

The featured "News" theme that crashed my server

Everything started out smoothly. Like thousands of developers do every day, I set up a new WordPress installation to support a new web app I’m getting online. I’ve got a Linode 1536 which is perfect for this . It has gigs of free disk space and 800MB of unused RAM just for cache. And these virtual servers are fast. Mine hosts about 15 Rails and WordPress apps and the system load never gets up to 1.0.

For me, the hardest (and most fun) part of setting up a new blog is choosing the theme. I didn’t want to waste time, so I looked only at WordPress’s one-page “featured” themes list and chose News — a conservative theme with personality.

I wrote a few posts to get started, posted a link to one on Reddit, and went to sleep.

I Woke Up but My Server Wasn’t There

The network traffic graph gives a dramatic view of the server crash

At around 9am, I was in for a shock: no web pages were loading and it took 2 minutes to simply ssh in. There were about a million Apache processes running and the system was out of memory. Checking on Reddit, I saw that the post was getting a good amount of traffic: it was at the top of the r/programming subreddit. It had a couple of hundred up-votes; a lot, but certainly not an apocalypse. So this was odd. I also saw that someone reposted it to the Hacker News. (Nice!) Except that the posts were only noting that the site was offline (Not nice.)

Discovering the Culprit: the Theme

A helpful Hacker News reader suggested “Caching is your friend”. That was my first thought as well. WordPress by default is just a PHP app, doing a lot of repetitious work with every request. But that didn’t feel right. This was a brand new blog, after all, and the requests were all for one simple page.

The “Twenty Eleven” theme: saved my server

The web server logs held the answer. Every visit to that blog post was generating 46 server requests for theme assets. 36 of those were for images. I couldn’t believe that the theme linked to that many individual files. This is a huge issue: it’s very important to reduce the number of external files required by a web page. No amount of server caching and optimization can help a site designed like this.

I used a trick to re-gain access to the web site. I stopped Apache, restarted it, and then jumped in before more web requests would arrive. I changed to the simpler but very well designed Twenty Eleven theme and … my web sites began to come back to life. I re-checked the server logs. Each visit was now generating only 7 requests.

The Moral: Trust But Verify Your Theme

Even highly promoted beautiful themes can have flaws that will crash an entire server under even modest traffic. Before you permanently change to a new theme, look at the HTML it generates. Analyze it with YSlow or Page Speed.