Stefán J. Sigurðarson
  • Home
  • Speaking
  • Contact
Subscribe
c#

Fast ManualResetEventSlim checks when waiting is rarely needed

I was looking at some code optimizations for the RabbitMQ .NET client and noticed that in one place on the hot path the Wait() method was being called on a ManualResetEventSlim which was already set most of the time, and thought that might be overkill.

  • Stefán Jökull Sigurðarson
Stefán Jökull Sigurðarson Feb 22, 2021 • 2 min read
Using HaveIBeenPwned, Application Insights and Grafana to detect credential stuffing attacks.
Security

Using HaveIBeenPwned, Application Insights and Grafana to detect credential stuffing attacks.

Today I want to share with you a method we use to detect and react to credential stuffing attacks in real-time using the PwnedPasswords API, Application Insights and Grafana.

  • Stefán Jökull Sigurðarson
Stefán Jökull Sigurðarson Sep 4, 2020 • 3 min read
c#

Real world example of reducing allocations using Span<T> and Memory<T>

I have been planning to write this post for a few months now but always seem to have found something new to add. This all started when I decided to look at the RabbitMQ .NET Client source code to see if I could make improvements to the asynchronous logic and

  • Stefán Jökull Sigurðarson
Stefán Jökull Sigurðarson May 1, 2020 • 10 min read
.NET/Visual Studio Productivity Tips - Part 1

.NET/Visual Studio Productivity Tips - Part 1

There are many useful shortcuts and methods in .NET and Visual Studio to make coding and debugging a lot easier. I'm going to share some of my favorites.

  • Stefán Jökull Sigurðarson
Stefán Jökull Sigurðarson Feb 9, 2020 • 2 min read
C# 8 -  Null coalescing/compound assignment
c#

C# 8 - Null coalescing/compound assignment

There are a lot of cool new features in C# 8 and one of my favorites is the new Null coalescing assignment operator.

  • Stefán Jökull Sigurðarson
Stefán Jökull Sigurðarson Nov 25, 2019 • 2 min read
You don't need to be a rocket-scientist to contribute to .NET Core!
.NET Core

You don't need to be a rocket-scientist to contribute to .NET Core!

Sometimes when I'm talking with other .NET developers, the "I don't understand why Microsoft doesn't provide X functionality" or "Why hasn't Microsoft fixed Y yet?" topic comes up. Guess what? You can fix all this yourself! Because .NET Core is open source.

  • Stefán Jökull Sigurðarson
Stefán Jökull Sigurðarson Nov 4, 2019 • 3 min read
asp.net

Mocking JWT tokens in ASP.NET Core integration tests

As we've been migrating services over to .NET Core we needed to mock JWT tokens in ASP.NET Core integration tests. I finally found a way that worked.

  • Stefán Jökull Sigurðarson
Stefán Jökull Sigurðarson Aug 28, 2019 • 2 min read
EVE Online account security - Part 2 - Pwned Passwords details, CSP and HSTS
EVEOnline

EVE Online account security - Part 2 - Pwned Passwords details, CSP and HSTS

In my previous post I showed you how we integrated the Pwned Passwords check from Troy Hunt's https://haveibeenpwned.com into our login pages on the EVE Online SSO, which is used by our game launcher, when logging into our websites and when logging into 3rd party integrations. Our feedback

  • Stefán Jökull Sigurðarson
Stefán Jökull Sigurðarson May 6, 2019 • 5 min read
Monitoring GC and memory allocations with .NET Core 2.2 and Application Insights
.NET Core

Monitoring GC and memory allocations with .NET Core 2.2 and Application Insights

With the new event source in .NET Core 2.2, a whole heap of diagnostics information can now be gathered in-process which can help you to gather information about your application behavior and to help you troubleshoot issues.

  • Stefán Jökull Sigurðarson
Stefán Jökull Sigurðarson Jan 9, 2019 • 7 min read
EVE Online account security - Part 1 - Pwned Passwords
PwnedPasswords

EVE Online account security - Part 1 - Pwned Passwords

Sitting in our Reykjavik Offices last April, I read one of Troy Hunts blog posts about Pwned Passwords mentioning how he launched V2 of his API allowing anyone to check their passwords to see if they had been included in known security breaches. I thought how cool that feature was

  • Stefán Jökull Sigurðarson
Stefán Jökull Sigurðarson Aug 11, 2018 • 2 min read

Benchmarking and performance optimizations in C# using BenchmarkDotNet

Hello friends! Long time, no blog, but now it's time to for something fun. I happened upon the awesome BenchmarkDotNet library the other day, which makes it incredibly easy to write good and solid .NET benchmarks. You can find a good tutorial on how to get started using it by

  • Stefán Jökull Sigurðarson
Stefán Jökull Sigurðarson Jun 4, 2016 • 7 min read

Add your own performance counters to Application Insights

I have been trying Application Insights for awhile now and while it is a fantastic tool I do feel it is missing several important performance counters out-of-the-box for .NET applications. Among them are several counters from the .NET CLR Memory category which I'm going to use as an example for

  • Stefán Jökull Sigurðarson
Stefán Jökull Sigurðarson Feb 21, 2016 • 2 min read

Using Docker Tools on Windows with Hyper-V instead of Virtualbox

