Proxy for accessing host Windows in WSL2

Since WSL2 is implemented as a virtual machine, the network is no longer shared with Windows like WSL1, but has become a new network segment, so it is more difficult to use the proxy of the host. Get the host IP in WSL WSL will have a different IP address every time it starts up, so you can’t set the proxy in a static way directly. WSL2 will write the

After reading the average code written by Microsoft engineers, I realized I was still too young

There’s a lot to be said for averaging unsigned integers by rounding? A recent article by Raymond Chen, a Microsoft engineer, has been a direct hit on the technology platform, sparking numerous discussions. Countless people clicked in with unbridled confidence: isn’t it just a simple elementary school programming problem of adding and dividing by two? 1 2 3 4 unsigned average(unsigned a, unsigned b) { return (a + b) /

The History of Version Control with Go: It Started with SVN and Ended with Git

Go development team technical leader Russ Cox (rsc) post describes the history of version control for Go. The reason is that every once in a while, someone always uses the following code to indicate that the first commit of Go was in 1972. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 % git log --reverse --stat commit 7d7c6a97f815e9279d08cfaea7d5efb5e90695a8 Author: Brian Kernighan <bwk> AuthorDate: Tue Jul 18 19:05:45 1972 -0500 Commit: Brian Kernighan <bwk> CommitDate: Tue Jul 18 19:05:45 1972 -0500 hello, world R=ken DELTA=7 (7 added, 0 deleted, 0 changed) src/pkg/debug/macho/testdata/hello.

Elastic: There's only one Elasticsearch, from Elastic

Elastic announced has settled a dispute with Amazon over trademark infringement of the term " Elasticsearc" trademark infringement lawsuit with Amazon. In accordance with the resolution, Amazon has begun removing the term Elasticsearch from various pages of its website and from the names of its services and related items. Now, the only Elasticsearch service available on AWS and AWS Marketplace is Elastic Cloud. In January 2021, Elastic announced change Elasticsearch and Kibana Open Source License Agreement; because they believe that customers are being misled by Amazon’s offering of Amazon Elasticsearch and that Amazon is abusing the open source license and profiting from the project.

DNS Introduction

We usually use domain names, such as taoshu.in, to access the Internet. But computers need to use IP addresses when they communicate. The core function of DNS is to save the mapping between domain names and IP addresses. Today, we will introduce how DNS works. In DNS, the core concept is the domain name. A domain name is a way of organizing information hierarchically, somewhat similar to a computer’s folders. Take a Windws system for example, the path where user Demo’s desktop is located is C:\Users\Demo\Desktop.

Some of my principles for designing system architecture

After working for more than 20 years, I have seen many companies’ system architecture and many problems in the past 20 years. When I communicate and discuss with these companies, including implementation and program comparison, there are a lot of comparisons and compromises of various programs. Today, I would like to write this article to summarize my personal experience and ideas in the hope that more people can refer to and learn from them, and be able to make a better architecture.

Go Programming Patterns - Pipeline

Flow line work models are common in industry, dividing the workflow into multiple segments, each with the right number of personnel depending on the intensity of the work. A good assembly line design tries to balance the flow rate of each step to maximize productivity. Go is a practical language, and the pipeline work model is very well integrated with Go. pipeline A pipeline consists of multiple links, specifically in Go, where the links communicate with each other via channels and the same link task can be processed by multiple goroutines at the same time.

Complete mastery of Go math/rand

Go Rand is a feature often used in development, but there are some pitfalls in it. This article will completely break down Go math/rand and make it easy for you to use Go Rand. First of all, a question: Do you think rand will panic ? Source Code Analysis The math/rand source code is actually quite simple, with just two important functions. 1 2 3 4 5 6 7 8

Google's new operating system, Chrome OS Flex, is born

Many people have an “old” computer at home, which may have been forgotten in a corner because of slow startup, outdated configuration, or incompatible software that you often use. Its next fate is either to remain in the corner or to be recycled. Google’s new Chrome OS Flex is a chance to rejuvenate these old devices. Chrome OS Flex is a new system from Google that differs from regular Chrome OS in that you can install it on devices that were originally based on Windows or macOS (not ARM chips), turning them into Chromebooks.

In-depth analysis of the Callable interface

1. Introduction to the Callable interface The Callable interface is a new generic interface added in JDK1.5 and declared as a functional interface in JDK1.8 as follows. 1 2 3 4 @FunctionalInterface public interface Callable<V> { V call() throws Exception; } In JDK 1.8, an interface with only one method declared is a functional interface. A functional interface can be modified with or without the @FunctionalInterface annotation. As long as an interface contains only one method, then the interface is a functional interface.

How to use higher-order function programming to improve the simplicity of your code

Functions are first-class citizens of Go language. This article adopts a high-order function approach to abstract the query conditions for querying DB using gorm, abstracting various complex combinations of queries for multiple tables into a unified method and a configuration class, improving the simplicity and elegance of the code, and at the same time can improve the efficiency of developers. Background There is a DB table, and the business needs

Windows 10 WSL2 Experience

1. Introduction to WSL Wikipedia. Windows Subsystem for Linux (English: Windows Subsystem for Linux, WSL for short) is a compatibility layer for being able to run Linux binary executables (ELF format) natively on Windows 10 and Windows Server 2019. This means that you can execute Linux programs on Windows with the help of WSL. For developers, this makes a lot of sense. High-level language development generally relies on a graphical

Go1.18 new feature: deprecate strings.Title method

Recently, while reading Go1.18 Release Notes, I found that the Title method of the strings, bytes standard library has been deprecated. Why is this? Introduction Here is an example of the strings standard library. The strings.Title method does the following: maps all Unicode letters at the beginning of a word to its Unicode title case. The example is as follows. 1 2 3 4 5 6 7 8 9 10 import ( "fmt" "strings" ) func main() { fmt.

My opinion about Lisp

Lisp is a computer programming language invented by John McCarthy in 1958. The name “Lisp” is an abbreviation for “List Processing”, which means table processing… The above is probably the accepted authoritative introduction, and a lot of information on the Internet probably says so. From this information, we can see that Lisp is a computer programming language similar to C and Java, and it is a different language from the

Opera becomes the first browser to support pure emoji URLs

Despite Opera’s diminishing presence in the market, there’s nothing stopping Opera from being the first to “eat the crab” in the industry. Recently they announced that they will bring emoji-only URL support to the browser’s address bar, giving a new twist to what is currently a slightly bland address bar. This new feature is a collaboration between Opera and Yat, a startup that sells emoji URLs, and through Yat users can make a one-time purchase and receive a unique domain name made up of emojis.

Thousands of npm accounts at risk of easy hijacking due to expired domain emails

Microsoft and North Carolina State University collaborated on an academic research project last year in which researchers found that thousands of JavaScript developers were using email addresses with expired domains as their npm accounts by analyzing the metadata of about 1.63 million libraries uploaded to Node Package Manager (npm), making it easy for their projects hosted on npm to be hijacked. The email addresses of all users on npm are allegedly publicly available.

Elegant use of #include

#include is not just for referencing header files. Proper use of #include can make the code more elegant. Usually we use #include to include header files, as follows. 1 #include <stdio.h> Understand that the purpose of #include is to copy the specified file to the reference as is during the pre-compilation phase. There is actually some logic that can be handled elegantly using #include. Referencing code blocks Suppose there is a C file that contains different blocks of code.

How to get the thread ID correctly?

How to get the correct thread ID, a seemingly simple question with a hidden catch. Since there are two thread models, user and kernel, there are two ways to get the thread ID. First of all, it is important to understand what POSIX is; a long time ago, when there was no Linux Kernel, Unix was the world of Unix, an open source system, and many developers did various customizations

Android 12 - WMS Hierarchy && DisplayAreaGroup Introduction

1. Introduction In Android window management, all windows are organized in a tree data structure, and knowing the tree of WMS helps us understand the management and display of windows. At the same time, the hierarchy of WMS also determines the hierarchy of SurfaceFlinger, which determines its display rules. 2. WMS top-level hierarchy construction In Android 12, all window tree management is based on WindowContainer, each WindowContainer has a parent

Android 12 - Letterbox mode

1. Introduction As more and more large and folding screen devices appear, many applications do not have UI adaptations for devices of different sizes, when the application chooses to display in a specific aspect ratio (although Google does not recommend this, the official hope that developers can adapt the layout of different screen sizes ~), when the application’s aspect ratio and its container ratio is not compatible, it will be