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:
To remove them from the search path, execute:
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:
qt/[>=5.15.0 <5.16.0]@bincrafters/stable


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:

Sunday, July 26, 2020

Windows Batch script to use Qt + Microsoft C++ Build Tools

I recently started using Qt Creator on Windows with Microsoft C++ build tools. During this process, I created below batch script to open a console window where I can give all Qt + nmake/jom commands.

Saturday, July 25, 2020

Script to download latest Qt-Creator nightly development installer

Here is a script I created to download latest Qt-Creator nightly build installer for Linux. However, it can be modified to download the installer Windows or Mac OS. Replace .run with .exe for Windows, and with .dmg to make it download installer for Mac OS.
You can use above script to download latest stable release as well. Just change the URL to to download latest stable release.

Thursday, July 23, 2020

How to uninstall Mac OS Xcode command-line tools

You can uninstall Xcode command-line tools by manually deleting the directory /Library/Developer/CommandLineTools
You can delete this directory either from Finder App or by entering following command in Terminal App.
sudo rm -rf /Library/Developer/CommandLineTools

Resetting the default command line tools:

Once you remove the directory, enter below command to reset the default command-line tools
sudo xcode-select -r


Above commands should also help you remove command-line tools from Mac OS auto update.



Wednesday, July 22, 2020

How to clear Qt online installer Account credentials

Now that Qt has stopped hosting offline installers, the only option left is to use Qt online installer.
Unfortunately Qt online installer automatically saves the account credentials without asking, and does not provide any option to avoid auto save. This could be particularly problematic if you are using Qt online installer on a public computer, and you don’t want to keep your account credentials lingering around.
Below are steps to delete Qt online installer account credentials
Qt stores the account credentials in a file named qtaccount.ini
You need to delete this file to remove Qt account credentials from the computer.


qtaccount.ini is stored at C:\Users\<User Name>\AppData\Roaming\Qt\
Note: You can enter below shortcut in Windows Run (Win Key + R) to open this directory with File Explorer.
To delete the file in console, open cmd.exe from Windows menu and enter below command
del %APPDATA%\Qt\qtaccount.ini


qtaccount.ini is stored at /home/<User Name>/.local/share/Qt/
To delete this file from terminal, enter below code in terminal
rm /home/$USERNAME/.local/share/Qt/qtaccount.ini

Mac OS X:

Qt Account details are stored at /Users/<User Name>/Library/Application\ Support/Qt/
To delete this file via Terminal, open terminal app and enter below code
rm $HOME/Library/Application\ Support/Qt/qtaccount.ini

Related bug report: