13 August 2012

A bit more about the library

Nashville hack day happened Saturday and it was awesome. Click the link—every single talk was great, and that page has slides, links, source code, etc. for all of them.

Mine was on sorting and searching at the library.

The talk starts out talking about what happens if you take a book off the library shelves and put it back in the wrong place. When I wrote it, I got curious, so sent email to the library, asking:

Hi, I have a few questions about the library system.

  1. How many books are in the library system?
  2. Do you ever take a full inventory of the library, scanning every book on the shelves?
  3. If not, is there any other way to know if a book is missing? (that is, the catalog shows it as Available but it's not actually on the shelves in the right place)
  4. If you do track missing books, how many are missing right now? How long does it usually take for them to turn up?

I'm not planning a book heist. :) I'm preparing a talk about information technology and libraries for a local event for software engineers.

Engineers are always interested in “failure modes” -- that is, what happens when something goes wrong.

I didn’t get the response in time to change the talk, but the library sent me email this morning with these answers:

  1. There are 1,629,308 items in the collection.
  2. No, we do not do a complete inventory of our entire collection.
  3. We do monthly weeding (de-selection) reports for items that haven't circulated in 1-2 years and that usually catches most missing items. We cover almost the entire collection within one year. However, we also will do a system-wide ILS report and change items automatically to missing status in the computer that haven't circulated in branches in a very long time. We also do this for items stuck in transit mode between locations for a long time.
  4. We do not track missing items at a level that will provide us with statistics like return rate. Anecdotally, however, it is rare that missing items are located again. They are usually missing because of theft.

(I’ll just note that the way they actually track missing items means they wouldn’t detect items that are only misshelved for a month or two. There might be a lot of them. I find two or three every week.)

Anyway, the talk was picked up on Reddit programming and got some wonderful comments. My favorites:

  • “My high school did a volunteer day where we took our entire class year and spent an hour in a class learning how they sort the library books, then sent us each to a section to go through, find misplaced books and put them back in order. It took 2-300 of us ~5 hours to sort all of the library.” –Kimano

  • “This posting reminds of when I visited a warehouse that had automated storage and retrieval of items from the warehouse.

    “One of the cool things that had to happen periodically was essentially the real-world equivalent of defragmenting a hard disk. If you think a hard disk is slow, imagine how slow it is to physically move pallets and cartons!” —grandzooby

  • “The reason we can insert books in a shelf is that there are some gaps distributed between books, and insertion shifts a couple books around to make space. Insertion sort is O(n log n) is a fun research paper that describes a similar way to organize data in arrays, with enough bogus elements (gaps) for insertion to be logarithmic time, but not so many that binary search is super-logarithmic.” —phkuong

And several folks linked me to ShelvAR, a super-cool augmented reality app for keeping library books in order. (Incidentally, those guys seriously need to cheat to get higher apparent performance!)

Hack day was so great that I can’t wait to do another one.

01 May 2012

Why I am not a teacher

(This is in response to Why CS graduates don’t teach which didn’t sound quite right to me.)


Why don’t I quit my job and become a teacher? I’ve thought about it, but


  • Money.

  • It seems like public school teachers have to spend a lot of time just fighting active sabotage—whether it’s the legislature, school boards, textbook publishers, administrators, parents, students, other teachers, etc. In a lot of these stories everyone comes off badly. I hate politics.

  • I’m used to being empowered to make whatever changes are necessary so that I can do my job. Teachers can’t even begin to do that. They don’t control the curriculum, class sizes, external interruptions, disruptive students, prerequisites, and most importantly they have no control over the goal (test scores). It sounds awful.

  • There’s a major “classroom management” component of teaching that I would find stressful and probably unrewarding. I don’t expect I’d be any good at it either. (Money aside, this is the biggest sticking point. I probably just can’t do the work.)

  • Here in Tennessee, to teach in a public school, I would have to enroll in education courses. This isn’t a huge deal, but it’s basically a lot of unpaid overtime and I’ve never heard anybody say anything nice about that kind of part-time program. Maybe I’d be pleasantly surprised. (Go on, tell me I’d be pleasantly surprised.)


Bottom line, being a programmer is easy: it’s mostly just programming. I love teaching more than I love programming. If being a teacher were mostly about teaching, I might have to give it a shot. I wish it was. But it’s just not.


…Is it? Go on, tell me it is.

08 April 2012

Friar Tuck’s theorem

“Well, then, good fellow, holy father, or whatever thou art,” quoth Robin, “I would know whether this same Friar is to be found upon this side of the river or the other.”

“Truly, the river hath no side but the other,” said the Friar.

“How dost thou prove that?” asked Robin.

“Why, thus;” said the Friar, noting the points upon his fingers. “The other side of the river is the other, thou grantest?”

“Yea, truly.”

“Yet the other side is but one side, thou dost mark?”

“No man could gainsay that,” said Robin.

“Then if the other side is one side, this side is the other side. But the other side is the other side, therefore both sides of the river are the other side. Q. E. D.”

“’T is well and pleasantly argued,” quoth Robin; “yet I am still in the dark...”


—from The Merry Adventures of Robin Hood by Howard Pyle

02 April 2012

Understanding a place

Involuntary blockquote:


I’m here, talking to you about talking to rocks, partly because a volcano blew out sideways, and fifteen years later, I turned to look at another volcano I’d known my whole life and saw the same lateral eruption rip it apart thousands of years in the past. “What happened to me,” St. Helens said, “is exactly what happened to them. Your San Francisco Peaks were a peak before that day. Oh, and it would’ve been a really bad idea to stand where you’re standing now, what with the lahar and all.”

I just stood there with my jaw agape, looking from the lahar deposit to the gash in my beloved Peaks, sputtering the occasional overwhelmed expletive as the thrill of realization and the enormity of what had happened pinned me to ground that was perfectly safe for the geologic moment.

This is what I want to give you, my dear readers: the indescribable euphoria that comes from understanding a place for the very first time.


—Dana Hunter (@dhunterauthor), introducing her new blog, Rosetta Stones.

21 March 2012

FBI

Andrew Weissmann, the top lawyer at the FBI, says the Supreme Court made a distinction about the Fourth Amendment, which guards against unreasonable searches and seizures, ruling that computers that follow suspects are much more intrusive than people doing the same thing.


“The court essentially is saying that you have an expectation of privacy even though if it was done by humans there would be no violation,” Weissmann says. “But because it's done by machines, it is.”


I guess I should read more about this decision. I mean, on the one hand, it seems to me there’s a pretty obvious practical difference that is going to affect the number of people the government ends up tracking twenty years down the road (in an “all of them” vs. “not so very many of them” sort of way). Not to put too fine a point on it, but if there weren’t a real difference, the FBI wouldn’t be bitching about the decision. On the other hand, yeah, the Fourth Amendment doesn’t seem to be drawing that kind of distinction. So hmmm.


“And the problem with that is that a search warrant requires probable cause to be shown and many of these techniques are things that you use in order to establish probable cause,” Weissmann says. “If you require probable cause for every technique, then you are making it very very hard for law enforcement.”


I am so glad I don’t have the kind of job that would be a lot easier if only we didn’t have a Bill of Rights.


Source: NPR: FBI Still Struggling With Supreme Court’s GPS Ruling

16 March 2012

Not censorship


I am in no way calling for censorship. Rush is entitled to all the free speech he wants, but we—as women, as members of marginalized or oppressed groups, and as Americans—are equally entitled to use our free speech and all the tools of the democratic process to get him off the air.



Gloria Feldt, calling for the FCC to take Rush Limbaugh off the air.


I have an honest question here. How exactly would that not be censorship?


Unless I’m missing something, I think the most charitable way of reading this must be to ignore these two sentences entirely, take as read that Feldt knows she is calling for a kind of censorship, and then evaluate the case for censorship on the merits. But the case is ludicrous too. Banning offensive speech? We’re going to build our future on that cliff?

27 February 2012

Necessity

New favorite sentence of Wikipedia: “Slaughtering and eating their horses, they melted down stirrups, spurs, horseshoes and other metal items, and fashioned a bellows from deerhide to make a fire hot enough to forge tools and nails.” From Álvar Núñez Cabeza de Vaca, easily among the most incredible true stories I have ever heard.

25 February 2012

They had to make their own fun

Every other month, we make do without TV and computer games. The following unlikely thing occurred without any further prompting or help from any grownup. Evidence that our sinister parental plan might be working.



23 January 2012

Courage now


A.


What is virtue?


Perhaps the question is wrong, but suppose you were to characterize the habits and behavior you wish everyone would cultivate. What would make your list?


There are many considered answers. For example, the ancient Greeks listed prudence, justice, fortitude, and temperance. Catholic catechism takes those and adds faith, hope, and love. The YMCA promotes caring, honesty, respect, and responsibility. A friend of mine once worked at a nonprofit (the one that runs the Hope and Healing Center in Memphis) that had its own list of virtues (one was gentleness, which gets a big thumbs-up from me). We got to talking about it and I remember asking if she thought fortitude was a virtue. She said no.


B.


You can read the transcript of “Petty Tyrant” here. Or you can listen to it online for free. It’s the story of Steve Raucci, a school district maintenance manager and small-time terrorist in Schenectady, NY. If you crossed him, Raucci would get you fired and brag about it to his buddies in the maintenance department. Or he would vandalize your home and your car with spray paint. He would put a bomb on your doorstep. It went on for years, eight years at least.


Finally a couple went to the district attorney. Raucci was convicted on 18 felony counts. He got 23 years in prison.


Why didn’t someone stop him sooner?


Everyone was afraid of him.



Carl Strock You’d like to think you’d be different. You’d like to think that I would have done something different if I had been in that position. I would’ve stood up. I would have been righteous. But you don’t know until you’re in the position. You can’t be sure.


Sarah Koenig Some of the people who worked for Steve Raucci also thought they’d be different. They were good people. They knew right from wrong. But they tell me, “You had to be in it to understand.” Ellen Frederick said it was almost like being in a cult, being brainwashed.



Hmm. Koenig doesn’t pursue the brainwashing angle; she changes the subject. When she comes back to this aspect of the thing a few minutes later, it’s like this:



Sarah Koenig … When you see pictures of Raucci from the trial sitting there quietly at the defendant’s table, it's hard to imagine that he caused this mayhem all by himself. But of course he didn’t. He was surrounded above and below by people who looked the other way.


Even Carl Strock, the newspaper columnist, told me regretfully that he too had gotten complaints about Steve Raucci from maintenance workers in the past, but didn’t really follow up. And it’s understandable why. Their stories seemed too small and bureaucratic, not something the rest of us would be interested in.



In other words, I see what you’re saying. And you’re not off the hook.


A.


From catechism:



Fortitude is the moral virtue that ensures firmness in difficulties and constancy in the pursuit of the good. It strengthens the resolve to resist temptations and to overcome obstacles in the moral life. The virtue of fortitude enables one to conquer fear, even fear of death, and to face trials and persecutions. It disposes one even to renounce and sacrifice his life in defense of a just cause.



It is possible for good ideas to go out of style. They don’t seem particularly useful in certain places at certain times.


When I consider the future, and what I’ll need for it, I think the time for courage is coming.

Why do we indent code?

Apparently one of the rules of Stack Overflow is that if enough people read and like a post, it gets deleted. Here is one of mine from two years ago. For a time, it was my top-voted answer.


Q: The firm where I work has programmers who still don't seem to understand the importance of indentation and write all the code aligned to left margin. What arguments can I put to convince them of the importance of indentation? —Phulore R, 16 Feb 2010


A: Clearly we’ve all internalized this so much that no one can remember why we do it. At least, none of the other answers so far. ;)


