Thursday, January 25, 2007


WARNING: This blog entry was imported from my old blog on (which used different blogging software), so formatting and links may not be correct.

First, the video from the 100th JavaPosse episode is
available. "Crazy" Bob Lee has some photos as does
Peter Moore.

Second, the
JRuby Serial Interview #4 episode is available, where I talk about the NetBeans+Ruby work. There are two more new screenshots in there...

Monday, January 22, 2007

Ruby Screenshot of the Week #2

WARNING: This blog entry was imported from my old blog on (which used different blogging software), so formatting and links may not be correct.


Here are some things to notice:

  • NetBeans knows you're creating a method definition for a class, so it only
    shows method matches that are inherited from the superclass. In this case,
    we're inheriting from Integer and there are two method matches that start with "ab" - one from
    Numeric and one from Object.
  • It shows documentation for the method, based on the rdoc
  • It shows where each method is coming from
  • It's dealing with moderately broken source

Saturday, January 20, 2007

Live Centennial!

WARNING: This blog entry was imported from my old blog on (which used different blogging software), so formatting and links may not be correct.

On Monday night we're going to record our 100th episode of the Java Posse. To mark the occasion we're going to do it live at Google's headquarters in Mountain View. If you're a listener please join us - Monday night at 6:15pm. More details in the shownotes for episode 99½ - here.

Also, we have the upcoming unconference in Colorado - the Java Posse Roundup 2007, March 6-9, co-hosted by Bruce Eckel. Sign up now, it's going to be a blast!

Thursday, January 11, 2007

Ruby Screenshot of the Week

WARNING: This blog entry was imported from my old blog on (which used different blogging software), so formatting and links may not be correct.

If you've listened to the latest Java Posse episode (#99, around 56 minutes into the podcast) you heard me getting caught red handed, coding in the background while we were recording. Joe pressed me to state exactly what I was working on: Code completion within Ruby require and load statements in NetBeans. Here's a screenshot:

This will hopefully be available soon...

Saturday, January 6, 2007


WARNING: This blog entry was imported from my old blog on (which used different blogging software), so formatting and links may not be correct.

