Shallow Thoughts : : Oct

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

Sun, 28 Oct 2007

Bright naked-eye comet: 17/P Holmes

I finally got a chance to take a look at Comet 17/P Holmes. I'd been hearing about this bright comet for a couple of days, since it unexpectedly broke up and flared from about 17th magnitude (fainter than most amateur telescopes can pick up even in dark skies) to 2nd magnitude (easily visible to the naked eye from light-polluted cities). It's in Perseus, so only visible from the northern hemisphere, pretty much any time after dark (but it's higher a little later in the evening).

And it's just as bright as advertised. I grabbed my binoculars, used a finder chart posted by one of our local SJAA members, and there it was, bright and obviously fuzzy. Without the binoculars it was still easy to see, and still noticably fuzzy.

So I dragged out the trusty 6" dobsonian, and although it has no visible tail, it has lots of structure. It looked like this:
[Comet 17/P Holmes] It has a stellar nucleus, a bright inner area (the coma?) and a much larger, fainter outer halo. There's also a faint star just outside the coma, so it'll be fun (if we continue to get holes in the clouds) to see how fast it moves relative to that star. (Not much motion in the past hour.)

It's nice to have a bright comet in the sky again! Anyone interested in astronomy should check this one out in the next few days -- since it may be in the process of breaking up, there's no telling how long it'll last or what will happen next. Grab some binoculars, or a 'scope if you have one, and take a look.

Tags: ,
[ 22:51 Oct 28, 2007    More science/astro | permalink to this entry | comments ]

Sat, 27 Oct 2007

The annual autumn easter-egg hunt

I'm sitting here at my desk, taking a break from homework and listening to the plop, plop of guavas falling from the tree outside my window.

Both trees are going pretty crazy this year. Big, ripe, tasty guavas accumulate way faster than I can eat them. I should probably learn how to make jam, but it always sounds so daunting. And this year the squirrels aren't interested (funny, since last fall's squirrels liked guavas quite a lot).

Gathering the guavas always reminds me of hunting easter eggs. They fall into the tall sorrel, or the branchlets sprouting from the bottom of the bigger guava tree, or into the tangled, fragrant mess of lantana that pokes its head around the corner and under the tree. Guavas are smaller than easter eggs and not as colorful, but they're about the same shape ... and the thrill of discovery when you spot that elusive green fruit hiding in the underbrush is a lot like what I remember from those long-ago easter egg hunts.

I just heard another plop. I think I'll go eat a guava.

Tags: ,
[ 22:21 Oct 27, 2007    More nature | permalink to this entry | comments ]

Wed, 24 Oct 2007

She's Geeky tech unconference

I just got back from She's Geeky. What a rush! It'll take me a while to wind down from this fabulous all-women meeting.

I have to admit, I was initially dubious. A conference for geeky women sounded great, but it struck me as kind of expensive -- $175 (with a $125 early-bird rate). That's very cheap as tech conferences go, but for a two-day "unconference", it was enough to turn off most local techie women I know: nearly all of them knew about She's Geeky and said "I'd love to go but I can't afford it." Full disclosure: I said the same thing, and wouldn't have gone myself had I not gotten a "scholarship", for which I am immensely grateful. (In retrospect, considering how well run it was, it probably would have been worth the early-bird price. But that's not easy to tell ahead of time.)

Monday consisted of lunch and informal discussion followed by two sessions of scheduled talks. I particularly liked the afternoon schedule, which included two different sessions of speaker training: the theory being that one factor holding women back in technology jobs is that we don't make ourselves visible by public speaking as much as we could. I went to the "Lightening (sic) Talks" session, headed by Danese Cooper. It didn't make me lighter, but we got some great advice at giving conference talks (lightning and otherwise) plus two rounds of practice at three minute talks. I'm not sure what I enjoyed more, the practice and useful feedback or the chance to listen to so many great short talks on disparate and interesting subjects.

