Sunday, June 14, 2026

Inactive titlebar color in Windows 10

After I installed my Windows 10 IoT LTSC, I noticed that the inactive titlebar was white. The blue active titlebar could be set via Settings, but not the inactive. ChatGPT gave me the Registry entries to set this color manually:

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Microsoft\Windows\DWM]
"AccentColorInactive"=dword:00DCDCDC
"ColorPrevalence"=dword:00000001

Save the content above in a *.reg file, and merge it to the Registry, and it’s done.

Saturday, June 6, 2026

Understanding std::rotate

While working on the future version of my C++20 WinDlg library, I stumbled upon the need to shift characters within a string. My first impulse was to use memmove, but hey, there should be a C++ way to do this.

In fact, std::rotate seemed to be the appropriate fit – safe and sound –, but turns out I had a different idea on how it would work, and it took me a while to properly understand it. The central idea is: you take the interval [it1 it2) and move it right, so it will end at it3). Everything beyond it3 will be placed at the beginning. Thus it actually “rotates” to the left.

Examples:

std::wstring s = L"01234";

std::rotate(s.begin(), s.begin() + 1, s.end()); // 12340
std::rotate(s.begin(), s.begin() + 2, s.end()); // 23401
std::rotate(s.begin(), s.begin() + 4, s.end()); // 40123

std::rotate(s.begin() + 1, s.begin() + 2, s.end()); // 02341
std::rotate(s.begin() + 3, s.begin() + 4, s.end()); // 01243

Wednesday, May 27, 2026

Define initial directory in Git Bash

After installing Git on my new Windows 10 IoT LTSC, as always the default directory of Git Bash is home. It is, however, rather easy to change this behavior.

Right-click the Git Bash shortcut to open its properties, and:

  • Target: remove the --cd-to-home suffix; and
  • Start in: replace %HOMEDRIVE%%HOMEPATH% with whathever folder you want.

Monday, May 25, 2026

Make Firefox fast again

Still on my new Windows 10 IoT LTSC setup, I found a page which seems to have a large amount of Firefox tweaks. I’ve tried most of them, and honestly I didn’t notice any improvement, but I hope it pays off in the long term:

Sunday, May 24, 2026

Disable Win global hotkeys

Today I installed a new 1 TB SSD drive, since my old 120 GB one capacity was out of control. Windows 10 IoT LTSC was the OS of my choice, along with the incredibly smooth massgrave.dev aid.

One thing that didn’t work was the global shortcuts of foobar2000.. At first I thought it could be related to the newer 64-bit version I finally installed, but ChatGPT – first time on this blog – told me that IoT LTSC is stricter about hijacking Win hotkeys. And it gave me directions on how to disable them globally, which I didn’t even know it was possible. Create a new key under:

HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced
  • New, String Value
  • DisabledHotkeys
  • AS

The above will disable Win+A and Win+S global hotkeys, which is amazing.

Tuesday, April 7, 2026

Reusing code in const and non-const methods, C++17

I found the code below from this great answer in StackOverflow. It allows you to implement the const method with your logic, then use this one-liner to implement the non-const method. It’s a trick from the great Scott Meyers:

const T& f() const {
	return something_complicated();
}

T& f() {
	return const_cast<T&>(std::as_const(*this).f());
}

I’m using this thing everywhere.

Thursday, April 2, 2026

Project templates in Visual Studio 2022

After configuring C and C++ projects countless times, base on these settings, I finally bit the bullet and created a reusable template in Visual Studio 2022. And it’s surprisingly simple: create the project and then go Project → Export Template.

The project name itself can be used inside files with $safeprojectname$ string. In order to have it replaced even inside .rc files, edit the .vstemplate and add:

<TemplateContent>
  <Project TargetFileName="ayylmao.vcxproj" File="ayylmao.vcxproj" ReplaceParameters="true">
    <ProjectItem ReplaceParameters="true">RES\$safeprojectname$.rc</ProjectItem>
  </Project>
</TemplateContent>

There’s no GUI for deleting a template, though. One must manually remove the zip files from two different locations:

  • Documents \ My Exported Templates
  • Documents \ Templates \ Project Templates

To restore a template, simply copy the zip back to:

  • Documents \ Templates \ Project Templates

Sunday, February 15, 2026

The Rust doc_cfg fiasco

In WinSafe, Cargo features are used extensively to gate the DLL modules which are currently implemented. This is good because you specify only the modules you need, reducing your compiler effort. The Rust documentation doc_auto_cfg unstable feature was extemely useful, applying tags on each entity specifying the required feature for it.

Then, at some point of October 2025, doc_auto_cfg was merged into doc_cfg. And it’s now completely broken.

I filled an issue at the official repo. I’m not the only one missing that feature, but no one seems to care. This is so demotivating I stopped WinSafe development completely.

I found a workaround by pinning the compiler version using rust-toolchain.toml, along with the last version where doc_auto_cfg works, which I painfully found out:

