Like Dad Used to Keep It

Dad was a big keeper of the boxes things came in.

Dad was a big keeper of the boxes things came in.

Every time I look at the transistor radio in my workshop, I think about my Dad. Well, not the radio, really, but the box. See all the wear and tear? That radio box is about 10 years old.

Dad’s been gone for a few years, now, but Dad would do that. He’d keep things in the original box until the box disintegrated. It’s a good idea for several reasons:

  • Labels the item
  • Preserves the instructions
  • You know where to get parts (if anything is actually repairable.)
  • It makes odd-shaped items fit neatly on the shelf and in drawers.

However, I don’t think any of those reasons are the real motivation. Maybe it goes back to when the container was a part of the product. Like, back when the boxes for tools looked nicer than the boxes for jewellery look now.

Even more than that was just Dad’s impulse to preserve, to keep things nice. Anyway, when I see that old box, I think Dad likes to see it, too.

Posted in Commentary | Tagged , , , | Leave a comment

Getting Away With Something

Sodom and Gomorrah - John Martin

Sodom and Gomorrah – John Martin

Then the Lord said, “How great is the outcry against the elitists and their government toadies. They cry out against the poor and say that they toil not, neither do they spin. I must go down and see who is Getting Away With Something.”

Abraham remained standing before the Lord. Then Abraham came near and said, “Will you indeed sweep away the deserving with the wicked? Suppose there are fifty within the Safety Net who couldn’t meet their medical bills; will you then sweep away the Safety Net from the fifty deserving who are in it? Far be it from you to do such a thing, to cut off the deserving with the wicked, so that the deserving fare as the wicked! Far be that from you! Shall not the Judge of all the earth do what is just?”

And the Lord said, “If I find fifty deserving within the Safety Net, I will leave the whole plutocracy in place for their sake.”

Abraham answered, “Let me take it upon myself to speak to the Lord, I who am but dust and ashes. Suppose five of the fifty deserving could have paid their medical bills, but now they have lost their jobs? Will you destroy the whole Safety Net for lack of five?” And he said, “I will not destroy it if I find forty-five there.”

Again he spoke to him, “Suppose forty are found there who owe on student loans for a degree that the elite value not?” He answered, “For the sake of forty I will not do it.”

Then he said, “Oh do not let the Lord be angry if I speak. Suppose thirty are found there who bore their children rather than abort them?” He answered, “I will not do it, if I find thirty there.”

He said, “Let me take it upon myself to speak to the Lord. Suppose twenty are found there who are working, but cannot earn a just wage?” He answered, “For the sake of twenty I will not destroy the Safety Net.”

Then he said, “Oh do not let the Lord be angry if I speak just once more. Suppose ten are found there whose retirement was taken to pay executive bonuses?” He answered, “For the sake of ten I will keep it in place.”

The two angels came to the plutocracy in the evening, and Lot was in a place of honor within the plutocracy. When Lot saw them, he rose to meet them, and bowed down with his face to the ground. He said, “Please, my lords, let me treat you as equals, even though you cannot prove that you are deserving.” They said, “No; we will spend the night in this town square.”

But he urged them strongly; so they turned aside to him and entered his house; and he made them a feast, and baked unleavened bread, and they ate.

But before they lay down, the men of the plutocracy, both the elite and their toadies, all the people to the last man, surrounded the house; and they called to Lot, “Where are the men who came to you tonight? Bring them out to us, so that we bring them into the plutocracy. We wish to make unto them loans instead of Free Stuff, that they may become indentured servants unto us.”

Lot went out of the door to the men, shut the door after him, and said, “I beg you, my brothers, do not act so wickedly. Look, I have two daughters who have not yet entered the plutocracy; let me bring them out to you. The younger will be an unpaid intern unto you; and the elder will hew wood for 30 hours and draw water for another 30 so that even the Safety Net avail her not. Only do nothing to these men, for they have nothing to yield up to you.”

But they replied, “Stand back!” And they said, “This fellow came here from outside, and his charity is given freely to those who cannot prove they deserve it! Now we will deal worse with you than with them.” Then they pressed hard against the man Lot, and threatened him with foreclosure.

But the men inside Lot’s house reached out their hands and brought Lot into the house with them, and shut the door. And they smote the men who were at the door of the house, both small and great, so that they were unable to find who actually held the mortgage on Lot’s house. The first waved papers that shew him as the owner of Lot’s house, but another had papers that shew the first had failed to file other papers, and there was great confusion.

