The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 2,422 other followers

Archive for July, 2021

Abel Wang, a true legend, is gone.

Posted by jpluimers on 2021/07/30

Hopefully my response to his spouse was appropriate enough:

Thanks for this tribute. It’s amazing, lovely, wonderful, all at the same time.

Abel is one of the persons that I would have loved to meet in real life.

I’m forever grateful that Scott Hanselman got me into touch with Abel Wang. Abel informed and motivated me. After that we stayed in touch every now and then about being ill and how to deal with that.

I had to contemplate for a while as this hit me harder than I thought, especially given the “always positive Abel” he is in my – and many others’ – minds.

So to all his close ones: remember the positivity and try to be like that. Abel expects that from us.

Glad I could send him some good thoughts last week, and miss him already.

Related twitter links (Image by Donavan Brown) as my memory still is not what it used to be:

Read the rest of this entry »

Posted in About, Personal, SocialMedia, Twitter, Facebook | Leave a Comment »

How to auto start virtual machines in Windows 10 Hyper V – YouTube

Posted by jpluimers on 2021/07/30

One day I will need this: How to auto start virtual machines in Windows 10 Hyper V – YouTube.

Via [WayBack] windows 10 automatically start a vm – Google Search.

Requires Hyper-V to be installed, so these should be useful:

–jeroen

Read the rest of this entry »

Posted in Hyper-V, Power User, Virtualization, Windows, Windows 10 | Leave a Comment »

Some links on getting MacOS network interfaces and DHCP information

Posted by jpluimers on 2021/07/30

One day I’ll put this in a script that shows all DHCP information for all network interfaces.

For now some links I will need when writing that script.

Many of the below commands are also in [WayBack] Command-Line Tools: The Missing Manpages (Mac OS X for Unix Geeks).

Shows all interfaces:

networksetup -listallhardwareports

Show any DHCP server on any interface (but does not list interfaces):

system_profiler SPNetworkDataType | grep "Server Identifier"

  • [WayBack] Find the IP address of your DHCP server. – Apple Community

    Other options would be:

    system_profiler SPNetworkDataType | grep "Server Identifier"

  • [WayBack] Crabeater: Stateful Parser in Python

    I came up with a method for parsing the output of system commands that require knowledge of previous lines to provide context. An example of this is parsing the MAC addresses for interfaces on a Mac running OS X Leopard using the system_profiler command. The output of the command has various levels of sections. The first level of section headers aren’t indented at all. The next level is indented four spaces and the next six spaces.

    For this task I want to parse out the interface names, which are indented four spaces, but there are plenty of similar subsection headers that are not interfaces. The context I need is whether or not the current line is in the Network section.

    I came up with a way to implement this where the Parser is a class and has an instance variable named “state” that holds the correct method to use to parse the next line.

    Notice that h2Pattern matches any subsection header, but I only use it to match a line if the line is inside the Network section (i.e. it is only used inside the network method.)

 

Read the rest of this entry »

Posted in Apple, Mac OS X / OS X / MacOS, macOS 10.13 High Sierra, Power User | Leave a Comment »

Is warshipping still a thing?

Posted by jpluimers on 2021/07/30

Reminder to self to see if warshipping is still a thing, and in which regions.

Related:

Via:

–jeroen

Read the rest of this entry »

Posted in Power User, Security | Leave a Comment »

Methods on enums by using extension methods: Unity sample MonoBehaviour explaining how to associate simple strings with enums.

Posted by jpluimers on 2021/07/29

Reminder to self (as I keep forgetting how versatile extension methods can be):

[WayBack] Mark Pintar sur Twitter : “The nice thing about extension methods is one can add it to most types. Even works of int, float and other primitive types… “

An interesting way of allowing methods on enumerated types is by using extension methods: [WayBack] Unity sample MonoBehaviour explaining how to associate simple strings with enums. · GitHub.

A more elaborate example from [WayBack] NoraGrace-Chess/Position.cs at master · ericoldre/NoraGrace-Chess · GitHub is below the fold.

Via:

 

using System;
using System.ComponentModel;
using UnityEngine;

public class EnumDescription : MonoBehaviour
{
    public enum PlayerState
    {
        Unknown,
        [Description("Alive and kicking")]
        Alive,
        [Description("Dead as a duck")]
        Dead
    }

    // Start is called before the first frame update
    void Start()
    {
        var state = PlayerState.Dead;
        Debug.Log("Player is " + state.GetDescription());
    }
}

public static class EnumExtensions
{
    public static string GetDescription(this Enum value)
    {
        var type = value.GetType();
        var name = Enum.GetName(type, value);
        if (name != null)
        {
            var field = type.GetField(name);
            if (field != null)
            {
                if (Attribute.GetCustomAttribute(field,
                  typeof(DescriptionAttribute)) is DescriptionAttribute attr)
                    return attr.Description;
            }
        }
        return name;
    }
}

Read the rest of this entry »

Posted in .NET, C#, Development, Software Development | Leave a Comment »

 
%d bloggers like this: