How to Add Babel Polyfill

Since @babel/polyfill is no longer recommended after Babel 7.4, both @babel/preset-env and plugin-transform-runtime can set corejs to handle polyfill. The main reasons for the deprecation of @babel/polyfill are. This package simply introduces stable core-js and regenerator-runtime/runtime, where the latter can be replaced using the plugin @babel/plugin-transform-regenerator. This package does not smoothly transition from core-js@2 to core-js@3. Introduction to Babel In short, Babel is a compiler that converts code written in

Go Module using gitlab private repository

Package management is a feature that Go has been criticized for doing poorly. Before 1.11, go get lacked support for package versioning and reproducible builds. At the time, many useful tools were born in the Go community, such as glide, dep, etc. After 1.11, Go introduced the Go Module, and there was no longer a GOPATH restriction, so you could write projects in any path you wanted, but support for private repositories was not very good at that time.

Go Simple and powerful reverse proxy

In this article, we will learn about reverse proxies, its application scenarios and how to implement it in Golang. Reverse proxies are servers that sit in front of a web server and forward requests from clients (such as web browsers) to the web server. They allow you to control the requests from the client and the responses from the server, and then we can use this feature to increase caching,

Azure Database for PostgreSQL Learning Summary

Azure Database for PostgreSQL is an on-cloud database service provided by Azure based on the open source PostgreSQL database. It is a fully managed database service with predictable performance, security, high availability, and dynamic scalability to handle mission-critical workloads. Azure Database for PostgreSQL offers. Built-in high availability. Automatic backups and point-in-time restores (backup data is retained for up to 35 days). Automated maintenance of the underlying hardware, operating system, and

Resolving PostgreSQL service startup failure on macOS

