<M <Y
Y> M>

[Comments] (1) : Murder in the Gunroom. Perhaps a GUN was involved?

[Comments] (2) Random Books: Jarno has a little application that picks random search terms to find a random book on Amazon. But dang if I didn't click that doohickey ten times without it ever coming up with a book. I decided to try and implement a random book finder that would reliably come up with books.

The main problem is the arbitrary restriction of Amazon Web Services where you can't get more than 250 pages of query results. If it weren't for this restriction, you could pick a random number from a huge range and do a Browse Node search to get the corresponding page of results. This is still a pretty good solution if you want to search for products in a restrictive set like the set of science fiction books: find the corresponding Browse Node and do a browseBestSellers.

As it is, the simplest solution is to only search for a single word, instead of Jarno's two. Here's some code that does that and works pretty well.

import amazon
import random

def random_product(keyword, max_page=250, associate="crummthesite-20"):
    result = None
    while result == None:
        page = random.randint(1, max_page)
            results = amazon.searchByKeyword(keyword, page=page, type="lite",
            if results:
                result = random.choice(results)
        except amazon.AmazonError:
            results = None
        if not results:
            max_page /= 2
    return result

def format_product(p):
    print '<a href="%s">%s</a>' % (p.URL, p.ProductName)

keyword = random.choice(open("american.0").readlines()).strip()

Sample book: Reutilization of Waste Materials.

The other solution is screen-scraping. As covered earlier, there is an Amazon URL such that you can randomly vary a parameter and get a more or less random set of books. Here's some code that fetches one of those URLs and grabs an ASIN at random. Then it does an AWS lookup of that ASIN because life is too short to scrape all the appropriate information off that big ol page. This is a little less reliable than the earlier implementation, but it gets a better random distribution of books (since the other one picks a word to search on, and word distribution is not random).

from BeautifulSoup import BeautifulSoup
import amazon
import random
import urllib2
import re
import socket

URL = "http://www.amazon.com/exec/obidos/tg/new-for-you/top-sellers/-/books/all/books/0/1/%s/1/"
def random_book(max_page=150000, associate="crummthesite-20"):

    product = None

    while product == None:
        url = URL % random.randint(1, max_page)

        req = urllib2.Request(url)
            soup = BeautifulSoup(urllib2.urlopen(req).read())
            asins = soup.fetch("input", {"type" : "hidden",
                                         "name" : re.compile("asin\.*")})
            if asins:
                asin = random.choice(asins)['name'][5:]
                product = amazon.searchByASIN(asin, "lite", associate=associate)[0]
        except socket.error:
            product = None
        if not product:
            max_page /= 2
    return product

def format_product(p):
    print '<a href="%s">%s</a>' % (p.URL, p.ProductName)

print format_product(random_book())

Sample book: Choice, Welfare and Measurement

Restaurant Tradeoff: When I moved to New York I gave up a lot of burritos (as The Burrito Eater indicates) but apparently I gained a huge number of extremely specialized restaurants that only serve one dish. For instance, the arachibutyrophobic-hostile peanut butter restaurant I went to last month.

Now I've discovered Rice to Riches, which only sells rice pudding with lots of different toppings. I think if I start a restaurant it would be easier to start one of the really specialized ones. Let's say, I would sell only choux puffs with various sweet and savory fillings. Meanwhile, here's a copycat recipe for their Rocky Road rice pudding.

Flickr Rebus: I had the idea to write something that used the Flickr API to turn a sentence into a rebus. For every word it would do a tag search on that word, and use the appropriate thumbnail picture. Well, I'm not that interested in doing it now because there's a similar thing called flickrfling which takes an RSS feed and rebusizes the first part of it. It's a Flash application and I don't know why it takes an RSS feed (instead of, say, a string) except to get another buzzword in there, but it's satisfying enough to stave off my desire to do my own for a while.

[Comments] (1) Link dump:

Turns out double rainbows are caused by inflation. Now here's Bob with the weather!

[Comments] (1) : I thought this comic verse would be pretty funny, but upon examination none of it is as good as the stanza that made me laugh in the first place:

  The Bard subsists on simpler food:
    A dinner, not severely plain,
  A pint or so of really good

I don't understand anything about poetic meter or why one meter is funny and another one is serious, but that one's funny. It's a meter with a punchline.

[Comments] (5) Humanocentrism: "Ever wondered what form your favorite Transformers would take if they existed in different eras?" Presumably they would look a lot like they normally do, since they're aliens from another planet and not restricted to Earth's current level of technology.

Just part of my longstanding tradition of taking the logic of Transformers at face value when nobody else does.

Amazing New Web Meme: that I just made up. Reveal interesting Wikipedia articles you looked at recently.

Unfortunately, this web meme has no way of propagating, so it is sure to die out. Just like the laser harp.

Language Games: A while back I designed a game involving the unreliability of translations and the mendacity of translators. One requirement for playing the game without finding it extremely tedious was some automated tool for garbling a message by using an automatic translator to translate it back and forth. Multibabel is the kind of thing I had in mind.

For a while before I A game was designed; Non- reliability of conversion and the inclusion of mendacity of translator. Boredom without finding that very, one condition in order to do the game went the tool which in order to distort message with use to converting that of the automatic translator on front and back is automated. Multibabel There is a kind of thing which I had with heart.

: For a while now I've been looking for a way of keeping track of my various lists of books and cultural artifacts. I want a website that offers a web service interface so I can munge my list of books a million ways. This quest of mine has gotten me into all kinds of trouble and I'm still using a series of parallel Amazon wish lists because they at least have a web service interface for getting the list of books.

The latest entrant into this fray is lib.rario.us, which looks just like del.icio.us except it's for keeping track of things that have an ASIN or ISBN. I like the del.icio.us interface a lot (mainly because it's easy to hide it behind a NewsBruiser interface), but lib.rario.us doesn't offer even one tiny web service.

