Monday, January 19, 2015

snow leopard to Yosemite upgrade, part trois: procmail bug problem

Sincerely hoping this is the last part. In part deux we figured out question #4 from my list in part 1. So now on to questions #3 and #1, as I hope #2 will take care of itself.
Actually I'm pretty sure that if I fix #3, then #2 will be fine. Why? Because it's true for the lovely Carol; her .procmailrc isn't problematic, and her email went fine into Maildir/newMaildir/cur.

Yes! I've got to take my encouragement when I can.

Anyway, to debug #3, I tried this:
mini1:~ collin$ cat Mail/backup/92784 | strace procmail
-bash: strace: command not found
mini1:~ collin$ 
Dang. There is no strace, but there is a truss, dtruss actually, on Mac OS X. It requires root privileges. So I became root and ran procmail on a minimal .procmailrc which nonetheless has a line like
FROM=`sed 1d | formail -I reply-to: -I resent-from: -I return-path: | \
        formail -rzxTo:`
Sure enough, the dtruss output convinced me that this particular feature is b0rken in the current procmail.

Fortunately, that's the only place I use that in .procmailrc, and it's not actually needed. So I said…

mini1:~ collin$ cat Mail/backup/92708 | procmail
mini1:~ collin$ 
and clicked "Get mail" on thunderbird. It asked for my password, and there my mail was.

So there's something rotten in the Yosemite version of procmail 3.22. That was with /usr/bin/procmail, and I wondered if the mac port version would have a similar issue. Yes :(.

mini1:~ collin$ cat Mail/backup/92862 | formail -imessage-id: | /opt/local/bin/procmail .procmailrc.1.18
Abort trap: 6
mini1:~ collin$ 
Guess I'd better file a ticket.
Done: https://trac.macports.org/ticket/46623
Now for question #1: the issue may have been as simple as needing to add a component to $PATH, as:
mini1:~ postman$ grep PATH tunnel.sh
PATH=$PATH:/usr/sbin:/usr/local/bin
mini1:~ postman$ 
Formerly, fetchmail was in some common place like /usr/bin but I had to install it myself, which I did Sunday. So now it's in /usr/local/bin/fetchmail—which probably wasn't in root’s path and hence might not be in $PATH at all given that the script is invoked by root from launchctl.

But I think everything works now. Whew!

snow leopard to Yosemite upgrade, part deux: dovecot

continued from part one

Found this post from Robert Chalmers, advising me to upgrade dovecot to something more modern… which requires libiconv. So:

While in the midst of that, I figured I should get rid of the old dovecot from mac ports. So I said "port list | grep dovecot" and found instead a dovecot2, which I decided to install:
mini1:~ collin$ sudo port install dovecot2
After some muddling around with that (I had to deactivate some old packages basically), I became root and…
bash-3.2# doveconf -n > dovecot-new.conf
bash-3.2# mv dovecot-new.conf /opt/local/etc/dovecot/dovecot.conf
But trying to run dovecot gave me an error message... default login user (dovenull) doesn't exist. Why not? Because it's spelled wrong.
bash-3.2# grep dovenull /etc/passwd
_dovenull:*:227:227:Dovecot Authentication:/var/empty:/usr/bin/false
bash-3.2# 
So I added the required line to dovecot.conf:
default_login_user = _dovenull
and voilà (pardon my French). I ran over to the lovely Carol's desktop computer and restarted Mail.app; 80 new messages.

Praise God from whom all blessings flow! Thus is #4 solved.

Updating mac mini from snow leopard to Yosemite

I need to run Quicken on the lovely Carol's mac mini, so I ran over to OfficeMax and picked up a copy of Quicken 2015, on sale with $10 off. I wish I had remembered my $15 off gift card, which I guess will have to wait for another trip.

I ran the installation script and learned the awful truth: Quicken requires Mac OS X 10.7 or later, and we were running 10.6.8 or thereabouts on the mini. Today, of course, you can't upgrade to 10.7 (at least not easily); you upgrade to Yosemite. Having read stories of angst and annoyance, I wasn't looking forward to the update process, but I plunged ahead.

First, I had an argument with the app store, which insisted I add "security" questions. I'll spare you the rant. Then I started the download. Some hours later, the download was complete and I started the installation. The whole thing, start to finish, was done Saturday, probably within twelve hours.

Sunday

