Vice Comparison

Posted by Daniel Lyons Sat, 19 Jan 2008 07:48:00 GMT

Reasons to consider switching to masturbation for your new vice instead of a MMORPG:

  • It’s free
  • It’s more fun
  • When you’re done, you have something to show for it
  • It requires less time. With this extra time you can (but don’t have to):
    • Hold down a job (how about that drinking vice!)
    • Spend more with non-imaginary friends
    • Accomplish more than one task in a given 24-hour period

I’m having trouble coming up with good catch phrases for this new campaign, but I have a few ideas:

  • “Be your own whore—not someone else’s!”
  • “Human Contact: it’s not just for those who bathe!”
  • “Aren’t you neglecting some of your other needs?”
  • “You remember that part in the Matrix where they show the tanks with the people inside that are being used as batteries…?”

Tags , , , , ,  | 2 comments

CSS

Posted by Daniel Lyons Thu, 29 Nov 2007 06:50:00 GMT

The way most people format CSS is something like this:

css.selector {
  attribute-name: value;
  attribute-name: value;
}

I read somewhere, probably via Reddit, that a better way to do it is like this for readability purposes:

css.selector { attribute: value; }
other-css.selector { attribute: value; }

Today Josh suggested something a bit more radical: alphabetize them by selector. You arrive at something like this:


a { foo: bar}
a:hover { foo-bar: baz; bazzle-bat: foo; }

b { font-blah: blah; }

I liked this a lot, but I took it a little further. I indented the braces to line up, like this:


a       { foo: bar}
a:hover { foo-bar: baz; bazzle-bat: foo; }

b       { font-blah: blah; }

(For a bigger example, check out the CSS on my tumblog.)

Now, I like this for two reasons. One is that this really does make finding what you’re looking for a lot easier. But another, in my book better reason, is the statement this makes about CSS.

You would never organize a program’s functions alphabetically. You would never indent them all so the code is a big jumble on the right somewhere. This layout turns CSS into a selector rolodex with insanity on the right. And you know something? That’s exactly what CSS is: insanity, complete unmitigated chaos. The best we can do is label the roads. That’s what this layout does. It gives you trails that lead off into the wilderness. And you know something? It’s better.

So this morning when I read Brendan Eich’s The non-world non-wide non-web, I was already in a bad mood because, what has the W3C ever done for us? We’ve got XHTML, which is basically a dead letter. We have CSS, which is absurd. We have the whole XML toolchain. It’s hilarious to hear people slam Lisp and turn around and defend XML’s virtues. (I bet if you printed out the W3C’s paperwork on XML, you’d arrive at more than 1500 pages.) To learn SVG, one I thought I had liked, is also a pile of lies is just the icing on the cake.

Actually, it reveals how the W3C works quite clearly. Look at the commentary on Brendan’s page. A bunch of “invited experts” facing off with a Mozilla developer, scorning the WHATWG as the “WhatthefuckWG.” Granted, I have no idea what they’re about either, but still. Nobody expects programmers with decorum. “Invited experts,” on the other hand…

As time has gone on I have seen that there are fewer and fewer anonymous institutions that are really trustworthy in computing. Zope was a big disappointment, after boosting themselves (anonymously) as being the premier OOP wizards of the universe. W3C has pretended for some time to know everything about the internet and to have the experience and knowledge necessary to make things happen, ultimately culminating in two large fiascos (CSS and XML Schema). In the case of XML Schema, there was a better, simpler concept around which has gained some adoption, RelaxNG. The work mainly of one person.

I bring up Lisp alot because, lately, using it is such a joy. There are some features you’d look at and say, that’s a wart. One example is multiple return values. You have to use this obnoxiously long-named multiple-value-bind form to get at the additional return values past the first one. It’s tempting to look at that and say, why not just return a list?

Well, one reason you wouldn’t think of but might stumble into is because you now want to include some extra information in what’s returned by a function but you don’t want to change all of the call sites to wrap their call with car. You wouldn’t think about this kind of thing unless you were writing in a language in which you would find yourself swapping out functions piece-by-piece. It’s the opposite of Haskell, where you want the compiler to catch every little thing and force you to say exactly what you mean.

