Entries Written By Michael
How I fixed the problem and got my Logitech mouse working OS X 10.6 Snow Leopard
Logitech has yet to release updated keyboard and mice drivers for OS X 10.6 / Snow Leopard. I’m quite fond of my Logitech MX 510 mouse and wanted this problem fixed as soon as possible. I used the instruction from the link below which tells you to download the “Logitech Control Center”, locate the “Logitech …
Want to use Spring 3.0 milestone release from Maven?
I wanted to add the Spring 3.0 M4 milestone early access release to a Maven project to test out some of the new features. However Spring milestone releases are not readily available in the standard public Maven repositories, so what do you do? For the full explanation check out the link to “Spring/Maven Repositories” link …
How to automatically provide an answer to Unix commands
How do you automatically provide an answer to a Unix command for example cp: overwrite `destination/./b.txt’? Many Unix/Linux commands that operate on files may stop and ask for confirmation for each file before completing an action. Of course for many Unix/Linux commands there are parameters that allows you to specify the desired behavior, but there …
JUnit 4 error: reference to assertEquals is ambiguous
This is a somewhat confusing compilation failure that sometimes happen when you write unit tests using JUnit 4. This is an example code snippet that produces this error (result.getValue() returns an Integer object): assertEquals(12345, result.getValue()); And when you try to compile your project it produces a compilation error like this: /projects/myapp/src/test/java/org/myapp/MyTest.java:[88,8] reference to assertEquals is …
Spring XML and defining end of line characters in a bean property
If you need to define and end of line character (EOL) like n in your Spring XML files in a bean property you can’t do this <bean id=”some-bean-id” class=”some-class”> <property name=”my-property-name” value=”n”/> </bean> This simply wont work. You’ll end up with a backslash followed by the letter n. What you have to do is to …
Maven, Log4j and javax.jms
Log4j version 1.2.15 added features which has new dependencies on sun and javax packages. When you try to build your project using Maven and log4j 1.2.15 you will see this: [INFO] Unable to find resource ‘com.sun.jmx:jmxri:jar:1.2.1’ in repository central (http://repo1.maven.org/maven2) [INFO] Unable to find resource ‘com.sun.jdmk:jmxtools:jar:1.2.1’ in repository central (http://repo1.maven.org/maven2) [INFO] Unable to find resource …
svn: Inconsistent line ending style when trying to commit a binary file
If you get this error message “svn: Inconsistent line ending style” when trying to commit a binary file into your SVN repository then Subversion probably thinks that your file is a text file. First verify your file with: svn proplist <your-file> If the result contains svn:eol-style but you know that your file is a binary …
How to read environment variables in Java
You can set environment variables or pass them in using the -Dvariablename syntax SET logfile=/location/to/my/log/file.log or java -Dlogfile=/location/to/my/log/file.log HelloWorld When you want to access these environment variables from your Java source file you can use Java 1.5 and newer: String logfileLocation = System.getenv(“logfile”); Java 1.4 and older: String logfileLocation = System.getProperty(“logfile”);
What jar file does a Java class belong to?
I found this very useful web site that allows you to search what JAR file a specific Java class belongs to. This has proven quite useful to me over the last couple of days when I had to deal with NoClassDefFoundError and ClassNotFoundException problems. You can just enter the name of the class or JAR …
Mockito an alternative to JMock
I’ve used JMock for quite some time and I’ve found it to be a great and very useful mocking framework for unit testing. I was never quite happy with the syntax though; especially the part where you specify expectations. Here’s a JMock snippet illustrating an expectation and a return value from a mocked object context.checking(new …
Recent Comments