Archive for the ‘’ Category

Finding the cheapest Amazon Store for English Books

Thursday, December 3rd, 2009

I tend to buy English Books at Amazon. Since I’m living in the Netherlands I usually would check, and to see which store could make me the best deal. Prices differ quite a lot and since exchange rates also have changed quite you can save quite a bit of money.

However that required quite some work because you have to take into account exchange and shipping rates.

Hence I decided to make a website that does this automatically


As I was always impressed with the concept of Google Web Toolkit (GWT) and AppEngine I decided to give that a try. It also was the first time that I programmed something more than Hello World in Java. Overall I have to say I’m very impressed with GWT and AppEngine

  • It has a very nice integration with Eclipse
  • You program both server side and client side in one language i.e. Java
  • You can debug both client and server side in Eclipse, step through the code, set breakpoint, inspect variables etc. Basically everything what you normally expect when debugging a desktop app
  • GWT makes sure that you don’t have to learn all quirks that different browsers have with javascript as GWT just compiles different versions for different browsers (You still you have to know the CSS quirks)
  • Deploying your web application is a breeze. You make an account on AppEngine and you can deploy your app simply by pushing one button.
  • Free quotas on AppEngine are pretty generous. Hence if you don’t get too much traffic you can host it completely for free
  • Client Server Communication (RPC) is super easy. You just extends the class RemoteService and specify the prototypes and make sure that all the data structures you want to send over the line are implementing IsSerializable and GWT makes sure that everything works
  • Making a user interface is very similar to making a user interface for a desktop program. If you have experience with toolkits like GTK, Qt or god forbid MFC making a UI in GWT is easy
  • From your Java code you can still call Javascript libraries

There is actually just one thing I really dislike: the datastore. The datastore is the database that AppEngine is using

  • It’s a pain to get data in the data store. I for instance have a table of about 115.000 records which contain IP ranges and country codes. Hence based on connecting IP I can determine the country of the visitor and immediately can set the country. For the Java there is no upload tool available. Hence I decided to write a servlet and post the data to it. However on AppEngine you can only process a limited time otherwhise it throws an exception. Hence in the end I now send around a 100 records at the time than sleep for a second and upload the next 100 records. Even then app engine now and then throws an exception. So I had to built a retry functionality in the script. Even for deleting the data I needed to write something similar. In the end it takes several hours to upload all the records. I’ll publish how I did this in a following blog post.
  • If you want to do a query you have to get an instance of the PersistanceManager. This is very slow and takes a few seconds. That’s also the reason you see the spinner running in the exchange rate block on cheapriver. It just gets four floating point values from the database but if the PersistanceManager is not in memory anymore it takes several seconds.

As I’m a terrible graphic artist I had the site and logo design done by Michael Katindig of Massive Method in the Philippines. He’s done a great job for a good price. So if you have graphic design work I can recommend Michael.

While doing all this I had to think of two nice books I recently : The World is Flat by Thomas Friedman and The 4-Hour Workweek by Timothy Ferris. Both basically argue that because the world is so flat at the moment anybody can start easily an international business with minimal investments. Basically by outsourcing almost everything. Many services furthermore have a kind of pay as you go model and need very limited upfront payment.

  • I bought a domain for $8.99 at GoDaddy
  • For Google AppEngine I still don’t pay anything because I’m using the free quota. If CheapRiver gets a huge number of visitors I probably need to pay something but by that time enough people buy something at Amazon via CheapRiver such that I should be able to afford it from the affiliate fees.
  • I signed up for a free Google Apps account to have email addresses
  • Massive Method made the graphics and web design for a couple of hundred dollars
  • And lastly I put of course quite some hours in of my free time to program CheapRiver, but that has been a fun learning experience

I hope you find CheapRiver useful. Suggestions for improvements are welcome