Tuesday, 30 September 2025

The Downlow on Explainable AI

Here's a great compilation of the latest in Explainable AI  (XAI). Deep learning models (CNNs, RNNs, LLMs) as well as older models such as Support Vector Machines are covered. Techniques such as SHAP (short for Shapley Additive Explanations) are covered as well.

Monday, 29 September 2025

Getting to Know Svelte

Get to know Svelte.

Open Source Community Communication with Discord

The Discord instant messaging platform is popular with virtual communities, around open source projects, gaming and other communities, conceived by San-Francisco-born Jason Citron. It has various safety infrastructure mechanisms built in such as the Safety Rules Engine and they also emphasise Safety-by-Design (a concept prevalent in other engineering disciplines such as civil engineering).

Mermaid Diagramming

Mermaid diagramming was a concept of using text commands to create flowchart-like diagrams. 

This idea was realised in MermaidJs which renders Markdown-inspired text definitions to create and modify diagrams. It is a competitor to Lucid Chart.

Among the different charts Mermaid can build are the old database favourite of entity-relationship diagrams (E-R diagrams). Conventionally, we represent entities with capital letters and relations with lowercase letters.  The crow's foot notation is used to connect entities; intuitively expressing the idea of 1-many relationships.

Another popular chart is a sequence diagram. These express interactions between entities, e.g. the favourite Alice and Bob interactions in cryptography interactions. Entities can be expressed as rectangular boxes by default, but stick men can be used as icons too using the actor syntax.

Quadrant charts, or 2x2 matrices, can easily be built as well. These are common in consulting e.g. the BCG matrix, also known as the product-portfolio matrix. It helps to identify promising investment areas and areas which should be closed down e.g. low growth and low market share quadrant products.

Architecture diagrams can also be rendered in Mermaid.

There are also various experimental diagrams such as Sankey diagrams, which are used in science, especially physics.

Mermaid chart rendering is now available in the latest Visual Studio 2022 update.

Friday, 12 September 2025

dotnet.exe - what it means

dotnet.exe has many uses, but running compiled .NET executables distributed as EXE files is not one of them. One application is running .NET SDK commands.

File format for Jupyter Notebooks

Jupyter notebooks are stored as .ipynb files (which stands for interactive Python notebook). 

Microsoft Semantic Kernel

Microsoft Semantic Kernel is a "lighweight, open-source development kit" to build AI agents and integrate models into C#,  Python and Java code.

When you load up SK into a fresh Visual Studio Code (no extensions) it will prompt to install recommended extensions. These will include:

  • ESLint - integrates ESLint JavaScript into VS Code (for static analysis)
  • Prettier - integrates Prettier, the opinionated code formatter (for JavaScript, TypeScript and other webby stuff)
  • Azure Functions - to quickly manage serverless apps directly from VS Code
  • vscode-pdf - to display pdf files in VSCode (required to open PDF code maps for .NET and Python)

Cost Effective Deployment of Language Models

Cost effective deployment of language models (explicit financial as well as implicit environmental cost) is partly responsible for triggering the interest in small language models (SLMs) as alternatives for specific applications. 

Nvidia Research have a great paper on this entitled "Small Language Models are the Future of Agentic AI" with the recommendation that more routine tasks (non reasoning tasks) move from LLMs to SLMs. Fine tuning these SLMs for specific tasks can also enhance the effectiveness of deployed models.

Thursday, 11 September 2025

Introducing the Mojo Programming Language

Mojo is a programming language in the Python family.  Informally, it is a kind of "high performance Python".

It is currently available in browsers, via Jupyter notebooks and locally on Linux and macOS.

Developers of Mojo are Chris Lattner (ex Apple, ex Tesla, ex Google) the original architect of Swift (which he began developing in 2010, subsequently developed and added to by other developers) and LLVM (working with Vikram Adve at University of Illinois), and Tim Davis, a former Google employee.

Chris has described Mojo as "AI First" whereby AI is driving the design and requirements but it is not designed to be AI-Only, and so it can be described as moving towards a general purpose programming language.

Mojo is built on the MLIR (Multi-Level Intermediate Representation) compiler infrastructure, of which Lattner was a co-founder, one of whose aims is to reduce the cost of building domain-specific compilers.


Tuesday, 9 September 2025

