Wednesday, December 23, 2009

Amano Chocolate: Dos Rios

I can't even tell you how mad I am right now at Art Pollard, at Amano Chocolate. After my glowing review of his totally excellent Guayas chocolate, he rewarded me by completely failing to mention that he had another chocolate also on the way: Dos Rios. I would have had no idea if I hadn't seen it on the shelf at Pirate-O's today.

I bought a bar, along with my sandwich for lunch, and headed back to the office. After a few bites of sandwich, I decided that I couldn't wait to try the chocolate. So I put the sandwich down and broke off a piece of chocolate. The second I put it in my mouth, I knew I had a problem. Not only did I not want to finish my sandwich, for fear of losing the flavor that was suddenly in my mouth. In fact, I don't know if I can ever eat another kind of chocolate again. I have officially been ruined.

The box that this chocolate comes in describes it as tasting like bergamot oranges, cloves and cinnamon. They're not kidding. The orange punched me in the mouth immediately, and was complimented by an amazing set of spices. I used to like those cheap chocolate oranges that you can find everywhere in America around Christmas time. They are officially crap. This trumps that any day.

There is a bitterness that you expect from dark chocolate, but it's not an unpleasant bitterness. I broke off a piece and gave it to Harleypig, and told him that he had to try it. The look on his face was classic. He finally said, "I do not like dark chocolate. But I like this." The bitterness is one of the things he mentioned. It's not the dark bitterness of overly dark chocolate, but the pleasant bitterness of an orange that isn't too sweet.

You have to try this. If you're in the south part of the Salt Lake valley, go down to Pirate-O's right now and buy a bar. If you're closer to downtown, go to Caputo's and get it. If you're too far from either, order online. This stuff is effing amazing.

Disclaimer: Although he's apparently not much of a friend right now, I do know Art Pollard. I don't believe this to have biased my review of the chocolate itself, but that's your call. And maybe if Art starts telling me about new flavors again, I'll acknowledge him as a friend again.

Update: Art called, and we talked shop until I had to go change a diaper. We're friends again.

Friday, December 18, 2009

Fun with sshd and strace

I suppose this would be a much bigger concern if you could pull it off as an unprivileged user, but you do have to have root access on a server to pull this off. And really, once somebody has root, all bets are off anyway. Still, it's an interesting excercise.

In one window, log into a Linux server (RHEL 5.3 in my case) as root. In another window, use ssh to log from a remote machine into the server:

jhall@bourdain ~$ sftp guest@myserver
Connecting to myserver...
guest@myserver's password:

When it prompts for the password, hop back over to the server and run ps to figure out which process is handling the connection:

[root@myserver ~]# ps auxf | grep ssh
root 28705 0.0 0.0 60672 1184 ? Ss 12:32 0:00 /usr/sbin/sshd
root 29361 0.0 0.0 86856 3116 ? Ss 14:36 0:00 \_ sshd: guest [priv]
sshd 29362 0.0 0.0 62016 1384 ? S 14:36 0:00 \_ sshd: guest [net]

What you need from this is the PID of the sshd process with [priv] next to it. In this case, 29361. Use strace to hop in and monitor this process (redirecting STDERR to a file, for later reference):

[root@myserver ~]# strace -p 29361 2> strace.log

Go back over to the remote system and type in the password. Go back to the server, cancel the strace, and then take a look at the log file. On my system, the 3rd line down had the payload:

Process 29361 attached - interrupt to quit
read(6, "\0\0\0\f", 4) = 4
read(6, "\v\0\0\0\7inmelet", 12) = 12
getuid() = 0
open("/etc/passwd", O_RDONLY) = 4

The text that we're looking for here is "inmelet", which is our sample password. In the clear.

Of course, this was a very manual process. But plenty of techniques exist would would allow us to monitor sshd, and launch strace automagically every time a user logged in. Of course, if you're using ssh keys, then there would be no password to see in the clear anyway. I haven't tested to see if you could steal the ssh key though. That might be a fun excercise too.

Thursday, December 17, 2009

Create a Custom MDA with Postfix and Perl

Wow, this was a fun one. We have an internal "project manager" that we use at work, instead of my prefered program, RT. The other day, my boss asked me to set up this program so that they could email tasks to it, instead of having to pull up the site to create a new task. The easy part was building the queue into our system. But the fun part was setting up Postfix to receive and parse the emails.

My first thought was to set up Procmail to send the messages to my parsing script. I'd never used it before, and I'd heard horror stories about writing "recipes" in it. What I had not heard was how difficult it could be to get it to play right. The mail server that I was using was not one that I had set up, and it had some weirdness about it that I wasn't familiar with. After fighting with Postfix and Procmail for a while, I managed to learn enough about Postfix configuration to realize that I might as well just skip Procmail, and write my own MDA.

Now, when I say MDA, it's a bit of a misnomer. It receives and parses emails, but rather than filtering and delivering emails to a specific mailbox, it dumps a few fields into a database. To avoid confounding the issue too much, I will try and keep this post to the bare minimum. My setup uses virtual mailboxes, but I won't go into the steps to set that up. I also won't cover the DBI code that I wrote. If I get enough requests, maybe those can go into other posts.

First things first. You need to edit the mail.cf file to set up some transports. There were two specific lines that I needed to add to mine:

virtual_transport = virtual
transport_maps = hash:/etc/postfix/transport

This allows me to only send messages sent to specific email addresses to my MDA. So the next step is to add the addresses to /etc/postfix/transport that you want forwarded to your MDA:

tasks@mytaskmanager.com mymda
projects@mytaskmanager.com mymda

Make sure to hash the file once you've edited it:

postmap /etc/postfix/transport

You've probably guessed that "mymda" is what you're going to call your MDA. This doesn't have to be the name of your script, it's just a pointer to the lines that you're about to add to your master.cf file:

mymda unix - n n - - pipe
flags=R user=vmail argv=/usr/local/bin/mymdascript.pl USER=${user} EXTENSION=${extension}

You can see in here where we actually define the name of your script, in this case "/usr/local/bin/mymdascript.pl". Now that we're done with the Postfix configuration (remember to restart postfix for it to take effect), we can go ahead and set up that script. It's going to look something like this:

#!/usr/bin/perl

use Mail::Internet;

my @rfc2822 = <STDIN>;
my $email = Mail::Internet->new( [ @rfc2822 ] );

my $from = $email->head->get("From");
my $date = $email->head->get("Date");
my $subject = $email->head->get("Subject");
my $body = $email->body();
$body = join( '', @$body );
...snip...

This is a very, very basic script. It will receive the email from Postfix using STDIN, and to save you the trouble of parsing it out manually, I just ran it through Mail::Internet (part of the MailTools package).

Keep in mind that each line that you pull out of the message will have a newline in it, so $from, $date, $subject, etc. may need to be chomped, depending on your needs. Also, the date is hopefully in RFC2822 format, so in my case, I had to run it throught DateTime::Format::Mail to get it ready for MySQL.

Like I said, this isn't a full MDA. But it can be used for accepting things like commands, preformatted data, etc. from email and processing them, without having to deal with the overhead of something like Procmail. And if you want to use it to write a full-featured MDA, by all means feel free. And really, now that you know that the script is going to pull the message from STDIN, you're free to use C, Python, even Bash if you want.

