Wednesday, October 23, 2013

Installation instructions for Quarto on OSX

I was trying out Avdi Grimm's Quarto a week or so back for ebook generation. The toolchain looks very promising, but has a few dependencies that need to be installed before you can start publishing. These are listed in the README.

Here's a quick guide in getting those installed on OSX (Mountain Lion). Note I already had the following setup:

  • Git
  • HomeBrew
  • pygentize
  • xmllinit

Command line instructions:

The big one here is to ensure ~/.cabal/bin is in your path when you run the rake task to publish.

Tuesday, October 8, 2013

Vendoring Binaires on Heroku: An Example with Aspell

Recently I needed to install the Aspell library on Heroku for a side project. By default a Heroku Dyno doesn't include any non-essential libraries so your left to install these on your own. This introduced me to the world of buildpacks and an awesome build tool that Heroku provides to get the job done.


The objective is to have a Rails application running with FFI::Aspell, a FFI binding for the Aspell library on Heroku.

Heroku Buildpacks and Vendoring Binaries

First, we need to configure Heroku to vendor binaries. The easiest way to do this is use the Vendor Binaries buildpack which allows you to extract a tarball stored on S3 into your /app directory when the application build process is triggered. This is all configured in a .vendor_urls located in the root of your application.

As Heroku only supports a single buildpack by default, we need to configure it to support multiple buildpacks. In our case, we need the Ruby buildpack in addition to the Vendor Binaries buildpack. Fortunately this is relatively easy to do when we create our new application (and can be done after the fact as well):

heroku create --stack cedar --buildpack

Now we have our multi buildpack application, we can configure those buildpacks in .buildpacks:

For our vendored binaries, although we haven't built it yet, we can configure it's location on S3 in .vendor_urls:

Commit both the .buildpacks and the .vendor_urls files to your Rails application.

Build the binary

Next we need to build the binary. First, let's download and extract the source into a temporary working directory (not in your Rails application).

mkdir ~/Code/temp && cd ~/Code/temp
curl -o aspell-
tar -xvzf aspell-

Now, let's create a build server on Heroku. The Vulcan gem automates the process of creating the server and building the library.

gem install vulcan
vulcan create vulcan-yourname

Now we're ready to build the binary:

vulcan build -s ~/Code/temp/aspell- -p /tmp/aspell -c "./configure --prefix=/tmp/aspell && make install"

You will notice that we configure the library to be installed in /tmp/aspell using the prefix option. We also need to tell Vulcan using the -p option where the compiled library will be located. At the completion of the build, a tarball is then download to your /tmp directory.

You can now copy the tarball from /tmp/aspell-0.60.6.tgz to the S3 bucket specified in .vendor_urls. Ensure the read permission on the uploaded file can viewed by "world", otherwise it won't be accessible when you deploy your application and you will receive the following errors:

-----> Found a .vendor_urls file

gzip: stdin: not in gzip format
tar: Child returned status 1
tar: Exiting with failure status due to previous errors

 !     Push rejected, failed to compile Multipack app

Build the supporting dictionary files

Typically we would be done at this point, but we need to compile the dictionary files that Aspell uses separately. This makes the process a little more complicated.

We're going to use our Vulcan build server to compile the dictionary files. This requires starting up a shell, downloading the Aspell tarbar we built previously and extracting it into the original installation directory.

heroku run bash --app vulcan-yourname
cd /tmp
mkdir aspell && cd aspell
curl -o aspell-0.60.6.tgz
tar -xzvf aspell-0.60.6.tgz

Now we're ready to build the dictionary files:

export PATH=$PATH:/tmp/aspell/bin
curl -o aspell6-en-7.1-0.tar.bz2
tar -xvf aspell6-en-7.1-0.tar.bz2
cd aspell6-en-7.1-0
./configure && make install

At this point you will see output similar to this:

/tmp/aspell/bin/prezip-bin -d < en-common.cwl | /tmp/aspell/bin/aspell  --lang=en create master ./en-common.rws
/tmp/aspell/bin/prezip-bin -d < en-variant_0.cwl | /tmp/aspell/bin/aspell  --lang=en create master ./en-variant_0.rws
/tmp/aspell/bin/prezip-bin -d < en-variant_1.cwl | /tmp/aspell/bin/aspell  --lang=en create master ./en-variant_1.rws
/tmp/aspell/bin/prezip-bin -d < en-variant_2.cwl | /tmp/aspell/bin/aspell  --lang=en create master ./en-variant_2.rws

