Monday, June 17, 2013

In Defense of Bee Stings

Last weekend I got stung by honeybees. Two stings, in fact-- one to my right wrist and another just to the left of my nose. It's been fun getting everyone's dramatic reactions and horrifying stories of stings from their childhood, but I want to step back a bit in this post and clarify some misconceptions about bees and stings.

Those mean bees!

No, actually they were goaded into it. Really, the only thing I could have done to aggravate them more would be to stomp on the hive!

The Robbing, Part 1

My niece and nephew were visiting from out of state, so I thought it'd be fun to try harvesting from my top-bar hive for the first time. We got in there and some of the comb wasn't being made exactly parallel to the bars, so I went ahead and cut out the crooked parts. Unfortunately the cut went through some of the active brood comb.

Now, if you're a bee, imagine some giant creature deciding your garage isn't quite in the right spot. So the giant comes through with a massive blade and cuts through the kids' room, sawing a couple of them in half and taking a few more of them with him as he steals that part of your house. This would not make you a happy bee!

The Robbing, Part 2

We went in for lunch, then a half-hour later tried robbing a different section of the hive. At this point the pheromone signal had time to permeate. The hive was under attack and all the bees were on high alert!

This time we found a couple of frames that didn't have active brood in them, so it was time to raid the larder in earnest. My assistant brushed the bees off the comb, then my nephew ran them inside to be carved up. By the time we moved on to the third frame there were several hundred bees in the air that were looking to pick a fight.

The Vengeance

Did I mention yet that I wasn't wearing any protective gear? No hat, no veil, no gloves. Shorts and a T-shirt for me!

One of the bees figured out that the giant raiding the nest had an appendage called a "hand" that was nearby! She nobly gave her life as a distraction, but to no avail. The monster kept coming, peering closer with its enormous eyes, greedily eyeing the children in the nursery.

Actually, I was just trying to figure out if this comb had enough honey to be worth taking.

Seizing opportunity, another defender dove in for the attack. Her stinger's barb exposed, a drop of venom glistening in the sun, she plunged for vengeance!

Have you ever been stung on the face? It's rather disconcerting. Among my top 10 favorite activities, face stings are not to be found. At this point I saw the larvae on the comb and decided they had a pretty good reason to be defending. Carefully, I set the full bar back on the hive and packed the remaining empty bars in place. Gently, I set the top back on the hive.

Once the bees were safely packed back up, I stepped away from the hive and had my assistant get the stingers out. This was a good 2-3 minutes after the stings, so there was plenty of time for the venom sacs to empty into me.

Lessons learned:

  1. Minimal protective gear would have prevented the face sting. Frankly, the wrist sting could have been avoided too.
  2. If you're going to harvest, do it for real. Don't carve up the larvae and go back a half hour later expecting the bees to act as if nothing happened.
  3. Get the stingers out soon. Brush with your hand, pluck with tweezers, scrape with a credit card... just get them off.

How horrible! You must be allergic!

Reactions to honeybee venom vary widely, and can even change over time. I had a couple stings last year and they didn't swell up nearly as much. This time the stingers were left in WAY longer than before. Get the stingers out fast! Also, people around bees who aren't getting stung can develop more severe allergies than people who don't have regular contact with bees. Crazy, huh? Plus, it can be that the more you're stung, the less you react. Apparently I should be getting stung once a month or so to keep my immune system updated with the latest "security patch". And as bad as it looks, apparently this is a pretty typical reaction for a sting on the face.

So your bees aren't really mean, and you're not severely allergic?

Pretty much.

What now?

I'd like to try building up an immunity to bee venom. There are a couple areas of my body that are numb on the skin, so they seem like good candidates for an initial inoculation. Still not sure how to catch a bee "safely", and frankly I'm not thrilled with the idea of terrorizing one so badly that she's prepared to kill herself for my science experiment.

Tuesday, March 26, 2013

MVVM defined from a Business Workflow perspective

In software engineering we have what are called Design Patterns. Most tech interviews have at least one question on a pattern called Model View Controller, or MVC. You can do a search and come up with millions of results, but basically your business model and the view presented to the user are two separate systems glued together by a Controller that watches for changes in the Model and listens to events in the View.

As patterns have evolved since the original work written by the "Gang of Four", another flavor of UI design has arisen called Model View View-Model, or MVVM. It's exactly the same thing, only different-- in this case your controller is replaced by a view-model. Huh? Why not just call it a controller?? People make arguments about the subtle differences between MVC, MVP, MVVM, and MV*, but it's all pretty much just to confuse people in interviews.

I like to think of it in terms of business processes, and the workflows that support them. A business process could be something like "providing a way for people to sign up." Workflows to support that process could include:

  • Providing a signup page for people to enter their information directly.
  • A referral page so that some of the person's information is already filled in by another member.
  • Admin screens for customer service reps to complete the process on behalf of the user.
The business process has specific requirements, like having a username and a password. Maybe an email address or phone number, too. But as people are going through the individual workflows they might need to leave those things blank because they haven't come up yet. That's where the view-model comes in. It stores the workflow-specific information relevant to that data entry screen, and provides a mechanism to pump the important information into the business process once it's ready.

Friday, February 22, 2013

Is Java Dead? What language should you learn?

The Question