Sunday, December 13, 2009

Cinnamin Craisin Muffins



Okay, so I have a thing for silicone baking molds. And I know the shapes weren't quite what I wanted. So sue me.

Baking molds aside, these muffins are the perfect way to start off a cold, wintery day. As with most muffins, it takes longer for the oven to preheat before than it takes to mix everything together, so set your oven to 375F a good 10 minutes before you start mixing.

1 1/2 cups flour
1 1/2 tsp baking powder
1/2 tsp salt
1/2 tsp nutmeg
1 Tbsp cinnamon
1/2 cup melted butter
1 cup packed brown sugar
1 whole chicken egg
1/2 cup milk
2 oz craisins

Being muffins, we use the muffin method: whisk together the dry stuff (flour, baking powder, salt, nutmeg and cinnamon) in one bowl, whisk together the wet stuff (melted butter, brown sugar, egg and milk) in another bowl, then combine and mix together with a spatula (trust me it's easier to combine wet and dry with that than with a whisk). Fold in the craisins, pour into prepared muffin tins, and bake for 20 to 25 minutes at 375F.

On a diet? Or maybe just looking for a way to add a little extra flavor? I'm told that with the muffin method, you can swap out the liquid fat with apple sauce, cup for cup. I didn't try it with this recipe, but I've done it before and it's worked well. And you can still spread on butter after it bakes, so don't worry about losing that goodness.

Monday, December 7, 2009

Periodic Tables of Food

A couple of days ago, I stumbled upon a poster at AllPosters of a Periodic Table of Vegetables. It's an interesting concept, to be sure. The Periodic Table of the Elements is a mapping of a particular type of data, organized by groups (columns) and periods (rows). Why not use the same style as a visual representation of something tastier?

Unfortunately, the image is a little too small to make out most of the veggies clearly, but it got me wondering what other kinds of periodic tables of food exist. The search was, and still is, on. I found several interesting tables of food, a couple of which I had even seen before. I also found non-food tables, my favorite being of game controllers. Here's what I've found so far:

The table that I've found myself looking at, and wanting to hang up on my wall the most, is the Periodic Table of Dessert. It breaks down its categorization into separate ingredients, which is important, because that's pretty much what the elemental table does. It makes an excellent effort to categorize things clearly, and assigns one- or two-letter symbols to each item. However, it does contain far fewer columns than the original, and uses symbols that I don't necessarily agree with (why P for peanut butter, instead of PB? How does M signify honey?). I would love to send this table through another revision. On the bright side, it is accompanied by a thermal spectrum (which doesn't make a whole lot of sense to me) and what appears to be the crystaline structures for several compounds (which is just awesome). These are all available together as a single poster.

Next up is the Table of Condiments that Periodically Go Bad. Unlike the dessert table, this table is numbered. Unfortunately, the numbers really only make sense paradoically (is that a word?). Again, elements are given symbols, and any that crossover to the dessert table actually seem to match. This kills me. I don't think that salt should be S, I think it should be Sl or Sa. Ideally, we would break into a three-letter designation, and use Sal. <End Rant> The most important part of this table is the designation for each condiment of how long you have before it goes bad. Very nice, in terms of food safety.

The Periodic Table of Produce is similar, except that it feels much more serious to me. Really, it's a table of food storage of fresh produce, including storage suggestions and timelines to when a particular veg will go bad. I would love to find a higher-quality version of this, and put it on my refrigerator door.

Growing more complex, we have a Periodic Table of Cheeses, complete with full merchandizing on t-shirts, mugs, mouse pads and, of course, posters. According to the site, this table was created by the blind Russian cook Anatoli Grigor Konchalovsky, apparently in 1865. I don't know how true that is, but if it is, that probably makes it the first periodic parody of food. Some thought has clearly gone into its organization, but I'm not entirely sure yet what each color means, or how some of the groupings fit. I love the "Noble Cheeses" classification, though.

I found the Periodic Breakfast Table interesting, though I haven't yet found a copy that looks to be complete. Offhand, it seems to be sorted visually, rather than by type of grain, manufacturer, history, etc. It does have some of this printed with each cereal, but it doesn't seem to be sorted that way.

