HOWTO: configure MarsEdit or TextMate’s Blogging Bundle to work with Drupal

If you use third-party blogging software (such as MarsEdit), you may have some trouble configuring that client to work out of the box with Drupal.

See, Drupal 6.12 comes with the handy “Blog API” module: it gives your Drupal site an XML-RPC interface. In english, that means that you can post content to a Drupal-based website using client software such as TextMate and MarsEdit. This is nice.

So, assuming http://example.com/ is your drupal install, you can feed an URL of http://example.com/xmlrpc.php to MarsEdit, and happily post and edit content to Drupal. And bunnies and squirrels will dance around the meadow in joy and fling flowers in the air.

Yes.

Well.

In theory, there should be no difference between theory and practice. In practice, there will be.

HOWTO: make Drupal work with MarsEdit

MarsEdit is pretty easy to set up, but there’s one minor hiccup, caused by a bug in Drupal’s blogAPI module. Here’s a quick run through the setup process:

Let’s add your blog to MarsEdit. Select New Weblog... from the File menu. A friendly window appears: “Tell us about your weblog”. Go ahead and plug in the base URL of your drupal site. If the autodiscovery bug I mentioned has not been patched, then you will get a dialog that says, in effect, “I am a stupid computer and cannot figure this out, so you will have to do it for me”. If you don’t get this message, then the bug has been fixed. Hooray!

Otherwise click Edit Settings and you will be presented with a dialog box like the following:

Screen capture of MarsEdit dialog box

I’ve selected most of the (likely) correct options in this box, but notice the field labeled Blog ID: (helpfully highlighted above). This is where you have to check your settings in Drupal, because you have to choose the type of content you will be submitting via your client.

