Thursday, May 14, 2009

maven profiles.xml

Just solved a problem with maven and profiles.xml. The documentation says that the profiles.xml file uses the exact format as the <profiles> element in pom.xml, but this isn't quite true. The <profiles> element is needed, but the documentation neglects to point out that you need to wrap the <profiles> element with a <profilesXml> root element.



<?xml version="1.0" encoding="UTF-8"?>
<profilesXml>
<profiles>
<profile>
<!-- This profile is used by default -->
<id>default-profile</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<webapp.port>9090</webapp.port>
<webapp.admin.port>9999</webapp.admin.port>
</properties>
</profile>
</profiles>
</profilesXml>

Tuesday, July 22, 2008

Twos Complement Worksheet

I recently was doing some testing on some UTF8 character conversion code and since Java does not have any unsigned byte datatypes, it was quite a pain to get UTF8 expansions recoded as signed bytes for the test. I couldn't find anything online that would take a signed byte and return the decimal value of the same bit-pattern as an unsigned. So I wrote this really hacky Google Docs spreadsheet to help myself. Probably there are 1000 better ways to do it, but this is at least a very explicit implementation that shows exactly how the process works.