When testing software that requires a database for persisting data there are different ways to do this. One way is to use a real database engine instance for testing purpose only. Setting up a full scale database server is totally oversized for testing purpose. So using a dedicated simply to use database is a good way. Furthermore the data may not persisted as after the test the data is not necessary anymore. For performance reasons a non-persistent database engine would be great. There are many solutions for in-memory database testing. One of them is H2
. Let’s have a look how H2
can be configured for this purpose. Continue reading
Compressed Memory
When using swap the system is going to be dramatic slow and maybe hangs for seconds as the performance of the next level memory is dramatically slower then random access memory. In case there is not enough physical RAM and swapping happens really often, there is a way to compensate this approach a little bit by using compressed in-memory swap space. Continue reading
How to use regex groups in Java with ease
When searching for a pattern or a group of data while processing text in Java, regular expressions are a useful instrument to work with. Using regular expressions in Java, it is possible to identify data in a subset of other data. E.g. when having a number of groups or when developing a regular expression it might be helpful in case you don’t have to know the position of the group in context of the regular expression. For this purpose there is a feature called named capturing group. Continue reading
Redirecting embedded jetty log to log4j2
When using embedded jetty
within an application, per default there is no support for log4j2
. Using slf4j
it is possible to redirect the logging to log4j2
. But without this redirection there is no way to directly use it. But of course there is a way to use it. Only a piece of simple adapter code is required. Continue reading
Feeding /dev/random with random data
When doing cryptographic operations on a system generating random numbers is required. But accessing /dev/random
might be slow in case there is not enough random input. Let’s have a look how to provide some additional random data to improve the speed of random number generation. Continue reading
Adding new resolution to the X window server
When running Debian Linux with VirtualBox there is limited support for high display resolutions. Per default a maximum resolution of 1024x768
is possible. For a modern operating system this resolution is definately not state of the art.
But there is a way to support a higher resolution than 1024x768
. It is possible to switch to a resolution like 1920x1080
or more. Even more than one display is possible. Continue reading
Completely cleaning up git workspace
When developing software using git
as version control system, sometimes there is the wish to completely reset your workspace, so that your snapshot is exactly as the snapshot in the repository. There shall no deleted, missing or additional files or folders that are not tracked. Furthermore git
does not track folders. There shouldn’t any dead folders that git
doesn’t care for. Let’s have a look how to do that. Continue reading
Installing Chrome / Streaming Netflix on Ubuntu
Currently using legal video streaming is a quite tough topic. As drm
mechanism prevent most of the users to use legal video streaming on Linux. I don’t want to make some advertisement, but using Amazon Prime/Instant Video, Google Play, Netflix etc.. is not working out of the box. But Netflix provided a way to use Google Chrome for streaming. Continue reading
Running Junit tests in a specific order
When running tests with Junit, per default the test execution order is deterministic. But the order of all the tests is not predictable. But for some reasons, it may be useful to ensure a specific order. E.g. one of your tests is sometimes failing and you have no idea. So maybe your production code is not threadsafe or there are some other effects that influence your test without knowing it. E.g. a cache that is filled with some results by a test running before. Continue reading
Concatenating Path
In Java 7 a new file api was introduced. This new file api is represented by the java.nio
package. With the old api java.io
it was possible to concatenate two file/folder easily. Let’s have a look how this works with the java.nio.file.Path
Continue reading