Latest News in the category DevBlog

A news aggregator from various RSS feeds, like technology, gaming, development and general news sites.


Resolving Paths To Server Relative Paths in .NET Code

ASP.NET Core automatically resolves 'virtual' paths in Razor pages or views to a site relative path.Note that more than likely you'd want to pass in all the parameters for base path, current page and host information, if you're processing the Url generically.In this post I've described a couple of helpers that do exactly that and even if you don't use these as is, they should give you the basis for resolving Urls in any Web scenario...

09/03/2025

Inline Confirmations in JavaScript UI

What if you could instead use an inline UI to confirm an operation?In this post I describe a simple way you can use an inline UI to confirm an operation that can be easily implemented with a few lines of code and a couple of binding directives.I recently ran into an app that was using a nice and simple UI to handle confirmation of deletions by using a dual interface for the confirmation prompt - a button - to both start and confirm a delete operation.

27/02/2025

Retrieving Images from the Clipboard Reliably in WPF Revisited

Recently however I started noticing some issues with some of my clipboard pasting code in Markdown Monster producing what appears to be corrupted images when displaying in an ImageSource control.What's happening in this code is that the image is copied to the clipboard from SnagIt and then picked up by the form when it loads from the clipboard and loaded into an Image control via an ImageSource bitmap.WPF Image Clipboard operations have been notoriously difficult to work with, but with this circuitous workaround described in this post, that first loads a bitmap and then an ImageSource from that, it's possible to load the vast majority of images reliably.

22/02/2025

Comparing Raw ASP.NET Request Throughput across Versions: 8.0 to 9.0 Edition

Whenever a new release of .NET comes out I run a comparison test of versions using some of my own load testing tools and in this post I look at .NET 8.0 to 9.0.WebSurge can also run non-UI tests from the command line and these tests tend to be a bit more efficient as they don't have to deal with the overhead of even minimal UI updates.NET's performance trajectory has been on a steep upward trend and in this release that trajectory has leveled out a bit.

19/01/2025

Back to Basics: Using the Parallel Library to Massively Boost Loop Performance

A few days ago I posted a quick note on X about a specific use case of using the Parallel library in .NET to massively optimize a link look up operation in Markdown Monster with very little code.The specific scenario I'm going to talk about is a Markdown link checker in my Markdown Monster editor that collects all links in a Markdown document and then checks those links - both local and online - for validity.However, after updating to using parallel code checking all links is drastically faster taking roughly the amount of time of the slowest link to process.

27/12/2024

Getting the Current TabItem when the Tab is not selected in WPF

The icon tabs on the left can be accessed with the context menu even when the tab is not active.The key here is a small utility function WindowUtilities.FindAncestor<T>() which is used to walk up the control hierarchy to see if there's a matching control of the provided generic type - in this case a MetroTabItem (a TabItem subclass from MahApps.Metro)./// Finds a type of element in the parent chain of an element

09/11/2024

Using Sql Server on Windows ARM

I recently picked up a Windows ARM device in the form of a Samsung Galaxy Book 4 with a SnapDragon X Elite chip.And yes, this is the SQL Server Express installer, but that installer also includes the LocalDb installer and so you go through most of the SQL Express setup - but without actually installing Express.If you want to do connect to the database in code you can do that with a connection string that looks like this:

24/10/2024

Webcam randomly pausing in OBS, Discord, and websites - LSVCam and TikTok Studio

If you want to get rid of it, delete HKEY_CLASSES_ROOT\CLSID\{860BB310-5D01-11d0-BD3B-00A0C911CE86}\Instance\LSVCamThis is a regression that started recently for me, so it's my opinion that they are installing a virtual camera for their game streaming feature but they are doing it poorly.Nothing bad will happen if you delete the registry key BUT it'll show back up when you run TikTok Studio again.

09/10/2024

Getting the ASP.NET Core Server Hosting Urls at Startup and in Requests

