Power Cages, you say?

Dear Amazon,

Which of the items in this picture do not belong in the sub-category Power Cages of the category Strength Training Equipment?

(and this is from page 2 of the results; I don’t want to know what page 11 has on it…)

Show me on this doll…

John Bolton called his new book “The room where it happened”, which sounds remarkably like a sordid tale of child abuse. Which from the reviews, it apparently is.

Cram-O-Matic Recipes

Serebii has a page up with the crafting rules for the Isle of Armor DLC. I got bored, scraped the page into CSV files, and wrote a Perl script to generate all the reasonable recipes.

The whole thing ended up just over 300 lines of code, and that includes all the HTML boilerplate to generate a responsive static site. I simplified the logic by using the DBD::CSV CPAN module that allows querying a directory full of CSV files with a pretty full SQL implementation (including left outer join, which came in handy for eliminating recipes that required uncraftable ingredients), caching in memory for reasonable efficiency. If I wanted to run it frequently, it would be a few seconds work to use SQLite’s built-in CSV import and add a few indexes, but once I got the code working, I only had to run it once. Unless they change things in a future patch, in which case I’ll run it again.

(the most obvious optimization I could add is collapsing adjacent sets of recipes that share several ingredients; they’re separate right now because they’re the result of different point combinations (e.g. 10+2+2+2 and 10+2+2+4 produce the same result, but the fourth ingredient is different)) Done! And I also reduced the output by limiting it to recipes with at least three identical ingredients.

By the way, if you want to hack CSV files this way from the command line, take a look at q, which basically builds an in-memory SQLite DB on the fly as you refer to your data files, with the option of saving it to disk when you’re done. It defaults to assuming headerless space-separated files, so you need the -H -d, options to read CSV. Work is in progress to convert it to a standard Python library that could be used the way I’m using DBD::CSV.

Comments via Isso

Markdown formatting and simple HTML accepted.

Sometimes you have to double-click to enter text in the form (interaction between Isso and Bootstrap?). Tab is more reliable.