Groovy 5 introduced some extra overloaded methods for the collectEntries method, that can be used to transform an iterable object into a Map.
You can now pass a closure or function as arguments to transform the original iterable element into the key and value for the resulting Map. It is now also possible to pass a so-called collector Map that will be used to extend with new key/value pairs.
Besides extra overloaded method signatures for collectEntries Groovy 5 also adds the new methods withCollectedKeys and withCollectedValues. With the method withCollectedKeys a closure or function can passed to create the keys for the new Map based on the elements from the iterable. The value of the key/value pair is the unchanged element. You use the method withCollectedValues to pass a closure or function to create the value for the new key/value pair in the resulting Map. The key will be the original element from the iterable.
Continue reading →
The Nushell command enumerate adds an index value to each item in a list. The index value is stored in an extra column named index. You can use this column to filter data based on the index value.
Continue reading →
Nushell has very useful commands to filter lists and tables. When you have a list with null values, you can use the compact command to filter out the null values. With the option --empty you can also filter out empty items like empty strings, empty lists and empty records. If you want to filter out rows in a table where a column contains a null value, you can use the compact command followed by the name of the column.
Continue reading →
Nushell has some nice built-in commands to get randomized data. The random command can be used to get random numbers, strings, and more. You can use the dice subcommand to get random numbers between 1 and 6. The command returns a list of integers. With the option --dice you can specify how many times to throw the dice. By default the dice has 6 sides, but you can use the option --sides to change that. You could roll a dice with 2 sides, like flipping a coin, or roll a dice with 10 sides.
Continue reading →
Some people think GUIs have replaced the command-line. But they have not, they are complementary.
Some things can still be done better and easier in the command-line, for example scripting, and to servers one usually has access via an SSH terminal only.
But there is more!
This blog will describe a few very convenient commands for software developers.
All of it works in the Bash shell (common on Linux), but most of it works in the Z shell (zsh) as well (common on Mac).
Continue reading →
How to use Kotlin’s let and also functions.
Continue reading →
The nice thing about the http command in Nushell is that you can interact with HTTP endpoints without the need to install any external tools. You can use several subcommands like get, post, put, delete and patch. Each of these commands has the options to specify request headers. You can use the option --headers or the short version -H followed by a list of header keys and values.
Continue reading →
The http command in Nushell can be used to interact with HTTP endpoints. You can post data to an endpoint using the post subcommand. If you want to post JSON data than you can simply use a record data structure and use the argument --content-type application/json (or the shorthand -t application/json). Nushell will automatically convert the record data structure to JSON and use it as the body of the HTTP request.
Continue reading →
The ultimate way to get rid of versioning administration is to use CI/CD (Continuous Integration/Continuous Deployment).
However, in many cases CD is not possible. For example when creating libraries, or software requiring versions for compliance reasons.
Versioning is then still needed. This should be easy, but it turns out that without a proper procedure it can become very messy very fast.
This blog will describe a simple set up of such a procedure based on trunk-based development
and Semantic Versioning.
Continue reading →
Flyway is convenient tool to manage your database changes.
You can use it to create and populate your database from scratch, or to manage changes on a pre-existing database.
You can add it to your application so that when it starts up it invokes Flyway, or you can use the command-line version.
This blog describes a convenient way of using the Flyway command-line version.
Continue reading →