Shallow Thoughts : : Jun
Akkana's Musings on Open Source, Science, and Nature.
Sat, 30 Jun 2007
Today's topics are three: the excellent comic called xkcd,
the use of google to search a site but exclude parts of that site,
and, most important, the useful Mozilla technique called Bookmarklets.
I found myself wanting to show someone a particular xkcd comic
(the one about dreams).
Xkcd, for anyone who hasn't been introduced, is a wonderfully
geeky, smart, and thoughtful comic strip drawn by Randall
How to search for a comic strip? Xkcd has an archive page but that
seems to have a fairly small subset of all the comics. But fortunately
the comics also have titles and alt tags, which google can index.
But googling for
dreams site:xkcd.org gets me lots of
hits on xkcd's forum and blag pages (which I hadn't even known
existed) rather than just finding the comic I wanted. After some
fiddling, though, I managed to find a way to exclude all the fora
and blag pages: google for
xkcd dreams site:xkcd.com -site:forums.xkcd.com -site:fora.xkcd.com -site:blag.xkcd.com
In fact, it was so nifty that I decided I might want to use it again.
Fortunately, Mozilla browsers like Firefox have a great feature called
bookmarklets. Bookmarklets are like shell aliases in Linux:
they let you assign an alias to a bookmark, then substitute in your
own terms each time you use it.
That's probably not clear, so here's how it works in this specific
- I did the google search I listed above, which gave me this long
and seemingly scary URL:
- Bookmarks->Bookmark this page. Unfortunately Firefox
doesn't let you change any bookmark properties at the time you make
the bookmark, so:
- Bookmarks->Organize Bookmarks, find the new bookmark
(down at the bottom of the list) and Edit->Properties...
- Change the Name to something useful (I called it
then choose a simple word for the Keyword field. This is the "alias"
you'll use for the bookmark. I chose xkcd.
- In the Location field, find the term you want to be
variable. In this case, that's "dreams", because I won't always be
searching for the comic about dreams, I might want to search for anything.
Change that term to %s.
(Note to non-programmers: %s is a term often used in programming
languages to mean "replace the %s with a string I'll provide
So now the Location looks like:
- Save the bookmarklet (click OK) and, optionally, drag it
into a folder somewhere where it won't clutter up your bookmarks menu.
You aren't ever going to be choosing this from the menu.
Now I had a new bookmarklet. To test it, I went to the urlbar in
Firefox and typed:
xkcd "regular expressions"
The first hit was exactly the comic I wanted.
(You'll find many more useful bookmarklets by
[ 21:13 Jun 30, 2007
More tech/web |
permalink to this entry
Thu, 28 Jun 2007
I upgraded my laptop's Ubuntu partition from Edgy to Feisty.
Debian Etch works well, but it's just too old and I can't build
software like GIMP that insists on depending on cutting-edge
But Feisty is cutting edge in other ways, so
it's been a week of workarounds, in two areas: Firefox and the kernel.
I'll start with Firefox.
Firefox crashes playing flash
First, the way Ubuntu's Firefox crashes when running Flash.
I run flashblock, fortunately, so I've been able to browse the web
just fine as long as I don't click on a flashblock button.
But I like being able to view the occasional youtube video,
and flash 7 has worked fine for me on every distro except Ubuntu.
I first saw the problem on Edgy, and upgrading to Feisty didn't cure the
But it wasn't their Firefox build; my own "kitfox" firefox
build crashed as well. And it wasn't their flash installation; I've
never had any luck with either their adobe flash installer nor their
opensource libswfdec, so I'm running the same old flash 7 plug-in
that I've used all along for other distros.
To find out what was really happening, I ran Firefox from the
commandline, then went to a flash page. It turned out it was
triggering an X error:
The error was: 'BadMatch (invalid parameter attributes)'.
(Details: serial 104 error_code 8 request_code 145 minor_code 3)
That gave me something to search for. It turns out there's a longstanding
bug, 14911 filed on this issue, with several workarounds.
Setting the environment variable XLIB_SKIP_ARGB_VISUALS to 1 fixed the
problem, but, reading farther in the bug, I saw that the real problem
was that Ubuntu's installer had, for some strange reason, configured
my X to use 16 bit color instead of 24. Apparently this is pretty
common, and due to some bug involving X's and Mozilla's or Flash's
handling of transparency, this causes flash to crash Mozilla.
So the solution is very simple. Edit /etc/X11/xorg.conf, look
for the DefaultDepth line, and if it's 16, that's your problem.
Change it to 24, restart X and see if flash works. It worked for me!
Eliminating Firefox's saved session pester dialog
While I was fiddling with Firefox, Dave started swearing. "Why does
Firefox always make me go through this dialog about restoring the last
session? Is there a way to turn that off?"
Sure enough, there's no exposed preference for this, so I poked around
about:config, searched for browser and found
browser.sessionstore.resume_from_crash. Doubleclick that
line to change it to false and you'll have no more pesky
For more options related to session store, check the
Session Restore page.
Kernel: runaway kacpid
Alas, having upgraded to Feisty expressly so that I could build
cutting-edge programs like GIMP, I discovered that I couldn't build
anything at all. Anything that uses heavy CPU for more than a minute
or two triggers a kernel daemon, kacpid, to grab most of the CPU for
itself. Being part of the kernel (even though it has a process ID),
kacpi is unkillable, and prevents the machine from shutting down,
so once this happens the only solution is to pull the power plug.
This has actually been a longstanding Ubuntu problem
but it used to be that disabling acpid would stop kacpid from
running away, and with feisty, that no longer helps.
The bug is also
The Ubuntu bug suggested that disabling cpufreq solved it for one
person. Apparently the only way to do that is to build a new kernel.
There followed a long session of attempted kernel building.
It was tricky because of course I couldn't build on the
target machine (inability to build being the problem I was trying to
solve), and even if I built on my desktop machine,
a large rsync of the modules directory would trigger a
runaway kacpi. In the end, building a standalone kernel with
no modules was the only option.
But turning off cpufreq didn't help, nor did any of the other obvious
acpi options. The only option which stops kacpid is to disable acpi
altogether, and use apm. I'm sorry to lose hibernate, and temperature
monitoring, but that appears to be my only option with modern kernels.
Kernel: Hangs for 2 minutes at boot time initializing sound card
While Dave and I were madly trying to find a set of config options to
build a 2.6.21 that would boot on a Vaio (he was helping out with his
SR33 laptop, starting from a different set of config options) we both
hit, at about the same time, an odd bug: partway through boot, the
kernel would initialize the USB memory stick reader:
sd 0:0:0:0: Attached scsi removable disk sda
sd 0:0:0:0: Attached scsi generic sg0 type 0
and then it would hang, for a long time. Two minutes, as it turned
out. And the messages after that were pretty random: sometimes related
to the sound card, sometimes to the network, sometimes ... GConf?!
(What on earth is GConf doing in a kernel boot sequence?)
We tried disabling various options to try to pin down the culprit:
what was causing that two minute hang?
We eventually narrowed the blame to the sound card (which is a Yamaha,
using the ymfpci driver). And that was enough information for google
to find this
Linux Kernel Mailing List thread. Apparently the sound maintainer
decided, for some reason, to make the ymfpci driver depend on an
external firmware file ... and then didn't include the firmware file,
nor is it included in the alsa-firmware package he references in that
message. Lovely. I'm still a little puzzled about the timeout: the
post does not explain why, if a firmware file isn't found on the
disk, waiting for two minutes is likely to make one magically appear.
Apparently it will be fixed in 2.6.22, which isn't much help for
anyone who's trying to run a kernel on any of the 2.6.21.* series
in the meantime. (Isn't it a serious enough regression to fix in
2.6.21.*?) And he didn't suggest a workaround, except that
alsa-firmware package which doesn't actually contain the firmware
for that card.
Looks like it's left to the user to make things work.
So here's what to do: it turns out that if you take a 2.6.21 kernel,
and substitute the whole sound/pci/ymfpci directory from a 2.6.20
kernel source tree, it builds and boots just fine. And I'm off and
running with a standalone apm kernel with no acpi; sound works, and I
can finally build GIMP again.
So it's been quite a week of workarounds. You know, I used to argue
with all those annoying "Linux is not ready for the desktop"
people. But sometimes I feel like Linux usability is moving in the
wrong direction. I try to imagine explaining to my mac-using friends
why they should have to edit /etc/X11/xorg.conf because their distro
set up a configuration that makes Firefox crash, or why they need to
build a new kernel because the distributed ones all crash or hang
... I love Linux and don't regret using it, but I seem to need
workarounds like this more often now than I did a few years ago.
Sometimes it really does seem like the open source world is moving
backward, not forward.
[ 22:24 Jun 28, 2007
More linux |
permalink to this entry
Thu, 21 Jun 2007
Whew -- I think our resident squirrel Notch has finally had her long-overdue
litter. It wasn't immediately obvious, but she's been deflating over a
period of about a week. Since then she's gone off her mad burying
frenzy and gone back to eating the nuts we give her.
Last week, while she was still pregnant, she was kind enough to give
me a nice nut-burying exhibition right outside the office door, which
I got on video. She digs a hole, places the nut in and tries to pack
it down, decides it's not deep enough and pulls it out again, digs a
little deeper, jackhammers the nut into place with her nose, fills in
the hole then does her usual careful job of covering over the hole and
arranging leaves on top of it to hide the evidence.
Then she turns and digs up a nut that was buried two inches away and
eats it. Video
In other squirrel news, on an afternoon hike at Rancho San Antonio
yesterday I saw an Eastern Fox squirrel in the trees about halfway up the
first leg of the PG&E trail. Foxes are an invasive species (just
like Notch and her Eastern Grey friends who inhabit most of the
suburbs around here), so that's not good news for the native Western
Greys who have traditionally inhabited the park. I suppose it was just
a matter of time, since RSA is so close to suburbia, before the
non-native eastern squirrels invade and drive out the wimpy native
squirrels. It'll be interesting to see whether the western greys can
hold their own, or, if not, how long the invasion takes.
In non-squirrel news, we had a few very hot days last week (mid 90s)
and fled to the redwood forests to escape the heat one day, and
smelled that odd chlorine odor I've noticed before. The smell
was fairly faint this time. I asked my Bio teacher about it in class
last semester, but he didn't know what it might be, so it remains a
mystery for now. I'll be tracking whether it's there on all hot days,
or just some, this summer.
[ 14:49 Jun 21, 2007
More nature/squirrels |
permalink to this entry
Sun, 17 Jun 2007
It was a bit over two years ago that I switched
icewm to fvwm as my window manager. Fvwm proved to be very fast,
very configurable, and "good enough" most of the time. But lately,
I've found myself irritated with it, particularly with its tendency to
position windows off screen (which got a lot worse in 2.5.18).
It looked like it was time to try another window manager, so when
I learned that the Openbox
project is headed by a fellow
or, I had to try it.
Openbox impressed me right away. I'd tried it once before, a couple of years
ago, when I found it a little inconsistent and immature. It's grown up a
lot since then! It's still very fast and lightweight, but it has good
focus handling, excellent window positioning, a good configuration
window (obconf), and a wide variety of themes which are pretty but
still don't take up too much of my limited screen space.
But more important, what it has is a very active and friendly
community. I hit a couple of snags, mostly having to do with focus
handling while switching desktops (the problem that drove me off
icewm to fvwm), so I hopped onto the IRC channel and found myself
chatting with the active developers, who told me that most of my
problems had already been fixed in 3.4, and there were .deb files
on the website for both of the distros I'm currently using.
Indeed, that cured the problem; and when I later hit a more esoteric
focus bug, the developers (particularly Dana Jansens) were all over it
and fixed it that same day. Wow!
Since then I've been putting it through its paces. I have yet to see
a window positioned badly in normal usage, and it handles several
other problems I'd been seeing with fvwm, like focus handling when
popping up dialogs (all those secondary GIMP Save-as dialogs that
don't get focused when they appear). It's just as flexible as fvwm
was when it comes to keyboard and mouse configuration, maybe even
more so (plus it has lots of useful default bindings I might not
have thought of, like mousewheel bindings to change desktops or
"shade" a window).
I was going to stay out of theme configuration, because there were
several pretty good installed themes already. But then in response to
a half-joking question on my part of whether a particular theme came
in blue, someone on the IRC channel made me a custom theme file -- and
I couldn't resist tweaking it from there, and discovered that tweaking
openbox themes is just as easy as fiddling with its other defaults.
I don't use transparency (I find it distracting), but my husband is
addicted to transparent windows, so when I noticed on the web site
that openbox handles transparency I pointed him there. (He's been
using an old Afterstep, from back when it was still small and light,
but it's been a constant battle getting it to build under newer gccs.)
He reports that openbox handles transparency as well as afterstep did,
so he's switched too.
I haven't looked at the openbox code yet, but based on how fast the
developers add features and fix bugs, I bet it's clean, and I
hope I can contribute at some point.
Anyway, great focus handling, great window positioning, fast,
lightweight, super configurable, and best of all a friendly and
helpful developer and user community. What more could you ask for in a
I'm an openbox convert. Thanks, Dana, Mikachu and all the rest.
[ 13:13 Jun 17, 2007
More linux |
permalink to this entry
Mon, 11 Jun 2007
Someone showed up on #gimp today with a color specified as an HTML
hex color specifier, and wanted to know how to find the nearest
Easy, right? There have got to be a bazillion pages that do that,
plus at least a couple of Linux apps.
But I googled for a while and couldn't find a single one. There
are lots of pages that list all the RGB colors, or convert decimal
red, green and blue into HTML #nnn hex codes, or offer aesthetic
advice about pleasing combinations of colors for themes (including
this lovely page on butterfly-inspired color themes,
courtesy of Rik) but nothing I could
find that gave color names. Apparently there used to be a Linux
app that did that, a piece of Gnome 1 called GColorSel,
but it's gone now.
I got to thinking (always dangerous!) ...
/etc/X11/rgb.txt has a list of color names
with their RGB color equivalents. It would be really easy to write
something that just read down the list finding the ones closest to
the specified color.
Uh-oh ... of course, once that thought occurred to me, I was doomed.
Programmer's disease. I had to write it. So I did, and here it is:
Nearest Matching Color Name. It checks against both rgb.txt
and the much smaller list of 17 CSS color names.
[ 22:18 Jun 11, 2007
More programming |
permalink to this entry
Sun, 10 Jun 2007
It's springtime in the backyard! I saw a couple of mockingbird
fledglings cheeping to be fed in the pyrocantha while we were having
dinner last night, though we never saw the mockingbird nest.
And we have a couple of California towhee fledgelings
who come by to eat sunflower seeds. Mama towhee first
brought them by one by one, broke the seeds up (apparently a
sunflower seed is a little too big for a towhee to swallow in one
piece) and fed them to the cheeping youngsters. But now they're coming
by on their own, and still having some trouble breaking
up the seeds, but they're making progress. Unfortunately one of the
chicks hops only on one foot, apparently having injured the other already.
It's springtime for our
local squirrels, too.
Ringtail, the fox squirrel, is still
around, and we have an occasional visit from a male fox squirrel as
well. Notch, our longtime resident grey squirrel diva,
is heavily pregnant. She looks like a little furry bowling pin
and we keep thinking she's going to have her litter at any moment,
but days pass and she continues to grow. We noticed her pregnancy some
time in mid-April (it was quite visible by then), and gestation is
supposed to be around 44 days, so either she's way overdue, or the
books are wrong about Eastern grey squirrel gestation. (Or she's just
fat and not pregnant at all, but I don't think so since her nipples
are very prominent too.)
She still moves remarkably gracefully and has no trouble with leaping
and climbing, unlike Nonotchka, who lumbered and waddled when she got
to this stage last summer.
But the real fun is a pair of baby squirrels who showed up a week
ago. We're calling the female Nova and her brother Chico (he has
slonchy ears that look like Chiquita's). We have no idea who their
mother is -- obviously not Notch, and we haven't seen any other
female greys in quite a while. The kids wear sleek summer coats,
while Notch still hasn't shed her shaggy winter fur despite the
This pair is much bolder and more athletic than Chiquita and Ringlet
were last year. They leap, they run along the fence, and they scamper
headfirst down tree trunks. They don't play together much at all,
the way last year's twins did, but sometimes they play by themselves.
This morning, we watched in amazement as Nova played by the guava
tree just outside the office door, alternating between pretend-burying
of walnut shells and wild gyrations, rolls and backflips.
Best of all, I got it on video!
I've set up a youtube account and uploaded a
long video of
her doing backflips and spins, and a
shorter video of
her digging and rolling.
[ 19:32 Jun 10, 2007
More nature/squirrels |
permalink to this entry
Fri, 08 Jun 2007
What's up with portable radios that get great reception when your hand
is on them moving them around, but the minute you let go, the static
I have a great business idea:
some entrepeneur should make an artificial hand you can drape over
your radio to get that effect to stay.
(Please no one mail me explaining capacitance. And in fact, it
turns out it works pretty well to lean a long metal bar against
the wall next to the radio. But I bet people would buy an
artificial hand antenna anyway!)
[ 11:59 Jun 08, 2007
More humor |
permalink to this entry
Thu, 07 Jun 2007
NPR this morning had a program
. One of the "experts" they brought in was
Richard Retting, senior transportation engineer with the IIHS
(that's the Insurance Institute for Highway Safety, a group funded
by auto insurance companies).
Early on they asked him why speeding was bad. He said there were
three reasons. The first two were straightforward: when you're going
faster, you (1) travel farther before you can react to something, and
(2) take longer to stop. No problem there, and I waited for the third
reason, presuming it was going to be kinetic energy.
The third reason, he said, was energy. "Remember that equation
E = mc2 from high school?"
Wow! If I drive faster than the speed limit, I'm converting my mass
For those who haven't studied physics recently, he was probably
confusing Einstein's equation relating energy, mass and the speed of
light with Newton's formula for kinetic energy,
KE = mv2/2. The host responded incredulously
"The speed of light?" but Retting didn't seem to notice, and pressed
on: "When you're going faster, your energy is disproportionate and
Okay, you're talking on the radio and you have a brain-o.
I'm sure we've all said silly things when we knew better, like
reciting the wrong equation then not noticing the gaffe.
But he also
seems confused about what "exponential" means, perhaps because of that
"exponent" of 2 in the equation. An exponential
curve is when you
have something like 2X, not X2. Admittedly, the
dictionary of "exponential" includes vague definitions like
"Pertaining to exponents", and I suppose there is an exponent
of 2 involved. But really, folks: kinetic energy
increases as the square of speed.
A little later in the program, someone called in to mention studies
showing that higher speeds don't necessarily correlate with accidents,
and Redding chastised him for doing google searches for studies:
"That's not how we do science in this country." Hey, Mr. Retting --
it might pay to be a little more careful with your own science if
you're going to be dismiss callers with remarks like that.
[ 17:37 Jun 07, 2007
More science |
permalink to this entry