Skip to content

Instantly share code, notes, and snippets.

@jackawatts
jackawatts / gist:3f55cd9e80d86a6c56c08207b531fd8b
Created Nov 19, 2019
Uninstalling VSIX from the command line
View gist:3f55cd9e80d86a6c56c08207b531fd8b
Find the VSIX identifier by:
1. Renaming the VSIX to .zip
2. Opening the .manifest file
3. Copy the ID from the ID attribute
Then:
```CMD
vsixinstaller /q /a /u:"<VSIX Identifier Here>"
```
@jackawatts
jackawatts / Azure SQL User Management.md
Last active Nov 6, 2019
Azure SQL User Management
View Azure SQL User Management.md

Create the Login

CREATE LOGIN [Login] 
	WITH PASSWORD = 'password'
GO

Create the User

CREATE USER [User]
@jackawatts
jackawatts / Vscode as default merge tool for git.bat
Created Jan 16, 2019
Vscode as default merge tool for git
View Vscode as default merge tool for git.bat
git config --global merge.tool vscode
git config --global mergetool.vscode.cmd "code --wait $MERGED"
git config --global diff.tool vscode
git config --global difftool.vscode.cmd "code --wait --diff $LOCAL $REMOTE"
@jackawatts
jackawatts / Working with Azure AD and Graph API.md
Last active Jan 25, 2019
Working with Azure AD and Graph API
View Working with Azure AD and Graph API.md

Access to the GraphAPI requires an auth token best collected via ADAL.NET MSAL.NET is an alternative but it does not handle caching elegantly

Configure Azure AD to have the correct permissions

  1. Login to portal.azure.com
  2. Azure AD
  3. Visit the app registration
  4. Settings => Required Permissions
  5. Add Graph API if it does not already appear in the list
  6. Add the appropriate permissions (as an app typically)
@jackawatts
jackawatts / Add an Azure Resource Manager service connection.md
Last active Apr 1, 2020
Adding an Azure Resource Manager Service Connection in AzureDevOps
View Add an Azure Resource Manager service connection.md

Taken from: https://blogs.msdn.microsoft.com/mihansen/2018/03/31/granular-vststfs-deployment-privileges-using-service-principals/

AzureDevOpsAR is simply the name of the app registration AzureDevOps will be associated with, don't like the name? Simply change the references below.

  1. Create an App Registration to act as a Service Principal:
    1. Log in to portal.azure.com
    2. Azure Active Directory => App Registrations => New Application Registration
    3. Name: AzureDevOpsAR, Type: Web app/API, Url: http://azuredevopsar (Url isn't important as it won't be used)
    4. Copy the Application ID as this will be the Service principal client ID
    5. Settings => Keys => Add
View Local DB.md
View Mobile Friendly Web Forms.md
  1. Only show important fields so that people don't have to spend more time filling out the form than they need to
  2. Top align fields so that the form is suitable for a mobile view
  3. Design for fat fingers so people aren't penalized for using a smaller device
  4. Collapse menus and dropdowns so that the form isn't harder to navigate through
  5. Use predictive text so that the user has to type less
  6. Use single inputs where possible so that they user has less fields to fill out
  7. Make submit buttons standout, have meaningful names & possibly 1/3 so it is clear what the user must do and they know how close they are to completing the section
@jackawatts
jackawatts / TestDbSet.cs
Last active Jul 16, 2018
TestDbSet for Entity Framework 6.0
View TestDbSet.cs
// FROM https://msdn.microsoft.com/en-us/data/dn314431
namespace Data
{
public class TestDbSet<TEntity> : DbSet<TEntity>, IQueryable, IEnumerable<TEntity>, IDbAsyncEnumerable<TEntity>
where TEntity : class
{
ObservableCollection<TEntity> _data;
IQueryable _query;
public TestDbSet()
@jackawatts
jackawatts / Sonarqube Quickstart for .NET.md
Last active Jul 17, 2018
Getting up and running with Sonarqube
View Sonarqube Quickstart for .NET.md
  1. Install Java Runtime Environment (http://www.oracle.com/technetwork/java/javase/downloads/jre8-downloads-2133155.html)
  2. Download and extract sonarqube (https://www.sonarqube.org/downloads/)
  3. Launch sonarqube: C:\sonarqube\bin\windows-x86-xx\StartSonar.bat
  4. Browse to localhost:9000 to validate
  5. Install the SonarScanner for MSBuild (https://docs.sonarqube.org/display/SCAN/Install+the+SonarScanner+for+MSBuild) Edit the SonarQube.Analysis.xml file in the directory the scanner for MSBuild was installed to:
  • Ensure the sonar.host.url element points to localhost:9000
  • Ensure the directory the scanner was extracted to is added to:
View SQL Geography and Geometry.md
  • WKT: Well-Known Text
  • SRID: a unique identifier for the co-ordinate system to be used defined by EPSG. All Geography types in SQl Server have an associated SRID. Geography instances with different SRIDS cannot be compared without additional transformation.

Note: SRIDS must be the same when performing opertations on multiple geography instances*

SqlGeometry is 2D while SqlGeography is 3D+. It is worth considering deafaulting to SqlGeometry simply unless 3D measuements or localised geography systems are used. Many 3rd parties provide data in 2D and it is easier to transform geometries to difference co-ordinate systems.

Converting KML to WKT

Try SharpKml (https://github.com/samcragg/sharpkml) great library for manipulating KML

  1. Load your KML: