Road to the Perfect Mini ITX PC (Part 3): Fractal Design Meshify C White

In the third part of my road to the perfect mini ITX computer case, things will get a bit weird. As you may have gathered from the title, I will not talk about a mini ITX enclosure in this blog post. Quite the opposite, in fact: the Fractal Design Meshify C is a full-sized mid-tower ATX case.

You may now wonder why I suddenly had a change of heart and ditched a big.SMALL™ case for a not-so-small big computer tower. Well, I was surrendering to big graphics cards. Or, put the other way around, I was annoyed that I had to search endlessly to find a fast and quiet, and affordable two-slot graphics card model, only to fail ultimately. But, let me not get ahead of myself and start from the beginning, the same way I did for the previous two blog posts.

Read More »

Road to the Perfect Mini ITX PC (Part 2): NZXT H200

The second of the bunch is one of the stylish cases from NZXT, the H200. While it is technically a mini ITX chassis, it is a large case for that market segment. Just like the Fractal Design Core 500, it is compatible with a wide range of hardware, making it the perfect enclosure for price-conscious buyers. On top of that, it also is beautiful.

Unfortunately, I do not have an image of a complete desk setup with this case. Here is one with a good look at the internal layout and installed hardware.

Read More »

Road to the Perfect Mini ITX PC (Part 1): Fractal Design Core 500

The computer that I bought roughly a year ago has seen quite a few revisions already. But I am not talking about the core hardware – although I switched the GPU at one point. I mean the case. I wanted to go with something small from the start, so the basis is a mini ITX mainboard. However, I have not been incredibly happy with any of the cases so far. In this first installment in a series of several blog posts, one for each computer case, I will share my experiences in building a small, attractive, and performant and yet price efficient computer. I will cover design, hardware compatibility, pricing, and availability. Unlike the YouTube tech creators, not everybody has a seemingly unlimited budget or receives hardware from the manufacturers for review or showcases. It may look easy in all those YouTube videos, but it might not be for everyone.

Although I am mainly talking about gaming hardware, the same thoughts also apply to compact office PCs or workstations. Depending on the use case, i.e., which PC component requires the most focus, one or the other might become less or more relevant. So, first off is the Fractal Design Core 500.

Read More »

Terraform Azure Error: parsing json result from the Azure CLI: Error waiting for the Azure CLI: exit status 1; Failed to load token files

There are some instances where I have managed to screw up my Azure CLI configuration file with Terraform. It must have something to do with parallel usage of Terraform or Terraform simultaneously with the az tool. Either way, I ran into the following error.

$ terraform refresh
Acquiring state lock. This may take a few moments...

Error: Error building account: Error getting authenticated object ID: Error parsing json result from the Azure CLI: Error aiting for the Azure CLI: exit status 1

  on main.tf line 16, in provider "azurerm":
  16: provider "azurerm" {

I wondered: "What might block the Azure access? Am I maybe not logged in?" So, I went ahead and tried to log in.

$ az login
Failed to load token files. If you have a repro, please log an issue
at https://github.com/Azure/azure-cli/issues. At the same time, you 
can clean up by running 'az account clear' and then 'az login'. 

(Inner Error: Failed to parse /home/rlo/.azure/accessTokens.json with exception: Extra data: line 1 column 18614 (char 18613))

The error probably comes from parallel access to my Azure CLI configuration file. When I opened the /home/rlo/.azure/accessTokens.json, I found some dangling garbage at the end of it that broke the JSON format.

Here’s a snippet of the last few lines.

        "refreshToken": "0.A...",
        "oid": "<oid>",
        "userId": "<userId>",
        "isMRRT": true,
        "_clientId": "<clientId>",
        "_authority": "https://login.microsoftonline.com/<uid>"
    }
]bc1"}]

I took out the trash bc1"}], saved the file, and it worked again. Many access to resources. Such joy 😉

Qt5 QtCreator Error on Linux: stddef.h: No such file or directory – Code model could not parse an included file

The following is an error that has shown itself every time I have installed the Qt5 framework and the QtCreator development environment on a Linux based machine. It never mattered which flavor of Linux; QtCreator always showed this error.

Warning: The code model could not parse an included file, which might lead to incorrect code completion and highlighting, for example. 

