Monday, July 23, 2012

The Perfect Woman

Yesterday my wife asked me to envision the perfect woman and then make a list of her virtues. She pleaded with me to have an open mind and not let it become a list of virtues she has or a list of virtues I wished she had. Here is what I came up with; order has no significance.
  • Loving, capable of being a mother to anybody, but not pron to spoiling
  • Faithful, spiritual, prayerful
  • Graceful
  • Intelligent in conversation, but not determined to win arguments
  • Humorous, but not raucous
  • Musical
  • Humble, but not shy or awkward
  • Confident, but not prideful
  • Capable of leading, but never desiring to [1]
  • Understanding of human emotions
  • Socially proper
  • Organized but no OCD
  • Capable of cooking every day without the family tiring of her food [2]
  • Frugal
  • Long hair [3]
"A virtuous woman is a crown to her husband" - Proverbs 12:4

[1] The wife in Legacy is the best example I can think of. She's able to take charge when she needs to.
[2] This doesn't mean she has to cook every day, just that she could if needed to.
[3] I added this after my wife pointed out that I didn't have any physical attributes in the list. I didn't think I needed any, but then I realized I always envision good women as having long hair.

Friday, July 13, 2012

My Mysterious Double Cron

One of the websites I manage at work has a cron associated with it that ran every Monday morning at 1:00 AM to process outstanding invoices.
0 1 * * 1 php cron_script.php >> cron_script.log 2>@1
The script worked beautifully until June 18 when everyone who was charged was billed twice. I first thought my script must have a bug, but further inspection proved that wasn't the case[1].

The output log only had one entry for June 18, so I was inclined to blame it on network errors[2].

But most signs showed that the cron had run twice, at almost the exact same time. I was reluctant to accept this because cron is a stable library, but the evidence was overwhelming. The order of the double-charge pairs was perfectly sequential.
11223344
If both executions weren't at almost the exact same moment you would see something more mixed.
12132434
We could see that from the responses we get back from our credit card processing company and store in the database, information stored in the eCommerce software to show customers when they were charged, and history that our credit card processing company keeps.

So the cron ran twice but logged its activity once. After much debate, the only plausible solution we could divine was that the NTP update script also ran at 1:00 AM and caused the clock to drift backwards a few hundred milliseconds and repeat 1:00 AM. We could explain the log file having on entry by assuming the first execution obtained an exclusive lock on the file.

But then I did some research and found out that NTP almost never drifts the clock backwards (especially not for such small intervals as we were expecting) and redirecting output in the shell to a file does not lock the file.

Our theory was sufficiently busted, and now we have no possible explanations for both anomalies:
  • How did the cron run twice at the same time?
  • Why did the output only get written to the log file once?
Surely it must have been cosmic rays.

[1] Technically my script did have a bug in that it allowed people to be billed twice if the script ran twice at the same moment. That has since been fixed by applying an exclusive lock to the logfile. But I realize now that the fix is insufficient. I have a better idea.

[2] We have had other problems related to network errors between us and our credit card processing company. My inclination to blame the network wasn't random.

Wednesday, April 11, 2012

The Innovator's Framework

The most shocking conclusion of Clayton M. Christensen's The Innovator's Dilemma is that good managerial practices can lead a company to failure when dealing with disruptive technologies. Good managers lead companies by pursuing high profit margins and delivering what their customers want. But Christensen proves that those methods only work for sustaining technological development and not for developing disruptive technology. That is revolutionary. Christensen clearly explains how to avoid the same failures that Sears, Woolco, and many other companies have experienced.

Christensen also offered an eye-opening explanation of the migration of capabilities within a company. It explains why resources are more important to a startup while process, values, and culture are more important to a mature company. I thought about my experience at a startup where I work. When I joined two years ago, there was no process -- for anything. The three programmers sat in a room next to each other and just coded. Now we have bug lists, version control, and development environments. Our values are also starting to coalesce into a company culture. I enjoyed being influential in the development of that culture. But it will be time for me to get a new job when this period of development ends and employees become just another programmer.


Monday, April 2, 2012

Developing Useful Talents

I played a lot of video games when I was little boy. I spent many hours on classics such as Road Rash II, NFL Blitz, Super Mario World, and Mario 64. But then I grew up and realized how much video games waste time and money. Any benefit which video games may provide can be obtained through cheaper and more fulfilling means. Yes, video games can be avenue for socializing in person, but they aren't the best avenue. At least games like Boggle and Scrabble enhance a skill worth having. Instead of idling away our time and money we should be developing useful talents.

Tuesday, March 27, 2012

Privacy on the Internet is a Fallacy


Privacy on the internet is a fallacy which we need to stop pursuing. Somehow we have allowed consumers to believe that their personal information is safe, secure, and private on the internet. Consumers have no problem knowing that friends of friends can freely stalk them, but riots ensue when personal information is mined by Google to enhance their user experience. This is akin to announcing an engagement in Relief Society and expecting the news to stay there. Ignorance is the sole cause of this illogical behavior. We must stop allowing ourselves to be deceived by the fallacy of a private internet.

Wednesday, March 14, 2012

The CS Gender Gap is Natural

It is well known that computer science is a male-dominated field. After much research, the most reasonable cause for this phenomena is that women just don't enjoy tinkering with gadgets. The proposed solution to the gender gap is to change computer science so that tinkering is not required. This would be accomlished by teaching computer science more like mathematics. That could tear down some barriers for women, but what about the effect it would have on the men? Lets take another step back and ask, why is the gender gap a problem? A lot of research was done in order to prove whether social injustice was the cause. But now we know the culprit is more natural and we can rest at ease.

Tuesday, March 13, 2012

A Respectful Forum

We often hear general authorities suggesting that we use social media as a means for sharing the gospel. I have two options for reaching out to my friends (based on what services they use): Facebook or a blog. I had a blog that I updated regularly before my mission. Many of my friends, and a few random people, were faithful readers. But the internet has changed in the 5 years since I stopped blogging; I don't think I could get the same audience I had before. I am left with Facebook, but that is treacherous ground. When people want to participate in a respectful and meaningful exchange of ideas, they don't turn to Facebook. Most of the people who discuss politics and religion on Facebook are passionate and obnoxious fiends. I, like many others, quickly unsubscribe from most updates of those radicals. The last thing I want to do is force all of my friends to ignore anything I say.