20230922 R&D review

1. Why is heartbeat detection needed in websocket? How to detect heartbeat?

Insert image description here
The unexpected disconnection of the front end does not trigger onclose, and the abnormal disconnection of the back end is not detected.

2.8 * 8 How to prove that you can go from point x to point y

Insert image description here

3. What other overloading are there besides virtual functions?

The so-called overloading is to give new meaning. Function Overloading allows a function name to have multiple functions and perform different operations under different circumstances. Operator Overloading is also the same. The same operator can have different functions.

In fact, we are already using operator overloading without even realizing it. For example, the + sign can perform addition operations on data of different types (int, float, etc.); << is both a displacement operator and can be used with cout to output data to the console. C++ itself already has overloading of these operators.

4. Are functions in py objects? Why is everything in py an object?

Function (function) in python
In python, functions are also objects
An object is an area in memory specially used to store data< /span>
The function can be used to save some executable code (all statements are stored)

A program is composed of methods and data. In Python, not only all data are objects, but even the functions and class definitions used to define methods are stored and processed as objects
Insert image description here
type and object
All objects inherit from object
All types are instances of type type

5. Let’s talk about the gil lock

For Cpython, a bug generally prevents multi-threads from concurrently executing machine code mutex locks
The ancient GIL mechanism, if thread 2 needs to be executed on CPU 2, it Need to wait for thread 1 executing on CPU 1 to release the GIL first (remember: GIL is global)
And io may be unfair
GIL does In this case, it will have an impact on the running efficiency of multi-threaded programs
The presence of GIL does not mean that python must be thread-safe
At any point in time, it can only There is a thread executing
The most popular approach is to use a multi-process approach, where multiple processes are used instead of threads. Each Python process has its own Python interpreter and memory space, so the GIL is not an issue
Python has multiple interpreter implementations. CPython, Jython, IronPython and PyPy are written in C, Java, C# and Python respectively. Only cpython has gil
noexcept nogil

6. The difference between relational database and document database

Insert image description here
A document database is a non-relational database designed to store and query data as JSON-like documents. Document databases make it easier for developers to store and query data in a database using the same document model format they use in their application code. The flexible, semi-structured, and hierarchical nature of documents and document databases allows them to change with the needs of the application. The document model works well with use cases such as directories, user profiles, and content management systems, where each document is unique and changes over time. Document database supports flexible indexing, powerful ad hoc queries, and analysis of document collections

7.Which parameter of tail can be used to view the latest command?

-f

8. Where to put it after importing?

Maybe it has something to do with /lib/site-packages

9. Map fog problem

Insert image description here
Our hero, enemy hero, terrain height

Guess you like

Origin blog.csdn.net/weixin_40986490/article/details/133174833