Chatting with the Interviewer | Python Object-Oriented Access Control

Python was designed as an object-oriented language from the start, and the first element of object-oriented thinking is encapsulation. Simply put, encapsulation means that the attributes and methods within a class are divided into public and private; public ones can be accessed externally, while private ones cannot. This is the most crucial concept in encapsulation—access control. There are three levels of access control: Private, Protected, and Public. Private: Accessible only within the class itself. Protected: Accessible within the class itself and its subclasses. Public: Accessible by any class. ...

March 30, 2018 · 4 min · Zhiya

Batch Extract Win10 Lock Screen Wallpapers Using Python

Windows 10 users might notice that every time they boot up, the lock screen displays a different beautiful image. These images are often selected from outstanding photography works and are quite exquisite. However, since the system automatically changes these images, even the most beautiful ones might be replaced the next time you start your computer. With the help of Python, we can use a few simple lines of code to batch extract these beautiful lock screen images. By setting your favorite images as desktop backgrounds, you no longer have to worry about them being replaced. ...

March 26, 2018 · 2 min · Zhiya

Understand the Token Bucket Algorithm in 15 Lines of Python Code

When transmitting data over a network, to prevent network congestion, it’s necessary to limit the outgoing traffic so that data is sent out at a relatively uniform speed. The token bucket algorithm achieves this functionality by controlling the number of data packets sent to the network and allowing for burst data transmission. What is a Token? From the name “token bucket,” it seems to be a bucket filled with tokens. So, what exactly is a token? ...

March 20, 2018 · 3 min · Zhiya

The Person Who Loves You the Most Will Help You Understand Blockchain Without Breaking a Sweat

Blockchain is a hot topic these days. You can hear people talking about blockchain or trading cryptocurrencies in any office building elevator. Through this article, I hope to give you a comprehensive understanding of the concept of blockchain. After grasping the concept, the next article will demonstrate how to implement a blockchain network with approximately 300 lines of Python code. Blocks and Chains A block is, well, a block (what else could it be?), and when you link these blocks together one by one, like a chain, it’s called a blockchain (hold your thoughts, keep reading). ...

March 14, 2018 · 4 min · Zhiya

No More Fear in Interviews: Understand the LRU Algorithm with 20 Lines of Python Code

The LRU algorithm is a common topic in backend engineer interviews. This article will help you understand the LRU algorithm and ultimately implement a cache based on the LRU algorithm using Python with ease. What is a Cache Let’s look at a diagram: when we visit a webpage, the browser sends a request to the server, which processes it and returns the page to the browser. When multiple browsers access simultaneously, multiple requests are initiated in a short time, and the server has to perform the same series of operations for each request. This repetitive work not only wastes resources but can also slow down response times. ...

March 6, 2018 · 4 min · Zhiya