Azure PowerShell login

if ([string]::IsNullOrEmpty($(Get-AzureRmContext).Account)) {Login-AzureRmAccount}

Microsoft Future Decoded, November 1st 2017, Day 2 – Tech Deep Dives

Microsoft Future Decoded, November 1st 2017, Day 2 – Tech Deep Dives

These are my notes from the day. It’s not a detailed summary of the event, just notes for things I found interesting or want to remember to try out or do.


Not much that was relevant to us. Mostly vendors helping people migrate to the cloud.

Innvovation Keynote

Focused on Mixed Reality, DNA storage, blockchain in Azure. All very interesting but nothing immediately actionable.

CosmosDB – Global Scale, Multi-Model, Guaranteed Latency

  • We should add some validation onto all the entities we store in CosmosDB that runs before we save/update. Probably using FluentValidation. This should include anything used to generate the ID or the PartitionKey, e.g. OrganisationIdentifier.
  • When we go live, start by over-provisioning RUs and then once we can see our usage through the portal, dial it down.
  • Find out more about the different consistency levels as there could be performance benefits, particularly when importing data. This is configurable per-request.
  • Think about how we want to configure indexing – lazy?
  • We can use Azure Functions with CosmosDB triggers to trigger copying of data to SQL Server
  • Endjin Cloud Adoption Risk Model poster
  • The IndexingPolicy is configurable, we need to work out what we need
  • Even if we’re not partitioning to begin with, we need to set a PartitionKey and make sure it’s a good one
  • Although the SDK will handle and retry errors, e.g. 429 – we need to decide what to do if this still fails. Endjin use a dead letter queue.
  • We could provide a UI for editing RU configuration without needing to re-deploy – though the Azure Portal should be able to handle most requirements for this
  • Look into per minute request units configuration to give some flexibility for bursty traffic
  • Cross partition queries are expensive so avoid using them where possible
  • Sign up for a summary of the week’s top news in the Microsoft Azure ecosystem, as well as interesting historic content that’s well worth reading.
  • Since we’re migrating from RavenDB, check for gaps in CosmosDB tooling, e.g. how easy is it to manually edit a single document?
  • Once you select the API for accessing CosmosDB you can’t then use a different API. For example you can’t mix the table storage API with DocumentDB API.
  • Check the current document size limit and make sure none of the data we’re migrating is approaching it
  • Make sure we’re logging the RUs used by all requests. See: Cosmos DB Request Units and the .NET SDK

DevOps: Zero to Hero with Visual Studio Team Services

  • Look at how to use the VSTS Release feature alongside Gitflow/Hubflow. There must be some documentation on it.
  • PowerBI can be hooked up to VSTS so you can generate dashboards and reports from VSTS activity. This could be a good way of getting an overview of all builds/releases. See:

Microsoft SQL – What you need to know for Privacy, Compliance and GDPR

  • Find about the Microsoft Assessment and Planning Toolkit (not relevant to us as designed for cloud migrations)
  • A classification, e.g. “address”, “name”, “email” can be assigned to columns in SQL Server to make it easier to identify personal data
  • Some example code used the FORMSOF function – could be useful one day. See: Querying SQL Server Using Full-Text Search
  • Try out SQL Server Vulnerability Assessment Tools
  • There was an interesting demo of temporal tables showing how it can be used to a) expire data after a specified date b) restore data to a previous version (without doing a full database restore). See: Temporal Tables Temporal tables
  • It was implied that it’s okay to keep backups containing data of individuals that have asked to have their data deleted so long as you also keep a list of these individuals and make sure that after restoring any backups, there’s a process to run through this list and re-delete the data of those individuals.

Empowering Keynote

I didn’t stay for this but the video is available online.

Creating a self signed SSL certificate on Windows using PowerShell

Run this PowerShell command as Administrator:

New-SelfSignedCertificate –DnsName * –CertStoreLocation cert:\LocalMachine\My

Open Manage Computer Certificates (typing certificates in the Start menu should find it)

Open Personal\Certificates

Find the * certificate that has an expiration date of a year from today. Delete any others for * to avoid confusion later on.

Right-click and choose Copy.

Navigate to Trusted Root Certification Authorities\Certificates

Right-click and paste.

Restart your machine.

In IIS, update the bindings for all sites to use the SSL certificate created above, it will be called *


Deleting local git branches that have been merged on the remote using PowerShell

This is useful but hard to find a PowerShell version of. I found it here:

git branch --merged | %{$_.trim()} | ?{$_ -notmatch 'develop' -and $_ -notmatch 'master'} | %{git branch -d $_}

Setting all indexes to have zero replicas with Elasticsearch

To configure all indexes (including existing ones) to have zero replicas (useful if running on only one server, e.g. in development), execute this (syntax assumes you’re using Sense):

PUT /_settings


