Notes from Michael Wynholds

Introducing Presto

By on in Everything Else

Note: If you’re looking for information on Houdini or Toggle, you’re in the right spot. After changing the project name from Toggle to Houdini (for SEO reasons), we’ve switched again (there was another Houdini already). If you know of another language called “Presto” please let us know, we’ve got more names.

At Carbon Five we pride ourselves in crafting amazing web experiences using the best tools and technologies available. Over the years we’ve tried basically every language and framework combo there is. Java & Spring, Ruby & Rails, Python & Django, JavaScript & Node, Go & ??, C# & ASP.NET (OK, not that one), and even Perl & PHP (or that one).

Over the years we’ve noticed that it seems like every day, all day, all our fancy code boils down one basic thing: showing and hiding DIVs. That’s it. Send a bunch of DOM to the browser, then toggle those DIVs on and off. Logged in? Show a DIV. Logged out? Hide a DIV. Click a tab? Yup, another DIV.

So, we’ve gone and done it. We wrote our own language, Presto. And Presto is all about showing and hiding DIVs. Fast. How? Read on. It’s like magic.


Continue reading …

Bash-pocalypse 2014!

By on in Everything Else

Hopefully by now everyone has heard about the Bash remote execution vulnerability, and is sufficiently terrified. We here at Carbon Five all use Macs, and so we are all by default vulnerable. Here are the steps we took to secure our computers. Maybe they can help you too.

Continue reading …

Agile for Startups

By on in Process

A couple of weeks ago I gave a presentation entitled Agile for Startups to the companies in Startup UCLA, a startup accelerator program run by UCLA. I actually gave this talk a week after my colleague Lane Halley presented her talk to the same group.

Agile for Startups from Michael Wynholds

The talk went well, and I think it was well received. The content is targeted at folks, both hackers and hustlers, who don’t have any experience with Agile techniques. I tried to focus on techniques that can have immediate value to startups.

Here is a summary of the eight techniques I described:

Continue reading …

Raking and Testing with EventMachine

By on in Development, Process

I have been getting more and more interested in high-performance Ruby apps, and in EventMachine in particular. First of all, super props to Aman Gupta for EM, and to some other Ruby devs out there who have been writing libraries and drivers on top if it, such as Ilya Grigorik, and Carbon Five’s own Mike Perham.

However one area that has not gotten a lot of attention within the EventMachine world is that of testing and tools support. It would be ideal for evented codebases if all tests and all rakes were automatically run inside an EventMachine reactor. I realize that many of the EM-enabled libraries out there, like mysql2, work whether they are in a reactor or not, so this may seem unnecessary. But this means that your tests are exercising a different code path than your production app, which is a bad idea.

So how can we get our tools running within EventMachine?
Continue reading …

Database migrations for Cassandra with ActiveColumn

By on in Development

We at Carbon Five are pleased to announce the release of ActiveColumn – an object mapping framework for Apache Cassandra. Currently at version 0.1.1, this gem is young but functional with its first major feature of data migration support.

Prior to Cassandra 0.7, keyspaces and column families had to be maintained by hand in a configuration file. But starting with version 0.7, these are managed through Cassandra’s Thrift API. ActiveColumn uses this new functionality to deliver data migrations similar to ActiveRecord.

ActiveColumn gives you several tools to help you with your Cassandra data migrations:

  • A Rails generator for creating migration files
rails g active_column:migration CreateUsersColumnFamily
  • Several rake tasks for creating and migrating keyspaces
rake ks:create
rake ks:drop
rake ks:migrate
rake ks:rollback
(and more)
  • Some useful data management functions to use within migrations
class CreateUsersColumnFamily < ActiveColumn::Migration

def self.up
create_column_family :users

def self.down
drop_column_family :users


The gem is pretty well documented on github, so take a look there for further details.

We hope that you find ActiveColumn useful in your Cassandra project. We are dedicated to keeping it under active development, so check back for further updates, give your feedback below, or jump on the project on github and help drive it forward.

Next up: timeline-based data mapping and querying!

Cassandra and Rails talk at LA NoSQL meetup

By on in Everything Else

Last week, Mike Wynholds presented at the inaugural Los Angeles No SQL meetup. The movement to these non-traditional data storage systems has exploded in the last year, and we had a chance to use Cassandra in one of our client’s projects. Cassandra is a column based datastore developed within Facebook, and open-sourced as a top-level Apache project. It is being used by its creators as well as Digg, Twitter, Reddit, Rackspace, and many others. For the meetup, our presentation covered what is Cassandra’s structure, how we used it, the challenges we faced, and the lessons learned. You can watch the presentation below, or you can grab the presentation with this PDF, and from its original Keynote file. And feel free to ask questions and leave comments below!

