FOSS I Love
Local game streaming with Sunshine and Moonlight
Local game streaming with Sunshine and Moonlight
After creating an Apps Script to email myself every day from a Google Sheet, someone asked: Why? Overall I find I can face the day better when I have timed reminders inside my inbox. My deep work is deeper, and almost nothing gets forgotten, when I want to ex…
9 patterns including HITL, hard mining, reframing, cascade, data flywheel, business rules layer, and more.
Obsessing over sleep and trying too hard will backfire.
Discover how ChatGPT-4 surpasses 90% of developers in solving coding challenges. Explore the future and potential of AI in software development.
Full source code is a attached here. This post shows two methods of implementing drop down lists in ASP.NET MVC 4. The code for data access and the general layout of the application should not be considered suitable for anything other than pedagogical purposes…
It is easy to debug an AWS Lambda function locally with Visual Studio Code, all you need to do is install one tool and make one change to the launch.json file. Read on to see how.
Full source code here. Want to learn more about Polly? Check out my Pluralsight course on it. The blog posts I have written so far about Simmy all deal with the scenario where you don’t have control over the source code that you want to break, in these cases S…
Using Amazon Polly to convert text to speech is very easy, with a small .NET console application you can send the text to Amazon and play it on your computer.
Full source code available here. As I am learning Node.Js I am constantly surprised by how easy it is to do some things, and how difficult to do others, and how poor the examples out there are.
Full source code available here. Want to learn more about Polly? Check out my Pluralsight course on it. This post on the Polly circuit breaker is part of a larger series of post on the Polly Resilience Framework, see here for the others, or check out my Plural…
In the previous post I gave a quick introduction to GitHub Actions showing how to build a small Hello World application and make the artifact available for download. In this post, I'll show how to build debug and release versions of the same application, with …
Polly's Wait and Retry lets you decide how long it should pause based on the exception thrown in the invoked code. This is very useful when you know what problems can occur and how long you need to wait for them to resolve.
Full source code available here. This is a follow up to my previous post where I used dynamic and JSON files to make querying ElasticSearch with a HttpClient much easier.
While trying to use Rider on Linux, I hit these errors "load failed", "MSBuild is required to load project 'HelloLinux' but it was not found", and "MSBuild (Microsoft Build Engine) is required to load and build project 'HelloLinux'". If you got any of these, r…
Full source code. I’ve been using AutoFixture for a while with my unit tests. It creates objects with prefilled data, saving me the hassle of manually constructing them. Basic usage If you want a string from AutoFixture do something like -
Full source code here. Want to learn more about Polly? Check out my Pluralsight course on it. In this, the second of three posts on caching in Polly, I will show how to cache the values returned inside a HttpResponseMessage as opposed to caching the response w…
For years my blog was on WordPress hosted by a third party, I recently moved it to Netlify, Hugo, and Wowchemy. It is much faster, easier to work with, more reliable, and more secure. Getting a blog up and running with those tools is very easy; migrating hundr…
Full source code here. Want to learn more about Polly? Check out my Pluralsight course on it. Polly allows you to cache a response for reuse by a subsequent request, it supports both local an distributed caches, full information can be found here https://githu…
Speech to text is now as simple as uploading a file, starting a transcription job, and waiting for the results.
Full source code available here. I wrote a post some time back about calling a stored procedure with Entity Framework using the DbCommand, but it was a bit complicated and not that easy to use.
Full source code available here. I have written about Fluent Validation a couple of times. There is a new library available for .Net Core. How to return to validation messages back to the caller is not immediately obvious.
Full source code here. Want to learn more about Polly? Check out my Pluralsight course on it. When developing an application with Polly you will also probably want to write some unit tests.
If you are using IAM auth with Lambda Function URLs, and you want to call the function using HttpClient from a .NET application, you need to sign the request. Read on to see how.
In the [previous post](/2021/02/c-and-aws-lambdas-part-1-hello-world/) I created a Lambda that executed a C# console application. In this post, I walk through creating a .NET Core 3.1 Web API application inside a Lambda and making it reachable from the web, ju…
Full source code available here. If you need to store anything temporarily within an application, you should consider using the In-Memory Cache from Microsoft. In .NET Core it is much easier to use than its predecessor from Framework 4.
Lambda layers allow you to leverage functionality provided by AWS. This post shows how to use the AWS Parameters and Secrets Lambda Extension to cache Secrets Manager secrets.
After using Docker for a while I like cleaning out all my images, containers, volumes, and the build cache. Here are some simple commands to do that.
Full source code available here. I am learning Node.js and have found it a bit of a struggle to locate good, simple documentation. It feels like most people writing in the space assume a lot of existing knowledge, like you know how plenty of JavaScript, or how…
Short version If you are having problems with nuget packages and think it might be related to local caching delete packages from these directories - %LocalAppData%\NuGet\Cache and %userprofile%\.nuget\packages\ Long version I was making nuget package, lets cal…
Sometimes all you want to do is have a quick look at a Windows EC2 instance to see what is going on, or make a small change. I'll show how to do that without the difficulty of making security group changes.
Part one of a four-parter where I'm going to show how to index the complete works of Shakespeare in Elasticsearch. This first part will set up the infrastructure on AWS. The second will go through the lambda that bulk loads data into Elasticsearch. The third w…
Continuing from Pizza Delivery IoT Project Pt. 1, I have completed much of the circuit design on my breadboard and completed the basic code necessary to interact with the sensors on the board. To interact with the various components on the board, I ...
The dotclear blogging engine has some issues when including pre-formated html; it removes all leading spaces and mangles empty lines. This is a significant problem when posting nicely coloured code snippets like those produced by hilite.
In this video we explore various prompt tricks to manipulate the AI to respond in ways we want, even when the system instructions want something else. This c...
A couple of new features in .NET 6 improve Lambda cold start times and the speed of deploying new functions. Read on to see how.
After some discussions on Twitter a few new ways of using WhenAny with Tasks of different types came up. Here is what I think will be my last post on this topic for a while, probably...
Sometimes you will want a user to approve a build job/step in GitHub Actions, in this post I show you how to do just that.
AWS Step Functions are a very easy way to orchestrate many things. But they can also be used to run a Lambda at an exact time (down to a tenth of a second, or less), up to a year in the future.
Full source code to download. I’ve been using ninject for a few years, but every time I use it with Web Api I hit some problem and they usually stem from not including the right nuget packages, not changing the DependencyResolver or (once) forgetting how to ma…
In this, the third part of the series, I show how to read from the Shakespeare CSV file where each row represents a line from a play, ([download here](https://file.ac/5b5t4n9lN5o/Shakespeare%20Plays.csv)), and send these lines to Kinesis. The lambda in AWS wil…
In an earlier post I showed how to use a .NET 6 Lambda function to retrieve a secret from Secrets Manager synchronously, but it is also easy to do this asynchronously.
Download full source code At first you think it’s going to be easy to download a file from Web Api, but as I discovered, it was not. In my case I wanted to load data from the database, perform some processing and return a subset of the data as a file.
Calling an AWS Lambda from Windows 10 is different depending on the shell you are using. In this post, I'll show how to call a simple Lambda that takes a simple event document from PowerShell, the command prompt, the WSL Ubuntu shell, and the git bash shell.
Quick example of using DataDag with a .Net 5 Web Api application on your local computer.
Full source code available here. If you are used to using HttpContent.ReadAsAsync you might be surprised to learn that it is missing from .NET Core 2. You can try adding Microsoft.
Full source code available here. .NET Core 2 and .NET Core 2.1 offer many ways to load configuration and they are well documented by Microsoft. But there is one scenario that I didn’t see explained.
There is a bug in VS Code that occurs when you use string with `@$` - the verbatim character and the interpolation characters, but there is a workaround.
If you are using some legacy SQL in C# you’ll occasionally need to write a WHERE IN. You don’t want to end up writing something like the below, either directly or through some sort of loop.
This post shows how to use Polly with .NET 6; injecting a HttpClientFactory with a Retry policy into a controller.
Summary In this post I show how to use dynamic compilation to allow Entity Framework to reference tables whose names are not known at compile time. Details Entity Framework works great for the majority of scenarios; it handles tables in one database or spread …
Download the source code here. If you are using lazy loading with Entity Framework you should check that queries to the database are working as expected. A lazy load call to something like customer.
Calling one Lambda function from another is something you'll occasionally need to do. If you are using Lambda function URLs it is a simple HTTP request. But you can also use the AWS Lambda SDK to invoke the other function.
I was re-watching The Martian a few weeks ago. There is a scene Mark Watney needs an ASCII table, he rummages through the laptop of one of the crew to find one. This got me thinking that it should be very easy to create a table with a simple program.
Full source code here. Want to learn more about Polly? Check out my Pluralsight course on it. This is the third in my series on chaos engineering with Simmy. The first two posts dealt with the fault policy throwing exceptions and returning failed responses rat…
About a year ago I wanted to start using .NET Framework 4.7, it should have been an easy process, but wasn’t. After some trial and error if figured it out and wrote a blog post explaining how to get it working.
In September 2018 I wrote a new post explaining how to store enums as ints or strings with Entity Framework Core. It is a nicer solution than the one presented here.
WHERE IN is a very useful and commonly used feature of SQL, it looks like this - SELECT * FROM ORDER WHERE OrderId IN (10248, 10249, 10250, 10251) The will return up to four rows of data, showing just the orders that have an OrderId in the list you passed to t…
When using Blazor and Polly there are a few ways to pass data from Polly back to the UI, this example shows how to do this with the Polly Context.
If you know that your Lambda function needs to handle bursts of activity at a predictable time, and you want to avoid the slower response of cold stars for that burst, you can force the Lambda service to warm up execution environments for you ahead of the burs…
In this the third in a series of posts on using .NET in AWS Lambdas I build on the previous post where I connected a Http Gateway to a Lambda running a Web API application. In that post I built the infrastructure by hand, i.e. via the GUI, pointing and clickin…
Full source code available here. Did you know that .NET Core 2 can pass in an instance of any type you want to the Startup.cs constructor? Well you can! Here’s how.
This post is mostly a note to myself. I am often annoyed with the amount of logging to the console that occurs when I start a Kestrel hosted application and I can never remember how to turn it off.
Full source code available here. Unit testing Entity Framework used to be quite a chore, but over the past few years it has become significantly easier. In this post I’m going to show you how to use the InMemory database with named instances.
This is a follow-up to a post I wrote a few days ago about varying the delay between retries based on the exception. This time I'm going to show how to vary the delay based on the result.
There are times when firing off the same query in parallel to two or more data stores is a good choice, but normally hitting one, waiting for the response, and only hitting the second if necessary is a better approach. Here I'll show how to query Redis, and if…
Full source code here. There are some subtle issues in the way I use DI in this post, see here for an alternative if you don’t want to follow this approach
This video is somewhat long as it covers the following topics:0:00 Introduction0:20 Horizontal Layers & Vertical Slices4:20 Reasoning behind using a DbContex...
In the unlikely event you need to determine what port Kestrel is running on...
Secrets are usually retrieved far more often than they are changed. The AWS Secrets Manager cache lets you cache secrets for a specified period, reducing the number of requests your applications need to make.
Filtering out entries in a dictionary is not too difficult when the key and value are simple. For example if you had - IDictionary oneToFourDictionary = new Dictionary {{ "one", 1 }, { "two", 2 }, { "three", 3 }, { "four", 4 } };
Full source code here. Want to learn more about Polly? Check out my Pluralsight course on it. This is the last of three posts on caching with Polly. The first showed how to selectively cache HttpResponseMessages based on the status code of the response.
Amazon Transcribe provides two ways to identify speakers in a piece of audio. In this post, you will see how to use speaker identification to distinguish between the voices of two people.
I have two other posts on multiple GET methods, one for ASP.NET 5 Web Api, and another for Web Api 2. It seems that every version of Web API changes how it handles default routes or route prefixes or whatever the next name will be.
This is one of those posts that I write for my future self. Here's how to deserialize JSON from a file in C#. It also lists multiple ways to create the C# model from the JSON.
Full source code here. In the previous post I showed how you can use an action filter to execute code both before and after an action method and how to apply the filter globally.
If you are developing .NET applications for AWS there are many command line, and `dotnet` tools and templates that will help you. Here is a brief list, with install instructions.
Using Polly with Blazor is simple, as I've shown in the previous two posts. In this, I will define the Wait and Retry Policy in the `Startup`, add it to the service collection and use dependency injection to pass it into the Razor page.
If you need to show many results (tens, hundreds or thousands), in a paged manner, you won’t want to display links to all those pages. I looked online for some c# that would adapt the number of page links shown to with the number of pages returned, but found n…
Full source code available here. This is part 3 of my short introduction to Elasticsearch. In the first part I showed how to create an Elasticsearch index, mapping, and seeded it with data.
If you are using Visual Studio Code and you want to add a new project to your workspace, the easiest thing to do is something like - dotnet new xunit -f netcoreapp2.
I have been a fan of Entity Framework for many years, and have relied on using the context within the `Configure(..)` method in Startup.cs, but that is not available when using top-level statements. This post shows how to use the context within `Program.cs`.
Full source code available here. A few weeks ago I started playing with DynamoDb in a .NET application. I read through the AWS documentation but felt it was incomplete and a little out of date.
A follow up on an earlier post showing a few different ways to use pattern matching.
Sometimes I accidentally "Disconnect" from a debug session instead of "Stopping" it. When this happens you leave behind a running process, holding on to files and preventing your starting a new debug session. Sometimes it also holds onto a port. Here I show ho…
Full source code here. Want to learn more about Polly? Check out my Pluralsight course on it. Simmy chaos policies have configurable options, via these options the polices can be turned on or off, have the rate at which they fire set, and in the case of the la…
Full source code available here. If you want to play around with Entity Framework it can be a little frustrating to create a complex database with a lot of sample data.
In the previous post, I showed how to use Pulumi to create a Lambda, API gateway and upload a zip of Web API application directly to the Lambda. In the post I'm going to use S3 to store the zip of a simple .NET application (not a Web API app) and point the La…
Full source code available here. Unit testing Web API controllers in .NET Core 2 is very easy. I have very simple GET and POST methods. 1[Route("api/[controller]")] 2public class ValuesController : Controller 3{ 4[HttpGet] 5 public async Task<IActionResult> Ge…
In a previous post, I showed how to use a VPC Endpoint to give a Lambda function (which is connected to the VPC) access to Secrets Manager. In this post, I will show how to use a NAT Gateway to give a Lambda function access to Secrets Manager and the internet.
When deserializing JSON from a console application or library, you have to handle unusual casing of JSON key names, and numbers represented as strings yourself. This is done with a couple of serialization options.
Download full source code. Want to learn more about Polly? Check out my Pluralsight course on it. In my previous post “A simple Polly example with WebApi 2” I showed how to make a request to an unreliable endpoint protected by a Polly retry policy.
Edit - even though the steps described below related to an example with IIS, you can use this technique for any running process, it’s just a matter of identifying the process id.
Full source code available here. I’ve been using AutoMapper for quite a few years, but one of the features that I like the most is the ProjectTo method. When using Entity Framework it lets me reduce the number of fields I query from the database to match the m…
I love using Hugo and Netlify for my blog, but one thing I have not been able to get working is aliases, it might be because of a custom permalink I'm using, my slugs, or something else, but here is a workaround.
In my previous post I discussed how values sent from the browser are bound to objects in the action methods of a controller. If binding is not working as expected you need to examine the html element names and the types you are binding to, I showed how the For…
If you are Amazon.Lambda.Templates, version 6.3.0 or earlier with .NET 7 RC 1, you may get an error when creating new project templates. Read on for a fix or a workaround.
Very quick post on using Lambda discards with Polly retries, includes an example with the HttpClientHandler too.
Sometimes when using Entity Framework I want to verify that I’m connected to the database I think I’m connected to. Here’s how to check in Entity Framework 5, Entity Framework 6 and Entity Framework Core 1 (EF 7)
In the previous post I used GitHub Actions and Pulumi to create an S3 bucket. This post shows how to build a .Net 5 application and upload the zip to the S3 bucket.
I often follow the src, test directory structure for my .NET projects. But if you open Visual Studio Code to the parent of these directories, you can't use the build and test tasks without some modifications to the tasks.json file.
Amazon Polly can convert text to speech in a variety of voices. In this post, I'll use it to read a file containing a dialogue from the play Julius Caesar where Cassius and Brutus discuss Caesar, using a different voice for each speaker.
It took me a little while to figure this out, so I thought I'd share.
Full source code here. Action filters are executed before and/or after the execution of an action method, they can be used to modify how an action executes or to perform a separate task, such as authorization or logging.
Full source code available here. In the previous blog post I showed how to setup Elasticsearch, create and index and seed the index with some sample documents. That is not a lot of use without the ability to search it.
Full source code available here. Have you ever wanted to execute a method on all implementations of an interface? Say you have an interface called IGenerator and four implementations of it – GeneratorA, GeneratorB, GeneratorC, and GeneratorD.
I was recently asked to add an ASP.NET MVC 4 application to an existing Web Forms site. The ideal solution was to keep the code bases separate and the apps on a common domain.
Full source code available here. Entity Framework Core has made unit testing CRUD functions much easier, see here for an example of using the In Memory Database, it allows you to search, add, remove and update rows.
Download full source code here. I thought this would be easy, there is a method called ExecuteSqlCommand which takes the stored proc name and an array of parameters. I wanted to pass in two parameters and get one back, no problem, I’ve done this with ADO.
Using Entity Framework I occasionally get the following error when reading from the database - `exceptionMessage=Value cannot be null. Parameter name: constructor` My Person class looked like this - 1 public class Person 2 { 3 public Person(string firstname, s…
Full source code here. This is a alternative to the approach described in a previous post. On a slack channel there was some discussion around the use of a little known extension method on HttpClientBuilder, ConfigureHttpClient.
In two recent posts I showed how to warm up execution environments for your Lambda functions so you can avoid the cold start penalty when you have a burst of traffic. In this post I'll show how to use Lambda versions and aliases to make this process easier.
With GitHub Actions, C#, and Pulumi it is easy to create an AWS S3 bucket, here's how.
Full source code available here. This is an update to a post I wrote in 2017 talking about Fluent Validation in ASP.NET Core. The example is the same but there has been few updates.
In my previous post I showed how to build a .NET 5 library inside a docker image and deploy it to an AWS Lambda. This post is a small extension on that. I'm going to build a .NET 5 Web API application, turn it into a docker image, deploy it to an AWS Lambda, a…
There have been a few times when I wanted to publish two blog posts on the same day, but I wanted to be sure of the order they would appear in.
I have a database built off code first models, but I want to set some of the columns to sparse. There isn’t a way to this with the fluent api or through annotations.
Full source code available here. Want to learn more about Polly? Check out my Pluralsight course on it. When making remote service requests the remote side will sometimes take longer than acceptable to respond.
For many reasons you might want to know where a running assembly is located on your filesystem. I had to do this once when I was compiling classes at runtime and had a dependency on EntityFramework.
I have two other posts on multiple GET methods, both for Web Api 2. the first shows how to use routes like http://…/api/values/geta. the second shows http://…/api/values/22 or http://…/api/values/AAC1FB7B-978B-4C39-A90D-271A031BFE5D.
Sending values from an MVC view to a controller works very well when you are binding back to the same model/viewmodel you populated the view with. But when you start trying to do something a little different, it’s not so obvious or straightforward.
I sometimes want to test how an application will handle errors when calling a web service. To do this, I built a simple echo server that responds to any HTTP verb on any URL. Some percentage of the time, the server will return 500 errors. It uses the Simmy pac…
Yesterday I had the honor and privilege of sharing the re:Invent stage once again with my good friend and colleague Runeet Vashisht for our session “Refactoring strategies for .NET applications as you migrate to the cloud” In this session, we were co...
Full source code here. Over the past week I have written a few articles about HttpClientFactory and dependency injection in .NET Core 2.1. There is one scenario I didn’t deal with - calling a HttpClient from inside the Main method in Program.
With the AWS tools and templates for Lambdas it is very easy to build and deploy a .NET 6 Web API application as a container image.
Want to learn more about Polly? Check out my Pluralsight course on it. Polly is fantastic for transparently retrying a request but there is always a point at which you must give up.
Sometimes I accidentally "Disconnect" from a debug session instead of "Stopping" it. When this happens you leave behind a running process, holding on to files and preventing your starting a new debug session. Sometimes it also holds onto a port. Here I show ho…
Introduction AWS CodeBuild is one of AWS’s core development services for creating CI/CD Pipelines. CodeBuild is a fully managed service that helps developers to create automated builds of their development projects. With CodeBuild there is no develop...
This is the first of a few posts on GitHub Actions. This first will be fairly basic, compile a Hello World application, zip up the binaries, and make them available to download. In future posts, I'll show how to add approvals and deploying to AWS, but for now,…
Full source code available here. If you have been using the Kestrel web server with Framework 4.x, you might already be hosting Kestrel inside a Windows service. But what if you want to use Kestrel with .
This is mostly a reminder to myself on how to store multiple SSH keys in my .ssh directory.
Full source code available here. In my previous post I showed how to use the wonderful AutoMapper ProjectTo() feature, the demo code shown worked with AutoMapper up to v8.1.1. It looked like this –
Here are two ways to page through files in an S3 bucket.
Even when using Polly retries, there are times when you just want to give. The cancellation token is a great way to do this.
Full source code available here. Want to learn more about Polly? Check out my Pluralsight course on it. The release of .NET Core 2.1 has made using HttpClient much easier. If you have been using HttpClient for a while you will know about its limitations around…
For years I've been manually installing the .NET SDK on Linux. There is no automated way to remove them, but deleting everything and starting clean is very easy.
If you found this blog or podcast useful, please help support it by buying me a coffee or by using this Amazon referrer link when you buy items from Amazon. Using this link does not affect the price of the items.
I have been using Visual Studio Code in Ubuntu Linux for a while, but it was not an easy process to get it working the first time. I just got around to installing .
Setting up your "Thing" in the AWS Console. This post is the third in my series IoT for the .NET Developer. You can find the companion video for this blog post here: Sending IoT Data to AWS IoT Core using .NET - YouTube. In the last post in this seri...
This past re:Invent AWS Launched Amazon CodeCatalyst the new All-In-One DevOps service. CodeCatalyst provides you with a single pane of glass to source control management, handling pull requests, issue management and software builds. CodeCatalyst use...
Full source code available here. Want to learn more about Polly? Check out my Pluralsight course on it. How to use the HttpClientFactory with a console application is not immediately obvious.
Cold starts with .NET AWS Lambda functions are a concern for some, but provisioned concurrency provides a simple and cost-effective way to keep your Lambda function warm.
With Elasticsearch, indexing data in bulk is a more reliable and scalable approach than indexing a high volume of documents one at time. Here is how to achieve this with AWS Kinesis and a Lambda.
Opening a new PowerShell window from an open one and running a command inside it was not as simple to figure out as I expected.
You can't yet run .NET 6 on AWS Lambda with the familiar managed runtime, but you can with a custom runtime. Here are the few small steps you need.
Full source code is available here. Below is an example of how to use RabbitMQ with Mass Transit service bus. See here for instructions on how to install Rabbit MQ.
I left out version number in a package reference and got the exception - Exception has occurred: CLR/System.MissingMethodException An exception of type 'System.MissingMethodException' occurred in System.Collections.Concurrent.dll but was not handled in user co…
If you want to experiment with code variations for a Lambda function, try Lambda versions. In this post, you'll see how to deploy a stable and experimental version of the same function.
This is part four of my four-part series on indexing the works of Shakespeare in Elasticsearch. In this, I'll show how to use the Elasticsearch "low level client" to perform the search. Previously, I wrote a [blog showing how to use a HttpClient](/2020/09/get…
By default, Wowchemy publishes blog posts to a /post path, if you want to change this to /blog or something else there are a few small changes needed.
If you are getting this - "Error converting the Lambda event JSON payload to type System.String", you might need to serialize the payload you are sending. Read on to see how.
Full source code here. The code provided will not compile until you make a change in seeder.cs, the way it’s written it generates 500,000 rows in a local db. Set this to whatever value you want.
Full source code available here. In this post I’m going to show you how to test an action method of controller that uses a HttpClient. When performing this test you want to isolate just the code of the action method for testing, you want to remove the dependen…
Full source code is provided. Overview This post gives a quick overview of how to use Entity Framework migrations and a detailed example of how to handle the addition of a new non null foreign keyed column to an existing table with data in it.
The mediator pattern is very helpful for keeping business logic out of your API endpoints. This post provides a simple example of this with the MediatR library.
Full source code available here. In .Net Core Web Api it is not possible for the routing mechanism to distinguish between the following action methods. public string GetSomething(int id, int something) and public string GetAnother(int id, int another)
Want to run a .NET 6 Lambda on ARM64?
Source code is available here. I recently had a problem where I wanted an MVC controller to use constructor injection of specified dependency and have that dependency load another specified dependency using Windsor.
I have an application where I deserialize an xml stream from a third party. One of the fields is a task code which can be one of only three values, insert, update and delete.
I’ve been developing software for some years and found that simple usually beats complicated and pragmatic choices beat dogmatic ones. In this blog, I want to share some useful pieces of code and ideas.
First in a series of posts on using .NET with AWS Lambdas. It will start with the simplest example that converts a lowercase string to an uppercase string, but by the end, you will be running a .NET Web API powered by Lambda, fronted by an API gateway where al…
If you are like me, you like to be able to write code anywhere. While I pretty much always have my laptop set up with development tools, I also have a bad habit of not pushing my changes when I get done. I then pull out a different device and get rea...
Over the years I've hesitated to add SQL Server to my laptop because of its size, but now it's easy to run in inside a container with a single command.
Full source code here. This is a simplistic approach to the problem and assumes that the dependencies created by the factory do not in turn have their own dependencies. This deficiency could be mediated by passing those dependencies into the factory.
Full source code available here. Some time ago I wrote a post showing how to stream results from Entity Framework over Web API. This approach a few benefits – the results would not be materialized in the API code, a small amount of memory would be used irrespe…
Full source code available here. In my previous post I showed a way of testing a controller that uses a HttpClient. I had to mock the HttpMessageHandler pass that to the HttpClient and set a bunch of properties.
This post shows how to extract key-value pair from fields in a multi-page PDF with Textract.
If you recognize the error from the title of this post, you can jump to the solution. The problem I have a ASP.NET 5 solution with two projects, a web application project and a class library project.
Full source code here. While writing some recent blog posts on HttpClientFactory I had to work with some of the obscure features of ServiceCollection and dependency injection in .NET Core 2.
Full source code available here. About a month ago I wrote a post with a simple explanation of how to use methods that take Action or Action<T> as parameters. Actions themselves take 0 to 16 parameters and return nothing.
In this post I show how to get a .NET 6 Web API application up an running on a Windows instance in AWS, and how to make the instance accessible to the web.
There are times when firing off the same query in parallel to two or more data stores is a good choice, keeping the first response, and canceling the other requests. Here I show how a achieve that even if the Task<> types are different.
I always forget how to read from a stream to a string, so I've create an extension method that does that and works with all stream types.
Full source code here. A few years ago I wrote a post about saving enums to the database with Entity Framework. It was able to save the enum as a string to the database and when reading from the database it was able to take that string and populate the enum co…
It is possible to refresh or update components on a Blazor page asynchronously in response to a task or tasks completing, here is an example.
It is strangely difficult to zip files from the command line with Windows 10. I spent an hour going round in circles between what you should be able to and what you can actually do. Here is a simple solution...
Lambda Function URLs are a very easy way to make a Lambda function executable via an HTTPS request, they deploy in seconds, and can scale to your needs.
A simple Web API application using Redis.
Summary When returning objects from a method try to use IList, IDictionary, etc instead of List and Dictionary. This is especially important when the method is inside a class library which you distribute.
When a Lambda function is connected to a VPC, the function can no longer access the internet. One way to resolve this is to use a NAT gateway, read on to see how.
Full source code available CoreWithKestrelFromConfighere. In my previous post I explained how to host Kestrel web server running on (the default) port 5000 as a Windows service. But what if you want to run the server on a different port?
This post is very like the previous, getting a Web API application using .NET 6 and Kestrel up and running on an EC2 instance, but with Linux this time.
Introduction When you are looking to deploy infrastructure into an AWS Account, one of the best practices is to use Infrastructure as Code (IaC). This is a recommended approach because it allows the process to be repeatable, and traceable. It also al...
Let's Encrypt updated their root cert recently and now calls from some systems to APIs that use Let's Encrypt certs are failing. Here's one way to fix it with Polly and the HttpClientHandler.
Full source code available here. A few weeks ago I posted about reading and writing data to DynamoDb. I gave instructions on how to get create tables on localstack and how to use the AWS Document Model approach.
Full source code here. Accessing generic methods by reflection is not easy. A while ago I needed to do just that and found relatively little information out there. So I dug in and figured it out for myself.
There are times when you will want to use something from the service collection within `Program.cs`, in this post shows how to do that when using top-level statements
Full source code available here. Over the past couple of years I wrote a few posts about Dependency Injection in .Net Core 2.1, and this week I received comments from a reader telling me that some of the changes in .
Full source code here. I wrote blog post in 2015 on using the Fluent Validation NuGet package for complex validation needs. In the post the validator checked that a create person request had at least one active primary phone and at least one active primary ema…
Getting Memcached running with a .NET Console application took a little longer than expected. If you are trying to do the same this might save you half an hour of messing about with constructor parameters.
If you use WhenAny with different types of Task you may want to do something when the first finishes, but also wait for the second to finish. Here's how.
To add add a ROWGUIDCOL to a unique identifier in a table using code first you have to use code migrations. Below is the snippet you need. I haven’t covered how to perform a migration because there are plenty of articles available.
Full source code here. Want to learn more about Polly? Check out my Pluralsight course on it. Up until now the Simmy examples I’ve written have thrown exceptions, changed successes to failures or slowed down a request.
Full source code here. Want to learn more about Polly? Check out my Pluralsight course on it. When I give talks on Polly I show how to use it in a Web API application that calls another Web Api application.
It is very easy to run .NET 6 AWS Lambda functions on ARM64 processors, read on to find out how...
Full source code here. There are times when you may need to access the HttpRequest from places that it is not normally available such as the constructor of a controller or the constructor of a service that is built by dependency injection.
Microsoft just released .NET Framework 4.7, but surprisingly it is not the easiest to install. Here are the steps for Windows 10, as of this writing, it is not available for earlier versions for of Windows.
The Problem It’s hard to get the details of an exception from a Web Api response when calling Web Api from a C# program. (Skip to the solution if you don’t care about the background), it even handles inner exceptions!
Occasionally you need to extract text from an image. Amazon Textract makes this easy. In this post, I'll show how to use it to extract text from a single image.
One of the great things that operating in the cloud allows us to do, is create lab environments. With Infrastructure as Code (IoC) tools, it makes it really easy for users to create preconfigured lab environments to try new things, and experiment wit...
Download full source code. When building a Web Api 2 application there is much unneeded MVC baggage that comes along with it. To start with all the css, html and javascript can go, then most of the packages, most of referenced dlls and almost all the C#.
Full source code here. I recently hit a problem where I needed to reload configuration settings as they changed, fortunately, this is relatively straightforward when using the IOptionsMonitor, in .NET Core.
If got this error when trying to scaffold a new controller (MVC and Web Api) for an ASP.NET 5 web app using Visual Studio 2015. There was an error running the selected code generator: 'No database providers are configured.
Full source code here. A few weeks ago I wrote a post about using dependency injection to pick between two implementations of an interface. It was a solution I was not very happy with because it meant I had to new up the implementations inside a factory or I h…
tl;dr - ignore most (maybe all) of the posts out there comparing Dapper and Entity Framework performance, you need to measure it yourself. Here’s why - Some are angry opinion pieces from people who don’t like one technology or the other and clearly haven’t ru…
Full source code available here. A while ago I wrote a blog post about the advantages of streaming results from Entity Framework Core as opposed to materializing them inside a controller and the returning the results.
Full source code available here. Two recent experiences with C# and JSON frustrated me with how difficult it is to work JSON inside an application. I have also been learning Node.
Full source code available here. A junior engineer colleague of mine recently asked me “how the f* * * do I call this method?”. Seemed like a reasonable question. It was a method that took a complicated Func and an Action with a series of parameters.
A few months ago AWS released a feature allowing Lambdas to run container images, for larger applications this is easier to work with than a zip file or set of layers, it also lets you move your already containerized apps to Lambda with a small effort. This po…
Full source code here. I have been using HttpClientFactory for a while and have generally preferred using named clients over typed clients. With a named client you get the HttpClient just before you are going to use it, and you have full access to the HttpResp…
Download full source code. Storing configuration preferences in the database is not a hard task. It usually involves storing the name of the preference, the value and the type in the database.
When practicing a presentation on a single screen it is helpful to see the notes, next slide, time information, etc., that you normally get with multiple monitors. This can be done with the Presenter View.
A simple example of uploading a file to S3 with .NET using a few lines of code.
This is a simple Lambda function that uses a Function URL. This blog post will be referenced in more complicated examples.
I've been playing with Step Functions for a while and wanted to see if I could use them to orchestrate a bunch of API calls, processes the responses, make decisions, etc. This post shows how to combine a single Lambda, HttpClient, and Step Functions to achieve…
Introduction If you read my post on Entity Framework migrations, you might be saying, “that’s amazing, but that’s all very well for new projects, but we’ve got eighty tables in place already and that code first migration ship has sailed”.
For the sheer fun of doing a little silly programming...
This post shows how to use Polly with .NET 6 if you are taking advantage of top-level statements.
In my last post I wrote about securing your AWS lab environments by using Managed Microsoft Active Directory as an authentication provider and configuring that active directory with randomly created passwords. This is a great first step in helping to...
Full source code available here. You will often use the GET verb when making requests to an API. You have probably used it like this - www.example.com/person/ or www.example.com/person/1 or www.
I thought it would be simple to add a task to run tests from the VS Code command palette, but it was not as straightforward as I hoped. Here's how to do it.
Full source code here. A non .NET developer friend asked me to help him write a sample C# application that exercises a POST endpoint he wrote, it requires Basic authorization. After a quick search, I found that there are relatively few good examples of doing t…
Serializing a class to XML in C# is straightforward; most collections can be easily serialized also. Something like the following will work in most scenarios - 1public string GetSerializedString<T>(T objectToSerialize) 2{ 3 var serializer = new XmlSerializer(t…
I love using Docker when developing software, but installing it on Linux is not as simple as I had hoped. If you have hit the error "docker-desktop : Depends: docker-ce-cli but it is not installable" then this post is for you.
Full source code available here. I recently hit a problem where I was getting incorrect responses from a server behind a load balancer. Looking at the logs didn’t help because there was no error.
Full source code here. Want to learn more about Polly? Check out my Pluralsight course on it. I recently presented a talk on Polly at the DevUp conference in St. Louis.
I've been working on a small AWS Lambda that has needed many iterations, I quickly got tired of building it, zipping by hand from Windows UI, uploading from the AWS console UI, and executing a test from there. Here is a simple batch file that does it all.
Full source code here. Want to learn more about Polly? Check out my Pluralsight course on it. I wrote a blog on using a Simmy Fault policy a few days ago, it is very simple to use by itself, but it is far more useful when used in combination with a resilience …
A simple Hello World type application for Redis using C#.
Working with Json directly in C# has always been a problem, but as Json becomes more common the problems mount. I was using AWS Step Functions recently and wanted to pass the Json string output from a Lambda running .NET Core 3.1. As with all things C# Json st…
Full source code available here. Want to learn more about Polly? Check out my Pluralsight course on it. In a previous post I showed how to use Polly to make a simple call, retrying in the event of failure.
In my last article "IoT for the .NET Developer", I covered how you can get .NET 7 installed and running on your RaspberryPi. In this article, I am going to cover how to get your Raspberry Pi set up and connected to AWS's IoT Core. There are two main ...
I wanted to start the year with a post about one of my favorite activities. The organization Code.org has an annual event that they run called Hour of Code. The idea of Hour of Code is to have technology professionals like you and I go into the class...
There are at least two ways to count the number of times a mocked method is called with Moq. The first is with the Verify method, the second is with the Callback method.
Full source code is available here. A common problem is validating an object using a complicated set of rules. I started using the Fluent Validation package some time back, it is commonly used with MVC and Web API applications but can be used with in any scena…
Want to see how easy it is to use a SQL Server Docker container with Entity Framework for .NET 6?
Download full source code. Want to learn more about Polly? Check out my Pluralsight course on it. If you are calling APIs and you haven’t heard about The Polly Project, you should check it out.
Full source code available here. If you are using HttpClient to make requests for you, you might have come across some articles discussing how to reuse HttpClient. They strongly advocate for using a single HttpClient for as many requests as possible, i.
Amazon Transcribe provides two ways to identify speakers in a piece of audio. In this post you will see how to use channel identification to identify speakers. In a subsequent post I will show how to use speaker identification for cases where you don't have th…
Full source code here. One of the very nice features of Entity Framework is the navigational properties. But it is easy to set them up in a less that optimal way.
I have two other posts on multiple GET methods, one for ASP.NET 5 Web Api, and another for Web Api 2. Download full source code. A few months ago I wrote a post explaining how to create a controller with multiple GET methods.
Full source code here. Want to learn more about Polly? Check out my Pluralsight course on it. This post builds on the previous one where I added chaos policies to a registry and dynamically configured their settings via a config file.
Discards can now be used with Lambdas in C# 9. Here is a simple example.
Full source code available here. Want to learn more about Polly? Check out my Pluralsight course on it. In previous posts on Polly I showed how to use a simple retry, and a retry with a delegate that is called before the request is retried.
Textract can do more than just extract plain text, it can also identify fields in a form and extract the key-value pairs. In this post, I'll show how to use it to extract key-value pairs from a tax document.
In this blog post, we are going to start the process of developing an Internet of Things (IoT) solution using .NET 7 on a Raspberry Pi. IoT systems often run a lightweight Linux OS and leverage ARM hardware with low-power processors and have small am...
This post pulls together a few threads I've been working on - the creation of Lambda to run .NET, storing the zip in S3, and updating the .NET Lambda when the zip in S3 is updated. This one took quite a while to put together - the permissions, roles, and polic…
Introduction There is an ongoing project each year for the Developer Advocates to build sample applications. This year my sample application is going to be built around an IoT use case. This project was the catalyst for my IoT for the .NET developer ...
Full source code available here. A while ago I was working on a program that had to convert enums values to strings as it saved data. When I removed the enum value from the data that was saved it went noticeably faster.
Here’s something I worked on a few days ago. It shows six ways of verifying that an incoming string has nine numeric characters and then returns a string in the standard social security number format.
Full source code available here. Routing in .NET Core Web Api (1.1 and 2) is a little different than in earlier versions. I’ve written about this a few times, you can find those posts here.
Now that's a C change we can back
Support me on Patreon to access the source code:https://www.patreon.com/milanjovanovicJoin my weekly .NET newsletter:https://www.milanjovanovic.techRead my B...
What is a Kubernetes Control Plane Components? #shorts Let us connect:🌍 My website - https://mohamadlawand.com📸 Instagram - https://www.instagram.com/mo...
.NET, .NET Core, ASP.NET, ASP.NET Core, Visual Studio, Jaliya Udagedara
Coming up in the next major version: a clearer name, a new repo name, new components (a lot of them), a new domain name and more. Read on to learn about the why and how.
Usually, when we see Blazor components, the C# code handling the interaction for the component template is placed below the template within the same .razor f...
When maths and programming don't overlap, we might be in for some weird surprises! #shorts #csharp #dotnet #programming #programmingtips Join this channel to...
Remember: you can also always follow the show on Twitter @dotnetcoreshow, and the shows host on Twitter @podcasterJay or visit our Contact page. Welcome to s...
In this article, I'm going to show you how to generate a QR code in .NET MAUI for Android and iOS...
In this post, I'm going to show you how to create Azure Functions with PowerShell and Visual Studio...
Since .NET 6 this file is the entry point of our application. It is doing work of both Program and Startup file if we look it via previous…
Fritz wants to help you become a better developer. You can learn 31+ shortcuts and tricks for Visual Studio Code, as well as his favorite VS Code extensions,...
In this video we will be going to be exploring how we can create full infrastructure on AWS with TerraformSupport me on Patreon to access the source code:htt...
In MassTransit v8.0.15, the ability to specify endpoint dependencies was added. Using this new capability, receive endpoints can be configured so that they d...
TL;DR if you have an idea on how to publish a .NET MAUI app as a single file for Windows, please let me know. I tried everything i could find on the internet in the docs and on GitHub but nothing work
The first 1,000 people to use the link will get a 1 month free trial of Skillshare: https://skl.sh/jamesmontemagno04231 Let's start our journey together to ...
💻Get the source code: https://youtube.dotnetmicroservices.com/microservicesmistake🔥Check out my free .NET workshop: https://dotnetmicroservices.com/worksho...
Hi, I'm James. In this video, we will look at how you use the Build from Code feature of AWS AppRunner to automatically re-compile and deploy your applicatio...
One of the things that sets WinUI apart from other UI frameworks is that provides a declarative way to define visual states for a control or a page. It also allows for the transitions between states to be defined. In this post we’re going to cover how to defin…
It's been a little bit... but James, David, and Matt are back with the latest .NET MAUI and Azure news! We are heading to Build and .NET MAUI is headed to .N...
The Camera.MAUI plugin does much more than just taking pictures. For instance, it can also generate QR Codes and other barcodes! In this video I will show yo...
I’m so excited to announce that for the first time, the For Those About To Code: World Wide Tour will be at the 2023 Copenhagen Developers Festival in Copenhagen Denmark! I will present my se…
Nullable reference types are not new, but I love them so much that I had to do a video about them! And also the required keyword introduced in C# 11 improved...
We use NodaTime in our application to deal with time. As you may remember, time is very important in our application - it's a attendance time-tracking tool with duty planning and many more features. For example, we use Instant to model a point in time. But som…
Subscribe to my DevOps Newsletter, Observed!: https://news.codewithstu.tv/In this first interview of a series, we're meeting the founders of WeAreDotnet, a n...
https://www.linqpad.net/https://twitter.com/linqpad/status/1643192136974868481
Create a multilingual a to z list in C#
React Starter Template for ABP application with Next.js and Tailwind CSS is ready to use. You can use this template to start your next project.#react #nextjs...
We all want to build robust and reliable applications that can scale indefinitely and handle any number of requests. But with distributed systems and microservices architectures growing in complexity, it's becoming increasingly harder to monitor the health of…
Setting up a .NET Project in 2023
Get the source code: https://www.patreon.com/amantinband.In today's video, we'll implement Domain Events from Scratch.We'll see why domain events are such a ...
In this video, we will recreate a design of one of the pages of an artificial intelligence image generator application.Original Dribble design: https://dribb...
GitHub New Code Search and Code View Feature.💎 Be a Patreon to get the source code: https://patreon.com/gsferreira🚨 KEY LINKS🤝 Support me on Patreon (and ...
#dotnet #csharp #tutorial #softwaredevelopment #signalR #aspdotnetcore #programming #softwareengineer #softwareengineering #softwareengineeringtutorials Upd...
Hi everyone. MediatR 12.0.1 was recently released and has some major changes. In previous versions, when we didn't need to return something from a handler, w...
Introduction Threading is a powerful technique that allows you to achieve better performance and…
Hello, everyone! How are you today? I hope you are doing fine. I'm so excited because this is my...
Visual Studio for Mac gets left out of the loop sometimes when we talk about extensibility, unfortunately. I decided to learn how, and this is my story!
Learn how to use markdown and Mermaid.js to illustrate finite state machines, hierarchical finite state machines, and UML state diagrams.
Tech Entrepreneurship • Software Engineering • .NET
Aprende cómo crear una aplicación móvil utilizando .NET MAUI en solo 10 pasos sencillos. Aprende sobre las ventajas de usar .NET MAUI.
In the previous article we learned to call Web API and minimal API using fetch(). Many a times your APIs are secured using JSON Web Token (JWT) based authentication scheme. And you need to pass the JWT while making API calls. In this part of the article we wil…
Here are some interesting articles, blog posts, videos, podcasts, and GitHub repositories I’ve run into over the last week (April 17, 2023 - April 24, 2023)
Recently, I have been working on a new file system called gefs. It isn't yet trustworthy, but it's ready for testing. The code is available here: https://shithub.us/ori/gefs/HEAD/f.html