How do I use Lock? What is the difference between Lock and synchronized?

  Lock   It's like a synchronization block, java.util.concurrent.locks.Lock Is the thread synchronization mechanism. However, locks are more flexible and complex than synchronous blocks. Because lock is an interface, you need to use one of its implementations to use lock in your application. ReentrantLock is one such implementation of ...

Posted by greedyisg00d on Wed, 27 May 2020 07:09:42 +0200

[LeetCode] 9 Word Split 2

subject 140. Word Split II Given a non-empty string s and a dictionary wordDict containing a list of non-empty words, add spaces to the string to construct a sentence so that all words in the sentence are in the dictionary.Return all these possible sentences. Explain: Words in the dictionary can be reused when separating. You can assume that t ...

Posted by hellangel on Mon, 25 May 2020 18:45:06 +0200

Task 25 - first reptile test

First question: use the requests library to visit Baidu homepage 20 times, and return the length of his text and content attributes.   1 # -*- coding: utf-8 -*- 2 """ 3 Created on Tue May 19 10:12:16 2020 4 5 @author: 49594 6 """ 7 8 import requests 9 url = "https://www.baidu.com/" 10 for i in range(20): 11 try: 12 rest ...

Posted by gp177 on Tue, 19 May 2020 16:43:11 +0200

Take a quick look at Swagger

1, Swagger 1. What is Swagger? Swagger is a standardized and complete framework for generating, describing, invoking, and visualizing Restful style Web services.Simple understanding: it is a REST API document generation tool, which can generate online interface documents and facilitate interface testing. 2. Why Swagger? When front-end and back- ...

Posted by mikesheridan5 on Mon, 11 May 2020 19:42:36 +0200

(Reprint) cascade type and FetchType of JPA

Link: https://www.jianshu.com/p/b8595aee06ac   CascadeType Summary Cascade refers to cascade operation, which is annotated in hibernate configuration @OneToOne,@OneToMany,@ManyToMany , @ ManyToOne properties Cascading is often used when writing triggers. The function of triggers is to ensure that the data in the associ ...

Posted by nykoelle on Fri, 08 May 2020 11:58:32 +0200

Python 3 quick start tutorial errors and exceptions

There are at least two types of errors in Python: syntax errors and exceptions. syntax error Syntax errors are also called parsing errors: >>> while True print('Hello world') File "<stdin>", line 1 while True print('Hello world') ^ SyntaxError: invalid syntax The parser indicates the error line ...

Posted by bigger on Thu, 07 May 2020 10:12:10 +0200

mongoDB advanced application

Replica set introduction What is a replica set -MongoDB replication is the process of synchronizing data on multiple servers. -Replication provides redundant backup of data and stores copies of data on multiple servers, improving data availability, And can ensure the security of data. -Replication also allows you to recover data from hardwa ...

Posted by Shibbey on Wed, 06 May 2020 03:09:50 +0200

YModem protocol learning

YModem transmission mode: YModem, YModem-1K, YModem-g. In YModem-1k, the standard 128 byte transmission is replaced by 124 byte information fast transmission, and CRC teaching and research is used to ensure the accuracy of data transmission. YModem-g cancels the CRC check code of the data, and after sending a data block information, ...

Posted by markjia on Sun, 03 May 2020 16:44:28 +0200

Crawling novel (step 3) python

Suppose you have installed bs4 requests This novel is chosen at will, so you don't have to worry too much Python 3 implementation. There are too many crawlers using Python 2 on the Internet, but there are still few crawlers using Python 3 The link is https://www.qu.la/book/12763/10664294.html Get the title of the article (find the exact htm ...

Posted by hnissani on Fri, 01 May 2020 10:30:06 +0200

Getting Started with Golang Web: How to Implement a High Performance Route

abstract stay Last article In, we talked about how to implement an Http server in Golang.But in the end, we can find that although DefaultServeMux can do routing distribution, its function is also imperfect. Routing distribution by DefaultServeMux is not a RESTful style API, and we cannot define the method required for requests or add query p ...

Posted by gplaurin on Mon, 20 Apr 2020 03:33:23 +0200