Saturday, November 26, 2011

Random Thoughts

Richard Feynman is one of my heroes, as much for his brilliance and creativity as for his sense of humor, his matter-of-fact view of the world, and his unassuming and, well, human personality. Years ago, as I read his autobiography, Surely You're Joking, Mr. Feynman, I couldn't help thinking I would have loved to work with him. Maybe, just maybe, I might have absorbed some of the Feynman genius (or at least some of the Feynman humor) through osmosis. But I also wonder if he'd approve of my curiosity and quirky thoughts, or if he'd just shake his head and wonder if I'd ever get it right. The first chapter of his autobiography is titled "He Fixes Radios by Thinking!" But my version, one of the highlights of my career, might've been called "He Fixed a Critical Product Flaw by Accident."

I was an engineer at a tiny company, building a family of devices that still make me proud. Before most people had even heard of the Internet, our appliances let our customers connect their computers over the telephone or a network to their remote electronic equipment: the PBXes that ran their telephone systems, their network switches and routers, their alarm systems, you name it. If you could talk to it electronically, we'd figure out how to connect you to it. Better still, we could program our devices to monitor that equipment, diagnose any faults, and page a technician if we couldn't fix the problem automatically. Then the technician could access our device with his computer, connect through it to his own equipment, and fix it without leaving home!

Of course, we didn't want to open the proverbial barn door to anyone with a computer, so we built some heavy-duty security into all of our products, many of which are still considered state-of-the-art. The details were too complicated for our average customer, so we tucked them inside a fairly simple, friendly interface. So simple, in fact, that we often taught our computer-savvy customers how to write their own programs to make our devices do almost anything they could want. Seriously: anything that involved communication, monitoring, and alarming. One customer bolted them to cell phone towers. Why? You've seen the flashing red lights on top of those towers, the ones that warn pilots to keep their aircraft a safe distance away? Well, this customer wanted to monitor the lights, start a diesel generator if the power failed, and page a technician any time a light stopped working. We did that.

One particular training was held at our office during the holiday season. I sat in, partly to meet the customers, partly to see how our products were used "for real," and partly because it's an absolute treat to be in one of Mike's classes. One of the company's founders, Mike is among the smartest and most entertaining people on the planet. He's done engineering, programming, training, tech support, tech writing, sales, ... and there are only a handful of people who can do any one of those jobs as well as he did. He also has a wonderful sense of play and humor.

To start the class, Mike showed us how to write a program to turn the lights on the device on and off. First we turned them all on, then all off. Then we lit them in sequence, in pairs, and in reverse order. Since it was close to the holidays (and because we wanted to demonstrate our random number generator), he suggested we flash them randomly, like the lights on a Christmas tree.

That was when I unwittingly started channeling Feynman.

I asked innocently, "What does random mean?" Which sparked a rather animated discussion: one customer suggested that each light should turn on and off the same number of times as every other one. "If we flash the first light 3 times, then the second one 3 times, and so on, is that random?" We agreed there's something more to randomness, but after a few minutes we still hadn't satisfied ourselves with a working definition. Seizing what to this day has still been my only opportunity to use the math I'd learned in graduate school, I explained that a sequence is random if no part of it "looks like" any other part, and that we can actually measure randomness with a function called an autocorrelation. (If you follow the link, don't let the fancy math symbols fool you: it's not nearly that complicated. You just write the sequence, then write it again starting with the second number. Then you multiply the pairs of numbers together and take their average. Repeat the process starting with the third number, and then the fourth, and so on, shifting it by one more number each time. The lower the averages are, the "more random" the sequence.)

That's when Mike told us that our devices actually had two random number generators. The first is your ordinary, run-of-the-mill random number generator. The second starts with an "ordinary" random number and then encrypts it, the idea being that the encryption makes it "more random." But we couldn't verify the theory because no one knew how to test it. Until now. I ran back to my desk during an aptly timed break and returned shortly with two graphs. And, indeed, the encrypted random number generator produced an autocorrelation with averages that were far lower than the "normal" generator. Except for a single point on the graph, which spiked far too high. Hmm.... That can't be right.

