Skip to content

Friday, 23 December 2022

Let’s go for my web review for the week 2022-51.


Charge - Blender Open Movie - Blender Video

Tags: tech, blender, 3d, movie

The latest Blender Open Movie. Again a very good one!

https://video.blender.org/w/04da454b-9893-4184-98f3-248d00625efe


UnifiedPush: a decentralized, open-source push notification protocol | F-Droid - Free and Open Source Android App Repository

Tags: tech, mobile, android, notifications

This is a big deal, it’s time we open up that can of worms.

https://f-droid.org/2022/12/18/unifiedpush.html


MSG defends using facial recognition to kick lawyer out of Rockettes show | Ars Technica

Tags: tech, surveillance

This is really creepy… how can this be even allowed?

https://arstechnica.com/tech-policy/2022/12/facial-recognition-flags-girl-scout-mom-as-security-risk-at-rockettes-show/


Okta’s source code stolen after GitHub repositories hacked

Tags: tech, security

This sounds like a bad series of events for such a company…

https://www.bleepingcomputer.com/news/security/oktas-source-code-stolen-after-github-repositories-hacked/


We are drowning in information while starving for wisdom | Realize Engineering

Tags: research, knowledge, ethics

This is indeed very much true… there’s a clear crisis in research. It turned into a hamster wheel of publishing articles at a constantly faster pace. The incentives are misguided which pushes that behavior to even have a career. Meanwhile, knowledge building suffers.

https://realizeengineering.blog/2021/01/20/we-are-drowning-in-information-while-starving-for-wisdom/


Photographer Fools the Internet With AI-Generated Cameras That Don’t Exist | PetaPixel

Tags: tech, ai, gpt, generator, fake

Don’t worry, so called AI isn’t going to take away your jobs. But do worry though, this marks the end of trusting any pictures or texts you see in the media. Everything needs to be challenged, even more so now.

https://petapixel.com/2022/12/15/photographer-fools-the-internet-with-ai-generated-cameras-that-dont-exist/


Cyberpunk Translate

Tags: tech, ai, neural-networks, translation

Interesting tool to for the automatic transcription and translation of videos using off the shelf components. Seems to work nicely.

https://github.com/elanmart/cbp-translate


Copilot Internals | Hacky repo to see what the Copilot extension sends to the server

Tags: tech, github, copilot, ai, machine-learning

Interesting reverse engineering job of Copilot’s client side to have a better idea at which information it actually feeds to the model. A couple of funny tricks to prepare the prompt are involved. Obviously some telemetry involved as well, again with interesting heuristics to try to figure out if the user kept the suggestion or not.

https://thakkarparth007.github.io/copilot-explorer/posts/copilot-internals.html


A not so unfortunate sharp edge in Pipenv :: dade

Tags: tech, python, supply-chain

This is indeed a problem in the way Pipenv handle this kind of cases. Makes for bisecting clearly troublesome.

https://0xda.de/blog/2022/12/a-not-so-unfortunate-sharp-edge-in-pipenv/


An Ode to Unit Tests: In Defense of the Testing Pyramid

Tags: tech, programming, tests, tdd, architecture, craftsmanship

Good piece. I like how it frames the debate, asking the right questions on where might be the assumptions on how testing is done.

https://www.infoq.com/articles/unit-tests-testing-pyramid/


The Cargo Cult of Good Code

Tags: tech, programming, craftsmanship

Good points, this shows quite effectively the problem with blindly following rules without keeping in mind the reasoning behind them.

https://pboyd.io/posts/cargo-cult-of-good-code/


Taming Names in Software Development - Simple Thread

Tags: tech, programming, craftsmanship

Excellent piece about naming things in code. The conclusion is perfect of course: it’s hard but it pays off.

https://www.simplethread.com/taming-names-in-software-development/


The Story of A - by Kent Beck

Tags: tech, architecture, refactoring, craftsmanship, xp

