Wednesday, November 24, 2004

Set And Forget

It's almost Thanksgiving. I don't kee-yah 'bout dat.

My ncurses XUL renderer is coming along nicely. Too bad XUL sucks and only crazy people write programs for ncurses. I'm working on getting CSS properties imported and making colors work. Maybe I'll start a SourceForge project for it once it's a little more mature. Or a Savannah project.

Everyone's an idiot except for me.

Monday, November 15, 2004

Shitcock!

Okay, now you have to hear about some computer shit because I am proud of it. So you know how I was writing a constraint-based layout engine? Well, here's my algorithm, which Mike Bell can probably prove inefficient and wrong. You start by building a tree of elements that need to be rendered, some of which may specify their size explicitly, some of which may specify their size unreasonably, and some of which may not specify size at all. Here's how you decide how big they get to be:
  • At every node in the tree, ask your children how much space they need to render themselves; offer each child node the maximum space available to you
  • If the aggregate of requested sizes from your children exceeds one or both dimensions of your maximum size, scale all children to fit proportionally
  • Set your size to the minimum between the aggregate of your child node requested sizes and the maximum space available to you
To calculate your own size requirements, do the following:
  • If you have any text content, size the text according to a line-break-aware text-sizing algorithm (too boring to describe here)
  • If you have child nodes, take the maximum width and the aggregate height (or vice versa, if you're orienting your elements horizontally) of your children
  • If you have a specified min-width or min-height, ensure that your requested width and height are at least equal to these lower bounds; if you have a specified max-width or max-height, these should establish a cap for both dimensions
Here's a piece of good news -- I was getting really frustrated because I was running my renderer on a bit of sample XUL and getting a layout I didn't understand. So I got kind of depressed and figured I'd dick around with the built-in XUL renderer in Firefox. I run it on my sample XUL, and I get the same output as my renderer! So my renderer appears to work, even though I have no idea why it's doing what it's doing. Now it's more or less a question of figuring out how to render all of the elements, like checkboxes and radio buttons, etc.

Here's a piece of bad news. It turns out the reason that KeySpan's been asking us to pay $60 a month for cooking gas is that there's a gas leak in the building somewhere between our apartment and the incoming gas line in the basement. The KeySpan guy shut off the gas to our apartment and the landlord's got a plumber coming on Thursday, but it's not super clear when we're gonna have gas again.

In a moment of nostalgia, I went searching for this story that Bill and I had found on Stile Project a while back. I remember Billy originally remarking on it as a pretty dead-on characterization of how depressing and shitty (literally!) suburban life sounds -- it doesn't disappoint.

I'm on vacation on Thursday and Friday! Suck a dick, employers!

Saturday, November 13, 2004

Yes. Right Into The Camera. Yes.

It seems congratulations are in order:
  • All hail M-Biddy for getting a job -- at OpNet, the Pentagon's largest supplier of nuclear missiles and Arab-killing gases! No, that's not what it is; it's some boring god-damn networking thing
  • All hail Devlin Smithers for making. more. money.
This ncurses project I'm working on is starting to get pretty interesting -- what I'm doing is creating an ncurses rendering target for XML-based user-interface toolkits. ncurses, by the way, stands for "new curses," and curses, by the way, is this fairly hoary UNIX library for doing low-level manipulation of terminal screens. Think text-mode graphics, basically. The problem with ncurses is that, while it makes it very easy to, say, draw a single character at particular place on the screen -- no easy feat with the standard set of system calls and libraries in UNIX, mind you -- it is horrendously difficult to render a full screen of "widgets," like boxes, buttons, text input controls, etc. On the other hand, though, you've got these XML user-interface-markup document types, like XUL, where you can quickly and easily specify things like buttons and check-boxes and whatever. Here's what a little piece of XUL might look like:

<box id="main-box" align="center" border-width="1">
<label id="main-box-label" text="Click the button below"/>
<button id="main-box-button" text="Click me!"/>
</box>

It's pretty obvious what that's gonna look like, right? And it was super-easy to write, too. Here's the problem: Currently, the only real renderer for XUL is called Gecko -- it's what renders HTML for Mozilla Firefox, too -- and so you need a raster-based GUI like X11 or Win32 to run it, and this doesn't help anyone at all if they're trying to develop text-based applications. So what I want to do is make it so that you can feed in that XUL to ncurses and have ncurses draw it in text mode. This is not an unreasonable proposition, since the majority of the widgets specified by XUL don't specifically require pixel-level control of the display device.

Where it gets interesting, though, is in trying to figure out where to draw these things on the screen. I found a little bit of information on this at the Gecko development page, but for the most part I have to figure it out myself. HTML, see, uses what's called a "flow" based layout paradigm, which means that you more or less assume that a "page" can be arbitrarily long, so that if there's an element that absolutely needs to be a certain size, then the other elements can wrap around it or go after it, and you basically can just put things in the next available space on your infinitely long or wide page. XUL, on the other hand, as well as other rendering kits like Gtk, are "constraint" based, which means that there's a certain maximum size (such as an application's window) and you're not allowed to exceed that size -- so if you give all your elements leeway to take up as much space as they want, you might not have room for all of them. So maybe you have to squish some of them a little, and even then you still might not have enough room. Basically, constraint-based layout algorithms are more likely to fail than flow-based ones; and that's okay -- it's interesting, even. So I'm trying to write some layout code now. We'll see what happens.

