The Git staging area hinders experimentation

What is Git staging area Unlike the other systems, Git has something called the “staging area” or “index”. This is an intermediate area where commits can be formatted and reviewed before completing the commit. … This allows you to stage only portions of a modified file. From https://git-scm.com/about/staging-area. There are three different “repository states” in Git: the HEAD, the staging area, and the working tree. The HEAD represents the commit that you have checked out, which is the latest saved snapshot of your project. The HEAD state is stored in the Git object store and can be recovered using the command git reflog. The working tree represents the current state of the project in the file system. The working tree state is not persistent; commands such as git status generate the working tree state on the fly by reading the file system metadata. The staging area stores the changes that you want included in the next commit. However, the staging area itself is not recoverable. If you modify the staging area with commands like git add, the previous staging area is gone forever. ...

September 27, 2025

Why is out-of-source building more important than ever?

In the software industry, it is known that an out-of-source build is superior to an in-source build. However, despite the fact that mature build systems like CMake and Meson have out-of-the-box support for out-of-source builds, many projects are still built in-source. Many agree that in source builds more straightforward to setup, out of source builds are “cleaner” and easier to manage. Some projects are not being switched because the current setup is sufficient and the “out-of-source build” is considered a nice-to-have feature. ...

September 13, 2025

Stylus, Wayland, libinput and kwin

Stylus, Wayland, libinput and kwin Have you ever wondered how krita can turn your stylus into an eraser when you press the button? How does input handling work in Linux under wayland? The kernel All these key events, mouse movements and stylus events are first transmitted to the kernel via variouse hardware protocols such as USB or Bluetooth. Then the Linux kernel makes these device available via udev. Udev exposes hotplug devices to user space programs, and userspace programs can query device informations via the libudev library. However, device events are emitted by evdev interfaces. Evdev maps raw input events into generic high-level input events. You can think of this as the Linux kernel seeing input events as just a bunch of 0’s and 1’s, but after evdev it suddenly means something like mouse movements events, keystroke events, etc. ...

December 25, 2022

How to build KDE APP on Qt6

How to build KDE APP on Qt6 With the Qt6.4 release last month and the ongoing porting of most KDE Frameworks and Applications to Qt6, it’s time to write a post about how to build KDE applications on Qt6. This guide is intended for developers who want to port their own applications build on KDE frameworks. I’ll use the porting of KWeather as an example. KWeather is a weather forecasting App build on top of Kirigami, it also relies heavily on KWeatherCore framework for its core functionality. So I’ll also cover the porting of KWeatherCore. ...

October 4, 2022

Thoughts on Software Wizardry

Thoughts on Software Wizardry Last year is the year I started programming extensively. As I’ve worked on different languages and systems, I’d like to share some thoughts with you. I define software wizardry as coding tricks that solve problems in unconventional ways that are often obscure and hard to get right the first time. How not to code in Ruby Ruby is invented to increase productivity, and part of that productivity boost comes from monkey patching and insane meta-programming capabilities. ...

February 1, 2022

Ruby Ractor and Parallelism in Interpreted Languages

Ruby Ractor and Parallelism in Interpreted Languages Ractor One of the major feature of Ruby 3.0 is the introduction of ‘ractor’. Ractor is a new concurrent abstraction for Ruby. Unlike Ruby threads, ractors can run in parallel. Due to the Ruby Global Virtual Machine Lock(GVL), even each Ruby thread is mapped to native thread, there can only be one active thread running. But after the introduction of ractor, there can be multiple GVL, each ractor has one. That’s why ractors can have parallel execution. ...

September 12, 2021

Ruby Meta Programming Performance

Ruby meta programming performance In 2015, Pragtob wrote a blog post about Ruby meta programming. Well, you may wonder why I’m talking about a blog that wrote five years ago while the computer science is progressing at ever-increasing speed. I searched for it, because in work we were hit by this problem. In work we use Cocoapods to manage dependency. In a project with few pods you won’t notice the speed of Cocoapods. But what if, let’s say, 600+ pods? It can take half a minute just for Cocoapods to generate XCode Project files! We managed to narrow down the performance issue to this very Ruby file. On the surface, it’s pretty harmless. There is a helper method that can generate other methods using meta programming, saving the hassle to manually write things like sorting results, memorizing… However, there are also some methods that merely return a constant string but also use this helper. Methods defined using define_method have small overhead, but when the method get called tens of thousands of times, the overhead is big enough to use some monkey patching to optimize it. I monkey patched those methods that use define_method but simply return a constant string. Re-define those methods with plain def resulted in a 5s optimization. 5s may not sound like much, but in programming world, it’s like 3 years! ...

September 5, 2021

Delete the QQmlApplicationEngine?

How I tried to delete QQmlApplicationEngine for less memory usage Qml Qml manages to separate UI and backend logic, one can adjust c++ code without breaking UI, or develop different front end without implementing same logic twice. As plasma mobile developers, we can utilize the flexibility of Qml and Kirigami framework. Making apps that look equally beautiful on mobile and desktop platform. However, the high memory usage is its major drawback. On a device like pinephone which only has 2 Gigs of ram, low memory consumption is crucial. ...

August 31, 2020

Plasmoid with C++

Plasmoid with C++ the screenshot is at the end of this post I’m developing a Plasmoid for Plasma Mobile. Called KClock-Plasmoid, as its name suggests, it’s a plasmoid for KClock. The goal is to display time, next alarm and stay at system top panel to indicate KClock is running in background. KClock side So the goal is pretty simple, and all I have to do is to find a way to share information from KClock to the plasmoid. However the solution isn’t that trivia. As it turned out, DBus is perferred for IPC(Inter-process communication). Before start working on plasmoid, I need to expose some of the class of KClock to DBus first. Since KClock is built upon Qt, I choose to using Q-DBus as it will save a lot of effort than using low level interface. Now the problem is - I don’t know how to use Q-DBus. As usual, I went to the Qt documentation and to my surprise, it spent most content to describe the concept of DBus and compared to Qt’s signal/slot machinism. Although useful as it is, lack of examples meaning I still didn’t know how I can use it in my code. Thankfully, KDE has its own tutorial about DBus and it provides multiple examples. You can find it here. ...

August 12, 2020