Thursday, November 13, 2008

Javascript tagName and labels

First of all, tagNames are always UPPERCASE! Secondly, when an event listener (onclick) is registered to an element, containing a label with its 'for' attribute set to a valid input id, click on that label will result in two events being fired: one for the label and one for the appropriate input.

Tuesday, November 4, 2008

Are you using getters and setters?

Then use them everywhere. I mean equals, toString, compare and other methods, belonging to the same class. Failing to do so might backfire any time you add some logic to the setter/getter (and I know, that getters/setters are considered an anti-pattern by some, but that's another topic).

Saturday, October 11, 2008

Eclimd doesn't see your workspace

Add
-Dosgi.instance.area.default=path_to_the_workspace
to the eclimd.bat run parameters.

Wednesday, October 8, 2008

Ibatis nested resultmap/select memo

Ibatis v. 2.1 : when using nested resultMaps you must put sqlMap namespace before the actual resultMap name. When using nested select - namespace isn't needed.

JSON-lib memo

JSON-lib library for java v. 2-2-2-jdk15. Uses java string quotes (double quotes) when serializing JSON objects to string.

Monday, September 29, 2008

Struts 1: Action to DispatchAction

In order to convert Action to DispatchAction, change the action name from 'execute' to 'unspecified' and add a 'parameter="something"' attribute to action node in struts.xml.

Tuesday, September 23, 2008

Mockito matchers

Configuration: Mockito 1.5, TestNG 5.8 jdk15, maven-surefire 2.4.2
Don't use mockito matchers (anyInt, anyString, ...) to 'mock' arguments for non-mocked/stubbed method calls. Using matchers this way can cause unpredictable test failures, as the state of matchers is being tracked statically (simpliest explanation I could come up with without digging into source). You might get an InvalidUseOfMatchersException in a test case different to the one matchers were used in.