Monday, May 28, 2012

Priority of marriage: quote (almost) without comment

From a 1991 sermon by Tim Keller:
No relationship is more fundamental than the relationship between a husband and a wife. It's the primary relationship. Father/mother/child relationship is secondary. And therefore your spouse and your marriage has to be your #1 priority; it has to come before your career; it has to come before your friends; it has to come before your children--that's a very hard one especially nowadays, it really is; it has to come before anything else.

Now afterwards I got a number of questions about this. Somebody came up to me and said to me, "All right, what if the man thinks that he is putting his marriage first but the woman thinks he's not? How do you solve that?" Or, "What if the woman thinks she is putting her marriage first and the man thinks she isn't? How do you solve that?"

It's simple: if one person thinks the marriage is first and the other person thinks it's not, then it's not. It's simple.

Dr. Timothy Keller, Marriage as Priority & Friendship September 8, 1991
starting about 12 minutes in

You might also be interested in Dr. Keller's explanation of The #1 cause of marriage problems, which he also mentions in the above sermon.

Sunday, May 27, 2012

[A glimmer of] Understanding the PCUSA

Updated 2013-04-07 because shuckandjive.org's domain registration expired; links have been adjusted to point to http://shuckandjive.blogspot.com
I'm a member of Menlo Park Presbyterian Church, which is currently affiliated with the PCUSA, a denomination in some turmoil. Here is an issue that I found vexing; thanks to my friend Simon, to an article by R.R. Reno reminding me about Jonathan Haidt's work on liberals and conservatives, and to a book by Jack Rogers, I now have a glimmer of understanding.

What issue, you ask? Sorry, I got ahead of myself. The issue was ordination of women in the church. To you this issue may be a slam-dunk, but I had to spend some hours studying the Scriptures and considering my own motives and prejudices. Part of my study involved reading a lecture attributed to Tim Keller [online here or here] where I read this rather surprising extract:

Some 15 years ago, we would have entered the Presbyterian Church USA to minister, but we were told that our view of women-in-ministry precluded us from serving there. Though we would have worked beside people with different views, those on the other side of the fence would not work with us.
Women and Ministry [link]
Redeemer Presbyterian Church
By Tim and Kathy Keller 11/89
Jack Rogers reports this has been the case for some time:
In its 1974 decision, the Permanent Judicial Commission in the Kenyon case cited the Confession of 1967. The PJC decision stated that the equality of women and men is an essential of Presbyterian theological beliefs…

I found it vexing and incomprehensible that on one hand the PCUSA would consider Tim Keller unfit for ministry, and on the other hand has no problem with someone like John Shuck who believes

that "God" functions as a symbol. The concept of "God" is a product of myth-making and "God" is no longer credible as a personal, supernatural being. For me, "God" functions as a shorthand for the Universe and sometimes for qualities and aspirations I wish to pursue or to emulate.
Unlike the Apostles Peter and Paul, unlike the author of Hebrews, Shuck doesn't believe Christ died for our sins:
The passion accounts in the gospels that we hear in church and that we watch on film and that preachers relish in recounting from the pulpits are fictions. Stories. These events didn’t happen. The theological explanation is based upon pure imagination.
He notes in this posting that he has been elected by Holston Presbytery to serve as a voting commissioner to the PCUSA’s 2012 General Assembly.

How can Tim Keller be unfit for ministry, and John Shuck be elected by his presbytery as a commissioner for the Presbyterian Church (U.S.A.) general assembly? That was something I found incomprehensible and vexing. But after some helpful input, I now find it only vexing.

A few weeks ago, my friend Simon and his wife joined me for dinner. It was a time of sweet fellowship, getting to know each other a little more and discussing some of these questions. I'll say here that Simon and I don't necessarily fully agree on all issues. Anyway I asked him if he had any insight into the above question: how can the question of "who can be nominated as an Elder?" be essential in a Christian denomination, whereas belief that Jesus Christ died for our sins isn't essential? Simon proposed the following possible position of the denomination:

