And that is all.
March 21, 2025
March 17, 2025
Code improvements checklist
- Use extension method chaining instead of wrapped method calls or constructor calls
January 24, 2025
Layered configuration of a particular IOptions in .NET
There are layers in global IConfiguration like JSON, Environment variables etc. But it is possible to leverage a similar approach to the specific IOptions configuration:
services.AddOptions<SpecificOptions>()
.Configure<IOptions<GeneralOptions>>((so, go) =>
{
so.SpecificUrl = go.Value.BaseUrl;
})
.Bind(configuration.GetSection("SpecificOptions"));
Here an instance of SpecificOptions configured from gathering values from some other options as a first layer and then from a configuration section as a second one. Setting null in SpecificOptions does not override first Configure call, but if Configure would be the 2nd layer, it would override value with null, so proper null checks should be applied if necessary.
October 12, 2023
How to change default locale in Angular
Import locale app.module.ts:
Then call registerLocaleData before @NgModule
Provide LOCALE_ID in providers section:
August 28, 2023
Testing with ILogger and container in .NET core
In order to use NullLogger with container, next configuration should be added:
services.AddLogging(l => l.AddProvider(NullLoggerProvider.Instance));
July 24, 2022
Useful libraries (updating)
BenchmarkDotNet - https://www.nuget.org/packages/BenchmarkDotNet - transforms methods into benchmarks.
ASP.NET Core OData - https://www.nuget.org/packages/Microsoft.AspNetCore.OData - create OData endpoints.
NBomber - https://www.nuget.org/packages/NBomber - load testing framework.
Verify - https://github.com/VerifyTests/Verify - assertion of complex data models and documents.
OpenIddict - https://www.nuget.org/packages/OpenIddict - OAuth 2.0/OpenID Connect flows implementation.
CsvHelper - https://www.nuget.org/packages/CsvHelper - reading and writing CSV files.
Pulumi - https://www.pulumi.com - cloud infrastructure as code using programming language.
Quartz.NET - https://www.nuget.org/packages/Quartz - job scheduling system.
AutoFixture - https://www.nuget.org/packages/AutoFixture - generates values for anonymous variables in tests.
MediatR - https://www.nuget.org/packages/MediatR - message dispatching via C# generic variance.
System.Linq.Async - https://www.nuget.org/packages/System.Linq.Async - LINQ extensions for IAsyncEnumerable.
NLog - https://www.nuget.org/packages/NLog - logging framework.
NSubstitute - https://www.nuget.org/packages/NSubstitute - mocking library
January 17, 2022
Git comment char
When git is integrated with an issue tracker that can link commit to a particular issue '#' - hash sign sometimes is used to provide issue number (for example #1234). But at the same time hash sign is used as a comment symbols in git rebase change commit message. So, comment is ignored. To overcome this it is possible to change default comment char in git locally:
January 14, 2022
WinDbg documentation
Comprehensive documentation of WinDb and other windows debugging tools https://docs.microsoft.com/en-us/windows-hardware/drivers/debugger/
December 28, 2021
git alias to pull forward only
Simple git alias that does pull --ff-only. It is possible to configure git pull to do --ff-only by default - https://blog.sffc.xyz/post/185195398930/why-you-should-use-git-pull-ff-only-git-is-a
but I prefer to have default settings for commands to have fine-grained control over the operations.
Open .gitconfig (usually it is in c:/users/YOUR-USER/.gitconfig) and add an alias:
December 16, 2021
git alias to pull another branch and checkout it
Open .gitconfig (usually it is in c:/users/YOUR-USER/.gitconfig) and add an alias:
Then instead of doing
You can do
And avoid double changes that cause reload in IDE.
December 01, 2021
Simplify folder navigation in windows terminal powershell
Open settings json file in windows terminal (ctrl+shift+,), find "actions" json array, add two commands (don't forget about preceding coma):
From now on pressing Alt+Up will go one level up (like in Windows Explorer) and pressing Alt+Down will bring powershell hint for switching the directory:
The trick here is to use \u0000 which is a terminal equivalent of pressing Ctrl+Space. It is applicable only to powershell, since there is no directory browsing feature in a regular cmd.
January 04, 2021
How to remove all local git branches except master through Powershell
git branch -D @(git branch --format '%(refname:lstrip=2)' | where {$_ -ne 'master'} )
October 16, 2020
How to remove annoying items from windows explorer context menu
Menu items should be removed from registry.
Share with skype:
Remove HKEY_CLASSES_ROOT\*\shell\Share with skype
Remove HKEY_LOCAL_MACHINE\SOFTWARE\Classes\PackagedCom\Package\Microsoft.SkypeApp(XXXXXXX and so on)\Class\{xxxxxx}
Create a new string key to forbid Skyep to create this menu again HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Shell Extensions\Blocked\{776DBC8D-7347-478C-8D71-791E12EF49D8}
Move to OneDrive:
Create a new string key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Shell Extensions\Blocked\{CB3D0F55-BC2C-4C1A-85ED-23ED75B5106B}