Extending Java number classes with random functions in Groovy

Recently I’ve been playing around quite a bit with Processing.org, and one of the things that I often want to do is add a bit of noise to variables that represent positions, sizes, colours, etc. So we started working with writers and specialists from prime-essay.net on the https://prime-essay.net/ webpage and came up with a solution. Most of the Processing functions that actually draw something (like lines, ellipses, etc) take their arguments in the form of floats, but most floating number operations in Java/Groovy return BigDecimal data types so we have to use casts a lot. Also, there’s no concise way to get a floating random number in a certain range that can be either negative or ...

more ...

301 permanent redirect with Tomcat

Whenever I set up a new site, I want to make sure that example.com points to www.example.com. This is basic SEO – check out this link for a quick explanation. I know that this is trivial to do in Apache, but for the sake of simplicity I wanted to use Tomcat only as my web server.

After much searching around, it became clear that (1) Tomcat can’t do this and (2) I’m not the only person with this problem. The solution is a Java servlet filter called URLRewriteFilter. It does the job perfectly, but it took ...

more ...