Then the men said to Lot, “Have you anyone else here? Sons-in-law, sons, daughters, or anyone you have in the plutocracy — bring them out of it. For we are about to destroy this plutocracy, because the outcry against its people has become great before the Lord, and the Lord has sent us to destroy it.”  So Lot went out and said to his sons-in-law, who were to marry his daughters, “Up, get divested now; for the Lord is about to destroy this plutocracy.”

But his sons-in-law said, “Are you jesting? It has always been this way. What would take its place? Within six months, all the shekels will be right back in the same purses.”

When the light dawned, the angels urged Lot, saying, “Get out, or else you will lose everything in the downturn.” But he lingered; so, the Lord being merciful to him, the men bought him out and left him outside the plutocracy. Likewise, they bought out his wife and daughters from their financials and credit default swaps. When they had bought them all out, they said, “Just forget this whole plutocracy; do not look back or try to save any part of it; flee to the hills, or else your substance will be consumed.”

And Lot said to them, “Oh, no, my lords; your servant has found favor with you, and I am glad to get away with something; but I cannot just shut down completely, for fear the downturn will overtake me and I will go broke. Look, that Zoar co-op is easy enough to invest in, and it is a little one. Let me put my investments there — is it not a little one? — and my assets will be saved!” They said to him, “Very well, I grant you this favor too, and will not overthrow the co-op of which you have spoken. Hurry, invest there, for I can do nothing until you are fully vested there.” Therefore the co-op was called Zoar. The light had fully dawned on the earth when Lot became fully vested in Zoar.

Then the Lord rained on the elitists and their servile government sulfur and fire out of heaven; and he overthrew that plutocracy, and all that elite, and every transaction that they corrupted. But Lot’s wife, behind him, couldn’t resist selling short on the downturn, and she became a pillar of salt.

Abraham went early in the morning to the place where he had stood before the Lord; and he looked down where the elitists and their servile governments had been and toward all the land of the plutocracy and saw the smoke of them going up like the smoke of a furnace.

So it was that, when God destroyed the elitists and their government toadies, God remembered Abraham, and sent Lot out of the midst of the downturn, when he overthrew the plutocracy in which Lot had invested, because Lot had showed mercy to those who had not proven that they deserved it.

Whenever the safety net is discussed, even among Christians, the conversation always gets around to welfare cheats, if it doesn’t start there. Well, of course there are some, but what of it?

  1. God doesn’t limit His charity to the deserving, so we can’t, either. As G. K. Chesterton points out, if someone deserves a benefit, that it is a demand on us for justice rather than an opportunity for us to show charity.
  2. God seems to set great value on preserving even very imperfect things. He doesn’t burn down the city to exterminate some rats; nor plough up the wheat to kill the tares. Helping truly needy people, even if they were in the minority, takes precedence over preventing abusers from Getting Away With Something.
  3. God does not give money and power to certain people because they possess some superior wisdom or morality. The cost of one rich tax dodger, one unearned government subsidy, or one no-bid defence contract can easily exceed the cost of all  welfare programs put together, but the discussion almost never turns to the sins of the wealthy and powerful.
Posted in Commentary | Leave a comment

Meaningful Pagination

Why “Meaningful?”

Well, if your results are ordered by last name, which page do you click to see “Phillips” ?

<<Page 1, 2, 3 . . . < 15, 16, 17 > . . . 32, 33 >>

Go on, guess!

Wouldn’t this be easier?

<< Appleby, Brown, Busskirk . . . < Lundy, Numps, Psederton > . . . Wycliffe, Zetos >>

See?  With proper page labels you can find the page in a couple of clicks.

Page numbers only make sense when there is no natural order to the results. A true search (returning results in “relevance” order, say) is forced to use page numbers, because the results don’t have any consistent labels. However, there’s no excuse for making users guess which page number is the “P’s” when we’re filtering and sorting a “Last Name” column.

It’s normal to have some kind of default ordering, so that should be used to label the pages. If we’re talking about people, family name is a good default order. There is a demo at, and the default order is family_name.

However, we could use “Supervisor.” If you click the “Supervisor” link in the first table of search terms, you’ll see that the results are paginated by supervisor’s name. (Hover over “Pick Page” in the brown pagination menu.)


Whatever we use, the pages should be labeled with the value of that field for the first record on the page.

Here’s One Way To Do Meaningful Pagination

Use whatever paginator you like. Kaminari is fine.

