off by one for 2011

<Y
Y>

Wed Feb 09 16:09:24 mairix rocks:

If you're like me, and if you're reading this there's at least a possibility you are, you don't keep your email at Gmail or in Thunderbird or Mail.app or wherever -- you keep it the way Ray Tomlinson intended -- on a server where you read it in plain text format. I use mutt with mboxes, but there are a lot of other possibilities. Anyway, after 10 or 20 (or more!) years of archiving your mail, it sometimes gets hard to find what you're looking for. Well, mairix is just the tool for you -- it incrementally indexes messages, and returns search results as a folder of messages for you to look in. It's free software, it's fast, and available in Ubuntu.

Fri Mar 11 11:32:26 getopts -- another one for posterity:

Just a little addition to posterity about getopts. 'getopts' is a handy bash builtin that parses parameter strings. It exists so parameters can be processed in a consistent way, and so you don't have to reinvent the wheel every time you want to use command line switches. It's part of POSIX, is really pretty easy to use, and many languages have libraries which work in a similar way. Anyway, there are many tutorials online, but the one at bash-hackers.org is the best I've seen for bash.

I was inspired to write this post because I've been wrestling with a problem. I used getopts inside a function that I was using for logging. It just wasn't working right and the behavior was strange. The answer, which perhaps should have been obvious in retrospect, is that getopts uses a variable, OPTIND, to index into the parameter list. You can use OPTIND to "shift off" the options you found with getopts, leaving the remainder.

This works great if you run getopts once, at the beginning of a script. But because of bash's scoping, if you use getopts inside a function, the value of OPTIND remains where it was left at the end of the previous getopts execution. So, if you're going to use getopts inside a function, you should reset OPTIND when finished or, to be safe, at the beginning of the function before running getopts.

I'm so glad I spent a few hours chasing that one down.

Update: It also implies that you should be mighty careful if you plan to use getopts in more than one place in the same execution of a program!

Sat Apr 02 14:58:59 libconfig problems in Debian and Ubuntu:

Are you still using Hardy Heron? Have you had issues using libconfig -- a configuration parsing library by Mark Lindner -- in Debian or Ubuntu? Here's why. Turns out this has been solved in later releases.

Tue Apr 05 12:22:49 how to slice a sandwich:

What's your preferred sandwich slicing angle? Vertical (shortest cut), Diagonal (longest cut), or Horizontal (medium cut)?

I have always been a diagonal cut man, myself. That's how mom did it. I don't like the way vertical cut sandwiches taste. But currently, I'm more interested in whether *anyone* does the horizontal cut... I don't think I've ever seen that outside of the laboratory.

Perhaps geometry is at work here. Diagonal ...cut sandwiches represent right triangles, which are pretty cool -- arguably more important than parallelograms, since parallelograms can be made from triangles. And of course, 3 is the magic number.

But also, notice that the golden ratio of 1:1.62 appears in vertical cut sandwiches, but does not appear in horizontal cut sandwiches. In our experiments here at Tastytronic Labs, our sample bread measures about 5.25 by 4.25 inches (the units of the United States of America!).

A vertical cut sandwich is roughly 2.63 x 4.25 inches, while a horizontal cut (known as "the devil's cut" in medieval times) results in a sandwich that is ~2.13 x 3.44. By applying the golden ratio (1:1.62) to 2.63 (vertical cut sandwich width), we get 4.26 -- almost exactly the vertical cut length. However, applying it to 2.13 (horizontal cut sandwich slice width) we only get 3.45 -- considerably less than the horizontal cut slice length.

And thus we find a possible explanation for why the "horizontal cut" is so rare. It's at least safe to say that Aristotle's mom did not cut sandwiches horizontally.

Wed Apr 13 13:28:38 random thought:

Hardware is just software you can't change.

Sun Apr 17 19:37:41 Unintentionally funny DVR episode synopses #243:

"Property Virgins. 'A Woman Who Survived a Lightning Strike Is Shocked by Real Estate Prices' Home prices shock a lightning-strike survivor."

