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 [...]
Categories: DevOps,clojure
Tagged: clojure, devops, incanter
- Published:
- August 16, 2010 – 8:02 pm
- Author:
- By Sam Newman
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 [...]
Categories: DevOps,clojure
Tagged: clojure, devops, incanter
- Published:
- August 15, 2010 – 7:10 pm
- Author:
- By Sam Newman
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 [...]
Categories: clojure
- Published:
- August 10, 2010 – 10:11 pm
- Author:
- By Sam Newman
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 [...]
Categories: clojure
- Published:
- June 20, 2010 – 12:34 pm
- Author:
- By Sam Newman
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 [...]
Categories: clojure
- Published:
- June 19, 2010 – 8:00 pm
- Author:
- By Sam Newman
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 [...]
Categories: clojure
- Published:
- June 13, 2010 – 7:13 pm
- Author:
- By Sam Newman
I’ve recently been working on a Clojure application that I hope to open source soon. It’s been my first experience of using Clojure, and is almost certainly one of the most thought provking things I’ve done in a long while. One of the things that is still causing me issues is how to go about [...]
Categories: Development,clojure
Tagged: clojure, functionalprogramming, TDD
- Published:
- February 16, 2010 – 8:56 pm
- Author:
- By Sam Newman
I’ve been working on a couple of spare time projects, both of which I hope to release more formally in the next few weeks. One of them involves development of a simple web application for deployment on Google App Engine. As part of the development, I had to modify an existing open source Clojure API [...]
Categories: Development,clojure
- Published:
- February 14, 2010 – 12:32 pm
- Author:
- By Sam Newman
So all the cool Clojure kids keep wanting me to use Emacs. The problem is that I haven’t used Emacs for the last 10 years – since, in fact, I had to support a C application on about 7 different flavours of UNIX. As you can imagine, I’ve since expunged many of those past memories. [...]
Categories: clojure
Tagged: clojure, emacs, ide, intellij
- Published:
- January 11, 2010 – 8:11 am
- Author:
- By Sam Newman
I’m currently working on a personal project by way of learning Clojure – it’s actually a program to match up my itemised phone bill against my list of contacts to help me expense my calls. I find it best to have a real-world problem I need to solve to learn a new programming language. The [...]
Categories: clojure
Tagged: clojure, Java, scala, syntax
- Published:
- January 10, 2010 – 6:33 pm
- Author:
- By Sam Newman