<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="FeedCreator 1.8" -->
<?xml-stylesheet href="https://baszerr.eu/lib/exe/css.php?s=feed" type="text/css"?>
<rss version="2.0">
    <channel xmlns:g="http://base.google.com/ns/1.0">
        <title>BaSzErr - blog:2020:10:23</title>
        <description></description>
        <link>https://baszerr.eu/</link>
        <lastBuildDate>Sun, 26 Apr 2026 13:31:35 +0000</lastBuildDate>
        <generator>FeedCreator 1.8</generator>
        <image>
            <url>https://baszerr.eu/lib/exe/fetch.php?media=wiki:dokuwiki.svg</url>
            <title>BaSzErr</title>
            <link>https://baszerr.eu/</link>
        </image>
        <item>
            <title>2020-10-23_-_brand_new_legacy_code</title>
            <link>https://baszerr.eu/doku.php?id=blog:2020:10:23:2020-10-23_-_brand_new_legacy_code</link>
            <description>
&lt;h1 class=&quot;sectionedit1&quot; id=&quot;brand_new_legacy_code&quot;&gt;2020-10-23 - brand new legacy code&lt;/h1&gt;
&lt;div class=&quot;level1&quot;&gt;

&lt;p&gt;
this post is already couple of years due.
but i think it is worth to tell this tale.
&lt;/p&gt;

&lt;p&gt;
back at that time i was working in a project, that had a chance to define a brand new interface.
totally from scratch.
no legacy, no backward compatibility – whatever the person responsible for it will decide, will get implemented.
rare occasion and a great moment in project&amp;#039;s history.
&lt;/p&gt;

&lt;p&gt;
the only real requirement was performance when sending large data blocks.
so what could go wrong here?
designing detached from reality when author of the specifications started to do changes without any experiments or measurements.
&lt;/p&gt;

&lt;p&gt;
after initial draft (“message level”) it came down to encoding and transmitting.
this was a moment in time where “optimizations” started to kick in.
nevermind the details – mostly loads of pointless “what if” discussions, that had no support in any data.
just a “strong feeling” that it will be better.
however noting is for free.
each of these “optimizations” added complexity and some extra states into (otherwise fairly straight forward) specification.
&lt;/p&gt;

&lt;p&gt;
as you can imagine, it backfired within a year time window.
extra steps turned out to be complex and error prone.
this in turn caused endpoints to go out of sync, on random occasions.
these issues were often non-reproducible, and timing related.
after having agreement between two ends of the communication channel, the &lt;abbr title=&quot;specification&quot;&gt;spec&lt;/abbr&gt; was pretty much set in stone.
&lt;/p&gt;

&lt;p&gt;
the interesting part was to see that when deployed, the protocol had zero issues with performance.
just for the sake of discussion we also stubbed the implementation with “naive” one – it did not even sweat!
all the pain (discussion, extra implementation, countless bugs and nerves) – in vain.
due to lack of proper measurements, that would support decisions to increase complexity, the team ended up with brand new legacy code that they had to maintain.
&lt;/p&gt;

&lt;p&gt;
more over – planned ultimate-flexibility of the protocol failed, too.
in fact the very first change in requirements that arrived blew the root concept apart.
it just happened to hit the part of the protocol that author assumed will never change.
to fix it even more extra states were needed, with even more potential for errors.
on the other hand, the parts that were made flexible enough to accept any possible input, were never really needed exercised.
both &lt;a href=&quot;https://en.wikipedia.org/wiki/KISS principle&quot; class=&quot;interwiki iw_wp&quot; title=&quot;https://en.wikipedia.org/wiki/KISS principle&quot;&gt;KISS principle&lt;/a&gt; and &lt;a href=&quot;https://en.wikipedia.org/wiki/open-closed principle&quot; class=&quot;interwiki iw_wp&quot; title=&quot;https://en.wikipedia.org/wiki/open-closed principle&quot;&gt;open-closed principle&lt;/a&gt; were violated here and it did not took long to see the results.
&lt;/p&gt;

