Wednesday, November 25, 2009

Efficiency of a one time debugging session.

Value stream mapping of a debugging session of a fast moving open source project.

  • svn update: 3 min
  • mvn install (downloads the world) [FAILURE]: 3 min
  • mvn clean install (downloads the world) [FAILURE]: 3 min
  • manualy clean the workspace (remove deleted files): 1 min
  • mvn install (finishes downloading the world): 5 min
  • mvn -DdownloadSources=true idea:idea (downloads the world II, the source return): 10 min
  • start idea: 3 min
  • open project inside idea: 5 min
  • configure a newer JDK in idea: 3 min
  • start the program in debugging mode: 30 sec
  • add a breakpoint: 15 sec
  • reproduce the problem: 15 sec
  • find the bug: 15 sec
  • mail the user: 1 min

Total time: 48 min 15 sec
Time effectively spent on the issue: 2 min 15 sec
Efficiency: 4.66%

YMMV. Done on an almost 3 years old laptop running Ubuntu (1.83GHz Dual core, 2G RAM, 320G disk).

(those timings are from memory, but they seem consistent with the time I used between my mails.

Potential conclusions:

  • don't do random development on semi-complex open source projects ?
  • use less complex toolkits/development environments. I usually just read the code in less, nano or gedit. Hint: if someone gives me a simple editor that allows me to navigate between classes, that fires up very quickly, by just reading a maven pom, that would be pretty cool. If that editor had a terminal, even better. Maybe it is time for me to revisit emacs and its ecb...

There was a time when firing IDEA was a joy. Is my machine too old ? Did I lose something?

ssh/sftp in java

Some years ago, we had to deal with SFTP file transfers. We solved the problem by reusing the Apache licensed projects Commons VFS and the org.apache.commons.vfs.provider.sftp.SftpFileProvider class. This reuses the jsch library, and after having to troubleshoot some issues wrt threads and strange disconnections, it left a sour taste in my mouth. (jsch code isn't really my taste, and there's little logging for example, even though the author praises openssh's -v arguments. I don't want to diminish the author's accomplishments, but debugging production server issues with a debugger isn't fun).

I've found the Trilead project, but this project is unsupported now. Latest code is available e.g. from here.

Then another blog entry (also rambling on the code quality of the jsch project...) led me to commons-net-ssh, which sounds like a compelling alternative for SFTP file transfers.

Apache licensed, it looks active, somewhat documented and with a couple of unit tests...

The README says "GSOC project "SSH and SCP for Apache Commons-Net"", and this blog entry hints that the project should be retrofitted one day into apache commons-net. Can't wait for that.

Tuesday, November 24, 2009

xhtml, html and file extensions

I lost 30 min trying to understand why my proposal for handling String timezones in maven POM files (a la 'Europe/Oslo' instead of '+1' that doesn't take into account summer time) wasn't working in firefox 3.5.5 but was working in chrome and opera 10.01:

If I understood well, files served as .html are loaded as HTML files not as XHTML files in firefox, even if the doctype is XHTML transitional. So >script ... /> are turned into >script< and thus mess up the next element... w3c validation doesn't say anything.

I am still unsure this is how it should work, but using <script ...></script> solves it.

thanks to #firefox on moznet for help.

Thursday, November 19, 2009

Strategies for managing many small maven2 and hudson projects

So you finally decided to structure your maven2 projects properly, e.g. identify the correct set of plugin versions/configurations that work well in your environment, introduce a set of corporate POMs.... You also decided to clean up your hudson usage, use new plugins, etc...

You have to change many POMs, probably adapt hudson projects as well. You don't want to change all those configurations one by one. The good news is that both maven and hudson use XML as storage for the config files.

Here are some tips and tools you might want to use: