Shallow Thoughts : : Jul

Akkana's Musings on Open Source Computing, Science, and Nature.

Sat, 28 Jul 2007

Turn off gtk cursor blink

It's a small thing, but xchat's blinking text cursor has irritated me for a while. It's not so much the blink itself that bothers me, but that it makes the mouse pointer flicker. (I have no idea why blinking the cursor should make the X mouse pointer flicker, but it was pretty clear that they were in sync.) I've also seen fingers pointed at cursor blink as a laptop battery eater (one more reason the CPU has to wake up every second or so when it might otherwise have been idling) though I've seen no numbers on how significant that might be (probably not very, on most laptops). Anyway, there are reasons enough to look into turning off the blink.

Xchat is a gtk application, of course. There are lots and lots of pages on the web telling developers about gtk's gtk-cursor-blink property (and related properties like gtk-cursor-blink-timeout) and what they do in at a library level, so it's clearly possible. But I found nothing about where a user should set these properties to make gtk find them.

Here's the answer. Add to $HOME/.gtkrc-2.0 (or any other file loaded by $HOME/.gtkrc-2.0):

gtk-cursor-blink = 0

I had to restart X (maybe shutting down all gtk apps would have been enough) before I saw any effect.

While I was searching, I did find a nice page on How to disable blinking cursors in lots of different apps. Its gtk section didn't seem to do anything here (maybe it only works if a gnome desktop is running), but it's a good page nontheless, full of useful advice for turning off cursor blink in other programs.

Tags: ,
[ 19:50 Jul 28, 2007    More linux | permalink to this entry | comments ]

Fri, 27 Jul 2007

Hydration Research

I don't usually spend a lot of time reading the sides of Diet Coke cartons, but maybe I should. There's some good scholarly writing there. For instance, did you know that, according to the Diet Coke carton,

[Coke's hydration research]

"It's true. Research shows that all beverages contribute to proper hydration. That means [ ... ] Diet Coke helps you stay hydrated all day long."

I'm visualizing a big laboratory full of spectacled scientists in white lab coats, cages full of lab rats with hanging water bottles filled with hundreds of different beverages. The sign outside the building says "School of Hydration Science".

I wonder which journals publish the peer-reviewed hydration research papers?

Non-diet Coke cartons have almost the same note, except they leave out the "Research shows" part. I wonder if that means the lab rats didn't stay properly hydrated with regular Coke, so they had to toss those data points out of the final paper?

Tags:
[ 19:24 Jul 27, 2007    More humor | permalink to this entry | comments ]

Wed, 18 Jul 2007

So that's why they call them Bullfrogs!

We were heading past the scum pond at Walden West for a quick afternoon hike when I heard Dave, just ahead of me, make a very loud and very rude noise.

Or maybe not. He immediately turned around and asked, "Was that you?" I insisted truthfully that it wasn't.

Weird! We walked on, and behind us we heard more odd noises -- sometimes like machinery, and sometimes like a cow bellowing. We figured it was part of the summer school at Walden West -- maybe they bring in barnyard animals to show the kids.

But the cow bellowing was still going on when we got back to the car, and we could tell now it wasn't coming from the school. It was coming from the pond. A thought occurred to me -- "What do bullfrogs sound like? Like, maybe, a bull?" I had to go see.

Sure enough, the green, scummy pond was covered with big frogs! I counted about 9 visible at any one time. Mostly they were just floating in the scum, but every now and then one would bellow, or dive and swim somewhere else.

Mostly they ignored us ... except the ones near the edge of the pond. If we tried to walk up near them and look down on them, they disappeared underwater immediately. Maybe we looked like a heron or egret.

I know I'm supposed to hate bullfrogs. They're an invasive species with a voracious appetite for local species. My bio teacher told us to kill them on sight if possible (not that we could have done so here even if we'd wanted to). But I found it fun and unusual to see any frog at all here ... let alone a frog chorus right in front of us in broad daylight.

A few photos.

Tags: ,
[ 21:44 Jul 18, 2007    More nature | permalink to this entry | comments ]

Tue, 17 Jul 2007

Adventures with bash's word erase

I've been a happy csh/tcsh user for decades. But every now and then I bow to pressure and try to join the normal bash-using Linux world.

But I always come up against one problem right away: word erase (Control-W). For those who don't use ^W, suppose I type something like:

% ls /backups/images/trips/arizona/2007
Then I suddenly realize I want utah in 2007, not arizona. In csh, I can hit ^W twice and it erases the last two words, and I'm ready to type u<tab>. In bash, ^W erases the whole path leaving only "ls", so it's no help here. It may seem like a small thing, but I use word erase hundreds of times a day and it's hard to give it up. Google was no help, except to tell me I wasn't the only one asking.

Then the other day I was chatting about this issue with a friend who uses zsh for that reason (zsh is much more flexible at defining key bindings) and someone asked, "Is that like Meta-Delete?"

It turned out that Alt-Backspace (like many Linux applications, bash calls the Alt key "Meta", and Linux often confuses Delete and Backspace) did exactly what I wanted. Very promising!

But Alt-Backspace is not easy to type, since it's not reachable from the "home" typing position. What I needed, now that I knew bash and readline had the function, was a way to bind it to ^W.

Bash's binding syntax is documented, though the functions available don't seem to be. But bind -p | grep word gave me some useful information. It seems that \C-w was bound to "unix-word-rubout" (that was the one I didn't want) whereas "\e\C-?" was bound to "backward-kill-word". ("\e\C-?" is an obscure way of saying Meta-DEL: \e is escape, and apparently bash, like emacs, treats ESC followed by a key as the same as pressing Alt and the key simultaneously. And Control-question-mark is the Delete character in ASCII.)

So my task was to bind \C-w to backward-kill-word. It looked like this ought to work:

bind '\C-w:backward-kill-word'

... Except it didn't. bind -p | grep w showed that C-W was still bound to "unix-word-rubout".

It turned out that it was the terminal (stty) settings causing the problem: when the terminal's werase (word erase) character is set, readline hardwires that character to do unix-word-rubout and ignores any attempts to change it.

I found the answer in a bash bug report. The stty business was introduced in readline 5.0, but due to complaints, 5.1 was slated to add a way to override the stty settings. And happily, I had 5.2! So what was this new way override method? The posting gave no hint, but eventually I found it.

Put in your .inputrc:

set bind-tty-special-chars Off

And finally my word erase worked properly and I could use bash!

Tags: , , ,
[ 15:22 Jul 17, 2007    More linux | permalink to this entry | comments ]

Sun, 15 Jul 2007

Sniffin' the Oaks

I continue to be puzzled by the mysterious chlorine small that sometimes wafts through the redwood forests during the warm days of summer. It's been fairly noticable for about a month now, though it's patchy and doesn't occur everywhere.

Today's hike was on a trail called "The Lonely Trail", up above Woodside. It was just as well that it was lonely: no one could see Dave and me (mostly me) stopping to sniff bushes and trees and rotting logs and dirt. But alas, no definite culprit emerged. It did seem stronger when we were next to tanoak trees, though that is virtually everywhere in these forests.

Tanoak is short for Tanbark-Oak, or Lithocarpus densiflorus. It's not a true oak (genus Quercus) and is more closely related to chestnuts. But it's like oaks in many ways -- the tough, shiny leaves look a bit like larger versions of our local coast live oak (though the distinctive veins make it easy to tell the two apart). The acorns, too, are very similar to those of live oaks.

The smell definitely wasn't coming from the tanoak leaves, but it did seem stronger near the trunks of some of the tanoaks. I'd always assumed "tan" referred to color (since there are white oaks, black oaks, blue oaks and red oaks, none of which are really those colors). But what if it refers to a tree whose bark is particularly high in tannic acid? What does tannic acid smell like, anyway?

This would still leave some mysteries. Tanoaks are all over bay area parks, not just in redwood forests. What is it about the deep, shady redwood forests which bring out this smell, where it's seldom obvious in the tanoaks of the valleys or rolling hills? Some interaction between tanoaks and redwoods, or ferns? Something that only happens in the shade?

I never found a tree that gave me a clear answer -- I merely picked up subtle hints of chlorine odor from the trunks of a few trees. Returning home to the digital world, I learned that the tanoak tree is indeed very high in tannins, and was extensively harvested for tanning hides. The local native Americans also used the acorns for flour, after leaching them to remove the bitter acid. I found no references to odor from tanoak bark or wood, but a few pages mentioned that the flowers, which hang in catkins, have a foul odor. No one goes into specifics on this odor.

I didn't see many flower catkins on today's hike, but they're listed as appearing in June through October. Looks like I have a research project lined up for the next outing.

Tags: ,
[ 21:30 Jul 15, 2007    More nature | permalink to this entry | comments ]

Tue, 10 Jul 2007

A Fast Paste Environment

I got email from a recruiter yesterday alerting me to opportunities for "Engineers who are interested to work in a fast paste environment with talented and passionate people!"

The email came from a reputable place and was well targeted, not random spam like a lot of recruiter email. I don't know, though ... It's good that they're talented and passionate, but I've seen (and debugged) code that resulted from fast pastes, and the result is often not pretty. I think I'd prefer to work in a place where they designed the code from scratch rather than just pasting it quickly.

Tags:
[ 14:52 Jul 10, 2007    More humor | permalink to this entry | comments ]

Wed, 04 Jul 2007

Make Amazon pages narrow enough to read

I like buying from Amazon, but it's gotten a lot more difficult since they changed their web page design to assume super-wide browser windows. On the browser sizes I tend to use, even if I scroll right I can't read the reviews of books, because the content itself is wider than my browser window. Really, what's up with the current craze of insisting that everyone upgrade their screen sizes then run browser windows maximized?

(I'd give a lot for a browser that had the concept of "just show me the page in the space I have". Opera has made some progress on this and if they got it really working it might even entice me away from Firefox, despite my preference for open source and my investment in Mozilla technology ... but so far it isn't better enough to justify a switch.)

I keep meaning to try the greasemonkey extension, but still haven't gotten around to it. Today, I had a little time, so I googled to see if anyone had already written a greasemonkey script to make Amazon readable. I couldn't find one, but I did find a page from last October trying to fix a similar problem on another website, which mentioned difficulties in keeping scripts working under greasemonkey, and offered a Javascript bookmarklet with similar functionality.

Now we're talking! A bookmarklet sounds a lot simpler and more secure than learning how to program Greasemonkey. So I grabbed the bookmarklet, a copy of an Amazon page, and my trusty DOM Inspector window and set about figuring out how to make Amazon fit in my window.

It didn't take long to realize that what I needed was CSS, not Javascript. Which is potentially a lot easier: "all" I needed to do was find the right CSS rules to put in userContent.css. "All" is in quotes because getting CSS to do anything is seldom a trivial task.

But after way too much fiddling, I did finally come up with a rule to get Amazon's Editorial Reviews to fit. Put this in chrome/userContent.css inside your Firefox profile directory (if you don't know where your profile directory is, search your disk for a file called prefs.js):

div#productDescription div.content { max-width: 90% !important; }

You can replace that 90% with a pixel measurement, like 770px, or with a different percentage.

I spent quite a long time trying to get the user reviews (a table with two columns) to fit as well, without success. I was trying things like:

#customerReviews > div.content > table > tbody > tr > td { max-width: 300px; min-width: 10px !important; }
div#customerReviews > div.content > table { margin-right: 110px !important; }
but nothing worked, and some of it (like the latter of those two lines) actually interfered with the div.content rule for reasons I still don't understand. (If any of you CSS gurus want to enlighten me, or suggest a better or more complete solution, or solutions that work with other web pages, I'm all ears!)

I'll try for a more complete solution some other time, but for now, I'm spending my July 4th celebrating my independance from Amazon's idea of the one true browser width.

Tags: , , , ,
[ 20:01 Jul 04, 2007    More tech/web | permalink to this entry | comments ]

Syndicated on:
LinuxChix Live
Ubuntu Women
Women in Free Software
Graphics Planet
DevChix
Ubuntu California
Planet Openbox
Devchix
Planet LCA2009

Friends' Blogs:
Morris "Mojo" Jones
Jane Houston Jones
Dan Heller
Long Live the Village Green
Ups & Downs
DailyBBG

Other Blogs of Interest:
DevChix
Scott Adams
Dave Barry
BoingBoing

Powered by PyBlosxom.