Blog

  • Learning Ruby… going about learning a new programming language


    I teach computer science at a small state college to pay the bills. One course that I regularly teach is “Objected-Oriented Programming and Design”. Our program is very C++ focused and this course is the class where we pound the more advanced aspects of C++ into our students and try to give them a flavor of other ways of doing OOP by introducing them to other object-oriented languages.

    So… what other languages? In the past, I’ve taught the course by talking advanced C++, hitting Java pretty heavy, and doing a quick overview of Smalltalk to show students the “pure object” way of thinking. Teaching Smalltalk has been problematic… that language is so different from anything most of my students have seen that they go into vapor lock. Most of these folks are community college graduates looking to complete their four-year degrees (more on that in a future post) and haven’t had the deep dive background that you get in other programs. This has meant that I’ve had to go looking for a language that I can use to demonstrate the “pure object” idea without causing heads to go spinning out in the classroom.

    That leads us to Ruby. I like the way that Dave Thomas described the language in one of his books:

    Take a true object-oriented language, such as Smalltalk. Drop the unfamiliar syntax and move to more conventional, file-based source code. Now add in a good measure of the flexibility and convenience of languages such as Python and Perl.

    So it appears that it will meet the needs of my course. However, it’s not a language that I’ve ever used for production development. I like to develop some ninja-level skills with a language before I have to try to teach it to other people.

    So, oh Noble Readers, I intend to subject you to a series of posts that describe my experiences on learning Ruby. These posts will be the basis of my lecture materials for my class and will hopefully give you a feel about how someone like myself who has had the “fortune” of having learn many different programming language over time learns a new one.

    Selah.

  • Tofu? You eat that stuff?

    A few friends of mine have been talking about ways to cook tofu. Being the “over-educated hillbilly” that I am, that compressed soy curd called tofu isn’t something that you would expect to see in my pantry. However, having worked for a number of years with folks from Japan and China + a few years of graduate school with people who regularly eat this stuff, I’ve tried fixing it a few different ways.

    One recipe that I really like is a variation of one found in Mark Bittman’s How to Cook Everything cookbook called “Braised Tofu with Eggplant and Shitakes”:

    Braised Tofu with Eggplant and Shiitake Mushrooms

    From Mark Bittman’s How to Cook Everything

    1 lb tofu
    1/4 cup peanut oil or corn oil
    1 c. shiitake mushrooms (soaked and drained)
    Salt & pepper, to taste
    1 TB garlic, minced
    1 TB ginger, minced
    1.5 lbs eggplant
    1 TB siracha chille sauce
    0.5 c. water
    2 TB soy sauce
    1 TB sesame oil
    1 TB toasted sesame seeds
    2 TB chopped green onions
    
    • Drain tofu and cut in half lengthwise. Place in-between four sheets of paper towels and then weight down the tofu (no more than 2 lbs weight). Let set for a minimum of 30 minutes but as long as possible.
    • Trim eggplant, cut into cubes and place in colander or strainers. Sprinkle liberally with salt and let eggplant drain for 30 minutes. Rinse and then pat dry.
    • Saute shiitakes w/ half of oil in deep skillet or wok w/ salt and peper until mushrooms are crisp (about 5 to 10 minutes). Remove to plate.
    • Add remaining oil and then sauté garlic and ginger for about a minute. Then add eggplant and sauté for until it browns. Add chile sauce and water and cook until eggplant is tender; add more water if needed.
    • Add tofu and soy sauce. Cook until tofu is heated. Add reserved mushrooms and turn off heat. Add sesame oil. Garish w/ sesame seeds and chopped green onions

    What’s nice about this recipe is that you can adjust it quite easily if you have meat eaters in the house by replacing the mushrooms with chicken or shrimp (or in addition to the shiitakes). Another variation is to replace both the eggplant and mushrooms with ground pork. Good, quick, and easy way to do something far better than any Chinese takeout you get buy.

  • Building a minimal Linux desktop

    Got some old computers around the house? I have that problem. For many moons people have been telling me to not toss those old computers, just install Linux on them. Well, that used to be good advice… But the popular Linux distributions like Ubuntu, Fedora, and OpenSuSE have evolved to keep up with current hardware. This is a really true when it comes to window managers like GNOME and KDE. The most recent versions of those packages overwhelm older machines.

    So, what can you do? There are lightweight distributions like Puppy Linux and Damn Small Linux that are designed to work on less powerful machines. However, I have found these distributions to be either too limited, too buggy, or both. Some people suggest to just fall back onto using older versions of common distributions. That’s not a good solution for me given what I do for a living. So, I have to find a way to thin down the current version of one of the popular distributions.

    The first question is which distribution? Almost every distribution supports minimal installs so what I suggest is to go as far upstream as possible. So that means work with Debian, Slackware, or RHEL/CENTOS. For today’s discussion, let’s use Debian. Go to the Debian web page and download the minimal net-install ISO from www.debian.org (or one of its mirrors).

    Go through the standard steps of a net-install up to the point where the installer runs APT to get stuff from one of the mirrors. At this point, de-select the entry for the “Desktop Environment” packages. Complete the install and reboot.

    You have the first useful minimal configuration: a base system that boots to a command-line prompt. If you’re building a server, you can stop here and start loading server things (which is a topic for another post).

    As we’re building a minimal desktop machine, log-on as root and let’s do some magic with apt-get:

    • Install the X.org xserver by issuing an “apt-get install xserver-xorg-core xorg”
    • You have two options here. You can install a full desktop environment like GNOME or KDE but why didn’t you use the standard install if that’s what you wanted? Rather install one of the lightweight desktop environments like LXDE: “apt-get install lxde”. This will install a base set of packages and themes as well.
    • The other option is to go light and just install a window manager plus application packages. This is best for really old machines or if you want to get the best performance with the least overhead.

      • Install a login manager. I prefer xdm for this purpose: “apt-get install xdm”
      • You will need a window manager. The most popular of the lightweight WMs is either Fluxbox, Openbox, FWM, or JWM. If you prefer something that feels like Windows, then go with JWM: “apt-get install jwm”
      • I’d suggest installing a web browser: “apt-get install iceweasel” will do the trick if you’re using Debian Lenny

    Now reboot and you should have a nice, clean, minimal Linux install with X/Windows. Use the package manager to download other stuff you may need or want.

  • A New Year and A Familiar Subject

    New Year’s Day. The start of a new year… And for those of us in higher-education, the start of a new term. Like most people who teach, the first few weeks of January involve the frantic rush of getting ready to teach the Spring courses. If you’re lucky, they are courses that you have the material all configured and ready to dump back onto your employer’s learning management system. But it’s not that way for me right now as I find myself getting ready to teach Software Engineering again after some time away from the subject. So, the gap between Christmas and the start of classes is filled with reviewing the course texts, editing slide decks, and updating syllabi.

    The past few days have been reading days. And I found an interesting article in the Janurary 2014 edition of the Communications of the ACM discussing estimation in agile processes <link>. Software developers who become vocal agile proponents tend to look askance at estimation; thinking that estimation of a software project has some connection to complete definition of the requirements for a project. What is missed in this case is that you have introduced a disconnect between business and development aspects of a project.

    Agile planning focuses on workflow: how to decide what to do over the next few increments of time and how to generate the most value in that time. In the CACM article, the author points out that is very different from the business requirement for estimation: generate the information required to determine what resources are required for a project. This is key, as most software projects are capitalized projects and some sort of connection between budgetary cycles and development plans are required.

    This is an important point that is missed in instruction in agile development. Textbook discussions of agile planning focus on the workflow aspects and tend not to emphasize the connection to budgetary cycles and estimation. It’s an important point to remember when introducing novice practitioners to use of these techniques.

    Selah.

  • Slow Cooker Chipotle Molasses Pork Ribs

    The weather’s turned cold… time to break out the crock pot. Here’s something I clipped out of a newspaper article a few years ago. Good stuff for this time of the year.
    2 lbs. country-style pork ribs 
    2 T. creole seasoning (I'm partial to Slap Yo' Mama) 
    1 T. veg. oil 
    
    Chipotle Molassses BBQ Sauce
    1.5 c. ketchup 
    1 can chipotle peppers in adobo sauce 
    0.25 c. apple cider vinegar 
    0.5 c. cajun-style garlic hot sauce (Cajun Power brand is what I use) 
    0.5 c. cane syrup (or light molasses if you're not in South Louisiana) 
    1 T. worcestershire sauce 
    1 T. soy sauce 
    1 medium onion, chopped 
    0.5 green pepper, chopped 
    2. T. green parsley 
    1 clove garlic 
    0.5 t. liquid smoke 
    1 t. salt 
    1 t. black pepper 
    1 t. creole seasoning 
    1 t. cayenne pepper 
    

    Instructions

    • Prep your slow cooker. Dry the ribs with paper towels and season ribs with the creole seasoning. Sear the ribs in a large skillet using the oil.
    • In the meantime, combine the ingredients for the BBQ sauce in your blender and process until smooth (adjust the amount of peppers, creole seasoning, and cayenne pepper if you want less spice). Using a fine-mesh strainer, strain the sauce into your slow cooker, discarding the pepper seeds and any other solids that don’t go through the strainer.
    • Add the ribs into the cooker and let them cook for 4 to 6 hours on the cooker’s high setting, 6 to 8 hours on the low setting. About 30-45 minutes before completion, use a spoon or ladle to remove any fat that has risen to the surface of the sauce.
  • Holiday party? Hate eggnog? Try this…

    Holiday season. Christmas, to be exact. The time of the year that people go down the street to the local grocery and buy that stuff called “eggnog”. That’s a strange thing; fostered upon us by the Scots in much the same vein as they did with haggis. I can see some grizzled Highlander sitting in the cold of his castle by the Loch saying “Hah.. we’ll show those cursed pantywaists… we’ll mix some raw eggs and some clotted cream with their whisky and make ’em drink it. That’ll be the laugh!”.

    Full disclosure: I do have a bunch of Scots in my ancestry. And you can tell that I’m not an eggnog fan. There’s just something about the idea of drinking raw eggs that doesn’t work for me. Going that route, go ahead and make a custard and be done with it. However, I don’t mind a simple milk punch like this one. Just remember: the nutmeg has to be freshly grated, and by gad ye’ laddies, the spice goes on top!

    1 ½ ounces good bourbon or brandy
    2 ounces half-and-half
    1 teaspoon superfine sugar
    Drop of vanilla extract
    Ice cubes
    Freshly grated numeg
    

    Combine the bourbon, half-and-half, sugar, and vanilla in a cocktail shaker with ice. Shake thoroughly until the mixture is cold and frothy. Strain into a highball glass filled with ice. Top with a grating of nutmeg.

    Serves 1, adjust as needed

  • My favorite bread pudding recipe…

    I had forwarded a post up on Facebook about the 12 Best Bread Puddings in New Orleans and got some recipe requests. Here’s the one I use, lifted many moons ago from one of bourbon websites. Enjoy!

    INGREDIENTS

    Bourbon Sauce:
    
    	* 1/2 cup (1 stick) butter, melted
    	* 1 cup sugar
    	* 1 egg
    	* 1 cup Kentucky bourbon whiskey
    
    Bread Pudding:
    
    	* 1 loaf French bread, at least a day old, cut into 1-inch squares (about 6-7 cups)
    	* 1 qt milk
    	* 3 eggs, lightly beaten
    	* 2 cups sugar
    	* 2 Tbsp vanilla
    	* 1 cup raisins (soaked overnight in 1/4 cup bourbon)
    	* 1/4 teaspoon allspice
    	* 1/4 to 1/2 teaspoon cinnamon
    	* 3 Tbsp unsalted butter, melted

    Bourbon Sauce:

    In a saucepan, melt butter; add sugar and egg, whisking to blend well. Cook over low heat, stirring constantly, until mixture thickens. (Do not allow to simmer, or it may curdle.) Whisk in bourbon to taste. Remove from heat. Whisk before serving. The sauce should be soft, creamy, and smooth.

    Bread Pudding:

    • Preheat oven to 350°F.
    • Soak the bread in milk in a large mixing bowl. Press with hands until well mixed and all the milk is absorbed. In a separate bowl, beat eggs, sugar, vanilla, and spices together. Gently stir into the bread mixture. Gently stir the raisins into the mixture.
    • Pour butter into the bottom of a 9×13 inch baking pan. Coat the bottom and the sides of the pan well with the butter. Pour in the bread mix and bake at 350°F for 35-45 minutes, until set. The pudding is done when the edges start getting a bit brown and pull away from the edge of the pan. Can also make in individual ramekins.
    • Serve with bourbon whiskey sauce on the side; pour on to taste. Best fresh and eaten the day it is made. Makes 8-10 servings.
  • 25 Random Things About Me

    There was a meme going around Facebook a while back where you were asked to write “25 Random Things About Yourself, Then Tag Someone Else to Do It”. This was one of the posts that got lost in the transaction from my old web host to the new host. So, I thought I might copy this over for the sheer joy of your reading pleasure. So, here’s 25 random things about me (most of which I suspect people might not have wanted to know)

    1. I have stood on the walls of the Old City of Jerusalem and watched the Sun rise over the Mount of Olives.
    2. I’ve been programming computers for almost 30 years.
    3. I wonder why it took me 15 years to realize that I would be much happier if I finished my Ph.D.
    4. I am allergic to coffee and marijuana.
    5. My mother is amazed by the fact that I like to work in my yard and to garden given how little effort I put into helping in the yard and garden when I was little.
    6. Only one baby picture of me survived the fire that destroyed my parent’s mobile home when I was five years old.
    7. I hate vacuum cleaners as result of my brother always making me vacuum the house when he babysat my sister and I when we were growing up. This explains why I get along so well with the Dust Bunnies in my home.
    8. I am terribly afraid of bees, hornets, and wasps due to an emotionally scarring experience at a family picnic when I was 4 years old.
    9. However, it was that same picnic where I first learned to fear bees that resulted in my fascination to this day with trains.
    10. I was a complete and total emotional train wreck during most of my undergraduate years at Sewanee.
    11. Of all the courses I took at Sewanee, I have found that the acting classes have best prepared me best to work in academia due to fact that I treat every lecture as a performance.
    12. I suspect that I’m like every other graduate of Sewanee who’s is working on or has completed their Ph.D.: I wonder if I could ever join the faculty?
    13. As much as I love to read science fiction novels, I really cannot stand most of the science fiction on television and in the movies.
    14. People always seem to underestimate the comic genius of The Three Stooges.
    15. I spent New Years Eve of the Millennium Year 2000 in a trauma center in my hometown awaiting gall bladder surgery. You see the most fascinating things in a trauma center on the New Years Eve of the Millennium.
    16. I have spent extended periods of time in London, Tel Aviv, Jerusalem, and Mexico City.
    17. I have been to every state except for New Hampshire and Vermont. I intend on rectifying this deficiency once I complete my Ph.D.
    18. I have a great fear of heights.
    19. Someday I hope to be invited to lunch with Nero Wolfe and see the orchids in the greenhouse on the roof of his brownstone.
    20. Someday I hope to be able to play Shakespeare’s merry rogue, Falstaff.
    21. It is difficult to write, it is damned difficult to write well.
    22. Guilty admission time: I really like The Benny Hill Show.
    23. I will continue to practice until I can consistently make a good pan of biscuits.
    24. Someday travel plans: go back to the Holy Land, visit the Isle of Lewis in Scotland, again drink a pint in a country pub in England, ride the train over the Andes in Chile, drink wine in the wineries of South Australia, and see the Taj Mahal.
    25. I have been greatly blessed by all of those whom I’ve had the great fortune to have met over the years, hope to be able to meet the rest of you, and wish you all “Bon Chance” and “Auf wiedersehen” wherever you may go and whatever you may do.
  • How to tide yourself over until someone restarts the Hostess brand

    Well, the maker of Hostess Cupcakes (and other pre-packaged snack cakes that might survive a nuclear attack) has gone to Chapter 7 bankruptcy and is closing down. While it’s pretty clear that someone will buy their brands, it may be a while before you can get the Hostess Twinkie fix.

    The people at America’s Test Kitchen published a recipe for a version of the classic Hostess Cupcake that I’ve used a couple of times. While it may not have the ability to be used as survival food, it’s pretty darn good.

    This is based on the ATK original, tweaked to address some food allergies that I suffer from… There’s a rather neat trick here for filling the cupcake by cutting out a conic section, slicing off half, and then replacing and frosting over the top.

    CUPCAKES
    1 cup all-purpose flour
    0.5 teaspoon baking soda
    0.25 teaspoon salt
    0.5 cup boiling water
    0.3 cup cocoa powder
    0.3 cup semisweet chocolate chips
    0.75 cup sugar
    0.5 cup sour cream
    0.5 cup vegetable oil
    2 large eggs
    1 teaspoon vanilla extract
    
    FILLING
    3 tablespoons water
    0.75 teaspoon unflavored gelatin
    4 tablespoons (0.5 stick) unsalted butter, softened
    1 teaspoon vanilla extract
    Pinch salt
    1.25 cups marshmallow creme
    
    GLAZE
    0.5 cup semisweet chocolate chips
    3 tablespoons unsalted butter
    
    • MAKE BATTER: Adjust oven rack to middle position and heat oven to 325 degrees. Grease and flour 12-cup muffin tin. Combine flour, baking soda, and salt in bowl. Whisk water, cocoa, chocolate chips, and espresso in large bowl until smooth. Add sugar, sour cream, oil, eggs, and vanilla and mix until combined. Whisk in flour mixture until incorporated. Divide batter evenly among muffin cups. Bake until toothpick inserted into cupcake comes out with few dry crumbs attached, 18 to 22 minutes. Cool cupcakes in tin 10 minutes, then turn out onto wire rack and cool completely.
    • PREPARE FILLING: Combine water and gelatin in large bowl and let sit until gelatin softens, about 5 minutes. Microwave until mixture is bubbling around edges and gelatin dissolves, about 30 seconds. Stir in butter, vanilla, and salt until combined. Let mixture cool until just warm to touch, about 5 minutes, then whisk in marshmallow creme until smooth; refrigerate until set, about 30 minutes. Transfer 1⁄3 cup marshmallow mixture to pastry bag fitted with small plain tip; reserve remaining mixture for filling cupcakes.
    • ASSEMBLE CUPCAKES: Microwave chocolate and butter in small bowl, stirring occasionally, until smooth, about 30 seconds. Cool glaze to room temperature, about 10 minutes. Cut cone from top of each cupcake and fill cupcakes with 1 tablespoon filling each. Replace tops, frost with 2 teaspoons cooled glaze, and let sit 10 minutes.
  • Finally time again to both blog and bake…

    Been a while since I’ve posted here on my blog. Lots of stuff gone under the bridge since my last post back in January of this year: job hunting, mad rush to finish the dissertation, finding a job, graduating, moving, and then starting the new job. Things are finally settled enough to where I can again pay attention to blogging.

    Well, it’s time to start getting back into the flow. We’ll start things off with a recipe for chocolate chip cookies that I used the other day for a picnic supper (thanks Kelley and Derrick for the invite!). This is based on a recipe I found about 5 years ago in Cook’s Illustrated. They do a few things different than the standard Toll House recipe for chocolate chip cookies. First, they do a mix of white and dark brown sugar. Then, they switch to 1 egg and 1 egg yolk rather than 2 eggs. Finally, instead of the standard creaming of the butter, they brown about 3/4 of the butter in a skillet and then add the remaining butter in before adding to the mix. Combining these things together gets you a more chewy cookie while keeping the crisp edges people seem like in their cookies.

    It’s good…

    INGREDIENTS
    1 3/4 cups unbleached all-purpose flour (8 3/4 ounces)
    1/2 teaspoon baking soda
    14 tablespoons unsalted butter (1 3/4 sticks)
    1/2 cup granulated sugar (3 1/2 ounces)
    3/4 cups packed dark brown sugar (5 1/4 ounces) (see note)
    1 teaspoon table salt
    2 teaspoons vanilla extract
    1 large egg
    1 large egg yolk
    1 1/4 cups semisweet chocolate chips or chunks
    3/4cup chopped pecans or walnuts, toasted (optional)
    

    INSTRUCTIONS

    1. Adjust oven rack to middle position and heat oven to 375 degrees. Line 2 large (18- by 12-inch) baking sheets with parchment paper. Whisk flour and baking soda together in medium bowl; set aside.
    2. Heat 10 tablespoons butter in 10-inch skillet over medium-high heat until melted, about 2 minutes. Continue cooking, swirling pan constantly until butter is dark golden brown and has nutty aroma, 1 to 3 minutes. Remove skillet from heat and, using heatproof spatula, transfer browned butter to large heatproof bowl. Stir remaining 4 tablespoons butter into hot butter until completely melted.
    3. Add both sugars, salt, and vanilla to bowl with butter and whisk until fully incorporated. Add egg and yolk and whisk until mixture is smooth with no sugar lumps remaining, about 30 seconds. Let mixture stand 3 minutes, then whisk for 30 seconds. Repeat process of resting and whisking 2 more times until mixture is thick, smooth, and shiny. Using rubber spatula or wooden spoon, stir in flour mixture until just combined, about 1 minute. Stir in chocolate chips and nuts (if using), giving dough final stir to ensure no flour pockets remain.
    4. Divide dough into 16 portions, each about 3 tablespoons (or use #24 cookie scoop). Arrange 2 inches apart on prepared baking sheets, 8 dough balls per sheet. (Smaller baking sheets can be used, but will require 3 batches.)
    5. Bake cookies 1 tray at a time until cookies are golden brown and still puffy, and edges have begun to set but centers are still soft, 10 to 14 minutes, rotating baking sheet halfway through baking. Transfer baking sheet to wire rack; cool cookies completely before serving.

    Selah.