A good set of skills to develop to bring technical changes to a project. It doesn’t need to be overwhelming or a fight. If you doubt, if you have empathy and if you slice the proposals it can become doable and help the people around you.

https://tidyfirst.substack.com/p/the-story-of-a


The topologist’s world map – tafc.space

Tags: tech, map, art

This is really cool work. Very insightful and pretty to look at.

https://tafc.space/qna/the-topologists-world-map/



Bye for now! And Merry Christmas!

Hopefully by now, you know that in KDE we are running an End of Year Fundraising campaign.

If you didn't, now you know :)

The campaign has already raised around 16 thousand euros, but there's still a bit to go to the minimum goal of 20 thousand.

So let's spice things up a little, I will donate 10% of every donation you make, you donate 1€, I will donate 0.1€, you donate 100€ I will donate 10€, etc.

I'm placing my maximum total donation amount at (20000-16211.98)/11 = 344.37, that is if you all donate 3443.7€ (or more), I will donate 344.37 and we'll reach the 20K goal.

How is this going to work? 

I will make my donation on the 31st of December (just one donation, to save up on fees).

For your donation to be included in my matching donation you need to send me an email to aacid@kde.org with your name/email and put in copy (CC) the KDE e.V. board kde-ev-board@kde.org so they can confirm your donation.

Only donations between now (23rd of December around 18:00 CET) and 31st of December will be considered.

Sunday, 18 December 2022

I’m happy to announce the release of Tokodon 22.11.2 (and 22.11.1 who I released earlier this month and forgot to properly announce). These releases contain mostly bug fixes but also some welcome interface improvements.

First this adds an account switcher (similar to the one Tobias Fella implemented in NeoChat). Very usefully when you need to manage multiple accounts and want to quickly switch between them.

Tokodon
Tokodon

This also change the image preview from appearing in a separate full screen window to be contained inside the window. This follow the similar change from from James Graham in NeoChat.

Preview full window mode
Preview full window mode

Joshua Goins improved the loading of media attachment and made it possible to now hide sensitive image by default using the blurhash effect. This is also using the already existing implementation of blurhash from Tobias in NeoChat and you might start to see a pattern in this release. ;)

Blurhash post
Blurhash post

Finally I added support for custom emojis in many places inside the UI. Perfect if you want to show you true verified checkmark in your profile :)

Aside from the nice new improvements, I improved the spacing in the app and while not perfect yet, I hope this makes Tokodon more enjoyable to use. Joshua Goins has also made various improvements to our internal networking code and this should offer better reliability and less prone to crash code. And I fixed an important crash on start-up that was affecting a lot of users

Finally I started adding unit tests in Tokodon and added the infrastructure to mock a Mastodon server. We now have reached 12% unit tests coverage and I hope this number will grow after each release.