What's that? Mike asked me.

I ran it several times, I answered, and the spike is always there. That's a bug in our code.

Really? Where?

I have no idea. But I'll let you know before the end of the class.

Sure enough, after a bit of digging, I found a variable in one of the encryption routines that hadn't been initialized properly. Instead of starting off at 0, it was left with whatever value happened to be in its particular location in memory when the program ran. Mike asked me what effect the bug would have on the operation of the device. I told him that, since the routine ran only when a user logged in, and the variable could hold 256 possible values, then one time in 256 you'd type the correct password and be denied access.

Mike told me that, over the course of a decade, he was absolutely certain it had happened to him twice.

I promised that it would never happen again.

Sunday, October 9, 2011

Stealth Education

A post stolen from one of my comments on this discussion from a LinkedIn group called The Math Connection.

My kids and I play games all the time. Not the formal, "official" kind, but little impromptu ones that present themselves throughout the day. We try to make words from the letters on license plates. We make up new lyrics to songs. We may very well be responsible for the Worst. Puns. Ever.

 We play "what if" all the time, which leads to fascinating discussions!

  • What if nobody ever died?"

We talked about what it might be like to get older and older, and whether our bodies would age.We talked about all the things we could learn if our lives lasted forever. We even wondered if people would ever learn to get along peacefully, knowing they'd have to live with each other forever. And what would we do when the world filled up with people?

  • What if ice were heavier than water?

We talked about lakes freezing from the bottom up, instead of from the top down, and how fish and the other plants and animals would need to adapt to survive freezing. We talked about ice cubes sitting at the bottom of a glass. We talked about carrying ice from place to place if it were much heavier than water, which is already really heavy.

We ask silly questions.

  • How did Mommy and I know your name when you were born? Maybe we were wrong and your name is really Sandy.
  • Aren't we lucky that the family dog understands English? What if he only understood German?

We ask questions about the way the world works.

  • Why do we ask you to clean up your toys?

We talked about safety. We talked about the importance (and convenience!) of being able to find things when you want or need them. We talked a little about inventory, and how it's hard to know what you have if it's disorganized.

  • Why does it cost more money to have a mortgage than to just pay for a house, and why is it worth it?

We talked about how expensive houses are, compared to salaries. We talked about investing, and about the time value of money. We talked about whether they'd pay a little extra for a toy if it meant they could have it sooner.

We play all sorts of math games.

One of us will pick a number and the others will try to guess it. We'll estimate the number of cars that travel on a highway in a day, or the amount of water we drink in a year. We figure out how long it will take to save up for a new toy.

My wife and I share the belief that learning is—and should be—fun, and our kids have never known differently. To them, learning is just another game.

One day I was trying to show them that they can multiply in their heads. 3 × 1 was easy, as was 3 × 5 when they remembered they have 5 fingers on each hand and 5 toes on each foot. But 3 × 100 baffled them. So I asked, "What's 3 times a hot dog?" They answered, "3 hot dogs!" Then I tried, "What's 3 times a giraffe?" Getting the hang of it, they yelled, "3 giraffes!" "Right. What's 3 times your sister?" Silence for a moment, then, "A big pain in the neck."

Saturday, January 22, 2011

Ubarn Leendgs, Selpling, and Why Yuo’ll Bleivee Antyhnig

This has been going around the Internet:

AOCDRNDICG TO RSCHEEARCH AT CMABRIGDE UINERVTISY, IT DSENO'T MTAETR WAHT OERDR THE LTTERES IN A WROD ARE, THE OLNY IPROAMTNT TIHNG IS TAHT THE FRSIT AND LSAT LTTEER BE IN THE RGHIT PCLAE. TIHS IS BCUSEAE THE HUAMN MNID DEOS NOT RAED ERVEY LTETER BY ISTLEF, BUT THE WROD AS A WLOHE. IF YOU CAN RAED TIHS, PSOT IT TO YUOR WLAL.... OLNY 55% OF PLEPOE CAN.

