Tuesday, January 29, 2008

What's in it for me?

A rich young man came to Jesus, wanting to know the way of eternal life, and went away sad. But today I want to focus on the disciples, who are surprised by Jesus's comments.
"Again I tell you, it is easier for a camel to go through the eye of a needle than for a rich man to enter the kingdom of God."

When the disciples heard this, they were greatly astonished and asked, "Who then can be saved?"

Jesus looked at them and said, "With man this is impossible, but with God all things are possible."

Peter answered him, "We have left everything to follow you! What then will there be for us?"
Matthew 19:24-27
I love these guys. I love how, at least in this passage, they engage with Jesus fully, asking him about what troubles them.

"What's in it for me?" says Peter, speaking for the rest of them -- and for us too, if we're honest. What is he hoping Jesus will say? Does Peter hope for fame? He got that -- beyond his dreams! Did he hope for wealth? I don't think he got that one -- or long life on earth either. But if he had it to do over again, would he pass on Jesus's invitation? Not a chance!

What do I hope Jesus will say to me? What do you and I want from Jesus?

What I want first of all is to want what he wants for me. I want to be changed, to be purified. Because right now, the security and wealth thing is more attractive to me than it deserves to be.

Monday, January 28, 2008

A tough customer -- or a dumb one

You probably know the story: Moses and Aaron go to Pharoah king of Egypt. "This is what the Lord, the God of Israel says: Let my people go," they say, and Pharoah is unimpressed.

"Who is the Lord?" he says. "I do not know the Lord and I will not let Israel go." (Exodus 5:1-2).

That was dumb but understandable. Today's reading makes me think Pharoah was more than dumb:
He (Aaron) raised his staff in the presence of Pharaoh and his officials and struck the water of the Nile, and all the water was changed into blood. The fish in the Nile died, and the river smelled so bad that the Egyptians could not drink its water. Blood was everywhere in Egypt.

But the Egyptian magicians did the same things by their secret arts, and Pharaoh's heart became hard; he would not listen to Moses and Aaron, just as the Lord had said.
from Exodus 7:20-22
I found this astonishing. Moses and Aaron created an ecological catastrophe, and what did Pharoah do to prove his superiority? Did he reverse it? Oddly, he has his staff do more of the same.

Now why was this a Good Idea?
  • God says, "Let my people go."
  • Pharoah says, "I won't and you can't make me."
  • God says, "If you don't, I will ruin your country"
  • Pharoah says, "Ha! I can do that too!"
