.NET Core Entity Framework Migrations

When you don’t want to script out your own database, Entity Framework Core has your back. When you change your database context or the models it uses, you can use a couple of commands to create and update your database to keep it in sync with your model. These examples run in the Package ManagerContinue reading “.NET Core Entity Framework Migrations”

Removing Special Characters and Diacritic Marks in C#

I did this trick in JavaScript to remove diacritic marks a while back and the need to perform a similar transformation in C# came up this week. The following method simplifies strings such as “façade” into simple string like “façade”. private static string Simplify(string input) { string normalizedString = input.Normalize(NormalizationForm.FormD); StringBuilder stringBuilder = new StringBuilder();Continue reading “Removing Special Characters and Diacritic Marks in C#”

Microsoft Teams – What Microsoft Taught Me This Week

After my day job this week I’m attending the Virtual MVP Summit that Microsoft are running. The event is normally held in-person, but due to the current events it was switched to 100% online with attendees and presenters all joining sessions from home using Microsoft Teams. When you stick 150 people into an online videoContinue reading “Microsoft Teams – What Microsoft Taught Me This Week”

Easy API Testing with REST Client Extension for Visual Studio Code

Visual Studio Code is becoming my go-to tool for automating stuff. It’s lightweight, it’s a joy to use, and it seems to be able to do pretty much everything ever thanks to a vibrant plugin marketplace. If you test APIs, you might be using an API testing tool of some kind, such as Postman. WithContinue reading “Easy API Testing with REST Client Extension for Visual Studio Code”

The Universal Truth of Collections

The BBC has been running a series called Secrets of the Museum, which features a behind the scenes look at the Victoria and Albert Museum in London. The longer I watched this fascinating show, the more it revealed one of the universal truths of humanity; it’s propensity to collect things and it’s inability to limitContinue reading “The Universal Truth of Collections”

Import IIS Log Files to SQL Server with Web Log Importer

In the past I have used Log Parser Studio to run SQL style queries against IIS logs, but it can take a fair bit of time to do this. Sometimes you just want to run a quick SQL query against the log data that IIS has collected. SQL Server is a super quick way ofContinue reading “Import IIS Log Files to SQL Server with Web Log Importer”

Avoid Expensive innerHTML Manipulation with insertAdjacentHTML

It is pretty well known these days that fiddling with innerHTML is terribly inefficient. It triggers serialization, and it can result in invalid markup. Nevertheless, you’ll still find this being done in many applications. elem.innerHTML = elem.innerHTML + ‘<a href=”https://www.example.com”>Visit Example Dot Com</a>’; // or elem.innerHTML += ‘<a href=”https://www.example.com”>Visit Example Dot Com</a>’; You can avoidContinue reading “Avoid Expensive innerHTML Manipulation with insertAdjacentHTML”

HTML Challenge: Toggle Switch vs Checkbox

The toggle switch has very suddenly become a ubiquitous feature of web user interfaces. You can’t hardly fill in an HTML form these days without finding one; especially as 99% of forms we now fill in are concerned with “cookie consent”. Why isn’t the toggle switch a first-class citizen of HTML, you may ask… toContinue reading “HTML Challenge: Toggle Switch vs Checkbox”

Set a Minimum Font Size

This is just a little script I needed to use to increase text size conditionally. It only increases text below a minimum size and leaves everything else. (function () { var minFontSize = function () { $(“.content-zone *”).each(function () { var $this = $(this); if (parseInt($this.css(“fontSize”), 10) < 16) { $this.css({ “font-size”: “16px” }); }Continue reading “Set a Minimum Font Size”