In-Car Entertainment

My wife: “What states begin withD?”

My daughter, sneaking a peak at a pocket atlas: “None.”

My wife: “What about Delaware?”

My daughter: “Apparently this map doesn’t include Delaware.”

Splitting a File

Make no mistake: my coding fu remains quite weak. Still, something as simple as splitting a text file into smaller files based on a small string that sits on a line by itself shouldn’t be too hard of a problem. Well, the splitting isn’t that hard when someone hands you a Perl script. What’s hard is finding a way to split the files for yourself and also to have the files named after the string by which they were split.

What do I mean by this? I have a large text file, two of them actually, which are made up of over one hundred texts each. Each text begins with `–###–` and proceeds for some number of lines before the next `–###–` occurs.

I would like to split these larger files into their constituent parts and have each of those parts be contained in a file named, `###`. This shouldn’t be as hard as it is. I have tried:

split -p ‘^–[0-9][0-9][0-9]–‘ mytext.txt


csplit -k individuals.txt /–[0-9][0-9][0-9]–/

And that’s just to split the file. (Neither worked.) This Perl script did:


@arr = split(‘–[0-9][0-9][0-9]–‘);
for $c (@arr)
print FO $c;

But it simply labels the files by number, which loses their original identifying number.

Textual Analysis in Mac OS X

For those who use or access Macs, I just wanted to point out that videos of this year’s [WWDC sessions][wwdc2012] are up and they have a session on “Text and Linguistic Analysis.” All the sessions are at the URL below. I watched last year’s session on [latent semantic analysis][wwdc2011], which is also baked into the Mac OS, and it was quite good. You can watch the videos on-line or get them through iTunes to watch off-line, and they are also available as PDFs. (The site is worth checking out just to see how well it is designed.)


It turns out that [StackOverflow is not all that friendly](, or at least the subset that decided to close the question I had asked. (You’d think you could only close a question if you had either opened it or tried to answer it. Ah, Internet moderation, you are a beast that feeds the self-righteous.)

We Need More Science

In an article on Slate, Derek Lowe argues that [“We Don’t Need More Scientists—We Need Better Ones”][dl]. His provocative statement is in response to the current efforts to get more students to major in the fields of science, technology, engineering, and mathematics (aka STEM). His logic, based on his years as a chemist in the pharmaceutical industry, is that much of the grunt work that was formerly the purview of the middle and lower tiers of scientists here in the U.S.A. has been offloaded to India and China (and, one supposes, to various information technologies). There just isn’t that much work out there, he notes, and so what we need is not more scientists, but better ones, one who fit better into, as he describes it, “a high-wage country like the United States.”

In reality, Lowe ends up backtracking by the end of the essay, noting that he finds it “painful to think about children, all over the world, who might grow into great discoverers but will never have their chance. How many Ramanujans have spent their lives looking at the back of a water buffalo rather than flying through the higher reaches of mathematics? What have the rest of us missed out on as a result?” Such a sentiment flies in the face of “more better, less mediocre,” especially if you are pursuing a market logic, as Lowe seems to be doing.

In fact, to get better scientists, you need more of them. And what that means is that we need more science.


A nine-year-old girl in Scotland started blogging about her school lunches and she made the world a better place. [Wired has the story.][wired] Be prepared to have your heart warmed and to feel just a little bit better about darn near everything.

The lesson, for me, is to allow students to find something that interests them and then let them put everything they’ve got into it. Then my job as a teacher is to find ways to get them the knowledge they need. *Need* here is terribly important, because I don’t want it restricted to what the student thinks they need or even what the project needs. Students need more than that, and projects do, too. Usually teachers as more experienced learners, as well as knowing about developmental stages, can address both.

This kind of teaching, however, requires small class sizes and motivated individuals: teachers, students, parents, administrators.