John Liu Blog

Every drop counts

Some networking commands

Some basic networking commands for self reference: List the current route table: netstat -rn Add an ip range into route table. –p means this route will persist so it will not be lost after restart. route add 172.27.48.0 mask 255.255.240.0 172.27.48.1 -p Access to any ip address starting with 172, inside the mask of 255.0.0.0, via ip address 192.168.0.10 Route add 172.0.0.0 mask 255.0.0.0 192.168.0.10 metric 4 –p Remove from route table:

Small table big performance impact

I recently came across an intersting case with a new stored procedure performance. The SP appeared to be run fast for one parameter value but very slow for another. My initial thought was parameter sniffing. However, a quick WITH RECOMPILE didn’t help. After turn on Live Query Statistics and look at the live data movements, I noticed that the process is doing a index scan on a small table with only 8 rows and then doing nested loop against a large table with out of wack estimates.

Azure sign-in methods in PowerShell script

When using PowerShell script to run tasks in Azure environment, we need first to sign-in to Azure. There are several ways to sign-in to Azure in PowerShell script. 1. Interactive sign-in we can using either Connect-AzAccount or Login-AzAccount -Credential (Get-Credential) Login-AzAccount and Add-AzAccount are alias of Connect-AzAccount. With -Credential (Get-Credential) option, it let you interactively enter the credential on the cmd interface, otherwise, it popup a GUI to let you login.

Run VMWare and Docker on the same computer

You can install VMWare Workstation (v15.4 or earlier) and Docker on the same computer, but they can’t be run at the same time due to VMWare and Hyper-V can’t be run at the same time. Docker depends on Hyper-V. To run VMWare Workstation, turn off Windows features “Virtual Macine Platfrorm” and “Microsoft-Hyper-V-All” and then restart computer. PS C:\> Disable-WindowsOptionalFeature -Online -FeatureName "Microsoft-Hyper-V-All" -NoRestart PS C:\> Disable-WindowsOptionalFeature -Online -FeatureName "VirtualMachinePlatform" To run Docker, turn on Windows feature “Virtual Macine Platfrorm” and “Microsoft-Hyper-V-All” and then restart computer.

VMWare p2v keyboard not working

After converting a physical laptop into a VMWare Workstation, the keyboard might not working. To fix this problem, simply edit following registry entry UpperFilters data value to be ONLY kbdclass. Remove any thing else before or after kbdclass, such as SynTP etc.. This worked for Lenovo laptop. HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class{4D36E96B-E325-11CE-BFC1-08002BE10318} To be able to modify the registry “without” keyboard, simply using the in-built soft keyboard (On-Screen Keyboard) under All Programs –> Accessories –> Ease of Access –> On-Screen Keyboard