Thursday, July 23, 2009

Questions for couples

I have some useful questions for couples that are married or might soon be, but first a confession:

Readers might think that I have a perfect relationship with the lovely Carol, or that things are always smooth between us. This is not so; we have our share of struggles. We've said things we wish we could take back, and sometimes things are very uncomfortable. Marriage takes work, and sometimes help is needed from a counselor.

We visited one a few weeks ago, and I wrote down some of the questions we discussed:
  1. What works well in your relationship? What do you wish were different?
  2. What are three adjectives that describe your parents' relationship as a couple? Do you admire that relationship?
  3. Who are your models for what it means to spend time together as a couple?
  4. What are your models for resolving conflicts in an intimate relationship?
Obviously variations and extensions are possible -- how did your parents resolve conflicts, what adjectives describe the couple(s) you cited in #3 or #4, etc?

These were great questions for us. #1 for example gave me a chance to enumerate some things I love about our marriage: we smile a lot, I get a kiss in the morning and when I come home, she keeps the house tidy, she listens to me and cares about me, she's a great cook, I love discussing ideas (from books and articles) with her, etc. I didn't mention that I really like the shape of her body (which I do) or, uh, well, I'll stop there.

#3 was also good, because her parents had a different model of spending time together than mine do. That just might have some impact on how each of us thinks about that aspect of relationships.

Though we've been married almost 23 years, I don't think we've ever talked about how our parents' relationships worked, what we liked about their relationships, etc. Until now.

We also talked about what to do when things start to get uncomfortable, but I'll save that for another posting.

netmask -- why doesn't this work?

So "Ulrich" was having trouble bringing networking up, and he showed me his network parameters:
ip address: 
default gateway:
Yow! That will never work, because the netmask won't let him get to the default gateway!

What does all this stuff mean, how could anyone tell, and more importantly what is the correct netmask to use?