Amazingly, though, the traditional del.icio.us rip-off name proves itself useful for once: it's given me the obvious-in-retrospect idea of just using del.icio.us to keep track of my wish list. Use it as a platform. Why didn't I think of that before? It could work, once I put up something between me and del.icio.us that looks up ISBNs from titles.

[Comments] (1) Paleoworld: This is a whole documentary series (on the Science Channel... OF SCIENCE!) about dinosaurs. I guess it could be about other paleo-things but I only seem to see the ones about dinosaurs. Sample shows: "The Lost Dinosaurs of Egypt" and tonight's episode, "Troodon: Dinosaur Genius". It's really good to listen to while making dinner because it's about stuff that's extinct. All they can do is circular pans around models of the dinosaurs, and pictures of paleontologists digging in the desert. So you're not missing anything by just listening to it.

"Troodon: Dinosaur Genius" is about the Troodon, which had an opposable finger and the largest brain/body mass ratio of any dinosaur. Pretty soon the documentary will reach the traditional "unwarranted extrapolation" phase, where people will speculate that, were it not for the K/T event, Troodon could have continued its trend towards greater intelligence and become a sentient lizardoid species. Yes, just like in that episode of Star Trek: Voyager.

The main problem with Paleoworld is that there's no warning when it goes to commercial, and the voiceover announcer for the show sounds just like the voiceover announcer in the commercials. So you hear things like this. "But the story of Troodon does not end here. It launches us from the dinosaur age to the space age. The latest Mars Orbiter is about to arrive!" And "Troodon was a dinosaur with incomparable brainpower. All of us have internal plumbing. But sometimes our pipes doesn't work as well as they should."

I once worked with a guy who was going to voiceover school nights, and he said that there is a standard set of voices that you learn in voiceover school. I guess this is so the school and employers can grade you on an objective scale, but it's really creating a voiceover monoculture.

