Tuesday, September 29, 2009

The Boy Scout Motto

Be Prepared. That is the motto of the Boy Scouts of America. And everyone loves the boy scouts, right? Okay, maybe not everyone. I remember hearing kids in school make fun of boy scouts. I also remember those same kids, not too long after high school, stumbling around drunk at a local grocery store, making fun of anything they could manage to focus on. Kind of puts things into focus, doesn't it?

What does it mean to me to be prepared? I don't board an airplane without snacks, bottled water and sufficient reading material; you never know how much time you'll spend in the air or even just on the runway. I keep small sewing kits and first aid kits in my car, along with a flashlight, a roll of paper shop towels, and of course, jumper cables. And I've used all of them. I keep a spare laptop power brick in my work backpack, and have ended up using it on a number of occasions, sometimes because I forgot mine, but often because somebody else forgot theirs.

Being prepared means thinking about things that might happen, so that if and when they do happen, you don't get caught with your pants down. Of course, we can't think of everything that might happen, but we do our best. And one of the things that I like to keep stocked is my food storage. I started slowly building it when I got married, and when I got laid off a year and a half later and was out of work for six weeks, my family and I were fed.

I was dismayed some time ago to discover that there is a name for people like me: preppers. It sounds like "pepper", which is kind of cool, but reeks of "Trekker", which is completely uncool (even for me, and I also reek of uncool). But it gets worse. See, a lot of preppers believe that in addition to their food storage, they must also prepare for things like civil unrest. I don't think this is entirely unfounded. Anyone that's been through, or even seen on TV, riots and looting in large cities because of everything from natural disasters to local sports teams winning (or losing) would be a fool to find civil unrest unlikely.

I don't mind them stocking up on their guns and ammo. It's not my thing, but I'm not going to slam on them either. But what kills me is when their efforts to ensure their families' safety makes them look like gun-toting fanatics who will try to cease power at their earliest opportunity. I don't see it like that, but a lot of people do.

That's right. Some people actually have actually expressed discontent and fear at preppers, for a variety of reasons, including the one I just mentioned. One person, who's vanity mandated that her blog's name included the words "pretty girl", has stated that "Preppers Scare the Crap Out of Me". Her post is filled with a torrent of misinformation, and even tries to bring politics into condemning what I consider to be common sense: being prepared. For the record, I'm a little jaded that the post that refered me to hers also brought politics into it. Look, I don't care whether you're liberal, conservative, moderate, etc: when disaster happens, if you're not prepared, it may mean the difference between life and death, or at the very least, confinement and freedom.

Hundreds of years ago, back before the days when American politics invaded our society, way before the Boy Scouts, there was a dude named Aesop. I don't know if he really came up with the story of The Ant and the Grasshopper, but the moral is clear: being prepared can save your life.

My favorite part of the pretty girl's post is her closing thought: "For now though, I’m stocking up on sugary rum and tequila and calling it a day." Well, at least she has a plan, even if it is no more than to drink herself into a drunken stupor.

Kind of puts things into focus, doesn't it?

Thursday, September 17, 2009

Speaking at UTOSC 2009

Those of you in or near Utah may be interested to know that this year's Utah Open Source Conference is on the horizon. There's a full schedule at this conference, and I'm please to announce that I will be making two presentations this year. I thought I'd let you know what I'll be presenting on, using the text from the program descriptions:

Monitoring Your Servers
Friday, October 9, 6:15pm
Monitoring servers has become increasingly important in recent years, as downtime has become increasingly unacceptable. Countless tools exist to notify admins when downtime occurs, and possibly raise flags beforehand to keep it from happening in the first place. This session will explore some of the tools available, and discuss which ones are most appropriate for certain situations.

Object Oriented Cooking
Saturday, October 10, 4:45pm

It seems that more and more geeks are discovering a fascination with cooking. Whether you're a geek that lives to cook or just cooks to live, Object Oriented Cooking is for you! Geek chef Joseph Hall will show you how smaller recipes can become objects, ready to be included on a whim in larger recipes. As you begin to understand how code reuse can happen in the kitchen, your meals will become both easier and tastier.

Of course, the problem with making two presentations instead of one, like in years past, is that now I have to prepare twice as much content to present. The first year I was talked into teaching a cooking class, even though it wasn't technically computer-related. The second year, I taught a Perl class instead, partly in order to stay on topic with the rest of the conference. By popular demand (I had people asking about it as early as last year's conference) the cooking class is back this year, but with a twist: I'm trying to present cooking in a format which is more familiar to geeks.

The server monitoring session is something that I'm planning to use to explain my own personal quest to keep an eye on my servers, both at home, and at work. Mostly at work. Because of my specific needs, some solutions were more appropriate than others. Obviously, your needs will probably vary. The idea is not necessarily to describe specific technologies, but to help identify which technologies are most appropriate for your specific needs.

If past years are any indication, then we're going to be in for an exciting conference in general. If you haven't registered yet, now's the time.

Saturday, September 12, 2009

Ecuadorian Chocolate from Amano

You need to understand something. I love Ecuadorian chocolate. A few years ago I went to a chocolate tasting with E Guittard, and my favorite sample was a piece of dark chocolate from Ecuador that was just awesome. Ever since, I'm always on the lookout for single-bean origin chocolate from Ecuador. Venezuelan is easy to find. So is Columbian. Unfortunately, Ecuadorian seems to be a pretty rare find.

This leads me to today's story. I was at the airport today, and I ran into none other than Art Pollard from Amano Chocolate. He was on his way to a village in Ecuador called Guayas. This did not surprise me. Art spends a lot of time meeting with the farmers that are growing his cacao beans. But what did surprise me was when I found out that this particular trip was paid for by the Ecuadorian government.

