Thursday, May 11, 2017

Paradise ponders: 99 year old generator plant edition...

Paradise ponders: 99 year old generator plant edition...  Yesterday evening we had our celebratory dinner at Le Nonne's – a shared caprese for an appetizer, then I had chicken-and-ricotta ravioli in marinara, and Debbie had a pork chop special (three boneless chops with a lovely sauce that had butter, garlic, rosemary, lemon, and some other things we couldn't identify).  That was a very yummy meal, every bit of it.  We left nothing behind. :)

Earlier in the day, in between what felt like five dozen interruptions, I managed to cut the cedar boards and route the dovetails for one of the two frames I'm making for the basement cattery windows that open into our sun room.  To do that, I used the elevated dovetail jig that I finished preparing yesterday.  I did a trial fit of the boards, without glue, and they all fit snugly.  It looks like I had the router just a tad (maybe 1/50th inch) too high when routing the pin boards, but for this application (where the exterior joints won't be visible), that's not an issue at all – just something to remember for the next time I do it.  The snugness was good enough that I could carry the trial-fitted frame over to our house to test its fit into the window – and it was perfect.  I had measured the boards with the goal of 1/8" free space around the frame, to allow for some glue – and that's exactly what I have.  Yay!  Today I'll be cutting and routing the second frame and applying a light gray stain...

After our dinner last night we stopped at the Hyrum generating plant, six miles east of town up Blacksmith Fork Canyon.  We've driven past the generating plant many times, but last night they had the generator down for maintenance and they held an open house for curious locals.  Perfect for me!

When we arrived, we saw that there was a relatively small line outside – perhaps 20 people (mostly kids!).  We could also see that the inside was crowded and appeared to be on multiple levels.  All of this would be challenging for Debbie at the moment, so she decided to wait in the car while I took the little tour.  I waited outside with a happy, friendly crowd of locals for about 20 minutes and then the group inside came pouring out.  Among them were some people we know: Lizzie H., her husband, and her little brother A.J.  Lizzie's the daughter of our friend Michelle H., and she's pregnant with Michelle's first grandchild.  Lizzie told me, very excitedly, that they found out her baby is a girl. :)

The power plant was built in 1918, so it's 99 years old this year.  Walking inside this plant was like going back in time.  What's most amazing to me is that this generator is still in use after all this time!  It's owned by Hyrum city, and operated as a co-op.  When running, it produces 500kw, about 1/40th of the entire city's power consumption.  Mostly it provides power for all the municipal buildings, thereby saving the city's citizens the expense of the electrical power bill.  Yesterday was the first day it's been down for maintenance since we moved here three years ago, and I forced myself to stay up late (past 7:30 pm!) to go see it.

For the geeks, here's a brief explanation of what you're seeing in my photos below (in order):
  1. A view of the generator's rotor and stator (both painted with red electrical insulating compound).  In normal operation it is uncovered like this.  The gray cylinder in the foreground is part of the casing for the commutator/brush assembly.
  2. The commutator/brush assembly.  Again, the red is electrical insulation compound, and in normal operation it's uncovered like this.  I'm guessing that at night there's a nice sparky presentation here, and that the air in here is full of ozone.  
  3. One side of the water turbine casing (the side toward the generator).
  4. The water turbine governor.  This device, in particular, made me smile at it's construction.  All the electrical parts are open; no safety casings around anything.  Ditto with the rotating mechanical parts.  The job of the governor is to keep the turbine rotating at just the right speed so that the generator produces AC at 60 Hertz.  This means allowing more or less water into the turbine as the load on the generator changes.  I'm guessing that the load is basically constant at max these days, since the generator's capacity is such a small fraction of the city's need.  Nevertheless, this is a key component; the power produced really must be held steady at 60 Hertz, or all sorts of problems for customers will occur (not least of which is all their AC powered clocks will be wrong!).
  5. A view of the turbine blades, through a maintenance port that was temporarily removed.  They're only a few inches wide, which surprised me – I was expecting something much larger.  Also, I was expecting the shaft to be vertical, as all the other water turbines I've seen were built that way (with the generator on top).  
  6. The giant gate valve that controls the water entering the turbine.  The valve itself is the assembly below the large vertical cylinder.  That cylinder is a double-action piston that uses water to raise and lower the gate valve.  There's a hoist up there now because the valve “needs a little help” to be opened.  I believe this valve is used only for turning the turbine on and off, and not for speed control.  I'm not certain, though, because I couldn't get the attention of the busy (and all talked out!) host.  I suspect there are control louvers of some sort inside the turbine housing that can quickly change the turbine's speed and are more amenable to governor control than this very slow-acting gate valve would be.


In a little while I'm taking poor little Cabo to our vet.  Today is the day she gets spayed.  We can't give her any food or water this morning, so she's crated and whining piteously for her normal morning routine of deep drinking, bananas, and her morning kibble.  She's very confused, as this is the first day of her entire life when all three elements are missing...

Later this morning we're scheduled to have a new Internet connection installed.  While Clinton (the second tech to come visit us, to repair our intermittent connection) was here, he very casually mentioned that he believed gigabit Internet was now available in our area and being quietly rolled out.  I was skeptical, as we're pretty far out in the country, but on Monday I called Comcast to find out.  Lo and behold, it is available here!  Amazing!  The advertised speeds are 1000 mbps download and 35 mbps upload, both rather large improvements over our already good 230 mbps download and 12 mbps upload.  I ordered it, and it will be installed today.  That got me moving on another networking improvement I've been noodling about.  Two and a half years ago, when we built our barn, I put Ethernet in the ground between the house and the barn so I'd have Internet access in my barn loft office.  Because the barn and the house are on separate electrical systems, I had to install an isolater in that connection – and those are only available at speeds up to 100 mbps (at a reasonable price).  So I've been limited to that speed in my office.  With gigabit Internet to the house, that now looks crippling. :)  So I ordered a pair of Mimosa Networks radio backhaul links.  They'll give me an over-the-air link that can move 1,400 mbps, so I should be able to take full advantage of our gigabit Internet even in my office.  That pair of radio links is about half the cost of a gigabit isolater, which gets me to pondering about what a crazy world we live in these days.  Radio links cheaper than wired links – who knew?

Wednesday, May 10, 2017

Paradise ponders: an eventful 24 hours edition...

Paradise ponders: an eventful 24 hours edition...  Well, I didn't get far on my plans yesterday to start the cattery window frames.  Not far at all.  Events conspired...

First, I'm finding myself swamped with paperwork and phone calls of various kinds.  All just routine stuff, but I've been neglecting it and now there are starting to be consequences. :)  So I started catching up with all that, both yesterday and today.

Right in the middle of that paperwork, I got an unexpected text message from our mason, Randy Bingham.  He asked if I was home.  I replied that I was.  He said “We have your cap!”, meaning the rock slab that would form the roof of our little filling station.  I asked if he wanted to deliver it, and he said “We’re here right now!”  So I ran out to greet him and his partner Jeffrey.  The big chunk of rock weighs about 1,100 pounds, so they used their handy-dandy loader to put it in place.  Jeffrey's running the loader, and that's Randy with his back to me.  It's going to be a few weeks before they have time to put the rock veneer on the sides, but now we've got a roof!


