Old entries restored

I finally made good on my promise to
restore the old entries from when this blog was running on dasBlog. I tried my best to make sure
you people reading this through RSS didn’t get a bunch of duplicated
posts, but if your reader refreshed at the wrong time you might
have. This operation is not yet big enough to warrant a separate test
server, and besides, we’ve already established that I’m a lazy lazy
man.

The job ended up being more than 15 minutes of quick-and-dirty
scripting, mostly because the old data was full of small gotchas (one
example: in blosxom everything is
files, so it’s a good idea to have descriptive file names. The most
descriptive thing in my old entries was, naturally, the
title. However, that wasn’t unique (I made a lot of posts titled
”Quickies of the day”, for examples), and so I had to implement
”Windows-style” name un-collision code (e.g
quickies_of_the_day_2.txt)

If someone wants the code, it’s here.
Run it like "dasblog2blosxom.pl *.dayentry.xml >
redirect.map"
. The redirect.map file is for making sure
that old dasBlog URLs still work with Apache’s mod_rewrite and the
following rule set:

    RewriteEngine On
    RewriteMap testmap txt:/path/to/redirect.map
    RewriteCond %{QUERY_STRING} ^guid=(.*)
    RewriteRule /PermaLink\.aspx ${testmap:%1} [R=301,NE]
    RewriteCond %{QUERY_STRING} ^guid=(.*)
    RewriteRule /Trackback\.aspx ${testmap:%1} [R=301,NE]
    RewriteCond %{QUERY_STRING} ^guid=(.*)
    RewriteRule /CommentView\.aspx ${testmap:%1} [R=301,NE]

(big up to has for helping me with the mod_rewrite magic)

There are probably bugs that weren’t exposed by my blog data. Also,
I’m stil new to Python programming, and things might not be done in
the most pytonish way. Do not use the code as a guideline on how to do
stuff.

The comments that people wrote in on the old setup are not yet
restored. That is a project for another late night.

The GNU GPL, modifications and swedish copyright law.

Yesterday, I was involved in a discussion that started with the Affero General Public
License
, a modification of GNU GPL, indented to close the ASP
loophole
in GNU GPL v2. The ”ASP loophole” referst to the fact
that a Application service provider (ASP) can make the functionality
of a GPL’ed program available, without distributing the actual
program, through a Web UI or something similar.

The Affero GPL (and upcoming
GPL v3
) intends to close this by demanding (in 2 d) that, if the
software has functionality to allow users to download the source code
of that program, you may not remove this functionality.

Now, the GPL (both Affero and GNU v2) is not a binding license. It
even says so itself in section 5: ”You are not required to accept this
License, since you have not signed it”
. It’s power derives from
the fact that, unless you accpt it, normal copyright law applies,
which forbids you to redistribute software for which you do not hold
the copyright.

However, to exploit the Affero/GNU v3 GPL, you don’t have to
redistribute the software, just remove the feature that allows users
to download the source. And if you don’t accept the license, who’s
going to stop you? Section 5 of the Affero GPL goes on to say:
”However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License.”
(emphasis
mine)

So, the whole power of the Affero GPL hinges on the fact that,
under normal law, you do not have the right to modify a program for
which you do not hold the copyright. But is that really correct? I’ve
read and re-read the Swedish copyright law, and I cannot
find where it says that personal modifications are not allowed. In
fact, it explicitly allows the modification of programs and copying
(but not redistributing) the result in 26 g §, in certain
cases. The swedish copyright law is all about making copies and
the redistribution of copyrighted material, not modification-making.

So, under Swedish law, are you allowed to modify software for which
you do not have the copyright? If so (and I think that’s the case),
the raison d’etre for Affero GPL is null and void in
Sweden. Presumably, this is different under US copyright law.

If you know (or think that you know) that I’m wrong in the above
assumption, I’d love to hear about it, preferably with a reference to
a law and section, or reference to a precedential case. Or, you know,
just with a logical reasoning about why I’m wrong. Still no talkback
system, but I check my referrer logs, so if you blog about it, I’ll
read it. Or just email me at staffan@tomtebo.org

The one thing I can think of that would make modifications of a
software program illegal, according to Swedish law, is 12 §, which states that
one may not create copies of a computer program, not even for personal
use (as opposed to most other works such as books or music, where
personal copying is allowed). Maybe it can be argued that modifying a
program is, in effect, making a copy of it?

Wikipedia and authority

Ernest Miller has a great summary of ”The
Great Wikipedia Authority Debate”
. Essentially, this started when
an unnamed librarian claimed that Wikipedia was not suitable as a
information source, because it can be edited by anyone and therefore
must lack authority. This is not an uncommon assumption, and while I
have often wondered about how much I can trust a given wikipedia
article, I think that it’s wrong, for much of the same reasons that I
trust open source software (which also have recieved similar critisism).

Joi Ito states
that since anyone can edit any page means that ”Any comments that are
extreme or not true just do not survive on Wikipedia”, and that’s
where Wikipedia’s authority is derived from, which is more or less
exactly what I think, but better put. I would liken it to a free
marketplace of facts, where the clear and undisputed facts survive,
while the badly formulated or false facts die and disputed[1] facts are
marked as such.

Just yesterday, while studying history, I came across a nice
illustration about why wikipedia’s authority may be greater than that
of any random expert author. The main book that I’m using, Människan
genom tiderna
, stated that the Fashoda
Incident
occurred in 1892, while Wikipedia stated that it occurred
in 1898 (and the rest of the Internet backs
it up
).

Not a really big deal, but the earlier date confuses the order of
events, and such an error shouldn’t be in a history book. But the
error wasn’t caught, and now hundreds of thousands of books with this
incorrect fact have been put in the hands of swedish students, most of
which will never catch the error. A similar error on wikipedia wouldn’t have lasted more than a few hours. So, with this empirical evidence, which source is the most authoritatve?

[1] As defined by the majority, ”the market”, if you will.

mod_rewrite, win32 and colons

I’ve been spending my evenings divided between frantically studying history and working on
my new project. The
latter is soon to debut on lagen.nu
(but it will be in swedish only).

In swedish law, all laws are uniquely identified by what’s known as
”SFS-nummer”, a string consisting of the year the law was enacted,
followed by a colon, followed by a index number for that year (there
are some exceptions to this rule, but I’m ignoring them for now). For
example, the swedish copyright law is known as 1960:729.

Lagen.nu will contain all swedish laws together with all manners of
cross-referencing goodness. So, wouldn’t it be great if there was some
URL-rewriting magic at work, so that instead of going to
http://lagen.nu/1960/729.html, you could just go to http://lagen.nu/1960:729?
Turns out this is fairly simple with apache and mod_rewrite:


RewriteEngine On
RewriteRule ^(\d+):(\d+)$ /$1/$2.html [L]

Well, on my Unix box, that is. On Windows, things are a little more
complicated, and since my development machine is a WinXP laptop, I ran
into these complications. I run Apache on the laptop, to have the same
environment on both computers. As you may know, NTFS has a
little-known feature called Alternate Data
Streams
, which are specified by appending a colon and the stream
name to the file name. That’s why colon isn’t allowed in filenames (at
least I think that’s why…)

Anyway, Apache has
a problem
with this on win32. Even though we never want apache to
look at the disk for a file named 1960:729, somewhere deep in
the apache core the incoming URL (or at least part of it) is tested
for filename validity, and fails, resulting in a permission denied
error.

So, what to do? IIS to the rescue! It turns out that there is a IIS
plugin closely modelled after mod_rewrite called ISAPI_rewrite, which is
closed-source but free as in beer in its lite version. Good enough for
me. I had some problems with it (couldn’t use \d to match
just digits, I had to use RewriteRule ([^:]*):(.*)
$1/$2.html
) but otherwise, works just fine. Might be worth a look
if you’re on IIS but want to have more control over your URLs.

update: just discovered an interesting bug (i think?) in IE:
If you have a url on the form <a href="1960:729">, IE
assumes that it’s not a relative URL, but instead a absolute URL to
the server 1960 on port 729. Heh.

Learning python… again

An interesting side effect of deciding to quit
programming for food
is that I’ve started to program for fun
again. Since a set of laws is, at it’s core, just a gigantic set of
large documents, much interesting stuff can be done by textual
processing of this body of work. And so I’m writing some python code
to fetch all current swedish laws, the preparation documents for them,
and verdicts referencing them, in order to semantically mark them all
up and cross-reference the hell out of them. It’s been surprisingly
fun so far.

So, why python? Since I’m more proficient in C# or Perl, it would
make more sense to use any of these languages. Well, C# in particular
is a very sensible language, with a very useful class library. But,
you know, it’s just not that fun. There’s something about the
whitespace-sensitivity of python that just feels good. And since I no
longer have to worry about marketable programming skills, that’s what
I’m going to use.

But one aspect of the sensibility of C# and the .Net programming
platform is that the tools are really really (really) good. Visual
Studio’s integration of the class libraries (incl intellisense),
documentation and debugging is first-class. Sure, the editor might not
be as powerful as Emacs, but that’s really only a small part of the
puzzle.

And so I’ve been searching for a good IDE for python
development. So far I’ve tried, and rejected, the following:

PythonWin
Free with a download of ActivePython.
No integrated class browsing or intellisense-like features, and no
easy access to documentation.
Visual Python
This is a plugin to Visual Studio, which to me makes a lot of
sense, and it does a lot of things right. What brings it down for me
is the lack of help and autocompletion for built-in types like strings
and the lack of an Immediate pane during debugging. It’s also way to
expensive for me to buy personally.
Komodo
This is a standalone commercial IDE with an affordable personal
use price. Here, the main dealbreaker is the lack of class library
integration and a slow editor. The class browser also leaves much to
be desired (it’s more of a symbol browser, relly).

So, if none of these passed my test, what am I using? Well, I gave up
on the whole IDE thing and decided to just use Emacs. With some help
from Pontus, I got
python-mode.el to behave enough that I’m comfortable enough to get
some stuff done. The py-help-at-point command does most of what
integrated documentation would do, and for the time being I’ll have to
browse the class library over here with
Mozilla instead. And use printf-debugging. It worked ten years ago, it
should work now as well.

I do intend to test WingIDE and BlackAdder,
but since they’re both commercial and not that affordable for a
student, they have to be really really good for me to choose them over
my current Emacs solution.

Back to school

As a part of my ongoing preparations to apply to law school next
year, I’m currently studying the history of the world. In Sweden you
can, if you find that your old school grades aren’t so good, do a
general nationwide test for applying to the university —
”Högskoleprovet”, and if you get a good score on that, you can
use that instead of your old grades to apply for any university
program.

Well, my old school grades weren’t that hot, and so I took the test
some time ago, and it went really (really!) well. I might have gotten
smarter in the last ten years. But then I discovered that in order to
be a laywer, you need to be a history buff. Or at least, your old
history grade must be at least 3, regardless of your
Högskoleprov-score. Mine was a 2 (graded from 1-5, 5 is
best). Oops. (This isn’t specific to law school and history, every
university education can have some subjects for which applicants are
required to have at least a 3 as their old school grade. This wasn’t a
problem to me before since I’ve only read computer science, for which
history is not considered that important.)

But there’s a second chance for people like me. We can re-read the
high scool history curriculum and take a day-long test, and if we
pass, then we still get to apply to law school. And so what I spend a
lot of nights doing now is reading and re-reading history books at an
increasingly frantic speed. The date for the test is Sept 13th, for
which I have to be as historically versed as I’ll ever be (actually,
there is another test the 8th of november that I can take, should I
fail this, but I try to keep that possibility out of my mind for
now).

Anyway, I’m finding that history is really an interesting subject,
which really DOES help me to understand the present better. I wonder
why I never liked it back in school? I guess it’s harder to see the
use of it before getting interested in current affairs and in general
seeing the world.

On another note, since I won’t be writing so much about programming
anymore, I have been thinking about starting to write this blog in
swedish instead, as it will be of even less interest to people outside
Sweden now. Then again, if I’m going to link out to lots of people all
over (and I will), it might be nice for them to know what I’m writing
about. If I had put up a talkback system, all you trusty readers could
weigh in with your options, but I’m a lazy lazy man.

The new project: Learning to drive

The first half of this year, my big Project was to run a
marathon. That project eventually ended successfully (link to marathon
race report forthcoming, as soon as I get it up), and so I went
looking for a new project. Since I’m almost 30 and still don’t know
how to drive a car, it felt like a suitable project. In some parts of
the world the concept of an adult without a driver’s license is
unheard of, but here in Stockholm the local transportation system is
really good enough that you don’t really need one. Still, it would be
neat to have.

So far I’ve successfully applied for permission to seek a driver’s
license, enrolled into driving school, and even taken a few
lessons. I can now do amazing things like starting the car and
stopping it again, or drive really slow. It’s fun!

New directions and challenges

Well, about that blog writing hiatus. Since all you loyal readers
have so obviously been waiting for new posts, I feel I should tell you
why I was gone, what I’ve been doing, and where I’m going. Or
something.

I’ve decided to quit programming, and working with computers in
general. At least as a way to make my living. I’ve been working as a
programmer for eight years now, but for some time now I’ve begun to
feel that the challenges that this profession offers don’t interest me
the way they used to. Therefore, after some heavy consideration, I
came to the conclusion that maybe I should stop doing it.

But what to do instead? Since I’m only (well…) 28, I feel I have
plenty of time to try to learn something substantially
different. Which is why I’ll go to law school starting next year
(can’t start this autumn, my employment contract says I should work
til the end of December). I took a introductory course in law about
ten years ago, when I was studying CS, and found it pretty
interesting. There are a lot of paralells to be drawn between the
legal system and any computer system, mainly in that they are both
really complex sets of rules, intendet to describe of how we would
like things to work, but since the people writing the descriptions are
fallable, the resulting system has idiosyncraties, holes and other
bugs.

I think the general mindset and methods that I’ve deveopled as I’ve
been designing, developing and debugging computer software systems can
be very useful for most kinds of intellectual works, but particularly
law. Also, I guess it can be very useful to have a solid understanding
of technology in general, and software development in particular, when
working as a laywer, paralegal or whatever I’ll end up as.

But before that, I have 4 1/2 years of studies to complete. It’s
going to be interesting to see if I’m better or worse at studying than
I was ten years ago.