&lt;p&gt;
avoid over-engineering and &lt;a href=&quot;https://en.wikipedia.org/wiki/bikeshedding&quot; class=&quot;interwiki iw_wp&quot; title=&quot;https://en.wikipedia.org/wiki/bikeshedding&quot;&gt;bikeshedding&lt;/a&gt;.
when making sth new stay focused on the problem you are solving.
support your decisions with actual measurements.
use prototypes / PoCs to help guide your research.
&lt;/p&gt;

&lt;/div&gt;
</description>
            <author>anonymous@undisclosed.example.com (Anonymous)</author>
            <pubDate>Tue, 15 Jun 2021 20:09:27 +0000</pubDate>
        </item>
        <item>
            <title>2020-10-23_-_limiting_code_line_length</title>
            <link>https://baszerr.eu/doku.php?id=blog:2020:10:23:2020-10-23_-_limiting_code_line_length</link>
            <description>
&lt;h1 class=&quot;sectionedit1&quot; id=&quot;limiting_code_line_length&quot;&gt;2020-10-23 - limiting code line length&lt;/h1&gt;
&lt;div class=&quot;level1&quot;&gt;

&lt;p&gt;
some time ago i came across an article / discussion &lt;a href=&quot;https://hackaday.com/2020/06/18/ask-hackaday-are-80-characters-per-line-still-reasonable-in-2020/&quot; class=&quot;urlextern&quot; title=&quot;https://hackaday.com/2020/06/18/ask-hackaday-are-80-characters-per-line-still-reasonable-in-2020/&quot; rel=&quot;ugc nofollow&quot;&gt;if it is still reasonable to stick to 80 characters per line&lt;/a&gt;, when writing a source code. argument is fairly simple – 80c is a magic number, that happened to be a number of characters that one can fit on the text console in &amp;#039;80s and &amp;#039;90s, text-mode (so that you do not have to scroll). we now have 2020, full-HD or 4K wide screens. so why bother?
&lt;/p&gt;

&lt;p&gt;
there is one more thing, though. when we read and need to skip to a new line, and the line is too long, we have trouble locating where the beginning of that new line is. this is no accident that newspapers are big, yet still feature multi-columns – it is just easier to read.
&lt;/p&gt;

&lt;p&gt;
&lt;a href=&quot;https://baszerr.eu/lib/exe/detail.php?id=blog%3A2020%3A10%3A23%3A2020-10-23_-_limiting_code_line_length&amp;amp;media=blog:2020:10:23:two_columns.jpg&quot; class=&quot;media&quot; title=&quot;blog:2020:10:23:two_columns.jpg&quot;&gt;&lt;img src=&quot;https://baszerr.eu/lib/exe/fetch.php?w=400&amp;amp;tok=3236ef&amp;amp;media=blog:2020:10:23:two_columns.jpg&quot; class=&quot;media&quot; loading=&quot;lazy&quot; title=&quot;http://i.stack.imgur.com/kSlZe.png&quot; alt=&quot;http://i.stack.imgur.com/kSlZe.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;
&lt;/p&gt;

&lt;p&gt;
this is also sth that trikes my nerve about dokuwiki i use here – lines can be just too long and annoying to read.
i do plan to fix it – it&amp;#039;s one of the “it will happen one day” projects.
&lt;/p&gt;

&lt;p&gt;
so shall we back to 80c?
i&amp;#039;d say no – 80c is arbitrary and fairly low, if you try to use descriptive names.
also code is not a typical text.
lines are not of an equal length.
very often there are lines with just braces / parenthesis.
this makes lines switching significantly simpler for human brain.
&lt;/p&gt;

&lt;p&gt;
my personal rule of thumb is to try to keep it below 120c.
on rare occasions i allow myself to reach up to 160c.
otherwise i just break lines, introduce helper functions, etc.
&lt;/p&gt;

&lt;p&gt;
in fact – this is how i typically work:
&lt;/p&gt;

&lt;p&gt;
&lt;a href=&quot;https://baszerr.eu/lib/exe/detail.php?id=blog%3A2020%3A10%3A23%3A2020-10-23_-_limiting_code_line_length&amp;amp;media=blog:2020:10:23:dual_screen_low.png&quot; class=&quot;media&quot; title=&quot;blog:2020:10:23:dual_screen_low.png&quot;&gt;&lt;img src=&quot;https://baszerr.eu/lib/exe/fetch.php?w=600&amp;amp;tok=f3efa6&amp;amp;media=blog:2020:10:23:dual_screen_low.png&quot; class=&quot;media&quot; loading=&quot;lazy&quot; title=&quot;my workspace&quot; alt=&quot;my workspace&quot; width=&quot;600&quot; /&gt;&lt;/a&gt;
&lt;/p&gt;