The filling station presented me with a new challenge.  I've discovered that the height of the tanks doesn't provide enough pressure to operate the nice auto-closing nozzles I bought.  So now I've ordered a couple of fuel pumps that we'll mount in the block structure – which means the plumbers will have to re-do part of the plumbing.  It's always something...

While I was out with Randy and Jeffrey, I noticed some workers alongside the irrigation canal that runs along the east side of our property.  They were cleaning up the big piles of brush that had been left there by the canal cleaners a month or so ago.  I've been after them for three years now to clean up the mess they made, and finally they did it.  The workers did an especially nice job, too – right down to cleaning up the twigs with a leaf rake.  I've been planning to get a burn permit to burn those piles myself, as I'd given up on them cleaning it up.  Good thing I procrastinated: they did even better, picking it all up instead of burning it.  Nice!

Then we went to lunch at Los Primos with our friend Michelle H.  A most pleasant (and delicious!) lunch that was.  We tend to go on Tuesdays because that's the day they have our favorite menu item: vegetable beef soup.  Yesterday they had just one bowl left, which Michelle and I decided Debbie should have.  Our waiter saw our disappointment, and he told us the soup often runs out early in the day.  But ... he also said that if we called in the morning and told him we were coming in the afternoon (normally our big meal for the day), he'd reserve as many portions as we'd like.  Woo hoo!

I had a nice long (literally at the fence) conversation with my friend and neighbor Tim D.  He's recovering from back surgery, and doing very well, but his physical activity is strictly limited and he really hates that.  It's hard for him to stick to the guidelines his doctor gave him.

Debbie and I took a drive in the afternoon to see if we could spot a local bird that we really like: the yellow-headed blackbird.  We struck gold, and got several nice, long viewings of males – including one doing the full-on mating call and display behavior.  Nice!  We also saw large numbers of Canadian geese and white-faced ibis with their beautiful iridescent breeding plumage.  The photo at right (you'll have to click to embiggen it) shows one scene full of geese and ibis.  My finger is there to shield the lens from direct sunlight, as I was shooting straight into the evening sun.  We also saw a couple of other interesting things: a herd of buffalo, apparently being raised for the meat, and a young lady practicing steer roping.  Just driving through the bottoms of the Little Bear River is beautiful right now, with green everywhere and lots of flowers (especially around houses).

This morning we got an especially good piece of news for Debbie's recovery.  She just finished the third trial run (month-long) using a drug called Forteo that helps build back new bone for people with osteoporosis.   Her endocrinologist recommended it as the best drug for her situation.  After the two previous trial runs, she had to stop using it because her blood calcium levels got too high, which increases the risk of a heart attack.  Not good!  But after this trial (which we'd all agreed would be her last), her blood calcium levels were normal!  Yay!  This is mostly because she stopped taking calcium supplements and also stopped getting too much calcium in her diet.  She's now carefully monitoring her calcium intake to keep it within normal range, neither too high nor too low.  And apparently that was all it took to let her respond normally to Forteo.  So now she's going on it for the next two years, to get her bones built back up faster and stronger.  We were all primed for another round of bad news on this, so it was one of those very pleasant surprises for us to hear the good news.  Debbie is over-the-moon, and demanded a celebratory dinner tonight.  So we're headed to Le Nonne's at 5:30. :)

Tuesday, May 9, 2017

Paradise ponders: giant redwood boxes, ancient eyeballs, errant puppies, and bloody confusion edition...

Paradise ponders: giant redwood boxes, ancient eyeballs, errant puppies, and bloody confusion edition...  Well, we had quite a confused and stressful day yesterday.  Despite that, I managed to finish my giant redwood “box”, and I'm very pleased with how it came out.

The first step yesterday was to route a large groove on the inside of each of the pin boards and tail boards.  This groove would accept the “bottom” I made earlier from tongue-and-groove redwood 2x8s.  The groove needed to be 1.5" across and 0.55" deep.  In the first photo below, you can see my jig on the router table to make the groove in the tail boards (the short sides).  I fixed the fence so that the edge of the router bit toward me was 2.5" from the fence.  Then I clamped a long board very carefully so that there was exactly the width of the tail board plus 3/4" between it and the fence.  I'm using a 3/4" straight bit, so being able to move the tail board in-and-out 3/4" means I could cut a 1.5" wide groove.  Then I clamped a couple of “stopper boards” to the long board, in the right place so that the groove would be cut in all but the last 3/4" of each side of the tail board (so the groove would be “blind” - not visible from outside the box).  Finally, I raised the bit to exactly 0.55" high.  I'd never done anything like this before, so I spent considerable time triple-checking everything I did before I started removing wood.  Once I was happy with it, I lit off the router and carefully lowered a tailboard onto the bit.  After that I just moved the board around to route out everything within range of the stops I'd set up with the boards.  It was harder than I expected to move that board around, as the vacuum created by the dust collection system tried very hard to keep the board in one place. :)  When I stopped the router and pulled the tail board out, I miked the groove – and it was exactly right.  Amazing how well measuring works!


After cutting the grooves in all four sides (I had to move the stopper boards to do the pin boards), I was ready for a trial fit (right hand photo above).  This went very well.  The only real problem was that the two pin boards (the longer sides) and bowed slightly along their long axis, but I figured I could take that out in clamps.  And that's what you see in the first photo below – after slopping glue on as fast as I could, I assembled it all just as in the trial fit, and then clamped the crap out of it.  Twelve clamps later, all the bowing had been taken out, and I had a good fit all the way around.  This morning I took it out of the clamps, spent a couple of minutes with my belt sander smoothing out the finger joints, and voila! – my jig “elevator” is complete.  The last photo shows it all set up and ready to use, clamped to my bench and with the dovetail jig clamped on top.  Now I can easily handle the long boards I need for my next project, which I'll be starting today: cedar frames for the basement windows that are opened to the sun room.


When I was a much younger man, I was a co-founder of a business that made and marketed practice management software to optometrists and ophthalmologists.  As you can likely imagine, I met some interesting people during those eight years, people who knew an awful lot about human vision.  Some of them had instruments to measure all sorts of things about vision, and I had the opportunity to have my eyeballs measured in ways that most people never do.  I discovered several things about my eyes that I'd not previously known:
  • My retinas had about 25% more photoreceptors in the macula of my eyes than the average person.  That meant my visual resolution, assuming my focus was optically corrected, was a bit better than average.
  • My sensitivity to blue colors is about 55% better than average, mainly because the reason I have more photoreceptors in my macula is because I have many more blue receptors than most people do.  Not only is my sensitivity to blue higher, but I can see blue objects more sharply (for the same reason).  One interesting result of this, to me at least, is that I see certain colors – particularly those that most people call pink – as containing more blue.  That leads me to see shades of lavender and purple where others see pink.  It also lets me distinguish between more shades of green than most people can.
  • My pupils can shrink to about 50% of the area that most people's pupils can.  I don't think anyone has ever noticed this when looking at me, but it has a pleasant consequence for me: I only feel the need for sunglasses when I'm in white-out conditions.  Bright sunny days I can easily handle.
