Skip to content

Wednesday, 1 November 2023

The other day I had to dive into the ksmserver code, the core of session management in KDE Plasma, but found it all a bit difficult to read. If only I could get a callgraph I thought…

Turns out it actually is possible!

In fact it is almost too easy with clang/llvm. There are already solutions that attach LLVM bitcode to existing binaries. e.g. gllvm. gllvm basically is a shim sitting between ninja and the actual compiler and injects some behavior for us. This enables the use without having to refit anything in our existing code. You might note that clazy, our most excellent code analyzer, works in a similar fashion.

Here is how to use it:

# install gllvm (NOTE: as a pre-requisite you should have Go properly set up)
go install -v github.com/SRI-CSL/gllvm/cmd/...@latest

# clone plasma-workspace
git clone https://invent.kde.org/plasma/plasma-workspace
# change directory
cd plasma-workspace
# export environment variables
export CXX=gclang++
export CC=gclang
# You may need to set some additional vars so gllvm can find your compilers
## export LLVM_CC_NAME=clang-16
## export LLVM_CXX_NAME=clazy
# Configure
cmake -S . -B build
# Build
cmake --build build/
# extract the bitcode (into build/bin/ksmserver.bc by default)
get-bc -m -v build/bin/ksmserver
# Run through llvm's opt program to generate a callgraph
opt --disable-output --passes=dot-callgraph build/bin/ksmserver.bc
# copy into working directory
cp build/bin/ksmserver.bc.callgraph.dot callgraph.dot
# prettify the c++ names (this may produce invalid labels, so I'm skipping it here)
## cat build/bin/ksmserver.bc.callgraph.dot | llvm-cxxfilt > callgraph.dot
# generate an SVG of the graph
dot -x -Tsvg -ocallgraph.svg callgraph.dot
# we now have a callgraph.svg \o/

Depending on the complexity of the software and how many libraries it uses this graph may be incredibly large and verbose though. We’ll need to apply some filtering to make it useful. Or at least I thought so when working with ksmserver.

To further filter the graph you can use the gvpr helper. It is a bit clunky but gets the job done. You can build a filter expression to only include interesting functions like so

N{
    if ($.label!="@(*_ZN9KSMServer*)" || $.label=="@(*metacall*)")
        delete($G, $);
}

and then filter the dot graph with

# Filter out uninteresting functions (filter.prog is the filter expression from above)
gvpr -c -f filter.prog build/bin/ksmserver.bc.callgraph.dot > intermediate.gv
# Filter out all empty nodes (they call nothing and are of no interest)
gvpr -c "N[$.degree==0]{delete(root, $)}" intermediate.gv > final.gv
# generate an SVG
cat final.gv | dot -x -Tsvg -ocallgraph.svg

Final result

Screenshot

Tuesday, 31 October 2023

For a project of mine I need gamepad support. In the past, I’ve happily used QtGamepad, but that has not been ported to Qt 6. It’s not dead, but Andy (QtGamepad’s maintainer) wants to do some re-architecting for a Qt 6 release.

I need QtGamepad now, however, so I’ve ported it myself. It’s not a whole lot of code and Qt’s pro2cmake.py made it a breeze. I’ve renamed the whole thing to QtGamepadLegacy and pushed it to GitHub. So whenever the official QtGamepad is released there should be no naming conflicts. I’ve tested with Qt 6.6.0 and the evdev plugin.

I don’t plan on adding any new features to the port. I’ll try to keep it compatible with upcoming Qt releases, though.

Monday, 30 October 2023

Embed Rive in your QtQuick applications

Learn how to use Rive within Qt and Qt Quick.

Rive is a tool (and file format) that enables you to create interactive vector animations. With the RiveQtQuickPlugin, you can effortlessly load and display Rive animations within your QtQuick projects.

In this article, we will demonstrate how to embed Rive files, use different rendering backends, load artboards and trigger animations.

Continue reading Embed Rive in your QtQuick applications at basysKom GmbH.

Saturday, 28 October 2023

Long Covid. If you are at all conversant with C20 twenties and thirties detective novels, you’ll know all about the invalids, the incapabables, the chronically ill. That was the flu. Though it never is the protagonist who is suffereing, it’s always someone else.


Well, this time it’s me. The protagonist of my own life.

I got covid when I got jabbed, early 2022. In the vaccination centre. Not because of the vaccine, but because, for some reason, everyone was expected to sit down, in a perspex cubicle for fifteen minutes, unmasked.

Of course, as you know, the covid virus remains infectuous for six hours and airborne, no droplets needed, in any area an infected person has been breathing for about ten minutes.

