I have the following:
ScriptEngineManager mgr = new ScriptEngineManager();
ScriptEngine jsEngine = mgr.getEngineByName("JavaScript");
jsEngine.eval("function getArray() {return [1,2,3,4,5];};");
Object result = jsEngine.eval("getArray();");
How can i convert the result object which is of type sun.org.mozilla.javascript.internal.Native...
Hi,
I want to write a generic awk script that can take as input a file and a field number (in that file) and give me the average value of that field in that file. I would use it something like this:
bash$ avg.awk 3 input.file
22
bash$ avg.awk 4 input.file
2001
Of course, I can write the script if I know which field (e.g., $3) I am go...
Is there a PHP framework that doesn't force me to use a single index.php as the entry point, or an MVC architecture? Because I need to develop something in my own way, with features like Authentication, Security, Crypto, Database CRUD and the like, and so a framework of some sort could help. Is this RAD?
...
How do I create message queue in PHP, such that it can be modified and read by 2 different scripts running at the same time? Or is it better to use a database for this?
...
Does PHP have global variables that can be modified by one running script and read by another?
...
How can something like the following be done in a PHP script?
code{
$result1 = task1() or break;
$result2 = task2() or break;
}
common_code();
exit();
...
How can a PHP script detect if a socket has been closed by the remote party?
...
I first configure my script to run even after the HTTP request is over
ignore_user_abort(true);
then flush out some text.
echo "Thats all folks!";
flush();
Now how can I trick the browser into thinking the HTTP request is over? so I can continue doing my own work without the browser showing "page loading".
header(??) // someth...
I have a problem replacing a command inside of a script, the offending line in the script looks like this:
mail -s "$(hostname) on $(date)"
It should be replaced with a line like this:
nail -r "[email protected]" -s "Subject" -S smtp=255.255.255.255
But I can't get sed to do a replacement :) I wrote a small script for that purpose:...
The web application my organization has written to perform customer care functions doesn't have this ability. I know there are Firefox plugins to automate the browser, but what I'd like to do is provide a framework and facility to manage and execute scripts through our web application.
The user would write scripts that checked on commis...
I want to remove all lines where all the second column 05408736032 are same
0009300|05408736032|89|01|001|0|0|0|1|NNNNNNYNNNNNNNNN|asdf| 0009367|05408736032|89|01|001|0|0|0|1|NNNNNNYNNNNNNNNN|adff|
these lines are not consecutive. Its fine to remove all the lines . I dont have to keep one of them around.
Sorry my unix fu is really w...
Is there a script somewhere (doesn't matter what language although it would be best if it can run on linux) that can fetch for simple things from the hotmail/live mail web page? Of course the main motivation for this is that hotmail does not allow for IMAP access and their pop access is limited to 15 minute check and YET still does not p...
So I have .csh script generate.csh
I want to call another .csh script from within it.
I tried
./shell_gen.csh test1 test2.prt
But it runs shell_gen.csh but without command line arguments.
Anyone?
Thanks
generate.csh
#!/bin/csh
./shell_gen.csh test1 test2.prt
shell_gen.csh
#!/bin/csh
set source = output
########################...
I have inherited a fairly large codebase, 90% C++, and I need to get up to speed on it quickly. There are hundreds of .cc files in a wide directory tree structure.
It's fairly complex, and has no logging. In order to figure out how some major subsystems work, I want to insert a function call into every function.
E.g., given a .cc f...
Hi there,
I need to create a script that backups a couple of files on a SVN repository during the night, since the files are secure I can commit them without entering a username (is that even possible?) or password.
Possible solutions I came up with:
- creating a dummy user without password or with a known password but this poses a se...
Is there way to delete duplicate lines in a file in Unix?
I can to it with sort -u and uniq commands. but I want to use sed or awk.
Is that possible?
...
I have a script running in the background that prints some output. I redirected the standard output to a file for log purposes. However I don't want this file to grow forever, what would be a good way to do rollover without coding the logic myself? (Either rollover based on date or file size).
...
I do a bunch of json requests with dynamic script tags. Is it possible to detect if there's an error in the request (eg. 503 error, 404 error) and run something on detection of the error?
...
How can a PHP script start another PHP script, and then exit, leaving the other script running?
Also, is there any way for the 2nd script to inform the PHP script when it reaches a particular line?
...
Hello.
I have this .xml file http://www.anitard.org/layouts/blogger_layouts/spicenwolf/spice_and_wolf_www.anitard.org.xml
When i make a link to this in my website you will try to view that document, but that is not possible.
How do i make it downloadable? So when i click on my link the .xml document will request to download it.
...