Weekly #5: Learning Rust

Hi~ This is liuyuxin, and this is my 5th weekly report. The happiest thing that happened in the past week was that my girlfriend successfully got into graduate school and became my fellow alumnus. Although we are not in the same campus, it will still be much more convenient to meet in the future.

My weekly report will be updated every Monday morning through WeChat public account and personal blog. Please search "刘玉新" on WeChat public account, and the blog address is: The blog supports RSS subscription:

This issue of the weekly report is a bit late. The following is the main content.

Reinventing the Wheel

The biggest challenge I faced after switching from Windows to Ubuntu was not being able to find a translation software as a replacement for pot. Although pot also supports Linux systems, it cannot register global shortcuts and set top windows within the application due to Ubuntu's default use of the Wayland protocol. The shortcuts registered in the system settings also have a delayed response. So I decided to write my own using Flutter. After half a night, I wrote a usable demo that uses Baidu Translate API for translation, which initially meets my needs.

But after packaging it, I realized that the app, which was working fine during debugging, had the same problem as pot after installation: it couldn't register global shortcuts and set top windows within the application. After checking the documentation, it turned out to be a problem with the Wayland protocol. Everything worked fine after switching to the X11 protocol. So am I just reinventing the wheel? It's better to switch to X11 and continue using pot.

However, I am still willing to spend some time continuing to develop this software because the original intention of writing this software was for my own use. I know what my needs are, and it's still better to write an app for myself according to my own ideas than to use other ready-made ones.

Yes, it's still Material You design

(Actually, I switched to Kubuntu after less than 10 days on Ubuntu. I suddenly found that the design style of the KDE desktop system is quite nice, and it has a higher level of customization. Now I don't have to worry about the display protocol of Ubuntu anymore, after all, the software is mainly written for my own use.)

Learning Rust

Last week, JetBrains released their own Rust IDE, and Rust has been gaining popularity in recent years. I also plan to spend some spare time learning it (of course, I will still continue to use VS Code).

The main learning material is the Simplified Chinese version of The Rust Programming Language. Before starting, I learned about the main features of Rust: high performance and high security.

The performance of a programming language mainly lies in its utilization of computer hardware resources. Traditional memory management has two methods: manual memory management (such as C and C++) and automatic memory management (such as Python and Java). Both of these methods cannot achieve both performance and security. However, Rust's "ownership mechanism" allows for both performance and security. The core of the "ownership mechanism" is that a value is always owned by only one variable. The benefits of this allocation mechanism are:

  • Very low cost of reassignment, without the performance overhead of garbage collection.
  • The owner of the value is very clear, and there is a clear time for memory reclamation.

This is the main reason why Rust can write high-performance and high-security programs.

Other Matters

  • My girlfriend has been complaining about my hairstyle for a long time, mainly because my hairline is a bit high and my hair is easily flat. I went to get a perm over the weekend, but she thinks I look even uglier now...
  • Alibaba's Yuque has launched an education discount, and using an educational email can upgrade to a premium membership for free. I also got one. But I don't use Yuque anymore.
  • I saw on Jike that there is a new brand of milk tea called "霸王茶姬" in Beijing! It's my girlfriend's favorite milk tea! When we were in Guiyang, she would never buy other brands of milk tea as long as there was "霸王茶姬". Now it's available in Beijing too (I remember it wasn't available last semester, I don't know when it opened). I must arrange to get some (when ordering, I found that there were more than 280 orders ahead)!
  • The book "Elon Musk: Tesla, SpaceX, and the Quest for a Fantastic Future" has been taken down from WeChat Reading. I just finished reading the first chapter! Looks like I'll have to find an e-book myself. Or maybe I'll put it aside for now, I don't have to read this book. I'm thinking of reading "The Fountainhead" for the third time or starting to read "The Neapolitan Novels"?
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.