And no vaccine is immediately effective.

These were incubation incubators.

So I got sick. Really sick. For two weeks I had a horrible fever and was completely bed-ridden.

The aftermath is worse though.

I noticed my cognition was going down: I was (and am) getting dumber. Concentration powers going down. Getting pukey, and after that, shitty, regularly. Heart rates getting up into realms no blood pressure measurement machine could manage to measure. Having to lie down for days.

People wished me well. Wished me to get better soon.

Sorry people, that doesn’t work: this is like M.E., and you don’t get better from that. (In fact, Long Covid might, after all, have provided a pathology that explains M.E.)

Better soon? Bad days are getting increasingly frequent, and while I’l very good on good days, I cannot predict when good days will happen.

There you have it… Puke. Runny shit. Lying down all day in a darkened room. Brain Fog. Every little thing you manage to do is an achievement. Heart palpiations. Doctors telling you you’re malingering. Good days when you’re doubting you are actually sick getting outnumbered by days you cannot even eat, only drink water.

(And don’t ask me about how it’s when your nose if full of the smell of bin liner filled with the intestines of two-weeks dead animals.)

.

..

Hey… Masks are the one thing that work.

Happy October and other related holidays! The list of work is a bit smaller, as predicted I was busy this month. However, I have some really exciting work done in PlasmaTube - some of which you may have already seen if you follow me on Mastodon.

I also added a better way to discern bugfixes from features in these posts! It also details which branches and versions the change will appear in. I will be adding this slowly to older posts. I’m also really close to completing a whole year of this blog series, which I started back in January 2023! 🎉 I’ll be detailing more of 2024 plans in December.

Tokodon

[Feature] I added support for viewing server announcements! It doesn’t support emoji reactions yet, because I want to also implement emoji reactions in general (if your server supports it.) [24.02]

Announcements are now shown in the sidebar.

[Bugfix] Fixed more cases where media attachments wouldn’t load, if some of the metadata was invalid. [24.02] [23.08]

[Feature] The window geometry and position (if on X11) is now saved and restored. [24.02]

[Feature] A profile’s featured tags are now shown in the filter bar. You can select between them or reset it by tapping on “All”. [24.02]

An example of my featured tags, and you can select one of them!

[Feature] The selected post in a thread is now scrolled to initially, so you don’t have to scroll so much when viewing replies. [24.02]

[Feature] When scrolling to the very end of a timeline, a message is now shown that it’s really the end and you didn’t encounter some kind of bug. [24.02]

For example, when scrolling to the bottom of the home timeline.

[Feature] Tokodon now supports basic notification actions such as viewing the post or the user’s profile. More actions are planned in the future, but this is a good start. [24.02]

An example of a notification when you are mentioned.

[Feature] I cleaned up and merged the offline testing system that was originally pioneered by Rishi Kumar. This doesn’t affect users, but means that Tokodon can be tested more easily. Aka, more stable software! :-) [24.02]

[Bugfix] Add missing PulseAudio, FreeDesktop Secrets and notification permissions for the Tokodon Flatpak. [24.02] [23.08]

NeoChat

[Feature] NeoChat state (such as event cache) will now be stored in it’s own state file, called “neochatstaterc” in ~/.local/share/KDE/neochat. This matches the behavior of other KDE applications, instead of the weirdly named “data” file like before. [24.02]

[Feature] The event cache is now compacted so it’s a little bit smaller, and easier to read. [24.02]

[Feature] The recent emojis are now saved in the state file, instead of the regular config file. Less state in there, woohoo! [24.02]

Kirigami

[Feature] You can now control the isMask property of a Chip. Otherwise, this property is inaccessible, preventing you from changing the icon color. [6.0]

PlasmaTube

I did a ton of work improving PlasmaTube this month. If you haven’t been using PlasmaTube yet, or haven’t tried it in a while… 24.02 in February will be packed with new features and bugfixes!

[Feature] PlasmaTube is now Qt6, complete with the new declarative type registration system. For users, it means that it’s marginally faster and that it’s ready for the February mega-release. [24.02]

[Feature] Different video sources other than Invidious is now supported! The current plan plan is to support Invidious, Piped and PeerTube by 24.02. The feature set of the new video sources are currently limited compared to Invidious, but will be expanded. [24.02]

The new welcome page

[Feature] Selecting between video sources is now supported, for example if you have a Invidious instance but also want to watch PeerTube content. [24.02]

The new switcher

