Archive for November, 2006

Fighting Spam on a Diet – How to fix Akismet Performance Problems

Running into strange WordPress performance problems and database errors?  Akismet could be the culprit, but we're in luck, it's an easy fix. Earlier I wrote a bit about our encounter with vicious, robotic Chinese comment spammers.  Since then we've had a few further issues, and I think I've found the culprit - Akismet, the plugin we've been using to fight the spam. First off, let me say that I think Akismet is a great plugin.  While we had hundreds of spams come in for a few days in a row, not one made it out to the public.  Very nice.  But it is a bit too aggressive in one spot, and that can slow down your blog or lock up the comment table, filling your max_connections. The problem is in akismet.php, specifically the akismet_delete_old() function.  Look for the following lines:
$n = mt_rand(1, 5); if ( $n % 5 ) $wpdb->query("OPTIMIZE TABLE $wpdb->comments");
Those of you with PHP / MySQL experience will recognize the problem immediately.  For the less code-literate, this is creating a random number between 1 and 5, and if the number has a remainder after being divided by 5, it runs and OPTIMIZE TABLE on the comments table.  That means that at random, it will lock the entire table and compute statistics after 80% off all deletes. Now, it's a good idea to optimize your tables after a large number of deletes.  But it is a pretty expensive operation, because it could be rearranging things on disk to free up space. Now, imagine you get hit by a spam bot and end up with a couple hundred spam comments.  Akismet catches them all, and 15 days later tries to delete them all in one big loop.  One big loop filled with a couple hundred table-locking, disk-intensive database operations. But it's easy to fix.  Replace the lines above with this:
$n = mt_rand(1, 100); if ( $n == 42 ) $wpdb->query("OPTIMIZE TABLE $wpdb->comments");
That will only optimize the table on average once out of 100 comments deleted.  Why 100?  It's an educated guess.  According to the MySQL documentation, at most you will need to optimize a table once a month or so, maybe once a week if you have a large number of deletes or edits on varchar fields. Why did I pick 42 for the one value out of a hundred that triggers an optimization?  You're asking the wrong question.

The Greatest Comedies of All Time