There's a place for every family member at the table. If you don't believe exactly as we do on some issue (even some very important ones), you can still have a place at the table. But one thing you mustn't do here is oppress your sister.
Side note: What's there not to fully agree with here? Only this: Membership in God's family isn't inherited, or automatic for everyone who, say, goes to a certain church or a certain seminary; to be in God's family someone must welcome Jesus into their life, and believe in him (John 1:12) in order to become a child of God. Put differently, we need to be adopted (Romans 8, Ephesians 1) into the family, or as Jesus said, "born again" (John 3). He also said, "Not everyone who says to me, 'Lord, Lord' will enter the kingdom of heaven" (Matthew 7:21). These are not proof-texts; Jesus also says that the path leading to life is narrow, and few find it; he talks a lot about those who are on the inside vs on the outside; if a brother refuses to repent even when confronted by the congregation, we should treat him as an unbeliever; he warns us to be aware of wolves in sheep's clothing. Not everyone who claims to be a brother or sister truly is one; I don't see how we can escape our responsibility to at least try to discern whether someone has been adopted and truly is a family member, vs being a wolf in sheep's clothing.
I may not have the exact wording, but need I say I was impressed with this answer? This is at least a coherent position. I don't fully agree with it (more at right), but it is at least comprehensible to me.

Another piece of the puzzle may have to do with being more "contractural" or liberal vs being more "beehive"-oriented or conservative (the quoted terms are from Haidt's 2007 article on misunderstanding religion. Haidt has done some interesting research on ethical perceptions:

In my dissertation and my other early studies, I told people short stories in which a person does something disgusting or disrespectful that was perfectly harmless (for example, a family cooks and eats its dog, after the dog was killed by a car). I was trying to pit the emotion of disgust against reasoning about harm and individual rights.

I found that disgust won in nearly all groups I studied (in Brazil, India, and the United States), except for groups of politically liberal college students, particularly Americans, who overrode their disgust and said that people have a right to do whatever they want, as long as they don't hurt anyone else.

Haidt, 2007 [link]
A little later in the article, Haidt lists four principles summarizing a new synthesis in moral psychology. I'm particularly interested in this one:
4) Morality is about more than harm and fairness. In moral psychology and moral philosophy, morality is almost always about how people treat each other. …

OK, so there are two psychological systems, one about fairness/justice, and one about care and protection of the vulnerable. …

But if you try to apply this two-foundation morality to the rest of the world, you either fail or you become Procrustes. Most traditional societies care about a lot more than harm/care and fairness/justice. Why do so many societies care deeply and morally about menstruation, food taboos, sexuality, and respect for elders and the Gods? … If you want to describe human morality, rather than the morality of educated Western academics, you've got to include the [Emile] Durkheimian view that morality is in large part about binding people together.

From a review of the anthropological and evolutionary literatures, Craig Joseph (at Northwestern University) and I concluded that there were three best candidates for being additional psychological foundations of morality, beyond harm/care and fairness/justice. These three we label as ingroup/loyalty (which may have evolved from the long history of cross-group or sub-group competition, related to what Joe Henrich calls "coalitional psychology"); authority/respect (which may have evolved from the long history of primate hierarchy, modified by cultural limitations on power and bullying, as documented by Christopher Boehm), and purity/sanctity, which may be a much more recent system, growing out of the uniquely human emotion of disgust, which seems to give people feelings that some ways of living and acting are higher, more noble, and less carnal than others.

Haidt, op. cit. (emphasis added)
Haidt has written another book, The Righteous Mind, which R.R. Reno read and discussed in the aforementioned article from First Things; apparently Haidt's list now consists of care, freedom, fairness, loyalty, authority, sanctity; liberals care about the first three only and may actively reject the others. Reno quotes Haidt on this: When I speak to liberal audiences about the three 'binding foundations'—Loyalty, Authority, and Sanctity—I find that many in the audience don't just fail to resonate; they actively reject these concerns as immoral.

So here's my current whack at what's going on, why Shuck is accepted by the PCUSA but Keller is rejected. First, there has been a shift in the denomination away from an admittedly flawed understanding of how to interpret the Bible. I'm assuming that Rogers has not caricatured some past mental models, but certainly trying to read Genesis 1 as a chronology, or saying creation happened in 4010 BC, or that women mustn't wear braids in church (and how about that gold jewelry?) is a problem. Perhaps the baby has been thrown out with the bath-water, but it's easy to see how this can happen. This may explain why the PCUSA has no theological essentials. (Seriously. There is not a single tenet you must believe—I mean about God or Jesus Christ—in order to be ordained in the PCUSA. I'll happily be proven wrong on this, but I don't think that's happening.)