Where Winforms lives on Github

This is where Winforms lives on Github.  You can use it to understand how Winforms works under the hood. 

Winforms is a .NET wrapper over Windows user interface libraries, such as User32 and GDI+.  It also offers "control and functionality ... unique to Windows Forms" (taken from README.md on Github). 

Can't Resize a Form in Design Mode for Winforms

Check a control with Docking.Fill set is not blocking the resize. This can intercept clicks meant for the form. You can workaround by temporarily setting Dock=None on the blocking control.

Resource-Aware Design in WinForms - TextBox versus RichTextBox

The TextBox is the clear winner when it comes to memory usage - as it is optimised for plain text only, versus the RichTextBox which supports rich text formatting as well as images and tables. 

This means the startup cost is also less.  Layout logic is also a source of resource consumption in the latter, as it uses FlowDocument internally for layout, whereas TextBox is just a simple stream of text.

Here are some metrics to compare 1000 instances of TextBox versus 1000 instances of RichTextBox:

Initial memory: 45MB vs 60MB  (33% heavier)
Memory used: 3MB
Control creation time: 120ms vs 250ms

Restoring a mass of text boxes from memory will take half the time if we use a regular TextBox versus a RichTextBox.

Monday, 8 September 2025

F7 and Shift-F7 - Key Visual Studio Solution Explorer Shortcuts

If you have a C# control in Visual Control you want to look at, hit the following:

F7 - to see the code (or FN-F7 on certain laptop keyboards that overload function keys)
Shift-F7 - to see the control in Design mode (or Shift-FN-F7 on certain laptop keyboards)

Environment Variables in Windows 11

To see your environment variables, type set in the command line. This will show you a bunch of stuff like:

ALLUSERSPROFILE=C:\ProgramData
ALLDATA=C:\Users\windowsjoe\AppData\Roaming
CommonProgramFiles=C:\Program Files\Common Files
CommonProgramFiles(x86)=C:\Program Files (x86)\Common Files
COMPUTERNAME=windowsjoemachine
...
OS=Windows_NT (Even if you are using Windows 11)
...
USERDOMAIN=windowsjoemachine
USERDOMAIN_ROAMINGPROFILE=windowsjoemachine
USERNAME=windowsjoe
WINDIR=C:\Windows
..

And so on, and so forth.

The setx command is an extension of set which allows you to create or modify environment variables, persisting the result across sessions.  It was first integrated into Windows Vista and is a staple for Windows 10 and Windows 11. 

To use setx to append to your PATH variable you will want to do something like this:

setx PATH "%PATH%;C:\Your\New\Directory"

For Windows Joe, a special scripts directory holds a lot of useful scripts. Hence, the path is updated to:

setx PATH "%PATH%;C:\users\windowsjoe\scripts"

If successful, you will see the message "SUCCESS: Specified value was saved.".

However, you will not be able to see the results using echo %PATH% until you start a new session.

Sunday, 7 September 2025

Alt-TNP - Package Manager Settings in Visual Studio

This includes a feature called "Clear All NuGet Storage" which wipes out all the local NuGet caches.

Disk space is freed, but builds may take longer initially, since cached metadata and binaries are gone.

Alt-TNO - the Nuget Package Manager Console in Visual Studio

Alt-TNO in Visual Studio 2022 leads you to:

Tools
NuGet Package Manager
Package Manager Console

from where you can use Find-Package to find your desired packages.

An example usage:

Find-Package Newtonsoft.Json

The Jungle of Text Encoding

Dealing with textual data on the Internet is like navigating a jungle. 

Without some normalisation, you need to get adept at handling multiple encodings.

System.Text is your partner here.

This holds the Encoding class, which has various useful properties.

  • Encoding.ASCII 
  • Encoding.Default (default encoding for current .NET implementation)
  • Encoding.Latin1 (Latin 1 character set, ISO-8859-1)
  • Encoding.Unicode (encoding for UTF16 in little endian byte order)
  • Encoding.UTF32 (little endian)
  • Encoding.UTF7 (obsolete)
  • Encoding.UTF8
Recall that Windows is little-endian by default, running primarily on x86 and x86-64 architectures which are little endian.  Even Windows on ARM uses little endian mode (ARM is bi-endian which means it can be used in little or big endian mode).

Saturday, 6 September 2025

