Snowflake algorithm (improved version) - Snowflake

Snowflake algorithm Snowflake is an open source distributed ID generation algorithm based on Twitter. It divides 64-bit bits into several parts in the way of namespace partition, each part represents different meanings. The 64 bit integer in Java is Long type, so the ID generated by SnowFlake algorithm in Java is long to store. Bit 1 occupies ...

Posted by riex1 on Wed, 31 Jul 2019 06:15:44 -0700

if judgment of process control

I. Grammar 1.1 if (single branch structure) ''' <Code Block 1> If <condition>: <Code Block 2> # Execute Code Block 2 and then Execute Code Block 3 when the condition is True, otherwise execute Code Block 3 directly without Executing Code Block 2. Code Block 3 > # Run Code Block 3 directly when conditions do not hold ' ...

Posted by vintox on Wed, 31 Jul 2019 05:50:29 -0700

ggbiplot - Best looking PCA mapping: sample PCA scatter + grouped ellipse + principal component abundance and correlation

Links to the original text: https://blog.csdn.net/woodcorpse/article/details/78863454 https://github.com/vqv/ggbiplot/blob/master/README.md A few days ago in the "Macro Genome 0" W ...

Posted by Instigate on Wed, 31 Jul 2019 04:50:08 -0700

ThreadPool Executor for Learning Concurrent Programming in java

ThreadPoolExecutor ThreadPoolExecutor is the parent of all thread pool implementations. Let's first look at the constructor Constructional parameters corePoolSize: Number of Thread Cores Maximum PoolSize: Maximum number of threads Keep AliveTime: When a thread is idle, it will only survive if the number of threads is greater than corePoolSize ...

Posted by FuzziNectar on Wed, 31 Jul 2019 02:45:03 -0700

SPDK Problem Investigation

phenomenon Running the SPDK program, the following error occurred: starting write I/O failed, push back, reback to previous status starting write I/O failed, push back, reback to previous status starting write I/O failed, push back, reback to previous status starting write I/O failed, push back, reback to previous status starting write I/O fa ...

Posted by quecoder on Wed, 31 Jul 2019 02:16:45 -0700

Analysis of Factory Model

Differences between simple factories, factory methods, Abstract factories, strategy patterns, strategies and factories Combined with simple examples and UML diagrams, the simple principle of factory pattern is explained.   I. Introduction Ten years ago, there was an explosive family who had three cars (Benz, Bmw, Audi) and hired drivers to ...

Posted by ReKoNiZe on Wed, 31 Jul 2019 00:24:53 -0700

[A Series of Articles] Learn about common collection classes (including source code) in java

List 1,ArrayList Key source code // Default initialization to an empty array public ArrayList() { this.elementData = DEFAULTCAPACITY_EMPTY_ELEMENTDATA; } // Adding elements public boolean add(E e) { // Add modCount to judge expansion ensureCapacityInternal(size + 1); // Increments modCount!! elementData[size++] = e; return ...

Posted by knetcozd on Wed, 31 Jul 2019 00:13:58 -0700

canvas Picture Trial

In these days, I will study canvas drawing again, and simply write a page, which is used to frame items. For the time being, I just want to draw quadrilateral. Just go directly to the code, the comments are written more complete already. <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title></tit ...

Posted by Soogn on Tue, 30 Jul 2019 22:06:08 -0700

Basic Java Learning: Controlling Execution Processes

I. if-else if(a > b){ System.out.println("a greater than b"); }else if(a == b){ System.out.println("a Be equal to b"); }else{ System.out.println("a less than b"); } II. while and do-while while while(a < 10){ System.out.println("I'm smaller than 10."); } do-while do{ System.out ...

Posted by wrongmove18 on Tue, 30 Jul 2019 21:44:43 -0700

Sword Finger offer Solution - JavaScript Edition

1. Finding in Two-Dimensional Array In a two-dimensional array, each row is sorted in increasing order from left to right, and each column is sorted in increasing order from top to bottom. Please complete a function, input such a two-dimensional array and an integer, to determine whether the array contains the integer. function Find(target, a ...

Posted by REDFOXES06 on Tue, 30 Jul 2019 21:17:58 -0700