Tuesday started way before normal geek time, with bagels and espresso and an explanation by conference organizer Kaliya Hamlin on how we'd use the Open Space process. Sessions would be an hour long, and we had eight rooms to work with, all charted on a huge grid on the wall. Anyone could run a session (or several). Write it (and your name) on a card, get up and tell the group about it, then find a time and space for it and tape it on the grid. Rules for sessions were few. For session leaders, Whoever comes to your session is the right audience, and whatever happens is what should have happened. For people attending a session there's the Rule of Two Feet: if you're not getting anything out of the session you're in, you should get up and get yourself to somewhere where you're contributing and/or learning. Not hard when there are seven other sessions to choose from.

This all worked exactly as described. Whatever hesitance many women may feel toward public speaking, there was no lack of volunteer session leaders on a wide variety of topics, both technical and social. I signed up to give a GIMP session before lunch; then in a morning session on server and firewall configuration given by fellow LinuxChix Gloria W. and Gaba, I noticed a few people having a lot of general Linux questions, in particular command-line questions, so I ran back to the wall grid and added an afternoon session on "Understanding the Linux command line".

Easily my favorite session of the conference was the Google Maps API talk by Pamela Fox of Google. I've been meaning to experiment with Google Maps and KML for a long time. I even have books on it sitting on my shelf. But I never seem to get over the hump: find a project and a specific task, then go RTFM and figure out how to write a KML file from scratch to do something fun and useful. Pamela got me over that in a hurry -- she showed us the "My Maps" tab in Google Maps (you have to be signed on to a Google account to use it). It includes tools for generating some starter KML interactively, and it even has a polygon editor, all implemented in AJAX (Javascript) and running in a browser. Wow! What a great way to get a running start on map mashups. There's also a whole open source Javascript API and set of libraries for writing creative web mapping apps. I'm sure I'll be experimenting with this a lot more and writing about it separately. Just this talk alone made the conference worthwhile, even without all the other great sessions.

