scripting

image magick: right align text in area

Hi, i'm struggling with this: i'm building a table-like image. All goes well, but i can't get this to work: i want to place some text at x,y: 10,10, but want to right align it in an area of 40x40. Why? because they are numbers. When i draw text it's ok to place it at 10,10; it will by default be placed at 10,10 and thus be left-aligned....

Use preg_match to find if string contains script-tags

Hello, How do I write a pattern to use with PHP's preg_match function to check if a string containing script-tags? ...

.bat script only executes 1 line

I'm writing a script that performs the same function several times, but when I run the script only one of commands executes leaving the rest not executed after the .bat file has run. Does this have to do with the long time it takes for my commands to run (15-20 sec)? I've written plenty of bat files and I've never run into this. Do I n...

How to write shell script that filter for lines and count them?

I have a text file like this: Apple Orange Orange Banana Banana Orange Banana Orange Apple Orange I want to produce the following output after running a bash shell script: Apple: 2 Orange: 5 Banana: 3 It's pretty standard stuff if I use a full blown language like Java/C++ etc but what is the quickest way to do it with a shell scrip...

Protecting Scripting Language Source Code

I'd like to protect the PHP and JavaScript program source code from the prying eyes of my client. How can I do that? ...

Evaluate a ruby or javascript script string from within an android program

Is it possible to evaluate a string expression script from within an android app? Using either ruby, javascript or perl? ...

How to check if memcache or memcached is installed for PHP?

How do I test if memcache or memcached (for PHP) is installed on my Apache webserver? Memcache is a caching daemon designed especially for dynamic web applications to decrease database load by storing objects in memory. ...

Global environment variables in a bash script

How to set a global environment variable in a bash script? If I do stuff like #!/bin/bash FOO=bar ...or #!/bin/bash export FOO=bar ...the vars seem to stay in the local context, whereas I'd like to keep using them after the script has finished executing. ...

windows7 set the "show icon and notification" programmatically

I want my application (written in c#) which needs to run on Windows 7 and show an icon in the notifiaction area. The default is "only show notifivcation" I my icon to be shown by default. looking for the api in c# or to wite a script for this. If there's no direct way to do this is there any overriding way? Any idea will help- urgent is...

script to get average based on timestamps

I have two fields in my text file which are timestamp number The format of timestamp is hh:mm:ss.mmm some sample records are 18:31:48.345 0.00345 18:31:49.153 0.00123 18.32:23.399 0.33456 I want to print out averages of records which are no more than 30 second apart. what is a good and fast way of doing it ...

Exposing C# objects to Lua scripting

Hi, I'm looking into adding scripting to my C# application. I've been debating between Lua and C# (through CSharpCodeProvider). Regardless of which language I use, I need the script to be able to access/manipulate objects/arrays in my main application. With C# I should be able to expose my objects and interface functions without too ...

Nested case in bash script

I have written the following function in a bash script but it is not working. Am I missing something obvious? main_menu() { dialog \ --title "Sim Gateway Infomation Utility" \ --menu "What do you want to do?" 12 60 5 \ Summary "View overall summary" \ Details "View details of a sim bank" \ Modify "Modify used minutes...

Embedding IronRuby in C# and DateTime

When I embed IronRuby what is the proper way to get a reference to either Ruby's DateTime/Date classes or .NET's System.DateTime. I'm running into errors when I try require 'date' I get the error - no such file to load -- date when I try require 'mscorlib.dll' I get the error - no such file to load -- mscorlib.dll What is the right w...

How to run command using output of another command in DOS?

Example: for /? | if (this stream has word "the" in it) {echo the line with "the"} I need somehow to analyze the text in the redirected stream. ...

why can't I run CMD for command like this:

for /f %%i in ('someprogram %1 2>&1 | find /c "some string"') do ... it says 2>&1 was unexpected at this time ...

Which javascript interpreter is the easiest to embedd in a C application?

There are a few available and i want to support many platforms so i guess V8 isn't that good unless someone has written an interpreter patch for it. ...

Is there a non-java, cross platform way to launch the associated application for a certain file type?

First, I found a couple of java specific questions and answers for this. I am looking for more "native", but cross platform solution, using C, C++, some kind of shell scripts, or, in my case, Qt. So the question is, are there standard, cross platform, ways to programmatically open the associated application for certain file types. Or a...

Finding/Handling stalled PHP scripts

I use Ajax to kick off a PHP script that can take a few hours to run. It's done asynchronously so the PHP script will complete even if the browser is closed. I need to handle any of these PHP scripts that have stalled/hung for whatever reason. What is the best way to go about this? Is there a way to get a process id for the PHP scrip...

Time difference between system date and string, e.g. from directory name?

I would like to write a small script that does the following (and that I can then run using my crontab): Look into a directory that contains directories whose names are in some date format, e.g. 30-10-09. Convert the directory name to the date it represents (of course, I could put this information as a string into a file in these direc...

How can Perl fill out fields on a GUI made in Visual Basic?

I have a script that runs several little programs I don't have the source code to, one of which requires filling out some fields in a GUI. I've been doing this by hand, but I'd like to have the Perl script focus the GUI window, then enter some hardcoded text into each field and close the window. ...