computer geek gone chef and back again
 
 


graciously hosted by neverblock
http://www.neverblock.com/

blog.josephhall.com


Saturday, January 30, 2010

My Drive Array

A couple of years ago I got ahold of an old ATX computer that I intended to use as a file server. Unfortunately, there were a few problems with it. The biggest problem was that the drive cage for the smaller drives was missing. Smaller problems like an underpowered power supply and limited onboard IDE adapters were fixed with things like a new 600W power supply, and extra IDE expansion cards. As it turns out, Linux had no problem with two onboard adapters and two more cards (two adapters per card). With IDE's master/slave setup, that brought me up to two DVD burners (/dev/scd0 to /dev/scd1) and six hard drives (/dev/hda to /dev/hdf). But the drive cage, that was a problem.

Fortunately, like many American bakers and pastry chefs, I spent a lot of time at the hardware store. And believe it or not, the roofing section at Lowes carries a simple solution: roofing ties. Not TILES, but TIES (no "L"). Behold, the drive array, now connected to my Thinkpad (click to embiggen):



Yes, dear readers, the file server is dead. It seems to have developed memory issues in its old age, leading to its untimely demise. Not Alzheimers, but some form of dementia. A close-up on the array itself:



Sadly, my Thinkpad does not have an external IDE adapter of any kind. But USB to IDE adapters are relatively cheap and easy to find. I can't access every drive at once, but that's not a big deal at the moment.

Lowes has several different sizes of roofing ties, and several different styles. I used two different sizes, both completely flat, but with rows of holes exactly the same width as a standard 3.5" internal drive. One is five holes high and one is three holes high.



If you're going to do this, you'll be buying them in sets of two each. And while you may be tempted to stack three drives in one 3-high roofing tie set, fight the urge! You need airflow between the drives, or they will overheat. I speak from experience. Limit yourself to three drives for the 5-high ties, and only use the 3-high ties for connecting sets of 5-high ties. Look back at photo #2 to see what I mean.

Speaking of heat issues, it's not a bad idea to point a fan at these if you're going to have them all on at once. It's not a big deal with one or two USB-connected drives, but with all six drives that I have in my array, I always had a fan going.


Thursday, January 28, 2010

Importing the USDA SR22 into MySQL

Some of you who were interested in my post on importing SR21 may have been waiting for this one. I know it's been a few months since SR22 came out, but I didn't have a need to import it until just now. There are changes to this new version, but they are minimal, and you may have already patched the code yourself.

Specifically, two new fields were added to the ABBREVS table: Vit_D_mcg and Vit_D_IU. This brings the total column count in that table from 51 to 53. That number is the only change in the Perl file, and those two columns were the only additions to the SQL file. With those in place, I was able to import the new database without a problem. For the lazy and/or efficient, here are the new versions of the files:

import_sr22.pl
sr22.sql

Based on the reponse to my last post, I expect more troubleshooting questions on this post. For those who know what you're doing, you can stop reading now. Everyone else, check here before asking.

  • You need to have at least Perl 5.8.6 installed.

  • You need to have the Perl DBI installed, and DBD::mysql.

    • In RHEL/CentOS/Fedora, these packages should be called perl-DBI and perl-DBD-MySQL.

    • In Ubuntu/Debian, these packages should be called libdbi-perl and libdbd-mysql-perl.

  • When you download the files, make sure you save the Perl script as import_sr22.pl, not import_sr22.txt.

  • This script assumes you've downloaded the abbreviated file. It is a separate download from the full version, so make sure you don't miss it.


I think that covers all the questions I was asked previously. For those who are interested, The Eloquent Geek posted a non-Perl way of doing this on the last post. I haven't tried it myself, but for your reference:

For those who do not want to use the perl here is how you import the data from the command line client:
load data infile '/file_path/TABLE_NAME.txt' into table TABLE_NAME fields terminated by '^' optionally enclosed by '~' ;

Just substitute the table name per table.


Wednesday, January 27, 2010

iPad

Well, Apple's new tablet was finally announced today. Aside from a slew of jokes concerning the name, it would seem that the majority of the reviews can be summed up in one word:

"Seriously?"

Not all reviews were negative, of course. One that I read can be summed up in a few more words: "Look! It's a giant iPhone! Isn't that so cool?" Let me put this into perspective. A cute little baby, at the size that you would expect a cute little baby to be, is cute. The same baby, but the size of a house, is no longer cute. It is scary.