fatal error: 'stddef.h' file not found 
note: in file included from /home/rlo/Code/C++/WorkTracker2/WorkTracker2Shared/src/data/taskrepository.h:1: 
note: in file included from /home/rlo/Code/C++/WorkTracker2/WorkTracker2Shared/src/data/taskrepository.h:3: 
note: in file included from /usr/include/c++/9/optional:38: 
note: in file included from /usr/include/c++/9/stdexcept:38: 
note: in file included from /usr/include/c++/9/exception:143: 
note: in file included from /usr/include/c++/9/bits/exception_ptr.h:38: 

Although that message never caused any issues compiling the code, I found it rather annoying, and at some point, annoying enough to search for a solution.

As it turns out, this message appears when you have Clang libraries installed. QtCreator detects that and automatically uses Clang to parse the source code and provide inline error messages and code completion.

You can get rid of this error when you explicitly add the STL header files’ include-path to your project. In my case, I have added the following to my *.pro file.

unix {
    INCLUDEPATH += /usr/lib/gcc/x86_64-linux-gnu/9/include
}

Azure PostgreSQL Error: PSQLException The connection attempt failed

A few days ago at work, I was investigating a strange issue where one of our services could not connect to the Azure Managed PostgreSQL Database from the Kubernetes cluster. Oddly enough, other services of that cluster did not exhibit this behavior.

org.postgresql.util.PSQLException: The connection attempt failed.
        at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:315) ~[postgresql-42.2.16.jar!/:42.2.16]
        at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:51) ~[postgresql-42.2.16.jar!/:42.2.16]
        at org.postgresql.jdbc.PgConnection.<init>(PgConnection.java:225) ~[postgresql-42.2.16.jar!/:42.2.16]
        at org.postgresql.Driver.makeConnection(Driver.java:465) ~[postgresql-42.2.16.jar!/:42.2.16]
        at org.postgresql.Driver.connect(Driver.java:264) ~[postgresql-42.2.16.jar!/:42.2.16]
        ...
        at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:49) ~[ehg-hermes.jar:0.13.0-SNAPSHOT]
        at org.springframework.boot.loader.Launcher.launch(Launcher.java:107) ~[ehg-hermes.jar:0.13.0-SNAPSHOT]
        at org.springframework.boot.loader.Launcher.launch(Launcher.java:58) ~[ehg-hermes.jar:0.13.0-SNAPSHOT]
        at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:88) ~[ehg-hermes.jar:0.13.0-SNAPSHOT]
Caused by: java.io.EOFException: null
        at org.postgresql.core.PGStream.receiveChar(PGStream.java:443) ~[postgresql-42.2.16.jar!/:42.2.16]
        at org.postgresql.core.v3.ConnectionFactoryImpl.enableGSSEncrypted(ConnectionFactoryImpl.java:436) ~[postgresql-42.2.16.jar!/:42.2.16]
        at org.postgresql.core.v3.ConnectionFactoryImpl.tryConnect(ConnectionFactoryImpl.java:144) ~[postgresql-42.2.16.jar!/:42.2.16]
        at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:213) ~[postgresql-42.2.16.jar!/:42.2.16]
        ... 46 common frames omitted

As it turns out, it was an issue with the PSQL JDBC driver version that comes bundled with Spring Boot version 2.3.4-RELEASE. All the other services were still built with a slightly older release and therefore used an older PSQL JDBC driver.

The key indicator of what is going on is this method call.

org.postgresql.core.v3.ConnectionFactoryImpl.enableGSSEncrypted

A bit of research led me to a question on StackOverflow that pointed me in the right direction, and ultimately I ended up on Microsoft’s Azure documentation. If you scroll down, you will find a section named "GSS error".

The solution to this problem is simple. If you do not want or cannot change the Spring Boot or PSQL JDBC driver version, e.g., because of automated CVE scans that break builds (the reason we upgraded this one service), then you can solve it with a configuration change. Append gssEncMode=disable to the JDBC connection string.

Example: jdbc:postgresql://svc-pdb-name.postgres.database.azure.com:5432/databasename?gssEncMode=disable

CMake on Windows 10 with Qt5 Error: CMAKE_PREFIX_PATH

Quick one: Set the proper CMAKE_PREFIX_PATH value for Qt5 development on Windows 10 with MinGW and CMake.

Here is the lovely error you get from CMake.

