Thursday, March 26, 2009

Jar Manifest Attribute Names

I probably should have known this before, but I discovered today that a "." character is invalid for a jar manifest attribute name. The attribute name is limited to:

{A-Z} | {a-z} | {0-9} | - | _

I tried using an attribute name of "java.version" in my jar manifest and the jar was created by the Maven build without any problem, but when the jar was used as a dependency of another project, then I got a warning about an invalid name.

The maven jar plugin and maybe assembly plugin should probably do some regex validation while creating the jar to at least give a warning. Otherwise maven will happily create a jar with invalid manifest and you may not discover this error until it starts causing some problems in other projects. I created a Jira Issue about this.

Wednesday, January 28, 2009

Restore a deleted file from subversion.

If you want to restore a deleted file from svn there are a few ways to do it, and some work better than others.

The subversion book gives the basic info for restoring a file using either merge or copy. However, the method used in the example for copy didn't work for me. So let's say you delete a file "Stuff.java" in revision 100. Then you would want to restore the file, using the previous revision, into the current working directory like this.

svn copy -r 99 http://svn.mycompany.org/repos/myproject/Stuff.java Stuff.java

My svn server didn't seem to handle the revision option correctly, and kept telling me that the file didn't exist. So an alternative syntax looks like this:

svn copy http://svn.mycompany.org/repos/myproject/Stuff.java@99 Stuff.java

This second syntax, which I didn't see mentioned in the svn book, worked like a charm for me.

If you don't know in which revision the file was deleted, you can use svn log in the directory to see a history of file changes.

After you copy the deleted file, you are not quite finished. You'll still have to commit your changes. So something like svn commit -m "Restore file Stuff.java" will finish the job.


Monday, January 12, 2009

RPM for Pidgin msn pecan

Apparently Microsoft changed something on the MSN Messenger servers today, and this was causing problems for many people using Pidgin. One workaround is to use the modified msn plugin from google. But I couldn't find any Fedora rpms for this. So I decided to make one.

The rpm for Fedora 10 is here.
And the source rpm is here.

Thursday, December 18, 2008

The fog

It was a beautiful foggy day today, so I decided to take a few pictures on the way to work.


Thursday, August 14, 2008

Recursively remove .svn directories

It seems I regularly need to remove all the .svn directories from a directory structure. It would be nice if this function to disconnect a directory structure was built into svn, but since it is not, I usually use this command from the root of the project directory structure:

rm -rf `find . -name .svn`

Thursday, June 5, 2008

You talk better than you fool

One of my favorite Simpson's quotes:

Bart: You're going down, Homer. I'm gonna fool you!
Homer: You talk better than you fool.
Bart: I'll fool you up real nice.
Homer: You couldn't fool your mother on the foolingest day of your life if you had an electrified fooling machine.

Friday, March 21, 2008

Finding stuff in jars

My coworker gave me a nice command to use when looking for certain classes in a set of jar files. This will recursively process each jar file in the current directory, and list the contents in search_jars.txt

find . -name \*jar -exec unzip -l {} \; > search_jars.txt

Then you can look in search_jars to find out where class files or other stuff is coming from.