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!

Hack of the Day: Versioned Tomboy notes

I have a “TODO” tomboy note that I constantly update with little notes, things to pick up at the store, etc. However I don’t like the fact that my history isn’t saved. In one case I had a URL I had plunked in my TODO but hadn’t kept anywhere else. I went to find it recently, and I had deleted it from my note. Luckily I had a backup with the old version of the note, and I was saved.

It would be nice to have a versioning plugin for tomboy (like a wiki) but I’m too lazy to code the solution, so I came up with an Awesome Hack instead: CVS and cron. I turned my ~/.tomboy into a CVS repository, and set up a cron job that would scan my notes every hour and commit to the repository. Now if I want to go back in time I can browse through the revisions.

Having an actual versioning plugin would be preferable to all this, but barring that this is a decent enough stopgap measure.

Amsterdam Photos

Amsterdam photo time!

[800×600][1600×1200]
Pedestrians, bikes, trams, cars

Char and I had a lot of fun in Amsterdam. She did a lot of shopping, and I did a lot of World Cup-watching.

[600×800][1200×1600]
shop shop shop

Amsterdam is a maze of twisty little passages, all alike. Often there will be multiple instances of a chain store on different blocks, adding to the disorientation. Luckily all roads lead to Central Station, so it’s easy to get lost but also easy to find your way back

[800×600][1600×1200]
little public art

Early on I saw the Heineken experience by myself (Char was shopping at the time). I knew it would be dumb and expensive, but I didn’t realize just how dumb it could get. The beginning of the “Experience” is a museum-like area that tells the story of how Heineken was founded. It has the letter the guy sent to his mom (zing!) saying he had bought a brewery, and the marble cornerstone of his first brewery… Except that the letter is a xerox, and the cornerstone is a plastic cast! Totally low-rent.

[800×600][1600×1200]
this is funny, through

The Experience was about twice as long as it needed to be. Half way through you get your first free beer, but then it’s off to more horrible branding experiences. The movie presentation of a first-person view of a bottle being filled with beer was a notable low point. About the time I got to the Pod People section of the Experience, I couldn’t take the horrible green branding of it all and had to leave. Yes, I turned down more free beer!

Near the Heineken brewery is a Pancake restaurant in an old carousel. They had kept a few of the horses, but despite the good pancakes I would have preferred a carousel.

Char and I did some Geocaching in Amsterdam. I had printed out some caches before I left for Europe, picking three caches with increasing levels of difficulty. The first cache was a simple one that led to an interesting point in Amsterdam — a copper plate from which everything is measured. I’ll let this informational sheet explain:

thumbnail

Amsterdam Marker Explanation

[800×600][1600×1200]
Char Touches the Bronze Knob

[600×800][1200×1600]
Water level indicators

I was “warned” before I went that Cafes and Coffeeshops are different things in Amsterdam. As it turns out, there’s no way you could mistake a coffeeshop for a place that serves coffee. The odor and clientele should be enough to clue in even the cluelessest foreigner.

One thing I noticed was that many of the coffeeshops are blatant trademark violations:

[600×800][1200×1600]
The blur is on purpose, folks

Other coffeeshops included The Doors Coffeeshop, The Pink Floyd Coffeeshop, Popeye’s Coffeeshop, Hill Street Blues, and many others. I’m surprised that they are allowed to exist, considering that a big company probably wouldn’t want their “properties” associated with drug use. Yet, there they are.

[800×600][1600×1200]
Char has the munchies 😛

[800×600][1600×1200]
There are cars of all sizes in Amsterdam. I even saw a Hummer

[800×600][1600×1200]
Char poses in the ‘d’ of a large “IAMSTERDAM” logo

[800×600][1600×1200]
logo in back

And of course our favorite sign, which introduced us to a new Dutch word:

[600×800][1200×1600]
Let op! Drempels!

Drempels!

Our Summer Vacation 2006

Char and I went on vacation to Paris and Amsterdam for two weeks this summer. Here are a lot of pictures:

We stayed at a really nice place called Swell Apartment Paris. It’s basically a little apartment in Montmartre with a bedroom, living room, and kitchen, and you can stay there for a week and pretend you live in Paris. We probably wouldn’t have stayed there if I hadn’t gotten my currencies confused. I thought we were paying in Euros, but it was actually Pounds. Oops.

The room didn’t come with internet, but if I put the laptop on the desk I got a signal from an unsecured network called THOMSON. I don’t normally steal internet, so I connected only when I needed to to look up maps, check schedules, or get a weather report. It was really nice to have, but I knew I couldn’t expect it to last. Indeed, on the last day THOMSON had suddenly become a secured access point. THOMSON, sorry I caused the trouble, but thanks so much for letting me in as long as you did.

[800×600][1600×1200]
The guest book records the incidents when these letters have fallen off the wall

[600×800][1200×1600]
Amazing props that wouldn’t look good anywhere else

[600×800][1200×1600]
There was construction going on every morning, but you can’t win ’em all

[800×600][1600×1200]
Char wakes up

[600×800][1200×1600]
Little but very functional kitchen (with washing machine!)

The first thing we did was check out the cemetary at Montmartre. Some awesome monuments here.

There was also a cute cat who had made its home in the cemetary

Next we walked over to Sacre Coeur. It was very crowded and hot, and we had forgotten our sunblock. Luckily we came through relatively unscathed, although Char was extremely close to burning.

[800×600][1600×1200]
Char at Sacre Coeur

[800×600][1600×1200]
Owen in the same place

We saw some obvious sites, like the Arc de Triomphe,

l’Hotel de Ville,

Notre Dame,

and the Eiffel Tower (although we are on it in this shot

We also visited Le Jardin des Plantes, and saw the zoo there. The zoo’s primary residents were birds and hoofed mammals, but they also had some reptiles and one big cat (that exhibit was under repair).

[800×600][1600×1200]
Frog not in the zoo

Outside the zoo we set up the camera and took the only shot of both of us for the whole vacation. I too paranoid to lend anyone my camera, so I needed a relatively secluded area where there was a platform I could place the camera upon. Thankfully the photo is excellent.

[800×600][1600×1200]
One of the many small hoofed creatures in the zoo

[800×600][1600×1200]
Another cute hoofed thing

[600×800][1200×1600]
Sleeping, not headless, owl

[600×800][1200×1600]
Evil-looking vulture

[600×800][1200×1600]
Another evil bird

[600×800][1200×1600]
Both Char and I think this bird looks straight out of The Dark Crystal

I finally meet the elusive cassowary, which I learned much about in Australia. There’s a section of the rainforest in the Northeast that seems to revolve completely around the cassowary. For instance there’s a tree that makes a nut so poisonous nothing can eat it — except for the cassowary. And that tree survives because the cassowary eats it and drops it somewhere else. There were at least five or six examples of this type of symbiotic behavior.

[800×600][1600×1200]
Char meets a very stately individual

There was one big cat at the zoo, a Jaguar. It was pacing around its cage when we saw it

Later on it got all tuckered out

Pandas! Although the non-giant kind. They were being fed just as we got there. That certainly woke them up.

A misc shot:

[600×800][1200×1600]
Pompidou

The illusion. I found out about this online, and used google maps to pinpoint the exact location of this particular curiosity. Let’s say, however, that you stumbled upon the following stretch of road without knowing what was going on:

[800×600][1600×1200]
Hm… grafiti perhaps?

Want to know what it is? Take a guess and then click through to see the answer!

Since this post is damn long, I’ll be posting Amsterdam photos tomorrow.

Continue reading “Our Summer Vacation 2006”