Drupal allows the definition and creation of different content types. You get to them via the administrative menu, under Administer > Content management > Content types. (This should have the path of http://example.com/admin/content/types in your browser address bar.)

For example, you can see that my site currently has two content types: blog and page:

Screen capture of drupal config showing the blog and page content types

You’ll notice that the blog type has the Name Blog Entry, and the Type blog.

The type is your Blog ID for MarsEdit.

If you want to create pages of that type with MarsEdit, you want to put blog in to the field marked Blog ID. If you created a custom content type named Wiki Notes with the type wiki, and you want to post those notes using MarsEdit, you want to enter wiki in that field.

And that should work.

Hooray.

HOWTO: make Drupal work with TextMate

The TextMate Blogging Bundle provides a sparse (but pleasant to use) interface for the creation and editing of blog entries directly inside the text editor. I’m using it right now to compose this post.

Sadly, when I tried to access the drupal blogAPI from it, Drupal threw an error: Blog API module is not configured to support the 0 content type

Hmm.

Okay, so content type is basically the blog_id in XML-RPC terms. So I guessed that TextMate wasn’t specifying the blog ID, and was passing the default value (which I know from past, painful experience is 0). So I had to configure TextMate to specify that blog ID value somewhere. But where?

The TextMate Blogging Bundle invokes a ruby script, [$TM_BUNDLE_PATH]/lib/blogging.rb, which parses a file called com.macromates.textmate.blogging.txt. Here, with URLs obfuscated, is mine:

  # List of Blogs
  #
  # Enter a blog name followed by the endpoint URL
  #
  # Blog Name         URL
  Paper Bits          http://some_path_to_wordpress_stuff
  Drupal Blog         http://www.example.com/xmlrpc.php#blog

See that bit on the end of the Drupal Blog line? The #blog? That’s where the magic lives.

Translation: To get TextMate working with Drupal’s blogAPI module, put a #typename at the end of the XML-RPC URL.

If your content type is wiki, then you want http://www.example.com/xmlrpc.php#wiki under URL.

And that’s it.

What’s happening here?

In case you care, I found this by digging into the [$TM_BUNDLE_PATH]/lib/metaweblog.rb and [$TM_BUNDLE_PATH]/lib/blogging.rb scripts.

In metaweblog.rb the methods all require a blog_id to be passed along with the method call. An example:

  def get_recent_posts(blog_id, username, password, number)
    call("metaWeblog.getRecentPosts", "#{blog_id}", "#{username}", "#{password}", number)
  end

Okay, so, let’s do a search in blogging.rb for the variable blog_id. We find a method called parse_endpoint which features the following:

  def parse_endpoint
    # we have an endpoint that looks like a URL
    [...]
    # guess the mode based on the endpoint path
    [...]

    if @endpoint =~ /#(.+)/
      @blog_id = $1
    else
      @blog_id = "0"
    end
  end

Aha. That’s a regular expression. It’s looking for #something at the end of the URL, and setting that as blog_id. And if it doesn’t? It sets “0″. Which is the offending element from my rogue error message.

So, I made a guess, and it worked.

Hot damn.

Moral of the story

This post began as a plea for help to the lazyweb. I had solved the MarsEdit problem (it was a simple matter of a single Google search), but couldn’t manage to get TextMate running.

In order to write this post, I had to explain my problem with TextMate in a clear and concise manner to an educated but unfamiliar audience. Which meant thinking along lines like, “well, they’re probably going to ask me if I looked to see if TextMate submits a blog ID like MarsEdit. I wonder where that would be kept?”

Eventually, I solved my own problem.

I hope that the next time someone else has the same problem, the great Google technical support repository pops this article up for them, and saves them some time and pain. If that’s you, then excellent.

If you’re still having trouble, try writing an email to the smartest person you know. You might end up solving it yourself.

Good luck.

Posted in General | Tagged , , , , | Leave a comment
  • Links of interest

    • camen design · Video for Everybody! 4 hours ago
      Pure HTML5 code, with no javascript, which will serve Ogg to Firefox/Opera, etc., H.264 to Safari, and flash to the brain damaged.
    • Using Wikis to Document UI Specifications - Boxes and Arrows: The design behind the design 2009/06/30
      "Many claim that agile methodologies help companies increase revenue, reduce costs, improve quality, ensure compliance, and drive innovation throughout the product lifecycle. As designers, we often find ourselves working with teams that are using agile processes. I propose that the UI spec is best documented through a wiki when working in such an environment. This method is both adaptive and sufficient for teams building and delivering products, and helps to foster the collaboration that agile development requires. Problems with traditional UI specs include the following:"
    • reacTIVision 2009/06/30
      "reacTIVision is an open source, cross-platform computer vision framework for the fast and robust tracking of fiducial markers attached onto physical objects, as well as for multi-touch finger tracking. It was mainly designed as a toolkit for the rapid development of table-based tangible user interfaces (TUI) and multi-touch interactive surfaces. This framework has been developed by Martin Kaltenbrunner and Ross Bencina at the Music Technology Group at the Universitat Pompeu Fabra in Barcelona, Spain as part of the reacTable project, a novel electronic music instrument with a table-top multi-touch tangible user interface. Currently this project is developed within the new spin-off company Reactable Systems where we will continue this software as an open source project, but where we will be also able to offer additional services around the creation of tangible interfaces based on our software framework.
    • Multiclutch - map custom gestures to multitouch trackpads 2009/06/30
      When I was doing tech support, I was asked many times: how do you create custom multi-touch gestures? How do you disable the ones you don't want? Here you go.
    • CocoaHeads Apr 23, Wil Shipley on iPhone on Vimeo 2009/06/28
    • Git on Shared Accelerators [Joyent Wiki] 2009/06/26
      I really should have read this more carefully.
    • Zappos.com Favorites 2009/06/25
      Shoes I wish to have, but have not yet splurged on.
    • Amazon.com: Portable Plexi Cliffhanger Parts List for Trackmate 2009/06/24
      The simplest setup for Trackmate requires a few minor components. Adam Kumpf has thoughtfully created an amazon list to purchase them in one place.
    • webERP: webERP API 2009/06/19
      webERP uses the XML-RPC API. This makes things easier…
    • periodic table of controllers 2009/06/19
    • Pitchfork: Mos Def's New Album Available as T-Shirt 2009/06/18
      "Here's a new one: Mos Def's BNM'ed new album The Ecstatic is available as a T-shirt. As in: You can buy a shirt that has The Ecstatic's Killer of Sheep-interpolating cover art on the front, its tracklist on the back, and a download code for the album on a hang tag."
    • Video: SPRXmobile's Layar is world's first Augmented Reality browser for cellphones 2009/06/18
      A magic lens for AR data. On Android, coming to iPhone 3G S and others soon.
    • Miso - Omkrets arkitektur: Typografi 2009/06/17
      Lovely sans-serif typeface. The example graphic shows a circuit board, and it would look really nice on a custom PCB.
    • Anonymous Pro 2009/06/17
      True-type font for programming. May compete with Inconsolata for my monospace typeface of choice.
    • Carl Linnaeus Invented The Index Card 2009/06/16
      "ScienceDaily (June 16, 2009) — Carl Linnaeus is most famous as the father of modern taxonomy. What’s not so well known is that in his effort to manage vast amounts of data, he came up with a revolutionary invention: the index card."

Matt Jones - The New Negroponte Switch

The new Negroponte switch

[T]he technologies of rapid fabrication and pervasive networks are allowing the tangible and intangible to switch places and mingle.

The above quote is from this slide deck from Matt Jones, which you will read now.

Really. Go:

Posted in Photo Cards | Tagged , , , | Comments closed

Stuff on my desk…


Stuff on my desk…, originally uploaded by jazzmasterson.

Playing with automatic post-to-blog from my camera.

The eye-fi is just a bit clumsy when it comes to posting here…

Posted in General | Comments closed

Woodchucks need not apply

I just unearthed a digest from the Internet Oracle while digging through some old text files. Turns out, the oracle still exists. Who knew?

From the digest:

Date: Fri, 24 Jan 97 16:59:10 -0500  
From: Internet Oracle <oracle-vote@cs.indiana.edu>  
Subject: Internet Oracularity #881-09  

Selected-By: Scott Forbes <trans@lucent.com>

The Internet Oracle has pondered your question deeply.
Your question was:

> Oracle, knower or all, master of the internet, please elucidate:
>  
> What is the best way to catch microfiche?

And in response, thus spake the Oracle:

} In a neural net.  
}  
} You owe the Oracle some sea monkeys.