Yesterday I implemented pagination. I had already created a paginate function and was using it to clamp the number of results. Then I realized, due to the data structure I’m using (a list masked by a series scanner) I’m not going to want to get the length of things to decide whether or not I have another page. The easiest way to decide if I have another page is to paginate on one more item than I want and see if I get one more item than I want, and then omit that from the return value and return a boolean indicating whether there’s more. So I make the changes and drop in my function which now returns something else. None of my existing code died. Then I went through and changed my existing code, function by function, to utilize the flag I’m now returning. There were something like four call sites so it wasn’t a big deal.

If this were Java, I would have told you all about using the Refactor menu item in Eclipse, and how easy it was to change all my existing code and recompile it and run it and confirm that yes, it is working.

Now you could ask questions about the quality of the design. It would not have been hard, however, to make another function do the actual work and return a list of items and a value in a list and repackage it for the existing call-sites and mark it deprecated. I don’t think that design is any better though, so in this case evolution brought us to where we probably should have been. Assuming there isn’t a dramatically better design. And maybe (probably) there is.

End rant.

Tags , ,  | no comments

FreeBSD and PostgreSQL

Posted by Daniel Lyons Fri, 29 Sep 2006 06:52:59 GMT

Bill and I had quite a bit of downtime today, due to two problems:

  1. Gentoo isn’t maintained as well as it used to be, and permitted Bill to update a package (OpenLDAP) which has no backwards compatibility regarding the database format.
  2. When you use LDAP, even if everything speaks PAM (which it does), it winds up linked against LDAP.

We’re thinking about migrating two things:

  1. The whole system away from LDAP, probably to PostgreSQL or (shudder) regular flat files.
  2. The OS from Gentoo to FreeBSD.

I personally would like to see both changes made, since I think FreeBSD is stabler and more well-maintained. However I think keeping ports up-to-date in FreeBSD is somewhat harder than keeping Gentoo up-to-date, but I’m not really sure why I feel that way; I guess going back to my early experiences with 4.6 and 5.0 which had a wonkier package system.

I also have learned something important about LDAP: it’s a total fucking sham. I remember this was my initial opinion of it, and I spent a couple years at Matterform thinking maybe it is a good idea because everything can utilize it, but, though that is true, I simply don’t need it, ever, and it is bulky, slow, inefficient with CPU, disk and RAM, and very fragile. Most of the benefits of it can be realized with PAM and PostgreSQL. In fact, the only benefits you don’t get are:

  1. Software browsing of the directory (Apple’s AddressBook and Mozilla Mail can do this)
  2. Simple replication via slurpd (though Slony-I can replicate PostgreSQL in a similar single master/many slave configuration)

The rest of it can be emulated via PAM and nsswitch. There’s a sysauth project for PostgreSQL which does both and they’re both post-1.0.

And if you still believe the horseshit about LDAP being better than a database, here are two little factoids to correct you:

  1. TinyLDAP is 7 times faster than indexed OpenLDAP directory, and more than 37 times faster than a default install of OpenLDAP, which has no indices.
  2. My 1.5 page SQL query from work, which PostgreSQL’s query optimizer says should cost 10,000 “points”, is delivered in a fraction of a second.

When a directory asshole tells you directories are optimized for reading and databases are not, you can mention that. I also find it incredibly annoying that the OpenLDAP people insist that you’re not comparing OpenLDAP to PostgreSQL fairly unless you put a lot of time and effort into tweaking OpenLDAP. Then and only then do you see similar performance to out-of-the-box PostgreSQL. Of course, PostgreSQL being a database, you can also tweak the hell out of its performance.

Screw the maintsream.

Tags , , ,  | 1 comment

Media

Posted by Daniel Lyons Thu, 14 Sep 2006 01:48:47 GMT

I think we should all start calling the media “le petit terroriste.” Pardon my probably incorrect French.

Tags  | 1 comment