Skip to content

Monthly Archives: November 2009

Disable default Java DNS caching

30-Nov-09

By default Java 1.6 caches DNS queries, either forever if there is a security manager installed or for an implementation specific period if there is no security manager installed. There are two ways to disable this behavior which breaks things like load balancers that do DNS load balancing. first you can disable it by adding [...]

How to get a timestamp in milliseconds from Erlang

30-Nov-09

This is pretty simple, the ubiquitous milliseconds since 1970-01-01 timestamp and it isn’t part of the Erlang standard library. % gets a timestamp in ms from the epoch get_timestamp() ->     {Mega,Sec,Micro} = erlang:now(),     (Mega*1000000+Sec)*1000000+Micro.

Bonjour / Zeroconf in Erlang with Caching Responses with Subscriptions

30-Nov-09

I have the basic logic for caching of DNS response records based on subscriptions. Thanks to everyone on the Erlang Discussion mailing list and in particular to Rob Carlton for getting me over an hump and helping me make progress on this project, I really appreciate the help and hope that I am creating something [...]

Git vs Subversion on OSX

29-Nov-09

As a long time Subversion user, I am going to try and use Git for a while. I am on OSX again and Git is much nicer to deal with than on Windows. For my latest side project ( inet_mdns ), I am working on a native Erlang Bonjour/Zeroconf implementation. I am still probably going [...]

Counters in Erlang

20-Nov-09

I want to be able to keep multiple statistics counters in my server applications. With some help from the friendly people on the erlang-discussion mailing list I came up with this implementation of how to create counters in Erlang. I considered all the solutions suggested and for my needs this worked out the best. I [...]

Bonjour / ZeroConf in Erlang

15-Nov-09

Here is the beginnings of a Bonjour / ZeroConf module in Erlang. I always like to ZeroConf all my servers I write so I don’t have to play the xml/properties/ini file game with how a server or clients connect to each other. All my previous Python and Java servers have used bindings to a C [...]

Found a great source code snippet sharing site

14-Nov-09

Snipplr.com I really love the broad clean interface it has. I am posting most of my source code snippets there as well as this blog. Along with some things that probably won’t make it into a blog post. You can follow what I post there here. There is a plugin for WordPress but I can’t [...]

How to bundle Java programs into a single executable .jar file

13-Nov-09

One of the most useful things you can do for any project is provide command line friendly tools for administration, diagnostics and maintenance. As nice as browser based administration tools are, not everyone has access to production machines behind firewalls and the sort with a browser, most administration is done via ssh. Giving operations tools [...]

How to add a truncate(int len) method to String in Groovy

12-Nov-09

This adds a .truncate() to the String objects in Groovy. It lets you tell what the max length of a String should be and then truncates it to that length – 2 with an ellipsis on the end to let you know that the contents were truncated. You could easily modify this to just truncate [...]

How to reformat source code in XCode 3.x

12-Nov-09

I am using XCode 3.2.1 for some Cocoa development and I really miss the OPTION-CMD-L short cut in Intellij IDEA that re-formats your current source code file as you have it configured. I found you can get something similar but not as powerful by doing a Edit -> Select All and then CTRL-I in XCode [...]