scripting

How to: assign vim cursor to a certain line in the window and have the text scroll underneath that cursor position?

You can keep the cursor line in the middle of the screen and then have the text scroll underneath it by setting the scrolloff to a very large number. Ex: :let &scrolloff = 999 To read more about how this works: :help scrolloff I love this feature and use it all the time but I would like the ability to keep the cursor at other locat...

how to use a variable in oracle script for the table name

I have an pl\sql script where I want to set the table name used in the script to a variable. So, from some examples I found on the web, I wrote the code below. The first section works, so I think my general syntax is correct,but the second section, where I attempt to use a variable for a table name it errors ("SQL Error: ORA-00903: inv...

List circular group membership from active directory

We have 40K+ groups in our active directory and we are increasingly facing problem of circular nested groups which are creating problems for some applications. Does anyone know how to list down the full route through which a circular group membership exists ? e.g. G1 --> G2 --> G3 --> G4 --> G1 How do I list it down. ...

"eval" in Scala

Can Scala be used to script a Java application? I need to load a piece of Scala code from Java, set up an execution scope for it (data exposed by the host application), evaluate it and retrieve a result object from it. The Scala documentation shows how easy it is to call compiled Scala code from Java (because it gets turned into to re...

PowerShell Runspace vs DLR

With the .NET 4.0 beta now available, and thus the wider availability of the .NET Dynamic Language Runtime, I guess these kinds of topics are going to become "hotter". I'm confused about the conceptual differences between the DLR and PowerShell. It seems to me that if I want to provide scripting capabilities in my .NET app, I can use...

excluding first and last lines from sed /START/,/END/

Consider the input: =sec1= some-line some-other-line foo bar=baz =sec2= c=baz If I wish to process only =sec1= I can for example comment out the section by: sed -e '/=sec1=/,/=[a-z]*=/s:^:#:' < input ... well, almost. This will comment the lines including "=sec1=" and "=sec2=" lines, and the result will be something like: #=sec...

Is there a way in Ruby/Rails to execute code that is in a string?

So I have a database of different code samples (read snippets). The code samples are created by users. Is there a way in Rails to execute it? So for example I have the following code in my database (with id=123): return @var.reverse Is there a way for me to execute it? Something like: @var = 'Hello' @result = exec(CodeSample.find(...

How do I run a java program from a different directory?

I have a java program that I would like to be able to run from anywhere on my machine. I would like to run it from my Cygwin command prompt. I've made scripts to call the java program. I added the location of the java program to the classpath, and the scripts work when I run them from the java program's directory. However, when I try...

Batch Scripting, For using the results of a dir

Hi All, I'm trying to write a small batch script that will delete files old files from a directory. The first parameter is the directory for the script to look into, and the second is the number of files to preserve. rem @ECHO OFF rem %1 is the path in which to look for the files rem %2 is the number of recent files to preserve if [%...

Shell Script Search and Delete Non Text Files

Hi, I want to write a shell script to search and delete all non text files in a directory.. I basically cd into the directory that I want to iterate through in the script and search through all files. -- Here is the part I can't do -- I want to check using an if statement if the file is a text file. If not I want to delete it else c...

How to define variables and constants for a linux user account?

Say I created a linux user account called john. John wants to create a variable called MYVAL with the value Hello World in the linux shell (bash) MYVAL = 'Hello World' John does not want to redeclare this variable every time he logs in. Is there some linux config file or start up file that john can declare this variable in such that it...

What are reasons to choose a scripting language over C#?

What are reasons to choose a non DSL scripting language over statically compiled language such as C#? -edit- Good answers so far. I feel I should explain further. I am pretty sure people use Python over C# for more reasons than just taste and C# over Python for other situations. ...

What are good environments for running high-memory-consuming (Python/Perl) scripts?

I'm looking for suggestions on new development system from some programmers that have more experience, but let me give some background on why. We need a new development server for running scripts on large feeds Speed is not a concern, it just needs to finish The scripts are not ran often, and are typically coded very quickly (not o...

Embedded script languages for PHP?

Hi, i was wondering if anybody knows of a nice scripting language that can be embedded into php? Javascript would be favorite and although there are several attempts they are either much too shaky/slow/outdated (phpjs, j4p5) or a real pain to get up and running on shared hosts (pecl spidermonkey). The background is: I would like to ha...

Subscript out of range error in vbs script

I'm trying to move my entire User folder in Vista to a non-system partition. To do so with a minimum hassle I'm following the directions provided at Ben's Blog, specifically the vbs script he provides. However executing the script throws up an error which I can't resolve myself. Here's the vbs code followed by the text file it calls on, ...

Equivalent to Unix eval in Windows

Was wondering how you'd do the following in Windows: From a c shell script (extension csh), I'm running a Python script within an 'eval' method so that the output from the script affects the shell environment. Looks like this: eval `python -c "import sys; run_my_code_here(); "` Was wondering how I would do something like the eval sta...

Source shell script into environment within a ruby script

If I'm writing a shell script and I want to "source" some external (c-)shell scripts to set up my environment, I can just make calls like this: source /file/I/want/to/source.csh I want to replace a shell script that does this with a ruby script. Can I do a similar thing in the ruby script? Update: Just tried it with test_script.csh: ...

How expand a CMD shell variable twice (recursively)

Using the Windows XP CMD command-line I can expand a variable twice as follows: set AAA=BBB set BBB=CCC for /F "usebackq tokens=*" %i in (`echo %%AAA%%`) do echo %i will echo CCC. I.e. AAA has been expanded to the string BBB, and then the variable BBB has been expanded to CCC. This doesn't work from inside a batch script (i.e. a .cmd...

Value of global variable doesn't change in BASH.

I am working on a BASH script which has a global variable. The value of the variable changes in a function/subroutine. But the value doesnt change when I try to print that variable outside the function. The Sample code is as follows: #!/bin/bash count= linux_f() { let count=100 } linux_f echo $count The echo statem...

VB6 - LUA Integration

I'm wondering if anyone has any tips for integrating LUA and VB6. I am running a small Online RPG that would be awesome to add some scripting to. ...