CMake Error at CMakeLists.txt:13 (find_package):
 By not providing "FindQt5.cmake" in CMAKE_MODULE_PATH this project 
has
 asked CMake to find a package configuration file provided by "Qt5", 
but
 CMake did not find one.

 Could not find a package configuration file provided by "Qt5" with 
any of
 the following names:

 Qt5Config.cmake
 qt5-config.cmake

 Add the installation prefix of "Qt5" to CMAKE_PREFIX_PATH or set 
"Qt5_DIR"
 to a directory containing one of the above files. If "Qt5" provides a
 separate development package or SDK, be sure it has been installed.

CMake asks you to tell it where to find the Qt5 *.cmake configuration files. One option is to set the CMAKE_PREFIX_PATH variable. The Qt5 documentation has the following to say about that:

The easiest way to use CMake is to set the CMAKE_PREFIX_PATH environment variable to the install prefix of Qt 5.

Now, what the hell is the "install prefix"? It turns out it is the path where you can find the compiler-specific Qt binaries, include files and the other stuff. In my case, using MinGW, it is located at "C:\Apps\Qt\5.14.2\mingw73_64". If you are using the MSVC binaries, select the corresponding directory, probably something like "C:\Apps\Qt\5.14.2\msvc_2017".

Linux Gaming: Middle Earth – Shadow of Mordor; Get it to run, and run it fast

Gaming on Linux is a challenge because only a few companies take the time to create native Linux ports of their games. It is even more challenging when those natively ported games do not run at all or do not run well. One of them is Middle Earth: Shadow of Mordor. I have bought this game specifically because it has a native Linux version – and because I remember that it was well received by media and players.

This game has two issues:

  • It refuses to start in full-screen mode.
  • The performance is terrible.

Let’s go through these two issues and see how they manifest and how to fix them.

Read More »

Pop!_OS Linux Fixing Windows Dual Boot Problem

In a previous blog post I have mentioned that I was not able to add my Windows 10 installation to the Grub boot menu. I have finally found a solution. Now, in my last Linux blog post I mentioned that I ultimately gave up on Linux after trying Ubuntu 20.04. Well, I could not stop thinking about it. I am on Pop!_OS again and although I did not disconnect any SSD on installation, Pop! did not detect Windows 10 and add it to Grub itself. So, I was back at where I started.

Quick recap of the setup: I have two SATA SSDs (yes, SATA, like a cave man), one with Windows 10 (the Crucial MX500) and one with Pop!_OS Linux (the Samsung 850 Evo). The bootloader for each OS is on the respective SSD.

Now, enough background, let us get to the solution!

If you are CLI wizard do your thing, I will be using a convenient UI for the first step. Open “Disks” and locate the Windows 10 EFI partition. It’s around 100MB in size. Once you have found it, click the “Play” button to mount it.

The Disks utility will then display the mount point that is required in the next step.

Now, copy some Windows 10 Boot files to your Linux /boot folder. Yes, you read that right. Sounds weird, but it did the trick.

Do this with Nautilus or use the following command (which I recommend). Replace <mount point> with the path you got from the Disks utility. Note that path completion does not work once you go past /boot/efi. The EFI folder exists, you merely do not have permissions to see it as a regular user.

sudo cp -r /<mount point>/EFI/Microsoft /boot/efi/EFI

The last step consists of making the boot menu show up so you can actually select an entry. Edit loader.conf and add “timeout 10” (or any amount of seconds you prefer).

sudo vim /boot/efi/loader/loader.conf

All you need to do now is reboot and (hopefully) enjoy a boot menu with your Pop!_OS and Windows 10 boot entries. I do not know if this procedure also works with other Linux variants. It might for the Ubuntu based distributions, but I cannot say.

Maven Failsafe Plugin environmentVariables Not Working (org.postgresql.Driver claims to not accept jdbcUrl)

A few months ago I had written about how one can setup a PostgreSQL database in a docker container during the Maven testing phase (part 1 and part 2). Today, I wanted to iterate on this topic using Testcontainers. Unfortunately, before I could get to that I ran into issues with the original project. For some reason I was now getting the following error:

Caused by: java.lang.RuntimeException: Driver org.postgresql.Driver claims to not accept jdbcUrl, jdbc:postgresql://localhost:${it-database.port}/docker_db_testing_tests

