blog.rupamsunyata.org

Decklin’s excuse for some blogging software. Est. 2006.

When mayonnaise goes bad

This is is a wonderful metaphor: "looking in the fridge every few minutes and hoping that something tasty will appear".

I may be thick, but Planet does not appear to store any information about how often a feed ought to be polled (my blog seems to be hit every 20 minutes even when I'm AWOL). I use rawdog, which does.

When adding a feed, I make a vague guess at how often I want to poll it, and then periodically adjust the time based on how often updates actually happened. This is done with a terrible, awful, ugly hack that reads the database[1] and spits out the config file with new-and-improved times. Pretty dumb, but good enough "for now" (apparently I haven't touched it in over a year).

rawdog will also automatically update feed locations if given a 301. Since it already rewrites the config for that, I might try to merge time updating into the core someday, but no one has demanded such a feature AFAIK.

[1]And by "database", I mean "pickle", since Adam doesn't want any fancy dependencies. Despite how slow this ought to be, the combination of optimized (such as it is) feed-polling and ever-faster CPUs in my web servers have made it fast enough for me not to care.

Dee Ess Double-yoo

Occasionally I see an absurd discussion like this one continue to drag itself out and I feel sort of guilty for writing one of the big “minimalist” things. The point of writing less code is not to conserve memory or cycles or soothe some “first thing we’ll do, let’s purge all the libraries” fetish. The point is to only write what you want to express. If a feature would require that to get lost in a bunch of dreary nonsense, then it’s not worth it. If there’s a library you can call that lets you say the what and not the how, then it is.

More importantly if there’s a standard program that you can call that’s the same standard program that everyone has agreed on for decades and that saves you from implementing a protocol which you are obviously not smart enough to implement on your own, then you just shut up and fucking call it. And if that causes you to realize that your program is pointless, don’t write it.

Not writing it is the least amount of code you can produce. And that is the best possible thing you can do. That’s what this unix thing is all about. Those who do not understand it are condemned to reimplement it, poorly.

Whoo

So I’ve gotten the roux rewrite running, finally. Not doing anything useful, but running. I can’t believe I was using a pull parser and generating the Atom 0.3 by hand(!) before. Ugh. Totally, completely, hideously embarrassing.

Anyway last time I got distracted on the way to making it useful and just said “screw this, I’ll put some regular expression crap in” and it’s been hobbling along on that (basically no better than the million other screen-scrapers out there). But. I had a brainwave about how to implement what I was really looking for (the “civilized” bit), which works on simple cases at this point; I just need to think about making it extendible. Should be fun.

Enabling domain-specific languages seems to be a theme with all this recent stuff. I don’t know why.

Constants of the universe

One of the few annoying things about free software is simply finding it. You can get a very good idea of what is to your taste or not from people around you, but if you don't know or care (or want to care!) about some particular problem, generally people whose opinions you trust don’t like any of this crack either.

In particular, Web Frameworks(tm). Lots of people love them. I’ll take vanilla. After paging through several manuals last weekend for things which I might be able to use a templater from, and finding that despite all the other features, no one seemed to even care that much about even doing inheritance sanely, I got annoyed and grumbled something about how they all sucked and figured I could just factor that logic out myself and use what I was already using for the boring bit.

However, Erich pointed out that that sucked too. And if you care about being correct (says me who serves all these pages with the XHTML mime type despite it breaking Internet Explorer and Google), you should probably assume that if you give your users (including yourself!) something fragile, they’re inevitably going to break it (and if they’re the sort of users that have been crawling out of the woodwork these days, well...). So I checked out Kid, to which I am giving yet another link here because it’s just that good. I’ve seen attempts to implement the “it’s all valid XHTML” thing before and they were rather blah. This one seems to actually fit with its being hosted on lesscode.org. And I am nothing if not a sucker for less code. And for things being pleasant to read.

So I ported my templates over and added the four lines I alluded to, and now (since I know my output is provably valid), although I have not put them live yet, I have a starting point for making them be a little less crack (really, it’s very bad). Has anyone registered lesscrack.org yet?

New blog

Okay, I’m putting this blog on Planet Debian... now. The old one is not gone yet, because I’m tired and I don’t think I’ll do it until tomorrow.

In a fit of hubris, I wrote some software to run this blog (which is just a bunch of generated static files), called Mnemosyne. I was bored of PyBlosxom and it was slow. I believe Erinn said something like, now it’s only a matter of time until I write my own RCS... If I get to that point I will really start worrying. If anyone is looking for something along these lines, please tell me what sucks and/or what is broken.

Anyway, rather than categorizing things (ugh), I’m just putting anything tagged “planet” in the feed that goes here. I think this will work better.

Oh, and I almost forgot: my blog now has automatic flooding-prevention. Nothing older than a day gets in this feed. I don’t know why feeds in general don’t have some sort of time limit.

Mnemosyne stats

Since this blog thing is kind of functional, let’s see how much fat I’ve been able to avoid. Lines of non comments/blanks/continued-docstrings:

Code: 204 modules + 21 command = 225
Blog: 6 conf + 60 layout + 142 style = 208

433. Eh. I can do better. It’s still ugly. Hopefully getting it clean enough to not be embarrasing can involve removing some more code, and not adding too much. DRY. That’s the principle here.

There are more examples to add, of course. A good procmail recipe definitely. And my blog is slightly more complex than the example.

Update at the end of the next day-ish: 445. Lots of ugliness replaced. Wrote 120 more lines of README. Not bad.

From a few days ago

Snakes on a Plan9!

I still have the port of rc, but it is pretty much “done” these days as far as fixing bugs and I don’t think I’ve uploaded the Debian package in a year or so. I may get back into it and add some improved readlineiness someday.

Generated by Mnemosyne 0.12.