SteGriff

Blog

Blog Index

Welcome!

This blog is my notebook of solved problems, thoughts, and stuff I made.

It runs on Jekyll, and used to be powered by Upblog, hence the name. I have an old wordpress blog at stegriff.wordpress.com

All 155 posts

Getting Enum attributes - fast!

Getting Enum attributes - fast! Sometimes you want to attach extra information to Enum members so that you can get, for example, a user-facing string representation of the underlying value. There are a number of Stack Overflow answers and the like which will tell you how to do this with...

A quirky way to handle dependencies on artifacts from other solutions

A quirky way to handle dependencies on artifacts from other solutions Say you’ve got two big .Net solutions: Enormous legacy codebase including lots of patterned, reusable code (200 projects) Internal dependencies which cascade; i.e. WarehouseService depends on WarehouseBusinessModel depends on WarehouseDataModel New front layer partially dependent on the old modules...

My project depends on two different EntityFramework data layers with different versions of Entity Framework

My project depends on two different EntityFramework data layers with different versions of Entity Framework …Get me out of here! So how can we make a .Net solution work with more than one version of Entity Framework in the mix? It’s a horrible problem; here are my comprehensive field notes....

What no-one tells you about getting started with BenchmarkDotNet

What no-one tells you about getting started with BenchmarkDotNet BenchmarkDotNet is a package for benchmarking (timing) .Net routines. It does correctly what you would do wrong if you were trying to time code yourself using System.Diagnostics.Stopwatch and gaffer tape. Like, it does timed rounds of volume testing, warmups, and JIT...

How to use Moq

How to use Moq This is more of a ‘Note to Self’ article… something else I forget a lot… :) First, install the Moq Nuget package. Example which always returns the same value Let’s use the Mock class. You can only mock an interface, never a concrete type. // Get...

WebAPI with NinjectHttpApplication the new way for 2019

WebAPI with NinjectHttpApplication the new way for 2019 There’s conflicting advice on how best to integrate Ninject with ASP.Net WebAPI. You can use NinjectWebCommon.cs with WebActivatorEx to start up your injection, or you can avoid having any of that code by making your application inherit NinjectHttpApplication. This new way suits...

Reasons a breakpoint will not be hit

Reasons a breakpoint will not be hit 1. You’re not in Debug config Build configurations other than Debug, by default, have “debugging info” turned down or off, and don’t define the DEBUG or TRACE constants. You can change this for a configuration on a project: Right-click the Project and go...

Scrub bin and obj

Scrub bin and obj When you run Clean Project or Clean Solution in VS, it doesn’t delete everything from bin and obj; it just removes the artefacts which VS would normally build. So the output from external tools or previous builds might be left alone. To do a full ‘scrub’...

Add Config Transform in Visual Studio

Add Config Transform in Visual Studio This is a basic thing but I forget how to do it from time to time. You may want to add a Config transform (i.e. Web.Something.Config) to a project in one of these situations: A) You added a new project to a solution with...

My First PWA

My First PWA A Progressive Web App is a website which you can pin to your homescreen and use offline like an app. To make a website into a PWA, you have to add some metadata and a script. I’m gonna boil these down to the absolute minimum - this...

Azure API Management

Azure API Management I’m looking into Azure API Management (APIM) to find out how I can wrap my contemporary WCF services from the previous post. Process Make the resource I made a new Azure API Management service resource in the Azure portal. Import APIs via OpenAPI/Swagger/WSDL I added my APIs...

WCF from scratch in 2019

WCF from scratch in 2019 I work with a (big!) layer of WCF services and I want to know more about them and how we can adapt for the future. So I’m doing a deep dive! If I switch tenses in this post, apologies. It’s part stream-of-consciousness and part review....

How to use Git behind a Symantec Threatpulse MITM proxy/firewall

How to use Git behind a Symantec Threatpulse MITM proxy/firewall In some corporate environments, you might be behind a proxy, like Symantec Threatpulse, which intercepts would-be-secure traffic(!), re-signing it before delivery with a different CA. Of course this causes all kinds of problems with the “certificate chain”. You might see...

Mothballing a mudball (or, how I moved from custom software to Jekyll)

Mothballing a mudball (or, how I moved from custom software to Jekyll) In 2014 I gave up on Wordpress and, in the height of my PHP-hacking phase, decided to build some custom blog software with these design goals: Lets me write in Markdown Lets me upload from anywhere with FTP...

Make an animated expanding list/accordion in Vue

Make an animated expanding list/accordion in Vue I had to do a bit of research to put together all the parts for this feature, so it’s worth writing down for future reference I think! Here is a demo: Yeah, I used Taco Bell locations again because it’s handy JSON data...

Notepad++ command to open Git Bash in current directory

Notepad++ command to open Git Bash in current directory To set up this command, open Notepad++ and press F5 (or go to Run\Run...) Paste in the following: "C:\Program Files\Git\git-bash.exe" --cd=$(CURRENT_DIRECTORY) Now you can choose to Save the command as ‘Git Bash here’ or similar, and give it a keyboard shortcut...

Updating Service Reference destroys most members in Reference.cs

Updating Service Reference destroys most members in Reference.cs If you update or add a service reference in Visual Studio and you don’t get all of the methods you were expecting, there was probably a silent error within the svcutil process which adds the reference. You can check what the error...

Intellisense in SSMS doesn’t work any more

Intellisense in SSMS doesn’t work any more In my last job Intellisense stopped working in SSMS and I just lived with it for years. When I came to a new office, it worked for a while, and then stopped one day. But it’s so much extra typing, I decided to...

Host HTML on GitHub Pages without using git

Host HTML on GitHub Pages without using git This is a companion post for easy and free ways to host a static website. Here’s how you can use the GitHub web interface to make a new HTML website without touching git or the command line! Open GitHub in your browser,...

Easy and free ways to host a static website