“index” : {

“number_of_replicas” : 0



Then check it’s worked by running this:

GET /_cat/indices?v

Stdout logging in ASP.NET 1.1.1 Azure Web Apps

Because I keep forgetting it:


RavenDB: CryptographicException & FormatException: Input string was not in a correct format

If you get an error similar to the below and are using encrypted databases, make sure that you’re running the RavenDB process as the same user you were when the databases were created/encrypted.

The encryption keys are stored in per-user stores by Windows so if you created the database while RavenDB was running as a Windows Service (as LOCAL SYSTEM) and then later run RavenDB directly using Raven.Server.exe it will be running as the logged in user, not LOCAL SYSTEM and won’t have access to the encryption keys.

Raven.Database.Server.Tenancy.AbstractLandlord`1,Warn,,45,Could not unprotect secured db data Raven/Encryption/EncryptIndexes setting the value to '<data could not be decrypted>',"System.Security.Cryptography.CryptographicException: Key not valid for use in specified state.
   at System.Security.Cryptography.ProtectedData.Unprotect(Byte[] encryptedData, Byte[] optionalEntropy, DataProtectionScope scope)
   at Raven.Database.Server.Tenancy.DatabasesLandlord.Unprotect(DatabaseDocument databaseDocument) in c:\Builds\RavenDB-Stable-3.0\Raven.Database\Server\Tenancy\DatabaseLandlord.cs:line 283
Raven.Database.Server.Controllers.RavenDbApiController,Warn,,45,Could not open database named: XXXX Input string was not in a correct format.,"System.FormatException: Input string was not in a correct format.
   at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
   at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info)
   at Raven.Database.Config.InMemoryRavenConfiguration.Initialize() in c:\Builds\RavenDB-Stable-3.0\Raven.Database\Config\InMemoryRavenConfiguration.cs:line 339
   at Raven.Database.Server.Tenancy.DatabasesLandlord.CreateConfiguration(String tenantId, DatabaseDocument document, String folderPropName, InMemoryRavenConfiguration parentConfiguration) in c:\Builds\RavenDB-Stable-3.0\Raven.Database\Server\Tenancy\DatabaseLandlord.cs:line 263
   at Raven.Database.Server.Tenancy.DatabasesLandlord.CreateTenantConfiguration(String tenantId, Boolean ignoreDisabledDatabase) in c:\Builds\RavenDB-Stable-3.0\Raven.Database\Server\Tenancy\DatabaseLandlord.cs:line 99
   at Raven.Database.Server.Tenancy.DatabasesLandlord.TryGetOrCreateResourceStore(String tenantId, Task`1& database) in c:\Builds\RavenDB-Stable-3.0\Raven.Database\Server\Tenancy\DatabaseLandlord.cs:line 160
   at Raven.Database.Server.Controllers.RavenDbApiController.TrySetupRequestToProperResource(RequestWebApiEventArgs& args) in c:\Builds\RavenDB-Stable-3.0\Raven.Database\Server\Controllers\RavenDbApiController.cs:line 618

Pukka tea tasting notes

I bought a Pukka teas taster pack a few weeks ago, and kept notes so I could remember which ones I wanted to buy more of. These are my personal tastes and opinions, your results may differ!

star anise & cinnamon – “A velvety swirl of organic star anise, cinnamon & ginger” – Good but not sure I’d want to drink a whole box full, perhaps one for winter.

lively english breakfast – “A perky blend of organic whole leaf tea, ginseng & licorice” – Had this with milk. Quite good but a bit “fruity” for tea with milk. Not one I’ll be buying a box of.

three tulsi – “A sacred organic blend flowering with vibrant clarity” – A bit like Jasmine tea, not bad but a bit flowery for me.

lemon, ginger & manuka honey – “A welcoming cup of spicy-sweet organic bliss” – Very good, a classic. Though the manuka honey is only a flavouring, it doesn’t actually contain any. Not so good if left to go cold.

cool mint green – “An organic spearmint splash into green’s goodness” – Pretty much what it says on the tin – green tea with a hint of mint. A good combo – takes the edge of the green tea bitterness. Might buy this one.

rooibos & honeybush – “A copper red charm of organic earthy delight” – Not much to say really, tastes of rooibos – quite nice but not that keen personally.

lemongrass & ginger – “An uplifting organic lemony zing with a flying finish” – Not bad, hard to describe really – not quite as interesting as it sounds. Not interesting enough to consider buying any more. The lemony-ness is very subtle.

licorice & cinnamon – “A luxuriously sweet organic treasure gilded with golden spice” – You can’t really go wrong with this one – very nice, sweet and warming. Would buy again.

lemon & mandarin with lemon verbena – “An organic citrus sensation to cheer your senses” – Not quite as exciting or fruity as it sounds but a good fruity tea, similar to lemon and ginger I guess.

detox – “A lemony spring of organic aniseed, fennel & cardamom” – Nice and refreshing, light, lemony. Doubt it actually detoxes anything though!

elderberry & echinacea with elderflower – “A rich organic embrace tingling with fruity warmth” – Fruity, nice. Hard to distinguish all the flavours but would buy again.

wild apple & cinnamon with ginger – “A sunlit orchard of organic warmth & sweet spice” – Not bad and quite warming though not sure about the apple.

blackcurrant beauty – “Deliciously deep purple organic fruits to help you glow inside and out” – Blackcurranty, not much more to say.

womankind – “A delicate dance of organic cranberry, rose & sweet vanilla” – I had this in a pink mug to match the packaging. Not bad, lots of ingredients but none of them really stood out. Fairly generic “fruity” tea.

clean green – “A fresh burst of pure organic green tea with a luscious lemony lift” – Basically green tea with a hint of lemon. Pretty good though, takes the bitter edge off. I’d buy this if I wanted a green tea.

vanilla chai – “A caffeine-free organic lift flushed with cinnamon warmth” – Nicer than other chai teas I’ve had – I couldn’t really taste the vanilla but it seemed to work.

relax – “A deeply soothing fusion of organic chamomile, fennel & marshmallow root” – I had this on a stressful day to put it to the test – not sure if it worked or not. It was nice but not memorable – I probably wouldn’t buy this again.

sweet vanilla green – “A seductively sweet organic melody of soothing vanilla and whole leaf green tea” – Good but not that sweet and not much vanilla flavour. Better than plain green tea though.

gorgeous earl grey – “An inspiring infusion of organic whole leaf, bergamot & lavendar” – I’m not a massive earl grey fan but this one seemed pretty good – nice and smooth though I was left with a bitter taste when I’d finished the cup.

three ginger – “A warming swirl of organic ginger, galangal & golden turmeric” – It’s a good ginger tea, but it’s just ginger tea – couldn’t taste the other ingredients.

three licorice – “A sweet song of nourishing organic licorice from Kazakhstan, Pakistan & Egypt” – Very good and strong flavour but I think I still prefer the “peppermint & licorice” tea by Pukka.

cleanse – “A radiant blend of organic nettle, fennel & peppermint” – Hard to decribe, tasted mostly of peppermint but not as strong as a pure peppermint. Nice, but a bit boring.

supreme matcha green – “A vital wellspring of organic whole leaf green tea & the finest matcha” – Much like any other green tea I’ve had – a bit bitter but feels like it’s doing you good. The matcha is only 2% so probably more of a marketing gimmick than anything else.

three fennel – “Soothing organic sweet & wild fennel seeds with fennel leaf” – This smells pretty good and tastes ok too – a bit bland but I like it, I just don’t know why.

