John Liu Blog

Every drop counts

Hyper-v: Convert Generation 1 VM to Generation 2 VM

If you have VM in Generation 1 format, you might want to convert it to Generation 2 format to utilise new futures. For example, Windows11 requires the VM in Gen2 format to be able to enalbe Secure Boot and Trusted Platform Module (TPM). To check if your VM is Gen1 or Gen2, run following PowerShell command. Get-VM | select vmname, generation We can’t directly convert Gen1 VM to Gen2 VM.

Install Python Library in Visual Studio Code

In Visual Studio Code Python project, you can create a Python virtual environment for your project. Open Command Palette (Ctrl+Shift+P), search for Pyton: Create Environment command. This will auto set the workspace environment to the newly created virtual environment. Now in the terminal, run the pip install for the library needed. pip install <library> Alternativly, you can run following script to create the virtual environment (named venv or whatelse you prefer):

Power Automate notes

Add newline to string variable using concat There are several ways to Add a newline when appending to string variable: Add ‘Enter’ into the expression. concat(‘Line1’,’ ‘,‘Line2’,’ ‘,‘Line3’ ) Create a ‘NewLine’ variable and in the ‘Value’ field press Enter to assign line return to it. Use this variable in the concatenation. Use decodeUriComponent(‘%0A’) expression concat(‘Line1’,decodeUriComponent(’%0A’),‘Line2’,decodeUriComponent(’%0A’),‘Line3’) Remove newline from string There seems no easy way to remove newline/line break from multiline string.

Power Automate with Snowflake

Configuration There is a Snowflake connector in Power Platform to connecto to Snowflake database using Snowflake API calls. To be able to use the Snowflake connector, Azure AD (Entra ID) authentication for Snowflake needs to be setup on Snowflake side. Follow Getting started with Power Apps and Snowflake on how to configure the Azure AD authentication for Snowflake. timestamp value In Snowflake Power Platform connector, the timestamp_ntz data type represents a timestamp in UTC time zone without time zone offset information.

Setup R and Python on SQL Server 2022

When setup R or Python on SQL Server 2022, especially for named instance, some special notes required, apart from the offical documentation. You need to make sure when doing install, both Database Engine Services and Maching Learning Services and Language are installed. Unlike with earlier version of SQL, R and Python libraries are not installed/configured automatically in SQL 2022. You need to download and install latest R4.2. Then need to install some standard R dependencies.