Skip to main content

Open Source Bluegrass

Posted by hansmuller on October 5, 2005 at 1:23 PM PDT

This past Saturday morning, a friend and I were in San Francisco at
Golden Gate park, walking out of the Speedway Meadow. It was cool and
overcast and the fog blanketed the tree tops and hung over our heads
and gave the surroundings the blurry hazy look of an old newsreel. We
were walking down into another hollow, listed on the map as Marx
meadow, and drifting toward us was the sound of Joan Baez singing
"The Night They Drove Old Dixie Down". The long narrow meadow is
flanked by steep hills and tall trees. With its foggy ceiling and dim
light it felt like a cathedral. There were thousands of people there,
listening, shuffling toward the stage for a better view or just
sitting in the grass listening to the story about Virgil Caine and the
tragedy of the American Civil War. We joined them and listened to
Joan Baez sing more old American songs, songs by Woody Guthrie and Bob
Dylan and folk songs that have been around so long they're just
attributed to "traditional". I'll never forget being the same place
last year listening to John Prine sing "Angel from Montgomery" or this
year, hearing anti-war and protest songs inspired by conflicts from
the distant past and from right now.

It's tough to write about how great it was spending a day listening to
music. It was entertaining, it was moving, it was fun, sometimes it
was beautiful. In the evening it was really cold. You should have
been there. If you live in the area, you should have stepped away
from the keyboard and taken your head out of the network for a while,
and plugged it into the music. At least that's what I did and I
couldn't have been happier. But that's not why I'm writing this.

There were five big stages in Golden Park on Saturday and Sunday,
different bluegrass and folk music performers every hour, from 11AM
till 7PM, and it was all free. Free as in Free Beer. A (very)
wealthy man named Warren Hellman has been putting on the "Not Strictly
Bluegrass Festival" show on his own dime for the past five years. I
can't tell you exactly why he does this, although if I had to guess
I'd say he's motivated by the same spirit that inspires software
engineers to join open source projects and build things just for the
pure joy of it. That spirit confounds economists looking for a profit
motive and capitalists looking for a profit. There were about a
bajillion people in Golden Gate Park taking in the music over the
weekend, and they weren't confused at all.

So I just wanted to say thank you. Thank you Warren Hellman for
sharing two days of music with the Bay Area, again.

If you've actually read this far and have made a mental note to delete
me and my moon-eyed ravings from your RSS feed, here's a non-sequitur
that I hope you'll find reassuring. It doesn't have anything to do
with free music, but it's a genuine Java code sample that you might
find useful.

Examples from the java.util canon are usually short and tidy. In
theory, now that we have type parameters, the can be even

shorter and tidier
. For example if you have a TreeMap
that defines the number of occurrences of each word in a document,
you can print them all like this:

Map<String, Integer> countMap = new TreeMap<String, Integer>();
...
for (Map.Entry<String, Integer> e: countMap.entries()) {
    System.out.println(e.getKey() + ":" + e.getValue());
}

All well and good, unless you wanted to see the word/count entries
sorted by word count, not by word. TreeMap keeps the entries sorted
by key, that's the word String in this case. To sort the word/count
Map.Entry entries by word count you must convert the entries to a
List, define a Comparator that compares Map.Entry values, and then use
Collections.sort to sort the list.

/* Sort the entries in countMap by count.  This code has
* me wondering about just going back to AWK.
*/
Comparator<Map.Entry<String, Integer>> compareEntries =
    new Comparator<Map.Entry<String, Integer>>() {
    public int compare(Map.Entry<String, Integer>e1, Map.Entry<String, Integer>e2) {
        return e2.getValue().compareTo(e1.getValue());
    }
};
ArrayList<Map.Entry<String, Integer>> entries =
    new ArrayList<Map.Entry<String, Integer>>(countMap.entrySet());
Collections.sort(entries, compareEntries);

Maybe it's just me, but yech. Sometimes I'd really rather just
listen to Earl Scruggs play Foggy Mountain Breakdown.

Related Topics >>