scripting

Running scripts inside C#

I want to run javascript/Python/Ruby inside my application. I have an application that creates process automatically based on user's definition. The process is generated in C#. I want to enable advanced users to inject script in predefined locations. Those scripts should be run from the C# process. For example, the created process will...

Dynamic Client Script

I need to write a java script. This is supposed to validate if the checkbox is selected in the page or not. The problem here is that the check box is inside a grid and is generated dynamically. The reason being the number of check box that need to be rendered is not know at design time. So the id is know only at the server side. ...

SQLplus script to format text as numeric

I am selecting rows from a table, but some of the columns are a text type, but they always have numeric data in them. How can I format them as numbers? e.g. column quantity heading 'Quantity' format 999,999 However, since the column in the table is text, the numeric formatting is ignored. ...

How to save file using Eclipse Monkey?

Hey, I've recently started working with Aptana and Eclipse Monkey. What I want to do now is to create a script that saves a file then uploads it to a FTP. Problem is that Eclipse Monkey is VERY poorly documented and Google returned only unrelated results. I've made it upload the file, but I need the script to save the file before uplo...

Automatically folding #defines in vim

I work with quite a bit of multi-platform C/C++ code, separated by common #defines (#if WIN, #if UNIX, etc). It would be nice if I could have vim automatically fold the sections I'm currently not interested in when I open a file. I've searched through the vim script archives, but I haven't found anything useful. Any suggestions? Plac...

How to determine the line ending of a file

I have a bunch (hundreds) of files that are supposed to have Unix line endings. I strongly suspect that some of them have Windows line endings, and I want to programmatically figure out which ones do. I know I can just run flip -u or something similar in a script to convert everything, but I want to be able to identify those files that ...

How do I use Inno Setup to optionally install a plugin/file in a folder based on a registry entry?

Inno Setup is a nice easy to use installer. It is rated high in this stackoverflow question. I have a need to install a plugin to a folder relative to the installation folder of a 3rd Party application. It isn't obvious from the docs how to do this. ...

What is a simple command line program or script to backup SQL server databases?

I've been too lax with performing DB backups on our internal servers. Is there a simple command line program that I can use to backup certain databases in SQL Server 2005? Or is there a simple VBScript? ...

Shell script to recursively browse a directory and replace a string

I need to recursively search directories and replace a string (say http://development:port/URI) with another (say http://production:port/URI) in all the files where ever it's found. Can anyone help? It would be much better if that script can print out the files that it modified and takes the search/replace patterns as input parameters. ...

Automatically mounting NTFS partition on FreeBSD at boot time

I am looking for the way to mount NTFS hard disk on FreeBSD 6.2 in read/write mode. searching google, I found that NTFS-3G can be a help. Using NTFS-3G, there is no problem when I try to mount/unmount NTFS manually: mount: ntfs-3g /dev/ad1s1 /home/admin/data -o uid=1002, or umount: umount /home/admin/data But I have a problem when ...

What is the best scripting language to embed in a C# desktop application?

We are writing a complex rich desktop application and need to offer flexibility in reporting formats so we thought we would just expose our object model to a scripting langauge. Time was when that meant VBA (which is still an option), but the managed code derivative VSTA (I think) seems to have withered on the vine. What is now the best...

batch scripting iterating over files in a directory

How could I iterate over each file in a directory using for? And how could I tell if a certain entry is a directory or if it's just a file? ...

Checking Unix script ftp return codes.

I am currently creating an overnight job that calls a Unix script which in turn creates and ftps a file. I would like to check all possible return codes. The unix man for ftp doesn't list return codes. Does anyone know where to find a list? Anyone with experience with this? We have other scripts that grep for certain return strings ...

IE Script debugging pop up

In order to debug an asp.net web app I have to have IE Script debugging enabled. Unfortunately, in the past week or so google's analytics javascript has developed a problem. So that when I browse to a site that has google analytics I receive the little pop up "A runtime error has occurred. Do you wish to debug?" Yes, even stackoverfl...

Can network interfaces be bridged "automatically" with Windows?

I'm working on a portable device, that when I connect it to a windows machine (over USB), it shows up as a seperate network interface to the PC. This is great, except when I want to connect several devices together, and want them to all be on the same network (subnet). I'm looking for the ability to bridge network interfaces together au...

Java: Scripting language (macro) to embed into a Java desktop application

I am writing a graphics application in Java. Eventually I would like to build in a scripting language so things are programmable. Which language library do you recommend? Likely suspects are: Rhino (JavaScript) JRuby (Ruby) Jython (Python) Less likely candidates are: Whip up my own language using JavaCC LuaJava (Lua) Groovy JavaFX...

Which scripting language should I learn after Perl?

Hi, I have used Perl for many years now, mostly for doing all kinds of file parsing and system scripting jobs. Several newer scripting languages (python, ruby) are now available, that all in part tend to address scripting etc. in a better way than Perl apparently did. If I would have to choose learning a new scripting language, which ...

How can I write a shell script to direct grep data into a date-based filename?

I basically want to do this: grep 'example.com' www_log > example.com.YYYY-MM-DD-H:i:S.log ...with of course the filename being example.com.2008-09-27-11:21:30.log I'd then put this in crontab to run daily. ...

Loading .sql files from within PHP

I'm creating an installation script for an application that I'm developing and need to create databases dynamically from within PHP. I've got it to create the database but now I need to load in several .sql files. I had planned to open the file and mysql_query it a line at a time - until I looked at the schema files and realised they are...

Call a Mathematica program from the command line, with command-line args, stdin, stdout, and stderr.

If you have Mathematica code in foo.m, Mathematica can be invoked with -noprompt and with -initfile foo.m (or -run "<<foo.m") and the command line arguments are available in $CommandLine (with extra junk in there) but is there a way to just have some mathematica code like #!/usr/bin/env MathKernel x = 2+2; Print[x]; Print["There were ",...