Second, contracturalists (or "liberals") have risen to power in the denomination. (Note that this is separate and distinct from being theologically liberal.) This is how care, freedom and fairness have become the essentials.

Do I care about care, freedom, and fairness? Yes I do, but who gets to define all these terms? For example, is it fair that someone who believes in Jesus is part of God's family, whereas a much nicer person isn't—even if that person is more polite and patient, gives more to charity—because they don't believe in Jesus?

Would I refuse to attend or support Redeemer Presbyterian Church because they don't ordain women as elders? I would say it's an issue for me but I don't know if it would be a controlling issue. (I disagree with Dr. Keller's views on women in the church, but it's not essential for salvation or fellowship that we agree on that issue.) I think I'd be more concerned if the crucifixion and resurrection of the Lord Jesus Christ were not preached -- based on my understanding of the Bible, I think this is essential for salvation.

At this point I still disagree with the PCUSA, and I disagree less with them since reading (most of) Rogers's book. But at least the position is comprehensible.

Saturday, May 26, 2012

Converting two date(1) outputs into a time delta

So I wrote a little shell script that went something like:
date
somestuff
morestuff
otherstuff
date
and I wanted to calculate the time between the first date and the second. It's not rocket science; by inspection you can tell whether the start and end are on the same day, same hour, etc., and do the necessary "borrow"s -- if something started at 1:59:59 and finished at 2:00:17 then it obviously took about 18 seconds.

But suppose you want to do it programmatically -- which I almost always want to, because I may want to know in a couple months whether the time has gone up or down. The second thing that came to mind was to change all those date commands to something more like date +%s, because if what you have is

$ date
Sat May 26 22:20:39 PDT 2012
$ somestuff
…
$ date
Sat May 26 22:22:29 PDT 2012
it would be a lot easier to calculate the time difference if instead you had this:
$ date +%s
1338096039
$ somestuff
…
$ date +%s
1338096149
but that would make the output more computer-friendly than human-friendly. To paraphrase the old IBM motto, "Machines should do date conversions; people should think."

So here's what I did instead. I wrote some Python to do the conversions -- or rather to call the conversion routines. Here's an extract; it's inside a loop that reads all the lines in a screen-scrape (or script(1) output) file.

    if aline.endswith(' date'):
        expecting_date = True   # Next line will resemble 'Sat May 26 hh:mm:ss' etc
    elif expecting_date:
        secs = time.mktime(time.strptime(aline, '%a %b %d %H:%M:%S %Z %Y'))
        dates.append(secs)      # Will this code work beyond 2038 AD ??
        expecting_date = False
It turns out that in this particular file, whenever you see a line ending with " date", the next line will have output from date(1).

After the loop runs, what we have is a list of times based upon the date(1) outputs: if the file has 'Sat May 26 22:20:39 PDT 2012' (a string) then the list dates will have 1338096039 (a number), which can be compared, subtracted from something, etc.

The routine you want to remember is time.strptime; that magic "format" string is the format that my dates come in. Somehow I had the idea that you ought to be able to just put '%S' or something like this into strptime, and it would know you meant the "standard" (POSIX maybe?) date format. But it didn't work for me, thus the '%a %b %d %H:%M:%S %Z %Y'

That's all there is to it! Next time I'll look for this posting, rather than grinning (or not) and bearing it.

Thursday, May 24, 2012

Combining and encrypting PDF files

So I need to send some documents to the guy at the bank; these documents of course have sensitive information -- account numbers at a brokerage, things like this. The bank guy also wants me to sign something and send it back to him. How to take care of everything in one go?

First, I printed the document needing signatures, and signed it, and scanned it in using xsane; I have version 0.997 on my OpenSUSE 11.3 desktop. The scanner can save as ".png" (lossless) and I convert it to PDF using imagemagick:

$ convert scanned.png scanned.pdf