The son of a friend of mine recently asked what programming language he should learn. He heard Java was dead, but was confused because Android and iPhones use Java and they're more popular than ever. What's going on here??

My Response

First, iOS apps are written in Objective C, not Java. But that's just nit-picking. ;-)

The short version:

Programming languages are tools. Some are better at specific tasks than others-- you don't use a hammer to chop down a tree. Sure it'll work, but it's a lot of work and your end result won't be very pretty.

The long version:

Java is as dead as you want it to be, really. We've come into an era where there are lots of programming languages available, and Java is simply one voice in the choir. Each language is born with a specific task in mind. Over time that morphs, and some languages end up where they shouldn't be while others get pushed out of their established niches by something newer. Evolution, if you will.

Java was built to handle complex problems in a truly object-oriented way. Some languages work best as procedural (Assembly, C), others are functional (LISP, Erlang), and many are object-oriented. When Java came on the scene, people were tired of writing desktop applications in one language for Windows, another for Apple, and yet another for Unix/Linux. Manually allocating memory was (and still is!) a tedious and dangerous prospect. Java solved this problem by running in a "virtual machine" where the Java code would tell the machine what to do, and the machine did the operations on the computer it was running on.

The really neat thing was that around this time (mid '90s) web browsers as we know them were starting to appear. With the appropriate browser plug-in you could run the same app that you wrote for your desktop in the browser! Java and ActiveX (Microsoft) slogged it out in a death match until Internet Explorer 6 conquered the world... but the Pax Microsoft is another story for another day.

Fast-forward a few years. Desktop development is still a big thing, but web development is coming on like a freight train. Because Java was designed for complex problems, it has a natural home in large enterprises like medicine and online banking. For everyone putting up a website to show off their dog's new haircut, it's serious overkill.

PHP rules the land of small web projects. In part, this is because PHP is easier to learn, so lots of people pick it up. Look at that, PHP must be popular! But it turns out that it's not a very good language; just a very popular one. New versions and new frameworks come along  to make PHP better at large problems. But now it's not as easy, so a lot of people get turned off by it.

Enter Ruby. Ruby was an obscure little language until someone build the Rails web framework. One thing Ruby on Rails does well is handle the database for the developer. Up until now, you needed to create your database separately and then learn another language (SQL) to communicate with it. What a mess! But RoR makes that invisible. The programmer can just code, and Rails makes the database magically work.

By the way, by now the Java crowd has been doing that database trick for years, and they roll their eyes whenever the Ruby guys start bragging.

Now everyone's in on the game. Python has Pylons and Django, Microsoft moved to MVC, Ruby on Rails is maturing and getting better tools. Meanwhile JSP hasn't changed all that much because they had it right all along. Seriously, just ask them!

But now we're approaching an explosion of a different kind. Mobile computing and embedded devices are popping up in everything. What do they run? If it's really lightweight, maybe you need an embedded language like C++. Have a bit more horsepower? Java still runs on everything from mainframes to coffee pots. If you want to code on an Apple device you'll have to use Objective C.

So is Java dead? In short, no. It's a great general-purpose language that's just been crowded out of some niches by more specialized languages. That's just fine! There's lots of room for everybody, and good programmers commonly know at least one language in 3 or 4 different categories.

Where should you start? Pick a project (not a language) that interests you. Solve it in whatever's easiest to learn for now. Don't worry-- you won't get it right the first time anyways. The important thing is to start solving problems. When you encounter something that your current tool doesn't do well, you'll pick up another and be amazed at how much more productive you are. Keep working on interesting problems and pretty soon you'll have a belt full of useful and fun tools.

What do I use? Mostly C#. ;-)

Saturday, February 2, 2013

VirtualBox with Linux guest on Windows host won't resize after installing guest additions

Before I go on a rant, here's the short answer:

Instructions from the VirtualBox manual say to install Dynamic Kernal Module System (DKMS). For my Ubuntu setup this is what worked:

sudo apt-get install dkms

For a Fedora installation it's something like this:

yum install dkms

Follow these instructions for detailed steps on Suse, CentOS, Debian, etc.
Now that DKMS is installed, you can (re)install Guest Additions. They say to install DKMS before installing Guest Additions, so if your Guest Additions are already installed and functional (ha! If they were, why would you be reading this?) you might consider a) uninstalling and rebooting; or b) just rebooting because if you had the same problem as me the reboot breaks Guest Additions anyways.

Back to my rant...

Wow, how's that for a link-bait title? And why such an obvious bait for the search engines? BECAUSE IT TOOK FOREVER TO FIND THE ANSWER. I've dealt with this issue for several months now by simply not rebooting unless it was absolutely necessary. Once a single reboot was done, my screen was stuck back at the smaller resolution that my image started at.

I would have thought that since my Ubuntu image came from it would play nicely with Guest Additions. Apparently those images are fairly stripped down with only what's necessary. Since those are "additions", the prerequisites aren't in place.
Don't you just love those little nuanced rat-holes you encounter as you learn? Blarg.

Wednesday, January 30, 2013

Soap Recipe

I taught a soap making class tonight, and my friend Ryan Byrd (who, incidentally, runs the coolest site in Utah) attended. After he left I was cleaning up, and discovered that he'd forgotten to take his copy of my ulta top-secret recipe! So for his benefit and the benefit of all who seek it, here you go! All measurements are in grams.

 Full  Half  Quarter