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…
An article to help you understand the analysis of parameter passing principles (java, go, python, c++)
Foreword In the past year or so, I have been exposed to some languages that are unfamiliar to me, mainly Python and Go. During this period, in order to quickly realize the needs, I just followed the example. Lao’s code; I didn’t delve into some details and principles. Take parameter passing as an example. The implementation details of each language are different, but there are similarities; it is easy for many novices to be confused when they get started, leading to some low-level mistakes. Java Basic type transfer Let’s take Java, which I am most familiar with, as an example. I believe no one can write such code: @Test public void testBasic() { int a = 10; modifyBasic(a); System.out.println(String.format(“Final result main a==%s”, a)); } private void modifyBasic(int aa) { System.out.println(String.format(“aa==%s”, aa)); aa = 20; System.out.println(String.format(“After modification aa==%s”, aa)); } Output results: Before modification aa==10 After modification aa==20 Final result main a==10 However, judging from the purpose of this code, it should be to modify the value of a. Intuitively, it is understandable if the modification is successful. The fundamental reason why the results are not in line with expectations is the misunderstanding of parameter value passing and reference passing. Before…
The difference between java, python, JavaScript and jquery loop statements
1. Overview There are two types of loop statements in Python, while and for; There are four types of loop statements in Javascript, while, do/while, for, for/in jQuery loop statement each 2. Java loop statement a.while The syntax of while is: while(conditional statement){ code block } Or: while (conditional statement) code; The meaning of while is very simple. As long as the conditional statement is true, the following code will be executed. If it is false, it will stop. For example: Scanner reader = new Scanner(System.in); System.out.println(“please input password”); int num = reader.nextInt(); int password = 6789; while(num!=password){ System.out.println(“please input password”); num = reader.nextInt(); } System.out.println(“correct”); reader.close(); In the above code, as long as the password is not equal to 6789, it will always prompt for input, and reader.nextInt() receives a number from the screen. b、do/while No matter what the conditional statement is, if the code block will be executed at least once, you can use a do/while loop. The syntax of do/while is: do{ code block; }while(conditional statement) That is: execute the code block first, and then determine whether the condition is true. If it is true, continue to execute the code. If it is not true, exit the…
How do Java, PHP, Python, JS and other developers draw statistical charts?
Abstract: At present, many programmers basically use the back-end to generate data and pass it to the front-end, and then the front-end renders the data to the drawing library for display, so as to get the various results we finally saw. kind of graph, but sometimes we find that there is a lot of data that needs to be transferred. At this time, it is very slow to pass the data to the front end for analysis and display, so it is necessary to generate various statistical graphs on the back end, as follows Let’s talk about how various programmers make pictures? PHP programmers who have used PHP to create statistical charts should know that JqGraph is the golden partner of PHP. Using JqGraph we can complete the production of many charts, such as scatter charts, bar charts, line charts, stock charts, and pie charts. Wait, and the library currently supports PHP7, so we can use it with confidence. Currently, many programmers basically use the back-end to generate data and pass it to the front-end, and then the front-end renders the data to the drawing library for display, thereby obtaining the various pictures we finally see. But sometimes, we find…
storm installation (2) Installation of ZeroMQ, JZMQ, Python, Java environment
2.ZeroMQ installation Copy the installation file zeromq-2.1.7.tar.gz to the home file path. Add permissions to files chmod +x /home/ zeromq-2.1.7.tar.gz unzip files tar -xzf /home/ zeromq-2.1.7.tar.gz Enter the file path to install cd /home/ zeromq-2.1.7 ./configure make sudo make install Installed ( An error uuid not found will be reported here. At this time, you need to install the util-linux-2.21.1.tar.gz file. Unzip it with the same installation steps, and then enter the decompressed folder ./configure –without-ncureses make sudo make install Then just install zeromq ) 3.JZMQ installation First enter the home path cd /home Download installation files git clone https://github.com/nathanmarz/jzmq.git Enter the jzmq file cd jzmq Install ./autogen.sh ./configure make sudo make install Installed 4.Python installation Copy the file to the home folder Enter the home folder cd /home Add permissions chmod +x Python-2.7.6.tgz unzip files tar zxvf Python-2.7.6.tgz Install cd Python-2.6.6 ./configure make make install After the installation is complete, test whether the installation is successful python -V Python 2.7.6 Installed 5. I have already installed the Java environment when building Hadoop before, so I won’t go into details here.
Python, C, Java and C++ stand on top of each other, and the others have no chance of winning?
Organization | Su Mi Produced by | CSDN The ever-changing nature of technology can be traced. The latest TIOBE October programming language list has been released. Come and see what changes are worth paying attention to! 01 The four major programming languages continue to increase their dominance Once upon a time, the iron triangle composed of Java, C, and C++ in the programming language world has been stable for a long time. Just a year ago, Python surpassed the C language and broke the TIOBE list for more than 20 years. It topped the list for the first time and completely broke the original iron triangle structure. Since then, Python has been making rapid progress. Now, according to the latest October list, TIOBE officials pointed out that Python, C, Java and C++ have been on the TIOBE index list for a long time. The Top 4 languages alone are far ahead of the rest, and the gap seems to be growing. For example, C++, which ranks fourth this month, accounts for 9.92%, which is 5.5% higher than C#, which accounts for 4.42% and ranks fifth. In addition, in the last year, these four languages The cumulative market share is 40%,…
Detailed analysis of sample codes for performance comparison of golang, python, php, c++, c, java, and Nodejs
This article mainly introduces relevant information on the performance comparison of golang, python, php, c++, c, java, and Nodejs. Friends in need can refer to it When I was working in PHP/C++/Go/Py, I suddenly encountered I had an idea and wanted to make a simple comparison of the performance of the recent mainstream programming languages. As for how to compare, I still have to use the magical Fibonacci algorithm. Maybe it’s more commonly used or fun. Okay, talk is cheap, show me your code! Open your Mac, click on Clion and start coding! 1. Why is Go the first one? Because I am using it personally recently and I feel very good. package main import “fmt” func main(){ fmt.Println(fibonacci(34)) } func fibonacci(i int) int{ if(i<2){ return i; } return fibonacci(i-2) + fibonacci(i-1); } Let’s take a look with Go1.7 first: The code is as follows: qiangjian@ localhost:/works/learnCPP$ go version && time go build fib.go && time ./fibgo version go1.7.5 darwin/amd64 real 0m0.206suser 0m0.165ssys 0m0.059s real 0m0.052suser 0m0.045ssys 0m0.004s Then, look at 1.8: The code is as follows: qiangjian@localhost:/works/learnCPP$ go18 version && time go18 build fib.go && time ./fibgo version go1.8 darwin/amd64 real 0m0.204suser 0m0.153ssys 0m0.062s real 0m0.051suser 0m0.045ssys 0m0.003s I…
Comparison of perl, php, python, java and ruby
Preview ◆ The development trend of language must be the combination of dynamic and static, hard and soft ◆ Perl is concise and obscure, Python is elegant and clear, Ruby is exquisite and agile, and PHP is concise and simple ◆ Perhaps elegance comes from paying attention to details and specifications ◆ After (RoR) is combined with Ruby, it is like a civet cat that immediately sets off the elephant-like appearance of Java and .NET. Figure Ask a question ◆ What are the characteristics of Perl, Python, Ruby and PHP? ◆ Why are dynamic languages mostly used as lightweight solutions? ◆ Why is LAMP popular? ◆ Why is Ruby on Rails popular? ◆ What is the development trend of programming languages? Explanation “There are four remaining dynamic languages, which we classify as background scripting languages.” Colon said and drew a chart—— Quotation marks Listen carefully: “I remember that you initially divided these languages into three categories: C-family static languages, non-C-family static languages, and dynamic languages.” Colon explanation: “That is based on grammar. , focusing on theory; now it is divided according to application, focusing on practice.” Period immediately thought: “This division method looks like a three-layer architecture – the front-end…
Comparison of Perl, PHP, Python, Java and Ruby_PHP Tutorial
Preview ◆ The development trend of languages must be a combination of dynamic and static, hard and soft ◆ Perl is concise and obscure, Python is elegant and clear, Ruby is exquisite and flexible, and PHP Simple and simple ◆ Perhaps elegance comes from paying attention to details and specifications ◆ After (RoR) is combined with Ruby, it is like a civet cat that immediately sets off Java And the elephant-like figure of .NET Question ◆ What are the characteristics of Perl, Python, Ruby and PHP? ◆ Why are dynamic languages mostly used as lightweight solutions? ◆ Why is LAMP popular? ◆ Why is Ruby on Rails popular? ◆ Programming What is the development trend of languages? Explanation “There are four remaining dynamic languages, which we classify as background scripting languages.” Colon said Draw a chart—— http://www.bkjia.com/PHPjc/445730.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/445730.htmlTechArticlePreview◆ The development trend of languages must be a combination of dynamic and static, rigid and soft. ◆ Perl is concise and obscure, Python is elegant and clear, Ruby is exquisite and agile, and PHP is concise and simple. ◆ Perhaps elegance comes from the details…
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…