Why is indentation so useful? Because control flow jumps around in a program, and indentation helps you find where it's going. For example:


if (k == 0) {
if (!foo.hasKey(bar))
foo.put(bar, 1);
if (order.held())
order.release();
else
order.markUpdated();
}
Notifications n = order.getNotifications();
if (n != null)
n.sendUpdate();

On the first line, what if k isn't zero? Where do we jump to?


With indented code, you can just visually scan down to the next bit of code directly underneath the if:


if (k == 0) {
    if (!foo.hasKey(bar))
        foo.put(bar, 1);
    if (order.held())
        order.release();
    else
        order.markUpdated();
} //<---- here!
Notifications n = order.getNotifications();
if (n != null)
    n.sendUpdate();

Similarly, at the end of an if block, indentation helps you visually skip over the else block. And at the end of a loop, your eyes can easily zip back up to the top.


Once you're used to it, you can easily follow a break or continue.


Persuading people of anything is hit-or-miss no matter how right you are. :) It seems like it would be best to try to convince one person at a time, in a totally non-confrontational way, using respectful language and real-world examples.


I hope you can convince your colleagues to use indentation, but if not, remember they are human beings doing what works best for them. And remember they’re your teammates. Treat them humanely. Write code they can work with. If you like, spin yourself a little emacs mode that auto-indents the file when you open it and un-indents it when you save it. It’ll be fun, and you’ll have a story to tell. Life is too short to spend it bickering over stuff like this.


