Posts By Skye

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:

  1. OpsWorks doesn’t currently handle single-cookbook repositories correctly.
  2. 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] 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 vsprintf()}, or the first variable to substitute into the query’s placeholders if being called like {@link 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->get_col($wpdb->prepare("SELECT post_author FROM " . $wpdb->posts . " WHERE ID = " . intval($postID) . " LIMIT 1");

// New (two argument) function call
global $wpdb;
$authorIDs = $wpdb->get_col($wpdb->prepare("SELECT post_author FROM " . $wpdb->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)

Cure for your iPad’s Safari Slowness Blues

My iPad 2 has been serving me well for a year and a half but I recently noticed it getting sluggish.  More specifically, using Safari became like pedaling in hummus.  Opening a new tab or selecting the Search or URL bar seemed to be consistently taking two or three seconds.  I resigned myself to life like this for a while until I accidentally clicked the double arrow on the right side of the OS X Safari’s Bookmarks Bar.

The bookmarks grow fast when all you have to do is hit Command-D

Having too many links in the bookmarks bar will wreak havoc everywhere if you’re syncing over iCloud

It took a few seconds for my laptop to display all the entries.  At that point I reasoned that my bookmarks, synced via iCloud, were causing the sluggishness.  A trip to the Bookmark Manager showed that there were roughly 700(?!?!) first level items in my Bookmarks Bar, along with a dozen or so nested folders with a few hundred more items.  I dragged nearly everything in to the Bookmarks Menu and it instantly solved the problem.  I opened the iPad and the problem was indeed solved there as well, all was lightning quick again.  Interestingly enough, the ‘normal’ bookmarks menu in both the OS X and iOS versions of Safari seem to have no trouble with a large quantity of links.

TL;DR – Too many links in the Safari Bookmarks Bar slows everything down.

Getting NSNumberFormatter to Display Currency

When working on a little cocoa app today, I ran in to a somewhat perplexing problem where I could not get currency-formatted values to display in my NSTableView.  Using interface builder to add a number formatter to my text field and set the style to currency, I set the text value and… nothing.  Turns out that the formatter only wants double values, so use double values :)

BitCoin, Now Accepted by WordPress

Just saw an interesting post on the official blog that they are now accepting payment in BitCoin.  Interesting.  This definitely brings the technology a huge step closer to legitimacy (and much-needed public debate) and comes right on the heels of an article this week that made mention of Reddit looking into accepting BitCoin for its Gold accounts.

Betaville Media Coverage

Since the BBC published an article on Betaville last week, we’ve gotten a good bit of Media coverage.  Some pieces have just been snippets of the original BBC piece while others have really explored the ideas behind Betaville and provided genuine reflection; Cool stuff!  I was invited to give another interview about the project last week, this time to The Metro (London).  This morning I was greeted by their article and figured it was probably time to put links to a few of these articles in the same place.

PostgreSQL 9.1 Remote Access

Concise instructions for setting up remote access to a fresh PostgreSQL 9.1 installation on Ubuntu 12.04 because I’m tired of googling every other month for it.

In /etc/postgresql/9.1/main/postgresql.conf

listen_addresses = '*'

And in /etc/postgresql/9.1/main/pg_hba.conf:

host    all     all      md5

Note that this is horribly insecure, letting any user connect to any database.. It’s just an example.

Finally, restart Postgres.

sudo service postgresql restart

BBC Article on Betaville

I mentioned a few weeks ago that I had been interviewed by the BBC about Betaville.  I was wondering if – and when – anything would come of it until yesterday when I was told that it was featured in the BBC Technology section.  I’m incredibly humbled that people are not only taking the work we did seriously, but that it is empowering people to be proactive in changing the world around them.

Although not mentioned in the article, I want to thank all of the past contributors (Google Code, Github) who have put something of themselves into Betaville.