[Feature] Along with that, the overall login flow is overhauled to match other Kirigami applications. You can even select from a list of public instances. (Keep in mind that the UI is still a work in progress and will be improved before release.) [24.02]

A list of public Invidious instances

[Feature] The sidebar is no longer icon only, and matches the UX of other Kirigami applications such as NeoChat, Tokodon and Arianna. There are now several tabs such as “Popular”, “Trending”, “Subscriptions”, “Playlists” and “History”. Some of these are disabled depending on if you’re logged in and if the video source supports them. [24.02]

The new sidebar design

[Feature] The “Trending” page has been overhauled to use tabs instead of stuffing all of the different types into the page’s actions. [24.02]

The trending tabs

[Feature] Added a “Playlists” page! Right now you can only view playlists, but I plan on adding more advanced playlist management soon. [24.02]

[Feature] Added a “History” tab, which of shows you recently watched videos. [24.02]

[Feature] Added a new context menu, shown while long tapping or right-clicking on a video item. You can mark a video as watched or unwatched, add it to a playlist and more. [24.02]

The video context menu

[Feature] Added a picture in picture mode! It’s even possible to control the video using the normal controls in the main window. When closing the PiP window, it will also restore the position in the main player too. [24.02]

The picture in picture window

[Feature] It’s now possible to use a network proxy in PlasmaTube, but due to FFmpeg limitations you can only set a HTTP proxy unlike other KDE applications which support a SOCKS5 proxy. [24.02]

[Feature] You can now change the default homepage for Invidious sources, which also syncs to the Invidious web frontend and any other clients that support this key. More settings will be available in the future, such as autoplay (which currently does nothing.) [24.02]

The default homepage setting.

[Feature] You can now view comments on a video, which is supported in Invidious, PeerTube and Piped sources. They aren’t very detailed yet, and threading is not yet supported. [24.02]

Comments, although the encoding isn’t perfect yet.

[Feature] A channel’s avatar, banner and description is now shown on the channel page. Eventually other channel tabs like playlists will be available here too! [24.02]

The new channel design.

Merkuro

[Bugfix] Fixed a bug where certain locales would be unable to use the date picker. [24.02] [23.08]

KWallet

[Bugfix] Fixed the “Configure KWallet…” menu item not working. [23.08]

[Feature] Added a visible error message for conditions where KWalletManager could fail and display nothing, like the DBus service failing to activate. [24.02]

The KWallet DBus service is not activable for some reason. The only way to tell before is to look at the logs…

KWin

[Bugfix] Fixed the default keybinds for “Switch to Next/Previous Desktop” not being set properly by default, when they probably should. [6.0] [5.27]

Plasma

[Feature] A bunch of small improvements and fixes for the “Show Activity Manager” applet. This is mostly fixing stuff that was broken due to KF6 changes. [6.0]

Kirigami Addons

[Bugfix] Prevent a crash when calculating initials in names that only have parenthesis, such as “(gobble)”. This affects the new Avatar component. [0.12]

See you next month!

During the last years, I’ve been doing a lot of coding and no blogging. That’s a shame because without good announcements, there is no chance for people to know about the code.

All of the projects I’ve been coding on are more or less unfinished which is why I’ve not been too keen on blogging about them. It’s time to get over this inhibition and show the world these rough gems in all their glory.

This blog is just the announcement of more blogs that are about to come. For now, the projects that I’ll be be blogging about are just listed here with a short description and a link to the repository.

I will be fighting the urge to polish the projects more and delay announcing them even further. The plan is to blog about one project per week.

Kwats

RDF graphs contain triples. Prepending the triples from the graph with the IRI of the triples gives quads. The Dutch word kwats sounds like quads but means nonsense.

Kwats is a simple server where triples can be stored and queried. Triples are added in the form of graphs. The graphs are stored as files in git, along with provenance information.

A running server keeps the graphs in memory. Rules about what is allowed in the graphs is written in the form of SHACL.

Subtree of Life

Subtree of Life is a webpage to create phylogenetic trees that show the relationship between the species of your choice. How are cat, dog and bumblebee related? Like this.

The code for this webpage is finished. The user experience, documentation and packaging can be improved.

Xust

Xust was a big COVID project. It is meant to become an XQuery implementation like BaseX and Xidel.

Xust main has 1218 commits and the XQuery functionality is not usable yet. The repository contains Rust crates for an XML DOM, DTD validation, and XML Schema validation.

This is a fun repository to work on because of the large number of tests. The CI shows 75551 tests at the moment that finish in seconds.

Rehorse

