Pit design mode – factory method mode (Factory)

The factory method pattern is also called the factory pattern. It is one of 23 design patterns. It solves the problem of creating objects in software design. It can better solve the change of users’needs. Problem: In the simple factory pattern, we put all the instantiated objects in Factory. CS (factory class), and we can instantiate objects in our predictions, but our predictions are limited, and the customer’s requirements are unlimited, so there is a problem, but the customer’s needs are too complex.Miscellaneous, we have to modify the source code, which is not allowed by...

The closure I understand

Closure concept: a function that has access to variables in another function scope. function add(){ var result; result = function(x,y){ return y+x } return result } var sum = new add(); console.log(sum(10,20))/*30*/ The main reason for function execution is () function createFunctions(){ var result = new Array(); for (var i=0; i < 10; i++){ result[i] = function(){ return i; }; } return result; } var funcs = createFunctions(); for (var i=0; i < funcs.length; i++){ ...

Programmer’s distress

  Hello, everyone. I’m Xiao Yang. I’m glad you can brush this article. First of all, I encourage you to have a bright future on the road to struggle. Secondly, Xiao Yang said: pay = reward.   I hope that if we encounter setbacks on the road to struggle, we can simply vent, but let it out. We are still good colleagues and have to continue working. Xiao Yang is a shooter, full of positive energy, no matter what difficulties, Xiao Yang can face positively, this is Xiao Yang in my heart. Xiao Yang is studying in the future.They will work hard, be miserable and happy.   Don...

Solve multi table associated queries + slow sorting speed

select * from ( SELECT ROW_NUMBER() OVER(ORDER BY A.ColumnName DESC) NUM, * from T_A A left join T_B B on A.X=B.Y and ...) t where B.ColumnName is not null Optimization of the key 3:1、Change natural link to left join and filter out the null value of the right table in the outer layer.2、Oracle’s ROW_NUMBER () is used to place the order by condition in the join select item, ROW_NUMBER() OVER (ORDER BY A. ColumnName DESC) NUM.Solve the slow sequencing problem;3、Index create index IND_C_DESC on T_A (ColumnName DESC) is created according to ascending and descendin...

Installation of Apache Ambari

Check version compatibility: https://supportmatrix.hortonworks.com, green represents compatibility. The flow chart is as follows: Software environment: yum and rpm (RHEL/CentOS/Oracle/Amazon Linux) zypper and php_curl (SLES) apt (Debian/Ubuntu) scp, curl, unzip, tar, and wget OpenSSL (v1.01, build 16 or later) Python For SLES 12: Python 2.7.x For CentOS 7, Ubuntu 14, Ubuntu 16, and Debian 9: Python 2.7.x

A dentist’s conscience advices that everyone should have a look.

This is the 10 point of the dentist. Most people go to the doctor only when they have toothache or uncomfortable teeth. They don’t go to the doctor on time. Some people think that tooth extraction is bad for the brain. Others think it’s partly because of the cost and so on. Ten tips for senior dentists: First, don’t wait until you have dental diseases to see the doctor.Dental disease differs from other diseases of the body in that it can be prevented. The development of dental disease is a slow process. To thatEven if the doctor wants to save it, it is very difficult.Suggest...

luogu P4342 [IOI1998]Polygon

IOISo many DP in the early days? The title requires that one side of the ring be broken. We can break the link into a chain and open a two fold array. Easy to think of DP, set up\(f_{i,j}\)For interval\([i,j]\)The maximum value is then the interval DP of an enumeration breakpoint. But there may be negative numbers, which means that there may be two negative numbers in the interval multiply to get the maximum, so let’s say\(g_{i,j}\)For interval\([i,j]\)Minimum value When transferring, consider all possible situations. // luogu-judger-enable-o2 #include<bits/stdc++.h> #define LL lo...