Just started to work for a project where the majority of the people use Windows. Quick fix for ^M occuring in shell scripts:
sudo aptitude install tofrodos
and then
find . -name '*.sh' | xargs dos2unix -d
(could be with exec, but for a small number of files it does not really matter)
piątek, 22 maja 2009
sobota, 9 maja 2009
A cryptographic hash of an empty byte array does exist. Honestly.
An hour or so spent and finally the reason found - no data. That test proves it in a way:
The output:
Exactly the same as the one I was getting. In particular, different from the expected one (suprise). I should make some constant ;-/
@Test
public void testNullDigest() throws Exception {
MessageDigest md = MessageDigest.getInstance("SHA1");
System.out.println(ArrayUtils.toString(md.digest(new byte[0])));
}
The output:
{-38,57,-93,-18,94,107,75,13,50,85,-65,-17,-107,96,24,-112,-81,-40,7,9}
Exactly the same as the one I was getting. In particular, different from the expected one (suprise). I should make some constant ;-/
sobota, 2 maja 2009
Prune unnecessary log4j dependencies in maven
If you want to use the newest log4j with maven build, you may notice a few dependencies you may not want to include if you just want to have plain ordinary logging without JMX or mail support.
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.15</version>
<exclusions>
<exclusion>
<groupId>javax.jms</groupId>
<artifactId>jms</artifactId>
</exclusion>
<exclusion>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
</exclusion>
<exclusion>
<groupId>com.sun.jdmk</groupId>
<artifactId>jmxtools</artifactId>
</exclusion>
<exclusion>
<groupId>com.sun.jmx</groupId>
<artifactId>jmxri</artifactId>
</exclusion>
</exclusions>
</dependency>
Subskrybuj:
Posty (Atom)