Category Archives: Code

Using Groovy AST to Add Common Properties to Grails Domain Classes

Groovy offers a lot of runtime meta-programming capabilities that allow you to add reusable functionality in a shared fashion. Grails plugins make use of this ability to enhance your project. One of the things that you can’t do with runtime … Continue reading

Posted in Code, Groovy | Tagged , , | 4 Comments

Check Multiple Mercurial Repositories for Incoming Changes

Currently I have a whole bunch of Mercurial repositories in a directory. All of these are cloned from a central repository that the team pushes their changes to. I like to generally keep my local repositories up-to-date so that I … Continue reading

Posted in Automation | Tagged , , , | 1 Comment

Java Return from Finally

try…catch…finally is the common idiom in Java for exception handling and cleanup. The thing that people may not know is that returning from within a finally block has the unintended consequence of stoping an exception from propagating up the call … Continue reading

Posted in Java | Tagged , , | 2 Comments

USB to Serial Adapters in VMWare

I needed to do some work using a pin pad (a device that allows you to enter a numeric code at a point-of-sale or other system) and needed to test it in a 32bit Windows environment. The pin pad uses … Continue reading

Posted in Code | Tagged , , | 4 Comments

What is the Cost of Not Doing Things?

We’re really good at measuring the cost of some things. We’re good at measuring the cost of a new computers for everyone on the team, we’re good at measuring the cost per hour of a resource on a project and … Continue reading

Posted in Code | Tagged , | 3 Comments

NoSQL with MongoDB and Ruby Presentation

I presented at the Milwaukee Ruby User’s Group tonight on NoSQL using MongoDB and Ruby. Code Snippets for the Presentation Basic Operations   // insert data db.factories.insert( { name: "Miller", metro: { city: "Milwaukee", state: "WI" } } ); db.factories.insert( … Continue reading

Posted in Code, Ruby | Tagged , , | 2 Comments

MongoDB: MapReduce Functions for Grouping

SQL GROUP BY allows you to perform aggregate functions on data sets; To count all of the stores in each state, to average a series of related numbers, etc. MongoDB has some aggregate functions but they are fairly limited in … Continue reading

Posted in Code | Tagged , , , | 5 Comments

MongoDB Replication is Easy

Database replication with MongoDB is easy to setup. Replication duplicates all of the data from a master to one or more slave instances and allows for safety and quick recovery in case of a problem with your master database. Here … Continue reading

Posted in Code | Tagged , , | 2 Comments

MongoDB and Java: Find an item by Id

MongoDB is one of a number of new databases that have cropped up lately eschewing SQL. These NoSQL databases provide non-relational models that are suitable for solving different kinds of problems. This camp includes document oriented, tabular and key/value oriented … Continue reading

Posted in Code, Java | Tagged , , | 2 Comments

Random but Evenly Distributed Sets of Numbers

Let’s say one is a computer programmer and let’s say one’s wife (or roommate; or significant other) does social science research (a totally hypothetical scenario of course). When doing social science research one needs to create randomized groups of participants. … Continue reading

Posted in Code, Python | Leave a comment