(drumsting)

Warning: Rose-colored glasses may be required to view this content properly.

Posted in General | Tagged | Comments closed

Quote: Richard W. Pew, 10/05/2005

“Design is the successive application of constraints until only a unique product is left.”

From The Design of Everyday Things, by Don Norman.

I’m pulling my notebook out of storage, so that I can store it in a way that’s easier to access.

Without access to large walls with homosote mounted on them, the card notebook is moving into a library card catalog tray. And it’s going online, as well.

For now, I’m going to be uploading the photos here to Flickr using the Eye-Fi chip in my camera, and blogging some of them to this blog.

More interesting things may follow, but for now, I’m spending a lot of time looking back through a massive sketchbook that’s been shuffled into chaos. So that’s where I am, if anyone wonders.

Posted in General | Comments closed

Who Watches the Watchman?

Christopher Fahey:

From a behavioral perspective, I find the watchclock fascinating not simply because it’s a kind of steampunk GPS, a wind-up mechanical location-awareness technology. I’m further fascinated at how this holistic system of watchclocks, keys, guards, and supervisors succeeded so completely in creating a method of behavioral control such that a human being’s movements can be precisely planned and executed, hour after hour and night after night, with such a high degree of reliability that almost a century goes by before anyone thinks of ways of improving the system as originally conceived. The watchclock is a primitive form of technology-mediated interaction design and narrowly-focused social engineering: The “interface” is the whole system: The watchclock, keys, and paper records.

Posted in links | Tagged , | Comments closed

Rands In Repose: Keynote Kung-fu Two

Rands:

The rule is: if you’re starting a presentation by endlessly fussing with your presentation design, you probably don’t have anything to say.

Also see: Keynote Kung-Fu.

Posted in links | Tagged , | Comments closed

Hivelogic - ExpressionEngine: The Details

Dan Benjamin:

The Path is not difficult for those who have no preferences.

Letting go of how you believe things should be is the hardest part of learning.

Posted in links | Tagged , , , | Comments closed

Matt Jones and TheIncidental

A palimpsest for a place: TheIncidental at Salone Di Mobile 2009:

One thing that’s very interesting to me is using this rapidly-produced thing then becomes a ’social object’: creating conversations, collecting scribbles, instigating adventures - which then get collected and redistributed. A feedback loop made out of paper, in a place.

(Via Warren Ellis.)

Posted in General | Tagged , | Comments closed

The little green dot says…


The little green dot says…, originally uploaded by jazzmasterson.

Looking forward to the first thunderstorm of the year.

Twitter says it’s a relatively heavy one. Let’s see.

Posted in General | Comments closed
  • Flickr photostream

    The new Negroponte switch

    Stuff on my desk…

    Note: Tiny bits of friction

    "Business Acumen" from "What the CEO Wants You To Know", 2005

    Quote: Paul Sappho, 10/05/2005