Get React component examples based on DOM nodes in React 17

In React, the ReactDOM.findDomNode method is used to get the DOM elements returned by the render method of a component instance. But what if, on the other hand, you want to get the component instance based on the DOM elements? I’m sure anyone familiar with React has seen the following code 1 2 3 4 5 6 7 8 9 /** 根据 DOM 节点查找其所

Project upgrade to webpack5 Practices and Summary

This is a year-long summary of webpack5 upgrade practice. I started this project in April 2020 when webpack5 was in beta phase, and then I made a few more attempts, all of which were stuck in different branches due to compatibility between self-published and third-party plugins. 2020-04 : webpack5@5.0.0-beta.15+ 2020-07 : webpack5@5.0.0-beta.21+ 2020-10 : webpack5@5.0.0 Release 2021-01 to 04 : WEB New project, webpack5, React17… 2021-07 : webpack@5.4x The following

Browser Gzip Compression

The zilb library and file compression in Node.js Three compression algorithms supported by zlib: gzip, deflate, and brotli. Basic usage examples. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 import zlib from 'zlib'; function zip(str, encoding = 'gzip') { str = typeof str === 'string' ?

Analysis and handling of document.addEventListener exceptions after upgrading React16 to React17

Compared to React 16, the new features of React17 are featureless, so the upgrade from 16 to 17 is relatively smooth. One disruptive change, however, is the change in the event system. In React 17, React will no longer attach event handlers at the document level. Instead, it will attach them to the root DOM container into which your React tree is rendered. Exceptions are thrown wherever document.addEventListener is used

Git Multiple Ssh Keys

When there are multiple git accounts, such as a github, used for some of your own development activities, and then a gitlab, generally the company’s internal git. these two your email address if different, there will be a problem involved, the generation of the second git key will overwrite the first key, resulting in the inevitable one can not be used. Solution We can configure the problem by creating a

Navicat Premium Database Account Password Decryption

If you want to crack the password of an already connected database, you can refer to this method. First of all, check the properties of the database that is already connected like this But the password is ****** who can not read, the blogger also downloaded from the site to use some broken password crackers and other things, all to no avail. The next step is to try to export these connection properties, select the file —->Export Connection, check the database you want to export, export the .

MySQL Paging Sorting with Data Duplication Problem (MySQL Priority Queue)

MySQL Version: 5.7.18 Problem Assuming that the field category is not indexed and has duplicate values, the combination of order by category and limit will not work as expected. Scene Reproduction Table structure (reproduce the problem, two fields are enough ~) 1 Table structure (reproduce the problem, two fields are enough ~) Sort all data by the category field: select * from ratings order by category ; id category 1 1 5 1 10 1 3 2 4 2 6 2 9 2 2 3 7 3 8 3 When we want to paginate the first 5 items use select * from ratings order by category limit 5 ;

python-gitlab CLI Usage Notes

It took us about two weeks to migrate our GitHub code to Gitlab, and the biggest impact was on our product release pipeline, which needed to be adapted to Gitlab and some services on our intranet environment. Basically, we had to rewrite the entire product release pipeline, and it was exhausting 🥺. At the time, I thought migrating the code to Gitlab was purely backwards 😅, but after

Microsoft confirms Windows 11 will not support most virtual machines

Microsoft confirmed that TPM 2.0 support is now required to run Windows on a virtual machine, which means that users can no longer install Windows 11 on an older, spare PC or laptop. In the Windows 11 Insider Preview Build 22000.194 changelog, Microsoft clarified the requirements for running Windows 11 on a virtual machine, stating that the system requirements for Windows 11 on a virtual machine (VM) will be the same as a physical PC, and that VMs previously created to run the Insider Preview version will not be updated to the latest preview version.

How to use the registry storage features

I am currently responsible for the packaging and release of the company’s PaaS toB product. One of my daily tasks is to run the automated packaging pipeline, and then update the installation packages to the QA test environment. Since the packaging and testing environments are located in two different server rooms, the product installation packages need to be synchronized across the public network from the packaging machine to the QA

Sorting using the standard library std::sort function

The sort method of std accepts two iterators, begin and end, and abstracts access to the elements through the iterators, hiding the internal implementation. This is a simple example: 1 2 3 4 5 6 7 8 9 std::list<int> list { 0, 4, 2, 1, 3, }; std::sort(list.begin(), list.end()); The result is that the list is sorted, and we don’t need to care about what sorting algorithm is used. In fact, the standard library decides what algorithm to use by the number of elements, based on Introspective Sorting.

Debugging deepin in a VMware virtual machine via serial port in ArchLinux

Interface on the computer motherboard: Interface for serial transmission, it can only transmit 1Bit at a time. the serial port can be used to connect an external modem, a plotter or a serial printer. It can also be connected to network devices such as routers and switches by means of a console connection and is mainly used to configure them. Consumer electronics have been replaced by USB for serial interfaces; however, in non-consumer uses, such as networking devices, serial interfaces are still the primary method of transmission control.

Critical RCE vulnerability found in Microsoft's Azure Linux

Security firm Wiz has discovered a critical RCE vulnerability in Microsoft Azure’s Linux virtual machines that could be exploited by hackers to easily gain root privileges. These vulnerabilities are known as “OMIGOD” and include CVE-2021-38647, CVE-2021-38648, CVE-2021-38645 and CVE-2021-38649. The root cause of the problem is a software agent known as Open Management Infrastructure (OMI), which allows users to collect statistics and synchronize configurations across the environment and is embedded in many popular Azure services, including but not limited to.

Some thoughts on complexity

Someone recommended this article before, Complexity has to live somewhere, the general idea is that the complexity of the system can’t just disappear, it can only be transferred from one place to another, because there is so much logic in the real world, there are so many cases around the corner that you have to deal with, which will inevitably introduce complexity into the system. Although these complexities you can transfer to your colleagues or outsource to third-party systems, the complexity is indefinite.

Pitfalls encountered in vue3 upgrade

I’ve been busy with work recently, and I’ve fallen behind on improving my own capabilities, so I took the opportunity today to solve some of the problems I was thinking about before, and I also gave my VueBlog a chance to upgrade both vue and webpack to the latest beta version, and then I encountered a lot of pitfalls, so I’ll put them all on record today so I don’t forget them later.

The Pitfalls of Cpp Projects

This article records some of the problems and optimization methods of C++ in these years’ projects. It is important to note that there is no one-size-fits-all method for code optimization, and you can only see what you can do, and you have to avoid problems such as premature optimization, code optimization must be done in the middle and late stages, and don’t optimize for the sake of optimization. const and

Analyze program performance using the perf tool

Recently, I’ve been optimizing the performance of DDE, so I’ve been catching up on the use of various analysis tools under linux. This diagram is an application scenario of linux analysis tools from Brendan Gregg, and you can see that it includes almost every part of the system that should be analyzed with the tools. Linux Perf Tool Allows the system to perform analysis In order to be able to analyze it properly, we first need to turn on the debugging features of the system, allowing us to access other processes.

Qt Multithreading

There are three ways to register Qt types for multithreading, namely inheriting QThread, using QObject’s moveToThread function and Qtconcurrent concurrent threads. In many articles, it is recommended to inherit from the QThread class and override the run method to use time-consuming manipulation code in run. This approach makes us think that QThread is the entity of the thread. Creating a QThread object is thought of as opening a new thread.

How to make a package for Arch

Arch uses the pacman package manager and the package format is tar.zst. Arch provides a number of tools for creating tar.zst packages, first you need to install the base-devel package and the devtools package. 1 pacman -S base-devel devtools Arch’s packaging process works like this, starting with writing a PKGBUILD file that describes all the information needed to build a package, such as where to download the source code from, what the dependencies are, what the build version is, how to build, etc.

Deploying a kubernetes cluster with Kubespray native development tests

The company’s PaaS platform uses the open source kubespray for the underlying kubernetes cluster deployment, and I was involved in the kubespray second-opening work. During this period, I mainly completed kubespray automated packaging and release pipeline, private deployment, added self-research CNI deployment, and some bugfixes. I recently took time to organize and summarize some of the pitfalls of using kubespray to deploy kubernetes clusters for local development and testing. Prepare