chamomile, vanilla & manuka honey – “A soothing dip in an organic pool of calm” – I was so calmed when I drank this that I’ve totally forgotten what it tasted like. It contains manuka honey flavouring, not actual manuka honey which is a bit of a swizz.

three cinnamon – “A sweet embrace of organic Indian, Indonesian & Vietnamese cinnamon” – Very cinnamony for obvious reasons – nice flavour, warming and has the best disclaimer – “Do not drink more than 4 cups a day”

night time – “organic oat flower, lavender & limeflower tea for peaceful sleep” – I had this during the afternoon and didn’t fall asleep (fortunately). It was pretty good, drinkable, hard to describe the flavour though – not as exotic a taste as the description might suggest.

revitalise – “A burst of warming organic cinnamon, cardamom & ginger” – Nice, smooth but not particularly memorable.

after dinner – “A delicious digestif of organic sweet fennel, roasted chicory & caradmom” – I had this mid-afternoon but I think it would go well after a big dinner, especially steak or similar.

serene jasmine green – “A sensual haven of organic green jasmine tea, chamomile & lavender” – Doesn’t taste as fancy or complicated as it sounds but good if you like that kind of flavour – I prefer the sweeter flavours personally.

original chai – “A royal flush of organic cinnamon, cardamom & ginger” – My favourite of the chai teas so far, or perhaps it’s just growing on me. I’d consider buying more of this one.

PSake: “Exception: Unknown .NET Framework version, 4.6.1 specified in 4.6.1.”

If you get this error, you may have run another PSake script with a different framework version in the same PowerShell session.

Open a new PowerShell window and try again.

Rewriting git history – removing a directory

git filter-branch –force –index-filter ‘git rm –cached -r –ignore-unmatch directoryToRemove’ –prune-empty — –all

git push origin master –force

Running IISRESET from Visual Studio

If you want a quick way of running IISRESET from within Visual Studio:

Tools > External Tools…


Add a new menu item to run C:\Windows\System32\iisreset.exe (note the checkboxes at the bottom)…


You then get a new menu item…


And the output is displayed in the Output panel…


Depending on your UAC settings, you may need to be running Visual Studio as Administrator for this to work.

UAC, Windows 10 and Visual Studio


Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers]

“C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\devenv.exe”=”~ RUNASADMIN”

Progressive .NET Tutorials 2015

Microservices in .NET

IDL – interface definition language – swagger?

Components – don’t know what’s remote

SOA – make it being remote explicit

Microservices – bounded contexts, eventual consistency

Hard to let go of understanding everything

QA – just test the contract of each service, not the whole system – reduces problems caused by configuration problems

Don’t make services too small (Nanoservices) – can lead to too many changes in lots of places, latency (caching helps)

Monolith – staccato delivery

Break it up as each developer/team can only internalise so much

Embrace Conway’s law – check the long version of this

Eventual consistency – 2 phase commit doesn’t scale

Shared data – one source of truth, but can share out a “version” of the data

Try to avoid sharing dependencies, i.e. DTOs – duplicate theme

Enterprise service bus – becomes smart network, hard to test, locked in to vendor – keep the logic in the services instead

Anti-corruption layer for legacy code

Documentation driven design

REST in practice – reference data – ATOM feeds, very cacheable

Could use EventStore for the feed – then services poll the event feed – like a queue of orders in a restuarant



What about having a single API to cover everything?


  1. Break up into bounded contexts
  2. Ubiquitous language



Hexaganol architecture



DNS SD & SRV records – difficult to manage, so Zookeeper/etcd etc better




Everything is an actor 

3 Core Abilities of an actor 

  1. Send messages 
  2. Create other actors 
  3. Change behaviour 

Location transparency (same code in different locations) 

But URLs do have machine names in them 

Switchable behaviour web crawler 

Lighthouse (dedicated seed node) 

Dead letters 

Push dangerous calls down to children 

Supervision directives 

Functional programming in F# 

Types are sets and are composable 

Algebraic types 

Function oriented 


Pattern matching 

No ==, use let for assignment otherwise it will compare 

pure – no side effects 

Pipeline more logical than nesting paranthesis 

Currying – one input, then returns a function taking another input?? 

HOFs – parameterise all the things 

PowerShell DSC

DSC not just a Microsoft/PowerShell standard 

AWS $userdata 

Pull server 

Generates MOF file 

“WMI Tester” 

DSC resource kit – lots of modules! 

The DSC book 

Also see Chef’s site 

Microsoft DSC Resource Kit 

Check git repo for slides etc 

Keynote – Why I’m not leaving .NET!

ASP.NET 5: How to Get Your Cheese Back

Visual Studio & .NET on OS-X, Linux, and Windows

Going Further with ASP.NET 5

Complete Code Craft

Introduction to RabbitMQ & EasyNetQ 


Knowing what went bump in Production – modern monitoring in .net



nxlog community edition 

200GB/day of logs 

How big is the cluster? 

13 months retained 

Scheduled health checks 


embedded checks – config missing etc 


Move reads from writes 

Correlation IDs 

Reactive-interactive approaches to visualization of F# jobs

Akka.NET Fundamentals — #ProgNet15 from petabridge

The Joy Of REPL

Monoliths to Microservices: A Journey

How do you type a backslash “\” into the Dell DRAC viewer?

If you have a UK keyboard and try typing backslash into the Dell iDRACView application you might see # appear instead.

After a lot of experimentation and frustration, the only way I could find of doing this was to check Keyboard > Hold Left Alt Key then type 92 on the keyboard number pad. Then uncheck Keyboard > Hold Left Alt Key again.

Internet of Things and Data Hackathon – 11th June 2015

I don’t have time to write a proper blog post, but here are some of the links I found useful today:

Event hashtag: #hackitmsft

Thanks to Microsoft for a fun and informative day.

Most Good Ideas Actually Deliver Zero or Negative Value

“the chances are that about 2/3 of the work we are doing is of either zero or negative value to our customers – and certainly of negative value to our organization”

From Lean Enterprise: How High Performance Organizations Innovate at Scale and discussed at 13 minutes in to .NET Rocks Episode 1101

404 error accessing Salesforce OAuth2 endpoints?

Try removing the trailing slash.

This works:

This doesn’t:

Sluggish Internet Explorer performance and Browser Link

I recently experienced problems where Internet Explorer performance was sluggish, almost unusable. I could barely log in to the application I was running as there was a long lag between key presses and the text appearing. It turns out that the culprit was Browser Link, a new feature in Visual Studio 2013 that creates a communication channel between the development environment and one or more web browsers.

Disabling Browser Link solved the performance problems.

Uncheck the “Enable Browser Link” option:



My Magic Lantern bricking experience

A few months ago I managed to brick my wife’s Canon 60D. This is the story of how it happened and the things I tried doing to fix it before finally giving up and sending it off to be repaired.

Whilst using my Canon 60D (Firmware 1.1.1, ML 2.3) to take long exposures (astrophotography) I noticed it had apparently frozen up. Unfortunately I can’t remember exactly what I then did, but it was probably a good 30 seconds or more before I removed the battery and card.

I wasn’t able to start it up again no matter what combination of button presses or card/battery removals/replacements I tried.

I was seeing nothing at all on the rear screen, LCD display or in the viewfinder, no beeps or clicks, no smells. The only sign of life I could get was with one of the cards I had Magic Lantern installed on – I get either a single flash when I insert the card or occasionally a double flash – it does this every time but only with that card. No other card does anything at any time. I originally copied Magic Lantern onto two identical 16GB cards. The other card (same version of ML, same card manufacturer) does nothing.

I tried the following standard suggestions for a “bricked” camera but nothing helped:

  • different batteries – partially charged and 100% charged
  • different lenses
  • with/without lens
  • with/without card
  • using a card formatted on my PC – empty
  • using a card formatted on my PC – clean ML install
  • using a card formatted on another 60D (low-level format)

I posted my problem onto the Magic Lantern forums: Bricked 60D – no sign of life except for the SD card light with one ML card

There were a few diagnostic tools which I was able to run:

  • LED blink test
  • Startup log
  • ROM dump

After a few teething issues with incorrectly formatted cards and corrupted file copies, we managed to get the LED blink test and ROM dump to run. The LED blink test just flashes the SD card light once a second – useful for showing that it’s able to read the card and that basic startup routines are executing. The ROM dump was meaningless to me, but was of interest to the Magic Lantern developers who were able to look for possible corruption.

I also had a lot of “fun” trying to build Magic Lantern and the ROM dump code from the source. I’m a developer, but I was way outside my comfort zone with the Magic Lantern build process and embedded ARM development tooling. I got there in the end but it wasn’t fun.

We had a few red herrings and dead ends due to the aforementioned card formatting/filesystem corruption problems.

What was really needed was more detail about the startup, to try and find what was running, and more importantly, what wasn’t – and why.

The Magic Lantern developers have come up with a very clever way of doing this. Because the only way my camera could communicate with the outside world was by flashing its SD card light then the only way to get startup data out was via this light.

There are two parts – code that runs on the problematic camera which flashes the light rapidly – a bit like morse code – long blinks and short blinks. Then you need another helper camera (also running Magic Lantern) and the deblink module, which watches and decodes the blinks in realtime and displays the output.

The tricky part of this, was finding someone else local who had Magic Lantern installed and was able/willing to run the deblink process.

Thanks to Andy Harris (a regular at Reading Geek Night), we managed to give this a go. The result was something we coined “camera inception”. Below you can see my camera (furthest away), the decoding camera (middle) and then for good measure a third camera recording the output that was being decoded via the decoding camera. The reason for the third camera was that we kept running into problems where the decoding camera either turned off, or didn’t record the output anywhere on its own card. So the third camera acted as a record of what happened.


The decoding camera was set up with a very nice macro lens, looking straight at the flashing light on my camera. You can see the orange glow in this photo.



The end result was this:

Unfortunately (as is probably obvious with hindsight) the decoding process didn’t work that well so the output is a bit corrupted.

The Magic Lantern developers had a few more suggestions but it was beginning to require skills I just didn’t have – electronics and low level ARM programming knowledge.

After an interesting few months I finally had to call it a day and returned the camera to a Canon repair centre. They did a great job and the camera is back to normal, but my wallet took a bit of a battering.

I’d like to thank Alex from Magic Lantern and Andy Harris for their time and effort in trying to fix this. Hopefully this post will be helpful to anyone else in a similar situation, or at least interesting!

Tweaks for SSDs on Windows

  • Update firmware
  • Check TRIM is enabled
  • AHCI mode
  • Disable hibernation (powercfg -h off)
  • Install Intel Remote Storage Tools
  • Disable page file?
  • Turn off auto defrag (automatically disabled in Windows 7+?)
  • Turn off superfetch (optional, automatically disabled in Windows 7+?)
  • Set up backups

MongoDB London 2013

Some very rough notes from MongoDB London 2013:

Session 1 – Performance

Keep indexes in memory

Data in memory if you can

Slow queries can be configured to appear in logs

Use SSDs

Growing documents is bad

Do an ‘explain’ on queries

Padding factor

DB locks when writing

Sharding to scale writes

Optionally read from slaves but they may not have the written data yet

Write concern level configurable

Can set importance level of writes based on the node that has acknowledged the write

You can define your own _id structure to help querying

Use short field names – use an abstraction layer

Covered indexes

Dropping collections is faster than removing


Run your own benchmark – benchrun


Document per day,  pre allocated then use inc operator

Session 2 – Backups

bsondump converts bson to json

Use journalling

Disk backups faster

TTL indexes and capped collections


An uneven number of nodes is advised

There’s a mesh of hearbeats between the nodes

An arbiter node only exists for voting – it stores no data

You can have hiddden nodes, for “backup” purposes only

You can give a node a slaveDelay so the replication is delayed

Servers can be tagged e,g, { datacenter: new york }

There are 5 read preference modes

You can test all this on a single machine