But I didn't get a chance to experiment right away with any of that cool mapping stuff, because right after that session was one by speaker and comedian Heather Gold. Heather had given Saturday night's evening entertainment, and I am very sorry to have had to miss the show to go to a night class. The session was on self confidence, getting over fear of speaking, and connecting with the audience. Since the allotted space was noisy (the same one I'd ended up with for my GIMP talk, and the noise was definitely a problem), Heather led our small group out onto the balcony to enjoy the warm weather. The group was diverse and included women at very different levels of speaking, but Heather had great tips for all of us. She has great presence and a lot of useful things to say, and she's funny -- I'd love to see her on stage.

Everybody had a really positive attitude. At the Lightning Talks session on Saturday, Danese stressed "No whinging" as a general rule to follow (in talks or anywhere else), and I'd say the whole conference followed it. While we heard about lots of serious topics women face, I didn't hear any whining or "men are keeping us down" or that sort of negativism. There were some bad experiences shared as well as good ones, but the point was in finding solutions and making progress, not dwelling on problems. This was a group of women doing things.

There are only two changes I can think of that could have improved the conference at all. First, I already mentioned the cost. While it was fair considering the fantastic organization, great people, plus catered meals, it still lets out some of the women who could have benefitted the most: students and the un- and under-employed. A few of us LinuxChix talked about how much we'd love to see a similar conference held at a cheaper facility, without the handouts or the catered meals. Maybe some day we'll be able to make it happen.

Second (and this is a very minor point), it might have been helpful to have runners reminding people when sessions were ending, and perhaps making the sessions 55 minutes instead of an hour to encourage getting to the next session and starting on promptly.

Even without that, people mostly stuck to the schedule and Tuesday finished right on time: pretty amazing for a conference whose agenda had been made that morning with cardboard, tape and marking pens. I've seen unconferences before, and they're usually a disorganized mess. This one ran better than most scheduled conferences. Kaliya and her fellow organizers clearly know how to make this process work.

We all pitched in to clean up the room, and I braved the rush-hour freeway. And arrived home to find that my husband had cooked dinner and it was just about ready. What a nice ending to the day!

Tags: , , ,
[ 00:01 Oct 24, 2007    More misc | permalink to this entry | comments ]

Mon, 22 Oct 2007

Flash Cards in Python

I'm taking an online Spanish class. My mom talked me into it -- she and I both periodically try to learn Spanish, then forget it again because we don't practice enough. The hope is that if we're both taking the same class, we'll converse with each other by email en Español, have more fun and learn better.

I have no particular talent for (non-computer) languages, and in particular I have trouble learning vocabulary. By Lesson 2 I could see already that I was going to have trouble with the vocabulary lists. What I needed was flash cards!

There are probably a bazillion flash card apps around. But it's such a trivial problem, why not re-invent the wheel for the bazillion-and-oneth time? It's more fun to spend an hour hacking Python than to spend an hour googling and tossing out all the Windows and Mac and Java and web oriented solutions looking for something that's small, self-contained and runs on Linux.

So ... my trivial flashcard in Python. It doesn't make you type in the answer -- you just think of the answer and hit return, and if you got it right, hit return again for the next word. If you got it wrong, type something else (. or space or x or whatever) followed by return, and it'll remember that you got it wrong, increase the liklihood of showing you that word again, and print a list of words missed at the end (when you type q to quit).

I needed the

# -*- coding: utf-8 -*-
at the beginning to keep it from complaining about the various accented characters in some of the Spanish words, but that doesn't automatically make it print those characters correctly. With LANG=C, it translates them into plain ASCII, which is okay with me most of the time. With LANG=en_US.UTF-8, which you'd think would work, it tends to print garbage characters or hexadecimal codes -- not so okay. The trick turns out to be to set it to Spanish:
export LANG=es_ES.UTF-8
Perhaps I can force that in the script. But not right now ... I'm off to She's Geeky, a conference on Women in Tech going on in Mountain View today and tomorrow.

Tags:
[ 12:45 Oct 22, 2007    More education | permalink to this entry | comments ]

Sun, 21 Oct 2007

GimpLabels: Printer fudge factor

I ran out of business cards (where do they go? I never seem to find occasion to give any out. They make good bookmarks, though) and wanted to print some more. I use gLabels for low-res label printing, but it prints poorly (or used to, anyway) so when I want something with crisp and sharp images, I use GIMP with my GIMP Labels script.

That's all fine, except that the "make label page" part of the script scales the labels to fit on a typical Avery letter-sized template -- and the Gutenprint drivers for my printer can't actually fill a letter sized page. (I have the choice of normal printing, in which it fills about 97% of the page, or Borderless printing, where it slops way over the edges.)

The solution is to crop a little extra off the outside edge of the label page. So I added some code to script-fu-rect-label-page to keep a "Printer fudge factor" and crop the page at the end. An easy tweak which seems to work fine, and with any luck it'll cure a lot of the misalignment problems I've seen with labels.

While I was making changes anyway, I added some clearer installation instructions for the 95% case of someone who just wants the script with the labels I've included, since I recently heard from someone who wasn't clear on where to install the script.

Tags:
[ 13:03 Oct 21, 2007    More gimp | permalink to this entry | comments ]

Sat, 20 Oct 2007

Firefox, caching, and fast Back/Forward buttons

I remember a few years ago the Mozilla folks were making a lot of noise about the "blazingly fast Back/Forward" that was coming up in the (then) next version of Firefox. The idea was that the layout engine was going to remember how the page was laid out (technically, there would be a "frame cache" as opposed to the normal cache which only remembers the HTML of the page). So when you click the Back button, Firefox would remember everything it knew about that page -- it wouldn't have to parse the HTML again or figure out how to lay out all those tables and images, it would just instantly display what the page looked like last time.

Time passed ... and Back/Forward didn't get faster. In fact, they got a lot slower. The "Blazingly Fast Back" code did get checked in (here's how to enable it) but somehow it never seemed to make any difference.

