<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <?xml-stylesheet href="/s/inc/rss.xsl" type="text/xsl"?>
    <rss version="2.0"  xmlns:atom="http://www.w3.org/2005/Atom">
        <channel>
            <title>RSS feed for tag cpp on Raymii.org</title> 
            <link>https://raymii.org/s/tags/cpp.xml</link> 
            <description>RSS feed for tag cpp on Raymii.org</description>
            <atom:link href="https://raymii.org/s/tags/cpp.xml" rel="self" type="application/rss+xml" />
    
            <item>
                <title>Bringing a Decade Old Bicycle Navigator Back to Life with Open Source Software (and DOOM)</title> 
                <link>https://raymii.org/s/blog/Bringing_a_Decade_Old_Bicycle_Navigator_Back_to_Life_with_Open_Source_Software_and_DOOM.html?utm_medium=rss&amp;utm_source=raymii&amp;utm_campaign=tagrss</link> 
                <guid>https://raymii.org/s/blog/Bringing_a_Decade_Old_Bicycle_Navigator_Back_to_Life_with_Open_Source_Software_and_DOOM.html</guid>
                <description>I recently found a Navman Bike 1000 in a thrift store for EUR 10. This is a bike computer, a navigation device for cyclists, made by MiTaC, the same company that makes the Mio bike computers. This Navman Bike 1000 is a rebadged `Mio Cyclo 200`. It's from 2015 and as you might have guessed, no more map updates.
This article shows how I dabbled a bit in reverse engineering, figuring out the device runs Windows CE 6.0 and using Total Commander and [NaVeGIS](https://sourceforge.net/projects/navegis/) together with Open Street Map to get up to date maps from the OpenFietsMap project, allowing me to use this device for navigation with the most up to date maps. Since it is all open source, even if the current map provider would stop, I can always make my own maps.</description> 
                <pubDate>Fri, 25 Jul 2025 23:37:00 GMT</pubDate>
                <lastBuildDate>Sat, 02 Aug 2025 21:31:00 GMT</lastBuildDate>
            </item>
    
            <item>
                <title>Fast MQTT logger (to syslog)</title> 
                <link>https://raymii.org/s/software/Fast_MQTT_Logger.html?utm_medium=rss&amp;utm_source=raymii&amp;utm_campaign=tagrss</link> 
                <guid>https://raymii.org/s/software/Fast_MQTT_Logger.html</guid>
                <description>For almost 5 years I've been using the `mqtt-data-logger` [python script](https://github.com/RaymiiOrg/mqtt-data-logger) to log all MQTT communication. This script works, but is a bit limited in how it stores logs (files per time it's started) and it often can't keep up with the message rate (tens of thousands per second) of my mqtt brokers.
So I've written a new tool in C++ to log all MQTT messages to syslog and optionally to the terminal. Then, via syslog, you can send it to where ever you like, be it a file or an ELK (Logstash/Elasticsearch/Kibana) stack. It even compiles without syslog support, if you only want to log to a file or the terminal.
There's a docker image and a docker compose file, so you can easily deploy it wherever you have an MQTT broker running. </description> 
                <pubDate>Tue, 25 Mar 2025 21:33:00 GMT</pubDate>
                <lastBuildDate>Tue, 25 Mar 2025 21:33:00 GMT</lastBuildDate>
            </item>
    
            <item>
                <title>My go-to C++ code for asynchronous work processing on a separate thread</title> 
                <link>https://raymii.org/s/software/My_go-to_Cpp_code_for_asynchronous_work_processing_on_a_separate_thread.html?utm_medium=rss&amp;utm_source=raymii&amp;utm_campaign=tagrss</link> 
                <guid>https://raymii.org/s/software/My_go-to_Cpp_code_for_asynchronous_work_processing_on_a_separate_thread.html</guid>
                <description>You probably recognise this situation. You're working on your code and realise that the thing you're writing might take long, be blocking or is batch-wise. It might be resizing images, calling some API or processing hardware inputs or a stream of incoming messages. These tasks, if not handled efficiently, can halt your application, leaving it unresponsive. To avoid this, one solution is to offload these time-consuming operations to a separate thread, allowing the main application to continue executing without interruptions.
