• Flipboard

    In case you missed it, Ultravisual got acquired by Flipboard. We’re extremely excited to bring the knowledge born of hard-fought battles to a product and team that we greatly admire. I’m fortunate to have had the opportunity to create something awesome with the best people over the last few years and am looking forward to what comes next.

  • Cassandra 2.0.0 Package and Ubuntu

    I tried giving Cassandra 2.0.0 a whirl tonight by installing the dsc20 package from the DataStax Community repository but found that Cassandra would not start due to incompatible class files.  The error you’ll see in output.log looks something like this:

    CassandraDaemon : Unsupported major.minor version 51.0

    If you’ve done much in Java you’ll probably recognize that this is a version inconsistency and, sure enough, you need Java 7.  The dsc package doesn’t seem to specify this (and the opscenter-free package actually depends on java-6-jre-headless if you apt-cache show the package.

    To solve this you’re going to want to install Java 7 and update your configuration to set it as the default.

    sudo apt-get install java-7-jre
    sudo update-alternatives --config java

    The update-alternatives command will prompt you to choose which Java you’d like to use. After all this, give starting Cassandra another go and you should be all set.

    sudo service cassandra start
    sudo service cassandra status
  • AWS OpsWorks CookbookNotFound on Custom Repositories

    Since Amazon began offering OpsWorks earlier this year, I’ve been looking forward to giving it a go and picking up some Chef know-how in the process. I have come upon a rather painful issue where a single cookbook in my git repository’s root continuously threw Chef’s CookbookNotFound exception. After hours of futile trial and error and a heap of Googling I finally happened upon this thread in the AWS forums.

    The important takeaways are:

    • OpsWorks doesn’t currently handle single-cookbook repositories correctly.
    • Putting your cookbook in a subdirectory of the git repository should work.

    I suppose this explains why all of Amazon’s example cookbooks are parented under the same repository! To avoid this insanity in the future, you may as well just create the cookbook in a subdirectory of a git repository to begin with.

    mkdir my_app_cookbook
    cd my_app_cookbook
    git init
    knife cookbook create my_app -o ./
  • Great Find for Pretty JSON in Safari

    I finally got tired of going to the [really, really awesome] pro.jsonlint.com and decided to have a quick look for a Safari plugin. Sure enough, in about 6 seconds of searching, I found this safari-json-formatter on GitHub. Its advertised for Safari 5 but installs without issue and works great on Safari 6. Thanks, Rick Fletcher!

  • WPDB::Prepare Warning in WordPress 3.5

    I just today upgraded the jMonkeyEngine site to WordPress 3.5 and noticed that one of our plugins was causing errors.  The exact error looks like Missing argument 2 for wpdb::prepare().  Looking at the wp-db.php file that ships with WordPress 3.5, we can see that there is indeed a second argument and it is documented as an array for options:

    @param array|mixed $args The array of variables to substitute into the query’s placeholders if being called like
    {@link http://php.net/vsprintf vsprintf()}, or the first variable to substitute into the query’s placeholders if being called like {@link http://php.net/sprintf sprintf()}.

    Cool, so let’s change the code that calls the prepare method to have an empty array as a second argument:

    // Old (single argument) function call
    global $wpdb;
    $authorIDs = $wpdb-&gt;get_col($wpdb-&gt;prepare("SELECT post_author FROM " . $wpdb->posts . " WHERE ID = " . intval($postID) . " LIMIT 1");
    // New (two argument) function call
    global $wpdb;
    $authorIDs = $wpdb-&gt;get_col($wpdb-&gt;prepare("SELECT post_author FROM " . $wpdb-&gt;posts . " WHERE ID = " . intval($postID) . " LIMIT 1", array()));

    If your queries were previously working, they will indeed continue to wok with the addition of this simple fix (though you may want to investigate using the functionality provided by WP in this new functionality)