Palindrome as an Interview Question

Palindrome often comes up as an interview question. In this post I will investigate 3 implementations and their relative performance.

What is a palindrome? Wikipedia says A palindrome is a word, number, phrase, or other sequence of characters which reads the same backward as forward, such as madam or racecar.

It is quite common to ask an interview candidate to implement a function to check if a given string is a palindrome. In this blog post I will show 4 different implementations. While these implementations might not handle all use cases identically, they satisfy a set of testcases to make sure they all work correctly based on a common interpretation.

Simple

Find out more


Rate Limiting Streaming gRPC Calls

In this post I investigate implementing rate limiting with .NET 7 for gRPC streaming messages. In my previous post I looked into how to apply rate limiting on gRPC requests (unary or streaming).

When we apply the ASP.NET Core rate limiting middleware to gRPC services, we can limit the rate of incoming requests. However, if the request is a long running (client stream, server streaming or duplex) we cannot limit the rate of messages sent.

In this post I create a sample rate limiter for ASP.NET Core gRPC streaming services. The limiter is built on top of .NET 7's rate limiting API.

When would I need to rate limit the incoming messages? For example clients sending long running requests with streaming data can rate limited per endpoint or per resource accessed.

Find out more


ASP.NET Core Rate Limiting with gRPC

ASP.NET Core with .NET 7 adds an interesting new feature: rate limiting. In this post, I will look into how to apply rate limiting for gRPC services with ASP.NET Core.

At the time of writing this post, the code samples are based on .NET 7 RC2.

Rate Limiting with ASP.NET Core WebApi

We can find multiple demos on applying Rate Limiting on minimal APIs. However, it is less frequently demo-ed on how to apply rate limiting on controllers. Fortunately, the documentation details this scenario. Let me quickly recap.

Find out more


GitHub Actions Template for .NET NuGet packages

This post outlines the template workflows I use for GitHub Actions to build, test and deploy .NET nuget packages.

It consists of two workflows, CI and CD. As these are templates, each repo will require some level of customization, but the structure remains relatively similar. Each step is denoted the with the current up-to-date version of the action available at the time of writing this post.

Continuous Integration

Continuous Integration (CI) is responsible for builds when new Pull Requests are opened, new commits are pushed, or master gets updated (for example a Pull Request is merged). CI is triggered on push or by workflow_dispatch which means a manual trigger.

Find out more


Even or Odd 2

In a previous post I have looked into different implementations for deciding if an integer is odd or an even number.

At the time of writing this post, the latest .NET 7 Preview 5 offers a new API to answer the above question. There are two new static abstract methods defined on INumberBase type which is implemented by numerous types including Int32. One can use these methods as static methods on generic type parameters restricted by INumberBase interface or as static methods on implementing types.

For example using it with ints:

public bool StatAbsIsOddOrEven(int number) => int.IsOddInteger(number);

Find out more