[toolchain]
channel = "nightly-2025-09-27"
components = ["rust-docs"]
targets = ["x86_64-pc-windows-msvc"]

With the above file, the command line to generate the docs is:

RUSTDOCFLAGS="--cfg docsrs" cargo doc --all-features

Or even better, directly specify the toolchain the command line:

RUSTDOCFLAGS="--cfg docsrs" cargo +nightly-2025-09-27 doc --all-features

This compiler has the 1.92.0-nightly version, and it seems I’m gonna using for a long time.

Update: after 4 months, the bug was finally fixed.

Friday, November 21, 2025

Windows 10 SDK 10.0.20348.0 is gone

I was caught by surprise today after updating Visual Studio 2022 to version 17.14.11. All my projects failed to compile, because the SDK files disappeared. I first thought something broke with VS Code support, but then I saw that Visual Studio itself had the same problem.

Turns out the Windows SDK I was using – 10.0.20348.0 – was simply deprecated and removed in this update, according to here, and the release note itself. Indeed, Visual Studio Installer won’t show it anymore.

Apparently, now I’ll have to install a Windows 11 SDK, even if I’m running Windows 10. I hope this doesn’t break my stuff.

Wednesday, November 5, 2025

Non-movable and non-copyable C++20 classes

On my fantastic journey implementing WinLamb v2, I’m diving deep into C++20, grasping a lot of concepts I never understood before, and having a lot of fun along the way.

One of the things that I implemented was the idea of non-copyable and non-movable classes, at first, using macros. This felt inelegant, so I implemented P2895 paper with utility classes. It ultimately failed with the nested ListView classes, so I discarded the idea too.

My final solution was to = delete move constructor, which will prevent all copy and move. The hard rules are not particularly easy to memorize, so I’ll let them here for further reference:

  1. The two copy operations are independent. Declaring copy constructor does not prevent compiler to generate copy assignment and vice versa. (Same as in C++98.)
  2. Move operations are not independent. Declaring either one of them prevents the compiler to generate the other. (Different from copy operations.)
  3. If any of the copy operations is declared, then none of the move operations will be generated.
  4. If any of the move operations is declared, then none of the copy operations will be generated.
  5. If a destructor is declared, then none of the move operations will be generated. Copy operations are still generated for reverse compatibility with C++98.
  6. Default constructor generated only when no constructor is declared. (Same as in C++98.)

Example:

class Foo {
private:
	Foo(Foo&&) = delete; // non-copyable, non-movable
};

Friday, October 24, 2025

Ibanez Wizard profile history

Since I’m on the market for a “battle” RG guitar to play with bands, I reminded a change that happened to the fretboard width of Wizard necks, from 56 to 58mm. According to Rich, it happened back in 2005.

Digging a bit more, I found more information about the Wizard neck profile history, which I compiled in the table below:

Neck Width Thick Radius
Original Wizard 43/57mm 17/20mm 17"
Pre-2005
Super Wizard 43/56mm 17/19mm 17"
Wizard 43/56mm 18/20mm 17"
Post-2005
Super Wizard 43/58mm 17/19mm 17"
Wizard 43/58mm 18/20mm 17"

Monday, October 20, 2025

Using VSCode for C++ projects

For a long time I thought I only could use Visual Studio to write C++ programs on Windows, because MSVC toolchain requires some particular initializations before being able to run.

Turns out there is a way to smoothly run all the MSVC machinery from within VSCode. The answer is the same I found last year in automating MSVC builds: we need a .bat file to call MSVC’s own .bat, then we invoke VSCode executable right after.

call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
"C:\Users\Rodrigo\AppData\Local\Microsoft Visual Studio Code\Code.exe"

Save this .bat somewhere, and put a shortcut to it in your start menu, naming it “VSCode MSVC” or something like that.

To my surprise, multiple things work better in VSCode than in Visual Studio itself:

  • file navigation;
  • file creation and deletion;
  • code and comment folding;
  • keyboard shortcuts;
  • error reporting – VSCode highlights in red the files with errors, while in Visual Studio I have to build the project and look at the output to see which files are broken.

Monday, October 13, 2025

Perfect non-locking string winding

While searching my future Ibanez RG Prestige, I found this StewMac video of how to properly wind the strings around the tuning machines:

I remember having seen this technique before, but this time I’m keeping the reference.

Saturday, September 27, 2025

Single target dir for all Rust projects

Rust, just like C++, generates a lot of output files when you build an executable. Particularly, when writing my programs with WinSafe, I use the library straight from a sibling directory, so I can test any changes right away – the side effect is that all those output artifacts are generated repeatedly for each new program.

So I’ve just tested the target-dir global option for Cargo, which will use a single target directory for all projects. This would, in theory, prevent the constant rebuilding of WinSafe artifacts.

Since the output dir changed, I had to also change the deploy.sh scripts to point to the new location. Other than that, everything seemed to work as intended, and I’m pretty satisfied with the results.

This is now my global ~/.cargo/config.toml file:

# https://github.com/rust-lang/cargo/issues/3381#issuecomment-710388554
[net]
git-fetch-with-cli = true