The statements from the brokerage had creative filenames like Statement_03-31-12_3336.pdf and Statement_04-30-12_3336.pdf. So what I wanted to do was combine these three files into a single encrypted PDF:

  1. scanned.pdf
  2. Statement_03-31-12_3336.pdf
  3. Statement_04-30-12_3336.pdf
Here's the incantation that did it:
$ pdftk scanned.pdf Statement_0*.pdf cat output out.pdf encrypt_128bit user_pw MyPassWord
where:
  • pdftk
    is the fabulous PDF toolkit program
  • scanned.pdf Statement_0*.pdf
    is the list of files to be combined
  • cat output out.pdf
    tells pdftk to concatenate the preceding files, and put the output into the file named out.pdf
  • encrypt_128bit user_pw MyPassWord
    means to encrypt the file using the password MyPassWord
It wasn't hard, but I needed some searching and trial-and-error to figure it out. Next time I'll just pull this little post up.

Thursday, May 17, 2012

Identity crisis! Well, actually identity theft

So we're refinancing a mortgage (truly a first-world situation) and we find our credit report has a ding on it. Short version, somebody got hold of my social security number (it's out there in the wild, apparently) and got a telephone with it, in Winnetka. That's Winnetka, California, for those who, like me, didn't know we had one here.

So, what to do about it? Someone at the collection agency (EOS CCA) told me to file a police report. In what jurisdiction? I asked. I mean, I'm not going to L.A. to file a police report. So the Redwood City Police Department now has a report. Cool; I'm now an official victim of identity theft.

That report, plus $2.50 (plus tax and tip), will get you a cup of coffee at Stack's; meanwhile, because of my lowered credit score, my loan origination fee is some $800 more than it would have been otherwise.

And I've spent some time this evening writing a letter to AT&T, telling them that the charge was fraudulent, and castigating them for their reckless and irresponsible lending policies. At the time of the fraud (last fall), I'd had an AT&T home phone for about 12½ years—for some of those years it was Pacific Bell, or SBC, or something like that but who cares—my residence address (some hundreds of miles away from Winnetka, CA) was unchanged; etc.

I disputed this bogus charge with all three credit rating agencies. I also mailed them a copy of the police report. TransUnion took a few days to remove the bogosity from my credit report; Experian emailed me today saying to take the matter up with the original creditor.

Would it have been cheaper to just pay off AT&T? Well, I don't know if that would have cleaned up my credit score in time; the other thing is, it would encourage AT&T in their reckless and irresponsible lending practices. Millions for defense, but not one cent for tribute!

Saturday, April 21, 2012

Elevating the head of the bed

This is kinda elementary, but I did it wrong last time; this way is better.

First, I'll show you a picture of the setup: each end has a 2x4 lying edgewise. A 2x6 lies between them, kinda like a bridge. I mis-measured the bed, so the 2x6 is too short; it doesn't reach all the way across. So I put a 2x4 on top of that.

As you can see, this creates a stand, or a prop, about 7½" high, which ought to be high enough. (If you make it too tall, you and everything else on the bed will tend to slide downhill—including the mattress.) How do you keep the 2x4s on the end from just collapsing onto their sides?

I did it wrong the first time; I drove screws through the 2x6 into the 2x4s, but the screws weren't long enough.

You can see the new and improved version at right; that bracket will hold the 2x4 on more securely. I also "toenailed" it in a couple of directions, and added a longer screw, too, through the top of the 2x6 into the edge or each 2x4.

And though the 2x4, lying down atop the 2x6, isn't subject to the same kind of sidewise pressures, I went drove two 2.75" screws through that long 2x4 into the 2x6, so it's a lot more stable than the old version.

The white things on the "foot" are felt pads; I thought they would be kinder to the floor than a 2x4 directly on it.

How about getting the thing under the bed? I used a hydraulic jack, as you can see below. With the bed being right next to the wall, there's not much room for a helper.

That's about it; I slid the stand under the bed, lowered the bed onto it, and pulled the jack out. Then I pushed the bed horizontally toward the headboard; mission accomplished.

If you're wondering why we want to do this... well, let's just say there are lots of reasons why one might want to have the head end of the bed elevated.

Why “#!/usr/bin/python -utt”?