then the country is ruined (but I'm getting ahead of myself).

Here's my take on it: Pharoah is locked into his position. He's trying to show how tough he is -- that is, testosterone, rather than his brain, is doing his thinking. Put differently, he's in a power struggle. This struggle makes him stupid.

Have you done that? I certainly have -- arguing with somebody about something and at some point realizing the other person is right, but continuing to argue anyway because that was my position. Dumb? Yeah. Unique? Nope; it's been going on for over 3000 years.

May God help us to have soft hearts, so that we can turn toward him in repentance where needed, rather than running from him in denial!

Sunday, January 27, 2008

"I am the greatest" -- NOT

I have a disease. Not a physical one, but a spiritual one. You have it, too. So did Jesus's disciples:
At that time the disciples asked Jesus, "Who is the greatest in the kingdom of heaven?"
Matthew 18:1
They ask Jesus, "Who is the greatest?" rather than "Who is great?" for the same reason kids ask their parents, "Who do you love best?" rather than "Who do you love?"

Why do they do that? Why do we compare ourselves with others? In Searching for God Knows What, Miller remarks that we humans compare ourselves with others all the time, as though that would somehow ease the vague insecurity inside us. It's one of those really dumb and ineffective things we do, because even if I decide I'm better than someone else in some respect (a questionable conclusion in any case), there are lots more people in the world, or even just in my state, and so the vague insecurity would just keep coming back. There is no way to really be sure that I really am the greatest. But even if I was, then what? Ten minutes or ten years from now, I might not be.

It's a disease, it's an epedemic -- worse, it's endemic! In No Two Alike, Harris describes this tendency as a mental organ. The tendency to compare is part of the human condition. And it causes all kinds of problems. James tells us that from jealousy and selfish ambition, disorder and every evil thing follow. The proverbs say that jealousy is worse than anger or wrath. And of course all that comes from comparing ourselves with others.

So this comparison thing is a really bad deal. It's a kind of idol -- it has power over me, but only as much power as I give it. To break this power, I have just a few ideas.

First, when I'm tempted to say, "At least I'm better at <something> than ________ is" or "I'm glad I'm not as bad as ________" then I can try to remember the mistakes I've made, the people I've hurt, or whatever. This helps me to be less arrogant that I might otherwise be.

Similarly, when I'm feeling envious about somebody who has more money, a bigger house, a better-looking body (etc.) than I do, I can try to remember that many in this world, or even in my neighborhood, have less money or more problems or poorer health (etc) than I do. This helps me to be more grateful.

Finally, in all these things, I can choose to remember that everything I have is from God. Did I earn a lot of money? Who gave me the skills, the health, the good looks that allowed me to do that? (OK, never mind the good looks.)

That's about it for my ideas to fight this awful tendency to compare myself with others.

How many did you come up with? Just kidding!

Friday, January 25, 2008

Turnaround

Joseph's brothers sold him into slavery, but he's become Prime Minister of Egypt and now has power over them. When their father Israel (Jacob) dies, they're afraid, but look at how Joseph responds:
His brothers then came and threw themselves down before him. "We are your slaves," they said.

But Joseph said to them, "Don't be afraid. Am I in the place of God? You intended to harm me, but God intended it for good to accomplish what is now being done, the saving of many lives. So then, don't be afraid. I will provide for you and your children." And he reassured them and spoke kindly to them.
Genesis 50:18-21
Joseph is a great example to me of grace and mercy. Grace because he gives them good things they don't deserve -- mercy because he doesn't give them bad things they do deserve.

Now by being in Egypt, Joseph saved many lives, probably including his brothers', by interpreting the king's dreams and taking action on them. (Genesis 41:29-36). So who is the real hero in all this? Isn't it God, who sent the dream to the king to warn him of famine, who gave Joseph the ability to interpret the dream, granted him favor in the eyes of the officials so his plan would be adopted?

I've heard it said that God is the hero in every Biblical narrative. And isn't that true in our lives today?

Wednesday, January 23, 2008

Mild? I don't think so.

Have you seen paintings of Jesus in lovely pastoral scenes? His face is serene, and docile animals and children are nearby. These paintings, besides presenting Jesus as rather a boring (if sweet) character, leave out a whole lot about Jesus. Today's New Testament reading for example shows Jesus as anything but sweet and boring:
Then some Pharisees and teachers of the law came to Jesus from Jerusalem and asked, "Why do your disciples break the tradition of the elders? They don't wash their hands before they eat!"

Jesus replied, "And why do you break the command of God for the sake of your tradition?
Matthew 15:1-3
He goes on to describe exactly how they do that; he calls them hypocrites and blind guides.

Jesus doesn't come across as urbane or mild in this passage. He certainly isn't boring -- he is, as the Narnia characters say, "not a tame Lion."

Indeed, he doesn't suffer hypocrites gladly. Pious hypocrites seem especially to irk him. So I take this passage as a warning -- of an error to avoid.

But no Pharisee woke up one morning and said, "I want to become a pious hypocrite"; probably most of them started well, seeking to follow God. Somewhere along the way, they started focusing too much on the rules and not enough on knowing God himself -- so much so that when he came in person they didn't even recognize him.

I'm afraid there's a bit of the Pharisee in me: I tend to like rules. If I follow the rules, I feel like I'm all right, and if you don't follow them, I feel better than you.

But that's a completely wrong way of looking at life, and it's a temptation I must beware of, because I really don't want to end up like these pious hypocrites.

Jesus lived to bless others; he was focused on God, not on himself. Doesn't that sound like a better way to live? May God help you and me to go in that direction.

Sunday, January 13, 2008

openoffice: new slide template, old preso

The answer is at http://openoffice.blogs.com/openoffice/2006/05/bringing_the_ma.html

OK, now a little background. I'm doing a presentation -- not for work, or I'd just use their templates. I found some templates I liked at http://technology.chtsai.org/impress/ and after poking around, some others at http://thelinuxbox.org/?p=24

But given that I already started my presentation, how to apply the master pages to my existing (or "old") presentation? Solveig tells us how here.

Saturday, January 12, 2008

Simple Python Program, Part 1 (revised)

The elder teen was talking about learning Python, and I was trying to figure out what a simple problem might be that would help her pick it up. We chatted about a few things, and I thought, how about a calculator program? It could read expressions, one per line, evaluate them, and print the value. Being a little rusty on Python syntax and such, I decided to just write a sort of "echo" program. Here's what I came up with:

1 #!/usr/bin/python -tt
2 # vim:et:ai:sw=4
3 # $Header: /Users/collin/pycalc/RCS/calc.py,v 0.1 2008/01/10 01:11:34 collin Exp $
4 #
5 # simple calculator. Read and process an expression per line.
6 import sys
7
8 def do_one_expression(expr):
9 # For now, let us just see if we can print a line
10 print(aline)
11 return
12
13 if __name__ == '__main__':
14 for aline in sys.stdin:
15 do_one_expression(aline)
16 sys.exit(0)
17
18 # $Log: calc.py,v $
19 # Revision 0.1 2008/01/10 01:11:34 collin
20 # initial revision. this one double-spaces the input.
21 #
22 # $EndLog$

OK, let me go through this. You can safely ignore lines 1-5.

I want to read all the lines from "stdin" -- i.e., the sort of usual input for the program -- which I remembered in Python is called "sys.stdin"; hence I have to type "import sys".

Then I write the sort of workhorse routine, "do_one_expression" -- for this first version, this routine will simply print its input parameter and return. Remember, I'm just re-learning the syntax.

Finally, lines 13-16 will send "aline" to the workhorse routine, until we run out of input, at which point we exit.

What is that "__name__" business on line 13? Not needed here, strictly speaking, but this is useful if you ever want to run the Python debugger on the code. Line 14 is Python's way of iterating over all the lines in the standard input.

Line 16 is probably superfluous, but it's my habit and it doesn't seem to hurt anything.

So I ran this program, feeding it a file that looked like this:
line1
two
number three
and it gave me this:
line1

two

number three
That's right, it was double-spaced.

I remembered then that when you read from sys.stdin the way I do here, you get the line with its terminating newline character. Since the 'print" statement adds its own newline, I was seeing double-spaced output. So rather than calling "do_one_expression(aline)", I tried saying "do_one_expression(aline.rstrip())" but nothing changed.

What happened? Take a look at line 10; it prints the (global) variable "aline" -- not the parameter "expr"! Having fixed that, the program now looks like this:

1 #!/usr/bin/python -tt
2 # vim:et:ai:sw=4
3 # $Header: /Users/collin/pycalc/RCS/calc.py,v 0.2 2008/01/10 01:17:25 collin Exp $
4 #
5 # simple calculator. Read and process an expression per line.
6 import string
7 import sys
8
9 def do_one_expression(expr):
10 # For now, let us just see if we can print a line
11 print(expr)
12 return
13
14 if __name__ == '__main__':
15 for aline in sys.stdin:
16 do_one_expression(aline.rstrip())
17 sys.exit(0)
18
19 # $Log: calc.py,v $
20 # Revision 0.2 2008/01/10 01:17:25 collin
21 # Solved two problems: First, the subroutine do_one_expression was
22 # printing aline, not its parameter! Second, we now kill trailing
23 # blanks from the string read.
24 #

25 # Revision 0.1 2008/01/10 01:11:34 collin
26 # initial revision. this one double-spaces the input.
27 #
28 # $EndLog$

By the way, the lines with the yellow background are lines that were added or changed from the previous version.

Okay -- now it can read lines and print them out without double-spacing them. How about doing something useful? Let's see if we can break the line into tokens. Since we are not going to do anything very fancy, maybe something like the string routine "split" will work. If you're not sure (as I wasn't) whether "split" would handle multiple spaces or tabs, you could try this:

% python
Python 2.3.5 (#1, Aug 22 2005, 22:13:23)
[GCC 3.3 20030304 (Apple Computer, Inc. build 1809)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> " oneword after_tab after_spcs 17 21 ".split()
['oneword', 'after_tab', 'after_spcs', '17', '21']
>>>

Cool. It even strips leading and trailing whitespace! So if I put in a string like
123 456   +
then we should be able to "split" it and get an array containing "123", "456", and "+".

We could do something like "atoi(3)" on each of the numeric strings (to convert strings like "123" into a number, i.e., 123), and look at the operator ("+" in this case) to decide what to do with the numbers.

I thought I'd use a sort of RPN syntax, so that I could put only numbers on the stack (rather than numbers and operators), and I wouldn't have to deal with parentheses. So the flow for do_one_expression would be something like this:

split the expression into 'tokens'
for all tokens in the expression (the line):
if it's numeric
transform into a number
push it onto the stack
if it's "+"
pop 2 numbers off the stack
add them
push the sum onto the stack
if it's "-"
do the analogous operations...
When tokens exhausted, print the top item from stack.

I looked in the Python library reference manual (in your distribution or google it) for "atoi" and found:
Deprecated since release 2.0. Use the int() built-in function.
So that's what I'll use for converting strings to numbers. Here's the simple integer calculator:

1 #!/usr/bin/python -tt
2 # vim:et:ai:sw=4
3 # $Header: /Users/collin/pycalc/RCS/calc.py,v 0.3 2008/01/10 01:35:50 collin Exp $
4 #
5 # simple calculator. Read and process an expression per line.
6 # Make that an RPN calculator. No (parens)
7
8 import string
9 import sys
10
11 def do_one_expression(expr):
12 tokens = expr.split()
13 nstk = []
14 for atoken in tokens:
15 if atoken.isdigit():
16 nstk.append(int(atoken))
17 continue
18 if atoken == '+':
19 second = nstk.pop()
20 first = nstk.pop()
21 nstk.append(first + second)
22 continue
23 if atoken == '-':
24 second = nstk.pop()
25 first = nstk.pop()
26 nstk.append(first - second)
27 continue
28 # If we get here, unsupported operator.
29 print "** Unknown operator: '" + atoken + "'; ignored."
30 continue
31 # Done with tokens.
32 print "Problem:" , expr
33 print " answer:", nstk.pop()

34 return
35
36 if __name__ == '__main__':
37 for aline in sys.stdin:
38 do_one_expression(aline.rstrip().strip())
39 sys.exit(0)
40
41 # $Log: calc.py,v $
42 # Revision 0.3 2008/01/10 01:35:50 collin
43 # this one does addition and subtraction, integers only
44 #

45 # Revision 0.2 2008/01/10 01:17:25 collin
46 # Solved two problems: First, the subroutine do_one_expression was
47 # printing aline, not its parameter! Second, we now kill trailing
48 # blanks from the string read.
49 #
50 # Revision 0.1 2008/01/10 01:11:34 collin
51 # initial revision. this one double-spaces the input.
52 #
53 # $EndLog$

As you can see, lines 12-33 form the bulk of the changes. Line 12 splits the line into tokens, as described earlier. The stack is kept in a Python "list", which is defined and initialized at line 13. (It gets newly minted every time do_one_expression gets called.)

Line 15-17 handle the case where the "token" is a number. I determined (by experiment) that the string function "isdigit" (line 15) returns True when the entire string consists only of digits. So if atoken is all-numeric, it represents a number, and so int(atoken) is its numeric value. We push it onto the end of the list by calling nstk.append() (line 16). The continue statement at line 17 says that's it for this pass through the loop, so we go back to the top of the loop.

Lines 18-22 process the addition operation. If we see that the present token is a '+', then we pop two elements off the stack (lines 19-20), and push (or append) their sum onto the stack in line 21.

Now in 19-20 it doesn't matter which order I pop the elements off the stack, but in lines 24-25 it does. Imagine how this code handles the expression "7 3 -":
  • we push 7 onto the stack;
  • we push 3 onto the stack;
  • when we see the "-" we pop 3... we set
    second = 3
    and likewise set
    first = 7
  • then, executing line 26, we append (or "push") first-second (i.e., 7-3→4) onto the stack.
So although I could have replaced lines 19-21 with
nstk.append(nstk.pop() + nstk.pop())
it would not be safe to replace lines 24-26 with such a line.

Line 29 handles the case where neither a number nor a known operator was supplied. Rather than completely giving up, though, the program continues. Hence if the user types "7 4 should_be_3 -" we'll still eventually print the answer.

Next time I'll describe how to make the program handle floating-point numbers, and also how to make it a little more interactive.

Friday, January 11, 2008

How Important is Self-Image?


The third chapter of Proverbs opens with a half-dozen commands dealing with what one PBC pastor called "skills":
  • remembering (3.1: "do not forget my teaching...")
  • faithfulness (3.3: "Let love and faithfulness never leave you")
  • trusting (3.5: "Trust in the Lord")
  • humility (3.7 "Do not be wise in your own eyes")
  • stewardship (3.9: "Honor the Lord with your wealth")
  • accepting reproof (3.11: "do not despise the Lord's discipline")
One of today's readings comes from this section:
Do not be wise in your own eyes;
fear the Lord and shun evil.
This will bring health to your body
and nourishment to your bones.
Proverbs 3:7-8
Like most of the other commands here, this one comes with a promise. The promise isn't absolute (it is possible to be humble, fear the Lord, shun evil, and yet die from cancer--even bone cancer), but they give a picture of the way things generally work.

What has my attention from today's passage, though, is the contrast between
  • the prohibition:
    • Do not be wise in your own eyes
  • and the precepts:
    • fear the Lord,
    • and shun evil.
The writer seems to be telling us that being wise in our own eyes is contrary to fearing the Lord.

And why is that? Because we're wrong so much of the time, and pride blinds us to our own folly. Unlike Einstein, many of us would rather think we're right than to find out where we're wrong.

So how are we doing? When you or I hear that we've been doing the wrong thing, do we stop doing it and change our course?

At the office, I've been working with some folks to change the way we develop software. Several weeks ago, we hired someone who started telling me he was concerned about the direction we're headed with these changes: basically, we're headed in the wrong direction. He didn't say it like that--he was tactful and professional--but that was the import of his remarks.

Did I tell him it was too late to change? At least this time I didn't--maybe because the Lord knew I'd be writing about this passage soon? It was a little hard to take, but I had to admit there was something to what he said. So I had to think about how to say, "I think I've been steering us in the wrong direction" -- essentially "I was wrong then, but I'm not wrong now."

Not the easiest thing, but probably better than the alternative.

And you know what? I don't know about nourishment in my bones, but having come clean, I feel better.