Rehorse is a web application for rehearsing music. It started off as way to loop recordings that matches the sheet music. So you can loop easily between, say, measure 10 and 12.

The application has been in production for years but is not very polished. I maintain an instance of it for members of two bands.

Nix flake for KDE software

kde-nix-flake packages KDE software for Nix. Nix is a package manager available for many Linux distributions. It handles packaging, setting up a development environment, testing and deploying.

The file flake.nix contains instructions for running stable and nightly KDE software, setting up a build environment with nix develop, running tests with nix check, using Plasma as a desktop, using the binary cache for quick installation, and running jobs on a CI server.

Keeping this repository up to date with the development speed of KDE has turned out to be a challenge.

Diary

The simply named diary is another unfinished application that has been in production for years. It is a desktop application based on rust-qt-binding-generator that I use to write notes.

It was also meant to keep a calendar and a list of todo’s, but those parts are not finished.

Friday, 27 October 2023

Let’s go for my web review for the week 2023-43. A bit on the finishing line compared to the usual, I didn’t manage to post it earlier today… Well, technically it’s still Friday. 😉


Stop ChatControl! | de.indymedia.org

Tags: tech, politics, surveillance

This is a very worrying development in Europe. This feels a lot like a dream come true for police states… Let’s not go there.

https://de.indymedia.org/node/310589


Europe’s CSAM-scanning plan is a tipping point for democratic rights, experts warn | TechCrunch

Tags: tech, politics, surveillance

A longer account of a seminar showing the amount of people and arguments against chat control. The EU commission is pretty isolated in this madness.

https://techcrunch.com/2023/10/24/eu-csam-scanning-edps-seminar/?guccounter=1


Kyoto Statement on End-To-End Encryption – Global Encryption Coalition

Tags: tech, cryptography, politics, privacy

Timely and needed statement as fights against cryptography are emerging again.

https://www.globalencryption.org/2023/10/kyoto-statement-on-end-to-end-encryption/


Why can’t our tech billionaires learn anything new?

Tags: tech, criticism

An important read in my opinion. This whole manifesto from Andreesen is just ludicrous and this explains very well why. In any case we need more techno-pragmatists and less techno-optimists.

https://davekarpf.substack.com/p/why-cant-our-tech-billionaires-learn


This new data poisoning tool lets artists fight back against generative AI | MIT Technology Review

Tags: tech, cyberpunk, ai, machine-learning, copyright, tools

A very needed tool unfortunately. This is fascinating research as well. The world is really so cyberpunk now.

https://www.technologyreview.com/2023/10/23/1082189/data-poisoning-artists-fight-generative-ai/


Jina AI Launches World’s First Open-Source 8K Text Embedding, Rivaling OpenAI

Tags: tech, ai, machine-learning, gpt, foss

Another open source LLM available out there. This one seems to have interesting properties.

https://jina.ai/news/jina-ai-launches-worlds-first-open-source-8k-text-embedding-rivaling-openai/


From Twitter to X, Elon Musk’s transformation from free speech defender to champion of disinformation | RSF

Tags: tech, twitter, social-media, information, criticism

I never liked the “it’s neutral, it’s just a tool”. A very naive view in my opinion. New illustration of this with Twitter. Tools are inserted in a socio-technical system, and the sociology side will influence the design enough to make the tool not so neutral. Here clearly all hell broke loose and it became a massive danger to democracy due to the level of misinformation and the type of messages which are advantaged by the changes.

https://rsf.org/en/twitter-x-elon-musk-s-transformation-free-speech-defender-champion-disinformation


The Carpentries retires its X/Twitter accounts and Facebook profile

Tags: tech, social-media, twitter, fediverse

More organizations leaving Twitter (now X… rofl). It’s a good thing and a logical step if you take values and code of conduct into account. It clearly became a cesspool from what I see.

https://carpentries.org/blog/2023/10/announcing-the-carpentries-departure-from-x-and-facebook/


GRC | ValiDrive  

Tags: tech, storage, scam, tools

Beware the fraudulent cheap drives you can buy nowadays. Looks like a nifty tool to check a drive if you have suspicions.

https://www.grc.com/validrive.htm


iLeakage

Tags: tech, apple, security

The spectre attack still has real world effects… This affects Safari this time.

https://ileakage.com/


Stealing OAuth tokens of connected Microsoft accounts via open redirect in Harvest App | 0xcrypto

Tags: tech, security, web

If you got to implement an OAuth integration. Please be responsible and don’t do this… this could lead to very serious breaches for your users.

https://eval.blog/research/microsoft-account-token-leaks-in-harvest/


