Thursday, April 27, 2017

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!

No comments:

Post a Comment