Category:Program Language

  • Summary of numpy

    Time:2020-11-25

    A chestnut >>> import numpy as np >>> a = np.arange(15).reshape(3, 5) >>> a array([[ 0, 1, 2, 3, 4], [ 5, 6, 7, 8, 9], [10, 11, 12, 13, 14]]) >>> a.shape (3, 5) >>> a.ndim #The number of axes of an array. In the python world, the number of axes is called rank […]

  • Dp-01 matrix of algorithm

    Time:2020-11-25

    01 matrix difficultysecondary Given a matrix of 0 and 1, find the distance from each element to the nearest 0.The distance between two adjacent elements is 1. Example 1:Input:0 0 00 1 01 1 1Output:0 0 00 1 01 2 1 1. To solve this problem, let’s start with a questionNumber of islands The problem […]

  • Go learning notes map (Dictionary)

    Time:2020-11-25

    1. Declaration assignment: var m1 map[string]int m1 = map[string]int{“name”:1, “xxx”:2} be equal to m1 := make(map[string]int) be equal to m1 := map[string]int{} //m2 := map[string]interface{}{} 2. Map is a reference type m2 := m1 m2[“age”] = 18 //Results of M1: Map[ age:18 name 1 xxx:2 ] 3. Determine whether the map value exists OK, it’s […]

  • If C + + is an arrow, which eagle would you shoot with it?

    Time:2020-11-25

    When you see the title, you may not quite understand what it means. In the end, don’t worry. I believe that a lot of people come into contact with C + + programming in college, but this course only tells you what the programming language is, but it doesn’t tell you how to master programming. […]

  • On the problem that the code can not take effect in time after modification

    Time:2020-11-25

    Today, after the modified code is uploaded to the server via FTP, even if the cache is deleted, it still doesn’t take effect, with a delay of about 10 seconds. After research, it is found that the reason is that PHP starts the opcache extension, and the deletion of this extension takes effect immediately. It […]

  • Container deployment of Prometheus + alertmanager + grafana monitoring components

    Time:2020-11-25

    Deploy configuration files directly docker-compose.yml version: ‘3’ networks: monitor: driver: bridge services: prometheus: image: prom/prometheus container_name: prometheus hostname: prometheus restart: always volumes: – /data/monitor/prometheus.yml:/etc/prometheus/prometheus.yml – /data/monitor/prom_db:/prometheus – /data/monitor/prom_rules:/etc/prometheus/rules ports: – “9090:9090” networks: – monitor grafana: image: grafana/grafana container_name: grafana hostname: grafana restart: always volumes: – /data/monitor/ga_data:/var/lib/grafana environment: – [email protected] ports: – “3000:3000” networks: – monitor […]

  • Exit function

    Time:2020-11-25

    Referring to the relevant information, calling the exit function directly returns the process to the operating system, whether it is invoked in the main thread or the child thread, will directly control the control to the operating system.     Code 1: call exit in main thread to exit. #include #include using namespace std; void […]

  • Python OCT function

    Time:2020-11-25

      OCT function is also a python built-in function. It mainly converts an integer into octal, which is similar to ord function / Chr function; 1、 Introduction to OCT function The oct() function converts an integer into an octet string. The syntax is as follows: oct(x)   Parameters: X – integer; Return value: return octal […]

  • Java process control: sequential structure

    Time:2020-11-25

    1、 Process control In JavaProcess control statementIt can be classified as follows:Sequence structure, choice structure and circulation structure。 These three structures are enough to solve all the problems! 2、 Sequential structure Description: Java process controlBasic structureIt’s a sequential structure. Unless otherwise specified, java code isIn order, statements and code blocks are executed from top to […]

  • PHP design pattern code examples of null object (25)

    Time:2020-11-25

    objective The empty object pattern is not a GOF design pattern, but it is enough to be considered a design pattern as a frequent pattern. It has the following advantages: The client code is simple It can reduce the probability of null pointer exception Test cases don’t need to consider too many conditions Return an […]

  • Vscode installation go third-party expansion pack pit logging detailed tutorial

    Time:2020-11-25

    1. Installation of go extension package in vscode will not be described. 2. After installing the go extension package, create the gopath environment variable 3. Path will be automatically added, if not, it can be manually added 4. Create your own workspace in gopath directory (it’s not clear why it must be created in gopath). […]

  • Methods and precautions of removing elements in Java collection

    Time:2020-11-25

    1. Preface Operation set is a thing that Java programmers repeat almost every day. Today, let’s look at ways to remove elements from the Java collection. I’ve built a simple collection, and we’ll take this as an example to explore. List<String> servers = new ArrayList<>(); servers.add(“Felordcn”); servers.add(“Tomcat”); servers.add(“Jetty”); servers.add(“Undertow”); servers.add(“Resin”); 2. For loops do not […]