999 days is not forever
One of my peculiar perversions is that I want my browser's history ofvisited URLs to stick around forever (or at least to not expire in a acrude time-based way). Firefox doesn't have an option to do this, butit does have an expiry time in days in a field that only accepts threedigits, and back in the halcyon days of yore when I switched to Firefoxand set it up, 999 days seemed acceptably close to forever.
Recently, I noticed that
ZFS's helpful attention to detail
Because I just ran into this:
Imagine that you have a ZFS pool, call it tank to match the conventionof ZFS examples, and that it has three spare devices configured. Furtherimagine that you want to remove those three configured spares from thepool:
# zpool remove tank c4t0d0 c4t0d1 c4t0d2
(No error messages are emitted.)
Then, because you are a cautious person (or because you have a toolthat automatically saves your pool
Why you want sysadmins, not users, to be providing the computing
One possible reaction to how we don't really control user desktops is to shrug and let users go their own way ifthey don't want to have one of the short list of provided desktopenvironments. You won't fight it, but you won't do anything to supportit either; you'll let them run Ubuntu, or OS X, or whatever, but they'reentirely on their own.
This is a great way to make a terrible mistake. You really do want '
Why I have the same shell dotfiles everywhere
In light of the complexity that is requiredto use the same set of shell dotfiles on all of the systems where Ihave accounts, one might sensibly ask why I bother. The answer is thatI heavily customize my account's environment; I have all sorts ofaliases , environment variable settings, and so on.
(Such heavy customization does have its downsides , including that I am not really comfortableon a new system until I have brought up my environment. A more subtledisadvantage for a sysadmin is that it
A Unix shell trick
This is the sort of trick where I present the code first and explainit afterwards:
arch=`(PATH=$HOME/bin:/local/bin:$PATH arch || echo unknown) 2>/dev/null`
(This has been slightly modified to keep the line length down; in thereal version, more things are added to $PATH . Note that this may beword-wrapped in your browser.)
This sets the $arch variable to the output of the arch command
The problem with unit testing programs
A commentator on my entry on why your main program should be import able mentioned that a third reason is to beable to unit test your program. I agree with the sentiment in general,but in specific I've never been able to get unit testing of my mainprogram code to work very well.
While I can unit test most of the low-level code involved in a program,I've found that much of the high level code, the stuff that goes in themain program, has two
How to get as much of your program byte-compiled as possible
The CPython interpreter doesn't run Python code directly, but first compiles it to bytecode . Because this parsingand compiling steps are somewhat time-consuming, CPython optimizesthings by saving the compiled bytecodes into .pyc files (or .pyo files if you used the -O switch to python ), and trying to usethem when possible.This speed increase doesn't necessarily matter all that much for aprogram that runs a long time, but it does matter for typical utilityprograms, which only run for a
Why your main program should be importable
When I first started coding in Python, I didn't know what I was doing.So I structured my Python programs the way I would write Bourne shellscripts or Perl programs, writing functions as necessary and usefulbut otherwise putting all of the logic and code in the program's fileoutside of functions (in what I now call 'module scope').
This is a perfectly rational structure for Python programs, and evenworks; my programs ran fine and were perfectly functional. But it wasalso a
Why negative DNS caching is necessary
DNS software in general has two forms of caching, which I've seen called'positive' and 'negative'. Positive entries hold actual answers obtainedfrom authoritative servers (theoretically, see Dan Kaminsky's DNSattack), while negative entries mark entries that (theoretically) don'texist. Positive entries are cached for their TTL value; negative entries don't have a TTL themselves, but more or lessinherit a TTL from the zone's SOA record.
(The details are complicated .)
Something to remember when using DTrace on userland programs
As mentioned before , Solaris's DTraceis fundamentally a kernel debugger; in order to extract informationfrom userland programs, you need to copy it to kernel space (generallyusing DTrace's copyin() function) before you can start printing it orotherwise use it.The most important thing to remember about this is that you wind updealing with two sorts of pointers: userland pointers, which is whatare in all of those data structures you copy in from your program, andkernel pointers, which is what