Skip to content

Blog

Little SQL Server Tricks: Creating a Range of Numbers

Some tasks I do in SQL Server would be much simpler if I could get a sequence or a range of numbers. I could create users#1 to user#1000 without any programming – just by using plain old SQL. PostgreSQL offers the generate_series function for such use cases. Unfortunately, there is nothing comparable in SQL Server. All you can find on Google are solutions that are complicated, long and impossible to remember.

Working with Temporary Files in .Net

Working with files in .Net is straightforward. You can use the File or FileInfo classes and call the method with the self-explaining name to create, copy, move or delete files on your system.

However, sometimes all you care about is to write some temporary data to a file. In this case the Path.GetTempFileName() method is exactly what you need. This method creates a uniquely named, zero-byte file in the user's temporary folder and returns the full path of that file.

How to Fix Network Errors with Docker and Windows Containers

Last week I run into this annoying problem when I tired to run the .Net samples for Docker:

Step 7/23 : RUN dotnet restore
> Running in ce2d8740cf2e
Restore completed in 389.74 ms for C:\app\dotnetapp\dotnetapp.csproj.
Restore completed in 220.85 ms for C:\app\utils\utils.csproj.
C:\Program Files\dotnet\sdk\2.2.402\NuGet.targets(123,5): error : Unable to load the service index for source https://api.nuget.org/v3/index.json. [C:\app\dotnetapp.sln]
C:\Program Files\dotnet\sdk\2.2.402\NuGet.targets(123,5): error : No such host is known [C:\app\dotnetapp.sln]
The command powershell -Command $ErrorActionPreference = Stop; $ProgressPreference = SilentlyContinue; dotnet restore returned a non-zero code: 1

Partial Interfaces in C# - They Exist and There Is a Use Case for Them

Partial classes are a great way to keep (automatically) generated code away from manually written one. All you need to do is to use the partial keyword in front of your class definition and the compiler will combine those partial classes to one single class.

At work, we currently try to figure out a way that would offer us the same flexibility but for interfaces. We have generated classes and can generate an interface for their methods, but we want to be able to extend the functionality with partial classes for the more complex cases. How can we get those methods in the (manually written) partial class in the same interface, without risking those changes to be overwritten with the next run of the generator?

The Most Undervalued Refactoring: Slide Statements

When we refactor our code, we want to make it better. Not just a tiny bit better, a lot better. Therefore, we look at refactorings that change our code in big steps, like extract method or extract class. However, tiny little risk-free steps can bring us to insights that we miss otherwise. Sliding lines of code around is such a tiny little step and often overlooked. What could possibly be gained if a single line of code is moved to another place in the same method? As it turns out, a lot!

How to Force a Group Policy Update on Windows

Group Policy is a feature of the Windows operating system that lets you define company-wide rules that are applied to all accounts and machines in an organisation. For example, your company can use a ruleset in a Group Policy Object (GPO) to prevent you from accepting third-party cookies in your browser or set the location of your home directory to somewhere else than C:\Users\yourname. When everything works as it should, you do not need to know anything about them. However, when things go wrong you better know at least the two commands I explain in this post.

3 Great Resources to Start with Docker (& .Net)

Popular technologies come with an enormous amount of "promotional" material. Docker is no exception to this rule: you find an endless stream of things to read, to watch and to listen to about Docker and containers. With only a limited amount of time at your hand, where should you spend it?

A few weeks ago, I was facing the same problem. I found many things that were not so useful, and I spent far too much time on them. However, at the same time I found the 3 resources I like to share with you today. I hope they can be of great use for you too. I am still new to the topic and appreciate if you post your favourite books, videos and tutorials as a comment to this post.

Different Styles for Examples in BDD

Behavior-driven development (short BDD) is all about examples. They are used to explain what should happen when certain events occur and what exactly the meaning of a certain requirement is. So far all is simple and straight-forward. The challenges come with writing those examples. There are different ways to express the same ideas and not every style works with every audience.

Where Are the Windows Lock Screen Images Stored?

Today's post is not about software development. I like interesting pictures and the Spotlight images used in the lock screen of Windows 10 are often so interesting that I like to keep them for longer. Those images are stored on your computer, you only need to find them - but where?