JDriven Blog

Clojure Goodness: Formatting With Java Format String

Posted on by  
Hubert Klein Ikkink

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.

Continue reading →

Git: rebase vs. merge

Posted on by  
Kees Nederkoorn

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 →

Automatic Switching Of Java Versions With SDKMAN!

Posted on by  
Hubert Klein Ikkink

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.

Continue reading →

Filter a Kotlin Map to get non-null values only

Posted on by  
Riccardo Lippolis

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 →

Clojure Goodness: Finding The Maximum Or Minimum Value

Posted on by  
Hubert Klein Ikkink

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.

Continue reading →

Beginners guide to lambdas

Posted on by  
Ties van de Ven

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 →

Using WireMock in an async environment

Posted on by  
Tom de Vroomen

Building Event Driven systems is great, but not all systems are Event Driven. Communication with those systems can be via HTTP and those systems may not be able to respond quickly to a request, taking up to minutes to serve a response.

Are there tools to mock such a situation to be used for testing?

Continue reading →

Minikube on LAN

Posted on by  
Casper Rooker

Locally deployed clusters can be a convenient part of a modern software development cycle, reducing feedback loops and give a developer a useful representation of the live version of an app, even if it’s just a stub. Unfortunately, they have a reputation for eating up your precious resources like they’re mashed taters. Since this year working from a home office has become the norm for many developers around the world. Enter the home desktop to "share the load" with our brave little work laptop. We will form a fellowship with our loyal home desktop, to help us through this new and uncertain adventure. Keep reading to find out how we can take off and escape this "Mount Doom" scenario!

Continue reading →

shadow-left