RSSAmplifier

Blog

erresen.github.io

a programmer's blog about programming

erresen.github.ioRSS feed ↗10 posts

Latest posts

Three .gitignore files for dotnet projects in git

When setting up a new git repository in GitHub for a C# dotnet project, there doesn’t seem to be a preset .gitignore template for C# or dotnet. There actually is, but unhelpfully it’s not called what you’d expect; C#, CSharp, .net or dotnet… it’s instead name “VisualStudio” 🙄 There’s actually a few ways of getting a good dotnet .gitignore into your repo, three of which are listed below: GitHub’s…

Save debug info to file in Visual Studio

When debugging time-sensitive applications, multithreaded applications or applications with components running in different processes, the act of placing a breakpoint can change (or break) the way that the application runs. In these scenarios it can be useful to fall back to the old school way of doing things - log it out. Here’s a guide on how to log Debug info to a file in Visual Studio. Log to…

Nullable object must have a value - C#

I recently came across an error I haven’t seen before (or certainly can’t remember): InvalidOperationException: Nullable object must have a value. It was thrown in a C# MVC view and the Visual Studio debugger (unhelpfully) didn’t break at the line that was throwing the error. As such it was more challenging than usual to track down the cause of the bug. We’d recently updated how the data objects…

CLI git commands for IDE/GUI users

Git’s super powerful, but a lot of that power is only really available in the command line interface (CLI), hidden from developers using GUI tools built into IDEs like Visual Studio. I’m a C# dev, so I live in Visual Studio. Recently I’ve been finding myself having to use git’s CLI to get things done, either more quickly or sometimes at all! Below is a list of the git commands that I actually use…

Appreciating accessibility - Keyboard shortcut guidelines

You know what really sucks? Breaking bones. I’d been watching too many mountain biking videos on YouTube and after the first jump on a ride at my local bike trails, I came to realise that my enthusiasm and confidence far outweighed my skill. After over-jumping the jump, hitting a tree, flying over the bars and landing directly on my left shoulder 4 metres down the trail, I now have a broken…

Throwaway: Disposable email helper in Vue.js

I recently wrote Throwaway , a little app built in Vue.js to help generate and store throwaway email addresses. Why? I am a big advocate of online privacy; I don’t like giving away any more personal information than is strictly necessary, and it pains me to see my friends and family blindly entering their real names and email address into random online forms, without really comprehending what…

A .gitignore file for Vue.js projects

GitHub doesn’t appear to have a default .gitignore file for new Vue.js projects, so here’s what I’m currently using. . DS_Store node_modules / dist # local env files . env . local . env . * . local # Log files npm - debug . log * yarn - debug . log * yarn - error . log * pnpm - debug . log * # Editor directories and files . idea . vscode * . suo * . ntvs * * . njsproj * . sln * . sw ? .DS_Store is…

Getting the length of an ntext field in T-SQL (MSSQL)

When querying the length of a string field in SQL, the normal go-to is the LEN() function. If the field you’re querying has the datatype ntext you’ll likely run into the following error: Argument data type ntext is invalid for argument 1 of len function. Problem You can’t use LEN() on an ntext field. In the query below, the Comments column has the datatype ntext . If you run this query… SELECT…

What to do when your graphics drivers fail in Windows 10

Keeping Windows up to date is normally a good idea. Keeps your system secure and blah, blah, blah… Not such a good idea if you have a Lenovo X1 Carbon. I dutifully installed a recent update to have my laptop restart into a black screen. Computer on and apparently at the lock screen, but no display. Tried plugging in an external monitor, but still nothing. Windows update screwed me. I needed to…

Midpoint Rounding Options in C#

Decimal midpoint rounding options in C# default to To Even . This was a head scratching moment for me at first, as the way us humans have been taught to round is generally Away From Zero . Away From Zero rounds 2.5 to 3; the way most of us were taught rounding at school. var needsRounding = 2.5 M ; var rounded = Math . Round ( needsRounding , MidpointRounding . AwayFromZero ); Console . WriteLine…