One of Those Things You Don't Know If You Should Post in Your Blog Or on TheDailyWTF

From Rails, or more specifically, ActiveSupport's json.rb:

# When +true+, Hash#to_json will omit quoting string or symbol keys
# if the keys are valid JavaScript identifiers.  Note that this is
# technically improper JSON (all object keys must be quoted), so if
# you need strict JSON compliance, set this option to +false+.
mattr_accessor :unquote_hash_key_identifiers
@@unquote_hash_key_identifiers = true
Article page

AudioFormat 0.4 released

After a longish break, released a new AudioFormat when I noticed how aggravating the current version was :-)

The new version, 0.4, allows you to add files to the list of files to convert via a file selector or by dragging. It also should handle and report errors a bit better. And maybe it'll even recognize Vorbis files? Although I suspect it'll get very confused if it encounters something like Ogg Tarkin files. Will have to work on that a bit more.


Article page

Unit conversion in Java

JUGC is a Java library for unit conversions. It allows you to define a set of units and their relationships (a kilogram is a thousand grams, a tonne is a thousand kilograms, etc), translations for those units (gramma is fi_FI for gram), generate a Java library from those units (well, most of the library won't be generated, but the unit definitions will be) and then deploy that library in a project.

So basically you'll go from unit definitions like this:

                    <from>9 5 / * 32 +</from>
                    <to>32 - 9 5 / /</to>

                    <from>459.67 +</from>

to converting units like this:

    ConverterFactory.getConverter("celsius", "rankine").convert(42);

And the translation support is pretty simple, too:


                    <from>1000 /</from>




And then in your code:

    ConverterFactory.getConverter("gramma", "kilogramma", "fi_FI").convert(42);

The conversion expressions are in RPN.

I have yet to make a release and it's not totally finished — it should be possible to ask for the conversions to be done with arbitrary precision math, for instance — but I believe it's pretty usable already.

License: BSD sans advertising clause.

Article page

Stamp out the ants

If learning a simple, conceptually mainstream language such as Ruby is too high a price to pay to get away from the madness of Ant and Maven, as it seems to be for some people commenting on Raven, I'm inclined to think you are in the wrong line of work. And Ant and Maven are hardly zero learning curve tools just because the syntax uses XML.

It's possible that Raven (or JRake) isn't the right solution, but the irrational fear evident, for example, in this TheServerSide thread, would be hard to believe if it wasn't just business as usual in the Java world.

Article page

Writing to envy

Two remarkable pieces of writing in the blogosphere today, both ending up in the instant classics section of their respective categories.

The first one is a tutorial style piece exposing the inner life of a search engine. A simple full-text search engine in 200 lines of Ruby. It's concise, it's clear and after reading it anyone can write a simple search engine. If only all things in the world of code were explained that well.

The second one has been linked from all over the place, including some A-listers, so this probably doesn't come as news. But it's so good it deserves all the attention it can get. Socrates takes on WS-Mumbojumbo: The S stands for Simple.

Article page