After looking at the words more carefully, it started to dawn on me that something wasn't quite right. Here's my initial response to the person who posted the fascinating tidbit:

Vrey cevelr, but lkie the mairtjoy of uabrn leendgs, tllaoty irconcert. It semes to be ptetry esay wvnheeer the wrods are sroht, or wehn you cosohe the "ionccerrt" oderr of toshe ltreets emertlexy clefaurly. But as you can see, all it teaks is a few leongr wrods, or a lses convirted onderirg, and it bemoecs fartsnurtig and ducliffit to utsandnerd.

Like so many of the "facts" we find on the Internet, this one simply isn't true. Anyone who wants to "prove" an idea can invent studies and statistics, and it's usually not too difficult to create a supporting example or two. The time invested in the hoax pays off when it goes "viral" because people who find it interesting can spread the misinformation immediately and virtually effortlessly. My counter-example took a bit of work, and I'm not completely sure I caught all the typos, but I'm still snickering at fartsnurtig, ducliffit, and utsandnerd.

I won't go into all of the telltale signs of a hoax, but two glaring give-aways are a very vague citation of a reputable authority (Cambridge University, here) and an amazing statistic that makes you feel special or superior but simply doesn't make sense if you think about it:

Wait: if the oerdr of the ltteres doens't mtater, then why can olny 55% of plepoe raed it? Does taht maen the oethr 45% are illeritate? Or is it poorf that 87.6% of all statistics are mdae up on the sopt?

One of my favorite quotations of late is David Comins' observation that "People will accept your idea much more readily if you tell them Benjamin Franklin said it first."  It's even more true if you butter them up and they trust you.

This is one of the simplest forms of social engineering: a technique for gaining control of something by cajoling or fooling the people responsible for it. Social engineering is disturbingly effective; it's behind phishing scams, identity thefts, credit card frauds, and corporate information leaks. We're bombarded every day by so much "information" that we can't possibly verify it all... and in most cases there's no reason to do so because it doesn't matter very much. But it's a good habit to "filter" the things you read or hear by asking yourself two questions:

  1. Does this make sense?
  2. What does the "informer" stand to gain if you accept the information as fact?

I almost closed this note by telling you that social engineering costs $3 billion in the US alone, and that 45% of corporate losses are due to some form of social engineering. But that wouldn't have been fair because you might have believed me, and I just made up those statistics. So, pelase, keep yuor eeys and yuor mnid oepn!

And remember: "Don't believe everything you read on the Internet." – Abraham Lincoln

Saturday, April 3, 2010

Never Bored of Education

Originally posted April 4, 2010

Here in our state, the latest crisis is our education budget. In a nutshell, we've been spending more money than we have, and the governor's solution involves significant cuts to the state funding our public schools receive. By significant, I mean that my own district is now $4M short of funding its $55M budget for the 2010-11 school year.

It's a real problem, and our Board of Education has given us the choice of eliminating 29 teaching positions and 30 paraprofessionals, most of our sports programs, almost all capital improvements, and various other cuts; or raising property taxes to the tune of about $200 for the average resident.

But that's not what I'm writing about.

To me, the most incredible, counterproductive, and debilitating factor is that, faced with a community crisis, each of the stakeholders has become secretive, defensive, and self-righteous, rather than working together to find a viable solution. I can't remember the last time I witnessed this much finger-pointing and slinging of empty statistics¹.

I've unwittingly acquired a very personal understanding of just how broken our system is. It all started with the introduction of our Everyday Math program into our elementary schools....