We’ll need to know which field the results are sorted by (there’s a little extra code to put the sorted field on the left if it’s an optional field, but that’s another tutorial):

Then we can get the contents of the first record on each page.

It’s simpler just to use the same page length and select the first field on each page.

So, the controller looks like this:

Then, it’s just a matter of creating the navigation display.

The view calls for the pagination navigation display if there is more than one page of results

There’s a little helper method:

which calls the actual pagination navigation partial:

And, finally, style it all:

There! It’s a bit of work, but it really makes user life easier.

Posted in Information, Ruby on Rails, tutorial | Leave a comment

Rails, Ransack, and Associations The Easy Way

Ransack (neé Metasearch) is brilliant at providing ad hoc table searches for users, but  handling all the possible ActiveRecord associations can require workarounds. However, it is bonehead simple to use with a single table. So, we’re going to give it one.

Views are Read-only Tables

A lot of the problems posted on StackOverflow happen when we use associated table fields. An employee has_one section, and we want to filter/sort by the section name. That kind of thing.

I find it’s simpler to avoid the whole issue. I have a demo running at The Employees Search (the landing page) uses results from four different tables, one used twice with an alias, and from another view. It ought to be a nightmare, but it’s actually simple, because it’s using a single virtual table (a Postgresql view.)

There are some other features implemented in the demo, but they’re for future tutorials. You can ignore them, for now.

I wouldn’t use a view for editing, but we only need to show/sort/filter. The view joins any associated tables and makes their columns look and act like native columns in a table.
A view will play nicely with Ransack, because it looks to Rails just like a single table.

How nice it is to get a table with all the columns renamed, all the text concatenation done, all the columns from associated tables sortable and filterable — yum! Null handling is another nice feature: nulls can be shown as “NULL” or “Inactive” or whatever you like, or left as nil values.

Creating/Editing a view in PostGreSQL:

I like to name my views “fil_whatever” (filter), and columns from joined tables as “whatever_disp” if several tables have columns with the same name. For example, if the “sections” and “divisions” tables both have a ‘title’ column, I’d rename them to section_disp and division_disp. I usually include the ‘whatever_id’ columns as well, so that my associations work, although I seldom use them.

That sql will produce a virtual table in PostGreSQL. The view can be used as though it were a table in its own right:

Gives results like:


So, we have pulled four tables and another view and an alias into one do-it-all table. However, as far as Rails is concerned, it is just another table, except:

  1. It doesn’t show up in your schema.rb
  2. You need to add a couple of lines to the model to let Rails find the table.

Here’s the controller:

and here’s the view:

There you have it. For my money, that’s a lot easier than fiddling :joins, :includes, scopes, etc. in Rails. YMMV, of course.

Posted in Information, Ruby on Rails, tutorial | Tagged , , , | Leave a comment

Camera Stabilizer? Who knows?


I had a request a while back: to create a camera stabilizer like this one. The challenge: it needed to be simpler to make.


I took that to mean more assembly of stock parts, and less drilling, heating, stretching, etc. I came up with this design, which meets the criteria, and actually shaves a bit off the cost.

It uses a Female Thread – Rod End Bearing ($3.08), a piece of threaded rod ($0.56), a 1′ piece of about anything, and some common nuts, bolts, and washers. It ought to be under $10, easy.

The rod end provides freedom of rotation in roll, pitch, and yaw, and the bar with the stack of washers at the ends provides inertia for stabilization.

I think.

You see, I have never used a Steadicam. I’ve never even seen one used, come to that. I tried it, and my results were distinctly better than hand-held, but what does that mean?

So, to test it, I am looking for someone who knows what’s supposed to happen! If it gets an upcheck, then I’ll feel comfortable publishing the full instructions, price list, and sources.

If you are willing to be a guinea pig, let me know.

Posted in NewProducts | Leave a comment

Fun Experiment: Same Odds, Different Lucky

There’s a good measure of odds called the “percentile.”

Let’s say you have an Stanford-Binet IQ of 150. What are the odds of that?

According to, that’s the 99.9110907427 percentile. That means that 1 person in 1,125 will have that IQ or higher.

To put it in more graphic terms, that’s as unusual as a man that is 6′ 6″ tall. (You can look it up: go to WolframAlpha, enter the terms “99.91109 percentile height” and set the age to “30 years.”)

