Archive for the ‘note-to-self’ Category

Erlang: How to send a message to a registered process on another node

Saturday, September 29th, 2007

It took me ages to find out how to do this — it is such a simple thing that no-one ever seems to mention it. Assuming that you have a process registered to foo:

register(foo, Pid).

you send it a message from the current node by doing:

foo ! "hello".

and you send it a message from another node by doing:

{ foo, node_name@othernode } ! "hello".

Ant unit test forking behaviour

Wednesday, August 15th, 2007

There is a long-standing issue with the way that ant’s JUnit task runs tests. The default behaviour is to fork off a new JVM for each test - which is *very* slow, particularly if you are doing something like GWT Unit Tests.

In this case, the whole GWT environment bootstrap (about 20 seconds on our cruise box) happens once per test. Ouch.Fortunately there is a solution, in ant 1.6.2 and above - use the forkMode attribute :

<junit fork="true" forkMode="once" ...

See the junit tag documentation for more details :

http://ant.apache.org/manual/OptionalTasks/junit.html

Rails server strangeness

Wednesday, June 7th, 2006

I was trying to start a server on the test environment with “script/server -e test”, but it turns out that lighttpd ignores that parameter - silently. So I was getting a server on the development environment instead.

You can get around this by using the webrick server:
script/server webrick -e test