# https://redd.it/1dua24f
# https://blog.rust-lang.org/2023/11/09/parallel-rustc.html
[build]
target-dir = "D:\\Stuff\\Core\\rs\\_target"
#rustflags = ["-Z", "threads=8"]
# Change default toolchain:
# rustup show
# rustup default nightly-x86_64-pc-windows-msvc
# rustup default stable-x86_64-pc-windows-msvc

As an extra benefit, when I want to clean the target directory, now I just need to delete the single _target one.

Monday, August 18, 2025

Previewing Go package documentation

While developing Windigo, I’m using the auto-generated docs at pkg.go.dev. It’s not perfect, but it’s something.

I didn’t know, however, a way to preview the generated docs while still developing the library.

Go 1.25 brought a new go doc option which allows us to preview the documentation by creating a temporary, virtual server. It downloads a whole bunch of packages, builds them, and then effectively displays the current docs:

go doc -http

This is being a game changer, I can now preview all the documentation instantly. Thanks to this guy who told me that.

Friday, August 15, 2025

Install PKCS#11 drivers, Linux

I need the PKCS#11 USB token at work, and every time I spin a new Linux VM, I need to install it again. But I never remember what needs to be done. So I’m documenting the steps here.

First, download the latest driver at GlobalSign, unzip and install it. The installation will probably fail because of missing dependencies; the second command will install them followed by the original package:

sudo dpkg -i foo.deb
sudo apt-get -f install

Once you reboot, the SafeNet icon will appear in the tray.

To install support for Brave browser, see here.

Sunday, August 10, 2025

Brave cookies whitelist

I’ve been wasting way too much time, multiple times, looking for Brave’s cookie whitelist setting. So I’ll just leave it here, for reference to my future self. I found the reference on this Reddit post.

The settings are buried in:

  • Settings
  • Privacy and security
  • Site and Shields Settings
  • Content
  • Additional content settings
  • On-device site data
  • Customized behaviors

Or, this direct link:

brave://settings/content/siteData

Monday, July 14, 2025

Goodbye Chrome

Today, Google Chrome officially disabled uBlock Origin extension. We can no longer enable it through any flags. I’ve been waiting for this moment to come for a while, and so it happened.

Today I finally uninstalled Google Chrome from my Windows computer.

Firefox is still my default browser, but I just installed Brave, which has the Chromium engine, because I have a feeling that it’s more performant than Firefox. However, I also have a feeling that Chrome itself is faster than Brave. Maybe Google has some code removed from Chromium and added only in Chrome, to intentionally make Chrome faster. Conspiracy theory, but who knows.

I used the portable version of Brave which felt strangely slow. I supposed that’s because I installed it on my D: drive, which is not SSD. Brave could not open magnet links, and so far, this new installation also cannot.

On my Android phone, I already have both Firefox and Brave. My issue with Brave is that it doesn’t support extensions, and SponsorBlock is become something I can’t live without.

Another issue is the disk space used by Chrome and Brave. My observations showed me that they top at somewhat 2.7 GB, which seems a lot. Coincidence or not, I also observed this for Firefox. My C: hard drive is running short these days, and until I buy myself a new computer, that’s all I have.

At last, I joined the bandwagon of the ex-Chrome users.

Thursday, June 26, 2025

Changing Chrome User Data location

By default, Google Chrome on Windows stores all its data in:

C:\Users\USERNAME\AppData\Local\Google\Chrome\User Data

This folder seems to top around 2.5 GB, as I tested both in Chrome and Brave.

When digging the portable version of Brave, I found that it uses the --user-data-dir command line switch to store the data somewhere else – that’s the whole point of being portable.

This command line switch, obviously, belongs to Chromium, and so to all its derivative browsers, like Chrome itself. Therefore, you can move Chrome’s User Data folder to any location. After moving the folder itself, you just have to pass the new location via the --user-data-dir command line switch, as explained in Chromium Docs:

"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --user-data-dir=D:\Stuff\ChromeUserData

This finding is also useful because it shows that the whole User Data folder can ba copied to a different computer.

I found a possible Chromium bug, however, when moving User Data to my D:\ drive. When a notification pops-up, clicking it will open another Chrome window, and this new window will point to the original User Data location. Which means native notifications are unusable.

Monday, June 23, 2025

Install PKCS#11 in Brave, Linux

As Chrome’s adoption of Manifest V3 approaches, I’ve been trying Brave more and more, even in my Android. Using it for work had me in trouble though, since unlike Firefox, it has no native support to PKCS#11 USB tokens.

After trying a few things, I gave up. But a few minutes ago I stumbled upon a website which I’ve seen before, probably when setting up Chrome, and to my surprise it worked for my Linux Mint. He uses the same SafeNet eToken 5110 I’ve got here.

modutil -dbdir sql:.pki/nssdb/ -add "eToken" -libfile /usr/lib/libeTPkcs11.so

I don’t know if it matters, but I ran the command above before installing Brave itself.