You see, while Amano isn't known for large production quantiies, they are known for high quality. If you don't believe me, ask the Ecuadorian government, who has been so impressed with the quality of Amano chocolate that they want to use them to help promote the sale of Ecuadorian cocoa. Amano has officially become the Michael Jordon of the chocolate world; they are no longer just selling themselves, their fame is being used to sell people too.

Art had a bag with him filled with bars of his new Ecuadorian chocolate, named Guayas, after the village which produced the beans. He gave me a bar, and was so excited about it that he wouldn't let me walk off without trying it and telling him what I thought.

I broke off a square and put it in my mouth. The first thing that hit me was the deep smokiness that I love so much in Ecuadorian chocolate. It was followed by a subtle hint of earthiness, and then a bitterness that was not unwelcome. Then came the fruitiness. The bitterness had woken up my taste buds, and they were ready to embrace that intense fruitiness. But unlike Amano's Madagascar bar, this fruitiness was accompanied by that familiar chocolate flavor that we all know from lesser, gateway chocolates. As the chocolate melted away, any bitterness that was there was replaced by the vanishing flavor of fruit and chocolate that left me wanting for more.

I wish I could tell you to go out and buy this right now, but I can't. While the bars have been formed and wrapped in foil, as of the time of this writing the boxes are still being printed. This bar won't hit the market for another 3 to 4 weeks. As much as I'm tempted to end this post with a couple of "neeners", the truth is, I will probably be going through withdrawl myself before I make it back to Utah, and will still have a couple more weeks before I can buy any more. So in a way, I'm kind of in the same boat as you guys. Except that I got to taste it first.

Neener.

Disclaimer: If you didn't know before now, it should be obvious from this post that I know and am friends with Art. If that makes me seem biased, then clearly the only solution is for you to buy a bar and decide for yourself.

Friday, September 11, 2009

Moving Planters indoors for Winter: Python Redux

Okay, so I'm a still a little bitter. Last year I posted a quick script for dealing with USDA data. To my absolute surprise, I have received far more traffic from this post than I ever dreamed. Many people were able to use it immediately, while some encountered speed bumps. The amount of emails that I've received concerning it is far greater than the amount of comments posted on the article itself.

And then one day, some lazy reader named Tony posted the comment:
Would be nice to have the ruby version of that perl code. It's a nightmare for someone with no perl experience :-(
I was a little ticked, and it probably showed in the curtness of my reply comment suggesting that he was welcome to write his own. My bitterness was again reflected in my most recent piece of code that does an automated weather check.

The highly skilled and talented James Lance took up the challenge and rewrote my script in Python. Granted, the fact that James is also an excellent Perl coder might have given him an edge, but he probably also knew the procedure was simple in any language: download some XML, check one of the values, and send an email if it matched a particular condition. You could write this in Bash if you needed to. James just took the initiative.

Kudos to James for not being lazy, and providing the Python version. I'm not so bitter anymore.

Friday, September 4, 2009

Moving Planters Indoors for the Winter

Winter will be here in a couple of months, and if you're like me, you might have some potted plants outside that you want to move inside when it starts getting too cold. Unfortunately, if you're like me, you're probably also not very good at checking the weather forecast to know when it's expected to be cold. Heck, sometimes I don't even know that it's going to be raining sometimes until I step outside into the rain without an umbrella or rain coat.

Fortunately, computers have made a lot of types of automation easier, like checking the weather for you. Since weather.gov is paid for by your tax dollars (if you're American), the data on that site is freely available. And bonus: you can now download a 7-day forecast for your area in XML format, suitable for easy parsing.

The quick link to the page you need to look at is http://www.wrh.noaa.gov/forecast/wxtables/. When you get there, you can click on the XML radio button, type in your city and state, and click "Go". The URL of the next page will be the link that you need to grab for your automated reports.

There are plenty of tools and programming languages out there for you to choose from to handle this, but if you're in the aforementioned class of people who are like me, you've probably already chosen Perl. Let me make your life a little easier, and give you the source code for a cron that I tossed together this morning. I have it set up to run at 6:30am every morning:




#!/usr/bin/perl

use strict;
use XML::Simple;
use LWP::UserAgent;

my $xs = XML::Simple->new();
my $ua = LWP::UserAgent->new();

my $url = 'http://www.wrh.noaa.gov/forecast/xml/xml.php?duration=168&interval=6&lat=40.69651&lon=-112.091784';
my $response = $ua->get( $url );
my $content = $response->decoded_content();
my $xml = $xs->XMLin( $content );
my %temps;

for my $day ( @{$xml->{forecastDay}} ) {
eval {
for my $hour ( @{$day->{period}} ) {
my $temp = $hour->{temperature}{content};
$temps{$temp} = 1;
}
}
}

my @temps = sort keys %temps;
my $lowtemp = $temps[0];

if ( $lowtemp < 40 ) {
use Net::SMTP::TLS;
my $smtp = Net::SMTP::TLS->new(
'smtp.gmail.com',
'Port' => '587',
'User' => 'username',
'Password' => 'password',
);
$smtp->mail('username@gmail.com');
$smtp->to('000000000@messaging.sprintpcs.com');
$smtp->data();
$smtp->datasend("Subject: Cold Weather\n");
$smtp->datasend("\n");
$smtp->datasend("Temps as low as $lowtemp coming up");
$smtp->dataend();
$smtp->quit();
}

exit;



Note to Perl programmers: This was a quick script, and it does the job. If you would like to offer improvements, I would love to hear them.

Note to non-Perl programmers: I'm sorry I didn't write it in (Python|Ruby|PHP) or whatever other language you prefer. You're more than welcome to write your own.