Password must be at least 12 characters long, must include lower and upper case letters, must include numbers, must include special characters, must have at least 3 numbers, must have at least 2 special characters, may not include words in the dictionary. Your password is rejected because it does not comply to our policy. A policy that isn’t published anywhere, but you must make one that complies anyway. Your password has expired, make a new one that does not resemble any of the passwords that you have created in the past.
And it’s all useless. We’re all doing it wrong.
Continue reading →
During my last year at JCore I was given the opportunity to do deep-dive in a self-chosen topic in the form of a 'Specialisation'.
For this 1-year project I chose to dive deep into AWS how it works and how I, as a developer, make use of it.
Some of the topics I covered during this were: DevOps, CI/CD and Security.
As a demo and as use case I created a simple pubquiz application in which you can register and have a custom form for your answers.
During the development of this application I faced different challenges that I had to overcome.
This blog is about how I created a simple API that is exposed to the internet and how I tried to tackle the challenges of security, scalability and adaptability.
The application I created consisted of a container image which hosts a simple API that is made with Java, Spring and AWS SDK.
So for this backend application I created a Virtual Private Cloud(VPC) with a Fargate task in a private subnet so the application itself is not exposed to the internet.
The goal was to make an API with the API Gateway that defines the API that redirects the correct call to my Fargate instance that is in a private subnet.
Here’s an overview of the infrastructure of my backend application:
Figure 1. My application infrastructure
Continue reading →
Spring offers several frameworks to implement server side rendered web pages and REST APIS.
In this blog I compare three options:
-
traditional, servlet based (spring-web),
-
reactive, Netty based (spring-webflux) and
-
DSL, reactive, Netty based (spring-jafu)
Continue reading →
In Clojure we can format a string using Common Lisp format syntax or the Java format string syntax. In the post we will look at the how we can use the Java format string syntax. We must use the format function in the clojure.core namespace. The method delegates to the standard JDK String#format method. The first argument is a format string followed by one or more arguments that are used in the format string. We can look up the syntax of the format string in the Javadoc for the java.util.Formatter class.
In the following example code we use the format function with different format strings:
Continue reading →
We have all gotten acquainted with git in the last decade. We have adopted a way of working that has made it easy for all of us to work together in large teams and reduced the times our code changes collided to a minimum. When we do run into problems, they’ve culminated to a single important moment; the merge. We all know the merging feature of git with all its pro’s and con’s. But what about another feature of git: rebase?
Continue reading →
SDKMAN! is a very useful tool to manage versions of so-called software development kits. There are a lot of SDKs supported by SDKMAN!: Java, Groovy, Kotlin, Scala, Gradle, Maven, Leiningen, Micronaut, Grails, Vert.x, JBake, AsciidoctorJ and more. When we look at Java we can use a simple install java <version> command from the command-line to install a version of Java on our computer. SDKMAN! will take care of downloading the Java version and setting all the correct system variables to use that Java version. With the use command we can switch between version in the current shell we are working in. But we can even automatically switch to a specific installed Java version when we enter a directory. This is very useful when we have to work on multiple projects on our computer and each project requires a specific Java version to be used.
To support automatic switching of a Java version we must first run the env init command in the directory of our project. This creates a new file .sdkmanrc in the directory. The file contains the Java version that was active when we invoked the env init command. It is a text file so we can change the Java version in the file, or regenerate the file by running the env init command again, but with a different active Java version.
Continue reading →
Kotlin data classes and annotations go really well together, but it is easy to mess it up.
Continue reading →
When dealing with Maps in Kotlin, sometimes we’re only interested in entries for which the value is not null.
Although the Kotlin Standard Library contains a filterValues function that seems to be appropriate, this function
does not do any type conversions, resulting in a Map which won’t contain null values,
but is still a Map with values of a nullable type according to the compiler. There is a feature request
for the JetBrains team to add this functionality, but for now it has not been implemented (yet?).
Continue reading →
To find the maximum or minimum value for numeric values we can use the max and min function. The functions accept one or more numeric arguments and the value that is maximum or minimum is returned. If the numbers are already in a sequence we can use apply max or apply min. If the values are not numbers we can use the max-key or min-key functions. These functions take as first argument a function that returns a number. So we can get the value that has the maximum or minimum return value for the function we pass as first argument.
In the next exmaple code we use the max, min, max-key and min-key functions:
Continue reading →
Lamda expressions were introduced in Java 8 and have been around for a while.
They are in my opinion one of the better features of Java 8, allowing for a more functional approach to writing code, and thus enabling most of the java 8 features.
So let’s take a closer look at lambda’s and see what they are, how to reason about them, and why they are a good addition.
Continue reading →