Thanksgiving Science!

I’ve got a little formula that predicts how long it will take for our Thanksgiving turkey to cook. It works really well for our temperatures and preparation, but I’d like to make it a little more general so everyone else can use it, regardless of temperature. As a wise man once said, if it’s worth doing, it’s worth overdoing, unless you’re overcooking turkey.

Towards that end, and because this is a science blog, I would like to perform a hypothesis-generating experiment. If you’re willing to further science, please share some details about how you prepared your turkey, and how it turned out. Humanity will thank you. Turkeys will not. I will post the results when I can, and maybe we can try again next year for a full prediction.

Click here to share your turkey data.


Firetruck: In which I write and record my first song…

Ian asked me for a firetruck song tonight for bedtime songs. I thought maybe there might be some kind of melody hiding in the fire truck siren sound, so I started there and half-assed my way through a melody. After he went down, I thought I might have enough to make a “real” song. It only has one chord progression and melody, due to it being a kid’s song and the first song I’ve ever written, but I found a surprisingly good loop to match against, and it kind of came out as a ballad for firefighters from a kid’s perspective.

Like I said, be gentle, it’s supposed to be a little lame. And I’ve never recorded a song before either.

Here are the lyrics:’m releasing the recording and the lyrics as creative commons share-alike (

Data Processing with Python: Part 2

As I’ve said, I’ve been doing tons and tons of tabular data manipulation using Python in the past few years, and I’m sharing some of the patterns I’ve developed. Please look at Part 1 to see some of the more basic stuff, and review the rules of the road. Below the fold, we will be talking about filtering data by column and row and doing processing without loading the whole file into memory.

Continue reading

Data Processing with Python: Part 1

I’ve been doing tons and tons of tabular data manipulation using Python in the past few years, and it’s high time I shared some of the interesting patterns I’ve developed. I’m sure others have managed similar things, but I’m not about to do a literature search right now.

First, some rules of the road for dealing with data easily in Python:

  1. Read and write data using character-delimited text, like CSV or TSV. You can use Excel or others, but these tricks work best with text data. It also has the advantage of not having to load the entire file into memory at once. Very large files can be analyzed quickly line by line, if you can.
  2. Use the csv library from python:
    import csv
  3. Name your columns. Take a chance to save your sanity and use a line to give a name to each column. You’ll thank yourself later. Also, nearly all of these tricks rely on it.

Continue reading

How to fix the economy

  1. I’m not an economist, so this probably has errors in it.
  2. None of these ideas are mine. I’ll hunt down where I got them from as soon as I can. See citations where I put them in.

Businesses aren’t investing in jobs because they have no reason to. They sit on huge piles of cash and continue to make acceptable profits without adding any jobs. Astonishingly, we manage to be in a period when inflation is nil, but prices are still going up. You know what gets people investing in new things? Inflation. Mild-to-moderate inflation drives capital into investments because otherwise the value of that money decreases over time.[1]

How would someone in charge of, say, the Fed, manage to increase inflation? They start by buying debt from banks, which frees up cash in existing banks to make other loans. Home mortgages would be a great start. The Fed can easily start buying up underwater mortgages and forgive the principal above and beyond the current market value. This puts a floor on the housing market and stops the glut of foreclosures, which gives the construction industry something to do again.

I would also start buying up and forgiving student loans of unemployed college grads. This would put them in a position to take greater risks with their careers, either taking jobs that aren’t directly in their fields or giving them room to start up businesses of their own.

This would be hugely controversial, of course, but the Fed chairman is appointed so that he can make these calls. We need something decisive either way, so someone needs to bite the bullet.

But what about everyday prices? Increasing inflation means, in the short term, increases in prices of stuff in general. True, but with the hardest hit people getting loan forgiveness, their overall costs will decrease. Also, investment in new technologies generally decreases real prices even as apparent prices go up. Finally, inflation doesn’t actually impact the poor significantly because they have little savings. In an economy with inflation, wages tend to increase with inflation.

On the fiscal side, there needs to be a resolution to the structural deficit spending. Most of this comes from the Bush tax cuts. Letting them expire takes care of 1/3 of the problem. Another portion of the problem comes from health care costs in medicare and medicaid. These costs can be amortized over a larger population by combining medicare and medicaid into one pool and opening up that pool to everyone. Medicare and Medicaid take care of the most expensive patients in the country, so opening it up to the rest of us would only decrease the overall risk. [2]

Finally, social security can easily be addressed by increasing the witholding limit above 90k. This will put it on sound footing for the next 100 years, based on figures I’ve heard. [2]

  1. Krugman, Paul. Why Is Deflation Bad?
  2. Reich, Robert. What If Everyone Saw This Clip Of Robert Reich Exposing 7 GOP Lies?

Why Java’s Date isn’t deprecated, even though it might look like it

This shouldn’t be news at this point (JDK 1.5 was released 5 years ago), but in Java 5 Sun decided to deprecate large swaths of java.util.Date’s methods and constructors and introduce the Calendar class, which can handle locale-specific conversions and manipulations of the units of time we humans are used to seeing. This has created some confusion here and there about whether to represent datetimes as Dates or as Calendars, as it looks at a casual glance like Date has been more or less completely deprecated. It remains, however, as the preferred way of representing datetimes in Java. An explanation is after the jump.

Continue reading