Older blog entries for JoeNotCharles (starting at number 22)

Joel gives bad advice: details at 11:00


Am I blind, or does Joel on Software not allow comments any more? (Or did it ever?) Well, I guess I’ll respond to his latest article on disabling unusable menu items right here, even though that means he’ll never see it.

Don’t do this… Instead, leave the menu item enabled. If there’s some reason you can’t complete the action, the menu item can display a message telling the user why.

That would be incredibly annoying - I’d be constantly clicking on items I expect to work and getting a popup saying, “Sorry.” In an app I use often, I use the menus mostly by feel, so I’m not going to notice that now there’s a message saying, “Disabled because the moon is in th’e fourth quarter and you haven’t paid your phone bill.” Or if I do it’ll be in the instant before my finger clicks the button, so now I’ll just have time to realize I screwed up before it pops up the Box of Aggravation.

A better thing to do would be to disable the option, so if I click on it nothing will happen instead of the app yelling at me, and have feedback on why it’s disabled.

Syndicated 2008-07-02 03:09:40 from I Am Not Charles

I’m a greasy little monkey


Wow, work’s really been kicking my ass lately. I’ve been meaning to update this blog for ages, but I’ve had no time. Finally got the day off and spent an hour or so learning to use Javascript and Greasemonkey. While we’re waiting for something more substantial, here’s my first script. You might even find it useful:

// ==UserScript==
// @name           Include Linked Images
// @namespace      ca.notcharles.greasemonkey
// @description    Add linked images to the end of a webpage.
// @include        http://www.wizards.com/*&pf=true
// ==/UserScript==

