Gist of the Day: Automated Testing With CUnit

It’s no secret that I love automated testing. I have done automated testing in Perl, C, Java, JavaScript, C++, Python, Objective-C, and PHP. I have yet to find an automated testing framework I didn’t like. C is a unique case since it requires a little more cleverness to perform some of the normal control techniques that you can do with other frameworks.
Continue reading “Gist of the Day: Automated Testing With CUnit”

Gist of the Day: Roles in Moose!

Have you ever struggled with how to structure your class hierarchy, given a common type of functionality which applies to some classes but not others? Say for instance you have a class named Animal. With this Animal class you can derive all of your animal classes. Take for instance a chicken, for which you subclass Animal to a class you call Chicken.
One of the features you’d like to implement is that an animal makes a noise. Chickens, for instance, cluck. Some animals, however, don’t make a noise. Take a seahorse for instance, it doesn’t make noise. It is every bit an animal, but it doesn’t make noise. There are many other mute animals across many different families of animals, so it doesn’t really seem to fit in to your hierarchy. For this purpose, you can use a Role in Moose. A role allows you to dynamically add functionality to an existing Moose class (as many of them as you like) without having to mangle your nice, clean class hierarchy. Think of it as a grab-bag of functionality for your class which can also be used by other classes regardless of their parentage.

Continue reading “Gist of the Day: Roles in Moose!”

Gist of the Day: Perl require Versus use

So, way back when I used to be a guy who thought up interview questions for super-senior Perl developers. I actually developed quite the reputation for being a very effective first-round interview for senior Perlers. My interviews were perceived to be so tough that headhunters would debrief the candidates so they could create cheat-sheets. I never considered my interviews very difficult at all. Despite the fact that very few of the candidates passed my first round, none of these questions seemed very difficult to me. Mind you, the client I was interviewing for wasn’t looking for someone who was a good programmer, they were specifically looking for a good Perler (a very good Perler). It is important for interviewers to ask questions relevant to the job they are hiring for, and if you have a legacy application which is using a lot of the in-depth features of a language then that language may become something very important to your hiring.
This is one of those “gotcha” questions that I actually had a recruiter try to call BS on me with, and I think it’s a fundamental one since it really reflects whether or not you understand how modules work in Perl:

What is the difference between use and require in Perl?

Continue reading “Gist of the Day: Perl require Versus use”

Gist of the Day: Perl Closure Extravaganza!

Hey all, so I’ve been asked to do something a little more in-depth, and I’ve been given no requests, so I picked closures in Perl.

About Closures

A closure is a function which was created dynamically inside of another function. In Perl (among other languages), these are sometimes referred to as anonymous subroutines. In Perl, all closures are anonymous subroutines, but not all anonymous subroutines are closures. The key differentiating feature is scope: a closure has access to lexically-scoped variables within a containing subroutine, whereas an anonymous subroutine is not necessarily even inside of a function. Continue reading “Gist of the Day: Perl Closure Extravaganza!”

Public Libraries

With all this talk about Kindle and eBooks being a cheaper alternative… have we forgotten about these lovely things called public libraries? They have New York Times best sellers and many newspapers for *free* all year round… and when you’re done reading them, you don’t have to store them, you don’t have to recycle them… you just take them back to the library!

Thick-Crust Pizza Crust (Vegan Friendly)

It’s been a while since I’ve put up a recipe, and that’s not because I don’t love you all… it’s because I’ve been mastering something that has taunted me for a long time: thick-crust pizza.
Now, you’re probably saying “but manchicken, pizza usually has cheese on it, and vegan cheese substitutes all taste like ass!”  Well, I couldn’t agree more… vegan cheese substitutes do tend to taste like ass, and that’s why I just don’t use them.  I make cheese-less pizza.  Now, without all that extra fat and Calories you can do a lot more with toppings, but you can also feel guilt-free about thick-crust pizza.  You probably could put cheese on this if you want, but I’m happy with just store-bought spaghetti sauce and onions.
You need:

  • 1 cup hot tap water, 170ºF/77ºC max
  • 1 1/2 tbsp yeast
  • 2 tbsp brewers yeast
  • 1 1/2 tbsp light corn syrup
  • 6 cups all-purpose flour (3 cups for dough, 3 to knead into dough)
  • 1/2 tsp salt
  • 1/2 tsp ground black pepper
  • 1 1/2 tsp dried oregano
  • 8 tbsp canola oil (2 tbsp for the dough, 6 to oil your pans)
  • 2 9-inch round cake pans
Dissolve the corn syrup in the hot water, then add both the yeast and the brewers yeast; mix well, set aside, let sit for 8 minutes.
While the yeast activating, get a large bowl and add 3 cups of the flour, salt, oregano and 2 tbsp of the oil.
Add water-yeast mixture to the dry ingredients; stir until everything is combined.
On a floured surface, knead remaining flour into the dough ball.  Knead dough for 2 whole minutes.
Divide dough into two even balled portions and then flatten them in the two pans.
Place the dough in an oven at 170ºF/77ºC (or slightly lower if your oven will go that low) for 30 minutes to rise.
Top your pizza and bake for 10-15 minutes (may take longer lots of toppings or cheese are added).