And for those who prefer a full changelog, here it is:
  • Remember selected account
  • Update metadata
  • Fix rebasing issue
  • Attempt to fix Qt complaining about incomplete Post type
  • Add parents to replies made by Account::get and similar requests
  • More fixes
  • Move away from shared_ptr for Post
  • Fix double-free bug when viewing certain timeline pages
  • Add qtkeychain to .kde-ci.yml
  • Fix hide image icon missing on Android
  • View your own profile via account switcher
  • Add emoji support to page headings and profile bios
  • Fix translation extraction
  • Fix replying from the notification timeline
  • Fix notification list
  • Fix fetching the timeline twice
  • Release 22.11.2
  • Fix showing view-sensitive button too often
  • Don't have text autocomplete on login form
  • Add missing release info
  • Release 21.11.1
  • Remove usage of anchors in layout
  • Use blur hash for loading images and sensitive media
  • Improve hover effect on the card
  • Fix qt6 build
  • Fix dependency in the ci
  • Put accessible description at the bottom
  • Improve the look of cards
  • Use Kirigami.ActionToolBar
  • Allow download images
  • Full screen image like neochat
  • Add m_original_post_id for use in timeline fetch
  • Propertly reset pageStack when switching account
  • Polish NotificationPage
  • Improve layout of follow notification
  • Fix crash when switching account in the notification view
  • Fix translation catalog loading
  • Post: Fix memory leak
  • Fix off by one error in notification model
  • Posibly fix crash (second try)
  • Remove debug leftover
  • Posibly fix crash at startup
  • Improve account switcher
  • Make tap and text selection work together in PostDelegate
  • Fix wrong header url
  • Fix handling of empty displayName
  • Improve layout of PostDelegate
  • Add InteractionButton component for likes, boosts and replies
  • Add Qt 6 CI for FreeBSD and Android
  • Fix custom emoji in account lists
  • Port LoginPage to mobile form
  • Add runtime dependency for org.kde.sonnet
  • More cleanup and add autotests
  • Properly use getter and use displayNameHtml in more places
  • Implement custom emojis
  • Fix coverage badge
  • Add a refresh button for desktop devices
  • Reset message handler properly to prevent threads overwriting each other
  • Fix setInstanceUri early exit, preventing client id from being fetched
  • Add coverage badge
  • Fix reuse
  • Add a qDebug filter to remove confidential data
  • Add model tests
  • Add basic test
  • Split account in an abstract class without networking
  • Remot stray qDebug leaking token

Packager section

You can find the package on download.kde.org and it has been signed with my GPG key.

Summary in English This article is written in Spanish. On it, ask the readers for events or channels where I can apply or participate in to promote the Eclipse Foundation in Spain and in Spanish during 2023. It ends with some interesting links about The Eclipse Foundation. Artículo Me incorporé a La Eclipse Foundation en … Continue reading ¿Dónde debo promover la actividad de Eclipse Foundation?

Friday, 16 December 2022

Let’s go for my web review for the week 2022-50.


Statement on EU Comission adequacy decision on US

Tags: tech, surveillance, politics

The EU Commission clearly doesn’t have the best interest of the people at heart there. Let’s see what it’ll give with the CJEU.

https://noyb.eu/en/statement-eu-comission-adequacy-decision-us


Tags: tech, twitter, social-media, fediverse, censorship

Slippery slope indeed… This is really becoming pathetic.

https://www.theverge.com/2022/12/15/23512113/twitter-blocking-mastodon-links-elon-musk-elonjet


PeerTube v5: the result of 5 years’ handcrafting – Framablog

Tags: tech, peertube, fediverse

You like Peertube? I do love this project. And it’s still mostly a single developer behind it. This needs to be supported.

https://framablog.org/2022/12/13/peertube-v5-the-result-of-5-years-handcrafting/


How to rebuild social media on top of RSS

Tags: tech, social-media, rss

Interesting ideas for a proper RSS renaissance.

https://tfos.co/p/rebuild-social-media/


The problem with overestimating AI — pnw.ai

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

A few months old but a good piece to put things in perspective after the recent craze around large language models in general and GPT in particular. Noteworthy is the “wishful mnemonics” phrase mentioned and how it impacts the debate. Let’s have less talks about AIs and more about SALAMIs please?

https://pnw.ai/article/the-problem-with-overestimating-ai/121722775


Laurence Tratt: How Might Generative AI Change Programming?

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

At least a good balanced post about Generative AI and programming. It’s not overestimating abilities of the latest trend in large language models and moves away from the “I’ll loose my job, developers will be replaced with AI” stance.

https://tratt.net/laurie/blog/2022/how_might_generative_ai_change_programming.html


The GPT-3 Architecture, on a Napkin

Tags: tech, ai, machine-learning, gpt

Nice article, gives a few clues to get a grasp on how GPT-3 works.

https://dugas.ch/artificial_curiosity/GPT_architecture.html


Faster hardware is a bad first solution to slow software

Tags: tech, performance, optimization