The problem, it turns out, is that the landing of bug 101832 added code to respect a couple of HTTP Cache-Control header settings, no-store and no-cache. There's also a third cache control header, must-revalidate, which is similar (the difference among the three settings is fairly subtle, and Firefox seems to treat them pretty much the same way).

Translated, that means that web servers, when they send you a page, can send some information along with the page that asks the browser "Please don't keep a local copy of this page -- any time you want it again, go back to the web and get a new copy."

There are pages for which this makes sense. Consider a secure bank site. You log in, you do your banking, you view your balance and other details, you log out and go to lunch ... then someone else comes by and clicks Back on your browser and can now see all those bank pages you were just viewing. That's why banks like to set no-cache headers.

But those are secure pages (https, not http). There are probably reasons for some non-secure pages to use no-cache or no-store ... um ... I can't think of any offhand, but I'm sure there are some.

But for most pages it's just silly. If I click Back, why wouldn't I want to go back to the exact same page I was just looking at? Why would I want to wait for it to reload everything from the server?

The problem is that modern Content Management Systems (CMSes) almost always set one or more of these headers. Consider the Linux.conf.au site. Linx.conf.au is one of the most clueful, geeky conferences around. Yet the software running their site sets

  Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
  Pragma: no-cache
on every page. I'm sure this isn't intentional -- it makes no sense for a bunch of basically static pages showing information about a conference several months away. Drupal, the CMS used by LinuxChix sets Cache-Control: must-revalidate -- again, pointless. All it does is make you afraid to click on links because then if you want to go Back it'll take forever. (I asked some Drupal folks about this and they said it could be changed with drupal_set_header).

