scripting

How can I use rsync to backup files changed within a recent period?

Is it possible to specify a time range so that rsync only operates on recently changed files. I'm writing a script to backup recently added files over SSH and rsync seems like an efficient solution. My problem is that my source directories contain a huge backlog of older files which I have no interest in backing up. The only solution I...

Overcoming a badly behaving Linux process?

I have a badly behaving process (launched via a user command) which keeps dying at erratic intervals, and I need it to stay alive till I manually kill it. Here is my straight, but probably stupid solution: #!/bin/bash if [ -z $1 ] then echo "Usage: /s98ize.sh <process name>" exit fi #start of the 'polling' loop while [ 1 ] do pgre...

Where Is Browser Javascript Stored and Executed?

Hi all, When javascript is run in a browser alert('Hello World'); What environment executes it and manages it in memory? I know this is vaugue! But thats the best place to start! ...

Change password in Task Scheduler in script

I'm changing password every month for all scheduled tasks I created in Task Scheduler. This is because our security policy expires our password every month. Due to increasing number of scheduled tasks I'm creating, it eats up a lot of time in just changing password within Task Scheduler. My question is: Is there a way in script to cha...

how to detect use of Perforce's "reopen for edit" from a script

I'm working on a script to interact with Perforce, which among other things needs to be able to understand pending changelists. For this I use 'p4 describe' and 'p4 opened', which are pretty straightforward. For instance, a file opened for edit shows up like this (from p4 opened): //source/stuff/things.h#1 add default change (text) Wh...

Grant SeServiceLogonRight from script

I need to be able to grant rights to a user from a script (a batch file or JScript file). In particular, I want to grant SeServiceLogonRight to a particular domain account. I can't use NTRights.exe (not available on all target OS's), and I'd like to avoid having to write an executable in C just for this. Is it possible to do this with st...

Color output from shell command in Ruby

Here's a simple Ruby script: puts `ls -laG` In OS X's ls, -G is for color. When run under bash, I get color output. When the above is run from a Ruby script, I don't see color or the ANSI escape sequences in the resulting output. From what I've read, my guess is it's because the script isn't running as a tty. Is there some way to ru...

How to manage files and dirs under WSH?

Is it possible to manage files and directories (i.e. get a directory's content, create/copy/delete files, etc.) usig javascript in WSH ? I did a quick look at MSDN and I cant find an object that let me do that. ...

Scripting individual database objects

I have a database I have inherited, and my best practice is to create the scripts to create the objects (tables, stored procedures and views) and then version control these. It would like to have all the objects in this database scripted out, and put into source control; but on SQL Server 2005 (SQL Server Management Studio) it appears -...

Javascript Object vs JScript Dictionary

Javascript Objects and JScript Dictionary are both associative Arrays obj = new Object ; dic = new ActiveXObject("Scripting.Dictionary") ; My question is... Is there any difference between them in terms of efficiency (either space or time) ?? In terms of functionality, I know a Dictionary is better because it allows more than just sca...

Which version of MSXML should I use?

Seems like this would be a common question, though I could not find it on SO. Which version of MSXML should I use in my applications, and more importantly, how should I decide? There is MSXML3, 4, 5 and 6. I recently posted some code in calling-wcf-service-by-vbscript that used MSXML v4. AnthonyWJones posted that I shouldn't use 4...

where are my visitors going?

What is an easy way to track which external links visitors click on (on my site)? I don't want to route them through my page, e.g., href = $my-url?url=$external-url. Is there an easy JavaScript-solution? ...

Better than MSDOS batch files?

Is there something better than using MSDOS in a bat file to run commmand line operations and copy files around. I am running into the old chestnut "gotchas" with long file names etc - and for some reason the bat file wont pause - when I insert PAUSE in my script after running a command - it's just annoying. Whats better out there? Che...

Powershell.exe running the script in cli, or a wrapper?

Hi all! I have a third-party application that's extensible by adding exe-files that perform dataconversion etc. I've written an extension in Powershell that does the conversion I want, but I'm unable to get the third-party app to run my ps1, as it will only accept an .exe file as an extension. The app adds a filename as the first (and o...

Using a Script to automate data entry to an OpenOffice Calc Spreadsheet

I would like to be able to automate creating spreadsheets and adding data to an OpenOffice spreadsheet using a script (any scripting language is acceptable - PowerShell, Python, or even JavaScript). What is a suitable library or tutorial? ...

Using bash what scripts or commands do you use to make you more productive?

What scripts do you regularly use to improve your productivity? Over the last year I have been trying to use bash scripts and commands to improve my productivity as a developer (Web and applications). Here is a list of a few simple ones that I use: Make files lower case: for i in *.txt; do mv "$i" "`echo $i| tr [A-Z] [a-z]`"; done ...

How can I prevent IE Caching from causing duplicate Ajax requests?

We are using the Dynamic Script Tag with JsonP mechanism to achieve cross-domain Ajax calls. The front end widget is very simple. It just calls a search web service, passing search criteria supplied by the user and receiving and dynamically rendering the results. Note - For those that aren’t familiar with the Dynamic Script Tag with Jso...

How can I intercept errors from gzip so cron doesn't see them?

So, OK, the job runs in cron: it fetches compressed files and processes them. If the files are corrupted, it deletes them. Sometimes they are bad on the remote server, in which case they will be downloaded and deleted each time. My cron logs extensively to STDOUT (directed to logfile in .crontab), using STDERR only for things that cause...

Powershell script to check application that's locking a file?

How will I do this in powershell. I like to check which process/application is using the file, so that I can close it. Thanks. ...

Arranging my music folder according to ID tags

Hello I'd like to write a script that arranges my music folder to sub folders. Is there an existing script that already does that? How will you write your own? What language will you choose? ...