Once the build is completed you can test Aspell is working correctly with:

echo "helloz" | aspell -a

We're almost there. Now just copy the dictionary files over to our original build for Aspell in /lib/aspell-0.60/ We will create a new tarball which includes the dictionary files:

cp *.rws *.alias *.multi *.dat ../lib/aspell-0.60/.
cd ..
tar -czvf aspell-0.60.6.tgz bin include lib share

Finally, transfer the new tarball aspell-0.60.6.tgz to your local machine and upload to S3 again replacing our original tarball.


Before deploying you will need to configure LD_LIBRARY_PATH, the path used by the dynamic loader to load libraries into dynamically linked executables. Otherwise, the following error is raised:

aspell: error while loading shared libraries: cannot open shared object file: No such file or directory

This is easy to do:

heroku config:add LD_LIBRARY_PATH=/app/lib

Now let's deploy our application. Remember to include the FFI::Aspell in our Gemfile and bundle. As long as you have your application setup correctly with Heroku you can then:

git push heroku

On a successful build your output will begin with the following (note the vendoring of

-----> Fetching custom git buildpack... done
-----> Multipack app detected
=====> Downloading Buildpack:
=====> Detected Framework: VendorBinaries
-----> Found a .vendor_urls file
=====> Downloading Buildpack:
=====> Detected Framework: Ruby/Rails
-----> Using Ruby version: ruby-2.0.0
-----> Installing dependencies using Bundler version 1.3.2
       Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin --deployment
       Fetching gem metadata from
       Fetching gem metadata from
       Installing rake (10.1.0)

Test the FFI::Aspell Gem

The moment of truth! Let's run a Rails console to test the FFI:Aspell gem.

heroku run console

At the Rails console:

speller ='en_US', 'dict-dir' => '/app/lib/aspell-0.60')
speller.correct?('cookie') # => true

Note we need to specify the dict-dir option since the Aspell library looks for it in /tmp/aspell/lib/aspell-0.60 by default (based on the prefix option we used when we compiled it). If you were to execute the binary directly from the shell you would also need to include this option. For example:

echo "helloz" | aspell -a --dict-dir /app/lib/aspell-0.60

If you don't include the dict-dir option, the FFI:Aspell library will crash.


If you have problems, it best to try to run the Aspell library directly from the shell using the example command above.

If you receive the following error:

Error: No word lists can be found for the language "en_US".

Then the path to the dictionary files is not correct.


Talk: Meet Trello

A couple of months ago I gave a presentation on Trello for a lunch and learn at Dynamo. Trello is a collaborative project planning tool that I was trying out at the time. This presentation shares my findings on how to use Trello for project management in an agile development context. Enjoy!

Meet Trello from DynamoMTL on Vimeo.

Monday, October 7, 2013

Recently Launched: Quarterly Co.

My last project at Dynamo involved the porting of a Rails application integrated with Recurly to Spree for Quarterly Co., an LA-based company. Quarterly is a subscription service, curating gifts by their selection of contributors shipped every three-months. Check out this beautifully written blog post written by Quarterly's founder, Zach Frechette, describing why he started Quarterly.

Key Objective

The key objective for this project was to move from their current model of billing their subscribers every three-months, to billing when a curated gift is shipped. Moving to this model also required some solid order management that their current application didn't provide. Spree, an open source e-commerce platform, was the chosen as the foundation for Quarterly's online business.

Technical Challenges

There were some interesting technical challenges for this project that included:

  • Customizing Spree's "Product and Order"-based data model to support subscriptions.
  • Migrating subscription data from two data sources, Recurly and the custom Rails application.
  • Migrating an existing design to Spree's opinionated checkout flow.

Check out the screenshot's below or visit the site, you might find a contributor that you want to subscribe to. Treat yourself!

(A shout out to Rodrigo Dalcin, a Front-end Developer at Dynamo, who worked porting the front-end to Spree for this project. Thank you for all your help!)

Home Page

Home Page

Contributor's Page

Contributor's Page