: Shuffling a Stacked Deck has a good approach to a popularity feedback loop. The solution is to randomly insert certain results into the list of the most popular. More elegant than the Ultra Gleeper's solution of multiple tiers of results.

I first noticed the popularity feedback loop back in the BBS days. A common feature of BBSes was a "Most Popular Files" list, and people just kept downloading the files on the list, which to my mind defeated the purpose of advertising these files. I set up a "Least Popular Files" list that listed all the files that had never been downloaded. It didn't really work.

: Mark Dominus's weblog is great! Don't worry, it contains hardly any Perl. It does contain "The Sesame Workshop people were not able to solve the problem."

[Comments] (1) : I have an idea for applying the Dissociated Press algorithm to a body of music. Dissociated Studio kind of does the same thing, but I have plans for a much larger-scale project. Stay tuned... as I never get it done!

[Comments] (3) : Sumana went to an MC Frontalot gig and ended up in Overcompensating.

[Comments] (2) Search Request: Frances government - good or bad? I think it would be good.

: Sumana called me up and read me items from this poorly-translated Chinese restaurant menu, and then refused to mention it in CES because "it's played". I find this attitude extremely shortsighted, so I threatened to post it to NYCB. The awe I felt this would provoke was not forthcoming. But I posted it anyway. Enjoy. Our favorite: "A west bean pays a fish a soup". I am a decadent fish! Fill my aquarium with the finest soups!

Crosspost: I posted to Spam As Folk Art about honest stock spam.

Off By One:

Bonus Wikipedia link: Kappa

Alternate Universe News:

The White House maintains that Gamera is a friend to all children.

: It's well-known to we Game Roundupologists that a large class of games can be improved by replacing the humans with dinosaurs or cars. Now, a Flash game programmer who demonstrates that any NES platform game can be improved by replacing the protagonist with Mega Man. Found via Adam Parrish.

[Comments] (5) : Where are the boats? In the ocean, silly.

QOTD: "Interrupting cows? In Berk--" "Moooo!"

: The first draft of the Ruby Cookbook is almost done! I still have to edit three contributed recipes, one of which won't be delivered until tomorrow. But I'm done writing recipes. Now I begin rewriting them.

I redid the outline so it shows the reviewer coverage of the various recipes. I'm also working on a script that grabs the code snippets out of the recipes, runs them, and sees the results match what it says in the book. That one's a little tricker.

: If you've been wondering what it is the companies who sponsor the Starslip Crisis RSS feed actually make: it's this stuff. I especially like the "Neutron Simulator", and the "Beam". I picture the neutron simulator as being basically a big piece of radioactive chalk. As for the beam...

: Z Machine Sets Unexpected Earth Temperature Record. The forthcoming Inform 7 must be hotter than I'd thought.

[Comments] (3) Formal: I have to convince some people that I'm being paid for my work on the Cookbook instead of doing it for no reason. I faxed them a printout of the invoice page from my agent's website. Not good enough. I've got the right idea, but they need something that looks more formal. Could I maybe fax them a printout of a web page that shows the deposits going into my bank account? Those bank web pages have real formal-looking HTML. Of course I can black out all my account numbers and any sensitive information before faxing in the printout.

Incidentally, I recently became a Texas oil millionaire. Why you laughin', li'l buttercup? Ain't it the truth, why it says so right here on this printout of a web page about my bank account.

[Comments] (1) : Bootleg Thin Mint recipe.

[Comments] (2) Done!: The first draft of the book is done!

I'm Partched!: Hey, Jake, you can now play with Flash simulations of Harry Partch's instruments.

: Brendan and Maria are in town. Today we went to the Met and saw a bunch of stuff. More about this later as I have to sleep. But I will say that ancient Chinese office supplies remain awesome. We saw a book called "Mr. Fang's Ink Compendium". Unfortunately copies of this book were not available in the gift shop.