I'm not going to bother linking to any reviews of Apple's attempt to make Google look good in comparison, just like I'm not going to bother buying one when it comes out. That's all on you.

Okay, tell you what. Let me Google that for you.


Tuesday, January 26, 2010

Ice Cream Nomenclature

Rather than responding in the comments area to Hollie's comment on Ice Cream Machine, I thought I would just make a new post. Her question was, "isn't that a sorbet?" No, Hollie, that wasn't a sorbet or even a sherbet. There are a few terms tossed around for frozen, churned desserts, and there are differences. Some of it has to do with dairy content, but not all.

Sorbet: This dessert generally contains fruit puree or juice, but can contain other things, such as coffee or chocolate. The important thing here is that there is no dairy content. So Hollie, with all the half and half in my recipe, it's definitely not sorbet.

Sherbet/Sherbert: You'd think my recipe would fall under this category, because sherbet can have dairy in it. But as it turns out, sherbet only contains a small amount of dairy, < 3%. The terms sherbet and sorbet are often used interchangeably, and I guess I'm not going to stop that with my little post. But as far as I'm concerned, they are different.

Ice Cream: Once you get above 3% dairy, your dessert becomes "ice cream". This is a pretty generic term that gets tossed around, and is applied to everything from sorbet to gelato. You can have large amounts of fruit puree like I had, or you can just keep it as simple as frozen, churned, sweetened milk or cream. I have a friend that is a big fan of unflavored ice cream: not even vanilla gets in the way of the taste of milk. One day I will have to try it.

Frozen Custard/Premium Ice Cream: Once you add egg to the mix, ice cream technically becomes a frozen custard. But most people still just call it ice cream. I have yet to see a premium ice cream that is not actually a frozen custard, but I'm sure one exists somewhere. From a technical standpoint, there is a definite advantage to using egg, which will help the ice cream set up a little more easily in the churn. It also adds a nice creaminess.

Frozen Yogurt: There's not really a whole lot of difference between ice cream and frozen yogurt, other than the former using cream (or at least half and half) and the latter using yogurt. Because of the yogurt, it's often a little more tart, and generally lower in fat.

Granita: This Italian dessert is kind of like sorbet, but with much larger ice crystals. This is due to the preparation, which is more of a shaved ice technique than a churning technique. The method that I see most often involves pouring flavorful liquid (usually coffee, but sometimes fruit juice) into a cookie sheet and putting it in the freezer, scraping with a fork every couple of hours or so.

Gelato: This is an Italian variety of ice cream who's name I have often seen mis-used and abused in America, so let's set the record straight. One big difference is the low dairy content: almost as low as sherbet. I have seen some gelatos with no diary at all. Gelato also has a higher sugar content than ice cream, and usually involves egg. I have also heard Italians mention some sort of mysterious stabilizer, which I have experimented with before. It's still unclear to me what it is, and if it's actually a requirement. Gelato is churned like ice cream, but has much less air incorporated into it, and is meant to be served fresh, the same day that it is made. While not necessary, gelato generally has a pretty high fruit content.

I have often heard the terms "gelato" and "spumoni" used interchangeably. Let me be clear on this: spumoni is a type of gelato. Not all gelato is spumoni. Spumoni is a layers ice cream, kind of like Neapolitan ice cream in America, but containing things like fruits and nuts.

Kulfi: My favorite dessert from India, this concoction differs from ice cream largely in that it is not churned. It generally contains flavors indigenous to India, like cardamom or pistachios. Americans be warned: it would seem that India loves their desserts sweet, as is evidenced in pretty much every kulfi I have ever eaten. It's not too sweet for me, but it's close.

I hope that clears things up a little bit for some of you. Obviously I haven't hit every type of frozen dessert, but there are a few important ones.


Tuesday, January 19, 2010

I Want Proof

There is a fad that's been circulating around the Internets for years now, and I'm sure is even older than that: the idea of so-called "negative calorie foods". The basic premise is that some foods require more calories to digest than they actually provide. For instance, a food that provides 5 calories, but requires 10 calories worth of energy for your body to process it, is considered to have negative calories.

It's an interesting concept, and it would be awesome if it were true. Unfortunately, I have been unable to find any concrete proof either way. We know how to determine a food's caloric content, but I wonder if we know how to determine how much energy it takes to process it? In trying to find answers online, I found several people who claimed to be knowledgeable, but who were obvious idiots, and/or didn't bother checking their facts. For instance, on this page, I found this comment:

