Why I’m Ditching Slackware

I went to find a package to install Git. The page at http://www.slackware.com/packages/ still says that the Slackware Package Browser has been moved to http://packages.slackware.it/ — it’s said this for years, and I keep wondering when they’re going to move the package browser back onto the main Slackware site.

But this time, when I followed that link, I found a page that’s so short, I can reproduce it in its entirety here:

The Slackware Package Browser

The old package browser was broken — instead of trying to fix it I am creating a new one from scratch. I’ll be using the Django framework. I’m also looking into Solr and Haystack to see if they can be of some use here.

It’s not going to take a lot of time and I will publish the working portions of the Package Browser as I finish and test them. Also, we’ll have some other thing to announce in a few days, so stay tuned ;-)

You should follow us on Twitter here.

The cherry on top of this sundae of fail awaits at the Twitter feed: the last tweet in it is from October 23rd, 2009. As of the time I’m writing this, that’s four months ago.

The one saving grace is that that last tweet includes a link to a web-browsable repository where I was able to download the package I needed. And yes, I do realize that Slackware’s essentially a volunteer project in Patrick Volkerding’s spare time. And I really do appreciate and love the distro’s commitment to remaining Unix-like.

But I need something that’s a little more rigorously maintained.

(Now I need to figure out what to migrate to. That’s likely to be quite a headache.)

What Would an Ideal Portable-Computing UI Look Like?

Right now, the question of what you need in a mobile computing platform is most often phrased in terms of “Do you need a netbook or a full laptop? Or perhaps one of the new high-end smartphones will manage?” I think the question isn’t one of capabilities as much as it is a question about how we access those capabilities.

For some people, the iPhone’s lack of a physical keyboard is a deal-breaker. For me, the smaller-than-standard keyboard on the average netbook is a powerful disincentive: If I had to use one, it would slow down my interaction with the netbook — and if I learned to be fluent and productive with the small keyboard, it might mess up my muscle memory for dealing with full-size keyboards on my “real” computers. It’s not a trade-off I’m willing to make.

The Palm Prē’s physical keyboard is tiny. I can only key it with my thumbs, and there’s no risk of interference with my pre-existing keyboarding skills. Inputting data with it is achingly slow, but offset by the device’s wonderful portability (it fits into a pocket even easier than an iPhone does). But I can’t really edit text with it, because there’s no D-pad to do precise cursor positioning with. Even the Orange+finger-movement trick is balky and awkward, in my experience; if I want to correct a single-letter typo, getting the cursor after the incorrect character so I can backspace and correct it is such an ordeal, it’s often quicker and easier for me to use Shift+Backspace to delete the entire word and then retype the whole thing.

In effect, even though the phone has the ability to edit text, the interface makes it so difficult that I can’t use the capability. It might as well not be there. What would a better interface mechanism look like? Read More »

Silly Coding Tricks: “Inverted” String Match

First things first: Never actually do this. This is just a fun curiosity, for amusement value only.

Because of the way JavaScript’s search() method works, you can do:

var my_url = 'http://kai.mactane.org';
if (! my_url.search(/http:\/\/kai.mactane.org/)) {
    alert("Your URL is http://kai.mactane.org");
} else {
    alert("Nope, your URL isn't http://kai.mactane.org");
}

Try running this, and it will correctly claim that “Your URL is http://kai.mactane.org” — even though there’s a ! at the beginning of the test. What gives?

That exclamation point looks like it’s saying: “If the search for http://kai.mactane.org within the given string fails…” But what that test is really saying is: “If the search for http://kai.mactane.org returns Boolean false — or anything that evaluates as Boolean false…”

What that search() call actually returns is the character index at which the needle is found, or -1 if it isn’t found. Since the needle is found at the very beginning of the haystack — at character index 0 — search() returns zero. Which evaluates to false in a Boolean context.

If the needle isn’t found, the search will return -1 — which evaluates as true in a Boolean context!

