My random rumblings

Something of everything and nothing at all

Update blogengine.net password

The password of the blogengine.net application's password can be found in the users.xml file.

The following PowerShell script can be used to generate a new password.


$password = "The new password"

$passwordBytes = [System.Text.Encoding]::UTF8.GetBytes($password)

$sha256 = New-Object System.Security.Cryptography.SHA256Managed

$sha256.TransformFinalBlock($passwordBytes, 0, $passwordBytes.Length)

$passwordHash = [System.Convert]::ToBase64String($sha256.Hash)

$passwordHash

MS SQL EXEC into table

Use the following if you need to use the output of a stored procedure.

declare @t table(vbuNo bigint, thirdPartyId int, username varchar(512))

 

insert into @t

    exec proc_GetAVMVehicles

 

select distinct VbuNo from @t order by VbuNo

Strong Named PowerShell Type

Example on how to add a strongly typed Type in PowerShell

 

$Source = @"

using System;

 

public class SomeClass

{

public string SomeMethod

{

return "The result";

}

}

"@

 

$keyFile = "$((Get-Item -Path '.\' -Verbose).FullName)\deploy.snk"

$compilerParameters = New-Object System.CodeDom.Compiler.CompilerParameters

$compilerParameters.CompilerOptions = "/keyfile:$keyFile"

$compilerParameters.ReferencedAssemblies.Add("System.dll")

Add-Type -TypeDefinition $Source -Language CSharp -CompilerParameters $compilerParameters

PowerShell Redis Delete

Use the following PowerShell script to delete keys from Redis.

.\redis-cli keys * | foreach{ .\redis-cli del $_ }

What process is using my file?

We can either use SysInternals process explorer we can use tasklist.

In the command line window execute the following:

tasklist /m path\filename.extension

Sign assembly without code

When you do not have the code for an assembly and need a signed assembly use the following:

sn -k stackexchange.redis.snk

ildasm StackExchange.Redis.dll /out:StackExchange.Redis.il

move StackExchange.Redis.dll __StackExchange.Redis.dll

ilasm StackExchange.Redis.il /dll /resource=StackExchange.Redis.res /key=StackExchange.Redis.snk

Apache Cordova

Copied from the following link: https://msdn.microsoft.com/library/dn771551(v=vs.140).aspx#vstac

Configure tools to work with a proxy

If you are using Visual Studio behind a proxy, such as a corporate firewall, you may need to configure proxy settings for the npm package manager and for git before you can use Visual Studio Tools for Apache Cordova.

Important

Using npm proxy settings with recent versions of Node.js can cause Cordova to fail to acquire plugins at the command line or in the configuration designer or when adding platforms required for build. If you encounter unexpected issues (particularly a "TypeError: Request path contains unescaped characters" error), try downgrading Node.js to 0.10.29.

To configure proxy settings for npm package manager

  1. Close Visual Studio
  2. Open a Visual Studio developer command window (Ctrl + Alt + A) and type the following command.

    npm -g uninstall vs-tac

  3. Open %AppData%\npm\node_modules and verify that the vs-tac folder has been removed.
  4. npm config set proxy <proxy-port>

    where proxy-port is the proxy address and port number, such as http://proxy.mycompany.com:80/

  5. npm config set https-proxy <proxy-port>

    where proxy-port might be a value such as http://proxy.mycompany.com:80/.

  6. Open Visual Studio.
  7. Open your Apache Cordova solution and rebuild your project.

TSQL Execution Time

Add the following line in Management Studio to get an accurate execution time reading of queries

set statistics time on