Skip to content

Welcome to Planet KDE

This is a feed aggregator that collects what the contributors to the KDE community are writing on their respective blogs, in different languages

Friday, 16 April 2021

Let’s go for my web review for the week 2021-15. A bit smaller this week, looks like less articles picked my interest. ;-)


The Community Canvas

Tags: community, management

Looks like a very nice canvas for building and charting communities.

https://community-canvas.org/


What exactly was the point of [ “x$var” = “xval” ]? – Vidar’s Blog

Tags: tech, shell

Interesting dive into history explaining why we had the x hack in shell script. Interestingly it was still relevant all the way to 2015 at least…

https://www.vidarholen.net/contents/blog/?p=1035


Understanding Atomics and Memory Ordering - DEV Community

Tags: tech, multithreading, atomics

If you’re still struggling with atomics and memory fences (and you should) this is a good piece to read. It really goes through it all.

https://dev.to/kprotty/understanding-atomics-and-memory-ordering-2mom


SQLite the only database you will ever need in most cases

Tags: tech, sqlite, sql

Starts a bit like a (somewhat deserved) love letter to SQLite. But that also does a good job pointing out some of its caveats and when to not use it.

https://unixsheikh.com/articles/sqlite-the-only-database-you-will-ever-need-in-most-cases.html



Bye for now!

As you may have already seen or heard, Qt Quick 3D introduces support for 3D particles in Qt 6.1. Similarly to instanced rendering , also 3D particles module is a technology preview in Qt 6.1 and will be fully supported in Qt 6.2. In this blog post we'll go through things every developer & designer should know about the new 3D particles, so please continue reading. With the visual elements such as particles, it is always beneficial to actually see what you can do with them. The video below goes through some demos from our Testbed application, included as part of the Qt 6.1 examples.

Thursday, 15 April 2021

Last year I decided to add an improvement to my home office, a treadmill. I thought about during the total lock-down we suffered in Spain in spring 2020. The reason for not trying it earlier was that I was skeptical about keeping my productivity level high while walking on the treadmill. Finally I made the decision to try out and asked for one to The Three Wise Men. They were kind enough to bring it.

After a few weeks using it, I would like to report about it since several of my colleagues at MBition/Daimler asked me about it. I hope that reading about my experience is useful to you.

Select the right treadmill

I started by doing some research on which treadmill to buy. The main characteristics that led my decision were:

  • Walking vs running: I wanted a treadmill for walking, not for running. There are quite a few models that has 6 to 7 km/h as speed limit and no support or add-ons to hold on to while walking. The intention is to avoid any clashing with my standing desk converter.
  • I am a big man so I need a big treadmill: the market offers treadmills with different length, surface and weight limits. I searched for one that can afford a big man like me and that was as wide as possible. Falling from it was a concern.
  • Remote control: since you will be walking while working, you need a way to control the treadmill remotely, either with a remote control, an app or similar. I selected one with a remote control.
  • With wheels: I need to move the treadmill often since I alternate using the treadmill with working standing up or seated. I wanted one with wheels so it is easier to move. Moving it to clean the office was also a requirement. Treadmills are heavy.
  • Limited investment: my idea was to try out first so I did not want to invest a lot up front. If it works, I will invest more in a replacement when needed.
  • Pay attention to the noise level: my treadmill is noisy although not enough to be annoying or to be heard by others while in video calls. Check the specifications, I did not so I simply was a little lucky..

I bought this model, produced by 2WD, ASIN/model B08GLTX8LK, through Amazon for €299. I had no issues with the purchase.

Usage

I use now the treadmill between 2.5 and 3.5 hours a day. I started using it between 5 and 6 hours but soon I got hurt in one foot which forced me to stop for some time. First lesson learnt: take it easy, specially if, like myself, you are not in great shape.

At first I ended up so tired that it was hard for me to keep good levels of concentration during the last part of any working day. As I get more used to using the treadmill, I feel more energetic in general so that tiredness is little by little going away. My productivity is increasing overtime, specially compared to the first few days. The last few weeks I even have energy left to do some additional soft exercise after work.