However, I somehow noticed that we weren't fetching email from our ISP's server. I don't remember how I decided this (it was a long time ago—last night). After a good night's sleep, I took a look at the computers this morning. My Linux box was OK to start, and I was delighted to find that the mac mini was serving NFS just fine. Even the mini's POP server was running.

So why weren't we fetching email from our ISP? A little detective work revealed that unlike with snow leopard, fetchmail isn't installed on Yosemite. To wit:

mini1:~ collin$ uname -a
Darwin mini1.local 14.0.0 Darwin Kernel Version 14.0.0: Fri Sep 19 00:26:44 PDT 2014; root:xnu-2782.1.97~2/RELEASE_X86_64 x86_64
mini1:~ collin$ type fetchmail
-bash: type: fetchmail: not found
mini1:~ collin$ 
Well. I thought I would update ports so I became root and fumbled around a bit:
bash-3.2# port selfupdate
Warning: port definitions are more than two weeks old, consider using selfupdate
--->  Updating the ports tree
--->  Updating MacPorts base sources using rsync
MacPorts base version 1.9.1 installed,
MacPorts base version 2.3.3 downloaded.
--->  MacPorts base is outdated, installing new version 2.3.3
Installing new MacPorts release in /opt/local as root:admin; permissions 0755; Tcl-Package in /Library/Tcl

Error: /opt/local/bin/port: port selfupdate failed: Error installing new MacPorts base: shell command failed
bash-3.2# ^D
Hrmpf. Ran a web search, which led me to this stackoverflow article which in turn pointed me to a blog entry that mentioned the XCode command line tools: apparently I need to open the XCode preferences pane.

But first I needed to install XCode, which I'm doing now... done. Next:

bash-3.2# port selfupdate
--->  Updating the ports tree
--->  Updating MacPorts base sources using rsync
MacPorts base version 1.9.1 installed,
MacPorts base version 2.3.3 downloaded.
--->  MacPorts base is outdated, installing new version 2.3.3
Installing new MacPorts release in /opt/local as root:admin; permissions 0755; Tcl-Package in /Library/Tcl

 
The ports tree has been updated. To upgrade your installed ports, you should run
  port upgrade outdated
bash-3.2#
So I did that and saw several times the admonition that
bash-3.2# port upgrade outdated
Warning: The Xcode Command Line Tools don't appear to be installed; most ports will likely fail to build.
Warning: Install them by running `xcode-select --install'.
H'm... Not sure. I looked at the Xcode preferences panel, as Well, fools rush in where wise men fear to tread, so following the previous link ... but the preferences panel doesn't have anything about the command line tools. Another web search led to this set of instructions, which don't work, either. :(

Following this link I tried to simply snag fetchmail using mac ports.

bash-3.2# port install fetchmail +ssl 
Warning: The Xcode Command Line Tools don't appear to be installed; most ports will likely fail to build.
Warning: Install them by running `xcode-select --install'.
--->  Computing dependencies for fetchmail
Error: Dependency 'libcomerr' not found.
To report a bug, follow the instructions in the guide:
    http://guide.macports.org/#project.tickets
Error: Processing of port fetchmail failed
bash-3.2# 
At this point, it was time to stop and make dinner.

Monday morning