Salt Labs | Oh-Auth - Abusing OAuth to take over millions of accounts

Tags: tech, security

OAuth is nice and taking over the world… but don’t weaken the security, follow all the steps and verify the tokens you get handed.

https://salt.security/blog/oh-auth-abusing-oauth-to-take-over-millions-of-accounts


The Cloud Computer / Oxide

Tags: tech, cloud, infrastructure, foss

OK, I admit this looks like a very cool product. This could turn interesting for private infrastructures. Trying to get the benefits of cloud approaches while keeping it under control.

https://oxide.computer/blog/the-cloud-computer


My 2023 all-flash ZFS NAS build

Tags: tech, storage, networking, self-hosting

Very thorough explanation of an interesting NAS setup. There are a few interesting tools I didn’t know about in there.

https://michael.stapelberg.ch/posts/2023-10-25-my-all-flash-zfs-network-storage-build/


Protomaps | A free and open source map of the world

Tags: tech, tools, geospatial, geography, map

Looks like a nice new solution to host and serve global maps.

https://protomaps.com/


Analyzing Data 180,000x Faster with Rust

Tags: tech, rust, optimization

This gives a good list of things to try when optimizing (Rust code or otherwise).

https://willcrichton.net/notes/k-corrset/


O3DE

Tags: tech, 3d, gaming, simulation

Nice to see Amazon Lumberyard getting a new life. It’s really feature packed.

https://o3de.org/


A Journey Into Shaders

Tags: tech, 3d, shader, mathematics

Wanna get started playing with shaders? This is a neat into leading to a blob made of metaballs.

https://www.mayerowitz.io/blog/a-journey-into-shaders


The Three Cs: 🤝 Concatenate, 🗜️ Compress, 🗳️ Cache – Harry Roberts – Web Performance Consultant

Tags: tech, web, http, caching, compression, performance, networking

Interesting exploration of the performance for web resources when they’re bundled or not. Also dabbles in the reasons behind the exhibited performances, definitely to keep in mind.

https://csswizardry.com/2023/10/the-three-c-concatenate-compress-cache/


Web Components Will Outlive Your JavaScript Framework | jakelazaroff.com

Tags: tech, blog, webcomponents, frontend, complexity

Another testament to the fact that it’s probably better to have minimal dependencies on your webpages. This is especially true for documents if you’re aiming for longevity. If you’re making an actual application the trade-off will be different.

https://jakelazaroff.com/words/web-components-will-outlive-your-javascript-framework/


The Negative Impact of Mobile-First Web Design on Desktop

Tags: tech, usability, ux, design, mobile, desktop

It’s nice that we get more content usable on mobiles… but this shouldn’t come at the expense of bad usability when on desktops.

https://www.nngroup.com/articles/content-dispersion/


Google Testing Blog: Improve Readability With Positive Booleans

Tags: tech, programming, craftsmanship

Definitely a good advice. We’re just better at understanding positive boolean expressions.

https://testing.googleblog.com/2023/10/improve-readability-with-positive.html?m=1


How To Tell Stuff To A Computer - The Enigmatic Art of Knowledge Representation

Tags: tech, knowledge, engineering

Looks like an old website, still it does a neat job of explaining how the field of knowledge representation evolved. This is nice to see a reference for beginners since I dabbled quite a bit into this years ago and it wasn’t very accessible.

https://www.lisperati.com/tellstuff/index.html


There is No Now - ACM Queue

Tags: tech, time, asynchronous, distributed, consistency

Time and synchronization are complicated in distributed systems. Luckily there are solutions to try to ease the pain. It’s not completely avoidable though.

https://queue.acm.org/detail.cfm?id=2745385


Refactoring has a price. Not refactoring has a cost. Either way, you pay.

Tags: tech, refactoring, craftsmanship, cost

Definitely this. One is more painful than the other though. It’s a question of paying small price over tine vs paying a big cost later.

https://www.germanvelasco.com/blog/refactoring-is-a-habit


Private Estimates, Public Progress - by Kent Beck

Tags: tech, agile, project-management, estimates

Indeed, going for scrutiny on made up numbers probably won’t get us nowhere. Tweaking them won’t help either. It’s the shared goals which matter most.

https://tidyfirst.substack.com/p/private-estimates-public-progress


Software Engineering Management Checklist

Tags: tech, management, engineering, learning

Definitely an excellent list to have in mind as soon as you get to engineering management. The four areas listed are the most important.

http://pnewman.org/engineering_mgmt_checklist.txt


We have used too many levels of abstractions and now the future looks bleak

