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 [...]
The Golden Ratio
October 24th, 2009 by Ulrik Sandberg — Tips & Tricks
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
…
Command output: [...]
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 [...]
Tags: amazon, backup, mac, network, s3, storage, tools, web
Mocking Classes
May 9th, 2007 by Ulrik Sandberg — Java, Testing
Mocking a class rather than an interface might present some interesting obstacles. Perhaps you have ran into the dreaded:
Unexpected method call toString():
toString(): expected: 0, actual: 1
You think nothing of it and happily add an expectation for toString. Then you get:
Unexpected method call toString():
toString(): expected: 1, actual: 2
The reason is that EasyMock [...]
Tags: mock, programming
Sweden Spring UG Birth of a new UG
May 1st, 2007 by Ulrik Sandberg — Events
Once in a while we see a new user group being born. One of those is close to many Java programmers’ hearts – the Sweden Spring User Group.
We turned to Ulrik Sandberg, one of the founders of the group.
Tell us how you got started with the Sweden Spring User Group.
The Sweden Spring User Group was [...]
Tags: spring, user group
Sharing a Mac Internet Connection Through Airport
January 20th, 2007 by Ulrik Sandberg — Tips & Tricks
I just solved a networking problem on my Macs after hours of trying. For the benefit of others, I’ll describe here the problem and the solution.
Setup
Cable modem from ISP, network cable to a firewall, the private end of the firewall via network cable on to a switch. Pretty basic, I guess. No wireless base stations [...]
Tags: internet, mac, network, tools, web
Solving 403 problems with Sourceforge Subversion
January 13th, 2007 by Ulrik Sandberg — Tips & Tricks
After having had severe problems when committing to the Sourceforge Subversion repos, I stumbled upon what appears to be the solution. The problem was that in the middle of a commit, one file or directory would fail with a 403 (permission denied). In desperation, I would chop up the change set and commit little pieces [...]
Tags: dns, network, sourceforge, subversion, tools, web