&lt;p&gt;
i use dual screen setup: primary screen is horizontal while secondary i pivot to vertical.
i edit code on secondary, so that i can benefit from seeing more context (more lines) at the expense of line lengths (which is still over 160c, thus more than enough for me).
primary screen serves as a compilation output and/or documentation preview.
&lt;/p&gt;

&lt;p&gt;
on top of this i use 20+ workspaces, to arrange my windows contextually.
&lt;a href=&quot;https://en.wikipedia.org/wiki/i3 (window manager)&quot; class=&quot;interwiki iw_wp&quot; title=&quot;https://en.wikipedia.org/wiki/i3 (window manager)&quot;&gt;i3&lt;/a&gt; &lt;a href=&quot;https://en.wikipedia.org/wiki/tiling window manager&quot; class=&quot;interwiki iw_wp&quot; title=&quot;https://en.wikipedia.org/wiki/tiling window manager&quot;&gt;tiling window manager&lt;/a&gt; of course, to minimize keyboard-mouse shifting.
&lt;/p&gt;

&lt;p&gt;
over the years i found this setup to best suite my needs.
&lt;abbr title=&quot;Your mileage may vary&quot;&gt;YMMV&lt;/abbr&gt;, but please keep line lengths readable while not being 80c orthodox.
there is a middle ground, that gets best out of both worlds.
&lt;/p&gt;

&lt;/div&gt;
</description>
            <author>anonymous@undisclosed.example.com (Anonymous)</author>
            <pubDate>Tue, 15 Jun 2021 20:09:27 +0000</pubDate>
        </item>
        <item>
            <title>2020-10-23_-_screw_it</title>
            <link>https://baszerr.eu/doku.php?id=blog:2020:10:23:2020-10-23_-_screw_it</link>
            <description>
&lt;h1 class=&quot;sectionedit1&quot; id=&quot;screw_it&quot;&gt;2020-10-23 - screw it...&lt;/h1&gt;
&lt;div class=&quot;level1&quot;&gt;

&lt;p&gt;
&lt;a href=&quot;https://baszerr.eu/lib/exe/detail.php?id=blog%3A2020%3A10%3A23%3A2020-10-23_-_screw_it&amp;amp;media=blog:2020:10:23:lead_and_pitch.png&quot; class=&quot;media&quot; title=&quot;blog:2020:10:23:lead_and_pitch.png&quot;&gt;&lt;img src=&quot;https://baszerr.eu/lib/exe/fetch.php?w=400&amp;amp;tok=86cc78&amp;amp;media=blog:2020:10:23:lead_and_pitch.png&quot; class=&quot;mediaright&quot; align=&quot;right&quot; loading=&quot;lazy&quot; title=&quot;https://upload.wikimedia.org/wikipedia/commons/0/00/Lead_and_pitch.png&quot; alt=&quot;https://upload.wikimedia.org/wikipedia/commons/0/00/Lead_and_pitch.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;
&lt;/p&gt;

&lt;p&gt;
i&amp;#039;m working on a pet project. it actually already spinned off a couple more child projects. one of them i hope to cover shortly. as a part of this effort a needed to screw down one part. thread was &lt;a href=&quot;https://en.wikipedia.org/wiki/metric screw&quot; class=&quot;interwiki iw_wp&quot; title=&quot;https://en.wikipedia.org/wiki/metric screw&quot;&gt;M10&lt;/a&gt;. i&amp;#039;m always using metric screws, in couple different sizes (depending on length / strength / weight parameters): M2, M3, M5, sometimes M8… and do so for many years now. this time i needed M10, which is much bigger than i typically use, but still – the same standard. so i made a trip to the shop just to buy two nuts and washers – around 0.2EUR total. when i got home, it turned out that the nut does not match thread!
&lt;/p&gt;