Don’t bank it all on faster hardware, make sure your software isn’t slow first. Otherwise it’ll bring quite some hidden costs.

https://pythonspeed.com/articles/fixing-performance-with-hardware


mold: A Modern Linker 🦠

Tags: tech, linking

Interesting new linker, should shorten build time quite a bit for large projects.

https://github.com/rui314/mold


Auto-vectorization: How to get beaten by compiler optimization — Java JIT!

Tags: tech, java, optimization, performance

Don’t underestimate performance of the generated code when a JIT is in the picture. Very good example with the JVM just there.

https://itnext.io/auto-vectorization-how-to-get-beaten-by-compiler-optimization-java-jit-vector-api-92c72b97fba3


Challenging the status quo at work?

Tags: work, culture

Wise advices on how to approach disagreements. Obviously requires psychological safety at work though. The culture will matter.

https://workweek.com/2022/11/28/challenging-the-status-quo-at-work/


Kind Engineering: How To Engineer Kindness

Tags: tech, management, team, codereview, kindness, feedback

Interesting article. I especially like how it makes the difference between being kind and nice. That honesty is required if you want to be really kind to others. It nicely shows examples on how to apply this (for instance, but not only, in the context of code reviews).

https://kind.engineering/


Ten Minute Physics

Tags: tech, physics, simulation, 3d

Nice resources to build physically based simulations. Quite a few topics to explore.

https://matthias-research.github.io/pages/tenMinutePhysics/index.html



Bye for now!

Multi Screen 🔗

Marco Martin notmart 12:15 +00:00
RSS

Ah, working with more than one screen, nice and convenient, but always has been the scourge of usability, due to broken hardware and software, on every platform you can imagine. And yes, on Plasma we are notorious to have several problems with regard to multi screens, which spurred many bug reports.

TL;DR

For Plasma 5.27 we did a big refactor on how the screens are managed (and how they are mapped to desktops and panels) which hopefully should solve many of those issues, creating a much more predictable experience, both for “fixed” multi screen setups (like a setup at your desk) and “on the go” (like attaching a projector at a conference).

  • No more default empty desktops after connecting a screen that you already connected in the past
  • No more desktops, wallpapers, widgets and panels lost after restart
  • No more different sets of desktops between X11 and Wayland
  • Better experience when using USB-C based docks

UI wise on the Systemsettings module nothing will change in the most common case, when you have one or two screens, where you will be presented with the usual “primary” checkbox.

When you have 3 or more screens, instead of s simple “Primary” checkbox, you will be presented with a dialog where you can rearrange the screens in a logical order, so that you can say: “This is my screen number one, this is my screen number two etc.”

Reordering screen priorities

This will map exactly to what “screen number one, two etc” are for the Plasma shell, so that whatever desktops, wallpapers, widgets and panels are on the “screen number one” will always be on the “screen number one”, never disappearing again, same for each screen, giving a completely predictable, and stable multiscreen setup.

For 5.27 I worked mostly on the Plasmashell part, but many thanks and shouts to Ivan for his work on KScreen and to Xaver for his work on the KWin and Wayland protocol parts.

Long story: the moving parts

I would like to do a semi-technical but still quite high level description on how our multiscreen infrastructure works, and what did we change.

When you have multiple monitors connected, assuming the kernel and drivers will do the right thing (which… doesn’t always happen), either X11 or Wayland (so in our case the KWin Wayland compositor) will see the screens and have info about them we can enumerate and manage.

KScreen

In Plasma we have a daemon/library to manage the screens, called KScreen. It will save a configuration for each combination of screens it encountered. each screen is identified uniquely by its EDID, and when this fails for the above reasons, the connector name the screen is connected to (under X or libdrm they will have names like HDMI-A-1, DP-2, eDp1 and so forth). connector names are also not optimal, but is the best that can be done in case of a bad monitor (For 5.27 Xaver fixed a quite big issue on this fallback path which likely caused several of the reported bugs).