Easy and free ways to host a static website I like to tell people to keep a technical blog because it’s good for your skills, your employer, your employability, the tech sector, and the economy at large. So today I want to share ways of starting a blog that range...

Windows Service starts multiple instances of out-of-process local COM Server

Windows Service starts multiple instances of out-of-process local COM Server Here is a problem I can’t solve. I have a 32-bit client application which calls in to a third party out-of-process COM server (also 32-bit). My client application is a C# app built on Topshelf, so it can run either...

Magically make an Azure AD user into a local machine admin

Magically make an Azure AD user into a local machine admin If you have standard Azure AD, it’s difficult to make a user into admin on their machine without making them a hardware/global admin across the whole Azure estate (which is not desirable). Through a chain of tricks, it’s possible....

Unit/Integration testing a project which calls an ASP.Net MVC site

Unit/Integration testing a project which calls an ASP.Net MVC site In Visual Studio, running Tests does not run your Startup Projects. This is a pain if you’re integration testing, and your client program calls an endpoint of your ASP.Net MVC or Web API site, because the site needs to be...

Class Not Registered

Class Not Registered I wrote a class which was COM-exposed and registered it using RegAsm. It was a 32-bit library on a 32-bit machine, being called by a 32-bit caller. Yet when the calling program tried to make an instance, it got the error “Class not Registered”. My Solution In...

How to create an Azure Active Directory Application and a Service Principal