28 November 2011

Opposing thoughts on teaching

Some thoughts on teaching by Bret Victor.


I used to think that to be a good manager of engineers, you first had to be a good engineer. I could name several particular managers in support of that theory, but that’s anecdotal evidence, right? And believe it or not I have a few counterexamples too. Now I think that management is many things, and there is more than one way to be great.


Bret says that to be a good teacher of mathematics, you must first be a good mathematician, scientist, or engineer. I think the claim is way too strong, and it’s a good thing, too, because we need many times more math teachers than there are mathematicians, scientists, and engineers who want to teach. It’s easy to suspect that Bret, who has an MS in electrical engineering, is harboring a romantic notion here. The structure of the essay isn’t encouraging—five anecdotes followed by a lot of undirected personal incredulity and vague analogies.


Look, if I have to choose between a teacher who “lives math” and one who can tell when a student is perplexed and find another way to explain it, I’ll pick the latter every time.


Of course you have to actually understand the material quite well to be a good teacher. Not just well enough to pass a test on it! You have to know it well enough to know what is actually interesting about it, to invent good demonstrations, to turn it around when you need to explain it a different way, to inspire kids to turn it around in their own minds, to recognize when a student gets it. But you don’t just have to know math well enough to do those things. You also have to actually do those things.


Many engineers are horrible teachers. Many math teachers who are obsessed with teaching, and not math so much, are great. Teaching is many things.


