Tuesday, 1 October 2024

Translating a Qt application, can be a daunting task. This is an overview from Qt 5 to Qt 6 and what new functionality Qt 6.7 brings.
Continue reading Translating Qt Applications at basysKom GmbH.

Translating a Qt application, can be a daunting task. This is an overview from Qt 5 to Qt 6 and what new functionality Qt 6.7 brings.
Continue reading Translating Qt Applications at basysKom GmbH.
After having participated to both Qt Contributor Summit and Akademy, I ended up going to a few more conferences in September.
I went to Nextcloud Conference just after going back from Akademy. Unfortunately I was quite tired from Akademy and Qt Contributor Summit and I only stayed Saturday morning. Still it was great to meet some old colleagues there.

The Matrix Conference happened the weekend after the Nextcloud conference. This was the first Matrix Conference and a gathering of all types of actors involved in Matrix. From the grassroots community to companies deploying Matrix based solutions to their customers. The NeoChat team was there and we were super productive into bringing back the Android version, thanks to the help of Volker Krause. This resulted in many patches in NeoChat itself but also one patch in Kirigami.
Special mention to the food and coffee offered at the conference, which was always excellent and either vegan or vegetarian. Outside of the venue, food was also execellent with a lot of middle eastern food choice.
Here some photos of the event and the food:
It was my second time going to the Linux Days in Dornbirn and while the weather wasn’t as welcoming as last time, the local Linux community was again super welcoming!
During the event, I did a talk in German about Plasma 6. This was my first time doing a talk in German and I hope I did okay. I also hosted a KDE stand with Simon Österle, who offered his help with the stand. His help has been invaluable to me, so huge thanks to him.
Like last year, after the conference, all helpers, presenters and stand holders went to a local restaurent to enjoy Käsespätzle. It was again delicious.
Here some photos of the event and the food:
This release focuses on SiteSettings feature, so I will try to introduce it here.
This feature tries to enable per site configuration / settings of multiple options per website host / domain. It consist of having global / default options and site / local settings.
These options can be changed for the given site in the “Site Info” dialog.

The default options for HTML5 can be changed in “Preferences > Privacy”

The default QtWebEngine / site options can be changed in the Browsing tab or in place where they where configured until now.

In the preferences it is only possible to change existing modified permissions for given sites. At the moment it is not possible to manually add sites to the list, this can only be done from within “Site Info” dialog.
These features will be done at a later unspecified date.
The Amarok Development Squad is happy to announce the immediate availability of Amarok 3.1.1, the first bugfix release for Amarok 3.1 "Tricks of the Light"!
3.1.1 features a number of small improvements and bug fixes, including miscellaneous fixes for toolbars and the return of tag dialog autocompletions, a functionality that initially got lost during the Qt5/KF5 port. However, most of the work has again happened under the hood to improve the codebase's Qt6/KF6 compatibility. For the 3.2 version coming up later this year, the KDE frameworks dependency will be raised to 5.108. This should allow replacing the remaining deprecated KF5 functionalities; one of the final barriers preventing Qt6/KF6 based builds from succeeding.
In addition to source code, Amarok is available for installation from many distributions' package repositories, which are likely to get updated to 3.1.1 soon, as well as the flatpak available on flathub.
You can find the tarball package on download.kde.org and it has been signed with Tuomas Nurmi's GPG key.
Three weeks ago, I attended KDE Akademy 2024 in Würzburg, Germany. It was pretty exciting to meet my KDE friends after one year since last Akademy 2023!
Ideally whole trip should’ve taken just ~18 hours door-to-door but thanks to Lufthansa whole travel turned out to be of 48 hours in total including layovers. Flight cancellation and rebooking caused by travel to start way earlier than planned (Thursday 5:00 AM instead of planned 07:00 PM) and had to spend insane amount of time in layover.
This year Akademy was in Würzburg (shock! horror!). I think its not too far fetched to say that we pulled it successfully.
During last years Akademy in Thessaloniki the idea came up given the high density of KDE people in the area to hold Akademy in Würzburg. On top we had the perfect venue in mind: two lecture halls for talks, BoF rooms and a ample common area for people to hack and socialize. I had such thoughts in the back of my mind for a while but did not share or go through with them.
However what Akademy does is it makes you talk to people and Tobias convinced it me that we should do it and more people even agreed that Akademy in Würzburg would be a good idea! (Of course some of these encouragers this does not mean work organizing Akademy like it would mean for us…) So on the second-to-last day of Akademy I sat down and wrote an email to my former university professor to enquire about the possibility of doing Akademy in the building that we envisioned.
And just like that, after some informal talks during Akademy and a meeting at the University and sending in a proposal after the Call for Hosts later you end up having weekly meetings to talk about and plan the next installment of Akademy.
There were some problems but I think all in all this year Akademy went very well. I heard so much praise and positive feedback it felt a bit surreal at first (as did Sunday evening when all the talks were done). The most stressful situation for me happened on Sunday afternoon when I retrieved my charging phone from the team room to discover that the social event could not go ahead as planned and trying to manage that with the rest of the team. I think the resulting evening was very nice and chill and you could feel my relieve. I heard there was even an afterparty afterwards at the bar where we had held the welcome event.
Of course during the event there are always minor issues that need dealing with and looking out for those, dealing with them and trying to make sure everything is running smoothly (and the stress coming these things) meant that I couldn’t (and was not in the right state of mind) to focus much on the talks. When the BoF days started this was bit better but only on Thursday after the day trip I felt in a ‘conference mood’ and was able to focus fully on the BoFs that I was attending and sit down and hack a bit. If you want to learn more about the actual conference many people have blogged about it on the planet or read the report on the Akademy website.
In the end I think it’s fair to say that Akademy was a success. Made possible by KDE e.V. (go donate!), the sponsors, all the people of the Akademy team local and non-local, all the Volunteers on short and on long notice an last but not least all the awesome attendees - there would be no Akademy without any people. Thank you to you all! I am excited to learn about where next years Akademy will be (you can do it as well - it’s not hard and you get an awesome award on top) and looking forward to attending it as ‘normal Attendee’ and meeting everyone again there (if not earlier).

