2020-06-12 Learned Today


Can’t create shortcut for a specific Google Chrome person in Windows 10

On Windows 10 I created multiple person accounts in Google Chrome and normally I could just select the correct person in the people dialog and then create a shortcut to google chrome by right clicking on the icon in taskbar and clicking on “Pin to taskbar”, but this time in Chrome 83 it would not sign in with the selected user, after clicking on the taskbar icon.

To fix this problem I just removed all persons from chrome and added them back. After that I could create separate shortcuts on the Windows 10 taskbar to specific signed in users.



Tags vs Categories WordPress blog post writing in Microsoft Word

It is still not possible to add tags to a blog post from within Microsoft Word, but you can add multiple categories.

So I decided to divide my blog posts in categories and no longer in tags.



Configuring Material Design line-height

When using material design in an Angular app, we encounter a problem: The letter ‘g’ was not entirely visible.

The problem was the chosen font family (Open Sans). To fix the problem we decided to increase the line-height for inputs in the material design styling configuration


To adjust the line-height for inputs inside Material Components use:

$input: mat-typography-level(16px, 1.3, 400),



Formatting T-SQL code in Visual Studio, SQL Server Management Studio and VSCode

You can use ApexSQL Refactor to format T-SQL code in Visual Studio or SQL Server Management Studio.

It has a lot of options to customize the formatting of your T-SQL Code.


To format T-SQL code in VSCode you can use the extension SQL Formatter, but it does not have many options to customize the formatting of your T-SQL Code.

I also tried Poor Man’s T-SQL Formatter, but I did not get it integrated into VSCode yet.













2020-06-11 Learned Today


How to fix the error The term ‘Start-WebAppPool’ is not recognized as the name of a cmdlet

When you get the error: “The term ‘Start-WebAppPool’ is not recognized as the name of a cmdlet”

You will have to import the WebAdministration module

Like so:

Import-Module WebAdministration


But if you do this on a system that does NOT have PowerShell 5.1, you will have to install the Windows Management Framework 5.1


Else you will get the error:

Detected Windows PowerShell version 4.0. Windows PowerShell 5.1 is

required to load modules using Windows PowerShell compatibility feature.

Install Windows Management Framework (WMF) 5.1 from

https://aka.ms/WMF5Download to enable this feature.

The error explains what to do, you should download the correct version of the WMF 5.1:



How to check version of PowerShell

> $PSversionTable


Side note

Restarting a Windows 2012 R2 server can take up to 10 minutes.


Notes on Module WebAdministration is loaded in Windows PowerShell using WinPSCompatSession remoting session

WARNING: Module WebAdministration is loaded in Windows PowerShell using WinPSCompatSession remoting session;

please note that all input and output of commands from this module will be deserialized objects.

If you want to load this module into PowerShell Core please use ‘Import-Module -SkipEditionCheck’ syntax.


But after unsing the parameter -SkipEditionCheck I got the error


Could not load type ‘System.Management.Automation.PSSnapIn’ from

assembly ‘System.Management.Automation, Version=,

Culture=neutral, PublicKeyToken=31bf3856ad364e35’.


So I did not used the -SkipEditionCheck, because the script was working correctly


Where to find info on the pwsh.exe



How to show all system paths on a new line with PowerShell

$env:path -split ‘;’


How to run a PowerShell 7 script on Windows 2012 R2 from the command line


You can use a shortcut or a small batch file.

I created a shortcut and used the following line as Target:

“C:\Program Files\PowerShell\7\pwsh.exe” -NoExit “deploy.ps1”

And used the folder containing the “deploy.ps1” as Start in location

NOTE: using the parameter -WorkingFolder did not work for me, so I used the “Start in” location


NOTE the file name must be the last parameter:

Default parameter if no parameters is present but any values is present in the command line. Runs the specified script in the local scope (“dot-sourced”), so that the functions and variables that the script creates are available in the current session. Enter the script file path and any parameters. File must be the last parameter in the command, because all characters typed after the File parameter name are interpreted as the script file path followed by the script parameters. Example: pwsh HelloWorld.ps1


Name parameters in C#, when calling a method

When you call a method in C# it is a good practice to name the parameters.
Certainly when dealing with Boolean values.

So instead of: contacts.Add(“My Name”, false);

Use: contacts.Add(“My Name”, shouldSaveToDb: false);

NOTE: If you name all parameters, the order does not matter.


Return custom error message instead of an exception from an ASP .NET Core controller

If you want an ASP .NET Core controller, to return an error message (not an exception), for example, when an parameter does not meet the requirements, then you can use the following code:

var response = new HttpResponseMessage


    Content = new StringContent(“Field ‘Birthdate’ should not be in the future.”),

    StatusCode = (HttpStatusCode.BadRequest)


return Task.FromResult(responseas IActionResult;



How to fix git push error

When you use an invalid branch name character, you will get the following error:

fatal: cannot lock ref ‘refs/heads/feature/Some_branchname_with_invalid_>_character’: Unable to create ‘…’: Invalid argument

error: src refspec feature/ Some_branchname_with_invalid_>_character does not match any

error: failed to push some refs to ‘ssh://git@…./…..git’

To fix this error remove all invalid branch name characters, in this case only the ‘>’ character.


How to insert lorem ipsem into a Microsoft Word document