From a colleague's questions I see that my explanation in this post from last year wasn't quite clear, so I'll try to make this one more complete.

First let's talk about tabs. The Python style guide (also known as "PEP 8" [link]), recommends using spaces only, particularly for new projects:

Tabs or Spaces?

    Never mix tabs and spaces.

    The most popular way of indenting Python is with spaces only.  The
    second-most popular way is with tabs only.  Code indented with a mixture
    of tabs and spaces should be converted to using spaces exclusively.  When
    invoking the Python command line interpreter with the -t option, it issues
    warnings about code that illegally mixes tabs and spaces.  When using -tt
    these warnings become errors.  These options are highly recommended!

    For new projects, spaces-only are strongly recommended over tabs.  Most
    editors have features that make this easy to do.
You can see how this works in a very short script like:
if 1+1==2:
        print "I'm still here"
<tab>print "and math still works"
If that's saved in two.py you can run it with python two.py and you should see the two strings:
$ python two.py
I'm still here
and math still works
With "-t" we get a warning about tabs and spaces:
$ python -t two.py
two.py: inconsistent use of tabs and spaces in indentation
I'm still here
and math still works
With "-tt" (two "t"s) the warning becomes an error:
$ python -tt two.py
  File "two.py", line 3
    print "and math still works"
                               ^
TabError: inconsistent use of tabs and spaces in indentation

How about that “-u”?

This one is a little more complicated. In a lot of computer programs, when you "print" something, it doesn't display the characters on the screen right away. Instead, it saves them up in an output buffer; it buffers them. Usually this is a good thing, because the program can't display characters all by itself; it has to call upon the system to do it, and it's cheaper to call the system once to display an entire line, rather than calling the system e.g. 42 times (once for each character on the line).

But there are at least two situations where this buffering isn't desirable. One case is when you want to leave the cursor at the end of the line for a while. Here's a silly example:

from time import sleep
print "waiting five seconds...",
sleep(5)
print "done."
If you run this simply as "python sleep.py" then nothing happens for about five seconds, then the line
waiting five seconds... done.
appears all at once. If it's run as "python -u sleep.py" then the first thing you see is the "waiting five seconds..." part. Then about 5 seconds later, "done." appears.

Another case where buffered output isn't so nice is if your process fork()s (copies the current process, creating a "child" process) with un-displayed characters left in the buffer. Here's an example of weird behavior:

from time import sleep
from os import fork
print "after sleeping, let's try a fork...",
sleep(5)
pid = fork()
if pid == 0:
    print "in child process"
else:
    print "in parent process; child is pid", pid
When we run it as "python sleep.py", we get this:
$ python sleep.py
after sleeping, let's try a fork... in parent process; child is pid 7370
after sleeping, let's try a fork... in child process
Why? Because at the time we call fork(), the output buffer has "after sleeping, let's try a fork..." -- which isn't displayed yet in the terminal window. When the parent adds "in parent process; child is pid 7370" and terminates the output with a newline character (by default), the output buffer is flushed—its contents are written to your display. But that only flushes the buffer of the parent process; the child's buffer still has those characters.

Thus, when the child process runs, an extra copy of "after sleeping, let's try a fork..." appears on the screen.

What if we run it as "python -u sleep.py"?

$ python -u sleep.py
after sleeping, let's try a fork... in parent process; child is pid 7367
 in child process
If you run this yourself, you'll see "after sleeping, let's try a fork..." appear almost immediately (i.e., you don't have to wait 5 seconds for it). When the process executes fork(), the buffer has already been flushed; that's why we don't see two copies of the "after sleeping..." part.

Why is the "child process" line indented by one space? Well, we didn't retain "after sleeping..." in the buffer when we created the child process, but we did retain the knowledge that we weren't at the start of a new line. Thus, the child process thinks we're not at the beginning of a new line, so it prepends a space to "in child process" before displaying it, just as it would if we were truly in the middle of a line. This is just the way Python's print statement works.

I hope that made sense. And since my Python scripts don't have a whole lot of output to the display, it doesn't hurt much to use "-u" all the time. Combining that with Guido's recommended "-tt" option... that's why I pretty much always have "-utt" in my Python scripts.