"Celery has almost zero calories, it's so minuscule we round down to 0."

I've never heard of anyone making this claim. If we consult the USDA Standard Reference, we discover that an 8-inch stalk of celery contains about 6 calories. This is not a miniscule amount (unless compared to a Big Mac), and I certainly wouldn't round it down to 0.

I found several other references to celery containing anywhere from 5 to 20 calories per serving (though the serving size was never stated), and guesses that eating a single serving would burn anywhere from 5 to 20 calories. Even Snopes, which I lose more and more faith in every time I read anything there, claims the "negative calorie" concept is true, but offers absolutely no evidence or proof.

Can anyone tell me definitively how many calories are burned by eating a single serving (say, 40g, the approximate weight of an 8-inch stalk) of celery? I want a number, and I want to know how that number was obtained.

My next complaint involves cooking alcohol out of food. There are plenty of people that will tell you, "don't worry, the alcohol burns out". In my experience, these are people that either think you're silly for caring, or are reassuring themselves because they want it to be true. Other people will tell you that you can never burn it all out. The most outspoken of these that I've heard is Alton Brown, followed by his good buddy Ted Allen.

Both Alton and Ted have discussed this on their shows, Good Eats and Food Detectives, respectively. Food Detectives is kind of a culinary Myth Busters, but is far more scripted. They frequently perform experiments to prove or disprove myths, but in the case of the alcohol, they did a food demo that proved nothing, and then stated their "fact" as gospel.

Alton Brown has stated repeatedly that alcohol never cooks out completely, but has never offered proof. Some years ago I did some research and found a report on the USDA's website that seemed to imply that after 2 1/2 hours of oven roasting, the level of alcohol left in foods is 0% (which I'm guessing is actually < 0.5%). Unfortunately, in more recent visits, this report seems to have been removed. I have been unable to find it for years.

So, it begs the question: does alcohol really cook out, or not? Does anyone have any proof? Or can anyone at least point me to a report or study somewhere that even suggests something either way?

I'm not convinced on the negative calorie thing, or the alcohol thing. And I'm sick of people making claims with nothing to back them up. I want proof.


Saturday, January 16, 2010

No More Fast Food

You may have heard that McDonalds is now providing free wireless Internet access at their restaurants. For those of you who eat at McDonalds, this is great news! For myself, I haven't eaten McDonalds in several years. And recently, I decided to abandon fast food in general.

Not eating at McDonalds was an easy choice, back when I made it. I still remember my first Big Mac. I was 12 years old, and my mom gave me $5 and told me I could eat lunch whereever was within walking distance of where we were. Finally, my big chance! I could finally try that Big Mac that I'd seen so many commercials about. Sadly, it did not live up to the hype. It was "okay", but nothing special. Since then, I had never eaten at McDonalds and thought afterwards, "wow, I'm glad I ate there!" So now I don't eat there anymore.

Since then, I've run into disappointment at every fast food establishment I've ever been to. Carl's Jr has one (just one) item on their menu that I like (the Western Bacon), and I always feel like crap after eating it. Wendy's also only has only one menu item I can stand (spicy chicken sandwich), and it's not worth the sheer incompetence that they tend to hire to sell it to me. Even Subway is on my black list, with their selection of styrofoam-inspired breads.

The problems with individual restaurants are just the tip of the iceberg. Fast food is famous for its unhealthiness. Granted, most restaurants now offer healthy options, but I have a hard time paying even a dollar (sometimes two or three) for a bag of apple slices, when I could just plan ahead and bring a $0.33 apple from the grocery store with me instead.

Fast food menus are not designed for healthy eating. What's interesting to me is how many aspects of this were pioneered by McDonalds. When Ray Kroc first found McDonalds, he was surprised and impressed at the manufacturing-line techniques that were used to churn out fast, cheap burgers. Decades later, McDonalds not only began selling value meals, but actually assigned numbers to them, for convenience. And let's not forget the famed "Supersize" option which everyone copied again. While they don't ask anymore if you'd like to supersize, I'm told you can still ask for it. The most classic example is a Big Mac with large fries and a large Coke. Tasty, no? Not for me. And just between you and me, I've never been a fan of McDonald's fries either.

I think my biggest problem with fast food has been using it as a crutch. When I don't bring lunch with me to work, fast food is there to keep me from being hungry. When I forget breakfast in the morning, there are plenty of places I can stop by on the way to work. And when I'm feeling just a little too tired to make my family a delicious and healthy meal, I can always pick up a bag-o-burgers on the way home.

