Saturday, April 25, 2015

Refactoring 101 for complete beginners

Working in the field for a while, I find that new folks in the field have a problem with refactoring. I think the primary problems are:

  • Code without tests is dangerous and frankly scary to refactor
  • It's really easy to copy/paste code, and if you don't have to support and bug fix things, the merits of clean and concise code are lost
While I don't claim to fix anything, here's a quick guide on how/why to refactor (for complete newbies):

Wednesday, April 22, 2015

The Hazard of Not Taking Things Personally at Work

Don't take it personally is an oft repeated platitude I hear repeated in the work environment. While I think it's unhealthy to take problems at work and things out of your control as personal affronts, I think a healthy dose of taking personal ownership of your work is "a good thing" (tm). I say this because the counterpoint to not taking things personally is not giving a damn and I think this is a far worse situation than folks who are personally invested and passionate about their work.

In my experience, the most successful folks I've interacted with take a very deep personal interest in their life's work. They are passionate, appropriately loyal, and care a great deal about the quality of the product or service they provide. Folks that punch the clock, point fingers, and skip home after their "8 (or so) hours of physical presence" are huge problem and all too often a key source of low quality work and cumbersome process. More dangerously this leads to a culture of "not my job" and causes folks who might otherwise be outstanding performers to ask themselves "why should I put forth any extra effort?" or "what's in it for me?".

So I amend the platitude and say this: Take personal ownership of your work, while I'm not about to spout phrases like "Arbeit Macht Frei", I DO think it is better if one approaches their work with a sense of ownership, responsibility, and a certain amount of pride in what they do for a living.

Thursday, March 19, 2015

Installing virtualbox guest additions on Centos 7 minimal image

I've just spent some time setting up a bare Centos 7 image to support development stripping out as much as possible. While CoreOS is probably a better choice, we run redhat in production at this point and centos is a better fit for the time being. The problem I've found is that many of the instructions available via google were written against prerelease versions or espouse manually installing random rpms instead of just using yum. While I get this "works", I'm not a huge fan of this approach and would rather do everything with the package manager. After a LOT of scouring and trial and error, I finally found the "magic" combination.

The winner is courtesy of I've taken these instructions and tweaked them slightly for my purposes.

The original poster did this on a more "full fledged" version of centos with a windows host and my instructions are for a minimal install using and OSX host (though I'm certain the OP's instructions will work too. First, mount the guest additions cd from the virtualbox gui (original link has a photo, but it's under devices->Insert Guest Additions CD Image. Then log into the console as root. Once you've done this, enter the following commands:

yum -y update kernel*
reboot -r now

After this step, you'll have to log in again. Then run the following:

yum install -y gcc kernel-devel kernel-headers dkms make bzip2 perl
export KERN_DIR=/usr/src/kernels/`uname -r`
mkdir /media/cdrom
mount /dev/cdrom /media/cdrom
cd /media/cdrom

Additionally, there are some instructions that I believe will work, but installed more than I really wanted to or I didn't discover until after. Additionally (pun intended) a key point I missed originally is that the minimal iso is missing default packages (perl I think was the culprit) that you need to properly build the guest additions so instructions for the "full blown" image will fail for mysterious reasons (i.e. the "build" symlink is broken)

  • This seems like it would work too, but installs more than I really wanted to over my cell phone connection
  • I found this after I wrote my post and it is virtually (pun intended) identical to my instructions.

Examples I tried that did NOT work or were too convoluted:

  • forum had all sorts of crazy "wget" hackery suggested...While it may work, I like the epel approach better
  • this version on stackexchange CAN get you there, but you have to read all the comments to figure out what is really required for a minimal install

I realize my post is a bit of a duplicate, but as there's no good way to get rid of historical anachronisms on the internet, this is an attempt to boost the ranking of the better approaches