PowerToys and WinGet are exciting previews for Windows Users. If you are a civilian, you’ll be getting these in general release soon, but for technical folks might want to try things out early. Or now! PowerToys PowerToys has been in preview for a while. You’ll install it when someone shows off FancyZones, which gives youContinue reading “A Glance at PowerToys and WinGet”
Category Archives: Programming
How to Drop a SQL Server Constraint When You Don’t Know its Name
If you are looking after a database that has been haphazardly maintained in the past, you might come across inconsistent naming of things such as constraints. When you come to delete the existing one, it might be tricky if it doesn’t have the same name across environments. That’s when you need to do a lookupContinue reading “How to Drop a SQL Server Constraint When You Don’t Know its Name”
Naming TypeScript Custom Type Guards
This is a super quick one. Be super-careful about how you name your custom type guards to stop consumers falling into a trap. Basically, the name you give a custom type guard and the return type you specify form a kind of promise that you have to be able to keep. Take this example: functionContinue reading “Naming TypeScript Custom Type Guards”
JQuery and TypeScript – We Have a Big Problem With jquery.d.ts
This is a call to all my TypeScript connections. This is a call to all. We have a big problem with the official Definitely Typed definition for jQuery. The most fundamental definition for the JQuery interface is incorrect, as you can see in the snippet from jquery.d.ts below. We can fix it, but not withoutContinue reading “JQuery and TypeScript – We Have a Big Problem With jquery.d.ts”
CSS Clamp: The Goldilocks of CSS Math Functions
There is a problem I have wrestled with a couple of times, which was frustrating to solve… but can now be easily solved using clamp, which is currently in an Editors Draft of the CSS Values and Units Module Level 4 specification. It is sat alongside similar mathmatical CSS nuggets, such as min and maxContinue reading “CSS Clamp: The Goldilocks of CSS Math Functions”
Entity Type IdentityUserLogin Requires a Primary Key
You will usually come across this problem in .net Core Entity Framework when you first override the OnModelCreating method in your DbContext. The entity type ‘IdentityUserLogin‘ requires a primary key to be defined. If you intended to use a keyless entity type call ‘HasNoKey()’. If you check your DbContext class, you’ll see that when youContinue reading “Entity Type IdentityUserLogin
Run Multiple PowerShell Scripts from a Master PowerShell Script
Having put together some individual scripts that ripped data out of an Excel spreadsheet, I decided to co-ordinate them with a master PowerShell script that would contain my variables and call out to neat little scripts to do work. PowerShell gets tricky to read when it gets big, so I prefer to have a coupleContinue reading “Run Multiple PowerShell Scripts from a Master PowerShell Script”
Extract an Excel Column to a Text File with PowerShell
Having opened up the same Excel spreadsheet to copy out a list of domain names into a text file for my test automation tools to consume for the third time, I wrote a PowerShell script to do it for me. Yes, it’s the same spreadsheet I mentioned before, it is full of interesting data andContinue reading “Extract an Excel Column to a Text File with PowerShell”
Copy Excel to CSV with PowerShell
Having opened up the same Excel spreadsheet to save the data as a CSV for the third time, I wrote a PowerShell script to do it for me. Simply set the source and destination files and the script takes care of the rest. & { $sourceFile = “C:\Temp\data.xlsx” $outFile = “C:\Temp\data.csv” $excelApplication = New-Object -ComObjectContinue reading “Copy Excel to CSV with PowerShell”
Convert a SQL SELECT into an INSERT Script
Sometimes you want to generate an INSERT script from existing data, perhaps with one or two values tweaked. It’s a pain to hand-crank the INSERT when you can see exactly what you want using a SELECT statement. It’s also a bit long-winded to use SQL import/export wizards or other tools. Sometimes, you just want toContinue reading “Convert a SQL SELECT into an INSERT Script”