Using The u8 String Literal

[C#]

A number of processing APIs and modules operate on byte arrays rather than discrete structures like strings.

Using AggregateBy In C# & .NET 9

[C#, .NET 9, LINQ]

Aggregation is a fairly common operation when it comes to data analysis, which is catered for pretty well in LINQ.

Using LINQ CountBy In .NET 9

[C#, .NET 9, LINQ]

Often in the course of your regular programming, you will need to do some basic analysis of data by aggregation, and the goto method here is typically LINQ and it’s GroupBy.

Loading & Using Application Settings In .NET

[C#, .NET, Configuration]

In the course of your .NET application you will invariably require to access and use settings in the course of your application’s operations to configure services that your application is going to require in the course of the running of your application.

Required Properties vs Constructors In Domain Objects

[C#, Design, Art Of Software]

One of the realities of writing software is dealing with objects, and how to communicate intent and help developers fall into the pit of success. This is especially an issue when you are writing software or code that is meant to be used by other developers, perhaps in an SDK or some sort of API.

Ordered Dictionary Improvements In .NET 9

[C#, .NET 9]

The dictionary class is a workhorse of the developer. It is a data structure that allows you to store a value of any kind with an associated key to look up the said value. The key must be unique, and attempting to insert a duplicate throws an exception

Removing Items From A Priority Queue

[C#, .NET 9]

.NET 6 introduced the PriorityQueue, a data structure that is a queue that allows you to attach a weight, or a priority, to enqueued items to affect the dequeuing behaviour.

Using LINQ Index

[C#, LINQ, .NET 9]

Here is a possible problem - you have a list of athletes and you would like to interate through them and generate an index for each.

Random Sampling In F#

[F#]

Suppose you need to write a program to randomly sample a number of items from a list of numbers from 0 to 99

Choosing From A Collection In F#

[F#]

Suppose you were writing a program to simulate the throwing of two dice. The minimum result you can have is 2 1 + 1 and the maximum result you can have is 12 6 + 6.

Truncating Numbers In C#

[C#, .NET]

If you have the following number, 123.456, and you want to write it to the console, or anywhere for that matter to 2 decimal places, you would do it like so:

Pretty Printing Unformatted Json In C#

[C#, .NET]

Occasionally, you will find yourself in a position where you have unformatted or poorly formatted JSON, and you would like to view it formatted, also known as pretty printed.

Determining The Operating System C# .NET Program Is Running Under

[C#, .NET]

Periodically, you will need to determine the operating system your code is running under in order to perform different logic. For example, you want the behaviour to be different depending on whether the code is running under Linux, Windows or OSX.

Did You Know - An Email Body Is Optional

[Did You Know]

The other day while working with one of our internal libraries for sending email, I ran into an error where it complained about a missing body.

Building Directory Paths In C#

[C#]

Suppose you wanted to generate a folder on your desktop, say to store your incomplete proposals.

Writing A Custom DateOnly JSON Deserializer

[C#]

The versatility of JSON as a data interchange format is that it can represent almost anything, given that ultimately all attributes are strings (or numbers).

Conmen, Charlatans And Software Developers

[Business Of Software]

Three of the things you will quickly discover that you need in this business are the following:

  1. A tough skin
  2. Patience
  3. An ability to accept an ambiguous state as a valid reality

Linux Tools Packaged With Windows

[Windows]

If you are running a recent build of Windows 10 (or 11) you would be surprised to learn a number of tools traditionally found in Linux are now bundled with Windows.

Cleaner Code With Switch Expressions In C#

[C#, Algorithms]

Everyone who remembers their path towards becoming a programmer, either as a hobbyist or a career software engineer, will remember the problem of writing this program - given a mark, allocate a grade according to a table like this:

30 Days Of .NET 6 - Day 25 - Hot Reload

[.NET, C#, 30 Days Of .NET 6]

Programming has been with us for almost a century now but the cycle surprisingly has largely been the same:

.NET 6 Release

[.NET, C#]

The final release of .NET 6 is now available.

You can get the final bits here. Remember that .NET is cross platform so you can select the appropriate sections to download the bits for your operating system

30 Days Of .NET 6 - Day 24 - Parallel.ForEachAsync

[.NET, C#, 30 Days Of .NET 6]

Computing “power” over the past decades has changed from being a speed game “megahertz” to a parallelism game - multi-processor, multi-core.

30 Days Of .NET 6 - Day 22 - LINQ Default Parameters

[.NET, C#, 30 Days Of .NET 6]

One of the things to think about when writing LINQ filter expressions (First, Last, or Single) is what happens when the thing you are looking for was not found.

Installing .NET 6 On Linux

[.NET, C#]

It is again worth repeating that .NET 6, like 5, 3 and 2 before it are cross platform and can be used to build applications in Linux and OSX.

30 Days Of .NET 6 - Day 5 - Mathematics API Additions

[C#, .NET, 30 Days Of .NET 6]

It may surprise you to learn that even the Math API, which generally does not change all that much, has some additions for those who do high performance trigonometric functions.

30 Days Of .NET 6 - Day 2 - Friendly To Newcomers

[C#, .NET, 30 Days Of .NET 6]

One of the challenges of developing and maintaining a programming languages and its accompanying tooling is you have to be welcoming to several demographics:

  1. Experienced developers on your tool-set
  2. Experienced developers from other tool-sets
  3. Students
  4. Complete newcomers to programming & hobbyists

About Software Bloat

[Business Of Software]

Occasionally you will hear somebody say, (or you yourself may say) something like:

Tip - Get Current Date In C#

[C#, Tips]

Frequently in the course of your code, you will need to get the current date.

The Value Of Good Documentation

[Business Of Software, Documentation]

Recent developments (we are in the middle of a massive upgrade of our technology stacks) as well as strategic decisions have forced us to interface with systems and ecosystems not only at code level as we are accustomed to, but additionally at documentation level.

On Career Progression

[Personal Development, Career, Business Of Software]

Lionel Messi is, by many accounts, the best football player in the world.

Gitlab HTTP Authentication With 2FA

[Tools, Gitlab]

If you have turned on 2 factor authentication for GitLab, you might be wondering how you can access and manipulate your repository over HTTPS.

The Other Integer Types

[C#]

Most developers, when requiring an integer type, use the int type and go about their business.

Disqus Off

[Meta]

So I noticed that the Disqus comments that I’ve been had been displaying a range of scammy ads.

Using Regex MatchEvaluators In C#

[Regex]

Regular expressions (Regexes) are a powerful tool for solving certain types of problems - and in particular looking for a certain pattern of text in a larger string and (optionally) replacing it with another.

Be Clearer With TimeSpans

[Tips, Time]

Many of the .NET APIs take time intervals as their parameters, and it usually is in milliseconds.

Fix For Entity Framework Tools Error

[Entity Framework Core, Fixes]

While running the entity framework command to add a migration, I got the following error

Fix For pgAdmin Not Loading

[PostgreSQL, Fixes]

Are you attempting to open the pgAdmin web console and it appears to be loading endlessly?

Remote Debugging In VS Code

[C#, VS Code]

Today we will setup an environment where we can develop and debug code remotely on a Linux environment.

HTTP Redirects Using HttpClient

[C#, Under The Hood, HttpClient]

In a previous post I had mentioned that the HttpClient does not automatically process HTTP redirects and you would have to write the logic yourself.

Refactoring With Records In C#

[C#, Records]

I recently had an opportunity to revisit some very old code (to the tune of almost a decade) and saw it as an opportunity to make some improvement and cleanup.

Chrome UI Surprises

[UI, UX]

Here is a site I am visiting on Chrome.

Upgrading To WSL 2

[WSL]

Good news if you have been running on Windows Subsystem For Linux (WSL) and have wanted to upgrade to version 2 but have not been willing to join the Windows Insider Program - WSL2 is now out in the main release.

Goodbye Wordpress

[Epiphanies]

I have been running this blog on WordPress since inception, and using WordPress in general for many years (since 2005).

Using IIS With ASP.NET Core 3.0

[ASP.NET Core]

Kestrel, the web server that powers ASP.NET Core is highly optimized for running ASP.NET Core code, and running it fast.

Using Curl In PowerShell

[PowerShell]

A useful tool to have in your toolbelt is an ability to make web requests and retrieve responses from the command line.

Touch In PowerShell

[PowerShell]

In Unix / Linux land there is a handy command to create an empty file.

How Old Is Your Language?

[Epiphanies, Languages]

Ever wonder how old your favourite language is? You might be surprised!

Should all bugs be fixed?

[Epiphanies, Business Of Software]

On the surface a perfectly reasonable question.

What Is A Software Company?

[Epiphanies, Software]

A software company is an institution that converts money into software that people pay money for.

Properties Under The Hood

[Under The Hood, C#]

One of the features of C# (and the .NET platform in general) is the support of properties as a first class citizen of the runtime.

Arguments Handling Across Paradigms

[C#, F#, Lisp, Languages]

One of the interesting things about using an object oriented language (like C#) vs a functional one (like Racket) is you get an opportunity to see first hand how different things are doing in either paradigm.

FizzBuzz In F#

[F#]

The FizzBuzz problem is one of those ubiquitous industry problems that has been floating around for decades, intended to separate the sheep from the goats.

Pinning Nuget Package Versions

[Nuget]

The Nuget package management system has been a godsend when it comes to managing libraries and dependencies in your projects.

Copy SSH Key In Windows 10

[PowerShell]

Did you know that Windows 10 has a proper SSH client, and has had one for a while?