Enable support for java.time.* with Jackson-jr

Jackson-jr is super neat, but does not (yet) support serialization of java.time.* (e.g. java.time.LocalDate, LocalDateTime) out-of-the-box. However, it is actually super easy to extend it. My example is in Groovy, but it will also work in Java if you add some boilerplate code such as “;”. First create some utility class to encapsulate the Jackson-jr […]

CodeNarc 1.5 with Grails 4

When I bumped CodeNarc from 1.4 to 1.5 at my Grails 4.x project, I kept getting the “groovy/text/TemplateEngine” error which is reported here: https://github.com/CodeNarc/CodeNarc/issues/449 The suggested solution was not too clear, so here is exactly what you gotta do – add the following to build.gradle: codenarc “org.codenarc:CodeNarc:${codenarc.toolVersion}” codenarc ‘org.codehaus.groovy:groovy-templates’

Grails 4 IntegrationsTest cannot compile when using OpenClover

I just recently upgraded a Grails 2 plugin to Grails 4 and that gave me a weird problem that probably also applies to Grails 4 applications. Every time I ran ./gradlew check with gradle-clover-plugin (OpenClover) enabled, then I would get compile errors (“unable to resolve class” for /grails-app/**/*.groovy) during compileIntegrationTestGroovy. After endless trial-and-error, I realised […]

Specify embedded Redis URI / port in Micronaut tests

Just a quick tip: If you need to specify the embedded Redis URI for Micronaut tests (e.g. when testing connectivity to Redis), then you just have to write the following in application.yml: redis.embedded:    uri: redis://localhost:1337 Here is how to set the port: redis.embedded:    port: 1337 You can just open EmbeddedRedisServer from micronaut-redis-lettuce and […]

Resolve DNS using VPN (openconnect) rather than default-ISP DNS on Ubuntu 18.04

Ubuntu 18.04 has a nice GNOME GUI for VPN, but it still takes a little effort to get it fully working. Here is what I did: I connect to a VPN that is based on Cisco AnyConnect, which means that I must use OpenConnect and that is not installed by default. Fortunately, Ubuntu has some […]

How to install HP LaserJet M1132 MFP on Windows 10

I have tried countless guides on how to install the driver for “HP LaserJet M1132 MFP” on Windows 10. It worked perfectly on Windows 8 and it also works on my laptop with Windows 10 but not my desktop computer with Windows 10. The driver installation just stops after extracting archive is complete, but the […]

Adding @GrailsCompileStatic to all production grails code (not test grails code)

When coding Groovy, @CompileStatic can help to spot errors and improve performance of production code. Unfortunately, @CompileStatic is optional and hence easy to forget, but thankfully Groovy has documented a way to make @CompileStatic for all production code: http://docs.groovy-lang.org/latest/html/documentation/#_static_compilation_by_default (Test code is not affected, because it is nice with flexibility when testing.) However, with Grails […]

How to start local ActiveMQ (build from source) on Ubuntu when the ActiveMQ package has previously been installed

This is the frustration of the day. I downloaded the ActiveMQ source and compiled it with no issues – however I could not start ActiveMQ (using ./activemq start) and the console output did not really explain what was wrong: ./activemq: 344: ./activemq: “/usr/bin/java” -Djava.util.logging.config.file=logging.properties -Djava.security.auth.login.config=/home/MY_USER/git/activemq/assembly/target/apache-activemq-5.12.1-SNAPSHOT//conf/login.config -Dactivemq.classpath=”/home/MY_USER/git/activemq/assembly/target/apache-activemq-5.12.1-SNAPSHOT//conf:/home/MY_USER/git/activemq/assembly/target/apache-activemq-5.12.1-SNAPSHOT//lib/” -Dactivemq.home=”/home/MY_USER/git/activemq/assembly/target/apache-activemq-5.12.1-SNAPSHOT/” -Dactivemq.base=”/home/MY_USER/git/activemq/assembly/target/apache-activemq-5.12.1-SNAPSHOT/” -Dactivemq.conf=”/home/MY_USER/git/activemq/assembly/target/apache-activemq-5.12.1-SNAPSHOT//conf” -Dactivemq.data=”/home/MY_USER/git/activemq/assembly/target/apache-activemq-5.12.1-SNAPSHOT//data” -jar “/home/MY_USER/git/activemq/assembly/target/apache-activemq-5.12.1-SNAPSHOT//bin/activemq.jar” : not found […]

Getting wireless to stop disconnecting on HP ProBook 430 G2 on Ubuntu 14.04 (Linux)

The default wireless driver settings for the HP ProBook 430 G2 on Ubuntu Linux 14.04 makes the internet connection drop frequently and the wireless connection first works again when the machine has been rebooted (or the wireless netcard driver has been removed and added again). The solution is to change the driver settings (disable e.g. […]

Add after body hook hack in wordpress (e.g. for Facebook Like button SDK) without modifying header.php

I wish to add the Facebook Like button to my wordpress – this requires that I add the following code right after <body&lt: <div id="fb-root"></div><script>(function(d, s, id) { … }(document, ‘script’, ‘facebook-jssdk’));</script> My solution Make a functions.php file in your child theme and add the following code (or append it to your main functions.php if […]