(By the way, you can check the http headers on any page with: wget -S -O /dev/null http://... or, if you have curl, curl --head http://...)

Here's an excellent summary of the options in an Opera developer's blog, explaining why the way Firefox handle caching is not only unfriendly to the user, but also wrong according to the specs. (Darn it, reading sensible articles like that make me wish I wasn't so deeply invested in Mozilla technology -- Opera cares so much more about the user experience.)

But, short of a switch to Opera, how could I fix it on my end? Google wasn't any help, but I figured that this must be a reported Mozilla bug, so I turned to Bugzilla and found quite a lot. Here's the scoop. First, the code to respect the cache settings (slowing down Back/Forward) was apparently added in response to bug 101832. People quickly noticed the performance problem, and filed 112564. (This was back in late 2001.) There was a long debate, but in the end, a fix was checked in which allowed no-cache http (non-secure) sites to cache and get a fast Back/Forward. This didn't help no-store and must-revalidate sites, which were still just as slow as ever.

Then a few months later, bug 135289 changed this code around quite a bit. I'm still getting my head around the code involved in the two bugs, but I think this update didn't change the basic rules governing which pages get revalidated.

(Warning: geekage alert for next two paragraphs. Use this fix at your own risk, etc.)

Unfortunately, it looks like the only way to fix this is in the C++ code. For folks not afraid of building Firefox, the code lives in nsDocShell::ShouldDiscardLayoutState and controls the no-cache and no-store directives. In nsDocShell::ShouldDiscardLayoutState (currently lie 8224, but don't count on it), the final line is:

    return (noStore || (noCache && securityInfo));
Change that to
    return ((noStore || noCache) && securityInfo);
and Back/Forward will get instantly faster, while still preserving security for https. (If you don't care about that security issue and want pages to cache no matter what, just replace the whole function with return PR_FALSE; )

The must-validate setting is handled in a completely different place, in nsHttpChannel. However, for some reason, fixing nsDocShell also fixes Drupal pages which set only must-validate. I don't quite understand why yet. More study required. (End geekage.)

Any Mozilla folks are welcome to tell me why I shouldn't be doing this, or if there's a better way (especially if it's possible in a way that would work from an extension or preference). I'd also be interested in from Drupal or other CMS folks defending why so many CMSes destroy the user experience like this. But please first read the Opera article referenced above, so that you understand why I and so many other users have complained about it. I'm happy to share any comments I receive (let me know if you want your comments to be public or not).

Tags: , , , ,
[ 20:32 Oct 20, 2007    More tech/web | permalink to this entry | comments ]

Thu, 18 Oct 2007

What environmental issues face the Bay Area?

On an afternoon hike at Rancho San Antonio, a bright yellow twice-folded paper caught my eye from the ground beside the trail.

It began:

ESCI 19 (Martinez, Gorsuch, Poffenroth & Higgins) FALL 2007

October 19-20 DIABLO RANGE Overnight Field Trip Schedule
37th parallel field studies
then continued with details of the class camping trip to Grant Ranch county park this weekend.

They're doing a pre-dinner hike, a night lecture, a night hike, then the next day they have early morning bird-watching and a morning hike before dispersing.

At the bottom are some

Discussion Questions
1. What environmental issues face California? Bay Area?
2. What will the Bay Area look like in 10 years? 20 years?

Half a mile down the trail, there was another copy: again, twice folded; again, lying in the dirt by the side of the trail.

I think I have a guess at the answer to Discussion Question 2. If even Environmental Science students think it's appropriate to toss their field trip planning sheets any old place on a trail, ten years from now the Bay Area is going to be buried in paper and other debris. (Well, at least paper is biodegradeable, unlike candy wrappers and soda bottles.)

Perhaps Martinez, Gorsuch, Poffenroth & Higgins should consider, next semester, including a lecture on litter and Leaving No Trace. (Though it's sad to think that it should be needed, even in a community college course like this appears to be.)

Tags:
[ 22:12 Oct 18, 2007    More nature | permalink to this entry | comments ]

Mon, 15 Oct 2007

Danica McKellar, TWIS, and Why Not to be Dumb

Last week, one of my favorite science podcasts, This Week in Science, had an interview with Danica McKellar. You may remember Danica -- she's written a book for middle school girls called Math Doesn't Suck: How to Survive Middle-School Math Without Losing Your Mind or Breaking a Nail. You may also know her as Winnie Cooper from the old TV show The Wonder Years, or more recently on West Wing, and she's also a math graduate and co-author of the Chayes-McKellar-Winn theorem.

Anyway, the interview is great for anyone interested in the general question of math education. They get into questions like "Why study math?" and "Why do people find word problems so hard?"

She talks about a survey she passed out to middle school girls while she was working on the book. Some of the questions had to do with what they thought of smart girls and dumb girls, and on the latter, the most common answer was "There are no dumb girls -- they're just pretending to be dumb."

She was shocked by that. If you play dumb, she tells girls, you'll get into the habit. If you play dumb to get that guy, you'll have to keep playing dumb to keep him, and it'll become more and more ingrained. Eventually you'll start believing it. You'll feel worse and worse about yourself and you might not even realize why. And stopping it later might be a lot harder than you think.

She had a great analogy about that from her days on The Wonder Years. One episode involved people teasing her character for being a goody-two-shoes, and in particular her good posture. She read the script and was mortified -- "I do sit straighter than everybody else! Oh, no! I'm not cool! I should slump more!" She practiced for weeks, sitting hunched over in the cafeteria and in class so that by the time the episode came out, people at school would say "Oh, well, she was just acting -- see, she really slumps like everybody else so she's actually cool." She made it a habit.

Now, ten years later, she's noticing back problems and trying to get over that habit and fix her bad posture, and it's not easy! And of course, at the time nobody noticed and it didn't make a bit of difference to her school popularity.

On word problems, her book offers a table helping people in mapping real-world word problems to the right equation (for example, if it says "a third of", that means 1/3 *). She also stresses using problems about subjects students care about. Co-host Justin comments that word problems in school math books always tended to be obsessed with trains leaving station A and arriving at station B, which doesn't relate to most kids' lives very much. Why not, Danica suggests, design word problems about buying magazines or sharing chocolate bars?

Anyway, it's a great interview, and I hope her book sells well and changes the world. I have a presentation coming up myself to a middle school girls' group in a few days (on astronomy) and I'm going to pick up a copy to make sure the girls know about it.

McKellar's website is mathdoesntsuck.com and you can listen to the whole interview on the TWIS podcast. If you like science podcasts, you'll want to check out TWIS anyway. They cover cool stuff and they do it well, with the nice bonus that it's hosted by a very sharp woman, Dr. Kirsten Sanford (plus goofy guy sidekick Justin Jackson). This particular episode starts with a fun and detailed discussion on listener responses to the "falling through a tube drilled through the center of the Earth" problem before they get to the interview. Check it out!

Tags:
[ 22:16 Oct 15, 2007    More education | permalink to this entry | comments ]

Sun, 14 Oct 2007

Handicapped parking

The SF Chronicle's solicited reader comments on San Francisco's new parking meter proposal.

My favorite response:

What about the handicapped cars that get to park for free? That needs to stop.

I'm visualizing the poor cars limping in on their flat tires and wobbly CV joints, motors puffing blue smoke ... and then they finally find a place to rest, and ... dang, no hands to put coins in the meter!

Tags:
[ 23:50 Oct 14, 2007    More humor | permalink to this entry | comments ]

Fri, 12 Oct 2007

PyTopo and PyGTK pixbuf memory leakage

On a recent Mojave desert trip, we tried to follow a minor dirt road that wasn't mapped correctly on any of the maps we had, and eventually had to retrace our steps. Back at the hotel, I fired up my trusty PyTopo on the East Mojave map set and tried to trace the road. But I found that as I scrolled along the road, things got slower and slower until it just wasn't usable any more.

PyTopo was taking up all of my poor laptop's memory. Why? Python is garbage collected -- you're not supposed to have to manage memory explicitly, like freeing pixbufs. I poked around in all the sample code and man pages I had available but couldn't find any pygtk examples that seemed to be doing any explicit freeing.

When we got back to civilization (read: internet access) I did some searching and found the key. It's even in the PyGTK Image FAQ, and there's also some discussion in a mailing list thread from 2003.

Turns out that although Python is supposed to handle its own garbage collection, the Python interpreter doesn't grok the size of a pixbuf object; in particular, it doesn't see the image bits as part of the object's size. So dereferencing lots of pixbuf objects doesn't trigger any "enough memory has been freed that it's time to run the garbage collector" actions.

The solution is easy enough: call gc.collect() explicitly after drawing a map (or any other time a bunch of pixbufs have been dereferenced).

So there's a new version of PyTopo, 0.6 that should run a lot better on small memory machines, plus a new collection format (yet another format from the packaged Topo! map sets) courtesy of Tom Trebisky.

Oh ... in case you're wondering, the ancient USGS maps from Topo! didn't show the road correctly either.

Tags: , , ,
[ 22:21 Oct 12, 2007    More programming | permalink to this entry | comments ]

Wed, 10 Oct 2007

Safeway Math

The local Safeway has an interesting exercise in applied consumer mathematics in the sugar aisle.

[sugar cube price comparison]

Sugar cubes come in two sizes. You can get a one-pound box for $1.68, or a two-pound box for $3.86. Of course, the larger size is always a better bargain, right?

Let's check that. 1.68 times two is ... carry the one ... $3.36. Compare to $3.86 for the two-pound box ... um, why exactly should anyone buy the two-pound box instead of two one-pound boxes?

But you don't even have to do the math yourself. Safeway has already calculated the price per ounce and helpfully provides shelf tags giving you the numbers:

[1 lb price] [2 lb price]

You might think this is a one-time oddity, but it's actually been the case for at least a year. In fact, several months ago the price premium for the 2 lb box over the 1 lb actually increased. I guess plenty of consumers are jumping at the chance to buy sugar cubes in the large economy size.

Tags:
[ 16:29 Oct 10, 2007    More humor | permalink to this entry | comments ]