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…

PHP, Javades encryption and decryption examples_PHP-php tutorial

des encryption is an encryption method that is widely used on the Internet in symmetric encryption. PHP supports des encryption through the mcrypt extension library. To use des encryption in Php, you need to install the mcrypt extension library first The following is an example of encryption and decryption The code is as follows: $iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB); $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND); $key = “This is a very secret key”;//Key $text = “Meet me at 11 o’clock behind the monument.”;//Content that needs to be encrypted echo ($text) . “\n”; $crypttext =base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $key, $text, MCRYPT_MODE_ECB, $iv)); echo $crypttext . “\n”;//Encrypted content echo mcrypt_decrypt(MCRYPT_RIJNDAEL_256,$key,base64_decode($crypttext),MCRYPT_MODE_ECB,$iv);//Decrypted content In the AES encryption algorithm, MCRYPT_RIJNDAEL_128, MCRYPT_RIJNDAEL_192, and MCRYPT_RIJNDAEL_256 are usually used. The following 128, 192, and 256 represent the number of bits of the secret key (that is, the encrypted Key). For example, MCRYPT_RIJNDAEL_128 is used. Then when using this algorithm to encrypt, the length of the secret key is 128 bits. For example, $key = ‘fjjda0&9^$$#+*%$fada’ is 20 characters. Then only the first 16 characters are used for encryption ( 16*8=128), if it is less than 128bit, ‘\0’ will be used to fill it in PHP. Sometimes when doing project docking, you may be using…

PHP, Javades encryption and decryption examples_php examples

des encryption is an encryption method that is widely used on the Internet in symmetric encryption. PHP supports des encryption through the mcrypt extension library. To use des encryption in Php, you need to install the mcrypt extension library first The following is an example of encryption and decryption The code is as follows: $iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB); $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND); $key = “This is a very secret key”;//Key $text = “Meet me at 11 o’clock behind the monument.”;//Content that needs to be encrypted echo ($text) . “\n”; $crypttext =base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $key, $text, MCRYPT_MODE_ECB, $iv)); echo $crypttext . “\n”;//Encrypted content echo mcrypt_decrypt(MCRYPT_RIJNDAEL_256,$key,base64_decode($crypttext),MCRYPT_MODE_ECB,$iv);//Decrypted content In the AES encryption algorithm, MCRYPT_RIJNDAEL_128, MCRYPT_RIJNDAEL_192, and MCRYPT_RIJNDAEL_256 are usually used. The following 128, 192, and 256 represent the number of bits of the secret key (that is, the encrypted Key). For example, MCRYPT_RIJNDAEL_128 is used. Then when using this algorithm to encrypt, the length of the secret key is 128 bits. For example, $key = ‘fjjda0&9^$$#+*%$fada’ is 20 characters. Then only the first 16 characters are used for encryption ( 16*8=128), if it is less than 128bit, ‘\0’ will be used to fill it in PHP. Sometimes when doing project docking, you may be using…

(Transfer) Using Thrift0.9.1 to implement cross-language calls to Golang, Php, Python, and Java

(Transfer) Using Thrift0.9.1 to implement cross-language calls to Golang, Php, Python, and Java

Question introduction: What is Thrift? Where is the official website of Thrift? How to implement cross-language calls between Golang, Java, Python, and PHP through Thrift? 1. What is Thrift Thrift is a scalable cross-language service development software framework. It combines a powerful software stack with a code generation engine to build services. Thrift is fac Question introduction:What is Thrift?Where is the official website of Thrift? How to implement cross-language calls between Golang, Java, Python, and PHP through Thrift? 1. What is ThriftThrift is a scalable cross-language service development software framework. It combines a powerful software stack with a code generation engine to build services. Thrift was developed by Facebook. It opened source code in April 2007 and entered the Apache incubator in May 2008. Thrift was created to solve the problem of large data transmission and communication between systems in the Facebook system and the need for cross-platform features due to different language environments between systems. Therefore, thrift can support a variety of programming languages, such as: C++, Java, Python, PHP, Ruby, Erlang, Perl, Haskell, C#, Cocoa, Javascript, Node.js, Smalltalk, and OCaml. (The current version 0.9.1 has started Supports golang language) to communicate between multiple different languages. Thrift can be…

