Sperm Wars 2

Posted by jcnnghm Mon, 15 Feb 2010 00:18:02 GMT

In the last few days I've noticed a lot of interest in Dating and the Pickup subculture, such as the article The New Dating Game, at The Weekly Standard. While I read the book The Game and found it to be amusing, the most interesting book I've read on the subject, though it wasn't really on the subject, is a little-known out-of-print book by Dr. Robin Baker, Sperm Wars: The Science of Sex. Because it's out of print, new copies are going for about $600. I'm primarily writing this becasue I recently found that this great book has been reissued as Sperm Wars: Infidelity, Sexual Conflict, and Other Bedroom Battles.

Sperm Wars is all about sex. Baker uses sexually charged stories to setup scenarios, and then explains the significance of each scenario in the context of evolutionary psychology. Baker covers everything, from masturbation and routine relationship sex, to female bisexuality, manual stimulation at the start of a relationship, and infidelity. The books namesake, Sperm Wars, are covered in great detail. Essentially, when a woman sleeps with multiple men, the 99% of their sperm that aren't capable of fertilizing the egg fight to the death to outflank the challengers. Fascinating stuff.

The heart of the book, to me, was the manner in which Baker tied the underlying evolved drives to the outward actions that people are intimately familiar with. For instance, Baker explains that men and women tend to sleep together less frequently, but more routinely the longer they've been in a committed relationship because it's only necessary for the man to "top-off" (his words, not mine) the woman, as his sperm can survive inside of her for about a week.

Baker's scenarios and explanations made it easy to extrapolate why people do what they do in practice, even if it's not immediately obvious. It doesn't make much sense for a woman to cheat on a man that she's happily in love with, unless you consider that she's overwhelmed with a subconscious desire to mate with a partner as fit as possible. Just as it's not easy to see why Tiger Woods would trash his name so thoroughly, unless you consider that a part of the desire for success is the in-built male desire to procreate as much as possible. Procreation for males leads to evolutionary success, whereas for women, it's much more complicated and refined.

The woman must not only conceive a fit child, but also raise them, at least from an evolutionary standpoint. The author asserts that unlike some apes, there is no outward sign that a human female is ovulating, so she is able to subconsciously control when she mates with different men, to control who fathers her children. Baker backs this up with the somewhat sobering statistic that 10% of the men that children call "dad" aren't actually their father.

All in all, Sperm Wars is an excellent book that I would recommend to anyone that is anxious to learn why people do the irrational things that they do. It could change your whole perspective, and may even have you questioning some of your own actions.

On $400 Hammers, $100 Bolts, and Cost-Plus Contracting

Posted by jcnnghm Sun, 14 Feb 2010 22:41:14 GMT

There are many misconceptions relating to government contracting, especially amongst technologists, so I thought I would take this opportunity to clear some of those confusions up.

I once bid several cents per e-mail to send out thousands of e-mails a month for a government organization. Ridiculous, right? Anybody can run sendmail in a colo for $100 a month. What the actual term of the agreement doesn't say, is that the e-mails were to be sent from an application we were to develop with features unique to the organization, and the e-mail addresses were to be collected using a marketing website and software package that we were to construct, maintain, and promote. We also had to provide two dedicated T1s, four dedicated servers, a load balancer, as well as design and produce all the print marketing materials to promote the new service. All of these things were included in the contract, but we were only paid per e-mail sent. Things aren't always as they appear at first glance.

In the case of the bolt, it's not an ordinary bolt. Normal bolts are never individually tested, a single bolt from the lot is taken and destructively tested. In the case of the expensive Department of Defense bolts, they are generally one of a kind, limited production, bolts designed for one purpose. In addition, they are generally non-destructively tested, which means that they are each individually subjected to the forces that they are rated for, and then examined. This is expensive.