21 November 2011

Khan Academy

Before reading this post, go to khanacademy.org and click on “Practice”. Play around with it for a while. Neat, huh?


I turned J loose on it for a few hours. (J is eight years old, homeschooled, and way ahead of his age cohort in math.) He was absorbed for a surprisingly long time, he said it was “kind of fun”, and he learned a few things. Not bad!


A few points to curb your enthusiasm:


  • Khan Academy started out as a collection of videos. Now it’s a game with available video tutorials.


    I watched my eight-year-old open a video, watch enough of it to guess the answers to the current problem set, then close it, cutting Sal off in mid-sentence. “And the interesting thing about—” Click. This is on day one. It’s very simple: the goal here is to get points and fill out the map.

  • The curriculum is the U.S. math curriculum. To whatever extent the curriculum is the problem, Khan Academy isn’t the solution.

  • The system punishes mistakes. That’s bad teaching already, but it punishes mistakes disproportionately to the point of being inhumane. To clear a topic, you have to answer five questions in a row correctly. If you get the fifth one wrong, you start over—five more questions. A sign error can cost you fifteen minutes of your life. It’s hard to believe this system got into production. No human teacher would be so cruel.

  • Not all of the problem sets are good. As of this writing, the problem set on shifting and reflecting functions is about as bogus as standardized testing gets.

  • The system awards badges for things like answering 75 problems in a row on the same topic, without any mistakes. Gross! I’m not sure why Khan Academy needs badges at all, but if it does, they should reward behavior that the site wants to encourage, right? Don’t we already discriminate enough against non-OCD-sufferers in math education?

  • Putting this work in the commons is the right thing to do, but I think it’s a long shot to hope that it’ll flourish there. This kind of courseware is hard to develop; I imagine it will be hard to modify and reuse. I hope I’m wrong.


All this may seem kind of devastating, but I dunno. Some of my criticisms are easily addressed. Some are just points of disagreement. On the whole it’s good for a lot of people to be attacking the problem of education from different angles. I don’t think Sal Khan would dispute that there’s a long way to go.


I don’t think I’ll be using Khan Academy with my kids. So far J and his younger sister are motivated by innate curiosity. I think we should ride that current as far as it takes us. For now, maps and points and badges, like grades and tests, are just a distraction.

27 October 2011

Nashville

I didn’t know there was an Occupy Nashville, but there is. Protesters have been camped out in the Legislative Plaza since October 7. There are dozens there around the clock. And if you’re homeless in Nashville it is totally the place to be now. :-\

Amazingly, the state is trying to ban this protest. Effective today, there is a new curfew. Nobody is allowed in the plaza at night. If you want to protest near the state capitol during the day, you must get a permit that costs $65 per day and get liability insurance coverage for $1 million, in case you break something.

On the plus side, the Tennessean is doing its job.

The latest: State imposes new curfew to evict Occupy Nashville protesters

Earlier: Occupy Nashville protesters may be ousted from Legislative Plaza

To me it doesn’t seem like “there’s a bunch of people out there who disagree with my politics, and homeless people” is a good rationale for making emergency rules changes and starting curfews. I sure hope this kind of action to ban a specific protest is unconstitutional.

Right now I have the feeling you get when you’re being trolled. You know the right response is to keep your head and be an adult. You know yelling will not help. Nothing will help, except to walk away.

Only the people trolling me are my government. …Actually I feel like that a lot lately.

Oakland

what it looked like to be there (warning: contains loud swearing and people acting like they’re in a movie)

NYT blog

Well, firing any sort of weapon at peaceful protestors is just wrong. People who would do that or order it should not be cops, because cops should have a level head and a sense of what amount of force is appropriate.


The Oakland PD says some individual protestors were throwing bottles and bricks. That seems likely enough—I don’t mean to give the impression I think all the protestors were model citizens on their best behavior—but it’s also no excuse. Individual drunks and troublemakers can be arrested individually. It can be done without weapons drawn. This may not be conventional wisdom among cops anymore, but to me it’s just common sense.


Ordinary cops, behaving the way cops behave across the country, turned this nonevent into a bizarre police-only riot. Two cops were hurt. Several citizens were hurt. They’re lucky it wasn’t much worse. What’s next for Oakland is up to Oakland. But the conventional wisdom has got to change.

28 September 2011

Ozymandias

“Because limited written historical sources have survived, much of what we know about the Parthians”—a powerful empire that ruled Persia and neighboring countries for five hundred years, from the collapse of Alexander's empire to the heydey of Rome—“must be deduced from coins.”