Programming
SQL Table Size Query
Below is a SQL query for getting database sizes borrowed from this post. Unfortunately it doesn’t work on Azure SQL databases unless you’ve been granted VIEW_DATABASE_STATE permissions.
Below is a SQL query for getting database sizes borrowed from this post. Unfortunately it doesn’t work on Azure SQL databases unless you’ve been granted VIEW_DATABASE_STATE permissions.
I hadn’t really thought about this before as I’d just assumed that any code that I posted would be freely available for anyone else to use as they saw fit but it turns out that I actually implicitly retain the copyright if no license is provided. I have now added Read more…
If for whatever reason you can’t just use a nice jQuery plugin like js-cookie then the below Javascript will serve as a basic method of setting and getting cookies.
I use Serilog for logging in most of my console applications as specified here, however the AddConsole and AddDebug extension methods are now obsolete in .NET Core 2.2 giving the below errors. ‘ConsoleLoggerExtensions.AddConsole(ILoggerFactory)’ is obsolete: ‘This method is obsolete and will be removed in a future version. The recommended alternative Read more…
Azure Key Vault is a pretty handy way of centrally managing access to secrets and logging what process has requested access to them. The best way to use it is for Azure hosted resources such as Web Applications or VMs for which you can assign a managed identity to the Read more…
This is an evolution of my previous post in which I described a method for inspecting the body of a request in a middleware method and passing it out so it could be logged later if required. The below code reads in the body of a request and then if Read more…
Below are a couple of methods for making working with DateTime objects easier that I thought I’d collate into a single post. Default Value When using a newly initialised DateTime object as a source for an input field in an MVC project it will default to 01/01/0001. In order to Read more…
One of the options in bootstrap-datepicker is to show the week number on the same row as the days of the week. This numbers the weeks using the ISO-8061 standard which is fine (though it would be nice to have the option to change locale), for my purposes I wanted Read more…
If you want to send some URL encoded content to an API you can use the built in FormUrlEncodedContent to convert an IEnumerable<KeyValuePair<string, string>> to a correctly coded content object. The most basic way to get the required KeyValuePair IEnumerable is to manually create it. As this is quite a Read more…
IdentityServer4 is an OpenID Connect and OAuth 2.0 framework for ASP.NET Core 2 which can be used to manage authentication for web applications. In my case I wanted to set up OAuth 2.0 authentication using a SQL backend for an API, this isn’t too tricky when you know what you’re Read more…