I started walking at 2 km/h. I increased to 2.5 km/h after 2 weeks. A few weeks later I tried 3 km/h but it was harder for me to concentrate. It is too fast for now. There is a slight mismatch by the way between the speed and the distance walked marked by the treadmill. I think that the average speed I walk is a little below 2.5 km/h. In am currently walking around 7-8.5 kms (10k steps is around 8 kms). In any case, I try to reach the 6.5 kms mark every day. I am accomplishing it regularly during the last few weeks.

Can I work normally while walking?

This is the question most colleagues ask me. The answer is yes… for most activities.

My experience is that I can work normally while walking, keeping good productivity levels, while performing most type of activities, specially during most meetings.

In which activities have I detected a reduction of productivity?

I detected a productivity decrease in those activities which require high levels of concentration or creativity like complex meetings that I facilitate and include many participants, those times when I need to come up with new ideas, analysis of complex data, etc. The good news is that I did detect this productivity reduction early. The longer I have been using the treadmill though, the more type tasks I can do without noticing a productivity reduction. So I plan to try again during the coming weeks some of those activities that I dropped early on while walking.

Walking is helping me a lot to go through those days with back to back meetings. I pay better attention and get less bored compared to standing up. As I get more used to walking, my energy levels during the afternoons are increasing, as mentioned, which helps me to get through the last couple of hours during long working days. It was not like that at first though, so plan accordingly.

The unexpected surprises

The treadmill uses IR to connect to the remote control which interferes with an IR-based device I had at my office, the HDMI hub. I use two laptops and two monitors and used the HDMI hub to have one of the two screens assigned to one of the laptops. The default config though is to have both monitors assigned to my working laptop. I did not find a way to prevent such interference so I had to remove the HDMI hub. I am looking for alternatives although the impact in my daily workflow is low. The problem was easy to detect because every time I turned the treadmill on, one of my screens turned off although both laptops detected the corresponding monitor. So the takeaway is: watch out for IR interference.

I trickier surprise for which I have not found a solution yet is the problems associated with the PLC. I have my office connected to the living room, where the fiber router is located, through PLC. This has been my default set up since years in several houses. Something related with the treadmill makes the link between both PLC devices unstable which ends up in connectivity issues. I have a backup connection for the cable link which is a wifi replicator including a specific wifi network for the devices I use for work (in other jobs I used to play with boards which required a testing network). So sometimes I have to use wifi instead of cable because the link between both PLC devices get unstable. It took me a while to detect the source of issues. After testing the PLC device in every plug of my office, I ended up finding one which makes the connectivity issues tolerable. Still I am searching for a solution here..

The takeaway is that the treadmill consumes quite some power and might have spurious looses that might turn network connectivity through PLC unstable.

Other points to consider

Some days I start the working day walking and some others I walk after lunch or when I have back to back meetings. I tend to change the set up putting or removing the treadmill no more than once a day. Usually I have an additional set up change when I push down my Varidesk to work seated. The idea is to reduce configuration changes to the minimum.

The standing desk converter I have is big enough to allow me to hold on to it while walking when I do not have my hands on the keyboard. That have saved me from falling down during meetings more than once. Be careful, falling down is a real risk. Take precautions.

Get professional advice about walking with or without shoes. In my case, I walk without shoes. This decision might change in the future. My knees are awful due to injuries from my basketball times. Pay attention to the way you walk. When you get tired, your walking style changes and you might end up hurting yourself.

My treadmill has a limit of 100 minutes. When it reaches that threshold, it stops. I was annoyed at first but it has ended up being a great thing. I used to work in cycles of 110 or 120 minutes but sometimes I loose track of time and this hard stop helps. While walking, my working cycles are now shorter which help my concentration levels, specially at the end of the day.

Obviously during meetings participants notice that I am walking. Be ready for questions and jokes. Having a treadmill is not mainstream yet. Ah, and do not fall while in a meeting.

Conclusions

