Long string

  To represent a long string (strings spanning multiple lines), use three single quotes or three double quotes. >>> print('''This is a long story. >>> print("""This is a long story. ... It continues here.      ... It continues here. ... And it not over yet. ... And it not over yet. ... Hello World''') ... Hello World""") This is a long story. This is a long story. It continues here.      It continues here. And it not over yet. ...

MySQL calculate the distance between two longitude and latitude, including specific SQL statements.

/*The incoming parameters are latitude latitude longitude ASC ascending order from near to far DESC descending order from far to near * / SELECT *, ROUND( 6378.138 * 2 * ASIN( SQRT( POW( SIN( ( 40.0497810000 * PI() / 180 - lat * PI() / 180 ) / 2 ), 2 ) + COS(40.0497810000 * PI() / 180) * COS(lat * PI() / 180) * POW( SIN( ( 116.3...

Implementation of a simple JavaScript throttle

Throttle javascriptThrottler is mainly used to delay the execution of certain actions, such as Ajax requests, if the input box registered the input event, then when the user input will continue to trigger this event, if the callback function continues to call the background interface through ajax, it will produce a certain serverPressure. Consider some way to defer Ajax requests, for example, by delaying 0.5s calls to the back-end interface when an input event is triggered, thus relieving the pressure on the server to some extent.Here is a simple throttle. 1 /** 2 * Throttle 3 * @param [f...

JVM

1. jvm Principle: Reference: https://baijiahao.baidu.com/s? Id=1606480770208000096& wfr=spider& for=pc Description: JVM tuning is mainly to optimize Heap heap and Method Area method area. Heap heap The heap is the largest area in the JVM. The object and data of the application are in this area. This area is also shared by threads. It is also the main recovery area of gc. A JVM instance has only one heap class memory. The size of the heap memory can be adjusted. The class loader reads the class file and needs to do so.To put classes, methods, and constants in the heap memory for easy ...

Two fork tree, tree, forest

Two fork tree: each node has at most two subtrees. Full two fork tree: the number of nodes in each layer is the largest node number. Complete binary tree: Leaf nodes are in the last two layers; for any node, the depth of the left subtree is 1 or equal to the depth of the right subtree Nature: Two fork tree: layer I, at most there are 2^ (i-1) nodes. Two fork tree: the depth of K two fork tree, at most there are (2^k) -1 nodes. Full two fork tree: the number of nodes in the full two fork tree with a depth of K is (2^k) -1 Binary tree: any binary tree, degree 0 of the number of nodes n0, degree...

Stacks and queues

First, stack  Stack top (top) stack bottom (bottom) After the advanced, from the top of the stack insert, remove from the top of the stack. Sequential stack: Stores elements from the bottom of the stack to the top of the stack at one time with a set of sequential storage units with top stack top pointers attached   Initialization: first allocate a space of the specified size and expand it by space after the space is insufficient.   base The bottom pointer of the stack always points to the bottom of the stack.   top The top pointer of the stack always points to the next position o...

Python entry three thirty days — network communication principle (Supplement)

    1、The essence of Internet is a series of network protocols. A hard-wired operating system, then loaded with software you can use normally, but you can only use it yourself. Like this, everyone has a machine of their own, but they are isolated from each other.   English has become the universal standard of communication for all people in the world. If you look at computers as people all over the world, the Internet that connects two computers actually means A series of unified standards, these standards are called Internet Protocol, the essence of the Internet is a series of protocol...