Today I was helping out a customer with their ASP.NET core application that wasn't starting up on a live server, hosted in IIS.So the task at hand is to get the Hosting Urls as part of the startup code in program.cs so that it can be written out as part of a start up banner as shown in Figure 1.You can also retrieve the host urls inside of a request by requesting a IServerAddressesFeature from an IServer instance and then requesting the feature and the addresses:

04/09/2024

Getting the ASP.NET Core Server Hosting Urls at Startup and in Requests

So the task at hand is to get the Hosting Urls as part of the startup code in program.cs so that it can be written out as part of a start up banner as shown in Figure 1.Effectively you have to put the Url retrieval code towards the very end of your startup code after the server has been started.You can also retrieve the host urls inside of a request by requesting a IServerAddressesFeature from an IServer instance and then requesting the feature and the addresses:

04/09/2024

Nuking Local Nuget Package Sources to show newly Published Packages

The command to clear the caches is a NuGet command that also works through dotnet nuget, but it's not widely advertised and not easy to find unless you know what you're looking for in the first place.The command to force the NuGet package sources to reload is:But there's a drastic solution available in the dotnet nuget local all --clear command at least, if you have the bandwidth and speed to deal with the fallout of having to re-download all your packages.

04/08/2024

Nuking Local Nuget Package Sources to show newly Published Packages

The command to clear the caches is a NuGet command that also works through dotnet nuget, but it's not widely advertised and not easy to find unless you know what you're looking for in the first place.The command to force the NuGet package sources to reload is:But there's a drastic solution available in the .NET NuGet local all command, at least, if you have the bandwidth and speed to deal with the fallout of having to re-download all your packages.

04/08/2024

Create a .NET PlantUML Markdown Render Extension

In the process I'll highlight a useful library and service that is PlantUML, and how you can add support for it in your own C# code, or use a custom RenderExtension in Markdown Monster or elsewhere to pre-process Markdown for PlantUML diagrams.Once you've created the addin you can create a new RenderExtension class in the project:Next you need to hook the actual pre and post processing into your Markdown parsing pipeline.

29/07/2024

Create a .NET PlantUML Markdown Render Extension

In the process I'll highlight a useful library and service that is PlantUML, and how you can add support for it in your own C# code, or use a custom RenderExtension in Markdown Monster or elsewhere to pre-process Markdown for PlantUML diagrams.Once you've created the addin you can create a new RenderExtension class in the project:Next you need to hook the actual pre and post processing into your Markdown parsing pipeline.

29/07/2024

Back to Basics: Await a Task with a Timeout

Task natively doesn't have a way to provide for a timeout on a single task, and by default an await call on a task results in an indefinite wait on the task to complete which...If you prefer to retrieve the result, but deal with exceptions instead, you can use the TimeoutWithResult() method instead, which directly returns a result and throws an exception if the operation times out.I also added these functions into Westwind.Utilities in the AsyncUtils class as extension methods to Task.

25/07/2024

Work around the WebView2 NavigateToString() 2mb Size Limit

The WebView2 control's NavigateToString() method has a limit for the string size of 2mb, which can be a problem especially for HTML pages with embedded content. In this post I'll describe how this problem can show up and show a couple of ways to work around the issue.

23/07/2024

Work around the WebView2 NavigateToString() 2mb Size Limit

The WebView2 control's NavigateToString() method has a limit for the string size of 2mb, which can be a problem especially for HTML pages with embedded content. In this post I'll describe how this problem can show up and show a couple of ways to work around the issue.

23/07/2024

Dealing with Platform Specific Classes and Methods in CrossPlatform .NET

If you deal with old .NET library code that is sprinkled with some Windows specific code in places you've likely run into places where the Windows specific code is throwing up unwanted compiler warnings. Sometimes that matters, but often times these warnings are annoyances as these methods are highly unlikely to get called from x-platform code. In this post I describe some annoyances, how you can work around them and eventually fix the issues without throwing everything out the window.

