Design versus construction
Every so often, people compare programming to something like buildinga house and ask why software projects can't be half as well estimatedas physical engineering projects typically are. One of the many reasonsthat this is a bad comparison is that physical engineering is differentfrom software engineering in a crucial respect.
The process of getting something physical constructed is generallydivided into two phases: design, the intellectual engineering work, andconstruction, which is theoretically mere unintelligent physical labour.Thus, once you've finished the design work
My approach to website passwords (and why it is the right one)
Recently, I read yet another article that asked people how many oftheir accounts would be compromised if someone got their password ona non-critical website. My answer is simple: none. And I think thatthis should be the answer for most everyone, to the point where itirritates me that it isn't.
I always use unique passwords for each website, generally a strongrandom one . For non-critical websites,I have my browser memorize them for me (and I get irate when this is
How CPython optimizes allocations for some built-in types
Due to writing yesterday's entry , I gotcurious enough to go see how CPython handles the creation of some of thebuilt-in types, and what sorts of optimizations it does. The necessarydisclaimer is that this is for CPython 2.5.1; it doesn't necessarilyapply to other versions of CPython, and it probably doesn't apply at allto other Python implementations (although I expect that they have theirown tricks). Thus, the best use for this is as an illustration
Some of my assumptions about Python object allocation
In a reddit comment thread I was accurately dinged for being a bit casual in how I talked aboutobject allocation at the end of my previous entry . As the comment notes, calling ' .setdefault(k,[]) ' creates and throws away a new object each time the key alreadyexists, just as ' .setdefaults(k, SomeClass()) ' would.
Well, sort of. One of the things I assume about Python is thatallocating and freeing new empty instances of built-in types
The accumulator mini-pattern and .setdefault()
What I'm going to call the accumulator (mini-)pattern is a commonoperation when summarizing a stream of data: you have some keys, whichcan repeat, and you want to accumulate some data each time each keycomes up, to count it or sum it all up or keep a list of all of the datafor each key.
In pretty much every language that has them, this pattern is done withdictionaries (or hashes or the language's equivalent). In Python, thiscreates
Recognizing non-interactive shells and 'shell levels'
The issue of when bash sources your .bashrc does raisethe obvious question of how you can tell in your .bashrc what caseyou're dealing with, so that you can do different things in each ofthem.
The traditional approach to do this is to set environment variables tosignal what state you're in and how many things have been initialized.One traditional 'have I been initialized' variable is $PS1 , but thishas the tiny weakness that su 'ing to the account from another account
True point in time restores may be hard
One of the things that people ask for from their backup system, oftenfor sensible reasons, is the ability to recreate the system exactlyhow it was at some past time; these are usually called 'point in time'restores. Point in time restores for the recent past are usuallyreasonably easy, but doing it for significant times ago can be verydifficult.
The problem is the dependencies involved start to grow and grow. Forexample, if you want to be able to restore your accounting system tothe exact state
I hate flaky systems, Fedora 10 and/or hardware edition
I am generally an even, calm person. But there are some things that justabsolutely get under my skin and drive me to screaming frustration, andone of them is flaky, unreliable systems. This is especially the casewhen I can't tell if the problem is hardware, software, or both.
Since I'm writing about this, you might guess that I am dealing withsuch a thing right now. You would be correct; my office workstation hasbecome really flaky ever since I upgraded it from
Backups and archives
When I am thinking of backup issues, I tend to strongly separate backupsfrom archives, and in fact I believe that there are two different sortsof backups with different characteristics. Since I think that this is animportant issue, let me explain my distinctions.
To start with, to me the difference between backups and archives isthat backups are for recovering after a system failure, while archivesare for storing data that you no longer keep online. Here, you have toconsider 'system failure' somewhat broadly, so
When bash sources your .bashrc
Since I just looked up the rules on when bash sources your .bashrc (and did some testing), here's the rules on what gets sourced when,for reasonably current versions of bash. Making this more confusingis that bash apparently uses heuristics for some of its decisions.
- login shells do not source your
.bashrc; they source only yourprofile (bash looks at various names, but I just use.profile). - non-login interactive shells source your
.bashrc. - shells started by ssh to run