The "5 Things Meme" is working its way around the internet, with people writing 5 things about themselves and then passing the baton to 5 others. Yep, exponential growth. I've been really busy with personal life recently but I'd better get this done before there's no-one left to tag! I've already been tagged by three different people (thanks
Alexis, David and
so I guess the signs of congestion are already becoming apparent!

It's hard for me to write 5 things that you don't know about me, because I know many of my readers listen to the Java Posse, and we frequently talk about our personal lives and our past there. You already know about my Dragon 32, Commodore 128 and Amiga 500 days, as well as my kids and hobbies like paragliding.
Anyway, I think the following list should hopefully be new and entertaining:

  1. When I was 18, I came to the USA as an exchange student in high school in Kansas.
    I joined the cross country running team, and the first week of school they had
    a rally during a football game where the new team was introduced. The coach (who
    was also a wrestling coach) introduced me to the home crowd as an exchange student
    from Sweden! (If you're not a regular reader, I'm from Norway). Well, we have this
    little national tiff between Norway and Sweden, telling "Swedish jokes" the way Americans
    used to have Polack jokes. So, I promptly took one step forward, and proceeded to greet
    the coach with the middle finger!

    Yes, looking back at it, and having been immersed by American culture for the
    last sixteen (oh my, has it really been that long?) years, it sounds shocking to me
    that I'd do it, but hey, it was high school, it was impulsive, and meant as a joke.

    Suffice it to say, the coach did not find this funny. I don't think Kansas wrestling coaches
    are the most receptive audience for such a greeting anyway, especially on home turf with
    the yearbook photographers standing by!

    I convinced the coach that I was truly sorry and had not meant offense, and we patched up
    through the season. But at the end of the year, on the last running practice, the coaches
    had arranged a treasure hunt - we ran around the town, looking for clues and finding little
    gifts. My gift from the coach was a cutout of a hand, with the middle finger cut off at the
    middle, blood painted on, and the inscription "If you ever do that again..." !

  2. In high school they opened a local radio station in my home town. I immediately joined,
    and had a lot of fun as a D.J., playing my favorite records, having callers call in and
    asking them questions from quiz books, etc. I also occasionally ran the "reruns" of the
    news episodes. One Saturday I came in, turned on the antenna, and started the most recent
    rerun tape. I then pulled out my homework and started working on it. However, listening
    to news while doing calculus is not easy, so as I so frequently did, I turned on a record
    and turned down the volume of the live feed channel. It was actually Woodpeckers from Space
    if I recall correctly! However, this time I had apparently
    pulled the wrong control, because after 15 minutes, a friend of mine called the radio station
    and told me something was horribly wrong - there was disco music playing on top of the
    interview and nothing was legible! Ooops.

  3. I ran track as well. I was not good at it - though I did get a couple of regional titles.
    One time, when I had travelled 4 hours away to an indoor track meet, one of the local
    runners (who I knew was one of the best junior runners in Norway) came over and asked me
    out of the blue (and as if he knew me) if I had been training much this winter. I said
    something to the effect of "yeah, twice a week or so" to which he had a long good laugh. He
    then told me he was bitter I had beaten him by 2/100s of a second in Japan the previous
    fall! What was going on? It turns out I looked a LOT like another runner in Norway,
    Vebjørn Rodal, who later went on to win the 800 meter dash in the Olympics in Atlanta '96.
    At this time he was still a junior, but a top runner. Later that spring, I was running a race
    in Oppdal, near his hometown, and he was present. When I ran the 800m dash, my coach
    had been standing next to Vebjørn's coach, and his coach had said "I thought I had
    told Vebjørn not to run this one!". I wish I had pictures of him and myself at that
    age so you could be the judge yourself. Instead I'll give you a couple of pictures of him
    later; I think the similarity is still there but obviously not as much. Those of you who
    know me can be the judge:

  4. In 2000, I was in Norway for the summer when Bill Clinton was visiting the country.
    One night my ex wife and I went out on the town, and walked by a restaurant with a crowd
    outside of it. In the window we saw Bill Clinton and a group of people having dinner in an
    otherwise empty restaurant. The were a number of guards in black suits hanging out by the door.
    We asked if the restaurant was open for business - which it was, so we went in! We had drinks
    at the bar (hey, this was an expensive restaurant!), and we were the only other people there!
    When they were about to leave we decided we had to say something, so my ex wife went up
    and after the introductions joked something along the lines of "Well, we're thinking of moving
    to Norway now that Al didn't make it". (This was right after Al Gore had lost(?) the election.)
    Bill Clinton came right back and said (and you've gotta read this with an Arkansas accent, especially
    the "fight" word), "No, you've gotta stay and fight. Stay and fight!".

  5. I started graduate school at the Stanford University computer science department at the same time
    that Larry Page (one of the two co-founders of Google) did. We took a number of the same classes,
    and we both hung out in the HCI group on Fridays since they had a number of interesting
    guest lecturers, research topics and discussion groups. We've both done well for ourselves, huh? (wink wink)

And now it's time to pass the baton. Since my fellow NetBeans and Creator engineers are already tagging each other, I'm going to try to branch it out in new directions: My brother and Sun Norway engineer (and OpenGrok developer)
Trond Norbye,
my fellow Java Posse members
Joe and
and JRuby developers
Charles and

Tuesday, January 2, 2007

Code Tip: Statically Check Multiple Interfaces

WARNING: This blog entry was imported from my old blog on (which used different blogging software), so formatting and links may not be correct.

You may think generics is all about avoiding casts in collections. However, I found a really good use for them the other day that's pretty useful.

Let's say you have a method which takes a List and does something with it.

void doSomething(List list) {

(In my code, it's actually List<String>, but I'm trying to keep other generics out of this to motivate those of you still needing a good reason to learn them.)

In my case, I needed to iterate over the list in reverse order. Uh oh, that's going to be pretty expensive for some types of lists, and if I switch my implementation to for example a LinkedList in the future, I'd like to revisit this. Obviously, I could make my method the following:

void doSomething(ArrayList list) {

However, using specific implementation classes rather than interfaces is frowned upon, and besides, this needlessly prevents the method from being used with other random access list. On the other hand, I would like to state in some way that this method really wants to be able to access the list elements in random order.

java.util.RandomAccess to the rescue. Lists that provide random access implement this interface. But what do I put in my method signature? RandomAccess is not itself a List. I really want to specify multiple constraints on my parameter.

This is precisely what generic methods allow! The following method declaration will accomplish what I want:

<T extends List & RandomAccess> void doSomething(T list) {

Here we're saying that my parameter T is a generic type, which satisfies multiple constraints: it both extends List and it implements RandomAccess! You can pass an ArrayList to the above method, but not a LinkedList!

Think hard about the constraints you add. In some cases, adding a RandomAccess constraint on a method is leaking implementation through to the client - it reveals something about the implementation behind the method signature that may change later. I find this most appropriate within implementation code.