scripting

Delete all files if another files in the same directory has a matching occurence of a specific word

I have several files in a specific directory. A specific string in one file can occur in another files. If this string is in other files. Then all the files in which this string occured should be deleted and only 1 file should remain with the string. Example: file1 ShortName "Blue Jeans" price 89.47 cur EURO file2 ShortName "Blue Jea...

Subversion post-commit script to update working-copy

Hi, Im having issues with a simple post-commit script. The goal is to update a different working-copy if a special keyword is present in the commit message: The script im using for testing is: #!/bin/bash REPO="$1" REV="$2" TEST_SERVER="localhost" PROD_SERVER="172.16.16.1" # Check for a deployment signal if ( svnlook log -r...

Execute php script every 40 miliseconds?

There is some way to execute a php script every 40 miliseconds? I don't know if cronjob is the right way, because 25 times per second require a lot of CPU. Well, If php isn't the correct language, what language I should use? I am making a online game, but I need something to process what is happening in the game, to move the characters...

How can I make my batch script for deletion of old files work?

Inside a folder (say c:\test) I want to delete the oldest file if the number of files are over 21. This is what I came up with, issue is that it one time deletes the oldest file, second run it does nothing and deletes the oldest for third, continues like that. Also it doesn't care if the file amount is lower than 21, deletes even if it ...

Copy data from Access to SQL

I am in the process of migrating an existing Access database to a SQL database with a web front-end. I have successfully copied the database to SQL using the SQL Server Migration tool and am working on developing the application. For reasons I won't go into here we cannot just link the Access front-end to the SQL DB and use the SQL DB as...

Running vim command over multiple buffers/tabs

I have a command to tidy up excessive whitespace in my code in vim: " to tidy excess whitespace map <leader>1 :execute ':%s#\s\+$##g'<CR> My question is, if I have 10 tabs or buffers open, how can I apply this command to all of them, rather than just going to each one and applying the command. Thanks, Stephen ...

Bourne Shell Scripting -- simple for loop syntax

I'm not entirely new to programming, but I'm not exactly experienced. I want to write small shell script for practice. Here's what I have so far: #!/bin/sh name=$0 links=$3 owner=$4 if [ $# -ne 1 ] then echo "Usage: $0 <directory>" exit 1 fi if [ ! -e $1 ] then echo "$1 not found" exit 1 elif [ -d $1 ]...

Scripting After Effects

I need to learn Affect Effect expressions and scripting fast. Can you recommend any resources on this topic? I've got a pretty knowledge of other scripting concept and languages like javascript. I just need the know-how on after effect scripting itself.. I'm using AE9 Thanks a mill! ...

sh - Build string containing paths

I'm building a small shell script for finding cat/man pages on a wide range of unix systems... in bash, I could build all possible paths by doing this: # default search paths default=$(echo /usr/{share, local, dpkg, XR11}/man/{man, cat}{1..8}) for path in $default do ... done Unfortunately, I'm forced to use sh... I could build th...

ASP.NET: Appending to HTTP response

I have a Page.aspx. I would like to inject a <script> tag into the response stream of Page.aspx, after it has finished writing its output. How could I do this form within the codebehind of Page? If I do this: protected void Page_Load(object sender, EventArgs e) { this.ClientScript.RegisterClientScriptInclude ...

Bash scripting on Android

Has anybody tried bash scripting on android? I tried to write a simple script on Android's bash shell through adb. I tried the following script which works for me: #sh1 x="hello" echo "$x" But when I do: #sh1 x="hello" if [ -n "$X" ]; then echo "hi" fi The error says [ -n not found! Why do I get this error and is there a work ...

CompositeScriptRefernce

Hi, I'm trying to add a composite scriptreference like this; ScriptReference scriptReference = new ScriptReference("CSSFriendly.JavaScript.MenuAdapter.js", "CSSFriendly"); scriptReference.NotifyScriptLoaded = false; scriptManager.CompositeScript.Scripts.Add(scriptReference); In the CSSFriendly assembly the script resource is defined; ...

VIM: Automatically adding menu-items for scripts from a particular directory

I have a number of scripts (Ruby as it happens) I run from VIM, by setting up the startup file to contain (for instance): amenu Ruby.script1 :%!ruby C:\ruby_scripts\script1.rb<cr><cr> amenu Ruby.script2 :%!ruby C:\ruby_scripts\script2.rb<cr><cr> ... What I would like to do, is to have VIM automatically check the C:\ruby_scripts direct...

Why can't I call javac using the Backquotes/Backticks approach in Ruby?

I am trying to compile a java source file via a Ruby Script. However I am a bit puzzled by the following behavior compile_results = `javac #{source_file}` this fails to run with a 'No such file...' error. I popped up irb irb(main):001:0> `javac -help` Errno::ENOENT: No such file or directory - javac -help from (irb):1:in ``'...

How to kill main thread from sub thread in Jython

I have a script that creates a thread which after 60 seconds (this thread) needs to kill the main thread. I`m not sure what command I can use to kill the main thread. I'm using Jython 2.5.1 and Thread.interrupt_main doesn't work. Here is the code: import threading def exitFunct(): #exit code here t = threading.Timer(60.0, exitFunc...

choosing even-numbered rows from a file

How do I choose even numbered rows of a file? I wish to select rows #2, 4, 6, etc. from a file that contains data. Can anyone help me with this? ...

How to download HTML using PHP?

How do I download an HTML file from a URL in PHP, and download all of the dependencies like CSS and Images and store these to my server as files? Am I asking for too much? ...

How much access should an OS give to web-based scripting?

I've been thinking about the access web-based applications have to an OS. I'm curious: What is the best way of determining this as it currently stands? Is the trend leaning toward more, or less access? What functionalities should be open/closed? A simple example would be.. say your g-mail alerted you in the task-bar when an incomi...

Wrapping a Lua object for use in C++ with SWIG

Currently I know how to have C++ objects instantiated and passed around in Lua using SWIG bindings, what I need is the reverse. I am using Lua & C++ & SWIG. I have interfaces in C++ and objects in lua, that implement methods which do the same job and have the same structure. I would like to be able to instantiate these objects in lua y...

Algorithmically suggest best node to perform demanding computation

Dear Overflowers: At work we perform demanding numerical computations. We have a network of several Linux boxes with different processing capabilities. At any given time, there can be anywhere from zero to dozens of people connected to a given box. I created a script to measure the MFLOPS (Million of Floating Point Operations per Sec...