The PostgreSQL service installed with brew, which was upgraded at some point, failed at startup, and no error was reported the first time. When I use the database connection tool to connect, I get an error that I cannot connect. When I use services info to check the service information, I also find that there is no Running. 1 2 3 4 5 $ brew services info postgresql postgresql (homebrew.

Understand the OIDC protocol and authentication mechanism

When there are more and more Internet applications, each application implements its own identity storage, authentication and authorization, users need to register and login repeatedly on the application, which is a bad experience, and user identity information cannot be shared and synchronized among multiple applications. When using enterprise applications, companies provide a series of applications and have to switch between registration and login despite being operated by the same user.

Spring official announcement of the network of large vulnerabilities, with solutions

On the evening of March 31, the Spring community released an article called “Spring Framework RCE, Early Announcement”, which officially announced the recent Spring vulnerability. It confirms that the rumored vulnerabilities do exist and are not the CVEs announced on March 28th and 29th as many recent articles say, so if you are solving the problem according to those articles, please start over with this official announcement. The identified RCE vulnerability in the Spring Core Framework is CVE number CVE-2022-22965.

PostgreSQL Foreign Data Wrappers Usage Explained

PostgreSQL Foreign Data Wrappers (hereinafter referred to as FDW) is a very useful feature in real database usage scenarios. PostgreSQL’s FDW is similar to Oracle’s dblink and DB2’s Federation, which allows you to establish connections between local and external databases so that you can manipulate external data as if it were local data. FDW What’s the point Data sharding uses FDW to distribute data across multiple databases to achieve data

PostgreSQL Tablespace Usage Explained

PostgreSQL’s tablespaces allow defining where database objects are stored in the file system. In effect, a directory is specified for the storage of data files for database objects such as tables, sequences and indexes. PostgreSQL uses the operating system’s filesystem for storage. This is a bit different from Oracle, which implements its own “file system”. In PostgreSQL, one tablespace can be used by multiple databases; and one database can use multiple tablespaces, in a “many-to-many” relationship.

Spring framework has a high-risk RCE 0day vulnerability? Core developers clarify

Recently, the most popular open source lightweight Java framework Spring was exposed to a high-risk RCE (Remote Control Equipment) zero-day vulnerability , Peking University Computing Center, praetorian, bleepingcomputer and other sites have reported on the vulnerability. According to a wildly popular online introduction, the RCE vulnerability stems from the SerializationUtils#dserialize method at the core of the Spring framework, which is based on Java’s serialization and deserialization mechanism and can lead to Remote Code Execution (RCE), which can potentially affect anyone using JDK9 and above.

Resolving the Elasticsearch index read-only 403 issue

The stack information of the Java exception log is as follows: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 2022-03-30 18:17:02.750 ERROR 22991 --- [task-6] .a.i.SimpleAsyncUncaughtExceptionHandler : Unexpected exception occurred invoking async method: public void com.proinnova.system.log.service.impl.LogServiceImpl.addLog(com.proinnova.system.log.po.SysLogInfo,java.lang.Exception) org.elasticsearch.ElasticsearchStatusException: Elasticsearch exception [type=cluster_block_exception, reason=index [os_exception_log] blocked by: [FORBIDDEN/12/index read-only / allow delete (api)];] at org.elasticsearch.rest.BytesRestResponse.errorFromXContent(BytesRestResponse.java:177) ~[elasticsearch-6.8.13.jar!/:6.8.13] at org.elasticsearch.client.RestHighLevelClient.parseEntity(RestHighLevelClient.java:2061) ~[elasticsearch-rest-high-level-client-6.8.13.jar!/:6.8.13] at

React 18 officially released with out-of-the-box improvements including automatic batching, new APIs, and more

On March 29, React 18 was officially released, and this version includes a number of out-of-the-box improvements such as automatic batching, new APIs such as startTransition, and streaming server-side rendering with Suspense support. Many of the features in React 18 are described as being built on the new concurrent renderer. This is a behind-the-scenes change that unlocks powerful new features. Concurrent React is optional - it is only enabled when users use the concurrency feature - but the development team believes it will have a significant impact on the way the public builds applications.

Consistent Hash Principle and GroupCache Source Code Analysis

Consistent Hash is often used to alleviate the problem of large cache failures caused by scaling up and down nodes in distributed caching systems. Consistent Hash is more of a load balancing strategy than a Hash algorithm. GroupCache is an official golang distributed cache library that includes a simple implementation of Consistent Hash. The code is available at github.com/golang/groupcache/consistenthash. This article will provide insight into the principles of Consistency Hash

Gracefully shutdown the service

“Graceful termination” means that when a service needs to be taken offline or restarted, there are measures and methods to let other services perceive the current service being taken offline as soon as possible on the one hand, and minimize the impact on the current processing requests on the other. Elegant termination can improve the high availability of services, reduce the service jitter caused by going offline, and improve service

Design and implementation of a Gin caching middleware

When we develop HTTP Server, we often have the need to cache the interface content. For example, for some hot content, we want to cache it within 1 minute. Caching the same content in the short term will not have a material impact on the business and will also reduce the overall load on the system. Sometimes we need to put the caching logic inside the Server, rather than on the gateway side such as Nginx, because we can easily clear the cache as needed, or we can use other storage media such as Redis as the caching backend.

Two ways to migrate the default installation (storage) directory for Docker

A while ago, I bought a data cloud disk for my cloud server to be mounted on, as the main storage of those data that occupy large disks in the future, so I thought of migrating some software data directories that were previously installed in the root directory / under the system to the new data disk mount directory, the first migration is Docker, my server system release version is

Understanding how the Go standard library http package handles keep-alive connections by example

HTTP is the basic protocol of the Internet today, carrying the majority of the application layer traffic on the Internet, and from the current trend, in the next 10 years, http will remain the main protocol for Internet applications. Based on the Go standard library we can easily set up an http server to handle client-side http requests, or create an http client to send http requests to the server.

Open Source Distributed Query Engine - Presto

What is Presto? Presto is Facebook’s open source MPP (Massive Parallel Processing) SQL engine, which derives its idea from a parallel database called Volcano, which proposes a model for parallel execution of SQL that is designed to be used exclusively for high-speed, real-time data analysis. Presto is a SQL computation engine, separating the computation and storage layers, which does not store data and enables access to various data sources (Storage) through the Connector SPI.

Jdk9 may have a more serious vulnerability than log4j

Former Alibaba senior researcher Yun Shu. On the microblogging site said “There’s a super big vulnerability and we’re ready to EXP”. According to the discussion below this microblog, this may be a JDK9, spring-related vulnerability. Yunshu said this vulnerability is more serious than the last log4j. After the lg4j vulnerability swept the world, the Java community will usher in the darkest hour?

Uploading and downloading files using multipart/form-data

1. Introduction to Form Form, is an important syntax element in HTML markup language. A Form contains not only normal text content, markup, etc., but also special elements called controls. The user usually “completes” the form by modifying the controls (e.g., entering text, selecting menu items, etc.), and then submits the form data to the Web server as an HTTP Get or Post request. Many beginners always confuse HTML and