How to get specific submitted feeds' statuses with Amazon AWS and the GetFeedsSubmissionList

1720 days ago

So I’ve been working a lot with Amazon MWS lately. Amazon obviously made a better than usual effort at documenting their API, but very often the simplest task is the most difficult to figure out. This is one of those times.

In this case I needed/wanted to get the status of several submitted feeds in one GetFeedsSubmissionList call. You won’t find an example of how to do this in their documentation or in the Samples sub-directory of the PHP client library I used. The phpDocumentor comments in the library are helpful occasionally, but not in this situation.

After some gnashing of teeth I figured out you can do this by passing an array of FeedSubmissionIds in the associative array you pass to the MarketplaceWebService_Model_GetFeedSubmissionListRequest constructor, e.g.:

  $parameters = array (
    'Merchant' => MERCHANT_ID, 
    'FeedSubmissionIdList' => array(
      'Id' => array([FeedSubmissionIdList 1], ... [FeedSubmissionIdList n]),

 $request = new MarketplaceWebService_Model_GetFeedSubmissionListRequest($parameters);

So I’m putting it out there to save someone else the time it takes to figure this out. I put this on their forum, too. Only time can tell which Google favors/is most visible.


Vote for Shakespeares in Good Morning America's "Best Bites: College Edition"!

2348 days ago

Good Morning America has Shakespeare’s Pizza up for best college eatery! Read more:

You know you've been there. You know you liked it. Vote for it right here!

Good luck, Shakes!


Keyboard navigation using MooTools and jQuery

2379 days ago

One of my favorite easter eggs in blogs and page content is when the arrow keys produce the same effect as clicking on the next or previous link/button/slider/widget/doodad (such as the Huffington Post's load-on-demand picture slider in the silly article Top 10 Party Schools). Here's a great article by Remy Sharp about using the arrow keys to control a slider. But because I don’t see this behavior enough, here’s how you could go about it:

  1. Give your “next” and “previous” links unique IDs.
  2. Add a handler to the document that listens for keydown events.

Super simple.

An example using MooTools:

Give your previous-page link an ID of “pnav_prev” and the next-page link an ID of “pnav_next”. Then at some point after the DOM has finished loading, add this JavaScript:

// listen for left & right arrows
document.addEvent('keydown', function(e) {
        // left = prev
	if (e.code == '37') location.href=$('pnav_prev')['href'];

	// right = next
	if (e.code == '39') location.href=$('pnav_next')['href'];

In jQuery:

Doing this is jQuery would be nearly (though not exactly) the same thing:

// listen for left & right arrows
$(document).keydown(function (e) {
  // left = prev
  if (e.keyCode == '37') location.href = $('#pnav_prev')[0]['href'];

  // right = next
  if (e.keyCode == '39') location.href = $('#pnav_next')[0]['href'];

As a matter of fact, that's the exact code this site's using (more or less: I decided to select the link based on its rel attribute).

You may be wondering why I’m choosing to fiddle with setting the [window.]location instead of just triggering the link’s click event. In jQuery at least, $('#pnav_next').click() simply won’t work. $('#pnav_next').trigger('click') works if you set up a click handler first (what I’ll call the bind-and-trigger method). For simple press-right-goto-next-article behavior, this would be overkill. If there were a stack of click events on that link that needed to be fired, using that method would be worth it.

FYI: using the arrow keys this way could have negative consequences. For instance: if the page had a form with radio buttons and/or checkboxes, this would definitely be undesirable behavior. And how would you handle the scenario in which you have a multi-page article? And so forth.

I couldn't find any instances of sites using this in for next/previous links, but I'm positive they're out there. Let me know if you find them. In the meantime, consider using this technique in your own projects. It's not rocket science, and I for one would appreciate it!

Comment [1]

JavaScript Frame Buster

2877 days ago

There are a number of reasons you would want to prevent your page or site’s contents to be contained within a frame or iframe:

  • you might have problems with someone using your content on their site
  • security concerns
  • controlling your site’s functionality and/or presentation

This small bit of code somewhere within your HTML documents will detect whether or not it’s been loaded into a frame and, if so, will “bust” out of the frame by loading the page in the main window.

<script type="text/javascript">
if (top != self) {
	top.location.href = self.location.href; 
// ]]>

This is not a security panacea, and there are ways around it. But it is a quick and easy way of preventing a third party from doing something silly with your site.


NASA totally needs to hire me

2898 days ago

The Hubble telescope came up at work today, no doubt because it’s been in the news so much lately. I totally guessed (in an educated manner) how you’d go about pointing it at something, and I was right. Aiming and figuring out what direction to point is done by holding a reference to relatively fixed (read: extremely distant) astronomical objects, rotational stability is provided through the combined use of gyroscopes & wheels (& software). Yay, Team Me!

Self-satisfied? Yes. Impressed with my memory and understanding of physics? Absolutely. Important to anyone else? Not so much.


Google throws its weight around, only more so, with Chrome

3016 days ago
Google Chrome
Google Chrome

Well, I guess I’m excited. Google has inserted itself into the browser wars with Chrome. They’re making some huge claims (from a nitpicky webnerd and JavaScript programming point of view), so if nothing else I’ll be interested in seeing how well they follow through. It’s eye-catching press release features: privacy privacy privacy, anti-hack/-phish(/-hish?) blacklist and “omnibox” features, multithreading, running different tabs in a sandbox, and hyper-fast JavaScript.

Download it (if you can – it was unavailable as of noon my time) here. Good luck downloading it behind a firewall.

Since it’s open source, will everyone benefit? Let us pray. Or Slashdot.

9/12/08 Update

still no love if you’re behind a firewall

Google persists in using their stupid distribution scheme for installing Chrome. People are still experiencing problems trying to install behind a firewall.

1/21/08 Update

love ensues

Some nice people at Googly finally decided to offer a standalone version. Bad news is it won’t update.

6/18/09 Update

they got it

Chrome is now a managed download, so everything works fine. Thanks, Google!


Figleaf is in the wild

3248 days ago
Figleaf thumbnail

I just finished up Figleaf: one way to go about placing an overlay on top of any Flash movies on a page. Check it out, and please tell me what you think about it. It’s well-done and works most of the time.


So I kinda like Twitter

3291 days ago
twitter bird logo/icon

As you can see, I’m not by any means a regular blogger. I just don’t have that much to say about [stuff] that I care to cast in digital stone. To both paraphrase and mangle Ralph Waldo Emerson, my opinions are like the cells of my body: constantly in a state of flux. And like my body, although there’s plenty going on inside, the outside appears (relatively) the same.

Wow, that sounds pretty pretentious.

Which is to say that I don’t want the me of today to be held to the utterances of the me of yesterday. If I wanted that, I’d write a book. Or rather, I’d publish the book I’ve written. Working title: “Huh?”

Digression over.

Twitter – although terminally cute & hip & decidedly web2.0-ey – is the perfect solution for people like me (and we are legion) who want to throw shout-outs to the masses, but can’t be bothered to sit down and think about how we want to say it.

Another thing I like about Twitter is it’s decidedly post-literate. That whole capitalization & punctuation thing is so 20th century, dude. Thankfully, I’ve witnessed no leetspeak to date.

Join the sweaty, texting masses. I ain’t no fanboy, but I like it. Next passing fancy: Sched.

Comment [2]

new domain, other changes a-comin'

3371 days ago
Fred G. Sanford, my idol

I finally retired my old domain, Long may it live. The new one, obviously, is

Why, you ask?

Several reasons, none of them particularly good. First and foremost, I go by “Garvin”. Oh, I have other nicknames, but that’s the one I actually pay attention to.

Most importantly, though, is that Garvin G. Garvin is sort of an alias. I’m also thinking of having my name legally changed to it. I like the ring of it, especially the vestigial middle initial. It’s all Fred G. “for Georgeous” Sanford.

Oh, but that’s not all

Along with the domain name, I grow weary of the look of this site. I’m glad I made the switch to Textpattern, but having done so just made me rather loath the way this thing looks. It’s not bad, just kind of dated & out of it. And this must not be.

So I’ll give you peeks and updates as I mosey along in my new design. It’ll probably be a few months in coming, as I’m in no particular rush. Time will tell.


Textpattern + some plugins = broken feed

3421 days ago
broken feed

I’ve read quite a bit about Textpattern’s annoying habit of creating RSS/Atom feeds that browsers download instead of display, because I’m relatively new to Textpattern and was experiencing the same problem. It turns out that the problem is in the plugins, kids. I’m sure a lot of you already figured this out, but knowledge unshared is only useful to one person. So I shall share my (mercifully brief) RSS odyssey.

broken how?

First off, I think I should define the problem before I explain my solution.

The feeds that are generated by Textpattern “out of the box” are of the MIME types “application/atom+xml” and “application/rss+xml” (depending). These feeds work fine and dandy right after you’ve successfully installed Textpattern. Take a closer look at the source of one of these feeds. The very first line should look something like:

<?xml version="1.0" encoding="utf-8"?>

Note that the “<” in “<?xml” should be the first character in the file.

Now take a broken feed – one which you’re prompted to download instead of your browser displaying it (as is normally & should be the case, barring plugins, XML handling app’s, etc). Since I’ve already primed you on what to look for, you’ll notice that there is a space just before the XML declaration.

blame yourself

As I said, I’m new to txp. So naturally my first thought was that one of the custom plugins I’d written for my site was the culprit. At the time I had them in a ‘plugins’ directory, so I simply removed them, then removed all mention of my custom tags from all pages and forms. ‘Went to my feed: same thing. Stupid space.

blame the Maker(s)

So being the PHP dork that I am, I decided that the problem must be in the Textpattern code itself. My reasoning was thus: I haven’t done anything truly earthshattering with my Textpattern install, and there was hardly anything worth finding in the Textpattern forum, to say nothing of their FAQ. There are two unhelpful FAQ entries related to feeds, but they weren’t very helpful and were written in a decidedly angry/defensive tone (and have perhaps unintentional factual errors):

I’ve tweaked quite a few open source projects over the years, so I dug through an entire trace of what goes into the serving of an RSS or Atom feed in Textpattern. What a magical odyssey that was. But to no avail: there was nothing I could find that would directly and obviously cause that damnable space. Does PHP’s eval function have a tendency to insert spaces? Not if the code being eval’d doesn’t, as far as I know.

blame others

So if Textpattern wasn’t to blame (at least not directly), and I wasn’t to blame, chances were that one of those dang plugins was doing it. And it was, though for the life of me I don’t know why. It happened to be the cbs_article_index that i had in my plugin cache directory in this case, but as it seems so many people have had an issue with Textpattern’s default feeds, I seriously doubt it’s just this plugin that’s the problem.

When in doubt, hack.

But this is where open source kicks gluteous. Good ol’ Noam Samuel has published a handy, dandy Textpattern feed hack. It’s specifically for RSS. Does anyone know if will work for the Atom feed, too? I sure don’t.


After some tinkering, I finally found the problem. The issue has to do with plugins in your plugin cache folder (commonly, textpattern/plugins).

For whatever reason, a space after the “?>” (end of PHP) ending or after any newline (\n) after the “?>” is resulting in a space being inserted before the intended first character of Textpattern output. So: the solution is to make absotively, posolutely sure that there is nothing after the plugin’s “?>” ending.

It seems that there’s a need for some clarification by Textpattern regarding best practices with plugins.

At any rate, I hope that this helps someone out there, and that some bright spark can figure out exactly what and where this is breaking. Happy blogging.

12/14/07 Update


That was fast. I put it on the Textpattern Forum (log in/register first to be able to see it) once I’d gotten it all figured out, and wet kindly fixed it within… minutes, seemingly. Squeaky wheel gets greased I guess.

Comment [1]

Valid XHTML 1.1 Valid CSS
             © 2008, garvin