Shallow Thoughts : : Apr
Akkana's Musings on Open Source Computing, Science, and Nature.
Tue, 29 Apr 2014
Long ago (in 2006!), I blogged on
annoying misfeature of Emacs when editing HTML files: you can't type
Emacs sees them as an SGML comment and insists on indenting all
subsequent lines in strange ways.
I wrote about finding a fix for the problem, involving commenting out
four lines in sgml-mode.el. That file had a comment at the very
beginning suggesting that they know about the problem and had guarded
against it, but obviously it didn't work and the variable that was
supposed to control the behavior had been overridden by other
That fix has worked well for eight years. But just lately, I've been
getting a lot of annoying warnings when I edit HTML files:
"Error: autoloading failed to define function sgml_lexical_context".
Apparently the ancient copy of sgml-mode.el that I'd been using all
these years was no longer compatible with ... something else somewhere
inside emacs. I needed to update it.
Maybe, some time during the intervening 8 years, they'd actually
fixed the problem? I was hopeful. I moved my old patched sgml-mode.el
aside and edited some files. But the first time I tried typing a
double dashes -- like this, with text inside that's long enough to
wrap to a new line -- I saw that the problem wasn't fixed at all.
I got a copy of the latest sgml-mode.el -- on Debian, that meant:
apt-get install emacs23-el
cp /usr/share/emacs/23.4/lisp/textmodes/sgml-mode.el.gz ~/.emacs-lisp
Then I edited the file and started searching for strings like font-lock
Unfortunately, the solution I documented in my old blog post is no
longer helpful. The code has changed too much, and now there are many,
many different places where automatic comment handling happens.
I had to comment out each of them bit by bit before I finally found
the section that's now causing the problem. Commenting out these lines
(set (make-local-variable 'indent-line-function) 'sgml-indent-line)
(set (make-local-variable 'comment-start) "")
(set (make-local-variable 'comment-indent-function) 'sgml-comment-indent)
(set (make-local-variable 'comment-line-break-function)
I didn't have to remove any .elc files, like I did in 2006; just putting
the sgml-mode.el file in my Emacs load-path was enough. I keep all my
customized Emacs code in a directory called .emacs-lisp, and in my .emacs
I make sure it's in my path:
(setq load-path (cons "~/.emacs-lisp/" load-path))
And now I can type double dashes again. Whew!
[ 12:42 Apr 29, 2014
More linux/editors |
permalink to this entry |
Wed, 23 Apr 2014
If anyone has been waiting for the code repository for PiDoorbell,
the Raspberry Pi project we presented at PyCon a couple of weeks ago,
at least part of it (the parts I wrote) is also available in my GitHub
in the rpi subdirectory.
It's licensed as GPLv2-or-later.
That includes the code that drives the HC-SR04 sonar rangefinder,
and the script that takes photos and handles figuring out whether you
have a USB camera or a Pi Camera module.
It doesn't include the Dropbox or Twilio code. For that I'm afraid
you'll have to wait for the official PiDoorbell repo.
I'm not clear what the holdup is on getting the repo opened up.
The camera script,
has changed quite a bit in the couple of weeks since PyCon. I've been working
on a similar project that doesn't use the rangefinder, and relies only
on the camera to detect motion, by measuring changes between the
previous photo and the current one.
I'm building a wildlife camera, and the rangefinder trick doesn't work
well if there's a bird feeder already occupying the target range.
Of course, using motion detection means I'll get a lot of spurious
photos of shadows, tree limbs bending in the wind and so forth. It'll be an
interesting challenge seeing if I can make the code smart enough to
handle that. Of course, I'll write about the project in much more detail
once I have it working.
It looks like the biggest issue will be finding a decent camera I can
control from a Pi. The Pi Camera module looked so appealing -- and it
comes in a night version, with the IR filter removed, perfect for those
coyote, rabbit and deer pictures! -- but sadly, it looks like its
quality is so poor that it really isn't useful for much of anything.
It's great for detecting what types of animals visit you (especially
at night), but, sadly, no good for taking photos you'd actually want
If anyone knows of a good camera that can be driven from Linux over
USB -- perhaps a normal digital camera that supports the USB camera
protocol? -- please let me know! My web searches so far haven't been
Meanwhile, I hope someone finds the rangefinder and camera driving
And stay tuned for more detailed articles about my wildlife camera project!
[ 11:57 Apr 23, 2014
More hardware |
permalink to this entry |
Thu, 17 Apr 2014
I'm back from Montreal, settling back in.
The PiDoorbell tutorial went well, in the end. Of course just about
everything that could go wrong, did. The hard-wired ethernet
connection we'd been promised didn't materialize, and there was no way to
get the Raspberry Pis onto the conference wi-fi because it used
browser authentication (it still baffles me why anyone still uses
that! Browser authentication made sense in 2007 when lots of people
only had 801.11g and couldn't do WPA; it makes absolutely zero sense now).
Anyway, lacking a sensible way to get everyone's Pis on the net,
Deepa stepped as network engineer for the tutorial and hooked
up the router she had brought to her laptop's wi-fi connection
so the Pis could route through that.
Then we found we had too few SD cards. We didn't realize why until
afterward: when we compared the attendee count to the sign-up list
we'd gotten, we had quite a few more attendees than we'd planned for.
We had a few extra SD cards, but not enough, so I and a couple of
the other instructors/TAs had to loan out SD cards we'd brought for
our own Pis. ("Now edit /etc/network/interfaces ... okay, pretend you
didn't see that, that's the password for my home router, now delete
that and change it to ...")
Then some of the SD cards turned out not to have been updated with the
latest packages, Mac users couldn't find the drivers to run the serial
cable, Windows users (or was it Macs?) had trouble setting static
ethernet addresses so they could ssh to the Pi, all the problems we'd
expected and a few we hadn't.
But despite all the problems, the TAs: Deepa (who was more like a
co-presenter than a TA), Serpil, Lyz and Stuart, plus Rupa and I, were
able to get everyone working. All the attendees got their LEDs blinking,
their sonar rangefinders rangefinding, and the PiDoorbell script running.
Many people brought cameras and got their Pis snapping pictures when
the sensor registered someone in front of it.
Time restrictions and network problems meant that most people didn't
get the Dropbox and Twilio registration finished to get notifications
sent to their phones, but that's okay -- we knew that was a long shot,
and everybody got far enough that they can add the network
notifications later if they want.
And the most important thing is that everybody looked like they were
having a good time.
We haven't seen the reviews (I'm not sure if PyCon shares reviews with
the tutorial instructors; I hope so, but a lot of conferences don't)
but I hope everybody had fun and felt like they got something out of it.
The rest of PyCon was excellent, too. I went to some great talks, got lots
of ideas for new projects and packages I want to try, had fun meeting
new people, and got to see a little of Montreal. And ate a lot of good food.
Now I'm back in the land of enchantment, with its crazy weather -- we've
gone from snow to sun to cold breezes to HOT to threatening thunderstorm
in the couple of days I've been back. Never a dull moment!
I confess I'm missing those chocolate croissants for breakfast
just a little bit.
We still don't have internet: it's nearly 9 weeks since Comcast's
first visit, and their latest prediction (which changes every time I
talk to them) is a week from today.
But it's warm and sunny this morning,
there's a white-crowned sparrow singing outside the window,
and I've just seen our first hummingbird (a male -- I think it's a
broad-tailed, but it'll take a while to be confident of IDs on all
these new-to-me birds). PyCon was fun -- but it's nice to be home.
[ 10:20 Apr 17, 2014
More conferences |
permalink to this entry |
Sun, 06 Apr 2014
Things have been hectic in the last few days before I leave for
Montreal with last-minute preparation for our PyCon tutorial,
your own PiDoorbell - Learn Home Automation with Python
But New Mexico came through on my next-to-last full day with some
pretty interesting weather. A windstorm in the afternoon gave way
to thunder (but almost no lightning -- I saw maybe one indistinct flash)
which gave way to a strange fluffy hail that got gradually bigger until
it eventually grew to pea-sized snowballs, big enough and snow enough
to capture well in photographs as they came down on the junipers
and in the garden.
Then after about twenty minutes the storm stopped the sun came out.
And now I'm back to tweaking tutorial slides and thinking about packing
while watching the sunset light on the Rio Grande gorge.
But tomorrow I leave it behind and fly to Montreal.
See you at PyCon!
[ 18:55 Apr 06, 2014
More misc |
permalink to this entry |