Maven did not replace the variable it-database in the integration test application.properties file. The question is: "why now"? It has worked before. Now, one thing that I changed is that this time I was using Linux instead of Windows. Either way, the fix was simple, although not obvious. It seems to be an issue with the Maven Failsafe plugin.

Not working:

<configuration>
    <environmentVariables>
        <it-database.port>${it-database.port}</it-database.port>
    </environmentVariables>
</configuration>

Working:

<configuration>
    <systemPropertyVariables>
        <it-database.port>${it-database.port}</it-database.port>
    </systemPropertyVariables>
</configuration>

Here is the link to the commit.

Spring Multipart File – Can I Read InputStream Multiple Times?

The short answer is Yes.

Here is the long version and why I even asked myself this question.

If you are familiar with ServletRequest then you probably know that calling its getInputStream method only works once. If you need to read the body data multiple times then it is up to you to cache it in a buffer or employ workarounds such as a "caching servlet request". Unfortunately, this fact is not stated in the Javadoc of ServletRequest#getInputStream so it is no wonder this question gets asked.

Spring’s MultipartFile is a bit different here. It, too, has a getInputStream method, but this one can be called multiple times. Again, it is not obvious from the documentation which is why I am making this mental note for myself and others who are researching this question because they know about the behavior of ServletRequest and assume – as I did – it is the same for MultipartFile. Fortunately, it is not.

In my case I needed to compute a hash of an uploaded file and then move the file to Azure’s Blob Storage. The Azure API used an InputStream and I assumed, once I had consumed the multipart InputStream that I could not use that API anymore.

As a side note: Using DigestInputStream it is possible to do this in one go, move the data to storage and while doing that compute the hash. In my case, I needed the hash first to compare it with a value that was provided on upload. Only when they match can the data be transferred to storage.

Star Wars Jedi Fallen Order Review

It was until the end of 2019 when the Star Wars franchise was blessed with another game that truly deserves to be part of the Star Wars universe. The last good Star Wars game I played was Bioware’s Knights of the Old Republic – and that was 2004! There were a few others in between and I may have played some. None left a lasting impression though, or otherwise I might still remember bits and pieces of them. And what did players get in recent history? Battlefront is what comes to mind. Well, it may have the Star Wars branding and characters and weapons and sounds. But to me, Star Wars is about a science-fiction fantasy story, a fairy tale if you will. I am not interested in a multiplayer shooter when I think about a Star Wars game. I am interested in an adventure and an adventure is what you get with Jedi Fallen Order. Is it a good adventure? Well, that is what I am here to tell you about.

Star Wars Jedi Fallen Order is a story driven, 3rd person action adventure. You play as a young Jedi that is hiding on a scrap planet until one day the Empire arrives and turns his life upside down. From there you fight your way through imperial troops, wildlife, and some zombies. Kind of.

Read More »

Automate Game Screenshot Capture: Windows API SendInput Function with C++

I am trying to write video game reviews after I have finished a game and I like to add some impressions in the form of screenshots to the reviews. There is one problem though: sometimes it is impossible to press the keyboard shortcut to capture a screenshot because the game requires my full attention – and all my fingers. Therefore, I miss out on a lot of action sequences. What does a programmer do in such a situation? Write a tool that scratches the itch.

Read More »

Assassin’s Creed Odyssey Review

Assassin’s Creed Odyssey is my first Assassin’s Creed ever. The first time I encountered Assassin’s Creed 1 I did not really like the concept. It felt weird to me that the actual interesting and cool gameplay was constantly interrupted by the modern-day stuff. It also did not help the game’s case that the German translation was atrocious. I had to revisit this series a few years later to get more interested. I did so by watching videos on YouTube where all cutscenes had been edited into one large video, effectively turning the game into a movie, sans the gameplay. Ultimately, I have come to like the presentation of the main stories. They are interesting enough and the cutscenes are of very high quality. As a result, I have seen about four or five of these “movies” and watched some gameplay of AC Origins. This really caught my attention and because Odyssey was supposed to be even more like an RPG, I snatched myself a copy once there was a good deal for it. But honestly, given the time I have spent with this game so far, the full price would have been warranted without question. I have finished the game including the DLCs, I am close to 200 hours and I think I am ready to share my thoughts.

Read More »