Tags: tech, learning, engineering, criticism

Healthy criticism of where our industry went. Engineers should exhibit curiosity on how the sausage is made, not just blindly use tools they don’t understand.

https://unixsheikh.com/articles/we-have-used-too-many-levels-of-abstractions-and-now-the-future-looks-bleak.html


On Craft

Tags: tech, craftsmanship

Beautiful text. She talks with fondness about her grandfather, but there’s indeed lessons about craftsmanship here. It’s not only about machines, it can’t extend into a humanist world view.

https://www.drcathicks.com/post/on-craft


Advice to a novice programmer

Tags: tech, programming, learning

Good list of advices for someone who just got started programming. Who knows, it might come in handy later.

https://blog.plover.com/prog/katara-advice.html


A literary appreciation of the Olson/Zoneinfo/tz database – Jon Udell

Tags: tech, time, date, history

A database we take for granted… but if you look in the margins it’s full of history and very well crafted.

https://blog.jonudell.net/2009/10/23/a-literary-appreciation-of-the-olsonzoneinfotz-database/


Internet Artifacts

Tags: tech, internet, web, history

Very cool idea. Lots of history in there! There were things I even forgot about.

https://neal.fun/internet-artifacts/


The Theory That Men Evolved to Hunt and Women Evolved to Gather Is Wrong - Scientific American

Tags: history, science

Very interesting dive into where this theory comes from and how wrong it is.

https://www.scientificamerican.com/article/the-theory-that-men-evolved-to-hunt-and-women-evolved-to-gather-is-wrong1/



Bye for now!

Thursday, 26 October 2023

KDE has a long and storied history of customisation, allowing people to express themselves freely through the desktop and truly

Reworking Recent Files search for Plasma 6

For Plasma 6, lots of KRunner plugins and framework functionalities were improved. I took quite a bit of time to work on the recent files search plugin used by KRunner and Plasmas application launchers like Kickoff. This included performance improvements, usability improvements and technical refactorings.

Let’s start off with the usability improvements: While the runner was named “Recent Files”, it still provided results for directories. In Dolphin on the other hand, “Recent Locations” are a separate location you may access next to “Recent Files”. Luckily, functionality for only querying files already exists in the KActivities-Stats framework :).
The search for files was also improved. Natalie Clarius added some time ago a patch to avoid false positives when the query is part of the file path. For example, when you type for “myfile” and “/home/user/myfiles/test” was a recent file, this file would be returned by the KActivities-Stats framework. With Natalie’s logic, those files would not be shown in KRunner, but still they fill out the limit of recent files we want to query. Of course, one could look for more files in case we discarded too many, but that can cause a performance penalty due to additional SQL queries.
Instead, I have added the ability to filter by the filename in KActivities-Stats. This means false positives are always avoided, and you will for sure get the results you are looking for!

Another useful, but not yet user-facing change is special handling for queries shorter than 3 characters. For those queries, a substring check would cause too many unintended results to be useful. Instead, the filename must start with your given query. Similar to how the Applications-runner handles it. There are plans to make this feature more easily accessible, but for now, it can only be done on the command line using krunner --runner=krunner_recentdocuments.

Example of single-plugin mode
Screenshot of KRunner in single-plugin mode with the recent files plugin

The final issue that everyone will benefit from being fixed is a memory leak. This means for each letter typed, the runner would allocate a bit more RAM for results from the query. This can add up over time in KRunner and Plasmashell. The KActivities-Stats that were “leaking” also caused CPU overhead, because they were notified about changes to the recent files list – even though they were never used again.
Luckily, you don’t have to worry about that at all from now on :).

Optimizations

Let us start with the small improvements: In my previous posts, I mentioned that constructing a QueryMatch object before being sure that the current item (application or systemsettings module) matches, causes a performance overhead. The same applied to the recent files plugin, because we discarded some files due to the false positive detection mentioned above.
Getting the filename was also optimized/simplified, because instead of using Qt API to get the filename from the URL, we can just use the resource title from KActivities-Stats.
String comparisons were speed up by reusing the results. For example, when checking if the filename contains the query, we can get the resulting index. If that index is 0, the query is contained and the filename also starts with it. Meaning we’d only do one string comparison for each recent file instead of up to 4.

Getting the appropriate icon is also way faster, because previously a method from KIO was used, which gets the file path, checks some extra cases, but usually gets the icon for the determined mime type. Because the extra cases were not relevant when only allowing files, we can directly get the icon for the respective mimetype. Luckily, we don’t even need to determine the mimetype, because the model already contains it.