Now at the same time I'm myopic (near-sighted) and I have moderately bad astigmatism.  That means I'm dependent on corrective lenses (eyeglasses for me) to get clear vision.  I've been wearing glasses since I was a wee lad; this is not at new phenomenon. :)  Now that I'm approaching being ancient (I'm almost 65), I've developed presbyopia (which nearly everyone does, eventually).  That means my eyes can't “accommodate” to focus at various distances like they used to be able to.  Consequently I've been wearing progressive lenses (“no-line bifocals”) for 15 years or so.  Presbyopia generally gets continually worse as you age, and mine has followed that pattern.  In the last few years it's gotten to the point where even with my progressive lenses I have difficulty with computer screens.  I work with my screens about 30" from my face, which is right in the middle of the transition between near and far vision on the progressive lenses.  At that point the field of clear vision is at it's narrowest.  The two screens I normally use occupy about a 90° field of view, so what I really need is the widest possible clear vision, not the narrowest.

So I finally caved in and bought myself a pair of single vision (that is, no bifocal) glasses with the prescription set for vision at about 30".  To get that prescription, I took the near “add” my eye doctor measured and halved it, which is approximately right.  I ordered the glasses from Zinni Optical (a Chinese company) on the advice of a friend who'd tried them and was happy with the results.  For $50 I got a pair of titanium frames with wide rectangular lenses, perfect for my application.  Yesterday I received them, and today I'm using them – and they are great.  They weigh next-to-nothing, the lenses work wonderfully, and I have relaxed, clear vision at my computer for the first time in a couple of years.  I wish I'd done this a long time ago...

The thing that stressed us the most yesterday was that both of our puppies (Cabo and Mako) escaped our back yard and disappeared from view.  This is our nightmare scenario: two incredibly athletic little puppies with absolutely no experience of the big bad world, out there somewhere on their own.  What happened is a construction worker left one of our gates open, and when I let the puppies out they discovered that very quickly.  We figured out that they were gone about 60 seconds after I let them out, but still in a walk around the house we could see nothing – nor did they respond to our agonized and frantic calls.  I got on my ATV and started driving around to places where I knew they had shown prior interest, but they weren't anywhere in sight.  Debbie called from our doorways.  Nothing.  Despondent, we were.

Then, a small miracle.  I spotted one of the puppies about a quarter mile away, running down a back road.  I hopped back on the ATV and intercepted him – it was Mako.  He came right to me; I leashed him and brought him home.  I called for Cabo, too, hoping she'd be nearby, but nothing.  After dropping off Mako I headed back out on a broader circuit of the general area where Mako was.  After a couple minutes of fruitless searching, Debbie called with wonderful news: Cabo had come to her as she called from our garage.

Bullet dodged.  Nightmare ended.  But our equanimity wasn't restored for quite some time...  This morning Debbie had a great idea: to get signs for all five of our gates, asking people to keep them shut.  That worker had no idea we had dogs in the back yard, so one can hardly blame him for not knowing that he should close it.  Furthermore, keeping dogs in a fenced yard is ... slightly unusual in these parts.  Most dogs run free, despite the risk to them from cars on roads – nearly incomprehensible to us, but nevertheless true.

Debbie was due to get blood drawn yesterday for some routine tests.  We drove the 12 miles up to the hospital lab around noon, only to find that the lab had no “orders” for blood work on her.  Argh!  We tried calling her doctor's office to get those orders re-transmitted (for we were certain that had already been done), but nobody was answering and we didn't get a call back after waiting a bit.  So back home we went.  Later, the doctor's office called us back, verified that the orders had already been sent, but they went ahead and re-transmitted them anyway.  Shortly later, the lab called us to let us know that they'd found the order – but it was the wrong one (an older “standing” order for quarterly checks).  Sheesh.  So we drove up to the hospital again, just after finding Mako and Cabo, and now we'd found that they had both orders.  Finally, they drew blood and got the tests underway...

So of course we had an ice cream cone at Aggie's Creamery. :)  Yummy, they were!

Monday, May 8, 2017

Fingers done!

Fingers done!  And they fit together very nicely.  After I was completely finished and feeling good about the result, I had another brainstorm – a way to accomplish the same thing using the router table.  That would have been substantially easier, with no chiseling required.  I think the capabilities of the router table have not yet been integrated into my woodworking “database”!  :)

Sunday, May 7, 2017

Working on the big box...

