Monthly Archives: March 2008

Web stuff: Akismet, JSONP

Posted by daniel.j.gallagher on March 28, 2008
JavaScript, Ranting and Raving / No Comments

Meant to post something about this the other night, when I got distracted by the latest Questionable Content. First, a shout to, which proposes an ad-hoc standard for JSON Padded requests (JSONP). Like most interesting and useful things on the web, it was proposed two years ago, and only now have I run across it in places like the Facebook API docs at

Looking at this, I realized that problem being addressed is exactly the same as one I have wrestled with for some time. Script includes, and JSON metadata in particular, are impeded in terms of usefulness by the difficulty in getting the contents to actually do what you want them to. Pure JSON merely states values, it doesn’t make assignments, necessitating an arbitrary wrapper of some kind that spoon-feeds the data into the page (and is not itself valid JSON). By a similar virtue, JavaScript containing var and function statements can be fruitful, but they all get thrown into the global namespace unless you mask them with a Crockford wrapper or specify an existing object to bind them to. In very few other programming environments do people have to settle for this kind of repetitious nonsense:

mystuff = window.mystuff || {};
mystuff.newmethod = function() {};
mystuff.newclass = {

It’s egregious and disgusting. But for cross-domain applications and quick scripting hacks you usually don’t have much choice.

The beauty of JSONP (which, due to my earliest computer science learnings and my familiarity with the Jargon File, always makes me think JSON predicate (to JSON, or not to JSON?)) is that it allows the browser to continue to interpret JavaScript at this level, while allowing backend services and stored JSON objects to ignore the extra fluff. To supply the fluff, you call a REST-style web service on top of the JSON service you want; and you hand it an extra argument specifying some code to prefix to the response.

I did something very similar once at work, and it seemed pretty slick. This proposal avoids some of the wrinkles, but at the same time I wonder if it might be too simple to capture the power of the idea. Prepending code is very URL-hack-friendly (not a bad thing in this case) but it also feels disorganized. Six months ago I probably wouldn’t have seen anything wrong with it, but here’s the thing. A standard is most useful when it not only does what people need it to do, it suggests its proper place in the scheme of things.

In this case, while it may be cool that you could shove an alert() statement (or whatever the hell else you like) in there before the code runs, chiefly that’s not what it’s for. You prepend so you can assign the returned value somewhere; you wrap so that you can run in a more controlled environment, or supply your object to a function. Basically, any time you want to use something like JSONP you’ll be trying to do one of a short list of things:

  1. Insert debugging statements or package manager callbacks.
  2. Prepare a namespace for a JavaScript “class”, or otherwise assign the received value onto some location.
  3. Call a function that is returned from the server, or call an existing function on data that is returned from the server.
  4. Roll-up a set of JavaScript classes into one request
  5. Something silly.

Given this, I’m not going to try and make a counter-proposal now. But I think this could argue for something slightly larger than JSONP, so that you get to fully harness REST and really get the most out of your stored scripts. It’s something that would be particularly interesting in combination with the class parser idea I suggested earlier–real classes, parsed out by a more robust language like PHP and returned as consistently correct JavaScript that smoothly integrates with the rest of your Ajax code.

Akismet I’ll have to get back to, as I should probably be catching a train nowish. Basically I was really, really confused when I first looked at the user interface, and I’m still not 100% sure I fully grok what it’s doing.

I Heart Hannelore and Soforth

Posted by daniel.j.gallagher on March 28, 2008
Meta-Everything, Yours Truly / 2 Comments

So quaint, so tragically cute. From raging volcanic fury to quiet embarrassment, she does it all. By herself she is arguably enough to make the series worth reading. And of course, she injects much-needed levity into the more gut-wrenching story arcs, like this current one. I am so getting the Hanners shirt when I have a stable address to get it mailed to.

Unrelatedly, I had an awesome interview today (and got to cross the Bunker Hill bridge twice! If I’m going to have a totally suck commute for the next month and a half, it may as well be up I-93). Quiet work on the fiction front continues,  I have a phone interview coming up, and this weekend I’m thinking of being in NYC of all places–woo Story Jam!

Anyway, bedtime.

Exercise: Development of a bourbon marinade

Posted by daniel.j.gallagher on March 18, 2008
Discoveries, Food and Drink / 2 Comments


Why Was There Bacon in the Pancake?

Posted by daniel.j.gallagher on March 13, 2008
Creative, Food and Drink / No Comments

Okay, so I’ve been saying for a while now that one of these days I was going to whip up some okonomiyaki, and l finally did. Furthermore, I did it all by myself. It was forgivingly easy–Ginneh said, “If you can make pancakes, you can make okonomiyaki”, and I said, “hmm. I think I can make pancakes…”

Anyway, the basic formula: 3/4 c. water to 1 egg to 1 c. white flour to about 1 and 1/2 c. (something like an eighth of a head) of thinly slivered cabbage. This makes enough batter for two monster patties at about 1 and 1/2 cup each; 1/2 cup patties are much more sharable and of course easier to flip on the stove.

For each large patty or pair of small patties, you throw a serving of meat on the pan. Then pour the batter, divide the meat and set it on top. Cook, flip, cook, flip, garnish, serve. Bam. The hardest part of the whole thing is slicing the cabbage.

Part of what makes this so easy is that it requires very little lubrication to keep the yaki from sticking to the pan (something to do with the cabbage? I dunno), most of which is provided automatically when you add meat. I used bacon, and a bit of sesame oil to add flavor and reduce mess, but you can substitute pretty much anything that will lie down – steak-ums are very effective – or vegetables, or nothing at all. Also helpful is the simplicity of the recipe. We make a fairly plain-Jane form of okonomiyaki around here; one site suggests combining one or more of the following toppings:

  • chicken
  • pork
  • beef
  • tako (octopus)
  • calamari (squid)
  • mushrooms
  • onion

And that’s without even getting into the more delicate, garnishing elements like ginger and dried fish flakes. Its capacity for elaborate toppings would appear to be the reason people sometimes transliterate okonomiyaki as “pizza” rather than “pancake” (more literally it’s “whatever you like, grilled”). I imagine pepperoni would make for a neat twist.

Since I don’t go for much of the more complicated stuff, the only really hard to come by ingredients are the sauces. You could almost get by on barbecue sauce and mayo, but I’m not sure I’d try. Even plain, okonomiyaki is something of a radical taste experience for the American palette. And since everything else is inexpensive stock ingredients, and a single cabbage can feed an army, the whole thing winds up being very cost-effective.

Caveat Venditor

Posted by daniel.j.gallagher on March 06, 2008
Ranting and Raving, Yours Truly / No Comments

Today I was awakened by the shrill cries of buzzards–buzzards determined not to let me oversleep my alarm. Around 11, I gave up the struggle and came to. There is a Monster at my doorstep, and I am just a wee bit terrified. How did I unleash this thing?

There’s a notice on the front page of my site, entitled “Caveat Venditor”. It’s a harmless bit of legalese (harmless because it is in fact impotent, utter hyperbole); the title means “let the seller beware”. I happen to like this notion, because it implies that corporations must answer to the individuals they sell to, not the other way around.

In this case however, the seller is me, and the buyers are IT recruiters, and I am responsible for sifting out the wheat from the chaff. In response, I have tuned my resume settings Way The Fuck Down. Sharing the cell was a largish mistake.