There are inevitably things about your computer that you wish worked differently. Broadly, these problems divide into two classes:
Problems in class 1 can be extremely frustrating because you don't necessarily know where you should look to find the solution. Once you do know where to look, the solution is trivial, and the nugget of hard-earned knowledge you've gained is priceless. I'm probably screaming into the wilderness, but I'm posting my golden nuggets of wisdom here in case someone has the same problem and manages to find this page.
Problems in class 2 are usually an illusion. In principle you can program a computer to do anything, so these problems are often just "The developer made a choice I don't like." One of the nice things about open source software is that you can actually dig in to the code and change things. Often the change you want is too much work, but if it's just a nagging detail you can often fix it without an enormous amount of effort. A few small patches are included below.
I'm also including links to particularly useful utilities. This is not meant to be an index of every neat hack that does something cool for someone, but rather those few things that I use every day and impact my life in a positive way.
Some of these are neat, some will make your life better or easier, and some only serve to demonstrate how anal I can be.
Here are additional sources of interesting tidbits:
There are many hardware monitors out there. Most let you plot the percentage of cycles used by your CPU, but not the system load. This is basically worthless because the CPU usage goes up to 100 percent and then gives you no further information. What if I have 10 CPU intensive processes running? It looks the same as if I had only one. The old-time Unix developers crafted a simple, elegant program to serve this purpose: Xload. Amazingly, people have utterly failed to appreciate Xload and proceeded to reinvent inferior wheels to solve this problem.
That said, my current favorite is Hardware Monitor It's small, clean, visually appealing, and it let's you plot system load.
One problem is that it uses the C++ Gnome libraries, which aren't standard on Red Hat 9 systems, so you need to install it via Apt for RPM to resolve the billion dependencies.
Also, I don't like the way Hardware Monitor does the axis scaling when viewing the system load, so here's a patch to fix it. I sent the patch to the author of Hardware Monitor and he said he'll integrate it shortly.
Update 13 Nov 03 Kudos to Scott Seagroves for taking up the challenge and finding out how to fix this. Under Red Hat 9, run gconf-editor and look in apps/metacity/general. There's a key called "button layout" which you can use to rearrange the buttons in the window title bar.
I still don't have a solution for OSX, but I don't have much hope on this front. I can't imagine Apple putting that much user interface control in the hands of amateurs...
Almost. I either wanted the script to be run from the current directory, or to have the full pathname of the selected files on the command line. I also wanted the standard output of the script nicely piped to a GUI window. I got none of the above.
The selected files are a newline separated list in the environment variable a NAUTILUS_SCRIPT_SELECTED_FILE_PATHS (newline separated!?! For the love of god, why???). And I had to learn Python so I could pop up a little GUI window showing the output. Here's the result. Put it in ~/.gnome2/nautilus-scripts, make it executable, and you should be able to get it by right clicking on files in Nautilus.
Update 26 Jan 04 Scott Seagroves pointed out that there are Gnome programs that pop small dialog boxes given command line arguments. Gnome 2.2 uses gdialog and Gnome 2.4 uses zenity. Both are in the gnome-utils rpm. This way you don't have to choose your scripting language based on what has a nice interface to Tk.
The three major computing platforms managed to come up with three different conventions about newlines in text files. This is particularly annoying in OSX since different applications are following different conventions. Here's a script to convert between the three formats.
You'll find yourself in Nirvana if you use this within Emacs: You're looking at a buffer with wonky newlines. Highlight the text and type "M-x shell-command-on-region", then "rets m u" to convert from the Mac convention to the Unix convention. Ta-da! The text is now nicely formatted in a new buffer.
So, the big solution is that you need to set a few kernel
variables to set the time delays. Type "sysctl -a" to see a
list of all the kernel variables and look for ones with names like
"net.inet.tcp.keepintvl" and such. Change the delays (measured in
seconds) with: "sysctl -w name=value "
Next you'll ask...
The syntax is a little wacky since OSX filenames can have spaces and such, so here are two examples. This one makes a bunch of files into a tarball, and this one converts a Postscript file to a PDF file and launches Acrobat to view it. Very useful if you have yet to get Ghostview working on your iBook (like me).
Under Linux, this is accomplished via xmodmap. Look at the man
pages. Putting the following in .Xmodmap works for me.
remove lock = Caps_Lock
remove control = Control_L
keysym Control_L = Caps_Lock
keysym Caps_Lock = Control_L
add lock = Caps_Lock
add control = Control_L
Under OSX, the situation is more complicated. I currently use uControl, but another program is DoubleCommand. John Johnson at Berkeley directed me toward a third solution which was posted to Mac OSX Hints. Or, you can get the Happy Hacking Keyboard. There seems to be no affiliation with Richard Stallman or the Free Software Foundation in spite of the fact that the keyboard is named after RMS's characteristic greeting (which can be found on various bits of Gnu gear). Oh well, I guess RMS doesn't own the phrase.
"M-x
apropos-command (ret) rectangle (ret)" to see the options, and
pay particular attention to kill-rectangle and yank-rectangle.
My major annoyances with GDB include the inability to reasonably display data structures like arrays.
There's a program called DDD which helps with this, but I never fell in love with it. At least, not until I noticed its interface to Gnuplot. That looks pretty cool.
A simple way to help with this is to just define a new GDB command to print your data structure formatted in whatever way you want. Here's how you do it.
This technique is also handy for debugging parallel programs. As
long as your bug doesn't require more than a few separate processes to
manifest itself, this technique works: First use
Norm Matloff's parallel debugging trick and put this
int gdb_parallel_debug=1;
while (gdb_parallel_debug) {
printf("Process %d waiting for gdb process to attach...\n", getpid());
fflush(stdout);
sleep(5);
}
in your code. Then put this in .gdbinit
define pattach
attach $arg0
finish
set gdb_parallel_debug=0
next
next
end
And ta-da! You can start gdb, then just type pattach 12345
and you'll automatically find yourself at the first statement after
the above while loop.
printplot 4in plot1.eps plot2.eps"
Here's how to do it.