Wednesday, September 10, 2008

Ant Wizardry

I've been spending a lot of time messing around with builds lately and that means reacquainting myself with my old friend, Ant. Back in the old days, I always wished there was an easy way to do simple string replacement/concatenation, creating a new property as a result. Sure you could use the antcontrib tasks, but I usually did not have access to them when it really counted and it was one more dependency to worry about. The other option is to mess with temporary files or some other naughty-feeling hackery (I think I used pathconvert once to do something like this and felt really dirty about it).

Anyway, as of Ant 1.7, check out what is possible. Run the following build file:


<project name="test" default="test">

<target name="test">

<loadresource property="abc">
<string value="One two three four" />
</loadresource>
<echo message="abc=${abc}" />

<loadproperties>
<string value="one=two${line.separator}three=four"/>
</loadproperties>
<echo message="one=${one}" />
<echo message="three=${three}" />

<loadresource property="test">
<string value="${one} two ${three} four" />
</loadresource>
<echo message="test=${test}" />

<loadresource property="test2">
<string value="${test}" />
<filterchain>
<replaceregex pattern="f(ou)r"
replace="f\1l"
flags="g"/>
</filterchain>
</loadresource>
<echo message="test2=${test2}" />

</target>

</project>


And you will see this output:


C:\testing\>ant -f testbuild.xml
Buildfile: testbuild.xml

test:
[echo] abc=One two three four
[echo] one=two
[echo] three=four
[echo] test=two two four four
[echo] test2=two two foul foul

BUILD SUCCESSFUL
Total time: 0 seconds


I wish I had this in my back pocket about four years ago...

Monday, September 1, 2008

Mandatory Software

As Doug has already mentioned, an interesting product from Google is being released tomorrow: Google Chrome. I guess the rumors were true after all! Since I have recently re-formatted my computer and I am currently in the midst of re-installing all of my applications, their timing is relatively good.

I discovered something interesting while re-installing software on my PC. After re-ghosting my machine (and installing various hardware drivers, Windows XP Service Pack 3, and a large number of updates), I installed the following software first:


So Eclipse wasn't the first thing I installed, but it was quite near the top; and Vuse uses SWT under the covers so that's a pretty good showing for Eclipse-sponsored software in my little world. Also keep in mind this is my home PC, not my work laptop - so this list is not particularly tailored to full-on software development (hence the Steam install). I'll have to do another list when my work computer gets reincarnated. ;o)

I remember the Python blogging community chipping in about what programs they use daily (and would install first on a new machine) and it was quite interesting. I wonder what other people's short list might look like?