There can be only one return; 0 RLY?

My opinions and choices on style of coding evolves and changes over time. By blogging about this now, I can refer back later when I change my mind. I can also elicit the opinions of others to influence me to change my ways if I happen to be wrong and…

In C#, your structs should be immutable.

I wrote some code. It was simple code. I had a collection. I iterated over the collection and updated the values. I did this several times in an outer loop. The code didn't work. Why didn't it work? My collection was an array of Structs. When I pulled an item…

"failed to peek context header from STDIN" and how to fix

The docker guidance says you can run docker build piping the dockerfile: #On linux $ docker build - < Dockerfile and on Windows it says to do this: #PowerShell Get-Content Dockerfile | docker build - Nice. But I've been getting this error all day... > Get-Content Dockerfile | docker build - unable to…

Form posts with PowerShell

This article is based on an answer found and updated on StackOverflow. I'f you have used PowerShell for much at all, you are probably familiar with Invoke-WebRequest. But did you know you can carry around a session and have it automatically add and update cookies for you? The Scenario I…

Manage your hosts entries better

If you are working with a lot of sites in IIS then you will be familiar with the hosts file on your computer. %SystemRoot%\System32\drivers\etc\hosts, usually found in C:\Windows\System32\drivers\etc\hosts. This file acts as a DNS mapping table used by your computer. As…

A couple of debugging tips

I had an idea of something I wanted to post, but a quick google turns up I posted it 6 months ago, so here are some debugging tips. Console Break So you are writing a console app? Cool. Want to see the output? Of course, you do. But when you…

Make me a sandwich

A lesson in powershell. I typed this: > iisreset Which responded with this: Access denied, you must be an administrator of the remote computer to use this command. Either have your account added to the administrator local group of the remote computer or to the domain administrator global group. So…