Culpatic programming

In the legal world, there is this latin term ”culpa”, which translates
roughly to ”carelessness” or ”neglience”. The term does not seem to be
used in US Law, but I’m guessing a similar concept still exists in all
Common Law countries (it might be worth mentioning to the casual
Google refereant that this post is written based in my understanding
of swedish law — if you’re in some other jurisdiction you
should take this with an even larger grain of salt).

The concept of culpa, or rather careless behaviour, is very important
when it comes to assessing whether a certain harmful action (or
sometimes inaction) by a person should make that person liable for
damages. The rules differ somewhat if the two parties were in a legal
agreement of some kind, but basically — if you cause harmful effects,
you’re generally worse off if it was due to carelessness than if it
was by accident (”casus”).

For example, if a supplier did not deliver his goods to the customer
at the agreed time and place, and this was harmful to the customer in
some way, the supplier is more likely to be liable for damages if the
reason for the failed delivery was due to him forgetting about it, as
opposed to there being a unforeseeable traffic jam that prevented him
from reaching the delivery place on time.

To determine wheter a particular action should be categorized as casus
or culpa, a court need to have some sort of guideline as to what is
generally considered to be careless in the context of the harmful
action. In some cases (such as traffic, or working environments), there
are rules that more or less spell out what is considered careless. In
the absence of those rules, courts generally observe what level of
carefulness that is considered adequate by those proficient in the
profession or trade.

In the programming world, there’s a whole lot of ”culpatic
programming” going on — proficient developers know about appropriate
steps to ensure at least some level of quality in their delivered
products, ranging from design methologies to source code management to
customer involvement to established QA techniques. They also know that
these steps often are not followed — for whatever reason. The result
is buggy software that cost time, money and sometimes lives.

Yet, the fact that many programs and systems are carelessly written
ise rarely discussed — most of the time, it is observed that bugs
will happen, a EULA or
other agreement that absolves the company of liabilities due to bugs
in the code is slapped on, and that’s the end of that.

While is true that it’s impossible (in any practical sense) to write
bug-free programs, it is possible to make a meaningful
distinction between bugs cased by carelessness (”culpa” bugs) and bugs
cased by accident (”casus” bugs). The intented usage for the system
will probably affect how the distinction is made (a off-by-one bug
might well be determined to be a ”casus” bug in a admin UI for a
in-house CMS, but is probably a ”culpa” bug in the firmware for a
electronic pacemaker). This also means that software that, when
written, is likely to capture a mass market (such as the RPC server in
the next Windows version) could and should be held to a higher
standard than software written on a hobby basis, when it comes to
determine carelessness.

Often, when the issue of software liability is raised, the
discussion is cut short by the observation that software will always
have bug, and that some of them will cause disastrous effect. It’s
also observed that there is a point in software development where the
cost of finding and fixing the remaining bugs is larger than what the
customers are prepared to pay, and if we make the law demand software
developer liability, no programs (particularly open source ones) will
get released. While it’s true, it’s a all-or-nothing argument. As a
(semi-retired) developer, I’ve caused my fair share of bugs in my
time. Many of these were casus bugs, but some were culpa bugs, bugs
that I would not have created had I followed adequate development
procedures. It’s the latter sort of bug I’m talking about — the ones
that are technologically AND economically feasible to eliminate, but
developers lack incentive to do so (other than pride of
craftmanship).

One large problem is that very few are qualified to determine
whether a bug is culpa or casus. Then again, very few are qualified to
determine if a certain food handling procedure is adequate or
neglient, or wheter a car’s failing braking system was carelessly
designed or not. The legal system still demands that we make a
destinction between culpa and casus in these cases, and does not allow
the food or car industry to sell their products with attached general
disclaimers that frees them from responsibility. Wheter enough care
was taken is determined by experts in the respective fields. For the
software case, this will mean letting independent parties review the
code and particular the conditions of the bug. This will, in many
cases, be expensive, but so are the problems that software bugs
cause.

Comments disabled (for now)

A month or two ago, I was the number one search result at google
for ”staffan”. Today, it seems I have been blacklisted entirely; A
search for ”Staffan Malmgren’s blog” brings up a bunch of trackbacks
and other references to me, but not this very page.

Most likely, this is punishment for my lack of comment-spam
housekeeping – I just went through the comments data files, and there
were maybe 5-10 legitimate comments among hundreds of spam messages,
most of them advertising the same few sites. Serves me right for
neither implementing spam controls or the nofollow
attribute.

(The other possible explaination is that someone at Google, in the
recent controversy about IDN
and browser security
, dug up some reference to my old Google
cracked?
post, didn’t think it was funny, and did something like
DELETE * FROM pages WHERE url LIKE
'http://blog.tomtebo.org/%'
. But that is not very likely.)

Anyway, the result is that comments are disabled for now, as I
haven’t bothered with tweaking the Blosxom writeback plugin to have
some sort of spam control. Comments will return when I move this thing
over to WordPress, which has way better spam control features out of
the box, which should happen shortly after my new server is delivered,
which should be in around two weeks.

flac2mp3.py

I have a medium-sized CD collection (around 500 or so albums), but
like most geeks I never actually fetch the disks and put them in my
CD/DVD player anymore. Instead, I rip them to some digital format and
listen to them on my computer, my portable MP3 player, or my showcenter. I’ve
been listening to music this way ever since I first discovered CD Copy back in -97 or so, and ripped
my entire collection.

Back then, disk space was expensive and MP3 encoders were less
stellar than they are now,
and so after a couple of years my collection of 128 Kbit/s rips
started to sound bad compared to what was practical in 2000. Another
round of ripping, this time to 192 Kbit/s, which was fine for a while,
until I got a portable MP3 player that didn’t have a lot of storage
(256 MB), but a nice WMA encoder. WMA in a portable player sound
perfectly OK at 64-80 Kbit/s, but not if you convert from a MP3
(because of the lossy nature of both MP3 and WMA, a MP3->WMA
conversion will be lossy2).

So, if I was to re-rip my 500 CD’s for the third time, I wanted to
do it right. I could rip them to plain WAV files, and then write small
scripts that would convert them to my preferred format for portable
devices, but WAV has two problems: Firstly, the files get huge, and
secondly, it has no good standard for metadata (like song, artist,
album etc).

Enter FLAC. Open source
implementation, lossless decent compression and excellent metadata
capabilities. So, when I’m re-ripping now I use EAC with the configuration
given at this
page
(scroll down a bit for the FLAC configuration), and hopefully
I should never have to do it again after this.

So, now I have a tree full of albums in FLAC format. To make things
extra pretty, I’ve even used Album
Cover Art Downloader
to create those folder.jpg files
that gets used by Windows XP’s Thumbnail view. Only one problem,
though — neither my Showcenter nor my portable player can play
FLAC. I neeede a way of batch converting my FLAC collection to MP3
and/or WMA.

Well, I haven’t solved it for WMA yet, but with this script you
can convert such a tree to MP3 files, as long as you have python, lame
and the command-line FLAC encoder. It’s written for windows, but
should run under any Unix variant without too much trouble, I hope. It
is written with the assumption that your folder structure is only one
level deep, ie directories should be named ”Johnny Cash – At Folsom
Prison”, not with subdirectories like ”Johnny Cash/At Folsom
Prison”. Since I rarely have more than three albums with any one
artist, I find the ”Artist/Album” convention mostly annoying.

Configure the upper-case variables, start a command prompt, cd’ to
the root of your FLAC tree, run the script and then be patient (for
me, the conversion takes well over 24 hours, and I have a relatively
zippy computer).

No license, do whatever you feel like with it (but do let me know
if you find it useful!)