For the hammer, the situation is similar. The price was inflated because of the equalallocation formula in use at the time. "The equal allocation method calculates prices for large numbers of items in a contract by assigning "support' costs such as indirect labor and overhead equally to each item. Take a contract to provide spare parts for a set of radar tracking monitors. Suppose a monitor has 100 parts and support costs amount to a total of $100,000. Using the equal allocation method each part is assigned $1,000 in such costs, even though one item may be a sophisticated circuit card assembly, which requires the attention of high-salaried engineers and managers, and another item may be a plastic knob. Add $1,000 to the direct cost of the part and you get a billing price. This is what the government is billed, though not what the part is really worth--the circuit card being undervalued, the knob being overvalued. The need for billing prices arises because contractors want to be paid up front for items that are shipped earlier than others." (from The case for the $435 hammer.)

As far as "cost plus" goes, there really isn't a better way to do what it does. Whenever I bid a contract I estimate cost, then add profit and that is the price. In the case of the e-mail contract I described above, I calculated the cost then decided on a fair profit. After that, I made best case, worst case, and average case estimates for e-mail volume. I ended up basing the per e-mail bid on the worst case number of messages sent. In other words, the bid price was ((cost + [slightly less than fair] profit) / worst case estimate). Had we won the contract and not gotten close to the worst case, the profit would be substantial. Had it been a "cost plus" contract, it probably would have been less expensive for the government overall, however, the risk would have been theirs, not mine (if our software was ineffective or underused, we could have potentially lost money).

Cost plus is most often used when something has to be built that is either difficult or impossible to estimate. If I were to ask you to build something that nobody has ever built before, and intended to have you sign a contract saying that you would construct it for that price, you'd probably greatly overestimate the actual cost, because you would have to make sure you don't end up too far in the red. The costs are evaluated and approved by an oversight group (like government engineers), so they can make sure project costs are really necessary. In addition, the records are audited and unnecessary cost is often disallowed. Cost plus isn't perfect, but it's less expensive in the long run then having the contractors make guesstimates then inflate them to deal with the risk and uncertainty.

In the long run, the single most disingenuous thing I've seen in government contracting is the blatant racism and sexism. Females and minorities are given preferential treatment because of their race or gender. Depending on the contract, their price proposals are also evaluated differently as well, often getting a 5% discount. In other words, a $100k bid placed by a Minority-owned business will be read as $95k when compared to other bids. The process is not only unfair and discriminatory, but can result in less qualified firms winning contracts on the basis of quotas.

In the end, the ultimate check and balance is the openness of the process. Anyone can put their money where their mouth is, start a company, and win some contracts. All you've got to do is demonstrate that you can do the work, and bid low.

My Power Duster

Posted by jcnnghm Wed, 10 Feb 2010 12:40:00 GMT

Power Duster Compressor Close
Roomba Red Roomba Red
Power Duster Compressor and Hose

My workspace has been getting dustier and dustier, so I have been wanting to do something about it. I've used canned air in the past, and that seems to work pretty well for clearing my electronics of dust. Unfortunately, the canned air pressure seems to rapidly decrease while it's being used, and the bottles don't last very long at all.

I started investigating the use of an air compressor for cleaning electronics, and a big concern was water condensing in the air lines and shooting onto the electronics that are being cleaned. I learned with some additional research that this problem also occurs when painting with compressed air, so there are a number of techniques for dealing with liquid in the air. Satisfied that I could deal with the water issue, I started looking for a compressor.

I settled on a DEWALT D55140 Heavy-Duty 1-Gallon 135 PSI Compressor. I selected this particular compressor because of the relatively low price and positive reviews. In particular, this model is supposed to be quieter than others, and I've had positive experiences with DeWalt tools in the past.

I also decided to buy an accessory set with a gun attachment and a 25' coil airhose. To deal with the water issue, I purchased an Air Dryer Kit. I placed one of the desiccant dryers at the compressor, and the other at the end of the hose just before the air gun. The desiccant balls turn from blue to pink as they absorb water so it's easy to see that they're working, and the state of each filter.

With this combination of compressor and accessories, I'm able to maintain 80psi bursts of dry air to knock the dust off of my electronics. It does a very, very good job of quickly knocking the dust off of my stuff, and onto the floor.

From there, I use my old Roomba to pick the dust off the floor, and move it out of my office. If you've never used a Roomba before, it's worth checking out. I have both a Scooba and a Roomba, which I run every day. They do a great job of keeping stuff clean.