Adam Cadre finally got some essays up about the election -- it's a lot of material, but it took him like a week and a half, too! The more of his shit I read, the less I think I'd like to hang out with him personally, but that doesn't mean he doesn't make a mean bean dip.

I want to do something this weekend, but I think I'm getting sick. We'll see.

Oh yeah, here are links to some 'blogs that I found; I'm not gonna create permanent links to them because I'm not especially close friends with their respective authors, but some of you might be, so:

Wednesday, November 10, 2004

People With Ultimatums

Rudy sez:
...commentators all over the political spectrum are saying that one of the reasons that Democrats lost the election is that they are "elitists" and "out of touch" with the "moral values" of Americans. But you know what? The problem is not that Democrats are out of touch with Americans. It's that these so-called "Americans" are out of touch with America as a concept. While all of these pundits are decrying the division of America as somehow the province of "liberals" and their misunderstanding of the middle and south of the country, how about just the occasional fucking word about how Bush's constant berating of "intellectuals" and "Massachusetts" is more divisive, as if somehow Illinois, Pennsylvania, California, and New York are filled with eggheads who only theorize and refuse to get their hands dirty in the real work that all those amazing "real" Americans engage in every day.
Apparently some of you think the south of this country deserves some sort of pass, because... God, I don't know, your reasons are so shitty and irritating that I can't even remember any of them. And neither, apparently, can this guy. But I could have told you that ignorance wasn't a fucking virtue before this election. And I know you guys think that ignorance plus poverty makes 'em okay, but look: When people get too poor, sometimes you just have to kill them, because clearly they didn't want it bad enough.

John Ashcroft resigns?! Apparently some of you saw this coming. Sez he:
The objective of securing the safety of Americans from crime and terror has been achieved.
Buh?!

I submitted my partially-working thread-cancellation patch to the Guile people. The more I think about it, the more I think my code was working and was actually exposing some SEGVs in their code. I mean, it was crashing when I pushed a quoted symbol into the list of cancellation expressions, and the crash happened in one of their symbol lookup functions, so... I don't know. Hopefully someone will look at it and get back to me before they release 1.8.

I also packaged and made preliminary releases for gzochi-client, gzochi-common, and gzochi-server. Peep it here. If you have any sort of UNIXy operating system, I encourage you to download it and give it a shot. Hell, even if you've got Windows, all you need to do is install Cygwin, and you should be able to use my stuff. Throw me a god-damn bone here.

I've also started working on that ncurses renderer for XUL -- after getting into a heated argument (well, not that heated) with some creeps at the Mozilla Foundation. For some asinine reason, they don't want to write a DTD for XUL, because then XUL wouldn't be "extensible" any more via this language they've got called XBL. This is retarded! If you develop a "technology," or whatever they're calling XUL, and you want developers to use it, you need to make them some kind of promise that it's safe to use -- this promise is called a "standard," and even if part of this standard is that core functionality can be extended. You just include the extensibility in the standard, so that your developers know the ways in which your thing can be extended. Fuck! God damn it. Their other rationale for not coming up with a standard is that "Mozilla is not a validating XML parser." Jesus Christ! These people who don't believe in DTD validation, much less don't believe in Schema validation... the horrible, anxiety-producing code you must write -- huge if-blocks scrabbling to figure out what to do if you come across an element that isn't a member of some array you put together somewhere. People: Whenever you write parsing code for a particular "document type," you are damn well writing a DTD / Schema validator from fucking scratch!

