Saturday, August 29, 2009

drupal

This open-source content management platform seems to be everywhere. Our church uses it for example. It automates a lot of website tasks -- account creation and the like. there's a blog feature, menus and so on.

Installation is pretty simple; if your site has MySQL and cPanel that makes even the MySQL part trivial. One thing I haven't figured out yet is how to change favicon.ico to ... ah, nevermind, here's how; very cool.

Monday, August 10, 2009

Quote without comment

Seen in Your Intercultural Marriage by Marla Alupoaicei:
Often the difference between a successful marriage and a mediocre one consists of leaving about three or four things a day unsaid.
attributed to Harlan Miller

Saturday, August 01, 2009

What's best in life?

I recently decided that there are few things in life better than preparing a meal for people you love and enjoying it with them. There may be (just) a few -- I can't think of many.

This was a terrific week for me. No, I didn't win the lottery, and I didn't even prepare a meal for my family. (The teenager and the lovely Carol were both in New Mexico--they still are in fact.) Let's see, I'll start with a couple of fortunate things and go on from there.
  • Our federal income tax refund came, as did a nontrivial product rebate check.
  • The doctor's office called with my blood test results -- they're moving in the right direction!
  • Several great conversations about spirituality and life issues: one with a college student who's taking some terrific steps to grow closer to Jesus, another with an engineer considering whether to fully trust Jesus, and a couple more;
  • Talked and prayed with a friend concerned about the future;
  • Helped write a sermon study guide for this weekend's services;
  • Helped a friend figure out the source of the mysterious mounds in his front yard;
  • Great times with the ex-teenager talking about lots of things;
  • We went on a bike ride (about 22 miles) today -- got a pretty good workout and had root beer floats when we got back; we prepared dinner together tonight too.
How could life be any better? Two things. First, safe return of the lovely Carol and the teenager to my loving arms (about 25 hours away now). Second, this computer (a gift from my buddy Kipp) not to freeze up any more. I have a working speculation that "noapic" will help (so far no crashes with "noapic" on boot) but....

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 255.255.255.0 -- why doesn't this work?

So "Ulrich" was having trouble bringing networking up, and he showed me his network parameters:
ip address: 10.53.10.121 
default gateway: 10.53.0.1
netmask: 255.255.255.0
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 10.53.10.121 wants to talk to 10.53.10.64, with the netmask 255.255.255.0 shown above. The comparison looks like this:
address bits
10.53.10.12100001010001101010000101001111001
10.53.10.6400001010001101010000101001000000
difference?--------------------------XXX--X
netmask
255.255.255.0
11111111111111111111111100000000
after mask?--------------------------------
So for 10.53.10.121↔10.53.10.64, the addresses, masked, result in no difference. So we will just send on the local LAN.

But if 10.53.10.121 wants to talk to 10.56.21.92, it looks like this:
address bits
10.53.10.12100001010001101010000101001111001
10.56.21.9200001010001110000001010101011100
difference?------------XX-X---XXXXX--X--X-X
netmask
255.255.255.0
11111111111111111111111100000000
after mask?------------XX-X---XXXXX--------
Even after masking, these don't match. So communicate with 10.56.21.92 we have to use the default gateway. But wait, is that possible? The default gateway is 10.53.0.1, so repeating the conversion and comparison yields:
address bits
10.53.10.12100001010001101010000101001111001
10.53.0.100001010001101010000000000000001
difference?--------------------X-X--XXXX---
netmask
255.255.255.0
11111111111111111111111100000000
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, 255.255.240.0, the result will instead look like this:
address bits
10.53.10.12100001010001101010000101001111001
10.53.0.100001010001101010000000000000001
difference?--------------------X-X--XXXX---
netmask
255.255.240.0
11111111111111111111000000000000
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 (255.255.224.0 or 255.255.192.0 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:
% ./netmask.py 10.53.10.121 10.53.0.1
best case netmask is fffff000 or 255.255.240.0
% cat netmask.py
#!/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. 192.168.0.1, all numbers <=255) or hex (7-8 digits,
optionally preceded by '0x' -- case is ignored).
USE AT YOUR OWN RISK. NO WARRANTY, EXPRESS OR IMPLIED.'''

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)
else:
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)
else:
print "*** couldn't" ' decode "' + an_addr + '"'
got_error = True
if got_error:
continue
if is_first:
# Initialize...
to_match = the_addr
the_mask = FULL_MASK
is_first = False
else:
# 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'
sys.exit(1)
if is_first:
# Nothing to do
print '??? No IP addresses supplied.'
sys.exit(0)
# 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','')
sys.exit(0)


if __name__ == '__main__':
main(sys.argv[1:])
%
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.

Enjoy!

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.