Posts
Flashing QMK DFU firmware on a Pro Micro
Naming things is hard. As a software engineer, I know this all to well. The times I've puzzled, despared, cursed at whoever named some variable, only to have git blame tell me that this particular variable was added by a certain remmelt…
Either way. In this post I will document the steps I took to flash the qmk-dfu bootloader onto a Pro Micro Arduino clone.
Terms First off, here are some terms I'll be using.
Posts
Easy headless setup for Raspberry Pi Zero W on OSX
You’ve got your hands on a Rasberry Pi Zero W! Lucky you. This is a great device for IoT, monitoring, you name it. I’m building a connected wake up light.
I will explain how to set up the Raspberry Pi Zero W in headless mode, so without using a screen or keyboard. This will likely also work for any other wifi-equipped Raspberry. You will only need to power the board. Let me know what worked for you!
Posts
Use Consul's KV store for Dropwizard settings
I wanted to see how hard it would be to get Dropwizard config from Consul’s key value store. Turns out it is very easy to do!
Make sure you’re using Dropwizard >= 0.8.0, this has the SubstitutingSourceProvider that we’re going to use.
Create a default Dropwizard project with the following configuration line in its config.yml:
someSetting: ${settings/someSetting}
Don’t forget to add it to the xxxConfiguration:
@JsonProperty @NotEmpty private String someSetting; Now in the xxxApplication class, register a new ConsulKVSubstitutor in the initialize method:
Posts
Why does hack time fail?
Google are doing it, so it must be a great idea: hack time!
In an innovative and enlightened company, everyone will be on board quickly. Reasoning along the line of, there needs to be some level of slack so people will have space to think and come up with new ideas, which will help current clients and will lead to new clients in the future. The constant display of thirst for new knowledge will also attract new employees and ultimately lead to a real engineering culture.
Posts
File upload using Dropwizard 0.8.0-rc2
Dropwizard 0.7.1 used com.sun.jersey:jersey-server:jar:1.18.1, where version 0.8.0 comes with org.glassfish.jersey.core:jersey-server:jar:2.15.
Before, when uploading files, it was enough to add the com.sun.jersey.contribs:jersey-multipart dependency like so:
<dependency> <groupId>com.sun.jersey.contribs</groupId> <artifactId>jersey-multipart</artifactId> <version>1.18.3</version> </dependency> This will not work anymore and throws the somewhat cryptic exception: java.lang.IllegalArgumentException: The MultiPartConfig instance we expected is not present. Have you registered the MultiPartConfigProvider class?
The correct dependency should be
<dependency> <groupId>org.glassfish.jersey.media</groupId> <artifactId>jersey-media-multipart</artifactId> <version>2.15</version> </dependency> Update your imports and you’re good to go.
Posts
Start Postgres container and connect with JDBC
Quick example of how to set up a Docker container with Postgresql, using the Spotify Docker Java client.
This supposes a running Docker installation on your local computer, for example using boot2docker.
import com.google.common.base.Strings; import com.google.common.net.HostAndPort; import com.spotify.docker.client.DefaultDockerClient; import com.spotify.docker.client.DockerCertificateException; import com.spotify.docker.client.DockerClient; import com.spotify.docker.client.DockerException; import com.spotify.docker.client.messages.ContainerConfig; import com.spotify.docker.client.messages.ContainerCreation; import com.spotify.docker.client.messages.ContainerInfo; import com.spotify.docker.client.messages.HostConfig; import lombok.extern.slf4j.Slf4j; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; @Slf4j public abstract class PostgresContainerExample { public static Connection setUpDbContainer() throws SQLException { try { // This will only work with the DOCKER_HOST environment variable set final DockerClient docker = DefaultDockerClient.