[Comments] (7) Once Upon a Time Variant: We hung out with Brendan and Maria all day and played games. We came up with this Once Upon a Time variant which fixes what I think is the biggest problem with OUaT: the underuse of ending cards. You get a million story cards that have single concepts on them, and there's an equally large deck of ending cards, each containing an entire plot point. This other deck is cooler but you go through it at 1/100th the speed.

So, the variant: you start off with two ending cards. Whenever it's your turn, you must play one of your ending cards before you can play a story card. You can just play the ending card and start tying it into the story, or you can talk for a few sentences before playing the ending card, to connect the current story to the ending. No one can interrupt you before you play your ending card, but you can't play any of your story cards either.

Once you play the ending card, your turn continues as in vanilla: you play story cards and try to get to the point where you can play your second ending card. If someone interrupts you, you must draw a story card and an ending card (so you begin each of your turns with two ending cards).

If someone's story gets to the point where you could play an ending card, you can interrupt with the ending card and start your story from there. (This actually happened.)

Since OUaT stories jump around a lot anyway, it's not difficult to use an ending card to close one thread of the story or to spawn a new thread. The additional constraint is generally what I need to feel comfortable making up an OUaT story.

Update: See comments for feedback from OUaT co-author James Wallis.

[Comments] (5) Why Do You Exist Here?: I read a philosophy paper (probably online) that hypothesized that our perception of consciousness was an artifact of the fact that time only goes in one direction. I want to reference this paper in the Ruby Cookbook, but I can't find it. All the words I can think of to describe the paper are also keywords used by the wormhole aliens who fill the web with crackpot stuff like "The Illusion of Linear Time and Solar Dynasties". In fact, I did find a paper that seems to say the same thing as the paper I'm trying to find, but it too was written by a wormhole alien and is unintelligible.

Does anyone else remember this paper? Maybe I should have developed an intense emotional hangup when I first discovered it, so that I'd always be revisiting that moment and I could remember the URL.

[Comments] (2) : Lego aircraft carrier. Reminds me of the plane boards used on real aircraft carriers.

: Going to Bakersfield tomorrow to see everyone. I don't really have things to say right now because my brain is boggled from debugging recipes (the automated test runner helps a lot; has any other book ever done this? Is it worth writing about?).

I am reading The Dalkey Archive but so far it's a much less funny ripoff of The Third Policeman. It better get surreal and fast, or I'll... regret my purchase!

[Comments] (2) Caution: Congratulations!: "Congratulations! Your seat comes with 36 channels of DIRECTV programming." Like I did something to win those 36 channels of DIRECTV programming.

[Comments] (2) Pac-Man Heresy: I was looking at this list of official Pac-Man franchise games and ports (caution: page uses "gay" as a pejorative). And a couple things occured to me. First, what would be much more interesting (and longer) would be a list of unofficial Pac-Man games and ports. Like, uh, this page, except more opinionated. The other thing is the monsters/ghosts. According to Pac-Man orthodoxy, the monsters who chase Pac-Man around the maze are just that: monsters. Generic monsters. NOT ghosts. To call them ghosts is counterrevolutionary. Some fools think they are ghosts because the horrible Atari 2600 port of Pac-Man had really bad flicker, and called them ghosts to cover up the fact.

But come on. They look like ghosts. Specifically they look like Charlie Brown ghost costumes, baggy sheets over the head with holes cut for eyes. That's why people think they're ghosts, not because one port twenty-five years ago couldn't handle five moving objects on the screen at once. People don't see random things flickering and say "oh, that must be a ghost". There has to be some preexisting resemblance to a ghost. So don't blame people for thinking that the monsters are ghosts.

Instead of simply asserting that the monsters are not ghosts, it's pretty easy to prove it, a la Aristotle. A ghost is the disembodied essence of a dead person. When Pac-man, under the influence of a power pellet, eats a monster, the essence of the monster is separated from its body and goes into the penalty box to regenerate. What is that disembodied essence but the monster's ghost? How can a ghost have a ghost? It does not make sense.