Warmongers: The New Pervert…

So, I’ve recently say that pedophiles are the worst people ever. If you live in the US, you’ve likely heard similar statements. It’s kinda crazy in the first place when you hear someone say this because–to me at least–what they’re really saying is “I am such a better person than a pedophile” or “regardless of the bad things I’ve done in my life, a pedophile is so much worse.” For the vast majority of people walking this earth right now, I would summarily reject that entire mentality outright. The very concept of ethically or morally justifying yourself by pointing out the bad behaviors of other is flawed. Even more than that, however, if you were to look at bad behavior, pedophilia is not even in the top-ten things you could do to damage society as a whole.
I’ll start off with a quick disclaimer on this paragraph. I am not a pedophile, I do not condone pedophilia, and under no circumstances would I ever do anything to minimize the damage that sexual abuse does to an individual and their family. Pedophilia, like many other crimes, damages people and communities. I am not trying to minimize this at all, just pointing out that while this is a horrible thing, there are worse things even than this.
What could possibly be worse than pedophilia? A warmonger. What is a warmonger? According to the Random House Unabridged Dictionary, a warmonger is “a person who advocates, endorses, or tries to precipitate war.” Several other dictionaries have similar definitions, but add that it is someone who does these things for personal gain. So what would someone seek to gain from war? Power, resources, money, land, religious zealotry, bigotry, self-righteous indignation, and everybody’s favorite: blind nationalism.
Blind nationalism is the one I think I see the most, but often times I see a combination of self-righteous indignation and blind nationalism. These two motives really do go hand-in-hand, don’t they? Think about it, one of the components of a nationalistic ideology is the “us versus them” mentality. Self-righteous indignation also has a similar mentality behind it. I think to a certain degree–remember, I’m not a sociologist or a political scientist, I’m but a humble geek trying to share my thoughts on the subject–these two things can morph into the exact same thing.
Am I talking about the Iraq war? No, I’m not talking about the Iraq war specifically in this. I’m talking about all violent action, excepting self-defense, including that which is done to enforce the law. Wow, that’s a pretty big thing to say there, isn’t it? Gosh, I must be some sort of communistic coward or pacifist or something, eh? No, I just realize that what my mom told me when I was a kid is still true to this day: hitting hurts. It does, I’ll show you. Try slapping yourself on the left arm with your right hand. That hurt a bit, didn’t it? See, I’m not making this up. And while hitting hurts, shooting hurts worse, bombing hurts worse, and stabbing hurts worse. That said, the “war on terror” is actually an excellent example–in my uneducated opinion–for this quick little study.
You know what I frequently hear that makes my skin crawl? You’ve heard it to, you know you have, it’s the old saying “freedom isn’t free.” What a statement. Anybody whose ever paid taxes sure knows that one, eh? When someone says “freedom isn’t free” in order to justify war I actually think it cheapens the entire concept of freedom. They’re saying that in order to be free, you must use violence to continue its exercise in the future. So in order to be a free person now, by their reasoning, if you are not okay with the use of violence and coercion for the sake of freedom then you are in some way in opposition to it. I think it’s even worse for the folks who have never served–which I admittedly have not served–in the armed forces. These people are saying “freedom is not free, but why don’t you pick up the bill Mr. Soldier?” I’m not a soldier, but I would think that most wish that while freedom isn’t free, that it took another form of payment. You know, like diplomacy.
So, now I guess some of you are thinking that I’m anti-military. Am I? Well, kind of, but not really. You see, I think the military is a great business. It gets young folks discipline, skills, money for college, and it does give us the ability to immediately defend ourselves. It also gives our government a great opportunity to give back to our society. WHAT?! Give back to our society? Did I just say that? Yes, I did.
The Jeep, computers, the Internet, duct tape, all of these things began as military research and inventions. Yeah, without the military there would be no duct tape, and we’d all be worse off without duct tape and you know it. So if I’m not against the military, what am I against? I’m against the offensive utilization of the military without a proven defensive purpose… and no, a bunch of bigots in the middle of the desert–even if they did pull off 9/11–is not a proven defensive purpose. Not even law enforcement is a proven defensive purpose. The only thing I would think that constitutes a proven defensive purpose is a substantiated credible threat that someone was invading or aiming a weapon at someone that the respective military force was charged with protecting. That doesn’t mean “he’s amassing WMD” but it would mean “he’s pointing WMD at us that we know can reach us and we have reason to believe that he will fire.”
So, now that we’ve gone through that spiel, how is a warmonger like a pervert? Well, I don’t know about you, but the reports I’m hearing are that war kills an awful lot of people, harms an awful lot of people, and results in a temporary or semi-permanent state of lawlessness that also hurts an awful lot of people. Pedophiles and rapists only hurt a handful of people. One rapist can hurt several people, one bomb–even a smart-bomb–can hurt several dozen if not several hundred (or in some cases several million) people. But a warmonger isn’t necessarily the one who is actually dropping the bomb, now are they? And a pervert isn’t necessarily the one who is abusing the victim either. Instead they’re both people who in some way get off on the idea of the wrong being done. Perverts get off on sexual abuse and/or deviance, warmongers get off on military forces killing and maiming. You see where I’m drawing the parallel?
Now, before you go off trying to defend George Bush or the Iraq war or whatnot, please understand that I’m not attacking George Bush or the Iraq war in the slightest. I am actually just pointing out that war is a bad thing–even when it’s necessary it is still bad–and that warmongers are the new pervert. Even if a war was necessary, it is still not okay to think of it in a good light. There is nothing good about war, ever.
So who am I calling a warmonger? Well, if you have ever said “freedom isn’t free,” have used the phrase “anti-war rhetoric,” have accused someone of being “anti-American,” or have in any way put war in a light that is in any way positive–other than citing with much resignation that it is necessary–then I am calling you a warmonger. If you are thinking of sending me an email to tell me how I should be thankful to the men and women who died to defend my freedom, you might also be a warmonger. This isn’t to say that I shouldn’t be thankful to those who defend freedom, and I am, this is merely to say that if you feel the moral imperative to tell me this than you are probably a warmonger. You might be a warmonger out of a flawed sense of nationalism, you might be a warmonger out of self-righteous indignation, you might be a warmonger because you never really thought of war as a bad thing, but for any of those reasons you would still be a warmonger.
Warmongering, however, I wouldn’t limit to war. I would say that those who advocate the assassination of foreign officials or diplomats or the use of deadly force to enforce the law–barring self-defense in the course of enforcing the law–are also warmongers.
So, why did I just spend a crapload of time writing an article about how I think warmongers are perverts? Because I’m pretty much just sick of it. I’m sick of this ridiculous idea that if you are not for all wars and all edicts of Washington that you are somehow in opposition to America or freedom. To all those who would suggest I should move out of the United States for holding these views, bite me. You can take your all-encompassing nationalism, your American flag bumper sticker, and your bald eagle hood ornament and shove them all right up your ass (be sure to use safe-sex practices, though). There aren’t enough yellow ribbons or American flag bumper stickers in the world to justify our more recent wars. This isn’t a sports team where you route for your team and poke fun at the opposing team with the us-versus-them thing going on. This is real life, and real people are dying, and real people are getting hurt.
Right now, in a land far away from the vast majority of those reading this post, somebody’s child is being hurt… think about that, it’s not a happy thought now is it?
So what do we do? Am I going to point out a problem without offering a solution? No, I wouldn’t do something like that. Here’s what we do: first, we create a 12-step program for warmongers. We could probably adapt the pornography addicts program for this. Then we hold our elected officials to account. When a politician is warmongering, we call them on it. Let’s get it through our thick skulls that killing people is a bad thing to do. Let’s learn from our philosophers and great thinkers and leaders and realize that there is nothing to be gained from hurting others. Let’s also get rid of this idea that violence is a good thing. There were many who cheered when Saddam Hussein was executed, why? Since when has death ever been something we cheer about? Even if the Iraqi people thought it necessary to put Mr. Hussein to death, why is that something that someone should smile about? That is a perverted frame of mind and we must do what we can to get that out of our culture.
In closing, I’m sure I’m gonna get flamed in the comments and via email on this one and that’s okay, but I hope that I will some day soon know the joy of living in a society that values life and that values peace.

