Wednesday, 9 May 2018

Docker for Windows

Docker for Windows has a download size of around 374 MB for the Community Edition (aka Docker CE). The rival edition is Docker EE (Enterprise Edition). Added features of EE include security scanning of application images as well as vendor-certified plug-ins for example from networking and storage vendors. It requires Windows 10 Pro or Enterprise Version 14393 or Windows Server 2016 RTM to run.

Thursday, 3 May 2018

Object.GetHashCode

GetHashCode is a virtual (overridable) function that returns an int (System.Int32). It is used to identify an object in a hash-based collection (Dictionary). A hash code is not a permanent value; it should not be serialized or stored in databases. They should not be sent across app domains or processes. A hash code can be negative.

Tuesday, 24 April 2018

Calling a Base Class Constructor in C#

To call a base class constructor in a derived class in C#, define the constructor in the subclass and use the syntax :base after the signature to invoke the base class constructor.

Naming Conventions for Abstract Classes in C#

Unlike with interfaces which tend to begin with a capital I, abstract classes have no such convention in C#.

(A famous example of prefix I usage "in the field" is the ubiquitous IEnumerable in System.Collections).

Some possible conventions that can be used (though some people oppose any prefix or suffix) -
  • Prefix : Abstract
  • Suffix:  Base
On a side note, there are some facts about abstract classes in C#.

Abstract classes cannot be sealed and they cannot be private, for obvious reasons. Abstract members cannot be labelled virtual as they are implicitly virtual. Also an abstract member cannot be static - perhaps less obvious.

The internal keyword in C#

Internal types are only available in files in the same assembly (they have "assembly scope"). An example, would be an internal interface used to template for some specific classes used in the assembly.

Saturday, 24 March 2018

Making a PNG Image Smaller

Converting a PNG to a 16 colour BMP bitmap reduces its size by between 40%-60%. PNG is a format that supports lossless compression.

Friday, 23 March 2018

The End of Special Sequences - Removal of Trigraphs in C++17

A trigraph is a three-character sequence interpreted as a single character, as per a programming language's specification. (Digraph is a similar concept for two-character sequences).

Keyboard limitations spurred their use i.e. lack of sufficient buttons to encompass the full character set of a language.

The concept of trigraph was initially invented by the ANSI C committee. IBM have historically opposed the removal of trigraphs from C++.