Anatomy of a Gradle Task: Task Dependencies
Here’s another little “gotcha” on gradle tasks. When they’re triggered. I’ve seen quite a few posts on stackoverflow along the lines of “How can I call a gradle task”. You can’t (Well ok you could but you don’t want to). It is executed as a dependency of another task.
Going back to that little copy task I wanted to execute, I needed it to run roughly somewhere after the clean task and before jar task. I ended up making my copy task dependent of compile. That didn’t work so I tried compileJava and classes and… only to later realize that the dependency was in the wrong direction: My task depends on one that is being executed but that doesn’t trigger my task, it merely states that my task, should it be executed, can only be run after some other task.
Anatomy of a Gradle Task: Execution Time
So I’m trying out gradle in the hope of being able to simplify and streamline an existing maven build which is quite large and inconsistent. And I just spent some time to figure out a few gotcha about gradle tasks and this post is to help others understand, because I think the gradle docs aren’t clear enough on this point
What I wanted to achieve is, to copy all *.properties files in src/main/java to the resources-output directory so they are included in the jar, because javac won’t pick them up since they’re no java source files. What happened was that, depending on what approach I tried, sometimes the copy worked sometimes it didn’t and I couldn’t understand why.
Anatomy of a Gradle Task: Execution Time
So I’m trying out gradle in the hope of being able to simplify and streamline an existing maven build which is quite large and inconsistent. And I just spent some time to figure out a few gotcha about gradle tasks and this post is to help others understand, because I think the gradle docs aren’t clear enough on this point
What I wanted to achieve is, to copy all *.properties files in src/main/java to the resources-output directory so they are included in the jar, because javac won’t pick them up since they’re no java source files. What happened was that, depending on what approach I tried, sometimes the copy worked sometimes it didn’t and I couldn’t understand why.
Automatically switch your mvn settings
I have one primary development notebook and take that with me wherever I go. Now in a company setting you usually have proxies and whatnot. And I think it’s an official best practice to roll your own company or departement maven proxy/cache.
So dependent on where you are, you might need a different maven ~/.m2/settings.xml file. Here’s a very simple shell function you can add to your ~/.bashrc
function mvn {
MVN="$(which mvn)"
if [ -n "$(ifconfig eth0 | grep YOUR-WORK-IP-HERE)" ]; then
echo ">>> Running mvn whith work config"
${MVN} -gs ${HOME}/.m2/settings-work.xml $*
else
echo ">>> Running mvn with vanilla config"
${MVN} $*
fi
}
This just checks for the ip of eth0 and calls mvn with a special settings.xml. In all other cases mvn is run with the vanilla config (or none, since the settings.xml is optional).
Automatically switch your mvn settings
I have one primary development notebook and take that with me wherever I go. Now in a company setting you usually have proxies and whatnot. And I think it’s an official best practice to roll your own company or departement maven proxy/cache.
So dependent on where you are, you might need a different maven ~/.m2/settings.xml file. Here’s a very simple shell function you can add to your ~/.bashrc
function mvn {
MVN="$(which mvn)"
if [ -n "$(ifconfig eth0 | grep YOUR-WORK-IP-HERE)" ]; then
echo ">>> Running mvn whith work config"
${MVN} -gs ${HOME}/.m2/settings-work.xml $*
else
echo ">>> Running mvn with vanilla config"
${MVN} $*
fi
}
This just checks for the ip of eth0 and calls mvn with a special settings.xml. In all other cases mvn is run with the vanilla config (or none, since the settings.xml is optional).
Mercurial and self-signed server certificates
So mercurial aborts when you want to interact with a repository that uses a self-signed certificate, as is the case for my own little mercurial repo exposed over https.
NOTE: this is obviously insecure and you must verify the ssl cert’s fingerprint is correct. If you roll your own server, log into the server and get the fingerprint from the cert file itself, not over https since there could be a man in the middle.
Mercurial and self-signed server certificates
So mercurial aborts when you want to interact with a repository that uses a self-signed certificate, as is the case for my own little mercurial repo exposed over https.
NOTE: this is obviously insecure and you must verify the ssl cert’s fingerprint is correct. If you roll your own server, log into the server and get the fingerprint from the cert file itself, not over https since there could be a man in the middle.
The simplest way to create pdf's from images
There’s probably no simpler way to create a pdf from images. Behold:
convert \*.jpg output.pdf
That’s all folks!
The simplest way to create pdf's from images
There’s probably no simpler way to create a pdf from images. Behold:
convert \*.jpg output.pdf
That’s all folks!
Using StarCluster for some heavy computing
Update: 2012-10-22
I recently put the scripts I used in a little github repo called starcluster-image-sharpener. It’s nothing big but it’ll get you started if needed. Go get them! ;)
Introduction
First a little context:
I’ve photographed a ton recently and on one occasion I screwed things up a bit and had a lot of slightly out of focus images. I’ve tinkered with the Canon Digital Photo Professional settings to find a good level of sharpening (after noise reduction because a lot was shot at high iso (for me and my 50D, iso 1250 is a lot already)) but wasn’t happy with it. I’ve found reasonable settings for noise reduction, which makes the image a bit softer, but sharpening wouldn’t do anything to compensate let alone actually sharpen.