Does php execution stop after a user leaves the page?

It depends. From http://us3.php.net/manual/en/features.connection-handling.php: When a PHP script is running normally the NORMAL state, is active. If the remote client disconnects the ABORTED state flag is turned on. A remote client disconnect is usually caused by the user hitting his STOP button. You can decide whether or not you want a client disconnect to cause … Read more

Limit execution time of an function or command PHP

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 default limit is 30 seconds or, if it exists, the max_execution_time value defined in the php.ini. When called, set_time_limit() restarts the timeout counter … Read more

Using perl’s `system`

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=arg2 -arg3 -arg4); # ↑ list of allowed EXIT_VALs, see documentation Edit: a rant follows. eugene y’s answer includes a link to the documentation to system. … Read more

Asynchronous vs synchronous execution. What is the difference?

When you execute something synchronously, you wait for it to finish before moving on to another task. When you execute something asynchronously, you can move on to another task before it finishes. In the context of operating systems, this corresponds to executing a process or task on a “thread.” A thread is a series of … Read more

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

You can use WScript.Arguments to access the arguments passed to your script. Calling the script: cscript.exe test.vbs “C:\temp\” Inside your script: Set File = FSO.OpenTextFile(WScript.Arguments(0) &”\test.txt”, 2, True) Don’t forget to check if there actually has been an argument passed to your script. You can do so by checking the Count property: if WScript.Arguments.Count = … Read more

Gradle to execute Java class (without modifying build.gradle)

There is no direct equivalent to mvn exec:java in gradle, you need to either apply the application plugin or have a JavaExec task. application plugin Activate the plugin: plugins { id ‘application’ … } Configure it as follows: application { mainClassName = project.hasProperty(“mainClass”) ? project.getProperty(“mainClass”) : “NULL” } On the command line, write $ gradle … Read more

tech