Friday, December 28, 2012

Berkey water filter extension

Child's parents visited for the week before Christmas.  Like us, they have a Berkey water filter. 

However, it has a shortcoming.  When the fluoride filters are installed to the base of the top receptacle, they go so deep into the bottom receptacle that the water will only fill up a few inches of the bottom receptacle.

Child's mother suggested a solution.  If the top receptacle could be lifted higher, it would allow more water to collect in the bottom receptacle.

While at Home Depot on a different errand, I noticed a duct that seemed like it would perfectly fit the bill.  
Master Flow 8 inch Starting Collar Take Off - Snap Together
Worm gear clamp. Two 4" diameter = one 8" diameter

 A quick call to Child confirmed that the diameters were the same, so I bought it, along with two four-inch-diameter worm gear clamps that I could attach together to make one eight-inch-diameter worm gear clamp.  It worked great.

Final product:

Monday, December 24, 2012

Room Cleaning

I'm about to clean my office.

I know, readers are recoiling in shock.  "Drek, clean his office?  The Mayan's must have been three days off from their end-of-the-world prediction!"

Yeah, yeah.  It needs it, though.  Child's parents have been visiting, so she and I have been sleeping on an air mattress in my office, which added to the already-hefty clutter and reduced my in-room mobility and therefore my already-low motivation to put things away properly.

But this time I have a plan!

For each item, I'm going to analyze it, determine if it has a proper location, and create one if not (rather than tossing it into a corner). 

In addition, I'm going to compromise with my lazy tendencies and find a least-effort approach to keeping the room tidy in the future.  Larger trashcan, more hangers, open box to catch once-worn teeshirts that are too clean to throw in the laundry basket but too time-consuming to fold (I said I was lazy).


In our church, members pay 1/10 of their "increase" (defined however the individual members choose to define that) as tithing.  As clerk of the local ward, I occasionally see the amounts people pay as tithing. 

I have two primary reactions.  The first is when I see a large amount of tithing:  "Wow, s/he makes that much money and still pays tithing?  I'm impressed at his/her dedication!"

The second is when I see a small amount of tithing: "Wow, s/he is on that tight of a budget and still pays tithing?  I'm impressed at his/her dedication!"

In short, paying any tithing is a manifestation of faith, whether you give of your wealth or give a widow's mite.  There's no dollar limit, high or low, to the Lord's blessings.

Wednesday, November 07, 2012

Election results

Well, the election is over.  My overall feeling about the result:


I'd feel worse about Mitt Romney losing if he hadn't been so unrelentingly negative the entire campaign.  Seriously, take some of that time you spent accusing the president of making mistakes and actually tell us how you'd fix them, rather than just telling us you would.

That, and Romney's abrupt shifts of policy when he decided to run for president.  Changing your opinion when new evidence or points of view are presented is one thing, and I'm 100 percent in favor of that.  Doing so when you think it will play better with potential constituents is another matter entirely.

Sure, I think Romney would have done a far better job than Obama in turning the economy around--after all, business was his business--but he was far from a candidate that I enjoyed voting for.

I think I'll add a project to my to-do list.  I'd like to write up a high-level view of the platform I'd enjoy seeing a candidate run on--or that I'd run on myself if I ever decided to run for president.

Thursday, October 11, 2012

Compiling a single kernel module

On (the fortunately rare) occasion, the need arises to modify a Linux kernel module/driver.  I finally found a helpful blog-post that gave a walk-through on how to compile a single kernel module without necessitating recompiling the entire Linux kernel.

Following are the steps I took to modify the xpad driver (used by xbox controllers), along with a few clarifications of the original blog post I follgowed.  Anything in bold, you'll want to tweak for your own system.

0. I'm assuming that you've already downloaded Linux source and modified the file(s) you need.  In my case, I was tweaking "/usr/src/linux-source-2.6.32/drivers/input/joystick/xpad.c".

1. Make a working directory to hold your new module when it's compiled, along with overhead needed by the compilation process.  I chose to name my directory "xpad" since I was specifically modifying the xpad driver.

$ sudo mkdir /usr/src/xpad

2. Copy in a few necessary files:

$ cd /usr/src/xpad 
$ sudo cp /boot/config-`uname -r`  .config
$ sudo cp /usr/src/linux-headers-`uname -r`/Module.symvers .

3. Move to your source directory and run some "make" commands to prepare your working directory.

Note that EXTRAVERSION should be whatever follows the first three numbers when you run "uname -r".  For example, if running "uname -r" results in "2.6.32-43-generic", EXTRAVERSION would be "-43-generic".

$ cd /usr/src/linux-source-2.6.32
$ sudo make EXTRAVERSION=-43-generic O=/usr/src/xpad oldconfig
$ sudo make EXTRAVERSION=-43-generic O=/usr/src/xpad prepare
$ sudo make EXTRAVERSION=-43-generic O=/usr/src/xpad outputmakefile
$ sudo make EXTRAVERSION=-43-generic O=/usr/src/xpad archprepare
$ sudo make EXTRAVERSION=-43-generic O=/usr/src/xpad modules SUBDIRS=scripts

