scripting

How does the #! work?

In a script you must include a #! on the first line followed by the path to the program that will execute the script (e.g.: sh, perl). As far as I know though, the # character denotes the start of a comment and that line is supposed to be ignored by the program executing the script. It would seem though, that this first line is at some p...

How can I terminate a multicast stream (asr - Mac) in a script?

Hello, I'm making a script to to run a bunch of multicast asr streams, but I do not know how to "stop" or "end" a multicast asr stream after a certain amount of time. Loop Suspend does not do what I'm looking for. I've also tried to add a sleep command followed by a kill command, but they kick in after the stream ends (so that approach ...

jQuery: loading reCaptcha into a div via ajax

Hello, I want to create a form that has a div with id "captcha". When the user enters a wrong password, following code is generated in "login.php" $myCaptcha=recaptcha_get_html($publickey, $error); $xml="<captcha><![CDATA[".$myCaptcha ."]]></captcha>"; echo $xml; recaptcha_get_html($publickey, $error); generates this: <script type="t...

How do I convert filenames from unicode to ascii

I have a bunch of music files on a NTFS partition mounted on linux that have filenames with unicode characters. I'm having trouble writing a script to rename the files so that all of the file names use only ASCII characters. I think that using the iconv command should work, but I'm having trouble escaping the characters for the 'mv' com...

Map resources when added to the project bundle

I have a .h when I map all the image files names and xib names with #defines. For example, if I have an image called "buttonBackground.png" I map it in my .h as #define BUTTON_BACKGROUND_PNG_FILE @"buttonBackground.png" It's possible to detect when a resource is added to the bundle and create the correspond define with a script? E...

Flatten a java project directory structure prepending the path to the file.

Hi there, I am trying to write a script (preferably in bash) to flatten a java projet directory structure prepending the path to the file. Example: | src | org | apache | file2.java | file1.java would result in: | src | org|apache|file2.java | org|file1.java The script should be recursive since the directory co...

remove extended attribute : fails

From a shell script, I'm trying to remove extended attribute setfattr -x security.selinux file.txt The file.txt has mode as 777 but im getting "permission denied error" How to fix this ...

How to replicate CTRL+C in a shell script?

I'm running a script that performs a command that lasts too long, so I want to interrupt it. Any help? I've tried to search a lot, and I've been pointed to the kill command. Although, I can't get it to work. By the way, I'm using a Mac OS X. Thanks! ...

Mac OS X - run shell script from the desktop GUI

You can create a shell script or a Python or Ruby script and run it on the Mac by using "Terminal" ... if you have Finder open, and you click on the icon for the file containing the source code of a saved shell script, is there a way to have that script run, instead of opening in my text editor ? ...

Bash script question

Say I have a bash script as follows while read $f; do cat $f >> output.txt; echo "aaa" >> output.txt; done Yet the second echo statement isn't executed. At all. What am I doing wrong? I'm running this via tail -f /var/log/somelog | ./script.sh $f should not be empty. It's only supposed to output when tail notices a change in th...

Java Applet question regarding data manipulation

Generally, how does a java applet manipulate user data? Take for instance "shopping carts" on shopping websites - after a user enters the data, is the data then preloaded each time a user accesses a website? Or is the data retrieved as the user is on the page? ...

how to make a python or perl script portable to both linux and windows?

I was wondering how to make a python script portable to both linux and windows? One problem I see is shebang. How to write the shebang so that the script can be run on both windows and linux? Are there other problems besides shebang that I should know? Is the solution same for perl script? Thanks and regards! ...

Ruby NameError when referring to Date

I'm getting "uninitialized constant Date (NameError)" with the following code: class Test attr_accessor :reqs def initialize() @reqs = [] end end class TestBuilder def test(&block) @current = Test.new block.call @current end def older_than_days(age) @current.reqs << lambda { |email| ::Date.parse(emai...

Assigning a material in Blender with a script

Question: How do you assign a material with a script to an object in blender? Info: I have this script to import a proprietary model type of mine that is basically a star map with object consisting of a single vertex. in order to make them look like stars and be visible they are all going to have a halo material assigned to them. I'm...

What is Linux for VMS DCL "ON ERROR"?

Using VMS DCL command scripts one can catch errors by using the on error command: $ on error then goto MyErrorHandler $ directory samiam.txt $ delete x.txt $ exit $MyErrorHandler: $ print "Something." How does one do this in Linuxland? In the example an error with directory or delete will cause control to go to MyErrorHandler. ...

Deleting N lines from every start point

How would I delete the 6 lines starting from every instance of a word i see? ...

Capture log4J output with grep

Hi, I know that log4j by default outputs to stderror. I have been capturing the out put of my application with the following command: application_to_run 2> log ; cat log | grep FATAL Is there a way to capture the output without the auxiliary file? ...

Better ways to create various kind of View Controllers on iPhone?

The thing is this: when we program for an iPhone app, we can add some more classes for those view controllers and such. But honestly, debugging and compiling these kind of programs get old real fast. Sure, we have the iPhone simulator, but sometimes, you just have to change some tiny things and you have to compile again. This is tedious....

Redirect PHP-Shell-Script output

Hi Folks, i have got a php-script foo.php #!/usr/bin/php -c /etc/php5/cli/php.ini -q <?php echo 'hello'; // & do some stuff ?> I call this script not wrapped by a sh-script but using it directly in a cron job. To get rid of it's output i normally would just create a sh-file which calls /usr/bin/php -c /etc/php5/cli/php.ini -q foo....

Choosing a scripting language for game and implementing it

Hello, I am currently developing a 3D Action/RPG game in C++, and I would like some advice in choosing a scripting language to program the AI of the game. My team comes from a modding background, and in fact we are still finishing work on a mod of the game Gothic. In that game (which we also got our inspiration from) the language DAEDALU...