Tests are the light side of programming. Period. Running test cases is one of the fundamental duty of every build automation system - including Maven. Even if it’s a kind of ritual and the determinant of style, every experienced programmer knows that sometimes things just have to be MacGavyered instantly. But how to fold up a late night app version using only Maven, bottle of ketchup and an old shoelace if our tests just don’t pass?
When bytes
meet Mike
Hi! 👋 I'm Mike, a.k.a @mikemybytes, building distributed systems for fun and living. While I specialize in JVM technologies (mainly Java, Kotlin, Spring), my professional interests go far beyond that. Let me show you what I found interesting!
When docker kicked in to the enterprise market many things started changing. Along with microservice-based architectures it became a must-have technology for any “modern” project (the containers idea itself isn’t new - docker has just made things much simplier). In analogy to Java related slogan from 1995 “Write once, run anywhere” almost 20 years later docker enthusiasts say: “Build once, run everywhere”. In fact both ideas can coexist easily and that’s probably one of the reason they really do in practice nowadays.
Nowadays we can argue if using Apache FOP is still the best solution for generating PDF documents. One of it’s biggest competitors is probably JasperReports Library which supports multiple file formats and does not require creating XML templates manually from scratch (thanks to Jaspersoft Studio).
However, sometimes you just have to face the FOP’s XML monster :)
The FOP’s way of styling elements (text blocks, tables etc.) is almost identical to the CSS.
For some compatibility reasons I needed to checkout specific branch or tag in the Git repository using only it’s name (last part without refs/.../ prefix) from a bash script.
For Mercurial repositories it’s not a problem at all thanks to:
hg checkout $tagOrBranch I haven’t found similar solution using git checkout, so as a workaround I’ve prepared the following bash script to do the job:
git fetch --all if git show-ref | grep "refs/remotes/origin/$tagOrBranch" then echo "It looks like a branch" git checkout -b $tagOrBranch git pull origin $tagOrBranch else if git show-ref --tags | grep "refs/tags/$tagOrBranch\$" then echo "It looks like a tag" git checkout tags/$branchOrTag else echo "No branch / tag '$branchOrTag' found" exit 1 fi fi
This post couldn’t have started different - since I’m calling myself a developer.
Why Yet Another Developer Blog? It’s always good to write down things before forgetting them - isn’t it a perfect excuse? Probably there is also another motivation…
If you can’t explain it simply, you don’t understand it well enough.
Albert Einstein