How to clean up temporary system files in batches (language: C#, C/C++, php, python, java), _PHP tutorial
How to clean up temporary system files in batches (languages: C#, C/C++, php, python, java), The language debate has been around for a long time. Let’s do some IO experiments (traversal Files with more than 9G, deleted in batches), try to use facts to compare who is better and who is worse. Operating system: win7 64-bit, file package size: 9.68G. 1. Language: C# Development environment: vs 2013 Total number of lines of code: 43 lines Time taken: 7 seconds Code: using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; namespaceBatchDelete { class Program { static void Main(string[] args) { //Input directory e:\tmp string path; Console.WriteLine(“Enter the directory to be cleaned:”); path = Console.ReadLine(); // start the timer Console.WriteLine(“Start timing:”+DateTime.Now.ToString(“HH:mm:ss”)); // First traverse the matching search and then loop to delete if (Directory.Exists(path)) { Console.Write(“Deleting”); foreach (string fileName in Directory.GetFileSystemEntries(path)) { if (File.Exists(fileName) && fileName.Contains(“cachegrind.out”)) { File.Delete(fileName); } } Console.WriteLine(“”); } else { Console.WriteLine(“This directory does not exist!”); } // Timer ends Console.WriteLine(“End time:” + DateTime.Now.ToString(“HH:mm:ss”)); Console.ReadKey(); } } } Operation renderings: 2. Language: C/C++ Development environment: vs 2013 Total number of lines of code: 50 lines Time taken: 36 seconds Code: #include #include #include #include #include #include…
Java, Regular: Why do these two matches mean the same thing? -php tutorial
javaPattern p = Pattern.compile(“(?=hopeful)hope”); String str = “hopeful”; Matcher m = p.matcher(str); while(m.find()){ System.out.println(m.group()); } Whether it can match hopeful, if so, capture the hope in hopeful. Of course, continue to search for matching substrings backward, starting from f. By comparison, we can see that (?=hopeful)hope and hope(?=ful) have the same effect. Although I saw the above explanation, I still can’t understand it. I have only seen the writing method hope(?=ful). How should I understand the other writing method? I always thought (?=) was used to match whether it ends with xxx… Reply content: javaPattern p = Pattern.compile(“(?=hopeful)hope”); String str = “hopeful”; Matcher m = p.matcher(str); while(m.find()){ System.out.println(m.group()); } Whether it can match hopeful, if so, capture the hope in hopeful. Of course, continue to search for matching substrings backward, starting from f. By comparison, we can see that (?=hopeful)hope and hope(?=ful) have the same effect. Although I saw the above explanation, I still can’t understand it. I have only seen the writing method hope(?=ful). How should I understand the other writing method? I always thought (?=) was used to match whether it ends with xxx… (?=exp) matches the position before exp (?=hopeful)hope -> (?=hopeful) + hope (?=hopeful) is positioned…
What are the differences in the steepness of the learning curves between Clojure, Java, Python, and Ruby?
Reply content: functional-koans/clojure-koans · GitHubmatyb/java-koans · GitHub gregmalcolm/python_koans · GitHubneo/ruby_koans · GitHubThis tutorial is almost all mainstream Language all-stars. This set of tutorials are pretty much the same. Learning languages using TDD. There is no book-based dogma, and Ruby was the first to come out. I feel that Clojure’s development efficiency will be the highest. It won’t be as disgusting as java restarting. Every time I go to the toilet, I still haven’t gotten up yet. That one is really annoying. REPL is cool~~ @Kim Leo’s statement, you can take a look and record the number of days you study~~—update 20141012@pezy provided a list, awesome-koans/koans -en.md at master · ahmdrefat/awesome-koans · GitHub This series includes but is not limited to bash (seems to be produced by Google), lisp, c sharp, groovy . There is no ocaml. By the way, here is a list of famous free programming books, free-programming-books/free-programming-books.md at master · vhf/free-programming-books · GitHub. —update 20141023 Put the vomit in the comment area below to make it clearer. It seemed like she was talking to herself, completely ignoring Lulu’s feelings. In fact, the basic points of the language in this series are covered, and the design issues are the…
java<>, >>> shift operation methods
<<, signed left shift, shifts the entire binary value of the operand to the left by a specified number of digits, and pads the low bits with 0s. int leftShift = 10; System.out.println(“Decimal:” + leftShift + “, Binary:” + Integer.toBinaryString(leftShift)); int newLeftShift = letfShift <<2; System.out.println("Shift left by 2 digits and then decimal:" + newLeftShift + ", Shift left by 2 digits and then binary" + Integer.toBinaryString(newLeftShift)); //The decimal result of positive integer x after shifting n digits to the left, x = x * 2^n The above are positive integers, and the operation results are as follows. Next, let’s take a look at what happens when a negative number is left shifted by 2 bits. The result of the operation is as follows. Why does the binary number -10 have so many 1’s? If you count carefully, there are exactly 32 bits. The first thing you need to understand is that Java negative numbers are stored in two’s complement form (complement = complement + 1). The binary number of 10 is 1010, and its complement is 0101. Adding 1 is the complement 0110. So why are there so many extra 1’s? This is because the int type occupies 8…
How to clean up temporary system files in batches (language: C#, C/C++, php, python, java)
The language debate has been going on for a long time. Let’s do some IO experiments (traverse more than 9G files and delete them in batches), and try to use facts to compare who is better and who is worse. Operating system: win7 64-bit, file package size: 9.68G. 1. Language: C# Development environment: vs 2013 Total number of lines of code: 43 lines Time taken: 7 seconds Code: using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; namespaceBatchDelete { class Program { static void Main(string[] args) { //Input directory e:\tmp string path; Console.WriteLine(“Enter the directory to be cleaned:”); path = Console.ReadLine(); // start the timer Console.WriteLine(“Start timing:”+DateTime.Now.ToString(“HH:mm:ss”)); // First traverse the matching search and then loop to delete if (Directory.Exists(path)) { Console.Write(“Deleting”); foreach (string fileName in Directory.GetFileSystemEntries(path)) { if (File.Exists(fileName) && fileName.Contains(“cachegrind.out”)) { File.Delete(fileName); } } Console.WriteLine(“”); } else { Console.WriteLine(“This directory does not exist!”); } // Timer ends Console.WriteLine(“End time:” + DateTime.Now.ToString(“HH:mm:ss”)); Console.ReadKey(); } } } Operation renderings: 2. Language: C/C++ Development environment: vs 2013 Total number of lines of code: 50 lines Time taken: 36 seconds Code: #include #include #include #include #include #include #include using namespace std; int main(int argc, char * argv[]) { //Input…
Implementation of mutual conversion between emoji expressions and unicode encoding (JS, JAVA, C#)
A few days ago, there was a need to convert the Unicode encoding corresponding to emoji into text, such as the “smiley face” corresponding to 1f601, but I did not find a C# method to convert 1f601 into text. How to convert using Encoding.Unicode None of them are right. In the end, I copied the emoji characters directly, and they were displayed directly in Visual Studio. Then just use the characters without converting them, and then let it go. Today I was working on the Markdown editor. Due to the GFM issue earlier, I also tested the encoding. I didn’t find any reliable information. I found a lot of emoji and Unicode comparison tables, https://apps.timwhitlock.info/emoji /tables/unicode Take a smiley face https://apps.timwhitlock.info/unicode/inspect/hex/1F601 for surgery~ 1. Convert emoticon characters to encoding 【C#】 Encoding.UTF32.GetBytes(“😁”) -> [“1”, “f6”, “1”, “0”] 【js】 “😁”.codePointAt(0).toString(16) -> 1f601 【java】 byte[] bytes = “😀”.getBytes(“utf-32”); System.out.println(getBytesCode(bytes)); private static String getBytesCode(byte[] bytes) { String code = “”; for (byte b : bytes) { code += “\\x” + Integer.toHexString(b & 0xff); } return code; } UTF-32 results are consistent 【C#】 Encoding.UTF8.GetBytes(“😁”) -> [“f0”, “9f”, “98”, “81”] 【js】 encodeURIComponent(“😁”) -> %F0%9F%98%81 UTF-8 results are consistent 2. Encoding to emoticon characters 【js】 String.fromCodePoint(‘0x1f601’) utf-32…
Java, JavaScript and ABAP obtain the call stack of the current code through code
Java StackTraceElement stack[] = Thread.currentThread().getStackTrace(); System.out.println(“Callstack test”); for(int i = 0; i <stack.length; i++){ System.out.println(“Jerry:” + stack[i].getClassName() + “:” + stack[i].getMethodName() + “—–“); } Test: Javascript function getCallStack () { var stack = “Callstack:”, fn =arguments.callee; while ( (fn = fn.caller) ) { stack = stack + “\n” +fn.name; } return stack; } function test1 () { console.log(getCallStack()); } function test2 () { test1(); } function test3 () { test2(); } function test4 () { test3(); } test4(); Test: ABAP CALL FUNCTION ‘SYSTEM_CALLSTACK’ IMPORTING callstack = lt_callstack. Test: To get more of Jerry’s original technical articles, please follow the public account “Wang Zixi” or scan the QR code below:
java, new a girlfriend
java, new a girlfriend (written by a novice)“ Purely for entertainment, welcome to spray The print results are as follows //The source code is as follows: public class GirlFriend { private String name; private String eat; private String sing; private String shopping; private String movie; public GirlFriend(String name, String eat, String sing, String shopping, String movie) { super(); this.name = name; this.eat = eat; this.sing = sing; this.shopping = shopping; this.movie = movie; } public GirlFriend() { super(); } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getEat() { return eat; } public void setEat(String eat) { this.eat = eat; } public String getSing() { return sing; } public void setSing(String sing) { this.sing = sing; } public String getShopping() { return shopping; } public void setShopping(String shopping) { this.shopping = shopping; } public String getMovie() { return movie; } public void setMovie(String movie) { this.movie = movie; } @Override public String toString() { return “with “+name+” “+eat+”, “+shopping+sing+movie; } public static void heart() { for (int i = 0, k = 0; i <14; i++) { if (i <3) { for (int j = 0; j <5 – 2…
[Data structure] stack (stack) stack chain (animated diagram, c++, java)
Article directory Overview of stack chain(Illustration) Basic operations of chain stack 1. Initialization 2. Push to the stack 3. Pop from the stack 4. Get the top of the stack 9. Complete code Summary The following is the text of this article,The following case Available for reference. Stack chain overview(Illustration) The stack can be stored sequentially,or chained,called sequential stack and chain respectively Stack. The sequential stack allocates a continuous space,It requires two pointers,base points to the bottom of the stack,top points to the top of the stack. The address of each node in the chain stack is discontinuous, only one stack top pointer is needed. From the figure, you can It can be seen that each node of the chain stack contains two fields:data domain and pointer domain font>. Basic operations of the chain stack The chain stack can be regarded as a singly linked list without a head node,But it can only be inserted at the head Operations such as , deletion, and value retrieval cannot be performed in the middle or at the end. Therefore, the nodes of the chain stack can be defined in the singly linked list method. First define a structure. xff08;The inner class), contains…