Simple implementation of long polling based on HTTP
The common communication mode between Web client and server based on Ajax (http) is divided into short connection and long polling.
Short connection: every time the client and the server perform HTTP operation, they establish a connection, and the connection will be interrupted when the task ends.
In the long polling mechanism, the client reque ...
Posted by rubenc on Mon, 30 Dec 2019 21:47:05 -0800
CodeForce - 1014E - Tree Reconstruction greedy
Title Link
Meaning: a tree has n nodes. Now there are n-1 states. The ith state means to delete the ith edge. Each state has two numbers a and b. Represents the largest node of two trees formed after deleting the i-th edge. To find out whether there is such a tree for known n-1 States, if there is such a tree, the edges will b ...
Posted by bonkaz on Mon, 30 Dec 2019 11:45:03 -0800
Lead sets
meaning of the title
Title Link
Give a tree, delete some edges, so that the distance between any point in any connected block is less than $k$
sol
The greedy thought in the examination room is right: consider a subtree. If the distance between the deepest two nodes in the subtree is added $> k $, the deepest point will be deleted. When u ...
Posted by binarynomad on Mon, 30 Dec 2019 11:33:36 -0800
Selectors and filters in jquery learning
Basic selector
Universal selector * all
id selector
Class selector.class
Label selector label name
Group selector one,.two union
The intersection of compound selector div and one
Descendant or descendant selector
Offspring selector > Direct child
Descendant selectors spaces all descendants
All ...
Posted by kc5tvd on Mon, 30 Dec 2019 08:46:14 -0800
Be elegant!Load large and long pictures like this in Android
When developing, we will inevitably encounter the situation of loading pictures. When the size of pictures is smaller than the size of ImageView, we can certainly happy to load the display directly.
But if we load a picture that is much larger than the size of the ImageView, displaying it directly with the ImageView will have a bad visual effe ...
Posted by elgordo1960 on Sat, 28 Dec 2019 15:16:15 -0800
Password encryption of Python hashlib
In the hashlib.md5(data) function, the type of the data parameter should be bytes.
Data must be converted to bytes before hash data must be converted to bytes before hashfrom hashlib import md5
c = md5("helloworld")
# TypeError: Unicode-objects must be encoded before hashing
c = md5("helloworld".encode("utf-8"))
Function de ...
Posted by djopie on Sat, 28 Dec 2019 09:27:06 -0800
Android drawing separator / separator in layout?
I want to draw a line in the middle of the layout and use it as a separator for other items such as TextView. Is there a good widget. I really don't want to use images because it's hard to match other components to it. I hope it can also be relatively positioned. Thank you
#1 building
I usually use this code to add horizontal lines:
&l ...
Posted by dzm on Sat, 28 Dec 2019 09:22:34 -0800
APP and applet jump to each other
App and applet jump to each other: 1. App initiatively initiates the applet card to share with wechat, wechat clicks to open the applet, and then the applet can open App 2. App initiatively initiates to open the applet. Now the applet can open app mainly in these two ways. It seems inappropriate to jump to each other. After all ...
Posted by homer.favenir on Sat, 28 Dec 2019 07:29:05 -0800
Go Base Slices
Section
Slice is a variable-length sequence of elements of the same type.It is a layer of encapsulation based on the type of array.Support automatic expansion
Slice is a reference type
The internal structure of the slice contains address, length, and capacity
var name []T
func main() {
var a []string // Declare a String Slice
...
Posted by le007 on Fri, 27 Dec 2019 21:41:16 -0800
Solution of page switching language (prefer small station, static page)
First of all, in the html structure, add the class name to all the structures that need to be converted, preferably to the nearest parent containing the text, because we need to use the text node to replace them.
Then construct data similar to json to facilitate replacement operation. You can also declare a variable flag to re ...
Posted by ccjob2 on Fri, 27 Dec 2019 10:53:51 -0800