brokul.dev

  • Blog
  • Archive
  • Feed
  • About

Calculating availability based on App Insights logs with Azure CLI

In this blog post, I will describe how to calculate availability (SLA) based on logs generated for existing "Web Test" in Application Insights. We will use Azure CLI to get data from a given period and Powershell to perform simple math to get the availability percentage value.

12 March 2023

Detecting the default browser font size in JavaScript

From an accessibility point of view, it's worth considering the default font size set in the user's browser. You can easily adjust your design to this value in CSS stylesheets using relative units like rem and em. There might be a situation where you need this value from the JavaScript context. How to get it?

12 February 2022

Bash script to update all NuGet and NPM packages in a solution

It's always worth being in sync with the most recent versions of libraries that you use. Naturally, it's true as long as these do not contain malicious code. In this article, you can find a simple, ready-to-use Bash script to update all NPM and NuGet packages within your .NET Core solution. Feel free to use it in your CI/CD.

01 November 2021

Authentication cookie lifetime and sliding expiration in ASP.NET Core

How to control authentication cookie lifetime, and why is sliding expiration potentially dangerous? This article contains an overview of this topic. It also shows the way to set absolute authentication cookie lifetime in ASP.NET Core.

31 October 2021

Extending parent styles in Sass to handle component states

It's a quite frequent case that some components like input fields have many states. It may look different according to some conditions. The classic example is an incorrect value in an input field which results in a red border. How to handle this in Sass?

02 October 2021

Sending files and additional data using HttpClient in .NET Core

How to send a multipart HTTP requests containing files using HttpClient in .NET Core? What to do if the target endpoint requires some additional data? This article describes the solutions for common cases and presents raw HTTP messages that are generated by the HttpClient for multipart requests.

22 July 2021

PowerBIClient and socket exhaustion in ASP.NET Core app

There are many sample solutions on the Internet that show how to use PowerBIClient in ASP.NET Core apps. The typical approach is to create a new instance of it and then use it to invoke web requests. Eventually, it is disposed. Is it a good approach?

10 April 2021

Infinite scroll in pure JavaScript for Ghost or WordPress blog

How to create a simple infinite-scroll mechanism? This article describes how infinite scroll is implemented on this blog.

25 March 2021

Adding domain to existing rule with CLI in Azure Front Door

Recently I wrote a simple script for my CI/CD which was responsible for new tenant onboarding. The key thing was to add a domain to Front Door and adjust the existing routing rule. I decided to use Azure CLI for that but there were some difficulties with making routing rules handle the new domains.

01 March 2021

Multi-tenant ASP.NET Core app - configuring authentication

In this article, we will set up multi-tenant authentication. How is it supposed to work? When a user is logged in within tenant1 then they will not be a valid user from the tenant2 point of view. We will use cookie-based authentication for that.

17 February 2021

Multi-tenant ASP.NET Core app - tenant resolution

A multitenancy is a way to handle multiple tenants on a common infrastructure. Depending on your case, tenants may share the application itself, database, or other services. In this series, we will create ASP.NET Core multi-tenant app. This article describes a tenant resolution mechanism.

08 February 2021

Proxy pattern in C# - an easy way to extend production code

According to open-close principle, code should be open for extensions but closed for modifications. In other words, you should avoid modifying production code unless it's really necessary. A proxy design pattern is one of the solutions to this problem.

01 February 2021

Fluent builder inheritance - how to make it work in C#?

Fluent builder is a well-known design pattern that helps to build objects of a given type. It makes code more readable and maintainable thanks to method chaining. The problem occurs when you try to extend the functionality of the existing builder using inheritance.

23 January 2021
© brokul.dev 2023