Is this you? As a journalist, you can create a free Muck Rack account to customize your profile, list your contact preferences, and upload a portfolio of your best work.
Claim your profile
Articles by Bohdan Stupak
Partitioning PotgreSQL Database
Introduction In one of the projects I used to work on, we've employed CQRS approach with PostgreSQL as a write storage and NoSQL database as a read storage. As a safety measure, we had a special endpoint that allowed us to regenerate entire content of the read storage based on the write storage that is supposed to be the single source of truth.
Using RAG architecture for generative tasks
Large language models are used widely across the industry these days. Yet still, many people are skeptical about their capabilities as they are quite prone to hallucination. For that reason, in this article, I decided to use LLM in a case where there are no incorrect answers: generating artistic text. However, even in the case of art which is highly subjective, there are still some quality gates (or shall I say personal preferences?).
Describing musical domain with F#
One of my recent projects was to create software that would automatically generate music based on a predefined set of rules. The degree of randomness I've planned to introduce would let me create different melodies every time, while the set of rules I was planning to create would ensure that it still would sound nice. You can access the complete source code here. Below we'll dive more deeply into the details regarding what it does.
Describing musical domain with F#
One of my recent projects was to create software that would automatically generate music based on a predefined set of rules. The degree of randomness I’ve planned to introduce would let me create different melodies every time, while the set of rules I was planning to create would ensure that it still would sound nice. You can access the complete source code here. Below we’ll dive more deeply into the details regarding what it does.
Composing poésie concrète with AWS Step Function
Concept Observing signs of russo-Ukrainian war fatigue I decided to come up with a poem called “Is the war over?”. I’ve labeled it as poésie concrète drawing an analogy with musique concrète - genre where music is composed of non-musical pieces of sound. In the same way, my poem is composed of search engine results for “russian war crimes” in the latest week which are then processed by a sentiment analysis model to extract sentences that highlight russian atrocities most properly.
Dynamic polymorphism: key concept to master OOP
The world of object-oriented programming contains many confusing mnemonics such as SOLID or design patterns. In this article, I argue that you can substitute them with understanding what dynamic polymorphism is and how it is applied. Introduction The world of object-oriented programming is a bit confusing. It requires mastering a lot of things: SOLID principles, design patterns to name a few.
Property-based Tests and Clean Architecture are Perfect Fit
Property-based testing is a technique that allows testing pure functions totally instead of relying on arbitrary values. This article highlights how it can be applied to the domain layer of a clean architecture. Introduction A lot has been written about clean architecture. Its main value is the ability to maintain free from side effects domain layer that allows us to test core business logic without leveraging heavy mocks.
Distributed locking with Redlock.net
Sometimes, there is a need to ensure that only one instance of a microservice executes a piece of code. This might be done to ensure application correctness or to implement a poor man's failover. The article shows how to perform this with Redlock.Net library. Why locking things Microservice architecture becomes widely adopted these days. One of the benefits it offers is the possibility of horizontal scaling which allows us to increase the performance of our application dramatically.
Visualizing Your Photos on a Map with React Native
React Native is a handy tool that facilitates mobile development without the need to learn specific technologies. In this article, we'll take a look at various parts of applications that displays photos' locations on a map. Back in the looney days before Russian full-scale invasion, I used to travel a lot domestically and internationally. Also at that time, I had a Nokia Lumia phone with a nice widget that displayed the locations of the photos I’ve taken on a map.
Applying custom similarity calculation in Elasticsearch
Elasticsearch has a rich set of tools to produce relevant search results. But sometimes they're not suit so well for your case so you might need to tweak similarity calculation. In this article, we'll see one such example. Presently we’ve been discussing improving Elasticsearch autocomplete functionality. For most cases, this is enough. However, in our case, things turned out to be not that rosy and we’ll have a look at why. Setup In our system we single document type per index.
Implementing Clean Architecture in Go
Holistic example of clean architecture in Go, covering development, documenting, and deploying of a web API A lot has been written about the clean architecture. Its main value is the ability to maintain free from side effects domain layer that allows us to test core business logic without leveraging heavy mocks. This is accomplished by writing dependency-free core domain logic and external adapters (be it database storage or API layer) that rely on the domain and not vice versa.
How Utilizing Lazy Evaluation and Caching Can Save Us from Wasteful Computation
I’m usually skeptical about leetcode tasks since this is not something you’ll encounter in your daily line-of-business code. But the idea behind this particular task has fascinated me. So I’ll break it down here. I’ll provide a bit simplified version of the task so you could capture the gist of it more easily. The naive solution would be to perform each operation on all elements of an array and then get element at desired index.
Improving Elasticsearch-based autocomplete
In this article we'll examine how different query-time and index-time settings influence relevance of your autocomplete query. Introduction Recently I’ve investigated autocomplete functionality of our system as there were a lot of complaints that it returns irrelevant results. The approach we’ve taken was pretty naive: our backend wrapped query into wildcard symbols and executed it as query_string on fields __title, title and commonInfo.RealName.
Overriding JSON serializer in Giraffe
In some cases, a built-in Giraffe JSON serializer might be insufficient. In this short tip, we show how to override it. I use my side-project KyivStationWalk as a set of my opinionated takes on software architecture. No wonder I use F# here. One of the types I use in this project to describe my domain is the subway station branch. There are 3 branches in Kyiv named by their traditional colors.
Strive for short-lived synchronous communication
When interacting with a service asynchronous communication often is a preferred way. However, there might be scenarios when synchronous communication is unavoidable. In this article we'll look at why and how synchronous should be minimized Introduction When interacting with a service asynchronous communication often is a preferred way.
Prefer using Stream to byte[]
While reviewing and refactoring a real-world codebase I've noticed how byte[] API is misused. That is the reason why in this article I'm sharing some thoughts on why you shouldn't evade Stream API in your code. Introduction When working with files there are often both APIs operating byte[] and Stream so quite often people chose byte[] counterpart as it requires less ceremony or just intuitively more clear.
DateTime.TryParse and the Case of Z Letter
This short tip aims to fill the gap in docs explaining what is ISO-8601 date format, how it is treated by DateTime.TryParse compared to other formats Introduction Recently, I’ve been tasked to provide date in a specific format from backend to the frontend and I noticed a behavior that I found a bit odd.
Batch Processing with Directory.EnumerateFiles
In case one wants to retrieve files from catalog, `Directory.GetFiles` is a simple answer sufficient for most scenarios. However, when you deal with a large amount of data, you might need more advanced techniques. Directory.EnumerateFiles is the API that allows you to organize batch processing for the directory with a large number of files. Introduction In case one wants to retrieve files from catalog, Directory.GetFiles is a simple answer sufficient for most scenarios.
Converting Video with FFmpegCore
FFmpegCore is a convenient wrapper around FFMpeg/FFProbe which allows convenient work with video. In this article, we'll have a look at how one can utilize it for video conversion. Introduction Working with multimedia is terra incognita for most developers since it’s something that one rarely encounters while working with usual business applications.
Understanding Dependency Injection in .NET Core with Quartz.NET example
Introduction Quartz.NET is a handy library that allows you to schedule recurring tasks via implementing IJob interface. Yet the limitation of it is that, by default, it supports only parameterless constructor which complicates injecting external service inside of it, i.e., for implementing repository pattern. In this article, we'll take a look at how we can tackle this problem using standard .NET Core DI container.
Using Span
Span is a relatively new C# feature that allows us to reduce memory allocation almost with no developer effort. In this article, we'll have a look at it and how we can use it. Introduction In my experience, the main thing to do in order to improve application performance is to reduce the number and duration of IO-calls. However, once this option is exercised another path that developers take is using memory on stack.
Refactoring String into the Specific Type
In this post, you will see cases where string type doesn’t clearly communicate all the necessary properties of a domain in question, and how this can be handled. Introduction While the article title may sound controversial as there is clearly nothing wrong with using string in your code, below I’ll show the cases where string type doesn’t clearly communicate all the necessary properties of a domain in question. Then I’ll show how this can be handled. You can watch the full code on Github.
Building auth endpoint with Go and AWS Lambda
Serverless is a great option for smallish nanoservices. It brings cost savings as well as some architectural benefit. Due to its minimalistic philosophy, Go is suitable not only for applications that leverage sophisticated concurrency, but also for simple operations as the one described in this post. This article discusses setup, authentication, using Windows and leveraging environment variables. It also shows how to do JWT generation and integration with API Gateway.
Leader election with Redlock.net
Sometimes there is a need to ensure that only one instance of a microservice executes a piece of code. This might be done to ensure application correctness or to implement a poor man's failover. The article shows how to perform this with Redlock.Net library Why locking things Microservice architecture becomes widely adopted these days. One of the benefits it offers is the possibility of horizontal scaling which allows us to increase the performance of our application dramatically.
Querying Last.fm web API with F#
Introduction Let's imagine that you have an edgy musical taste so you would like to recommend to your friends only those artists which are the most mainstream. If you have a profile on last.fm, then you could write a small tool which would query and process your listening statistics to automate this task. My tool for this job is F# programming language and I'll show you some benefits of it such as type providers or the ease of unit testing functions comparing to objects.
Ignoring operation result when using F# async computation expression
Using the code Consider this simple code downloading page contents using Puppeteer-sharp.
Lazy Behavior of IQueryable
Introduction Some of you may have encountered exception DbContext has been disposed. Here is basic explanation of why this error occurs and how to fix it. Background For our needs, let’s use a simple ASP.NET MVC application and Entity Framework to access database. Source Code For instance, let’s assume we have source code that returns collection of all products, which have price greater than or equal to 0.
Dependency injection for Quartz.NET in .NET Core
Introduction Quartz.NET is a handy library that allows you to schedule recurring tasks via implementing IJob interface. Yet the limitation of it is that by default it supports only parameterless constructor which complicates injecting external service inside of it i.e. for implementing repository pattern. In this article, we'll take a look at how we can tackle this problem using standard .NET Core DI container.
Cooking angular.js with typescript
Introduction Typescript starts to gain more and more popularity because of static typing offering its benefits. Still, some developers who are involved in supporting projects with angular.js may be stuck with lack of community offering their recipes of using angular.js together with typescript. This article will try to fill this gap. Our strategy involves shipping working product at every stage of development.
Creating holy grail layouts with CSS grid
This article shows how to use CSS grid to create holy grail layout Please Sign up or sign in to vote. The holy grail layout is a layout that consists of fixed width header, footer, left sidebar, right sidebar and fluid hero item as below. Traditionally it is composed via negative margins technique To be honest this doesn’t communicate much to me and looks more like a bunch of hacks. Luckily display: grid has arrived which allows to build 2-dimensional layout in more semantically meaningful style.
End-to-end testing of your web applications with canopy
This article will introduce to you canopy - selenium-based end-to-end testing framework that uses F#. Please Sign up or sign in to vote. - Stabilization layer built on top of selenium One of the most crucial concepts of canopy is reliability - when performing an action framework tries during time span specified via or or before failing which improves experience during writing tests.
"Method can be made static" may hide OO design flaw
Wandering through codebases I've encountered some examples of code where ReSharper issues the abovementioned warning. Although fix seems straightforward the warning itself may hide more subtle issue connected to object responsibility assignment. Let's take a look at the following code Although things may seem obvious at the first glance actually the code above is the example of Feature envy.
Querying Last.fm web API with F#
This simple application querying web API will show you some benefits of F# programming language Let's imagine that you have an edgy musical taste so you would like to recommend to your friends only those artists which are the most mainstream. If you have a profile on last.fm then you could write a small tool which would query and process your listening statistics to automate this task.
Regisrty redirection when using 32-bit application on 64-bit Windows
The article explains Windows registry redirection feature with some simple example Regisrty redirection when using 32-bit application on 64-bit Windows This article will guide you through Windows registry redirection feature, which might seem quite unintuitive at first acquaintance. Consider following situation. We have code that writes to HKEY_LOCAL_MACHINE registry on 64-bit OS.
Registry Redirection when using 32-bit Application on 64-bit Windows
The article explains Windows registry redirection feature with a simple example Registry Redirection when using 32-bit Application on 64-bit Windows This article will guide you through Windows registry redirection feature, which might seem quite unintuitive at first acquaintance. Consider the following situation. We have code that write to registry on 64-bit OS. When successfully executing this code, we somewhat unexpectedly receive no MySoftware folder at \HKEY_LOCAL_MACHINE\SOFTWARE path.
Pure CSS Salesforce-like progressbar Control
This simple salesforce-like progressbar control will guide you through some useful CSS techniques This tip covers several CSS techniques: using LESS, using and some CSS hacks. You can download the complete source code on github. LESS is CSS preprocessor which allows extending CSS with some useful features. You can learn more about it here. In this project, I use LESS variables and functions which as you can see later, allow me to work with colors in a cleaner way.
Show More
loading
Actions
Is this you?
As a journalist, you can create a free Muck Rack account to customize your profile, list your contact preferences, and upload a portfolio of your best work.Get in touch with Bohdan
Contact Bohdan, search articles and posts on X, monitor coverage, and track replies from one place.
Learn more about Muck Rack