Archive for September, 2007

Getting POST data from mod_perl2

September 27th, 2007 by daryl

I learned today after spinning my wheels a lot over the last few days that mod_perl2 under apache can parse POST data only once. I tried any number of ways to get at the POST data, but it was always empty. Finally, I came across something that mentioned that POST data could be parsed only once. The module I’ve been working on was running at the PerlLogHandler phase, which is after the request had already been parsed. So I could try all I wanted to re-parse the POST content, but I was parsing something that didn’t exist. When I attached the module to the earlier PerlHeaderParserHandler request phase (more info on this stuff here), I had access to the POST data. Of course, my grabbing the POST data in this phase makes it unavailable to other phases, which means that if a PHP file in the directory the module screws with tries to access the $_POST array, it’ll be empty and the script probably won’t behave as expected. This is ok for my purposes, as the module I’m writing is for logging data sent from a source that doesn’t expect a response. The point of my module is to get raw POST data and dump it in a log, so destroying the POST variables doesn’t hurt anything in my case.

The Apache2::Request module is designed to parse and cache request data for the duration of a request. Of course, if you don’t instantiate it until a late phase when the POST has already been destroyed (as I was doing), it’s not very helpful. The module also happens to be a minor pain to install, unlike most perl modules I’ve had to deal with.

Four games left

September 26th, 2007 by daryl

The Cubs have lost their last two outings against the Marlins, and I gather that the Reds, who they’ll play in their final three games, are considered a more formidable opponent. The Brewers toppled the Cards last night but lost tonight, making the contenders’ records as of tonight 83 and 75 (Cubs) and 81 and 77. If the Cubs lose all four of their remaining games, Milwaukee has to lose three of their four in order for the Cubs to win the division. I made a spreadsheet that tells me this.

In my long absence from baseball, I had forgotten just how a team could be a half game in front of or behind another. The reason seems to be that standings are calculated in such a way that teams who’ve played one or two more games than a team they’re being compared to can still be compared fairly. The calculation used for determining standings (I got this from here) is as follows:

(1/2) * ((WA - WB) + (LB - LA))

where:

WA Team A Wins
WB Team B Wins
LB Team B Losses
LA Team A Losses

I haven’t watched the Reds play recently, and I don’t know how good Griffey Jr. is these days (he was an up and coming star when I last watched baseball regularly), but I’m crossing my fingers that his injury puts a damper on their winning spirit. They’re 9 and 14 this month, and they lost 2 of 3 in a series against the Cubs last week. If Chicago loses tomorrow and fares as well against the Reds this weekend as they did last week, the Brewers have to win their remaining four to tie.

Go Cubbies

September 25th, 2007 by daryl

I’ve been following the Cubs pretty closely since I last wrote about baseball. At the time, they had just begun to start playing better after a lackluster first half of the season, and they’ve kept it up. Soriano, Ramirez, and Lee have been swinging big bats for the last couple of weeks, and Murton has had a few key dingers as well (and hasn’t gotten much recognition for them as far as I can tell). After making headlines by commanding $91 million for a 5-year contract a month or two ago, ace Zambrano has by and large done a poor job at the mound, but he came through this past key weekend to fan the first four batters he faced and to dominate through most of the game. And young outfielder Sam Fuld, pulled up from the minor leages (the Tennessee Smokies, in fact) just this month, has made a big defensive difference in a couple of games. What a thrill this ride must be for him.

It’s been an exciting few weeks as the Cubs have been running neck and neck with the Brewers for the NL Central title. They’re suddenly three games in the lead with only six to play. By my reckoning, if Milwaukee wins all six of their remaining games, the Cubbies can still lose two and clinch the title (and three to tie, which I guess would result in a two-team playoff). It’s been 99 years since the Cubs have won a World Series, and they haven’t been a good team in my living memory. To have them in the running for their division and just a few steps away from a Series opportunity makes me giddier than I can reasonably account for. Go, Cubbies!

Pees and Carrots

September 24th, 2007 by daryl

