May 31

I run into a problem where my karma run hangs (see grunt watch hangs on karma:unit:run task). After digging into it I found out that it relates to problem #1 in post etc/hosts bug and dns resolution. Upgrading to 10.8 damaged etc/hosts. DNS resolution of localhost was extremely slow.

To fix this you could use instead of localhost or split lines in etc/hosts

Instead of strug-imac.hypoport.local localhost

split them into single lines localhost strug-imac.hypoport.local

Tagged with:
Jun 13

Currently I’m setting up a new SSD. One of my first installations is homebrew, a must have IMO.

I have two users. Allen the admin and Stan the standard user. Stan is a developer who works most of his time inside our company network. Allen is responsible for installing apps and so on. For security reasons Stan don’t want to be admin. Nevertheless Stan wants to use homebrew, he loves it too. Allen don’t want to have two homebrew installations so that he allows Stan to use his homebrew.

Update 2013-05-31: considering /Library/Caches/Homebrew


  1. Create a group brew and add Stan
  2. brew doctor (Allen checks if he installed brew correctly)
  3. sudo chgrp -R brew /usr/local (Change the group of homebrew installation directory)
  4. sudo chmod -R g+w /usr/local (Allow group members to write inside this directory)
  5. sudo chgrp -R brew /Library/Caches/Homebrew (Change the group of homebrew cache directory)
  6. sudo chmod -R g+w /Library/Caches/Homebrew (Allow group members to write inside this directory)
  7. brew doctor (Stan checks if he can use homebrew)
  8. We are done!

Detailed Setup

Create a group brew and add Stan
One way to create a group brew is to open the System Preferences and select Users & Groups. Unlock this screen and press the lower left +. Select the account type Group and name it brew. After creating this group add Allen and Stan.

Allen checks if he installed brew correctly

allen$ brew doctor
Your system is raring to brew.

Change the group of homebrew installation directory

allen$ sudo chgrp -R brew /usr/local
allen$ ls -la /usr/local
total 16
drwxrwxr-x 8 root brew 272 Jun 12 22:31 .
drwxr-xr-x@ 13 root wheel 442 Jun 12 22:36 ..
-rw-r--r-- 1 admin brew 159 Jun 12 22:28 .gitignore
drwxr-xr-x 2 admin brew 68 Jun 12 22:33 Cellar
drwxr-xr-x 6 admin brew 204 Jun 12 22:28 Library
-rw-r--r-- 1 admin brew 789 Jun 12 22:28
drwxr-xr-x 3 admin brew 102 Jun 12 22:28 bin
drwxr-xr-x 3 admin brew 102 Jun 12 22:28 share

Allow group members to write inside this directory

allen$ sudo chmod -R g+w /usr/local
allen$ ls -la /usr/local
total 16
drwxrwxr-x 8 root brew 272 Jun 12 22:31 .
drwxr-xr-x@ 13 root wheel 442 Jun 12 22:36 ..
-rw-rw-r-- 1 admin brew 159 Jun 12 22:28 .gitignore
drwxrwxr-x 2 admin brew 68 Jun 12 22:33 Cellar
drwxrwxr-x 6 admin brew 204 Jun 12 22:28 Library
-rw-rw-r-- 1 admin brew 789 Jun 12 22:28
drwxrwxr-x 3 admin brew 102 Jun 12 22:28 bin
drwxrwxr-x 3 admin brew 102 Jun 12 22:28 share

Change the homebrew cache directory accordingly

sudo chgrp -R brew /Library/Caches/Homebrew
sudo chmod -R g+w /Library/Caches/Homebrew

Stan checks if he can use homebrew
In my case Allen and Stan is one person, so that a simple login do the trick.

allen$ login stan
stan$ brew doctor
Your system is raring to brew.

Tagged with:
Sep 10

Homebrew is my favorite package manager. If you installed Xcode just for brew than this post might be interesting for you.

Kenneth Reitz created a GCC Installer for OSX without Xcode! Thank you. This package is about 500 MB. Compared to Xcode you save at least 1,5 GB on your SSD.

So let’s go to work:

  • Remove Xcode
  • sudo /Developer/Library/uninstall-devtools --mode=all

    This will delete Xcode. For more details see John’s post

  • Download and install GCC for Mac without Xcode
  • Currently 10.6 and 10.7 packages are available at

  • Install brew (see
  • /usr/bin/ruby <(curl -fsSkL
  • You're done
  • You can verify your success with brew doctor.

You don't need Xcode for formulas like gradle, groovy, maven, tomcat etc. Nevertheless some formulas will require Xcode!

Tagged with:
May 19

I stumbled while installing a second WordPress blog. Everything seems to be fine: DB, PHP (first blog works), apache.conf, .. Nevertheless I received empty HTML bodies when calling a php page.

So I started debugging and finally found the problem inside my php.ini. In the moment I saw that line I remembered that I changed it to secure my server a bit ;)

open_basedir = /path-to-first-wordpress-dir/:/path-to-second-wordpress-dir/:/tmp/

After adding the path of my second WordPress installation everything was fine.

Tagged with:
May 01

Some of these stats that nobody needs.

I got pointed to This site shows you some stats and aggregates it to a money value. Would be interesting if they could provide potential buyers as well:)

