scripting

Is there a standard way to make sure a python script will be interpreted by python2 and not python3?

Is there a standard way to make sure a python script will be interpreted by python2 and not python3? On my distro, I can use #!/usr/bin/env python2 as the shebang, but it seems not all distros ship "python2". I could explicitly call a specific version (eg. 2.6) of python, but that would rule out people who don't have that version. It se...

How to sort rows in a text file in Perl?

I have a couple of text files (A.txt and B.txt) which look like this (might have ~10000 rows each) processa,id1=123,id2=5321 processa,id1=432,id2=3721 processa,id1=3,id2=521 processb,id1=9822,id2=521 processa,id1=213,id2=1 processc,id1=822,id2=521 I need to check if every row in file A.txt is present in B.txt as well (B.txt might have...

Be notified when a file is dropped into a folder Mac OS X

Hi I want to write a little script on my Mac. This script will basically look for new files in a particular folder, and move them to another location when some are found. So I was about to write something very basic, with an infinite loop, and I was wondering if something a bit more nice already exist ? Like a Listener or something I ...

Adding program arguments to C

How can I load the batch file console to my C console? I know in batch The command is Showme.bat /B and it'll load the console into whatever console you called that file from. What would that be in C? ShellExecute(NULL,"open","Showme.bat",NULL,NULL,SW_SHOW); Also, doing that... How could I also add additional arguments such as >>...

.bat Merging header.txt to all *.txt files

I have a file called header.txt I want this file to be prepended (first line) to all *.txt files in the same directory. How could I achieve this? Thanks in advance, Joe ...

how to lock all the streams under integration stream in clearcase in UCM

how to lock all the streams under integration stream in clearcase in UCM ...

How to determine network name in a proxy script?

I need to create automatic proxy confituartion script (*.pac). I need to determine the name of the connected network (windows 7 shows it in network and sharing center). If the name matches specific name, the proxy address will be XXX.XXX.XXX.XXX:8080 with name and password NNNN and PPPP, else there will be no proxy. ...

Best(?) way to make a popup menu for semi-portable shell scripts?

Basically I would love to say: echo `grep ^foo /usr/share/dict/words | popup_menu` ...and have some type of keyboard navigable menu popup or selection tool, very similar to how vim's ":Explore" mechanism works. Extreme bonus points for "easy and works pretty much everywhere with standard tools" Also acceptable is "needs some sort ...

need to connect to two different db from sqlplus

I need to take information from two different data bases. select * from TABLE_ONDB2 where column_on_db2 in ( select column_on_db1 from TABLE_ONDB1 ); Problem is both are on different db instances so I am not able to figure out how to put table names and column names etc. I hope my question is clear. ...

git post-commit hook - script on commited files

Hello, Can I see somewhere an example post-commit hook to run a script on each commited file? eg. git add file1 git add file2 git commit -am "my commit" and the hook executes: myscript -myparams "file1" myscript -myparams "file2" The best would be to have parameter to commit command to run this hook or not, eg. git commit -X… e...

How does Perl interact with the scripts it is running?

I have a Perl script that runs a different utility (called Radmind, for those interested) that has the capability to edit the filesystem. The Perl script monitors output from this process, so it would be running throughout this whole situation. What would happen if the utility being run by the script tried to edit the script file itself...

Performing Simple Calculations with Native Ant Tasks.

Using only native ANT tasks, how can I create a custom ANT task to do the following: Calculate the the number of days since January 1, 2000 local time and store it in a property. Calculate the number of seconds since midnight local time, divided by 2 and store it in a property. The above property values will then be appended to othe...

Is it possible to embedd PHP as a scripting langage into a desktop application

I know that my customers know PHP because i'm working on a PHP Tool (Running as a MFC Desktop Program) Is it possible to embedd the PHP interpreter in a general purpose way like Python, Ruby, Lua or Javascript? And if yes - is it a hack or is there a clean solution. ...

Stop Wordpress from automatically inserting scripts

Is there a way to stop Wordpress from automatically inserting scripts into my theme from wp-includes/js? It's kind of annoying that I can use/choose to add my own. Thanks! Actually it's not including the jquery but scriptaculous.js and effects.js and for some reason they're interfering with jquery. Would it be the same just putting: ...

loading doctrine models in zend framework scripts

i use zend framework 1.10 and i have a script under scripts library. i run this script from command line. how can i load all the models of doctrine and use them in my script. in the begining of the script i write /** * Doctrine CLI script */ define('APPLICATION_ENV', 'production'); define('APPLICATION_PATH', realpath(dirname(__FIL...

Create test files of increasing size

I have a soap web service which accepts file attachments, these I process on the server and push as a base 64 encoded file. What I want to do is create some test images, pdfs, text files, word docs, etc that are increasingly large. For example: Create a set of images that are 10 KB, 15 KB, 20 KB, ... N KB. Create a set of pdfs th...

Any method for going through large log files?

// Java programmers, when I mean method, I mean a 'way to do things'... Hello All, I'm writing a log miner script to monitor various log files at my company, It's written in Perl though I have access to Python and if I REALLY need to, C (though my company doesn't like binary files). It needs to be able to go through the last 24 hours, ...

How to read input from the stdout of another command (pipe) in linux shell script?

My objective (read Homework) is to find the process that is consuming the most CPU and RAM by writing a script. I've managed to extract the info from TOP command however I'm having trouble parsing the output. The following command top -b -n 1 | tail -n +8 | head -n 1 will output something similar to this single line 915 root ...

Git log tabular formatting

Hello, I have a simple alias to display few last commits: log --pretty=format:'%h %an %s' -10 How can I make the results to be displayed in columns, like this: 898e8789 Author1 Commit message here 803e8759 Other Author name Commit message here ...

Detect when Android emulator is fully booted

I want to create a script where I start an emulator and after the system is fully booted, I want to install an .apk. How can I know when the emulator is fully booted so I can run the install command? Here http://developer.android.com/guide/developing/tools/adb.html it is said that adb wait-for-device install <app>.apk is not correct. S...