Ulrik Sandberg

Ulrik works at Jayway in Sweden, usually in the role of an Agile mentor and system architect, insisting on testable, readable, well-documented and maintainable code. Certified SCJP and ScrumMaster. Co-founder of Spring LDAP. He has been developing software for 16 years.

Three Undocumented Features of JSON

Update: This article was written as an April Fool’s joke, taking a stab at the fact that JSON is a closed, dumb, and pretty anemic data format. There are other interesting data formats available, such as extensible data notation (edn). JSON (JavaScript Object Notation) is widely known as JavaScript’s data format, often used as a language-independent data interchange format. However, what I consider to be the three most powerful features of JSON are little-known. The main reason for this is…

A Decimal to Roman Numeral converter in just a few lines

Finding Out Who Changed What with Datomic

The Fantastic SUBST Function (part 4)

The Fantastic SUBST Function (part 3)

The Fantastic SUBST Function (part 2)

The Fantastic SUBST Function (part 1)

When John McCarthy in 1960 wrote his famous paper on the programming language LISP, he used a particular function to illustrate what you could do with the language. The language consisted of only nine “special forms”, primitive building blocks by which any computable function could be created. The function was called SUBST, and it included all nine of the special forms. It was a remarkable function. It could rip through any tree and replace all leaves that had one value…

Getting ShowOff source code high-lighting for Clojure

Clojure third language officially supported on Heroku

According to this blog entry on Heroku, Clojure becomes the third language officially supported on the Cedar stack, after Ruby and Node.js. They write: – “Clojure combines the expressiveness of Lisp, the agility of a dynamic language, the performance of a compiled language, and the wide applicability of the JVM in a robust, production-ready package. Clojure is a practical language designed to support high-performance, concurrent applications which efficiently interoperate with other software in the JVM ecosystem. All of this combines…

Deploying a Clojure web app on Heroku

Heroku is a cloud application platform for Ruby/Rails and Node.js. However, the Cedar stack on Heroku makes it possible to deploy other types of applications. In this blog entry, I will first describe how to write a simple Clojure web app using the Ring library and the build tool Leiningen. Then I will show how to deploy this Clojure web app on Heroku, using nothing but Git. I will make a change and see how to deploy that. I will also show how to easily roll back to a previous release.

Numerical Integration (With Precision)

In a previous blog entry, I explained the higher-order function sum and how to use the Substitution Model to follow the execution of a function. In this entry, I will use the sum function to perform numerical integration, and in the process run into some pitfalls of Java’s BigDecimal. I will show how the language Clojure provides an elegant solution to the “exact quotient cannot be represented” problem of BigDecimal.

The Substitution Model: A Tool For Understanding Recursion

dbg: A Cool Little Clojure Macro

The country that nearly drove me crazy

The Golden Ratio

The Power of Unit Testing

Upgrading Groovy to 1.6.2 Fails on Mac

When I tried to upgrade Groovy from 1.6.1 to 1.6.2 using MacPorts, it failed with an OutOfMemoryError. I managed to get it to build using some manual fixing in the build file. I’ll explain what I did in this blog. This was the result that I got: Looking in the directory mentioned above, we find a build.properties file that contains some settings: OK, plenty of memory, but nothing seems related to javac compilation. Let’s check the line 173, that the…

Always Use Parenthesis in Groovy Builders

Getting Coverage For Integration Tests

Encrypting Properties With Jasypt

Properties are used in many Java applications as a simple way of separating parts that are likely to change, from the parts that are not that likely to change. Consider for example this typical bean definition in a Spring configuration file: In order to simplify deployment and maintenance, it’s quite common to extract properties related to server names, ports, and user credentials from the Spring configuration file into a separate property file, like in this ldap.properties: In the configuration file,…

Squid, the caching proxy

I just checked out the old Squid again, the worlds most famous caching proxy. If you direct all your web access through the Squid proxy server, it will cache stuff after the first access. This would simplify for example for labs where fifty people simultaneously begin retrieving stuff from a Maven repo somewhere or downloading required libraries, and we have a very limited bandwidth. On the Mac it was easy to get running (if you have MacPorts): Then it was…

Using Amazon S3 for backup