Reusing previously fetched data

This is the most interesting part and was my original idea to improve performance: In KDE Frameworks 6, each runner lives in its own thread. Meaning, one may access member variables in a thread safe way. The data we want to reuse is the KActivities-Stats ResultsModel. This contains paths and additional metadata of recently used files. The number of files is limited to 20, which is the maximum number of entries is KRunner.
Implementing was straightforward: If one previously typed “firef” and after that “firefox”, the previous model can be reused as long as the limit of 20 did not exceed the previously found results. In addition to reusing the data, it is required to check the filenames again, because a file called “firef.test” should not match a query called “firefox”. Due to the preexisting logic to determine the match relevance, this is minimal additional work.
When measuring the real-world impact, it is important to note that fetching results from KActivities SQLite database is the most expensive part. Accessing the model is relatively cheap. Meaning the longer your queries are and if long as the number of results was not exceeded, your performance gains will be significant!

Unoptimized Profiling of the unoptimized version, loading the correct Icon takes a large porting of CPU cycles Optimized Optimized version, CPU cycles are significantly reduced and loading of icons is barely distinguishable from other, minor costs

In benchmarks, one is able to see that the CPU cycles with this patch are roundabout the same among the different measurements, whereas the CPU cycles before this patch correlated with the length of the query. The query was typed in letter by letter, keep in mind that the runner skips queries shorter than 3 characters unless the single runner mode is activated. For benchmarks, I decided against activating this mode, because it is not the normal usecase.

QueryCPU Cycles beforeCPU Cycles with changeReduction
mytextfile1.73E+103.592E+0979%
user8.291E+093.148E+0962%
firefox1.325E+103.601E+0973%

Friday, 20 October 2023

Let’s go for my web review for the week 2023-42.


F-Droid version of KDEConnect uninstalled by PlayProtect - Help - KDE Discuss

Tags: tech, android, google, trust

This will lower even more the trust we can have in those devices. The only way to really own them seems be to just blow the warranty and flash them…

https://discuss.kde.org/t/f-droid-version-of-kdeconnect-uninstalled-by-playprotect/5992


I’m banned for life from advertising on Meta. Because I teach Python. — Reuven Lerner

Tags: tech, facebook, ai, machine-learning, automation, criticism

The risks of too much automation… this is chilling to see what using machine learning based system all the way can lead to. It’s just a ridiculous situation and no way to get out of it.

https://lerner.co.il/2023/10/19/im-banned-for-life-from-advertising-on-meta-because-i-teach-python/


We Were Wrong About the GPLs — /dev/lawyer

Tags: tech, foss, licensing, law

Interesting line of argument regarding Free Software licenses. I wonder what the judges will conclude in the end… this could have important consequences.

https://writing.kemitchell.com/2023/10/13/Wrong-About-GPLs


Google-hosted malvertising leads to fake Keepass site that looks genuine | Ars Technica

Tags: tech, browser, google, attention-economy, security

This is a bad case of content moderation if it gets presented to users like this… but Google is not going to leave advertisement money on the table. The way browsers changed in recent years also make this kind of deceptions easier (harder to check certificates, hard to spot punycoding).

https://arstechnica.com/security/2023/10/google-hosted-malvertising-leads-to-fake-keepass-site-that-looks-genuine/


Atlas of Surveillance

Tags: tech, surveillance

US centric but a very welcome tool. Let’s hope we get similar initiatives for other countries as well.

https://atlasofsurveillance.org/


Encrypt. Now.

Tags: tech, privacy, surveillance, politics

Definitely very important as our privacy is attacked once more…

https://blog.tripu.info/encrypt/


Multi-modal prompt injection image attacks against GPT-4V

Tags: tech, ai, gpt, security

This is a hard problem to solve, and going multi-modal makes it harder in my opinion.

https://simonwillison.net/2023/Oct/14/multi-modal-prompt-injection/


Llemma: An Open Language Model For Mathematics | EleutherAI Blog

Tags: tech, mathematics, ai, machine-learning, gpt

On specialized and formalized domains like this it might lead to something interesting. That said there’s a tension with the fact that it doesn’t know when it doesn’t know which might be problematic. Also I wonder how it fares compared to computational models like WolframAlpha. In the end very formal domains like this have large knowledge bases already available.

https://blog.eleuther.ai/llemma/


LocalAI

Tags: tech, ai, machine-learning, gpt, foss

A good way to get some control back if you want to use a LLM. You can host it locally, it’s free software. Definitely a step in the right direction.

https://localai.io/


