Ten years of ThinkPadding

I’m the author of the title picture, and these are my ThinkPads. I’ve been very loyal to the ThinkPad brand for more than a decade. Until Lenovo sold me a lemon — ThinkPad X13 AMD. That event encouraged me to reflect on my loyalty. Which I did, and now I’m happy to share the results.

How did I reflect? I looked at the ThinkPad evolution under Lenovo by comparing all the models I own: X220, X270 and X13 AMD (and occasionally a very similar T14s). If there was something I liked in X220 which Lenovo killed in subsequent models, I put it on the bad list. If there is something that Lenovo kept or even improved in its newer models, I put it on the good list. By doing so, I was hoping to understand if my loyalty to ThinkPads still has any rational grounds or is mainly driven by habit.

In the end, as a bonus, I will share what’s so awful about X13 AMD (and any other AMD-based laptop sold by Lenovo).

Caution: Biases ahead 😉

When I started working on this post, I did not know where my reflecting would lead me. I admit that I had a feeling I was going to bash Lenovo for selling me a terrible product, but nevertheless, I tried to remain calm and rational. Despite my trying, you may find some statements biased and unjustified

continue reading →

Eliminate backlight flicker with Intel i915

The brightness of LED backlight in TFT displays is sometimes controlled using a technique called PWM or pulse width modulation. If implemented incorrectly, particularly if PWM frequency is too low, it can introduce distracting visual effects and induce eye strain, headaches, and even dizziness in some people[1].

Many older laptops set PWM frequency for their backlight too low. Luckily, in laptops equipped with Intel i915 GPU the PWM frequency is often controlled by the GPU and thus can be adjusted by a software.

continue reading →

You may be doing FP already

Functional programming (FP) has been a somewhat hot topic in recent years in my surroundings. Although in my close surroundings people are usually not zealous or overly excited, I do notice sometimes talks, discussions and vocally expressed opinions where tremendous benefits of FP over other paradigms are claimed, through presenting FP as a fundamentally new approach to writing code, opposite to, say, OOP. Some go as far as saying, that one must fully ditch OOP and all related experience because it’s all just a mistake.

Such extreme claims are rarely challenged. When a person with an OOP background gets involved in any FP-related discussion, it quickly gets overwhelmed with new unfamiliar vocabulary: algebras, monads, semigroups, functors, type classes…​ And I start questioning intents of those claims — are they made to make people shift to FP, or to prove, that some definition of FP is better than some definition of OOP?

With this post, I hope to show that FP can be seen as an evolutionary step, a generalization over practices we already consider the best in OOP paradigm. And if viewed like this, it can be useful even when adopted gradually. I hope this point of view will persuade programmers to look into FP and to borrow new techniques from it to improve non-FP code.

continue reading →

Filtering ScalaTest tests by tags in sbt

ScalaTest lets you tagging your tests with arbitrary tags and then filtering by tags when executing tests.

It’s not immediately obvious though, how to make use of this in sbt, at least I couldn’t find an answer on the very first page in Google or StackOverflow, and I remember myself looking for a complete solution for quite a while, so here it is.

continue reading →

Turning Synology NAS into a geeky media server: PulseAudio

Warning:

This post was written in pre-docker era. Back in the time it was necessary to perform many things that are no longer required on modern devices (like installing Debian Chroot package which, expectedly, is no longer offered).

Modern devices with Docker support or equivalent features (FWIW, my choice is Linux Station from QNAP) are much more friendly towards linux enthusiasts

Previously we’ve covered ALSA setup and Debian chroot.

In this post I’ll describe how to set up PulseAudio in Debian chroot, so that it’s possible to stream any sound from linux-powered pc to a sound card connected to Synology NAS.

continue reading →

Overloading that is not permitted or Java bridge methods

Most of my technical interviews for Java developer position include a puzzle, where candidate should implement 2 very similar interfaces in a single class:

// Implement both interfaces in a single class if possible
// Explain why possible or not possible

interface WithPrimitiveInt {
  void m(int i);
}

interface WithInteger {
  void m(Integer i);
}

Sometimes candidates, not being sure about the right answer, are willing to solve the following puzzle instead (I give it to candidates later anyway):

interface S {
  String m(int i);
}

interface V {
  void m(int i);
}
continue reading →

Turning Synology NAS into a geeky media server

Warning:

This post was written in pre-docker era. Back in the time it was necessary to perform many things that are no longer required on modern devices (like installing Debian Chroot package which, expectedly, is no longer offered).

Modern devices with Docker support or equivalent features (FWIW, my choice is Linux Station from QNAP) are much more friendly towards linux enthusiasts

I’m not a huge fan of Synology. I bought my DS214 by friend’s recommendation and became frustrated with it right after the purchase. Bundled software was limited and buggy. Many people find Synology products great. But for me it just didn’t work well because it forced its use cases on me instead of being a helpful tool for my own very specific use cases.

Anyway, I wasn’t willing to lose money on reselling my NAS, so I decided to get as much as possible from it and currently with my DS214Play I can:

  1. Play virtually any sound via connected USB sound card.
  2. Particularly, I can play my huge collection of high-resolution music in various formats (with replaygain tags respected). All that thanks to mpd, which I can control from any decent phone, web-browser or even smart-watch and scrobble all statistics to Last.fm.
  3. Stream sound from my laptop via PulseAudio, while watching videos on YouTube or movies.
continue reading →

randrctl — profile-based screen manager for X

While having some free time, decided to automate one of my daily routines — setting up external display.

Idea appeared long before I was told about famous (or not?) autorandr project. So if you are familiar with autorandr, you are already familiar with randrctl idea.

continue reading →

How Java logging frameworks determine caller class and method name

This post describes how java logging frameworks (log4j, for example) know the exact place in code (class and method name), where the logging statement was invoked.

I decided to write this post because often I meet developers who do not understant what is the cost of writing caller information to logs, or why the cost is so high.

continue reading →

Listen tracks from youtube in mpd

continue reading →