The user then can chose with the Systemsetting module how the screens are arranged, their resolutions, which is the primary and what not. When a screen is connected or disconnected, KScreen will search for an existing configuration for this set of screens and restore that one.

Plasma

The Plasma shell also has to be aware of multiple screens arrangement, because you want the desktops with their wallpapers, widgets and icons to be on the screen you expect it to, as well all the panels to be always on the “proper” screen you expect it to. And that’s where we had a lot of problems in the past, and various approaches have been attempted.

Current

Currently, up to 5.26 Plasma relied on two concepts for working out which screen a desktop and panel should be. Combining a single primary monitor and using screen connectors names for disambiguate second and third screens. In theory

There are a couple of things that can go wrong with this: between X11 and Wayland, connector names tend to be different (for instance HDMI-1 vs HDMI-A-1 on my system).

Another problem is related to the the USB-C based docks that have video outputs (such as the Steamdeck one, but is common to any other model and brand). They dynamically create and delete the outputs and connectors when they are plugged and unplugged, but the connector name is not stable between different plugs/unplugs: sometimes after re-plugging the old names are not recycled, but increased (so for instance if those were DP-2 and DP-3, they may become all the sudden DP-4 and DP-5). Since we used to store those names, we have a problem: each time a new connector name is encountered is treated as a completely new thing, giving its new empty default desktop and no panels, causing many wtf moments.

Plasma Containments (technical name of the desktops and panels) always had a screen property associated to them which is just an integer: 0 for the primary screen and then 1,2,etc for the others.

5.27

The new approach builds on a single design, extending the primary monitor concept to multiple monitors, which cleans up the codepaths even for the two monitor case.

So we now dropped this association map between screen number integers and connector names, and we go with this ordered list all the way down, so now Plasma, KWin and KScreen agree exactly who “Screen 1” is.

We have a new Wayland protocol for screen ordering (as well an X11 counterpart) for KScreen and KWin to agree to which one is the real logical ordering of the screens, so Plasmashell will now follow this without attempting to identify monitors by itself, removing a very big failure point.

As said, When your system has only 2 screens, in the Systemsettings module you’ll see exactly the UI it had: just a checkbox to select which one is the “Primary”, so no surprises here. When you have 3 screens or more then you are presented with a dialog where you can visually reorder the screens, to decide which is the first, which is the second etc.

In this way, you’ll always be sure that whichever screen was set as “first” will have your “main” set of panels and desktop widgets, that you will never lose, also whichever you set as “second” will always have the desktop and panels you set it and never change and so on.

Wednesday, 14 December 2022

At KDE we have multiple levels of quality assurance ranging from various degrees of a humans testing features to fully automated testing. Indeed automated testing is incredibly important for the continued quality of our software. A big corner stone of our testing strategy are so called unit tests, they test a specific piece of our software for its behavior in isolation. But for many aspects of our software we need a much higher level view, testing pieces of Plasma’s application launcher in isolation is all good and well but that won’t tell us if the entire UI can be easily navigated using the keyboard. For this type of test we require a different testing approach altogether. A couple months ago I’ve set set out to create a testing framework for this use case and I’m glad to say that it has matured enough to be used for writing tests. I’d like to walk you through the technical building blocks and a simple example.

Let us start of by looking at the architecture at large. So… there’s Selenium which is an incredibly popular, albeit web-oriented, testing framework. Its main advantages for us are its popularity and that it sports a server-client split. This means we can leverage the existing client tooling available for Selenium without having to write anything ourselves, we only need to grow a server. The server component, called a WebDriver, implements the actual interaction with UI elements and is generic enough to also apply to desktop applications. Indeed so thought others as well: there already exists Appium - it extends Selenium with more app-specific features and behaviors. Something for us to build upon. The clients meanwhile are completely separate and talk to the WebDriver over a well defined JSON REST protocol, meaning we can reuse the existing clients without having to write anything ourselves. They are available in a multitude of programming languages, and who knows maybe we’ll eventually get one for writing Selenium tests in QML ;)