LocalSend

Tags: tech, tools, foss

Looks like a nice FOSS tool to share files between devices without going through the Internet.

https://localsend.org/


SSH server & client security auditing

Tags: tech, ssh, tools, security

Looks like a nice tool to check if your SSH config is secure. Works both for servers and clients.

https://github.com/jtesta/ssh-audit


Organizing multiple Git identities | Garrit’s Notes

Tags: tech, tools, git

This is pretty much exactly how I organize my projects. I highly recommend this approach, works very well.

https://garrit.xyz/posts/2023-10-13-organizing-multiple-git-identities


An Interactive Intro to CRDTs | jakelazaroff.com

Tags: tech, crdt, web, distributed

Long article in two parts (make sure to read the second one as well) showing how to build an interactive painter with CRDT. Nice way to understand how they work.

https://jakelazaroff.com/words/an-interactive-intro-to-crdts/


Surfacing request errors when using HTMX

Tags: tech, web, frontend, htmx

Nice explanation on how to handle request errors with HTMX. It’s in fact relatively simple even though there’s a couple of pitfalls.

https://xvello.net/blog/htmx-error-handling/


Inside STL: The different types of shared pointer control blocks - The Old New Thing

Tags: tech, c++

This is a too little known fact in my opinion. Good thing someone sheds some light on it.

https://devblogs.microsoft.com/oldnewthing/20230821-00/?p=108626


Why async Rust? - Without boats, dreams dry up

Tags: tech, rust, asynchronous, community

Good exploration on how and why async Rust was designed. As usual it’s not purely for technical reasons, there’s a human and community factor to it.

https://without.boats/blog/why-async-rust/


Learn Wayland by writing a GUI from scratch

Tags: tech, graphics, wayland

Understanding the Wayland protocol by going all the way back to what’s going on with the domain socket. Can serve as a nice introduction.

https://gaultier.github.io/blog/wayland_from_scratch.html


What Every Developer Should Know About GPU Computing

Tags: tech, gpu, computation, architecture

Nice primer on how computation works on GPUs. Goes a bit into the architecture as well. Good starting point.

https://codeconfessions.substack.com/p/gpu-computing


Wrapping Meshes With Geodesic Walks - Casey Primozic’s Homepage

Tags: tech, 3d, web, geometry

Very interesting computational geometry tricks. You can make interesting shapes out of this.

https://cprimozic.net/blog/wrapping-meshes-with-geodesic-walks/


Fluid Simulation

Tags: tech, 3d, gpu, graphics, simulation

Nice notes breaking down how to simulate fluids. Easily translates to GPU computation too.

https://kyndinfo.notion.site/Fluid-Simulation-f0516d9d12e245a08ae5c7545ac822dd


API design principle: Reading a property or adding an event handler should not alter observable behavior - The Old New Thing

Tags: tech, programming, api, design

Definitely a good principle to follow when designing APIs. Otherwise you make them less obvious and more dangerous to use.

https://devblogs.microsoft.com/oldnewthing/20231016-00/?p=108895


Why Software Design Matters - by Kent Beck

Tags: tech, software, design, programming

Yes, definitely this. Plenty of reasons why it’s important.

https://tidyfirst.substack.com/p/why-software-design-matters


To Design or Not To Design? - by Kent Beck

Tags: tech, agile, tests, design, craftsmanship, business

There will always be some design and some testing. The intensity of both activities needs to be properly managed over time though.

https://tidyfirst.substack.com/p/to-design-or-not-to-design


Write more “useless” software | nicole@web

Tags: tech, learning, programming

Play is definitely needed for growth. It’s true for kids, it’s still true for so called grown ups.

https://ntietz.com/blog/write-more-useless-software/


Software engineering is about thinking, not typing | Organizing Chaos

Tags: tech, engineering, productivity

Definitely this. Also with experience you tend to type less and influence others more.

https://jordankaye.dev/posts/thinking-not-typing/


Manage Your Capacity, Not Your Time - The Engineering Manager

Tags: management, productivity, time, energy

Good advices. Keep some slack, have an idea of your energy level, that’s what impacts your capacity. Time is a given you can’t do much with it.

https://www.theengineeringmanager.com/management-101/manage-your-capacity-not-your-time/


Diving into Engineering Metrics - by Nicola Ballotta

Tags: tech, engineering, management, metrics

Good starting point before really exploring this field deeper. Especially important here is the last section on how to use them properly. Be cautious, keep people well-being in mind at all time.

https://hybridhacker.email/p/diving-into-engineering-metrics



Bye for now!