Author Archives: Sam Newman

Graphing Unique Users With Incanter 1

In a previous post, I showed how we could use Clojure and specifically Incanter to process access logs to graph hits on our site. Now, we’re going to adapt our solution to allow us to to show the number of unique users over time. We’re going to change the previous solution to pull out the [...]

Graphing Hits Per Minute Using Clojure & Incanter 3

Continuing in a re-occurring series of posts showing my limited understanding of Clojure, today we’re using Clojure for log processing. This example is culled from some work I’m doing right now in the day job – we needed to extract usage information to better understand how the system is performing. The Problem We have an [...]

Creating Sparse Tabular Data With Clojure 3

In the spirit of making my mistakes in public – something which I have a long history of on this blog – I thought I’d post up a solution I came up with for a relatively simple problem. I’m not unhappy with the solution – it works – but I can’t help thinking I’m missing [...]

AWS: S3 vs EBS-backed instances 0

As part of the day job at ThoughtWorks, I’m involved with training courses we run in partnership with Amazon, giving people an overview of the AWS service offerings. One of the things we cover that can often cause some confusion is the different types of images – specifically the difference between S3 and EBS-backed images. [...]

Executing A Command Line Program With Clojure 3

Updated to reflect some feedback and one example of using commons-exec as an alternative to the plain old Runtime.exec Second Update to reflect use of shell-out – thanks Scott! Basic Making use of clojure.contrib.duck-streams: (ns utils (:use clojure.contrib.duck-streams)) (defn execute [command] (let [process (.exec (Runtime/getRuntime) command)] (if (= 0 (.waitFor process)) (read-lines (.getInputStream process)) (read-lines [...]

Clojure, Partially Applied Functions And Java Interop 3

I’ve been playing around with partially applied functions in Clojure, and have hit an interesting snag when dealing with Java interop. First, lets examine what partial does in Clojure, by cribbing off an example from Stuart Halloway’s Programming Clojure: user=> (defn add [one two] (+ one two)) #’user/add user=> (add 1 2) 3 user=> (def [...]

In Clojure, Those Parenthesis Really Matter 1

Posted in the “I hope no-one else has to go through this” category in the hope that Google surfaces this for some other poor soul. Picture a rather trivial split function: (defn split [str delimiter] ((seq (.split str delimiter)))) Which helpfully spits out: java.lang.ClassCastException: clojure.lang.ArraySeq cannot be cast to clojure.lang.IFn The issue here is the [...]

UK Petition Supporting A National Strategy for MND 0

A friend of mine is suffering from a nasty, progressive condition called Motor Neurone Disease. There are many forms, all of which share the common trait of affecting the motor neurons which control walking, speaking, breathing and general movement. In the US it is often called ALS or Lou Gehrig’s disease. Prognosis varies, but the [...]

My Talk at QCon SF 2009 0

The talk I did at QCon SF 2009 is now available at infoq. Only an MP3 download is available, otherwise you’ll have to stream it from the site – but you’ll be missing a lot, as the slides are better than hearing me drone on.

Synchronizing Slides & Audio For A Screencast 0

At a recent ThoughtWorks techy meetup, we recorded a couple of videos for internal use. One of them involved someone speaking to slides. The problem was that we had no projector, and our flip camera wasn’t really up to doing a great job of filming the screen. So the problem I was faced with was [...]