Category: Programming

  • Avoiding Syntax Errors with the Conditional Operator in C#

    I was having a strange bug in my code, everything looked right, but for some reason, it just wouldn’t work as expected. I had written a simple conditional statement using the ternary operator, but it kept throwing a syntax error. I scratched my head, wondering what could be causing the issue. The code in question…

  • Two-Way Data Binding with Dates: A Common Gotcha

    I was having issues getting dates to bind. I realised that when the data came down as a string, the data binding worked fine, but when it came down as a date object, the binding failed. At first, I thought it was a problem with my Angular code, but it turned out to be a…

  • Web.config transforms and git. Ending the frustration.

    In the world of MVC projects, managing web.config transformations can often be a tricky task, especially when working with source control systems like Git. A common issue that developers face is that every time a web transform is run, the web.config file changes are being tracked by Git. This can be frustrating as these changes are made before runtime…

  • Building a Dockerized C# Email Tester: A Step-by-Step Guide 📧🐳👨‍💻

    As developers, we often need to test email functionality in our applications. But how can we do that efficiently, especially when working with Docker containers? In this tutorial, I’ll walk you through the process of creating a Dockerized C# Email Tester. We’ll cover everything from setting up the project to sending test emails—all within a…

  • Creating a component and adding it to an existing module.

    Sometimes when creating a component, we want it to exist under a module to keep things structured and so that our app module doesn’t get huge. It can also provide other benefits like lazy module loading and some nice other features. So that others know, the important thing here is that the file name of…

  • Removing Files from Git Source Control: A Quick Guide

    Removing Files from Git Source Control: A Quick Guide

    Introduction When working with Git, you might encounter situations where you need to remove a file or folder from source control. Whether it’s a temporary build artifact or a file that should never be tracked, Git provides a straightforward process to achieve this. In this article, we’ll explore the steps involved in removing files from…

  • Developing net core inside docker with https and kestrel

    Developing net core inside docker with https and kestrel

    First of all its a good idea to just make sure you can get https dev working locally. Then you can move to https on your container. This guide doesnt cover that but there are heaps of guides out there and the process is pretty straight forward. This guide will only look at https for…

  • [Solved] ERR_CONNECTION_RESET with SSL and ASP.NET

    I was in the process of migrating an application from forms authentication to Azure identity authentication. Initially, everything seemed straightforward, especially since I had another application already functioning with the new authentication method. However, my optimism quickly waned when I encountered unexpected issues during testing. Upon inspecting the setup, I found that despite setting everything…

  • [Solved] Entity framework – Violation of PRIMARY KEY constraint ‘…’. Cannot insert duplicate key in object ‘dbo…’ the duplicate key value is (…). The statement has been terminated.

    If you are struggling to create a new record in a sql db when using entity framework and you are ending up with an error that looks like this: What this means is that in SQL databases often a table will have a primary key id. And this primary key is generated by the data…

  • String Literal Cheat Sheet (Python, C#, JS)

    String Literal Cheat Sheet (Python, C#, JS)

    Python Python uses f-strings for string interpolation. Here’s an example: In this code, the variables name and age are inserted into the string using curly braces {}. C# C# uses string interpolation with the $ symbol. Here’s an example: In this code, the variables name and age are inserted into the string using curly braces {}. JavaScript JavaScript uses template literals for string interpolation. Template literals are…