Buy Me a Coffee

Buy Me a Coffee!

Friday, November 16, 2018

Testing new syntax

A colleague used some syntax that I hadn't seen before so I thought it would be worth testing in isolation.  The notation is an extension of the ternary conditional operator known as the null-conditional operator that was added as part of C# 6.0 in 2016.  I believe I need to up my C# game.  Anyway, here is the sample program I built:

which outputs:
=>
=>Test2
We build our code using the null-conditional operator to avoid having to build out the more common tertiary version of the same code:

Wednesday, November 7, 2018

Stop RHEL from hibernating when laptop lid closes

Quick hit here, I installed Red Hat Enterprise Linux 7 on a decent, but old laptop to let me play with OpenStack in a semi portable way.  The only issue is that I want to close the lid and leave it running and still be able to attach to it.  Close the lid, power savings kick in.  To stop that, just edit:
/etc/systemd/logind.conf
and change:
#HandleLidSwitch=suspend
to:
HandleLidSwitch=ignore

Tuesday, October 23, 2018

Nested Hyper-V and NAT Switches

Quick and dirty, to nest Hyper-V instances you just need to run a quick PowerShell command to set a flag:

Set-VMProcessor -VMName <VMName> -ExposeVirtualizationExtensions $true

Another interesting find is Setting up a NAT switch for Hyper-V:

New-VMSwitch -SwitchName “NATSwitch” -SwitchType Internal

New-NetIPAddress -IPAddress 192.168.0.1 -PrefixLength 24 -InterfaceAlias “vEthernet (NATSwitch)”

New-NetNAT -Name “NATNetwork” -InternalIPInterfaceAddressPrefix 192.168.0.0/24