Why do I find myself in these situations? I think that it's been a misguided set of priorities, coupled with poor planning. I could get up early and spend a few extra minutes making pancakes to show a little love to my family, or I could stop by McLazy's on the way into work and leave my family to fend for themselves. I could make a little extra for dinner one night so that I can have leftovers to bring into work the next day, or I could buy a bucket of chicken so as not to lose precious TV time.

I'm not saying that all restaurants are bad, of course. I'm still okay with casual dining restaurants. I will still go to diners. Fine dining, when it can be afforded, is a fine thing indeed. Even delis are okay with me, in moderation. If I could afford it, I would love to take my family out to eat once every week or two. Eating out is a treat, and a way to experience new foods and keep your palate from getting board. But when any treat becomes habit, it starts to lose meaning and spoil us. I'm not okay with that.

Note: I've already been asked this once or twice, so I'd better say it here. As far as I'm concerned, carry-out or delivery pizza is also fast food. I love Pizza Hut, but I don't love the expense, or the idea of using it as a crutch. I can make my own pizza at home, which may take more time and planning, but which will taste 10 times better, and cost less than a half as much.


Sunday, January 03, 2010

Ice Cream Machines

I got an ice cream freezer for Christmas. It represents the latest in a growing line of equipment that I've had the opportunity to make ice cream with, each progressively better.

You see, I started with a frozen core model. This includes a container which has a special solution built into it, which must be frozen for 24 hours before use, and an electric motor. This model was barely serviceable, because it never got cold enough to effectively freeze the ice cream, and it was only good for a 30-minute session. It held somewhere around a quart.

My next model was, aside from the fact that it also had an electric motor, a little more old fashioned. You actually had to add alternating layers of ice and salt, which was surprisingly more effective than the frozen core model. I could go for as long as 40 minutes before the ice got melty enough to raise in temperature again. It could also make somewhere around 3 quarts pretty effectively. The most major drawback was the freezer full of ice that you needed to keep around. The second most major drawback was disposing of the salt water. The third biggest was the water that would condensate on the side, and then melt into a puddle around the churn.

The first model was a joke. I would never recommend a frozen core to anyone. The second model was about the same price, and while it did have its drawbacks, it at least worked. I figured it would be the model I would use until I got rich and could afford a model with a built-in freezer.

Well, that model is what I got for Christmas. It technically holds two quarts, but I have yet to get more than a quart and a half out of it. But that's not the fault of the machine itself. The motor will run until it can't run no more, and then it will stop on its own. Since the built-in freezer won't shut off with the motor, you could probably just add ice cream mixture, turn it on and go shopping, and come back home to ice cream fully ready for consumption.

This brings up an important point. The first two models make soft-serve ice cream, which must be quickly moved into containers, and into the freezer, before it is ready to be served. While you can do that with this model, my first batch was actually hard-frozen. I wasn't used to the machine yet, and I ended up letting the motor run until the ice cream was hard.

This brings up something else important. I have discovered that, with all of my practice batches so far, I need a minimum of 45 minutes to get a good churn (and sometimes longer), something that my old freezers fell short of. I have also discovered that I no longer need to use egg yolk to get a decent freeze. Before, I always used egg-based recipes, because frozen custard is easier to churn. With one exception, I have yet to use anything egg-based in this freezer.

The one exception is eggnog. It's a little late now to do this, but it's something to keep in mind for next year. Commercial eggnog is little more than spiced, unfrozen ice cream. My favorite brand for the past few years has been Southern Comfort's Vanilla Spice Eggnog. They also have a "regular" Southern Comfort Eggnog. Both are alcohol-free (you're supposed to add the Southern Comfort yourself), and I've frozen several batches of the Vanilla Spice version, both for ourselves and for family and friends. For those of you that don't like eggnog, well, I'm guessing you don't like drinking melted ice cream either. And that's fine. It's okay to be wrong sometimes.

I will give you a recipe that I've been playing with. It's not perfect yet, but it's still pretty good. And it's totally egg-free:

Strawberry Ice Cream (beta version)

1 pint half and half
1 pound frozen strawberries
1/2 cup sugar
1 pinch salt

Combine all ingredients in a sauce pan and bring to a low simmer, just long enough to dissolve the sugar and thaw the strawberries. Use an immersion blender to puree the strawberries and homogenize the mixture. Cool and refrigerate overnight before freezing, as per your ice cream freezer's instructions. Makes a little over a quart.


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.