Today NetBeans 6.5 got released. Congratulations, guys! I’m primarily an Eclipse user1, but I keep hearing about NetBeans through the Java Posse and heck, I even subscribe to the NetBeans podcast to try and keep an eye on what’s up. Every time a new release comes out, I give it a whirl.
So [...]
Once again, jasypt (”Java Simplified Encryption”) makes me smile.
Java comes with a comprehensive set of encryption utilities: JCE. I had to do some decryption the other day and ended up with this code.
public class Decryptor {
private static final String ALGORITHM = "PBEWithMD5AndDES";
private final Base64 base64 = [...]
If you build a jar file with maven, it helpfully embeds a properties file so that you can pull out information about the build environment. You just need some code like this.
String path = "/META-INF/maven/groupId/artifactId/pom.properties"
InputStream stream = getClass().getResourceAsStream(path);
Properties props = new Properties();
props.load(stream);
System.out.println("my version is" [...]
I’m in the middle of converting jslint4java to use maven as its build system (yes, really). Part of this is ensuring that the antunit tests I wrote continue to work. Maven has the antrun plugin, but it’s not 100% obvious how to use an antlib inside it.
Normally, to run an antlib extension as [...]
I’ve been taking a look at jersey today. It’s an implementation of JSR 311, which is a proposed spec for implementing REST-like web services in Java. I started with the tutorial, which is quite frankly pretty bloody simple.
@Path("/helloworld")
public class HelloWorldResource {
@GET
[...]
For the cocoon 2.1 project I did last year, I wrote a few components in Java (mostly Generators and one InputModule). It’s a bit of a pain because it’s built on the out-of-date and intrusive avalon framework. Anyway the end result is that you can write things in your cocoon sitemap like:
[...]
I’ve finally gotten around to finishing off the code that I’ve had sitting around in google code for over a year, and released jslint4java 1.2. The changes are actually pretty small:
Update to jslint 2008-09-04. This adds several new options.
Several updates to the ant task:
Move the antlib definition to “antlib:net.happygiraffe.jslint” (incompatible change).
Default to failing [...]
What is an IP address? To many people, it’s just a sequence of four digits separated by dots1. But really it’s just a 32 bit integer. So, my IP address right now is 192.168.1.52. As a 32 bit integer, that’s:
0xC0A80134 (hexadecimal)
11000000 10101000 00000001 00110100 (binary)
An IP address on it’s own isn’t [...]
Logging has long been a pet peeve of mine. I find it intensely irritating to arrive at a tomcat installation and see a catalina.out file hundreds of megs large because some fool of a developer thought that System.out.println() was a good logging tool. I recently gave a presentation at work about logging, and [...]
I was trying to resolve entities (&weirdChar;) in an XML file. Easy enough, use a validating parser. But here’s the tricky bit: get the entity definitions from the classpath. This should still be easy, as SAX provides an EntityResolver.
Unfortunately, the interactions between JAXP and SAX make life complicated. I found that [...]