Usage of Python process pool multiprocessing.Pool

I. multiprocessing module The multiprocessing module provides a Process class to represent a Process object. The multiprocessing module manages processes like threads. This is the core of multiprocessing. It is very similar to threading, and the utilization of multi-core CPU is much better than threading Take a look at the construction method ...

Posted on Thu, 14 Nov 2019 05:45:59 -0500 by New Coder

python Foundation (19):random module, time module, sys module, os module

1. random module The imported random module is in the following format: import random 1.1 random decimal Take random decimal: mathematical calculation. print(random.random()) ා take the decimal between 0-1 (random. Uniform (1,2)) ා take the decimal between 1-2 1.2 random integer Take random integer: used in lottery and lottery. print(rando ...

Posted on Fri, 08 Nov 2019 08:48:09 -0500 by marco839

Samba server configuration under Centos7 (actual combat!)

Samba overview Samba is a free software to implement the SMB protocol on Linux and UNIX systems, which consists of server and client programs. SMB (Server Messages Block) is a kind of communication protocol that shares files and printers on LAN. It provides file and printer sharing services for different computers in LAN. SMB protocol is a cl ...

Posted on Tue, 05 Nov 2019 16:13:45 -0500 by pyfsapple

PHP method of generating order number

The first way to generate unique order number in PHP PHP code $str = date('Ymd') . str_pad(mt_rand(1, 99999), 5, '0', STR_PAD_LEFT); /**Bird and fish blog */ echo $str;     Note: this method is generated by using the current time plus random machine completion. Of course, we can make the time accurate to the second level The second w ...

Posted on Tue, 05 Nov 2019 13:35:02 -0500 by maneetpuri

[CentOS 7LAMP Architecture 7], Apache user authentication#

shallow A kind of ove User authentication of httpd vi /usr/local/apache2.4/conf/extra/httpd-vhosts.conf <VirtualHost *:80> DocumentRoot "/data/wwwroot/www.123.com ServerName www.123.com < directory / data / wwwroot / www.123. Com > ා specify the directory for authentication AllowOverride AuthConfig? This is equivalent to turni ...

Posted on Sat, 02 Nov 2019 14:09:57 -0400 by sifix

java8 date time format summary

The biggest difference between the traditional java date time format and java 8 date time format is out of the box security public class TestDate { public static void main(String[] args) throws Exception{ SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd"); Callable<Date> callable = new C ...

Posted on Sat, 02 Nov 2019 03:12:27 -0400 by kkurkowski

Notes on the connection establishment process of memcached client

When memcached initializes the server sockets during the startup process, it determines whether the system will listen to tcp or udp based on the startup parameters. For now, only tcp is concerned. When initializing the server socket, it will apply to the system for setting the address, bind, and start listening after ...

Posted on Fri, 01 Nov 2019 21:17:17 -0400 by fredanthony

[CentOS 7 architecture 8], domain name jump#

shallow A kind of ove Domain name jump As required, the domain name of 123.com will jump to www.123.com, and the configuration is as follows: <VirtulHost :80> DocumentRoot "/data/wwwroot/www.123.com ServerName www.123.com ServerAlias 123.com < ifmodule mod? Rewrite. C > requires mod? Rewrite Module Support RewriteEngine on? O ...

Posted on Fri, 01 Nov 2019 03:37:56 -0400 by Fly

Docker swarm cluster configuration practice

Docker Swarm is the same as Docker Compose, which is the official container choreography project of docker. However, Docker Compose is a tool to create multiple containers on a single server or host, while Docker Swarm can create container cluster services on multiple servers or hosts. Obviously, Docker Swarm is more suitable for the deploymen ...

Posted on Tue, 29 Oct 2019 17:22:38 -0400 by rincewind456

Using C + + to encapsulate mutex and conditional variables

This article uses C++ RAII mechanism To encapsulate the mutex and condition variables, to make them manage the life cycle of mutex and condition variables automatically, and to avoid resource leakage caused by manual maintenance. This article uses Pthread Library under Linux. mutex MutexLock First, the mutex is encapsulated. The following is th ...

Posted on Fri, 25 Oct 2019 14:30:24 -0400 by bickyz