Can’t test this?

After a most unproductive chase after a stupid programming error  – tab completion for imports in groovy/eclipse is just not good because eclipse won’t tell you afterward that you accidentally imported another class that now changes the type of your parameter and you can spend hours trying to find that one … “MethodMissingError” thank you very much! – … I finally gave in and quit.

So instead of chasing the bug by testing on the server as we used to do, I made mock objects and even modified the framework’s code. Now we can finally test the code outside of the framework 🙂 It was much easier than I thought. Yay. I even got to program some code!

We had been of the opinion there was no other way to test the code. Well, we were wrong: our need to have easier testing options was just not so great obviously and testing within the framework did not hurt enough, yet.

So I just made testing so much easier and it was even fun to do so after I decided to go through with this.

Rückblicke

Nachdem ich heute mein M’era Luna T-shirt anhabe und wir schon länger über Karlsruher Diskos, DJ Mozart und schwarzgekleidete Leute geredet haben, habe ich soeben nochmal den alten Bericht über das M’era Luna 2004 gelesen. Ein wirklich denkwürdiges Festival und der Bericht hat ein Zweit Lesen durchaus verdient.

Dieses Jahr wirds wohl nix mit Festivals … das M’Era Luna ist am 9./10. August und ist noch nicht ausverkauft … ? Need Festival.

I like me some compact code

Lately Groovy has been the language of choice for my scripting needs.

And slowly I am finding out how to do things in a groovy way instead of relying on shell commands that don’t always work as they would in a shell environment:

"scp user@host:*.java .".execute()

is just not the same as executing the same command in bash.

One of my pet peeves in Java is the way maps are handled. If you want to use a map to count occurrences of something you’ll have lots of fun doing so. It becomes even more hideous when you have multiple nested maps in your data structure:

if(!map.containsKey(keyA)){ map.put(key,new HashMap()); }
if(!map.get(keyA).containsKey(keyB)) { map.get(keyA).put(keyB,0); }
int counter = map.get(keyA).get(keyB)
map.get(keyA).put(keyB,counter+1)

Now for the same in groovy:

map[keyA][keyB] = map.get(keyA,new HashMap()).get(keyB,0)+1

I like it much better this way. I am sure many other languages allow for the same quick and easy way to accomplish this task. I just enjoy programming in a scripting language that is based on a language I know very well.

And by the way: I do not think that code written in scripting languages needs to be readable. If what you write is that important you should use a “real” programming language. Scripting languages are hazardous for code readability anyway as it is one of their defining features that they allow many shortcuts and are less strict on syntax than their grown-up counterparts.

PS: “Real Programmers Don’t Document If it was hard to write,it should be hard to understand”

Jboss Interoperability

todolist

My todolist is rather short. However it could not be longer.

I’ve been on this problem for days, so have several colleagues.

If anybody knows what is necessary to make a 4.0.2. jboss do successful rmi with a 4.2.0 jboss.

We keep getting a

ClassNotFoundException: org.jboss.ejb3.stateless.StatelessRemoteProxy

on doing the jndi lookup of our beautiful @RemoteHome interface. We’re of course missing the ejb3 client classes in the old jboss.

The wiki only states that we need to use the “legacy rmi invokers” to make the rmi work. But nobody ever explains anywhere how I make my application use those funky rmi invokers. It is probably so trivial, nobody could imagine, I would not know how to do it. Time and again we find people posting about a problem similar to ours and the thread ends with “oh it works now that I am using the legacy rmi invokers”. Thanks so much.

Update: for now it works in a weird way. We now have a proxy application. Basically the new structure now has three applications:

  • (A) the legacy app: a 2.x application deployed on a 4.0.2 server
  • (B) the proxy: a 2.x style application (no ejb3 annotations) deployed on a 4.2.0 server
  • (C) the new app: an ejb 3 application deployed on a 4.2.0 server

The calls now go like this (A) => (B) => (C). Why does it work? The proxy has no annotations typical for ejb3 whatsoever.  Therefore the ejb3 deployer ignores it and the “normal” deployer is triggered instead which leads to the ProxyFactory producing downward compatible rmi objects. The ejb3 proxy objects that are returned by (C) are in this way eliminated by routing calls from (A) through (B). This is not the most elegant solution and we’re still hoping to find something better. In the long run the server on which (A) runs will have to be upgraded anway which would also be a solution.

It also turned out that we indeed had managed to configure the application to use the legacy rmi invokers by deploying a deployment descriptor for our bean which referenced those invokers. We had just not managed to get to the point where this was relevant before. I’ll post the deployment descriptor tomorrow.

Producivity Tools Recap

You may remember the longish article I wrote about online todo list tools or you may not. Anyway it has been some time and I can now post a conclusion to this.

At first I really tried hard to work with Remember the Milk, I really wanted to like it. It ended hab having too many features.

Right now I am very actively using todoist. It is simple, has a clean layout and doesn’t have any unnecessary features.

At work one of the first things I do after reading my mail and cooking tea, is opening the todoist page and reviewing my tasks for the day. All my tasks have dates associated except those in the “Later” category. These dates serve as a reminder. If I didn’t get something done on a specific day, I re-schedule the task for another day during my morning review. I use projects to map the gtd categories and I use tags to differentiate between tasks for different projects, between work and private stuff.

In meetings I write down everything that sounds vaguely like a task. After each meeting I transfer the tasks to todoist.

I have to admit though I only got back to using todoist after a break of 4 or 5 months. But it was easy to get back into it and right now it is immensely helpful in helping me remember all the little and big things I need to do.

And now we are going to a barbecue party 🙂

code from the heap?

these days we have been looking into some weird performance issues with a project that is supposed to go live soon. we have not written all the code ourselves …  and were wondering why certain pieces of code had a constant 2 second duration which did not show up in the profiler.

we then found the following line of code:

monitor.wait(2000);

do I need to say anymore?

More Screenspace

So Saturday my new display arrived:

I am now running my gaming machine with a 24″ and a 19″ display. At work I have a single 17″ 🙁

My desk at home is a bit too small.

It takes some getting used to. I have so much screen space now that I don’t want to max out my browser window anymore because nearly all websites look pretty strange.

Productivity Help Online

I have started to manage a lot of things through the web and was on the lookout for a good online “todo list” application. So when I saw the Reader Poll: Best Online To-do List Manager? on Lifehacker, I had hopes to find something good. Admittedly at first I only checked out the two services with the most votes: Remember the Milk and Todoist. But when I started writing the article I made an account on every single one of the services mentionned in the poll. So what’s below the cut? Screenshots, links and mini reviews – strongly opinionated – of all the different todolist managers. If you’re lazy jump to the conclusion now.
Continue reading “Productivity Help Online”

new mmos

Tabula Rasa has an open beta out.

Many mmos coming out next year, will there be one to end the reign of WoW? (via Tobold)

My bet is on WAR. What I know? It will dent our guild membership, unless we make the jump and try it together. Not that I care overly much. My guild membership consists of reading and posting in the forum and logging on for an hour a week.

I think WAR is hyped quite a bit though and playing NWN2 I noticed how good WOW is.