• Extension methods in .NET

    In 2025 this is still mostly accurate, but modern C# offers simpler options for some examples like pattern matching. Leaving this article as a historical curiosity.

    Extending the functionality of existing types and classes in .NET is very straightforward with extension methods in .NET. These methods allow you to modify the functionality of a type without modifying the existing type, and are called as if they were a method on the original type. This functionality allows you to add a wide range of comparisons or operations to a method instead of creating functions or externalising methods inside a model or class library.

    Read more...

  • EC2 instance metadata

    In 2025 this article is quite outdated. Today, AWS recommends IMDSv2 and many new instance types default to IMDSv2 only. Also, avoid using metadata as an app-level “am I on EC2?” security check -- treat instances as cattle, not pets. I would mostly consider this article a historical curiosity.

    As a user of Amazon Web Services, I am still constantly finding new tools, APIs and features to use within their mammoth system. Because of the huge amount of documentation available, it is difficult to find useful information until I need it for a specific reason. I was looking for a way to make sure that an .exe that I was building could only be run on an EC2 instance, and that’s when I came across EC2 Instance Metadata.

    Read more...

  • Auto-generate property in VB.NET

    This is from 2013 so now likely irrelevant, and I haven't used VB.NET in years, leaving it up for historical curiosity only.

    At my old job back when I was using Visual Studio 2010, I had a macro for VB.NET that would generate properties in VB.NET from a list of private methods with a click of a button, because the VB.NET class property syntax is extremely tedious to write even for classes with a small number of properties. With Visual Studio 2012 macros have been removed so I had to find an alternative or otherwise suffer with copy/pasting or writing the whole thing out!

    Luckily I came across an answer on StackOverflow that utilizes code snippets to generate a property in VB.NET including the private variable. You can see the answer here: VB.Net Keyboard Shortcut to auto-generate a Property on StackOverflow. All you need to do is write the word Property and hit tab twice, and it will generate something like this:

    Visualbasic
    1
    2
    3
    4
    5
    6
    7
    8
    9
    
    Private _PropName As String
    Public Property PropName() As String
        Get
            Return _PropName
        End Get
        Set(ByVal value As String)
            _PropName = value
        End Set
    End Property
    

  • moment.js

    In 2025, while moment.js was a very important library in JavaScript history, it is no longer relevant. For new projects, prefer modern alternatives like date-fns, Luxon, or the upcoming Temporal API (available via polyfill). These provide better performance, smaller bundle sizes, and improved timezone/locale handling.

    I’m back after a very long hiatus to talk to you about an excellent JavaScript date and time library that I have recently found called momentjs. Messing around with dates and times in JavaScript can be a huge pain with the default functionality of the Date object, especially when it comes to parsing and formatting dates in various formats. I used to use the horribly-outdated-and-with-bad-docs-and-consistency date.js, after which moment.js is a breath of fresh air. Moment.js seeks to simplify that entire process by being extremely simple to use; it only has about 10 basic functions in total, which nevertheless are very useful and powerful, especially when developing applications or plugins driven by dates such as calendars.

    Read more...

  • Getting it done

    I’ve been a bit lost lately at home. Where I used to be constantly working on personal projects, I’ve found myself more frequently looking aimlessly at huge time sinks like forums and tumblr. I’ve been finding myself lacking the drive to work on personal programming projects even though I know I’ll enjoy it a lot once I get started and I’ll most likely learn some cool stuff from it. I’ve been suffering from a distinct lack of “Getting It Done”, in that I haven’t even done anything on any of my projects, or so much as looked at them in the past month or so. The slump may be from my work life; I’ve recently started to hit my stride as supervisor after being promoted near the end of last year but that has come with tradeoffs.

    Read more...

  • Using reserved words as identifiers in VB.NET by Theo Gray

    This is from 2013 so now likely irrelevant, and I haven't used VB.NET in years, leaving it up for historical curiosity only.

    I came across a problem at work the other day when the plugin that I was using, jQuery file uploader, required specific properties to be returned to it from the VB.NET object de-serialization when an error occurred. One of these properties was Error, which is a reserved language keyword in VB.NET. Ordinarily I would never be using reserved words as identifiers in VB.NET, since you can’t anyway because the compiler doesn’t allow it and it’s usually a very bad idea. But in this case it was either use a reserved keyword or have to modify the plugin source which I wasn’t too keen on doing.

    I came across this article by Theo Gray that outlined that it was as simple as surrounding the property in square brackets [], much in the same way you can use reserved keywords as column names in MSSQL. This worked great and it was a perfectly simple solution to my problem, but I certainly won’t be making a habit of it!

9 / 11