In this article, I'll show you how you can implement asynchronous work processing in C++ using a worker thread. This example class is my go-to for this situation and is easily adapted to handle more complex use cases. It has a queue of work items and uses a `std::thread`, a `std::mutex` combined with a `std::condition_variable` to manage work asynchronously, processing items one by one.</description> 
                <pubDate>Tue, 17 Dec 2024 23:59:00 GMT</pubDate>
                <lastBuildDate>Tue, 17 Dec 2024 23:59:00 GMT</lastBuildDate>
            </item>
    
            <item>
                <title>Logging all C++ destructors, poor mans run-time tracing</title> 
                <link>https://raymii.org/s/software/Logging_all_Cpp_destructors_poor_mans_run-time_tracing.html?utm_medium=rss&amp;utm_source=raymii&amp;utm_campaign=tagrss</link> 
                <guid>https://raymii.org/s/software/Logging_all_Cpp_destructors_poor_mans_run-time_tracing.html</guid>
                <description>I recently faced a challenging issue with an application that wasn't shutting down correctly, either segfaulting or terminating without an active exception. Running the program via `valgrind` to check for memory leaks wasn't possible because the program couldn’t perform its cleanup if it didn't shut down correctly. This article covers adding runtime instrumentation provided by `gcc` to log destructors. This helped me figure out what was still left over from the closed-source framework in use preventing correct shutdowns or causing segfaults. It includes example code, setup instructions and insights into handling shutdown issues in large, multi-threaded codebases.</description> 
                <pubDate>Sat, 21 Sep 2024 23:59:00 GMT</pubDate>
                <lastBuildDate>Sat, 21 Sep 2024 23:59:00 GMT</lastBuildDate>
            </item>
    
            <item>
                <title>Qt Property Macro (Q_PROPERTY with 95% less code)</title> 
                <link>https://raymii.org/s/blog/Qt_Property_Macro_Q_PROPERTY_with_95_percent_less_code.html?utm_medium=rss&amp;utm_source=raymii&amp;utm_campaign=tagrss</link> 
                <guid>https://raymii.org/s/blog/Qt_Property_Macro_Q_PROPERTY_with_95_percent_less_code.html</guid>
                <description>Adding [properties to QObject based classes](https://web.archive.org/web/20240529180113/https://doc.qt.io/qt-6/properties.html) is cumbersome. Although [the property system](https://web.archive.org/web/20240529180113/https://doc.qt.io/qt-6/properties.html) and [Signals and Slots](https://web.archive.org/web/20240529180002/https://doc.qt.io/qt-6/signalsandslots.html) are great to use, especially with QML, it takes a lot of boilerplate code to add such properties to a class, at least 15 to 20 lines for each property. I've cobbled up a macro that saves you about 95% of lines when using a `Q_PROPERTY`. (22 lines to 1 line).</description> 
                <pubDate>Wed, 29 May 2024 22:00:00 GMT</pubDate>
                <lastBuildDate>Wed, 29 May 2024 22:00:00 GMT</lastBuildDate>
            </item>
    
            <item>
                <title>Qt 5.15 LTS on Windows without a Qt Account</title> 
                <link>https://raymii.org/s/tutorials/Qt_5.15_LTS_on_Windows_without_a_Qt_Account.html?utm_medium=rss&amp;utm_source=raymii&amp;utm_campaign=tagrss</link> 
                <guid>https://raymii.org/s/tutorials/Qt_5.15_LTS_on_Windows_without_a_Qt_Account.html</guid>
                <description>I recently had to setup a Windows development environment with Qt 5.15. Qt 5.15 is still developed by the Qt company, but only released in binary form for paying customers. The [source code is released after 1 year](/s/blog/Qt_5.15_LTS_Docker_Image_for_Android_with_OpenSSL.html#toc_0).  Via the Online Installer you can only install 5.15.2 and you must login with a Qt account. This guide shows you how to install the most recent Qt 5.15 (as of writing it's 5.15.13) and Qt Creator, **without** a Qt account. We're using `vcpkg` to compile Qt and a specific offline-enabled installer for Qt Creator.</description> 
                <pubDate>Sun, 19 May 2024 00:00:00 GMT</pubDate>
                <lastBuildDate>Sun, 19 May 2024 00:00:00 GMT</lastBuildDate>
            </item>
    
            <item>
                <title>A docker image for Qt 5.15 LTS for Android, including OpenSSL and the KDE patch collection</title> 
                <link>https://raymii.org/s/blog/Qt_5.15_LTS_Docker_Image_for_Android_with_OpenSSL.html?utm_medium=rss&amp;utm_source=raymii&amp;utm_campaign=tagrss</link> 
                <guid>https://raymii.org/s/blog/Qt_5.15_LTS_Docker_Image_for_Android_with_OpenSSL.html</guid>
                <description>Recently I got an email from Google regarding the API level of [Leaf Node Monitoring](https://leafnode.nl), my open source monitoring app for Windows, Linux and Android. The Play Store version must be updated to target API level 33.
For Windows and Linux I'm building the app automatically in a CI environment but the Android build was still a manual process. Until now, because after a bunch of messing around with Android NDK versions, OpenSSL library paths and Qt compile flags I can automatically build Leaf Node Monitoring in my CI.

I'm using Woodpecker CI and that requires every build step to be executed in a Docker image. There are a few Qt docker images floating around but they are all using the pre-built 5.15.2 version by extracting it from the Qt Online Installer. That version is quite old, 5.15.15 LTS was released [a few days ago for Commercial License Holders](http://web.archive.org/web/20230902132649/https://www.qt.io/blog/commercial-lts-qt-5.15.15-released) on August 31, so after 1 year it will become available as open source.
My docker image builds Qt from source using the `5.15 KDE Qt Patch Collection` branch for Android and it includes OpenSSL. This is as far as I know the most up to date docker image for Qt 5.15, currently at 5.15.10 LTS.</description> 
                <pubDate>Wed, 13 Sep 2023 22:00:00 GMT</pubDate>
                <lastBuildDate>Wed, 13 Sep 2023 22:00:00 GMT</lastBuildDate>
            </item>
    
            <item>
                <title>Drawing a Circle in Qt QML three different ways</title> 
                <link>https://raymii.org/s/articles/Drawing_a_Circle_in_Qt_QML_three_different_ways.html?utm_medium=rss&amp;utm_source=raymii&amp;utm_campaign=tagrss</link> 
                <guid>https://raymii.org/s/articles/Drawing_a_Circle_in_Qt_QML_three_different_ways.html</guid>
                <description>Qt has no `Circle` built in to QML as a basic type, as for example the `Rectangle` or the `Button` control. This post shows you how to get a `Circle` in QML, from the most basic method (a `Rectangle` with a `radius` of 180) to more advanced methods, using the `Canvas` JavaScript API (which allows us to draw a partially filled Circle, for a Pie Chart) and a `c++` control based on `QQuickPaintedItem`. I wanted to experiment with the `Canvas` QML control and the `QQuickPaintedItem` C++ interface to get a better understanding of Qt and QML drawing interfaces, this post reflects that journey including showing your grouped QML properties exposed from C++.</description> 
                <pubDate>Wed, 05 Jul 2023 23:59:00 GMT</pubDate>
                <lastBuildDate>Wed, 05 Jul 2023 23:59:00 GMT</lastBuildDate>
            </item>
    
            <item>
                <title>My 24 year old HP Jornada can do things your modern iPhone still can't do!</title> 
                <link>https://raymii.org/s/blog/My_24_year_old_HP_Jornada_can_do_things_your_modern_iPhone_still_cant_do.html?utm_medium=rss&amp;utm_source=raymii&amp;utm_campaign=tagrss</link> 
                <guid>https://raymii.org/s/blog/My_24_year_old_HP_Jornada_can_do_things_your_modern_iPhone_still_cant_do.html</guid>
                <description>I like to tinker with old hardware. The [DEC](https://raymii.org/s/tags/dec.html) PDP-8 is my favorite [retro computer](/s/tags/pdp-8.html) and [Office 2003](/s/blog/Using_a_Windows_Mobile_2003_PDA_hp_ipaq_in_2022_including_whatsapp.html) is the best version ever released IMHO.  One of my other favorite retro devices is the HP Jornada 720. A small `handheld PC` (smaller than a netbook) running Windows CE or in my case, Linux. It has a decent keyboard, CFL backlit screen, **32 MB of RAM(!)**, a compact Flash card for storage and a stylus for the resistive touchscreen. Oh and I got a 10Mbit PCMCIA network card, but wireless cards are also still available. It might be old, released in 1999, but can do one thing your modern iPhone can't. </description> 
                <pubDate>Thu, 15 Jun 2023 01:30:00 GMT</pubDate>
                <lastBuildDate>Thu, 15 Jun 2023 01:30:00 GMT</lastBuildDate>
            </item>
    
            <item>
                <title>Named Booleans prevent C++ bugs and save you time</title> 
                <link>https://raymii.org/s/blog/Named_Booleans_prevent_bugs.html?utm_medium=rss&amp;utm_source=raymii&amp;utm_campaign=tagrss</link> 
                <guid>https://raymii.org/s/blog/Named_Booleans_prevent_bugs.html</guid>
                <description> During a recent code review I found a hard to spot bug, a misplaced parenthesis in an `if` statement. I often employ a technique I call `named booleans`, which would have prevented this bug. It's a simple technique, instead of a long `if` statement, give every comparison a seperate boolean variable with a descriptive name and use those variables is the `if` statement. This post shows the bug in question, an example of my `named booleans` technique and another tip regarding naming magic numbers.</description> 
                <pubDate>Fri, 17 Feb 2023 20:21:00 GMT</pubDate>
                <lastBuildDate>Fri, 17 Feb 2023 20:21:00 GMT</lastBuildDate>
            </item>
    
            <item>
                <title>Johnnie 'QObject' Walker, replace a service locator pattern while you're at it</title> 
                <link>https://raymii.org/s/software/Johnnie_QObject_Walker_replace_a_servicelocator_pattern.html?utm_medium=rss&amp;utm_source=raymii&amp;utm_campaign=tagrss</link> 
                <guid>https://raymii.org/s/software/Johnnie_QObject_Walker_replace_a_servicelocator_pattern.html</guid>
                <description>I've seen many C++ code bases where there was the concept of a service locator. An global static object that anyone can query to get a class. This is handy with old legacy spiderweb intertwined code that gets everything from everywhere, but not so useful when you're trying to unit test code, it is not visible from the header what dependencies you need. My preference goes to dependency injection, give all the dependencies to the class' constructor and use them that way. Makes it easy to mock and if you have many dependencies, it serves as a starting point to refactor in to a more clearly separated architecture. This article shows a piece of code that uses QObject, the Qt object base class, to replace a servicelocator. All QObjects can have a parent QObject, thus a tree is formed, which you can walk back up and search. This effectively replaces the servicelocator, since you can just request a certain type of QObject.</description> 
                <pubDate>Sat, 14 Jan 2023 04:30:00 GMT</pubDate>
                <lastBuildDate>Sat, 14 Jan 2023 04:30:00 GMT</lastBuildDate>
            </item>
    
            <item>
                <title>Add moc includes to speed up Qt compilation</title> 
                <link>https://raymii.org/s/blog/Qt_add_moc_includes_to_speed_up_compilation.html?utm_medium=rss&amp;utm_source=raymii&amp;utm_campaign=tagrss</link> 
                <guid>https://raymii.org/s/blog/Qt_add_moc_includes_to_speed_up_compilation.html</guid>
                <description>The Meta-Object Compiler, `moc`, handles Qt's C++ extensions and it is required for signals and slots and properties in Qt. `moc` reads C++ header files and if the `Q_OBJECT` macro is used, it generates an extra `.cpp` file named `moc_filename.cpp` containing extra (meta-object) code. This post has a bit of background information and a shell script to automatically include `moc_*.cpp` files in your code whenever `Q_OBJECT` is used. If you use `qmake`, this will probably speed up your build and if you use `cmake`, this will probably speed up incremental builds (when `CMAKE_AUTOMOC` is `on`).</description> 
                <pubDate>Mon, 12 Dec 2022 00:00:00 GMT</pubDate>
                <lastBuildDate>Mon, 12 Dec 2022 00:00:00 GMT</lastBuildDate>
            </item>
    
            <item>
                <title>Fade in / fade out in Qt/QML</title> 
                <link>https://raymii.org/s/tutorials/Fade_in_Fade_out_in_QML.html?utm_medium=rss&amp;utm_source=raymii&amp;utm_campaign=tagrss</link> 
                <guid>https://raymii.org/s/tutorials/Fade_in_Fade_out_in_QML.html</guid>
                <description>This guide shows you how to add a fade in / fade out effect to a control in QML. There are a lot of built in animations in Qt/QML, but no fade in/fade out. Using a state machine and a `SequentialAnimation`, we can first animate the opacity, then set the visibility, achieving a fade in / fade out effect. Other ways like a `PropertyAnimation` are also available but are less expressive or configurable.</description> 
                <pubDate>Fri, 19 Aug 2022 21:30:00 GMT</pubDate>
                <lastBuildDate>Fri, 19 Aug 2022 21:30:00 GMT</lastBuildDate>
            </item>
    
            <item>
                <title>Qt/QML Property bindings break after a JavaScript assignment</title> 
                <link>https://raymii.org/s/articles/Qt_QML_Property_bindings_break_after_javascript_assignment.html?utm_medium=rss&amp;utm_source=raymii&amp;utm_campaign=tagrss</link> 
                <guid>https://raymii.org/s/articles/Qt_QML_Property_bindings_break_after_javascript_assignment.html</guid>
                <description>Property bindings are one of the most powerful concepts in Qt/QML. Property bindings let you specify relationships between different object properties. When a properties dependencies change in value, the property is automatically updated according to the specified relationship. The QML engine monitors the properties dependencies (that is, the variables in the binding expression). When a change is detected, the QML engine re-evaluates the binding expression and applies the new result to the property.
One little known caveat with property bindings is that they break after a static JavaScript assignment (`property = value`). This post shows you the different behaviors and how to use `Qt.binding()` to assign property bindings via JavaScript.</description> 
                <pubDate>Thu, 19 May 2022 05:30:00 GMT</pubDate>
                <lastBuildDate>Thu, 19 May 2022 05:30:00 GMT</lastBuildDate>
            </item>
    
            <item>
                <title>HTTP GET requests with Qt and in Qml (async)</title> 
                <link>https://raymii.org/s/tutorials/HTTP_GET_requests_in_Qt_and_Qml_async.html?utm_medium=rss&amp;utm_source=raymii&amp;utm_campaign=tagrss</link> 
                <guid>https://raymii.org/s/tutorials/HTTP_GET_requests_in_Qt_and_Qml_async.html</guid>
                <description>With Qt it's very easy to work with (async) HTTP requests. This guide shows you how to do it with Qt core and in Qml. The two examples print the output of a HTTP GET request on screen after pressing a button. The Qml method uses JavaScript, so that's cheating a bit, the other method uses plain C++ with Qt's libraries for networking (`QNetworkAccessManager`) and signals and slots for the async part.</description> 
                <pubDate>Fri, 29 Apr 2022 00:00:00 GMT</pubDate>
                <lastBuildDate>Fri, 29 Apr 2022 00:00:00 GMT</lastBuildDate>
            </item>
    
            <item>
                <title>Yocto boot2qt for the Seeed reTerminal (Qt 6)</title> 
                <link>https://raymii.org/s/tutorials/Yocto_boot2qt_for_the_Seeed_reTerminal_qt6.html?utm_medium=rss&amp;utm_source=raymii&amp;utm_campaign=tagrss</link> 
                <guid>https://raymii.org/s/tutorials/Yocto_boot2qt_for_the_Seeed_reTerminal_qt6.html</guid>
                <description>In this guide we'll build a linux distribution for Seeed reTerminal, using the Yocto project and the `boot2qt` stack provided by Qt. This `boot2qt` image can be written to the internal eMMC and when booted up, the Seeed reTerminal runs a software stack that integrates nicely with Qt Creator (the Qt IDE), for example, one click deployment to the device. You can run your own Qt application on the reTerminal, full screen, it will boot right into it.
This guide covers Qt 6.2. The guide also covers changing the default startup app to your own app, Qt Creator integration and rotating your Qt app, both Widgets and QML, the latter via Wayland and Weston.</description> 
                <pubDate>Fri, 18 Mar 2022 00:00:00 GMT</pubDate>
                <lastBuildDate>Mon, 04 Apr 2022 00:00:00 GMT</lastBuildDate>
            </item>
    
            <item>
                <title>Build a WeatherTerminal app for the Seeed reTerminal (with Qt 6 &amp; QML)</title> 
                <link>https://raymii.org/s/tutorials/Qt_QML_WeatherTerminal_app_for_the_Seeed_reTerminal.html?utm_medium=rss&amp;utm_source=raymii&amp;utm_campaign=tagrss</link> 
                <guid>https://raymii.org/s/tutorials/Qt_QML_WeatherTerminal_app_for_the_Seeed_reTerminal.html</guid>
                <description>In this guide I'll show you how to build a weather app for the Seeed reTerminal using Qt and QML. Imagine the reTerminal in your entrance hallway and with just a quick glance at the screen you'll know what the weather will be the next few hours, if you need an umbrella, if you'll have a headwind on your bicycle ride or if it's just going to be clear and sunny. This tutorial builds on the [reTerminal Yocto boot2qt distro](/s/tutorials/Yocto_boot2qt_for_the_Seeed_reTerminal_qt6.html) we've built in the previous article and uses Qt 6. Qt is a C++ framework, but this Weather app will use QML almost exclusively. I'm using just QML to make the guide more accessible and also because I'm used to doing everything in C++, so a sidestep to QML is fun for me as well. </description> 
                <pubDate>Sat, 02 Apr 2022 00:00:00 GMT</pubDate>
                <lastBuildDate>Sat, 02 Apr 2022 00:00:00 GMT</lastBuildDate>
            </item>
    
            <item>
                <title>Qt 5.15.3 Open Source released</title> 
                <link>https://raymii.org/s/blog/Qt_5.15.3_OpenSource_released.html?utm_medium=rss&amp;utm_source=raymii&amp;utm_campaign=tagrss</link> 
                <guid>https://raymii.org/s/blog/Qt_5.15.3_OpenSource_released.html</guid>
                <description>Qt is a nice C++ framework with a GUI toolkit on top, actually, 2 toolkit, Widgets and Qml. Qt is available under the GPL and LPGL, open source licenses and a closed source license. [Back in 2020](https://lwn.net/Articles/817129/), the Qt company decided to [start a war](https://ev.kde.org/2020/04/06/changes-in-qt-and-the-kde-free-qt-foundation/) against their own users and contributors by withholding the 5.15 code, only releasing them under a closed license, making the offline installers available to paid customers and requiring a Qt account for the online installer. Due to [an agreement](https://www.qt.io/faq/3.2.-why-do-you-have-an-agreement-with-kde-about-your-licensing-what-kde-is-and-whats-the-history-of-qt-and-kde) with the [KDE project](https://kde.org/community/whatiskde/kdefreeqtfoundation/) they are obliged to release the code after one year under an open source license, and that time has come for 5.15.3. For most LTS releases, the Qt company writes a blog post, but this open source release only gets a [mailing list post](https://lists.qt-project.org/pipermail/development/2022-March/042262.html) (One day and 4 blog posts later, [no mention of 5.15.3 on their blog](https://archive.ph/IvMSn)). This short post is intended to give a bit more publicity to that release and to tell you about the KDE Qt 5.15 LTS patch collection. Even if I might not agree with the business practices, the framework is nice to work with.</description> 
                <pubDate>Fri, 04 Mar 2022 00:00:00 GMT</pubDate>
                <lastBuildDate>Fri, 04 Mar 2022 00:00:00 GMT</lastBuildDate>
            </item>
    
            <item>
                <title>Yocto boot2qt for the Raspberry Pi 4, both Qt 5.15 and 6.2</title> 
                <link>https://raymii.org/s/tutorials/Yocto_boot2qt_for_the_Raspberry_Pi_4_both_Qt_6_and_Qt_5.html?utm_medium=rss&amp;utm_source=raymii&amp;utm_campaign=tagrss</link> 
                <guid>https://raymii.org/s/tutorials/Yocto_boot2qt_for_the_Raspberry_Pi_4_both_Qt_6_and_Qt_5.html</guid>
                <description>In this guide we'll build a linux distribution for Raspberry Pi 4, using the Yocto project and the `boot2qt` stack provided by Qt. This `boot2qt` image can be written to an SD card and when booted up, the Raspberry Pi runs a software stack that integrates nicely with Qt Creator (the Qt IDE), for example, one click deployment to the device. You can run your own Qt application on the Pi, full screen, it will boot right into it.
This guide covers both Qt 5.15 and Qt 6.2. The 5.15 build process is a bit convoluted due to a few upstream issues. The guide also covers changing the default startup app to your own app and Qt Creator integration.</description> 
                <pubDate>Mon, 21 Feb 2022 00:00:00 GMT</pubDate>
                <lastBuildDate>Mon, 21 Feb 2022 00:00:00 GMT</lastBuildDate>
            </item>
    
            <item>
                <title>Embed the source code directly in your Qt app with qmake and qrc, for GPL compliance</title> 
                <link>https://raymii.org/s/articles/Embed_the_source_code_directly_in_your_Qt_app.html?utm_medium=rss&amp;utm_source=raymii&amp;utm_campaign=tagrss</link> 
                <guid>https://raymii.org/s/articles/Embed_the_source_code_directly_in_your_Qt_app.html</guid>
                <description>In my earlier [post on selling GPL software](/s/blog/Selling_GPL_Software_part_1_lots_of_hurdles.html) I outlined a few points that make it hard to sell GPL software. One of them is the availability of the source code. You could put it online but then everyone has access without paying. Other options like putting it behind a login or sending a link after purchase require extra systems and saving more user information, lots of extra hassle for me and the users.
One of my ideas for 'solving' this issue is by shipping the actual source code directly inside the application. This article shows you how to do that, by creating an archive of the current source code on every build with `qmake` and embedding that inside the application using `qrc`, including a button to save the archive locally to disk. It works on the desktop as well as Android, including the required permissions.</description> 
                <pubDate>Sat, 12 Feb 2022 00:00:00 GMT</pubDate>
                <lastBuildDate>Sat, 12 Feb 2022 00:00:00 GMT</lastBuildDate>
            </item>
    
            <item>
                <title>Log all Item properties and functions in Qml</title> 
                <link>https://raymii.org/s/snippets/Log_all_Item_properties_and_functions_in_Qml.html?utm_medium=rss&amp;utm_source=raymii&amp;utm_campaign=tagrss</link> 
                <guid>https://raymii.org/s/snippets/Log_all_Item_properties_and_functions_in_Qml.html</guid>
                <description>This small snippet of Javascript logs all properties and functions of a Qml Item. This is useful when you're knees-deep in a dynamic control that has a model and you're wondering why your code does not work. Probably because you're not using the correct property name. Or at least, that is something I often have. Logging all properties or functions helps to figure out that issue.</description> 
                <pubDate>Wed, 09 Feb 2022 00:00:00 GMT</pubDate>
                <lastBuildDate>Wed, 09 Feb 2022 00:00:00 GMT</lastBuildDate>
            </item>
    
            <item>
                <title>Loop over all Repeater items or Delegate's in Qml</title> 
                <link>https://raymii.org/s/snippets/Loop_over_all_Repeater_items_or_Delegates_in_Qml.html?utm_medium=rss&amp;utm_source=raymii&amp;utm_campaign=tagrss</link> 
                <guid>https://raymii.org/s/snippets/Loop_over_all_Repeater_items_or_Delegates_in_Qml.html</guid>
                <description>This small snippet shows how to loop over all Repeater items in Qml and also over all Delegate items in Qml. There are sublte differences between the two.
I'm using this to update visual all items in a control, before syncing state to a networked backend, and if the backend actions fails, I undo the visual state change. The network backend could be slow, by keeping state locally and syncing in the background, the user can continue working.</description> 
                <pubDate>Wed, 09 Feb 2022 00:00:00 GMT</pubDate>
                <lastBuildDate>Wed, 09 Feb 2022 00:00:00 GMT</lastBuildDate>
            </item>
    
            <item>
                <title>QML Touch Area visualization with QML_VISUAL_TOUCH_DEBUGGING</title> 
                <link>https://raymii.org/s/tutorials/Qml_Touch_Area_Visualization_QML_VISUAL_TOUCH_DEBUGGING.html?utm_medium=rss&amp;utm_source=raymii&amp;utm_campaign=tagrss</link> 
                <guid>https://raymii.org/s/tutorials/Qml_Touch_Area_Visualization_QML_VISUAL_TOUCH_DEBUGGING.html</guid>
                <description>This guide shows you how to enable a red visual square around your `Mouseareas` and `MultiPointTouchArea` controls. It visualizes where you can click/touch and also shows any overlapping touch area's. It's helpful on full screen device interfaces like a coffee-machine or other HMI.
The environment flag `QML_VISUAL_TOUCH_DEBUGGING` needs to be set, but this is not documented on the Qt Docs site, only on a cheat sheet from 2016 by ISC. If you google for the environment flag, the only pages you get are the Qt source code and that cheat sheet. I've found this flag to be very useful when debugging touch issues, like overlapping touch or when a touch area is too small to use.
One of my co-workers found it when we had touch issues and since there is a lack of documentation, perfect for a small guide.</description> 
                <pubDate>Mon, 07 Feb 2022 00:00:00 GMT</pubDate>
                <lastBuildDate>Mon, 07 Feb 2022 00:00:00 GMT</lastBuildDate>
            </item>
    
            <item>
                <title>QML Drag and Drop including reordering the C++ model</title> 
                <link>https://raymii.org/s/tutorials/Qml_Drag_and_Drop_example_including_reordering_the_Cpp_Model.html?utm_medium=rss&amp;utm_source=raymii&amp;utm_campaign=tagrss</link> 
                <guid>https://raymii.org/s/tutorials/Qml_Drag_and_Drop_example_including_reordering_the_Cpp_Model.html</guid>
                <description>This guide shows you how to implement drag and drop in Qml including how to reorder the backing C++ (`QAbstractListModel` derived) data model.
Most QML Drag and Drop examples you find online, including the Qt official example, use a `ListModel` in the same Qml file which has the data, but no example I found actually reordered a C++ model.
This example has a simple `MVVM (model-view-viewmodel)` C++ structure and a QML file with a drag and drop grid. The dragable example items come from the C++ model, which is derived from `QAbstractListModel`.</description> 
                <pubDate>Fri, 21 Jan 2022 00:00:00 GMT</pubDate>
                <lastBuildDate>Fri, 21 Jan 2022 00:00:00 GMT</lastBuildDate>
            </item>
    
            <item>
                <title>Responsive QML Layout (with scrollbars)</title> 
                <link>https://raymii.org/s/articles/Responsive_Qml_layout_with_scrollbars.html?utm_medium=rss&amp;utm_source=raymii&amp;utm_campaign=tagrss</link> 
                <guid>https://raymii.org/s/articles/Responsive_Qml_layout_with_scrollbars.html</guid>
                <description>In this article I'll show you how to make a responsive layout in Qt / QML that automatically adjusts the amount of columns and rows based on the window dimensions, including scrollbars for when the content does not fit inside the window. This also works if you have a portrait and landscape orientation of your application, since the screen or window dimensions will be different across those two builds. I also explain how the dynamic resizing works with an explanation of property bindings in QML and as a bonus this works on mobile (Android/iOS) as well.</description> 
                <pubDate>Tue, 05 Oct 2021 00:00:00 GMT</pubDate>
                <lastBuildDate>Tue, 05 Oct 2021 00:00:00 GMT</lastBuildDate>
            </item>
    
            <item>
                <title>Render markdown in a Qt QML Text or TextEdit control</title> 
                <link>https://raymii.org/s/snippets/QML_Render_Markdown_in_Text.html?utm_medium=rss&amp;utm_source=raymii&amp;utm_campaign=tagrss</link> 
                <guid>https://raymii.org/s/snippets/QML_Render_Markdown_in_Text.html</guid>
                <description>I recently discovered that Qt QML can render Markdown in `Text{}` controls. This snippet shows you how to do that including a screenshot and demo QML app.</description> 
                <pubDate>Mon, 04 Oct 2021 00:00:00 GMT</pubDate>
                <lastBuildDate>Mon, 04 Oct 2021 00:00:00 GMT</lastBuildDate>
            </item>
    
            <item>
                <title>Qt/QML: Expose C++ classes to QML and why setContextProperty is not the best idea</title> 
                <link>https://raymii.org/s/articles/Qt_QML_Integrate_Cpp_with_QML_and_why_ContextProperties_are_bad.html?utm_medium=rss&amp;utm_source=raymii&amp;utm_campaign=tagrss</link> 
                <guid>https://raymii.org/s/articles/Qt_QML_Integrate_Cpp_with_QML_and_why_ContextProperties_are_bad.html</guid>
                <description>In this article I'm going to discuss the different ways to expose a C++ class to QML. QML is a markup language (part of the QT framework) like HTML/CSS, with inline JavaScript that can interact with the C++ code of your (QT) application. There are multiple ways to expose a C++ class to QML, each with their own benefits and quirks. This guide will cover three integration methods, `qmlRegisterSingletonType&lt;&gt;`, `rootContext-&gt;setContextProperty()` and `qmlRegisterType&lt;&gt;`. We'll end off with a simple benchmark showing the difference in startup times between the first two. </description> 
                <pubDate>Sun, 03 Oct 2021 00:00:00 GMT</pubDate>
                <lastBuildDate>Sun, 03 Oct 2021 00:00:00 GMT</lastBuildDate>
            </item>
    
            <item>
                <title>Rectangle{} debugging in QML, just like printf(), but for QT</title> 
                <link>https://raymii.org/s/articles/Rectangle_debugging_in_QML_just_like_printf.html?utm_medium=rss&amp;utm_source=raymii&amp;utm_campaign=tagrss</link> 
                <guid>https://raymii.org/s/articles/Rectangle_debugging_in_QML_just_like_printf.html</guid>
                <description>Recently I've been using a debugging technique in QT/QML that I've decided to name `Rectangle{}` debugging, in the same vein as `printf()` debugging. QML is a markup language (part of the QT framework) like HTML/CSS, with inline Javascript that can interact with the C++ code of your (QT) application. QML has the concept of `anchors` for relative positioning of elements. Overall, `anchors` work quite well, but can get complex when inheretance and complicated layouts come into play. The `Rectangle{}` style of debugging places a semi-transparent rectangle with a border around your element so you can visualize the positioning and see what effect your changes have. This article shows an example where I recently applied this style of debugging at work in our coffee machine user interface, including some tips to do actual `printf()` style debugging (but with `Console.log`).</description> 
                <pubDate>Wed, 08 Sep 2021 00:00:00 GMT</pubDate>
                <lastBuildDate>Wed, 08 Sep 2021 00:00:00 GMT</lastBuildDate>
            </item>
    
            <item>
                <title>Execute a command and get both output and exit status in C++ (Windows &amp; Linux)</title> 
                <link>https://raymii.org/s/articles/Execute_a_command_and_get_both_output_and_exit_code.html?utm_medium=rss&amp;utm_source=raymii&amp;utm_campaign=tagrss</link> 
                <guid>https://raymii.org/s/articles/Execute_a_command_and_get_both_output_and_exit_code.html</guid>
                <description>Recently I had to parse some command line output inside a C++ program. Executing a command and getting just the exit status is easy using `std::system`, but  also getting output is a bit harder and OS specific. By using `popen`, a POSIX `C` function we can get both the exit status as well as the output of a given command. On Windows I'm using `_popen`, so the code should be cross platform, except for the exit status on Windows is alway 0, that concept does not exist there. This article starts off with a stack overflow example to  get just the output of a command and builds on that to a safer version (null-byte handling) that returns both the exit status as well as the command output. It also involves a lot of detail on `fread` vs `fgets` and how to handle binary data.</description> 
                <pubDate>Mon, 07 Jun 2021 00:00:00 GMT</pubDate>
                <lastBuildDate>Mon, 07 Jun 2021 00:00:00 GMT</lastBuildDate>
            </item>
    
            <item>
                <title>It compiles does not always mean that it works, a tale of virtual overridden fun in C++</title> 
                <link>https://raymii.org/s/articles/It_compiles_does_not_always_means_that_it_works.html?utm_medium=rss&amp;utm_source=raymii&amp;utm_campaign=tagrss</link> 
                <guid>https://raymii.org/s/articles/It_compiles_does_not_always_means_that_it_works.html</guid>
                <description>In a [recent article on clang-tidy](/s/snippets/Run_one_specific_clang-tidy_check_on_your_codebase.html) I referenced the fact that we're doing a huge refactoring regarding `char` pointers, lifetime, ownership and `std::strings`. Todays post is another one related to that change, where even though everything compiled correctly, it didn't `work`. For a compiled language, that is not something you expect. Next to unit tests, a compiler error is your number one sign that you've made a mistake somewhere.
In this case however, the code all compiled fine. The issue here was an older part of the code not using `override` combined with automated refactoring in CLion missing some parts of the code during a change. So, the issue in this case is entirely our own fault, it was spotted in the manual testing, but I'd rather had it not happen at all.
In this post I'll describe the problem including some example code that illustrates what happened. My key point is that even though the code compiles, you should always test it, preferably automated with unit and integrations tests, otherwise manually with a runbook.</description> 
                <pubDate>Wed, 12 May 2021 00:00:00 GMT</pubDate>
                <lastBuildDate>Fri, 14 May 2021 00:00:00 GMT</lastBuildDate>
            </item>
    
            <item>
                <title>Run one specific clang-tidy check on your entire codebase</title> 
                <link>https://raymii.org/s/snippets/Run_one_specific_clang-tidy_check_on_your_codebase.html?utm_medium=rss&amp;utm_source=raymii&amp;utm_campaign=tagrss</link> 
                <guid>https://raymii.org/s/snippets/Run_one_specific_clang-tidy_check_on_your_codebase.html</guid>
                <description>Recently I did a major refactor on a piece of code that involved thousands of lines of code which were in one  way or another related to string handling. All of the code handled `char*` (C style character pointer arrays) and the concept of `const` or ownership was literally unknown in that part of the codebase. The refactored code uses `std::string`'s, but due to the legacy nature, a large number of methods returned `nullptr`'s instead of empty strings. I understand why this was done, but finding all those instances and the fact it only gives a runtime error was a bit of a bummer.
Luckily `clang-tidy` is here to save the day. In my IDE, CLion, it gives a warning when you return a `nullptr`. It however does that only in the file you're currently editing, and since we're talking millions of files, I wasn't going to open them by hand. You can run `clang-tidy` easily on one file, and it's not hard to run it on an entire codebase as well, using  the script `run-clang-tidy.py`, provided in their packages.
This snippet shows you how to run one specific `clang-tidy` check, in my case, `bugprone-string-constructor`, on a (cmake and C++) codebase.</description> 
                <pubDate>Mon, 05 Apr 2021 00:00:00 GMT</pubDate>
                <lastBuildDate>Mon, 05 Apr 2021 00:00:00 GMT</lastBuildDate>
            </item>
    
            <item>
                <title>Three ways to print booleans as 'True' or 'False' in C++</title> 
                <link>https://raymii.org/s/articles/Print_booleans_as_True_or_False_in_C++.html?utm_medium=rss&amp;utm_source=raymii&amp;utm_campaign=tagrss</link> 
                <guid>https://raymii.org/s/articles/Print_booleans_as_True_or_False_in_C++.html</guid>
                <description>In this article I'll show you three ways to print a textual representation of a boolean in C++. Normally a bool is printed as either a `0` or a `1` by `std::cout`, but more often than not, if you're printing a `bool`, it's better to see `true/false`. Imagine reading through lines and lines of boring, repeating log files, how easy is it to miss a `0` in a sea of `1`'s? I've been there many times, wishing for more verbose logs.
I'll start with a simple `printf` with a ternary `if`  e.g. `(a ? this : that)` and continue on to `std::boolalpha`. The latter one is more flexible and allows you to set different values to be printed, for localization,  and can even be used to parse input streams. That means, the string `true false` results in two `booleans`, the first being, well, `true` and the latter, surprisingly, being `false`.</description> 
                <pubDate>Sun, 21 Mar 2021 00:00:00 GMT</pubDate>
                <lastBuildDate>Sun, 21 Mar 2021 00:00:00 GMT</lastBuildDate>
            </item>
    
            <item>
                <title>Disable (debug) logging in QT and QML</title> 
                <link>https://raymii.org/s/articles/Disable_logging_in_QT_and_QML.html?utm_medium=rss&amp;utm_source=raymii&amp;utm_campaign=tagrss</link> 
                <guid>https://raymii.org/s/articles/Disable_logging_in_QT_and_QML.html</guid>
                <description>In QT you can use a few functions from the `qDebug.h` header like `qDebug()` and `qWarning()` to log information to the console. In QML you can use the likes of `console.log()`, `console.error()`. It's also very easy to implement your own logger (eg. `SyslogMessageHandler`) if you want something different, like logging to syslog and the console.
In this post I'll show you how to disable both forms of logging in a release build, qml and qt have different ways to manage their output.</description> 
                <pubDate>Sat, 27 Feb 2021 00:00:00 GMT</pubDate>
                <lastBuildDate>Sat, 27 Feb 2021 00:00:00 GMT</lastBuildDate>
            </item>
    
            <item>
                <title>QT / QML Signals and Slots with C++</title> 
                <link>https://raymii.org/s/snippets/Cpp_QT_QML_Signals_and_Slots.html?utm_medium=rss&amp;utm_source=raymii&amp;utm_campaign=tagrss</link> 
                <guid>https://raymii.org/s/snippets/Cpp_QT_QML_Signals_and_Slots.html</guid>
                <description>QT has an Observer mechanism built in, which they call '[Signals and Slots](https://web.archive.org/web/20210210180603/https://doc.qt.io/qt-5/signalsandslots.html)'. It allows objects to communicate with each other without having to have knowledge of either ones internals. By inheriting from `QObject` and defining a few `Q_PROPERTY` macro's, the QT Meta Object Compiler (`moc`) does all the hard work for you.
Inside a C++ class this all works handy dandy and is reasonable easy to follow, but when using QML it requires a bit more work. This small example shows you how to bind QML and C++ together using signals and slots, in QT 5.12.</description> 
                <pubDate>Thu, 25 Feb 2021 00:00:00 GMT</pubDate>
                <lastBuildDate>Thu, 25 Feb 2021 00:00:00 GMT</lastBuildDate>
            </item>
    
            <item>
                <title>C++ std::async with a concurrency limit (via semaphores)</title> 
                <link>https://raymii.org/s/tutorials/Cpp_std_async_with_a_concurrency_limit.html?utm_medium=rss&amp;utm_source=raymii&amp;utm_campaign=tagrss</link> 
                <guid>https://raymii.org/s/tutorials/Cpp_std_async_with_a_concurrency_limit.html</guid>
                <description>std::async is an easy way to do multiple things concurrently, without the hurdle of manual thread management in C++. Like batch converting images, database calls, http requests, you name it. Create a few 'std::futures' and later on when they're ready, '.get()' 'm while they're still hot. A 'future' is an object which handles the synchronization and guarantees that the results of the invocation are ready. If you '.get()' it and it's not ready, it will block.
Recently I had a use case for concurrency with a limit. I needed to do hundreds of HTTP calls to a JSON API. The concurrency limit was not for the hardware, but for the server on the other side. I didn't want to hammer it with requests.
There is no standard way to limit the amount of concurrent jobs via 'std::async'. You can fire of a hundred jobs and it is up to the implementation to not fry the hardware. On linux/gcc it will probably use a thread pool so you're lucky, but you cant assume that.
This article will show you a simple short solution to implement a concurrency limit together with std::async, by using a semaphore, implemented with modern (C++ 11) standard library features ('std::mutex', 'std::condition_variable' and such). It also has a C++ 17 version which replaces our custom CriticalSection class with the use of an 'std::scoped_lock' and 'BasicLockable'.
We start off with a shorter example showing how to fire off a set number of jobs and wait until all of those are finished before continuing. That is very useful if you have a set number of jobs and want the implementation to handle all the thread work for you.</description> 
                <pubDate>Sat, 09 Jan 2021 00:00:00 GMT</pubDate>
                <lastBuildDate>Sun, 10 Jan 2021 00:00:00 GMT</lastBuildDate>
            </item>
    
            <item>
                <title>Hacker News vs Lobste.rs in C++, an exercise in parsing json http api's and date/time/timezones</title> 
                <link>https://raymii.org/s/software/Cpp_exercise_in_parsing_json_http_apis_and_time_stuff.html?utm_medium=rss&amp;utm_source=raymii&amp;utm_campaign=tagrss</link> 
                <guid>https://raymii.org/s/software/Cpp_exercise_in_parsing_json_http_apis_and_time_stuff.html</guid>
                <description>I recently wondered how many top posts on the Hacker News frontpage are also on Lobsters. At first I reached for my trusty Python, because when I need to do some JSON API parsing that's what I'll use. (Otherwise bash is my default goto for small things, except when json, networking or associative arrays are involved.) But, then, a thought came to my mind. Why not try it with reasonably modern C++. It's what I do at work, so why not a simple personal project. It would involve dependency management (json and a http library), parsing both API endpoints and, most importantly, doing stuff with time. Time, timezones and dates are hard. This article contains a bit of my learning process, compilation and usage instructions and an example run. Go look at the code and run the code yourself. Let me know if my timezone calculations are working outside of GMT+1.</description> 
                <pubDate>Thu, 31 Dec 2020 00:00:00 GMT</pubDate>
                <lastBuildDate>Thu, 31 Dec 2020 00:00:00 GMT</lastBuildDate>
            </item>
    
            <item>
                <title>C++ set up cpp-httplib with SSL support with cMake</title> 
                <link>https://raymii.org/s/tutorials/Cpp_set_up_cpp-httplib_with_ssl_support_with_cmake.md.html?utm_medium=rss&amp;utm_source=raymii&amp;utm_campaign=tagrss</link> 
                <guid>https://raymii.org/s/tutorials/Cpp_set_up_cpp-httplib_with_ssl_support_with_cmake.md.html</guid>
                <description>For a small personal project that talks to a few JSON API's and does some data parsing I needed a header only C++ HTTP library. Header only because that is the simplest way to include it in my project, just copy and paste the file. I came across the project cpp-httplib, which fits my needs, does all the http methods, small, a few examples and it looks modern and has recent development commits. Setup and getting it working was easy, but as soon as I tried an https url, I got an exception ('https scheme is not supported.'). This guide shows you how to setup cpp-httplib for SSL support with cmake. It took me a bit longer than I wanted to set it up correctly, so why not save you the effort.</description> 
                <pubDate>Mon, 14 Dec 2020 00:00:00 GMT</pubDate>
                <lastBuildDate>Mon, 14 Dec 2020 00:00:00 GMT</lastBuildDate>
            </item>
    
            <item>
                <title>std::accumulate in C++</title> 
                <link>https://raymii.org/s/snippets/Cpp_std_accumulate.html?utm_medium=rss&amp;utm_source=raymii&amp;utm_campaign=tagrss</link> 
                <guid>https://raymii.org/s/snippets/Cpp_std_accumulate.html</guid>
                <description>I'm using codewars to practice my development skills. Today I found out about the std::accumulate method in C++ while doing an exercise there. I'm sharing it here because I never heard of it before. It is the numeric header, and it also accepts a custom binary function to apply instead of operator+. This snippet shows some examples including a lambda operator and the for loop you would use otherwise.</description> 
                <pubDate>Wed, 23 Oct 2019 00:00:00 GMT</pubDate>
                <lastBuildDate>Sat, 07 Nov 2020 00:00:00 GMT</lastBuildDate>
            </item>
    
            <item>
                <title>Store multiple types in a single std::map in C++ with std::any, just like a python dict</title> 
                <link>https://raymii.org/s/articles/Store_multiple_types_in_a_single_stdmap_in_cpp_just_like_a_python_dict.html?utm_medium=rss&amp;utm_source=raymii&amp;utm_campaign=tagrss</link> 
                <guid>https://raymii.org/s/articles/Store_multiple_types_in_a_single_stdmap_in_cpp_just_like_a_python_dict.html</guid>
                <description>In C++, everything has a type. When declaring a function you specify the return type and for each parameter you specify what type it is, just as for regular variables. Templates aside (those still have a type), you almost always know what type of data you're working with. There is the 'auto' keyword, which can save you a lot of typing and duplicate code, but fundamentally you're still working with types. Since C++ 17 you can use 'std::any' to store anything, without knowing the type. This is awesome for some tasks, and horrific for most use cases. In this article I'll show an example of a 'std::map' with 'std::any', that behaves like a python 'dict', it's able to store multiple different types in the same container.</description> 
                <pubDate>Wed, 23 Sep 2020 00:00:00 GMT</pubDate>
                <lastBuildDate>Wed, 23 Sep 2020 00:00:00 GMT</lastBuildDate>
            </item>
    
            <item>
                <title>CookieNumberPrinter, incremental / idle game style numbers in C++</title> 
                <link>https://raymii.org/s/software/CookieNumberPrinter_incremental_game_style_numbers.html?utm_medium=rss&amp;utm_source=raymii&amp;utm_campaign=tagrss</link> 
                <guid>https://raymii.org/s/software/CookieNumberPrinter_incremental_game_style_numbers.html</guid>
                <description>To level up my software development skills, I'm programming a command line game in my spare  time.  It is a clone of the famous cookieclicker game by ortiel. A clone of a game is simple enough to get up and running  fairly quickly, but also extensible enough when needed. How do you store huge score numbers  when they don't fit in a long long? How do you write a game loop, how to use threads to handle  user input? Saving a game (how to design a proper save format)? Also a great way to learn about project organization, software architecture and to try out design patterns. As the game is a clone of CookieCliker, which itself is an incremental game, I had to figure out how to work with large numbers. Since this is not a university math project, I allowed myself the luxury of using Boosts Multiprecision.  The library handles the large numbers, including caluclation and operations with such a number. I did want to print the numbers in Idle Style, where large numbers are displayed with a suffix, like '1 million' instead of '1000000' and so on. This 'C++' class can be used to print Boost's 'cpp_dec_float' numbers in incremental style. It's just one header.</description> 
                <pubDate>Sat, 12 Sep 2020 00:00:00 GMT</pubDate>
                <lastBuildDate>Sat, 12 Sep 2020 00:00:00 GMT</lastBuildDate>
            </item>
    
            <item>
                <title>Ubuntu Snap auto updates broke my development setup and there is no way to turn them off</title> 
                <link>https://raymii.org/s/blog/Ubuntu_Snap_auto_updates_broke_my_development_setup.html?utm_medium=rss&amp;utm_source=raymii&amp;utm_campaign=tagrss</link> 
                <guid>https://raymii.org/s/blog/Ubuntu_Snap_auto_updates_broke_my_development_setup.html</guid>
                <description>After updating-by-reinstall to Ubuntu 20.04, I installed CLion via snap since that  seemed more convinient than manually downloading a java installation. CLion is the best thing since sliced bread, or I mean a C/C++ IDE by JetBrains. Ubuntu snap is  a packaging system made by Canonical and pushed hard in Ubuntu. Today I found out the hard way that snap auto-updates and that there is no way to turn that off permanently. CLion was updated, which I noticed because the process was killed. The update broke several key plugins for my workflow  and the theme was weird. In this article I'll discuss my disgust, I as the owner of the computer want to be in full control, not some developer that decides I need auto updates. I ended up removing snap completely, and my next install will not be Ubuntu due to this.</description> 
                <pubDate>Sat, 01 Aug 2020 00:00:00 GMT</pubDate>
                <lastBuildDate>Sun, 02 Aug 2020 00:00:00 GMT</lastBuildDate>
            </item>
    
            <item>
                <title>C++ Remove leading or trailing characters from std::string</title> 
                <link>https://raymii.org/s/snippets/Cpp_Remove_leading_or_trailing_characters_from_string.html?utm_medium=rss&amp;utm_source=raymii&amp;utm_campaign=tagrss</link> 
                <guid>https://raymii.org/s/snippets/Cpp_Remove_leading_or_trailing_characters_from_string.html</guid>
                <description>Here's a small snippet to remove leading or trailing characters from a std::string in C++. I use it to strip leading and trailing zeroes in a game score display function.</description> 
                <pubDate>Sat, 18 Jul 2020 00:00:00 GMT</pubDate>
                <lastBuildDate>Sat, 18 Jul 2020 00:00:00 GMT</lastBuildDate>
            </item>
    
            <item>
                <title>Generate QR code and write it to a PNG, scaled, in C++</title> 
                <link>https://raymii.org/s/software/Cpp_generate_qr_code_and_write_it_to_png_scaled.html?utm_medium=rss&amp;utm_source=raymii&amp;utm_campaign=tagrss</link> 
                <guid>https://raymii.org/s/software/Cpp_generate_qr_code_and_write_it_to_png_scaled.html</guid>
                <description>The QR-Code-Generator library by Project Nayuki for C++ gives you an easy, fast and correct way to generate QR codes. However, you get just a data structure, showing that data is up to you. An example is provided to print the code to a terminal, but not to create and actual image file. For Java, there is an example provided which writes a PNG file, but not for C++. The author of the library also has another C++ library, Tiny-PNG-Out. It is correct up until 700 megapixel PNG files, which I hope your QR code never hits. I've written a class which bridges the two together, allowing you to both generate the QR code and write it to a PNG file, scaled up to be as readable as possible.</description> 
                <pubDate>Sun, 07 Jun 2020 00:00:00 GMT</pubDate>
                <lastBuildDate>Sun, 07 Jun 2020 00:00:00 GMT</lastBuildDate>
            </item>
    
            <item>
                <title>Github Actions, C++ with Boost and cmake, almost a 50% speedup with caching</title> 
                <link>https://raymii.org/s/articles/Github_Actions_cpp_boost_cmake_speedup.html?utm_medium=rss&amp;utm_source=raymii&amp;utm_campaign=tagrss</link> 
                <guid>https://raymii.org/s/articles/Github_Actions_cpp_boost_cmake_speedup.html</guid>
                <description>For a personal project I use Github for source code hosting and Github Actions as an automated build and test tool. Github Actions compiles my cmake project and runs all the unit tests on every commit. It also saves a build artifact, the actual compiled program. By utilizing some dependency caching and make flags I sped up the build process by 43% by caching the apt install libboost1.65-dev and giving cmake a -j2 makeflag. This article shows my simple setup to compile a C++ project with cmake and Boost on Github Actions. After compilation, it runs all the tests and uploads the compiled binary for download. For my one man project it's overkill, but when collaborating or when builds take a long time on your own machine, it's great to have an automated build / test system.</description> 
                <pubDate>Wed, 27 May 2020 00:00:00 GMT</pubDate>
                <lastBuildDate>Wed, 27 May 2020 00:00:00 GMT</lastBuildDate>
            </item>
    
            <item>
                <title>Here be dragons, or, invalidated iterators</title> 
                <link>https://raymii.org/s/blog/Here_be_dragons_or_invalidated_iterators.html?utm_medium=rss&amp;utm_source=raymii&amp;utm_campaign=tagrss</link> 
                <guid>https://raymii.org/s/blog/Here_be_dragons_or_invalidated_iterators.html</guid>
                <description>Recently I had a new 'first-time' moment. You know the ones, the, 'oh right', moments, after you put in a bit of research. Mine was, as you might expect from all the other recent content, related to C++. I learned, the hard way, that 'iterator-based for loops' don't like to be resized during the loop. Well, they don't really care, but some precautions are to be taken since the 'iterator' used in the loop might be invalidated. Or as the very helpfull error during the crash prints to the console, 'munmap_chunk(): invalid pointer' and your debugger points you to somewhere deep in 'new_allocator.h'. In this article I'll give a few examples, both using index based for loops and iterator based for loops, plus some more details on what's going on with iterator invalidation.</description> 
                <pubDate>Sun, 03 May 2020 00:00:00 GMT</pubDate>
                <lastBuildDate>Sun, 03 May 2020 00:00:00 GMT</lastBuildDate>
            </item>
    
            <item>
                <title>C++ async, threads and user input</title> 
                <link>https://raymii.org/s/articles/Cpp_async_threads_and_user_input.html?utm_medium=rss&amp;utm_source=raymii&amp;utm_campaign=tagrss</link> 
                <guid>https://raymii.org/s/articles/Cpp_async_threads_and_user_input.html</guid>
                <description>For an unrelated piece of code, I recently spent a few days trying to figure out if there was a portable, modern C++ way to handle user input with a timeout. If there is no input after a few seconds, the program can continue doing other things. TL;DR, there is none, since stdin is blocking I/O. At the end of the article I'll also provide the code I ended up using, which uses two actual big-boy threads, one for input and one for 'other work'.</description> 
                <pubDate>Fri, 24 Apr 2020 00:00:00 GMT</pubDate>
                <lastBuildDate>Fri, 24 Apr 2020 00:00:00 GMT</lastBuildDate>
            </item>
    
            <item>
                <title>Run CLion native on Android, ditch your desktop!</title> 
                <link>https://raymii.org/s/blog/Run_CLion_on_Android.html?utm_medium=rss&amp;utm_source=raymii&amp;utm_campaign=tagrss</link> 
                <guid>https://raymii.org/s/blog/Run_CLion_on_Android.html</guid>
                <description>How often do you read articles that state that people have replaced their main computer with an iPad and are fully content? Now, how many of those articles just use a linux server (vps) somewhere with some native apps, but mostly SSH to that server? Well, what if I told you that you can run a full blown IDE, the best IDE for C++ there is, CLion by JetBrains, on Android? Including compiling, just native GCC, CMake, GDB and all the stuff you are used to? Just for fun I've installed CLion on an old Samsung Tab S2 I had lying around, using Ubuntu in a chroot. It works way better than I'd expected, with a Bluetooth keyboard and mouse it's almost as if your on a desktop. I wonder if you could run Android Studio and use the tablet to compile app's for itself. This article shows some photo's, including a mechanical keyboard, different window managers and had instructions to replicate this setup.</description> 
                <pubDate>Fri, 27 Dec 2019 00:00:00 GMT</pubDate>
                <lastBuildDate>Fri, 27 Dec 2019 00:00:00 GMT</lastBuildDate>
            </item>
    
            <item>
                <title>ScreensaverStopper, stop activating the screensaver by sending F24 often</title> 
                <link>https://raymii.org/s/software/ScreenSaverStopper.html?utm_medium=rss&amp;utm_source=raymii&amp;utm_campaign=tagrss</link> 
                <guid>https://raymii.org/s/software/ScreenSaverStopper.html</guid>
                <description>ScreensaverStopper sends the F24 keystroke every 40 seconds. This way, Windows should not activate the screensaver. Useful if you do not have rights to disable the screensaver, but can run executables. Wwritten in C++, compiled with GCC 8.1 via MinGW/cMake. Filesize is around 14 KB, memory usage after a day of running around 600KB. License is GNU GPLv3.</description> 
                <pubDate>Sat, 21 Dec 2019 00:00:00 GMT</pubDate>
                <lastBuildDate>Sat, 21 Dec 2019 00:00:00 GMT</lastBuildDate>
            </item>
    
            <item>
                <title>and &amp; or are valid in C++ (alternative tokens)</title> 
                <link>https://raymii.org/s/blog/and_or_are_valid_Cpp.html?utm_medium=rss&amp;utm_source=raymii&amp;utm_campaign=tagrss</link> 
                <guid>https://raymii.org/s/blog/and_or_are_valid_Cpp.html</guid>
                <description>A post on lobste.rs on the C feature trigraphs triggered me to write this piece on the C++ feature, alternative tokens. I've recently suprised a co- worker by using an if statement with 'or' instead of '||', which works fine, but he never saw it before. It's in C++ since C++ 11, but MSVC requires a specific compiler flag ('/Za') or the 'iso646.h' header. This post has a few samples on the usage inclusing other alternative tokens like bitor, xor and or_eq.</description> 
                <pubDate>Mon, 16 Dec 2019 00:00:00 GMT</pubDate>
                <lastBuildDate>Mon, 16 Dec 2019 00:00:00 GMT</lastBuildDate>
            </item>
    
            <item>
                <title>Weight for Weight, a coding exercise that kept me busy</title> 
                <link>https://raymii.org/s/blog/Weight_for_Weight_a_coding_exersize_that_kept_me_busy.html?utm_medium=rss&amp;utm_source=raymii&amp;utm_campaign=tagrss</link> 
                <guid>https://raymii.org/s/blog/Weight_for_Weight_a_coding_exersize_that_kept_me_busy.html</guid>
                <description>I'm using codewars to practice my development skills. The exercise I was working on the past couple of days was a level higher than the 'rank' codewars gives me, so a more difficult exercise. Using the sparse free time I have, this kata took a bit longer to complete, and had me thinking about the problem when I was not doing the exercise. If a problem fascinates me that way, I can't stop thinking about it until I've solved it. In this article I'll walk you through my work on this kata.</description> 
                <pubDate>Tue, 12 Nov 2019 00:00:00 GMT</pubDate>
                <lastBuildDate>Tue, 12 Nov 2019 00:00:00 GMT</lastBuildDate>
            </item>
    
            <item>
                <title>std::string to lowercase or uppercase in C++</title> 
                <link>https://raymii.org/s/snippets/std_string_to_lowercase_or_uppercase_in_cpp.html?utm_medium=rss&amp;utm_source=raymii&amp;utm_campaign=tagrss</link> 
                <guid>https://raymii.org/s/snippets/std_string_to_lowercase_or_uppercase_in_cpp.html</guid>
                <description>I'm using codewars to practice my development skills. Today I learned a method to transform a std::string's casing, either to uppercase or lowercase. Researching it further, I also found out how to do unicode strings with boost. This article also includes a mini howto on installing Boost on Windows 10 via mingw for use with CLion.</description> 
                <pubDate>Thu, 07 Nov 2019 00:00:00 GMT</pubDate>
                <lastBuildDate>Thu, 07 Nov 2019 00:00:00 GMT</lastBuildDate>
            </item>
    
            <item>
                <title>C++ project setup with CMake &amp; unit tests (google test)</title> 
                <link>https://raymii.org/s/tutorials/Cpp_project_setup_with_cmake_and_unit_tests.html?utm_medium=rss&amp;utm_source=raymii&amp;utm_campaign=tagrss</link> 
                <guid>https://raymii.org/s/tutorials/Cpp_project_setup_with_cmake_and_unit_tests.html</guid>
                <description>This guide will show you how to setup a new C++ project with CMake and unit tests via Google's test framework. With this setup you can get started right away with test-driven-development in C++. It is also simple enough to look and figure out how to add gtest to your existing project and start doing TDD on your legacy (existing) codebase.</description> 
                <pubDate>Tue, 01 Oct 2019 00:00:00 GMT</pubDate>
                <lastBuildDate>Wed, 06 Nov 2019 00:00:00 GMT</lastBuildDate>
            </item>
    
            <item>
                <title>Only zero is false, everything else is true in C++</title> 
                <link>https://raymii.org/s/snippets/Cpp_Only_zero_is_false.html?utm_medium=rss&amp;utm_source=raymii&amp;utm_campaign=tagrss</link> 
                <guid>https://raymii.org/s/snippets/Cpp_Only_zero_is_false.html</guid>
                <description>When using numbers in a boolean (implicit conversion), remember that only zero evaluates to false. Anything else, including negative numbers, will evaluate to true. This snippet talks about the rules for implicit conversion in C++ when using booleans. For seasoned programmers it's nothing new, but I found it interesting.</description> 
                <pubDate>Fri, 12 Jul 2019 00:00:00 GMT</pubDate>
                <lastBuildDate>Fri, 12 Jul 2019 00:00:00 GMT</lastBuildDate>
            </item>
    
            <item>
                <title>C++ template definitions in a .cpp file (instead of a header file)</title> 
                <link>https://raymii.org/s/snippets/Cpp_template_definitions_in_a_cpp_file_instead_of_header.html?utm_medium=rss&amp;utm_source=raymii&amp;utm_campaign=tagrss</link> 
                <guid>https://raymii.org/s/snippets/Cpp_template_definitions_in_a_cpp_file_instead_of_header.html</guid>
                <description>In this snippet I'll show you how to place your C++ template definitions in a seperate .cpp file. I'd recommend you to just put template definitions in your header file, or a .hpp file, but if you really want to there is a trick to get them in a seperate .cpp file. The trick is to explicitly instanciate every template you're going to use at the end of the .cpp file. With many different templates and types this becomes cumbersome, but for certain usecases it could be useful. </description> 
                <pubDate>Sat, 22 Jun 2019 00:00:00 GMT</pubDate>
                <lastBuildDate>Sat, 22 Jun 2019 00:00:00 GMT</lastBuildDate>
            </item>
    
            <item>
                <title>C++ create and write to a CSV file with a variadic template</title> 
                <link>https://raymii.org/s/snippets/Cpp_create_and_write_to_a_CSV_file_with_a_variadic_template.html?utm_medium=rss&amp;utm_source=raymii&amp;utm_campaign=tagrss</link> 
                <guid>https://raymii.org/s/snippets/Cpp_create_and_write_to_a_CSV_file_with_a_variadic_template.html</guid>
                <description>In this snippet I'll show you a variadic template to write to a file. In line with my other experiments to get a better grasp at templates, this example improves on my earlier attempt by using a variadic template, thus allowing you to provide an infinite number of columns to the csv file of any type that has the overloaded &lt;&lt; operator.</description> 
                <pubDate>Mon, 17 Jun 2019 00:00:00 GMT</pubDate>
                <lastBuildDate>Mon, 17 Jun 2019 00:00:00 GMT</lastBuildDate>
            </item>
    
            <item>
                <title>C++ create and write to a CSV file</title> 
                <link>https://raymii.org/s/snippets/Cpp_create_and_write_to_a_csv_file.html?utm_medium=rss&amp;utm_source=raymii&amp;utm_campaign=tagrss</link> 
                <guid>https://raymii.org/s/snippets/Cpp_create_and_write_to_a_csv_file.html</guid>
                <description>In this quick snippet I'll show you how to create and write to a csv file. It includes checking if the file is writable, and if it's not there, creates it with a different first row as header. It's a quick example, I've used it to log some test data. It can probably be improved.</description> 
                <pubDate>Fri, 07 Jun 2019 00:00:00 GMT</pubDate>
                <lastBuildDate>Sun, 16 Jun 2019 00:00:00 GMT</lastBuildDate>
            </item>
    
            <item>
                <title>Cooking with C++ templates and stronger types</title> 
                <link>https://raymii.org/s/blog/Cooking_with_Cpp_templates_and_stronger_types.html?utm_medium=rss&amp;utm_source=raymii&amp;utm_campaign=tagrss</link> 
                <guid>https://raymii.org/s/blog/Cooking_with_Cpp_templates_and_stronger_types.html</guid>
                <description>To gain a better understanding of C++ templates I'm playing around with them. Most of the online guides stop at the example of a simple template to, for example, get the max of two inputs, or cover just a bit more (like how to overload operators for your specific template classes to make &lt;&lt; and + / - work). Combining templates with a stronger type to pass stuff around led me to a test kitchen. As in, some code with ingredients, amounts and an oven. One small thing kept it from working, after some feedback it turned out I was passing the wrong parameters to the template. Afterwards the error also made sense. This post covers both my learning and a small piece on stronger types.</description> 
                <pubDate>Thu, 13 Jun 2019 00:00:00 GMT</pubDate>
                <lastBuildDate>Thu, 13 Jun 2019 00:00:00 GMT</lastBuildDate>
            </item>
    
            <item>
                <title>C++ variadic template recursive example</title> 
                <link>https://raymii.org/s/snippets/Cpp_variadic_template_recursive_example.html?utm_medium=rss&amp;utm_source=raymii&amp;utm_campaign=tagrss</link> 
                <guid>https://raymii.org/s/snippets/Cpp_variadic_template_recursive_example.html</guid>
                <description>In this article I'll show you how to use a variadic template in C++. Variadic templates allow you to have a template with a variable number of arguments, also called a parameter pack. Unpacking that pack is more difficult than it should be, so we use a recursive template to iterate over all the parameters one by one. I've also included an example in Python to compare to.</description> 
                <pubDate>Sat, 08 Jun 2019 00:00:00 GMT</pubDate>
                <lastBuildDate>Sat, 08 Jun 2019 00:00:00 GMT</lastBuildDate>
            </item>
    
        </channel>
    </rss>
    
    