No, it’s not a misspelling. For a couple of weeks now, we’ve sent Lennie to bed without a pull-up. She had been waking up with a dry pull-up pretty regularly, and then we just ran out of them, so I started dressing her in her most absorbent undies for bed and hoping for the best. She’s had accidents only twice so far, and one of those was a small enough accident that the undies soaked up all the pee anyway. It’s been only in the last few months that we’ve had any consistent success at potty-training, so this is a pretty big deal. She’s been a fully self-guided daytime pottier for a month or two, and now she’s mostly a non-bed-wetter.

Insert inspiring and graceful transition here.

When he was about 5 months old, we tried to introduce some non-boobie-milk food to Finn, mashing up some banana. He was very interested, having been in the habit for a while of watching us intently while we ate and lunging with impressive force and accuracy (and often success) to grab our dinner plates and pull them toward him. He’s like a little savage at the dinner table. But he wasn’t quite ready for solid food yet, and he choked a little and we had the necessary heart attacks and put solidish food of for another month. Last week, I got out a carrot for him and held it for him to let him gnaw on it while I ate my dinner. He would grab it and jam it into his mouth with gusto. Then he’d shave at it for a minute with his two bottom teeth, pull it out suddenly, and give it a puzzled look and repeat the process. Yesterday, we tried giving him some rice cereal, and he choked again (I don’t remember Lennie having so much trouble, and we got her started earlier than we did him), but I later gave him some more carrot, and he did ok with it, probably because he seems to have managed mostly to shave little bits off and get them all over his face and chest.

Insert inspiring and graceful conclusion here.

Finn

September 13th, 2007 by daryl

Finn at six monthsWhen Lennie was very young, I’d take time every few months to write a bunch of things about what new things she was doing, almost always prefaced by something like “I’m a crappy dad for not doing a better job of documenting things.” It turns out that having a second kid makes you an even crappier dad, as I don’t believe I’ve written one word about Finn since I first announced his birth nearly six months ago. It’s been long enough that I don’t really even know how to begin.

He’s a healthy boy, by which I mean he seems to be of generally strong constitution (if you forget the bout with croup he had a couple of weeks ago) and that he’s something of a hoss. I don’t remember his exact weight right now, but he’s coming up on 22 pounds, which let’s just say breaks the curve. And yet he’s not grossly fat, like some heavy babies. He’s got big thick legs and hefty arms, but he’s skinnier through the middle than Lennie was at this age, I think.

He’s also a cheerful boy. From the beginning, he was always peaceful. We could actually put him down in his bouncy and he’d sit there happily for a while. Nowadays, he more often wants to be held, but we do get him down for naps on his own sometimes, and he’s pretty good for sitting up and playing on the floor with some toys for a few minutes at a time (which is new in the last week or two, this sitting up steadily on his own). If he catches you smiling at him, he’ll light up with a big grin of his own, and his laugh is a lot like Lennie’s was when she was first coming into her infant laugh. A couple of months ago, Dad emailed us a picture of me as a baby at about Finn’s then-age, and the resemblance was striking. So it’s safe to say that he’ll be a handsome devil.

He got his first two teeth at roughly the same time when he was around 4 months old. Lennie got her first tooth at about the same age, but hers was a weird side tooth, and his are the bottom two in front. And boy are they sharp. One of his favorite toys these days is a little wooden spoon that he applies to the teeth. I’m thinking of giving him a file and seeing just how sharp he can get them.

Finn’s best trick these days is doing push-ups. Like honest to goodness push-ups. We’ll put him on his tummy, and he splays his arms and legs out and gets full abdominal clearance, pushing his butt up in the air higher even than his head sometimes. He’ll hold this pose for a while and then go down and right back up. So steadfastly was he performing this exercise a week or two ago that he actually sheared off part of one of his big toenails.

Lennie adores him and is a great big sister. For example, we nearly drove off a couple of weeks ago without having remembered to fasten part of his seatbelt, and she cried out for us to stop. Sometimes she loves him almost too much, applying herself to him rather like the Steinbeck character who cuddles his puppy (or is it a bunny?) to death.

There’s more, and more, but this is what I can manage for now.