NoClassDefFoundError

August 11, 2020

Here's a useful code snippet for tracking down the cause of a NoClassDefFoundError in Java. It'll tell you the actual file that a class was loaded from.

System.out.println(TheNoDefFoundClass.class.getProtectionDomain().getCodeSource().getLocation());

Streams in Java

July 30, 2020

Here's a few examples on how Streams can be used in Java.

package uk.co.drumcoder;

import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.Stream;

public class Test ...

Testing "Use Current Location"

June 19, 2020

The Use Current Location javascript functions don't work on insecure URLs in current versions of Chrome. This caused me problems as I had a local webserver hosting my site that wasn't protected by https.

There is an exemption when using localhost but this didn't help in my ...

PHP Simple Logger

June 2, 2020

I'm currently working in PHP and for various reasons I can't log to the console, all logging goes into a database. I'd then have to login as an admin to the UI to see these logs, and that's not good enough where the testing needs to ...

Docker Compose

April 24, 2020

I wanted to have three docker containers that were managed as one, being spun up and torn down together. These were a postgres database, pgsql postgres admin tool, and a spring boot back end (the one from https://drumcoder.co.uk/blog/2020/apr/24/docker-spring-boot/)

docker-compose.yml

Here's ...