Create HTTPS Certificates in Java: The unsafe way

October 28, 2019

TLDR: I recommend using Bouncy Castle instead of this method. I used this method in the past but I’m using Bouncy Castle now to support Java 11+.

Continue reading →

Secret SQL Weapon: Indexed (or Materialized) Views

October 27, 2019

A few months backs I implemented logic which needs to lookup entries in a big existing table, but the lookup wasn’t easy indexable. Here’s a guide on one approach you can take. I’m using SQL Server for this example. Let’s assume we have a table with guests, something like this

Continue reading →

Clojure defonce: Keep Your Apps State

October 25, 2019

One of the great strengths of Clojure is interactive development. Usually, you run a REPL and an editor that interacts with that REPL. You try out small things in the REPL, send pieces of code from the editor to the REPL, reload modified files, etc. You rarely restart the app, but keep going editing code. I’m missing that in other programming environments.

Continue reading →

Compiling Java Classes with Clojure Deps

October 24, 2019

In the past, I used Leinigen for Clojure projects. It downloads dependencies, compiles, handles the classpath, runs tests etc. Clojure 1.9 introduced the clj command line and the deps tooling. You can specify a deps.edn file and declare the dependencies in there. Deps not a build tool by design. it only downloads dependencies from Maven- and git repositories and builds the Java classpath. It doesn’t have other build features. However, for smaller Clojure projects that is enough and you can go without an extra build tool.

Continue reading →

Java, Let me use the damn FileDescriptor!

October 15, 2019

Recently I hacked on some utility in Java which should be able to bind low ports like 80 or 443 on demand without running as root. When I needed to bind these port I wanted to execute an external process as root which opens the ports for the main process and then sends the ports via Unix domain socket.

Continue reading →