scripting

Any interesting uses of Makefiles to share?

"make" is not only useful for building your programming project, but it seems to be under-used in other areas. For example, many shell scripts can be rewritten as Makefiles to allow independent parts to run in parallel (with "make -jXX") to keep all your CPU cores busy, with the explicitly declared dependencies as an added benefit in ca...

Using external GUI libraries to make user interfaces in Autodesk Maya

I develop tools in Autodesk Maya. Many of the tools I build have simple windowed GUIs for the animators and modellers to use. These GUIs often contain what you'd normally expect to see in any basic window; labels, lists, menus, buttons, textfields, etc. However, there are limitations to the complexity of the UIs you can build with the...

How can I let users run a script with root permissions?

Given the dangers of SUID shell scripts, is there a more secure way of giving passwordless access to scripts (bash, PHP) with root permissions in Linux? (Ubuntu 8.10) ...

Windows Disk Cloning vs Automatic installation of servers

During development , testing, and deployment, I have a need to fully automate a windows 2003 server setup. I'm trying to find the best way to automatically delpoy a server, which installs the OS, software dependencies that I have (for example SQL server, .net framework + my own application code). From what I've found , there are two ap...

How do you attach to events on a ScriptObject in Silverlight?

The HtmlObject provides all the necessary functionality to register managed event handlers for script and DOM events, but what if the class you need to listen to doesn't exist as a DOM element, but a scripting variable (referenced via ScriptObject) instead? ...

Scripting for .Net Deployment

I am researching various options for deploying a batch of .Net applications. Deployment is more than just copying files, we need to stop/start services, call an exe that executes database scripts, initiate a number of setup.exe installs, etc. These scripts will be given to a third-party who will apply various application updates to our...

Spring SP Class generation with or without Eclipse

With Hibernate+Eclipse you can generate POJO classes that represent the tables. You can then wire it all together pretty easily with Spring. However, if you have to interact with stored procedures you have to wrap each one in it's own class(es) -- although this is definitely preferred to standard JDBC it is still a bit cumbersome at time...

Developing a code base for multiple versions of a product

I know this is possible since there are so many packages available where you have a "Standard", "Professional", and "Enterprise" version of a package... but does anyone have any decent tutorials available on how a uISV would go about learning the techniques involved in developing a tiered feature piece of software? I've done multiple se...

Komodo Edit: Running macros via keybinding versus toolbar

Question: Is anyone out there familiar enough with Komodo Edit to shed some light on this macro? I need to figure out how to do buffer text selection in a macro when it is invoked via the tool panel. Problem: I have a very simple macro in Komodo Edit javascript that works as expected, but only when invoked via a custom keybinding. If th...

How to determine file type in bash script?

I am writing a nightly build script in bash. Everything is fine and dandy except for one little snag: #!/bin/bash for file in "$PATH_TO_SOMEWHERE"; do if [ -d $file ] then # do something directory-ish else if [ "$file" == "*.txt" ] # this is the snag then ...

Programmatic graphics toolchain

I have drawn an icon in Inkscape, but would now like to programmatically alter it (change the colours slightly for different icon states) and convert it to a tiled PNG format file containing multiple icons with different colours. I know about Inkscape's --export-png options, but can't see a way to make it change the image and/or export m...

Running a CMD or BAT in silent mode

How can I run a CMD or .bat file in silent mode? I'm looking to prevent the CMD interface from being shown to the user. ...

Windows XP: Replace the standard "New Folder" action with a WSH script

Problem: I have a custom WSH script that creates a new directory in a similar manner to the standard "New Folder" action in the Windows desktop. This script, however, does a couple of extra things; such as allowing me to create a pre-defined set of child directories (optional); as well as allowing me to add notes and reminders if the dir...

Why is 'cp' failing in this shell script?

Here's a snippet of code from a shell script I have written: for src in $(find . -type f -maxdepth 1 \! -name ${deploy} \! -name gvimrc) do src=$(basename ${src}) dest="~/.${src}" copy="${src} -> ${dest}" cp $src $dest && echo -e "${ok} ${copy}" || echo -e "${fail} ${copy}" done For some reason, cp fails to execute. Fo...

A .bat or .wsh script that can search for files

I am looking for some examples of a .bat OR .wsh script that can do the following: Recursively read file names in a directory with a user-provided extension (.dll, .exe, etc) Search a user-provided directory for the above file names Generate a txt or xls report of the findings, like: x.txt was found in "C:\temp", "C:\blah" TIA. EDIT...

What's an easy way to trim N lines from the tail of a file (without the use of 'head')?

Say I've got a bunch of files that are all >100 lines long. I'd like to trim off the top 14 lines and the bottom 9 lines, leaving only the lines in the middle. This command will trim off the top fourteen: cat myfile.txt | tail -n +15 Is there another command I can pipe through to trim off the bottom 9 without explicitly passing the ...

How Best to Alias an Executable Name in a WinDBG Crash Script?

Background Information For saving out crash dumps, I have a script passed to cdb.exe in the Debugger value of the AeDebug registry key: C:\progra~1\debugg~1\cdb.exe -p %ld -e %ld -g -y SRV*c:\mss*http://msdl.microsoft.com/download/symbols -c "$<d:\tgticker\Dumps\RDFD.cdbscript" Here is the first portion of the script: as /c CrashFir...

In Python, how I do use subprocess instead of os.system?

I have a Python script that calls an executable program with various arguments (in this example, it is 'sqlpubwiz.exe' which is the "Microsoft SQL Server Database Publishing Wizard"): import os sqlpubwiz = r'"C:\Program Files\Microsoft SQL Server\90\Tools\Publishing\sqlpubwiz.exe"' server = 'myLocalServer' database = 'myLocalDatabase' ...

Python script to list users and groups

I'm attempting to code a script that outputs each user and their group on their own line like so: user1 group1 user2 group1 user3 group2 ... user10 group6 etc. I'm writing up a script in python for this but was wondering how SO might do this. Thanks! p.s. Take a whack at it in any language but I'd prefer python. EDIT: I'm...

How can a bash script know the directory it is installed in when it is sourced with . operator?

What I'd like to do is to include settings from a file into my current interactive bash shell like this: $ . /path/to/some/dir/.settings The problem is that the .settings script also needs to use the "." operator to include other files like this: . .extra_settings How do I reference the relative path for .extra_settings in the .setti...