If Null Then

Archive everything!

All too often resources are lost because an obscure blog eventually goes away. I am asking fellow programmers to install the Internet Archive browser plugin that exists for just about every major browser and more importantly to actually use it! If you are having a hard time finding the solution to some problem and some rando blog wound up giving you the answer, then please use the IA extension to check the recent version and verify it contains the information you wound up using. If it doesn’t, then do us and possibly your future self a favor and create a save point; just takes a few seconds! While navigating my site, anytime you see this icon :pushpin: that is a link to an internet archived version of whatever I was referencing. Also, if you have the means, then you should really donate something to these guys and I mean annually! They are truly preforming a tremendous service for all of humanity… Wayback Machine Official Extension Links Chrome Extension (also Brave) ...

Totally off topic, but I am not crazy!

This is not programming or even tech related, but I do want to help broadcast this. Since I was 14, I’ve had some very frustrating food allergies that basically didn’t let me eat anything “fresh”, this is not only unhealthy, but also makes everyone think your just being a pain in the ass. Well, today I stumbled on something regarding :pushpin:“Oral Allergy Syndrome” and this definition is pretty much verbatim what I’ve been telling people for years and nobody ever believed me; I honestly had a hard time believing myself… Note: that article says PFAS (Pollen-Food Allergy Syndrome) is another term for OAS. I would always try to explain to my wife, friends and family that they will need to nearly murder the vegetables (cook to death) or I can’t eat them. The strangest thing is that statement applied to ALL of them, not just certain groups. Of course, nobody really wants to do that so I basically just haven’t ate very healthy over the years. When asked, I would try to tell them that ...

Educational Sabbatical

The time has come… I’ve officially left a well compensated and perfectly stable career to follow my long time passion of software development. I’ve been coding for well over a decade, but not entirely at a professional level. About a year and a half ago I began trying to round out my skills with deep study so I could hopefully make a smooth transition. Well, that was hard to do while working 50-70 hours a week. What the 1.5 years of intent did accomplish was illuminating just how much stuff I needed to go learn and it also helped me narrow the focus on what to pursue; which is a lot… Oddly, my objective changed from “getting a software development job” into “taking the rest of 2021 off for deep self study”. Luckily, I can afford to do that and is probably the only way I’ll reach the bar I’ve set for myself anytime in the near future. Learning Objectives Given the crazy world we live in, I have decided to put Security at the heart of everything I am doing. This is a large deviatio...

.Net Compiler Directives by Configuration Name

I’ve been building plugins that integrate into other application for a long time. I’ve been very successfully handling the 3rd party API version changes in a variety of ways, but recently there were some really large changes that required dynamic compiler preprocessor directives. I’ve used these plenty, but never had to make them so situational before. Here is the method I used to maintain a single code base and handle the configuration conditional build. Context Because my plugins are highly specific to another software’s version, I make use of the $(Configuration) environment variable a lot in my *.csproj files. In fact all my configuration names are just years like 2019, 2020, 2021. Which lets me use the $(Configuration) variable to dynamically target the right dependencies and/or build/install locations that represent the 3rd party defined paths. You will find a line resembling this in your *.csproj files that represent the typical/standard available directives. <DefineCo...

WPF Single Instance Applications

This long lost blog post work like a charm for persisting a single instance and transferring additional invocation arguments to the already running instance. Follow it exactly, it just works!

Linux Setup Experience

I recently reinstalled windows on 3 machines and dual booted 2 of them with Linux. I tried Fedora, MX and Mint, but settled on Fedora 33 using the Cinnamon desktop. This post is just a dump of some random things I want to remember should I have to go through this process again later. You will see discussions about the widespread use of UEFI motherboards making boot environments unnecessary, but I didn’t have that experience and wound up using the MBR version after the No-Grub & PBR versions didn’t work. Way bigger fan of the Fedora setup process, only complaint is the contextual help links rarely took me to a place that properly explained an acronym I wasn’t familiar with. However, that wasn’t a huge deal since I had access to Firefox throughout the entire install. There is a maximum number of primary partitions a drive can have so I opted to use a logical partition for all the Linux stuff. I had no problems shrinking an existing primary disk partition w...

System.IO.Directory.GetFiles() Alternative

If you’ve ever wanted to do something a bit more custom with System.IO.Directory.GetFiles() or System.IO.Directory.GetDirectories(), the typical hack is to write a wrapper around the “*.*” version. Well, there is an alternative; quite literally. Marijan Nikic posted a great re-write on CodeProject that is directly manipulating the WinAPI. He used the namespace System.IO.DirectoryAlternative so its quite natural to implement. Not only does this give you all the inner workings that you might want to manipulate in a single *.CS file, but it actually functions quite a bit faster than the native .Net version too. That CodeProject Article contains a comment stating the native version has a caching advantage, but that wouldn’t matter for most of my use cases. My only gripe is that it isn’t on GitHub where it could be expanded and I always struggle to find it until I do my search directly within CodeProject. So, I am somewhat writing this post just so I remember where to find it.

Helper class TryFindParentDirectory()

This is a simple recursive helper function and several overloads that locate a parent directory if it exists. Should it not find what your asking for, then it will return the DirectoryInfo starting point of the path you originally provided. You can send it a file or directory path that exists or doesn’t, and it shouldn’t care unless its somehow structurally invalid. Note, the DirectoryInfo object is kind of dumb, if you send it a file path and it didn’t find the parent you requested, then you can expect the returned DirectoryInfo pointing entirely to your file; not its directory. So, if your starting from a filename, then you either need to have established directory norms you can depend on or you need to do System.IO.Path.GetDirectoryName() first. I realize Null might be the typical, expected or desired output, but that is an easy fix; just delete ?? Path in the below code. Also, the ABC is a generic abbreviation I use for my AgileBIM.Controls project, just change it to whatever w...

GitHub Pages custom domain HTTPS/SSL struggles

While setting up this site, I struggled to get SSL/HTTPS operational through GitHub Pages using Google Domains as the NameServer. GitHub, still doesn’t enable the Enforce HTTPS option, but my site is very much protected thanks to CloudFlare’s free NameServer Hosting that automatically enforces SSL. The options were fairly clear during setup, but if you want more information about how/why this works, I found out about it from :pushpin: Adam Brown’s blog. Note, that CloudFlare will automatically import any DNS stuff you’ve already setup on Google Domains. I’d also point out that Adam’s GitHub Pages theme looks setup well if you want ideas.

Jekyll Theme external link management

While setting up this site, I was getting irritated with external links navigating away from the site. There are a couple of ways to resolve this and I started with a dumb brute force version of my own, but quickly realized there had to be a better way. I found a great Gem plugin by Keith Mifsud that solved the whole problem for me. You can find the documentation of the 2 minor edits this requires on :pushpin: Keith’s website.