Monday, June 29, 2009

Keep your documentation website backwards compatible

Most engineers know that you should at least try to keep your software and hardware backward compatible.
If it is not excessively expensive, the new version of your program should read data files created with previous versions, your newest 10Gbit switch should talk to the 100Mbit legacy one etc.

People seem to forget that this should also apply to your website with product documentation.

I have a nice Cerberus Pentagram P6381-0 wireless router that usually works perfectly. Today, however, I had a power glitch that left the router in unusable state.
I managed to get to the vendor's site with documentation, but the closest model I could get the PDF for was P6381-2 (can you spot the difference? ;-))
I managed to reset the router to factory settings using that doco - but surprise, surprise: the default password does not work.

Almost an hour later I googled for the exact model number and I found the right manual on the very same site - it just was not linked in the support links section. If it was, it would have spared me 2 hours of looking for the problem.

And yes, the default passwords are different for P6381-0 and P6381-2 models.

Lesson learned: keep the documentation for older releases easily findable for as long as you have people using it.
This applies esp to products that are not likely to be upgraded as soon as you release the new version: either because it is a piece of hardware or when upgrade costs money or significant effort.

Thursday, June 4, 2009

Unit testing your Intellij Idea plugin in a CI build

It's relatively easy to write a unit test for your Intellij Idea plugins that would work from under Idea.
Just extend an IdeaTestCase or LightIdeaTestCase, add some Mockito and enjoy :-)

The challenge is to set this up for an Ant build run on a continuous integration server like Bamboo - you just don't get the Idea set up on every potential elastic build agent that may turn out to run your build ;-)
I wanted my build to be self-contained - no external dependencies on stuff that may or may not be there, everything gets nicely checked out from the svn.

I came up with the following configuration:

Set up new Idea home



My lib contains an idea_version folder reflecting the structure of the actual Idea installation:

  • lib folder containing all the jars from Idea's lib dir - definitely all are not required, but it seemed to be too much work to actually find out which ones are,
  • bin folder that is necessary for the test framework to start - namely it should contain:

    • idea.properties - just copied as is, this is the marker that Idea uses to determine the folder is it's home,
    • log4j.dtd - also copied as is,
    • log.xml - modified so that the 'headless' Idea can find the log4j.dtd file:
      <!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">

      You may use an unmodified one, but then you need to make sure that the log4j.dtd file is in the current working directory of the test runner.


Set up test runner



I use this test target:
<property name="idea.home" location="${basedir}/lib/idea_9833"/>

<target name="idea7.test" depends="idea7.test.build, idea7.testproject">
<mkdir dir="${output}/test/xml-report"/>
<mkdir dir="${output}/test/system/log"/>
<junit dir="${output}/test" fork="true" forkmode="once" printsummary="on">
<jvmarg line="${jvm.args}"/>
<jvmarg value="-Xbootclasspath/a:${idea.home}/lib/boot.jar"/>
<jvmarg value="-Xmx256M"/>
<jvmarg value="-ea"/>
<jvmarg value="-Xdebug"/>
<!--<jvmarg value="-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5006"/>-->
<sysproperty key="java.awt.headless" value="true"/>
<sysproperty key="java.compiler" value="NONE"/>
<sysproperty key="idea.config.path" value="${output}/test/config"/>
<sysproperty key="idea.system.path" value="${output}/test/system"/>
<sysproperty key="idea.load.plugins" value="false"/>
<classpath>
<path path="${java.class.path}"/>
<path refid="testpath"/>
<fileset dir="${idea.home}/lib" includes="*.jar"/>
<pathelement path="${output}/test/classes"/>
<pathelement path="${idea.home}/bin"/>
</classpath>
<batchtest todir="${output}/test/xml-report">
<fileset dir="${basedir}/test" includes="${test.includes}"
excludes="${test.excludes}"/>
<formatter type="xml"/>
<formatter type="plain"/>
</batchtest>
</junit>
</target>