Okay, I'm going to give up on ports for now because I found this set of instructions which informs me that
fetchmail ceased to be bundled with server a while ago (it was last bundled with Lion), but it still works.
So I downloaded the archive fetchmail-6.3.26.tar.xz from the sourceforge site and said this on my Linux box (I'm not sure if the Mac tar groks xz): tar -xJf ~/Downloads/fetchmail-6.3.26.tar.xz. Then, back on the mac mini:
mini1:fetchmail-6.3.26 collin$ ./configure && make
checking build system type... x86_64-apple-darwin14.0.0
checking host system type... x86_64-apple-darwin14.0.0
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... ./install-sh -c -d
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... yes
…
mv -f .deps/odmr.Tpo .deps/odmr.Po
gcc  -g -O2   -o fetchmail socket.o getpass.o fetchmail.o env.o idle.o options.o daemon.o driver.o transact.o sink.o smtp.o idlist.o uid.o mxget.o md5ify.o cram.o gssapi.o opie.o interface.o netrc.o unmime.o conf.o checkalias.o lock.o rcfile_l.o rcfile_y.o norm_charmap.o  pop3.o imap.o etrn.o odmr.o     libfm.a    -lresolv
( echo '#! /bin/sh' && echo 'exec /usr/bin/python /usr/local/lib/python2.7/site-packages/fetchmailconf.py "$@"' ) >fetchmailconf && chmod +x fetchmailconf || { rm -f fetchmailconf ; exit 1; }
Making all in po
mini1:fetchmail-6.3.26 collin$ echo $?
0
mini1:fetchmail-6.3.26 collin$ sudo make install
Password:
/Applications/Xcode.app/Contents/Developer/usr/bin/make  install-recursive
Making install in .
test -z "/usr/local/bin" || ./install-sh -c -d "/usr/local/bin"
  /usr/bin/install -c fetchmail '/usr/local/bin'
test -z "/usr/local/bin" || ./install-sh -c -d "/usr/local/bin"
 /usr/bin/install -c fetchmailconf '/usr/local/bin'
test -z "/usr/local/share/man/man1" || ./install-sh -c -d "/usr/local/share/man/man1"
 /usr/bin/install -c -m 644 'fetchmail.man' '/usr/local/share/man/man1/fetchmail.1'
 /usr/bin/install -c -m 644 'fetchmailconf.man' '/usr/local/share/man/man1/fetchmailconf.1'
test -z "/usr/local/lib/python2.7/site-packages" || ./install-sh -c -d "/usr/local/lib/python2.7/site-packages"
 /usr/bin/install -c -m 644 fetchmailconf.py '/usr/local/lib/python2.7/site-packages'
Byte-compiling python modules...
fetchmailconf.py
Byte-compiling python modules (optimized versions) ...
fetchmailconf.py
Making install in po
if test "fetchmail" = "gettext-tools"; then \
   .././install-sh -c -d /usr/local/share/gettext/po; \
   for file in Makefile.in.in remove-potcdate.sin quot.sed boldquot.sed en@quot.header en@boldquot.header insert-header.sin Rules-quot   Makevars.template; do \
     /usr/bin/install -c -m 644 ./$file \
       /usr/local/share/gettext/po/$file; \
   done; \
   for file in Makevars; do \
     rm -f /usr/local/share/gettext/po/$file; \
   done; \
 else \
   : ; \
 fi
mini1:fetchmail-6.3.26 collin$ echo $?
0
mini1:fetchmail-6.3.26 collin$ type fetchmail
fetchmail is /usr/local/bin/fetchmail
mini1:fetchmail-6.3.26 collin$ 
OK, now does it work? I became "postman" and said
mini1:~ postman$ fetchmail
115 messages for cpark at see.postman.fetchmailrc.invalid (4437146 octets).
reading message cpark@localhost:1 of 115 (3264 octets) flushed
reading message cpark@localhost:2 of 115 (14305 octets) flushed
reading message cpark@localhost:3 of 115 (2974 octets) flushed
…
reading message cpark@localhost:113 of 115 (102452 octets) flushed
reading message cpark@localhost:114 of 115 (38129 octets) flushed
reading message cpark@localhost:115 of 115 (33972 octets) flushed
mini1:~ postman$ 
Nice. But I'm not seeing any mail :(
mini1:~ collin$ ls Mail/new
mini1:~ collin$ ls -ot Mail/cur|head -n4
total 66872
-rw-r--r--  1 collin      334 Jan 19 07:27 1421681270.M564345P8389.mini1.local,S=334,W=345:2,S
-rw-r--r--  1 collin      611 Jan 18 14:24 1421619847.M476474P8389.mini1.local,S=611,W=631:2,S
-rw-------  1 collin    12584 Jan 17 15:48 1421538531.32538_2.mini1:2,S
mini1:~ collin$ date
Mon Jan 19 08:37:18 PST 2015
mini1:~ collin$
Now the mail has got to my backup directory
mini1:~ collin$ ls -o Mail/backup/|grep -c "Jan 19 08:28"
36
mini1:~ collin$ 
so that says we got this far in my .procmailrc
 11 # Back up!!
 12 :0 c
 13 backup/.
 14 
 15 :0 ic
 16 | cd backup && rm -f dummy `ls -t | sed -e 1,128d`
so why didn't it get anywhere else?
Now I have a number of unanswered questions.
  1. Why isn't fetchmail running periodically? It should be going every minute, but it's not.
    mini1:~ collin$ sudo su - postman
    mini1:~ postman$ ls -ot Mail/backup|head
    total 10128
    -rw-------  1 postman  102879 Jan 19 08:28 358256
    -rw-------  1 postman   38546 Jan 19 08:28 358257
    -rw-------  1 postman   34346 Jan 19 08:28 358258
    -rw-------  1 postman    9247 Jan 19 08:28 358250
    -rw-------  1 postman   29631 Jan 19 08:28 358251
    -rw-------  1 postman   78060 Jan 19 08:28 358252
    -rw-------  1 postman    1652 Jan 19 08:28 358253
    -rw-------  1 postman   26749 Jan 19 08:28 358254
    -rw-------  1 postman   93590 Jan 19 08:28 358255
    mini1:~ postman$ ls -ot Mail/backup|grep -c "19 08:28"
    115
    mini1:~ postman$ ^Dlogout
    mini1:~ collin$ ssh sonic ls -ot Mail/backup|head
    total 24264
    -rw-------    1 cpark       59916 Jan 19 09:06 26889
    -rw-------    1 cpark       32443 Jan 19 09:06 26888
    -rw-------    1 cpark        5121 Jan 19 09:01 26887
    -rw-------    1 cpark       75745 Jan 19 08:48 26886
    -rw-------    1 cpark       51549 Jan 19 08:42 26885
    -rw-------    1 cpark       18291 Jan 19 08:29 26884
    -rw-------    1 cpark       33997 Jan 19 08:03 26883
    -rw-------    1 cpark       38197 Jan 19 08:02 26882
    -rw-------    1 cpark      102530 Jan 19 08:00 26881
    mini1:~ collin$ 
  2. I have mail in my Mail/backup, but why not in Maildir/new or Maildir/cur?
    mini1:~ collin$ ls -ot Maildir/backup|head -n5
    total 6920
    -rw-------  1 collin   29533 Jan 19 08:34 92744
    -rw-------  1 collin   23841 Jan 19 08:34 92745
    -rw-------  1 collin    3769 Jan 19 08:34 92746
    -rw-------  1 collin   38595 Jan 19 08:34 92747
    mini1:~ collin$ ls -A Maildir/new
    mini1:~ collin$ ls -A Maildir/tmp
    mini1:~ collin$ ls -ot Maildir/cur|head -n5
    total 66872
    -rw-r--r--  1 collin      334 Jan 19 07:27 1421681270.M564345P8389.mini1.local,S=334,W=345:2,S
    -rw-r--r--  1 collin      611 Jan 18 14:24 1421619847.M476474P8389.mini1.local,S=611,W=631:2,S
    -rw-------  1 collin    12584 Jan 17 15:48 1421538531.32538_2.mini1:2,S
    -rw-------  1 collin    18806 Jan 17 14:26 1421533571.31911_2.mini1:2,S
    mini1:~ collin$ 
  3. The mail gets from postman to my procmail, locally, but why doesn't procmail continue?
    mini1:~ collin$ tail Mail/vlog
    procmail: [42278] Mon Jan 19 08:28:58 2015
    procmail: Executing "sed 1d | formail -I reply-to: -I resent-from: -I return-path: |         formail -rzxTo:"
    procmail: [42290] Mon Jan 19 08:28:58 2015
    procmail: Executing "sed 1d | formail -I reply-to: -I resent-from: -I return-path: |         formail -rzxTo:"
    procmail: [42304] Mon Jan 19 08:28:58 2015
    procmail: Executing "sed 1d | formail -I reply-to: -I resent-from: -I return-path: |         formail -rzxTo:"
    procmail: [42316] Mon Jan 19 08:28:59 2015
    procmail: Executing "sed 1d | formail -I reply-to: -I resent-from: -I return-path: |         formail -rzxTo:"
    procmail: [42330] Mon Jan 19 08:28:59 2015
    procmail: Executing "sed 1d | formail -I reply-to: -I resent-from: -I return-path: |         formail -rzxTo:"
    mini1:~ collin$ 
    The more usual sequence looks like this:
    1617017 procmail: [32538] Sat Jan 17 15:48:51 2015
    1617018 procmail: Executing "sed 1d | formail -I reply-to: -I resent-from: -I return-path: |         formail -rzxTo:"
    1617019 procmail: [32538] Sat Jan 17 15:48:51 2015
    1617020 procmail: Assigning "FROM=jresneck@sungevity.com"
    1617021 procmail: No match on "^From:.*lazarjanet"
    1617022 procmail: No match on "(^((Original-)?(Resent-)?(To|Cc|Bcc)|(X-Envelope|Apparently(-Resent)?)-To):(.*[^-a-zA-Z0-9_.])?)criticalcare@rc5\.us"
    1617023 procmail: No match on "^From:.*@mpbta.org"
    1617024 procmail: Match on ! "^content-type:.*multipart/mixed"
    1617025 procmail: Match on ! "HB ^content-transfer-encoding:.*base64"
    1617026 procmail: No match on "^x-rc5-to: \/.*$"
    1617027 procmail: No match on "(^((Original-)?(Resent-)?(To|Cc|Bcc)|(X-Envelope|Apparently(-Resent)?)-To):(.*[^-a-zA-Z0-9_.])?)biblecollin@rc5"
    1617028 procmail: No match on "^From:.*zhohaome.*parka001"
    1617029 procmail: No match on "(^((Original-)?(Resent-)?(To|Cc|Bcc)|(X-Envelope|Apparently(-Resent)?)-To):(.*[^-a-zA-Z0-9_.])?)cpark\+junk@sonic.net"
    1617030 procmail: No match on "(^((Original-)?(Resent-)?(To|Cc|Bcc)|(X-Envelope|Apparently(-Resent)?)-To):(.*[^-a-zA-Z0-9_.])?)cpark\+tr@sonic.net"
    1617031 procmail: No match on "(^((Original-)?(Resent-)?(To|Cc|Bcc)|(X-Envelope|Apparently(-Resent)?)-To):(.*[^-a-zA-Z0-9_.])?)cpark\+bn@sonic.net"
    1617032 procmail: Assigning "VERBOSE=no"
    1617033 From postman@rc5.us  Sat Jan 17 15:48:51 2015
    1617034  Subject: Collin - New Year, New Rate Hikes - Park - 96922
    1617035   Folder: /Users/collin/Maildir/new/1421538531.32538_2.mini1              12584
  4. Isn't dovecot running? Why can't mail.app connect to it?
    mini1:~ collin$ sudo su - carol
    Password:
    mini1:~ carol$ ls Maildir/new|wc
          88      88    2728
    mini1:~ carol$ 
    Oddly enough, I can connect to dovecot from the Linux box, but not from the mac mini or from an MBA.
So I want to get #4 figured out. And Maybe if I answer #3 then #2 will take care of itself?

More to come...

Sunday, January 11, 2015

“I will teach you the fear of the Lord

I’ve read Psalm 34 many times (34:6 is one of my favorite promises) but the other night I noticed something new: verse 11 has the phrase “I will teach you the fear of the Lord.”

The fear of the Lord is important: the Proverbs tell us it’s the beginning of wisdom. A corrupt society, a corrupt people, are described as having no fear of God. So having the fear of the Lord is definitely an asset.

Ron Ritchie preached at least once on this. If memory serves, he said that he researched the phrase in the original language of the Scriptures, and found that what it really means is… to fear the Lord. (Preachers love saying things like that.) He gave an illustration: when he suddenly found himself thrown across his hotel room, he developed a fear of, or a healthy respect for, the power of electricity.

I’ll guess that Pastor Ron had some fear of electricity before that incident, but that he developed more fear, a healthier respect, afterward. Similarly, though many of us have some fear of the Lord, I suppose we’d be better off with a better-informed fear, a healthier respect, for him.

David offers to teach the fear of the Lord to his readers, and I’d like to take him up on it. Here’s the passage:

8 Taste and see that the Lord is good;
        blessed is the one who takes refuge in him.
9 Fear the Lord, you his holy people,
        for those who fear him lack nothing.
10 The lions may grow weak and hungry,
        but those who seek the Lord lack no good thing.
11 Come, my children, listen to me;
        I will teach you the fear of the Lord.
12 Whoever of you loves life
       and desires to see many good days,
13 keep your tongue from evil
        and your lips from telling lies.
14 Turn from evil and do good;
        seek peace and pursue it.
                                                           Psalm 34:8–14
According to the NIV Study Bible, “I will teach you…” is the focus of verses 8–14. In my naïveté, I would have thought to start at verse 11, but then I remembered that the biblical authors usually put their main point in the middle of the passage rather than the beginning (as seen for example in Jesus Through Middle Eastern Eyes by Ken Bailey). And it may be that verse 11 is the focus of the entire psalm, which is 22 verses long.

So what does David tell us to do as he tries to teach us the fear of the Lord?

  • Taste and see that the Lord is good

    It’s good for me to remember that every good thing in life comes from my heavenly father: the beauty of sunrises and sunsets, the forgiveness of sins, God’s presence, food, clothing, shelter, family, work, friendship, and so on. To count my blessings, as the song says.

  • Take refuge in him

    It’s important for me to remember that safety and security and peace come from God; they do not come from my investments, the locks on my doors, or the Department of Homeland Security.

    As another psalm (psalm 33 actually) says, a horse is a vain hope for deliverance.

  • Watch your speech

    Death and life are in the power of the tongue, as the Proverbs (18:21) say. This shouldn’t surprise us. How did God create the heavens and the earth? By speaking: “Let there be light,” he said, and there was light; then “Let the waters… be gathered in one place and let the dry land appear… Let the earth bring forth living creatures…” and so on, and then he created humanity in his image, according to his likeness. Part of that likeness is the power of speech, by which we can bless or curse our fellows, as James 3 says.

    We can bring evil into the world by speaking it; when we lie, we run the risk of starting to believe our own false words. When we suppress the truth, we bring evil rather than blessing into the world, and we become less able to know and fear God, and less sensitive to the truth.

  • Turn from evil and do good

    A few lines above this we read, “Fear the Lord…,” and surely that would include the idea of doing what he says, or to use an unpopular word, obeying him. This is really important because it enables us to know what God wants. Now my natural tendency is to say, “what does God want?” and then decide if I’m willing to do it. Jesus says that won’t work well: In John 7, he said, “If anyone wants to do God’s will, he will know whether I’m speaking from God or making all this stuff up.” And in John 14, he says that to those who obey his teaching, he will reveal himself (14:21) and make his home (14:23) with them.

    In other words, we must first decide to obey, and then we become able to learn what God wants, not the other way round.

  • Seek peace and pursue it

    The book of Proverbs has a lot to say about this, particularly about speech. “A gentle answer turns away wrath” (15:1), “A hot-tempered man stirs up dissension, but a patient man calms a quarrel” (15:18), “He who is slow to anger is better than the mighty…” (16:32) and so on. And the Apostle Paul urges us to live at peace with everyone, and not to take revenge (Romans 12:18-19).

So to develop the fear of the Lord, I plan to make every effort to:
  • remember the Lord—he alone is the one who makes me dwell in safety (Psalm 4:8)—and his blessings
  • obey what I know of God’s will, which includes watching my speech (cf. Ephesians 4:29) and being a man of peace

And Peter says…

This morning at church we looked at what 1 Peter says about fear. We are instructed there to fear God (2:17) but not to fear what others fear (3:1, 3:14). Someone has observed that anyone who fears the Lord is freer from every other fear. Not completely free maybe, but freer than they would otherwise be.

This put me in mind of the place where the Lord tells Jeremiah, “Do not be terrified by them, lest I terrify you before them” (Jeremiah 1:17). He also tells Ezekiel (a bit more mildly) not to be afraid of the “rebellious house” of Israel (Ezekiel 2:6).

So that's what I know: remember the Lord and his blessings, do what I know I should, and fear the Lord (not man).

Tuesday, January 06, 2015

Career advice debunked

Notes from a lecture by Norah Denzel at NetApp 01 April 2014. She does not endorse my transcription etc.

A few preliminary notes: She started in storage in 1984, spent 13 years at IBM. Went to Veritas, Legato, then HP, where she ran software: 10,000 consultants in 110 countries. She took 2 years off and went to Intuit, which had/has a very different model: millions of units where unit price less than $100.

She was the first person in her family to have a corporate job. When she was starting out in the work world, she asked people she knew for their advice -- the five smartest people she knew. Their advice follows, along with Norah's updated/amended (emended) version thereof.

  1. It's not what you know; it's who you know.

    Actually, the more important thing is Who knows what you know.

    You can meet all kinds of people, but unless they know your expertise, your goals, what you do—in short, what you know—all those acquaintances are just acquaintances.

    What you need is a sponsor to help you. And they won't help you unless they know where you're going and what you can do.

    Note: telling people what you do is part of your work and reduces your learning curve. You want "epiphanies at scale."

    And don't wait 'til you're done; your sponsor can help you steer your way there.

  2. Climb the ladder of success.

    Actually, it's more like "Chutes and Ladders"; it's an obstacle course. Think in terms of learning and strengthening yourself.

  3. Always tell the truth.

    Best advice ever: "We really like you. You always tell the truth. Always tell the truth, but not so much of it." Press releases are edited/tuned, and they should be.

    If somebody says, "You did a great job on X," the correct response is, "Thank you!" Do not say, "Well, I got a lot of help from Chris" or "Yes, but I wish I had done this part better."

  4. There's success and failure; just succeed.

    Well, you can play "not to lose", but that's a bad idea. Failure is part of success; learn from it and move on.

    I guess this is a lot like #2.

  5. How hard can it be? You were smart in school; just be the smartest person in the room.

    Actually you can learn the most when you're the dumbest person in the room. Being ignorant isn't anything to be feared.

A few more notes...

There are stereotypes; they can't be avoided. The question is not how to stop people from stereotyping or pigeonholing you; it's "When they do that, what are you going to do?"

Another thing. Sometimes you may want to try something more exciting; other times, you might want to stay with what's comfortable. If you have small children at home and/or a lot of other out-of-office commitments, it's entirely valid and reasonable to do the latter.

Tuesday, December 02, 2014

Making a huge PDF into a reasonably-sized one (by tossing superfluous bits) ... in gs(1)

Short version:
$ gs -o reasonable.pdf -sDEVICE=pdfwrite -r300x300 huge.pdf
Last week, I wrote an annual update, a family "newsletter" of sorts. This time, because of the baby (our first grandchild) we had more photos than usual. (We briefly considered having him in every photo, but there actually is one where Baby isn't visible.) I did this in OpenOffice, and then, to send to the printer, I clicked on the "PDF" button. The resulting file was, ahem, huge.
-rw-r--r-- 1 collin 19067843 Nov 30 20:01 Dec2014.pdf
Yes, over 19 million bytes; it was probably because the photos in there were too big. I told openoffice to make them about 2 inches high or whatever, but I guess all the bits were still there (the ".odt" file itself was nearly 12 Mbytes). I did a web search on "downsample pdftk" (no quotes), which led me to this hint, briefly
gs \
  -o output.pdf \
  -sDEVICE=pdfwrite \
  -dPDFSETTINGS=/screen \
   input.pdf
I tried this, and the output shrank down to about 70 kbytes. Impressive, but the photos were quite ugly. I mean, they looked OK on the screen, but for printing? Blech. I guess that's what /screen means.

Remembering the old saying, rtfm, I said "man gs" and found:

   Some devices can support different resolutions (densities).  To specify
   the resolution on such a printer, use the "-r" switch:

 gs -sDEVICE= -rx

   For  example,  on a 9-pin Epson-compatible printer, you get the lowest-
   density (fastest) mode with

 gs -sDEVICE=epson -r60x72
"Aha!" I thought. Let me do this:
$ gs -o output.pdf -sDEVICE=pdfwrite -r300x300 Dec2014.pdf
and the result, besides being under 1MB in size, looked great in okular, which is the PDF viewer on my Linux distro.

Tuesday, November 25, 2014

For my Linguist Daughter: a Cryptoquip

I have this urge to explain things that I learn. Yesterday's “Crypt-quip” gives me that opportunity.

The “cryptoquip” is a substitution cipher, where each letter stands for some other letter. For example, they gave us this clue: “W equals L”—which means that throughout the puzzle, every W stands for an L. Our job is to figure out what the other letters stand for, to reveal a groaner of a pun…

R U   J   A M S I P T   I A P E M   J

L M W Z R L   W J T B X J B M   C R Z F   J

Z F R L E   U S M T L F   J L L M T Z,   R   C P X W Q

L J W W   R Z   B J W W R L   B J M W R L.

Okay, the first thing to notice is that we have two one-letter words, represented by “J” and “R”. These have to be “I” and “a”, in either order. If “R” were “a” then the quip would begin “A_ I blah blah I …”; maybe “As I was walking I noticed…”

To tell the truth, though, I didn't even think of that; I just assumed that it began “If a blah blah a …”; it might also be “In a...” or “Is a…”; I didn't think it started off “It a…,” which isn't grammatical. But let’s go with R⇒I and J⇒A and defer the U for a while.

The clue tells us that “W” represents “L”, so that “LJWW” on the last line is “_ALL”. Experience with these groaners suggests the part after the comma, which so far we know is “I ___l_ _all i_…”, most likely will represent “I would call it….” But even without that knowledge, you could probably guess that LJWW means “call”; it's probably not ball, fall, gall, hall, mall, pall, tall, or wall.

If L⇒C, then what does LMWZRL on the 2nd line mean? C_L_IC—too short for “garlic,” besides starting with the wrong letter; C_LBIC? C_LDIC? Wait, didn't I guess that “LJWW RZ” was “CALL IT” (last line)? If so, then Z⇒T and LMWZRL is C_LTIC.

H'm, Not CALTIC (J⇒A hence we can't have M⇒A). CELTIC maybe? One thing about ALL-CAPS in the cryptoquip is that nothing marks proper nouns (or adjectives in this case). I suppose LMWZRL could also be COLTIC (is that a word?) or CULTIC (still possible).

Suppose it were CELTIC (M⇒E). Then our puzzle would look like this:

 I _   A   _ E _ _ _ _   _ _ _ _ E   A
 R U   J   A M S I P T   I A P E M   J

 C E L T I C   L A _ _ _ A _ E   _ I T _   A
 L M W Z R L   W J T B X J B M   C R Z F   J

 T _ I C _   _ _ E _ C _   A C C E _ T,   I   _ _ _ L _
 Z F R L E   U S M T L F   J L L M T Z,   R   C P X W Q

 C A L L   I T   _ A L L I C   _ A E L I C
 L J W W   R Z   B J W W R L   B J M W R L.
I see “Celtic” in line 2 and “_aelic” in line 4. Gaelic? If B⇒G then we'd have:
 I _   A   _ E _ _ _ _   _ _ _ _ E   A
 R U   J   A M S I P T   I A P E M   J

 C E L T I C   L A _ G _ A G E   _ I T _   A
 L M W Z R L   W J T B X J B M   C R Z F   J

 T _ I C _   _ _ E _ C _   A C C E _ T,   I   _ _ _ L _
 Z F R L E   U S M T L F   J L L M T Z,   R   C P X W Q

 C A L L   I T   G A L L I C   G A E L I C
 L J W W   R Z   B J W W R L   B J M W R L.
Gallic? As in French? Maybe the first word really is “If”, in which case the _ _ E _ C _ really could be “French”? Then U⇒F, S⇒R, T⇒N and F⇒H and we have
 I F   A   _ E R _ _ N   _ _ _ _ E   A
 R U   J   A M S I P T   I A P E M   J

 C E L T I C   L A N G _ A G E   _ I T H   A
 L M W Z R L   W J T B X J B M   C R Z F   J

 T H I C _   F R E N C H   A C C E N T,   I   _ _ _ L _
 Z F R L E   U S M T L F   J L L M T Z,   R   C P X W Q

 C A L L   I T   G A L L I C   G A E L I C
 L J W W   R Z   B J W W R L   B J M W R L.
OK, lines 2 is “Celtic language with a”—right? Then X⇒U and C⇒W. Turning to line 3, a THICK French accent, yes? So E⇒K. Let's see how that looks now.
 I F   A   _ E R _ _ N   _ _ _ K E   A
 R U   J   A M S I P T   I A P E M   J

 C E L T I C   L A N G U A G E   W I T H   A
 L M W Z R L   W J T B X J B M   C R Z F   J

 T H I C K   F R E N C H   A C C E N T,   I   W _ U L _
 Z F R L E   U S M T L F   J L L M T Z,   R   C P X W Q

 C A L L   I T   G A L L I C   G A E L I C
 L J W W   R Z   B J W W R L   B J M W R L.
Line 3: “…I would”, yes? P⇒O, Q⇒D and line 1 reads
 IF A _ER_ON __OKE A
“If a person spoke…”? That's it! A⇒P, I⇒S and we're done:
 I F   A   P E R S O N   S P O K E   A
 R U   J   A M S I P T   I A P E M   J

 C E L T I C   L A N G U A G E   W I T H   A
 L M W Z R L   W J T B X J B M   C R Z F   J

 T H I C K   F R E N C H   A C C E N T,   I   W O U L D
 Z F R L E   U S M T L F   J L L M T Z,   R   C P X W Q

 C A L L   I T   G A L L I C   G A E L I C
 L J W W   R Z   B J W W R L   B J M W R L.
Wasn’t that fun?