.
1234567
Host weight1.1.1.111.1.1.221.1.1.31In the memory, the host list is:host_list=["1.1.1.1","1.1.1.2","1.1.1.2","1.1.1.3", ]
If you want to create a key-Value Pair (for example, k1 = "v1") in the memory, perform the following steps:
Convert k1 to a number based on the algorithm.
Calculate the remainder of the number and host list length to obtain a value of N (0
In the host list
1.1.1.111.1.1.221.1.1.31那么在内存中主机列表为:host_list=["1.1.1.1","1.1.1.2","1.1.1.2","1.1.1.3", ]
If the user is to create a key-value pair in memory (for example: K1 = "V1"), then perform the steps:
Convert K1 into a number based on the algorithm
Calculate number and host list length to remainder, get a value n (0
Gets the host in the host list according to the value obtained in 2nd step,
host in the list. Host weight 192.168.56.102 1 192.168.56.103 2 192.168.56.104 1 then in-memory host list is: host_ List = ["192.168.56.102", "192.168.56.103", "192.168.56.104", "192.168.56.105",]If the user is to create a key-value pair in memory (for example: K1 = "V1"), then perform the steps:
Convert K1 into a number based on the algorithm
Calculate number
function of the MM initialization good mm[0]=-1; for (int i=1; i; i++) mm[i]= ((i (-1)) = =0) mm[i-1]+1: mm[i-1];Then it is the function that asks for the maximum and minimum value, here, must be careful to write, it is easy to write wrong:intRMQ1 (intX1,intY1,intX2,inty2)//Max{ intk1=mm[x2-x1+1]; intk2=mm[y2-y1+1]; X2=x2-(11; Y2=y2-(11; returnMax ( Max (Dpmax[x1][y1][k1][k2],dpmax[x1][y2][k1
subsequent content operations.
// Display the call only when multiple sheets are used.
// By default, PHPExcel will automatically create the first sheet and set SheetIndex = 0
$ ObjExcel-> setActiveSheetIndex (0 );
$ ObjActSheet = $ objExcel-> getActiveSheet ();
// Online games
// Set the name of the current active sheet
$ ObjActSheet-> setTitle ('Online Games class ');
$ ObjActSheet-> setCellValue ('A1', 'Game name'); // The first row of data in the first sheet in the generated excel f
small 2, right subtree 4 node of the left subtree 3 node height is less than the right subtree 6 node, this situation becomes right and right.As can be seen from Figure 2, the 1 and 42 cases are symmetric, the two cases of rotation algorithm is consistent, only need to go through a single rotation to achieve the goal, we call it a one-spin. The 2 and 32 cases are also symmetrical, and the rotation algorithm of the two cases is consistent and requires two rotations, which we call double rotation
operation), is the abbreviation for the simple conditional statementWriting format: a= value 1 if condition else value 2 if the condition is true, assign value 1 to a condition not set to assign value 2 to aA= "Lu" if 1>2 else "Xiao" print (a) Xiao7, the depth of the copyString (str) is created once and cannot be modified. As soon as you modify, create a newList lists can record positions on and offNumeric and stringCopy (regardless of depth) address is the same as long as it is assignedOther d
1. Fromkeys () creates a dictionary from a sequence and specifies a uniform valueDIC = Dict.fromkeys (['a'b' 'C ' ' def ' )print(DIC)Output: {' A ': ' Def ', ' B ': ' Def ', ' C ': ' Def '}2. Get () Gets the value according to key, when key does not exist, can be specified to return the default valueDic1 = {'K1':'v1'}v1= Dic1.get ('K1') V11= Dic1.get ('K1','No')v
You can see the ID field at this time the increment is starting at 1000 and has grown to 1002select * from K1;+------+--------+| ID | name |+------+--------+| 1000 | Xiaoke || 1001 | Xiaoke || 1002 | Xiaoke |+------+--------+Take a look at this table statementShow create table K1;+-------+------------------------------------------------------------------------------------------------------ -----------------
AOF (appendoffile) Introduction:
Record each write in the form of a log, record all the write commands performed by Redis (read operation not recorded), only append files but not overwrite files, Redis startup early read the file to reconstruct the data, in other words, When Redis restarts, the write instruction is executed from front to back based on the contents of the log file to complete the recovery of the data.
That is to say, AOF will all the write operations in the form of a daily log
; } // Verify the ZIP code Function fun_zip ($ str) { Return (preg_match ("/^ [1-9] \ d {5} $/", $ str ))? True: false; } // Verify the url Function fun_url ($ str) { Return (preg_match ("/^ http: \ // [A-Za-z0-9] + \. [A-Za-z0-9] + [\/= \? % \-_~ '@ [\] \': +!] * ([^ } // The data warehouse receiving escape special character input value can be a string or a one-dimensional array Function data_join ( $ data) { If (get_magic_quotes_gpc () = false) { If (is_array ($ data )) { Foreach ($ data as $
memcached, first download the python-memcached module and execute pip install python-memcached in cmdMemcached is relatively simple, the default only supports simple kv storage, and the cache is written in memory, specifically do not introduceAfter the server opens the service, the simple operation1 #!/usr/bin/env python2 Importmemcache3 4 5MC = Memcache. Client (['172.16.5.7:11211'], debug=True)6Mc.add ('K1','v1')#Add a new kv7Mc.add ('
The AVL tree is a highly balanced two-fork tree, with a height difference of two subtrees of any node Implementing the AVL TreeDefines an AVL tree,avltree, that defines Avltree 's intra-node class Avlnode, The node contains the following attributes:1.key-- keywords to sort the nodes of the AVL Tree2.left--left dial hand tree3.right--Right sub-tree4.height--HeightIf you insert a node in the AVL tree, it may cause the AVL tree to lose its balance in four different states:LL: Zo,leftleftLR: Around,
precedence over RBD file load.8.Redis of transactions1) APIOpen things MultiCancel transaction: DiscardThe monitoring is canceled regardless of failure or success after submitting the thing EXEC//commitMonitoring: WatchUn-monitoring: unwatch//Cancel all monitoring2) RollbackAfter you open the transaction before the exec error, then all rollback, if the error after the exec, then the error-prone statement continues execution, does not rollback127.0.0.1:6379> multiok127.0.0.1:6379> set
, according to the requirements of each functionTu = (' Alex ', ' Eric ', ' Rain ')a. 计算元组长度并输出tu = (‘alex‘, ‘eric‘, ‘rain‘)print(len(tu))b. 获取元组的第 2 个元素,并输出tu = (‘alex‘, ‘eric‘, ‘rain‘)print(tu[1])c. 获取元组的第 1--‐2 个元素,并输出tu = (‘alex‘,‘eric‘,‘rain‘)print(tu[0:2])d. 请使用 for 输出元组的元素tu = (‘alex‘,‘eric‘,‘rain‘)for i in tu : print(i)e. 请使用 for、len、range 输出元组的索引tu = (‘alex‘,‘eric‘,‘rain‘)for i in range(len(tu)) : print(i)f. 请使用 enumrate 输出元祖元素和序号(序号从 10 开始)tu = (‘alex‘, ‘eric‘,
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.