Here's a little theory, then I'll give you the lazy man's way. The IP address is a sequence of 32 bits, represented usually as four 8-bit bytes rendered in decimal and separated by dots. When I want to send something to another "node", I compare its IP address with mine in conjunction with the netmask. If it matches, I just send it on my local LAN. If it doesn't match, I use the default gateway. (You can have other gateways, but for now we're just talking about the default gateway.)

Let's say that wants to talk to, with the netmask shown above. The comparison looks like this:
address bits
after mask?--------------------------------
So for↔, the addresses, masked, result in no difference. So we will just send on the local LAN.

But if wants to talk to, it looks like this:
address bits
after mask?------------XX-X---XXXXX--------
Even after masking, these don't match. So communicate with we have to use the default gateway. But wait, is that possible? The default gateway is, so repeating the conversion and comparison yields:
address bits
after mask?--------------------X-X---------
Even after masking, these still don't match. So we can't send to the default gateway just by sending to it on the local LAN. Instead we have to use a gateway--but waitaminute, this is the only gateway we've got!

What we must do is loosen up the netmask. If we change it to, say,, the result will instead look like this:
address bits
after mask?--------------------------------
Behold! After masking, the addresses match, so the IP routing software knows it can send to this gateway.

In other words, the way to figure out a netmask that will work is to do a bit-compare between the IP addresses of the interface and of the default gateway, and see how long a netmask you need in order to mask off the differences. The optimal netmask may be shorter ( or for example), but this procedure ought to give you one that at least lets you get to the default gateway.

The lazy man's answer

Just run this little script, lines composed while riding the train, umm, like this:
% ./
best case netmask is fffff000 or
% cat
#!/usr/bin/python -tt
# vim:et:sw=4
'''Given a list of IPv4 addresses, prints the longest netmask
that accommodates them all. Addresses can be in dotted quad
format (e.g., all numbers <=255) or hex (7-8 digits,
optionally preceded by '0x' -- case is ignored).

import re
import string
import sys

def main(argv):
# addresses can be supplied in hex format or dotted-quad
hexpat = re.compile('(?:0x)?([0-9a-f]{7,8})$', re.I)
dqpat = re.compile('(\d+)\.(\d+)\.(\d+)\.(\d+)$')
FULL_MASK = 0xffffffffL # 32 bits
is_first = True
got_error = False # hope for the best
for an_addr in argv:
an_addr = an_addr.strip()

hexmatch = hexpat.match(an_addr) # Hex format?
if hexmatch:
# Yes! That was easy.
the_addr = string.atol(hexmatch.groups()[0], 16)
dqmatch = dqpat.match(an_addr)
if dqmatch: # Better be dotted-quad
the_addr = 0
for a_comp in dqmatch.groups():
if int(a_comp) > 255:
# That's an illegal number
print '*** In "' + an_addr + '":', a_comp, '> 255'
got_error = True
the_addr = (the_addr << 8) + int(a_comp)
print "*** couldn't" ' decode "' + an_addr + '"'
got_error = True
if got_error:
if is_first:
# Initialize...
to_match = the_addr
the_mask = FULL_MASK
is_first = False
# It's the (2nd or more) time through. to_match has the
# bits in common so far (possibly just the 1st address).
# the_mask holds the longest netmask that "works" so far.
# On entry: to_match & the_mask == to_match
# When loop is done: to_match & the_mask = the_addr & the_mask
while ((to_match & the_mask) != (the_addr & the_mask)):
the_mask = (the_mask << 1) & FULL_MASK
# Now re-establish entry condition
to_match = to_match & the_mask

# OK, now we've read all the addresses
if got_error:
# Don't process anything, just leave
print 'Not doing anything due to errors above'
if is_first:
# Nothing to do
print '??? No IP addresses supplied.'
# All good!
print 'best case netmask is', ('%08lx' % the_mask),
dqmask = `the_mask >> 24` + '.' + `(the_mask >> 16) & 0xff` + '.' + \
`(the_mask >> 8) & 0xff` + '.' + `the_mask & 0xff`
print 'or', dqmask.replace('L','')

if __name__ == '__main__':
That's it! You can snarf'n'barf the shaded part above and save it to a file on your Linux/UNIX™/Mac™ computer. You might need to adjust the first line (it works on Mac OS X 10.4 Tiger). Don't forget to set execute permissions on the script.


Wednesday, July 22, 2009

Caltrain frustration, part deux

This morning, the San Jose-bound train pulled into Redwood City, and I trotted up to board it. Looking up at the digital sign, I saw 7:28AM and slowed to a walk. Nevertheless, the door closed before I was all the way on the train! Fortunately, the conductor opened the door for me.

After getting fully onboard the train, I leaned my head out to re-check the sign. It still said 7:28! What the heck, closing the door two minutes before scheduled departure?

I sat down and the train started to move. Odd, I said to myself; I don't think it's quite 7:30. I yanked my (Verizon) cell phone out: 7:29. As we passed another digital sign at the station, I looked out again: 7:29. Leaving early, both according to the phone system time (which I tend to trust) and also according to your own clock!

So what's the story? If the schedule says 7:30 but the train pulls out at 7:29 (according to both your clock and mine), is this CalTrain policy (i.e., "we might leave a minute early")? Or "The head conductor can set his watch a minute 'fast' and run the train by that watch"? What does the schedule actually mean?

Or should the conductors be reminded to stay in the station until the schedule departure time?

Enquiring minds want to know!

Friday, July 17, 2009

What's God saying to you?

For some achievement-oriented people (you know who you are), that question stirs up a lot of anxiety. I'm not saying it's a Rorschach test, but if what comes to mind is "You don't read enough Scripture" or "You aren't loving (generous, kind, etc.) enough," that may say more about us than about God.

I was thinking about Psalm 139: "How precious to me are your thoughts, O God! How vast is the sum of them! Were I to count them, they would outnumber the grains of sand." (Ps 139:17-18). What kind of precious thoughts?

Here are a few -- a mere half-dozen "grains of sand." No, I can't prove all of them from Scriptures, but I think that some of what I feel toward my own children is an echo of God's feelings toward his:
  • Good morning! I've been watching over you all night.
  • I'm glad you're mine.
  • When you reached out to that person, it brought joy to the angels in heaven.
  • Just wait 'til you see the blessings I've got stored up for you next week!
  • You're doing just what I wanted you to do!
  • It brings me pleasure just to look at you.
Which reminds me of something I heard at our church's "men's summit" a few months back: Matthew 3:17 happens before Jesus has done anything; he hasn't preached a sermon, he hasn't healed or fed anyone, and he hasn't done any other miracle yet either. And God says, "This is my beloved son, in whom I am well pleased." So this inspired one speaker to say, "Hey God, what do you think of me?" while still in bed -- before reading any Scripture, before any other prayer, before doing anything "productive."

And to meditate on those words, "my beloved son, in whom I am well pleased." Before doing anything productive today, even before praying, we are his beloved.
By the way, this is no less true if you're a woman; I read in Vincent's word studies iirc that the NT writers used the word translated "son" (something like "υιοσ") when they wanted to emphasize the believer's relationship with God, and the word for "child" (something like "τεκνοσ") to emphasize the fact of birth. Thus in Romans 8:14-17, Paul ties being sons of God (verse 14) to being led by his spirit (the relationship), whereas verses 16-17 connect our inheritance to our being children (the fact of birth). And Galatians 3:26-28 makes it explicit that "sons" include both men and women: "You are all sons of God through faith in Christ Jesus.... There is neither... male nor female, for you are all one in Christ Jesus."
So if you are indeed his child, then whatever else God is saying to you, he's also saying this: "You are my beloved son; in you I am well pleased." Yes, before you read the Bible, before you pray for anybody, before you do anything "productive," God loves you and is pleased.

Now that's what I call good news.

Sunday, July 12, 2009

What does it mean to be "moving forward" in life?

That question came up this morning. I claimed that God is working to transform us into something beautiful, as I've written elsewhere. When we cooperate with him toward that goal, I said, that's when we're really moving forward. There are a lot of people who put all their energy into climbing the ladder of success, but realize afterward that it was leaning against the wrong building.

Our friend, who had posed the question, had talked about the usual practice of "focusing all my time and energy on getting what I want" (i.e., in order to move forward) -- but was now spending a lot of time serving others instead.

I said that this service was like what the Apostle Paul wrote in 2 Corinthians 4:5, "We are not preaching about ourselves. Our message is that Jesus Christ is Lord. He also sent us to be your servants." (CEV). This brings to mind the tme Jesus was teaching his disciples about humility, and wrapped it up by saying, "For even the Son of Man did not come to be served, but to serve, and to give his life as a ransom for many." (Mark 10:45)

Serving others -- being kind and generous with them, even if we don't like each other, is a great thing. As Jesus himself said, "If you love those who love you, what reward will you get? Are not even the tax collectors doing that?" (Matthew 5:46, NIV) Here's the whole paragraph (verses 43-48) in Peterson's The Message.

I love how realistic the Bible is -- it doesn't assume or command that we like everybody (or that they like us).

And I love it when Jesus helps people see that they're climbing the wrong ladder. And when they have the courage to do something about it.

Friday, July 10, 2009

Frustration, thy name is Caltrain

So I ran out to the garage this morning, took a few seconds to untangle the padlock and cable from the spokes (I wish people would be more careful), and reached for the garage door remote. Not there! At that point I should have just given up and decided to go to Menlo Park.

But nooooo... my "inner sloth" got the better of me (Redwood city is 2 miles, but Menlo Park is like 3½) so I found another remote and rode off. I had good luck with traffic lights, arriving at the barrier a full two minutes before the train was due to leave. (Actually my phone showed 7:27 -- what was the "southbound" train doing here so early??)

That was OK; there was plenty of time. Or there should have been.

The "northbound" train pulled into the station -- also early (by now it's 7:28), keeping the arms down. Drat it, the train is stopping here, why keep the arm down?

Oh, crap! The northbound driver drove the train past the station and right into the intersection! How long does it take him to shift gears?

OK, this has gotten too long. By the time he backed out of the intersection (this guy should be given another job) I missed the train. As the door closed, the conductor called out, "We're late! There's another one right behind us." Ah, no. The next train stops in Redwood City 43 minutes later. Five minutes after that I can catch one that also stops in Mountain View.

I locked my bike up anyway, and as the train pulled out, I yanked the phone out of my pocket. 7:30.

Sunday, July 05, 2009

Sequoia: the Good, the Bad, the Ugly

The lovely Carol worked at Sequoia National Park long before I met her, and we visited the park together for the 8th (or so) time this past week -- on this occasion, with Yunita and her friend Daniel. We camped Sunday and Monday nights at Lodgepole (you can see a map on this page, which also has an alphabetical list of campgrounds), where the sign at the gate proclaimed "Full" in spite of many empty sites (a lot of no-shows, we guessed). You can walk from your campsite to the "village" (which has showers, store, pizza, ice cream -- and the visitor center) -- I figure about a ½-mile.

You can also walk to Tokopah Falls, 1.7 miles from the trailhead (which is in the campground). We did this on Monday morning. There are gorgeous views along the trail, which is not very difficult. Starting elevation was about 6700', which made this a great way to get acclimated to the altitude. Dinner on Sunday was homemade chili (which I prepared Saturday afternoon), cole slaw (which the lovely Carol mostly prepared on-site), rice (provided by Yunita and Daniel). For breakfast we had cold cereal and hot drinks. Monday night's dinner was provided by Yunita and Daniel; they even brought the charcoal! It was delicious, too.

Tuesday morning we headed up the Lakes Trail -- our destination: Emerald Lake, via the Watchtower. If you've never seen the Watchtower, I gotta tell you it's worth the hike, especially if you're just hauling a day pack, rather than 40 pounds of gear. Start at the Wolverton trailhead (it's a cross-country ski area in winter) and follow the signs toward Pear Lake (1st junction) and the watchtower (2nd junction). The trailhead is apparently at 7250' and you gain over 1000' getting to the Watchtower. This is one of the spots on the map where a bunch of contour lines squish together -- I mean there is a steep dropoff. We saw Tokopah Falls, and the trail of Monday's hike, basically from above.

I always snap a few pictures at the Watchtower, but they can't do it justice -- not that my photo of Emerald Lake does it justice (yes, those white patches are snow).

The Bad

As we approached the lakes from the Watchtower, the mosquitoes got worse. At Emerald Lake, they were really thick and hungry. I mean, the "Off!™" 7% DEET spray distracted them for less than a minute before they started biting again. It was truly horrible. Come to think of it, there were quite a few on Monday's hike, too (Daniel got a whole mess o' welts from mosquito bites) -- but the insect repellant worked on them. We went into our tent and zipped the door closed after a while. The good news, though, was that the 25% DEET stuff does work on these things -- at least it did at 6:30 the next morning.

Some folks in a nearby campsite begged some repellant off us. Actually they donated a can of beer in exchange for a few sprays. I warned 'em it didn't really work, but they gave us the beer anyway. "Our strategy is to kill them all," one of the guys said.

"Good luck on that one," I told him. Actually you could just clap your hands and kill one or two -- they were that thick. But of course there are thousands more where those came from.

A ranger came by while we were hiding in our tent. She looked at our wilderness permit; we talked with her through the screen "door." Even as we chatted, I saw several mosquitoes land on her and take a bite. Apparently these bugs bite all day long.

The Fire

The fire, which we contained and extinguished, was started by a Svea gasoline-fired backpacking stove. These things work by pressurizing the fuel with heat; that is, you heat the tank and fuel expands/pressurizes. The resulting pressure forces liquid fuel through a small neck, vaporizing it for combustion under your saucepan.

There is a problem, though, if you don't fully tighten the filler cap. When you ignite the fuel in the little well atop the stove, the resulting heat may force gasoline vapor out the cap, turning the stove into a sort of blowtorch. When this happened to us, I was loath to pour water on the fire (I was visualizing oil fires, and creating a river of flame) but eventually decided to sprinkle water -- which lowered the flames; we flooded it and that extinguished the fire.

Unfortunately, when the stove became a blowtorch, the whole thing was in flames, including the (soldered?) seams at its bottom. So another attempt to light the stove (with the filler cap definitely closed) resulted in another mess of flames, caused by gasoline seeping out the bottom of our now-ruined stove. Dinner was cold soup, crackers, salmon and salami slices. And beer.

Our previous backpacking trip was about 23 years ago; between the mosquitoes and the fire, I'm not sure when I'll be ready for the next one.

The Return

I was quite excited to get out of there. I was awake by 6AM, and the mosquitoes were already out in force, just as the ranger had warned us. We had cold cereal -- no stove, so no coffee. It was about an hour from the campsite to Heather Lake. We descended via The Hump rather than the Watchtower, taking about 90 minutes to return to the lower junction, and not quite 90 minutes to the trailhead. 5.2 miles in a shade under 4 hours -- not very impressive. On the other hand, we stopped to talk with folks a few times along the way.

We drove over to the Lodgepole visitor center to return the bear-barrel (which we didn't need at all, really; there are bear boxes at Emerald Lake). We then headed down the hill into Three Rivers, which the car thermometer advised us was some 104°F. That night was spent in the Sierra Lodge, which has a pool (yay!) and interior designs from the '50s or so. Dinner was at the River View (on recommendation of the hotel staff), a funky place with great food.

Thursday, July 02, 2009

Cardiologist? An open letter to a young friend


I heard you're headed for the cardiologist. Your mom sounds kinda excited about all that, but I wanted to tell you about some cardiac tests I've experienced. First is the basic EKG or electro-cardiogram. Why EKG? I dunno. 'cause of Greek (καρδια?) or German maybe? Anyway you lie on a table and they connect a bunch of suction cups to your body -- the wikipedia link above has a picture showing approximate locations. Wires go from those electrodes to an electronic instrument. They might wipe your skin where they stick those on, to make sure the suction cups will stay there.

Then they'll want you to lie still and think peaceful thoughts, while they chart the electrical impulses that activate your heart muscles. It is quite a complicated problem to estimate what's going on electrically in your heart muscles, when all you have to go on is what you can read from electrical impulses at the surface of your skin. But for the patient it's a simple test; you just lie there while they attach electrodes, and think peaceful thoughts.

Anyway, the EKG is not invasive; nothing goes below your skin. They thought my heart was strange electrically after my EKG, so they had me do a stress EKG, or what I call the treadmill test, which also is not invasive. The setup with the electrodes is the same, but they have you run on a treadmill. At first the treadmill is easy -- like walking. But then they increase the tilt and the speed. The whole time you're walking, jogging, running on the treadmill they're monitoring your heart. When you're just about pooped you signal them and they slow the machine down gradually (so you don't run off it).

I took the treadmill test, and they studied that and said my heart was funny-looking electrically. They wanted me to do a stress echo test. That's like the treadmill test, but just at the point where I wanted to quit running, they put one of these ultrasound gadgets on my chest and took movies of it. There was this cold gel on the end of the instrument, an ultrasonic transducer actually. They studied that and decided my heart was funny-looking.

Bottom line, I do not have a cardiac problem. But my heart is funny-looking both electrically and in ultrasound.