(juc Series) synchronization queue

The source code of this article is based on JDK13SynchronousQueueOfficial annotation translationFor the implementation of a blocking queue, its insertion operation must wait for the corresponding removal operation. Vice versaA synchronization queue has no internal capacity limitThe peek() operation cannot be performed, so the element exists onl ...

Posted by phu on Wed, 10 Nov 2021 20:18:10 -0800

2021 Niuke winter vacation algorithm basic training camp 1D parallel search set inverse element combinatorial mathematics two-dimensional grid to one-dimensional precautions

subject Problem solving ideas Firstly, the idea of two-dimensional to one-dimensional is discussed. Convert each point to abscissa multiplied by N + ordinate. It seems that it can be realized, but this problem needs four points, so 3 and 4 are implicitly connected. So it will be Wa. When we first increase N by 1, each available XY will not ...

Posted by Bloodwine on Wed, 10 Nov 2021 20:13:54 -0800

Top ten sorting algorithms (fast sorting, merging, heap sorting and direct insertion) - Java implementation

Bubble sorting Start from the first element of the sequence to be sorted, constantly compare the values of adjacent elements, exchange if it is found that the reverse order, and gradually move the elements with larger values from front to back. Every time the maximum value of the sequence to be sorted is found, the maximum value is fi ...

Posted by almightyegg on Wed, 10 Nov 2021 20:12:43 -0800

maven java project configuration dual database (multi database configuration)

preface Why configure dual or multiple databases. When you need to obtain or insert data from two or more databases, the database driver, url path, username and password of each database are different. If you follow the configuration of a single database, you can only obtain the content of one database. explain According to my method, it is ...

Posted by Comtemplative on Wed, 10 Nov 2021 19:45:40 -0800

Android source code pit avoidance Guide 9 - AVRCP connection status is abnormal

AVRCP connection status is abnormal Android version: android-9 (P version) Problem phenomenon: disconnect the device and fail to issue Bluetooth adapter.action for a long time_ CONNECTION_ STATE_ The changed broadcast switches the connection status to Bluetooth adapter.state_ DISCONNECTED After checking the log, it can be found that all m ...

Posted by subrata on Wed, 10 Nov 2021 19:42:32 -0800

For python, Opencv learning notes -- 3

preface opencv version 4.1.2.30 (4. X > = version) and my version 4.5.3 are required 1, LUT There is only one threshold in the threshold comparison method described above. If you need to compare with multiple thresholds, you need to use a look-up table (LUT). LUT is a gray value mapping table, which takes the gray image value as the ...

Posted by mikwit on Wed, 10 Nov 2021 19:41:40 -0800

How to use virtual reference to manage out of heap memory in NIO

Virtual reference is the weakest reference. How weak is it? That is, you define a virtual reference, and you can't get the object through the virtual reference, let alone affect the life cycle of the object. The only function in a virtual reference is to queue to receive notification that the object is about to die. 1. Characteristics of virtu ...

Posted by xeno on Wed, 10 Nov 2021 19:34:26 -0800

Kotlin Vocabulary | use the extensions in kotlin to improve code readability

Have you ever wanted to add new functions or properties to the API of a class? You can usually solve this problem by inheriting the class or creating a new function that takes an instance of the class as a parameter. Java programming language usually uses Utils class to solve such problems, but this method does not support automatic code com ...

Posted by dhorn on Wed, 10 Nov 2021 19:34:50 -0800

Start with the Room Kotlin API

Room It is the encapsulation of SQLite, which makes the operation of Android database very simple. It is also my favorite Jetpack library so far. In this article, I will tell you how to use and test the Room Kotlin API, and I will share its working principle during the introduction. We will be based on Room with a view codelab Explain it to ...

Posted by shruti on Wed, 10 Nov 2021 19:24:16 -0800

(juc Series) concurrent linkeddeque source code of concurrent collection

The source code of this article is based on JDK13ConcurrentLinkedDequeOfficial annotation translationAn unbounded, concurrent, double ended queue is implemented using a linked list. Concurrent write, remove, and access operations between multiple threads can ensure security. When many threads share a common set, ConcurrentLinkedDeque is a good ...

Posted by BMN on Wed, 10 Nov 2021 19:18:20 -0800