RSSAmplifier

Blog

damnever's blog

A blog about software engineering and all sorts of things.

blog.damnever.comRSS feed ↗15 posts

Latest posts

Reminding Myself to Take a Break - The Hard Way

I spend a lot of time in front of the computer without taking breaks. It’s not that my work is particularly interesting or important, there’s a kind of inertia that makes it easy for me to sit for extended periods. Such a routine can be harmful to my eyes and may lead to other health issues like cardiovascular disease, obesity, back pain, and even mental health problems. Despite…

Enhancing Word Selection for macOS Built-in Input Method

I’ve been using the built-in input method on macOS for a while, and it’s pretty good, it is fast and doesn’t have many fancy features. In my daily work, I’ve gotten used to coding and searching in English. I rarely use obscure Chinese words, nor do I need to use internet slang. However, the quality of the first line of candidate words in Chinese can be quite poor, requiring…

Some Important Notes About VictoriaMetrics

VictoriaMetrics can serve as a full-featured alternative to Prometheus (not 100% compatible). Its official selling points are Scalability, Reliability, Ease-of-Use & Cost-Efficiency. The author has previously released some golang code libraries known for their performance. As an alternative to Prometheus, it tries to solve many existing problems of Prometheus and implements some features that…

The Consistency Problem of Distributed Lock

The devil is in the detail. Use Cases for Distributed Locks Distributed locks are designed to prevent shared resources from being read or written simultaneously in multi-process or multi-machine environments, which can lead to the following issues: Concurrent reads and writes causing dirty data Concurrent reads, leading to redundant operations based on the same data/state, causing contention and…

Some "Thoughts" on Coding

When I was in school, I felt that having learned enough rules, laws, and problem-solving templates, I always lacked interest in these things. Therefore, when I first started writing code and encountered the MVC pattern, I felt that MVC and the like were not good practices after trying a few times. Why should one make things so complicated when building a small website? Adding a small feature…

FaaS & Kubernetes & ?

After scanning the basic concepts and various components of k8s, it is very large and “beautiful”. It is something that requires experience. I thought about learning k8s through practice. The concept of Serverless is very popular right now, and the current general manifestation is FaaS? This thing is very mysterious and does not have a very clear and precise definition. The goal of…

Who Ate My Memory

It’s important to take a break and get out more. I’ve been working for over two years and nobody has shared with me anything beyond technology. I was at home pondering life when my server strangely reported a high memory usage rate. There were no abnormal processes on the monitor, but the overall memory usage rate was very high. Checking on the server, the monitor seemed to be working…

Pitfalls of etcd

The previous article has become increasingly bulky, so I’ve decided to extract it and start a new one. The so-called “pitfalls” are actually due to the incomplete documentation of etcd or the high expectations of the users.. One should understand what is different about Revision, ModRevision and Version? when using etcd. If consistency is required, one should also understand…

DO NOT Touch SO_RCVBUF

EDIT (2018/06/02): I was too ignorant, I read the book for nothing.. See https://github.com/golang/go/issues/25701 , and I mildly complained about Golang’s interface ( Dialer.Control & ListenConfig.Control ).. The rest of this article is just for reference, it’s just a draft. X Me In the previous article , I did something stupid, I directly called TCPConn.SetWriteBuffer in the code,…

The Hole (ETCD & BoltDB & Golang & Others)

Preface Let’s start like this… In the past, a lot of things needed to be done in the SOA framework: database, cache, message queue, service discovery and registry, service/api downgrading, circuit breaker, distributed tracing, load balance, metrics collection, logging, caller/callee white/black list, concurrency control, rate limiting, config management, deployment, inspect/profile,…

Greedy Python

Python is slow because it eats CPU , and multithreading can’t effectively utilize multi-core. However, this product not only eats CPU but also eats memory, which is very greedy. In my previous article , I mentioned a project. I never paid attention to it. This product probably loaded 70M disk files into memory in the form of dict , and the memory usage immediately soared by several hundred…

Rolling in the Deep (with Python)

It’s quite nice to occasionally doubt life (⊙﹏⊙)b Love The advantage of Python is that it’s enjoyable to use, has high development efficiency, and its concise syntax can be said to be the reason for its enjoyability but not the reason for its high development efficiency. Nowadays, who would do daily development with Notepad or naked Vi? I think the reasons for its high development…

Dynamically Add Methods to Existing Python Classes

Adding an instance attribute dynamically is as simple as: obj.a = 1 or setattr(obj, 'a', 1) . So easy! However, when it comes to dynamically adding methods, the problem arises. Here, a method is dynamically added to an instance: >>> class A ( object ): ... pass ... >>> def hello ( self ): ... print 'hello' ... >>> a = A () >>> a . hello = hello WTF?: >>> a . hello () Traceback ( most recent call…

Application of Singleton Pattern in Python

Singleton Pattern Ensures that a class has only one instance, and provides a global access point to it. Let’s take a look at the Singleton pattern in tornado.IOLoop : class IOLoop ( object ): @staticmethod def instance (): '''Returns a global `IOLoop` instance. Most applications have a single, global `IOLoop` running on the main thread. Use this method to get this instance from another…

Application of Factory Method Pattern in Python

Every now and then, there are always a few days when I feel like messing things up. This time, I reformatted the whole hard drive and reinstalled the dual system. As a result, I couldn’t play League of Legends anymore with Win10 + A card… So I had to go back to Ubuntu. While wandering online, I came across this picture, which provided strong support for my truancy~ Then, a Blog based…