Docker is a fantastic tool, and the Docker Toolbox is a must to manage it. If you install the Docker Toolbox on a Windows machine, the installer automatically installs Oracle Virtualbox to run the Docker virtual machine. That always annoyed me, since Hyper-V has now been a part of the

  • Stefán Jökull Sigurðarson
Stefán Jökull Sigurðarson Feb 5, 2016 • 1 min read

Using Application Insights with Ghost 0.7

Hello friends! I've been taking a look at Microsoft's Application Insights recently and decided as a test to see how hard it would be to integrate with the Ghost blogging platform. Application Insights is Microsoft's application performance monitoring platform. It is build into Azure and provides excellent insights into both

  • Stefán Jökull Sigurðarson
Stefán Jökull Sigurðarson Sep 10, 2015 • 3 min read

Microsoft finally fixes Storage Spaces, adds rebalancing command!

Anyone that has used Storage Spaces has probably seen that Storage Spaces does not redistribute files when a new disk is added to the space. Let's say you had a Storage Space with two 1 TB disks. If they filled up and you added a third 1 TB disk, you'd

  • Stefán Jökull Sigurðarson
Stefán Jökull Sigurðarson May 8, 2015 • 3 min read

How to flash a custom Country Variant firmware with the Windows Phone Recovery Tools

This is a way to install a different country variant firmware (or any other official firmware for that matter) to your Windows Phone using the Windows Phone Recovery Tools than the phone says it should install. Note: This is not an officially supported method of recovering to a different country

  • Stefán Jökull Sigurðarson
Stefán Jökull Sigurðarson Feb 16, 2015 • 3 min read

Google authorship and Google+ custom URLs

I have been trying to get Google Authorship to work properly with this Ghost blog for a while now as per these fine instructions from Christiaan Hendriksen. I added the necessary links into the footer of my blog pages as well as added link back to my blog on my

  • Stefán Jökull Sigurðarson
Stefán Jökull Sigurðarson Jun 24, 2014 • 1 min read

System.Net.HttpClient Best Practices

What is HttpClient HttpClient is a Portable Class Library from Microsoft for HTTP communications. It is completely asynchronous and has excellent features for extensibility. It is absolutely great, especially when communicating with REST based services. It's miles better than the old HttpWebRequest and is much easier to work with in

  • Stefán Jökull Sigurðarson
Stefán Jökull Sigurðarson Jan 3, 2014 • 2 min read

Add New Relic performance monitoring to the Ghost blogging platform

I love New Relic. It's one of the best performance monitoring tools I have ever used, so when I saw they added support for node.js I decided I had to see if I could integrate it into my Ghost blog. This guide assumes that you know how to deploy

  • Stefán Jökull Sigurðarson
Stefán Jökull Sigurðarson Nov 5, 2013 • 1 min read

Using extension methods to keep yourself DRY - Part 3

Hi there and welcome to part 3, the final in the series. It's time to put the icing on the cake to simplify our DAL code. In Part 2 we ended up with this code for our DAL: public Person GetPerson(int id) { using (var connection = new SqlConnection("SomeConnectionString&

  • Stefán Jökull Sigurðarson
Stefán Jökull Sigurðarson Aug 4, 2013 • 3 min read

Using extension methods to keep things DRY – Part 2

So, in Part 1 we used simple, basic and reusable extension methods to make our code a little bit easier to read. Let's do something more advanced. After Part 1 we ended up with our DAL code looking like this: public Person GetPerson(int id) { using (var connection = new SqlConnection(

  • Stefán Jökull Sigurðarson
Stefán Jökull Sigurðarson Aug 3, 2013 • 3 min read
extension methods

Using extension methods to keep things DRY - Part 1

I'm a big fan of DRY (Don't Repeat Yourself). If you find yourself writing the same code again and again, you should see if you can extract that code out to a method to prevent you from repeating the same code often. A pet peeve of mine is your typical

  • Stefán Jökull Sigurðarson
Stefán Jökull Sigurðarson Aug 2, 2013 • 2 min read
webapi

ASP.NET WebAPI, load balancers and SSL termination.

I recently encountered an issue in our ASP.NET WebAPI application, which sits behind a load balancer that does SSL termination. The load balancer gets a HTTPS request, decrypts it, unwraps the original HTTP request and forwards that to the application servers, freeing them from the SSL load. In our

  • Stefán Jökull Sigurðarson
Stefán Jökull Sigurðarson Jun 18, 2013 • 2 min read
entity framework

A way to unit test data access logic when using the Entity Framework.

I've spent a lot of time wondering about the best way to unit test my data logic when my filtering and paging logic is in code, such as when using the Entity Framework, and I finally decided on a strategy that I find "good enough". When I started

  • Stefán Jökull Sigurðarson
Stefán Jökull Sigurðarson Jun 5, 2013 • 3 min read
async

Async/await and the Task Parallel Library don't mix

I found out the hard way a few days ago that async/await and the Task Parallel Library don't mix very well. I was working on a project at work and was running code that we hadn't properly run since we upgraded our project to .NET Framework 4.5. We

  • Stefán Jökull Sigurðarson
Stefán Jökull Sigurðarson Jan 14, 2013 • 2 min read
Stefán J. Sigurðarson © 2022
Powered by Ghost