Evernote for the Palm Pre

By on in Everything Else

The Pre, an innovative next generation smartphone from Palm Inc., recently launched with much fanfare. Access to the WebOS SDK was limited to a few select partners including Evernote, maker of a web, mobile and desktop applications for capturing and finding our memories, notes and inspirations.
The Pre and the app are getting a good amount press from tech heavyweights like lifehacker and ZDnet.
We worked with Evernote to develop the first release of Evernote for the Palm Pre using this new platform.

Dojo drag and drop gotcha in IE

By on in Everything Else

I have been working on a web app for one of our clients that includes a pretty interactive AJAX / Web 2.0 component within it. This component is essentially a simplified drag-and-drop book publishing tool, which allows users to upload images and then to arrange them on predefined templates in order to create a book.

We chose to use the Dojo Toolkit (version 0.4.2) for both the AJAX (ie: remote calls to the server) and the Widegtry side of the Web 2.0 style. It’s been working fairly well. Dojo has a lot of functionality, but also has a few areas that still need some refinement. The most interesting / infuriating to me so far has to do with Dojo drag-and-drop functionality within IE.

Dojo’s facility for drag-and-drop is essentially composed of three components:

  • Drag-and-Drop Manager
  • Drag Sources
  • Drop Targets

It intuitively makes a lot of sense. You create drag sources and drop targets and out of the box they actually work pretty well. Dojo uses a form of JavaScript inheritance to allow you to create drag copy sources or drag move sources, each of which have different behaviors. You can also reassign specific functions on your drag sources or drop targets in order to customize their behaviors.

I developed and debugged the app in Firefox and Firebug, as we all do. But when it came time to check that everything works in IE, I ran in to one bug in particular that stumped me for two entire days, and frustrated me to no end. At a certain point in using the app, my ability to drop objects on their drop targets was broken. It only happened in IE (I was using IE 6 for Windows), and the error I got was the always helpful “Unexpected error”.

What I found was that the following code, which creates a drop target, also registers the drop target with the Drag and Drop Manager.

var imageTarget = new dojo.dnd.HtmlDropTarget(imageDiv, ['galleryImages']);
imageDiv.imageTarget = imageTarget;

As a matter of fact, the Drag and Drop Manager, which is a global singleton, keeps a registry of all drag sources and drop targets created. Later on in the flow of my application, some of these drop targets need to be re-rendered, and to do so I actually delete the DOM node and re-create it, using the following code:


The destroyNode() function is supposed to be memory-leak-friendly. But after I have done that, and created a new drop target where that one once was, when I try to drop another drag source on to it, I get the “Unexpected error” exception in JavaScript. And again, this only happens in IE. Firefox works fine. I finally realized that, even though the drop targets are automatically (and outside my knowledge for a long time) being registered with the Drag and Drop Manager, they must be explicitly unregistered before they are destroyed, otherwise this error occurs. I added the following code to do so.


And now everything works perfectly!

DBUnit, HSQL and the BOOLEAN data type

By on in Everything Else

We have been using HSQL in-memory along with DBUnit for unit testing lately, and I found an issue using the most recent version of each. Basically, HSQL has added a new data type, BOOLEAN, which replaces BIT. But DBUnit is not updated to support this, and an error is throw when you attempt to insert some BOOLEAN data using DBUnit.

The error looks like this:

WARNING - TABLE.COLUMN data type (16, 'BOOLEAN') not recognized
and will be ignored. See FAQ for more information.

The solution outlined here is straightforward. You need to create a new data type factory that extends the DBUnit class DefaultDataTypeFactory. This new class just handles the SQL type Types.BOOLEAN as a special case. The code follows:

package company.project.test;

import org.apache.commons.logging.*;
import org.dbunit.dataset.datatype.*;

import java.sql.*;

public class HsqlDataTypeFactory
  extends DefaultDataTypeFactory
  private static final Log log = LogFactory.getLog(HsqlDataTypeFactory.class);

  public DataType createDataType(int sqlType, String sqlTypeName)
    throws DataTypeException
    if (sqlType == Types.BOOLEAN)
      return DataType.BOOLEAN;

    return super.createDataType(sqlType, sqlTypeName);

Then, in order to use this data type factory, just set a property on the IDatabaseConnection DBUnit object in your code (here is an example method):

  protected IDatabaseConnection getConnection() throws Exception
    IDatabaseConnection connection =
      new DatabaseConnection(dataSource.getConnection());
    DatabaseConfig config = connection.getConfig();
                       new HsqlDataTypeFactory());

    return connection;