That of course doesn’t explain how GUI testing can work with this on Linux. Enter: AT-SPI. AT-SPI is an accessibility API and pretty much the standard accessibility system for use on Linux. Obviously its primary use is assistive technologies, like the screen reader Orca, but to do its job it essentially offers a toolkit-independent way of introspecting and interacting with GUI applications. This then gives us a way to implement a WebDriver without caring about the toolkit or app specifics. As long as the app supports AT-SPI, which all Qt apps do implicitly, we can test it.

Since all the client tooling is independent of the server all we needed to get GUI testing going was a WebDriver that talks to AT-SPI.

That is what I set out to write and I’m happy to announce that we now have an AT-SPI based WebDriver, and the first tests are popping into existence already. There is also lovely documentation to hold onto.

So, without further ado. Let us write a simple test. Since the documentation already writes one in Python I’ll use Ruby this time around so we have some examples of different languages. A simple candidate is KInfoCenter. We can test its search functionality with a couple of lines of code.

First we need to install selenium-webdriver-at-spi, clone it, cmake build it, and cmake install it. You’ll also need to install the relevant client libraries. For ruby that’s simply running gem install appium_lib.

Then we can start with writing our test. We will need some boilerplate setup logic. This is more or less the same for every test. For more details on the driver setup you may also check the wiki page.

  def setup
    @appium\_driver = Appium::Driver.new(
      {
        'caps' => { app: 'org.kde.kinfocenter.desktop' },
        'appium\_lib' => {
          server\_url: 'http://127.0.0.1:4723',
          wait\_timeout: 10,
          wait\_interval: 0.5
        }
      }, true
    )
    @driver = @appium\_driver.start\_driver
  end

The driver will take care of starting the correct application and make sure that it is actually running correctly. Next we’ll write the actual test. Let’s test the search. The first order of business is using a tool called Accerciser to inspect the AT-SPI presentation of the application. For more information on how to use this tool please refer to the wiki. Using Accerciser I’ve located the search field and learned that it is called ‘Search’. So, let’s locate it and activate it, search for the CPU module:

  def test\_search
    search = driver.find\_element(:name, 'Search')
    search.click
    search.send\_keys('cpu')

Next let us find the CPU list item and activate it:

    cpu = driver.find\_element(:class\_name, '\[list item | CPU\]')
    assert(cpu.displayed?)
    cpu.click

And finally let’s assert that the page was actually activated:

    cpu\_tab = driver.find\_element(:class\_name, '\[page tab | CPU\]')
    assert(cpu\_tab.displayed?)

To run the complete test we can use the run wrapper: selenium-webdriver-at-spi-run ./kinfocentertest.rb (mind that it needs to be +x). If all has gone well we should get a successful test.

Finished in 1.345276s, 0.7433 runs/s, 1.4867 assertions/s.