Here are the blogs of my team: 13.292,07 9.340,58 1.944,40 820,64 664,16

Which value has your team?

Tagged with:
Mar 17

If you are using Homebrew and want to use the maven formular you have to delete the symbolic link /usr/bin/mvn.

Thereby you use your homebrew maven installation instead of the shipping version of OSX.

The executable is located at /usr/local/bin/ which should be part of your path already.
The maven package itself can be found at /usr/local/Cellar/maven/3.0.3/libexec. This will be interesting for your IDE, which often wants a pointer to your maven home directory. I created a symlink current so that I can change the version to use at the command line without the need to configure my IDE again.

[/usr/local/Cellar/maven] master@struggy$ sudo ln -s 3.0.3/libexec/ current

That’s it.

Tagged with:
Dec 11

All of our team were to blind to recognize this feature – Pin Tab. Here is the scenario. You run your fast test suite locally. You have a couple of failed tests. You pick the first one, fix it, and run this test only to get fastest feedback. Stop. Now the results of your first run are gone, overwritten by the second run. Which other tests did fail? I can’t remember. We were looking for similar to the find dialog open in new tab. Couldn’t find it, a workaround was to copy/paste the result. Today I wanted to create a feature request. While I’m thinking about what I would expect I opened my IntelliJ IDEA and there it was: Pin Tab!

If you want to keep a result just press the pin at the left site. Now this tab is pinned. If you run another set of tests your previous result will remain. Cool. How could I overlooked it for so long?

Tagged with:
Dec 10

Do you annotate your TestNG tests with groups? We currently have four groups: FAST_TEST, SLOW_TEST, INTEGRATION_TEST, WEBDRIVER_TEST.

@Test(groups = TestGroup.FAST_TEST)
public class IncomeCalculatorTest {

  @Test public void test_negative_income_is_not_allowed() {

Recent, we have had trouble with the execution order of our tests. We are using Spring and one or more tests seem to dirty the context without annotating it with @DirtiesContext. We have several hundred tests so identifying the one isn’t that easy. Same problems? Vote for SPR-7811. A workaround is to control the execution order of the tests. Now we are back on our topic.

TestNG allows you to use beanshell scripts inside a suite file. The access is limited to the current method and its groups. Nevertheless you can do a lot with this information.

You want to run tests only, that require a transactional spring context? Or you want tests from a specific package only? Here we go:

<!DOCTYPE suite SYSTEM "">
<suite name="beanshell-demo-suite">
  <test name="allTransactionalSpringContextTests">
        <script language="beanshell">
      <package name="mycompany.*"/>
  <test name="allTestsInPackageX-Y-Z">
        <script language="beanshell">
      <package name="mycompany.*"/>

(org..AbstractT..Tests should be org.springframework.test.context.testng.AbstractTransactionalTestNGSpringContextTests)

Got it? If you can group your tests based on there names, packages, base classes, .. you don’t need to annotate all your tests with groups. No more missing or wrong tagged test, hallelujah!

Disclaimer: Sure there will be a lot of situations where you need test groups. E.g. when you use the dependsOn feature heavily. This blog shows what else is possible.

Tagged with:
Nov 17

In JBoss Drools you can use Functions to simplify rules and to DRY:

function int monthlyPayment(Money initialMonthlyPayment) {
    return initialMonthlyPayment.times(0.75);

We used this technic for some little helpers. We unit test all our rules and everything seems to be fine until our customer did some more monkey testing. He claimed that some rules worked once but fail now. After some root cause analysis we found a very strange bug (JBRULES-2749). Rules won’t fire! Luckily we found this bug before our go live.

Don’t use Drools functions until this issue is solved. Instead use a static method in a helper class.

Drools is really a cool rule engine, please vote for JBRULES-2749.

Tagged with:
Nov 04

In one way or another you are using task lists, I’m sure.

A task list – as the name suggests – is a list of tasks. How does it normally works?

While you are coding your brain (and/or the brain of your pair) try to escape :) It creates thoughts like:

  • I need to test this and that as well
  • Here it might be cool to clean up the campground
  • The name of that class did not express the intention any longer, what is more suitable?
  • ..

These ideas of other tests and possible refactorings keep you from the current task. To keep focus write them down. Free your mind. If you finished your task, take the next one from the list. New ideas? Add them. Let the task list evolve. Clean up your list frequently. If you have tasks that you won’t do shortly, create user stories and sell them to your product owner.

This practice allow you to keep focus on the current task without loosing your ideas. You’ll have less context switches. It makes you more productive. Try it!

TDD Task Lists With IntelliJ IDEA

I use this Task Plugin. It is simple and easy to use. Every action can be triggered with the keyboard. Changing keyboard mappings can be done classically with IDEA’s keyboard mapping. Because of the missing Insert key on my MacBookPro I remapped Add Task. To go quickly to the Task Tool Window you can either map it to a key or use the switcher (Ctrl-Tab on OSX):

Tagged with:
preload preload preload