Okay, okay, you're bored -- I can read the writing on the wall. Fine, here's some more stomach acid, this time from The Register:
Your primary and secondary schools will continue to turn out third-rate pupils with limited opportunities, while you enjoy the satisfaction of making it on your own without health care when a catastrophic illness bankrupts your family.

Your agricultural universities will continue issuing Ph.D.s in football, and bogus Protestant Evangelical and Fundamentalist theology, and how to jerk off a bull safely. Your children will learn to borrow enough money to erect chicken houses so that they, like you, can take custody -- not possession, but custody -- of Tyson's chicks, feed them, rear them, assume losses from those that fail to thrive, and in the end earn just enough money to service their endless debt, and realize a profit of perhaps $12K a year. Your bank thanks you; Tyson thanks you; George W. Bush thanks you; and I thank you.

Thursday, November 04, 2004

Americans Get The President They Deserve

Constructive solutions from some dude with a diary on DailyKos:
I also have a substantive recommendation to the Blue states: Do all that you can to shut off the spigots. Completely. Shut it down. All of it. No more sucking on the government's teat for the Red states. Transform the rhetoric of your Republican brothers into practice: Slash federal spending (is that still a Republican position?). Wipe out the farm subsidies. Eradicate all block grants to the states. End the transfer of thirteen cents out of every Blue State Tax Dollar to the Red states (call it "Real Welfare Reform".) Replace every dollar of reduced federal spending with a dollar of in-state spending.

Let Illinois, New York, Michigan, Wisconsin, Washington, California, and the rest of the Blue States keep their own damn money. Let the Red states keep out the gays, which is apparently their highest priority. Wait ten years and see who comes out ahead. And yes, this is bad policy. But it's clearly great politics. And winning on the political dimension is, sadly, a necessary condition for winning on the policy dimension.
My own solution -- don't know how easy it'll be to implement, but put my name on the paper if you submit anything to a conference: Read this; now this. Get it?

Or just listen to my friend "Razor":
The men, the revolting, shit-for-brains slobs who voted for Bush should be taken out behind some stripclub and stabbed in the back of the neck with a butter knife. Some of them should have their eyes popped out by the same knife before they're killed.

Monday, November 01, 2004

Roach In A Bottle

There really was a roach in a bottle! I saw it last week while I was dumping the recycling -- the roach was in a beer bottle with about a tablespoon of old beer in it and it was plinking and plunking around trying to get out. I knew it would 100% get away and upset the cat if it escaped, so I was, you know, picking up the bottle and shaking the roach back into the beer. I was hoping it would get sort of addled as the alcohol entered its spiracles, but that didn't happen, at least, not after one and a half minutes. So I dumped it into the toilet. The other night, Mer cooked some salmon and the glass baking dish exploded. Well, it didn't explode, but as she took it out of the oven, it basically fell apart in her hands. (The fish survived without a scratch, somehow.) Apparently we weren't supposed to 'broil' with it. Well, I don't call 400 degrees boiling, do you? Excuse me:
Here is your Moist Towelette. It will clean and refresh your hands and face without soap and water. Self dries in seconds, leaving skin smooth and soft. Directions: Tear open packet, unfold towelette and use.
Toddles and Teddles and I went "canvassing" in Pennsylvania yesterday. I don't know if you can even call it canvassing -- we just slipped this little leaflets under everyone's doors. Sometimes they'd hear you and open the door as you were walking away -- this gigantic and pretty much naked man picked up the pamphlet I'd slipped under the door as I was closing the door of his fence. I said, "Just wanted to make sure you knew how important it was to vote on Tuesday!" He looked exactly like the sexual predator in Stevie. Later, a small dog made a big dog bark and I fell off the top step of some stairs. It's important to vote, kind of. My thread shit doesn't work. So I'm implementing some other stuff in gzochi. Thinking about maybe getting going on ncurses bindings for XUL. That would be insane. Oh yeah, you guys can leave comments on my 'blog now. Try not to get, you know, too excited. What else. The gas bill is too high; the telephone does not work.