1 runs, 2 assertions, 0 failures, 0 errors, 0 skips
I, \[2022-12-14T13:13:53.508516 #154338\]  INFO -- : tests done
I, \[2022-12-14T13:13:53.508583 #154338\]  INFO -- : run.rb exiting true

This should get you started with writing a test for your application! I’ll gladly help and review your forthcoming tests. For more detailed documentation check out the writing-tests wiki page as well as the appium command reference.

Of course the work is not done. selenium-webdriver-at-spi is very much still a work in progress and I’d be glad for others to help add features as they become needed. The gitlab project is the place for that. <3

The complete code of the example above:

#!/usr/bin/env ruby
# frozen\_string\_literal: true

# SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
# SPDX-FileCopyrightText: 2022 Harald Sitter <sitter@kde.org>

require 'appium\_lib'
require 'minitest/autorun'

class TestKInfoCenter < Minitest::Test
  attr\_reader :driver

  def setup
    @appium\_driver = Appium::Driver.new(
      {
        'caps' => { app: 'org.kde.kinfocenter.desktop' },
        'appium\_lib' => {
          server\_url: 'http://127.0.0.1:4723',
          wait\_timeout: 10,
          wait\_interval: 0.5
        }
      }, true
    )
    @driver = @appium\_driver.start\_driver
  end

  def teardown
    driver.quit
  end

  def test\_search
    search = driver.find\_element(:name, 'Search')
    search.click
    search.send\_keys('cpu')

    cpu = driver.find\_element(:class\_name, '\[list item | CPU\]')
    assert(cpu.displayed?)
    cpu.click

    cpu\_tab = driver.find\_element(:class\_name, '\[page tab | CPU\]')
    assert(cpu\_tab.displayed?)
  end
end

Monday, 12 December 2022

It’s a Plasma widget that visualizes what’s going on on your system, music-wise that is. I’ve started this project years ago but only recently found the motivation to get it to a somewhat acceptable state. It’s pretty amazing to have bars flying across the screen to Daft Punk’s `Touch`.

https://store.kde.org/p/1953779

Friday, 9 December 2022

Qt 6 introduced a new way to access platform specific objects and functionality in the QNativeInterface namespace. Starting with Qt 6.5 it will be possible to obtain handles to wayland object handles this way. Let’s look at what’s new and how it improves on the past method.

In Qt 5 there were to two options to access platform-specific API and native handles of the current platform. If you were lucky, your platform had an ‘Extras’ module like Qt Max Extras, Qt X11 Extras or Qt Android Extras. However these were removed for Qt 6 and if you ever needed something that was not exposed this way or the platform had no ‘Extras’ module (like Wayland), it was also possible to access functionality via QPlatformNativeInterface. An example usage of would look like this:

QPlatformNativeInterface *nativeInterface = QGuiApplication::platformNativeInterface();
if (!nativeInterface) {
    return;
}
auto seat = static_cast<wl_seat*>(nativeInterface->nativeResourceForIntegration("wl_seat"));
auto surface = static_cast<wl_surface*>(nativeInterface->nativeResourceForWindow("surface", window));
if (!seat || !surface) {
    return;
}
// do something with seat and surface

The snippet shows multiple problems of this API. One is that it is not type safe, the nativeResourceFor... functions return void*. I could easily have forgotten to change the type in the second cast with further implications down the line. The second problem is that it is not obvious at all what is available, no header file will tell you. One has to either already know or read the implementation. Additionally any typo in the string will break the functionality.

Qt 6 solves this with the interfaces in the QNativeInterface namespace. They provide type safe access to the platform specific parts. Using the new interfaces for Wayland in Qt 6.5 we can rewrite the above:

auto waylandApp = qGuiApp->nativeInterface<QNativeInterface::QWaylandApplication>();
auto waylandWindow = window->nativeInterface<QNativeInterface::Private::QWaylandWindow>();
if (!waylandApp || !waylandWindow) {
    return;
}
auto seat = waylandApp->seat();
auto surface = waylandWindow->surface();
if (!seat || !surface) {
    return;
}
// do something with seat and surface

Much nicer. The nativeInterface functions check that the interface is available on the object and from there on usage is straightforward. It’s obvious what’s available by looking at the header or the documentation. For example through QWaylandApplication it’s possible to access the wayland objects that Qt is using internally as well as the input serial of the last user action which is sometimes required to pass in other wayland protocols.

The astute reader might have noticed that in the snippet QWaylandWindow is in the nested QNativeInterface::Private namespace for now. The interface chosen here is being evaluated and a bit experimental (due to the need of signalling surface creation and destruction, it’s the first native interface inheriting from QObject!) and as I wanted to get this into Qt 6.5 I followed the precedent of QWindow native interfaces of the other platforms also being private for now. QWaylandOutput also resides next to its cousins in QNativeInterface::Private. Still I hope they don’t need to stay too long there and can be made public soon.

Let’s go for my web review for the week 2022-49.


I Taught ChatGPT to Invent a Language - by Dylan Black

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

Hard not to have at least some ChatGPT related news this week. Plenty of impressive experiments out there… I think this one is hands down the most impressive one. I’m biased though, I like linguistics inspired works.

https://maximumeffort.substack.com/p/i-taught-chatgpt-to-invent-a-language


ChatGPT and the viability of replacing humans with circus tricks

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

Words of caution regarding the use of language models for producing code. This can derail fairly quickly and earlier than you’d expect… without noticing it.

https://adamshaylor.svbtle.com/chatgpt-and-the-viability-of-replacing-humans


Twitter Thrills Far-Right Trolls by Silencing Left-Wing Voices

Tags: tech, twitter, social-media, politics

This is really going down the drain. Right wings extremists basically took over the content moderation vacuum. I wonder how long before this turns into simply into an extremist echo chamber with no real user on it.

https://theintercept.com/2022/11/29/elon-musk-twitter-andy-ngo-antifascist/


Samsung’s Android app-signing key has leaked, is being used to sign malware | Ars Technica

Tags: tech, android, security

This shows really bad practices… and lack of transparency, worrying for users.

https://arstechnica.com/gadgets/2022/12/samsungs-android-app-signing-key-has-leaked-is-being-used-to-sign-malware/


The architecture of Mastodon

Tags: tech, fediverse, architecture

Nice explanation of the Mastodon architecture, how it propagates messages and interactions or how it scales.

https://softwaremill.com/the-architecture-of-mastodon/


Blockbench

Tags: tech, 3d

That looks like a nice even though a bit niche 3D model editor. I like this kind of style.

https://www.blockbench.net/


GitHub - datafold/data-diff: Efficiently diff data in or across relational databases

Tags: tech, tests, databases

Looks like an interesting tool when you need to diff databases. Definitely something I’d see myself using for large pin tests.

https://github.com/datafold/data-diff


Structured concurrency in Java with Loom

Tags: tech, java, multithreading

Interesting new concurrency model in Java. Probably a good inspiration in other situations.

https://www.davidvlijmincx.com/posts/loom/java_structured_concurrency/


The Git Parable

Tags: tech, git

An old piece, I sometimes like to revisit the basics so here it goes. A nice explanation of how Git is built and how it works internally. It’s of course a simplification in some way but close enough to have a good mental model of what goes on behind the commands we use.

https://tom.preston-werner.com/2009/05/19/the-git-parable.html


A debugging manifesto

Tags: tech, debugging

Excellent piece about the right attitude to have around debugging.

https://jvns.ca/blog/2022/12/08/a-debugging-manifesto/


What I learned from pairing by default

Tags: tech, pairing, programming

Good balanced view about pair programming. I’d definitely like to practice it more, although whole days might be a bit too much and too exhausting.

https://blog.testdouble.com/posts/2022-12-07-what-i-learned-from-pairing/


37 Years Ago, Steve Jobs Said the Best Managers Never Actually Want to Be Managers. Science Says He Was Right | Inc.com

Tags: tech, management

I’m not a huge fan of the “Steve Jobs said…” to justify thing, a clear rhetoric trick. Still, I think this short piece nails it down, it’s just better when managers actually know the job. It’s better to promote someone who knows it and coach that person into the job. There’s only one challenge then (which is glanced over in the paper): how to keep this manager technically relevant over time. It’s not that easy in our field.

https://www.inc.com/jeff-haden/37-years-ago-steve-jobs-said-best-managers-never-want-to-be-a-manager-science-says-he-was-right.html


The Most Brutal Ant: The Slaver Ant Polyergus - YouTube

Tags: science, ants, surprising

No really… ants are scary!

https://www.youtube.com/watch?app=desktop&v=Qsbe1pD8ocE



Bye for now!