In this article, I will demonstrate how to install Java OpenJDK 14 on macOS Catalina in 2020. If you are interested in installing OpenJDK 15 (which is the newest version as of this writing), please see this article: How to Install Java OpenJDK 15 on macOS Catalina Download and Install OpenJDK 14 Download the .tar.gz version of OpenJDK 14 from jdk.java.net/14/. sudo mv openjdk-14.0.1_osx-x64_bin.tar.gz /Library/Java/JavaVirtualMachines/ cd /Library/Java/JavaVirtualMachines/ sudo tar -xzf openjdk-14.0.1_osx-x64_bin.tar.gz sudo rm openjdk-14.0.1_osx-x64_bin.tar.gz Next, execute the following command to ...

In this post, I am showing you how to use the freely available Open Weather Map API to retrieve hourly weather forecasts 48 hours into the future for a given place using Python without external packages. Continue reading if you need an easy and flexible way to obtain weather data in your python application and you want to avoid using third-party dependencies for the task. You will use the free tier of the Open Weather Map API. The resulting weather ...

Flash messages (one-time notifications) are commonly used to display the result of an operation to your users: Spring Boot offers this exact functionality in the RedirectAttributes interface. It uses the FlashMap data structure to store the flash messages as key-value pairs. Thymeleaf automatically supports reading those attributes in the template files the same way it handles ordinary model attributes. One handy feature of flash messages is that they survive redirects (in contrast to normal model attributes). Have a look at ...

Spring Sessions allows you to persist user sessions into a database. Combined with Spring Security, it is easy to create a setup where each logged in user is represented by a row in a SPRING_SESSION table. Externalising sessions into a database is also a prerequisite for a zero-downtime deployment strategy where users can stay logged in while a new application version is deployed. On paper, the integration of those two Spring components is very easy. Assuming you have a working ...

Different deployment environments (e.g., development, testing, staging and production) often require that different pieces of code are switched on and off. For example, you only want to send real emails in production and write to an email log in all other environments instead. Or your code to initialise the database should only run in the staging environment. A simple but hard to maintain way for such conditional code executions is to define a globally available variable such as isProductionSystem and write ...

Stop repeating yourself. Emails and messages in general often consist of repeated content blocks that never change. Greetings and signatures are perfect examples: some people even try to eliminate such “noise” from messages (for example, the “nohello”-movement). While it is unrealistic that such changes to the human interaction protocol will ever be universally accepted, there is something else a productivity-minded person can do in order to lose less time each day typing the same phrases over and over again. Outlook ...

Measuring code execution times is hard. Learn how to eliminate systematic and random measurement errors and obtain more reliable results. We often need to measure how long a specific part of code takes to execute. Unfortunately, simply measuring the system time before and after a function call is not very robust and susceptible to systematic and random measurement errors. This is especially true for measuring very short intervals (< 100 milliseconds). Systematic and Random Errors So what is wrong with ...

Question: In my Thymeleaf template, I want to output the size of a list of objects. For example, for the list List<String> list = Arrays.asList("Go", "Python", "Scala"); the result should be 3. How is this possible using just Thymeleaf syntax? You can use the following expression: <span th:text="${#lists.size(myList)}">[Number of Elements]</span> And just in case you want to check if the list is empty, there is also an easy method for that: <span th:if="${#lists.isEmpty(myList)}">This list is empty</span> ...

Atlassian’s collaboration tools Jira and Confluence are one of the most popular tools for managing software projects and group knowledge. Learn how to get access to these great tools for free. For the longest time, Atlassian charged 10$ per month per application in their “Standard” tier. While this is basically nothing for an established company, it is still discouraging for start ups and non-profits since it sums up to a bill of 240$ per year for the popular combination Jira ...

GitLab offers to create personal access tokens to authenticate against Git over HTTPS. Using these tokens is a secure alternative to storing your GitLab password on a machine that needs access to your repository. It is also the only way to automate repository access when two-factor authentication is enabled. However, GitLab does a poor job documenting how you actually use these tokens. Create an Access Token Navigate to “User Settings” > “Personal Access Tokens” and enter a name and, optionally, ...

Bernhard Knasmüller on Software Development