Hopefully this proof can bring some civility to the enlightenment of those who think the Pac-Man monsters are ghosts. This is my Pac-Man heresy, brought on, I believe, by Pac-Man fever.

: Rachel and I went to the Newport Pier thinking that it was the place where they filmed the boardwalk scenes for Arrested Development. That's basically where those scenes were set, but they were actually shot at a more photogenic pier, many miles northwest in Marina del Rey. But we ate a frozen banana anyway. (As things you buy on a pier go, frozen banana is pretty healthy.)

I originally tried to write this entry in the style of an Arrested Development episode, but though it was formally correct there were no jokes in it. This is how you repay me for how I repay you?!?!

Emergency Samosa Sauce: If you have samosas but no samosa sauce, use apricot jam, melted in the microwave. Kind of like the tamarind-based samosa sauce.

I developed a samosa song which I sing when I'm awaiting samosas. It goes: "Samosa!" Except you say it on the fourth beat of the measure. I think it could be the next "Tequila".

[Comments] (1) Terror of Fox Terrier: When I was younger I read a Stephen Jay Gould essay about how textbook authors copy from each other instead of coming up with original ways of expressing ideas. The textbook (or, metatextbook, I guess) example is that Eohippus has been consistently described as "the size of a fox terrier" for over a hundred years, as the fox terrier itself has plummeted in popularity, and as the number of people who need to learn about vertebrate evolution despite not being the kind of Nick Charles WASPs who would know what a fox terrier was anyway has climbed.

I reread this essay today and I must have gone through postmodern puberty since my first reading, because this time I saw the subtext. Human culture is supposed to change and propagate quickly, by Lamarckian means. But the blind, semantics-ignorant copying seen in these textbooks shows that culture propagates by slower Darwinian processes too.

Textbooks evolve through sexual selection. Nothing selects against this bizarre and useless (and, Gould claims, wrong) comparison between Eohippus and a fox terrier, because nobody ever reads that sentence and tries to make sense of it. It is junk DNA. The whole text of the textbook only exists to make it larger, so it looks more attractive to school districts. All the resources are going into improving the textbook's plumage.

The reason I read the essay in the first place is that I've seen the fox terrier comparison three times in the past month or so. This is twenty years after big-shot paleontologist Gould publishes an essay totally slamming the comparison, with no one coming forward to explicitly defend it. The first time I saw it was next to an Eohippus in the horse evolution exhibit at the American Museum of Natural History. I guess it was about the right size, but I've seen a real Eohippus fossil and I've never seen a real fox terrier, so what do I know? Could we get a more helpful comparison in a real museum exhibit right next to the actual skeleton? (The Gould essay makes a tenuous connection between the AMNH and the original source of the comparison, so maybe they're just being stubborn.)

The second place I don't remember where I saw it. The third place was in a book I just read called The Eternal Frontier, an ecological history of North America. Apart from the fox terrier comparison it was a pretty good book, though it was written by an Australian which means it exhibits the cowboy obsession common to non-North Americans who write about North America. It was also pretty depressing since it portrays the entire history of life as organisms going in and really screwing things up for other organisms (though occasionally an non-organism like an asteroid or an ice cap really screws things up for everybody).

: Just now I learned how to not have your multiple bash shells overwrite each other's history. And I realized that that was the first time in a long time that I expanded my knowledge of living in a Unix environment (as opposed to programming in one). I guess this big list of other things you can change in bash is a good start.

: Last day of my California trip. Visited with Adam/Kris/Kim for a bit. We recorded a song which may or may not ever see the light of day. You're probably hoping not.

Nothing has really happened except slow spotty progress on editing the book. People are starting to ask me what I'll do next. Next I will decide what to do next.

Abominations: I saw this on the screen of the guy sitting next to me on the plane (that 36 channels of DirectTV really is a curse). The Three Robonic Stooges. Hanna-Barbara cartoon from the seventies. No, wait, it gets worse. In this Hanna-Barbara cartoon from the seventies the Three Stooges are given Inspector Gadget-style abilities so they can catch spies. But they can't because they're incompetent. But somehow they end up doing it anyway.

