Check it out at http://skorage.org/2009/03/08/simple-thrift-tutorial/