Powershell as a Visual Studio External Tool
Oct 22, 2017
It’s handy to be able to open Powershell at the current solution directory, e.g. for invoking scripts or git commands etc.
Click the Tools menu -> External Tools -> Add
Title: Powershell, or whatever you want
Command: your PS directory, e.g C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
Arguments: -ExecutionPolicy RemoteSigned -NoExit -Command “Set-Location ‘$(SolutionDir)’ | Clear-Host"
Initial directory: $(SolutionDir)
Useful Vim Stuff
Oct 18, 2017
!ls - execute ls in shell
Ctrl+q - block select
Ctrl+q, I - insert mode across multi-line block selection (operates across selection after Esc is pressed)
qx - record macro x
@@ - replay last macro
2@x - replay x twice
Ctrl+6 - edit last file (think of it like Ctrl+^ or ^^)
g; - previous change
gq - reformat
O - other end of visual selection
:split - horizontal split the current file
...
➦
Useful Powershell stuff
Sep 27, 2017
Group objects into batches of X items with a constructed property, credit to Dave Wyatt:
$bigList = 1..1000
$counter = [pscustomobject] @{ Value = 0 }
$groupSize = 100
$groups = $bigList | Group-Object -Property { [math]::Floor($counter.Value++ / $groupSize) }
—–
Use “PipelineVariable” to pass data down the pipeline rather than using a foreach:
Get-ADUser <username> -PipelineVariable user -Properties memberof |
Select-Object -ExpandProperty memberof |
Select-Object @{ n = ‘Name’; e = { $user.
...
➦
Umbraco Deployment Checklist
Jan 10, 2017
This is primarily aimed at deploying from Visual Studio to an Azure Web App + Azure SQL database, feel free to skip bits that aren’t relevant if you’re doing other things.
Prerequisites for developing locally:
Visual Studio (obviously)
Ensure IIS URL Rewrite module is installed using web platform installer (other downloads from MS documentation don’t seem to work)
Set up Azure:
Make a new SQL Database in Azure, take note of the server name, database name, admin login and admin password.
...
➦
Customising Umbraco's Default Grid Editors
Oct 19, 2016
Create a new directory in App_Plugins called anything you like. This will be your “package” directoryCopy the web.config file that’s inside the main “Views” directory (not your project’s main web.config!) into your package directory. This is needed for MVC to work properlyCreate a package.manifest file and put this in it (come back and modify these properties as necessary):
{
“gridEditors”:
[{
“name”: “Speaker Portrait”,
“alias”: “speakerPortrait”,
“view”: “media”,
“render”: “/app_plugins/yourpackagedir/MediaMarkup.
...
➦
Auto-Incrementing Build Number in Visual Studio and WiX Installer
Mar 20, 2016
In AssemblyInfo.cs, remove the “AssemblyFileVersion” attribute, and set “AssemblyVersion” to contain “*” where you want to include the revision and build numbers, like 1.5.*
In the WiX installer’s .wxs file, in the “Product” node, set the “Version” property to look like this:
Version=”!(bind.FileVersion.FileId)“
where FileId is the ID of the file to take the version number from.
Credit to these two StackOverflow posts:
http://stackoverflow.com/a/826850/2939759
http://stackoverflow.com/a/641094/2939759
Setting up a Linked Server login for EasySoft Salesforce ODBC Driver
Jan 20, 2016
We’re currently using EasySoft’s excellent Salesforce ODBC Driver to be able to treat our Salesforce org as if it were another SQL database (really useful for updating legacy stored procedures by rewriting queries that reference migrated Dynamics tables to query Salesforce instead!) We were working on updating a particular page in our website that needed to use it but was running into permissions issues when querying it, the error was:
...
➦
Scribe Agent Issues
Dec 02, 2015
Today we encountered a weird problem after resetting the credentials for the Salesforce account used for synchronising data. Although the “Test Connection” was successful, any attempts to connect to Salesforce ended up with this error: “Destination URL not reset. The URL returned from login must be set in the SforceService SOQL” Which really doesn’t help much; Googling for it just turns up a bunch of info about Salesforce API connections, so hopefully someone having the same issue finds this post.
...
➦
Azure Active Directory Redirect Loop
Oct 08, 2015
While developing an Azure web app that uses Azure AD integration, I ran into a mysterious redirect loop, first on my wife’s phone while trying to show it off (embarrassing!) and then again at work. Turns out that if you don’t specify https, the Microsoft sign-in page keeps redirecting back to the app and vice-versa. Took me a little while to figure this out, thanks to tugberkugurlu for finding the solution!
...
➦
How to make yourself a Dynamics CRM 2011 Deployment Administrator
Sep 01, 2015
Today I needed to deactivate one of our Dynamics organisations, but when I opened the Dynamics Deployment Manager, I received the following error:
"Only the Deployment Administrators are able to use Deployment Manager. You are not a Deployment Administrator.“
Bummer. I did a bit of Googling and found this post by Ronald Lemmen (thanks for pointing me in the right direction!). Since the Dynamics Deployment Manager is obviously checking the MSCRM_CONFIG database for this information I attached a database trace to it and found that it’s executing these queries (among many others):
...
➦