I could buy the robonic (were they trying to get a trademark?) modifications if the show took place in a Harrison Bergeron society, where as a matter of social policy people at the Stooges' level of competence were given special abilities to bring them up to the level of the general population. But it ain't so. There aren't even any Three Laws of Robonics. The only thing this cartoon has going for it is that according to IMDB, the guy who dispatches the Six Million Dollar Stooges is code-named Agent 000. The show predates and has the same basic plot as Inspector Gadget (minus the PSAs, but if you started doing PSAs after Stooges shorts you'd never be able to stop). You think that'd be worth something, but it's not.

Obviously the Stooges are not some wonderful cultural icon that has been demeaned by this stupid cartoon, but that doesn't excuse anything. Though by any measure the Stooges come up short when compared to the Marx Brothers, they have the same basic dynamic, and it's one you don't see enough anymore. Characters with no marketable skills, who cling together more through inertia than attraction or synergy. Coveting a position in high society, they end up going for it because they've seen that nothing really separates them from the current inhabitants of high society (who have no marketable skills either). But their plans are jeopardized by their own self-destructive behavior. <-- This paragraph doubles as my "outreach" attempt to explain to women the appeal of the Stooges, such as it is.

: Did you know there was an Arctic Winter Games? They "promote culture and values". I got lottery spam trying to convince me I'd won some AWG-related cash prize (maybe victims think they won bronze in Dog Mushing and forgot to pick up their prize?), so either the games are better known in other parts of the world, or a spammer is a big fan of them.

[Comments] (1) Earwax: This BoogaBooga entry reminded me of an experience I had at the Met. I was looking at ancient Chinese artifacts including an earwax pick shaped like an alligator. I was thinking what a strange kind of thing an earwax pick was. Then a family came up to the same case and the mother of the family said "Look, an earwax spoon like the one we have, only it's shaped like an alligator! Isn't that neat?" Supposedly George Washington had an earwax spoon too, so I guess that makes me the only person on earth who doesn't own one.

Would you like to learn more about earwax? Too bad. Already the knowledge burrows through your tympanum and into your brain!

And then I FREEZE-DRY the marshmallows!: When I was hanging out with Adam/Kim/Kris someone pointed out that if kids' breakfast cereal didn't already exist and have a lot of machinery dedicated to making it, no one would eat it except as an avant-garde dessert like a floating island.

[Comments] (3) : Famous comic Cat and Girl has a Flash-based comic creator program. Write constraints in comments and I will proactively utilize web technologies to meet clients' needs, assuming the clients are you and your needs are to be totally blown away by constrained Cat and Girl comics.

: Encoding problem.

[Comments] (4) : Once again, only ONE MAN dares give me comic constraints. In addition to breaking the 200-recipes-edited mark today, I created my own Cat and Girl, in the spirit of the original. The constraints were:

[Comments] (8) Vowecowedrrr: I hate the vocoder because it's used in all the damn pop songs I hear in the supermarket, and I suspect its primary use is to cover up the fact that pop singers can't sing. But this tutorial and its obvious-in-retrospect explanation of how vocoders work is pretty neat.

[Comments] (1) More Cat, More Girl: Factitious's constraints:

With further ado, the comic:

Tomorrow: Kevan's constraints, if I have time.

Mini Game Roundup: BlinkenSisters: Hunt for the Lost Pixels. A 2D platform game, a huge download due to embedded OGG files and graphics. Is it worth the download? No, not really. But the mechanics aren't bad. Your character jumps (and looks) kind of like the Princess in SMB 2, which I've always felt was a vastly underused mechanic. There's also a cool-looking squid monster. Just too much a basic jump-and-squish game and not really improved over older games 1% its size.

<M <Y
Y> M>


Unless otherwise noted, all content licensed by Leonard Richardson
under a Creative Commons License.