execution

Set maximum execution time in MYSQL / PHP

江枫思渺然 提交于 2019-11-26 16:45:00
问题 I have an XML document that has around 48,000 children (~50MB). I run an INSERT MYSQL query that makes new entries for each one of these children. The problem is that it takes a lot of time due to its size. After it is executed I receive this Fatal error: Maximum execution time of 60 seconds exceeded in /path/test.php on line 18 How do I set the Maximum execution time to be unlimited? Thanks 回答1: You can make it by setting set_time_limit in you php code (set to 0 for no limit) set_time_limit

CPU execution time in Java

倾然丶 夕夏残阳落幕 提交于 2019-11-26 16:31:34
问题 I want to calculate how much CPU time my function takes to execute in Java. Currently I am doing as below. long startTime = System.currentTimeMillis(); myfunction(); long endTime = System.currentTimeMillis(); long searchTime = endTime - startTime; But I found out that for the same I/P I get different time depending on system load. So, how to get exact CPU time my function took to execute. 回答1: As the JVM warms up the amount of time taken will vary. The second time you run this will always be

How to run batch script without using *.bat extension

☆樱花仙子☆ 提交于 2019-11-26 14:42:52
Is there any method in Windows through which we can execute a batch script without *.bat extension? This is an interesting topic to me! I want to do some observations about it. The important point first: A Batch file is a file with .BAT or .CMD extension. Period. Batch files can achieve, besides the execution of usual DOS commands, certain specific Batch-file facilities, in particular: Access to Batch file parameters via %1 %2 ... and execution of SHIFT command. Execution of GOTO command. Execution of CALL :NAME command ( internal subroutine ). Execution of SETLOCAL/ENDLOCAL commands. Now the

Prevent PHP script from being flooded

梦想的初衷 提交于 2019-11-26 14:18:16
问题 I want to prevent my script, from being flooded - if user hit F5 it is executing the script every time. I want to prevent from this and allow one script execution per 2 seconds, is there any solution for that? 回答1: You can use memcache to do this .. Simple Demo Script $memcache = new Memcache (); $memcache->connect ( 'localhost', 11211 ); $runtime = $memcache->get ( 'floodControl' ); if ((time () - $runtime) < 2) { die ( "Die! Die! Die!" ); } else { echo "Welcome"; $memcache->set (

Does php execution stop after a user leaves the page?

廉价感情. 提交于 2019-11-26 12:42:04
问题 I want to run a relatively time consuming script based on some form input, but I\'d rather not resort to cron, so I\'m wondering if a php page requested through ajax will continue to execute until completion or if it will halt if the user leaves the page. It doesn\'t actually output to the browser until a json_encode at the end of the file, so would everything before that still execute? 回答1: It depends. From http://us3.php.net/manual/en/features.connection-handling.php: When a PHP script is

Eclipse: export running configuration

与世无争的帅哥 提交于 2019-11-26 09:38:41
问题 I wrote a complex Java application with eclipse that uses many .jar libraries included into project folder. Is there a quick way to export a running configuration of the application that allows me to run it from shell (I don\'t actually need to move it around machines, so no jar export or similar things). I just need to detach the execution from Eclipse, but since project has many settings I would like to export a script (maybe .sh or just a plain long line) automatically.. 回答1: You can get

Can I pass an argument to a VBScript (vbs file launched with cscript)?

会有一股神秘感。 提交于 2019-11-26 09:19:09
问题 I have this script saved in \"test.vbs\": Set FSO = CreateObject(\"Scripting.FileSystemObject\") Set File = FSO.OpenTextFile(workFolder &\"\\test.txt\", 2, True) File.Write \"testing\" File.Close Set File = Nothing Set FSO = Nothing Set workFolder = Nothing When I run the script I want to pass the value of the \"workFolder\" variable. How can I do this? Can I do it? Something like \"cscript test.vbs workFolder:\'C:\\temp\\\'\" perhaps? Bonus question: Is it neccessary to clean up the passed

Stop SQL query execution from .net Code

这一生的挚爱 提交于 2019-11-26 07:48:21
问题 I\'m executing one stored procedure from the \'.net\' code. Since there is a lot of data, it is taking too much time to execute. Is there any way to stop this execution from the c# code? In other words, if we execute the query from database itself, there is a option to stop its execution but in the code is it possible? 回答1: Yes sqlcommand.cancel is your friend http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlcommand.cancel.aspx 回答2: Yes, you can cancel the query by using

Limit execution time of an function or command PHP

梦想的初衷 提交于 2019-11-26 07:39:29
问题 Hi is there a possibility to set time limit only to a command or only to a function eg: function doSomething() { //..code here.. function1(); //.. some code here.. } I want to set time limit only to function1. There exits set_time_limit but I think this sets the time limit to whole script. Anybody any Idea? 回答1: set_time_limit() does run globally, but it can be reset locally. Set the number of seconds a script is allowed to run. If this is reached, the script returns a fatal error. The

Using perl&#39;s `system`

a 夏天 提交于 2019-11-26 06:48:54
问题 I would like to run some command (e.g. command ) using perl\'s system() . Suppose command is run from the shell like this: command --arg1=arg1 --arg2=arg2 -arg3 -arg4 How do I use system() to run command with these arguments? 回答1: Best practices: avoid the shell, use automatic error handling - IPC::System::Simple. require IPC::System::Simple; use autodie qw(:all); system qw(command --arg1=arg1 --arg2=arg2 -arg3 -arg4); use IPC::System::Simple qw(runx); runx [0], qw(command --arg1=arg1 --arg2