Wait a minute! Six-foot-six?

  • If you were 6′ 6″, would you fit in? Literally? Airplane seats, back seats of cars, stadium seats?
  • Could you walk into WalMart and buy clothes that fit?
  • Would you pass unnoticed anywhere in person? You’re shy? Tough!
  • Would people expect different things from you?
  • Would they expect you to somehow fit yourself in?

So, if you have an IQ of 150, you’re just as exceptional as a man that’s 6′ 6″, but it’s invisible! (Unless you also happen to be 6′ 6″, but what are the odds?) The thing that struck me is how differently these “rare birds” are treated.

LeBron James, who is a basketball genius, at least, was identified and set apart when he was 11 years old. By the time he started in the NBA, he’d had 8 years of intensive basketball education. He always had high potential, but without that 8 years of intensive coaching, he couldn’t have achieved such high performance.

LeBron James 2

(Yes, I know he’s 6′ 8″, but the principle is the same.)

Compare a teacher with a 150 IQ kid (IQ) and a coach with a kid that’s going to be 6′ 6″ (TALL):

 (IQ) If the teacher says, “He’s smart, he’ll be fine. I need to concentrate on the kids that can’t pass proficiency,” people might cluck their tongues.

(TALL) If the coach says, “He’s tall, he’ll be fine. I need to concentrate on kids that are going to top out at 5′ 10″,” he’ll be spending more time with his family. Probably the next morning, in fact.

(IQ) If the teacher feels threatened because a kid is smarter than he is, people will call him democratic.

(TALL) If the coach feels threatened because a kid is taller than he is, people will call him to fix their garage doors.

(IQ) If the teacher consistently prefers average work to superior work, he’s working on the kids’ social skills.

(TALL) If the coach consistently plays his average players and benches the tall kid, he’s working on getting his food stamps.

(IQ) “We have a new gifted coordinator. One of the new teachers shows a real talent for working with smaller groups,” i.e., is hopeless in a classroom.

(TALL) “We have a new coach. We hired him away from last year’s city championship-winning school! They’re willing to drop all charges.”

How do they spend their free time?

(IQ) If the 150 IQ kid spends his summers at a computer camp, you’re pushing him.

(TALL) If the 6′ 6″ kid doesn’t spend his summers at basketball camps, you’re holding him back. 

Emotional development?

(IQ) If the 150 IQ kid knows he’s smarter than everyone around him, he has an emotional problem.

(IQ) If the 6′ 6″ kid knows he’s taller than everyone around him, he has a mirror.

Now it’s your turn: who are they talking about here?

(?) “Geek.”

(?) “Standout.”

Access to tools?

(?) “We have a resource room they can use during study hall. I think it has a computer.”

(?) “Outside of gym class? Well, our standouts have use of the gym through the summer, and lighted courts outdoors, and the Booster Club is equipping a weight room, and the coaches have a couple of training camps during the summer. The coaches each make an additional $5000/year.”

(?) “It looks like you can get a $1000/yr from the alumni association, and $500/yr from the Left-handed Plumbers Memorial fund.”

(?) “Full ride at any of three competing state schools. Just don’t get hurt next year when you’re a senior, and the rest will probably make offers, too.”

So, as Wired Magazine puts it:

Bill James, the pioneer of Moneyball-style statistical baseball analysis, points out that modern America is already very good at generating geniuses. The problem is that the geniuses we’ve created are athletes. As James says, this is largely because we treat athletes differently.

  • We encourage them when they’re young, chauffeuring our kids to practice and tournaments.
  • We also have mechanisms for cultivating athletic talent at every step in the process, from Little League to the Majors.
  • Lastly, professional teams are willing to take risks, betting big bucks on draft picks who never pan out.

Because of these successful meta-ideas, even a small city like Topeka, Kansas—roughly the same size as Elizabethan London, James points out—can produce an athletic genius every few years.

And, finally, there’s this from Forbes Magazine:

University of Florida Eliminates Computer Science Department, Increases Athletic Budgets. Hmm.

Go Gators! Go get in line for food stamps!


Posted in Commentary, Information | Leave a comment

Take the nickel.

Old story: if offered a dime or a nickel, the “village idiot” would always take the nickel. Finally the new guy in town says, “I’ve been watching you. You’re not that dumb, why do you always take the nickel?” And the “idiot” says, “Because if I take the dime, they quit offering.”

Everyone’s heard it. I’m posting it here because virtually all businesspeople and politicians will take the dime, every time. Then they’ll go sit in some sports bar and tell each other stories about how clever they were to get that dime.

The tyranny of the obvious.

Posted in Commentary | 1 Comment