Today we are releasing GCompris version 4.2.
It contains bug fixes and graphics improvements on multiple activities.
This version adds translation for Latvian.
It is fully translated in the following languages:
It is also partially translated in the following languages:
You can find packages of this new version for GNU/Linux, Windows, Android, Raspberry Pi and macOS on the download page. This update will also be available soon in the Android Play store, the F-Droid repository and the Windows store.
Thank you all,
Timothée & Johnny
在客户端因某些原因异常退出时,服务端将无法正常处理其他请求.
recv一直在阻塞着读取,且无法处理其他请求如何往线程池中传入类的成员函数.
auto task = [](){ 类的成员函数 } m_pool.submit(task);1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
* `Tcp`传输为字节流传输,采用在每条消息前面加上`长度`来正确接收每条请求.
* 在代码中往`redis`数据库中添加好友申请数据时,没有正确插入.
* 由于好友申请当中包含时间,姓名等信息,中间含有**空格**,在redis的哈希表中无法插入.
* 经过查阅在redis哈希表中,**空格**可以用`+`代替,在遇到`+`时会被转义为**空格**,或者存储为**十六进制**,但是这种方法在终端中的**空格**为灰色.
* 在聊天界面如果输入带有`%`,服务器直接挂掉.
* ```c++
int redisAsyncContext::Lpush(const std::string &key, const std::string &value)
{
//std::string cmd = "lpush " + key + " " + value;
this->m_reply = (redisReply *)redisCommand(this->m_connettion, "LPUSH %s %s", key.c_str(), value.c_str());
// 检查 m_reply 是否为 NULL
if (this->m_reply == NULL) {
std::cerr << "Error: redisCommand returned NULL" << std::endl;
return -1; // 或其他合适的错误值
}
// 检查 m_reply 类型
if (this->m_reply->type != REDIS_REPLY_INTEGER) {
std::cerr << "Error: Expected integer reply" << std::endl;
freeReplyObject(this->m_reply);
return -1; // 或其他合适的错误值
}
int num = this->m_reply->integer;
freeReplyObject(this->m_reply);
std::cout << "G" << std::endl;
return num;
}
在执行下面两句是,%会被替换为cmd.c_str(),导致无法将消息插入历史记录表,导致出现错误.
1 | std::string cmd = "lpush " + key + " " + value; |
只要更改为下面即没有问题
1 | this->m_reply = (redisReply *)redisCommand(this->m_connettion, "LPUSH %s %s", key.c_str(), value.c_str()); |
在某次测试时,新注册账号id为0614897828,导致与该账号聊天的账号进入聊天界面时,0614897828发送的消息会在他人界面显示为通知消息.
0614897828聊天时,数据库中记录账号为614897828.score字段字符串中的0去除.将从字符串的首位非0开始存储.在进入好友私聊界面时,客户端新建了来接收消息,同时主线程发消息,主线程通过判断用户是否键入Esc来退出聊天界面,在输入Esc时,接收消息线程无法正确回收,无法退出聊天界面.
Esc时,将标志位设置为false,但由于客户端的recv为阻塞,导致无法及时获取到标志位的更改.Esc时,服务器向客户端发送退出信号,这样就可以正确及时的获取到标志位的更改,从而正确退出.在进行发送文件时,服务器会先将文件存储在本地,但是服务器存储的文件会多写入一些信息,导致接收文件大小偏大.
实现后台发送文件,由于会有实时刷新的存在,会导致文件发送不准确.
socket连接到服务器,在将发送这个文件交给另外一个线程socket发送文件后,服务器不用手动断开连接,服务器有心跳检测,会在一段时间后断开.是一个Linux系统调用,也是一种进程间通信(IPC)机制,主要通过使用文件描述符生成和使用事件通知.
提供了一种在不同进程之间或同一进程内的线程之间的同步事件的方法.
异常是程序在执行期间产生的问题。c++异常是指在程序运行时发生的特殊情况.
异常提供了一种转移程序控制权的方式。C++ 异常处理涉及到三个关键字:try、catch、throw
关键字:try、catch、throw。
catch: 在您想要处理问题的地方,通过异常处理程序捕获异常。catch 关键字用于捕获异常
try: try 块中的代码标识将被激活的特定异常。它后面通常跟着一个或多个 catch 块
1 | try |
SIGPIPE 是一种信号,当一个进程尝试向一个已经关闭的或不可写的管道或套接字写数据时,会触发这个信号。默认情况下,接收到 SIGPIPE 信号的进程会终止。这在网络编程中会导致一些问题,因为如果客户端断开连接,服务器进程在写入数据时会因为这个信号而意外退出。
在网络编程中,特别是使用套接字进行通信时,忽略 SIGPIPE 信号是一个常见的做法。这样可以防止进程因为 SIGPIPE 信号而意外终止。相反,程序可以通过检测 send 或 write 操作的返回值来处理错误,从而使程序更加健壮。
初始客户端构思方面的缺陷,导致实时消息没有线程及时接收。
当前处理方式为服务端将通知消息放入数据库当中,客户端在登陆之后,增加一个线程来定时执行刷新函数,刷新数据库中的通知消息
可以优化为在客户端登陆之后,采用多线程的方式来处理相关操作.
目前只有在历史消息这一操作涉及到redis+mysql的处理方式.
可以将一些重要信息也采用redis+mysql的处理方式(涉及到redis的存储方式,redis存储于内存当中,会造成数据丢失的情况)
可以考虑将redis全部做为缓存的形式,将重要信息与历史消息类似,达到一定情况下放入mysql,使数据更加的持久化.
继续学习epoll的相关内容.
了解其余网络框架,使得该项目的服务端更加的健壮.
了解消息队列的信息同步的问题.
熟悉零拷贝的过程,以及零拷贝的具体实现.
序列化的相关协议,json与其他序列化的区别、json的优点,以及为什么不用其他的序列化
数据库的深入学习,了解redis的缓存穿透、缓存雪崩、缓存击穿。加强对mysql数据库的学习.
加强对网络协议相关知识的学习.
C++提供了四个强制类型转换的关键字:
static_castconst_castreinterpret_cast1 | static_cast<目标类型>(表达式) |
1 | int num = 2; |
该运算符将表达式转换为目标类型。但没有进行运行时类型检查来保证转换的安全性。
主要用法
int与char,安全性也需要程序员来保证1 | class Person |
const_cast是c++中专用于处理与const相关的强制类型转换的关键字
其功能为:为一个变量重新设定其const描述.
即:const_cast可以为一个变量强行增加或删除其const限定.
需要明确的是,即使用户通过const_cast强行去除了const属性,也不代表当前变量从不可变变为了可变。const_cast只是使得用户接管了编译器对于const限定的管理权,故用户必须遵守“不修改变量”的承诺。如果违反此承诺,编译器也不会因此而引发编译时错误,但可能引发运行时错误。
volatile和__unaligned属性。1 | class Student |
在const成员函数fun()中,编译器将“this”视为“ const student const this”,即“this”是指向常量对象的常量指针,因此编译器不允许通过以下方式更改数据成员“这个”指针。const_cast将“this”指针的类型更改为“student const this”。
const_cast比简单类型转换更安全。从某种意义上讲,如果强制类型与原始对象不相同,则强制转换不会发生,这是比较安全的。
1 | int a=20; |
reinterpret,即重新解释.
该强制类型转换的作用是提供某个变量在底层数据上的重新解释.
当我们对一个变量使用reinterpret_cast后,编译器将无视任何不合理行为,强行将被转换变量的内存数据重解释为某个新的类型。用于进行各种不同类型的指针之间、不同类型的引用之间以及指针和能容纳指针的整数类型之间的转换。转换时,执行的是逐个比特复制的操作。 它不检查指针类型和指针所指向的数据是否相同。
需要注意的是,reinterpret_cast要求转换的两个数据所占用的内存大小一致,否则会引发编译时错误.
1 | data_type *var_name = reinterpret_cast <data_type *>(pointer_variable); |
使用 reinterpret_cast 的目的:
1 | class A { |
dynamic用于在运行时实现向下类型转换。
1 | dynamic_cast <type-id> (expression) |
将expression转换为type-id类型,type-id必须是类的指针,类的引用或者是void,
如果type-id是一个指针,那么expression也是一个指针,是引用的话同为引用
特点如下:
nullptr。static_cast的效果是一样的。在进行父类指针向子类指针的转换时,dynamic_cast具有类型检查的功能,比static_cast更安全。dynamic_cast操作符则可以在运行期对可能产生问题的类型转换进行测试。1 | class AA { |