Press "Enter" to skip to content

Russell Finn’s Blog Posts

Preface to an introduction

Random comments about what all this is, exactly:

* Yes, this is a _really_ barebones weblog right now. I like a clean design… but maybe
not _this_ clean. I’ll probably poke around with some CSS at some point, but
right now I’m more interested in writing comments. (Any thematic pointers or
donations are of course welcome.)

* What am I doing commenting on C#? I’ve never even written any code in C#.
Those comments were occasioned upon the release of Mono 1.0, which I downloaded
to my PowerBook, poked around in briefly, and bought a couple of books. This
last action engendered a couple of rants which I decided were too ranty to
keep as email messages, so I posted them. Then life intervened. In the future
you’re more likely to see comments about Python, C++, and C (whatever there is to
say about C).

* “A weblog, huh?” I’ve been slowly drifting towards a mid-life — well, not
“crisis” exactly, but something close. The results of the 2004 general election
in the United States have accelerated that process. [You might infer from the
first posting in “politics” below where I stood in the election, and what my
mood is like this week.] So what’s the point of having a web site if I can’t
share my angst with the world at large? At the very least, I can get things off
my chest, and maybe the act of writing will help set my thoughts in order. (I
guarantee *no* cat pictures. Ever. Might get a dog someday, though.)

