Design pattern

1.Singleton mode:   Starving Chinese:     Instantiated direct call:      1 public class Car{ 2 3        private static Car car = new Car();  4 5        public static Car getCar(){ 6 7          return car         8 9        } 10 11     } Slacker:   When is it instantiated when used?    1 public class Car{ 2 3        private static Car car;  4 5        public static Car getCar(){ 6 7         if(car == nul...

Object oriented constraints, custom exceptions, encryption

1.constraint class BaseMessage(object): def send(self,x1): """ You must inherit BaseMessage, and then you must write the send method. Used to complete specific business logic.""" raise NotImplementedError(".send() It must be rewritten.") class Email(BaseMessage): def send(self,x1): """ You must inherit BaseMessage, and then you must write the send method. Used to complete specific business logic. """ passobj = Email()obj.send(1)   Define a constraint function at the beginning, declare the method used by the back function, and activ...

Tree chain dissection

  study from: http://www.cnblogs.com/chinhhh/p/7965433.html   https://www.luogu.org/problemnew/show/P3384 1 #include <cstdio> 2 #include <cstdlib> 3 #include <cmath> 4 #include <cstring> 5 #include <time.h> 6 #include <string> 7 #include <set> 8 #include <map> 9 #include <list> 10 #include <stack> 11 #include <queue> 12 #include <vector> 13 #include <bitset> 14 #include <ext/rope> 15 #include <algorithm> 16 #include <iostream> 17 using namespace std; 18 #define ll long...

Python string, string manipulation function and string related operations

pythonString, string manipulation functions and string related operations String introduction pythonString representation PythonIn addition to processing numbers, strings can also be processed. >>> 'spam eggs' 'spam eggs' >>> 'doesn/'t' "doesn't" >>> "doesn't" "doesn't" >>> '"Yes," he said.' '"Yes," he said.' >>> "/"Yes,/" he said." '"Yes," he said.' >>> '"Isn/'t," she said.' '"Isn/'t," she said.'   The output format of the string is the same as the input, wrapped in apostrophes, and the apostrophes and other special characters...

Python built-in string method (Collector only)

Python Built in string method (Collector only) method   Character string   string   python3.x    python  4.7k It takes 44 minutes to read and read. 5 String processing is a very common skill, but Python built-in string method is too many, often forgotten, in order to facilitate quick reference, according to Python 3.5.1 to write an example of each built-in method and categorize, for everyone to index.PS: You can click the green header in the overview to enter the corresponding category or quickly index the corresponding method through the right sidebar article cata...

JS implements the line wrap effect in the label of the HTML table.

Meet a problem I wrote a couple of lines below, but the table didn’t show them as rows. Instead, the newline became a space, and I wanted to convert it myself ponder a problem 1、You can see that the content of the table is data from the back end, so you want to convert it directly to & lt; BR & gt; tags. 2、If you think about it, do the following, run away and find out, & lt; BR & gt; just show it as text, and it won’t be tagged by html. Snap  3、Continue to think, ready to load the data, process it in js, and turn the line breaks in the text into &...

Add automatic download function

This function can be used to supplement the necessary files for the client, such as voice files, model files, etc. autotabledownloader.sp #include <sourcemod> #include <sdktools> static String:DownloadPath[64] public Plugin:myinfo = { name = "Auto Table Downloader", author = "Master(D)", description = "Auto Table Downloader", version = "1.1.1", url = "" } public Action:Command_CheakDownloadTables(Client,Args) { PrintToConsole(Client,"Cheaking Download Table...") new Handle:fileh = OpenFile(DownloadPath, "r") new String:buffer[256] while (ReadF...