10-21-2008
Quote:
Originally Posted by
neked
3) Even if you were a parameter substitution guru, and you used meaningful variable names and comments to make clearer what your parameter substitution tricks do, then future maintainers of the code might not be the same. This bit me a couple of days ago: I had to spend 20 minutes debugging a bash script riddled with those parameter substitution scripts. I estimate I would've spent closer to 5 minutes if the code was written using more obvious external tools (sed, basename, awk). This is about 15 minutes of human time wasted in order to save less than a few milliseconds of CPU time. Especially since the whole script runs only once a night, and does not exceed 0.030 seconds runtime on my modest 7 years old computer.
I've just substituted all occurrences of parameter substitutions with equivalent sed and basename commands in the script I refer to above, the execution time went up from an average of 0.030 seconds to 0.061 seconds. That means parameter substitution use shaved an average of 0.03 seconds per run. Considering that I've had to spend roughly 15 more minutes understanding the code to debug it, this means the code has to run 15*60/0.03 times to pay off the extra time I invested to debug it. That's 30,000 times. Considering that it runs once a night, this means we'll have to wait more than 80 years!
Even after 80 years, those 0.020 seconds shaved off CPU time per night are not as worthy to me as 15 minutes of my time which I could've spent
aternative activity redacted
Last edited by Perderabo; 10-21-2008 at 05:49 PM..
Reason: clean up language
9 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi,
I am new to this forum and unix too. I have just started learning unix. As I was going through the first chapter, I read that unix is multitasking, multiprogramming, multiprocessing and multiuser OS.
My question is: Is there any difference between a TASK and a PROCESS. How are PROCESS... (2 Replies)
Discussion started by: hana
2 Replies
2. Shell Programming and Scripting
I have a file contains
TASK gsnmpproxy {
CommandLine = $SMCHOME/bin/gsnmpProxy.exe
}
TASK gsnmpdbgui {
CommandLine = $SMCHOME/bin/gsnmpdbgui.exe
I would like to comment and than uncomment specific task eg TASK gsnmpproxy
Pls suggest how to do in shell script (9 Replies)
Discussion started by: madhusmita
9 Replies
3. Shell Programming and Scripting
I have an task definition listing xml file that contains a list of tasks such as
<TASKLIST
<TASK definition="Completion date" id="Taskname1" Some other
<CODE name="Code12"
<Parameter pname="Dog" input="5.6" units="feet" etc /Parameter>
<Parameter... (3 Replies)
Discussion started by: MissI
3 Replies
4. Programming
believe it or not but this is my first c program (i've worked with java, C#, php though) I am trying to make a daemon that checks if mplayer is running(it's for a projection room) and if it is not then to run mplayer with a file.. So far it's not working and I don't know why
Help and comments... (5 Replies)
Discussion started by: james2432
5 Replies
5. Boot Loaders
Hello,
I have kubuntu on my laptop and now I decided to switch to Windows 7. I made the bios settings properly (first choice is boot from cd\vd) but I see the error
" reboot and select proper Boot device or insert Boot media in select Boot device and press a key "
I have tried CD and... (0 Replies)
Discussion started by: rpf
0 Replies
6. Shell Programming and Scripting
hi,
infile-
create table salary
( occupation_code char(40),
earnings decimal(10,2),
occ_yearend integer
);
outfile-
salary:create table salary
salary:( occupation_code char(40),
salary: earnings decimal(10,2),
salary: occ_yearend integer
salary:);
Thanks. (4 Replies)
Discussion started by: dvah
4 Replies
7. Shell Programming and Scripting
Hi all,
I'm newbie and stuck here. Thanks for any help.
Input(txt file)
a b X
c d Y
e f Z
g h W
Requested output:
a b X Y
c d Y X
e f Z W
g h W Z
Please use code tags when posting data and code samples! (10 Replies)
Discussion started by: hernand
10 Replies
8. Shell Programming and Scripting
Hi experts,
I have a problem with the below shell task:
I need to modify the file creatin a paired row , per each row
which matches filter (e.g. number of nonempty columns = 5)
Output should look like this:
second row is original one from the input,
first row(red) is pairing row, it's... (29 Replies)
Discussion started by: hernand
29 Replies
9. Homework & Coursework Questions
I have a simple task for my school work. I'm new with unix, so i need help.
I need to write a scenario. Task is. From created txt file read first 3 words and create a 3 catalogs with those 3 words. 2 of those new catalogs should be transferred to other directory. If someone could help me just... (1 Reply)
Discussion started by: justynykas
1 Replies
LEARN ABOUT DEBIAN
makeastheme
MAKEASTHEME(1x) MAKEASTHEME(1x)
NAME
makeastheme, installastheme - manage themes in the Afterstep windows manager.
SYNOPSIS
makeastheme [--theme <theme_name>] [--no_wharf] [--no_pager] [--no_winlist] [--no_background]
installastheme [--theme <theme_name>] [--no_wharf] [--no_pager] [--no_winlist] [--no_background]
DESCRIPTION
This bundle of two Perl scripts is used to implement themes in the AfterStep window manager for X (http://www.afterstep.org).
At this time, these scripts are becoming solid beta quality. I would still highly recommend you to backup your configuration files in the
~/.afterstep dir. The easiest way to undo a theme is to simply restore your old files.
This theme pack currently supports the following modules and options:
Wharf: Pager:
BgColor Align
Pixmap Back
TextureColor BalloonBack
TextureType BalloonBorderColor
BalloonBorderWidth
WinList: BalloonFore
Font DesktopImage
Fore Font
Back Hilight
Justify Image
Pixmap (AS 1.5b6 pl2) SmallFont
Of course, the look file and desktop background is supported. Also, any images specified in the look file or the module options above are
also carried with the theme that is built.
This theme pack expects to find the ~/.afterstep/desktop/themes directory. Each theme should be a subdirectory from there. When you down-
load a theme, untar it in the themes dir. Also, when you build a theme, if you want to bundle any unique icons for use in the database
file, put them in the specific subir of the themes dir.
Also, the theme pack will only look in ~/.afterstep for module configuration files. That means when building a theme, it only takes modi-
fications from that dir. If the config files aren't there, makeastheme will ignore that module. When installing a theme, installastheme
will only edit files in ~/.afterstep. If it doesn't find any modules there, it will skip that module. At a minimum, you should have
'wharf', 'pager', and 'winlist' files in the ~/.afterstep dir.
OPTIONS
Both installastheme and makeastheme take the same command line, which can be in any order. The directory from which the scripts are called
is irrelevant. All directory paths are coded into the scripts and double-checked at runtime. After running installastheme, you will need
to manually restart AfterStep for the changes to take place.
When making the themes, you simply run makeastheme with the --theme <theme_name> argument and any of the other command line arguments you
might want to use. This script will grab all the config files necessary and all images specified within those config files. It then cre-
ates the theme in your '~/.afterstep/desktop/themes'
--theme
this option is used to specify the theme to install. With installastheme it is mandatory. With makeastheme if unspecified, the
$USER environmental variable will be used instead.
--no_wharf, --no_pager, --no_winlist, --no_background
Each of these options tell the scripts to skip processing for each of these modules. For makeastheme it is similar to saying, "I
don't have anything interesting in this module, don't store those options in the theme." For installastheme it is similar to say-
ing, "I really like my <module>, don't change any settings in there."
SEE ALSO
afterstep(1x), Pager(1x), Wharf(1x), WinList(1x),
/usr/share/doc/afterstep/README.theme.handler.gz .
AUTHORS
These tools were written by Lathi <alcornd@earthlink.net>.
This manual page was written by Robert Luberda <robert@debian.org>, based on the README.theme.handler file, for the Debian GNU/Linux system
(but may be used by others).
BUGS
If you find any, you can email me (mailto:alcornd@earthlink.net) or the AfterStep mailing list (mailto:afterstep@linuxcenter.com). Alter-
natively, you can also probably find me on EfNet channel #afterstep as Lathi.
Feb 10th, 2008 MAKEASTHEME(1x)