Skip to main content


Set "Windows spotlight" lockscreen images as desktop wallpapers without installing anything

I ended up moving the code for this post into my github since I'm using it myself ;) Get it from here:

Once you've cloned it, the only things you need to do are:

Decide where you want the wallpaper images to goUpdate the $location variable in the script with that location (I'm using ~\Pictures\Spotlight Wallpapers)Run the scriptOpen windows background settings and set the background type to "slideshow", pointed at that locationRun the script at startup if you want to get new images all the time (optional but recommended)

Recent posts

ImageProcessor security config for Umbraco + Azure Storage Emulator

This is only going to work if you're using ImageProcessor with Umbraco to deal with images being loaded from blob storage in the Azure Storage Emulator. Took me a while to get the settings right, the way I figured it out was:

firstly, use Azure Storage Explorer to find the URL for your emulated blob container and make sure that works by requesting from there directlyFind the URL it's attempting to use by catching the ImageProcessingExceptions that get thrown when it can't find the file
Once I had both the correct URL as well as the URL that it was attempting to use, figuring out what to put in the config was just trial and error.  Here's what I ended up with:

<service name="CloudImageService" prefix="media" type="ImageProcessor.Web.Services.CloudImageService, ImageProcessor.Web"> <settings> <setting key="Container" value="devstoreaccount1/media"/> <setting key="MaxBytes" …

The quickest, easiest way to make and connect to an Azure VM

$creds = Get-Credential
$vmname = "TestVM"
$vm = New-AzureRmVm -Name $vmname -Credential $creds #-Size "Standard_DS3_v2"
$fqdn = $vm.FullyQualifiedDomainName;
$username = $creds.UserName;
"full address:s:$fqdn" | out-file "~\desktop\$vmname.rdp";
"username:s:$vmname\$username" | out-file "~\desktop\$vmname.rdp" -Append;

Recurring issues in Visual Studio projects

Common issues and solutions to errors I come across in Visual Studio on a semi-regular basis:

"Could not find a part of the path … bin\roslyn\csc.exe"
Run this in Package Manager Console:
Update-Package Microsoft.CodeDom.Providers.DotNetCompilerPlatform -r

"Creation of the virtual directory http://localhost:12345/ failed with the error: Cannot create the Web site"
Update .csproj file and set the following:
In the <VisualStudio> element, set the following:

"Could not load file or assembly [assembly name] or one of its dependencies. The located assembly's manifest definition does not match the assembly reference"
If it's a nuget package, check version of the assembly in packages.config, web.config and "References" section in solution explorer, one of them is probably wrong. Try reinstal…

Get the maximum length of every field in a CSV, Excel etc

While setting up tables in our data warehouse for use with some external APIs, it was getting a little tedious to figure out the max length of some long fields to get the write size for CREATE TABLE statements, so I wrote this little script to calculate it for me. Yeah, it's kinda messy, so sue me (or don't). You can swap out the import-csv part to also import from Excel or whatever else

$csv = import-csv ~\Downloads\whatever.csv
$fields = $csv | select -first 1 | get-member | where MemberType -eq 'NoteProperty'

foreach($field in $fields)
    $data = $csv | select -ExpandProperty $field.Name
    $lengths = $data | % {$_.Length}
    $max = ($lengths | measure -Maximum).Maximum
    $field | add-member -NotePropertyName MaxLength -NotePropertyValue $max

$fields | select Name, MaxLength | Format-Table -AutoSize

Handling double-quoted CSVs in Azure Data Factory Pipelines

Azure Data Factory by default uses a backslash as the escape character for CSVs, but we ran into an issue with this today processing one of the CSV files from  As with most CSVs they use quotes around values as normal and with double-quotes for empty values, but they also use double-quotes to escape quotes within non-empty values. This probably sounds confusing, so here's an example:

"column 1","column 2","","column 4 value is ""sort of"" like this"

The ADF pipeline failed because the double-quotes don't get escaped correctly:
ErrorCode=UserErrorSourceDataContainsMoreColumnsThanDefined, found more columns than expected column count.

The solution was to change the "Escape character" property on the dataset, by clicking the "Edit" button beneath it and manually entering "", since "" isn't in the list of escape characters.  I didn't think this would work at fir…