&lt;p&gt;
i suspected that it was not M10 but instead some imperial-rooted thread, that some1 accidentally rated as M10. but no – i checked multiple sources and all of them reported it as M10. so i did some reading and when i was finally able to “ask the right question” in the growser, it turned out that for standard metric system screws, you can have &lt;a href=&quot;https://baszerr.eu/doku.php?id=blog:2020:10:23:iso_metric_screw_thread#preferred_sizes&quot; class=&quot;wikilink2&quot; title=&quot;blog:2020:10:23:iso_metric_screw_thread&quot; rel=&quot;nofollow&quot; data-wiki-id=&quot;blog:2020:10:23:iso_metric_screw_thread&quot;&gt;different thread pitches&lt;/a&gt;: coarse (“default” one, if not mentioned otherwise) and fine (that in turn can also come in a couple flavors).
&lt;/p&gt;

&lt;p&gt;
the notion i was used to was eg. M10x50, which reads: M10 screw (i.e. 10mm diameter), 50mm long. this is the coarse pitch – default one. for M10 it is 1.5mm pitch, thus the full marking would be M10-1.5&amp;times;50. for “fine” threads of M10 you can choose among M10-1.25 and M10-1.
&lt;/p&gt;
&lt;blockquote&gt;&lt;div class=&quot;no&quot;&gt;
 “the good news about standards is that there are so many of them to choose from”&lt;/div&gt;&lt;/blockquote&gt;

&lt;p&gt;
&lt;a href=&quot;https://en.wikipedia.org/wiki/Andrew Tannenbaum&quot; class=&quot;interwiki iw_wp&quot; title=&quot;https://en.wikipedia.org/wiki/Andrew Tannenbaum&quot;&gt;Andrew Tannenbaum&lt;/a&gt;
&lt;/p&gt;

&lt;p&gt;
now i need to go back to the shop and look for more M10s, but with a (new measured), non-default pitch: M10-1.
&lt;/p&gt;

&lt;/div&gt;
</description>
            <author>anonymous@undisclosed.example.com (Anonymous)</author>
            <pubDate>Tue, 15 Jun 2021 20:09:27 +0000</pubDate>
        </item>
        <item>
            <title>2020-10-23_-_sudo_bash</title>
            <link>https://baszerr.eu/doku.php?id=blog:2020:10:23:2020-10-23_-_sudo_bash</link>
            <description>
&lt;h1 class=&quot;sectionedit1&quot; id=&quot;sudo_bash&quot;&gt;2020-10-23 - sudo bash&lt;/h1&gt;
&lt;div class=&quot;level1&quot;&gt;

&lt;p&gt;
yes – as a rule of thumb you should not make scripts &lt;a href=&quot;https://en.wikipedia.org/wiki/SUID&quot; class=&quot;interwiki iw_wp&quot; title=&quot;https://en.wikipedia.org/wiki/SUID&quot;&gt;SUID&lt;/a&gt;.
same for &lt;a href=&quot;https://en.wikipedia.org/wiki/bash&quot; class=&quot;interwiki iw_wp&quot; title=&quot;https://en.wikipedia.org/wiki/bash&quot;&gt;bash&lt;/a&gt; and other shells.
there are however times, you do know what you&amp;#039;re doing and / or it is ok to hack a bit to make it work “here and now”.
&lt;/p&gt;

&lt;p&gt;
fun fact – if you do
&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;sudo chmod u+s /bin/bash
bash&lt;/pre&gt;

&lt;p&gt;
you&amp;#039;ll not have root.
bash will detect that and drop privileges on its own.
&lt;/p&gt;

&lt;p&gt;
there is however a workaround – if you&amp;#039;re absolutely sure you know what you&amp;#039;re doing, you can go for
&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;bash -p&lt;/pre&gt;

&lt;p&gt;
this will tell bash to ignore this safety feature and run shell SUID, as requested.
so you can do this, but it has to be explicit.
&lt;abbr title=&quot;In my humble opinion&quot;&gt;IMHO&lt;/abbr&gt; nice balance between staying secure by default and allowing to do crazy things, when needed.
&lt;/p&gt;

&lt;/div&gt;
</description>
            <author>anonymous@undisclosed.example.com (Anonymous)</author>
            <pubDate>Tue, 15 Jun 2021 20:09:27 +0000</pubDate>
        </item>
    </channel>
</rss>
