1. Aug 17th, 2007

    One line publishing

    why, 1-liners are crucial:

    I’m not suggesting that one-liners are the heart of all programming. But they can be the hook to get someone exploring. A single line of code simply shows that a language can be focused. And it lets a beginner get comfortable with the basic atoms.

    Publishing a blog post using SPP:

    curl -d title=HAI!&content=I+has+SPP&status=published https://labotes.org/publish [authentication]

    I submit as evidence that any request you cannot illustrate with a one-liner curl is indistinguishable from SOAP.

    1. Aug 17th, 2007

      sujal

      Great point. Love the illustration, and that’s why I love REST-like (though GET/POST only) web services like Amazons.

      (how come you can’t beat the comment spam with Spam Karma or Akismet?)

    2. Aug 17th, 2007

      Assaf

      I use Akismet and it works wonders, except for the occasional hiccups. I guess I should take the plunge and de-moderate comments.

    3. Aug 17th, 2007

      http://technorati.com/people/technorati/ryansking

      s/cotent/content/

    4. Aug 17th, 2007

      Assaf

      :w

    5. Aug 22nd, 2007

      Aristotle

      You can write Atompub POSTs with a curl one-liner too. The line will just be a little longer. :-)

      Of course, that ignores hypermedia, and hence it’s impossible to decide whether the protocol demonstrated by a curl one-liner uses HTTP merely as a transport or in fact as the application protocol.

    6. Aug 22nd, 2007

      Assaf

      I’d like to see that one-liner, though I’ll need a 40″ monitor and very narrow font to fit it all in one line :-)

    7. Aug 23rd, 2007

      Aristotle

      Actually with an 8px font on my 1400×1050 screen (regular 20″ TFT), it fits on a single line:

      curl -H 'Content-Type: application/atom+xml;type=entry' \
      --data-binary 'HAI!I has APPurn:null:"'$(date -Is)"'' \
      https://labotes.org/publish

      So nyah. Now use some real text with actual HTML tags in the content instead of just 12 characters of filler total and we’ll see how much contrast remains.

      Or how about uploading a picture:

      curl -H 'Content-Type: image/jpeg' --data-binary @inurprotocolz.jpg https://labotes.org/publish

      That’s actually shorter! Errm, oops, I forgot SPP can’t even do that. :-)

    8. Aug 23rd, 2007

      Aristotle

      Err, d’oh, I forgot to escape the angle brackets:

      curl -H 'Content-Type: application/atom+xml;type=entry' \
      --data-binary '<entry xmlns="http://www.w3.org/2005/Atom"><title>HAI!</title><content>I has APP</content><id>urn:null:</id><updated>"'$(date -Is)"'</updated></entry>' \
      https://labotes.org/publish

    9. Aug 23rd, 2007

      Assaf

      Generally speaking, Web browsers wouldn’t have a problem uploading images to SPP using multipart/form-data. To get the same effect using curl:

      curl -F ‘content=@inurprotocolz.jpg;type=image/jpg’

      I much prefer image/png, but otherwise looks fine to me :-)

    Your comment, here ⇓

    Or using OpenID