In Web website building technology, what are HTML, HTML5, XHTML, CSS, SQL, JavaScript, PHP, ASP.NET, and WebServices? –

There are many technologies for building websites, such as HTML, HTML5, XHTML, CSS, SQL, Javascript, PHP, http://ASP.NET, Web Services, browser scripts, server scripts, etc. What’s the difference? Novices don’t understand anything and want to clarify the relationship and application scope of all these technologies. Reply content: A semester ago, I had almost no idea what these were like the original poster. After a semester, I almost understood them all. Let me talk about my own understanding.> <Since I haven’t been in contact for a long time, I welcome corrections if there are any mistakes~ First of all, you need to know what the process of website access is:Suppose you enter the address of this question in the browser address bar http://www.zhihu.com/question/22689579 You might as well integrate the technologies you mentioned into the development process of the Web. If you look at them from a technical and historical perspective, you will know the background of the birth of these technologies and the problems they solve. Refer to an article I once wrote: History of the Development of Web Development Technology. 1. The birth of the Web When it comes to the Web, one word that must be mentioned is “Internet”. Web…

PHP, which is more controversial than Java, has pitfalls everywhere?

Do you still remember the popular blog a few years ago called “Comprehensive Analysis of PHP’s Bad Design (PHP: a fractal of bad design)” (https://eev.ee/blog/2012/04/09/phpafractalofbaddesign/) Article? When I first read it, I was working at a low-profile company with a lot of old PHP projects. This article made me think about whether I should quit programming and do something completely different. Fortunately, I quickly changed jobs. More importantly, PHP has made great progress since version 5. Today, I want to share some of my personal experiences with those who no longer use PHP programming, or are still stumbling around in old projects. Spoiler alert: PHP today still has some pretty bad designs, just like almost every programming language has its quirks. The method signatures of many of PHP’s core functions are still inconsistent, its configuration settings are still confusing, and many developers are still writing crappy PHP code because they have to, or because they don’t know a better way. What I want to share here today is the sunny side of PHP. Let’s focus on what has changed and what methods can help you write clean and maintainable PHP code. Over the next few minutes, I want you all…

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…

How do Java, PHP, Python, JS and other developers draw statistical charts?

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…

Implementation and precautions of redis installation phpredisJedis extension, php, java, python related plug-in installation example code and document recommendations…

Redis installation phpredis Jedis extension implementation and precautions, php, java, python related plug-in installation example code and document recommendations 1. Redis official website download: http://redis. io/downloadThird-party download redis windows application,Supports 32-bit and 64-bit,Download according to actual situationDownload address: https ://github.com/dmajkic/redis/downloads2. Copy the corresponding program to the directory you need ,I use 64-bit here& #xff0c;Put it in the E:\redis directory3. Start the redis server:Open a cmd window,First switch to the directory where redis is placed(E:\redis) ,Run redis-server.exe redis.conf Note that redis.conf is a configuration file,It mainly configures the port used by redis and other information(If not written, it will default to redis.conf& #xff09; ========== ======== 61;=========== version:redis64-2.8.2101Start the serviceC:\Users\zhengdunzhuang>d:D:\>cd redisredis-server.exe redis.conf (redis .windows.conf) ———————————-Start another console set getC:\Users \zhengdunzhuang>d: D:\>cd redis D:\redis>redis-cli.exe -h 127.0.0.1 -p 6379127.0.0.1 :6379> set zdz zhengdzOK127.0.0.1:6379> get zdz“zhengdz”127.0.0.1:6379> ====&# 61;======== ======== 61;======phpredis is a PHP module written in C language , used to connect and operate Redis data on the database. $redis = new Redis();http://www.oschina.net/p/phpredis Download extension(php5.3.10 windows64 The bit is not good):https://github.com/phpredis/phpredis/downloadsphpredis windows64-bit versionwamp64-bit version Apache 2.2.21 Php 5.3.10 Because the project is useful I searched around for redis “You need to install the phpredis client” and “There is no 64-bit version” and you can only…

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…

Contact Us

Contact us

181-3619-1160

Online consultation: QQ交谈

E-mail: [email protected]

Working hours: Monday to Friday, 9:00-17:30, holidays off

Follow wechat
Scan wechat and follow us

Scan wechat and follow us

Follow Weibo
Back to top
首页
微信
电话
搜索