Here’s a small but very useful PowerShell script to generate GUIDs in different formats.
You can use this method with PowerShell as alternative to the tail command at Linux.
When using PowerShell, did you ever wish to have a function to pipe structured data to visualize it.
PowerShell has a great built-in function for that: Out-GridView.
You can even filter the rows in the grid.
CSS 3 has a new method calc(), which gives you possibility to align elements. You can mix proportions and fixed measures.
width: calc(100% – 40px);
Recently I’ve found a method GeneratePassword() in the good old .NET full framework, in the System.Web.Security-namespace. It has two parameters to specify the complexity of the password.
public static string GeneratePassword (int length, int numberOfNonAlphanumericCharacters);
Sometimes you write an ASP.NET Core application without using MVC. For example an microservice or an application serving static files.
Anyhow you might want to secure your application using authentication. I was facing the problem, how I could challenge authentication when I’m not using MVC.
The solution is writing a custom middleware that challenges authentication.
If you want the Angular Development Server ng to serve at the external IP of your computer to allow external clients to access the app, use following command.
ng serve --host=0.0.0.0 --disable-host-check
If you want PowerShell to wait for an action to complete, you can display a loading spinner using these few lines of code.
The script will print a new dot every three seconds until the condition in the until-clause is fulfilled.
The result looks like this:
You can use the command line program clip to pipe the output of a command to your clipboard.
Write-Output "Hello World!" | clip
MS LocalDB has the possibility to share your personal LocalDB instance with other users on the computer.
You can use the CLI tool SqlLocalDb.exe to share the instance. It is available in the Developer Command Prompt of Visual Studio.
This is the documentation of the share action:
share|h ["owner SID or account"] "private name" "shared name" Shares the specified private instance using the specified shared name. If the user SID or account name is omitted, it defaults to current user.
C:\Windows\System32>sqllocaldb share contosolab\doering MSSQLLocalDB ShareLocalDb Private LocalDB instance "MSSQLLocalDB" (owner: CONTOSOLAB\doering) shared with the shared name: "ShareLocalDb".
Important: the argument “owner SID or account” must be your own user not the user you want to share the instance with.
The instance then appears as .\ShareLocalDb in the list.
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional>sqllocaldb info .\ShareLocalDb MSSQLLocalDB
You can use the shared instance in connection strings like this: