More and more companies are switching over to cloud native environments.
As a developer this gives me a lot of services to create awesome applications.
The challenge that occurred to me right away was how to use all those new components during development, since some companies do not have a testing/development environment in their cloud provider to play with.
LocalStack piqued my interest to simulate an AWS environment locally on my laptop, or when running the CI/CD pipeline.
This blog will give a brief introduction in what LocalStack can do and how you can use it for your own projects.
Continue reading →
In the first part of the small series about videoconferencing, I talked about the hardware.
As promised, this time it’s all about the software, and you don’t have to spend any money on it!
All the software we’re going to use here is open source.
This means it’s free to download, install and use!
Best of all, you are able to contribute to the projects as well, perhaps you’re a gifted developer that can improve the program.
Then give your improvements back to the community!
For now, let’s have a look at the programs you might want to download.
Continue reading →
As a consultant I find myself alternating between GitLab and GitHub about once a year, depending on the assignment.
While I like GitLab a lot, there’s one thing I had sorely missed whenever I switch back from GitHub: Dependabot.
Dependabot scans your project dependencies, and creates merge requests whenever updates are found.
This provides you with an easy way to keep up to date on dependencies, and notifies you early if there are any incompatibilities.
Luckily though, there’s now a Dependabot for GitLab project.
This project is based on the same Open Source Dependabot Core, so you can get the exact same automated dependency updates on both platforms.
In this blogpost I’ll walk you through how you can quickly roll out Dependabot on an existing GitLab installation, so you can start updating your dependencies automatically.
Continue reading →
Java 15 introduced the multi-line string value referred to as a text block. With this introduction also the formatted
method was added to the String
class. The method can be invoked on a String
value directly and function exactly as the static String.format
method. The nice thing is that now we directly can use a method on the value instead of having to use a static method where the value is passed as argument.
In the following example we use the formatted
method for a normal String
value and a text block:
Continue reading →
Since most of us are more or less forced to work from home, we’re using Zoom, Google meet, Microsoft Teams, Slack or other videoconferencing programs to keep in touch with each other.
Even though most programs allow you to blur your background or replace it with a nice image, it isn’t ideal and the quality isn’t that good.
On the other hand, you don’t want to be in a situation that you’re in the middle of an important meeting, and find out that you forgot to clean up that pile of laundry or other private goods that you rather don’t show to the outer world.
This is why I thought it would be nice to create a short series that helps you to professionalize your video conferencing setup.
The focus is to keep a tight budget, let’s say about 150 Euro of hardware.
We only will use open source programs to create your virtual environment you want to be in.
This isn’t only a thing that is just fun to do, but I’ll show other possibilities as well.
For example: You are able to place yourself in front of your PowerPoint presentation.
In the end, you’ll be able to create an end-result like this:
For this short demo I used free video footage available on videezy and vidveo.
If you want to use their free available products, remember to link to them and give the proper credits to them as well.
Continue reading →
A while ago I was working on a Spring REST project and had a special wish. I wanted for one endpoint an exception thrown when someone requested it with an object with unknown properties. All the other endpoints with their rest objects should continue to exhibit the same behaviour. Let me share how I did this.
Continue reading →
When working on a Java project, we might want to have a place where we can just play around with the code we write. We need a "scratch" file where we can access the Java classes we write in our main sourceset. The scratch file is actually a Java source file with a main
method where we can create instances of the Java code we write and invoke methods on them. This gives back a fast feedback loop, and we can use it to play around with our Java classes without the need to write a test for it. It gives great flexiblity during development. We must make sure the scratch file will not be packed in the JAR file with our production code.
To support this in our Gradle build file we can add a new sourceset that can access all classes we write in the main sourceset. Also we want to have new configurations for this sourceset so we can add dependencies that are only used by our scratch file. And finally we want a new task to run our scratch file. By default our scratch file will not be part of the JAR file with the classes from the main sourceset.
Continue reading →
At JDriven our mission is to improve the quality of software engineering. This is a great and noble cause and also something that cannot be achieved in isolation. I believe this is something that the entire community should be aiming for and can be achieved with the right mindset.
But how can you stimulate and create this state of mind and environment where quality and productivity go hand in hand? First let me start by saying this is my point of view and by no means a silver bullet. Just read and take what you think is useful and leave out what’s not.
Continue reading →
Some of our colleagues at JDriven work with Scala and we talked about the book Functional Programming in Scala written by Paul Chiusano and Runar Bjarnason. We looked at one of the examples in the first chapter in the book to show the importance of having pure functions without side effects. The example is about buying a cup of coffee and charging a credit card with the purchase. In three examples a function with side effects is refactored to a pure function without side effects. When looking at the example I was wondering how this would look like in Clojure using only functions and simple immutable data structures. We can look at the examples in Scala to see how it is explained and implemented in the book. There are also Kotlin samples available. In this post we see a possible implementation in Clojure to buy coffee and charge our credit card.
The first example is a buy-coffee
function with a credit card type as parameter. When we invoke the function with a credit card argument the credit card gets charged as side effect and a coffee type is created and returned. The coffee type is simply a map with a price key.
Continue reading →
Java introduced preview features in the language since Java 12. This features can be tried out by developers, but are still subject to change and can even be removed in a next release. By default the preview features are not enabled when we want to compile and run our Java code. We must explicitly specify that we want to use the preview feature to the Java compiler and Java runtime using the command-line argument --enable-preview
. In Gradle we can customize our build file to enable preview features. We must customize tasks of type JavaCompile
and pass --enable-preview
to the compiler arguments. Also tasks of type Test
and JavaExec
must be customized where we need to add the JVM argument --enable-preview
.
In the following Gradle build script written in Kotlin we have a Java project written with Java 15 where we reconfigure the tasks to enable preview features:
Continue reading →
In Java 12 the transform
method was add to the String
class. This method accepts a Function
as argument. The function must have a single parameter of type String
and can return any other type. The nice thing is that it works on a String
instance, so we can directly use the transform
method when we have a String
value. We don’t have to pass the String
object to another method to tranform it, but we can define the tranformation function close to the String
value.
In the following example we take a String
value and apply some functions with the transform
method:
Continue reading →
Since Java 12 we can format numbers in a compact style with the CompactNumberFormat
class in the java.text
package. A number like 23000 is formatted as 23K for the English locale. Instead of the short representation of K for 1000 we can also use a longer style where K is transformed as thousand for the English locale. We can use the same class to parse a String value that is in the compact style into a number.
In the following example we use several options of the CompactNumberFormat
class:
Continue reading →