19/07/2024

C# Version String Formatting

I'm tired of trying to format versions for user facing interfaces after fumbling with it again and again. In this short post I show a small helper extension method that lets you configure how to form user friendly version strings to display to end users.

14/06/2024

C# Version String Formatting

I'm tired of trying to format versions for user facing interfaces after fumbling with it again and again. In this short post I show a small helper extension method that lets you configure how to form user friendly version strings to display to end users.

14/06/2024

Mime Base64 is a Thing?

Ran into an old legacy application recently that required that attached data was preformatted to Mime Base64 which I never even heard of before. Turns out it's a 'url-safe' version of base64 that replaces certain characters that can be present in base64 with 'safe' characters. In this short post I show a small helper that handles several Base64 Mime operations.

27/05/2024

Speed up your Start Menu by disabling Web Search

If you're like me, you've probably cursed the Windows Start menu from time to time, when it's either very slow to pop up, or in some instances fails to pop up at all when you press the Windows key. This simple tip can drastically improve performance of your Windows Start Menu by simply disabling Web search.

04/05/2024

ASP.NET Core Hosting Module with Shadow Copy Not Starting: Separate your Shadow Copy Folders!

I recently ran into a major failure related to Shadow Copying for an ASP.NET Web app on IIS which was caused by corruption of the Shadow Copy directories. The app starts with the dreaded white ANCM Error page and event log entries that point at missing application folders. It turns out that this is caused by interference of multiple applications using the same shadow copy folder. In this post I describe the problem and how to work around it.

29/04/2024

ASP.NET Core Hosting Module with Shadow Copy Not Starting: Separate your Shadow Copy Folders!

I recently ran into a major failure related to Shadow Copying for an ASP.NET Web app on IIS which was caused by corruption of the Shadow Copy directories. The app starts with the dreaded white ANCM Error page and event log entries that point at missing application folders. It turns out that this is caused by interference of multiple applications using the same shadow copy folder. In this post I describe the problem and how to work around it.

29/04/2024

Open Sourcing DOS 4

This code holds an important place in history and is a fascinating read of an operating system that was written entirely in 8086 assembly code nearly 45 years ago. Today, in partnership with IBM and in the spirit of open innovation, we're releasing the source code to MS-DOS 4.00 under the MIT license.Amongst the floppies, Ray found unreleased beta binaries of DOS 4.0 that he was sent while he was at Lotus.

25/04/2024

Programmatic Html to PDF Generation using the WebView2 Control with .NET

In this post I describe how to use the Microsoft WebView2 control to automate HTML to PDF generation generically for any kind of Windows application, including services. We'll look at the WebView and it's printing functionality and some of the intricacies that are involved in hosting the WebView control outside of a desktop application context to provide unattended mode even in service context.

27/03/2024

Programmatic Html to PDF Generation using the WebView2 Control with .NET

In this post I describe how to use the Microsoft WebView2 control to automate HTML to PDF generation generically for any kind of Windows application, including services. We'll look at the WebView and it's printing functionality and some of the intricacies that are involved in hosting the WebView control outside of a desktop application context to provide unattended mode even in service context.

27/03/2024

Comparing Raw ASP.NET Request Throughput across Versions

When I set up a new machine I usually use a small ASP.NET test project to get a feel of performance of the machine and when that happens I also take a moment to compare performance across recent versions of .NET to see how things are improving - and improved they have.Both due to the new hardware I'm using but also ASP.NET continues to bump up performance in every new version that comes out.In this post I describe a simple project with minimal do nothing requests to test the ASP,.NET pipeline locally and how to test these request as well as discussing the results.

08/03/2024

Updating to .NET 8, updating to IHostBuilder, and running Playwright Tests within NUnit headless or headed on any OS