Fri Apr 22 19:50:40 zing!:

If I ever open a Beatles-themed day-old bread store, it will be called "Yeasterday"! Bada-boom!

Fri May 06 06:56:03 Hummingbird TV:

Almost as soon as we moved into this apartment in Pacific Palisades, CA, I put up a hummingbird feeder. There are tons of them in this neighborhood, and I've always enjoyed them. Then, A couple years ago, I took cuttings from the ivy growing in our hedge and planted it on our porch. It grew pretty well and soon started its way across the ceiling of our little porch cubicle.

Well, a few weeks ago, I noticed something weird on a branch but didn't pay any attention to it. Until I noticed that a hummingbird was very often on the branch -- and zoomed away every time I opened the door. Then, one day I was working on the porch, watering the plants, and the hummer zoomed up with a mouth full of fluff and spiderwebs and it all clicked -- the bird was building a nest in our ivy.

Now, what else is there for a computer nerd to do than to webcast the whole thing?

Vital statistics: I think it's a female Allen's Hummingbird, but I'm not exactly sure. Yes, that is an egg in the nest. There is one small egg [Update: now two eggs!], about the size of a large jelly bean. I've read online that they usually lay two eggs, but there's definitely just one in the nest. The nest itself is probably 6cm long, about an inch and a half. The bird was working on the nest less than a week ago but the egg is visible in the earliest pictures I took with the webcam on 5/4.

The weirdest thing is that the bird is only on the nest maybe 20 minutes out of the hour, or less, and it's not (usually) because of interruptions from us. I don't know if that means the egg really isn't going to hatch, or if that's acceptable in a warmer climate, or what. I'm hoping that if it doesn't hatch, she might "double brood" -- have another round. There are h-birds year round here so that's not impossible.

Images are updated between 6AM and 8PM every night, although I may shrink that some, as you can see, the cameras don't handle the low light very well. I will probably document my setup in a few days for those out there that are interested, but in short, it's basic webcams being driven by a Linksys NSLU2 running Debian Linux.

Anyway, I hope you enjoy!

Wed Sep 21 10:15:41 Changing references from parens to brackets...:

In Word 2007 (at least) in order to change references from using parentheses to using square brackets requires editing XML! Boooo.

http://channel9.msdn.com/forums/Coffeehouse/240589-Word-2007-citations-should-be-simple-but-solved/

Wed Sep 21 14:59:33 Codin' Chip:

In the Boy Scouts, there is a thing called a "Totin' Chip". It is "both an award and contract in Boy Scouts of America that shows Scouts understand and agree to certain principles of using different tools with blades" (WP). To get the Totin' Chip, which is a paper card (like a library card or the like) scouts must demonstrate a certain amount of knowledge and responsibility. The Wikipedia page has more on it, of course. The main thing (besides the rules) is that violations of the Totin' Chip code result in one or more corners of the card being removed; when all the corners are gone, you lose your right to tote a blade.

Anyway, I think there should be a "Codin' Chip" -- maybe it's a card, maybe it's an actual chip. If it's a card you lose corners; if it's a chip, you lose pins. Anyway, when you lose em' all, you're done.

Violations can be large or small; for example, not commenting code meant for others to read falls into that category, as does using equality to test floating point numbers inappropriately. Using strcpy and the like is definitely in there.

What else should cause you to forfeit a pin off your Codin' Chip?

Tue Dec 06 09:10:10 The Process #1 -- The Symbolism Survey:

Lately I've been really interested in the process that a craftsman goes through, intentionally or unintentionally, in the process of creation. I use the word craftsman because I'm interested not just in "art" per se, but also (not coincidentally) in things like academic writing, problem solving and engineering. This is a fascinating treasure trove, not just for the answers provided, but for who provided them...

The Symbolism Survey

From clickolinko.

off by one for 2011

<Y
Y>

[Main]

Unless otherwise noted, all content licensed by Peter A. H. Peterson
under a Creative Commons License.