Some highlights:
  • Make sure both Idea lib and bin are on the classpath.
  • Make sure you have Java on the classpath - for some reason I had not.
  • Notice the -Xbootclasspath jvmarg - <bootclasspath> hasn't worked for me.
  • Remote debugger may be handy sometimes.

Thursday, April 23, 2009

Beware of your IDE code generation!

I just came up against one of the most frustrating bugs this week.
One of the config panels in my Swing application just stopped showing it's contents on my Linux development machine. It displayed the border, but no contents.
As usual, "I have changed nothing" (TM), and the code works perfectly on other machines.

The only change I did recently was upgrading the JVM from 1.6.11 to (64bit) 1.6.13 (to solve a SIGSEGV during JUnit tests run from Eclipse).

Thanks to ad-hoc pair programming session we discovered the cause quite quickly: for no logical reason the panel overrides the isValid() method to return true.
This (apparently) causes the panel not to display it's content on this particular version of Java.

The only reason I can think of why this code was here is accidentally pressing Ctrl-O or what was the shortcut for "override a method" ;-)

Lessons learned:
- get rid of suspicious code when you spot one (or make it clear why it is there)
- get someone to have a look at a problem with you - I would probably spend hours if I tried to solve it myself

Monday, April 20, 2009

Atlassian Stimulus Package - JIRA for 5 for $5

In (unlikely) case you haven't already heard - Atlassian is selling 5-person licenses for JIRA and Confluence for $5 (Five American Dollars!)

Despite announcements' catchphrase, it is a fully functional yearly license, not a 5-day one.
You get full support, you will be able to prolong for following years also for $5 (no $5000 surprises once you get addicted to the software). The only limitation is the 5 users limit.

Seems that the US President does not have a monopoly on Stimulus Packages any more ;-)

You can find out more on http://www.atlassian.com/starter/
Be quick - it's a time-limited offer.

Shameless self-promotion: if you need help customizing your new JIRA, you may come to us.

Wednesday, April 15, 2009

When MacBookPro is not enough

While the dual core MacBookPro is fast enough for web browsing etc, a nice QuadCore workstation with 8 gigs of RAM and a 3.5" HDD is much better for Java development.
It happened that we had a spare one I could use, but I didn't want it under my desk, so I don't hear it's power.

I decided to go for a VNC setup, looking for configuration that would provide as smooth experience as possible.
I came up with a set of requirements:
- I want the Linux desktop to sit on my secondary monitor without any extra bars, frames etc (fullscreen mode)
- I wanted my mouse cursor to be snappy enough so I don't feel it is remote - first of all no 'shadow' cursors chasing each other,
- keyboard should behave as if it was directly connected (or as close to that as possible)
- clipboard sharing would be a definite win

Picking the viewer


The first three were easy to meet - just download the (free) RealVNC viewer. (hint: download the Enterprise Edition for MacOS and install the free viewer only - it's the server you would need to pay for).
I really like RealVNC's fullscreen mode, low-intrusive keyboard handling and especially mouse pointer handling (in contrast to JollyFastVNC I tried before which is my second choice. The built-in MacOSX client is out of question - no fullscreen mode, shadow mouse cursor).


Clipboard sharing


Getting the clipboard sharing has cost me a few hairs off my beard, though.

You need to run the version 4 of VNC server (vnc4server on Ubuntu) with the vnc4config utility running.
Unfortunately, I run a x86_64 system that has this little problem.
I solved it by recompiling the package from sources, thanks to the hint by tomer t at the end of the bug report thread.

For the lazy - here is the deb package for you: vnc4server_4.1.1+xorg1.0.2-0ubuntu7_amd64.deb

Above VNC setup + some samba home folder sharing provide a really nice development environment I would never change for a noisy machine heating my desk, with separate clipboard, keyboard, mouse and monitor (although you may look for some synergy to solve the last deficiency ;-) )

Friday, March 27, 2009

My first EclipseCon - a story from the cloud

This was my first EclipseCon. As a few months ago I started working on Atlassian Eclipse Connector, it was time to get to know Eclipse community and also promote a little bit the whole project, which last Monday reached it the first public beta release.

