Friday, July 27, 2012

Driving unconsciously

Started about two weeks back…
I like to think of myself as a courteous driver; when freeway traffic is stopped and someone wants to merge on, I usually let them in. Sometimes, though, if we've been taking turns (one car from the freeway, one from the onramp, one from the freeway, etc.) and suddenly two cars try to merge in front of me, I don't feel like letting the second one in.

Similarly, when getting onto the freeway, I take my turn, though sometimes, if someone already on the freeway doesn't want to let me take my turn, I feel peeved and try to push my way in.

At this point I have to step back and ask myself, what's the big deal if I let one more car in ahead of me, or if I get onto the freeway one car later? What if the person who won't let me in is from out of town, and they're following a friend (who's just about out of sight)? What if the person nosing in front of me has just received word that a loved one is in the emergency room? Couldn't I show them a little grace? Like Jesus said, shouldn't I treat them as I want to be treated? That could be me next time! And sometimes, I actually do.

But not always. Yesterday I was in a traffic-jam situation, bumper-to-bumper, and a luxury convertible passed me on the right and tried to merge in. I wasn't inclined to give him a break, though I wasn't thinking much about it. I just knew I felt my space was being invaded (what did I mean, "my space," anyway? I don't own the road).

He jammed his way in, and having won that argument, flipped me off. I felt like lobbing a paintball at him.

But then I thought, what exactly did happen there, anyway? Did he in fact pass me on the right and cut me off? Did I deserve his wrath?

I had to think about it; I suppose I've done many unkind things on the road—consciously or unconsciously—and so I had to say to the Lord, "Help me not to be deserving of wrath." And as I write this, a passage from 1 Peter 2 comes to mind:

[W]hat credit is there, if when you sin and are harshly treated, you endure it with patience? But if when you do what is right and suffer for it, you patiently endure it, this finds favor with God. For you have been called for this purpose, since Christ also suffered for you, leaving you an example for you to follow in his steps.
1 Peter 2:20-21, NASB (approximately)

Thursday, July 26, 2012

Thunderbird error copying message to sent folder—with dovecot

The past few weeks, my thunderbird email client has had trouble reading some messages and writing others. I searched for solutions, but none of them did much (I tried compacting my inbox, which is where I experienced the symptom, and this may or may not have helped). Pretty much I said File→Quit, then "killall -i thunderbird" and restarted. But I did that several times today and thought of something else.

Thunderbird on my OpenSUSE 11.3 Linux desktop talks IMAP to a local copy of dovecot (all folders are Maildir on local disk), and I wondered if the problem might have to do with dovecot rather than t-bird. I had read something about dovecot and bad index files affecting mbox-style folders but I decided to give the index thingie a try anyway.

First I stopped dovecot, then went into Maildir and said "mkdir OLD_DOVECOT_INDEX_FILES; mv dovecot.index* OLD_DOVECOT_INDEX_FILES/" and restarted dovecot. So far the results are promising; all things email seem snappy. Here's size/etc of old vs new index files:

collin@collin-dlx: ~/Maildir
total 12748
-rw-r--r-- 1 collin   285448 2012-07-26 13:33 dovecot.index
-rw-r--r-- 1 collin 12689408 2012-07-26 15:29 dovecot.index.cache
-rw-r--r-- 1 collin    12908 2012-07-26 15:29 dovecot.index.log
-rw-r--r-- 1 collin    32776 2012-07-26 13:33 dovecot.index.log.2
collin@collin-dlx: ~/Maildir
% ls -o dovecot.index*
-rw-r--r-- 1 collin 285832 2012-07-26 15:50 dovecot.index
-rw-r--r-- 1 collin  31744 2012-07-26 16:09 dovecot.index.cache
-rw-r--r-- 1 collin   5768 2012-07-26 16:09 dovecot.index.log
-rw-r--r-- 1 collin 127628 2012-07-26 15:48 dovecot.index.log.2
The big thing I notice is that the cache, which was formerly over 12 Mbytes, is now down to about 32K. Interestingly dovecot.index.log.2 is much bigger than the old one, but that doesn't seem to hurt anything.

Obviously, I hadn't run with the newer index files very long before doing the "ls -o", but about 5 hours later t-bird was still able to talk happily to dovecot and show/copy messages just fine.

So far, then, this plan looks like it may have solved my problem. I'll update this posting if not.

Wednesday, July 25, 2012

Sorting QIF records... a Python3 script

As somewhat of a modern Luddite, I use Quicken® 2002 basic for my home accounting; fortunately, I can download ".qif" reports for my accounts.

But one credit-card account doesn't give me the records in an order I can understand. Usually, I want to know the date range of last week's download, so I type something like
$ grep "^D" visa.QIF | sort
and based on the output, I'll search for transactions dated the following day or later. This way, I won't confuse myself by seeing the same transactions I saw last week (this is where déjà vu is for real).

Tonight I was confused the other way: I ended up with a .QIF file that was missing some transactions. As usual, the transactions were listed in some apparently-random order, and I didn't trust the bank to display transactions on-screen in the same order. Fortunately, the website can be told to display the transactions in some nice order (by transaction date, for example, or post date—ascending or descending). I like this concept, but it's too bad I haven't figured out how to download those transactions in a nice order. It may not be possible.

I wanted to have the on-screen stuff and my QIF file in the same order so I could see what was missing more easily, and feel confident that I had caught everything. How to sort the "QIF" file? For those who don't know, (but why are you reading this?), a QIF file looks like this:

A few things to note:
  • Entries consist of 6 lines, at least they do here; the 6th line begins with ^ and indicates the end of the entry
  • Dollar amounts are preceded by "T" and use commas to separate thousands
  • Dates are preceded by "D" and are in the American format, sort of: mm/dd/yyyy
Since entries have multiple lines, there's not an easy way to just sort them via the "sort" command. So naturally I wrote some Python. If it weren't so late I'd explain it all in some detail. I at least want to share it with you though:
#!/usr/bin/python3 -utt
# vim:et:sw=4
'''Program to sort records from a quicken 'qif' file.

Parameters: filename'''

import os
import sys
from time import localtime, mktime, strftime, strptime

def main(args):
    '''Read quicken records from a qif file, creating a dict for each one.
    At end of file, sort them by US-style date and print them.'''
    if len(args) != 1:
        print('Expected exactly one parameter, viz., filename; got',
                args, file=sys.stderr)
    if not os.path.exists(args[0]):
        print("Can't find inputfile %s" % args[0], file=sys.stderr)
    xactions = list()
    curr = dict()
    for aline in open(args[0], 'r'):
        aline = aline.strip()
        if not aline:

        akey = aline[0]
        aval = aline[1:]
        # end of record?
        if akey == '^':
            if curr:
                curr = dict()
        elif akey == 'T':
            curr[akey] = float(aval.replace(',', ''))   # 1,234 => 1234
        elif akey == 'D':
            curr[akey] = mktime(strptime(aval, '%m/%d/%Y'))
            curr[akey] = aval

    xactions.sort(key=lambda X: X['D'])
    for one in xactions:
        print('%s $%8.2f %4s %s' % (strftime('%Y-%m-%d', localtime(one['D'])),
                                        one.get('T', 99999.99),
                                        one.get('N', '#?')[:4],
                                        one.get('P', '<payee unspecified>')))

def date_cmp(a, b):
    '''Compare dates of two qif-based entries.'''
    return cmp(a['D'], b['D'])

if __name__ == '__main__':
Oh, the date_cmp() function is struck out, because it's not needed in this program. Why did I write it then? Because I was thinking of the way sorting works in python2.x, where you pass a comparison function into sort() if you want to use a non-default one, This post from last year shows how that one works. We don't need it here, though, and actually can't use it, because the sort of Python3 uses a "key" function, rather than a "cmp" function.

With that out of the way, here's how it works, basically: we read the input file ("Activity.QIF" or "Quicken.qif" or whatever) one line at a time. when we see a '^' then we're done with one entry and stash it in a list.

Each entry, by the way, is a python "dict" (like a hash for you Perl guys) -- the key is the first character in each line, and the value is everything after that. For some reason, I wanted to convert the dollar amounts into floating-point numbers (what was I thinking?) and in order to do that, I needed to kill off any ','; that's why the
float(aval.replace(',', ''))
construct above.

For the dates, I wanted to be able to sort them easily, and I thought the easy way to do that was to convert them into scalar values corresponding to "number of seconds since the epoch", so that's what the mktime/strptime stuff is about. By the way, I usually like to code like "import os" and then later "os.path.exists(...)." This avoids embarrassing name collisions, and besides makes it clear where each thing came from. But with all those "time" routines, is there any doubt where they came from? I mean, localtime, mktime, str*time.

When we get to the end of the file, we've got all the records, so we sort them. A sanity-check (to make sure we don't have data left over in curr) might be nice, but that's "an exercise for the reader."

