• Script debugging mechanism in Bash


    Run script in debug mode adoptbash -x <script>You can run the entire script in debug mode,bashEach command line will be printed out before running, and the number of nesting levels of the command will be indicated with a + sign before each line > bash -x debug.sh + echo ‘First line’ First line: the output […]

  • Abbreviation of regular common character set


    Abbreviation of regular common character set [toc] Because some character sets are very common, regular expressions themselves provide shorthand for such character sets As shown in the figure above,\s、\S、\d、\D、\w、\WThese six character sets are commonly used in normal times, and the regular on the left and right sides usually mean the same, that is, equivalent.Maybe you’ve […]

  • Database self study notes (1) — generalized Cartesian product, projection, connection, outer code


    Recently, I read the book “Introduction to database system” by myself, and summarize the problems I met. 1. Extended Cartesian product: It belongs to the traditional set operation in relational algebra. The others are union, except, intersection For example: create table R(A char(2),B char(2),C char(2)) create table S(A char(2),B char(2),C char(2)) insert into R values(‘a1’, ‘b1’, ‘c1’)insert into R values(‘a1’, ‘b2’, ‘c2’)insert into R values(‘a2’, ‘b2’, ‘c1’) insert into S values(‘a1’, ‘b2’, ‘c2’)insert into S values(‘a1’, ‘b3’, ‘c2’)insert into S values(‘a2’, ‘b2’, ‘c1’) select * from R cross join S Result:A    B    C    A    B    C    —- —- —- —- —- —- a1   b1   c1   a1   b2   c2a1   b2   c2   a1   b2   c2a2   b2   c1   a1   b2   c2a1   b1   c1   a1   b3   c2a1   b2   c2   a1   b3   c2a2   b2   c1   a1   b3   c2a1   b1   c1   a2   b2   c1a1   b2   c2   a2   b2   c1a2   b2   c1   a2   b2   c1     The number of rows is 3 * 3, […]

  • Learning to read regularly


    First, let’s look at the common points of the following pictures: /(?=.*d)(?=.*[A-Z])(?=.*W)(?=.*[a-z])(?=.*S)^[0-9A-Za-zS]{6,12}$/g Personal understanding: regular basic matching is like coordinate axis, including horizontal matching, vertical matching and position matching; Quantifier (horizontal) character matching {n,m} Match at least N times, but not more than m times {n,} Match n times or more {n} Match n times […]

  • I heard that you also want to learn composer —- version number


    The previous article briefly introduced the installation of composer, image switching, and simple usage. This article is mainly about the version number in composer. Version number introduction The setting of version number is recommended to followSemantic versionNorms. In short: Major version number (major version): when you make an incompatible API modification Minor version number (minor […]

  • Basic usage of regular expression


    Basic grammar Single character Number: \ D is equivalent to [0-9] Number or letter (underscore): [w is equivalent to [a-za-z0-9] Non numeric and alphabetic (underscore): \ W is equivalent to [^ a-za-z0-9 ‘] Spaces and tab: \ s match any white space characters, including spaces, tabs, page breaks, and so on. Equivalent to [\ f […]

  • Shell array operation


    Unlike python, you need to define a variable to be used as an array subscript, as follows: c=0 for file in `ls $dir` do filelist[$c]=$file ((c++)) done If you want to read the contents of an array, you can use the for loop: for image_name in ${filelist[@]} do if [[ ${image_name} =~ ‘tar’ ]] then […]

  • [MySQL] limit and limit offset


        There are two methods of limit: Two methods: (1)LIMIT A; #Indicates that a record is taken from the first record; (2)LIMIT A,B; #Parameter a is optional, which means skipping a piece of data (default is 0) #Parameter B is a required parameter, indicating that row B data is taken; eg1: Select * from […]

  • Comparison of equivalence and size in Python


    Equivalence and size comparison In Python, two objects can be compared as long as they are of the same type and they are built-in types (except dictionaries). Keywords: built in type, same type. Therefore, if two objects are of different types, they cannot be compared. For example, a numeric value cannot be compared with a […]

  • Small tips: JS/CSS for capitalizing the first letter of a string word


    CSS implementation: text-transform:capitalize; JS Code 1: String.prototype.firstUpperCase = function(){ return this.replace(/\b(\w)(\w*)/g,function($0,$1,$2){ return $1.toUpperCase() + $2.toLowerCase(); }) } var result = “i’m hello world”.firstUpperCase();; console.log(result); //I’M Hello World Note: Regular expressionb will split the English abbreviation, such as I’m into two parts, resulting in the output of I’M, sob cannot be used. JS Code 2: String.prototype.firstUpperCase […]

  • Connections in SQL (geek time)


    Connections in SQL One of the core of relational database is connection. In different standards, the connection may be written differently. The two most important SQL standards are SQL92 and SQL99. The following figures indicate the time when the standard was put forward. Connections in SQL92 The table used in the case is player table, […]