public class WebApplicationTestBuilderFactory { public static WebApplicationBuilder CreateBuilder<T>() where T : class { //This ungodly code requires an unused reference to the MvcTesting package that hooks up // MSBuild to create the manifest file that is read here. //spin up a real live web application inside TestHost.exe var builder = WebApplication.CreateBuilder( new WebApplicationOptions() { ContentRootPath = contentRootPath, ApplicationName = asmFullName });Because the test runs in the context of a different directory and my website needs to run within the context of its own content root path, I have to force the content root path to be correct and the only way to do that is by getting the apps base directory from a file generated within MSBuild from the (aging) MvcTesting package.

07/03/2024

Reading Raw ASP.NET Request.Body Multiple Times

Some time ago I wrote about accessing raw request body content in ASP.NET Core which ended up being one of the most popular posts on this blog. But I failed to mention one major caveat: By default Request.Body can only be read once. In this post I discuss why frequently when you need raw Request.Body access you actually need to read the body more than once, and you can enable that functionality and deal with the caveats of doing so.

20/02/2024

Sharing Tab Missing in Windows 11 Folder Properties

For some unfathomable reason, Windows 11 has removed the Sharing Tab on the Explorer Properties Context menu by default. The Sharing Tab allows you to shared folders and drives for remote access. In this post I discuss how to get the Sharing Tab back and also touch on how to make sure your machine can actually accept remote connections so you can share your folders and drives.

10/01/2024

Sharing Tab Missing in Windows 11 Folder Properties

For some unfathomable reason, Windows 11 has removed the Sharing Tab on the Explorer Properties Context menu by default. The Sharing Tab allows you to shared folders and drives for remote access. In this post I discuss how to get the Sharing Tab back and also touch on how to make sure your machine can actually accept remote connections so you can share your folders and drives.

10/01/2024

Working around the WPF ImageSource Blues

The WPF Image control and its ImageSource property can be problematic if you are loading a lot of images in a list. Depending on where you load images from, and how, you can very easily get bogged down with slow, blocking load operations, and memory leaks when the controls are released. In this post I describe a couple of specific problems I ran into loading a sizable list of images from files and show a few ways how to avoid the potential pitfalls related to ImageSource peculiarities.

04/01/2024

Integrating OpenAI Image Generation into a .NET Application

Image Generation AIs are proving to be very good at creating images that can be used for all sorts of purposes. In this article I discuss how you can integrate image generation right into your own .NET applications using the OpenAI REST API. In addition I'll show how you can integrated this functionality into a larger application and discuss some general thoughts on image AI usage based on some of the experiences from a developer/non-designer user perspective.

21/12/2023

Integrating OpenAI Image Generation into a .NET Application

Image Generation AIs are proving to be very good at creating images that can be used for all sorts of purposes. In this article I discuss how you can integrate image generation right into your own .NET applications using the OpenAI REST API. In addition I'll show how you can integrated this functionality into a larger application and discuss some general thoughts on image AI usage based on some of the experiences from a developer/non-designer user perspective.

21/12/2023

Embedding a minimal ASP.NET Web Server into a Desktop Application

Did you ever need to embed a Web Server into a non-Web application? In this post I describe how you can use host ASP.NET in a non-Web application and specifically in a WPF desktop app. What do you need, how is it different and some of the issues that you need to consider if you want to use ASP.NET in your non-Web applications.

28/11/2023

Embedding a minimal ASP.NET Web Server into a Desktop Application

Did you ever need to embed a Web Server into a non-Web application? In this post I describe how you can use host ASP.NET in a non-Web application and specifically in a WPF desktop app. What do you need, how is it different and some of the issues that you need to consider if you want to use ASP.NET in your non-Web applications.

28/11/2023

Save Files With Elevated Permissions on UnauthorizedAccessException

If you have an application that generically allows you to edit and save files, you might on rare occasions need to save files in locations that where a regular user account does not have permissions to save. Rather than failing wouldn't it be nice to let the user know and optionally allow saving with elevated permissions? In this post I describe the workflow and implementation on how to do just that.

03/11/2023

Caching your WebView Environment to manage multiple WebView2 Controls

I've been struggling with rare WebView initialization errors in one of my applications, that have been difficult to debug and track down. After a lot of trial and error I discovered that the problem is related to WebView Environment instantiations that might be stepping on each other. In this post I describe the problem and a solution that involves creating a single WebView Environment and reusing it for all WebView initialization.

31/10/2023

Rolling Forward to Major Versions in .NET

.NET Core has sophisticated policies that allows your applications that are compiled to specific versions of the .NET Runtime can roll forward to newer versions. You can specify what part of the version to roll forward and that generally works well, except for preview releases which require an extra step.

03/10/2023

IIS Error 500.19 with ASP.NET Core Application

Running on IIS locally is pretty rare, but if for some odd reason you decide to run IIS locally on your dev machine you might find yourself getting a 500.19 error which relates to an issue in the web.config configuration. The solution is simple enough: Make sure the ASP.NET Core Hosting Module is installed. In this post I describe in more detail what the problem is and why you need a seemingly superfluous extra install to get IIS and ASP.NET Core to cooperate on local dev machine.

19/09/2023

IIS Error 500.19 with ASP.NET Core Application

Running on IIS locally is pretty rare, but if for some odd reason you decide to run IIS locally on your dev machine you might find yourself getting a 500.19 error which relates to an issue in the web.config configuration. The solution is simple enough: Make sure the ASP.NET Core Hosting Module is installed. In this post I describe in more detail what the problem is and why you need a seemingly superfluous extra install to get IIS and ASP.NET Core to cooperate on local dev machine.

19/09/2023

Dotnet Tool Component not found on the Mac

I've run into this problem a few times: I install a new Mac OS and then install the .NET SDK. A bit later I install a dotnet tool using `dotnet tool install -g` and then try to run it, only to find out that the SDK is not able find it. This post is a note to self on how to fix the pathing for .NET tools to be found correctly and to be able to run your dotnet tools.

12/09/2023

Map Physical Paths with an HttpContext.MapPath() Extension Method in ASP.NET

ASP.NET Core doesn't have a Server.MapPath() method as classic ASP.NET had, and getting at the root path in Core is a little bit more involved than in those older versions. In this post I describe how to find the application Content and Web root folders and describe a MapPath() helper that simulates the old behavior.

16/08/2023

A WPF Statusbar Control

Statusbar controls are boring, but because of the way that they are used there are a number of caveats like ensuring the UI updates even in linear code, allowing for timeouts of status messages and resetting to default, and to provide some visual clues to draw attention to the status messages displayed. In this post I talk about a custom status bar control and helper that make it super easy to use a new status bar control or attach additional functionality to an existing status bar.

08/08/2023

Using WSL and Let's Encrypt to create Azure App Service SSL Wildcard Certificates

There are many let's encrypt automatic tools for azure but I also wanted to see if I could use certbot in wsl to generate a wildcard certificate for the azure Friday website and then upload the resulting certificates to azure app service. Azure app service ultimately needs a specific format called dot PFX that includes the full certificate path and all intermediates. Per the docs, App Service private certificates must meet the following requirements: Exported as a password-protected PFX file, encrypted using triple DES.Then upload the cert to the Certificates section of your App Service, under Bring Your Own Cert. Then under Custom Domains, click Update Binding and select the new cert (with the latest expiration date).

27/06/2023

Getting the .NET Desktop Runtime Installed with a Custom Runtime Checker and Installer

I've recently moved my Markdown Monster Desktop Application to .NET 7.0 and I had to make a decision on how to get the Runtime installed or packaged with my application. In this post I review the different deployment modes, the plus's and cons and the solution I ended up with which was to build a custom install wrapper that can check and install the runtime if not already present from an Installer or interactively.,

22/06/2023

Getting the .NET Desktop Runtime Installed with a Custom Runtime Checker and Installer

I've recently moved my Markdown Monster Desktop Application to .NET 7.0 and I had to make a decision on how to get the Runtime installed or packaged with my application. In this post I review the different deployment modes, the plus's and cons and the solution I ended up with which was to build a custom install wrapper that can check and install the runtime if not already present from an Installer or interactively.,

22/06/2023

Getting .NET Library Projects to Output Dependent Assemblies

Recent .NET Core versions have changed how .NET Core Library projects output dependencies into the build folder. The new behavior doesn't output depdencies, unlike full framework .NET projects which always automatically dumped dependencies into the build output folder. This isn't a common requirement, but when you need it, the options are sufficiently obscure and this post discusses how you can make your dependencies output into the build folder

29/05/2023

Implementing Two-Factor Auth using an Authenticator App in ASP.NET

Two factor authentication using Authenticator apps is getting more popular.One advantage of Authenticator 2FA is that you don't need to use a service nor do users have to provide additional bits of personal information.In this article I describe how Authenticator based 2FA works in the context of an application without using ASP.NET Identity.

18/05/2023

Removing the IIS Server Request Header from ASP.NET Core Apps (any version)

ASP.NET Core applications that run on IIS as InProcess output an Server name for IIS into the HTTP headers. If you want to remove the server header, you'll find that the process for IIS is different than for the internally created Kestrel header and you can't use the same approach to remove the header as with Kestrel applications. In this post I discuss why the header behaves differently in IIS and how to remove it regardless of ASP.NET version.

08/05/2023

Sending and Receiving GMail Email Attachments that contain Code or Binaries

As a developer, you're likely to occasionally send an email with attachments that are either code or binary executable files either as straight files or in a zipped up collection of code or binary files.You'll find that you can't actually send certain types of files or even files embedded in archives and even encrypted archives as most mail servers these days scan file content both before sending and when receiving email.In this post I discuss what works and what doesn't and how you can work around those files that don't work.

01/05/2023

GitHub Copilot for CLI for PowerShell

GitHub Next has this cool project that is basically Copilot for the CLI (command line interface).So this means I should be able to to do the same/similar aliases for my PowerShell prompt AND change the injected prompt (look at me I'm a prompt engineer) to add 'use powershell to.' It also then offers to run the command.

25/04/2023

Setting an Absolute Output Path for .NET SDK Projects

By default .NET SDK project dump their final build output into a deeply nested folder structure that describes the build configuration, target, platform and sometimes additional package folders. While that's useful especially for multi-targeted projects. Sometimes you just want your output to go to specific folder without all that noise. In this short post I show you what you need to set in your project file to put your files exactly where you tell them to,

21/04/2023

Preventing iOS Textbox Auto Zooming and ViewPort Sizing

If you've build mobile Web applications that need to run on iOS Safari and on an iPhone you might have run into the problem of input fields 'auto-zooming' the display when the input field and popup keyboard get focus. The view zooms and doesn't return back to the unzoomed even after exiting the input field. In this post I describe why this happens in some scenarios, and a couple of ways you can work around this annoying iOS Web browser behavior.

17/04/2023

Using Application Insights in .NET Desktop Applications

Using Application Insights with desktop applications isn't the most obvious operation, as App Insights has been primarily designed as a tool for providing logging, statitics and exception report for Web based applications. However, with a little bit of reworking it's actually quite straight forward to use Application Insights with Desktop applications and in this post I show you how I integrate App Insights in my WPF applications.

10/04/2023

WkHtmlToPdf: Dealing with broken Url Encoded and Extended Character Links

WkHtmlToPdf is a commonly used tool to create PDF documents from HTML files or Urls. Unfortunately it's a bit cranky and one of the problems you can run into is that links that include URL encoding won't work in your output PDF. In this post I describe the problem and a hacky workaround to make broken PDF links work by hacking the HTML file prior to conversion.

16/03/2023

Async Event Methods and preventDefault() in JavaScript

When using async events, it's important to understand how events work when called asynchronously. Specifically if you need to interact with the event context for things like preventDefault(), cancelBubble() or returning values that determine completion state, you need to be careful as these may have no effect if called after an `await` call.

17/02/2023

UpperCase Styling via CSS and text-transform

I learned something new today: there's a CSS `text-transform` style property that can be used to transform text automatically to upper, lower or capitalized case. No JavaScript contortions and it just works. In all my years doing Web dev I've not run into this property before, so I'm posting it here for others to find as well...

09/02/2023

A Button Only Date Picker and JavaScript Date Control Binding

The native date picker in HTML is a bit of a pain to work with as it's overly simplistic in features and how you have to assign and retrieve values from it.It also isn't customizable so if you need to build custom behavior like a button date popup that doesn't show the input control, you're out of luck.In this post I discuss the challenges of the HTML date picker control, provide small component to make binding values easier, and provide an example on how to create a button only date picker both with plain JavaScript and as a small Vue component.

07/02/2023

Basic Windows Machine Hardware information from WMI for Exception Logging from .NET

When writing out error information for a desktop application to a log whether local or to a telmetry engine, it's useful to get some idea of what hardware the app is running on.WPF applications in particular can have odd behaviors that are related to hardware acceleration, running inside of a VM or particular video drivers.In this short post I show how you can get very basic machine and GPU information that provides information on these basic system stats that can prove useful to trackdown rare hardware related issues.

02/02/2023

Windows Audio Encoding Failure after Settings Change

Ran into a problem with Windows Audio not playing for MP3, WAV and other music files as well as some applications like Spotify. Any audio playback ended up resulting in an error related to an invalid encoder. Turns out the problem was an unexpected settings change. Here's the scoop.

28/01/2023

HTML Table Cell Overflow Handling

HTML table column wrapping and truncating doesn't work like other HTML elements. Specifically if you want to keep table column content from wrapping via `overflow` or `white-space` wrapping settings you'll find that tables just laugh in your face. Here's a quick post that describes table wrapping and text truncation issues and the hacky workaround.

27/01/2023

Fix that damn Git Unsafe Repository

As of Git 2.36.2 Git has a new security feature that won't allow running Git commands until the folder the repository lives in is 'trusted'. This can be annoying, but it's relatively easy to fix. In this post I look at what causes the issue and show a number of ways that you can use to trust the repository to get on with life...

05/01/2023

Use your own user @ domain for Mastodon discoverability with the WebFinger Protocol without hosting a server

Mastodon is a free, open-source social networking service that is decentralized and distributed.It was created in 2016 as an alternative to centralized social media platforms such as Twitter and Facebook.One of the key features of Mastodon is the use of the WebFinger protocol, which allows users to discover and access information about other users on the Mastodon network.

18/12/2022

I got tired

But last year, without planning it, I got tired and stopped.I did find joy on TikTok and amassed a small group of like-minded followers there.I enjoy my YouTube as well, and my weekly podcast is going strong with nearly 900 (!) episodes of interviews with cool people.

18/12/2022

SetResolution: Setting Windows Display Resolution from the Terminal

I recently switched to a single 4k monitor and had a need to quickly switch resolutions to avoid the UI hostile Windows Display Resolution widget in Settings. I ended up creating a small command line utility called SetResolution that lets you quickly and easily set a new Resolution, create profiles of resolutions to switch to.

07/12/2022

Avoid WebDeploy Locking Errors to IIS with Shadow Copy for ASP.NET Core Apps

If you're self-hosting ASP.NET Core applications on IIS and using WebDeploy to publish to the server, you've very likely run into the dreaded locked file problem on the server. In this post I show you how you can work around locking problems with the base WebDeploy configuration and by using a new experimental feature in ASP.NET 6.0 to Shadow Copy deploy binaries. As a bonus this post also describes setting up and using Web Deploy in some detail.

07/11/2022

HSTS: Fix automatic re-routing of http:// to https:// on localhost in Web Browsers

If you're doing local Web develop with multiple development tools you've probably run into a problem where you end up not being able to access a local site via unsecured `http://` requests and automatically get redirected to `https://` no matter what you try.If you don't have a certificate set up for the site you may not even be able to access the site at all.In this post I discuss how HSTS works and why it can be a problem for local development as well as how to clear out the HSTS cache or avoid using it locally.

25/10/2022

Testing HttpRequest.Form Variables in Unit Tests for ASP.NET Core Components

Here's a quick post that shows how to create a testable HttpRequest.Form collection so you can test form variables in a unit test.

18/09/2022

Using Home Assistant to integrate a Unifi Protect G4 Doorbell and Amazon Alexa to announce visitors

Every object (entity) in your house that is even remotely connected can become programmable.Get the UniFi Protect 3rd party integration for Home Assistant NOTE: Unifi Protect support is being promoted in Home Assistant v2022.2 so you won't need this step soon as it'll be included. "The UniFi Protect Integration adds support for retrieving Camera feeds and Sensor data from a UniFi Protect installation on either an Ubiquiti CloudKey+, Ubiquiti UniFi Dream Machine Pro or UniFi Protect Network Video Recorder." Authenticate and configure this integration. Get the Alexa Media Player integration This makes all your Alexas show up in Home Assistant as "media players" and also allows you to tts (text to speech) to them. Authenticate and configure this integration.Provide the convenient login features your customers want, like social login, multi-factor authentication, single sign-on, passwordless, and more.

14/12/2021

JavaScript and TypeScript Projects with React, Angular, or Vue in Visual Studio 2022 with or without .NET

You need to consider the responsibilities of your various projects or subsystems and the multiple totally valid ways you can build a web site or web app.VS2022 brings JavaScript and TypeScript support into VS with a full JavaScript Language Service based on TS. NEW: Starting in Visual Studio 2022, there is a new JavaScript/TypeScript project type (.esproj) that allows you to create standalone Angular, React, and Vue projects in Visual Studio.

25/11/2021

A Nightscout Segment for OhMyPosh shows my realtime Blood Sugar readings in my Git Prompt

I've also worked with my buddy TooTallNate to put my real-time blood sugar into a bash or PowerShell prompt, but this was back in 2017.Now that I'm "Team OhMyPosh" I have been meaning to write a Nightscout "segment" for my prompt.Nightscout is an open source self-hosted (there are commercial hosts also like T1Pal) website and API for remote display of real-time and near-real-time glucose readings for Diabetics like myself.

23/11/2021

Upgrading a 20 year old University Project to .NET 6 with dotnet-upgrade-assistant

I wrote a Tiny Virtual Operating System for a 300-level OS class in C# for college back in 2001 (?) and later moved it to VB.NET in 2002.This evening, as the children slept, I wanted to see if I could run the .NET Upgrade Assistant on this now 20 year old app and get it running on .NET 6. Let's start:$ upgrade-assistant upgrade .\TinyOS.sln-----------------------------------------------------------------------------------------------------------------Microsoft .NET Upgrade Assistant v0.3.256001+3c4e05c787f588e940fe73bfa78d7eedfe0190bdWe are interested in your feedback!

18/11/2021

.NET 6 Hot Reload and "Refused to connect to ws: because it violates the Content Security Policy directive" because Web Sockets

DasBlog is a pretty large and cool app and we noticed immediately upon Mark upgrading it to .NET 6 that we were unable to use Hot Reload (via dotnet watch or from VS 2022).dotnet run will always assume it's in Development (you literally tell it to restore, build, and exec in one run command) if you run it.Don't ship your .NET SDK to your webserver and don't recompile the whole thing on startup in production!

16/11/2021