At first I overdid it, got hurt and tired fast so my productivity in the afternoons dropped. In my second try I took it easier and the experience is getting better overtime. Six weeks after being back at using the treadmill I am improving. I will soon be ready to increase the time walking and the type of activities I execute while on the treadmill.

I think it will take me another few weeks before the benefits for my health and shape become evident. I can see early signs though. So in general I find the experience positive so far although I expect to get better after a few more weeks when, in addition to the walking done on the treadmill, I have energy to complement such exercise with additional one on regular basis. The same applies to the level of concentration while doing the most demanding tasks.

The connectivity issues I am experiencing are unfortunate although tolerable. I need to find a solution.

So yes, I totally recommend to get yourself a treadmill. Results will show up sooner or later depending on your prior shape. I think that if you are in better shape than I was when I got it, which is not hard, results will be noticeable in a couple of months, probably less.

Season of KDE 2021 Status Report

This year I participated SoK as mentor for KWeather and Kalk. Now the work has been done, let me sum up the new features we bring to the projects.

KWeather

When the project name is KWeather, the actual code is committed to KWeatherCore, a Weather library. We decided to add weather alerts functionality to KWeatherCore, possibly easing the difficulty later if we want to develop a weather alerts daemon.

The data source is from metroelogy institutes around the world. Most of them provide CAP protocol for alerts. So the main goal is to write two parsers, one for CAP feed parsing and other for the CAP parsing. Anjani Kumar finished classes representing CAP feed entry and CAP message, as well as the CAP parser. Nikunj Goyal is supposed to work on feed parser and some of the daemon code. But due to various reasons, he wrote the AlertManager class which is an utility class. I wrote the feed parser and finished most of the documentation.

Since the lack of man hours, we weren’t able to finish the promised daemon. However the library is working as expected. We use config files (in json format) to avoid hardcoding different formats of CAP feed. So in the future we can support more countries without edit our code (and releasing new library version).

Kalk

Kalk is calculator for Plasma Mobile, this SoK we’re bringing binary mode to it.

Though as simple as the project name suggests, in the middle of the SoK we decided to switch from primitive double type to GMP and MPFR for our base type. Thankfully we’re using Bison/Flex for our math engine so swithing to multi-precision big number type doesn’t require use to rewrite Kalk again, wrapper classes still needs to be created. We re-used Knumber from KCalc. Since it’s a in-source library for KCalC, and lacking some helper functions Kalk needs, it has been copied to Kalk and modified since. Rohan Asokan wrote binary number type wrapper for Knumber (though later reverted because of preference for native GMP/MPFR binary <-> string converting functions), and math engine supports simple binary calculations. He also managed to add UI for binary calculator using Kirigami.

Date calculator was originally planned, but I decided to drop it eventually. Kalk is a simple calculator, I don’t want it to be bloat. Rohan Asokan did have a prototype for it though.

Kalk Binary Mode

The next release 2.9 will again come with many very useful and interesting new features. Today we want to talk about a new feature in the area of the data analysis that has been included into LabPlot’s master branch recently.

Though it is possible in LabPlot to access many different computer algebra systems and programming languages with a plethora of packages relevant in scientific communities, it is sometimes useful and desired to perform the analysis of data in a more visual and interactive way. For this kind of analysis LabPlot already supports algorithms and computations like the Fourier Transformation, smoothing, interpolations, Fourier filter, etc (see this blog post for a couple of examples). To this list we have now added the Hilbert Transform.

The Hilbert Transform has many applications, especially in signal processing. Below is an example produced in LabPlot that shows the time response of a super regenerative receiver to an ultra-wideband (very short) pulse consisting of few oscillating cycles enclosed within a Gaussian-like envelope (for high-Q receivers) or within a bilateral exponential envelope (for low-Q receivers).


Hilbert Transformation Example

In this example, the use of the Hilbert Transform helps you visualize and confirm the envelope shape and to find some signal features, like the position and the value of the maximum envelope point, which would be very difficult to determine otherwise.

The current development versions (i.e. the code being finalized and prepared for the next release) is available from our download section and can already be used to try out this new feature.