A few weeks ago JessB mentioned she had seen a list of the 100 greatest comedies (I think it was Bravo's list) and that it was pretty lacking. The full list can be seen here, in Manroom Magazine, and no, I didn't just make up Manroom Magazine, it actually exists. At the time a few of us remarked that although constructing a definitive list would be difficult, we could come up with 100 that were, on average, much better than the Bravo list and even the fancy important AFI list. So I am issuing two challenges:
  1. To all Unsought Input writers: I am seeking your input to a list of the greatest comedies. Write a follow-up post with some of your picks.
  2. To all UnsoughtInput readers: give us suggestions and critique our choices in the comments section.
The rules:
  1. They have to be filmy, theater-style movies. No short films, made-for-TV movies, etc.
  2. They don't have to be American like the AFI list, but they do have to have actually played somewhere in the U.S. at some point, available on DVD, etc. Art house is fair game, but "screened at Professor Lindski's seminar class on Polish cinema of the 1920s and 1940s" is not.
This won't be easy. Comedy is very subjective, and we're not even going to further constrain the judging criteria by asking for the "funniest" or the "most biting social satire." To get us started, I'll throw out a few picks of my own. Here are ten movies I would put on the list, in no order. I'm sure I can come up with more. We'll decide on the final list through a scientific process of bickering. Waiting for Guffman (1996) - In my opinion, this is the best of the Christopher Guest mocumentaries, even though Spinal Tap was more influential and A Mighty Wind and Best In Show both made more money. Blazing Saddles (1974) - Nothing is funnier than racism. Hey, where the white women at? [youtube]yZF_zPkWbhY[/youtube] Ghostbusters (1984) - When I was a child, I used to talk as a child, think as a child, reason as a child, and I loved Ghostbusters. When I became a man, I put aside childish things, yet I still think Ghostbusters is a brilliant movie. I think Dan Aykroyd and Harold Ramis just disproved the Bible. Sullivan's Travels (1941) - A film producer sees the suffering of his fellow man and decides to abandon his comedies and make a moving film about the plight of the poor. Eventually he discovers that escapist entertainment really is valuable. Although it might seem like the film ends on a high note, I've always thought it was ambiguous - the protagonist learns this while watching cartoons with fellow inmates in a starkly-lit scene filled with exaggerated, haggard laughter. I put this one in to show I'm more cultured than you. Rumble in the Bronx (1995) - For all the Charlie Chaplin and Buster Keaton on other lists, I can't understand why Jackie Chan never gets any love. He is the best physical comedian alive and has incredible timing. This movie has the perfect intersection of these talents, vague ideas about American culture, and poor dubbing. Watch Jackie fight the most ethnically diverse gang in the history of New York City: [youtube]-rEwedJNQ4A[/youtube] Being John Malkovich (1999) - A movie about a puppeteer and a sweaty portal into an actor's head. In my opinion the chase scene through Malkovich's subconscious is the best chase scene filmed. Rushmore (1998) - I liked The Royal Tenenbaums and Bottle Rocket, but I think this is the best Wes Anderson film. Co-written by Owen Wilson. I can't think of a comedy that makes better use of music, or better use of Bill Murray. [youtube]rWjXBJf3fGo[/youtube] Roujin Z (1991) - I've enjoyed a number of anime movies and series, but I tend to find comedic anime somewhat tiresome. Perverts trying to obtain panties... nerds getting embarrassing nosebleeds around women... women stumbling in such a way that you see their panties, causing said nosebleeds... it's only funny so many times. Roujin Z, on the other hand, is sort of a parody of the giant robot / mecha genre of anime that takes jabs at how modern society treats the elderly. What's Up, Tiger Lily? (1966) - I was really considering not mentioning any Woody Allen movies because they fill up everyone else's lists faster than a page fills an Congressman's heart with lust. So out of spite I am recommending What's Up, Tiger Lily?, one of the few Woody Allen movies that doesn't show up on any lists and the only Woody Allen movie to make me actually laugh out loud. Shaun of the Dead (2004) - This movie manages to reference every zombie movie ever made, get you really interested in the characters, kill off almost all the characters, and still be as funny as hell. Seriously, if you are ever really looking to kill some time, read the IMDb trivia page for the references to other movies. There we go - ten movies to start us out. Now post more of the best comedies and get bickering!

Science Projects: The Joy of Non-Newtonian Fluids

Have you ever wanted to walk on water, without the downside of being inevitably betrayed and denied by your closest friends? [youtube]f2XQ97XHjVw[/youtube] In elementary school we learn the difference between the three conventional states of matter: solid, liquid, and gas. But as lucky students with cool science teachers (and nerdy kids with the Internet) know, not all fluids are the same. Non-Newtonian fluids change viscosity under strain. Poke, shake, or smash them, and they act like a solid. Let them sit or move them around slowly, and they act like a fluid. This has some interesting applications, like body armor and custard. But who needs practical applications when you can create an evil cornstarch monster: [youtube]WnDKOc0Ag28[/youtube] Want to make some non-Newtonian fluids of your own? There are plenty of recipes online, but the easiest way to do it is to get some water in a bowl and slowly stir in some cornstarch. It should get kinda think and even, and when you get to the point where you can stir slowly, but not quickly, voila -- you have broken the laws of 4th grade science. The technical term is oobleck. Here are further instructions, one set for geeks: [youtube]BmL2WEOmEDw[/youtube] And one set for little kids: [youtube]fazPiaHvFcg[/youtube] And here's one more for the road: [youtube]NKxKVpHZe5Q[/youtube] And of course, since this is the Internet, there are even more videos to watch.

Morning Glories

Today I was trying to answer a reference question on the effects of vitamin water on plants, and I ran across the funniest description of a science experiment I have ever read. It can be found at this URL: http://www.youth.net/nsrc/sci/sci039.html#anchor1019498 ...under the title "Should You Feed Your Plants Juice Instead Of Water?"

What Villians are Thankful For

In a recent artIcle on i-mockery.com, superheroes said what they are thankful for this Thanksgiving. In order to give equal time I recently asked supervillians what they are thankful for this season.
Blob Blob I am thankful for my friends and family...what are you surprised I didn't say food. You bastards I have a genetic disorder why must you be so cruel.
Joker The Joker I am greatful Batman is too much of a pussy to kill my crazy ass. What do I have to do, shoot his best friend's daughter and paralyze her... oh wait I did that and he still did nothing. What a fag!
Magneto
Magneto
I'm thankful you stupid humans haven't invented plastic bullets yet. I mean really, even if you ran at me with a pointed stick I'd be screwed.
Dr. Polaris
Dr. Polaris
I'm thankful copyright infringement doesn't apply to comic book powers. But seriously we're totally different he's a mutant and I got my powers from exposer to magnetic field or something like that. Also my costume totaly kicks as, how does he even look like a magnet?
Lex
Lex Luthor
I'm greatful for the dumbasses in this country who voted for George Bush. If the're dumb enough to vote for him then surely they'll elect me. Luthor in 2008!
Gorilla Grodd
Gorilla Grodd
I love the Animal Planet channel. Its the best free porn ever!
Galactus
Galactus
I HUNGER HERALD BRING ME CRANBERRY SAUCE! AND THEN SOME PUMPKIN PIE AND DON'T FORGET THE WHIPPED CREME!!