Type definition is a necessary but tedious process in developing with TypeScript.
When a third-party library method needs to be defined separately, and the library does not export the method’s input type, you need to get the method’s input type.
For example, there is the following example function, we want to get its parameter type and return value type, so how should we implement it.
Example function.
1 2 3 4 5 6 function test(lzwme: string, idx: number) { return { lzwme, idx, }; } Get the parameter type of the function Use the predefined Parameters to get a list of parameter types for a function.
NodeJs-based encrypted transport for message exchange combining RSA and AES encryption algorithms
Sensitive message exchange has relatively strong requirements for correctness and security. Using a message digest algorithm to calculate and verify the digest of the message body prevents the message from being tampered with during transmission as an illegal message value; using an encryption algorithm to encrypt the message body prevents the message from being intercepted and read during transmission. The combination of the two can achieve a strong secure message
Migrate From Oh My Zsh to Prezto
Why switch? At the beginning of the contact oh-my-zsh is honestly just because of its very beautiful theme, such as powerlevel10k theme; this is really very “Sexy” for a person who is always on the terminal to exercise the left and right hand. Later, with the gradual in-depth use, oh-my-zsh deeply integrated with this integrated plug-in solution and so on did bring great convenience; for example, simple command line search,
Ways to send STMP-based emails with MS Exchange using node.js
This article describes how node.js can send emails based on the STMP protocol and the MS Exchange Web Service (EWS) protocol. All reference code in this article is coded in TypeScript examples. STMP protocol-based approach to sending emails with node.js When it comes to sending emails using node.js, the famous Nodemailer module is basically mentioned as the first choice for sending emails using the STMP method. There are many articles
Electron self-compiled application crash debugging analysis method
Application crashes in Electron If the exception is only caused by Javascript, you can listen for the relevant Error type event in the application logic and handle it. By listening for crashed related events, you can listen for and respond to application crashes within the application. 1 2 3 4 app.on('gpu-process-crashed', (_event, killed) => {}); app.on('renderer-process-crashed', (_e, _w, killed) => {}); mainWindow.webContents.on('plugin-crashed', (_ev, name, version) => {}); mainWindow.webContents.on('crashed', (ev, killed)
webpack build results remove use strict mode
There are special requirements that require the use of syntax that is prohibited in strict mode and results in an error, so avoid building the result with use strict.
Compile the build without adding use strict babel-loader set strictMode=false babel-loader handles module transformations via @babel/helper-module-transforms, which provides a configuration parameter strictMode to specify whether to compile to strict mode, which defaults to true, i.e. use strict is added by default. This is shown in the figure below.
System information gathering and performance monitoring in Electron applications
When analyzing problems with Electron applications, relevant system operation information is sometimes essential, so naturally there is a need for system base information collection and operation performance monitoring. The native capabilities in Electron are based on Node.js, so most of the system data collection for Electron applications is based on the capabilities provided by Node.js. In Node.js applications, various system-related information can be obtained mainly through the process and os
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.