<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Posts on MXI</title><link>https://mxii.eu.org/post/</link><description>Recent content in Posts on MXI</description><generator>Hugo -- gohugo.io</generator><language>en-us</language><lastBuildDate>Mon, 07 Jul 2025 20:45:00 +0400</lastBuildDate><atom:link href="https://mxii.eu.org/post/index.xml" rel="self" type="application/rss+xml"/><item><title>Still alive</title><link>https://mxii.eu.org/2025/07/07/still-alive/</link><pubDate>Mon, 07 Jul 2025 20:45:00 +0400</pubDate><guid>https://mxii.eu.org/2025/07/07/still-alive/</guid><description>&lt;p>Wow, it&amp;rsquo;s been 5 years since the last post.&lt;/p>
&lt;p>I&amp;rsquo;ve got somewhat unusual topic to cover and I don&amp;rsquo;t have another place to put it, so I thought I&amp;rsquo;d try to reanimate this blog. That will be another post. Here is a bit of rambling about the blog revival.&lt;/p></description></item><item><title>A case of adapting a CLI test command from *NIX to Windows</title><link>https://mxii.eu.org/2020/04/01/a-case-of-adapting-a-cli-test-command-from-nix-to-windows/</link><pubDate>Wed, 01 Apr 2020 21:45:11 +0300</pubDate><guid>https://mxii.eu.org/2020/04/01/a-case-of-adapting-a-cli-test-command-from-nix-to-windows/</guid><description>&lt;p>There is a package I wanted to publish to npmjs.com. That package provides a CLI tool among other features, and contains tests for that tool. Unfortunately, tests were made with only *NIX in mind, so it wasn&amp;rsquo;t possible to pass all tests and publish the package from Windows.&lt;/p>
&lt;p>The main culprit is inside the following function:&lt;/p>
&lt;pre>&lt;code class="language-javascript">function runWithInputAndExpect (input, args, expectedOutput, done) {
var command = 'echo &amp;quot;' + input.replace(/&amp;quot;/g, '\\&amp;quot;') + '&amp;quot; | node bin/cli.js ' + args;
exec(command, function callback (error, stdout, stderr) {
expect(error).to.be.a('null');
expect(stderr).to.equal('');
expect(stdout).to.equal(expectedOutput + '\n');
done(error);
});
}
&lt;/code>&lt;/pre>
&lt;p>What makes the difference between *NIX and Windows (as far as we concerned here) is how &lt;a href="https://ss64.com/nt/echo.html">&lt;code>echo&lt;/code> command&lt;/a> works. First of all, it keeps the quotes! But after we try to remove them - we will soon discover that the rabbit hole might be quite deep.&lt;/p>
&lt;p>And down the rabbit hole we go:&lt;/p></description></item><item><title>SDRSharp plugin for touch devices, some thoughts on license</title><link>https://mxii.eu.org/2019/11/06/sdrsharp-plugin-for-touch-devices-some-thoughts-on-license/</link><pubDate>Wed, 06 Nov 2019 17:00:00 +0300</pubDate><guid>https://mxii.eu.org/2019/11/06/sdrsharp-plugin-for-touch-devices-some-thoughts-on-license/</guid><description>&lt;p>This project was sitting on my hard drive for several years until now. Last time I made an attempt to clean it up and prepare for publishing to GitHub in 2017.&lt;/p>
&lt;p>Making sure it compiles against all required targets and contains all the required notes - is easy for such a small project. But there was something I just didn&amp;rsquo;t know how to deal with&amp;hellip; More on this below.&lt;/p>
&lt;p>&lt;img src="https://mxii.eu.org/post/2019-11-04-SdrSharp-plugin-for-touch-devices-and-some-thoughts-on-license/screenshot.png" alt="Frequency Navigation plugin screenshot" />&lt;/p>
&lt;p>Back in time, I was playing with RTL-SDR dongles, and the device I was connecting them to was a Microsoft Surface 2 Pro - &amp;ldquo;laptop-but-more-like-a-tablet&amp;rdquo;. I love Microsoft Surface devices, especially that old one, for it&amp;rsquo;s compact size. It is really cool to be able to move around freely, listening what&amp;rsquo;s coming from a dongle, no awkward balancing acts with a classic laptop&amp;hellip;&lt;/p>
&lt;p>Portable use has some UX specifics. Namely, having to use keyboard and mouse is really limiting, and touch screen operation on a tablet device is much more preferred.&lt;/p>
&lt;p>While SDR# had quite clean UI, it was clearly made without such considerations. The core functionality - frequency navigation - was nearly impossible to perform on the go. It is really hard to hit top or bottom of the right digit on the frequency display.&lt;/p>
&lt;p>At the same time, I had some examples of test and measurement equipment in access. These are historically made with very good tactile operation in mind. So I figured I can bring some of that experience to an SDR# plugin.&lt;/p></description></item><item><title>Next folder, previous folder navigation in Explorer with QTTabBar</title><link>https://mxii.eu.org/2018/12/22/next-folder-previous-folder-navigation-in-explorer-with-qttabbar/</link><pubDate>Sat, 22 Dec 2018 12:15:11 +0300</pubDate><guid>https://mxii.eu.org/2018/12/22/next-folder-previous-folder-navigation-in-explorer-with-qttabbar/</guid><description>&lt;p>&lt;a href="http://qttabbar.wikidot.com/">QTTabBar&lt;/a> surprised us with the update recently, after almost three years of silence. &lt;em>(The &lt;a href="http://qttabbar.wikidot.com/change-log">changelog&lt;/a> also points to an importance of having a full copy of your code somewhere outside of your PC. Version control systems to the rescue.)&lt;/em>&lt;/p>
&lt;p>To celebrate this fact, I decided to publish a little custom feature I&amp;rsquo;m using with QTTabBar &amp;mdash; a script and UI buttons to navigate between folders within one common parent folder.&lt;/p>
&lt;p>There are cases when you need to visit a set of folders, and going up and down in the folder structure is getting tedious. That&amp;rsquo;s where magic &amp;ldquo;Next folder&amp;rdquo;, &amp;ldquo;Previous folder&amp;rdquo; buttons come in handy.&lt;/p>
&lt;div class="sidenote">
&lt;p>Navigation pane, a.k.a. tree view can, in principle, be used for that, but it isn&amp;rsquo;t always convenient to use. I can only use it for top level navigation, unless Microsoft will come up with some way to reduce clutter in the tree - not showing subfolders that aren&amp;rsquo;t ascendants or descendants of current folder for example.&lt;/p>
&lt;/div>
&lt;p>My QTTabBar panel looks like this:&lt;/p>
&lt;p>&lt;img src="https://mxii.eu.org/post/2018-12-22-next-folder-previous-folder-with-qttabbar/qttabbar-panel.png" alt="QTTabBar panel screenshot" />&lt;/p>
&lt;p>Two triangles looking in opposite directions are the buttons this post is dedicated to.&lt;/p>
&lt;p>Below is the code and description for the buttons.&lt;/p></description></item><item><title>PowerShell, square brackets and apostrophes</title><link>https://mxii.eu.org/2018/01/08/powershell-square-brackets-and-apostrophes/</link><pubDate>Mon, 08 Jan 2018 02:15:11 +0300</pubDate><guid>https://mxii.eu.org/2018/01/08/powershell-square-brackets-and-apostrophes/</guid><description>&lt;p>This is a follow-up post to the one about &lt;a href="https://mxii.eu.org/2017/03/19/powershell-explorer-square-brackets-and-unicode-paths/">square brackets and Unicode&lt;/a> in PowerShell.&lt;/p>
&lt;p>I discovered recently that there is another PITA character that interferes with my workaround &amp;mdash; it&amp;rsquo;s a single quote, or apostrophe.&lt;/p>
&lt;p>It&amp;rsquo;s fine to start PowerShell inside a folder with an apostrophe in its name, but we have to escape it when using inside Powershell commands or passing into PowerShell from anywhere else.&lt;/p>
&lt;p>Below are my experiments to find the best way to open PowerShell in any folder&amp;hellip; if ever possible.&lt;/p></description></item><item><title>JavaScript spoiler with a twist (collapsing up or down)</title><link>https://mxii.eu.org/2017/09/07/javascript-spoiler-with-a-twist-collapsing-up-or-down/</link><pubDate>Thu, 07 Sep 2017 21:28:11 +0300</pubDate><guid>https://mxii.eu.org/2017/09/07/javascript-spoiler-with-a-twist-collapsing-up-or-down/</guid><description>&lt;p>I thought that I will eventually need to use spoilers in this blog to hide long and optional blocks of text. And at the same time I&amp;rsquo;m often unhappy with collapsible block implementations across the Internet.&lt;/p>
&lt;p>So I decided to design my own spoiler with one useful feature: it can be collapsed not only from the top edge but also from the bottom edge &amp;mdash; you will not lose the line you were reading and you don&amp;rsquo;t have to scroll all the way to the beginning of the spoiler.&lt;/p>
&lt;p>Examples:&lt;/p>
&lt;div class="spoiler">
&lt;div class="spoiler-btn spoiler-btn-top">&lt;i class="fa-solid fa-chevron-down">&lt;/i> click to &lt;span class="show">show&lt;/span>&lt;span class="hide">hide&lt;/span>&lt;/div>
&lt;div class="spoiler-body">
&lt;p>This spoiler can be expanded up and down. And your mouse is left right over the button you just pressed whenever it is possible (on top and bottom of a page there may be not enough stuff to keep it so, obviously).&lt;/p>
&lt;p>&lt;img src="https://picsum.photos/410/410?random=1" alt="" />&lt;/p>
&lt;/div>
&lt;div class="spoiler-btn spoiler-btn-bottom">click to &lt;span class="show">show&lt;/span>&lt;span class="hide">hide&lt;/span> &lt;i class="fa-solid fa-chevron-up">&lt;/i>&lt;/div>
&lt;/div>
&lt;div class="spoiler simple">
&lt;div class="spoiler-btn spoiler-btn-top">&lt;i class="fa-solid fa-chevron-down">&lt;/i> click to &lt;span class="show">show&lt;/span>&lt;span class="hide">hide&lt;/span>&lt;/div>
&lt;div class="spoiler-body">
&lt;p>This spoiler can be expanded in one direction only. Collapsing behavior is still the same. The difference is just a few lines in CSS.&lt;/p>
&lt;p>&lt;img src="https://picsum.photos/410/410?random=2" alt="" />&lt;/p>
&lt;/div>
&lt;div class="spoiler-btn spoiler-btn-bottom">click to &lt;span class="show">show&lt;/span>&lt;span class="hide">hide&lt;/span> &lt;i class="fa-solid fa-chevron-up">&lt;/i>&lt;/div>
&lt;/div>
&lt;p>Keep reading to see how it is done.&lt;/p></description></item><item><title>PowerShell, Explorer, square brackets and Unicode paths</title><link>https://mxii.eu.org/2017/03/19/powershell-explorer-square-brackets-and-unicode-paths/</link><pubDate>Sun, 19 Mar 2017 00:55:11 +0300</pubDate><guid>https://mxii.eu.org/2017/03/19/powershell-explorer-square-brackets-and-unicode-paths/</guid><description>&lt;p>Let&amp;rsquo;s make a folder &lt;code>C:\[test]&lt;/code> and try to open PowerShell there from Explorer (using Ribbon or context menu).&lt;/p>
&lt;p>&lt;img src="https://mxii.eu.org/post/2017-03-19-powershell-square-brackets/test-doesnt-exist.png" alt="set-location: Cannot find path 'C:[test]' because it does not exist. At line:1 char:1" />&lt;/p>
&lt;p>Oops!&lt;/p>
&lt;p>Let&amp;rsquo;s see what we can do with this.&lt;/p></description></item><item><title>HTML aspect ratio box using Custom Element</title><link>https://mxii.eu.org/2016/12/04/html-aspect-ratio-box-using-custom-element/</link><pubDate>Sun, 04 Dec 2016 23:45:23 +0300</pubDate><guid>https://mxii.eu.org/2016/12/04/html-aspect-ratio-box-using-custom-element/</guid><description>&lt;p>There is a standard trick to make HTML block with given proportions:&lt;/p>
&lt;pre>&lt;code>&amp;lt;div id=&amp;quot;containingBlock&amp;quot;&amp;gt;
&amp;lt;div id=&amp;quot;wrapper&amp;quot; style=&amp;quot;position:relative; width:100%; height:0px; padding-bottom:56.25%;&amp;quot;&amp;gt;
&amp;lt;div id=&amp;quot;content&amp;quot; style=&amp;quot;position:absolute; left:0; top:0; width:100%; height:100%&amp;quot;&amp;gt;
...
&amp;lt;/div&amp;gt;
&amp;lt;/div&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/code>&lt;/pre>
&lt;p>Since padding is computed according to containing element width, it&amp;rsquo;s possible to use it along with width to get required proportions (16:9 in this example, 56.25% = 100% * 9 / 16). And content block is positioned absolutely to use the space taken by padding.&lt;/p>
&lt;p>After learning about &lt;a href="https://developers.google.com/web/fundamentals/getting-started/primers/customelements">Custom Elements&lt;/a> I decided to see if I can abstract the trick and turn it into something clean and reusable. So it could be used just like this:&lt;/p>
&lt;pre>&lt;code>&amp;lt;ratio-box ratio=&amp;quot;16:9&amp;quot;&amp;gt;
...
&amp;lt;/ratio-box&amp;gt;
&lt;/code>&lt;/pre>
&lt;p>Custom Elements is &lt;a href="http://caniuse.com/#search=custom%20element">quite recent&lt;/a> feature in HTML, with version 0 available only in Chrome and version 1 just coming into play. It also requires JavaScript to work. So it is not practical to use yet, but still an interesting experiment.&lt;/p>
&lt;p>See the code and demo below. In addition, there is also a slightly improved HTML+CSS version.&lt;/p></description></item><item><title>Parallel processing in PowerShell</title><link>https://mxii.eu.org/2016/09/16/parallel-processing-in-powershell/</link><pubDate>Fri, 16 Sep 2016 21:05:05 +0300</pubDate><guid>https://mxii.eu.org/2016/09/16/parallel-processing-in-powershell/</guid><description>&lt;p>Running arbitrary number of tasks in parallel with PowerShell, while showing overall progress.&lt;/p>
&lt;p>The main disadvantage of the code I provided in &lt;a href="https://mxii.eu.org/2016/08/17/blog-minification-in-a-fancy-way-with-powershell/">previous post&lt;/a> is that it is performed sequentially. We can speed it up by means of parallel processing, since main limiting factor is not an I/O but minifying algorithms performance.&lt;/p>
&lt;p>There are a lot of ways to use parallelism in PowerShell and it wasn&amp;rsquo;t clear for me which one suits well for my task. I.e. to convert my script, which is processing a lot of small files on a local machine.&lt;/p>
&lt;p>It also should:&lt;/p>
&lt;ul>
&lt;li>provide updates in real time;&lt;/li>
&lt;li>keep output table formatting as close to original as possible.&lt;/li>
&lt;/ul></description></item><item><title>Ellipsis function for PowerShell</title><link>https://mxii.eu.org/2016/09/03/ellipsis-function-for-powershell/</link><pubDate>Sat, 03 Sep 2016 00:07:11 +0300</pubDate><guid>https://mxii.eu.org/2016/09/03/ellipsis-function-for-powershell/</guid><description>&lt;p>&lt;em>One more unintended thing arose from another post.&lt;/em>&lt;/p>
&lt;p>I was looking for a way to fit a lot of lengthy paths into console screen by removing less important parts. &amp;ldquo;&lt;a href="https://en.wikipedia.org/wiki/Ellipsis">Ellipsis&lt;/a>&amp;rdquo; is a standard name for such a thing. You&amp;rsquo;re dealing with it every time you&amp;rsquo;re looking at &amp;ldquo;&amp;hellip;&amp;rdquo; in place of something too long to fit into borders.&lt;/p>
&lt;p>Here is my implementation for PowerShell.&lt;/p></description></item><item><title>Blog minification in a fancy way with PowerShell</title><link>https://mxii.eu.org/2016/08/17/blog-minification-in-a-fancy-way-with-powershell/</link><pubDate>Wed, 17 Aug 2016 00:31:11 +0300</pubDate><guid>https://mxii.eu.org/2016/08/17/blog-minification-in-a-fancy-way-with-powershell/</guid><description>&lt;p>There is no built-in support for minification in Hugo engine, which isn&amp;rsquo;t a bad thing on its own. But I had to figure out a way to minify my files while keeping building and maintenance extremely simple.&lt;/p>
&lt;p>At first point I added &lt;a href="https://github.com/tdewolff/minify/tree/master/cmd/minify">minify&lt;/a> for text files. It&amp;rsquo;s a single binary (written in Go), and with a single call it can run recursively over Hugo&amp;rsquo;s public folder, minifying output files in-place, just as I needed.&lt;/p>
&lt;p>But minifying images is a more tricky task. I decided to use &lt;a href="http://jpegclub.org/jpegtran/">jpegtran&lt;/a> and &lt;a href="http://optipng.sourceforge.net/">optipng&lt;/a>, but they can&amp;rsquo;t be run recursively. Some scripting is required to use them. While the task of finding all the images in a folder and applying minifiers on them is trivial and can be solved with PowerShell one-liner, it was not satisfying enough, so I end up with the thing described below in this post.&lt;/p>
&lt;p>Additional motivation is to have a tool that can be adopted easily to any other processing task and will give me a fancy progress report.&lt;/p></description></item><item><title>Quick note about objects in PowerShell</title><link>https://mxii.eu.org/2016/08/12/quick-note-about-objects-in-powershell/</link><pubDate>Fri, 12 Aug 2016 03:14:15 +0300</pubDate><guid>https://mxii.eu.org/2016/08/12/quick-note-about-objects-in-powershell/</guid><description>&lt;p>&lt;em>I decided to move this note out from another post.&lt;/em>&lt;/p>
&lt;p>It&amp;rsquo;s a kind of summary on a question &amp;ldquo;Why &lt;code>[PSCustomObject]@{}&lt;/code> syntax is the preferred way to create objects in PS&amp;rdquo;. After looking into StackOverflow (&lt;a href="http://stackoverflow.com/questions/14012773/difference-between-psobject-hashtable-and-pscustomobject">one&lt;/a>, &lt;a href="http://stackoverflow.com/questions/35894272/powershell-type-accelerators-psobject-vs-pscustomobject">two&lt;/a>) and some other resources (&lt;a href="https://learn-powershell.net/2014/01/11/custom-powershell-objects-and-performance-revisited/">three&lt;/a>), I decided to test and write it down for myself.&lt;/p>
&lt;p>Nothing really new here. I only hope it will work as a good summary.&lt;/p>
&lt;p>&lt;strong>Update:&lt;/strong> Select-Object examples. Additional links.&lt;/p></description></item><item><title>Ways to measure execution time in PowerShell</title><link>https://mxii.eu.org/2016/08/05/ways-to-measure-execution-time-in-powershell/</link><pubDate>Fri, 05 Aug 2016 21:28:11 +0300</pubDate><guid>https://mxii.eu.org/2016/08/05/ways-to-measure-execution-time-in-powershell/</guid><description>&lt;p>Ok, back to business. No electronics at least for a few posts though.&lt;/p>
&lt;p>It will be clear later why I became interested in this topic. But it is, on its&amp;rsquo; own, worth for a post, so here it is.&lt;/p>
&lt;h1 id="measure-command">Measure-Command&lt;/h1>
&lt;p>The canonical way to measure how long something runs in PowerShell is to use &lt;a href="http://ss64.com/ps/measure-command.html">Measure-Command&lt;/a> cmdlet.&lt;/p>
&lt;pre>&lt;code>&amp;gt; Measure-Command { &amp;quot;do stuff&amp;quot; }
Days : 0
Hours : 0
Minutes : 0
Seconds : 0
Milliseconds : 0
Ticks : 7436
TotalDays : 8,60648148148148E-09
TotalHours : 2,06555555555556E-07
TotalMinutes : 1,23933333333333E-05
TotalSeconds : 0,0007436
TotalMilliseconds : 0,7436
&lt;/code>&lt;/pre>
&lt;p>One notable downside of this is that you see no output from a command. Time span is returned instead.&lt;/p>
&lt;p>What else can we do?&lt;/p></description></item><item><title>Circling the square</title><link>https://mxii.eu.org/2016/06/02/circling-the-square/</link><pubDate>Thu, 02 Jun 2016 20:48:23 +0300</pubDate><guid>https://mxii.eu.org/2016/06/02/circling-the-square/</guid><description>&lt;p>I have some more Paint.NET shapes added to collection. Superellipses to be precise. Check the &lt;a href="https://mxii.eu.org/project/paintdotnetstuff/">project page&lt;/a>.&lt;/p>
&lt;p>&lt;a href="https://en.wikipedia.org/wiki/Superellipse">Superellipse&lt;/a> or &lt;a href="https://en.wikipedia.org/wiki/Gabriel_Lamé">Lamé&lt;/a> curve is the shape produced by generalized equation of ellipse, where we change the power factor. It approaches to rectangular shape on large values.&lt;/p>
&lt;p>Also check the video below for a little bit of history of this shape in design.&lt;/p></description></item><item><title>Released some shapes for Paint.NET and converter</title><link>https://mxii.eu.org/2016/04/02/released-some-shapes-for-paint.net-and-converter/</link><pubDate>Sat, 02 Apr 2016 14:34:14 +0300</pubDate><guid>https://mxii.eu.org/2016/04/02/released-some-shapes-for-paint.net-and-converter/</guid><description>Some glitch-art, for starters. Guess what it was supposed to be:
Recently I was doing some simple photo-editing and found that it will be much easier if there were some crop masks. 3x3 grid and things like that.
After looking into Paint.NET forum I discovered that Paint.NET has support for custom shapes. This feature meet my needs almost perfectly.
I think I&amp;rsquo;ve overdid it a bit, and after some research and coding I end up with a bunch of stuff which you can see on a project page.</description></item><item><title>Decision between various blog engines</title><link>https://mxii.eu.org/2016/02/20/decision-between-various-blog-engines/</link><pubDate>Sat, 20 Feb 2016 14:54:00 +0300</pubDate><guid>https://mxii.eu.org/2016/02/20/decision-between-various-blog-engines/</guid><description>&lt;p>Ok, now this site is officially live. Time to write something. I&amp;rsquo;ll start from some details about site itself.&lt;/p>
&lt;p>Initial idea was (long time ago) to use &lt;a href="http://www.pmwiki.org/">PmWiki&lt;/a> as the site engine. I&amp;rsquo;ve used it before and I really like it. The main drawback that was bothering me - the complexity of maintaining blog-like site on a wiki engine. It is possible, but there are better ways to do it.&lt;/p>
&lt;p>Then I discovered static site generators. There is not much conceptual difference between them and file-based wiki engines like PmWiki - bunch of text files translated into html pages with some rules, but on publishing time, rather than each time on site access. And it&amp;rsquo;s perfectly fine this kind of site. There even should be a way to use PmWiki as static site generator, if I remember correctly.&lt;/p>
&lt;p>Looking for static site frameworks, I quickly discovered that there is a plenty of them. And there is a good choice of programming languages they are implemented in. As it was with PmWiki some time ago, I need to compare them and decide on optimal choice.&lt;/p></description></item><item><title>Hello world</title><link>https://mxii.eu.org/2015/11/02/hello-world/</link><pubDate>Mon, 02 Nov 2015 22:18:46 +0300</pubDate><guid>https://mxii.eu.org/2015/11/02/hello-world/</guid><description>This is just a placeholder post.
Posts will start appearing here later. You can subscribe to RSS if you don&amp;rsquo;t want to miss that moment.</description></item></channel></rss>