Friday, December 26, 2008

My younger daughter just said to me, "Dad, I know how to cheat at homework with the Wii." I asked what whe meant. She said that if you had to alphabetize a list of words (which she sometimes does for homework), you could create a Mii (an in-game avatar on the Wii) for each word, and give it that word as the name. Then use the game's "sort by name" feature to display all the Miis in alphabetical order. Voila!

Tuesday, December 23, 2008

When we announced Rails support for the 10gen cloud computing platform, we said that ActiveRecord support was not yet included. This led naturally to the question, "what the heck good is that?"

Actually, you can run Rails without ActiveRecord just fine. Rails has
been designed that way. For an example app that uses the Mongo
database, see my 10gen-rorob Rails app. You might want to use the branch that uses Rails 2.2.2 instead, because the master branch uses Rails 1.2.6 and the 2.2.2 branch also has a few more features.

On the other hand, internally we have a subset of ActiveRecord working
already and are working on supporting as much of it as makes sense
with a non-relational database. I already have the Rails app from
"Agile Web Development With Rails" running unchanged.

On the gripping hand, you can run the 10gen cloud yourself, in which
case you can run it with MySQL or any other relational database. In
that case, you can use ActiveRecord unchanged.

Wednesday, December 17, 2008

For the last four months I've been sequestered deep in the heart of the 10gen labs among the test tubes full of bubbling primary-colored liquids, glass jars filled with mysterious biological samples, and mysteriously glowing rectangular pixilated displays. The whole time, I've been pressing small plastic keys in arcane sequences and muttering to myself.

Finally—after going through three lab coats, two lab assistants, and more brains than I care to remember—the lab doors are creaking open to reveal the secrets within: Ruby and Rails are now officially part of the 10gen cloud computing platform.

It's alive! ... ahem... It's alive! ... AHEM ... IT'S ALIIIIVVVVEEEE!

...

Damn. There's never a good dramatic thunderclap around when you need one.

Actually, this announcement isn't worth all the theatrics. Initial Ruby and Rails support has been in the SDK for a while now. This is more of a soft launch. Ruby support should be complete. Rails support does not yet include ActiveRecord. We do have an XGen::Mongo::Base class which is Mongo-specific with an awfully ActiveRecord-like API.

This launch is more of an official milestone where we are asking the community to take a look at what we've done and give us feedback. Please go grab the 10gen SDK and give it a try. Let me know if you have any questions or suggestions, either here or preferably on the 10gen mailing list. If you are in the NYC area, come to one of our hackathons.

Database commands are JSON objects (sort of) which are almost like Ruby hashes, but not quite. Their keys are ordered, so I whipped up an OrderedHash class to use when the driver sends commands to Mongo.

Adrian Madrid (aemadrid@gmail.com) has been helping out a lot by providing invaluable feedback, tests, suggestions, and fixes.

Sunday, December 7, 2008

I've been playing a bit with Clojure recently. Playing only: I haven't written anything serious yet. One thing I did write, though, was the Clojure example in Geir Magnusson Jr's Java Mongo driver.

There's a bug somewhere, though: the sample only prints records 1 and 3 out of 3. The Java sample works correctly, as does the JRuby sample. I can't figure out why, because the Clojure code that iterates over the records that are inserted is pretty simple. Here's the code:

I've been working on a pure-Ruby driver for Mongo, 10gen's document database. If you are of the Java persuasion, then check out Geir Magnusson Jr's Java driver for Mongo.

One thing that we are discussing internally at 10gen is which layer of the system should be responsible for automatically creating primary key fields for records. Mongo does not require them, but Babble (the 10gen cloud computing app server) does. I think what will end up happening is that the driver will not add them unless the caller specifically asks for it.