Rails: undefined method `action' for YourController:Class

You will receive this error if you have created your controller class manually (i.e. without the Rails generators) and have not inherited from ApplicationController. For example

This is easily fixed by adding ApplicationController as the parent. Note the change on line #1.

Saturday, July 20, 2013

mysql2 installation issues on OSX 10.8.4 (homebrew install)

Installing mysql2 Ruby gem on 10.8.4 with a home-brew install may raise the following error:

mysql.h is missing. please check your installation of mysql and try again.

Removing the following options from cflags in mysql_config vim `which mysql_config` resolved the issue:

-Wno-null-conversion -Wno-unused-private-field


Friday, June 7, 2013

June Developer Challenge: Share the Knowledge

Note: This was originally posted to the Dynamo Blog.

Last month we leveled-up with Crush Your Achilles’ Heel. This month, it’s about helping your team members level-up with “Share the Knowledge”. This month’s focus is about sharing knowledge with your team mates. After years as a solo freelancer, one of the great joys I now experience working with a team, is the learning gained from my team members. I also love sharing what I’ve learned. However, we need to be proactive about sharing to allow others to benefit.

This month, your challenge is to take what you learned from last month’s challenge, and share it with your team members. At Dynamo, we have a number of avenues for sharing information with others. These include:

  • Workshop Wednesdays: Lunch-time sessions for presentations and discussions
  • Dynamo Central: A wiki hosted on GitHub to share process and procedures
  • Dynamo Blog: This blog to share with the greater design and development community
  • Dynamo Retreat: A yearly event to review what’s working, and what’s not

So choose something valuable from last month’s challenge to share. If you didn’t complete the challenge, I’m sure you have something else. Do you have a checklist or procedure documented in your notebook? Do you have a process that you’re benefiting from, but no one knows about it? I encourage you to share this knowledge as a presentation, a blog post, or simply as a checklist on the wiki.

Your Developer Challenge for the month of June has been issued! Please let us know what you attend to share this month in the comments below.

Tuesday, May 7, 2013

Ron Jeffries on Requirements

This is one of my favourite quotes on requirements:

Most of us were taught to write down all our requirements at the very beginning of the project. There are only three things wrong with this: “requirements,” “the very beginning,” and “all.” At the very beginning, we know less about our project than we’ll ever know again. This is the worst possible moment to be making firm decisions about what we “require.”

From Estimation is Evil, Ron Jeffries: Signatory of the Manifesto for Agile Software Development 

Monday, May 6, 2013

May Developer Challenge: Crush Your Achilles' Heel

Note: This was originally posted to the Dynamo Blog.

We all have it. It’s that gap in our knowledge that slows our development down. It’s your Achilles’ Heel. Every day we use the same tool, but we’re never really take the time to understand the fundamentals of how it works. This might be Git, SQL, or Regular Expressions. It might be a concept that we struggle with, but have never said, “OK, I need to dedicate some time to really understand this”. So this month, it’s time to crush it.

Inspired by RailsConf talk ”Nobody will Train You but You” from Zach Briggs, your challenge for the month of May is to identify a weakness in your development knowledge, and proactively train yourself in that area. Since the beginning of the year, I have been proactively addressing weakness in my development knowledge. Here are examples:

  • SQL: After years of working with Rail’s ORM, ActiveRecord, I felt my knowledge of SQL beginning to wane. I went back to basics and completed Standford University’s course on databases. After this course, I had cleared out those SQL cobwebs, and back to feeling comfortable working at the SQL console again.
  • NewRelic: Normally I use NewRelic in periods of stress, trying to resolve a performance issue. This means revisiting and learning the UI while I’m trying to solve a problem. By dedicating two afternoons to reading the documentation and reviewing a live application’s metrics, I feel much more prepared to dive in when there’s a performance fire.
  • Performance Optimization: I’ve addressed performance in an ad-hoc manner in the past. To resolve this. I have dedicated time to review various resources on performance including the Scaling Rails series (which is developed a couple a few years ago, but still relevant). This resulted in a cheat sheet that I actively use to think about performance from day one.

But this challenge doesn’t end with passively reading a book or watching a screencast. It’s about reinforcing your knowledge by sharing with others. You really understand a topic, when you share it with others. So after spending the month learning, next month I encourage you to write a blog post, perform a workshop or write a test suite demonstrating what you have learnt.

So here’s the plan:

  1. Take the week to identify your areas of weakness. As you go through your day, write down these areas as you experience them.
  2. Pick an area at the end of the week to work on. At this point, you might want to consider how you will share your knowledge. Please share your topic in the comments below.
  3. Develop a plan on how you’re going to improve your knowledge. Don’t try to be too ambitious, keep your goals realistic. Think SMART.
  4. Work through your plan for the month.
  5. At the end of this month commit to how you would like to share your knowledge. We will prepare to share our knowledge in the month of June.

OK, your Developer Challenge of the month of May has been issued! Please don’t forget to share your topic in the comments below. Good luck with crushing your Achilles’ Heel.

Saturday, April 27, 2013

Task Lists in Our Pull Requests

Note: This was originally posted to the Dynamo Blog.

Since we have been using Pull Requests to drive development over a month or so now, GitHub Task Lists have been an important component. Personally, I have been using them to document my initial thoughts/brainstorming on tasks required to complete a feature and the whole team have been using them pervasively. They also have an impact on issues (from the GitHub post):

You can use task lists to break down large issues and discourage the creation of many microscopic issues, allowing you to focus on interacting with the list instead of editing Markdown.

A Task List can be created in PR comments using GitHub Flavored Markdown. Here’s an example of a Task List from a project I’m currently working on:

Task List Example

And they are easily created with a bit of Markdown:

Markdown Example

Oh, and a power tip: pressing ‘M’ on the keyboard will display a Markdown cheat sheet.

How are you using GitHub Tasks Lists? Let us know in the comments.

Friday, April 26, 2013

Recently Launched: Tarkett Sports CMS and Websites

An ongoing project I have been working on at Dynamo over the last year with Hugo Frappier is a custom CMS for Tarkett Sports, a division of the Tarkett Group, "a worldwide leader of innovative and sustainable flooring and sports surface solutions".

A multi-Site, multi-lingual CMS

Tarkett Sports required a multi-site, multi-lingual CMS to serve all the sites of their subdivisions. FieldTurf (North America) was the first to be launched on the new platform, followed by FieldTurf Europe and an API for their iPad sales tool, "Link". At the time of writing, Beynon Sports Surfaces and Tarkett Sports Indoor (North America) are set to launch within the month.

Built on Ruby on Rails and MongoDB

The CMS was built with the usual Rails stack, however MongoDB was used with Mongoid, an Object-Document-Mapper, instead of ActiveRecord and a relational database. This was my first venture in the world of NoSQL, and working with a schema less data store was a perfect match for the CMS. However, it did require a new way of thinking, such as being comfortable with de-normalizing data structures and ensuring those data structures can be properly index. For example, MongoDB does not allow indexing of parallel arrays.

Support a large content-base

Why a custom CMS? Why didn't we just use one of the prominent offerings such as RefineryCMS? I've implemented five RefineryCMS installations over the last couple of years, and Refinery's sweet spot is small websites. Tarkett Sports currently holds over 10,000 content items. Refinery's UI and tree data structure is just not appropriate for such a large content-base.

Publish content collections anywhere in the page hierarchy

We also took a novel approach to the page hierarchy. With platforms such as RefineryCMS and Radiant, structured content (think news and product catalog) containing large data sets are typically supported by creating custom Rails model view, and controller classes. There's usually wrangling to unify the site URLs with the routing system. The Tarkett Sports CMS supports the concept of a collection. A collection of structured content, small or large, can be published anywhere within the page hierarchy. No URL wrangling required, no custom controller class. Collections are a first class citizen.

Reduce custom classes, increase content type re-use

The benefit of all this is that it has reduced the number of custom classes required for a site by increasing the reuse of existing collections and content types. In the past, I have found myself creating custom controllers and models just to support a different content type with the same structure just so I can use it in a different part of the page hierarchy. The concept of publishable collections has solved this.

Below are a few screen shots, showcasing the different sites and portions of the administration screens.

FieldTurf (North America) Home Page

FieldTurf (North America) Home Page

FieldTurf (Europe) Home Page

FieldTurf (Europe) Home Page

FieldTurf Products

FieldTurf Products

FieldTurf Product Detail

FieldTurf Product Detail

Tarkett Sports CMS Admin: Pages

Admin Pages

Tarkett Sports CMS Admin: Page Detail

Admin Page Detail

Tarkett CMS Sports Admin: Page Publishing

Admin Page Publishing

Monday, April 22, 2013

Open Gems with vim-bundler

When working with platforms such as Spree and RefineryCMS it's more than likely that I will be extending their models more often that not. This means opening the Gem to identify a specific behaviour I want to override. Vim is my text editor of choice, and I typically try to restrict my self to one instance of the editor running. It makes working with multiple buffers a lot easier! Whenever I want to open a Ruby Gem, it always irks me that I have to open another instance of the editor, in a separate window/pane (although Tmux reduces the pain of this a wee bit).

Vim does offer a client-server option, but admittedly I couldn't get this working and in my search I came across Tim Pope's vim-bundler. From the README:

An internalized version of bundle open : :Bopen (and :Bsplit , :Btabedit , etc.).

Exactly what I wanted, a way to `bundle open` within Vim. Here's a quick demo of using vim-bundler to open Spree's `Order` model and navigate to the `add_variant` method.

vim-bundler from Nicholas Henry on Vimeo.

Tuesday, April 16, 2013

Creating Dedicated, Focused Time

Note: This was originally posted to the Dynamo Blog.

Working on multiple projects in a single day has a mental cost and less efficient than dedicating time to a single project. Segmenting the week to work on a specific project and allocating time for the unexpected is one possible solution for reducing the cost of context switching.

Yesterday we had a terrific conversation in our weekly project mini-retrospective about the cost of context switching in the studio. This is a problem that any service-based company with multiple clients has, but it’s a tough problem specifically when providing creative services. At Dynamo, we’re working on engaging problems, which require dedicated, focused time to solve.

However, during the day we might be working on multiple projects, and there are maintenance tasks competing for our attention. So how might we reduce the context switching to create dedicated, focused time?

Our solution has four components:

  1. Segment the week to dedicate specific days to a project, depending on the velocity required.
  2. Assign a dedicated day to work on maintenance. This is planning for the unexpected, and the unexpected always happens.
  3. Publish your schedule. Let your team members and project managers know what days you have assigned.
  4. Project managers will be mindful of these assigned days.

The last component is the key. When project managers know the maintenance day of the project’s maintainer, then expectations can be appropriately set with the client when a maintenance task can be completed.

Of course, emergencies and rush tasks are always going to arise. But, in reality these are rare. So I plan to put this into practice, and I will let you know how it goes. How do you reduce the context switching to create dedicated, focused time? Let us know in the comments.

Tuesday, April 9, 2013

Taming the pile of unread books

Recently I posted to Facebook:

You know you have a book buying problem when... you discover that you have two copies of the same book on your bookshelf. Unread.

Yes, I have a book buying problem. And after that post I decided it was time to do something about it. I love reading. I find it extremely motivating and inspiring. But having a few dozen unread or partially started books is not only a waste of money, but just another open loop in my life that just doesn't need to be there. Jumping from book to book also inhibits in my ability to really understanding a book.

And before you start thinking I'm talking about a pile of trashy romance novels, I am talking about computer and business related books!

So how did it get this way?

I have always had a stack of unread books around, but I typically got through the queue. However, with eBooks it really has got out of control. I start with reading an inspiring blog post, or watching a video of a conference talk, it references a book and wham! Next moment, I'm online purchasing that sucker.

So what have I done to resolve this?

It was pretty simple really. I present to you, my three step plan:

  1. First, I took inventory. I identified the books as unopened, "briefly" started (read a few chapters), and "well" started (at least half way through).
  2. For those that were briefly started, I removed bookmarks, virtual or physical, and added them to the unopened pile. Basically, calling bankruptcy on the "briefly" started. This cleared a lot of open loops. A lot.
  3. With the "well" started books I recorded them in OmniFocus. This has helped me to keep conscious of how many books I have on the go. This ended up being four in total. The goal is to have no more than two in progress.

Since starting this two weeks ago, I have completed one book, and will finish the second this week. I will be at my goal of two in progress. Oh, and I haven't bought any new books in the last two weeks -- there have been a couple of occasions where I would have.

Book Queue in OmniFocus

Yes, I know this all sounds pretty ridiculous. However, I bet I'm not the only developer out there, with a book addiction. If you are, please let me know in the comments, how you have curbed your book buying behaviour, or please give my recovery plan a go!

Friday, April 5, 2013

April Developer Challenge: Feature Development With Pull Requests

Note: This was originally posted to the Dynamo Blog.

This month’s Dynamo Developer Challenge has been inspired by our own Daniel Wright—more about that in the moment.

In a nutshell, for the month of April we will be experimenting across the studio with using Pull Requests to develop a new features. We are moving beyond simply using them as a Code Review tool, as we have in a past challenge.

Over the last few months, Daniel has been religiously using Pull Requests to push new features. As I’m a bit of GitHub stalker I love seeing this, as it gives me a chance to provide feedback on commits and putting Code Reviews into practice. However, these Pull Requests were created once the feature was deemed “done.”

After viewing Zach Holman’s slides from a talk titled GitHub: Behind the Feature, Daniel began creating Pull Requests at the start of a new feature. And I’ve been impressed by what I have seen so far! But I don’t want to get a head of myself; I’ll share some observations at the end of this challenge.

So, how does this all work?

Here’s some steps, based on the write-up Daniel did for his current project:

  1. Choose a feature to implement, and create a new Git feature branch for it.
  2. Once you’ve selected your feature to work on, you’d create a new branch for it: git checkout -b features/your-new-feature
  3. Now do a very small amount of work, just enough that you can commit it. For example, you might create the view-template you’re going to use (e.g. app/views/pages/about.html.haml).
  4. Now commit it! git add . && git commit -m "Adds about page template"
  5. Push your branch up to GitHub: git push -u origin HEAD
  6. Finally, visit the project page on GitHub and create the pull request. Since you just pushed the branch, the project’s landing-page should prompt you to create the pull request. Give it a descriptive title, and describe what you’re planning to accomplish with the PR. For a simple integration job, this should be fairly straightforward, but you can be as descriptive as you like.
  7. Submit the pull request!

So, the April challenge has been posted for our Dynamo-Devs, but we encourage you to join us too. Are you up for the challenge? Please share you experiences in the comments along with our team’s.

For a little more background on this development strategy, checkout the slides below:

Thursday, April 4, 2013

Developer Challenges: Helping Us to Improve Our Craft

NOTE: This was originally posted to the Dynamo Blog.

We’re sharing an initiative that we’ve been experimenting off and on over the last year called “Improving Your Craft”, a.k.a Dynamo Developer Challenges.

These began as weekly challenges to help the team members and the team as a whole to improve development practices and increase developer happiness. Admittedly, when I was first driving this initiative, I was infrequent in posting these challenges, and the weekly schedule was a little too ambitious. Based on feedback from the team, we reduced the frequency to a monthly schedule, and I’m more disciplined in posting challenges each month—a calendar reminder really helps!

Here are some examples of the challenges posted to date:

  • Self-Directed Morning Code Review
    Inspired by Jason Fried’s post Morning tells the truth, this challenge asked developers to review their commit log from the previous day as a self-directed code review.
  • Pull Requests for Code Reviews
    This time it was Zach Holman’s talk How GitHub Uses GitHub to Build GitHub. The driver for this challenge was to encourage developers to review each others code, pollinating knowledge across projects. If you’re not currently using pull requests, GitHub has some great documentation on the topic.
  • In-Person Peer Code Reviews
    As an extension to the previous challenge, developers were asked to sit down with a peer for a 30-minute code walkthrough. It’s amazing how much the author of the code learns by just walking someone else through it.
  • Automation
    A final example was encouraged developers to start thinking what they can do to optimize their workflow. Too often we run the same set of commands everyday, when a simple shell alias can save us from repetitive typing or making a time-consuming mistake.

Hopefully this gives you a feel of the type of challenges that the team has been working on. And we would love if you joined us! Previously, these challenges have been posted to our Basecamp account, but we will now be posting them to the blog. I encourage you to share your experiences in the comments and the team will be sharing their as well, either as comments or blog posts (hint, hint!).

Although I’m a little late this month for April’s challenge, please be on the lookout tomorrow.

Please note this blog is no longer maintained. Please visit CivilCode Inc.