ShowOff is a presentation software where you create your slides by writing simple text files containing markdown formatting. Styling is done using CSS. The slides are served by a web server and can be displayed in a web browser. With a simple command, a presentation can be deployed on Heroku for everyone to see. ShowOff [...]
Getting ShowOff source code high-lighting for Clojure
September 10th, 2011 by Ulrik Sandberg — Dynamic languages, Tips & Tricks, User Experience
Tags: clojure source highlight
Clojure third language officially supported on Heroku
July 7th, 2011 by Ulrik Sandberg — Agile, Cloud, Dynamic languages, Java
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. [...]
Tags: clojure, heroku, official, support
Deploying a Clojure web app on Heroku
June 13th, 2011 by Ulrik Sandberg — Cloud, Dynamic languages, Java
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.
Tags: clojure, Cloud, Deployment, git, heroku, Java
Numerical Integration (With Precision)
April 2nd, 2011 by Ulrik Sandberg — Dynamic languages, Java, Tips & Tricks
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.
Tags: bigdecimal, clojure, integration, Java, math, numerical
The Substitution Model: A Tool For Understanding Recursion
March 20th, 2011 by Ulrik Sandberg — Dynamic languages
Section 1.3 in Structure and Interpretation of Computer Programs is about Formulating Abstractions with Higher-Order Procedures. As an example, the authors use three simple sums: a sum of an integer range a sum of the cubes of an integer range a sum of a series that converges to π/8 The purpose is to highlight what [...]
dbg: A Cool Little Clojure Macro
March 13th, 2011 by Ulrik Sandberg — Dynamic languages, Tips & Tricks
Here’s the development of a tiny little macro that is actually pretty useful. The post is quite verbose, because I explain a lot. I want a debug function that first prints the “quoted” (unevaluated) code and then what it evaluates to, so I can write something like this: user> (dbg (+ 1 2)) dbg: (+ [...]
The country that nearly drove me crazy
November 1st, 2010 by Ulrik Sandberg — Tips & Tricks
I just upgraded my OpenLDAP to 2.4.21 and suddenly I couldn’t load an LDIF that we in Spring LDAP have used successfully for years. % ldapadd -Dcn=Manager,dc=jayway,dc=se -wsomepwd -f /tmp/t.ldif adding new entry “ou=groups,dc=jayway,dc=se” adding new entry “c=Sweden,dc=jayway,dc=se” ldap_add: Invalid DN syntax (34) After some time of swearing and random changes, I managed to find [...]
Tags: ldap
The Golden Ratio
October 24th, 2009 by Ulrik Sandberg — Tips & Tricks
Also known as the “Divine Quotient”, the Golden Ratio was given an almost magical meaning during the renaissance, but it’s actually much older than that. Leonardo DaVinci used it. Euclid used it. It was supposedly discovered by Pythagoras. So, what is it? It’s very simple. Take a length and divide it into two parts: a [...]
Tags: goldenratio, mathematics, programming, scala, scripting
The Power of Unit Testing
May 21st, 2009 by Ulrik Sandberg — Agile, Java, Testing
The purpose of Unit Testing is to verify for the developer that a software unit does what it is supposed to and is fit for use. The confidence that the developer gets, gives the developer courage to do other useful practices like Refactoring. Unit testing is often used to test complex units with one or [...]
Tags: programming, scrum
Upgrading Groovy to 1.6.2 Fails on Mac
April 29th, 2009 by Ulrik Sandberg — Tips & Tricks
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: $ sudo port upgrade groovy —> Building groovy [...]
Tags: groovy, macosx, macports, problem, scripting, upgrade
Always Use Parenthesis in Groovy Builders
April 24th, 2009 by Ulrik Sandberg — Tips & Tricks
I recently ran into an interesting Groovy feature when demonstrating the strengths of the MarkupBuilder. As you probably know, parenthesis in a Groovy method call are optional, unless it’s a no-args call. In that case the parenthesis are needed in order to distinguish the call from a property. However, leaving out parenthesis in a Builder is asking for trouble. I’ll show you why.
Tags: builder, gotcha, groovy, parenthesis, programming, scripting
Getting Coverage For Integration Tests
December 13th, 2008 by Ulrik Sandberg — Java, Testing, Tips & Tricks
Unit testing in my world is basically defined by being able to run the tests wherever and whenever; on the train, on the plane, at work, or at home. If you also have integration tests, chances are that they require some external data source or something that simply makes it impossible to run them everywhere. [...]
Tags: coverage
Encrypting Properties With Jasypt
December 9th, 2008 by Ulrik Sandberg — Java, Tips & Tricks
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: <bean id="traditionalPersonDao" class="org.springframework.ldap.samples.article.dao.TraditionalPersonDaoImpl"> <property name="url" value="ldap://localhost:3901" /> <property name="base" value="dc=jayway,dc=se" /> <property name="userDn" [...]
Tags: properties, security, spring, tools
Squid, the caching proxy
June 6th, 2008 by Ulrik Sandberg — Tips & Tricks
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 [...]
Tags: cache, network, performance, proxy, tools, web
Using Amazon S3 for backup
September 2nd, 2007 by Ulrik Sandberg — Cloud, Tips & Tricks
Amazon Simple Storage Service (S3) is cheap on-line storage with a Web Service interface. You just log in with your Amazon id, sign up for S3, designate a credit card, and that’s it. You now have access to pretty much unlimited storage space, managed by Amazon. The price is $0.15 per GB-Month of storage used [...]
