scripting

Generating MySQL UPDATE statements containing BLOB image data

I'm trying to write an SQL statement that will generate an SQL script that will update a BLOB field with an IMAGE being selected from the database. This is what I have: select concat( 'UPDATE `IMAGE` SET THUMBNAIL = ', QUOTE( THUMBNAIL ), ' WHERE ID = ', ID, ';' ) as UPDATE_STATEMENT from IMAGE; In t...

Bash: Terminate on Timeout/File Overflow while Executing Command

I'm writing a mock-grading script in bash. It's supposed to execute a C program which will give some output (which I redirect to a file.) I'm trying to (1) make it timeout after a certain duration and also (2) terminate if the output file reaches a certain file size limit. Not sure how to go about either of these. Any help? Thanks. ...

How to write scripts that can run in bash and csh?

I'm not sure if this is even possible, but is there a way to write shell scripts that can be interpreted by both the Bourne shell as well as C shell? I want to avoid simply checking for the shell and running a shell-specific code. If this is possible, are there any guides on how to do it? I have always written my scripts for Bourne shel...

How can I pass an HTML file content from PHP to CGI (Perl) Script

The content of the an HTML file generated by a PHP is stored in a string variable called $output I am trying to send the contents in $output to a CGI script. I have tried the following CURL in PHP... $output = "long string, with strange non HTML characters..." $c = curl_init(); curl_setopt($c, CURLOPT_URL, 'http://www.example.com/cg...

Automating telnet with powershell

Ok, it's little convoluted. I am trying to write a script to automate telneting to a machine, execute few commands, look at the output in the telnet window, based on the output, send few more commands. Thanks for any help ...

I am new to shell scripting and i have wriiten a script to flag values within a if loop but if i try to call those values in another if loop it is returning null values

#!/bin/sh cat PLAYARTE_TXT.txt|while read line do count1=$(echo $line|wc -c) a=37 if [[ $count1 -eq $a ]]; then b=0 else c=1 break fi done if [ "$b" -eq "0" -a "$c" -ne "1" ]; then echo success else echo failure fi exit 0 ...

cross-platform scripting for windows, Linux, MacOS X

Hi. I'm looking for cross-platform scripting (language) for windows, Linux, MacOS X. I'm tired of .bat / bash . I would like to do things like for example ,,lock workstation'' at automatic login (I had this in X-Window but the solution was pretty ugly; now, I would like that on MS Windows and not that ugly :-) ). Generally: automate tas...

Accessing property file through batch script

Hi everyone, I'm trying to write a batch script, this script is responsible to launch a jar with one parameters. This parameter indicate to my jar wich property file to use in order to setup some configuration. Then the script will zip the results produced by the jar and send them to a location. But in order to set the name of the zi...

How to automate BlackBerry debugging with Eclipse?

I am developing application for BlackBerry 8900 and I am using features that force me to test/debug it on the real device. I am looking for a convenient way to be able to automate build-deploy-lanuch process. The process is: Package application & sign it Load it on the device Start debugging session in Eclipse With the newest versi...

How to iterate over dates and data and generate new files

I have a file, with n numbers on each lines. The first column on the line is a date: say 12/31/2009. However, some dates can be missing. I want to create files corresponding to date, containing the numbers that follow. For example: master file will contain this data: 12/28/2009 5 6 7 12/31/2009 6 7 7 The resulting files s...

Making a login Using JavaScript, Will Incorporate PHP Later

not sure why my code wont work, im teaching myself javascript i know php moderatly and i also know the intelligence of using java to hold a password and username, but at the moment i just want the script to work. <html> <head> <title>34webs</title> <link rel="stylesheet" href="css/lightbox.css" type="text/css" media="screen...

how to store a value returned from a sql query in a variable in batch programming ?

how to store a value returned from a sql query in a variable in batch programming ? i can invoke sqlserver queries from my cmd prompt using sqlcmd server name then the qwery this is query statement i m going to use SELECT CASE WHEN DATEDIFF(minute, record_timestamp, GETDATE()) < 10 THEN 1 ELSE 0 ...

Getting ID of an instance newly launched with ec2-api-tools

I'm launching an EC2 instance, by invoking ec2-run-instances from simple a bash script, and want to perform further operations on that instance (e.g. associate elastic IP), for which I need the instance id. The command is something like ec2-run-instances ami-dd8ea5a9 -K pk.pem -C cert.pem --region eu-west-1 -t c1.medium -n 1, and its o...

echo newline suppression

Why $echo '-n' doesn't write -n on terminal although -n is written within quotes ? ...

did i make a command through a dialog in mirc?

i've created a dialog that allows to kick an user. this dialog has a textbox where the user must write the name of the one to kick and then press the OK button to kick. I created all the dialog but i don't understand how to give the command on the ok. somebody can help me? ...

Why is this ASP Script not working?

Could you tell me whats wrong with this ASP script: I think the error is in the if statement <script> productID=new Array() variaveis=location.search.replace(/\x3F/,"").replace(/\x2B/g," ").split("&") if(variaveis!=""){ for(i=0;i<variaveis.length;i++){ nvar=variaveis[i].split("=") productID[nvar[0]]=unescape(nvar[1]) } } function Query...

How to determine if a C++ usertype has been registered with tolua

We use tolua++ to generate Lua bindings for C++ classes. Assume I have a C++ class: class Foo { //Some methods in Foo, irrelevant to question. }; and a tolua .pkg file with the following contents class Foo { }; Consider the following function: void call_some_lua_function(lua_State* luaState) { Foo* myFoo = new Foo(); ...

Would this mIRC script be possible? how difficult?

At my workplace we use mIRC for realtime communication for those of us who need to be constantly in touch with others. Sometimes it happens that I have to leave my desk for an hour or two at a time, and sometimes I get a PM in mIRC that I need someone to get me for. So, my question is, with the scripting capability of mIRC, is it possib...

Which TextEditor is easiest to customize for a new scripting language?

It's been more than an year that i'm developing a new scripting language with its own grammar rules and constructs. I'd like to give the users of this language some minimalistic ide to work with, but i don't want/have time to make one from scratch so i'd like to take one already existing (it has to run on Linux platforms natively, so no ...

Bourne Shell: Graceful way to get exit status

Is there a more graceful way to do this (bourne shell)? IsThereAnyApplesLeft applesLeft=$? Normally in c or java I would do: applesLeft=IsThereAnyApplesLeft ...