As I mentioned above, the sorting uses "key" rather than "cmp", and the "key" function just takes the value in each entry corresponding to the 'D' element—a less-than-one-liner, so I used a lambda to say, "hey, map X to X['D']"; it's not worth a whole "def funcName(foo):"

We then take the sorted list and print one element at a time: date, dollar amount, "check number" (that's what the "N" is), and payee. (Is it something else for deposits? I dunno.)

If it weren't past my bedtime, I'd explain further. But it is, so I won't. Except to point out that in python3, "print" is a function, not a statement. I may add more explanation later.

Sunday, July 22, 2012

Overcoming Anxiety - Part Deux

(Part one was several years ago—also linked here.) Recently I heard some things about anxiety, and I wanted to share them.

The first thing is that anxiety is related to trying to manage outcomes. (Where did I hear that? It wasn't here.) This put me in mind of something I read in Merton's No Man Is an Island, which I've been (re-)reading for years:

Johannes Tauler somewhere makes a distinction between two degrees of pure intention, one of which he calls right intention, and the other simple intention. …

When we have a right intention, our intention is pure. We seek to do God's will with a supernatural motive. We mean to please Him. But in doing so we still consider the work and ourselves apart from God and outside Him. Our intention is directed chiefly upon the work to be done. When the work is done, we rest in its accomplishment, and hope for a reward from God.

But when we have a simple intention, we are less occupied with the thing to be done. We do all that we do not only for God but so to speak in Him. We are more aware of Him who works in us than of ourselves or of our work. …

4.17 (pp. 70-71)

With a right intention, you quietly face the risk of losing the fruit of your work. With a simple intention you renounce the fruit before you even begin. You no longer even expect it. Only at this price can your work also become a prayer.

4.18 (p. 74)
Since much of the time my intention is impure, it's no wonder that I have anxiety; I want to do what I want to do, and I sometimes see God's will as something I have to accommodate myself to. So naturally when I'm doing my will, I'm pursuing some outcome; I want my work to produce some result—that's why I do it!

So I need to be transformed by the renewing of my mind (Romans 12:2) so that I can have a pure intention—and more than that, a simple one.

I wonder if that's what the author of Hebrews meant when he wrote:

There remains, then, a Sabbath-rest for the people of God; for anyone who enters God's rest also rests from his own work, just as God did from his. Let us, therefore, make every effort to enter that rest, so that no one will fall by following their example of disobedience
Hebrews 4:9-11 (NIV)
If I can really do that, truly surrender the fruit of my work before I even start, then maybe I'll be able to enter that rest, to be transformed.

And the world will be a better place, at least for people who interact with me.

A couple more things

A friend asked us to pray "that I would be less concerned about what other people think of me, and more interested in what God thinks." This is certainly an important part of finding rest for our souls (which Jesus promised in Matthew 11:28-30); when we are working for others' approval, it's a tough row to hoe... especially since every day brings new opportunities to be criticized or judged by somebody. Jesus wasn't talking about this in John 6:27-29, but if we truly believe in Jesus, believe that he is the source of life, and look only to Him for our approval, I wonder if we'd have less anxiety, less hunger in our souls.

And on the other end, something that can increase anxiety is… being an American! A recent article points out that the United States is, in the author's words, "the world's leading exporter of worrywarts"—which, she says, is a consequence of our broken meritocracy. We Americans like to think that we can have "success"—we can manage our career outcomes—by ability and effort, but it's not actually true. The uncertainty exacerbates the anxiety that would be there anyway.

This doesn't mean that anxiety is inevitable for Americans, but if you're an American and wondering why you can't get rid of anxiety, that may be part of why it's harder than it ought to be.

The good news, though, is that our God is mighty to save.

Thursday, July 12, 2012

A little good news today from Caltrain

According to Caltrain's ticket types page, a monthly pass can now be bought as late as the 15th of the month. This is great news, because in the past, I've returned from vacation on the 10th of the month, when the monthly pass nazis said "No monthly pass for you!"

The monthly pass is still a good deal on the 15th, because the it's the only pass that doesn't require one to "tag off" at the end of each trip.

I still hate the clipper card, and I still wish I didn't have to use it, but this "can't buy your monthly pass after the 9th" vexation at least is over.

Friday, July 06, 2012

Another confession

As I mentioned earlier, I'm on the nominating committee for our church, and we're currently in the process of selecting, or rather discerning, who should be added to the board this fall.

The process involves meeting the candidates and hearing their stories: how did you meet Jesus, how is your relationship with him now, how have you seen God at work in/through your life—this sort of thing. People have wonderful testimonies of God's work in their lives, and as I wrote earlier, our meetings—both our discussions with each candidate and our debriefing discussions afterward—bring a lot of joy and encouragement.

And insecurity and envy too. When we say that someone is very spiritual, or we're impressed with the things God has done in and through them, or that the level of maturity is really high, then—well, it's embarrassing, but there's a part of me that wonders, "What did they say about me when I was a candidate?" or "What would they say if I were the one who'd been interviewed?"

Isn't that silly? We're talking here about godliness, about how closely someone is living with God, and I've got insecurity and envy about that.

Which is why I find myself singing "I Need Thee Ev'ry Hour" a fair amount lately. A good reminder, and certainly true for me.

Who is my brother?

Why is this question important? I mean, do we really need to know who is a brother (or sister) in Christ, vs. who isn’t? In other words, can’t we just treat everyone the same?

Well, Jesus does say to love our enemies (Matthew 5:44-47), and we can certainly honor and respect everyone we meet, but the New Testament writers warn us about false prophets (2 Peter 2:1; Jesus calls them “wolves in sheep’s clothing”—Matthew 7:15), antichrists (1 John 2:18), people trying to lead us astray (1 John 2:26), purveyors of a different gospel (Galatians 1:8), wolves who distort the truth (Acts 20:29), etc. And Jesus himself told us that if a brother doesn’t listen after being reproved, to “treat him as you would a pagan or a tax collector” (Matthew 18).

But wait; aren’t we all God’s children? Well—no, we aren’t; John writes that Jesus gave the power (or the right) to become children of God to those who welcome him, who believe in him (John 1:12). This would be meaningless if everyone were already God’s child. Jesus also said to some religious leaders in his day, “You are children of your father the devil” (John 8:44), and Paul writes about being adopted (Romans 8). Although every human being is created in God’s image, we are not all his children in the way Jesus or John or Paul thinks, until something happens.

What is that something? Well, the Bible doesn’t tell us in a scientific or systematic way; it’s not like the DSM or the Motor Vehicle Code. The biblical writers use a number of different terms: John 1:12 talks about receiving or welcoming Jesus, which is related somehow to believing in his name; those who do that can become children of God. Similarly John 3:14-15 talks about believing in Jesus, who would be lifted up the way the snake was lifted up in the desert; those who believe receive eternal life. The Apostle Paul talks about a righteousness from God, which comes through faith in Christ to all who believe (Romans 3:21-22) [mouse here for more].

So not everyone is God’s child; is it enough if someone says he believes in Christ? Well, what does he believe about Christ? When the Apostles talk about believing in Christ, they mean believing what they say about him—for example that he was a real person who died for our sins and rose from the dead. In his gospel and his first letter, John begins by talking about Jesus and the fact that he (John) personally saw him: “The word became flesh and dwelt among us... and we have seen his glory” (John 1:14); “That which was from the beginning, which we have heard, which we have seen with our eyes, which we have looked at and our hands have touched...” (1 John 1:1). John is also specific in his instructions about testing the spirits:

Dear friends, do not believe every spirit, but test the spirits to see whether they are from God, because many false prophets have gone out into the world. This is how you can recognize the Spirit of God: Every spirit that acknowledges that Jesus Christ has come in the flesh is from God… (1 John 4:1-2)
I take the phrase “has come in the flesh” as shorthand for “has come in the flesh, dwelt among us, taught us about God, died for our sins, and was raised from the dead”—as Paul says in the first few lines of 1 Corinthians 15.

At least this is how I read the New Testament writers. I don’t think someone has to believe in the historicity of Jonah or Hosea to be a brother in Christ; they don’t have to agree with me on the rite of baptism, they needn’t share my views on sexuality, politics, fiscal or monetary policy, or women’s ordination to be a brother in Christ. They could be a communist or a racist or a libertarian, they might have bad table manners, they might pick their nose or scratch their armpits in public, they might smoke tobacco or marijuana; if they believe Christ died for their sins, if they welcome him into their lives, then they’re a brother (or sister) in Christ. We may choose our friends; we don’t choose our family members.

On the other hand, if someone doesn’t believe Jesus was a real person, or they think Jesus didn’t really suffer and die for our sins, or they don’t believe Jesus really rose from the dead, then they’re not a brother in Christ, though they may be a very nice person. Someone who thinks Jesus Christ was a kind of ideal concept, or who thinks the resurrection was some ahistorical tale, may be a great humanitarian, but they’re not in the family of God. They might go to the same church, they might dress nicely and speak politely and have the “right” views on a lot of social issues, but they’re neighbors or friends, not part of God’s family.

“Our God is mighty to save”… me?

As the band rehearsed for the 9:30 service, I reflected on that line from the chorus:
He can move the mountains
Our God is Mighty to save
He is Mighty to save
Mighty to Save by Michael W. Smith
[click for full lyrics]
Evangelicals used to talk a lot about escaping judgment (see for example John 5:24). We didn’t make up that concept, but it doesn’t communicate much to the modern materialist. In other words, if someone thinks that the present life is all there is, hell isn’t scary; the same applies to someone who doesn’t think himself a major villain—he might say to himself, “I’m no Hitler or Milošević—hey, I’m not even Bernie Madoff—so I guess I’ll do okay.”
and I wondered, if I weren’t already a believer in Jesus, what would I make out of these lines? I mean, let’s be realistic: as an upper middle class American male—in other words, as a man of privilege—what kind of salvation do I (or men like me) need? A not-very-helpful answer is mentioned in the box at right.

But as I asked the myself the question, the words of the Apostle Peter came to mind: “you were redeemed from the futile way of life inherited from your forefathers” (from 1 Peter 1). Peter also wrote about being “useless or unfruitful” (2 Peter 1) and how we can avoid that. Paul’s words also came to mind: “For we ourselves were once foolish, disobedient, led astray, slaves to various passions and pleasures, spending our days in malice and envy, hated by men and hating one another” (from Titus 3). From these passages we might have the beginnings of an answer for the post-modern man who thinks he has everything.

Because even the healthy, successful American man isn’t as good a person as his dog thinks he is; his family and his colleagues and his subordinates have seen his selfishness, his mistakes, his blind spots. And if he’s honest with himself, he also knows self-doubt. Has his life made a difference, really? Will this world be better because he was in it? What does his life mean beyond the accumulation of experiences, possessions and accomplishments?

Paul’s words are echoed in step 1 of AA-esque twelve-step programs: “We admitted we were powerless over alcohol— that our lives had become unmanageable.” (link) That is, we are not masters of ourselves; we cannot control our tongues (try going 24 hours, or even two waking hours, without complaining). We need to be saved from our blind spots, our envy, greed, pride, and so on; we need to be saved lest our lives be wasted in our selfishness and futile slavery to our urges.

And Jesus came to save us from a meaningless life; he offers us salvation, not only an escape from the judgment of Hell, but also the opportunity to join with him to bring the Kingdom of Heaven to earth—beginning with our own hearts. This is what he meant when he taught us to pray, “Father in heaven… your kingdom come, your will be done on earth as it is in heaven” (Matthew 6). And when he says, “What does it profit a man to gain the whole world and forfeit his soul?” (Mark 8), he doesn't just mean that one might suffer eternal judgment after this life is over; he also means that one may gain an abundance of accomplishments, experiences, possessions—one may be a man of privilege—yet still not be comfortable in his own skin in this futile and meaningless life.

But this need not be anyone’s fate, because Jesus is mighty to save. And when we sing that Jesus conquered the grave, we don’t just mean we have a chance to live forever after we die; we also mean that Jesus overcame the tragedy of death. That is, when our time on earth is up, we can leave knowing that our lives are not useless or unfruitful, that we did not entirely waste them in futile pursuits, that in the end God was pleased with who we have become.

Author of salvation
He rose and conquered the grave
Jesus conquered the grave
Mighty to Save by Michael W. Smith
[click for full lyrics]