Better Calendar, Better Kickoff and... Merge Requests?

Sometimes it’s useful to establish a connection between a signal and a slot that should be activated only once. This is not how signal/slot connections normally behave. Remember that, when a connection is established, it will stay active until:

  • the connection is explicitly disconnected; or
  • the sender object is destroyed; or
  • the receiver object is destroyed.

So, if we need such a single-shot connection, how do we go about it? A possible solution is to connect our signal to a small helper function (for instance, a lambda) that disconnects the connection, then calls the actual slot. This is it, in pseudocode:

// Trying to make
// connect(sender, &Sender::signal, receiver, &Receiver::slot)
// behave as single-shot connection

auto singleShot = [receiver, connection](parameters) {
  QObject::disconnect(connection); // WHOPS, we don't have this yet!
  receiver->slot(parameters);
};

connection = connect(sender, &Sender::signal, receiver, std::move(singleShot));

There’s a semantic problem with this code: the connection object is created after the lambda. But we need its value in the lambda, to be able to disconnect it! Fixing this requires us to introduce a little indirection, but it’s doable:

auto connection = std::make_unique<QMetaObject::Connection>();
auto connectionPtr = connection.get();

auto singleShot = [receiver, connection = std::move(connection)](parameters) {
  QObject::disconnect(*connection);
  receiver->slot(parameters);
};

*connectionPtr = connect(sender, &Sender::signal, receiver, std::move(singleShot))); 

This is…quite annoying to write. I certainly don’t want to type all of that every time I need a single-shot connection, and trying to make it generic is super tricky for new users of Qt.

We can do better!

Enter Qt 6.0!

In Qt 6, I have added the convenience Qt::SingleShotConnection connection flag that you can pass as the fifth argument of QObject::connect (optionally combining it with the other connection types):

connect(sender, &Sender::signal,
       receiver, &Receiver::slot,
       static_cast<Qt::ConnectionType>(Qt::SingleShotConnection));

The static_cast isn’t technically necessary, in this case. But it becomes necessary, should we want to also pass some other arguments (for instance, if we want the connection to be queued as well as single-shot). This closed a long-standing and very voted feature request. Sometimes, by removing the pebble in your shoe, you make many other people happy.

And for Qt 5?

I can’t add the same feature to Qt 5, as Qt 5 development is closed for new features.

However, I’ve also reimplemented the solution shown above in KDToolBox and packaged it with a convenient API:

KDToolBox::connectSingleShot(sender, &Sender::signal, receiver, &Receiver::slot);

sender->causeSignalEmission(); // calls the slot, and breaks the connection
sender->causeSignalEmission(); // does NOT call the slot

KDToolBox is KDAB’s collection of miscellaneous useful C++ classes and stuff. You can download it from our GitHub repository here.

Have fun!

About KDAB

If you like this blog and want to read similar articles, consider subscribing via our RSS feed.

Subscribe to KDAB TV for similar informative short video content.

KDAB provides market leading software consulting and development services and training in Qt, C++ and 3D/OpenGL. Contact us.

The post Single-shot signal/slot connections appeared first on KDAB.

Wednesday, 14 April 2021

I've recently started a new project, to enable me to playback videos from online sources in a desktop application: Mitubo.

Here's a terrible video I quickly made to show what MiTubo can currently do:

MiTubo is currently available for Ubuntu 18.04 and later from this PPA and for all other distributions from here as an AppImage package.

You are very welcome to try it out and report issues at its bug tracker. I know that there are many of them, but regardless of them the program is still useful to me, so I hope it can be useful for other people too.

We are happy to announce the release of Qt Creator 4.15 RC1 !

However much distress the current scenario and some personal stuff might cause, I’ve really been having fun with my laptop. Running everything on bleeding edge is exciting: kernel 5.12.rc6, openSUSE Tumbleweed with Plasma built daily from master (so openSUSE Krypton), using only the Wayland session, switching entirely to pipewire and so on. I figured I … Continue reading "My current Plasma Wayland from git"