Practical .NET, software, and AI tutorials by Gerard Beckerleg, a developer in Sydney.
- Delete AWS CloudFront Cache Automatically when Building and Deploying with CodeBuild
I use AWS CodeBuild to build and then deploy this Hugo static site to s3. The site is also sat behind Amazon’s CloudFront CDN and after a sucessful deployment I wanted to delete the cache automatically so I could see the changes from the build immedietly.
- BlazeMeter does not support the inline scenario configuration. Please make sure you configure the scenarios outside the execution section.
I was recently doing some load testing for a client and when uploading our Taurus YAML tests into the Blazemeter console we recieved the following error: BlazeMeter does not support the inline scenario configuration. Please make sure you configure the scenarios outside the execution section.
- Deploy Dotnet Core Blazor Client Side Static Site to AWS Amplify
I have been playing around with .NET Core and Blazor recently to create a client side application. When it came to deploying the site I thought I would try using something different, in this case it was [Amazon’s Amplify] (https://aws.amazon.com/amplify/) which appears to be Amazon’s answer to Netlify.
- Deploy Static Site to AWS on Commit
This is a quick cheat sheet for the steps involved to create a manual pipeline to deploy a static site with CDN and HTTPS to AWS automatically on commit, the simple solution nowadays is to use [Amazon’s Amplify] (https://aws.amazon.com/amplify/) but that wasn’t around back when I had to do this, but you might also need it if you have some non standard build requirements.
- Running a Custom Docker Image on Amazon CodeBuild
I needed to use a custom docker image for some Dotnet Core 3 work with Amazon CodeBuild and hit into a few issues that took a bit of digging around to find, so thought I’d leave the here should anyone else need the same info.
- Coding Quotes
This is a dumping ground for software development quotes I have collected over the years that resonated with me (work in progress): Clear is better than clever Software engineering is what happens to programming when you add time and other programers.
- Specifying a Redis Connection String with Dot Net Core and Microsoft.Extensions.Caching.StackExchangeRedis
The documentation seems to be a bit sparse when it comes to specifying connection strings with the Microsoft.Extensions.Caching.StackExchangeRedis NuGet package. If you have any type of non standard configuration then the secret is to pass the connection string in its entirety to options.configuration with additional options separated by a comma. For example, if you wanted to specify a non standard port and use database 1 instead of the default 0 then you could use the following connection string:
- XSRF or CSRF with Angular and Dot Net Core Web API
Turns out adding XSRF, CSRF, See-Surf or whatever the name we call it now to an Angular app with a .NET Core Web API is really really easy. Angular is set up by convention to expect a cookie with the name XSRF-TOKEN.
- How to Optimize All JPG and PNG Files in a Folder Using the Windows Command Line
Images on the internet should always be optimized where possible to reduce the load time of your websites. Of course the best solution is to use a CDN but sometimes for whatever reason like me you inherit some folders full of unoptimized images you can run the following commands to reduce the load on your server. These could also be added to batch files and run in the scheduler if required.
- How to Add Microsoft's Console Log Provider to .Net Core 2.2 Console Application using the built-in Service Provider
Starting with an empty .NET Core Console Application add the following packages: Microsoft.Extensions.DependencyInjection Microsoft.Extensions.Logging Microsoft.Extensions.Logging.Console Instantiate Microsoft’s Dependecy Injection Service Provider. var serviceProvider = new ServiceCollection().BuildServiceProvider(); Register the Console Logging Provider dependency with the Service Provider using Microsoft’s extension methods var serviceProvider = new ServiceCollection().AddLogging(cfg => cfg.AddConsole()).BuildServiceProvider(); By default the lifetime of the logging service is set to Singleton.