How to create an Azure Active Directory Application and a Service Principal You can use AAD Applications to add single-sign-on capabilities into your web app. Another use is to authenticate your own program code to call the Azure APIs, or to talk to Kudu (the source control and extension system...

Failure to cast an object from Azure TableOperation.Retrieve

Failure to cast an object from Azure TableOperation.Retrieve If you use TableOperation.Retrieve in the Azure Table API, you might struggle to cast the result object into your preferred TableEntity type. In my experience, this is because of the selectColumns which you specified (or forgot to specify) in the Retrieve operation....

Set up log4net in 2018

Set up log4net in 2018 log4net is a logging library for .Net projects, it can be a bit tricky to set up, so here are my personal notes: 1. Install the package Either from the NuGet Package Manager or with Install-Package log4net 2. Add a log4net.config Create a new file...

Base64 Encode and Decode Unicode (UTF-8) strings in JavaScript and .Net

Base64 Encode and Decode Unicode (UTF-8) strings in JavaScript and .Net The Base64 functions in JavaScript are made for ASCII values only. MDN has an excellent code sample for making this work with what they label UCS-2, but the original source labels as UTF-8. Hmm… in any case, it makes...

How to do a 301/302 redirect in an Azure Function App with HttpResponseMessage

How to do a 301/302 redirect in an Azure Function App with HttpResponseMessage Azure Function Apps’ use the HttpRequestMessage and HttpResponseMessage classes introduced with .Net Fx 4.5 (which are heavily used in .Net Core Web API projects). It takes a little bit of re-learning to do the normal web stuff...

Solve problems with using Office 365 SMTP in an Azure Web/Function App

Solve problems with using Office 365 SMTP in an Azure Web/Function App Office 365 uses an SMTP server like any other, but we got snagged on some weird gotchas for a long time, so here’s a blog post. The turnkey solution for mail in Azure is SendGrid, but in some...

Paprika For All

Paprika For All When I first made Paprika in 2015, I wanted to give everyone access to it. I am very excited to announce that from today, anyone can try Paprika with their own custom grammars, in their browser, for free, without even creating an account! I hope that it’s...

Adding LetsEncrypt to an Azure Function App using another Azure Function App

Adding LetsEncrypt to an Azure Function App using another Azure Function App Using Let’s Encrypt has always seemed a bit daunting but I finally bit the bullet and tried it out in Azure. A guy called Simon J.K Pederson has written some awesome turnkey extensions (Kudu stuff) for grabbing LE...

The Many Microsoft Partner Centers

The Many Microsoft Partner Centers At Village, we’re Microsoft Partners. Occassionally I need to check in on our competencies, qualifications, benefits etc. but there are many different portals that let you do this. So here are the ones I can find: Membership Insights (PowerBI) - my new fave Direct link:...

State Machine from Scratch

State Machine from Scratch In most languages and frameworks, good State Machine libraries exist, like Stateless. Use them when possible. When it’s not possible, there are principles you need to have in your head before you start. tl;dr: A FromState can go to a ToState when some Trigger causes a...

Enable ligatures and emoji in Notepad++

Enable ligatures and emoji in Notepad++ By default, emoji don’t work very well in Notepad++ and font ligatures don’t work at all. I have pieced together this guide from other people who have worked on the problems, notably this GitHub issue about ligatures in Notepad++ and this newsgroup post about...

AngularJS Quick Start Examples

AngularJS Quick Start Examples AngularJS is a little out of vogue now because little brother ‘Angular’ (just Angular) has taken over. However, after working with it under duress for a while, I only recently discovered the beauty of AngularJS. I’m not a big fan of starting every new project with...

Windows App Certification Kit - cannot install package because a different package with the same name is already installed

Windows App Certification Kit - cannot install package because a different package with the same name is already installed When running the ‘Windows App Ceritification Kit’, you get an error message like this: Windows cannot install package 780a2c2f-f4be-4a7d-83bf-212522026da9_1.0.0.0_neutral_~_m56gs6vrxbyza because a different package 780a2c2f-f4be-4a7d-83bf-212522026da9_1.0.0.0_x64__gf73qhakswkrp with the same name is already installed....

My POST Body is not being received

My POST Body is not being received This one trips me over all the time, lately when I’ve been triggering a HTTP POST action from Microsoft Flow. Symptoms You’ve configured a POST request something like this: Method: POST URL: https://my-service.example/Surface/DoThing Body: accessKey=NyahNyah But your tools/logs reveal that when it the...

Eraser, Webroot SecureAnywhere, and Windows 10

Eraser, Webroot SecureAnywhere, and Windows 10 Nasty, unintended interactions between software packages are the worst thing about software. Here’s one for the list! The short version: On Windows 10 Fall Creators Update, Webroot SecureAnywhere will lock files when they are modified or when deletion is attempted. There is a report...

Let’s make a NuGet Package

Let’s make a NuGet Package I wanted to make a NuGet package for Paprika.Net so I’ve documented the process here to make it easy for beginners to follow along! This guide is based on publishing one project alone, if you have a more complex need then you should read about...

.Net Framework, Core, and Standard

.Net Framework, Core, and Standard The distinction between these three concepts of .Net Framework, Core, and Standard, has long lay in a foggy corner of my brain saying “Danger! You do not understand the future of the primary technologies you use for everything!”. So I was glad when recently I...

Why isn’t my .Net Core Console App building an exe

Why isn’t my .Net Core Console App building an exe Your csproj or vbproj needs to include RuntimeIdentifiers for the platforms you want to target, and then you need to use the Publish feature (not just build) to export for your target platform. <RuntimeIdentifiers>win10-x64;osx.10.11-x64</RuntimeIdentifiers> Like regular .Net apps, .Net Core...

New-AzureStorageQueue : No queue endpoint configured

New-AzureStorageQueue : No queue endpoint configured If you create an Azure Storage Account with a replication setting of ZRS (Zone Redundant Storage) then you will not have access to Queues or Tables; only Blobs. Here is an example of a failing PowerShell: # Failing test of ZRS $storage = New-AzureRmStorageAccount...

Discovering Azure Resource Types

Discovering Azure Resource Types I was inspired by a post I found by Mitch Denny, called Azure Resource Types where he describes a programmatic process for uncovering every AZure resource type used in the Resource Template Gallery. I wanted to repeat his work because it was done almost exactly 3...

Non-blocking wait or sleep in Office VBA

Non-blocking wait or sleep in Office VBA There are a lot of ways to pause VBA execution when scripting Office and they’re nearly all bad and wrong. The ones I’ve heard, from worst to best: Loop with Application.Wait - this will completely freeze the Office app Loop and call the...

VSTS Build - Access to the registry key … is denied

VSTS Build - Access to the registry key … is denied If you have a project which is registered for COM Interop then it will not build in Visual Studio Team Services (VSTS), complaining with an error like: C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets (4640, 5) C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(4640,5):...

Migrate MSUnit tests Accessors to PrivateObjects

Migrate MSUnit tests Accessors to PrivateObjects MSUnits tests are fussy at the best of times and don’t run in a number of popular environments, such as Travis. If you have invested a lot into white-box MSUnit tests already and need to give your tests better compatability (with Visual Studio Online/Team...

Building Uncle Robot

Building Uncle Robot Tweets by RoboUncle This is an article for my muggle friends, to describe how I built my twitter bot, uncle robot. How does it write tweets? In 2015, I created a language called ‘Paprika’ which is useful for generating random arrangements of language. How do you just...

Visual Studio 2017 underlining all MVC code in red even though it builds

Visual Studio 2017 underlining all MVC code in red even though it builds This project builds fine, but in VS 2017 it shows a lot of errors, which is counterproductive for developers. The following is a reduced set of instructions from the long-titled Microsoft article, How to Upgrade an ASP.NET...

Easy API testing without Postman

Easy API testing without Postman The big name in API testing is usually Postman. It used to be a Chrome extension and now it’s standalone, but as a Firefox user I never got into it. A few of my colleagues use it for ad-hoc testing of APIs. Today I came...

“The specified dimension is not valid for the current chart type” on ChartObject.Duplicate

“The specified dimension is not valid for the current chart type” on ChartObject.Duplicate Background We have an Excel Add-In product which builds charts (among other things). Last week (Aug 2017), the chart generator suddenly stopped working in Office 2016 for two developers. One developer who uses Office 2010 was unaffected....

Link between Azure subscription and Azure AD

Link between Azure subscription and Azure AD I wanted to improve on a diagram I found in the docs for Azure RBAC which provides a really clear illustration of how Azure administrative components are connected. You can see my version here/above, or click through for a larger version. The original...

My First PowerShell

My First PowerShell A guide to the bits that I needed when starting to use PowerShell, particularly in the context of Azure. Not a complete guide to PowerShell :) For that, try these: (MSDN) PowerShell Fundamental Concepts Effective Windows PowerShell: The Free eBook Learn PowerShell in a Month of Lunches...

Azure Resource Templates - Crash Course

Azure Resource Templates - Crash Course Azure resource templates are a declarative JSON file which describes a load of resources which you want to create on an Azure subscription. They are generally triggered through PowerShell. If you haven’t used Azure PowerShell before, follow the first two points from this simple...

Authorise a group of developers to create new Azure resources

Authorise a group of developers to create new Azure resources Our company Azure hosts an Azure AD which we use for Office 365 and also as the authority for who can do what in Azure itself. A few staff are set as Azure admins, but many other developers need the...

How I write a blog post

How I write a blog post Uhhhhh, this post is a bit meta in a silly way that I might regret but it looks like I’m going to Do it Anyway. Since last post was the 100th post on this site (which means I post here on average every week...

BuildShadowTask task failed unexpectedly after merging Test Projects

BuildShadowTask task failed unexpectedly after merging Test Projects I merged two branches of a solution which each had new MSUnit test projects in them. After the merge, this build error was raised: Error 91 The “BuildShadowTask” task failed unexpectedly. System.NullReferenceException: Object reference not set to an instance of an object....

Deploy a Custom Microsoft Teams bot in 15 minutes

Deploy a Custom Microsoft Teams bot in 15 minutes You can make a ‘Custom bot’ for Microsoft Teams without having to use the full-blown Microsoft Bot Framework. The requirements are dead simple which makes this a really fun entry point to bot-making! First you might want to check out these...

Highlights from Microsoft Azure 20532

Highlights from Microsoft Azure 20532 Maybe you read my previous post about taking the Azure 20532 course with QA. Here are my highlights from the course: 1. Web+SQL Using the Web+SQL template, you can deploy a web app and Azure SQL database together which have an affinity for each other....

Developing Azure Solutions course 20532 at QA

Developing Azure Solutions course 20532 at QA May 2017 Last week I got to go on a Microsoft Azure training course, courtesy of my employer Village Software. The course was run by QA in their Manchester venue, and the experience was really good! So I wanted to write a little...

Junior again

Junior again We’re building an extension at the moment. Dad is the brains, and my wife and I are labourers. It’s funny, every time Dad has to remind me again to do something that he’s already asked me a dozen times to anticipate in advance, I think to myself “dang!”...

Anatomy of a building

Anatomy of a building I never realised there were so many types of brick. Building the extension has taught me a lot about what actually goes into a building, and where, and why. A lot of the things you learn are like answers to questions you’d never thought about. Like,...

Switch to, merge, and push a branch in git

Switch to, merge, and push a branch in git To switch to a branch, use checkout. It’s important that you don’t use the -b option - this creates a new branch even if it already exists on a remote (i.e. in GitHub origin). If you’re used to having different branches...

Jekyll Quickstart

Jekyll Quickstart Jekyll is a static site generator (SSG). An SSG lets you build reusable templates, and write your content in a flexible format like markdown (both of which make it like in a CMS), and compile the source files into static HTML which is then uploaded to the server....

He Carries My Burden We are here to make much of God - to make God look great (which should be easy because he is great). Lent is a opportune time for this, because we have so many options: Doing anything for lent? Yes, I’m giving up chocolate/meat/video games/tv/facebook/food for 40 days because Jesus is such a satisying treasure that I can go without that other thing! You know me, I’m not religious, I just believe that Jesus is the hope of the world, and he is pursuing you because you’re his precious child Yeah, I’m trying to remember every day to ask God to carry my burden, because life is so much better when he’s the one accomplishing everything - he does a much better job. Burdening God is Good When we hesitate to burden God, we are viewing him like a human. Harrassed, ungenerous, reluctant. God joyfully and readily takes on everything we can load on him, because he is a tireless father with a generosity and a holy pity that never end. If our only interaction with God each day is to say at the beginning, “Lord, carry my load, I don’t want it” and at the end, “Lord, you did it, and you did it so well” then look, you made much of God! You fulfilled your earthly purpose today by humbly asking your father in heaven (who is much greater than you) to carry your stress and workload for you and then making a big deal of him when he comes through! Publicly revealing the worth and goodness of God is an act of worship which will help to save the world. Join in! Burden God today!

He Carries My Burden We are here to make much of God - to make God look great (which should be easy because he is great). Lent is a opportune time for this, because we have so many options: Doing anything for lent? Yes, I’m giving up chocolate/meat/video games/tv/facebook/food for...

Tips for graduates

Tips for graduates At Village Software, we hire a good proportion of fresh graduates. After all, everyone needs their first break to get that “3 years minimum experience” that every other software development job requires. I’ve been lucky to be involved in the technical interview process for a few of...

Tiny angular pangram app

Tiny angular pangram app A pangram is a sentence that contains every letter of the alphabet, like “the quick brown fox jumps over the lazy dog”. I set out to make a tiny pangram app this morning in Angular, that would let you type in a box and “tick off”...

Learning about design patterns

Learning about design patterns I’m starting to look into design patterns using a few different resources, so that I can expand my programming knowledge (not just of the patterns themselves but of the deeper OOP and software architecture principles). Hopefully I can also pass on some of the learning to...

Notes on JavaScript public/private

Notes on JavaScript public/private Imagine we want to write a simulation of a House class with some private fields for storing internal information, and some public getters, setters, and other methods, which can use the internal information in a safe way. I’m going to use this as an example to...

Compiling a decompiled ASP.Net MVC website

Compiling a decompiled ASP.Net MVC website We recently took delivery of a codebase with no code… well, it might actually turn out that the original developer comes through but I started this process anyway! Currently the binaries on the FTP server are the only resource available. Set up the environment...

Windows Forms scaling on Surface Pro

Windows Forms scaling on Surface Pro We have been working on an Office Add-in which is primarily being deployed on Surface Pro 3s and 4s. These units all have their scaling set to 200% which presents a High DPI challenge. Here are some conditions unique to our situation: We are...

Keep a technical blog

Keep a technical blog About 20% of the time, when I Duck for the answer to a technical problem online, I find it on somebody’s blog. The other 80% is obviously found on StackOverflow. But software development would be much harder without those people who keep technical blogs/notebooks online! Here...

Wavesurfer.js doesn’t work in Firefox 51

Wavesurfer.js doesn’t work in Firefox 51 wavesurfer.js doesn’t play audio for me in Firefox, unless you set the backend option to MediaElement. Fault description When not working, it will draw the waveform and allow you to click around to move the seek point, but it won’t play any sound. The...

Gilbert Sackerman

Gilbert Sackerman Written 2017-01-23 I am very interested in the artist Gilbert Sackerman, and I’d like to find out more about him. There is not a lot of searchable information about him on the web, so maybe I could find some books one day and gather the stuff that I...

Adding anchored, scaling UserControls to a Windows Form dynamically

Adding anchored, scaling UserControls to a Windows Form dynamically In Windows Forms, you can set the Anchor property on controls so that they “anchor” themselves onto specific edges of the parent Form, so that when the Form is resized, your control also resizes. In complex applications, you will often have...

Merging across seperate repositories in SVN

Merging across seperate repositories in SVN We have a client who has the same product in two repositories; one repository is maintained for the main site, and the other is for developing a subset of backend features. Nevertheless, trunk changes from the site repository need to be merged across into...

ASMX Service raises 500 error and returns binary nonsense

ASMX Service raises 500 error and returns binary nonsense There are a few cases when an ASMX service in ASP.Net can return a 500 error and a load of junk binary data. Here are the probable causes and solutions: “I attach Visual Studio to the running code, but the server-side...

The Explorer’s guide to Las Vegas

The Explorer’s guide to Las Vegas Helen and I had the privelege of a business trip to Las Vegas recently, and as non-gamblers, we wanted to find fun things to do, and to explore without compromising on personal values. Helen had to be in conferences for most of the days,...

My Synaptics Validity Sensors driver keeps reverting

My Synaptics Validity Sensors driver keeps reverting My HP Pavilion laptop has a fingerprint scanner for login. The laptop shipped with Windows 7, but since 8.1 onwards, the fingerprint sensor driver keeps reverting to a screwy version which doesn’t work, and it does this every week (seemingly). To set the...

SVN merge is conflicting files unnecessarily and overwriting pertinent changes

SVN merge is conflicting files unnecessarily and overwriting pertinent changes The problem I was merging trunk changes into a branch and it was overwriting my actual work. This is unusual and not how SVN is supposed to work. Online sources asked whether I had accidentally selected “reintegrate” but I hadn’t....

The rough guide to an easy SVN merge

The rough guide to an easy SVN merge SVN merges can be tricky. We use TortoiseSVN here at work, as do many other .Net development places, so that will be the tool of choice for this guide. This tutorial assumes the merge of a branch into the trunk. You should...

Tail a file in Powershell

Tail a file in Powershell I had to split down a 42 billion line log file. To get the last n lines of a file using PowerShell, like Linux’ tail program does: Get-Content .\file.log -Tail 470000 > output.txt

Umbraco 4 navigation menu with hidden items

Umbraco 4 navigation menu with hidden items Look, I don’t choose to work with Umbraco 4, but sometimes you’re maintaining a legacy system for a client and needs must. A lot of older Umbraco systems just use XSLT for macros like this, but this project is heavy on .Net user...

LINQ is generating SQL with two joins when I only want one

LINQ is generating SQL with two joins when I only want one If you have a lot of conditions in your LINQ statement, sometimes LINQ-to-SQL does it wrong: var query = from pp in Context.ProductPrices where productCodes.Contains(pp.Product.ProductCode) && pp.PriceList == priceList && pp.Product.AccountNumber == customer.AccountNumber select new { Price =...

Where are FileZilla Site Manager entries stored?

Where are FileZilla Site Manager entries stored? To retrieve FileZilla connection details from an old hard disk or PC, go to C:\Users\Username\AppData\Roaming\FileZilla\ and get sitemanager.xml or any other settings file you care for. Replace C with whatever drive letter you want, and Username with your Windows username.

Derived classes and Entity Framework Mapping

Derived classes and Entity Framework Mapping If you wanted to add extra (unmapped) data to an Entity Framework model, you might think to create a derived class to hold the extra fields, but this is a mistake and will cause more problems. The usual way to add unmapped data to...

Approaches to Version Control

Approaches to Version Control Apart from using different technologies, different people and companies take a different approach to how they employ version control. I want to talk about a couple of patterns very briefly. Before we begin The SVN term “trunk” is essentially equivalent to the git term “master”. In...

Outer join without an ‘on’ clause in SQL

Outer join without an ‘on’ clause in SQL You can do an old-style join using a comma , between table selections to perform a full outer join which has no ‘on’ clause. Say you have a table for Ships and a table for ShipAttributes which lets you extend Ship by...

Setting up Native Instruments Komplete 6 for Audacity

Setting up Native Instruments Komplete 6 for Audacity Tags: #GriffWiki This is our family guide to setting up a Native Instruments Komplete Audio 6 soundcard with a voice recording mic. It may be of limited use to outsiders ;) Plug the sound card into the PC via USB The lights...

Select items from a LINQ grouping based on multiple criteria

Select items from a LINQ grouping based on multiple criteria The data Say you have a collection of Ships Logs. var logs = new List<Log>() { new Log(){ Id = 1, ShipId = 1, Message = null, CreatedDate = today.AddMinutes(-4)}, new Log(){ Id = 2, ShipId = 1, Message =...

Quick Reference - .Net File Open Dialog

Quick Reference - .Net File Open Dialog Making a file open dialog can be a bit laborious and I always forget which fields to fill in, so here’s my current copy-pasta for the task. In C# string fileExt = ".xlsx"; string filter = string.Format("Excel files (*{0})|*{0}", fileExt); var loadDialog =...

Postman sets login cookie but my web app doesn’t

Postman sets login cookie but my web app doesn’t I just lost a lot of time on this one! I have a web app written in HTML/Javascript/Angular and hosted by grunt (at localhost:8000), and a back-end API written in C# and hosted by pressing play in Visual Studio (which uses...

Writing .Net Events, the even shorter version

Writing .Net Events, the even shorter version A follow up to my previous quick start for writing C# events. Let’s assume you just want to raise a simple event which can be represented by EventArgs. If not, read the guide linked above. 1. Add a delegate above the class public...

Error in loading DLL - Why doesn’t my VSTO installer work?

Error in loading DLL - Why doesn’t my VSTO installer work? My problem and solution I have a workbook with a significant amount of VBA code, most of which calls methods of a VSTO add-in containing lots of business logic which has been ported from VBA into VB.Net. This works...

Exposing a WebForms usercontrol as a Partial View

Exposing a WebForms usercontrol as a Partial View If you’re like me, you work with ASP.Net MVC and are used to all these new parts and the cool things they offer, but the truth of commercial web development is that sometimes we have to work with and maintain older ASP.Net...

Globals.ThisAddIn is null or Nothing in VSTO Automation Add-In

Globals.ThisAddIn is null or Nothing in VSTO Automation Add-In Scenario You’ve created a VSTO Add-In and you want to call some of the code from VBA, so you’ve followed the procedure to expose RequestComAddInAutomationService. But when you create an instance of that exposed object and try to call one of...

VBA run-time Error ‘-2147024894 (80070002)’ with VSTO

VBA run-time Error ‘-2147024894 (80070002)’ with VSTO I was developing a VSTO Add-In for Excel. One day it was working and the next day it was not, and I had the following error: Run-time error -2147024894 (80070002) Automation error The system cannot find the file specified This was because the...

Get intellisense for VSTO add-in in VBA

Get intellisense for VSTO add-in in VBA If you’re calling VSTO code from VBA, like in this article, you may want to add a reference to your VSTO project so that you get Intellisense in the VBA Editor. If you can’t find your add-in in the Tools/References list, and Browsing...

Excel VSTO add-in won’t show my Windows Form

Excel VSTO add-in won’t show my Windows Form You put the Windows Form in a separate project because you were trying to be a good engineer, didn’t you? Excel can’t load the dependency DLL so it can’t/won’t display your form. Move your form into the same project as the add-in...

EU Referendum Opinion

EU Referendum Opinion I think Christians should vote for the UK to remain in the EU. What follows is a Christian rationale for remaining in the EU. Someone expressed an opinion to me along the lines, “Staying in the EU will result in increasingly evil, secular government of the UK”....

Using git with local folders

Using git with local folders ‘Git’ and ‘GitHub’ are so synonymous nowadays that you’d be forgiven for thinking you can’t have one without the other. I just realised that I personally don’t know how to use git its online counterpart, as I’ve only ever experienced using clone, push and the...

Where are Pandoc’s default templates stored

Where are Pandoc’s default templates stored On Windows, you can find the default templates for Pandoc in: C:\Users\{user}\AppData\Roaming\pandoc\templates So the default HTML template would be C:\Users\{user}\AppData\Roaming\pandoc\templates\default.html I initially could not find it there on my work PC because I was looking in the user ste and not stephen, which is...

ISO 8601 in PHP

ISO 8601 in PHP The one that ends in ‘Z’ To get the zoneless ISO-8601 formatted date, use this format string: date("o-m-d\Th:i:s\Z"); To get this: 2016-02-18T07:56:04Z The one with the timezone To get it with timezone, you can use the short formatting code: date("c"); To get this: 2016-02-18T07:56:04+00:00

Embrace the case or don’t

Embrace the case or don’t Every few years, Microsoft refreshes its core productivity software suites like Office and Visual Studio to match whatever is going on with Windows at the time. The corresponding releases for Windows 8 were Visual Studio 2012 and Office 2013. Both of these were devisive for...

ASP.Net AJAX “Unknown web method, Parameter name: methodName”

ASP.Net AJAX “Unknown web method, Parameter name: methodName” Scenario You have some backend code in an .asmx or .aspx file to handle AJAX requests. When you call them from the frontend with a perfectly formed jQuery request, you get the error: Unknown web method _____. Parameter name: methodName Exception Details:...

My CSS in 2016

My CSS in 2016 1. What should CSS be? Maintainable No specificity hell. No !important. Must have rules and class names that are easy to read. Flexible CSS be reusable like code is reusable Semantic HTML tags have a meaning, a role: <header> So should classes describe a role: <aside...

Virtual Pets

Virtual Pets My cool childhood When I was a kid, my parents and I used to holiday in Devon or Cornwall in our camper van. These were very enjoyable and memorable times! One of the special treats of such a trip was visiting the Pound Shops. In an era before...

PHP errors not displaying on OVH even though display_errors = on

PHP errors not displaying on OVH even though display_errors = on This happens because OVH uses an optimised PHP infrastructure known as PHP-FPM. This system does not respect php.ini files like PHP-CGI does. Instead, there are settings in .ovhconfig which determine how PHP-FPM handles things like errors, based on an...

Notepad++ slow typing and high CPU usage

Notepad++ slow typing and high CPU usage This can be caused by the function completion scanner if its character limit is set to more than 1. Symptoms Typing is slow. If you hold down a letter key, the characters don’t appear until you release the key. During key-hold, N++ will...

Using Git and GitHub in general IT

Using Git and GitHub in general IT If you need version control in the office and you’re not all software developers, git can still be a good choice. If you want to keep your repositories online at GitHub you can also use the great GitHub Desktop client. This is a...

Ignore certain files and types in GitHub Desktop

Ignore certain files and types in GitHub Desktop Git has a config file called .gitignore which you can use to specify files and types which should be ignored for the life of the repository. Be aware that if such files have previously been committed then you will need to explicitly...

Requirements Analysis, Humbled

Requirements Analysis, Humbled I was listening to a great interview today featuring Suzanne and James Robertson of the Atlantic Systems Guild where they discuss “big ‘A’ Agile” versus “little ‘a’ agile”. That is, how stepping back from the (ironically*, rigid) processes of the central Agile methodologies (Kanban, Crystal, etc.) we...

BSOD when joining mobile hotspot

BSOD when joining mobile hotspot Whenever I join the WiFi from my phone’s Internet Sharing feature, my Windows 8.1 PC suffers a Blue Screen of Death (Kernel Panic). This is because you need to enable FIPS in the network’s security settings, which I can’t do because the BSOD is immediate...

Managing a standard product and a personal version on GitHub

Managing a standard product and a personal version on GitHub SG 2019-01-26: From 2015 until 2019, this blog ran on homebrew PHP software called Upblog, a kind of headless CMS. Now it is a static site built with Jekyll. This blog platform, Upblog, is on GitHub; I want anyone to...

gitattributes error ‘ is not a valid attribute name’

gitattributes error ‘ is not a valid attribute name’ You’re setting an attribute value, but you’ve put spaces around the equals sign. Just remove the spaces! Instead of: .htaccess merge = ours Consider: .htaccess merge=ours Symptom You add a new gitattributes file or line and run git status, and receive...

The AGENT smartwatch

The AGENT smartwatch The AGENT smartwatch was an early Pebble competitor on Kickstarter. With a campaign launched in May 2013, the AGENT promised lower power consumption than its contemporaries, Qi charging, and a .Net toolchain. That was the most exciting part to me; as a Microsoft developer, I really wanted...

Why is Adobe Reader so big?

Why is Adobe Reader so big? Because it has a lot of features made to let Adobe’s corporate customers get better value out of you! This post is inspired by a comment about Adobe Reader by howardhus on Reddit. “Adobe Reader” is not just a PDF reader. At the pro...

When was the database last used?

When was the database last used? Keep having to Duck this so I thought I’d make a post. In SQL Server, to check when a database was last in use, you can query the sys.dm_db_index_usage_stats system table like this: select DB_NAME(us.[database_id]) as [db], OBJECT_NAME(us.[object_id], us.[database_id]) as [object], MAX(us.[last_user_lookup]) as [last_user_lookup],...

Using email addresses as LOGIN usernames on Azure SQL

Using email addresses as LOGIN usernames on Azure SQL If your SQL Database server is called myazureserver and your login is user@example.com, then you must supply your login as user@example.com@myazureserver. This is a modified quote from the documentation for CREATE LOGIN (section titled ‘Windows Azure SQL Database Logins’). user@example.com@myazureserver is...

Embed web pages into Powerpoint

Embed web pages into Powerpoint Doing a demo? Want to include a fancy HTML5 page, maybe an interactive D3 chart? Are you technical? We’re going to host your demo on GitHub (or GitHub Gist) and then embed it using an official PowerPoint extension. Some foreknowledge is required. This is for...

Publish or Web Deploy an Azure Web App with MSBuild

Publish or Web Deploy an Azure Web App with MSBuild It’s taken me a day and half to get this working. We have a Web App project which needs to be pushed to Azure from Jenkins. I was following this guide, Publish an Azure Web Site from the Command Line...

Jenkins Release button disappears when security is enabled

Jenkins Release button disappears when security is enabled I just installed the Active Directory plugin and set our Jenkins server to secure using it. Then, all of the ‘Release’ buttons on our projects disappeared. If this happens to you, it is probably because you have set ‘Logged-in users can do...

The 10,000 most common passwords

The 10,000 most common passwords These files were originally published by Mark Burnett (xato.net) on the 20th of June 2011, but it can be hard to get hold of them because search results are pretty bad and his old site page only exists in the Internet Archive right now. So...

Make the MVP

Make the MVP MVP means Minimum Viable Product (among other things). The minimum viable product is the first build that does something useful/fun (depending on what your user was going for). I like to compare this to Petri Purho’s advice, “build the toy first”. Petri spent a long time making...

Defined

Defined This is a web app I made on 18th November 2014 and I forgot to talk about it until now! It’s just a dictionary, powered by the Wordnik API. In this season of life, I was particularly into making minimal web services, and rapid prototypes. The address is currently...

Git saves the day

Git saves the day I’m working on a game for a bit of fun at the moment, called Space Fleet. I’ve set aside my train commute to Liverpool, and code in Visual Studio on my trusty 2011 HP laptop. The other day I had a sub-moment of horror when I...

AJAX ASAP

AJAX ASAP This was just a passing tweet but I want to give it another look… AJAX is sometime not Async, not JavaScript, and not XML. So I say we call it "ASAP": Async/Awaitable Scripts and Partials Whaddya think— Ste Griffiths (@SteGriff) July 6, 2015 What I’m saying about AJAX is...

Using CommonMark in Pandoc

Using CommonMark in Pandoc If you’re doing offline publishing of Markdown to any other format under the sun, you probably are (or should be) using Pandoc. And I’ll come onto how to do that in a minute, if you don’t know! But, as many web people now recognise, Markdown is...

Make blogging easier

Make blogging easier Blogging can be hard. Blogging can be easy. Here are my mental rules for making it easier: Find a workflow that you enjoy I didn’t enjoy Wordpress.com. It did everything in its power to foil me at every turn. Now that I can write posts in Notepad++,...

CommonMark and Markdown

CommonMark and Markdown Markdown is the web publishing format which has exploded over the last few years. This blog engine and many, many others are powered by it. That means that we write posts that look like this and they come out looking like shiny webpages. There are a load...

Allow password storage in Filezilla

Allow password storage in Filezilla I turned off password saving when I set up Filezilla. Recently I got sick of having to type in FTP passwords every time, so I wanted to re-enable the option to remember passwords. You can find it in Edit | Settings | Interface; in the...

IIS Error 500.19 when web.config is fine

IIS Error 500.19 when web.config is fine This article affects you if IIS is showing an HTTP 500.19 error with Error Code 0x8007000d, but your web.config file looks well formed. A special indicator is that the ‘Config source’ section just says: -1: 0:. Solution This is probably happening because your...

Quickstart a Cordova application

Quickstart a Cordova application This guide uses the Cordova CLI, and is a condensed version of the Apache Cordova Documentation. Install any development kits you’ll need to compile for your target platforms; Install Node and Git if you haven’t already; Install Cordova if you haven’t already, using npm install -g...

TortoiseSVN failed to run the WC DB work queue… access is denied.

TortoiseSVN failed to run the WC DB work queue… access is denied. This could happen when you attempt to ‘Upgrade Working Copy’ on a repository. I got this error while resolving problems with a Jenkins job which had just moved to a new build server. It seemed that Jenkins couldn’t...

Serialize .Net objects to file and back again

Serialize .Net objects to file and back again When writing some progams, especially games, you might want an easy way to serialize an object with all of its properites into binary so that it can be saved to a file. Here’s a good way! Full example source code is at...

Easily crop to selection in Irfanview

Easily crop to selection in Irfanview I like to have Photoshop installed on my PCs if possible, but at work it isn’t. So for most of those common image editing tasks, I use Irfanview! In Irfanview, you can click and drag on an image to create a selection border; Once...

Getting Started with Masonry JS

Getting Started with Masonry JS Masonry JS is a powerful library for making reactive tile layouts so that content boxes and images can shuffle themselves around your page layout to make best use of space. 1. Create an HTML page and add some boxes Create an HTML template and add...

Bugzilla Permission Denied in IIS on Windows

Bugzilla Permission Denied in IIS on Windows You’re setting up Buzilla on Windows with IIS and get a permissions error like this whenever you try to save config values: Error in tempfile() using template data\params.XXXXX: Could not create temp file data\params.I19Ig: Permission denied at Bugzilla/Config.pm line 270. For help, please...

Bugzilla cannot determine local time zone on Windows

Bugzilla cannot determine local time zone on Windows If you get this error in a new Bugzilla installation on Windows: “bugzilla undef error - Cannot determine local time zone”, it could be because you don’t have the Win32-specific part of the Perl DateTime::TimeZone library. You can check by going to...

Emoji Studio

Emoji Studio Released to Windows Phone Store on 21st April 2015, Emoji Studio is an art app that lets you place, resize, and arrange any of the characters you can type on the Windows Phone keyboard, including Emoji! (Emoji Studio gathers anonymous metrics, based on users opening the app and...

Write your own C# events

Write your own C# events Every other guide is too long! So this one is as much for my own reference as anyone else’s. Let’s go! We have: A class which owns (and fires) the event, say, “Owner”; Some class which handles the event, say, “App”. 1. Write an EventArgs...

Save a generated value from one SQL query to use in the next query

Save a generated value from one SQL query to use in the next query Say you want to insert a value into Dog and then reuse some aspect of it – such as an automatically generated ID – to use in the next query where you add a DogHouse mapping....

Creating an ad hoc network in Windows 8.1

Creating an ad hoc network in Windows 8.1 On Windows 8 and 8.1, you can host a wireless network so that multiple PCs can play a LAN game or share files. Open a new command prompt as administrator: netsh wlan set hostednetwork mode=allow ssid=MyWirelessNetwork key=MyWirelessNetworkPassword1111 netsh wlan start hostednetwork Then...

Order by GUID/UUID in SQL Server

Order by GUID/UUID in SQL Server We have some tables in MS SQL land where the ID fields are GUIDs (also known as UUIDs), and often you want to sort by ID when you run a query: select * from kiosk order by KioskId …but it doesn’t come out in...

Javascript for each returns numbers instead of objects

Javascript for each returns numbers instead of objects You’ve made an ajax request or something and now you have some data. You want to for-each over it, but instead of objects with accessible properties, your code is just outputting numbers. That’s because those are the indexes, not the objects! Two...

SIGN

SIGN I made a little service for fun at the end of 2014. I wanted one of those scrolling LED displays, but built this instead as a solution which can use any small screens you have lying around. Check out sign.me.uk if you want to try it. It doesn’t have...

Upblog

Upblog SG 2019-01-26: From 2015 until 2019, this blog ran on homebrew PHP software called Upblog, a kind of headless CMS. Now it is a static site built with Jekyll. Upblog is a website system. The site/blog is generated from pages/posts which you write in markdown. You write an HTML...

How to convert a video to a different format

How to convert a video to a different format Sometimes you have a video on your PC which you can’t watch because it’s in the wrong format. Maybe you shot the video on an old mobile phone, or you’re moving it from an Apple system to PC. This guide will...

Umbraco: Cannot use lambda expression as argument to dynamically dispatched operation

Umbraco: Cannot use lambda expression as argument to dynamically dispatched operation You’re probably doing something like this: var pages = Umbraco .ContentAtRoot() .Children .OrderBy(p => p.SortOrder); But the result of ContentAtRoot() is a dynamic, and you can’t sort a dynamic because the compiler doesn’t know any of its properties until...

Umbraco can’t publish due to MySql.Web.v20

Umbraco can’t publish due to MySql.Web.v20 Twice in two weeks, I’ve had the problem of not being able to Save and publish a content node in Umbraco. It saves, and appears to publish, but an ASP.Net error pops up complaining about MySql.Web. Even the status is set to published; the...

XML Serialization tricks in .Net

XML Serialization tricks in .Net We had some fairly complicated XML to parse here at the office yesterday. I’m going to give some examples here, but the node names have been changed because they’re part of a proprietary standard (I’m not really working with farmyard XML ;) ). This article...

Mimic /usr/bin in Windows

Mimic /usr/bin in Windows In UNIX and Linux, you can create symlinks (shortcuts) in /usr/bin which let you run extra apps from the command line. I’ve made a few custom command line tools in Windows, and I want to be able to run them from the command prompt, using just...

Coded

Coded Coded is a Windows Phone 8 app for editing plain text documents, such as code. I wrote it to satisfy my own need for portable, usable, code editing, and I’ve field tested it a reasonable amount. It’s had about 1000 downloads. Coded is useful for editing all sorts of...

Don’t spell check code blocks in Microsoft Word

Don’t spell check code blocks in Microsoft Word If you’ve pasted in code with syntax highlighting Select the affected code block, and go to Review on the menu strip or ribbon. Select Language\Set Proofing Language... and tick Do not check spelling or grammar. Creating a code block style If you...

Traverse PHP array in key order

Traverse PHP array in key order Say you’ve got an array with numerical keys (which aren’t continuous), such as file information keyed by file modified time: //Make an array of all files in the directory './stuff' $fileArray = []; foreach(glob('stuff/*') as $file) { //Get the time it was last updated...