* Speaking of the world at large, I expect to address some of my comments to
a wider audience — those of you outside our borders who are wondering what
the hell just happened. (So are 49% of us.) I may even dust off some old books
and write some thoughts in [Esperanto](http://www.esperanto.net), which I
studied some as a teenager but have not done much with since then.

* Yes, I’m quite a geek. Besides Esperanto, I spent my teen years getting a ham
radio license, going to science fiction conventions, and playing table-top
baseball simulation games (the old-fashioned way, with dice and charts, though
believe me if I’d had a computer at home back then I’d have been all over it).
In adulthood, I’ve owned a variety of Macs and even two Newtons. Despite
this, I’m married to a beautiful woman and have a wonderful daughter and a baby
boy on the way, so there’s hope for you junior geeks.

Comments closed

Words fail me

Quoted on [BoingBoing](http://www.boingboing.net/2004/11/04/kerry_concedes_updat.html):

> “I got a very clear picture of [Bush’s] base constituency when having a discussion over lunch with some co-workers about our favorite children’s shows. I was commenting on how much I liked Sesame Street, and one woman (a very vocal Christian conservative) said, ‘Oooh.. Sesame Street is too tolerant for me.’ To my horror, several other women nodded their heads in agreement. I guess I didn’t even think there was such a thing as too tolerant.”

Comments closed

Well, that was a waste of time…

The events of the past week having motivated me to restart my weblog, I decided
to take a look at [WordPress](http://wordpress.org), which seems to be getting
popular and looks like it has some nice features.

So I downloaded it. Gee, it requires a MySQL database. Now I’ve got a lot of
software experience, but it happens that SQL databases is not one of those things
I’ve ever needed to use before. OK, so it’s easy to create a MySQL database at
my [webhost](http://www.dreamhost.com), and the WordPress setup automatically
creates all the necessary data structures.

So now I figured I’d change the auto-generated password. [And here my troubles
began.](http://www.randomhouse.com/pantheon/graphicnovels/maus2.html) The new
password didn’t work. I clicked on the “lost my password” link. WordPress
sent me a new password. _That_ one didn’t work. Oh well, I thought, I haven’t
really done anything I can lose, yet, so I deleted the database and recreated
it, made a test post, and went to bed.

This morning there were _seven_ pieces of comment spam waiting for moderation.
I’d made exactly _one_ post, with commenting turned off, and apart from a
reference in a set of PyCon notes, nobody even knows I have a blog. I can’t
be having _this…_

…but, not ready to give up, I deleted the spam and tried to make a couple of
new posts, figuring there must be something in the WordPress community about
this. Then I tried changing my password again. Bad idea; same problem. I checked
the WordPress websites. Hey, it’s a known problem, and there’s a way to fix it
— edit the database directly. Boo. Hey, my webhost supports phpadmin. Yay.
Hey, I can’t log into my own database with _any_ password I can think of. Boo.

People, I’m sure there’s something obvious to do at this point, but I’ve got a
job; I’ve got a family; I’ve got a life; and I’m pretty sure a simple weblog
doesn’t really need a freakin’ SQL database. It’s just words, right?

So I’m back to Blosxom for now. (Sorry, [Ted](http://www.sauria.com/blog), Pyblosxom
wasn’t looking very stable for me last spring; at that time, even one of the
developers had switched his own blog to WordPress or MT or something. I’m sure
it’s better now, but I’m not interested in hacking a blog; I just want to write.)

Also, no comments for now. If you want to comment, (a) get your own blog, or (b)
send me an email (I’m not posting my email address, but you can probably deduce
it) and if it’s cogent or worth a reply, I’ll post it.

Comments closed

Followup to first annoying C# thing

My friend [Nick](http://www.nickbastin.com) dashed off the following quick reply to my previous screed (in its first incarnation as an email message to him):

> *I think it’s the difference between thinking of it as a verb or a noun.*

That would be fine, except they’re using it as a noun. Allow me to quote from [Dumbill and Bornstein](http://www.oreilly.com/catalog/monoadn/):

> These methods [such as `OnFileSystemEvent`, which will be referred to later]
> must match the delegates declared in `FileSystemWatcher`. From the Mono
> FileSystemEventHandler.cs […] source file […]:
>
> `public delegate void FileSystemEventHandler (object sender, FileSystemEventArgs e);`
>
> A delegate declaration defines an instance of a class descended from
> `System.Delegate`. In `FileSystemWatcher`, then, `FileSystemEventHandler` is an
> implicit subclass of `System.Delegate`.

So it *looks* like a function declaration, but it’s *really* a subclass declaration? (I presume “instance of a class” doesn’t mean “an object that belongs to a class” here.)

> … Next, we construct a new delegate of type `FileSystemEventHandler` and use the `+=` operator to add it to each of the `FileSystemWatcher`’s `FileSystemEventHandler` events.

[The code that does this is:

> `FileSystemEventHandler onFileSystemEvent =
> new FileSystemEventHandler (OnFileSystemEvent);`

where `OnFileSystemEvent` was previously declared as a static method with a signature matching the one above.]

So what we appear to have is a declaration that looks like a function but really declares a subclass of a special type of object that has only one method and no instance variables. Then you create one of these — *things* — initializing it with a matching method, and finally attach it to another object in a special way, such that it will be called back when a particular — *something* — happens.

I’m not saying this isn’t useful, but couldn’t they have presented it a different way, or called it something different (“callback”)?

Maybe I’m putting the blame in the wrong place. The philosophy of the Developer’s Notebook series seems to be to get you writing code quickly, and eschew all the theory. (They even title this section “Define Function Pointers”.) Perhaps I *should* crack open [Hejlsberg *et al.*](http://www.awprofessional.com/title/0321154916) and see if they explain it more precisely.

Comments closed

The (first) thing annoying about C#

[I haven’t gotten too far into the language so I can’t presume there won’t be more…]

I *want* to like C#. I think it has a lot of advantages over the widely used languages that come before it. When it was first released, it was widely believed to be a replacement for Java; but I’m looking at it more as a replacement for C++ — the little things that are peculiar idioms or complex constructs in C++ seem to tend to be directly supported in C#. So I’m predisposed to like it.

But then I come across these annoying Microsoft-isms — specifically, the Humpty-Dumpty-like [1] way in which they define ordinary computing terms like “events” and “delegates” to be something almost, but not quite, completely different.

I know what a “delegate” is — it’s an object that handles behavior for another object. A common design pattern, and one supported pretty much directly in Objective-C and Cocoa. But that’s not what a C# delegate is, apparently — although I’m not sure exactly what it’s supposed to be. It’s “like a function pointer”, except we don’t have those in C#. And the first example I see (in [*Mono: A Developer’s Handbook*](http://www.oreilly.com/catalog/monoadn/)) suggests that the thing you declare as a delegate is really a prototype for the action that the actual thing you instantiate is supposed to take — huh? Wouldn’t *that* be the delegate?

And apparently an “event” is a collection of delegates, and not, well, an event.

And somehow delegates are magic so you can instantiate one, add it to an “event”, then later instantiate a *different* one and *remove* it from the *same* event, and the “right thing” happens. (Because they’re “like function pointers”.)

Maybe this will make sense if I keep reading. (I hesitate to crack open [*The C# Programming Language*](http://www.awprofessional.com/title/0321154916), which is also on my desk; I’m a bit of a programming language nut, but this one looks like I need a law degree to get through it.)

[1] I could have said “Orwellian”; aren’t you proud of me?

Comments closed