The total cost for the compressor and the related parts was about $240. I'm pretty happy with the setup so far. It's definitely resulted in less dust being in my office.

Why Most People Think Memorizing Historical Facts is Useless (and Why It Actually Is) 5

Posted by jcnnghm Tue, 09 Feb 2010 18:46:00 GMT

An article, Why Most People Think Memorizing Historical Facts is Useless (and Why It Actually Isn't), was making the rounds yesterday. I strongly believe that the author is wrong, memorizing historical facts is useless, and so are History classes in general, as they are taught in the United States.

Knowing who someone was, where something happened, and when it happened are all essentially useless unless you know what happened, and why it happened. Unfortunately, I was never able to comprehend why I really enjoyed reading about history, but why I hated history classes. I figured out exactly what the problem was when I first read my favorite book of all time, The 48 Laws of Power by Robert Greene. In The 48 Laws of Power, Greene goes to great lengths to describe what leaders throughout history did to obtain, or lose, their power, and why they acted in the way that they did. The really fascinating part about history is all in the why. Why did they do that?

As History is taught in schools today, it's just a series of titles connected to events. Match Year X with Event Y. It is worthless. If you teach why's, and not just the who's and when's, all that other stuff falls into place, because it's contextually vital. If you care about why something happened, you'll understand what happened and who the major players were.

By far my favorite "character" in Greene's book, Charles Maurice de Talleyrand-PĂ©rigord (Talleyrand), was never mentioned in any history class I have ever taken. Talleyrand, a French diplomat, was intensely interesting, especially with respect to his interactions with Napoleon. Talleyrand actually collaborated with the British to allow Napoleon to escape from the island of Elba, which he had been exiled to after his failed invasion of Russia. Talleyrand firmly believed that Elba was too close, so he worked to convince the British that this was the case, and that if they let Napoleon escape now, he'd quickly enter a war where he'd be defeated and could be sent further away. Napoleon "escaped", and did indeed lead France into war again, where he was defeated at the Battle of Waterloo, and was exiled off the coast of Africa for the remainder of his life.

The real tragedy is, I'd never heard of Talleyrand until I read Greene's book. In college, I was tasked with writing an essay on Napoleon in a European History class, and decided to cross out the question posed by the professor, and construct and answer my own. I couldn't remember the facts I was supposed to, but I could remember and construct an essay on Talleyrand, which was good enough for the professor to give me an A, noting that it's not usually a good idea to disregard essay questions unless you have something really interesting to write about.

If a story is interesting and relevant, because you understand why something happened, you'll remember what happened. It is a big part of why. Take, for example, the story of the con artist Victor Lustig, famous for selling the Eiffel Tower. Lustig was able to play on Al Capone's desire to interact with someone of integrity to con him out of $5,000, a rather brazen act. Lustig approached Capone and asked him to invest $50,000, which he promised to double. Lustig returned in 2 months, and returned the $50,000 to Capone, along with a story of the hard times he had fallen on. Capone was shocked, and told Lustig that he had expected him to either return $100,000, or nothing, and confessed that he knew he was a con artist. So impressed by Lustig's honesty, Capone gave him $5,000 to help with his situation. There never was any investment deal, Lustig left the money in a safety deposit box for the two months. The con was all a play on Capone, who longed to deal with a man of integrity, since he was constantly surrounded by those who had none. This story is easy to remember, because it's easy to see why the actors did what they did.

After reading Greene's book, I became convinced that history education is all wrong. Why things happen, and why people do what they do, is intensely interesting. When they happened is boring and irrelevant. Not teaching why things happened dilutes the value of history to such an extent that it's worthless as it is. It serves no purpose, it must be fixed or abandoned.

How I Learned to Love Monitor Arms

Posted by jcnnghm Sun, 07 Feb 2010 17:08:00 GMT


My Desk


Moved out of the way


Pushed Away from the side


The Arm Structure


Sleek Appearance


Beefy MX Arm


All the stuff that's not on my desk anymore


Windows Monitor Settings

I recently added a 30" LG Monitor to my 3-monitor setup. Originally, I had intended to replace my 24" Viewsonic widescreen, but when I started considering it seriously, I began to see the utility in having a forth monitor, instead of just a larger third.

I was initially unsure of how I would accomplish this, but I had seen a 3M Monitor Arm in Office Depot, so I thought I'd buy it and try it out. Unfortunately, the 3M arm didn't have the lift that I really wanted, so I returned that arm and started searching online for other options. I came across the Ergotron Single Desk Mount Arm and the Ergotron Dual LX Monitor Arm. My thought was that I'd be able to purchase a dual arm, and mount both monitors on the left side of my desk on the arms, one above the other.

Once the dual arm arrived, I was able to get it setup in about 30 minutes. I was somewhat surprised at the ease of the setup. I had to unmount the other monitors from their stands, attach the monitor arms, secure the base to my desk with the desk clamp, and route the wires through the arms. The hardest part was removing the stands from the existing arms, and that wasn't very difficult. I did have to adjust the tension of each arm because of the weight of the monitors. All in all, I was very impressed with the ease of the setup process.

After a day of using the arms, I was so impressed that I ordered a second set for the monitor on the right side of my desk, and the Mx Desk Mount LCD Arm for the center 30" panel. The setup of the 30" monitor was a little more difficult than the smaller panels, but that's largely a function of the size and weight of the display. The desk clamp for the MX arm is larger than the other, and seemed very secure to me. The MX Arm is very solidly constructed, and has no problems whatsoever keeping the large display in place. I wouldn't attempt to use it with a smaller display, it really is designed for heavy displays, and the smaller arms do a fine job.

The cable management system of the arms is very well designed, and actually seems to work. I upgraded all of my DVI cables and power cables during this process to either 10 or 15ft so that the monitors positions could be easily adjusted, so the cables are rather large and inflexible, yet the cable management system still worked fine.

While I originally wanted the arms only to allow the two displays to be elevated, as soon as I got them installed I realized that I had needed these arms for some time, I just didn't know I needed them. For starters, they make dusting my desk significantly easier, as the monitors can be easily repositioned out of the way. Additionally, the appearance of my desk is cleaner than it was before, with the arms really improving the visual aesthetics of my work area; it looks much cooler and more high-tech now, and that counts for something. The arms have also made it easier to reconfigure the display configuration for specific situations. I'll occasionally shift one of the monitors to landscape view, and the arms allow any of the monitors, even the 30" display, to be transitioned.

From a productivity standpoint, I've got 4,096,000 reasons to be happy with this upgrade. The 2560x1600 resolution of the large display allows me to display either 2 or 4 files, plus the filesystem tree, in my IDE simultaneously. This has greatly enhanced my coding productivity. WIth the other three display, two 1600x1200, and a 1680x1050 display, I have a total of 9.7 million pixels to work with. In the upper left I usually keep my email, iTunes, and my project management software open. On the right hand side I usually have a web browser open with the stuff I'm working on. In the lower left I usually have a bunch of SSH windows open, tailing files, running irb, cucumber and autospec. In the center I'll keep my IDE or anything I'm actively working on. This allows me to keep everything I'm currently working on open and on top, so that I can reference things without having to move or change any windows. In particular, it's nice having autospec always running on my project so I can glance over and see any regressions.

All in all, I'm extremely happy with the monitor arms. I estimate the upgrade cost about $600, and my only regret is that I didn't make the investment sooner.

Three Years of Liberty

Posted by jcnnghm Sat, 06 Feb 2010 23:21:00 GMT


Liberty Chair

Worn Out Seat

At My Desk

About three years ago I purchased a Liberty Chair by Humanscale. The chair hasn't held up as well as I would like. With the Vellum cover and the Gel seat, the seat cover has started to tear. This chair was very expensive, about $1,000, and I would not have expected the seat cover to deteriorate.

All in all, I still think it's a comfortable chair, and it's definitely allowed me to log lots of hours in relative comfort. If you're in the market for one of these chairs, you may want to get this chair with leather instead of vellum, since that will hold up better. It's probably also worth considering another brand.

I think the Aeron chairs are probably just as comfortable, and more durable.

Headless Selenium Screenshots with Cucumber 3

Posted by jcnnghm Wed, 30 Dec 2009 11:24:00 GMT

 I was finally able to get Selenium integrated with Webrat and Cucumber on my Linux development server.  I followed this excellent guide to setting up the selenium server to run headless.  This enables me to run my tests without actually seeing the Firefox window.  This does, unfortunately, make debugging a bit more difficult.

Because of that, I created a Cucumber step to save a screenshot of the webpage in the tmp/screenshots folder.  This includes the entire page, not just the viewable portion.  Not only does this simplify debugging, but it also makes it trivially difficult to capture a large number of screenshots from the testing framework to compile visual reports.  I believe that making sure everything looks right is as much a part of testing as making sure it actually works.


Then /^I save a screenshot with filename "([^\"]*)"$/ do |filename|
  selenium.capture_entire_page_screenshot(File.expand_path("tmp/screenshots/#{filename}.png"), "")

Set Restriction Info with Facebooker 1

Posted by jcnnghm Tue, 22 Sep 2009 11:03:00 GMT

I’ve been working on a Facebook App and I was trying find out exactly how to go about setting content restrictions with Facebooker. While the documentation for the Admin.setRestricitionInfo API call is pretty clear, the Facebooker documentation is less clear.  It looked to me at first glance that the Facebooker::Admin.set_restriction_info method would have to be called with every request.  This seemed terribly innefecient to me, so I tried some other methods out until I found something that worked. In config/initializers, I created a facebook_permissions.rb file, and inserted the following code:

Facebooker::Admin.new(Facebooker::Session.create).set_restriction_info(‘type’ => ‘alcohol’)

This code will run every time your server starts, updating your application restriction settings.  Run the following command from script/console to double-check that the restrictions are being set correctly:


Select Random Rows Using Ruby On Rails

Posted by jcnnghm Fri, 07 Aug 2009 00:59:00 GMT

Today I was looking for a way to randomly select rows from a database using Rails. I implemented the following message, which will randomly select a specified number of random rows, or as many rows as are available if the requested number is greater than the available number.

def find_random(random_count, options = {})
  if random_count > count(options)
    find_every(options.merge({:offset => rand(count(options) - random_count + 1), :limit => random_count})).sort_by{rand}

The code first attempts to determine if there are enough records to randomize. After that, it randomly selects an offset and returns the specified number of rows at that offset, after randomly sorting them. The benefit that this has over the other methods, is that it should scale well with very large data sets. The downside is, of course, that the are sequential from the given offset. In my situation, this works fine. Depending on what the data is used for, this may not work well for you. If that is the case, the approach I would take is to randomly generate a number of offsets, and select individual records at each offset. This should perform reasonably quickly as long as only a random items are selected.

Rails Forum Plugins 2

Posted by jcnnghm Thu, 06 Aug 2009 00:09:00 GMT

 I’ve been looking into adding some forum functionality into my Baltimore and Annapolis bars website.  While I was researching different forum implementations to find out what kind of forum I’d like to have on the site, I came across a couple of rails plugins that will take care of all the heavy lifting.

First is Savage Beast, the second version of a plugin designed specifically to add forums to Rails sites.  While Savage Beast is functional, it doesn’t appear to be actively updated.  It was forked a few months ago to bring it in compliance with Rails 2.3.  Unfortunately, as of this writing, that hasn’t been completed yet.  Savage beast is definitely worth watching, but at this time I think it would take too much work to get it production ready.

On the other hand, we have Community Engine,  Community Engine uses the Engines plugin, now integrated into rails, to add all kinds of social networking features into your rails project.  In addition to forums, the plugin brings user profiles, blogs, photos, and a messaging system.  The plugin has a ton of github activity, forks, and followers, and is definitely under active development.  Even better, the plugin is already Rails 2.3 compliant.  The only apparent problem with Community Engine is how many features it really has.  I have a feeling it could be quite difficult to integrate the software into an already-developed website.

I intend to begin integrating it over the next few days, and I’ll keep this up to date with how it’s going.