I mostly blog about solutions I’ve made for problems I’ve encountered during my workday. The stack we use at Wehkamp is huge, so there’s always an interesting topic to blog about and many programming challenges to deal with. My main specialty is backend (.NET Core / ASP.NET / C#), but I do my fair share of Node.js and Python.
At Wehkamp we’ve been using ASP.NET for a long time. Containers brought .NET with us to our microservices architecture. We used a shell script in a special build container to build our service. Today we’ll discuss how we turned that shell script into a multi stage build Dockerfile.
At Wehkamp, we use the Hubot Grafana project to make our Grafana dashboard available in Slack. It mainly helps our standby team to make quick assessments on what’s going on with our website. Last year, we saw we could not upgrade the package from 2.5.2 to 3.0.1, because slugs could not be used anymore. But we use slugs and… quite heavily! So we did not upgrade our Grafana v7… until we got hit by the input field bug. We decided to see what we could do to bring our slug feature back to our ChatOps bot!
I always use Prettier to reformat my code in Visual Studio Code. Prettier formats CSS, HTML, JavaScript and TypeScript. Formatting helps code to look consistent and thereby more easily to read. In this blog I try to format all code I publish.
When working on a project, the need arose for better handling of enums decorated with a [Flag] attribute. In a previous article we explored how to use Handlebars.NET to generate JSON strings. In this article we’ll build further on that generator to add support for enums. We will also move away from the static JsonHandlebarsDotNet to an injectable version.
I ❤️ Handlebars! So I was very very very happy to see that Handlebars was ported to .NET! It is a mega flexible templating engine as it can easily be extended. I’m currently working on a project where a I need to parse objects via JSON templates to JSON strings. This blog will show how to instruct Handlebars to parse into JSON and add some nice error messages if your template fails.
Let’s use a small snippet to convert any article to Markdown. This might come in handy if you want to repost your articles to blogs that support Markdown like DEV.
Let’s run Jupyter notebooks in a Visual Studio Code development container, so we keep our host system clean and our development setup replicable. We’re building a scraper, so let’s add support for Puppeteer (pyppeteer) as well!
Let’s face it: sometimes DateTime is just too much: you only want to deal with dates. Since .NET 6, we finally have support for DateOnly. In this blog I’ll look at how to interact with it and how to add it to your Swagger API docs.
You have a bunch of online services that let you take screenshots of a site and save them in a folder. While it can be very useful to pay for such a system, it is not so hard to create it. Let’s use Chrome / Chromium with Puppeteer and Node.js (cluster) to take some snapshots in no-time. We’ll use the Puppeteer Cluster package to run multiple threads / workers to grab those screens in parallel. We’ll be using TypeScript.
Have you tried turning it on and off again? The web is a weird place and calls might not always succeed in the right manner. A retry with an exponential back-off mechanism helps your code to be more resilient when it connects to services outside of your control. While there are many packages that can help in this area, it pretty easy to add some utility methods to your project. In this article I’ll show how you can create a general-purpose exponential back-off and retry mechanism using TypeScript and Node.js.