Going back to deserts, there was a Periodic Table of Cupcakes posted in Women's Day earlier this year. There's a part of me that is impressed, because I never would have expected any mainstream periodical (other than the venerable Cook's Illustrated) to expect their readers to enjoy a scientific nod like this. But then another part of me looks at the actual cupcakes printed, and would be entirely confused by the majority of them if it didn't know that really it's probably just a marketing gimmick for their own recipes. Still, it's cool.

The Periodic Table of Candy looks to be entirely parody, listing commercial candy varieties, numbered, and in alphabetical order. I haven't decided yet whether the little girl at the top is cute or frightening.

Our journey is almost over. Back at AllPosters, I also came across a poster of the Periodic Table of Sandwichry. There is no way I can make out anything sensible on this, but as one of the cheaper posted presented, I might be willing to order it along with something else.

To finish up, I present to you the Periodic Tables of Beer Styles and of Mixology. Add these to the category of "Text to small to read, so no clue as to any useful information, including accuracy." Still, it's a nice thought.

Tuesday, December 1, 2009

T-Shirts For Sale!



Some of you may recall that when I did my Object Oriented Cooking presentation at the 2009 Utah Open Source Conference, I was wearing a t-shirt with an 8-bit stand mixer on it, instead of one of the bowling shirts that I usually wear. I actually designed and had that shirt made about a year ago. The idea was always to put up a few designs for sale, but I never got around to it; mostly because I only ever came up with one other design that I was even remotely happy with.

Well, a couple of nights ago, I got an idea for another design. It was based on the source code that I used in my presentation for a PB&J sandwich, written in Perl. I drew up the 8-bit graphics, added the source code to the back of the shirt, and after a couple of revisions, posted it for sale.

I now have three shirt designs for sale, in my Spreadshirt store. All feature 8-bit graphics depicting various food-related items. We have the stand mixer that I wore at the conference, a big-ol' jug of moonshine, and of source the PB&J in Perl. And just in time for Christmas too!

So if you want to show your geek side and your food side all at once, head over to my Spreadshirt store and grab a t-shirt. Or direct your friends and/or family members in that direction! I'll post more shirts as ideas come to me, but at least now we have an appetizer to get everyone started.

Friday, October 23, 2009

Mitigating the Evil Maid Attack

The security world is buzzing with news of the so-called "evil maid" attack. The basic warning is this: no matter how secure you think you are, you aren't. Full-disk encryption is now provably breakable, and without actually having to break the encryption itself. All you need to do is get ahold of a computer that has been shut down, boot to your own boot device, screw with the boot loader, and shut down again... and then come back after the computer has been turned on and logged into by the real user.

This attack has been called the evil maid attack because a hotel maid is in a perfect position to accomplish this. They have access to the room when you're not around, and leaving a "do not disturb" sign on your door is hardly a deterrent. If you stay at a hotel multiple nights in a row, and you leave your computer in your room while you're not around, you are leaving yourself at risk. You may be the subject of a targetted attack, where the attacker poses as a maid or otherwise gains access to your hotel room while you're out. Or an attacker may get an actual job as a maid at a high-profile hotel, where they know that plenty of secrets will always be passing their way, waiting to be stolen.

There are measures you can take to try and prevent this attack from occuring in the first place. Think of them in terms of both intrusion prevention, and intrusion detection. For instance, a BIOS password can be difficult at best to compromise on a laptop. This is an aspect of intrusion prevention. Of course, it is still possible to reset the BIOS password on a laptop, which will then give the attacker access to install the attack MBR. But if you turn on your computer and there is suddenly no password, when you previously had one, then you know that something is amiss. This is a form of intrusion detection.

You could always use a thumb drive to boot your machine, which would make an evil maid attack against your actual hard drive completely worthless. This introduces another aspect of computer security, which security experts will always disparage, called "security through obscurity". If the attacker doesn't know that you use this method, then they won't be able to attack against it. The problem with this method is, now you have to protect both your boot key, and your laptop. If you only use one thumb drive to boot your machine, and that drive somehow gets damaged (water, static electricity, EMF), then you lose the ability to use your computer.

You could change your password on every boot. Using traditional methods, this is is tedius, and inconvenient, and ignores the fact that the modified boot record might be prepared for it anyway. You could use a password dongle, but that suffers from the same limitations as the thumb drive.

You could leave your computer on, of course. If somebody shuts it down and messes with your boot record, then you'll at least be able to detect that. But then your computer is also susceptable to a cold boot attack, which doesn't require the attacker to return later, so that's out. Using a fingerprint scanner for authentication? Your fingerprints are probably everywhere on your computer already, and even the Mythbusters were able to fool these using little more than a photocopy.

So it would seem that leaving your computer off while you're not in the room is safer than leaving it on. Using alternative boot methods helps, but cannot completely prevent. Using a combination of methods is best, and while it may not provide 100% protection, it can slow down the attacker, and that may be enough.

Anybody else have any other methods that I missed?

Wednesday, October 21, 2009

Whiskerino 2009

"He that hath a beard is more than a youth, and he that hath no beard is less than a man." - William Shakespeare

The great Whiskerino 2009 is nigh at hand. In short, it is a beard-growing contest. The basic idea is, on November 1st, you shave. Everything comes off. And then you don't shave again until the end of February.

I have a lot of friends who have never seen me without a beard. When I met my wife, I had a goatee, and by the time our first child was born, I was sporting a full beard. Neither has ever seen me without facial hair. I'm a little worried my daughter won't recognize me.

I'm not that worried though. We had a dress code at cooking school that stated that you could have a beard or no beard, but you could not be in the stages of growing a beard. I knew that if we had a three-day weekend, I would have enough time to grow a long enough beard to be within the requirements of the dress code.

Of course I'm planning to enter the Whiskerino. I have a few friends that plan to as well. One rule is, you must post photos of your beard at least every 7 days, and more often towards the end. Never before has my beard been so well documented. I plan to post photos on my blog as well. For those who only read it via RSS, you're out of luck. I will be posting the photos on the side bar on my site.

If anybody out there has been contemplating growing a beard but waiting for the right time, the right time is now. Well, in a week and a half. I issue a challenge to all of my geek friends out there with the ability to grow facial hair. Even Shakespeare knew the importance of a Unix beard. Now is your beard's time to shine!

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.

Tuesday, August 18, 2009

Controlling Flash

Many of you kids may not remember The Big Cookie Scare about 10+ years ago. This was back before The Interwebs, when people sometimes called it the World Wide Web (so that's what "www" stands for!). The browser wars between Netscape and Microsoft were in full swing, and there was an epidemic of sites using these scary things called cookies. As far as a lot of people knew, there was no good that could come from cookies. I knew people who seriously thought that cookies were used as trojan horses, and that you could get viruses from them. I even worked for one of these people for two months, before finding myself a new job. Four months after I left, his company went out of business. Are we surprised?

Most people still don't know what browser cookies are, but the scare has lessened. Quite honestly, I think people just found new things to worry themselves about, especially when the browsers started introducing so-called "privacy controls". Now people can delete their cookies, block them from ever appearing on their computer in the first place, even edit them if they feel like it. The Intertubes are stuffed with rainbows and goodness. Or so we thought.

The cookie scare is back. People are suddenly finding out that this piece of goodness that Macromedia (and now Adobe, since the merger) has the ability to install cookies on your computer that your browser has no control over. Even worse, it's actually possible to have Flash install a cookie on your computer without you knowing that Flash is even running on a site. And if you delete a browser cookie, some sites keep a backup in the Flash cookie jar. Oh no! The tragedy! Webmasters have turned evil again!

I was already laughing. First of all, there's not much to worry about. Cookies are largely used as browser-side configuration to help maintain a consistent user experience, and as a mechanism to display ads to you that you actually care about, based on the types of sites you look at. This is little to worry about unless you're offended by content providers trying to use advertising to help pay for their employees and bandwidth, or you look at naughty sites while your boss/spouse/parents/etc are away. Shame on you.

But there are other reasons why I'm not worried. Thanks to a buddy of mine, I installed Flashblock a while back, which is a Firefox plug-in that keeps Flash files from loading unless you explicitly allow them to. I didn't initially install this because of some deep-seeded vendetta against Flash. It turns out that when Firefox 3 came out, certain Flash content would cause mplayer and Rhythmbox to stop working until I closed my browser. Since some sneaky sites think it's okay to automatically play videos when you open them, and certain friends have deluded themselves into thinking that I'm okay with this, I had to restart Firefox a lot.

Now that I'm running Flashblock, I don't get tricked into watching lame YouTube videos, and nobody is setting Flash cookies behind my back. But what if I was worried about cookies that were set before I installed Flashblock? Adobe's got you covered. They have on their site a Settings Manager for Flash cookies. It allows you to set rules and limits, and delete cookies that already exist on your computer.

So stop worrying about Flash cookies. Actually, stop worrying about cookies in general, you baby. If you're really paranoid, there are much, much worse things in the world to be worried about. Big brother's got plenty of other ways to keep tabs on you, and he probably thinks that cookies are an inefficient method anyway.

Hey, you've got something on your face. No, the other side. Up... up... yeah--yeah, you've got it.

Saturday, August 1, 2009

Cascabel Pork Tenderloin

I've been wanting to make this for a while, but cascabel chiles are amazingly hard to find in Salt Lake. The closest that I've come is some company that labels their guajillos as cascabels. It's tragic. I finally ordered some off of Amazon, and I'm ready to experiment.

I had three components that I needed: a pork tenderloin, a dry rub to put on the tenderloin before cooking it, and a sauce to put on the tenderloin after cooking it. I also needed some sides to go with the pork. They weren't as important, and unfortunately I think they suffered a little because of it. But I think they could be brought up to par. Let's get those out of the way first.

I needed some veg. I wanted something quick and simple. I decided to go with a medley of red bell pepper, zucchini and orange cauliflower (white will work just fine too, though). About a cup of each, cut into 3/4-inch pieces. I dropped these onto a sheet of foil, with some salt, oil, and Worcestershire sauce. This was folded up and set aside for later.



Next up, I needed some starch. Fortunately, I found some purple potatoes at the local grocery store. Have you ever had purple potatoes? They're so awesome. If you can't find them, you can use red potatoes. Put them in a zip-top bag with some oil and salt, toss them around, and when we're ready we'll toss them on the grill. Take them out of the bag first, though.



Next up, we need to get some sauce going. And for the sauce, we need a red bell pepper. And it needs to be roasted. Fire up the grill and put the pepper on it. Keep turning it every couple of minutes until the outside is nice and charred. Then put it in a bowl and cover it for a couple of minutes. That'll make them sweat, and the skin will peel right off.



Don't wash the skin off. You've worked hard (kind of) to get all that roasted flavor, and the last thing you want to do is wash it all off. Get the seeds out and set it aside. You'll need it in a moment, though. Add a bit of oil and salt, and a cup of mirepoix to a sauce pan over medium-high and get it nice and caramelized. Add a cup and a half of chicken broth to cool down the pan a little and drop it to medium-low. Add the roasted red bell pepper, a quarter cup of brown sugar, a canned chipotle, and four dried cascabel chiles (seeds removed). Let it simmer for a while. After about ten minutes, take an immersion blender to it, and get everything all nice and broken up. Let it sit on low until it reduces down into a nice, saucy consistency.

While that's happening, we need to get a dry rub together for the pork. Toss the following into a coffee grinder:

1 guajillo chile (dried)
1 New Mexico chile (dried)
1 chipotle chile (dried)
3 cascabel chiles (dried)
1/2 tsp minced garlic (dried)
1/2 tsp whole coriander seed
1/2 tsp whole allspice
1 tsp onion flakes
1 tsp mixed peppercorns

Now it's time to get down to business. First, toss the potatoes and the veg pouch on the grill. The veg pouch can go on an upper rack if you have one. If you have a gas grill, the heat should be on low. Then oil up the tenderloin, salt it, and rub it down with the spices. Toss it on the grill.



Isn't that a beautiful thing? You'll be wanting to cook the pork until it's somewhere around 155F or so. Then pull it and let it rest for a few minutes; it'll coast the rest of the way to doneness. While it's resting, you're going to toss together some mashed potatoes. The potatoes went on the grill before the pork, and with any luck should finish about the same time. You know the drill: a skewer should go in with a little resistance, but not much. Add them to a bowl with a quarter to a half cup of whole milk or cream, and a couple of tablespoons of the sauce, and mash 'em on up.



The veg steamed itself in the foil pouch, and is already ready to serve as is. I laid down a bed of purple mashers, laid a few slices of pork across the middle, sauced 'em, and added some veg around the side.



Thoughts: the spice rub was perfect. The leftover pork is sliced and in the fridge, and I can't help myself from snacking on the cold slices. The sauce was good, but mine had two chipotles in it and was way too hot. Drop it a little, and you're left with a nice, sweet chile-based sauce that still has some decent heat.

My potatoes were a little overcooked, but they tasted awesome otherwise. But I may have to come up with something a little better the next time around. Maybe something a little more garlicky and buttery.

The veg needed a lot of help. The red bell peppers were dead on perfect, but the zucchini and cauliflower were definitely lacking in flavor. I think this might be partially because they're pretty bland as it is. Something like Red, Purple and Bacon would be great. I just wanted to pull this all together on the grill. And I know this is going to sound crazy, but I was trying to avoid bacon on this one. Clearly, avoiding bacon leads only to disaster.

The plate that you see in the photo is pretty generously-portioned. But before you judge me, I should tell you that this was actually put together for me and my wife. We have plenty of leftovers, for meals to come. And tasty leftovers at that. I think that if you up the veggies a little, you could probably serve four to six people with this.

Sunday, July 26, 2009

Red, Purple and Bacon

And you thought I never cooked anymore.

I don't know about you, but I'm the sort of person who has a hard time seeing something like a head of purple cauliflower at the grocery store without buying it. They also had white, green and orange. But come on, a dude has his limits.

So what do you do with purple cauliflower? Well, anything you can do with regular cauliflower, really. You just get the advantage of having prettier colors. In this case, I started with bacon. Peppered bacon.



Huh. Eight half-slices. I could have sworn I ended up using six in the end dish. Something must have happened to the other two.

When the bacon is nice and crispy, pull out out of the pan and set it aside to drain. And yes, I know you don't like crispy bacon like I do. Trust me on this one. You want it crispy. Not cardboard crispy, but it does need to have some snap to it. Drain off most of the bacon fat, but not all of it.

I ended up using about a cup of purple cauliflower, cut into pieces, and half a cup of red bell pepper, also cut into pieces. Crank the heat, and saute them in the bacon fat. We're not looking to actually cook them all the way through, that will happen later. Right now we just want some color on them. I did add a splah or two of Worcestershire sauce though. I like it.



Then we need some pasta. I went with a ziti rigati, maybe a cup or so. Add it to the pan, along with a cup of chicken broth. Keep another half cup to a cup standing by, just in case. Also, I used a half tablespoon each of dried basil and dried chives.



This is a kind of absorption pasta dish. No wasted cooking water, and the pasta soaks up all of that flavorful liquid. You need to keep the pasta moving, but not constantly. Just enough that it all has a chance to soak up liquid, and none of it cooks unevenly. If you start to run out of liquid and the pasta isn't cooked yet, add another quarter cup or so and keep going.

The goal here is for the pasta to finish cooking at the same time as the veggies. It'll take somewhere around 10 minutes. give or take. You'll notice that I didn't add salt or pepper to this dish. Trust me, the bacon has plenty of both. In my case, the dish still ended up being just a tad saltier than I would have liked. Not enough to detract from the overall tastiness.

Just before the liquid finishes evaporating, you'll want to add the bacon back into the pan, along with the juice of half a lemon. You'll notice in the final photo that I ended up cutting it into inch-long pieces. I probably should have started out that way, but that's okay. The bacon is going to soak up just a little of the remaining juices, and catch some of the steam as well. This will make it lose some crisp. If you kept it soggy before, it will remain soggy.



Oh man. This stuff was awesome. I could have eaten it all night, but my heart would have exploded from the bacony goodness. Don't make it as an entree. Keep it as a side. Let me know if you think of the perfect thing to serve it with.

Saturday, July 18, 2009

Dude

I went to CostCo this morning to pick up a few things. When I was checking out, I had an interesting conversation with the checker. He was probably in his 50s or 60s, and reminded me of the dad in Better Off Dead, trying to communicate with his son. He didn't take it overboard, but he did use the word "dude" a lot. The way he said it was funny, as if it was a new sound that he had been trying out for a couple of days, but wasn't used to it yet. But he made sure to emphasize it ever so slightly, as if he was trying to assure me that he was young and hip.

"How are you today, Dude?"
"Um. Good."

Unlike on my blog, in person I tend to be a man of few words, at least to strangers. Certainly to strangers that I only expect to have to deal with for a couple of minutes, and then potentially never see again. Disposable strangers.

But the conversation took an annoying turn about the time he handed me my receipt. This is when I like cashiers to say. "thank you, have a good day", and then promptly ignore me in favor of the next person. But this was about the time he noticed my t-shirt.

"Oingo Boingo? I don't think I've heard of that, Dude. What is it?"
"They're a band. Well, they were a band."
"Oh, a band? You mean like music, Dude?"
"Yeah. Music."
"Well, what kind of music are they, Dude?"
"They were a ska band."
"Oh, you mean like rock and roll, Dude?"
"Um. Yeah. That's exactly what I mean."

Yes, he did use the word "dude" that many times, and more. The bagger (or whatever you'd call that guy at CostCo) was giving me looks that seemed to be a mix of, "I pity you" and "I pity me too".

There's a lesson here, I think. I'm not really sure what it is, though. Right off.

On. I mean on.

Thursday, July 9, 2009

The Maters

They's a growin'.



And the zucchini.



And the chiles.



But really, the maters.

Saturday, May 30, 2009

Replacing AWStats

Don't get me wrong; I've been a big fan of AWStats for years. It's great for giving me a high-level overview of how my sites are doing, traffic-wise. The day-by-day breakdown is nice, and if I don't mind looking at the big picture for my site a month at a time (which is usually good), then it's perfect. When I started working on a more complex setup than just a few low-traffic blogs, then it started to show its limitations. Let me tell you what I mean.

In our current setup at work (or at least the one that we've been moving toward), we have three web servers. Each server is behind a load balancer, and serves exactly the same sites. When I started monitoring, we had 200+ sites active. We wanted to have stats for each domain on each server, plus the stats for each domain across all servers, plus the stats for all domains on each individual server.

AWStats requires one separate config file per domain, per server, plus another separate config file per domain for all servers, plus a separate config for the server-wide stats. That means we're looking at 800+ separate config files. I wrote a script to automatically generate all of these for me, but they're still a pain to keep track of.

Before I parse out the log files, I need to combine multiple log files into massive composite log files (domain-wide and server-wide), in chronological order so that AWStats doesn't choke. As you can imagine, this requires a considerable amount of resources.

AWStats also maintains a flat data file per config file per month, all in the same directory. Assuming we keep just a year's worth of data, we're looking at 9600+ separate files in that directory. At this point, one wonders why we can't just store everything in a database.

Now that you've seen the kind of management nightmare that I have to deal with, with just the features that AWStats does have, I think you can see where my frustrations begin. But I can't be content just being unhappy with existing features; I want new features too. And anybody that's ever looked at the main awstats.pl file knows how much of a beast it is to figure out just what's going on, much less change anything.

I ended up adding some glue of my own to make things a little easier. Remember, not only do I have hundreds of config files and thousands of data files, I also have to pull them up in the first place. As it turns out, the script that I wrote to automate building config files also builds an HTML file with links to all of the AWStats pages in it. I even added a quick ping script to periodically hit each domain, and place a colored dot next to the domain name to indicate its active status (green is good, red is bad, blue and yellow are proprietary indicators that a site responded, but not in a normal manner). I even have other indicators set up to tell me things like whether a site has an SSL cert, today's hits so far, yesterday's hits, green up arrows to tell me if today's hits are higher then yesterdays, red down arrows if they are lower, yellow right arrows if the traffic is the same, you get the idea.

Maybe I'm just selfish, but I want a stats program that can handle all of this gracefully, and for not a lot of money. Free (as in freedom, and beer) is ideal. But since I ultimately decided to write my own, it certainly wasn't free as in time. But it was fun, and I learned a lot about AWStats while I was at it.

Incidentally, it turns out AWStats does support clusters kind of like our load balancer setup, but I didn't find that out until I spent a lot of time in the various parts of it. And I haven't taken the time to figure out how they do it; I already had a solution in mind anyway.

I hope this post gives you an idea of why I started thinking about replacing the great AWStats, I program which I still love and respect. If you're interested in looking at my code so far, I have packed it up for public consumption. Information about its operation and shortcomings are in the README.

Clicky!

Friday, May 22, 2009

Not So Inspirational Thoughts

I believe I've mentioned before that my primary responsibilities at work are as the systems administrator. It's something that Ive dabbled in with several previous companies, and taught a lot of classes on at my last job. Now I do it full time.

I was talking to my brother about it some months ago, explaining a few of the concepts of server security that I've either learned from others before me, or have picked up on my own. We might even have talked a little bit about social engineering and corporate security. After a while, my brother said to me, "so basically, good security is a fascist regime."

I thought about it for a moment, and said, "yeah, I guess it is."

Yesterday I mentioned this conversation to my boss. He laughed and said, "yeah, that makes perfect sense. In fact, any mechanical process that is a democracy is a failure."

Hope you all enjoy those thoughts as we head into the Memorial Day weekend. Me, I've got a few company servers to enforce martial law on.

Friday, May 8, 2009

Soundex

Today at work we were talking about spelling issues that have come up with phone reps, while trying to look up customer names in our database. For instance, it might sound like the customer is saying her name is Cassy, when in fact she spells it Cassie or Cassi. I used to know a guy who spelled his name Eron (instead of the more traditional Aaron).

How does one deal with this problem? Some of the solutions that were coming up were pretty scary-sounding, and started to drift into areas of serious security concerns. I finally spoke up and said something to the effect of, "if I could offer a suggestion, how do you all feel about looking up records by soundex?" I suddenly had three very interested faces looking in my direction.

Soundex is something that any serious genealogist is well familiar with, but for some reason it doesn't seem to be that common in the programming world. That's a real shame, because it's so useful. And fortunately for Perl and MySQL developers, tools already exist for you.

First, the basics:
  • Take a word, and write down the first letter of that word.

  • Drop all of the vowels remaining in the word.

  • Remove all duplicate letters (i.e. LL becomes L).

  • If "H" or "W" separate two letters with the same soundex code, the consonant to the right is ignored.

  • Convert the remaining consonants to numbers:

    • b, f, p, v => 1

    • c, g, j, k, q, s, x, z => 2

    • d, t => 3

    • l => 4

    • m, n => 5

    • r => 6

  • Save only the first three numbers. If you run out before you reach three digits, pad with zeros.

Using this code, the name "Joseph" would be encoded as "J100". "McAllister" would be "M242". See how easy that is?

MySQL has a couple of built-in functions that utilize soundex. The first, amazingly enough, is the "SOUNDEX()" function. This function doesn't give a standard soundex value; it actually encodes the whole word, giving you a minimum of 4 characters, but an arbitrary maximum. For instance:

mysql> select soundex('mcallister');
+-----------------------+
| soundex('mcallister') |
+-----------------------+
| M24236 |
+-----------------------+
1 row in set (0.00 sec)

If you want it to return a standard soundex with a maximum of four characters, you can use the "SUBSTRING()" function:

mysql> select substring(soundex('mcallister'),1,4);
+--------------------------------------+
| substring(soundex('mcallister'),1,4) |
+--------------------------------------+
| M242 |
+--------------------------------------+
1 row in set (0.00 sec)

MySQL also has a built-in function called "SOUNDS LIKE" that actually performs a SOUNDEX() function in the background:

mysql> select distinct first_name from customer where first_name sounds like 'corey' limit 10;
+------------+
| first_name |
+------------+
| Corey |
| cherie |
| Cory |
| Carrie |
| corri |
| cheri |
| cesar |
| CHERRY |
| Cierra |
| cora |
+------------+
10 rows in set (0.00 sec)

On one hand, we got a few names that most definitely weren't "corey". But on the other hand, the query was inherently case-insenstive, and offered a lot of wiggle room.

Perl also has a couple of Soundex modules available in CPAN, such as Text::Soundex. This module is also pretty easy to use:

use Text::Soundex;
print soundex("Ashcraft"), "\n"; # prints: A226
print soundex_nara("Ashcraft"), "\n"; # prints: A261

That second function, "soundex_nara()", is pretty important for doing US Census work, since the National Archives and Records Administration (NARA) uses a slightly different encoding scheme. Theirs is probably the version that most genealogists are going to be familiar with.

This is something that's definitely handy for looking up a lot of data, when the actual spelling is a little fuzzy. Maybe it will find its way into your database queries at some point now.

Tuesday, April 7, 2009

Mirepoix


One of the most important components of classical French cooking is mirepoix. A classic French mirepoix is composed of a 2:1:1 ratio of onions to carrots to celery, meaning that four cups of mirepoix would contain two cups of onions, one cup of carrots and one cup of celery. Some of you may also have heard of the cajun version of mirepoix, called trinity. The ratio is the same, but the carrots have been replaced with green bell peppers.

Mirepoix is used as the basis of a number of dishes, not only in French cooking, but in other cuisines. The ratios may vary a little, and the name may change (or not even exist at all), but the combination of onions, carrots and celery is classic. Recently some stores have even started selling both mirepoix and "cajun-style mirepoix" in the frozen foods aisles, which is convenient. But if you're willing to take the time to cut your own mirepoix and maybe even freeze it yourself, it will likely be cheaper, plus you can have a little better control over the quality.

I'm going to show you a few knife cuts here suitable for home use. You've probably seen all sorts of ways to cut these vegetables, and if you've been to cooking school, these methods are probably not what you were taught. They certainly weren't what I was taught, and if I were working for somebody like Thomas Keller, I wouldn't be using them either. But since I'm just cooking for me and my family, they will suffice.

Let's start with carrots. Go ahead and wash them, but don't bother to peel them. There's no reason to waste good carrot like that. With most carrots I see in grocery stores, you should be able to chop them in half, then cut the smaller half lengthwise into four pieces, and the larger half lengthwise into six pieces.

Go ahead and cut up a few carrots like this. When you have enough, there's a tip you can use to save yourself some time. Spread them out in a line across your cutting board, and start working your way across with your knife, dicing them up into pieces with as uniform a size as you can manage. Remember, accuracy is more important than speed, especially considering the sharp knife that I expect you to be working with.

Let's turn our attention to the celery. This is actually a little more difficult to cut, because it has kind of an awkward shape to it. The key is to bring it down to the same level as the carrots. First, grab a bunch of celery and cut the end off. Don't go crazy with it, you just want to be able to separate the stalks from each other. Don't be getting all wasteful on me.

When it's separated, go ahead and wash it in cold water. There were plenty of places for dirt to hide when it was together, and you need to get rid of it. With that out of the way, go ahead and lay a stalk down and slice off a piece of it length-wise.

With that piece cut away, go ahead and make the next cut. Be careful with these! It's easy to get carried away and go too fast. I've lost track of the number of times that I started to think I was a big-shot chef with ninja knife skills, only to end up slicing myself. Remember, accuracy before speed.

Now you have a bunch of long sticks of celery, ready to be diced just like the carrots. Lay 'em out the same way, and chop 'em up.

Last up, onions. These are actually very easy to cut, but they have their own dangers. You know what I'm talking about: the tears. I can give you a few tips, but when it comes down to it, you really just need to learn to suck it up. Take a step back if you start crying too hard, give it a break, then go back to it. First things first, you need to cut the stem end off.

Be careful not to cut too much of it off, because you actually need some of it to hold the onion together for a moment. Cut the flower end off too. Then go ahead and slice it in half, from end to end, so that you have two halves that are both held together at the stem.

At this point you can go ahead and peel away the papery part and throw it away. You might even want to put the cut sides face-down on the cutting board for a few minutes. Believe it or not, this seems to help dissipate some of the sting. When you're ready, slice the onion on the side, but not all the way to the stem. You still need that holding it all together.

Keep making slices like this at an angle, working your way around the onion. What you're going for are little fingers of onions held together by the stem. Another little tip here: try not to stand directly over the onions when you're cutting them. I think everybody does it, and it just puts you in the line of fire for onion fumes. Stand back a little and you will have fewer tears.

When you've worked your way around, it's time to actually dice the onion. Being careful not to cut your fingers, you want to slice across the cuts that you've already made. This is much easier, because that stem is still holding the onion together.

Keep going until you get almost to the stem. Feel free to cut as close to the stem as you want, but don't cut up the stem itself, I don't think you'd really like it.

Now that you have your vegetables cut up, you have a few options. If you bought way too many vegetables like I did when I was shooting these pictures, you'll probably want to freeze some of them for later use. You'll want some cookie sheets, or if you have a restaurant supply store nearby you can pick up "half-sheet pans", which are basically just commercial-grade cookie sheets.

I like to lay down a sheet of parchment on each sheet pan. You don't have to, but keep this in mind: the frozen veggies will stick to the pan itself a lot easier than to a sheet of parchment. Lay out the veggies on the pan, in as thin a layer as you can get it. If you have a lot of veggies like I did, you can put a cooling rack on top of the veggies, add another pan and repeat, but I wouldn't go more than three sheet pans high. The more you stack, the longer it will take to freeze, and you really do want these veggies to freeze as quickly as possible.

Move the sheet pans into the freezer and leave them there for at least two or three hours. Try not to open the door for the first couple of hours; it just slows down the freezing process. When they're nice and cold, you can move the veggies into a resealable plastic bin or bag, and then directly back into the freezer (once you've written the day's date on them, of course).

It's up to you whether you want to store them separately, or mix together the ratios yourself for freezer storage. Personally, I like to keep them separate. It offers me a little more freedom if I end up needing, say, a cup of carrot puree. I can't think of any reason offhand why I would need such a thing, but stranger things have happened.

I have another post written that makes excellent use of this mirepoix, but I have no photos to accompany it. Stay tuned, and as soon as I have photos I will post them.

Wednesday, April 1, 2009

Geek/Maker Calendar

I don't know if anybody else has noticed, but Make seems to be posting a lot of "Maker Birthdays" lately. I thought it might be fun to put together a calendar with as many days as possible filled with not only birthdays of makers, but also birthdays of other notable geeks, and various other noteworthy days for geeks. I know I'm stretching it on a few of these, but hopefully not too far.

My list so far is not comprehensive, but I'm running low on ideas. I thought I'd open it to my geekier readers, to see if we can fill the comments on this post with other geek days. I have Wikipedia links where available, and links elsewhere otherwise. I'm trying to remain as unbiased as possible, which is why you see certain names on the list that I'm not necessarily a fan of. Please try to be unbiased too. Here's what I have so far:

Jan 1864: George Washington Carver - http://en.wikipedia.org/wiki/George_Washington_Carver
Jan 1942: Brian Kernighan - http://en.wikipedia.org/wiki/Brian_Kernighan
Jan 1, 1894: Satyendra Nath Bose - http://en.wikipedia.org/wiki/Bose-Einstein_condensation
Jan 2, 1920: Isaac Asimov - http://en.wikipedia.org/wiki/Isaac_Asimov
Jan 3, 1892: J.R.R. Tolkien - http://en.wikipedia.org/wiki/J._R._R._Tolkien
Jan 4, 1643: Isaac Newton - http://en.wikipedia.org/wiki/Isaac_Newton
Jan 4, 1809: Louis Braille - http://en.wikipedia.org/wiki/Louis_Braille
Jan 5, 1940: FM Radio first demonstrated to the FCC - http://en.wikipedia.org/wiki/Jan_5
Jan 8, 1942: Stephen Hawking - http://en.wikipedia.org/wiki/Stephen_hawking
Jan 21, 1953: Paul Allen - http://en.wikipedia.org/wiki/Paul_Allen
Feb 4, 1943: Ken Thompson - http://en.wikipedia.org/wiki/Ken_Thompson
Feb 5, 1943: Nolan Bushnell - http://en.wikipedia.org/wiki/Nolan_Bushnell
Feb 8, 1828: Jules Verne - http://en.wikipedia.org/wiki/Jules_Verne
Feb 11, 1847: Thomas Edison - http://en.wikipedia.org/wiki/Thomas_edison
Feb 18, 1745: Alessandro Volta - http://en.wikipedia.org/wiki/Alessandro_Volta
Feb 24, 1955: Steve Jobs - http://en.wikipedia.org/wiki/Steve_jobs
Mar 3, 1847: Alexander Graham Bell - http://en.wikipedia.org/wiki/Alexander_Graham_Bell
Mar 11, 1952: Douglas Adams - http://en.wikipedia.org/wiki/Douglas_Adams
Mar 13, 1733: Joseph Priestley - http://en.wikipedia.org/wiki/Joseph_Priestley
Mar 14, 1879: Albert Einstein - http://en.wikipedia.org/wiki/Albert_Einstein
Mar 14 : Pi Day
Mar 16, 1953: Richard Stallman - http://en.wikipedia.org/wiki/Richard_Stallman
Mar 17, 1948: William Gibson - http://en.wikipedia.org/wiki/William_Gibson
Mar 24 : Ada Lovelace Day - http://blog.makezine.com/archive/2009/03/today_is_ada_lovelace_day_celebrati.html
Mar 31, 1811: Robert Bunsen - http://en.wikipedia.org/wiki/Robert_Bunsen
Apr 16, 1867: Wilbur Wright - http://en.wikipedia.org/wiki/Wright_brothers
May 11, 1918: Richard Feynman - http://en.wikipedia.org/wiki/Richard_Feynman
Jun 6, 1954: Tim O'Reilly - http://en.wikipedia.org/wiki/Tim_O%27Reilly
Jun 8, 1955: Tim Berners-Lee - http://en.wikipedia.org/wiki/Tim_Berners-Lee
Jun 19, 1623: Blaise Pascal - http://en.wikipedia.org/wiki/Blaise_Pascal
Jun 23, 1912: Alan Turing - http://en.wikipedia.org/wiki/Alan_turing
Jun 26, 1824: William Thomson, 1st Baron Kelvin - http://en.wikipedia.org/wiki/William_Thomson,_1st_Baron_Kelvin
Jul 10, 1856: Nikola Tesla - http://en.wikipedia.org/wiki/Nikola_Tesla
Jul 17, 1971: Cory Doctorow - http://en.wikipedia.org/wiki/Cory_Doctorow
Jul 20, 1969: Apollo 11 lands on the moon
Jul 30, 1863: Henry Ford - http://en.wikipedia.org/wiki/Henry_ford
Jul 30, 1962: Alton Brown - http://en.wikipedia.org/wiki/Alton_brown
Aug 8, 1901: Ernest Lawrence - http://en.wikipedia.org/wiki/E._O._Lawrence
Aug 11, 1950: Steve Wozniak - http://en.wikipedia.org/wiki/Steve_Wozniak
Aug 12, 1887: Erwin Schrodinger - http://en.wikipedia.org/wiki/Erwin_Schr%C3%B6dinger
Aug 19, 1871: Orville Wright - http://en.wikipedia.org/wiki/Wright_brothers
Aug 19, 1906: Philo Farnsworth - http://en.wikipedia.org/wiki/Philo_Farnsworth
Aug 20, 1970: John Carmack - http://en.wikipedia.org/wiki/John_Carmack
Sep 9, 1941: Dennis Ritchie - http://en.wikipedia.org/wiki/Dennis_Ritchie
Sep 24, 1954: Larry Wall - http://en.wikipedia.org/wiki/Larry_Wall
Oct 7, 1885: Niels Bohr - http://en.wikipedia.org/wiki/Niels_Bohr
Oct 17, 1984: Randall Munroe - http://en.wikipedia.org/wiki/Randall_Munroe
Oct 28, 1955: Bill Gates - http://en.wikipedia.org/wiki/Bill_gates
Oct 31, 1959: Neal Stephenson - http://en.wikipedia.org/wiki/Neal_Stephenson
Nov 7, 1867: Marie Curie - http://en.wikipedia.org/wiki/Marie_Curie
Nov 8, 1954: Bill Joy - http://en.wikipedia.org/wiki/Bill_Joy
Dec 9, 1906: Grace Hooper - http://en.wikipedia.org/wiki/Grace_Hopper
Dec 10, 1815: Ada Lovelace - http://en.wikipedia.org/wiki/Ada_lovelace
Dec 24, 1818: James Prescott Joule - http://en.wikipedia.org/wiki/James_Prescott_Joule
Dec 26, 1791: Charles Babbage - http://en.wikipedia.org/wiki/Charles_Babbage
Dec 26, 1937: John Conway - http://en.wikipedia.org/wiki/John_H._Conway
Dec 27, 1822: Louis Pasteur - http://en.wikipedia.org/wiki/Louis_Pasteur
Dec 28, 1969: Linus Torvalds - http://en.wikipedia.org/wiki/Linus_Torvalds
Dec 29, 1800: Charles Goodyear - http://en.wikipedia.org/wiki/Charles_Goodyear

I have a few other names that I've come up with that either I don't have birthdays for, or am not sure if they warrant being on the list.

E.G. Kingsford (Kingsford Charcoal)
Jul 22, 1968: Alan Cox - http://en.wikipedia.org/wiki/Alan_Cox
Damian Conway - http://en.wikipedia.org/wiki/Damian_Conway
Dave Bradley (CTRL-ALT-DEL) - http://en.wikipedia.org/wiki/David_Bradley_(engineer)
JD Frazer (User Friendly) - http://en.wikipedia.org/wiki/J.D._Frazer
Guido van Rossum - http://en.wikipedia.org/wiki/Guido_van_Rossum
Robert Morris - http://en.wikipedia.org/wiki/Robert_H._Morris_(cryptographer)

Anyone else want to submit some names?

Sunday, March 29, 2009

Three Cheesecakes

I did a little experimenting with cheesecakes recently. Now, when I say experimenting, I mean these probably aren't what you think of when you think of cheesecake. And you know, that's a real shame, because these really are delicious. But if you're feeling a little iffy about them, don't worry. If you remember my mini gnome cheesecakes, you'll know that you can make little tiny versions of the cheesecakes to sample, and if you like it then just quadruple the recipe and make a big cheesecake. That's right, these cheesecakes can be made with empty tuna cans. Let's take them one at a time, and I apologize in advance for the monotonous photos.

Cheddar Apple Cheesecake



This may seem a little strange to anyone that lives outside of New England, but cheddar and apple really do go well together. And while this is a sweet cheesecake, I didn't want it to be too sweet, so I went with a pretzel crust. The sugar is actually an attempt to make the crust hold together a little better. After a few tests both ways, I think it worked. As you can see in the photo, I added a little cinnamon on top of the cheesecakes, which I think really makes it.

Crust:

5 Tbsp pretzel crumbs
1 Tbsp sugar
1 1/2 Tbsp butter

Filling:

8 oz cream cheese, softened
1/4 cup sugar
1 large egg
3 Tbsp unsweetened applesauce
1/2 cup shredded cheddar

Garnish:

Ground cinnamon, as needed

* Preheat oven to 350F.
* Prepare 4 empty tuna cans, as per the mini Gnome cheesecake recipe.
* Melt the butter, and toss with pretzel crumbs and sugar. Divide evenly among the tuna cans, about 2 Tbsp per can.
* Press crusts into the bottom of the cans.
* Blind-bake the crusts at 350F for 10 minutes.
* Allow crusts to cool completely on counter, and drop the oven temperature to 275F.
* Cream together the cream cheese and sugar.
* Mix in the egg.
* Mix in the apple sauce and cheddar.
* Divide the cream cheese mixture among the tuna cans.
* Sprinkle cinnamon on top of the cheesecakes.
* Bake at 275F for 15 minutes.
* Turn off the oven and leave the door open for one minute.
* Close the door and allow the cheesecakes to cool for 45 minutes with the oven.
* Chill overnight before serving.


Bacon and Onion Cheesecake



I'm not going to lie here. Savory cheesecakes freak people out, just like you already started freaking out when you read the name of this cheesecake. I think that this kind of cheesecake is actually what the tuna can form factor is perfect for. Yes, they are kind of intense to eat on their own. No, you wouldn't ever serve it for dessert. Tell you what, instead of thinking of it as cheesecake, how about if you think about it as a dip? The only difference between this and a cheeseball is that this is flat, and tastes way better.

Crust:

5 Tbsp pretzel crumbs
1 Tbsp sugar
1 1/2 Tbsp butter

Filling:

4 strips bacon
1 cup diced onion
1/2 cup diced red bell pepper
1/2 tsp chopped garlic
dash Worcestershire sauce
8 oz cream cheese, softened
1/4 cup sour cream
1 large egg
2 Tbsp whole milk

* Preheat oven to 350F.
* Prepare 4 empty tuna cans, as per the mini Gnome cheesecake recipe.
* Melt the butter, and toss with pretzel crumbs and sugar. Divide evenly among the tuna cans, about 2 Tbsp per can.
* Press crusts into the bottom of the cans.
* Blind-bake the crusts at 350F for 10 minutes.
* Allow crusts to cool completely on counter, and drop the oven temperature to 275F.
* Fry the bacon till nice and crispy. Remove from the pan to cool, but save the drippings.
* Saute the onion and bell pepper in the bacon drippings until nice and browned. When the onion gets transluscent, add the garlic and Worcestershire sauce. Allow to cool completely.
* Cream together the cream cheese and sour cream.
* Mix in the egg.
* Mix in the milk.
* Crumble the bacon, and fold into the cream cheese mixture with the veggies.
* Divide the cream cheese mixture among the tuna cans.
* Bake at 275F for 15 minutes.
* Turn off the oven and leave the door open for one minute.
* Close the door and allow the cheesecakes to cool for 45 minutes with the oven.
* Chill overnight before serving.


Chinese Five-Spice Cheesecake



Okay, so maybe the savory cheesecake was a little weird. And this one probably seems weird too. Don't worry, this is probably the most normal of these cheesecakes. Depending on who makes it, Chinese Five-Spice tends to have ingredients like cinnamon, cloves, nutmeg, ginger, allspice, things like that. Kind of like a pumpkin pie. I even threw in a gingersnap crust, which is excellent. You'll like this one.

Crust:

5 Tbsp gingersnap crumbs
1 Tbsp sugar
1 1/2 Tbsp butter

Filling:

8 oz cream cheese, softened
1/4 cup sugar
1 large egg
1 tsp Chinese Five-Spice powder

* Preheat oven to 350F.
* Prepare 4 empty tuna cans, as per the mini Gnome cheesecake recipe.
* Melt the butter, and toss with gingersnap crumbs and sugar. Divide evenly among the tuna cans, about 2 Tbsp per can.
* Press crusts into the bottom of the cans.
* Blind-bake the crusts at 350F for 10 minutes.
* Allow crusts to cool completely on counter, and drop the oven temperature to 275F.
* Cream together the cream cheese and sugar.
* Mix in the egg.
* Mix in the spices.
* Divide the cream cheese mixture among the tuna cans.
* Bake at 275F for 15 minutes.
* Turn off the oven and leave the door open for one minute.
* Close the door and allow the cheesecakes to cool for 45 minutes with the oven.
* Chill overnight before serving.

Friday, February 27, 2009

Checking for open files

A coworker presented me with an interesting problem today. We have an SFTP server set up, where a client is uploading a series of files on a pretty regular basis. My coworker needed to process the files as soon as they were finished uploading, but he didn't know how to tell when it was finished. Since the SFTP server would be keeping the file open until it was finished writing it, all we needed to do was find out whether the file was still open.

In Bash, there's an easy way to check for this. When called without any arguments, the lsof program shows a list of all open files on the system. You can also call it with the full path of the filename that you are checking, and it will show only the processes that have that file open. For example, we can look at /dev/null, which seems to pretty much always be open on my system:

$ lsof /dev/null
COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
gconfd-2 6668 jhall 0u CHR 1,3 6663 /dev/null
gconfd-2 6668 jhall 1u CHR 1,3 6663 /dev/null
gconfd-2 6668 jhall 2u CHR 1,3 6663 /dev/null
...snip...

The lsof program also has an exit status of 0 if it returns any information, and an exit status of 1 if it did not. Since we're only interested in that error status and not in any of the information returned, we can throw it away by redirecting STDOUT and STDERR to /dev/null with &>:

$ lsof /dev/null &> /dev/null && echo "The file is open" || echo "The file is not open"
The file is open

Breaking this down a little further, if "lsof /dev/null &> /dev/null" was successful (returned an error status of 0), then it will run the first echo command. If not, that will make both the lsof command and the first echo command unsuccessful (error status of 1 for both) and the echo command after the pipes will run.

If it's a little confusing having "/dev/null" in that command twice, try running it on a file that's likely to not be open, like /proc/cpuinfo:

$ lsof /proc/cpuinfo &> /dev/null && echo "The file is open" || echo "The file is not open"
The file is not open

Just a handy little bit of Bash Fu to brighten your day.