Origin of Ray

Lift the fog of the Internet together

Today, let’s talk about a simple but very clever algorithm problem: calculate a subarray with several sums of k.

Then I will exhaust all the sub-arrays, calculate their sum, and see whose sum is equal to k.

The key is, ** how to quickly get the sum of a subarray **, for example, give you an array’nums’, let you implement an interface’sum (i, j) ‘, this interface to return’nums [i… j]’ and will be called multiple times, how do you implement this interface?

Since the interface needs to be called multiple times, it is obviously impossible to traverse’nums [i… j] ‘every time. Is there a fast way to calculate’nums [i… j]’ in O (1) time? This requires ** prefixes and ** tricks.

Read more »

What is SQL Injection?

Principle

The principle of SQL injection is an attack method that disguises SQL code into input parameters, passes it to the server for parsing and execution. That is to say, implanting some SQL code in some request parameters initiated by the server side, and the server side will splice the corresponding parameters when performing SQL operations, and also splice the "sql" of some SQL injection attacks, resulting in some unexpected operations.
Read more »

Origin: HTTPS enabled is not secure enough either

There are a number of websites that are only served externally via HTTPS, but when users visit a website, they often type the website domain name (e.g. Example Domain) directly into their browser instead of the The full URL (e.g., Example Domain), but the browser can still make the request correctly using HTTPS. This is possible thanks to the collaboration between the server and the browser, as shown in the figure below.

https://res.cloudinary.com/dvtfhjxi4/image/upload/v1608034077/origin-of-ray/微信截图_20201215200744_st7ygu.png

Figure 1: The server and browser do a lot of work for the user behind the scenes

In simple terms, the browser makes an HTTP request to the website, and after getting a redirect response, initiates an HTTPS request and gets the final response content. All of this is completely transparent to the user, so it is a nice user experience for the user to enter the domain name directly into the browser and still be able to communicate securely with the website using the HTTPS protocol.

Everything looks so perfect, but it is not. Since there is an explicit HTTP request and redirect (steps 1 and 2 in the above diagram) before an HTTPS connection is established, it allows an attacker to hijack this request in a man-in-the-middle manner to carry out subsequent attacks, such as eavesdropping on data, tampering with requests and responses, jumping to phishing sites, etc.

Read more »

This week, I checked some articles about vue global exception handling, and I have made some modifications according to my own needs. I will record it here.

Read more »

First, the topic of the previous leetcode: https://leetcode-cn.com/problems/satisfiability-of-equality-equations/

After we see this problem, it is very easy to think about it is to first find a data structure to save all equal relations, and then judge whether the two sides of the inequality exist in the structure at the same time.

The first step in this process is the union set, put the relevant data in a set, the second step is to find, find whether the correlation is established in this set, this search process can be optimized, that is, the union Set search path compression. Recommend this blog: https://blog.csdn.net/liujian20150808/article/details/50848646

Read more »

This article talks about the development process of asynchronous programming syntax, and how asynchronous method invocation gradually becomes synchronous syntax.

There are probably asynchronous programming methods下面四种

ECMAScript 6 (abbreviated as ES6), as the next generation JavaScript language, brings JavaScript asynchronous programming to a new stage. ** The topic of this series of articles is to introduce more powerful and complete ES6 asynchronous programming methods. **

The new method is more abstract, at first, I often feel puzzled, until a long time later to figure out, ** The syntax goal of asynchronous programming is how to make it more like synchronous programming. **

This article is about the relationship between these grammars. If you need a deep understanding of any grammar during reading, you can take a look.阮一峰老师的ES6语法入门

Read more »

The two major features of’nodejs’, namely’asynchronous IO ‘and’event-driven’. Through the *** “easy to understand nodejs”\ *** and several blog reading, have a general understanding, summarize.

** Note that the content of this article is based on node11 above. **

Synchronous and asynchronous, blocking and non-blocking

“Blocking” and “non-blocking” and “synchronous” and “asynchronous” cannot be simply taken literally, providing an answer from a distributed system perspective.
** 1. Synchronous and Asynchronous **
Synchronous and asynchronous focus on ** message communication mechanism ** (synchronous communication/asynchronous communication)
The so-called synchronization is that when a * call * is issued, the * call * does not return until the result is obtained. But once the call returns, the return value is obtained.
In other words, the * caller * actively waits for the result of this * call *.

Asynchronous is the opposite. After the *** call\ * is issued, the call returns directly, so no result is returned **. In other words, when an asynchronous procedure call is issued, the caller does not get the result immediately. Instead, after the * call * is issued, the * callee * informs the caller through status, notification, or handling the call through a callback function.

Read more »

The Chrome extensions are an important reason why many people choose Chrome, and after years of development, Chrome has a wide variety of extensions.

Read more »

Browser resource loading process

Let’s start with two questions:

  • How does the browser know which resources should be loaded?
  • In what order does the browser load these resources?

When the browser intercepts a page, it will do the following four things in order

  1. First, all the resources that need to be loaded will be classified.
  2. Then decide the loading permission of the resource according to the security policy related to the browser.
  3. Then calculate and sort the loading priority of each resource.
  4. The last step is to load resources according to the loading priority order.
Read more »
0%