PascalCase for WinForms Controls - Always

PascalCase is used for readability and consistency.  It aligns with how .NET controls are named, such as Button, Label and ComboBox.  

In fact, all public types and members are in PascalCase. Private fields are often in camelCase or _camelCase.

Key Properties of SplitContainer

There are some properties of SplitContainer that are well-worth remembering for programming efficiency.

Recall that a property in C# is a special encapsulation of a class field (typically with internal setter and getter methods). The set method uses an implicit value keyword.

Here are some key ones:
  1. Panel1 - the leftmost or topmost panel in a SplitContainer
  2. Panel2 - the rightmost or bottommost panel in SplitContainer
  3. FixedPanel - which panel remains fixed sized when container is resized
  4. Orientation - orientation of the panels
  5. Panel1Collapsed - whether Panel1 is collapsed
  6. Panel2Collapsed - whether Panel2 is collapsed
  7. BorderStyle - container border style

Prompt Maintenance

So-called prompt engineering is fraught with execution risk. New features are added to LLMs all the time. What worked yesterday may not work (as well) today and may need to be further "tuned".

This high touch maintenance requirement may trigger a shift away from usage of prompts in production workflows to more truly engineering-oriented solutions that have better stability and resilience properties.

Shortcuts for WinForms Custom Controls

To swiftly create custom controls in WinForms (which is needed for applications beyond a certain size), command of some keyboard shortcuts is preferable.

Control-Alt-X      Make the Toolbox appear
F4     When selecting a control, to make the Properties window appear (on some laptops you need to do FN-F4)
F12   Go to definition (or FN-F12)
Alt-F12    Peek definition (or FN-ALT-F12)

Changes in .NET 6 to WinForms

While .NET 6 may seem like a distant memory, a very important change was made to WinForms at the time.

In the main Program class, and static Main method, the previous initialization routines were replaced with a succinter statement - ApplicationConfiguration.Initialize().

Compiler Intrinsics - Basics, Pros and Cons

In Microsoft C++, many functions come from libraries, whilst some are built in to the compiler. The latter functions are known as compiler intrinsics.

PROS

An intrinsic function is usually inserted inline, avoiding overhead of a function call. Hence, compiler intrinsics are efficient!

They can be even jiffier than inline functions, as the optimizer in the compiler has knowledge of them and can optimise usage!

POTENTIAL CONS

A potential downside of using intrinsic functions is reduced portability of the code - other compilers may not support these functions. Also, some intrinsics may be available for some target architectures and not others.

COMMON INTRINSICS

Microsoft make some intrinsics available on all target architectures. Here's an example!

_AddressOfReturnAddress

signature: void * _AddressOfReturnAddress();

<intrin.h>

This function provides the address of the memory location that holds the return address of the current function.

MASM Decoded

MASM is the Microsoft Macro Assembler. 

It was introduced by Microsoft in the early 1980s to support x86 programming on DOS and Windows Platforms, and competed with IBM and Borland assembly tools.  The "macro" in the naming refers to assembly macros - reusable code snippets to simplify complex or repetitive assembly tasks.   It is an assembler in the sense it converts assembly language into executable machine code.

Inline assembler used to be a "thing" in earlier versions of Visual Studio. This allowed you to embed assembly language in a higher level programming language source code. This is no longer supported for x64 or ARM64 targets.

Options to port inline assembler include: conversion to C++, create separate assembly language source files, or use compiler intrinsics (supported by the Microsoft C++ compiler).

Visual Studio 2022 August 2025 Updates

August 2025 brought new amendments to Visual Studio 2022. 

For the August 19th release (17.14.13), these included the latest MAUI install (9.0.82), a fix for a stack overflow crash when linking MASM-generated debug information, and a fix for the Live Visual Tree horizontal scrollbar (Live Visual Tree gives you a real-time view of running XAML code).

Versions follow the MAJOR.MINOR.BUILD convention, so August 19th release is the 13th build of the 14th minor release, of the 17th major release.

Friday, 5 September 2025

Python platform module API shows errors - Oh Yeah

The Python platform module shows Windows 10 on Windows 11 machines - this is similar to other APIs which have been made to identify Windows 11 as a more advanced build of Windows 10 to avoid breaking backward compatibility. If build number is greater than 22000, you got Windows 11.