Archive for the 'Uncategorized' Category

A fistful of links

June 10, 2009

Here’s a list of links I tweeted over the last week or so (as requested by @dmpetersson). I considered shamelessly removing the RT info, but came to my senses and carried them over. Clearly shows that the majority of my links are retweets, but then again more people might discover the interesting people who originally tweeted the links and follow them. I will start posting these digests weekly going forwards.

CouchDB to the rescue

February 17, 2009

Got CouchDB installed on my Fedora box. This thing is sweet. Working with a RESTful JSON/HTTP storage system is so much easier than old-fashioned SQL databases. If I were to store users and a lists of stuff per users where this stuff could be shared among more users in a realtional db, I would create a table for the users indexed on userid, a table for the stuff indexed by stuffid and a table of userid to stuffid relations. Then of course I would need lots of boilerplate code to work with the database.

In CouchDB, I would have a database of users where a user doc is stored under /users/<userid>. The stuff would be stored as documents under /stuff/<stuffid> and the relations would be stored either in the user document or in a separate database /userstuff/<userid>/. An important difference is that no matter if the relation information was stored in the user database or in a separate database, the document stored at that location would have to be replaced whenever stuff is added or removed for a user. This makes me prefer putting the relations in a separate database rather than keep updating the user document.

It was hard to believe that you could get a simpler interface than pure HTTP, but still I had to test CouchRest by Chris Anderson. This made working with CouchDB even easier. With all this stuff in blaze, all development is a breeze since I don’t have to spend time on the nitty-gritty repetitive low-level boilerplate stuff.