Friday, October 22, 2010

Migrating firefox bookmarks, and other Linux→Mac transition tales

Yes, a Linux® → Apple® transition is happening here. Why? Well, it's a bit of a long story. My desktop machine has been dying slowly and recently it decided to accelerate that process. The lovely Carol has been putting up with an aging IBM lease return running an old Linux distro and in particular firefox2.x. An annoying problem with this old firefox is that when she tries to print from certain websites, its javascript is sufficiently creaky that the printer doesn't.

Therefore the plan is: a mac mini for her. HDMI→DVI adapter and connect to this ViewSonic display (1440x900); I'll take the lease-return IBM and try to upgrade its OS; wish me luck. Meanwhile, she'll be using the mac mini, which first of all has the software on it already (well, I did download firefox and NeoOffice, but that was a piece of cake); it also can give her an experience similar to what she already has on her (2006) iBook.

But there is data migration. "rsync -av -e ssh" for her mi¢ro$oft word (well, mostly openoffice-generated) documents. Most of her mail is already in Maildir format; I figure she can run a local dovecot and use mail.app; more on this later.

Besides mail, the thing I wanted to tell you about was bringing the bookmarks from the Linux box to her browser on the mac. You can find bookmarks.html by typing something like this on your Linux box:

$ cd .mozilla/firefox/*default
$ pwd
/home/carol/.mozilla/firefox/bjvya9an.default
$ ls *ookmark*html
bookmarks.html
$ 
You should change "default" to whatever the profile name is that you have for ffox on your Linux box. Copy that file to $HOME/Desktop on your mac (this will make the next step easier).
Now start firefox up. From the menu at the top of the screen, select Bookmarks→Organize Bookmarks... and you should see a window like that on the left (click for a slightly larger image).

Near the top of that pop-up window you'll see a button with a 5-pointed star. Click it and the little menu (the one with Backup, Restore, Import HTML... and Export HTML...) will appear. Select "Import HTML..." and it'll let you select a file to import. This is why I said to copy bookmarks.html under $HOME/Desktop/. I'm sure you'll know what to do from here on in.

More on mail setup later.

You're smarter than people say you are!

So my buddy "Horace" asked me how to do something in PERL.

OK, well, it's not like he asked how to do something in mi¢ro$oft Offic€. He was calling a database library that returned a hash reference, which he was using like this:

$foo = blahblah::hashref($what,$ever);
print OUTFILE "DATE:", $foo->{DATE}, "TYPE:", $foo->{TYPE} ...; 
The question was, rather than hard-coding the keys, wasn't there an easy way to find all the keys and dump the value corresponding to each key?

It seems like the sort of thing Larry would provide -- and because of the TMTOWTDI principle, probably provide more than one way to do it. I'm not a big fan of the TMTOWTDI principle because if you have to read other people's code, you eventually have to learn all the cockamamie ways people might have coded something.

It's this way in C, too; one can code ++a; or a++; or a+=1; or a=a+1; -- they all do the same thing. Similarly i[x] and x[i] mean the same thing: *(x+i). And strptr->fld is the same as (*strptr).fld

Back to Horace's problem. If we had an actual hash, rather than a hash reference -- e.g., if we had %bar rather than $foo -- then we'd simply code

foreach my $fld (keys %bar) { print "$fld $bar{$fld} "; }
Then I remembered an incantation I saw in a musty old volume...

I suggested trying it: using (keys %$foo) in the statement above. Horace typed it in and gave it a cockeyed look. "I'm not sure that'll even compile," he said. Just being supportive I guess. But much to his surprise...

$ perl -cw thescript.pl
thescript.pl syntax OK
$ 
Then he ran it; out came the keys and their values.

It was gratifying to see that my guess worked. Then came the best part. "You know, you're way smarter than people say you are."

It's nice to feel validated. I guess.

Tuesday, October 19, 2010

Whoa, darwinports is now macports!

It's been nearly five years since I installed darwin ports on my powerbook, and upon recently acquiring a current Mac I looked for "what was that port thing? oh yeah, darwin ports..."

I found a link to download darwin ports, but the link didn't work. Good thing, too, since a few searches later I discovered this darwinports fraud page. The Real Thing, according to this page, is now macports.

Feeling somewhat dizzy, I did a little more searching and became convinced that what I sought was indeed macports, not darwinports. Further proof came in a working download and a smooth installation of the desired software -- dovecot in case you were interested.

More about that later, but for now I wanted to tell you about this name change. That is, in case I'm not absolutely the last person to find out.

Sunday, October 17, 2010

In which your blogger removes any doubt that he's a wacko

Since I'm never gonna run for political office and will never be considered for supreme court justice or anything, I figure that how I vote isn't going to have an adverse effect on my career. So....
  • Governor: Meg couldn't be bothered to vote. I don't buy the smear campaign related to the housekeeper, but I can't bring myself to vote for Brown. Voting for anyone else is pretty much useless. So I'm abstaining.
  • Lt Governor: Maldonado. Can't stand Newsom because he doesn't seem to care what the law says. I don't want my house fire-bombed so I won't say any more.
  • Att'y General: Cooley. Heard his debate on the radio v. Harris and he sounds a lot more reasonable to me.
  • US Senate: Dear Barbara, you have done the impossible and caused me to vote for Carly. I never thought I'd ever do that, but you've done it. Congratulations.
  • US Rep 14th: Dave Chapman. Anyone but Eshoo. Again, respect for the law is important to me.
  • Sequoia Healthcare District. As I understand it, the district exists to run Sequoia Hospital. But CHW owns and runs Sequoia Hospital. So the district, and the funding, for the district makes no sense. Hickey, Graham, and Stogner say they'll dissolve the district. Why should we pay staff to run this purposeless entity in San Mateo County?
  • Prop. 19: YES. Holder says the feds will continue to enforce marijuana laws. Fine, let them pay for the hours to find, arrest, prosecute, convict... and also for the prisons where these people will be housed. Why should the taxpayers of California pay for all that "enforcement" -- which in case you haven't noticed isn't working? Better to tax it -- like tobacco and alcohol.
  • Prop 20: YES. Got to get the politicians out of the gerrymandering business.
  • Prop 21: YES. $18 per year per vehicle, to undo some of the damage that the Governator did.
  • Prop 22: YES. Have you noticed that roads have gotten worse over the past decades? Caltrain, and other public transit districts, not to mention other local programs, have had enough taken from them by Sac.
  • Prop 23: NO. As in Say NO to Texas Oilmen.
  • Prop 24: YES. Why would we reduce business taxes? I don't get that.
  • Prop 25: YES. Stop budget gridlock in Sac.
  • Prop 26: NO. Otherwise 34% of voters can block anything. (And if you're curious I did vote NO on 13 back in the 70s)
  • Prop 27: NO. Not just NO but "We threw you guys out of the gerrymandering business on purpose, and now you're clamoring to get back in? NO NO NO!"
  • Measure M, City/County Ass'n of Gov'ts: YES. $10/year per vehicle for infrastructure maintenance and improvements. As in yes on 21/22.
What about the other races? I've given enough effort to be well informed on them.

Tuesday, October 12, 2010

Overcoming NETMA (Nobody Ever Tells Me Anything)

I attended a great seminar by this title, probably around 1990. Unsurprisingly, I couldn't find my notes in 2004 (a six-year stay in Japan came between those dates). So I'm going to give you what I remember, jumbled and incomplete though it may be. Here's a story:
My mother mentioned in a letter that "by the way, our house burned down, so we're moving..."

Back when I was in college, long distance cost like dollars a minute, but I called them anyway. "Why didn't you tell me sooner?!" I said.

"We didn't want you to worry," they said. Oh, and "you couldn't do anything about it."

"Upset" wasn't an adequate word. A lot of the time, our instructor said, we don't give people a lot of information for the same two reasons.

They hate that.

First, they do worry. They often know something's going on, but when we don't tell them... well, nature abhors an information vacuum, so people make stuff up, and often it's worse than reality. This is true in families, and it's true in organizations.

Then, sometimes they can do something about it, even if it's just asking a question. To cite a fictional example, in Tom Clancy's Debt of Honor, a certain aircraft carrier sustained damage to two of its four propellor shafts. It'll be months before they can be fixed, and everybody assumes it'll therefore be months in dry-dock. Until someone says, "Sir, I hate to sound stupid, but how fast will she go on two shafts?" It's a lot easier to weld the gearbox shut than it is to restore the two shafts, of course, but somebody had to think of it first.

We aren't trying to keep people in the dark (it doesn't work anyway, contrary to the mushroom theory); we just don't want to weigh them down with too much stuff and distract them from what they need to be focusing on. So what are some practical steps?

Oh, by the way, the objective here isn't information for information's sake, but rather building a healthier, more effective organization.

A periodic meeting

I remember the story; unfortunately I don't remember why this was such a good idea. The story was this: A certain dentist had a staff meeting every morning, before the first patient arrived. They would review the day's schedule, including anything out of the ordinary; I think he brought doughnuts. I suppose that by getting everyone in sync, and telling everybody what everybody else was doing, this guy gave them a sense of being on the same team.

And if memory serves, the meeting wasn't all business, either; people mentioned things like vacation plans, so there was a sense of family. This made the office a more pleasant place to work -- and also to visit! Patients liked the atmosphere and apparently referred their friends, because this guy's business was booming.

A meeting, then a meeting

The boss in this story was in the state government, in Texas. She went to her department-head meeting, and as soon as she got back, gathered her people to tell them what happened. Of course, she only had to do this a few times before they started anticipating these post-meeting meetings.

What benefits came from this practice? I'll leave that as an exercise for the reader.

Give 'em the bad news right away

Suppose the Big Cheese lets fly that there will be layoffs -- 6% of the workforce. Should you tell your people what you know?

If you don't, then, well, see above. So how much do you tell them? Well, you don't want them to make up stuff that's worse! But you may be forbidden to say too much. H'm, sticky situation. But that's why they pay you the big bucks.

What's the worst thing...?

This might have come from some other seminar, but the idea here is to ask people what the most annoying thing is. Go ahead, man up and ask them!

It might be easy to fix, in which case wouldn't you feel silly leaving that opportunity not taken!


That's it for now; I'll update this if I remember more.

So you want to be a VP, Part II

Part I provides some background; in this posting I'll introduce some of my favorite work-related books.
  1. Drucker (the prescient), The Effective Executive
    If another business-focused book has had a greater influence on my thinking about work, I don't know what it is. Know Thy Time, Focus on Contribution, Effective Decisions—brilliant.
    His Managing for Results is also interesting, albeit less applicable for someone in my position.
  2. Cohen and Bradford, Influence Without Authority
    A great book on the "new" (1991) world of the flattened organization, and how to deal with the realities of being on the hook for results, without being given the corresponding organizational authority. Very practical. It includes some success stories as well as some not-quite-s.
  3. Covey's 7 Habits of Highly Effective People
    A broader focus than just business. Worth a trip to the library. Don't take it too seriously, though; he tells you what to do in life, but it feels like legalism to me.
  4. Goldratt, Critical Chain
    Great insights on scheduling, why projects are late, student syndrome, etc. I wrote about this in 2007.
  5. Townsend, Up the Organization
    Entertaining and common-sensical, but more focused on the higher echelons of management.
These books have informed my thinking, more than giving me specific action steps.

Besides thinking differently, of course, one must also change actual behavior, doing things beyond the comfort zone, to grow professionally (or personally for that matter). This needn't be a long slog up the ladder; you really can decide that you don't want another promotion, if for example you'd rather write code than budgets (I resemble this remark).

Saturday, October 02, 2010

Lights out!

Early Thursday morning, the lovely Carol and I drove to the Sequoia "Y" -- taking two cars (boo!) because we had different places to go afterwards. When we arrived, she told me that only my right headlight had been on. "Bad bulb," I thought.

Also this past week, the hall light failed to come on in the morning. Then in the evening, it worked fine. Then it turned off all by itself. "Bad switch," I thought.

So those were on my to-do list for today: find or buy a new switch for the hall light, and visit Kragen or Kohlweiss for a new headlight.

I started with the car: opened the door, turned on the headlights, and popped the hood. Whoa: the bulb wasn't out -- well, it was, sort of. What I mean is: the bulb was lit, and burning brightly. It just wasn't where it was supposed to be! It was illuminating the engine compartment, rather than the outdoors. Hurmpf. Positioned the fixture, and gave the retaining ring a firm twist. Voilà -- the second easiest lighting fix I've ever made!

I should have taken the hint and re-thought my assumption about the hall light, but I wasn't thinking too swiftly. After verifying that the light still wouldn't turn on, I unscrewed the wall-plate and the switch. Undoing the "eye" on the red wire (a formerly white wire from 12-2 Romex, embarrassed by a beet-colored magic marker), I decided on a quick check and touched the black wire to the red. No light!

"Wha...?" I thought, and walked out to the garage for my handy-dandy sniffer. This is a really cool gadget that beeps when it's near an energized wire. Yes, the black wire was "hot". When I reconnected the "red" wire and flipped the switch, the red wire also became hot. I removed the glass from the light fixture and checked the wires leading to the light-bulb sockets. No beep. Curiouser and curiouser! Did I goof up the power connection?

I removed the entire fixture from the ceiling, and found that power was indeed reaching it. Re-checking the sockets, I found that they were indeed energized. Odd that two light bulbs would fail at the same time....

Did you guess it? I didn't have the bulbs in all the way! These are not standard screw-in CFLs; they have bayonet-like mounts, which are apparently too high-tech for me -- at least they were the first time! I pushed a little harder and gave each one a twist, and obediently each bulb lit up. Perfect.

I felt a little sheepish, but it was better than having to go to the store.

And the drip in the washing machine!

Last weekend, I heard an odd sound from the clothes washer. It was off, but there was still a sound -- like a very slow clock ticking. Puzzled, I opened the lid and waited. Sure enough, there was a drip. ... and maybe five seconds later, another.

"Bother!" I thought. I tried draining the water (ran the washer for the last minute of the "spin" cycle); it sprayed some while spinning, and after it was done, there was still the drip. I turned off the water-supply valves and left a note for the lovely Carol.

She washed a couple of loads during the week, and I figured I'd have to look up the model number and the part number for replacement valves (iirc the mixing valve is a single unit). But yesterday or the day before, I listened to the washer, which was... silent. Water supply valves? Open.

I guess the piece of sand -- or whatever was lodged in the valve and caused the drip -- got washed away.

Three electromechanical problems that could have been three headaches became were two easy fixes and a non-problem. Praise God for little blessings!