Python – Closures and Decorators

I. Closure 1. Definition of closure Closures are a special mechanism in programming languages, belonging to higher-order functions. Specifically, theyoccur when: 1. functions are nested (a function is defined inside another function);2. the inner function uses variables (or parameters) of the outer function; and3. the outer function returns a value from the inner function. 2. … Read more

MySQL performance optimization

Table design optimization SQL optimization system→ const→ eq_ref→ ref→ range→ index→ ALL. The goal of SQL performance optimization should at least reach rangelevel 1, and ideally it ref should be level consts 2. The main optimization method is indexes , which will be discussed in detail in the “Index Optimization” section later. question Disadvantages of Large SQL Advantages of splitting into smaller SQL statements Lock contention … Read more

Vue DevTools – Development Debugger

Vue DevTools is a browser extension tool specifically developed for Vue.js, used for debugging and optimizing Vue applications. The following is an installation and usage guide: 1. Install Vue DevTools 1. Browser support Chrome (Recommended): Install via the Chrome Web Store. Firefox : Install via the Firefox Add-ons Marketplace. Edge : Compatible with Chrome, the Chrome version can … Read more

Data Structure: Tree

Definition A tree is a non-linear data structure consisting of a finite set of n (n≥0) nodes: Key terms the term definition Root node The topmost node of a tree, with no parent node (like the “root directory” of a file system). Parent node/child node If node A directly contains node B, then A is the parent … Read more

Nacos: Services and Configuration in the Cloud-Native Era

Introduction: The Challenges of Microservice Architecture and the Birth of Nacos Driven by cloud computing and containerization technologies, microservice architecture has become the mainstream paradigm for modern application development. However, with the exponential growth in the number of services, traditional service governance models face three core challenges: inefficient service discovery mechanisms, lack of a unified … Read more

Preliminary understanding of STL and string

What is STL? STL (Standard Template Library): It is an important part of the C++ standard library. It is not only a reusable component library, but also a software framework that encompasses data structures and algorithms. STL version updates The original version, completed by Alexander Stepanov and Meng Lee at HP Labs, adhered to the … Read more

Kafka producers

When sending messages using Spring Boot and Kafka, we only need to inject the corresponding type of KafkaTemplate and call the send method, which is very simple. The simplicity of operation actually implies a lot of internal details are encapsulated. This article is used to analyze the Kafka producer in detail. Message partitioning algorithm In … Read more

Slow queries in MySQL (slow log)

1. What is a slow query? The slow query log is a log of queries that take a significant amount of time to execute. It records all long_query_timeSQL statements that exceed a time threshold set by parameters, helping developers analyze and optimize database query performance. By default, 慢查询日志the slow query log is disabled; it must be enabled … Read more

MySQL-TRIGGER

1. What is a trigger? 2. Advantages and disadvantages of triggers The advantages of triggers are as follows: The disadvantages of triggers are as follows: 3. Types of triggers NEW and OLD type triggers: NEW indicates data that will be added or has already been added; OLD type triggers indicate data before modification, NEW indicates … Read more

Delayed loading and L2 caching in mybatis

I. Lazy Loading 1. Core Definition Lazy loading is MyBatis’s optimization mechanism for related queries : when querying the main object, its related objects (such as the one-to-many relationship between users and accounts) are not queried immediately. The SQL execution of the related query is only triggered when the related object is actually used (getter method is called). 2. Core … Read more