The Everyday Mathematics program was developed by researchers at the University of Chicago with the intent to help young students see that math is all around them, that they already understand more math than they realize, and that math can be both creative and personal. The program is also designed to teach kids that they can understand math on a visceral level: math is far more than a set of rules that must be followed precisely, and there are many ways to go about solving a problem. Being an engineer who loves both teaching and math, I happen to think Everyday Math could be the best thing that's happened to math in the way of public relations since Bing Bang Buzz. It could be.

But when the publisher's representative—who had been a principal in our own school district—presented the program to a room full of parents, it was as if a chill fog had descended on the room. Over a hundred pairs of eyes began to glaze over, hands were raised, and timid voices asked, "Does this mean we learned it wrong?" "Why did it change?" "How can I learn this to help my kids?"

Having taught math to adults myself, this response didn't surprise me. The representative tried to be reassuring, as I'm certain she'd done many, many times before. And, ever unable to stop myself from trying to help when I should probably just shut up, I prompted her:

"Can you tell us why this program is better?"

"The researchers at the University of Chicago studied this a lot and found that this is the best way to teach math."

"I know that, and I agree. But what is it about it that makes it better?"

"Well, a lot of very smart people put a lot of thought into it, and they developed this program as a result."

That's when I felt the room get smaller, and the air get thicker, and the whole system come crashing down. And I got scared, because everyone else acted as if that was the right answer! The representative, the principals, the supervisors ... everyone! Could I possibly have been the only one thinking, "If the publisher's representative can't articulate the program's value, then how will our teachers get it? And if the teachers—who were presented with the program only about a month before school started—didn't get it, then how deep a break with reality would it take to even hope that they would be able to teach it to our kids, who can smell fear-of-math from across the playground?

After the presentation, I approached the representative, our principal, and our math/science supervisor. I told them that I've had experience teaching, and that I'm a hopeless math geek. I explained what I'd observed, why I thought Everyday Math was doomed to fail if we continued the way we'd started, and I offered whatever help they could use: I'd be happy to work with the teachers and parents to help them understand the program, and to figure out how to teach it to the kids effectively. They agreed that it was going to be a struggle, thanked me profusely, and took my contact information.

Several months later, with the school year in full swing, you'd think the Everyday Math program was the Source of All Things Evil. The parents hate it. The teachers are frustrated with it. And instead of enjoying a new level of understanding, the kids now have to learn—by rote—not just one, but four different ways to solve every problem, none of which makes sense to them.

So I wrote an email to our math/science supervisor. Reminded her of my offer earlier in the year. Suggested again that I'd be happy to work with the parents and teachers, or to help in whatever way she thinks would be most effective. She replied and politely suggested I join our District Technology Committee.

So I wrote to our technology supervisor, again explaining my background and offering to help with his committee, in any way he thought would be most useful. He replied a few days later, saying I'd be welcomed on his committee, which met on Thursday at 3:15. Have I mentioned that I'm lucky enough to still have a full-time job?

Fast forward to our Board of Education budgeting meeting. The one that had parents complaining that our taxes are too high and the teachers' benefits are outrageously rich. The one that had teachers complaining that we have too many administrators, and that they're overpaid. The one that had the administrators explaining their budgeting decisions and offering statistics to defend them, and to show how much better we are than other districts. The one that left most of us with a sense that our children might have more wisdom and maturity than we who are supposed to be educating them.

I think I made enemies of some of our supervisors at that meeting, because I approached our superintendent, privately, after the meeting and told her this story. I asked her, "What's the message here?" I also suggested that, instead of posting budgets and statistics on the BoE web site, she consider asking the parents for help, and providing avenues for us to do so. I found myself asking her to "please make it easier for us to help you." You'd think from her reaction that, in 37 years, no one had ever done that before. Ouch.

On another note, I later approached the principal of our high school and told him that our babysitter, whose name he recognized, had graduated from his school and is now enrolled in a community college. And that my daughter, who is in elementary school, is helping her with her English because her assignments were returned without corrections. To his credit, he immediately asked if I'd volunteer to tutor, and I agreed enthusiastically.

