wesley tanaka


MessagePack vs JSON vs BSON


Here is a benchmark of MessagePack vs JSON vs BSON in Python 2.7.3 in Ubuntu 12.04.4 LTS on a 2.5 GHz Intel Core2 Quad Q8300. The software used was:

Install python packages without root access using easy_install or pip


You can run easy_install to install python packages in your home directory even without root access. There's a standard way to do this using site.USER_BASE which defaults to something like $HOME/.local or $HOME/Library/Python/2.7/bin and is included by default on the PYTHONPATH

To do this, create a .pydistutils.cfg in your home directory:

Create MySQL hashed password for Puppet password_hash setting


To generate a password_hash for a MySQL user in the puppetlabs-mysql Puppet Forge module, run the mysql command line program and run the query SELECT PASSWORD('opensaysme'); where opensaysme is the password you want to use for the MySQL user. For example:

Switching from GoDaddy.com to Namecheap.com


Years ago, I registered a few domain names with GoDaddy under their cheap promotional pricing. Every year since, I've wanted to transfer my domains away from GoDaddy to avoid their jacked up renewal fees, but every year I'd procrastinate until the expiration date and, out of fear that the transfer would fail and I'd lose the domain names entirely, I'd end up searching online for a coupon, biting the bullet, and renewing with them.  Last year, I tried to switch to 1&1 but they did not support wildcard domain names, so I gave up.

Implied State Space Size


Consider these two if statements:

If statement #1

if (color == RED and has_thorns == TRUE)
  return "Roses are red"
else if (num_petals == 5)
  return "Violets are blue"

If statement #2

if (species == ROSE)
  return "Roses are red"
else if (species == VIOLET)
  return "Violets are blue"

The Architecture of Open Source Applications ePub download


You can download an ePub version of "The Architecture of Open Source Applications" (edited by Amy Brown and Greg Wilson) here.

The book is also available to read for free at http://aosabook.org/en/index.html under the Creative Commons Attribution 3.0 Unported license.

Using Eclipse with a Android project using the new gradle build system / project structure / layout


The Eclipse Android ADT plugin hard-codes paths for the AndroidManifest.xml file, the res directory and the gen directory.  If you migrate an Android project to the new Gradle project structure, it will stop working in Eclipse.  You can work around this by creating symbolic links from the new Gradle layout to the old locations expected by ADT.  For example, from the root of your project, if you have a android directory, you can run these commands:

WARNING: Class Joiner loaded from appengine.jar has a dependency which is not part of App Engine's supported API


Using optimizeWar = true in gradle-gae-plugin will cause it to run fatJarPrepareFiles and fatJar which expand all of your dependency .jar files into .class files and then re-combine them all into a single appengine.jar file. Depending on what you have in your dependencies block, this can sometimes cause:

bootstrap class path not set in conjunction with -source 1.6


Running a simple build.gradle file with sourceCompatibility = 1.6 with Oracle's JDK 1.7

apply plugin: 'java'
defaultTasks 'build'
sourceCompatibility = 1.6

repositories {

dependencies {
  testCompile 'junit:junit:3.8'

will cause this warning to be emitted by the JVM:

Upgrading Gradle to the latest version on Ubuntu


(Updated November 22, 2014)

Ubuntu 12.04.3 has an old version of Gradle (1.0-milestone-3 from September 2011) installed by default.  To upgrade to a later version of Gradle, you can use Cheng-Wei Chien's PPA for Gradle at https://launchpad.net/~cwchien/+archive/gradle by issuing the following commands:

sudo add-apt-repository ppa:cwchien/gradle
sudo apt-get update

Syndicate content
by Wesley Tanaka