Some Ruby operations are painfully slow but writing a C extension to fix them is a big commitment. I wanted to explore an alternative: compile C# to a native shared library with NativeAOT and call it from Ruby using FFI. I picked C# because I know it and love its standard library. To see if it holds up I built a benchmark, reimplementing ActiveSupport’s String#parameterize in ~20 lines of C#…
One of the biggest drawbacks of SignalR is that it’s hard to scale. Microsoft provides a solution called Azure SignalR Service that promises to handle it wihout hassle. And guess what? It does! Your application doesn’t have to run on Azure and configuration is easy. It’s good.. pretty, pretty good!
Accessing Sharepoint from a .NET application without using Windows is easy. This article will download files from Sharepoint using the PnP.Core package on macOS with .NET 7.
xUnit has become the favorite unit testing tool for many .NET developers. The assertion library documentation however is quite sparse. Let’s explore the testing of list collections using a lesser known xUnit assertion, Assert.Collection .
Azure Functions is a serverless compute solution that integrates with a wide selection of cloud services to allow developers to build isolated blocks of event-driven code in a cloud-native fashion. This post demonstrates how an Azure Function written in TypeScript can interact with a database without any actual database logic in the function itself, and how to write unit tests for these functions.
The DateOnly type that was introduced in .NET 6 is convenient for exchanging strongly typed date information in APIs. Unfortunately, the ever popular JSON format has no standard for date fields. This leads to UnsupportedTypeConverter errors when trying to serialize these fields using System.Text.Json. This article explains how to create a custom JsonConverter to define the serialization format for…
Regular expressions are not a great way to validate URLs. Using Ruby’s built-in URI parser, a custom Active Record Validation Helper can be built to safely validate URLs in Ruby on Rails applications while allowing for flexible domain name allow-listing.
The new minimal APIs in .NET 6 make creating low-ceremony microservices and backends very appealing, and they’re also a great way to add simple endpoints to Blazor Server applications, complete with Dependency Injection and JSON serialization.
Blazor is so great that I’d rather not use anything else. That made me wonder: can I build SVG files using Razor syntax and is that a good idea? The answers are absolutely and definitely!
In sociology, the broken windows theory states that if a window in a building is broken and is left unrepaired, all the rest of the windows will soon be broken. This equally applies to software developement is it’s importatnt to be aware of this and make fixing these broken windows a team priority!
Trix is a rich text editor that is popular with Ruby on Rails developers. In this post we’re going to take Trix out of Rails and use it inside an ASP.NET Blazor application by making a drop in replacement for Blazor’s InputText component.
CircleCI provides several official orbs for interacting with Amazon Web Services, but not for CloudFormation specifically. However, that doesn’t mean you need to reach for a community orb to update your stacks from a CI pipeline. A single AWS CLI command is all that is needed to push template updates to your AWS account.
I always thought indentation was a solved problem, until I needed to adapt to something different. Here’s a trick to force correct indentation for your .NET projects by using the Omnisharp language server.
Years ago I replaced my IKEA TRÅDFRI gateway with a Rasbperry Pi with a Raspbee, running deCONZ. It allowed me to mix and match ZigBee devices from various brands and make flexible configurations. Plus the integration with Home Assistant is superb. However, one thing I lost is the ability for the IKEA remote to control my lights directly when the deCONZ gateway is down, which was possible back…
People have been sleeping on .NET and they’re mising out. With the release of .NET 5 this month, it’s time to consider C# .NET for your next project! It’s a great general-purpose software framework that’s likeable, in high demand, easy to sell to customers, has decent performance, is completely open source, mature and has a large backing. What more could you want? Let me…
Cypress makes writing integration tests (or system tests) easier and more fun. This posts shows you the tools needed to add Cypress tests to your Rails application.
Gitlab CI allows you to create and manage Kubernetes clusters directly from the interface and easily deploy builds to your existing Kubernets infrastructure. Here’s how.
Since the introduction of the Magic Keyboard, interest in using an iPad as a remote terminal for desktops is bigger than ever. The tool of choice for many iPad enthusiasts seems to be Jump Desktop, which supports VNC, RDP and their proprietary Fluid protocol. Let’s try to get the most out of it when connecting to a macOS desktop.
Prometheus Operator is the perfect cloud-native monitoring solution for Kubernetes. By deploying the Helm chart you get a preconfigured Prometheus and Grafana setup plus an array of CRDs to add monitoring your own services. Not everything necessarily lives in a Kubernetes cluster, though. So how would you add external targets to a Prometheus Operator setup? One could define an Endpoint, Service…
TL;DR I wrote a super fast Excel file reader called Xsv , check it out! It’s fast and low on memory because it uses a SAX-based XML parser instead of a DOM-based one. Here’s some benchmarks to prove it. Simple API for XML, or SAX for short is an event-based API, of which development started in December 1997 1 . It is an alternative to the well-known Document Object Model, which was…
The topic of this post is neither new nor original, so I’m going to keep things short. People have been using jemalloc with MRI Ruby for years and praising it’s benefits all the while. The TL;DR here is: for Rails apps, using jemalloc will reduce memory consumption and might increase performance a little. Why? To illustrate my own experience, here’s a Grafana graph showing the effect of switching…
Ruby on Rails 6 allows us to leverage the excellent Webpack bundler to manage JavaScript and CSS components in a way that’s more native to those technologies than the old asset pipeline: no more gems to wrap JavaScript libraries and no more libv8 gem issues. Another advantage Webpack brings is the excellent source maps. I was surprised to see the source code of my Svelte components, complete…
For a long time I’ve been thinking about getting out of my comfort zone and try to develop a game for something like the Sega Mega Drive or maybe the Atari 2600. But for a spoiled high-level developer like me that would be quite a daunting task so I’ve postponed indefinitely. Then last week, in the midst of the COVID-19 crisis, I stumbeld upon this awesome project called PICO-8. To…