This article explains how to create a console application with logging in place using .Net SDK, Visual Studio, and Serilog. It covers setting up the project, configuring dependency injection, creating the base application, and adding Serilog. It also explains the purpose of each NuGet package used and how to configure Serilog using the Configuration Manager and Dependency Injector.
I’m a big fan of doing Proof of Concepts using a console application. The reason for this is that often what is being looked into has zero UI requirements so why use one? I also like to make sure that I have logging in place to help me understand what is going on. Below I will show how to achieve this simply.
... ➦Why did I move my site to Hugo? I wonder that myself, but at the end of the day there is a simple reason…. ease.. Well in theory, we will see how it goes.
I looked a Jekyll and almost went with it. But was not sure, you never know I may well move this to Jekyll at a later point.
I’m going to try to cross post some of my stuff to Hashnode, or I may well just post on Hashnode. I will be using the domain kenlea.blog.
I can never remember how to limit what versions of NuGet packages are allowed for a project. So here are how it’s done
When referring to package dependencies, NuGet supports using interval notation for specifying version ranges, summarized as follows:
| Notation | Applied rule | Description |
|---|---|---|
| 1.0 | x ≥ 1.0 | Minimum version, inclusive |
| (1.0,) | x > 1.0 | Minimum version, exclusive |
| [1.0] | x == 1.0 | Exact version match |
| (,1.0] | x ≤ 1.0 | Maximum version, inclusive |
| (,1.0) | x < 1.0 | Maximum version, exclusive |
| [1.0,2.0] | 1.0 ≤ x ≤ 2.0 | Exact range, inclusive |
| (1.0,2.0) | 1.0 < x < 2.0 | Exact range, exclusive |
| [1.0,2.0) | 1.0 ≤ x < 2.0 | Mixed inclusive minimum and exclusive maximum version |
| (1.0) | invalid | invalid |
Every now and again part of the Visual Studio code display vanishes on me and I can never remember the setting
Visual Studio CodeLens
In order to get it back I need to re-enable the CodeLens in the Visual Studio options
Visual Studio CodeLens Options
Securing your Pi is a must especially if you are planning to have your Pi open to the outside world. (e.g. act as a web server). Below are details of some of what you should do.
One issue with the Raspberry Pi is that the default user will always be pi. You may want to create another user to make the Pi a more secure, you can then delete the default user.
... ➦Normally when I’m running my Pi I don’t have it connected to a monitor or keyboard. This means that when installing it, I need to install it in headless mode. Below are details on how I setup in headless mode. Before doing this, you need to setup the SD Card as detailed in Building Raspberry Pi.
SSH is what I use to connect to my Pi. How I connect to my Pi and is disabled by default. However, it is possible to enable it from initial boot by creating a file called ssh on the root of the SD Card. This will enable ssh for one time only, I will explain later how to permanently enable it. NOTE: If you are using Windows make sure that the file is created with no extension. On Mac or Linux you can simply type ‘touch ssh’ and copy that file onto the SD Card
... ➦
Raspberry Pi 3+
A few days ago I managed to remove files from my Pi that stopped it working. I was thinking about rebuilding it anyway so figured now is the time to do it. Details for installing the Pi are below
This can be downloaded from the following URL https://www.raspberrypi.org/downloads/raspbian/
The download is a compressed file so you need to unzip it. There are plenty of tools out there that enable you to do this.
... ➦