scripting

In Powershell, what's the best way to join two tables into one?

I'm fairly new to Powershell, and am wondering if someone knows of any better way to accomplish the following example problem. I have an array of mappings from IP address to host-name. This represents a list of active DHCP leases: PS H:\> $leases IP Name -- ---- 192.168.1.1 Apple 192.16...

simple encryption tutorial?

I'm looking for a simple encryption tutorial, for encoding a string into another string. I'm looking for it in general mathematical terms or psuedocode; we're doing it in a scripting language that doesn't have access to libraries. We have a Micros POS ( point of sale ) system and we want to write a script that puts an encoded string on...

deleting brackets in a file using sed

Can anyone help me in deleting brackets in a file ? here is my script .. #!/bin/bash for file in fftw is_c mpi_tile pmb tau xhpl do for state in C0 C1 C2 C4 do printf "${file}_${state}_v1.xls" sed -e 's/\(//' ${file}_${state}_v1.xls sed -e 's/\)//' ${file}_${state}_v1.xls awk '{sum+=$3} ; END {print " ", su...

How to reset a variable to NULL in PHP?

I can use isset($var) to check if the variable is not defined or null. (eg. checking if a session variable has been set before) But after setting a variable, how do I reset it to the default such that isset($var) returns false? ...

Kill Running PHP Script via Process ID?

Hello all, I make lots of GET requests to several PHP scripts via AJAX. I want to ask for implementation advice on how to kill a PHP script that is currently running (in the background). Is there some way to get the PHP scripts process ID when it runs and then I can probably kill that process via shell/cmd etc? Is there a better way? ...

Using apple's Automator to pass filenames to a shell script.

I have an automator script that I'd like to run on a folder. I want the script to take each file in the folder and run my shell command on it. Automator is set to pass input to stdin, but I don't think I'm using stdin correctly below, can you help please? for f in "$@" do java -Xmx1000m -jar /Users/myprog/myprog.jar $f done ...

How can I implement scripting in my game?

I'm trying to write a game and implement scripting so that later on in development I won't have to recompile everything when I want to change numbers. My problem is that I don't know how scripts should interface with the game. The scripting language I'm using is angelscript. Right now, I have a state: the intro state, which I'm using a...

XArgs command on cygwin is mangling file paths

I'm trying to use xargs on a Cygwin Windows system to remove SVN files deleted locally. I run the following command that generates the following output: svn status | grep '^\!' | sed 's/! *//' weblings-webplatform\vendor\jetty-7.0.0.pre5\contexts-available\test-annotations.d\META-INF\MANIFEST.MF weblings-webplatform\vendor\jetty...

awk save command ouput to variable

I need to execute a command per line of some file. For example: file1.txt 100 4 file2.txt 19 8 So my awk script need to execute something like command $1 $2 $3 and save the output of command $1 $2 $3, so system() will not work and neither will getline. (I can't pipe the output if I do something like this.) The restriction to this ...

CAMEL is processing the file before the "mv" command completes

We are facing a problem in our monitor script. The flow of the program is Customer ftp/sftp the file (in .csv format) to "source" directory Bash script renames the completed .csv file to .aaa file Another Bash script moves the ".aaa" file to "destination" directory and renames the file back to ".csv" CAMEL is monitoring the "destinati...

How to read string from file using Groovy in QuickBuild

Please, some help to newbie in QuickBuild. I have a lot of versions stored in text files. To start build process I need to retrieve it and run some scripts in shell. My answer is, how to read from the file using QuickBuild environment? I know that it supports Groovy, MVEL and OGNL languages but I'm not familiar with no one of them. Tha...

Script to open executables and snap to top left hand corner of desktop

Hi guys I was just wonderin' in a .bat file, if there was a way to call an external .bat file, or even an *.exe and make it open so it 'snaps' to the top left hand corner of the screen ? Cheers ...

Nsis - changing installation directory.

Currently I am in my installing directory say c:\Program File\My installer.I have to execute a demo.bat file that is stored at some other location say c:\Program Files\Temp\example.bat,which I have to go at that location and execute coz my example.bat has some support files that are only stored in Temp folder. My question is how can I c...

Is there a Java Scripting Language that Can Work Without Caching? Jython? Groovy? etc?

Hi all, We have an existing java-based heavyweight project that needed an interactive script interpreter. After a fair amount of research we eventually ended up with Jython, one of the reasons being that the customer's group already has a large amount of python expertise, and it's an easier sell to give them an api in a language c...

security problem with Java ScriptEngine

I just started to use the Java ScriptEngine to do little extensions to my Application then i noticed that i can import all the java classes in the script and use them without restrictions. Is there a way to specify what classes a script can use? I dont want them to do things like java.lang.System.exit(1); ...

Difference between launching a script with ./script.sh and . ./script.sh

Please tell me what is the difference in bash shell between launching a script with ./script.sh and . ./script.sh? ...

<%= Session.Timeout * 19 * 1000 %>

What is the actual time of session timeout here is it 19 minutes ? <%= Session.Timeout * 19 * 1000 %> <script language="javascript" type="text/javascript"> setTimeout('SessionTimeout()', <%= Session.Timeout * 19 * 1000 %>); function SessionTimeout() { alert(<%= "'Session time out!!'" %>); window.location = "D...

Session time out

<script language="javascript" type="text/javascript"> setTimeout('SessionTimeout()', <%= Session.Timeout * 60 * 1000 %>); function SessionTimeout() { alert(<%= "'Session time out!!'" %>); window.location = "Default.aspx" } </script> Does the above code will help in session time out ? If so how many minutes? ...

InfoPath window.dialogArguments from UI.ShowModalDialog is null

I have been asked to fix a piece of legacy code that doesn't work. I don't know whether this ever worked, but it looks OK to me as per the documentation and examples. Our InfoPath form uses the 2003 object model. Its FormCode.cs calls other assemblies one of which contains the line: moderatorId = (string)thisXDocument.UI.ShowModalDialo...

how (in maya) can i get the 3D position of the mouse?

hello... i have created a dragger context in maya using the following code, pos holds my 2D coordinates of mouse cursor, i want to convert it into 3D coordinate to be the source of the ray i want to launch,, i want it either through python scripting or through the python api,, import maya.cmds as mc mc.draggerContext( 'testContext', ...