Weekly #5: Learning Rust

Hi ~ This is liuyuxin, and this is my 5th weekly report. The happiest thing in the past week was that my girlfriend successfully got recommended for postgraduate study and became an alumnus of my university. 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 official account and personal blog. Please search for "刘玉新" on WeChat official account, and the blog address is: The blog supports RSS subscription:

This issue of the weekly report is a bit late. Here 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 replacement for pot, a translation software. Although pot also supports Linux systems, it cannot register global shortcuts and set top-level 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 created a usable demo that uses the Baidu translation API for translation, which initially meets my needs.

However, after packaging it, I realized that the same problem as pot occurred after installing the app, which is the inability to register global shortcuts and set top-level windows within the application. After checking the documentation, it turned out to be the fault of the Wayland protocol. Everything worked fine after switching to the X11 protocol. So am I reinventing the wheel? It's better to switch to X11 and continue using pot.

But I am still willing to spend some time continuing to develop this project 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 beautiful, and it has a higher degree of customization. Now I don't have to worry about the display protocol of Ubuntu anymore because the software is mainly for my own use.)

Learning Rust#

Last week, JetBrains released their own Rust IDE, and Rust has been gaining popularity in recent years. I 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 is mainly reflected 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 memory recycling time.

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. Using an educational email address 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 milk tea from any other brand 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 immediately (when ordering, I found that there were over 280 orders in front of me)!
  • 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 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 "Source" 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.