Thursday, February 27, 2014

Reading email messages in Perl using Mail::POP3Client.

I had to write a program to read emails through POP3. It seemed to be a relatively easy to do using Perl's Mail::POP3Client library. There are enough examples on the Internet to get a basic program written very quickly that will retrieve emails. However, I was surprised that I couldn’t find a more detailed program. For example, I soon learned (the hard way) about message encodings (Base64 and Quoted-Printable). I found references to MIME::QuotedPrint and MIME::Base64 libraries for decoding the email bodies. It was easy enough to check the header for encoding entries:

Wednesday, February 26, 2014

Nutritional catchphrases are stupid and unscientific.

Want to sound smart when discussing nutrition? Try throwing around semi-meaningless terms like “processed,” “balanced,” “artificial,” “whole foods,” and “calorie dense.” They can be interpreted to be just about anything. You get to shoot down every bit of dietary advice you personally deem unsatisfactory without the trouble of finding evidence to support your claims. Doing research is hard, but spouting catchphrases and simplistic guidelines that make you seem reasonable is easy.

Ice Cream Container
“Don’t eat anything with more than five ingredients, or ingredients you can’t pronounce.” Done and done!

Is coconut oil healthy? Most people would say yes, but by my definition, coconut oil is a processed food and it’s certainly calorie dense. Even olive oil (another calorie dense food dieticians rave about) requires processing. If cold pressing olives isn’t considered “processing,” then neither should extracting the juice from any other fruit and consuming it. If apples are healthy, why isn’t apple juice healthy? Is it because it contains a lot of sugar or is it bad simply because the apples were “processed?” Why are processing apples bad, but processing olives good? I assume an apple is considered a whole food, while apple juice is not. If I don’t want the skin of the apple and peel it off, is it still a whole food? Probably not. An orange is a whole food, too, I guess. Why is it okay to discard the skin of an orange, but not an apple? Maybe it’s not okay? If I don’t eat orange peels, am I allow to complain when my diet fails or is this just an example of me not being compliant enough? And what about the apple cores? Do I have to eat those, too? What about the seeds?

Food isn’t a black box. Things like macro-nutrients, vitamins, minerals, etc. and their effects have been studied and are understood. Let’s stop pretending they’re not. Let’s not treat food as some kind of irreducibly complex enigma. It’s okay to make a statement like, “Olive oil has a net positive nutritional benefit, but apple juice does not.” We can argue this is true because we can dissect each food item and discover its types of fats, carbohydrates, and other components and deduce the effects they have on the human body. We may not have all the answers, but it’s at least an educated guess grounded in evidence. Throwing around loosely defined terms to categorize foods we intuitively deem healthy or unhealthy is a hand-wave, not science.

Tuesday, February 25, 2014

Audit for clear-text passwords in Subversion working copies.

The default configuration for Subversion working copies is to store the user passwords as clear-text. There’s no way for an administrator to force the use of a gnome keyring, so some kind of auditing program is needed.

This Perl script can be scheduled to run daily (as root) to scan the user home directories and delete any configuration files that may contain a clear-text password. Encrypted password working copies and working copies without stored passwords remain untouched.

Monday, February 24, 2014

Low Carb Gluten Free Chocolate Chip Cookie Dough Ice Cream

I decided to adapt a more complicated ice cream flavor to low carb: Chocolate Chip Cookie Dough. The ice cream part is simple now that I know the secret ingredient that makes low carb ice cream soft and scoopable: glycerin. The tough part is making a low carb and gluten free chocolate chip cookie. Cookies are not easy to make low carb. But wait! I don’t have to actually bake the cookies. I just have to get the raw dough to taste like regular cookie dough.

Thursday, February 20, 2014

Mitigating the risks of Subversion log edit capability.

The default Subversion pre-revprop-change hook script blocks any change to the repository log for good reason. Allowing users to edit the Subversion svn:log attribute is risky since the changes are not version controlled. Accidental or malicious modifications cannot be easily restored. However, humans are prone to errors and users frequently wish to be able to fix a commit log recently entered. A compromise is to allow the author of a commit to change their log messages providing they occurred within the last 24 hours. There’s also an exception for an administrator, so change the “GPinzone” in the script to whomever account is used as the admin.

Wednesday, February 19, 2014

Goals are for losers

All of us have thoughts and feelings that influence the way we make decisions. It’s not always something that can be put into words. An article, book, or television program may trigger emotions that may confirm or deny our own personal experiences and knowledge. Skeptical feelings arise whenever our internal “bullshit detector” gets triggered, sometimes subconsciously. My detector gets twanged whenever someone waxes poetic about goals. I couldn’t put it into words, but the logical part of my brain detects a conflict. I can believe that successful people have goals and setting them is a good behavior, but what about unrealistic goals? How do you know if goals are achievable? Did someone like Steve Jobs just know which goals were worthwhile and which were stinkers? How did his initial failures at promoting the home computer not deter him from pursuing that concept? How was that distinguishable from a bad idea that will never sell? What about the millions of passionate people who disappear into obscurity whom have good ideas and clear goals? Why didn’t goals work for them? Of course, putting all that reliance on one aspect of success is unfair. There are lots of reasons to consider why good people with good ideas fail miserably. However, even successful people with proven track records seem to fail quite often. In fact, the number of failures for meeting goals is way more than their successes. Yet, people continue to promote the importance of goals. Either there’s something “they” aren’t telling us or goals are a load of bullshit.

It was refreshing to say the least when I read Scott Adams book, “How to Fail at Almost Everything and Still Win Big.” The book’s chapters are interspersed with autobiographical accounts of Adam’s life including his failures and mysterious health issue, and his principles for success. The chapter titled, “Goals Versus Systems” yielded an “a-ha” moment for me when he wrote:
To put it bluntly, goals are for losers. That’s literally true most of the time. For example, if your goal is to lose ten pounds, you will spend every moment until you reach the goal—if you reach it at all—feeling as if you were short of your goal. In other words, goal-oriented people exist in a state of nearly continuous failure that they hope will be temporary. That feeling wears on you. In time, it becomes heavy and uncomfortable. It might even drive you out of the game.
My indescribable feeling has been described! Yes! A thousand times, yes! Diet success requires a system, not a goal. Low carbohydrate, high fat is a system. Paleo is a system. Vegan is a system. Not all systems are equal and some may work better than others (and some may not work at all). He even addresses diet in terms of systems vs. goals.
The system-versus-goals model can be applied to most human endeavors. In the world of dieting, losing twenty pounds is a goal, but eating right is a system. In the exercise realm, running a marathon in under four hours is a goal, but exercising daily is a system. In business, making a million dollars is a goal, but being a serial entrepreneur is a system.
Even realistic and achievable goals can be counterproductive to the psyche.
If you achieve your goal, you celebrate and feel terrific, but only until you realize you just lost the thing that gave you purpose and direction. Your options are to feel empty and useless, perhaps enjoying the spoils of your success until they bore you, or set new goals and reenter the cycle of permanent presuccess failure.
The definition of system and goals is a little blurry. However, he provides a simple way to distinguish between the two.
For our purposes, let’s say a goal is a specific objective that you either achieve or don’t sometime in the future. A system is something you do on a regular basis that increases your odds of happiness in the long run. If you do something every day, it’s a system. If you’re waiting to achieve it someday in the future, it’s a goal.
Diet needs to be a system. It should be something that increases “your odds of happiness in the long run.” It cannot rely on extraordinary amounts of willpower to maintain. Any system that necessitates starvation or chronic hunger is a bad system. Any system that makes a person feel bad or unhealthy is also bad. I know that seems obvious, but ask some ex-vegans how they felt while on their system of choice, yet they persevered…for a while

The chapter called “Diet” is very insightful. He makes a bold claim that he eats as much as he wants, of anything he wants, whenever he wants. A proviso to his claim is that it works because he “reprogrammed” himself to want the right kinds of food for enjoyment and disfavor the wrong ones. I won’t go into his techniques to eliminate cravings for undesirable foods, so if you’re interested, you should buy the book. However, I can relate his advice to my own experiences. I eliminated the cravings for sugar by abstaining from high glycemic, high carb food and by substituting those foods for tasty low carb alternatives. Ratcheting down on “crutch” foods occurred over time. I practically never use low carb wheat-based flours or consume processed low carb snacks. However, I still use non-nutritive sweeteners and I don’t see that ever changing. Any diet that removes the joy of eating will result in failure.

TL;DR


Goals are for losers. Choose systems that work for you. Buy the book. Read Dilbert.

Bonus link: Goals vs. Systems from Scott Adams' blog.

Tuesday, February 18, 2014

Improved ice cream stabilizer

I discussed the importance of stabilizers in my Tools and Techniques of Making Ice Cream series of posts. Xanthan gum is a common choice by home ice cream makers, but it’s not an ideal one. It’s a very effective ingredient, but gives the ice cream an unnatural gummy texture. In fact, it’s such a strong thickener that it’s very easy to add too little or too much.

There are many different kinds of additives that can be used as an ice cream stabilizer. I found a product from Dixie Diner’s Club called Thick-It-Up Low Carb Food Thickener that contains a mix of common thickeners: locust bean, (and/or tara), guar, acacia, and xanthan gums. I tried it out in a couple batches of ice cream and it works well. I’ve found that ½ teaspoon per quart provides stability without affecting the texture.

Thick-It-Up Low Carb Food Thickener

Saturday, February 15, 2014

One of the most under-appreciated foods in history.

I’ve stumbled upon what I believe is one of the healthiest foods in existence. It’s held in high regard by the followers of vegan, paleo, and low carb. Nope, not cauliflower, but good guess. It’s a great source of fat. Lots of monounsaturated fat and oleic acid. It can be used as a cooking oil, too.

Friday, February 14, 2014

Automating Subversion repository creation for new and imported repos.

Creating new repositories is a very mechanical operation ripe for automation. This bash script will create a new repository in the appropriate directory using the name specified on the command line. It will also set up the default Subversion paths of trunk, branches and tags. It checks for the Collabnet binaries to determine the unique settings needed for that implementation.

