design_model(15)Strategy

1.Policy pattern: The policy container does not know the details of the internal policy, because the container does not implement the same interface as the internal policy, that is, the container and the internal policy is simply a combination relationship, the container only extracts the behavior of the internal policy, and carries out a unified implementation. 2.Example public interface Client { public abstract void test() ; } public class Big implements Client{ @Override public void test() { System.out.println("3Fold ");}}Public class Min implements Client{@OverridePu...

Definition of defects

1、    The function of requirement is not realized. 2、    Realized the function that the demand has no requirement. 3、    There are clearly specified mistakes that should not be made in the software.   (Extension: what are the two basic elements of software?     1)    Function should be able to achieve     2)    To have strong exception handling capability (robustness) 4、    Although demand is not mentioned explicitly, the function that should be realized has not been realized. (Note: Requirements may have omissions, we can not test the wor...

design_model(14)Mediator

1.Mediator pattern / / do not need to coordinate the relationship between themselves. 2.Example public interface Mediator { void register(String dname,Department d); void command(String dname); } public class President implements Mediator { private Map<String,Department> map = new HashMap<String , Department>(); @Override public void command(String dname) { map.get(dname).selfAction(); } @Override public void register(String dname, Department d) { map.put(dname, d); } } public interface Department { void selfAction(); voi...

Python in Ubuntu system

  UbuntuIn the system, Python version 2.7.x is installed by default, and python command is executed directly. Pthon version 2.7.x will be opened; Python version 3 needs to be installed by itself, and after successful installation, Python 3 will open pyt.Hon 3.x version.   pythonIt is installed in the /usr/bin directory; the python library is installed in /usr/local/lib/python XX. XX is the version number.   This article introduces the installation of Python source code in Ubuntu system:         Official website download source: WGet https://www.python.org/ftp/python/3.5...

Optimal trade

1 #include<iostream> 2 #include<cstdio> 3 using namespace std; 4 const int maxn=1e5+7; 5 const int maxm=5e5+7; 6 const int inf=0x7f7f7f7f; 7 int n,m,num; 8 int head[maxn],val[maxn],f[maxn],mi[maxn]; 9 int read(){ 10 int f=1;int x=0;char s=getchar(); 11 while(s<'0'||s>'9') {if(s=='-') f=-1;s=getchar();} 12 while(s>='0'&&s<='9'){x=x*10+s-'0';s=getchar();} 13 x*=f; 14 return x; 15 } 16 struct Edge{ 17 int next,to; 18 }edge[maxm]; 19 void add(int from,int to){ 20 edge[++num].next=head[from]; 21 edge[num].to=to; 22 head[...

Print all strings according to dictionary order.

For example, to ABC To print ABC, ACB, BAC, BCA, cab, CBA. void AA(char* pStr,char* pBegin) { if(*pBegin == '\0') cout << pStr << endl; else { for(char* ptemp = pBegin;*ptemp != '\0';ptemp++) { if(ptemp != pBegin) { char a = *ptemp; *ptemp = *pBegin; *pBegin = a; } AA(pStr,pBegin+1); if(ptemp != pBegin) { char a = *ptemp; *ptemp = *pBegin; *pBegin = a; } ...

[WPF] WPF MVVM simple example

1 New WPF application WPFMVVMExample The program structure is shown in the following figure.     2 ModelRealization Under the Model folder, create a new Business Class StudentModel (Class File StudentModel. cs), and the detailed code for the class is shown below. using System.ComponentModel; namespace WPFMVVMExample.Model { public class StudentModel : INotifyPropertyChanged { /// <summary> /// School number/// </summary> private int studentId; public int StudentId { get { return studen...

Eclipse’s server window can’t add solutions like tomcat6.0 and other versions.

Correct method windows->perferences Delete all the options. These are the Tomcats you deleted after you added them. One doesn’t leave. Restarting eclipse after deleting solves the problem Problem solving can be added. Failure method There is no such directory in my eclipse4.3 directory..metadata/.plugins/org.eclipse.core.runtime/.settings】 1.  Close Eclipse  2.  Open the location of WorkSpace. {workspace-directory}/.metadata/.plugins/org.eclipse.core.runtime/.settings Delete the following files org.eclipse.jst.server.tomcat.core.prefs org.eclipse.wst.server.core.prefs    3....