4. Make your specific module.

In my case, I tried first to make just the xpad module.  That resulted in an error indicating that there wasn't a Makefile specifically for the xpad module.

First, unsuccessful attempt:

$ sudo make EXTRAVERSION=-43-generic O=/usr/src/xpad modules SUBDIRS=drivers/input/joystick/xpad

/usr/src/linux-source-2.6.32/scripts/ /usr/src/linux-source-2.6.32/drivers/input/joystick/xpad/Makefile: No such file or directory
make[2]: *** No rule to make target `/usr/src/linux-source-2.6.32/drivers/input/joystick/xpad/Makefile'.  Stop.
make[1]: *** [_module_drivers/input/joystick/xpad] Error 2
make: *** [sub-make] Error 2

There WAS, however, a Makefile that built all the joystick drivers at once, so I fell back to using that.

Second, successful attempt:

$ sudo make EXTRAVERSION=-43-generic O=/usr/src/xpad modules SUBDIRS=drivers/input/joystick

This generated, among other files, a .ko file, my modified kernel module.  The new modules will be located in the working directory you created in step 1 (in my case, "/usr/src/xpad/drivers/input/joystick/xpad.ko").

5. Make a backup of the original kernel module, just in case (of course impossible) that there's a bug your new module.

$ sudo cp /lib/modules/`uname -r`/kernel/drivers/input/joystick/xpad.ko /lib/modules/`uname -r`/kernel/drivers/input/joystick/xpad.ko.bak

6. Copy in your new kernel module:

$ sudo cp /usr/src/xpad/drivers/input/joystick/xpad.ko /lib/modules/`uname -r`/kernel/drivers/input/joystick/xpad.ko

7. Reload module dependencies:

$ sudo depmod -a

8. Remove the old module, just in case it's currently loaded:

$ sudo modprobe -r xpad

9. (Unplug and) plug in your device to trigger a load of your new module!

Closing thoughts:

To simplify repeated compiling of the code during development, I dumped the pertinent commands into a script I could run:

cd /usr/src/linux-source-2.6.32
sudo make EXTRAVERSION=-43-generic O=/usr/src/xpad modules SUBDIRS=drivers/input/joystick
sudo cp /usr/src/xpad/drivers/input/joystick/xpad.ko /lib/modules/`uname -r`/kernel/drivers/input/joystick/xpad.ko
sudo depmod -a
sudo modprobe -r xpad

Saturday, September 22, 2012


In August, my uncle planned a canoe trip to the Boundary Waters Canoe Area (BWCA) in Minnesota.  I talked my coworker Jon into joining me, and on August 4 (Friday, Day 0) we flew from San Diego to Des Moines, Iowa, arriving Saturday morning.  

Day 1

Shortly after we arrived, a huge thunderstorm swept through Des Moines, cancelling the flight directly after ours.  Since I was under the storm instead of circling over it in an airplane, it was rather enjoyable, and reminded me how much I missed the Midwest thunderstorms.  I just haven't seen anything to compare with them further west.

My uncle and aunt live in Missouri, so they swung by the airport on their way north and picked us up.  Along with them were two of their sons and two friends.  We had an all-day drive to Ely, Minnesota, and there were sprinkles much of the way up.  It made me wonder what the weather was going to be like on the canoe trip itself, and I was a little worried that the outlook was "heavy character building, tapering to light grumbling by mid-week."

That night we checked in with the outfitter we were renting the canoes from.  They gave us a DVD titled "Leave No Trace," explaining how to have a minimal impact on the terrain we'd be crossing.  We watched it on a portable DVD player at the hostel where we spent the night.  At one point in the video, there was a head-shot of a moose, and one of the less outdoorsy friends saw the large ears and wondered if it was a kangaroo.  From then on, we kept our eyes out for "kangamooses," but they seemed fairly scarce where we were.

Day 2

Launch day dawned cool and clear.  Breakfast was a delicious combination of the normal breakfast food and leftovers: bacon, ice cream, pancakes, and salad.  We had been joined the night before by a cousin, her husband, and another friend, and after breakfast, we all drove to launch point 14.  We were well prepared, with enough gear to outfit the entire US Navy for an extended deployment into unfriendly waters.  

The food bag allocated for my coworker and me for the week-long trip held as much food as my normal monthly consumption.  It was good wilderness food, most of it boxes ending in the word "Helper," but there was also some cleverly packaged ground beef, salted and bagged to survive without refrigeration.  Simply rinse and serve, with enough salt left behind to nicely flavor.

Last touch of civilized ground.

As automobiles are not good at floating, they were exchanged for canoes at the launch point.

My allocation of gear.  Not shown: one 32-foot canoe.

Arriving at our first night's destination.

Late that afternoon, we set up camp.  It was a good site on a rocky ledge just off the river, with plenty of scenery to go around.  Mo and Eric took the opportunity to wet their fishing tackle, with Eric disclosing that he had never in his life caught a fish on a pole.  Spear gun, net, bare-handed, yes, but never on a pole.  It was his curse, but one that the group was determined to help him break.

He was given a choice between a hook with a squirming leech on it, and one with a lure.  When presented with a leech, no matter what the context, there's really no choice, and he stuck (get it? ha ha!) Mo with the leech, taking the lure himself.  He and Mo spent the next hour fishing, but Mo got her revenge by catching the first fish.  At that point they switched rods, and balance was maintained by Mo also catching the second fish, bigger than the first.

Eric returned to camp skunked, but his spirits remained high.  He had an entire week to break his curse, and in waters that BWCA brochures clearly stated "teemed" with fish, how hard could that be?

First catch of the trip!

Victory!  (Not Eric's.) A northern pike?
The young ("noisy") complement of attendees left later that evening for a second campsite across the lake.  Much character was built attempting to hang a bear bag in pitch darkness on a steep, brushy hillside.  It involved a rope that was about ten feet too short, holding flashlights in teeth, and climbing sappy pine trees in sandals.  In the end, the bag was left tangled halfway up a pine, safe from any bear that was lame, blind, under four feet tall, or prone to hysterical fits of laughter at the sight of a "bear bag" put up at 10 pm at night by someone holding a flashlight in his teeth, climbing a tree in sandals, and using a rope that was ten feet too short.

Day 3

Our first morning in the wilderness dawned as beautiful as the day before, and the bear bag had been unmolested.  After the amount of effort that had gone into putting it up, it will be admitted that there was a small amount of disappointment.

Interest was expressed in shouting capitalistic slogans at our neighbor to the north, and accordingly the canoes were loaded for a Canadian visit.

Camp life was rigorous and deprivations abundant. Note the complete lack of gently-waving palm fronds and grapes.

This is neither apple juice nor cooking oil, as speculated by observers.  In fact, it was our drinking water, post-filter.

Canada's first line of defense: cleverly positioned dams built by carefully trained beavers.

An interesting, but less-effective canoing technique: sinking the canoe.

Creating small outposts of American soil by throwing American rocks into Canada.

Arriving at Canada, we hurled rocks and sneered at socialism while secretly longing for cheap health care and a culture of polite deference.  While attempting to plant a flag on Canadian soil, a party member fell from his canoe and inadvertently became an illegal alien for a brief period of time before being quickly retrieved.

Overall, it was a successful trip and we returned to camp flush with victory.  Dinner that night was Orange-mush Helper (as opposed to the Gray-mush Helper from the night before.)  Dessert was a distant lightning storm in cumulonimbus clouds glowing orange in the setting sun.

Day 4

Another beautiful morning.  If character was to be built, it wouldn't be from poor weather.  Instead, portages would be used: stretches of what us mariners colloquially refer to as "land" that divides passable sections of water.

Portages have an interesting property of being uphill no matter which direction you are traversing them.  In addition, fallen trees carefully position themselves at a height such that they're too high to step over, but too low to walk unimpeded under.  Instead, they require the portager to bend their knees and walk at a half-crouch with a 55 pound canoe on their shoulders, using two hands to balance the canoe and swatting mosquitoes out of their eyes with a third.  On the far side of the fallen tree is a large mudhole sprinkled with just enough rocks to let you think you can step across carrying your 70 pound canoe, but the second-to-last rock is jiggly and will cause you to slide into the mud, doing a variety of Russian squat-kicks in an attempt to stay upright with a 100 pound canoe on your shoulders.  By the end of the portage, you hope the kevlar-reinforced body of your 150 pound canoe is as strong as advertised because you're dropping it like a ton of bricks.

Sherpas were available on select portages and took payment in granola bars.

At one point we crammed 6 people (5 pictured + photographer) into a canoe, bringing back memories of college dorm rooms past.

Another group of people were scheduled to join us, so one of our canoes returned to the entrance point to meet them. Along the way they discovered a rucksack of food lying forgotten by a portage, left by whom we shall not say, except that in our defense Jon and I had a lot of other group gear in our canoe and had assumed that someone else had grabbed the rucksack.

It will be an indication of how much food was brought that the missing food had not been noticed, and probably wouldn't have until the end of the trip, except that our choice of Helpers would have been more limited.

Also, the realization that a bag full of food had been lying on the ground for three days with no ursine consequences left a vague feeling of dissatisfaction with the amount of effort we had gone through to get our bear-bag into a tree.  That night's effort would be much less enthusiastic.

With the new crowd, we moved camp to an island on Shell Lake.  Again, the group split up, with the older, more decrepit demographic setting up camp on a lush, pine-dotted promontory.  The younger group took a second campsite halfway along the island.

At the second campsite, the Forest Service-provided latrine followed the letter, if not the spirit, of the law.  It was carefully positioned the correct 150 feet away from camp, but had a beautiful line-of-sight into the heart of camp, allowing one to feel fully involved in the variety of camp activities no matter what local business was in process of being handled.

New campsite on island
The island was haunted by toads, which as far as haunts are concerned are relatively mild.

Eric's luck in fishing was holding, in that he was catching nothing.  All around him small children were hauling in walleye and small-mouth bass hand over bobber, while his line remained stubbornly limp.  One time he had a nibble, but it was just a lilypad.  While retrieving his line he pulled a little too hard and shot his leech across an observer's starboard bow, and after that his constant collection of onlookers gave him a little more room.  It was hard to stay away, however--watching his curse unfold held a certain morbid fascination, like watching an extremely slow, boring, and watery train wreck.

Day 5

Yet another beautiful day.  Any rain was nothing more than an amusing chuckle at past worries.  There was swimming, hiking, games of capture-the-flag, and of course, day canoe trips to various locations.

Some lakes had enough vegetation that they were difficult to tell from the land.  On one excursion, Jon and I got a half-mile inland before we realized we had missed a turn in the creek.

Returning from visiting a neighboring lake, Jon and I encountered another canoeist who warned us that the "gestapo" were in the vicinity checking canoing and fishing permits.  Later that evening the green-clad rangers stopped by our camp.  Despite the canoeist's warning, any resemblance to Nazi enforcers was strictly superficial--not a jackboot, riding crop, or goosestep to be seen.  In fact, they were very pleasant and casually chatted for a few minutes, glanced briefly at our boat permit, and moved out to the lake to do a little fishing. 

Having observed Eric's difficulty with fishing, Aunt Kristi took it upon herself to break his curse.  After gathering their fishing poles and carefully selecting the largest, most succulent leeches, Kristi led the way up the shoreline, confident of success.

Five minutes later they were back, Eric dripping head-to-toe with a sodden hat sitting crooked on his head.  His curse had chewed him up and spit him out. Apparently a wayward cast had gone into a tree, and when he stepped on a log to retrieve it, the log had turned out to be floating over six feet of water. 

Eric's lack of luck did not extend to the rest of the group.

This beaver was a nightly visitor to the shore by the campsite.

View of the campsite.
With more lightning in the distance that evening, I was worried that the rain we had managed to avoid so far would be unleashed in a downpour of belated intensity.  There were a handful of intrepid trip participants who were sleeping under the stars, so I passed along a tarp I had been using as a tent awning.

A short while later, they decided to move away from the pile of lightning-attracting metal canoe paddles by the shore and set up camp in a clearing further into the woods.  As we started hanging the tarp, it started to sprinkle.  We picked up the pace, anticipating a downpour at any moment.  As we finished setting the tarp up, however, the sprinkling stopped, having pleasantly cooled the air.  Still, there was ominous thunder rumbling, so the group crowded under the tarp for the night.

So close to nature, encounters were bound to happen.  Notable quote from that night: "I was not expecting to find a frog in my pajamas."  So true.  No one does.

Before the trip, anticipating lazy afternoons and long evenings, I had stocked up on Louis L'Amour books.  Tragedy struck this evening, however: having finished my current book, I discovered that my last one was missing.  Civilization suddenly seemed distant and ennui promptly set in.

Day 6

The morning was cold and cloudy.  Jackets were broken out and breakfast fires were built.  I toasted a bagel on a home-built toaster made from weaving a forked stick together, which worked out well until the toaster caught fire and the forks of the stick sprang apart, sending my bagel shooting across camp.

With no Louis L'Amour to occupy my time, I decided to expand the open-air sleepers' simple tarp covering.  Other members of the camp were also bored, and soon we had seven amateur Frank Lloyd Wrights designing an elaborate structure.

After scaling down initial aspirations of a three-story Robinson Crusoesqe treehouse, we started threading together tarps and ponchos into a patchwork covering that gave the finished product its name of "Franken-tent."  While not particularly spacious, it was reasonably comfortable and provided protection from the elements.  Not that the protection was particularly needed.  The elements were already starting to revert back to their persistent sunniness, providing a distressing lack of the misery that makes for the best camping stories.


Later that afternoon we played capture-the-flag, where an enemy amphibious assault across the narrow bay that separated our flag stations was met by wet grass cleverly placed on the steep rocks in such a way as to maximize the opponents' probability of breaking an ankle.  The attack was successfully repulsed and our team ended up victorious.

To warm up, Eric built a lean-to fire, which his wife unkindly compared to a structure closer to a crackhouse, but it got the job done.

One additional happiness: the prodigal Louis L'Amour book was found.  The vacation was saved.

Arcane rituals were practiced ("playing with fire")

Portaging. While not obvious from the picture, the canoe was constructed from an alloy of lead and brick, as I quickly deduced after five minutes of carrying it.

Day 7

The final day of our adventure arrived, with more witheringly good weather.  With only hours to go before leaving, Eric decided to have one last go at breaking his fishing curse.  I threw together a pole made with a stick, six foot length of fishing line, a hook, bobber, and worm scrounged from beneath a rock.  Taking the pole along the shoreline, we found a deep, dark hole, and Eric dropped the line in.  Minutes later, there was a tug on his line and he pulled out an eight-inch bass.  It wouldn't have won any prizes, but it was a fish.  His curse was broken.

Eric was happy, but it seemed tinged with a little apprehension.  Kristi put her finger on the likely reason.  "Until now, he's been able to blame not catching fish on his curse.  Now, if he doesn't catch fish, he's just a bad fisherman."  A good point. 

Photographic evidence of the breaking of Eric's curse.
The trip back to our original entry point was quick, the additional gear and number of people that had joined us midweek offset by the canoing skills gained over the duration of the trip.  We smiled with kindly tolerance at the flailing strokes of groups we passed that were just beginning their trips, while our flashing paddles cut cleaning and smoothly through the water.  Portages were crossed efficiently and smoothly, with little to no gear left behind.  We had come far, and not just milage-wise (kilometer-wise for the portions of the trip done through Canadian waters).

We were canoeists.

Friday, September 21, 2012


A little while ago we visited the beach with two of my sisters and brother-in-laws.  While we sat under an umbrella admiring the waves, a large seagull landed nearby, inspecting us carefully.  With eight kids running around, the ground was littered with a collection of cheez-its, fruit-loops and granola bars. 

Satisfied that he had parked himself in a prime location and was first in line for when we left, he started preening his feathers.  "Hey, Ash, go chase the seagull," I told her.  She was more interested in sucking down a fruit juice and refused.

I moved on to various other children, all of whom indicated that their snacks, shade, or sand activities were all of more interested, helped by the fact that the seagull was as large as most of them.  Finally, one small niece agreed to chase the seagull, under full assurances that the bird would immediately fly away as soon as she was near.  She dug herself a starting block in the sand and took off running.

To her (and the adults') surprise, she arrived at the seagull without it flapping off.  It had been momentarily distracted by a itch and its head was buried under a wing.  The niece stood there a little confusedly, two feet from the bird, unsure what her next move was. 

The bird finally looked back up, satisfied that the itch had been vanquished.  It took a moment to register that there was a small child two feet away, then the seagull exploded in a feathery ball of squawking and flapping that seemed to levitate off the ground before shooting off over the sand.

Something tells me that the seagull will keep a weather eye out next time it scratches and itch, and my niece didn't show much inclinations to chase seagulls after that.

Friday, August 24, 2012


A coworker took this picture at our latest demo.

Tuesday, June 26, 2012

Healthy Living

As my better half, KLa is in charge of making sure I don't die before she does and leave her saddled with a bunch of medical bills related to my debaucherous, pre-marriage cuisinic lifestyle of frozen pizzas, ramen noodles, and peanut-butter crackers (hey, peanuts are practically vegetables!).

As a result, she makes us healthy meals full of fruits, vegetables, and grains who would turn up their noses at the thought of processing, sneer at artificial flavors, and turn green at the sight of red dye #40.

Ever in pursuit of the pinnacle of haleness, however, she went hunting for a healthier alternative to our usual breakfast oatmeal.  I suspect that as a common ingredient in cookies it's guilty by association, but KLa refuses to confirm or deny this.

Anyway, a couple mornings ago she presented me with a bowl of quinoa, which I believe is Spanish for "a bowl of oddly-texured brown and yellow seeds that look like frog-eyes."  According to the wiki page it's related to "pitseed goosefoot," which I think says it all.  It's how I always imagined eating plankton would feel like, and yes, as a fan of Kon-Tiki I've imagined what eating plankton would be like.

Monday, June 04, 2012

Debugging mutex locks in threaded programs using GDB

A common problem I have while debugging a threaded program is trying to determine which thread currently has a mutex lock when another thread is stuck waiting at the lock.  This could be because the two threads are deadlocked, or perhaps the first thread simply forgot to unlock the mutex.

Piecing together information from StackOverflow and my own experience, here's a possible way to go about it:

1. Run your program using GDB

$ gdb program
(gdb) run

2. When the program freezes, stop it using Ctrl-C

Program received signal SIGINT, Interrupt.
0x0012d422 in __kernel_vsyscall ()

3. Do a backtrace to see where we're deadlocked.

(gdb) backtrace

#0  0x0012d422 in __kernel_vsyscall ()
#1  0x0013aaf9 in __lll_lock_wait () at ../nptl/sysdeps/unix/sysv/linux/i386/i686/../i486/lowlevellock.S:142
#2  0x0013613b in _L_lock_748 () from /lib/tls/i686/cmov/
#3  0x00135f61 in __pthread_mutex_lock (mutex=0xb2601660) at pthread_mutex_lock.c:61
#4  0x08167cc9 in ObjectManager::lockObject (this=0x8280998, ObjectId=2992640368) at program/src/ObjectManager.cpp:1212
#5  0x08164929 in ObjectManager::executeActions (this=0x8280998, actions=...) at program/src/ObjectManager.cpp:424
#6  0x08174d09 in main (argc=1, argv=0xbffff6b4) at program/src/main.cpp:110

From this, we can see that we're stuck at line 1212 in ObjectManager.cpp (frame 4).  (Look for the frame right before the frame containing __pthread_mutex_lock)

4. Switch to the frame.

(gdb) frame 4
#4  0x08167cc9 in ObjectManager::lockObject (this=0x8280998, ObjectId=2992640368) at program/src/ObjectManager.cpp:1212
1212            pthread_mutex_lock(&mutex);

5. Determine which thread currently holds the lock we're attempting to obtain.

Look for the mutex.__data.__owner value.  This is a thread ID, or in GDB parlance, a light-weight process (LWP) ID.

(gdb) print mutex
$2 = {__data = {__lock = 2, __count = 0, __owner = 19617, __kind = 0, __nusers = 1, {__spins = 0, __list = {__next = 0x0}}}, __size = "\002\000\000\000\000\000\000\000\241L\000\000\000\000\000\000\001\000\000\000\000\000\000",
  __align = 2}

(gdb) info threads
  9 Thread 0xb47d0b70 (LWP 19619)  0x0012d422 in __kernel_vsyscall ()
  8 Thread 0xb4fd1b70 (LWP 19618)  0x0012d422 in __kernel_vsyscall ()
  7 Thread 0xb57d2b70 (LWP 19617)  0x0012d422 in __kernel_vsyscall ()
  6 Thread 0xb5fd3b70 (LWP 19616)  0x0012d422 in __kernel_vsyscall ()
  5 Thread 0xb67d4b70 (LWP 19615)  0x0012d422 in __kernel_vsyscall ()
  4 Thread 0xb6fd5b70 (LWP 19614)  0x0012d422 in __kernel_vsyscall ()
  3 Thread 0xb77d6b70 (LWP 19613)  0x0012d422 in __kernel_vsyscall ()
  2 Thread 0xb7fd7b70 (LWP 19610)  0x0012d422 in __kernel_vsyscall ()
* 1 Thread 0xb7fd8800 (LWP 19607)  0x0012d422 in __kernel_vsyscall ()

6. Switch to the owning thread.

(gdb) thread 7
[Switching to thread 7 (Thread 0xb57d2b70 (LWP 19617))]#0  0x0012d422 in __kernel_vsyscall ()

At this point, you could run a backtrace on the owning thread to see what it's doing and perhaps get clues as to why it never unlocked the mutex our original thread is still gamely waiting for.

Saturday, June 02, 2012


Just a quick picture of our bees!

Monday, May 28, 2012

Fence II: The Return of the Fence's Revenge

Despite naturally missing my wife and daughter terribly, with them on vacation, today was a great day for getting things done.  I tackled the fence on the right side of the house and even without missionaries from church to dig the postholes it was fairly easy going.

Unlike the left side of the house with its five sections, steep hill, nearby tree, and double-wide gate, this piece was only two eight-foot sections on flat ground.  The most complicated part was figuring out how to join it with the Leaning Tower of Cheap Engineering that was the remains of the previous fence.

Fortunately, it was tilting enough that the termites apparently had a hard time keeping their footing and had left enough wood that it was still somewhat translucent.  I decided to salvage what I could, but some of it was bad enough that it had to go.  As I dug up one of the posts that I was going to replace, I was amazed by how little concrete the builders had originally used.  No wonder it was leaning!  I've seen more concrete stuck in the treads of my tires.

The finished product was decent (guess which half is the new half):

When our company had moved into its new building, the landlord was going to throw away some old chain-link fence material, so I had borrowed the U-Haul our company was using and took it home instead.  This is what I still have left after doing the fence today:

While an elephant-proof fence is a laudable goal, an eight-foot tall gate has a certain imposing feel that could be a little off-putting to neighbors and visiting relatives, and perhaps lead to passing policemen wondering if we were growing marijuana in our backyard.  Then again, maybe they wouldn't care.  Anyway, I bought a metal-cutting blade, took my handy Sawz-All, and trimmed two feet off the gate:

When mounted, it looked a little...headless, but that didn't affect operations.  At least we don't have to worry about Ash being carted off by coyotes now!  Or at least once I mount a latch of some kind. 

All in all, a good day's project.  Next up, the 130 feet of fence at the back of our property!  And by next, I mean of course next year.

Friday, May 25, 2012

Free Time

An apparent side-effect of KLa and Ash being on vacation is that I have lots of time to blog.

Future Politicians, Today

I can't be the only one wondering how the politicians of tomorrow are going to spin the Facebook posts and Twitter tweets that they're generating today. 

During any given election season, political mudslingers dig up old college newsletters or newspaper articles where their opponents may have said something potentially spin-worthy.  Their resources are limited, however, and rarely extend past the point that their opponent became a public figure and therefore news-worthy.

Nowadays, however, anywhere between 25% and 50% of Americans have Facebook accounts, and that probably skews young.  There will be no shortage of embarrassing photos, awkward tweets, and ill-advised posts made in a brief moment of insanity (the so-called "teenage years").

The more I thought about it, though, the more I started to lean towards "it won't matter."  Politicians are naturally shameless to begin with and besides, these social media accounts are so ubiquitous that their opponents will probably have one too, leading to a MAD scenario.

Regardless, it will be interesting to see how it plays out.  With Myspace and Facebook hitting nine and eight years old, respectively, the standard teenage early-adopter will be halfway through their law degree by now.  Give them another decade and we'll start to see the fireworks.

Vacation Pros and Cons

Pros and cos of KLa and Ash being on vacation:

  • I vacuumed an entire floor without the vacuum being unplugged even once.
  • I got to sleep in until 6:45 am
  • I took an entire shower without having to lean out dripping wet to lift someone onto the potty.
  • I didn't get to chase a squealing and laughing two-year-old around with the vacuum.
  • I woke up alone in bed, without a wife to drape an arm over or a two-year-old climbing in saying, "Food time?"
  • I had a cheese sandwich for breakfast instead of an omelette or banana-raisin waffles.
Not sure if I'll survive two weeks.

Vacuuming Revelation

The past couple days KLa has been waking up with a handful of bug bites.  Worried that the mice we recently fought may have brought fleas into the house, she sprinkled Borax all over the floor before she left for Utah and drafted me to vacuum it up later that night.

As I was vacuuming it up, the thought occurred to me that it might not matter what powder you sprinkled on the floor.  It could be glitter and be just as effective--what it did was show me how terrible of a vacuumer I normally was.  It took me three or four slow passes to get up all the Borax and since my usual technique is one or two quick swipes, it's not hard to do the math and realize that maybe my standard vacuuming is fairly ineffective.

In short, regardless of whether the Borax actually did anything to the potential fleas, at the least it made me vacuum properly.


I've always pictured myself as a rebel--a counter-culture anti-establishment kinda guy who ignores the usual societal norms and boundaries and laughs in the face of tradition.  Take this morning for example--I had a cheese sandwich FOR BREAKFAST.

Stupid moths, getting in my cold cereal...

Thursday, May 24, 2012

Open Source and Productivity

I was so productive this evening that I decided to finish it off with a little blogging.

I love my job.  There isn't a day that I don't look forward to going into work.  With KLa and Ash leaving for Utah this morning, I was left with a free evening and the activity that sounded the most fun was to go back to work after dinner. 

If there was one downside to my job, however, it's that everything is "Proprietary and Confidential."  We use a lot of open source software (OSS) at work, but it's pretty one-directional--we only select OSS software that doesn't require us to contribute back.  It's a fact of life for a proprietary company like ours, but still not the dream world I would live in if I could. Every since I could program I've worked on and contributed to open source projects and I've always enjoyed the open sharing.

For the past couple days I've been working on adding joystick support to our software.  It's been a fun project, made infinitely easier by finding two pieces of OSS that make working with joysticks a breeze.  I did run into one snag, though--one of the joysticks just wouldn't work properly.  After spending some time on my own troubleshooting, I looked up the chatroom where the developers hung out and grilled them with some questions.
With their guidance, it took 20 minutes to fix the bug instead of two hours.  I went away with a fix for my problem and a big savings in time, and they went away with an improvement for their software.  That's what my perfect world would be like all the time--everyone sharing, and everyone winning.

Until then, I'll keep enjoying my job, and mentally thanking all those open source developers who put so much of their time and resources into making free and incredibly useful software, asking little and requiring nothing in return.

Wednesday, April 25, 2012

Andrenaline Junkies Got Problems

Ah, nothing quite like the glare of oncoming headlights in your lane to get the adrenaline flowing!  The thrill of adventure, the squealing brakes, the wife tourniqueting the arm...just another day in California driving.

Thursday, April 19, 2012


Thanks to my father and his darn do-it-yourself ethic, KLa and I decided to take a stab at putting up a new section of fence ourselves.

We probably wouldn't have done it ourselves except interestingly, it was like pulling teeth to get a quote on our fence.  We had a general contractor acquaintance come over and measure, but he never followed up.  I know for a fact he was looking for work, which is why I offered the job to him, but I suspect he weighed digging postholes in California's rock-hard soil and eating, and decided ramen wasn't that bad.

Our neighbor wanted to repair a joint section of our fence (the section from our side that was in the best shape and the last one we would have done if it was up to us, unfortunately) and had a man come out to give a quote.  He, too, made measurements, then vanished and never reappeared.  It's odd.

So we decided to take a shot at it ourselves.  My dad and I had put up a fence when I was younger so between that and a few websites (and a healthy dose of "winging it") we got what we needed and began.

First, Ash waterproofed the boards:

The missionaries from church were eager for a service project and I was happy to oblige.  For the cost of a couple burgers from Five Guys, they did all the heavy work of digging the postholes.  (Note to self: don't put a posthole so close to a tree next time. Whoever you sucker into digging the hole will take a long time getting through the roots.)  I poured cement, cut boards, and "managed."

KLa and I put up the first section of slats, and later the missionaries came over and again and helped finish it off.

My bro-in-law came over and helped build the gate.  And just like that we were done!

Granted, the project was spread over about a month and a half of Saturdays, leading our back-fence neighbor to jokingly question which dynasty we were planning to finish the Great Wall in, but the end result wasn't half-bad.  You can tell just by looking at the fence that some good management went into it.

Our next project is the fence on the other side of the house, and I hear a new missionary moved into the area.  I wonder if he's ever dug postholes...

Monday, April 02, 2012


Friday night and Saturday night, Ash got to bed super late--9 pm or later.  The next mornings, she woke up super early--4 or 5 am. 

Last night we finally got Ash to bed at a reasonable hour--7:30 pm or so, and she happily slept in until 7 am. 

Moral of the story: get Ash to bed on time.  (And it doesn't hurt if I get to bed on time, too...)

Tuesday, March 20, 2012

Robotics update

5D Robotics recently posted some videos we shot about the current state of our robots (I especially like this one and this one).

I'm not a huge fan of the "trance" background music, but the videos do a good job showing what we're up to.

Party Time!!!

For dinner tonight, I had a bowl of popcorn and a cottage-cheese container full of lemonade.

I can't wait until Kla gets home.

Wednesday, February 08, 2012

Free Memory in Ubuntu

I was so happy to figure this out that I wanted to post it for my own memory and anyone else who was also interested.

On one of my computers, my RAM was being eaten up and I couldn't figure out why.  Running 'top' resulted in the following line:

Mem:    505908k total,   478736k used,    27172k free,    41888k buffers

Out of my half gig of ram, 95% was being used.  Browsing the list of processes didn't give any indication that there were any particular memory hogs.

Running 'free -m' (the -m prints in megabyes instead of the default kilobytes) resulted in the following output:

user$ free -m
             total       used       free     shared    buffers     cached
Mem:           494        469         25          0         41        315
-/+ buffers/cache:        112        381

From that, I was able to discover that the majority of my RAM was tied up in caching data.  Not necessarily bad, since if you have spare RAM lying around, you might as well use it for something, but it was slowing down my SSH terminals to the point where they were effectively unusable.  The previous couple times I had this problem, I had simply rebooted, but that was a hammer=nail solution and I wanted a better one.  I finally found the solution on
  1. Flush file system buffers for safety
    1. user$ sync
  2. Become root (simply sudo-ing the final command won't work because of the redirection)
    1. user$ sudo bash
  3. Free cached memory
    1. root# echo 1 > /proc/sys/vm/drop_caches
To check that Ubuntu had given back my RAM, 'top' resulted in the following:

Mem:    505908k total,   120384k used,   385524k free,      204k buffers

Additionally, 'free -m' resulted in the following:

user$ free -m
             total       used       free     shared    buffers     cached
Mem:           494        128        365          0          0         24
-/+ buffers/cache:        103        390

Tuesday, January 31, 2012

Street Musician

I just watched a very pretty performance by a street musician on YouTube.  Two things in the video struck me:

1. A surprising number of passer-bys put some money into his case.
2. None of them stuck around to listen to the music.

I wonder why? 

Presidental Elections

Right now, if I had to vote for someone for President, and wasn't allowed to abstain, my vote would go as follows:

1. Mitt Romney
2. Barack Obama
2. Rick Santorum
3. Newt Gingrich

I was listening to Mitt Romney's celebration speech (for winning the Florida primary) this evening on the way home from work, and I had to shake my head several times.  Most of it was at the attacking nature of speech: "My opponents are doing this stupid thing!  The president wants to destroy America!"  Other times it was at the black and white nature of the positions he presented.  "The president wants to disband our entire military! I'm going to make it into the greatest military juggernaut in history!" (Yes, I'm exaggerating.)

Apparently Florida has been just about the most negative political race in history.  As a huge believer in decency, respect, and diplomacy, my estimation of Mitt Romney (and the other candidates) has been lowered because of the attack ads they've ran.

At the same time, I know why the candidates run attack ads: they get attention, they get press, and they get results.  People are swayed by them.  The unfortunate side effect is that candidates are willing to run incorrect (read: lying) attack ads, because by the time they're exposed, the damage has been done and of course the expose gets much less attention than the ad itself.

I'm guessing most people in country would agree that the state of politics in our country is pretty bad.  It's hard going to the polls when you're only selecting the least distastful of two choices.