<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Niclas Roßberger on nidomiro</title><link>https://nidomiro.de/author/niclas-ro%C3%9Fberger/</link><description>Recent content in Niclas Roßberger on nidomiro</description><generator>Hugo</generator><language>en</language><lastBuildDate>Fri, 14 Mar 2025 10:43:41 +0100</lastBuildDate><atom:link href="https://nidomiro.de/author/niclas-ro%C3%9Fberger/index.xml" rel="self" type="application/rss+xml"/><item><title>Rust-04: More operators and loops</title><link>https://nidomiro.de/code/learning-rust/04-more-operators-and-loops/</link><pubDate>Sat, 16 Jul 2022 12:00:00 +0100</pubDate><guid>https://nidomiro.de/code/learning-rust/04-more-operators-and-loops/</guid><description>&lt;p>In the last post we improved the simple program to be extendable with other operators.
In this post we will implement more operators and a loop.&lt;/p>
&lt;p>Let&amp;rsquo;s start with the simple task: adding more operators.
To support more operators we have to change two parts of the calculator, the parsing and the evaluation.
First let&amp;rsquo;s look into changing the parser.
For this we simply add the new operators (&lt;code>-*/&lt;/code>) to the regex inside &lt;code>Operation::from_string&lt;/code>.
The resulting regex will look like this: &lt;code>^\s*(\d+)\s*([+\-*/])\s*(\d+)\s*$&lt;/code>.
Now the parser accepts the new operators; first part done.&lt;/p></description></item><item><title>Rust-03: Improving the simple program</title><link>https://nidomiro.de/code/learning-rust/03-improving-the-simple-program/</link><pubDate>Mon, 11 Apr 2022 12:00:00 +0100</pubDate><guid>https://nidomiro.de/code/learning-rust/03-improving-the-simple-program/</guid><description>&lt;p>In the last post we created a simple program that would accept an input like &lt;code>5+5&lt;/code> and calculates the result.
In this post we will improve this program.&lt;/p>
&lt;p>To prepare for adding more operators we need to improve the input-parsing.
Currently, we just split the input-string at the plus-sign.
If we want to know the operator, we have to choose another approach.&lt;/p>
&lt;p>In this case I chose regex:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-rust" data-lang="rust">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ff79c6">#[derive(Debug)]&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ff79c6">struct&lt;/span> &lt;span style="color:#50fa7b">Operation&lt;/span> {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> left: &lt;span style="color:#8be9fd">i32&lt;/span>,
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> operator: &lt;span style="color:#8be9fd">char&lt;/span>,
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> right: &lt;span style="color:#8be9fd">i32&lt;/span>,
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ff79c6">impl&lt;/span> Operation {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff79c6">fn&lt;/span> &lt;span style="color:#50fa7b">from_string&lt;/span>(input: &lt;span style="color:#ff79c6">&amp;amp;&lt;/span>&lt;span style="color:#8be9fd;font-style:italic">String&lt;/span>) -&amp;gt; &lt;span style="color:#8be9fd;font-style:italic">Option&lt;/span>&lt;span style="color:#ff79c6">&amp;lt;&lt;/span>Operation&lt;span style="color:#ff79c6">&amp;gt;&lt;/span> {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#8be9fd;font-style:italic">let&lt;/span> regex &lt;span style="color:#ff79c6">=&lt;/span> Regex::new(&lt;span style="color:#f1fa8c">r&lt;/span>&lt;span style="color:#f1fa8c">&amp;#34;^\s*(\d+)\s*([+])\s*(\d+)\s*$&amp;#34;&lt;/span>).unwrap();
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> regex.captures(&lt;span style="color:#ff79c6">&amp;amp;&lt;/span>input).map(&lt;span style="color:#ff79c6">|&lt;/span>capture&lt;span style="color:#ff79c6">|&lt;/span> Operation {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> left: (&lt;span style="color:#ff79c6">&amp;amp;&lt;/span>capture[&lt;span style="color:#bd93f9">1&lt;/span>]).parse().unwrap(),
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> operator: (&lt;span style="color:#ff79c6">&amp;amp;&lt;/span>capture[&lt;span style="color:#bd93f9">2&lt;/span>]).parse().unwrap(),
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> right: (&lt;span style="color:#ff79c6">&amp;amp;&lt;/span>capture[&lt;span style="color:#bd93f9">3&lt;/span>]).parse().unwrap(),
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> })
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> }
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>As you can see we have a new thing called &lt;code>struct&lt;/code> in the code.
If you are coming from a language like Java or Typescript, a struct can be seen as a class without any methods.
This struct is called &lt;code>Operation&lt;/code> and as the name suggests it holds an operation.
The fields &lt;code>left&lt;/code> and &lt;code>right&lt;/code> are both typed as an &lt;code>i32&lt;/code> or in other words a &amp;ldquo;signed 32-bit integer&amp;rdquo;.
The field &lt;code>operator&lt;/code> is a &lt;code>char&lt;/code> since we only use one character for an operator.
In rust &lt;code>strings&lt;/code> and &lt;code>chars&lt;/code> are utf-8, therefore a &lt;code>char&lt;/code> can contain one unicode codepoint, not just a byte.&lt;/p></description></item><item><title>Rust-02: The beginning</title><link>https://nidomiro.de/code/learning-rust/02-the-beginning/</link><pubDate>Fri, 25 Mar 2022 12:00:00 +0100</pubDate><guid>https://nidomiro.de/code/learning-rust/02-the-beginning/</guid><description>&lt;p>At first, I didn&amp;rsquo;t like Rust.
Managing memory myself is something I don&amp;rsquo;t want to do.
After a first look at Rust and setting it aside for a few weeks, it appeared back on my radar.
I thought: &amp;ldquo;This time I&amp;rsquo;m looking deeper into it&amp;rdquo;.
So I started by reading the &lt;a href="https://doc.rust-lang.org/book/">Rust Book&lt;/a>; and I&amp;rsquo;m still reading it and find new concepts that are really clever.&lt;/p>
&lt;p>One of the first things I discovered is that I do not need to manage memory myself.
The majority of the management will be done by the Rust compiler; I just have to follow some Rules.
These Rules, called &amp;ldquo;Ownership&amp;rdquo;, are a bit confusing to start with, but make more sense, the more you think about them, and the more you use them.
In combination with the strict differentiation between mutable and immutable structures, you can write code that is easy to read, easy to think about and resource efficient - a combination, I thought never possible.&lt;/p></description></item><item><title>Rust-01: Why am I learning Rust?</title><link>https://nidomiro.de/code/learning-rust/01-why-learning-rust/</link><pubDate>Tue, 01 Mar 2022 12:00:00 +0100</pubDate><guid>https://nidomiro.de/code/learning-rust/01-why-learning-rust/</guid><description>&lt;p>This is a good question, a very good question.
Why am I learning &lt;a href="https://www.rust-lang.org/">Rust&lt;/a>?&lt;/p>
&lt;p>To begin with, I programmed in a lot of languages so far: C++, Python, Swift, Java, Kotlin and TypeScript to name a few.
All languages have some features I missed when programming in other languages.&lt;/p>
&lt;p>Currently, my favorite languages are Kotlin and TypeScript; with Kotlin having the lead.
These languages are expressive, and really nice to write.
I can express my thoughts in code without having to convert them too much in order to make the compiler happy.&lt;/p></description></item><item><title>More secure DinD in GitLab CI</title><link>https://nidomiro.de/article/more-secure-dind-in-gitlab-ci/</link><pubDate>Thu, 31 Dec 2020 12:00:00 +0000</pubDate><guid>https://nidomiro.de/article/more-secure-dind-in-gitlab-ci/</guid><description>&lt;p>If you are reading this article you probably already know how to use DinD (DockerInDocker) in GitLab CI. The default way is to set &lt;code>privileged=true&lt;/code> in your Runner-config.&lt;/p>
&lt;p>This little flag makes everything work; but at the cost of security. There are many articles regarding this topic, eg. &lt;a href="https://www.trendmicro.com/en_us/research/19/l/why-running-a-privileged-container-in-docker-is-a-bad-idea.html">this one&lt;/a>. The baseline is, if you run a container privileged, and the container uses the root-user inside, you can lose the whole server.&lt;/p></description></item><item><title>More secure deployments via ssh</title><link>https://nidomiro.de/code/more-secure-deployments-via-ssh/</link><pubDate>Fri, 21 Aug 2020 12:00:00 +0000</pubDate><guid>https://nidomiro.de/code/more-secure-deployments-via-ssh/</guid><description>&lt;p>If we deploy an application automatically we have to grant the CI
(Continuous Integration) access to the server. Common practice is to do
that via a GitLab Runner or an ssh account on the server.&lt;/p>
&lt;p>Personally I would not recommend using a GitLab Runner for deployments,
because you have to maintain it. Another potential issue is, that you
normally register runners for your whole GitLab instance or groups. That
results in a scenario in which everyone can use that runner and
accidentally (or not) destroy, for example, your production server. To
avoid that you have to register the GitLab Runner in the Project it
belongs to only. But even then your production server can be misused as
a build worker and therefore create performance issues.&lt;/p></description></item><item><title>Handling server configurations</title><link>https://nidomiro.de/article/server-config-from-git/</link><pubDate>Wed, 15 Jul 2020 12:00:00 +0000</pubDate><guid>https://nidomiro.de/article/server-config-from-git/</guid><description>&lt;h1 id="intro">Intro&lt;/h1>
&lt;p>During my work as a programmer I often encountered that configuration and infrastructure files only lived on the servers they belog to. If they had a copy in git, the states would always divert over time. One reason for this diverting is that you actively have to put the changed files in git, after you finished your work. It’s simply a thing you can forget.&lt;/p>
&lt;p>What do I mean by &amp;ldquo;infrastructure files&amp;rdquo;? For me infrastructure files are files, that you need to configure the server itself, e.g. nginx-config, docker-compose.yml, &amp;hellip; .&lt;/p></description></item><item><title>Switching to Hugo</title><link>https://nidomiro.de/article/switching-to-hugo/</link><pubDate>Wed, 17 Jun 2020 12:00:00 +0200</pubDate><guid>https://nidomiro.de/article/switching-to-hugo/</guid><description>&lt;p>If you see this post, my WordPress blog is gone.&lt;/p>
&lt;p>My Blog now uses &lt;a href="https://gohugo.io/">Hugo&lt;/a>.
I really like formats like &lt;a href="https://en.wikipedia.org/wiki/Markdown">Markdown&lt;/a> and &lt;a href="https://de.wikipedia.org/wiki/AsciiDoc">AsciiDoc&lt;/a>.
These formats are expressive, and you can edit them with every editor &lt;em>you&lt;/em> want and don&amp;rsquo;t need expensive licenses, like for Word or similar.
Another advantage is that you define what should happen by writing and not by clicking a button and hoping the program does what you intended to do.&lt;/p></description></item><item><title>Install cmake 3.11.1 on Ubuntu</title><link>https://nidomiro.de/2018/04/install-cmake-3-11-1-on-ubuntu/</link><pubDate>Tue, 17 Apr 2018 20:00:00 +0200</pubDate><guid>https://nidomiro.de/2018/04/install-cmake-3-11-1-on-ubuntu/</guid><description>&lt;p>Sometimes you just want a newer version than ubuntu ships. This code
will update cmake to version 3.11.1 or any other version you want.&lt;/p></description></item><item><title>Automatic VirtualBox module signing for UEFI</title><link>https://nidomiro.de/2018/04/automatic-virtualbox-module-signing-for-uefi/</link><pubDate>Tue, 17 Apr 2018 19:49:00 +0200</pubDate><guid>https://nidomiro.de/2018/04/automatic-virtualbox-module-signing-for-uefi/</guid><description>&lt;p>These steps are for all those people who hate to sign the Virtualbox
modules every time and don’t want to disable UEFI.&lt;/p></description></item><item><title>Ubuntu: automatic password for second encrypted disk</title><link>https://nidomiro.de/2016/12/ubuntu-automatic-password-for-second-encrypted-disk/</link><pubDate>Thu, 15 Dec 2016 21:23:00 +0200</pubDate><guid>https://nidomiro.de/2016/12/ubuntu-automatic-password-for-second-encrypted-disk/</guid><description>&lt;p>I just encountered the problem that I have to type two passwords at
startup, for two encrypted disks. My first disk is encrypted through the
Ubuntu installer. After some searching I found the perfect solution for
that task. In german, it&amp;rsquo;s called
&lt;a href="https://wiki.ubuntuusers.de/LUKS/Schl%C3%BCsselableitung/#Bestehendes-LUKS-Geraet">&amp;ldquo;Schlüsselableitung&amp;rdquo;&lt;/a>,
in English derived keys. But perfect solutions often have a big issue
why they don’t work, like here. I’m using Ubuntu 16.04 which uses
´systemd´, and that has problems with derived keys. So I found the
second most perfect solution for me, using a key-file. Some people argue
that this is a security issue, but the derived key is also obtainable
with root rights, just like a key-file. And by the way, your private
keys of your certificates are also stored on that disks and nearly
nobody complains about that.&lt;/p></description></item><item><title>Qt Signals &amp; Slots: How they work</title><link>https://nidomiro.de/2016/12/qt-signals-and-slots-how-they-work/</link><pubDate>Wed, 07 Dec 2016 11:44:10 +0200</pubDate><guid>https://nidomiro.de/2016/12/qt-signals-and-slots-how-they-work/</guid><description>&lt;p>The one thing that confuses the most people in the beginning is the
Signal &amp;amp; Slot mechanism of Qt. But it’s actually not that difficult to
understand. In general Signals &amp;amp; Slots are used to loosely connect
classes. Illustrated by the keyword &lt;code>emit&lt;/code>, Signals are used to
broadcast a message to all connected Slots. If no Slots are connected,
the message &amp;ldquo;is lost in the wild&amp;rdquo;. So a connection between Signals &amp;amp;
Slots is like a TCP/IP connection with a few exceptions, but this
metaphor will help you to get the principle. A Signal is an outgoing
port and a Slot is an input only port and a Signal can be connected to
multiple Slots.&lt;/p></description></item><item><title>Should I use Qt containers or the std ones?</title><link>https://nidomiro.de/2016/11/should-i-use-qt-containers-or-the-std-ones/</link><pubDate>Wed, 02 Nov 2016 23:45:00 +0200</pubDate><guid>https://nidomiro.de/2016/11/should-i-use-qt-containers-or-the-std-ones/</guid><description>&lt;p>If you come from plain vanilla C++, you only know the &lt;em>C++ Standard
Library&lt;/em> with its containers like &lt;code>std::vector&lt;/code>. If you know how to use
them, you can accomplish your tasks pretty fast. But if you’re coming
from another language, the naming might be a bit odd. The Qt containers
offer both, C++ style and Java style naming of methods. So coming from
another language the Qt one&amp;rsquo;s might be easier to use.&lt;/p></description></item><item><title>Why I love the Qt framework</title><link>https://nidomiro.de/2016/10/en-why-i-love-the-qt-framework/</link><pubDate>Sat, 15 Oct 2016 21:31:00 +0200</pubDate><guid>https://nidomiro.de/2016/10/en-why-i-love-the-qt-framework/</guid><description>&lt;p>Everyone that knows me, knows that I love the Qt framework. Before I
started programming in C++, Java was my primary programming language. I
love the generics (yes, some of you will hate me for that opinion right
now) and reflection. During my Java-time I used them very often to
increase reusability. But while studying we had to learn C++ and I hated
it in the beginning. It felt so old and so stiff compared to Java. But
in one lecture we used Qt, and it was even more terrible - in the
beginning. Signals, Slots, QWidgets, &amp;hellip; it was too much. After working
with it for some time it felt better. What I really liked about Qt from
the beginning was the Qt Designer. For the first time I was able to have
fancy ui’s in C++ and don’t have to bother with a C api. In Java, I had a
graphical editor for Swing. So creating ui’s was now as easy as in Java,
maybe a bit easier. But the results with Qt are much better and fancier.
After some reading and experimentation I began to understand how Signals
and Slots work. From now on I really liked Qt. It was awesome. It was so
easy to accomplish tasks, and it still is. If you build an application
with an ui and some heavy stuff to calculate, or simply said two threads
to communicate, it is very easy with Qt. Just use Signals and Slots to
communicate between the threads and the Qt framework will deal with all
the synchronization stuff (If you use them properly). You can also use
Signals and Slots to loosely couple objects. The sender-object that
emitted the Signal, does not know where it is going and the
receiver-object does not know where it came from. So you easily exchange
components, just like with dependency injection. If I write an
application and use the C++ standard library and Qt, I can be sure that
it will compile and run on all the mayor platforms. A few months ago I
switched from Windows to Linux. The reason why I did that can be found
here &lt;strong>&lt;a href="https://nidomiro.de/2016/08/de-warum-ich-zu-linux-wechsle/">Warum ich zu Linux
wechsle&lt;/a>&lt;/strong> if you can read
German. I was so excited when I opened the project file of my Qt
project. I developed the whole project in Windows and with a click of
the &amp;ldquo;Compile &amp;amp; Run&amp;rdquo; button it was running under Linux. But the
portability is not the only advantage. You have a huge Library with many
classes solving different problems. If you want to use for example
Network, no problem, just use it. The same goes for JSON support, XML,
SQL, Bluetooth, OpenGL and many more. It’s just so convenient, you don’t
have to search for a library, try to compile it and link it to your
project, Qt does all that for you. So you don’t have to reinvent the
wheel every time. At the beginning I mentioned reflection in Java. You
can use reflection in Qt with the help of moc (Meta Object Compiler). So
every class that inherits from QObject knows what class it is and other
information at runtime.&lt;/p></description></item><item><title>Writing a basic Qt project with Qt Creator</title><link>https://nidomiro.de/2017/01/writing-a-basic-qt-project-with-qt-creator/</link><pubDate>Mon, 10 Oct 2016 11:44:00 +0200</pubDate><guid>https://nidomiro.de/2017/01/writing-a-basic-qt-project-with-qt-creator/</guid><description>&lt;p>I’m assuming you are already able to program and at least had a look at
C++. For example I won’t explain why &lt;code>int main(int argc, char *argv[])&lt;/code>
is in the C++ source code.&lt;/p>
&lt;p>If you create a &amp;ldquo;Qt Console Application&amp;rdquo; you will have the following
code:&lt;/p></description></item><item><title>How to start with Qt?</title><link>https://nidomiro.de/2016/12/how-to-start-with-qt/</link><pubDate>Fri, 07 Oct 2016 11:44:00 +0200</pubDate><guid>https://nidomiro.de/2016/12/how-to-start-with-qt/</guid><description>&lt;p>In this series I’ll give you a starting point on working with Qt.
Like I mentioned in &lt;em>&lt;a href="https://nidomiro.de/2016/10/en-why-i-love-the-qt-framework/">Why I love the Qt
framework&lt;/a>&lt;/em> I had a hard time
at the beginning. I want to give you an easier start with this awesome
peace of technology. This page will serve as an index for the whole
series of tutorials and explanations. As more posts follow this page
will be updated. I know there are plenty of tutorials on Qt, but maybe
I’ll explain some things in a way you understand better.&lt;/p></description></item><item><title>How to work on your projects on multiple devices</title><link>https://nidomiro.de/2016/09/en-how-to-work-on-your-projects-on-multiple-devices/</link><pubDate>Tue, 27 Sep 2016 22:26:00 +0200</pubDate><guid>https://nidomiro.de/2016/09/en-how-to-work-on-your-projects-on-multiple-devices/</guid><description>&lt;p>In the beginning of my programming-life I’ve never thought of
synchronization of my projects as an issue. Back at the time I only had
a Computer standing in my room. Then I got a Laptop from the company I
worked for back at the time. Still, synchronization was not an issue by
now because I kept private and work separate. But the whole journey
began when I started studying, and I bought myself a Laptop. In the
beginning I used a USB-drive to copy my workspace on, after I finished
on one device, and copied it to the other machine then. It was simply
ugly&amp;hellip; After a few weeks I had hundreds of different versions, because I
worked a bit on the Laptop, forgot to copy it to my Pc but wanted to
save the possible progress I made.&lt;/p></description></item><item><title>Installing Redmine 3.0 on clean Ubuntu 14.04</title><link>https://nidomiro.de/2015/03/installing-redmine-3-0-on-clean-ubuntu-14-04/</link><pubDate>Fri, 27 Mar 2015 13:10:00 +0200</pubDate><guid>https://nidomiro.de/2015/03/installing-redmine-3-0-on-clean-ubuntu-14-04/</guid><description>&lt;p>In this tutorial we will install Redmine on a clean installation of
Ubuntu server 14.04 with an Apache server and MySql. Redmine wil be
reachable under the subdomain &lt;code>redmine.example.com&lt;/code>.&lt;/p></description></item></channel></rss>