We had a poster session about the project and I must admit I was very positively surprised how many people came to ask or talk to us about this project. Also the whole concept of poster reception is a great thing. While serving yourself delicious food, you could in a very informal style chat with various people on topics which interested you. Folks were also coming to say just to us “hello”, as they really like us and the way Atlassian does its business. I was really proud of it.

Interesting thing is that almost nobody currently does code reviews in their companies (although almost everyone would love to or plans it). Even more astonishing is the fact that still a lot of people does not use continuous integration or even have no idea what (and what for) continuous integration is. Finally interesting thing is that only less than 5% of people (one hand raised as far as I noticed correctly) admitted that they had some automated UI tests for the tools/systems they write on or for Eclipse platform. And again, most of people plan to use such tool in the near future (this is maybe why significant part of exhibitors offered UI testing tools).

From technical point of view I have the following short conclusion about current trends:
  • web-based IDE: +1,
  • cloud computing: +1,
  • SOA: -1
More precisely:
  1. Eclipse IDE is heading towards web browser. Yes. With e4 project and a lot of activities around stuff like RAP we may expect that in a year or two we will have most of functionality available currently on the desktop client will be available also in the web browser.
  2. SOA time as a buzzword is gone. SOA talks were the ones which were rated the worst and had poor attendance. SOA books were the one which stayed on the bookshelf at the bookstore unbought. SOA seems to be this topic which finally bothers people rather than brings money. It seems that it's the time when SOA was finally called for action: it has to stop claiming how valuable and great it is (feeding endless SOA gurus and consultants) and rather start proving it in reality.
  3. Cloud computing is a new trend. Amazon Elastic Cloud (EC2) was one of the hottest topic (including very interesting keynote). Unfortunately for many people it does seem to be yet another buzzword. I've seen examples of the systems which used cloud computing probably only for cloud computing sake. How cloud computing will change the landscape it is still hard to tell. However it seems that the recent release of Bamboo with it EC2 support may contribute to verification of the future of this stuff.
EclipseCon was yet another conference where some people used word “agile” to make topics of their presentations looking more sexy and attractive. IMO they always failed. Their talks had usually nothing to do with “agile”. Still “agile” seems for some a new key for success. Yes I agree, contrary to some 3-letter buzzword it means concrete valuable thing, but it won't help you if you just put it on your slides or session subject without really understanding and applying it in your organization.

Sessions which I would probably remember the most:
  1. The Social Mind keynote. Really interesting presentation and discussion about social soft aspect of writing scalable software. Refreshing, non-obvious and encouraging. Well done guys.
  2. Jetty@Eclipse. Great, technical presentation of Jetty in the context of its recent move to Eclipse foundation. Many interesting observations and examples of web server scalability, threading issues and asynchronous ways to cope with normally thread-blocking operations. Besides, the talk was really convincing (including awesome examples with Maven Jetty plugin) in its claim that Jetty is the best servlet engine currently available. Good job Greg Wilkins, Australia FTW!
I would summarize EclipseCon 2009 as a very good conference, but for one thing: the attendance. It was clearly visible that the organizers had expected much more people. A lot people did not show up, some talks were canceled or rescheduled. Some rooms were left unused, some were almost empty. It was quite depressing. Some EclipseCon veterans admitted that comparing to the previous year the number of attendees dropped maybe even by about 50%. I hope that this is only due to The Crisis and everything will be good again soon (next time).

Tuesday, February 10, 2009

I was sure it just works...

Today I learned that you cannot plug a mini-jack microphone to a MacBook and expect it to work. MacBooks don't amplify their line-in input to process the signal, they require a special gizmo you have to pay extra for.

To learn that I had to scratch Mac's case (and notice high mic signal level), then tap my headphones' mic (and notice no mic signal), then consciously process the information.

This observation makes my everyday habit of connecting headphones' mic to the MacBook and adjusting the mic so other people hear me better just look stupid.
The only upside is that I can still see other guys doing the same ;-)

I wonder how many things there are that I take for granted that actually are false.
The only problem is that to learn that I would need to challenge the obvious - not an easy task.