Category: Programming
-
[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)
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…
-

How to Push Your Git Repository to TFS
In this guide, we’ll walk through the steps of pushing your Git repository to Team Foundation Server (TFS). This guide assumes that you’re working with a Git repository. If your project isn’t already in a Git repository, you’ll need to initialize a new Git repository for your project. Step 1: Add the TFS Remote in…
-

Fixing inconsistently formatted Australian mobile numbers… in excel! 😎
Here is the excel formula: This formula checks if the first character of cell M2 is 0. If it is, it concatenates “+61” with the rest of the characters in M2 except the first one. If not, it checks if the first three characters of cell M2 are “+61”. If they are, it returns M2.…
-

How to add a remote folder share as a remote git repository in vs code?
In some cases, you might just wanna push your code to a network folder and use that as your remote. This will also work without vscode as long as you can get to the command line and you have the necessary folder permissions. Here is how 👍 First you will need to initialise your remote…
-

Simple way to sort dates in any format with jquery.datatables
Initially, I was formatting the date in my table using any format I liked. However, I soon realized that this would ruin sorting. For example, if you have a table with dates formatted as “dd/mm/yyyy” and “mm/dd/yyyy”, datatables will sort them incorrectly because it will sort them based on their underlying serial numbers. Then I…
-

Converting from DOCX to PDF for thumbnails
I recently needed to show some thumbnails of docx files online. Here is what I came up with. Please note that this will not create a perfect thumbnail. In fact its quite basic. It allows the user to simply see that the file contains something. Nevertheless, I hope you find it helpful! Here is the…
-

🌎💻 Converting Lat Lng to XY Coordinates: A Guide
As someone who works with geographic data, I often need to manipulate latitudes and longitudes. Recently, a researcher requested that I convert a list of latitudes and longitudes to XY coordinates to obscure the actual location of the points while still allowing for analysis of the distance relationship between them. Here’s how I did it,…
-

📅 How to Format and order dd-mm-yyyy Dates in jQuery DataTables 📅
If you’ve ever worked with DataTables, you may have encountered issues with how dates are displayed. By default, DataTables will display dates in a format that may not be easily readable or sortable. However, with a few simple tweaks, you can format your dates to display exactly how you want them. First of all your…