Working on the big box...  It's really a way to elevate my dovetail jig, but it will look like a big box, anyway.  I ran into a slight problem with my box-building plans yesterday.  My original notion was to cut dovetails into the sides of the big box using the dovetail jig itself.  That would have the dovetail jig “bootstrapping” itself into a more capable tool.  'Twas an excellent idea, but sadly there's a limitation of the dovetail jig that makes that plan impossible: it's limited to wood that's 7/8" thick, and I'd already bought the redwood to build it out of 2x8s (and those are roughly 1 1/2" thick).  Dang it!

Dovetails or fingers are really the “right” way to build this thing – they're by far the strongest kind of joint I could make.  The fallback would be to buy corner braces and install them on the inside corners of the box – doable, but much less interesting than a real joint.  So I decided to make a fool of myself and make finger joints by hand.  I chose 7/8" wide fingers (only because the math worked out nicely) and started with my tail boards (the two short sides of the box).  The first step was to use my bandsaw to cut the sides of the fingers (first photo below).  That was easy enough for these boards, but it will be considerably trickier when I go to saw the pin boards – those pins will have to fit tightly between the tail board fingers.

The next step was to chisel out the holes where the pins will go, between the fingers of the tail boards.  In the second photo you can see the beginnings of the first one I chiseled out, and the third photo shows it finished.  That was a lot of work!  After putting my thinking cap on, I came up with the idea of drilling 3/4" holes right at the ends of the notches I was chiseling out (fourth photo).  I theorized that I'd have much less material to remove via chisel, and it would be easier.  It was (see fifth photo for the results of five hammer blows on the chisel).  Much easier – so easy that I finished the remaining three notches in less time than it took me to chisel just the first one (in the sixth photo)!

The last photo shows my working setup for the chiseling.  I'm using a 3/4" chisel and a dead fall hammer (love those things!).  Just below the chisel in the photo is a diamond sharpening stone; I hone that chisel frequently as sharp is very much better than dull when you're cutting directly across grain as I am here.  The tail board I'm working on is clamped to my workbench, but there's a spoil board under it so I don't gouge my bench when chiseling.


The finished C-clamp rack...

The finished C-clamp rack...  Per a reader's request, here it is (at right).  The photo is a bit of an optical illusion: the rack is actually perfectly level, though it looks like the right side is slanted sharply downward.  What's really going on is that it's mounted on the wall encasing a set of stairs (to my loft and office), and the bottom of that wall is slanted sharply up!

Saturday, May 6, 2017

Paradise ponders: spraying, cable connectors, dovetails, flowering trees, and weird parts edition...

Paradise ponders: spraying, cable connectors, dovetails, flowering trees, and weird parts edition...  Yesterday I sprayed our yard with 2,4-D to knock down the dandelions and a few other noxious weeds.  Later this year the fellow working on my sprinklers is planning to spray something that kills a broader range of weeds in an attempt to recover the south two acres of our lawn.  I also sprayed the yard of one of my neighbors (Alan and Nikki L.) for the same reason.  My 60 gallon sprayer (with an eight foot wide boom) that I tow behind my ATV really makes this easy.

Yesterday and today we spent most of the day sans Internet – our intermittent problem seemed to have come back.  I had another pleasant experience with a Comcast tech online, and we quickly determined that we needed another tech to come visit us and do some more troubleshooting.  At the time we made the appointment our service was completely knocked out.  Of course, just one hour before the tech made it here it all came back up just fine.  However, that tech had monitored the signal strength coming from the router back to Comcast, and he noted that it was far too low.  So when Clint (the tech) got here, he went straight to work replacing every old connector in the line, as in his experience that is the major cause of such problems.  He also noted that the ground of our line wasn't “bonded” (connected) to the house's power ground, which can cause problems – so he bonded it at the power pole.  Result: we're now getting 230 mbps downstream and 12 mbps upstream.  The downstream speed is faster than we've ever seen here.  I'm hopeful this means that Clint actually found the problem.  If not, he says the next step is to run new wire from the pole to the house, as that's about the last thing left that could be intermittent...

Today I was actually able to build a pair of dovetail joints.  The part I needed (at right) came in on Thursday night, so I finally had everything needed to make my dovetail jig work.  That weird little gadget fits onto my Bosch router to let it follow the templates on the jig.  It's a Bosch adapter that allows quick changes of the bushing (the little part with the circular writing on it).

My first dovetail joint with setup is at left.  Rather than just throw away the test boards, I made them into a pair of brackets to be wall mounted and holding a piece of 1/2" galvanized pipe to hang my C-clamps on.  They're being glued in the photo; tomorrow I'll sand the joints a bit and I'm done.  That jig worked a treat – by far the easiest and best dovetails I've ever made...

There are trees in bloom all over the valley right now.  Some of them right in our neighborhood are below.  The first two photos are of the same tree.  It had so many bees in it that the ground below it was vibrating from the sound of their wings.  The third photo is of my neighbor's tree, one of two right in front of his house – gorgeous, they are.  The last photo is one of four in our yard, right next to our barn.  Their smell will knock you off your feet, so sweet and strong, especially early in the morning...


Friday, May 5, 2017

Paradise ponders: first mowing edition...

Paradise ponders: first mowing edition...  Yesterday I fought the battle of the lawnmower.  Successfully, too – not long before dark I actually finished mowing our yard.  But it was not easy getting to that point!

First, all four tires were flat.  I lugged my little air compressor out to the shed where I kept the lawnmower over winter, and soon that problem was fixed.  It must be a slow leak, because this morning they all still look good.  Then I tried to start the mower, but the battery was dead.  So I jump-started the mower with Debbie's car and some jumper cables, and it started right up.  Ran it for fifteen minutes, turned it off, and tried to start it again.  It was deader than a door-nail.  Sigh.  Dead battery (two and a half years old, and frozen over winter – so fair enough).  Ran to NAPA and bought a new battery (and had fun with the staff there who wanted to see the Model X).  Ran back home, threw in the battery, and zoom – off we went.

Engaged the mower blade and there was a horrendous bang! and the sound of an unloaded gas engine.  Some quick inspection and I found that the main drive belt had broken.  Off to the local hardware store, where I found – amazingly! – precisely the belt I needed.  Back home, disassemble half the mower, install the new belt, put the mower back together, discover two parts left over.  Disassemble the mower again, find the place for those two parts, put it all back together, and off we go.

About half the yard later, I notice that the grass is no longer being mowed on the left side of my path with the mower.  The mower has two blades under the deck, so the left blade must have a problem.  Start investigating, and in the process I put my right index finger on the drive pulley for that left blade.  I hear a loud ssssss and I smell cooking meat.  My finger!  The pulley is so hot it almost glows.  A little more investigation – very carefully! – and I discover that the pulley is slightly loose on it's shaft.  It's held on by a simple nut, so I just need to tighten it, I think.  No problem!  I dig through my socket wrenches (the only kind of wrench that would work on this recessed nut) and discover that the nut is bigger than the biggest socket I own.  I mike it, and find that it's 7/8".  My biggest socket is 3/4".  Sigh.  Off to the hardware store I go, to buy a bigger socket.  They don't sell 7/8" sockets for 3/8" drive wrenches, which is what I have.  Sigh.  So I buy a Craftsman 1/2" drive socket set, and now I have sockets from 3/4" to 1 1/2".  Back home I go.  One quarter turn of the wrench later, the pulley is tight again.

Back out to the lawn, and I finished the rest of it without incident.  But now I wonder what will happen to me when I try to mow next week!

Afterwards Debbie and I wandered up to Aggie's Creamery to get an ice cream cone.  When I came back to the car with our cones, a young man (who had been lounging with another young man) ran over and asked me how I open the door.  I explained to him that the car sensed my fob and opened itself as I approached, but what he really wanted to know was how the door handle worked.  So I explained how you just push it to open the door.  The two young men were clearly delighted by seeing a Tesla, and Debbie was laughing about that.  Then she started opening the falcon wing doors and the trunk just to get a reaction from them, which she most certainly did.  Lots of fun!  :)

It's not just American history we don't know...

It's not just American history we don't know...  We're just as ignorant about Mexican history!  Click image at right to embiggen.  Hint: the tiny sliver of yellow is the correct answer.


Thursday, May 4, 2017

Paradise ponders, gluey spray edition...

Paradise ponders, gluey spray edition...  I'll be working out in our yard most of today.  The weather is gorgeous, and I've got a backlog of things to do – starting with mowing.  If I have time, I'll also be spraying our yard and that of two of our neighbors.

But I did get a bit done this morning in the wood shop.  First I pulled the three boards I glued up yesterday out of the clamps and checked it out (first photo).  The assembly came out beautifully, with the homemade tongue-and-groove keeping the boards in perfect alignment.  Then I continued a project I've been working on intermittently: installing brackets to hold my clamp collection.  I have one more bracket to go, then this effort will be done.  Call it the “wall o’clamps!”


Awesome...

Awesome...  I'm sad to know that Cassini's mission is over in September.  I've been following it closely for so long now that it's become part of my daily routine.  At least it's going out with a bang, a big one!


Wednesday, May 3, 2017

“First chips” on the router table...

“First chips” on the router table...  After several hours of careful assembly, lining up, and tests on scraps, I decided I was ready for the first real use of the router table.  I'm building an add-on for my dovetail jig: basically a sturdy wooden box, 40" wide by 24" deep, and about 7" tall.  This will be clamped on one long side to the top of my workbench, and then the dovetail jig will be clamped on the other long side, about 24" higher than the workbench.  This will let me make dovetails on longer boards, up to about 63" long.  The first dovetail project I've planned has some 54" boards, so I'll need this.

In the process of testing and aligning the router table, I connected my dust collection system for the first time.  When I ran a piece of wood through, I thought there was something wrong – there were zero chips flying around the room.  Turns out that the suction from the dust collection system gets sort of concentrated by the relatively small diameter hole around the router bit (about 2.5" diameter).  This creates a very high speed air flow, so high that no chips at all escape.  That's very sweet compared with a hand-held router that spews chips at supersonic velocities in all directions!  After all the routing I did today you'd never even know I was woodworking – not a bit of sawdust or wood chips on me.

The “bottom” of this box (which will actually be vertical when it's in use) I'm making from 3 lengths of 2x8 redwood.  Ordinarily I would use dowels to align them, just as I did on my recent stairs project.  Now that I have a router table, though, another possibility arises: homemade tongue-and-groove.  First I used a straight 3/4" bit to route the tongue into two boards, with the board down flat on the table (result in first photo below).  That worked great – when I used a micrometer to measure the tongue's width (the critical bit), it was between 0.47" and 0.49" – and I was aiming for 0.48".  Yay!  Then I used a straight 1/2" bit to route the grooves in two boards (second photo), this time with the board up on edge.  The bit held the width to between 0.50" and 0.54" (again, with the micrometer).  I suspect the larger widths are due to my errors in holding the board flat against the fence.  Still, those are actually very small errors.  Then I slopped some glue on them and clamped them up (third photo).  The bags you see are 25 pound bags of lead shot; they're keeping the boards against the pipes to prevent any bowing.

The edges of the three boards are perfectly aligned, notably better than dowel pinning would be when done by hand (I no longer have a dowel pinning jig, though I think I'll end up getting one.  The process of routing the tongue-and-groove was almost effortless by comparison with dowel pinning.  I like... :)


Puerto Rico to declare bankruptcy...

Puerto Rico to declare bankruptcy ... and default on $73 billion in “municipal debt”.  The financial situation in Puerto Rico is complicated, not least because of its status as a U.S. Territory.  However, the fundamental cause of their problem is actually closely akin to the problems faced by many American cities: decades of spending beyond their most optimistic means.  I expect to see a dozen or more American cities taking the same route over the next decade, especially as the underfunded pension funds run out of money to pay their pensioners.

I have stayed away from municipal bonds as an investment for over 15 years now.  As my mother-in-law might say, they look worser every day...

Tuesday, May 2, 2017

Lindzen on climate alarmism...

Lindzen on climate alarmism...  If you're not familiar with him, Richard Lindzen is a well-known atmospheric scientist at MIT who's long been cautious about global warming (or climate change) claims.  I just ran across a detailed article he wrote a few days ago.  Here's one sample paragraph:
Sea level rise:

Globally averaged sea level appears to have been rising at the rate of about 6 inches a century for thousands of years. Until the advent of satellites, sea level was essentially measured with tide gauges which measure the sea level relative to the land level. Unfortunately, the land level is also changing, and as Emery and Aubrey note, tectonics are the major source of change at many locations. Beginning in 1979 we began to use satellites to measure actual sea level. The results were surprisingly close to the previous tide gauge estimates, but slightly higher, but one sees from Wunsch et al (DOI: 10.1175/2007JCLI1840.1) that one is in no position to argue that small differences from changing methodologies represents acceleration. Regardless, the changes are small compared to the claims that suggest disastrous changes. However, even in the early 1980’s advocates of warming alarm like S. Schneider argued that sea level would be an easily appreciated scare tactic. The fact that people like Al Gore and Susan Solomon (former head of the IPCC’s Scientific Assessment) have invested heavily in ocean front property supports the notion that the issue is propagandistic rather than scientific.
The whole thing is an excellent and sober summary of the problems with climate alarmism.  No matter what your position or beliefs on climate change are, you'll learn something by reading this piece...

Paradise ponders, joinery jig jollies and vampire doctors edition...

Paradise ponders, joinery jig jollies and vampire doctors edition...  The past couple of days I've been assembling and learning to use two joinery jigs that I purchased.  I'm still working on them; they're fairly complicated, both to put together and to use.  One of the jigs is for dovetail and finger joints, the other for mortise and tenon joints. The photo on the left is my new dovetail and finger joint jig, before I assembled it.  On the right is the mortise-and-tenon jig, mostly assembled.  Both of these came with large bags of parts, some of which had to be assembled, and some of which are needed for certain modes of use.  Both also came with thick manuals, well-written and illustrated, showing you how to do all sorts of different things using the jigs.  It will be a while before I feel competent with these. :)  Fortunately, basic sorts of joints look pretty easy to do.


Building these jigs involves a little woodworking, which I wasn't expecting at all.  The most involved thing I have to do is to build a sturdy wooden box that can lift the jigs a couple of feet above the 35" high surface of my bench.  That will let me put joints in boards that are up to 5' long, which I actually need for the very first set of dovetail joints I'm making.

Yesterday Debbie and I had a joint doctor's appointment with our general practitioner.  I had a few things to talk with her about, including my desire to check on my blood B12 levels after adjusting the dose of injected B12 this year.  So the vampire lady there came after me with four vials of blood to fill.  First she stabbed me in the inside right elbow, and got three and a half vials when that vein gave out.  So then she stabbed me in the left inside elbow and got the remaining vial.  Truthfully I barely felt the needle; she was very good.  But I walked out looking like I'd been in a battle, with black wrap over big wads of cotton on both elbows.  Got a big bruise on the right one, too.

Monday, May 1, 2017

Another SpaceX success...

Another SpaceX success...  They launched an NRO classified payload today, and recovered the first stage by a landing at Cape Canaveral.

Simply amazing.  If I were a young man right now, I'd be doing everything I could to get a job at SpaceX.  If I were at NASA, I'd be wondering why.

Webcast of today's launch.  I never get tired of watching these things...


Walking down memory lane again...

Walking down memory lane again...  Just saw the latest Ken Shirriff post on reverse-engineering the 76477 audio chip.  Oh, man, did that bring back some memories!  I ran into that chip when doing a consulting gig to design electronic pinball machines in the late '70s.  Back then the idea of an electronic pinball machine was pretty radical, and in many parts, heretical.  One of the biggest complaints players had about the few electronic machines in existence was the horrible audio (and it really was horrible!).  The fellow I was consulting for was willing to spend some money to solve that problem, and we quickly focused on the 76477 as a practical solution.  We ended up with four of them in our design, all being controlled by a Z80 and a board full of analog electronics to supplement the 76477.  We got it to the point of slightly less than horrible, but certainly nowhere near the mechanical noise nirvana of an old fashioned solenoid-and-relay pinball machine...

Sunday, April 30, 2017

Paradise ponders: router table and sushi edition...

Paradise ponders: router table and sushi edition...  Per a reader's request, a photo (at right) of our new oven, installed.  Above it is the microwave I installed a couple months ago.  Note the walnut trim strip between the microwave and the oven – to our surprise, I didn't need to modify that strip to accommodate the new oven.  The old oven and the new oven are less than 1/16" different in height!

Well, the remaining parts for the router table were delivered on Friday afternoon, as planned.  Yesterday morning I used them to completely finish the router table (at left).  Most of this work was trivially easy, but one part was ridiculously hard.  In the photo you can see a rectangular shaped plate with a circular hole in the middle through which the router spindle projects.  That plate is cast iron (same as the rest of the table), but it sits on four bolts in the corners that are used to adjust its height.  The idea is that you need to match – exactly – the height of the surrounding table.  Well, that's easier said than done!  I found myself making adjustments of as small as a tenth turn on those bolts.  They're extremely awkward to reach, from through a small door in the enclosure underneath the table top.  It took me nearly two hours to get them perfect enough to make me happy.  Those bolts have jam nuts on them, but I hope they don't move!  The crank handle at the left top engages with a nut visible just to the right of the router spindle.  Turning that nut slowly raises and lowers the router assembly.  This is a very nice way of setting the height of the bit.  Overall I'm very pleased with this router table: it's solid, has an absolutely flat and smooth table, the fence is very nicely done, and the router lifter is definitely the cat's meow.  I've only used it on a few test pieces so far, but worked beautifully on those...

Yesterday afternoon we went out to celebrate two things: me finishing the router table (what a kit that was!) and Debbie doing her first day of good exercise since her most recent surgery.  Debbie had a small beer and a noodle dish she managed to eat entirely.  There was a lot of happy noises and smiles from her side of the table.  I had the sashimi at right (hamachi, sake, maguro, and white "tuna" (escolar).  All delicious!  I also had a rainbow roll with the same four fish.  I am so glad we found out about sushi at Black Pearl, as it's by far the best in our area (at least, the best of all those I've discovered!).

A wall around California...

A wall around California...  I suspect the majority of the population of the Mountain States would think this was a very good idea!


Saturday, April 29, 2017

Favorite colors...

Favorite colors...  It would never have occurred to me to study the question of what colors are people's favorites.  Nor would I have expected that there would be significant differences in the popularity of various colors.  But there apparently are:

My own favorite color?  Well, I'd have a hard time choosing between bright orange (like a California poppy) or bright yellow (like a nice lemon).  Maybe a slight preference to the orange.  That puts me solidly in the weirdo category, it seems.  One of my friends likes to call me “six sigmas” because I'm at least six standard deviations from normal (though I claim eight!).  This seems to be yet another dimension in which I deviate...  :)


Paradise ponders: Utah gratitude edition...

Paradise ponders: Utah gratitude edition...  I fled to Utah from California just three years ago, after living in that sunny land for 43 years.  When I first came to California, in 1971, I was coming from New Jersey.  The California of 1971 was a paradise by comparison to the hell-on-earth that was New Jersey.  Back then, even California's government was better.

It was all downhill from there.  By the time we retired in 2013, it was obvious to Debbie and I that our long-planned retirement in the mountains of San Diego wasn't going to be the dream we'd thought it would be.  We made up our minds to leave, and we chose Utah for many reasons.

It turns out, though, that we'd underestimated (by a lot!) just how well we'd fit in here in Utah.  We'd expected the natural beauty, as we'd traveled here many times.  We knew the weather would include actual seasons.  We hoped that the government would prove to be less intrusive, more common-sensical, and it has.  But we did not expect the people here to be so welcoming, despite our not being of the predominant faith here (LDS).  We also didn't expect some other things, slightly subtler, but that turn out to be very important to us. 

I'd say the biggest one, for me, is the general assumption of honesty here.  In general, people just trust one another.  If you tell a craftsman that you agree with their price, they'll just proceed with the work and trust that you'll pay them.  If you leave your wallet somewhere, you can trust that it will be held for you, contents intact.  If you leave your car unlocked, you can trust that it will not be stolen.  If you carry ten items to the cash register in a store and tell the clerk you have ten of them, she'll just ring you up for ten without even counting.  And so on.  I'm talking about out here in the countryside, where we live – the story is different in the cities, of course.  Out here, though, people just assume that you're honest in your dealings.  How refreshing, especially compared with our experiences in California!

Another slightly subtle surprise for us: we can depend on others around here for help, and they assume they can depend on us.  I still get surprised by this quite often – people are all the time volunteering to help out, and they really mean it. 

And some of our neighbors have become good friends, despite the vast differences in our backgrounds and experiences. 

We're very grateful for the wonderful home that Utah has made for us.

And when we read things about California, like this or this, we're even more grateful for Utah providing us with refuge!

Friday, April 28, 2017

Paradise ponders: snow and router table edition...

Paradise ponders: snow and router table edition...  The router table is now complete except for the actual router and it's lifter (they're supposed to arrive today). The rest of the kit went together just as perfectly as the first third.  The only challenging part turned out to be putting that cast iron top on.  That thing was heavy (I'm guessing about 70 pounds), and the bolts that attach it to the stand go up through the bottom of it.  That was a real booger to get on, because the top's mounting holes had to be precisely aligned with the corresponding holes in the stand, and because I couldn't see a darned thing inside the cabinet (no space to get my fat head in there).  The first photo below shows the wood chip box that's supposed to make this router table nearly dust and chip free.  We'll see how well that works!


Our weather today is really hard to believe for being nearly May.  We've had rain, hail, sleet, and snow today, all day long.  Right now it's raining.  It's about 35°F outside, so the snow and sleet aren't sticking very long, thankfully.  Our trees (at right) had some snow on their leaves, though.  But once again, it's wet as heck outside – there's mud everywhere.  Dang.

AI and deep learning...

AI and deep learning...  My long time readers will know that I am very skeptical of artificial intelligence (AI) in general.  By that I mean two separate things these days, as the field of AI has split into two rather different things the past few years.

The first (and oldest) meaning was the general idea of making computers “intelligent” in generally the same way as humans are intelligent.  Isaac Asimov's I, Robot stories and their derivatives perfectly illustrated this idea.  The progress researchers have made on this sort of AI is roughly the same as the progress they've made on faster-than-light space travel: nil.  I am skeptical that they ever will, as everything I know about computers and humans (more about the former than the latter!) tells me that they don't work the same way at all.

The second more recent kind of AI is generally known by the moniker “deep learning”.  I think that term is a bit misleading, but never mind that.  For me the most interesting thing about deep learning is that nobody knows how any system using deep learning actually works.  Yes, really!  In this sense, deep learning systems are a bit like people.  An example: suppose spent a few days learning how to do something new – say, candling eggs.  You know what the process of learning is like, and you know that at the end you will be competent to candle eggs.  But you have utterly no idea how your brain is giving you this skill.  Despite this, AI researchers have made enormous progress with deep learning.  Why?  Relative to other kinds of AI, it's easy to build.  It's enabled by powerful processors, and we're getting really good at building those.  And, probably most importantly, there are a large number of relatively simple tasks that are amenable to deep learning solutions.

Deep learning systems (which are programs, sometimes running on special computers) we know how to train, but we don't know how the result works, just like with people.  You go through a process to train them how to do some specific task, and then (if you've done it right) they know how to do it.  What's fascinating to me as a programmer is that no programming was involved in teaching the system how to do its task – just training of a general purpose deep learning system.  And there's a consequence to that: no programmer (or anyone else) knows how that deep learning system actually does its work.  There's not even any way to figure that out.

There are a couple of things about that approach that worry me.

First, there's the problem of how that deep learning system will react to new inputs.  There's no way to predict that.  My car, a Tesla Model X, is a great example of such a deep learning system.  It uses machine vision (a video camera coupled with a deep learning system) to analyze the road ahead and decide how to steer the car.  In my own experience, it works very well when the road is well-defined by painted lines, pavement color changes, etc.  It works much less well otherwise.  For instance, not long ago I had it in “auto-steer” on a twisty mountain road whose edges petered off into gravel.  To my human perception, the road was still perfectly clear – but to the Tesla it was not.  Auto-steer tried at one point to send me straight into a boulder!  :)  I'd be willing to bet you that at no time in the training of its deep learning system was it ever presented with a road like the one I was on that day, and therefore it really didn't know what it was seeing (or, therefore, how to steer).  The deep learning method is very powerful, but it's still missing something that human brains are adding to that equation.  I suspect it's related to the fact that the deep learning system doesn't have a good geometrical model of the world (as we humans most certainly do), which is the subject of the next paragraph.

Second, there's the problem of insufficiency, alluded to above.  Deep learning isn't the only thing necessary to emulate human intelligence.  It likely is part of the overall human intelligence emulation problem, but it's far from the whole thing.  This morning I ran across a blog post talking about the same issue, in this case with respect to machine vision and deep learning.  It's written by a programmer who works on these systems, so he's better equipped to make the argument than I am. 

I think AI has a very long way to go before Isaac Asimov would recognize it, and I don't see any indications that the breakthroughs needed are imminent...

Paradise ponders: of ovens and arduous kits...

Paradise ponders: of ovens and arduous kits...  Yesterday morning we finally got our new oven (Bosch photo at right) delivered and installed.  We were supposed to get it this past Monday, but after looking at it Darrell realized he was going to need some help – the beast weighs 180 pounds!  Darrell (the owner of Darrell's Appliances), with Brian to help him, had it installed in less than an hour after arriving.  I had already removed our old oven and wired an electrical box, which saved them some work.  However, there was a challenge for them: the opening in our cabinetry was 3/8" too narrow.  Darrell set up some tape as a guide, whipped out his Makita jig saw, and had that problem fixed in a jiffy.  There was a bit of a struggle to get it off the floor and into the hole, but once they did everything else went smoothly.  It seems to work fine.  The controls are a breeze to use.  We haven't cooked anything yet, but I'm sure Debbie will pop something in there soon! :)  One big surprise for us: it comes with a meat thermometer that plugs into a jack inside the oven.  How very convenient!

Yesterday I started building the new router table I bought (Rockler photo at right).  When I took delivery of the table, I thought there had been some kind of mistake: it came in two flat boxes, just a couple inches thick and not all that big.  No mistake, though – it's just a serious kit.  By that I mean that what you get is some pieces of sheet metal, cut, drilled, bent, and threaded as needed, along with a bag of nuts and bolts.  A big bag of nuts and bolts!  The packing was ingenious – a whole lot of metal pieces packed into a very small volume.  I was a bit dismayed upon seeing the kit after unpacking it, as my general experience in assembling kits made mostly of sheet metal is ... pretty bad.  Things usually don't fit right, and I end up using pliers, hacksaws, rubber mallets, and nibblers to get everything to fit.  Often I have to drill and thread my own holes.  Worse, usually the edges of the sheet metal are as sharp as a razor blade and I end up looking like the losing side of a knife fight.

I'm about one third of the way through the assembly, and so far I am very pleasantly surprised.  With just a single exception, every part has fit precisely correctly, first try.  Better yet, the edges of the sheet metal don't seem quite so sharp – no cuts yet (and no bloodstains on the goods!).  The one exception was a minor one: I needed one gentle tap of the rubber mallet to get a recalcitrant threaded hole to line up with a drilled hole.  The directions are crystal clear, with great illustrations.  I hope the rest of the assembly is just as nice!


Thursday, April 27, 2017

NASA at...

NASA at ... its most awesome, and at its least awesome...  Too bad there's so much more of the latter than the former...

Paradise ponders: artichokes, kits, better indexes, and electricity edition...

Paradise ponders: artichokes, kits, better indexes, and electricity edition...  Yesterday Debbie made a new dish – a casserole of chicken, artichokes, onions, Parmesan cheese, and mayonnaise.  That's her serving at right, over rice.  This one is a keeper, and I was a bit surprised just how tasty those artichokes were.  They were canned, in water, not the marinated kind I'm familiar with.  The water was salted, so we leached as much as possible out by soaking them in fresh water, replaced several times, and that seemed to work very well.  A keeper recipe for sure!  Both of us thought of several modifications we could make to it that might be even better.  I sense some artichokely experimentation in our future...

Over the past few days some tools I've ordered arrived: a couple of jigs (for making box joints and mortise-and-tenon joints) and a router table.  All three of these are kits – boxes of parts with bags of nuts and bolts.  Big bags of nuts and bolts.  I'm gonna be putting things together for a while before I can use them.  All three of these were long-planned, but I need them now to let me build some stuff for the cattery.  Somehow I didn't expect the jigs to be kits, but the fact that the router table is a kit doesn't really surprise me...

A couple days ago I posted about an index to look up the value of the largest decimal digit that is smaller than a given binary value.  The code that I posted was ... not optimal.  Here's a better attempt:
int lz = Long.numberOfLeadingZeros( _val );
int mag = 63 - lz;
int hi = mag << 3;
long sec = Long.highestOneBit( _val ) ^ _val;
int lo = (int)(sec >>> Math.max(0, mag - 3));
int index = hi | lo;
In addition to a better algorithm, I also made the code easier to read. The compiler optimizes the local variables away, so there's no performance impact to this.  The 9 bit index generated is pretty simple.  If 2^k is the most significant bit in _val, then the upper six bits of the index are k, and the lower three bits are the bits in _val at 2^k-1, 2^k-2, and 2^k-3 (with a bit of special casing for k < 3).

I'm going to be putting up a little shed soon, to house some components of our sprinkler system.  I had my favorite electrician (Tyler, from Golden Spike Electric) out yesterday evening to check out the job.  It's such a pleasure to work with people like him!  I want something kind of weird (naturally!), and he had absolutely no problem accommodating me.  I'm going to have him run a 50 amp 220 volt circuit to a subpanel in the new shed, and I'm going to wire it from there.  “No problem”, says he – and we looked over the existing panel that he'd connect to.  There was a circuit installed long ago that ran to an external plug for an RV.  This is not something we'll ever need, so we're going to remove that and steal the existing breaker (which happens to be 50 amp!) for my new subpanel.  Easy peasy!

Wednesday, April 26, 2017

Paradise ponders: Debbie's “graduation”, filling station milestone, steam train, and tax cuts...

Paradise ponders: Debbie's “graduation”, filling station milestone, steam train, and tax cuts...  This morning Debbie went in to see her surgeon for a two week post-surgery followup.  He pronounced her recovery to be great, ready to get her staples taken out, and cleared for any physical activity that didn't cause her pain.  She looked so good, in fact, that he declared it unnecessary for her to have the usual subsequent followup visits.  This prompted a nurse who was in the room to comment that Debbie had “graduated”.  Yay!  The staples came out (something that Debbie really hates – she crushed my hand and buried her head in my shoulder while the nurse did this), and now her big job is to see how far she can push herself with exercise before it gets painful.  First milestone there will be walking without any walker, crutches, or cane.  The surgeon said she could be doing this just as soon as she can comfortably put full weight on her left knee.

Yesterday the guys were here working on our filling station.  They got all the pipe cut, threaded, and installed – the tanks are now actually connected to the nozzles!  I just put in a call to my fuel supplier, and within a few days I should actually have some gasoline and diesel fuel sloshing around in those  tanks.  There's still more work to do on the filling station, but we can use it while that work gets done.  I've just ordered the steel door to go in the front of it; that should be here in six weeks or so.  I've also got Randy Bingham (the mason who did our fireplace) lined up to put rock on top and all around it, but it might be a while before that gets done.  Progress! 

Yesterday we'd planned to go see a steam locomotive that was scheduled to stop for just a half hour in Cache Valley.  The place where it was to stop was the teensy little town of Cache Junction, just south of my brother Scott's home.  This town has about four houses, and it's kind of in the boonies of Cache Valley – so we weren't expecting many people to show up for it.  Man, were we wrong!  There were a couple hundred cars parked there, overflowing the little parking area to line the sides of the roads for a half mile or so on both sides of town.  I'd guess that around a thousand people were milling all about.  In that environment there was no way for us to park close by for a view of the train, and Debbie's not ready to walk over rough ground, so we just drove through town and marveled at the size of the crowd.  We visited for a little while with my brother (where we picked up some beautiful logs he'd saved for me) and on the way out we did get to see the locomotive as it approached Cache Junction.  We crossed the tracks about 2 miles from Cache Junction and were amused to see that a crowd had gathered there as well.  This steam locomotive was darned popular here!

As I started writing this post, news is trickling in about Trump's proposed tax cut.  I have no idea what the chances are that this will actually get through Congress intact, but I'm skeptical given the magnitude of the cuts and the general hostility of the Democrats.  But one aspect of the proposed plan jumped out at me: repealing the federal income tax deduction for state and local taxes.  This deduction is, in effect, a federal subsidy that disproportionately benefits residents of high tax states.  I'd be delighted to see that actually be repealed, but it's easy to foresee that the Democrats will start crazed howling about this one.  That's so obvious that I have to wonder if it was included in the proposal mainly as a sop whose removal could be traded for Democratic votes in the Senate...

Tuesday, April 25, 2017

Binary to decimal conversion performance...

Binary to decimal conversion performance...  Now here's an obscure topic that I've worked on a great many times over my career.  The original inspiration for me to work on this came from programming the Z-80, way back in the '70s.  That little 8 bit microprocessor could do 16 bit addition, but it had no multiply or divide instructions at all.  Often the application I was working on needed higher precision math (usually 32 bits), so I had a library of assembly language subroutines that could do the basic four 32 bit operations: add, subtract, multiply, and divided.  Multiply and divide were maddeningly slow.  Eventually I came up with a way to speed up multiply considerably, but divide was intractably slow.

This slow divide performance was on full display anytime I wanted to convert a 32 bit binary integer to its decimal equivalent.  The canonical algorithm uses repeated division-with-remainder by ten.  For instance, to convert the binary number 11001001 to its decimal equivalent, you would do this:
11001001 / 1010 = 10100 remainder 1
10100 / 1010 = 10 remainder 0
10 / 1010 = 0 remainder 10
The result is then the remainders, in decimal, in reverse order: 201.  You need one division operation for each digit of the result.  A 32 bit number might have as many as ten digits, and on that low-horsepower little Z-80, those divisions were really expensive.  So I worked hard to come up with an alternative means of conversion that didn't require division.

What I came up with has been independently invented by many people; I wasn't the first, I'm sure, and I don't know who was.  The basic technique depends on a simple observation: there aren't all that many possible decimal digits whose value fits in a given length binary number.  For instance, in a signed 32 bit binary number, the largest positive decimal number that can be represented is 2,147,483,647.  That's 10 decimal digits, any of which can have the non-zero values [1..9], except the most significant one can only be [1..2].  That's just 83 values.  If you pre-compute all those 83 values and put them in a table, then you can convert a binary number to decimal with this algorithm:
start with the binary value to be converted
while remaining value is nonzero
    find the largest value of a decimal digit < the remaining value
    record the digit
    subtract that decimal digit value from the remaining value
This produces the decimal digits in order, from the most significant digit to the least significant digit.  Most importantly, it does so with no division required.

That was vital to getting decent performance out of that Z-80.  But what about a modern processor?  Well, it turns out that in relative terms, division is still the red-haired stepchild of CPU performance.  On a modern Intel or ARM processor, 64 bit integer division can take over 100 CPU clock cycles.  Multiply operations, by comparison, take just a handful of clock cycles, while addition and subtraction are generally just 1 or 2 clock cycles.  Even when using a high-level language like Java, algorithms that avoid using division repetitively can still produce large performance gains.  I've done this five or six times now, most recently to get a 6:1 performance gain when converting floating point values to XML.

One line of the above algorithm I sort of glossed over: the bit about finding the largest value of a decimal digit that is less than the remaining value.  The naive way to do this would be to use a linear search, or possibly a binary search of the table of decimal digit values.  This would require a number of iterations over the search algorithm, at best an average of 4 iterations for a binary search over a table big enough for 32 bit values.  For 64 bit values we'd have 171 decimal digit values, and we'd need 5 iterations for that binary search.

We can do better, though, by taking advantage of the fact that there's a close relationship between the binary values and the largest fitting decimal digit.  I just finished coding up a nice solution for finding the largest decimal digit that fits into a signed 64 bit integer.  It works by using a table with 512 entries, about three times as many as we have possible decimal digit values.  Given a 64 bit positive binary number, the Java code that computes the index into that table is:
int lz = Long.numberOfLeadingZeros( value );
int index = ((63 - lz) << 3) + (0xf & (int)Long.rotateRight( value, 60 - lz));
Pretty simple code, really. It's also very fast.  Best of all, with a properly constructed table the index will point to an entry that will either be the correct one (that is, the largest decimal digit that will fit into the value) or it will be too big.  If it is too big, then the preceding entry in the table is guaranteed to be the correct one.  Much better than the iterative searches!

With those two techniques in combination, I'm doing conversions from binary to decimal with no divisions and no iterative searching.  It's very challenging to benchmark performance in Java, but my simple testing shows about 5:1 improvement in performance for random numbers in the 64 bit positive integer range.  Smaller numbers (with fewer decimal digits) show smaller performance gains, but always at least 2:1.  I'll call that a win!