Blog

New Site Look

[linkstandalone]

Hello there, just wanted to write about the new look of the website

I finally decided to do something about the terrible design on the site, we now have a navbar on all pages, a new color scheme and better formatting

Wed, 29 Dec 2021 17:06:26 +0100

Nginx redirects to unwanted port? Nginx redirects to unwanted port?

[linkstandalone]

I recently experinced on 2 diffrent occasions, Nginx redirecting to some unreachable port when the trailing slash (/) was missing

If this happens to you simply paste the following into your nginx.conf if you want to change it globally, or throw it inside your site specific config, if you want it to apply to 1 site only. port_in_redirect off; Check out the official documentation Sat, 11 Dec 2021 00:16:20 +0100

Use vim to make special characters

[linkstandalone]

If you want to make special characters in vim like æ ø å, it's possible directly in vim, it works like this.

While you are in Insert mode type "CTRL-K" and the two letter character code, so if i wanted to make "æ" i would type "CTRL-K ae", if i wanted to make "ø" i would type "CTRL-K o/" and if i wanted to write "å" i would type "CTRL-K aa"

Thu, 03 Jun 2021 22:43:31 +0200

C# WPF Async

[linkstandalone]

So recently i was working on a very resource heavy function in C#, and while the function ran, it completely halted the UI (WPF), and refused to make any updates to the UI while it was running.

So i decided to make the function Async, since that would surely fix the problem? Well no, not quite. With the function Async it completely refused to run, the reason for this is that WPF UI elements can't just be changed by something on another thread, so to solve this i used the Dispathcher function.


Dispatcher.Invoke(() => { someLabel.Content = "Not Running"; someLabel.Foreground = Media.Brushes.Red; someProgressBar.Value = 0; });

The function is a simple void, but is executed with Task.Run(() => SomeVoid() ); To give the asynchronous functionality, so the program will be running smooth and with a progress bar.

Do note that when running on another thread, you will not only need Dispatcher to change values, but also to read them.

Tue, 18 May 2021 21:51:44 +0200