Failure points:

  • Power
  • Network
  • Data Center (5 nodes safest, 2 (primary) +2 (primary)+1 (backup DC)
  • Multi-node failure can occur e.g. 2 out of 3 fail

When there’s only one node, the whole cluster becomes read-only

You can disabled indexing if you want to, e.g. on a backup node that isn’t ever queried

OpenStreetMap data contains lots of Points Of Interest, e.g. pubs

MongoDB can be used with Hadoop

There’s a mongo-storm project

Defining a redirect/rewrite in the Web.config

For my own reference:

Parsing MongoDB log files with logstash on Windows

Note: work in progress

This site helps with the date/time formats used:

This is a useful site for debugging grok expressions:

Parsing IIS log files with logstash on Windows

Note: work in progress

I found a couple of example configurations for IIS logging, but they both rely on NXLog and contain deprecated configuration settings:

This is a useful site for debugging grok expressions:

Finding all NuGet packages across multiple solutions

This PowerShell script will look for a file called nuget.config in the current directory, then use it to enumerate through all packages.config files across all solutions underneath the current directory and list the packages that are in use.

Deleting files that Windows can’t delete

I recently downloaded some files from Salesforce Chatter which ended in “….”

If Windows won’t let you delete them (it says they don’t exist), SysInternals sdelete will:

C:\tools\SysinternalsSuite\sdelete.exe /s “\?\C:\Users\TRobinson\Desktop\Over the next few weeks….”

Beware of non-breaking spaces in your HOSTS file

I recently had some problems with HOSTS file entries that were being ignored. When viewed in most text editors it looked correct, but what looked like harmless whitespace was actually a non-breaking space (Decimal 160 or Hex A0). Although you can use tabs or spaces to separate the IP address from the hostname in HOSTS file, it treats non-breaking spaces as part of the hostname and therefore doesn’t work as expected.

Dashlane Easter Egg – Konami Code reveals Conway’s Game of Life

I’ve been a Dashlane user for a while now, having found out about it through a friend and respected colleague who started working for them in the Paris office.

What you may not know is that Dashlane have invited a number of people to be on their “Board of Users” and to give feedback on new product developments. A few days ago one of the QA Engineers set us all a challenge – to find a hidden “cheat code” in the PC version of the application.

Well, I found it! (and I think I was the first)

It turns out that if you open the application, then go to the Help > About screen you’ll initially see this:


Now comes the fun part, you need to type the Konami Code:

↑ ↑ ↓ ↓ ← → ← → A

As soon as you finish that, you’ll see this screen and the Easter Egg will have been activated:


Initially I though, hmm, interesting, is it some kind of icon editor? You can start drawing on the grid, like this:


But as soon as you click the Dashlane logo then the grid turns into Conway’s Game of Life:


The guys at Dashlane have been kind enough to offer to send me some goodies but the main prize is this signed Dashlane drawing from the team at Dashlane in Paris:

Dashlane Konami Code Scan

Thanks all!

Powershell: -contains vs. -match and -like

I recently discovered a problem where the Where-Object –contains operator wasn’t doing what I thought it was, i.e. the equivalent of String.Contains() in C#. For example:

(Get-Item .\MyDirectory) where { $_.Attributes -contains “Directory” }

Is not the same as:

(Get-Item .\MyDirectory) where { $_.Attributes -match “Directory” }

The former fails if the directory has more than one attribute. The reason for this is:

-contains is designed to work on arrays, not strings (referred to as a containment operator)
-match looks for a match inside a string and supports regexes
like looks for a match inside a string and supports wildcards

So if the directory only has one attribute then –contains sees it as an array with a single entry “Directory” and returns true.
But if the directory has multiple attributes then –contains still sees it as an array with a single entry but the value of that entry is “Directory,NotIndexed” so returns false.

Remote debugging

If you have problems remote debugging then make sure you check all the boxes in the Control Panel\All Control Panel Items\Windows Firewall\Allowed Programs screen.

You may or may not have two entries, I don’t know what causes this.


IIS Configuration

We recently needed to make sure that anonymous authentication was enabled (at the IIS level) for an application, regardless of the defaults or configuration of the server the application was being installed on.

To do this you can add the following (as a sibling of ) in the Web.config to make the required IIS authentication settings explicit:

            <anonymousAuthentication enabled="true" />

This will override any settings made in the IIS Manager and the applicationHost.config file.

Whilst on this subject, it’s worth mentioning that you can also configure IIS on the command line using something like this:

appcmd.exe set config "Contoso"

There is lots more inforomation about the various settings here:

However, we hit a slight snag with this.

Although we can put the setting in the web.config, the default IIS permissions prevent this particular set of settings from being modifed in the web.config unless you explicitly enable these settings to be delegated to the web.config.


Given that anonymous authentication is enabled by default (unless we’ve changed it as part of the machine image) then for this particular case we felt that it would be simplest just to assume that IIS is set up correctly. We would soon notice if this wasn’t the case.

The better long-term solution would be to make sure that we set up the IIS delegation permissions as part of machine/image setup – to allow us to configure this setting and others in the web.config. This can be done via the command line so could be part of a server setup script.

Flotr2 charting library

Another candidate for HTML/JavaScript charting, that’s a bit higher-level than d3.js or Raphael:

Adding the Visual Studio 2010 Command Prompt variables to your PowerShell profile

If you add the following to your PowerShell profile then you’ll have access to all the commands only normally available by opening the Visual Studio 2010 Command Prompt:

# Set environment variables for Visual Studio Command Prompt
# Based on:
pushd 'c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC'
cmd /c "vcvarsall.bat&set" |
foreach {
  if ($_ -match "=") {
    $v = $_.split("="); set-item -force -path "ENV:\$($v[0])"  -value "$($v[1])"
write-host "`nVisual Studio 2010 Command Prompt variables set." -ForegroundColor Yellow

Your PowerShell profile will be somewhere like this:



I’d not come across this until today, when I was having problems installing some printer drivers. It lets you list and remove printer drivers very easily.

Just run this: printmanagement.msc

msysgit conflict with Subversion

I’ve got msysgit installed, with the bin directory in my PATH.

Unfortunately msysgit uses svn 1.4.6 still, so when I was running svn on the command line it was finding the older msysgit version first, not the newer version that’s part of TortoiseSVN.

There’s a WontFix bug on the msysgit tracker:

Shuffling the order of the PATHs has solved the problem for now.

“DateTimeOffset should be considered the default date and time type for application development”

If you’re in the habit (like I was until recently) of using the DateTime data type whenever you need to represent a date, time or timestamp then I strongly recommend reading this MSDN article:

Choosing Between DateTime, DateTimeOffset, and TimeZoneInfo

The main points are:

  • Only if a DateTime value represents UTC does that value unambiguously identify a single point in time regardless of the system or time zone in which the value is used.
    • The DateTimeOffset structure represents a date and time value, together with an offset that indicates how much that value differs from UTC. Thus, the value always unambiguously identifies a single point in time.
      • The DateTimeOffset type can be used to unambiguously define the meaning of “now”, to log transaction times, to log the times of system or application events, and to record file creation and modification times.
        • These uses for DateTimeOffset values are much more common than those for DateTime values. As a result, DateTimeOffset should be considered the default date and time type for application development. </ul> It’s worth also mentioning that recent versions of SQL Server support an equivalent type, so you can easily persist this type in databases without any conversion: datetimeoffset

Why we stopped using the Microsoft Sync Framework

Somebody on Stack Overflow recently asked for reasons why I wouldn’t reccommend using the Microsoft Sync Framework. Below is some feedback which I sent to the Sync Framework team at Microsoft which covers this fairly well and may be useful to other people considering using the Sync Framework in non-database projects.

We originally chose the Sync Framework as we were looking for something to produce a quick prototype of a tool which allowed file synchronisation from a Windows filesystem to Windows Azure Blob Storage. We found an example provider for Azure and we used this (and modified it) along with the FileSyncProvider to achieve our goal. It had been working okay in basic situations and was fine for the prototype but as the prototype developed into a beta release of the product we were finding it getting in the way of progress, primarily because when strange behaviour occurred it was very difficult to understand what the Sync Framework was doing under the covers – debugging was very difficult. We came across the problem which this case refers to and realised that we had come as far as we could with the Sync Framework, due to changes in the original requirements from our product owner. The original benefit of using the Sync Framework (quicker to get started) was being outweighed by the restrictions it placed on what we were trying to do. Our requirement changes meant that our synchronisation scenario was much simpler than originally thought and we decided that we no longer needed to use the Sync Framework.

The things that we found challenging about the Sync Framework:

I’m sure there are solutions to most of the above but I think the general feel among my team was that the Sync Framework was perhaps too powerful/complex for our needs and that a custom solution developed internally would give us the flexibility we needed.

The New Efficiency: The UK Technical Launch of Windows 7, Windows Server 2008 R2 and Exchange Server 2010

Tuesday was the UK Technical Launch of Windows 7, Windows Server 2008 R2 and Exchange Server 2010 at Wembley Stadium. The weather was pretty grim but it was good to finally walk down Olympic Way for the first time and see the arch coming into view.

Olympic Way

Although the event was aimed at “IT Pros” rather than developers I figured this event would be a good way of finding out what’s new and what I, as a developer, might be able to work with in the near future. There was also the bonus of a free copy of Windows 7 Ultimate for turning up which helped make the peak travelcard and the day off work a bit less painful.

Below are some of the highlights from my perspective as a developer:

**XBox 360s

** For some reason the Wembley conference centre is full of those XBox 360 stands. I played a bit of Need for Speed: Shift and then some Halo 3: ODST while waiting for the first session. Not a bad way to start the day.

Twittering and texting

I was impressed that Microsoft had thought to suggest a Twitter hashtag (#MSWembley) to use so that everyone could keep track of tweets related to the event. They were also monitoring it for feedback and as a way of asking questions which was a nice idea. There was also a text number that you could use for questions. Unfortunately all the sessions seemed to overrun so there wasn’t any time for questions in the sessions I went to.

Microsoft Hyper-V Server 2008 R2

Although it’s been out a while, the R2 release seems to be much improved. I was impressed with the live migration of a virtual machine from one server to another with only a very short pause, very impressive stuff to see. I’m not sure if it’s a new feature or not but it was also useful finding out about P2V (Physical to Virtual) migration. I’m fairly sure VMWare came first with most of this stuff but that doesn’t come with my TechNet subscription!


Although I use virtual machines a lot for testing and development I’d not thought about some of the many other business uses for virtualisation. One of the most interesting ones was for the police – for security they have to have seperate systems for accessing certain information databases. In the past this would be done by having physically seperate machines on seperate networks. Now they can just have a dumb terminal which remote desktops into banks of virtual machines, all running Windows 7 of course!

Exchange Server 2010

There are some nice new features with this release. While you’re composing a message you get a warning if someone on the recipient list is out of office, before you send it – a nice potential timesaver. You can create your own customisable alerts too e.g. a warning if you’re sending a mail externally or if it contains certain keywords. The web interface now has threaded conversation support, and works in Firefox just as well as in IE. And finally the beginning of the end of PST files which I know can be a nightmare.

Me at Wembley

Training and events I’ve been to

For the last few years I’ve been trying to keep a list of all work-related training and events I’ve been to. I recently updated this and thought it might be interesting to post it here.

Events are shown in chronological order, newest first.**


Vista Squad: Scott Guthrie – ASP.NET MVC Special Event

Friday 3rd July 2009, 13:00 – 16:00

Microsoft, Thames Valley Park, Reading

London DotNet User Group: Silverlight 3

Thursday 2nd July 2009, 18:30 – 21:00

MRM London, 76-80 Southwark Street, London

Speaker: Scott Guthrie

UK SQL Server User Group: Understanding ADO.NET Data Services, Windows 7 features in-depth

Wednesday 13th May 2009, 17:30 – 21:00

Microsoft, Thames Valley Park, Reading

Speakers: Mike Taulty, James O’Neill, Viral Tarpara

WebDD 2009

Saturday 18th April 2009, 09:30 – 17:00

Microsoft, Thames Valley Park, Reading

DeveloperDeveloperDeveloper (DDD7)

Saturday 22nd November 2008, 09:00 – 17:30

Microsoft, Thames Valley Park, Reading

FoWA 2008 – Expo & Diggnation Live

Friday 10th October 2008, 19:30 – 00:00

ExCel, Royal Victoria Dock, London

Vista Squad: “First Blood Part II” (How to be a Geek 2.0)

Wednesday 17th September 2008, 18:00 – 21:15

Speakers: Viral Tarpara

Microsoft, Victoria, London

SQLBits Cubed (III)

Saturday 13th September 2008

University of Hertfordshire, Hatfield

Heroes Happen Here

Wednesday 19th March 2008, 09:30 – 19:00

The ICC, Birmingham

Microsoft UK Launch: Visual Studio 2008, SQL Server 2008, Windows Server 2008

Microsoft’s Web Platform. IIS7 and ASP.NET 3.5

Tuesday 8th January 2008, 18:30 – 21:20

Microsoft, Thames Valley Park, Reading

IIS7, Windows Server 2008, Visual Studio 2008, LINQ, ASP.NET 3.5

MSDN: What’s new in Visual Studio 2008 and .NET Fx 3.5 for the Web Developer

Tuesday 2nd October 2007, 18:30 – 21:20

Microsoft, Thames Valley Park, Reading

Microsoft MIX:UK 07

Tuesday 11th – Wednesday 12th September 2007, 09:30 – 17:30

Congress Centre, London

DeveloperDeveloperDeveloper (DDD5)

Saturday 30th June 2007, 09:30 – 17:00

Microsoft, Thames Valley Park, Reading

IET Berkshire: The Sony PlayStation 3

Wednesday 21st March 2007, 19:00 – 21:00

Palmer Building, Whiteknights, The University of Reading, Reading, RG6 6AH

DeverloperDeveloperDeveloper (DDD4)

Saturday 2nd December 2006, 09:30 – 17:00

Microsoft, Thames Valley Park, Reading

BCS Berkshire: The ‘Open versus Closed’ Debate

Tuesday 14th November 2006, 19:30 – 21:30

John Nike Theatre, Agriculture Building, Whiteknights, The University of Reading, Reading, RG6 6AH

The Web: Designing and Developing Compelling Sites and Applications

Tuesday 19th September 2006, 18:30 – 21:15

Microsoft, Thames Valley Park, Reading Atlas, ASP.NET, IIS7, Expression Web Beta 1, WPF/E

DeveloperDeveloperDeveloper (DDD3)

Saturday 3rd June 2006, 09:30 – 16:40

Microsoft, Thames Valley Park, Reading

MSDN Technical Briefing: SQL Server 2005 for SQL Server 2000 Developers (Level 200)

Wednesday 26th October 2005, 09:30 – 16:30

Microsoft, Thames Valley Park, Reading

DeveloperDeveloperDeveloper (DDD2)

Saturday 22nd October 2005, 09:30 – 17:30

Microsoft, Thames Valley Park, Reading

Programming a Microsoft SQL Server 2000 Database (M2073)

Monday 5th – Friday 9th September 2005

Interquad, Thames Tower, Reading

Microsoft TechEd Europe 2005

Monday 4th – Friday 8th July 2005

RAI, Amsterdam, The Netherlands

Pre-Conference Seminar: The Zen of ASP.NET 2.0

IEE: Opening Windows into Microsoft

Monday 27th June 2005, 18:30 – 21:00

Microsoft, Thames Valley Park, Reading

Exploiting service oriented plumbing (Olive Presland)

Windows embedded: Desktop to device (Dave Baker)

Programming with Microsoft ADO.NET (2389B)

Wednesday 22nd – Friday 24th June 2005

Interquad, Middlesex St Centre, London

An Introduction To C# and The .NET Framework

Tuesday 14th – Wednesday 15th June 2005

The University of Reading

Speaker: Philip Stears

Programming the Microsoft .NET Framework with C# (M2349)

Monday 9th – Friday 13th May 2005

Interquad, Tabernacle Street, London

Project Management

Thursday 14th – Friday 15th April 2005

Centre for Staff Training and Development, The University of Reading

Speaker: Alan Rousseau, Steve Walker & Associates Ltd

Thames Valley User Group .NET – Second Meeting

Tuesday 7th December 2004

Microsoft, Thames Valley Park, Reading

Speaker: Eamon O’Tuathail, Clipcode

Assertive Communication Skills

Thursday 28th October 2004

Centre for Staff Training and Development, The University of Reading

Speaker: Vicki Evans, Vision Training and Development

TCS Module 3

Monday 11th – Thursday 14th October 2004

Quality Inn, Warwick

Speakers: Dawn Husemann, Paul Ford (Insight People Development)

TCS Module 4 (Strategic Business Review – Globalisation)

Monday 4th – Thursday 7th October 2004

Quality Hotel, Chesford Bridge, Kenilworth, Warwick CV8 2LN

Speakers: Paul Taylor and Andrew Savage, Pi Management

ZDNet UK IT Priorities Conference

Tuesday 28th September 2004, 09:00 – 17:00

The Park Lane Hotel, London

An Introduction to SharePoint Portal Server 2003

Thursday 1st July 2004, 09:00 – 17:00

Deverill, The Holiday Inn, Swindon

Thames Valley User Group .NET – Inaugural Meeting

Monday 21st June 2004

Microsoft, Thames Valley Park, Reading

Microsoft Research Academic Days in Dublin

Wednesday 13th – Friday 16th April 2004

Leading academics, faculty, and PhD students from the United Kingdom and Ireland. An opportunity to learn about different aspects of Microsoft .NET and future technologies and to meet other Academics and people from Microsoft Research.

BCS: Applying XML in the medical field

Wednesday 25th February 2004, 19:30

Gordon Lecture Theatre, Whiteknights, The University of Reading, Reading

Speaker: John Chelsom

TCS Module 2

Sunday 4th – Friday 9th January 2004

Limpley Stoke Hotel, Bath, Avon

Speakers: Insight People Development

TCS Module 1

Sunday 7th – Thursday 11th December 2003

Limpley Stoke Hotel, Bath, Avon

Speakers: Insight People Development

BCS: Linux

Wednesday 19th November 2003

Gordon Lecture Theatre, Whiteknights, The University of Reading, Reading

Speaker: Roger Whittaker, SuSE

Turning off the beep on a Dell Latitude D620

  1. Right-click on “My Computer”, then click “Manage”
  2. Click on “Device Manager”
  3. Click on “View > Show hidden Devices”
  4. Click on “Non-Plug and Play Drivers”. Then right-click on “Beep” and choose “disable”.
  5. Restart

Source: – see the comments

Filter for WinMerge

A lot of web development tools like Dreamweaver and FrontPage like to create annoying files and folders throughout a build. I’m sure they’re useful to somebody, but they just get in the way when you’re doing a comparison of two builds.

I thought I’d share a basic filter I’ve made for WinMerge, which makes it ignore any junk files created by Dreamweaver, FrontPage and Windows.

**Folders ignored:


  • _vti_cnf
  • _notes

**Files ignored:


  • Thumbs.db
  • _vti_cnf
  • dwsync.xml

I’ll probably add more files to this list as I discover them, but for now please feel free to download the filter. If you have any suggestions, please add a comment to this post.

Using SysInternals Process Monitor to troubleshoot permissions problems

I recently found a good use for Process Monitor which I hadn’t thought of before:

If you ever have problems with software not working and you suspect it may be a permissions issue, run Process Monitor while the software is running and look for any ACCESS DENIED messages in the Result column. It’s much easier than guessing the permissions you need to set.

Note: Process Monitor is an enhanced replacement for Filemon and Regmon but Filemon would still do the job.

jQuery and SWFObject

If you have any problems with jQuery and SWFObject conflicting, put the SWFObject code in the $(document).ready event handler.

ASP.NET debugging in Firefox – resources not loading

For a while I’ve had trouble with Firefox when using a local IIS 5 install to test/debug an ASP.NET application. Some of the images and other resources weren’t loading, almost as if a limit had been hit. It would also show a login dialog box.

The solution is to go to about:config in Firefox and make sure that network.http.keep-alive is set to true.

The reason I’d set it to false in the past was so I could test a load balanced cluster.

Update: I’ve since found that the fix above doesn’t always work.

Something else which almost fixes this problem is to disable HTTP keep-alives via the site properties in IIS. Unfortunately this has the side effect of stopping debugging working in Visual Studio 2003.

Can’t execute code from a freed script

Another good reason to hate Internet Explorer 6 and it’s hopeless error messages.

If you ever get the JavaScript (or should that be JScript) error “Can’t execute code from a freed script” – try moving any meta tags in the head so that they’re before your script tags.

Source: CodeThat

Globalisation/Globalization and Charity IT Resources

While tidying my bookmarks today, I found a load of sites I’d used for my MSc. I thought I might as well post them here before I delete them as it took me a while to collect them all and they may be useful for somebody somewhere.

You might also like to find out more about my Msc Dissertation.

WordPress and Gallery 2

As you may have noticed, this site now runs on WordPress and Gallery 2. I then integrated the gallery into WordPress by using the WPG2 plug-in.

The next job is to do some design modifications and skinning so that it doesn’t look like every other WordPress blog.

Update: I’ve just upgraded to WordPress 2.0.1 so the Gallery integration isn’t all there yet.

Voluntary Sector Project of the Year

After being shortlisted a month or so ago my project has been awarded Voluntary Sector Project of the Year at this years Computing Awards for Excellence at Battersea Park Arena, hosted by Jack Dee. There’s a press release on the GAP website for more information and some photos in the gallery.

Update: There’s now a press release on the University of Reading website, currently featured on the front page and news page.

RealPlayer Enterprise

If you hate RealPlayer as much as I do then you might find RealPlayer Enterprise useful. It’s had most of the annoyances removed and although you have to register to download it it doesn’t try and take over your computer quite as much when you install it.

NVidia ForceWare Network Manager vs. SonicWall VPN Client

After a lot of trial and error I’ve finally come to the conclusion that the NVidia ForceWare Network Manager can cause problems with the SonicWall VPN Client. I can’t say for certain as there are so many other things involved but after uninstalling it everything else seemed to start working as it should. I had the firewall disabled but it was still doing something to stop some VPN traffic going through. There’s some more detailed information on Experts Exchange

WRT54G-UK Firmware

I recently bought the UK edition (WRT54G-UK) of the Linksys Wireless-G 54mbps Broadband Router. Recently it seems to have either been crashing, or not picking the connection back up again after it’s dropped. Even though it’s only a month or so old, I decided it was probably time for a firmware upgrade. The label on the bottom of mine said is was Version 2. The firmware was version 2.2.07.

As there are differences between the UK and US models, I started by looking on the Linksys UK support site which warns you that “If you use the US versions of your wireless product’s drivers or firmware on European wireless products, you may lose the ability to use high channels (channels 12 and 13).” Unfortunately I couldn’t find any European firmware updates for Version 2 of the hardware. As usual, international support is lacking.

At the time of writing, the US Linksys site has an update for the WRT54G Version 2, which upgrades the firmware to 3.03.6. I was a bit unsure about installing this but it seems to be working fine so far.

If anyone has tried the European 3.03.9 Firmware on a Version 2 WRT54G, I’d be interested to know.

Update (26th February 2006): I’ve just updated to the US 4.20.7 Firmware and everything seems to be working fine. Again, channels 12 and 13 aren’t available but it’s no big loss for me. The new firmware adds WPA2 support as well as the SecureEasySetup button.

Antec SLK3000B and AcoustiPack

I recently bought a new case, the Antec SLK3000B. The reason I’m posting this is that some people might be interested to know that the AcoustiPack™ Pre-cut kit for the Antec SLK3700-BQE is a perfect fit (with a couple of exceptions).

  • The left-hand side panel of the SLK3000B has two new ventilation holes. You just need to cut two holes in the foam before fitting it.
  • The foam block that fits under the hard drive caddy is too large because the design has changed significantly since the SLK3700-BQE. It’s not the end of the world though.
  • The air filter block at the front needs a couple of minor chunks cutting out because the cabling from the front of the case has moved slightly.

So I’ve still got two identical foam blocks left (one of which isn’t on the fitting instructions sheet) which I’ll probably try and find a use for once I can find a way of cutting them accurately. I’ve not got the rest of the computer up and running yet, but the AcoustiPack kits are well designed and I was impressed with the instructions.

Finally, I have a blog

I thought it was about time I gave this a go. I hope you enjoy reading it, but don’t expect anything more than a few technical notes or interesting links.

I’m using the Serendipity Weblog System