PenguinTV optimization

I’ve been going through the crufty and scary ptvDB.py looking for ways to improve performance. Armed with the trust profile and pstats modules, I cut polling time in half by removing redundant and unnecessary database hits.

I then got the idea of generating a print statement every time I hit the DB, so I can see exactly what the database is doing during regular operation.

The result is not always pretty:

Basic article read:

SELECT title, creator, link, description, feed_id, date FROM entries WHERE id=? (69443,) ok
SELECT id,entry_id,url,file,download_status,viewed,length,mimetype FROM media WHERE entry_id = ? (69443,) ok
SELECT read FROM entries WHERE id=? (69443,) ok

Ok that’s fine, we get the entry, any associated media, and then the read state.

What about an unread entry?
SELECT title, creator, link, description, feed_id, date FROM entries WHERE id=? (67523,) ok
SELECT id,entry_id,url,file,download_status,viewed,length,mimetype FROM media WHERE entry_id = ? (67523,) ok
SELECT read FROM entries WHERE id=? (67523,) ok
UPDATE entries SET read=? WHERE id=? (1, 67523) ok
UPDATE media SET viewed=? WHERE entry_id=? (1, 67523) ok
SELECT read FROM entries WHERE id=? (67523,) ok
SELECT id,entry_id,url,file,download_status,viewed,length,mimetype FROM media WHERE entry_id = ? (67523,) ok
SELECT title, creator, link, description, feed_id, date FROM entries WHERE id=? (67523,) ok
SELECT id,entry_id,url,file,download_status,viewed,length,mimetype FROM media WHERE entry_id = ? (67523,) ok
SELECT read FROM entries WHERE id=? (67523,) ok
SELECT feed_pointer,description FROM feeds WHERE id=? (233,) ok
SELECT id,title,fakedate FROM entries WHERE feed_id=? ORDER BY fakedate DESC (233,) ok
SELECT id FROM entries WHERE feed_id=? (233,) ok
SELECT feed_pointer FROM feeds WHERE id=? (233,) ok
SELECT pollfail FROM feeds WHERE id=? (233,) ok
SELECT feed_pointer FROM feeds WHERE id=? (233,) ok
SELECT read FROM entries WHERE feed_id=? (233,) ok
SELECT id FROM feeds WHERE feed_pointer=? (233,) ok

Oops. It’s whacking the database three times for the entry data, and updates the whole feed as well. Time to figure out what I’m doing wrong!

Where are the Granny Smith apples?

Char and I have been trying to find Granny Smith apples for a couple weeks now, and no store we’ve been to has them. We’ve looked in Shaw’s, Whole Foods, and even Market Basket, to no avail. Where did they all go? Are they out of season or something?

As a spoiled westerner I’m not used to growing seasons actually mattering, so this has been a weird experience. The stores have plenty of other varieties of apple, but I much prefer the tart Granny Smith. My current theory is that there is one boat that brings all the imported apples to the north east. Sometime last month it sank off the coast of South America, leaving us without green apples for the forseeable future.

edit: success! Harvest Coop had Granny Smiths, although many were bruised. I think it was the leftovers from the last successful shipment before the boat sank.

Ubuntu Fonts

An update was recently pushed to ubuntu that updates fontconfig, one of the programs involved in rendering text on the desktop.

DOWNLOAD THIS UPDATE!

I’m not sure what they did, but my fonts look noticably clearer, better defined, and sharp. It’s really quite beautiful. Also, the various options in the font dialog (specifically the hinting levels) finally work, so I can see the difference. I don’t know who is responsible for finally getting this right, but thank you!

“It’s not Citizen Kane, it’s Snakes on a Plane”

This jewel was uttered by a guy sitting near me at the midnight showing of Snakes on a Plane at AMC Loews Boston Common Theater yesterday. Fifteen minutes before showtime, he was on the phone trying to convince a friend to come to the theater. It’s a shame his friend didn’t show.

That little couplet serves as the perfect review of Snakes on a Plane. It is also a no-contest rebuttal to any criticism of the movie. Do the first fifteen minutes of the movie exist only to get everyone on Pacific Air Flight 121 as fast as possible? Yes, but even that was a little long for some in the audience. Are some of the characters shallow, and are some of the actors really bad? Of course! Do the effects pale in comparison to Pirates of the Caribbean? Damn straight!

It is a little cheesy, a little scary, and quite a bit funny, all in the right proportions. Most importantly, it does not take itself too seriously. “Snakes” is a good B-movie, something I feel like I haven’t seen in a while. When was the last time you saw a really bad police interrogation scene?

Should you see Snakes on a Plane? Yes, but if you weren’t in Theater 16 on Thursday night you’ve already missed the greatest showing there will ever be of this movie. I invited my friend Mike to the show, and he brought a printout of the Snakes on a Plane Participation Script. Well before showtime, he helped the audience learn the key lines: anytime the asian bad guy finishes a sentence, yell “…in bed!”; anytime a sentence ends in “snakes,” yell “motherfucking snakes!”; anytime Samuel L Jackson yells at someone, add “...bitch!” for emphasis; etc. It was a little like a Rocky Horror Screening, except that nobody had seen the movie yet. So when the entire theater found out that adding “in bed” actually works for damn near everything the asian guy says, it was hilarity topped with the joy of discovery.

I wouldn’t trust any reviewer who wasn’t in a theater with the electric atmosphere and audience participation I experienced last night. The story of SoaP’s development and production has been one of collaboration between the filmmakers, the fans, and especially Sam himself. For this movie to work that collaboration must extend to the screenings as well. Putting the burden of the entertainment on the film itself is a dereliction of duty by the audience. So print out the wiki, bring some rubber snakes, and do your part!