2022年5月25日 星期三

Slow MySql Server Performance - What and How to check?

0

Slow MySql Server Performance - What and How to check? Log slow queries- If your system has a ton of queries, it gets tougher to find out which queries are slowing your system. MySQL provides a tool to log slow queries for further analysis https://dev.mysql.com/doc/refman/8.0/en/slow-query-log.html EXPLAIN Extended command shows details about your queries when your have no idea what is happening https://dev.mysql.com/doc/refman/8.0/en/explain-extended.html To speed up your queries use Index - A good practice is add index by seeing which fields are in the WHERE clause add index for them. Also if you are retrieving all fields from a table, the query gets slower by fetching all data from disk. In SELECT query you should specify which fields you need to bring instead to bring...

2022年5月20日 星期五

正則表達式 (regex) 各程式語言使用方法 (part 5)

0

#Java public class RegexTestStrings { public static final String EXAMPLE_TEST = "This is my small example " + "string which I'm going to " + "use for pattern matching."; public static void main(String[] args) { System.out.println(EXAMPLE_TEST.matches("\\w.*")); String[] splitString = (EXAMPLE_TEST.split("\\s+")); System.out.println(splitString.length);// should be 14 for (String string : splitString) { System.out.println(string); } // replace all whitespace with tabs System.out.println(EXAMPLE_TEST.replaceAll("\\s+", "\t")); } } #PHP $str = 'a1234'; if (preg_match("/^[a-zA-Z0-9]{4,16}$/", $str)) { echo "驗證成功"; } else { echo "驗證失敗"; } #perl print $str = "a1234" =~ m:^[a-zA-Z0-9]{4,16}$: ? "COMFIRM" : "FAILED"; 正則表達式 (regex) 簡介...

正則表達式 (regex) 範例 (part 4)

0

只能輸入1個數字  表達式 \d$ 描述 匹配一個數字 匹配的例子 0,1,2,3 不匹配的例子 只能輸入n個數字   表達式\d{8} 描述匹配8個數字 匹配的例子12345678,22223334,12344321 不匹配的例子 只能輸入至少n個數字  表達式\d{8,} 描述匹配最少n個數字 匹配的例子12345678,123456789,12344321 不匹配的例子 只能輸入m到n個數字  表達式\d{7,8}$ 描述匹配m到n個數字 匹配的例子12345678,1234567 不匹配的例子123456,123456789 只能輸入數字   表達式[0-9]*$ 描述匹配任意個數字 匹配的例子12345678,1234567 不匹配的例子E, 只能輸入某個區間數字   表達式[12-15]$ 描述匹配某個區間的數字 匹配的例子12,13,14,15 不匹配的例子 只能輸入0和非0打頭的數字   表達式(0|[1-9][0-9]*)$ 描述可以為0,第一個數字不能為0,數字中可以有0 匹配的例子12,10,101,100 不匹配的例子01, 只能輸入實數   表達式[-+]?\d+(\.\d+)?$ 描述匹配實數 匹配的例子18,+3.14,-9.90 不匹配的例子.6,33s,67-99 只能輸入n位小數的正實數   表達式^[0-9]+(.[0-9]{n})?$以^[0-9]+(.[0-9]{2})?$為例 描述匹配n位小數的正實數 匹配的例子2.22 不匹配的例子2.222,-2.22, 只能輸入mn位小數的正實數   表達式^[0-9]+(.[0-9]{m,n})?$以^[0-9]+(.[0-9]{1,2})?$為例 描述匹配m到n位小數的正實數 匹配的例子2.22,2.2 不匹配的例子2.222,-2.2222, 只能輸入非0的正整數   表達式^/+?[1-9][0-9]*$ 描述匹配非0的正整數 匹配的例子2,23,234 不匹配的例子0,-4, 只能輸入非0的負整數  表達式^/-[1-9][0-9]*$ 描述匹配非0的負整數 匹配的例子-2,-23,-234 不匹配的例子0,4, 只能輸入n個字符  表達式^.{n}$...

正則表達式 (regex) 實戰 II (part 3)

0

A newspaper (often just called a paper when the context is clear) is a periodical publication containing news, other informative articles (listed below), and usually advertising. A newspaper is usually printed on relatively inexpensive, low-grade paper such as newsprint. The news organizations that publish newspapers are themselves often metonymically called newspapers. Most newspapers now publish online as well as in print. The online versions are called online newspapers or news sites. 60666066 Name : Chan Tai Man Tel: 24882488 , 2499 2499 , 139 6888 6888 Email : abc@gmail.com, def@yahoo.com HKID: A123456(7) , A123456(A) TWID: A168145309 Website...

Pages 14« 123456 »