Thursday, February 13, 2014

Finding evidence for Decision Analysis and Resolution (DAR). It’s easier than you think.


The Capability Maturity Model Integration (CMMI) models are collections of best practices used to help organizations improve their processes. One of the more puzzling process areas for many new to CMMI is Decision Analysis and Resolution (DAR). The purpose of DAR is to establish guidelines to determine which issues should be subjected to a formal evaluation and then apply that formal evaluation to those issues. One of the selling points for implementing DAR is that it takes the blame out of decision making. By using it, there will be evidence that objective data was collected and a decision was made based on a standardized process. It’s CYA heaven!

DAR is unique in that there is no requirement to the number of formal evaluations that need to be performed. Yes, evidence has to be shown that DAR was performed, and it should be pervasive across every aspect of the organization, but that’s not a requirement. How will you know when it’s implemented enough? Unfortunately, that’s a subjective call. A call that gets progressively harder to make for an organization with a paucity of DAR evidence.

Wednesday, February 12, 2014

Subversion repository backup script.

This bash script will create compressed dump files of all the available subversion repositories. The paths will need to be modified based on your operating environment. It uses 7zip for compression, but can be modified to use any compression program/algorithm desired.

Tuesday, February 11, 2014

Dieting and willpower: It’s not just about hunger and palatability.

Willpower: Why Self-Control is the Secret of Success I had the pleasure of discovering the book “Willpower: Why Self-Control is the Secret of Success” by Roy F. Baumeister and John Tierney. The authors' premise is that all successful people possess two qualities: intelligence and self-control. They believe people can improve their ability to resist temptation and provide methods to achieve this lofty goal. However, I’m going to concentrate on the research the authors provide to help us better understand what willpower is and how it works.

The book transforms willpower from an abstract concept into a tangible and predictable real-world phenomenon. The primary methods to understand willpower are experimentation and observation. The results are unavoidably subjective compared to other more “concrete” areas of science. Nevertheless, it’s refreshing to see the problem tackled with biology and falsifiable experimentation rather than a treatise expressed in purely philosophical terms.

Monday, February 10, 2014

The false compromise argument: why ignorance is not a point of view.

I had a familiar conversation with a stranger recently. This person remarked that maybe “there is no one healthy for every person? What’s healthy for you might not be for me?” This kind of flippant answer usually gets my hackles up. It’s not because I disagree with the premise. It’s the “split the baby” response to a problem that can’t be solved practically that raises my ire. That isn’t a solution. It’s a cop out.

Friday, February 7, 2014

Java’s escape hatch: Getting legacy applets to work again.

Oracle is putting the screws to Java browser applets and those screws are getting tighter on each release. That’s the good news. The bad news is that legacy Java applets probably aren’t up to snuff and won’t be updated anytime soon. Java 7u51 provided an escape hatch to make exceptions for URLs to Java applets that can be trusted. Individual users can make exceptions directly through the Java settings in the Control Panel. Large organizations would be better off implementing this through Deployment Rule Sets.

Thursday, February 6, 2014

Subversion write-through proxying using a ssh tunnel.

Subversion is an open source centralized version control system. Because of its centralized nature, all commits to slave repositories must flow up to the master server and then the slaves are synchronized with the latest commit. (Commits directly to the master will also trigger a sync to all of the slaves.) The configuration of the master and slaves as described by the Subversion manual is summarized as follows:

Tuesday, February 4, 2014

Tools and Techniques of Making Ice Cream - Part Four

Part three covered the theory and now it’s time to put it all into practice. Let’s jump in with a more complicated recipe like Butter Pecan.

Ben and Jerry’s Butter Pecan

  • 2 cups heavy cream
  • 1 cup whole milk
  • ¾ cup sugar
  • 2 eggs
  • ½ cup butter
  • 1 cup chopped pecans
  • ½ tsp salt
This is the original recipe* we’ll use as a baseline. Everything looks pretty low carb in this except the whole milk and sugar, but let’s not worry about that right now. Open up the spreadsheet, go to the Butter Pecan tab, and scroll down to the “Original” section.

Monday, February 3, 2014

Tools and Techniques of Making Ice Cream - Part Three

My post called, “The quest for a truly low carb ice cream” and parts one and two of this series cover mostly all of the basics of making homemade ice cream. Part three is a deep dive into ice cream science. A lot of it is going to seem redundant since I’m going to cover many of the same topics, but in greater detail. If you’re only interested in making (sugar free) homemade ice cream and you’ve read the earlier posts, you can skip this one if you like. Part four will be a short post detailing my Ice Cream Freezing Point Depression Calculator spreadsheet, so it will be written with the assumption that the reader is familiar with these topics. However, there’s nothing stopping anyone from just plugging in numbers to get the recommended thresholds and ignore all the theory behind it. (You can be a great driver even if you don’t know the internal workings of a car.) The amount of information on ice cream science is staggering. What I’m writing here is truly only the tip of the iceberg.