Unfortunately, the tutoring sessions are typically held at noon on weekdays. That works for my wife, who also volunteered, but not for me. I'm hoping to find an email in my inbox when Spring Break is over, with an alternative. I'll let you know².


¹ How to lie (or at least stretch the truth) with statistics:

  • CLAIM: The state is cutting 5% of our funding.

    REALITY: The state is cutting an amount equal to 5% of our total budget, not 5% of the funds we receive from the state. This equates to 10% of our state funding.

  • CLAIM: The governor is cutting only our surplus.

    REALITY: In anticipation of this year's cuts, we raised additional money and cut spending last year. This year's budget depended on that money to offset our loss of state funding; it's not "free" or "extra" money that we can afford to lose.

  • CLAIM: According to our local government, if it weren't for the budget cuts, our property taxes would have gone from 5.5% in 2008 to 2.7% in 2010--in other words, they'd be cut by almost 50%!

    REALITY: It's true that we'd be paying about $400 less, but that's about 4%, not 50%. The rest of our "savings" are due to the town's reassessment of its properties at twice their previous value.

  • CLAIM: According to the latest Comparative Spending report from the state Dept. of Education, our district's administrative costs are only 6th out of 70, ranked lowest to highest.

    REALITY: We have 7 supervisors who do not teach, but the DoE calculations consider them to be teachers, not administrators. Recalculating with the supervisors in the administrators' group puts us in 40th place.

  • CLAIM: Our superintendent and two of her administrators are taking a voluntary pay freeze to help offset administrative costs.

    REALITY: Our superintendent's salary is $205k; the assistant superintendent's is $160k. Our highest paid teacher earns $87k and the average teacher's salary is $55k.

  • CLAIM: As the highest-paid superintendent in the state, ours is grossly overpaid.

    REALITY: Our superintendent has 37 years of experience, 15 of which are in our own district. I've seen no information about what she does for our district, or how much she saves or costs us each year. How can anyone make a judgment without this information?

² Nope. Never happened.

Sunday, February 21, 2010

Don't Believe Everything You Read... and Follow Instructions

Originally posted February 21, 2010

Through a series of events that would have made Rube Goldberg's head spin like the face of a Rubik's Cube¹, the company I [used to] work for recently acquired a medium-sized manufacturing facility in a nearby state. It didn't take long for the rumor mill to start churning, and speculation reached a peak while the entire management team was attending a several-day party site visit.

I overheard some coworkers discussing a copy of a newspaper clipping that had been left on the table in the kitchen. The article said the entire manufacturing facility would be relocated to a currently unoccupied building less than a mile from our office. It even quoted an "anonymous executive" who, given the particular phrasing, could only be my boss.

This would be a good time to mention that I emailed a copy of the article to one of our VPs, someone who's known me for over 10 years. I included the explicit instructions DO NOT FORWARD.

The newspaper story notwithstanding, there was no reason to move the manufacturing facility, which had been family-owned and employs hundreds of people in the area, several hundred miles away and across state lines. The relocation itself would be terribly costly, and many skilled and experienced personnel would be lost in the process. It just wouldn't make sense.

I learned from this that it's possible to interpret "DO NOT FORWARD" to mean "show this immediately to our Marketing Director," who, of course, lost no time in grabbing a phone to call the newspaper to demand a retraction. Halfway through dialing, however, she realized it would be prudent to verify the story before taking action.²

Back at the office we were discussing the article. I explained why the relocation wouldn't make sense, and that I was sure it wasn't going to happen. There was some resistance from my coworkers. After all, there it was. In print. In a newspaper. "How can you be so sure?" they asked. But my reply left no room for doubt: "Because I wrote it before I left for work this morning."

I wonder where (or if) I'd be working today if that phone call had gone through.


¹This may very well be the worst imagery I've ever used. Ever. We're talking Bulwer-Lytton quality, folks.

²Actually, as our Marketing Director told me later, her exact thought was, "This came from Adam? I'd better check it out for myself."