scripting

Add Selected 'Attribute' to Select Box Based on PHP Time

I am currently using the following PHP code generate a Select Box with different times: <? for ($x = 28; $x < 81; $x++) { if ($x == 48) { print "<option selected='selected' value='" . date("H:i:s", mktime(0, $x * 15, 0, 0, 0)) . "'>" . date("g:i a", mktime(0, $x * 15, 0, 0, 0)) . "</option>"; } else { print "<option value...

linux shell scripting: hex string to bytes

Lets say that I have a string "5a". This is the hex representation of the ASCII letter 'Z'. I need to know a linux shell command which will take a hex string and output the binary bytes the string represents. So if I do echo "5a" | command_im_looking_for > temp.txt can I open temp.txt, I will see a solitary letter Z. ...

Use bash to read a file and then execute a command from the words extracted

FILE: hello world I would like to use a scripting language (BASH) to execute a command that reads each WORD in the FILE above and then plugs it into a command. It then loops to the next word in the list (each word on new line). It stops when it reaches the end of the FILE. Progression would be similar to this: Read first WORD fr...

find and replace a string in a set of xml files using shell commands

Hello Members. I have 1000 files in a directory. I'm on a solaris machine I want to replace the string " /example/test/temp " t0 " /testing/in/progress/ in all the xml files in my directory. any pointers will be great. thanks, novice ...

What is wrong with this AWK script?

Basically, I am creating an XML file by taking the values from a column of a table. I am starting an AWK script from a shell script (ksh if it matters) like this: SQL_RESULT=`sqlplus -s ${CONNECT_STRING} << EOF ${SQLPLUS_SETTINGS} select customer_id from GD9_GENTH_CUST_SUBSCR; exit; EOF` FILE_LIST=`echo $SQL_RESULT|sed -e 's/\n/''/g'` ...

MSI script to check sql server 2000 PE for a db name and not rerun db install script

Greetings, I am seeking help on building a script that will allow my msi installer to check for an exsisting db or exsisting user on the local server of sql server 2000 Personal Edition, during the pre install, the script needs to return the sql response and not run/resintall the sql scripts if the db name or db user is on the server al...

How to impose a time limit on a whole script in Python

The user is entering a python script in a Java GUI python-editor and can run it from the editor. Is there a way to take the user's script and impose a time limit on the total script? I'm familiar with how to this with functions / signal.alarm(but I'm on windows & unix Jython) but the only solution I have come up with is to put that scr...

I have a site where I will be manually changing street addresses. I want to include a map link but I want it to update itself automatically when I change addresses...

I have a site where I will be manually changing street addresses. I want to include a map link but I want it to update itself automatically when I change addresses... Also, I'd like the link to send the address field to google maps or mapquest and return with that info in a small popup window that features the map. What's the best way...

a MYSQL script to convert the column names to lowercase

I am looking for a single MYSQL script to convert ALL column names in a database to lowercase in one go... I have inherited a MYSQL database that has a lot of mixed case column names (150 tables with a strange naming convention) and I don't want to go through manually each table by table to do this. Has anyone got such a script? Thank...

script to add files to SVN with filters

My bash scripting is weak. I want to create a script that filters and add files to the svn. So far i have this ls | egrep -v "(\.tab\.|\.yy\.|\.o$|\.exe$|~$)" I tried to output it using exec but couldnt figure out how. Before that I checked if svn add uses regex. I am not sure if it does and i couldnt figure out how to reverse the ab...

how to replace names recursively via windows batch operation

Hi all, I want to process a batch operation in a big directory. Actually I have the batch script for that process. But here , I have a problem. Some of the directory names, files names contain " " (space character). So in the batch operation this names passed as 2 arguments . and those lines will not work. So Iwant to rename " " with "_...

How can I test for SQL Server connectivity from DOS?

I am trying to figure out how to "test for connectivity" to a SQL Server database from DOS. If the connection fails I need to detect the failure. sqlcmd -Q "select 'a test'" -S .\SQLEXPRESS You'll notice that that command doesn't return a true/false value. Also, if the instance doesn't exist, it times out. I want something like th...

Time of shutdown on Mac OS X

Possible Duplicate: Receiving power notifications (especially shutdown) on Mac OSX Hi Guys, I'd like to be able to log the times that my mac is switched on and off during the day (keeping track of my hours jacked-in). Switched on is easy: I just have a tiny script that writes the time to a logfile when the user logs on, but I c...

Ampersand using Javascript & PHP

I'm trying to redirect a page using javascript output using php. The problem I'm having is passing the ampersand as you can see below. Input $url = 'number=1&id='.$usrid->id; echo "<script type='text/javascript'> window.location = 'directory?$url'; </script>"; Output The above return on browser address bar this: http://www...

how to direct output into a txt file in bat script in windows

hi, all in linux, let say i want to start tomcat, and want to direct all the console log into a text file, i can do write a bash script: ./startup.sh > output.txt but in windows, can we do the similar stuff using .bat script. how can i write this bat script??? (i know the proper way should ask the application to do the log, but the ...

How to batch execute php script from one php script?

I have a series of php scripts that I want to run in a particular order. I tried using: <?php exec('file1.php'); exec('file2.php'); exec('file3.php'); ?> to accomplish this, but just got a series of errors. If I run them from the command line, they all work fine... I'm not sure how to do this... if someone can help, that'd be gre...

How to check a file every 1 minute in a windows bat script?

I want to write a bat script to check a text file (log). If the log is over 10M, I want to delete some portion of the file, only keep the last 500 lines, and delete all the old content. So there are two issues: how can I check the file every 1 minute, and how can I delete only a portion of the content? ...

tk, tcl exec stderr, stdout separately

I have a tcl script. The problem is that I have to call a script that can write something to stderr (it's not a critical failure). I would like to capture stderr and stdout separately in tk/tcl. if { [catch {exec "./script.sh" << $data } result } { puts "$::errorInfo" } This code will return my result but it also contains stderr....

Connecting Two Bash Commands

I have Ubuntu Linux. I found one command will let me download unread message subjects from Gmail: curl -u USERNAME:PASSWORD --silent "https://mail.google.com/mail/feed/atom" | tr -d '\n' | awk -F '<entry>' '{for (i=2; i<=NF; i++) {print $i}}' | sed -n "s/<title>\(.*\)<\/title.*name>\(.*\)<\/name>.*/\2 - \1/p" ...and then another comma...

How can a user pass their database schema to my web application?

A while ago, I wrote a program that outputs any localhost or network database to a series of protobuf-net marked up template generated classes that I then use for all my communications architecture for my web services. I want to put this application available online for myself so I don't have to run it locally on my machine any more, an...