Effectively, the ! operator is reconciling the disagreement between search()’s idea of falsehood and if()’s idea of falsehood: search() returns -1 for a false result (a failed match), but if() considers -1 to be true, not false.

This trick only works with needles that you are sure will only occur at the beginning of the haystack.

Once again, you should never, ever actually write code like this for any serious purpose or in anything you intend to deploy in the real world. The maintainability problems are not worth the amusement of confusing all your co-workers with a test that looks reversed. Instead, use a positional anchor in your regex, and explicitly test against -1…

if (my_url.search(/^http:\/\/kai.mactane.org) != -1)

…like any sensible JavaScript coder. (Yes, that last bit is intended to be ironic. I wrote something once about the silliness of having to add that extra test; I’ll have to see if I can find it and republish it here. )

How Many Ways Can You Exit an App?

Different people use applications in different ways. Sounds simple and obvious, but how often do you look at the real implications of it? Just to take a simple example, let’s suppose you’re using Windows (pretty much any recent version), and you want to perform a simple task: Exit the active application. How many different ways might a user do that?

  1. Alt, F, X (that is, “tap the Alt key and release it, then hit F, then X”)
  2. Alt+F, X (i.e., “hold Alt while pressing F, then release both and press X”)
  3. Alt+F4
  4. Alt+X, up-arrow, Enter
  5. mouse-click on “File”, move down and mouse-click on “Exit”
  6. mouse-click the top-right corner “x” button
  7. in some apps: Ctrl+Q (this is particularly likely if the user has just migrated over from the Mac world, or often has to switch back and forth)

Seven different ways of doing this simple action. I could come up with similar lists for “save the active document”, “copy and paste some text”, and other common actions. Note that Save, Cut, Copy, and Paste are often found on toolbars, unlike Exit, so that makes another way-of-doing-it that’s not on the previous list.

If you want your application to be perceived as “intuitive” or “user-friendly” by all of your users, rather than just a narrow range, make sure that the first thing the user tries works just like they expected.

Alert: SpamAssassin’s Year 2010 Bug

If you haven’t been getting as much email as usual this past week, the culprit may be SpamAssassin. It turns out that SpamAssassin 3.2.5 (the current version, released in June of 2008) has a Year 2010 Bug.

The problem lies in the core configuration file 72_active.cf, which contains a wide variety of “currently active” rules. On line 543, it says:

header FH_DATE_PAST_20XX Date =~ /20[1-9][0-9]/ [if-unset: 2006]

For those who don’t read regular expressions, this rule will match any Date: header that contains a string like 201x, 202x, 203x, etc., where “x” could be replaced by any digit. So, back in 2008, this rule would catch email that claimed to hail from the year 2010 or later. (Well, up to 2099.)

Starting on the morning of last Friday, this rule started triggering on pretty much all mail that hadn’t been delayed, thus adding 3.384 points to every piece of incoming email. Naturally, this could easily push mail over the threshold from “not spam” into “spam” when it doesn’t belong there.

If you’ve been expecting some mail that hasn’t arrived, and your mail host uses SpamAssassin, you might want to check your spam folder.

According to a note on the SpamAssassin project’s main page, you can easily correct this problem in either of two ways:

  1. If your system is configured to use sa-update, run it now.
  2. Remove the FH_DATE_PAST_20XX rule altogether by putting “score FH_DATE_PAST_20XX 0″ at the end of your local.cf file.

Alternatively, if you’re the mail administrator, and you don’t mind setting up a Year 2020 Bug for yourself, you could always change the part that says Date =~ /20[1-9][0-9]/ so that it says Date =~ /20[2-9][0-9]/ instead. After all, stuff that claims to be from years in the future (or past) is likely to be something you don’t feel like reading. But if you do this, I strongly urge you to find some way to send yourself an alert around December of 2019, warning yourself that you need to fix that problem. (And that may be easier said than done.)