RSSAmplifier

Blog

Dmitriy Kubyshkin

Dmitriy Kubyshkin

kubyshkin.nameRSS feed ↗9 posts

Latest posts

Win32 Window Custom Title Bar (Caption)

One would imagine that changing the colors of the built-in window title bar or at least painting your own custom one would be a pretty straightforward task. Sadly in Windows (more precisely Windows 10), it is not easy at all. It took me a few tries and multiple full days of work to find a reasonable solution that is also up-to-date. Here's how it goes...

C Language Enum Tips & Tricks

C Language provides a built-in `enum` type for listing types of things. The default implementation, however, leaves much to be desired. In this article I'm going to list some useful techniques I discovered working with C for the past few years.

Type Checking as Evaluation

If you have never been exposed to a language with a static type checking, it might be hard to wrap your head about what it is and how it works. One way to look at type checking is as evaluation of a secondary program that mirrors the structure but uses types as values. That sounds way more confusing than it actually is. Let me explain...

Big Trouble With Scrollbar Grip Minimum Size

Scrollbars are one of those things you usually do not pay much attention until you need to implement one. In a very basic form, there is just some straightforward math to learn, and you are good to go. To maintain good UX you usually want to have a minimum size for the scroll grip (the thing a user can drag), which causes math to be a bit more tricky, but nothing crazy. Real trouble begins though…

Newtype (Tagged Type) in TypeScript

One of my favorite features in Haskell is "newtype". It allows you to wrap another type without any runtime overhead. Usually this is important when dealing with types that have the same underlying representation but should never be mixed together. Here is a somewhat contrived example in Haskell: ```haskell newtype Dollars = Dollars { fromDollars :: Int } newtype Euro = Euro { fromEuro :: Int }…

Errors in JavaScript

Largely due to its complicated history and implicit coercion in many places JavaScript has a lot of inconsistencies when dealing with how errors are reported from the functions and processed by the client code. In this article, I will try to describe some of the existing strategies and will outline some new possibilities that became viable with ECMAScript 2015+ as well as things we can learn from…

How to Insert Text Into Textarea at Cursor Fast

It’s great to see the web platform grow and get features like Service Workers, but one of the areas that traditionally gets little to no attention is dealing with user input. While working on another project, I needed a way to insert some text at the current cursor position in a textarea to auto-complete what user is typing. It turns out this simple task is almost impossible to achieve if you want…

Immutable Classes in JavaScript

> "You can't touch this!" — _MC Hammer_ As the JavaScript matures and starts being used to build ever bigger projects, it might make sense to adapt some things that are generally accepted in the industry as best practices. One of those things is the usage of immutable objects throughout the application. If you are familiar with `Object.freeze`, the solution might seem straightforward. As it…

App Version From Git in Qt/QML

While making an app it is really important to keep accurate track of the versions. Usually such a tracking is implemented via tags in version control system like [git](https://git-scm.com). It’s also a good idea to keep in mind [semantic versioning](http://semver.org/) when assigning version to your code. But tagging your code with the right version number is only the first step. You also need to…