/*
Copyright (c) 2008 Joe Mason 

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/

var body = document.getElementsByTagName('body')[0];
var anchors = document.getElementsByTagName(’a');

for (var i = 0; i < anchors.length; i++)
{
	var anchor = anchors[i];

	// only process anchors containing images
	if (anchor.getElementsByTagName(’img’).length == 0) continue;

	// add the target of the image to the end of the document
	var href = anchor.getAttribute(’href’);
	var hr = document.createElement(’hr’);
	body.appendChild(hr);
	var img = document.createElement(’img’);
	img.setAttribute(’src’, href);
	body.appendChild(img);
}

I won’t bother going through it because there are a million Javascript tutorials out there.

So what’s it useful for? Well, Wizards of the Coast have been releasing Dragon and Dungeon magazine articles online - free, for the time being. Sooner or later they’ll start charging for them so I’ve been downloading as many as I can and saving them as PDF’s. (The best way to do this is to click on the “Printer Friendly” link at the bottom of an article, and then print to PDF. On Windows you’ll have to install an add-on for this - I like PDFCreator.)

The problem is that some of them have thumbnailed images which link to a full-sized version, and I’d really like the full images to end up in the PDF. So this script just finds every image which is a link, and appends that image to the end of the page. It only runs on the printable format page (the “pf=true” at the end of the @include line). It just occurred to me it should really be checking that the link actually leads to an image, but meh - that’s not very likely for these articles, and if it happens I’ll deal with it then.

This article is a nice simple example to try it on.

Syndicated 2008-07-02 02:37:32 from I Am Not Charles

Blog of the trivial


This is the second time in the past two weeks I sat down to post about an ingenious workaround I found, only to find out it wasn’t necessary. I like to post a code sample saying, “This should work, but it turns out to be more complicated than that,” and then build up the less obvious solution. But both of my simple test cases worked just fine, leaving me without an entry. “Hey, this really obvious thing should work - and it does! Good night!”

This is leaving this blog a little thin.

Syndicated 2008-06-09 01:37:14 from I Am Not Charles

Wild Zebras


Christian at Design Desires posted some simple Javascript to make dynamic zebra-striped tables. He asked for comments to be mailed to him - in keeping with last month’s rant about open discussion, I’m posting my response here instead:

No sir, I don’t like it.

I don’t find it adds anything. I’m perfectly able to read across the lines of a plain old static table, so highlight one line doesn’t make it any faster to read that line. It also doesn’t help me pick out a line when scanning with the mouse, because I’m already looking at the line that gets highlighted - I put the mouse there myself!

I don’t know if it’s just my browser, but highlighting the line causes a lot of flicker. (The “more extreme” example from Neil Roberts is even worse - it actually resizes things while I’m mousing over them, jerkily. That’s terrible!) So I’d really hesitate to use this until it’s been tested on a lot of browsers and setups to make sure it’s smooth everywhere.

The only advantage I could see is if I look away and come back later. There might be some value in highlighting the line after the mouse has stopped there for a few seconds, which wouldn’t cause flicker when scanning quickly. It still might be more annoying than useful, though.

Syndicated 2008-05-10 15:31:49 from I Am Not Charles

Advogato vs. the world


Now that I’m not using Advogato any more, I’ve taken a little time to think about what made me dislike it. Mostly it’s that the user interface is bland, but there’s also a bit of clunkiness that really annoyed me:

90% of the world’s blogs are laid out in the same way: if you have something to say about a post, you make a comment on it. If you have something to say that you think deserves a post of its own, you post in your own blog and make a trackback to the post you’re referencing.

Advogato works a bit differently: you can post, and that’s it. There are no comments and no trackbacks. On the surface, that’s because it’s more primitive, but the community’s had plenty of time to add these features. Either they just don’t care or they think their system’s actually better.

(Wait, that’s a misuse of worse-is-better - I should have linked to less is more.)

The advantage of the Advogato system is that people do comment on each others’ posts, but they do it in their own journals. You just start out with a link to the post you’re commenting on, in this format:

shlomif: did you actually read the Nichomachean Ethics? The thing is repulsive…

On most blogs, when referencing a post somewhere else the standard is to quote copiously - quote the parts you are replying to directly, quote the parts you find especially interesting, quote the parts that give the argument’s main points. Since you found the subject interesting enough to go to all this effort, you want to give your readers a good overview. But this gives the reader very little incentive to actually go back and read the original post you’re quoting, since they already have the hilights. The Advogato style gives no context, but readers can always click the link to find it. That means that, on Advogato, people who are hooked in by a post are actually more likely to go back and read the entire context, because there’s no other way to get it.

The other advantage of Advogato’s style is that I can find interesting discussions no matter who starts them as long as someone I know takes part. When a discussion starts on one blog and unfolds entirely in the comments there, it can’t draw in anyone who isn’t already a reader. I only find new blogs when they’re widely linked to, which only happens when lots of different people have a lot to say on a subject, or when they feel that a post is so insightful that it needs to be shared. I miss out on the smaller, more specialized posts which may attract comments and observations by not wide dissemination.

On the other hand, the Advogato style discourages casual commenting, since it’s so much work to make a link - nobody comments unless they have something substantial enough to make a full post. Discussions tend to peter out after a few exchanges. And unless you already have a strong relationship with the person you’re replying to, how do you know they’ll even read your reply? There’s a list of recent posts throughout the entire site on the front page, but this doesn’t scale well at all.

So, no, the Advogato system doesn’t really work as-is. It’s pretty good for building a sense of community, but the poor scalability and lack of features in the interface it makes it unattractive for serious blogging, so many writers migrate elsewhere. (Take a look at the Advogato recent blog entries list and see how many are syndicated from other sites.) In fact, the community feeling is exactly the reason I switched to Wordpress - I wanted more control over the layout, the name, and the style. I wanted a blog that I felt like I owned. But here I am complaining about how blogs are fragmented when everybody owns their own instead of participating in a communal site.

So what’s the solution? Act like a writer, not a reader. Unless what you want to say is really inconsequential, do it Advogato-style, in your own blog, with a simple link back to the post you’re referring to. That way more people will see what’s going on, and the whole community will grow. Just commenting on other people’s blogs is easier and faster, but it’s also less effective. Unfortunately, it’s what’s most encouraged by most interfaces.

(Now - should I disable comments, just for irony?)

Syndicated 2008-04-30 05:35:21 from I Am Not Charles

Advogato again (7 replies)


I was just about done typing up a post about Advogato and how its community differed from most blogs, and then I went over there to check on something and realized my entire thesis was wrong. So let me ask a question to see if I can salvage it, or if I’m just a blind idiot:

I last used Advogato 4 years ago. I could have sworn at the time, there was no way to leave a comment on a post, leading to lots of people making posts in their own journals just to reply to a post in another journal. But the top post on avogato.org right now has 7 replies, so apparently it’s possible.

Has it always done that, or was it added recently? (That is, some time since 2004?)

Syndicated 2008-04-27 17:17:56 from I Am Not Charles

“Troubleshooting icecream” is not a helpful search


I’ve been a happy distcc user for many years - every time I got a new computer, I tended to have the old one still sitting around with nothing much to do except be part of a compile farm. Really, what else are you going to do with the old thing? But last time I upgraded, it was because the old computer completely died, so for a year or so I’ve been laptop-only and distcc-free.

However! My new job sent me a company laptop, and the combination of two computers in the house plus big projects to compile from scratch means it’s time to get distcc back in shape. Except the new laptop came with SuSE (which I’m not a fan of, so far), and SuSE’s package manager only contained some new thing called Icecream.

Icecream has an unfortunate naming scheme for at least three reasons: if I need help, do I Google for “icecream” or “icecc”, the actual binary name? (This is compounded by the fact that it’s so new there’s very little documentation out there to find, and it’s pretty much overwhelmed by hits about actual ice cream. Mmmm.) Ubuntu has a completely different package called icecream - name collision! And finally, they had the gall to name their work scheduler “scheduler”, which tells you nothing about what it’s for - Ubuntu sensibly renamed it to “icecc-scheduler”.

Apart from that, though, this is a pretty nice improvement. The first obvious difference is that there’s no more manually keeping DISTCC_HOSTS in sync - thank God! One server runs the aforementioned “scheduler” daemon, which keeps track of which hosts are available and how loaded they are, and every host that wants to take on jobs runs the “iceccd” daemon, which - in theory - finds the scheduler by multicast. Even if multicast fails (see below) you just have to feed them the one scheduler hostname manually, instead of the entire list.

The other big improvement is that icecc has the ability to package up a toolchain in a chroot, and transfer the whole thing to a compile host. That means you don’t have to worry about keeping your tools exactly in sync on each host any more (although you can avoid overhead by doing so). I haven’t tried it yet, but if it works it will save me a lot of headache, since I have no intention of taking Ubuntu off my personal laptop and I can see things getting out of sync in a hurry. It can even be used for cross-compiles.

And now the bad: like I said, it’s new and there are very few docs. (EDIT: apparently it’s not so new, but it’s still harder to find information for it than for distcc. I guess I should have said it has less mindshare.) The page I linked to is about it, really. So as a public service, here are some troubleshooting tips, in the order I figured them out:

  • The main symptom of icecc not working is that all compiles go to localhost only. There are two main causes: iceccd on other hosts can’t find the scheduler, so they never register, or they register but the scheduler decides not to use them.
  • To check that a host is registering, run icecc with the “-vvv” (very verbose) flag, and tail -f the log file (/var/log/iceccd on SuSE, /var/log/iceccd.log on Ubuntu). If you see “scheduler not yet found.” more than once or twice, this is the problem - you’ll have to pass the scheduler hostname manually with the -s flag. Or just pass the hostname manually from the start, because in my experience the autodetection never works.
  • If you see “connection failed”, it’s found the host but couldn’t connect for some reason. Check your firewall settings.
  • If all the hosts are connected (you’ll be able to see them in the detailed hosts view of iccmon) but the schedular still sends all jobs to localhost, check the scheduler log (/var/log/icecc-scheduler.log on Ubuntu; I can’t remember the name on SuSE, because I renamed mine to match Ubuntu’s and forgot to write down the original). Again, use “-vvv”. You’ll see “login protocol version: ” lines, again confirming the hosts are registered, followed by lots of “handle_local_job” lines, which confirm that the scheduler’s not sending anything out.
  • Make sure all the hosts have the same network name. Ubuntu’s default parameters set the network name to ICECREAM; SuSE’s left it blank. I didn’t trust leaving it blank so I added a -n parameter to the command line on SuSE. I don’t know if it was necessary, because my problem turned out to be the next one:
  • Make sure all hosts use the same protocol version. Turns out the Ubuntu package I installed was a few versions behind the SuSE version, so it used protocol version 27 while SuSE used version 29. (icecc developers: if your protocol isn’t backwards compatible, this would be a WONDERFUL thing to give an error message about!) I ended up compiling from source on both machines to make sure I had the same version - fortunately, it’s small.

Whew. Yes, it was a bit of a pain in the ass to get working - I hope cross-compiling works, or I’ll have to ask myself whether it would’ve been easier to just track down distcc for SuSE in the first place.

Syndicated 2008-04-25 04:20:14 from I Am Not Charles

Advogato #6


Originally posted on Advogato on April 25, 2004:

I don’t imagine anyone actually cares about my web page at notcharles.ca, since all that’s there are a few old reviews and stuff, but I might as well announce that it’s going away…

Commentary: Never mind, nobody cares about the rest of this. (That applies to entery #7 too.) My god, has it been 4 years since I’ve had a web site?

Well, that’s it - everything useful from my Advogato account is here. That didn’t last very long. Now to get some new content up. Let’s see if it takes this time.

Syndicated 2008-04-18 05:40:18 from I Am Not Charles

Advogato #5


Originally posted on Advogato on April 16, 2004:

Hmm, I notice from the entry just below my last one that Parrot is getting really impressive. Must… resist… new project…

Commentary: Ha ha, Parrot? Really? Four years later, how much work has been sunk into Parrot and what exactly does anyone have to show for it?

Syndicated 2008-04-18 05:36:08 from I Am Not Charles

Advogato #4


Originally posted on Advogato on April 16, 2004:

pcolijn just posted some Gnome API usability gripes that exactly mirror what I felt the one time I tried to write a Gnome app a few years ago. I’m disappointed to see the state of the documentation apparently hasn’t improved much. KDE’s is way ahead.

At the time, I didn’t even have the option of using a C++ binding to avoid having to fiddle with all the low-level GObject funkiness, because gtk– sucked ass. I understand it was discontinued, then recontinued, then changed maintainers, or something. Anyway, Peter, have you looked at C++ bindings at all?

Commentary: the precise post of Peter’s I was replying to is here, and his reply is here. I just took a brief swing through the Gnome API docs and they look much better than they did.

Syndicated 2008-04-18 05:25:40 from I Am Not Charles

13 older entries...

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!