Wednesday, March 31, 2021

qDebug log with and without spaces in a single sentence

Below sample shows how spaces can be disabled/enabled in middle of a single qDebug log.
Keyword: qDebug disable space in middle of log

Saturday, March 27, 2021

Mac OS: How to stop/kill Kaspersky Endpoint Security

Recently all of sudden I had started getting all sorts of internet connecitivity issues on my Office issued Mac book Pro. My internet would stop working all together on my Mac book Pro and the only way to get it working again was to reboot Mac Os.
After some closer inspection, I found that Kaspersky Endpoint Security pushed my company's IT was causing this issue. Since Kaspersky Endpoint Security does not contain graphical user interface to interact with, I had to come up with a way to unload it from system memory.
Below script unloads Kaspersky Endpoint Security Daemon. You need to run it after each reboot. You need to have super user permission.
sudo launchctl unload /Library/LaunchDaemons/com.kaspersky.kav.plist
WARNING: Above command stops Kaspersky Endpoint Security. Enter it only if you know what you're doing!

Friday, March 26, 2021

Qt: Nested QMap example

I had to recently use nested Qt QMap. Below is a simple C++ code sample which shows how I used nested QMap and initialised using C++ initialiser list.

Thursday, March 25, 2021

Install Qt Creator without Qt Account

I hate using my Qt account whenever I install Qt Creator on any public computers, because Installer automatically stores the login credentials on computer. Once stored, I need to manually delete them later on.

Whilst installing Qt Creator via offline installer, I noticed that installer does not prompt for login whenever there is no internet connectivity. You can simulate this by configuring invalid proxy configuration within the Qt Creator installer.

It's quite straight forward. Click on settings button, and configure 0.0.0.0 as the proxy.

After this you can proceed to install Qt Creator without having to worry about the Qt Account login.  



Wednesday, July 29, 2020

How to enable display mirroring over VNC on Ubuntu

Ubuntu ships within a built-in VNC server, which can be configured to enable promptless screen mirroring over VNC.
Run below script/commands on target Ubuntu system.

Tuesday, July 28, 2020

How to rename Windows 10 user home folder

Steps to rename User name

Rename the user name in the Control Panel (Windows Menu → Settings → Accounts).

Steps to rename the home folder under C:\Users

  1. To rename the user's home folder, we first need to create a temporary Admin account in Windows 10.
    To create a temporary local Admin user in Windows 10, follow below steps:
    1. Go to Windows Menu → Settings → Accounts → Family & Other users → Add someone else to this PC
    2. Click on I don't have this person's sign-in information.
    3. Select Add a user without a Microsoft account
    4. You can leave the password field empty, as this is a temporary account and we will delete this account at the end.
  2. Once a new account is created, change the account type to Administrator


  3. Logout and Login as newly created user from login menu.
  4. Open File Explorer, Go to C:\Users\ and rename the folder under C:\Users\<old_username> to the desired name.
  5. After renaming the folder, now let us map the renamed folder with the user account.
    1. Open regedit from Win + R
    2. Traverse to Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList

    3. Traverse through the profile list and find the matching profile where key ProfileImagePath value contains the previous home folder path. Once found, update the value to match your new folder path.
      Example:As shown in below image, I renamed from C:\Users\Administrator to C:\Users\supernova
  6. Create a link from your previous home folder to new one via Command Prompt. This should help us with programs which have stored previous home folder path in their settings.
    1. Search for Command Prompt in Windows Menu. Right Click and select run as administrator
    2. Create a link from previous folder name to new folder name via mklink command.
      Syntax:mklink /j <old_username> <new_name>
      Examplemklink /j Administrator supernova Where Administrator is my previous folder name.
  7. Delete the temp account created in Step 1.


Monday, July 27, 2020

Installing and using Qt libraries with Conan

For some reason or the other, I always had Qt installed on my dev machine either by manually compiling it from sources or via apt-get. Recently I started using conan to install Qt libaries and qmake.
After installation however, I could not find an automated way of adding installed Qt binaries to my binary search path. Even after many searches online, I did not find any sample conanfile.txt anywhere showcasing the proper way to install Qt with conan. After going through conan documentation however, I found out that conan generator virtualrunenv can be used to tackle this problem. virtualrunenv generator can be used to add/remove directories installed by conan to your binary search path.
To add Qt binaries installed by conan to your PATH, execute:
source activate_run.sh
To remove them from the search path, execute:
source deactivate_run.sh
By adding virtualrunenv as one of your code generators, you can easily bring/remove qt binaries to/from your search path.
Below is my conanfile.txt which I use to install latest Qt 5.15.x via conan:
[requires]
qt/[>=5.15.0 <5.16.0]@bincrafters/stable

[generators]
qmake
virtualrunenv

Some of the disadvantages of using Conan to install Qt:

  • Qt installed via conan does not include Qt designer and other binaries. It only includes qmake.
  • Qt installation via Conan still requires few packages to be manually installed via APT.

More info: