RSSAmplifier

Blog

Christopher Maier

Recent content on Christopher Maier

christophermaier.nameRSS feed ↗17 posts

Latest posts

Creating a Query DSL using Clojure and MongoDB

One of the nice things about MongoDB (particularly when using it in Clojure via the Congomongo library) is that its map-based query language is so amenable to the creation of a domain-specific language, or DSL. Creating and manipulating maps is like breathing in Clojure, so it is trivial to decompose the different query requirements of your application into a small collection of simple functions…

Writing Elegant Clojure Code Using Higher-Order Functions

Back when I first started writing Clojure code, I heard lots about the use of higher-order functions (also known as HOFs). Since functions are first-class language members in Clojure, you can do things like pass them as arguments or return them from function calls. Any function that accepts or produces another function in this way is a higher-order function. This allows you to write some very…

Github's new "Fork and Edit" Feature is Awesome

Github recently rolled out a new Fork and Edit feature that is pretty awesome. It basically allows you to create your own fork of any Github project, edit files in a new branch of that fork, and create a pull request back to the original project, all from your web browser, and in about as much time as it’s taken me to write this sentence. This really lowers the barrier for contributing code…

The Importance of MongoDB Key Names

Coming from a relational database background, you might not devote a lot of thought to the names of your columns. That is to say, while you make an effort to come up with a sensible and descriptive naming scheme for your columns, you probably don’t think about the amount of space those names take up. And why should you? In a relational databases, the column names are stored once, probably in…

Not-So-Private Clojure Functions

If you’ve been programming in Clojure for longer than, oh, about 5 minutes, you probably already know how defn creates a publicly accessible function in a namespace, while defn- creates a private one. If you’re outside the original namespace and you try to call a private function, you will get the smackdown. Here’s a simple demonstration. We’ll create two functions, one…

Using YUI_config to Set Up Custom YUI Modules

Once you have been using the YUI JavaScript framework for a little while, you’ll inevitably need to write your own custom modules. For me, I started creating lots and lots of widgets and needed to figure out how to properly modularize everything. The documentation for creating modules using YUI.add is good, and it got me up and running quickly. So far, so good. Armed with a handful of…

MongoDB Query Tricks, or "Why Don't MongoDB Doesn't Not have $and?"

Pardon the atrocious grammar; there is a point! I recently had a tricky time formulating a particular query in MongoDB. As you probably know, MongoDB has a number of query operators to use. It’s got stuff like $in, $nin, $or, and others, but no $and. Normally, you don’t need something like $and, since the capability is there implicitly; you just list off all your conditions on your…

Using MapReduce in Congomongo Now

My patch to Congomongo that adds support for running MapReduce jobs in MongoDB was accepted, but that code hasn’t yet been pushed out to the official Congomongo SNAPSHOT jar in Clojars. Until that happens, if you’d like to use the new MapReduce code, you can use my version. If you’re using Leiningen, add this to your project.clj: [org.clojars.christophermaier/congomongo…

Using Idiomatic Clojure, Part 1 - comp

As I read the Clojure code of others, I come across better ways to write my own code. Today’s example comes from The Joy of Clojure by Michael Fogus and Chris Houser. I often find myself writing anonymous functions along the lines of #(not (vector? %)) to act as filters in various places (filter, for, take-while, etc.). I always thought it looked a bit gnarly like that. Fortunately, there is…

My iPhone Plays MP3s Again

I recently upgraded my old iPhone 3G to iOS 4.1; I’d heard the horror stories about the abysmal performance that iOS 4.0 had with the older phone, so I waited until Apple had the fix. Everything went well with the upgrade; I think my phone might actually be a little faster. But then I tried playing some music. A large portion of my library just wouldn’t play. I’d select a song…

Host-Only Networking with VirtualBox

I’ve been playing around with VirtualBox lately, and it’s pretty nifty. Initially I just used it to set up an Ubuntu machine so I could easily run GnuCash on my MacBook, but lately I’ve decided to start using it at work, too. I’ve got lots of plans: figure out how to use Chef, set up my own Hudson server, get a MongoDB cluster running, etc. I’d like all of these…

Patches Accepted!

I just heard that my map-reduce patch and my my GridFS InputStream patch for Congomongo were both committed to the main Congomongo repository! This marks my first official open source code contributions, and hopeuflly not the last.

The Path to MapReduce with Congomongo

I’ve recently started a Clojure / MongoDB project at work to help us with our proteogenomic annotation work. Naturally, I’m using Congomongo to interact with the database. It’s a great wrapper for the MongoDB Java driver, written in a very nice functional style. Lately I’ve been looking into the map-reduce capabilities of MongoDB and have been trying to figure out how to…

Easy Clojure API Search with Google Chrome

Do you need an easy way to search Clojure’s API? Do you use Google’s Chrome browser? If so, you’re in luck; it’s incredibly easy to add a custom engine to Chrome to search the API. Here’s how. Setting Up a Custom Search Engine First, open your preferences and hit the “Manage” button down by “Default Search”. That will bring up a Search Engines…

Comparing Settings From Different PostgreSQL Databases

I’m in the process of migrating from an older version of PostgreSQL to a newer version. I’d like to see what the differences are between the configuration (${PG_DATA}/postgresql.conf) of both servers. I couldn’t find an easy, ready-made solution, so I hacked up one using plain old SQL, which turns out to be particularly well suited to comparing sets of data :) First, get the…

Blogging on Github with Jekyll

As per the instructions on the Jekyll install page, gem install jekyll then (since I didn’t have this set already): export PATH=${PATH}:/Users/maier/.gem/ruby/1.8/bin added to my Bash ~/.profile file. Pygments is cool for syntax highlighting. On a Mac with MacPorts, it’s as easy as this: sudo port install python25 py25-pygments Running Jekyll with its standalone server is great for…

About

My name is Christopher Maier, a software engineer that enjoys building things from both bytes and atoms. I currently work at Grapl. In the past, I’ve worked at Operable and Chef. Prior to that, I worked as a bioinformatics developer, as well as a viral oncology lab technician, both at UNC Chapel Hill.