Would the Real manchicken Please Stand Up?

Okay, so some of you are going to notice my transition from blog.notsosoft.net to manchicken.com for the blog. This is for two reasons. One reason is that I’m trying to attract more free software traffic with the new domain name. The other reason is that I plan on using notsosoft.net for more free software related stuff.
manchicken.com is the new home for this blog, but blog.notsosoft.net will remain up and active indefinitely.

Summer Cooking w/manchicken

Hey everybody, it’s summer, and as much as I love to share the software, I love to share a fantastic dessert recipe, too. Free Software, Free Recipes. Oh hell yeah.
So what I’m going to tell you about today is my grilled pineapple à la mode. This is particularly good with lighter dishes, like a grilled veggie sandwich, or a barbeque (I like it with smoked BBQ brisket).
I make a sauce out of about 100ml honey and 50ml soy milk (I prefer plain), and then I brush it on the pineapple while I grill it on each side for about 2-3 seconds. Then I place the pineapple on a small plate, and top it with a scoop of ice cream. Then I drizzle a little bit of honey on the whole thing.
Now, for those of you who would like to download this recipe for your krecipes, I’ve attached the compressed recipe file to this blog post.
Right-click here to download it.
I hope this helps some of you find a great use for Krecipes, it really is a great program. My wife and I use it all the time for stuff. Maybe I’ll share my pizza crust recipe some day.