scripting

How to increment a number in several files if the number is not always the same ?

Hi, I have several files containing this line Release: X I want to increment X in all the files. If X was constant between the files, I could have a bash script looping around the files and doing ($1 containing the former release number and $2 the new one, ie. $1 + 1) : sed 's/Release: '$1'/Release: '$2'/' <$file >$file.new Now,...

Script.Net vs Nemerle

I was looking into scripting to be incorporated into my apps. Then I bumped into Script.Net and Nemerle. I do know that they have different syntax and Nemerle supports macro but not Script.Net. But I would like to know more about their differences in terms of functionality, usage and flexibility. And which one would you recommend, why? ...

SQL Server Agent: How to "sleep"?

In a scripting step in a scheduled task in SQL Server Agent 2005, I need to trigger a webscript that is running on a different server. I'm doing this: Dim ie Set ie = CreateObject( "InternetExplorer.Application" ) ie.navigate "...to my dreamscript" ' Wait till IE is ready Do While ie.Busy (1) Loop ie.Quit set ie = Nothing At (...

Small tools/scripts that help you so much?

On top of my head, especially for C/Linux developer: ack git-bz colorgcc colordiff moap and prepare-ChangeLog Is there some tool/script you couldn't work without, but that you feel others don't know so much? For instance, I just found: cppcheck ...

What's the best way to use .NET classes from Visual Basic 6?

At my workplace I'm stuck with Visual Basic 6, but after reading the answer to "How do I sort arrays using vbscript?" I got my hopes up, that at least some of the missing VB6 features can be supplemented by .NET features. (Different kinds of collections, mostly) It seems, that at least some .NET classes are available for scripting and ...

What is the best way to backup mysql in s3?

mysqldump is probably not the best idea on running backups every x hours but is the one that we are currently using. The backups are around 150 Megs each so sending it to other machines could waste many gigs of bandwidth. Is there any tool or application or script that could automate the creation of the backup and the upload to s3 am...

How to bring files in a filesystem in/out MySQL DB?

The application that I am working on generates files dynamically with use. This makes backup and syncronization between staging,development and production a real big challenge. One way that we might get smooth solution (if feasable) is to have a script that at the moment of backing up the database can backup the dynamically generated f...

IDE that provide autocompletion and error detection for Linux bash or shell scripting?

Our dev team is looking for an IDE like vi or nano or even textpad for windows that has the capability to autocomplete and error correction for bash or shell script for linux. Basically something similar to .NET autocompletion where you will be able to see if an if[ $# -ne 5 ]; then has no space between the 5 and the ] will tell yo...

Compiling with CodeDomProvider doesn't allow new features of C# or VB

I'm compiling some C# and VB code at run time using the CodeDomProvider, CompilerInfo, and CompilerParameters. It works great, and I really like being able to add scripting support to my application, but it only seems to support .NET 2.0 syntax. For example, the var keyword isn't supported in C#, and the If(bool, string, string) expressi...

Best way to simulate "group by" from bash

Suppose you have a file that contains IP addresses, one address in each line: 10.0.10.1 10.0.10.1 10.0.10.3 10.0.10.2 10.0.10.1 You need a shell script that counts for each IP address how many times it appears in the file. For the previous input you need the following output: 10.0.10.1 3 10.0.10.2 1 10.0.10.3 1 One way to do this i...

How do I redirect output to stderr in groovy?

I'm looking for a way to redirect output in a groovy script to stderr: catch(Exception e) { println "Want this to go to stderr" } ...

Find Unique Characters in a File

I have a file with 450,000+ rows of entries. Each entry is about 7 characters in length. What I want to know is the unique characters of this file. For instance, if my file were the following; Entry ----- Yabba Dabba Doo Then the result would be Unique characters: {abdoy} Notice I don't care about case and don't need to order...

Emacs M-x commands for invoking "GUI-style" menus

Question: How could I find out the M-x equivalent commands for doing GUI-based operations in Emacs, in those cases where my Emacs-variant uses OS-specific desktop functionality? Background: Conventional understanding states that everything in Emacs is a command, and that commands can be invoked via M-x, as long as you know the name of t...

How do you typically import data from a spreadsheet to multiple database columns?

For whatever reason, I have a lot of clients that have existing data that's stored in spreadsheets. Often there are hundreds, if not thousands of items in each spreadsheet, and asking the client to manually enter them through a website (or heaven forbid importing them that way myself) is out of the question. Typically, this data doesn't ...

Monitor a set of files for changes and execute a command on them when they do.

The (command line) interface I have in mind is like so: watching FILE+ do COMMAND [ARGS] (and COMMAND [ARGS])* Where any occurrence of "{}" in COMMAND is replaced with the name of the file that changed. And note that "do" and "and" are keywords. For example: > watching foo.txt bar.txt do scp {} somewhere.com:. and echo moved {} to ...

What is a good scripting language for basic file operations?

I often need to copy, move or rename files and directories based on some criteria as I collect data from many resources and I like to keep things organized. What scripting language provides the most intuitive and easy to use methods for these operations? Here is an example scenario: I keep my music in a folder hierarchy like below: &Ar...

Scripting inside a Python application

I'd like to include Python scripting in one of my applications, that is written in Python itself. My application must be able to call external Python functions (written by the user) as callbacks. There must be some control on code execution; for example, if the user provided code with syntax errors, the application must signal that. ...

How to disable "ActiveX Control May Be Unsafe" popup

In an HTML file on My Computer, I'm trying to use the Scripting.FileSystemObject in a script. How can I disable the popup saying "Any ActiveX control on this page may be unsafe for scripting"? The "Internet Options" Security pane allows one to set "Initialize and script ActiveX controls not marked as safe for scripting" to Enabled for v...

Download from EXPLOSM.net Comics Script [Python]

So I wrote this short script (correct word?) to download the comic images from explosm.net comics because I somewhat-recently found out about it and I want to...put it on my iPhone...3G. It works fine and all. urllib2 for getting webpage html and urllib for image.retrieve() Why I posted this on SO: how do I optimize this code? Would RE...

How to prevent deep linking to files on my website

I own a website which contain a lot of freeware stuff to download on it. The problem I'm facing is that people from around the world are taking the direct links of the files (for example .zip files) and posting them on their websites and general forums. I am getting a huge amount of bandwidth and that's ok, but the number of pages visi...