<?xml-stylesheet href="/nb//resources/xsl/rss2.xsl" type="text/xsl"?>
<rss version="2.0"
xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule">
 <channel>
  <title>News You Can Bruise</title>
  <link>http://www.crummy.com/</link>
  <description>Your chicken, your egg, your problem</description>
<creativeCommons:license>http://creativecommons.org/licenses/by-sa/2.0/</creativeCommons:license>
  <image>
   <url>http://www.harihareswara.net/nb/resources/img/export.png</url>
   <title>News You Can Bruise</title>
   <link>http://www.crummy.com/</link>
  </image>
  <managingEditor>leonardr@segfault.org (Leonard Richardson)</managingEditor>
  <language>en-us</language>
  <docs>http://backend.userland.com/rss</docs>
  <lastBuildDate>Thu, 18 Mar 2010 01:24:52 GMT</lastBuildDate>
<item>
 <title>Alternate ETag Validation Functions</title>
 <description>Yes, months after driving away everyone who read this weblog hoping I would talk about RESTful topics, here's some REST stuff. This is an idea I got from my co-worker Bj&amp;ouml;rn Tillenius. I hope someone else has come up with the same idea and given it a better name. 

&lt;p&gt;Here's the problem, on a high level of abstraction. Consider a representation (#1):

&lt;blockquote&gt;
&amp;lt;p id="1"&amp;gt;Forklift&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class="read-only" id="2"&amp;gt;Green&amp;lt;/p&amp;gt;
&lt;/blockquote&gt;

&lt;p&gt;And let's say the ETag of this representation is the string "x".

&lt;p&gt;According to the protocol governing this media type, you can modify the text in any paragraph unless its class is "read-only". So maybe you can PUT a document like this (#2):

&lt;blockquote&gt;
&amp;lt;p id="1"&amp;gt;Hovercraft&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class="read-only" id="2"&amp;gt;Green&amp;lt;/p&amp;gt;
&lt;/blockquote&gt;

&lt;p&gt;Or PATCH a document like this (#3):

&lt;blockquote&gt;
&amp;lt;p id="1"&amp;gt;Hovercraft&amp;lt;/p&amp;gt;
&lt;/blockquote&gt;

&lt;p&gt;OK, that's easy. Now suppose that the read-only text changes randomly according to conditions on the server. Let's say the read-only text suddenly changes from "Green" to "Red". If I were to GET the document again, I'd get this document (#4):

&lt;blockquote&gt;
&amp;lt;p id="1"&amp;gt;Forklift&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class="read-only" id="2"&amp;gt;Red&amp;lt;/p&amp;gt;
&lt;/blockquote&gt;

&lt;p&gt;And let's say the ETag of this document is "y". If I sent a conditional GET with an If-None-Match of "x", I'd get 200 and a new representation instead of 304 ("Not Modified").

&lt;p&gt;OK, but I don't send a conditional GET. I don't get the document again at all. Instead, I PUT document #2, with an If-Match of "x", and the request fails with 412 ("Precondition Failed"). Maybe it should fail anyway; maybe the server is very strict and thinks I'm trying to change a read-only paragraph from "Red" to "Green", which would probably be 400 ("Bad Request"). But we don't even get to that point because the ETags don't match.

&lt;p&gt;The request also fails with 412 if I PATCH document #3 with an If-Match of "x". But there's nothing &lt;i&gt;really&lt;/i&gt; wrong with that request. The point of If-Match in conditional writes is to avoid conflicts with other clients, and there are no other clients here.
The ETag is different because a read-only paragraph changed on the server side. 

&lt;p&gt;One obvious solution is to calculate the ETag only from the read-write portion of the document. This fixes conditional writes, but it breaks conditional reads. A client that requests document 1 and then makes conditional requests will never get document 4. The ETag is no longer a strong validator (update: actually, it's not any kind of validator); the document might change significantly without the ETag changing. So that's no good.

&lt;p&gt;The solution Bj&amp;ouml;rn came up with is to split the ETag into two parts. The first part is derived from the read-only portions of the document, and the second part is derived from the read-write portions. The ETag is a totally opaque string to the client, but the server knows what it means. On a conditional read, the server checks the entire ETag. On a conditional write, the server only checks the second half.

&lt;p&gt;In this example, the ETag for document #1 might be "1.a" and the ETag for document #4 might be "2.a". A conditional GET of document #4 with If-None-Match="1.a" would fail, but a conditional write with If-Match="1.a" would succeed. When the write went through, the document's ETag would change to "2.b", and "1.a" would not be good for either conditional reads or writes.

&lt;p&gt;From the client's perspective everything just works: your conditional read returns 200 iff the representation has changed, and your conditional write returns 412 iff someone else is messing with the resource. But is this okay from a standards perspective? Section 13.3.3 of RFC 2616 says "The only function that the HTTP/1.1 protocol defines on [ETags] is comparison." That doesn't seem to prohibit me from defining another one.

&lt;p&gt;If "x" is a strong validator then so is "1.a", but the new comparison function ignores some of its information about the resource state, effectively treating it as a weak validator (update: or as something that's not a validator at all). Is that okay? Would you believe the following definition of a strong validation function? "In order to be considered equal, &lt;i&gt;the second halves of&lt;/i&gt; both validators MUST be identical in every way, and both MUST NOT be weak." (cf 13.3.3 again)

&lt;p&gt;I'm interested in your thoughts on this. Smartass comments like "you should have two resources" will not be dismissed out-of-hand but also will probably not convince me. If you're curious, here's &lt;a href="https://bugs.edge.launchpad.net/lazr.restful/+bug/336866"&gt;the real-life bug&lt;/a&gt; that spawned this thinking.</description>
 <pubDate>Thu, 18 Mar 2010 01:24:52 GMT</pubDate>
 <category domain="http://www.harihareswara.net/nb/nb.cgi/category/nycb/">rest</category>
 <guid isPermaLink="true">http://www.harihareswara.net/2010/03/17/0</guid>
</item>
<item>
 <description>Speaking of Evan, he's started a new weblog, &lt;a href="http://walltype.com/"&gt;walltype&lt;/a&gt;, where he curates photos from Flickr that fit his own baroque categorizations. I think it has explodingdog-esque potential.

&lt;p&gt;Speaking of new weblogs by my friends: Pat Rafferty's &lt;a href="http://raffertyesque.com/"&gt;Raffertyesque&lt;/a&gt;. Now you have something to read while you look at Evan's curated pictures.</description>
 <pubDate>Mon, 15 Mar 2010 02:34:22 GMT</pubDate>
 <category domain="http://www.harihareswara.net/nb/nb.cgi/category/nycb/">weblogs</category>
 <guid isPermaLink="true">http://www.harihareswara.net/2010/03/14/0</guid>
</item>
<item>
 <description>Evan: "You really need to watch &lt;i&gt;Summer School&lt;/i&gt; on the original rental VHS. It's like listening to the Beatles on LP."</description>
 <pubDate>Sat, 13 Mar 2010 17:29:40 GMT</pubDate>
 <category domain="http://www.harihareswara.net/nb/nb.cgi/category/nycb/">film</category>
 <guid isPermaLink="true">http://www.harihareswara.net/2010/03/13/0</guid>
</item>
<item>
 <title>The Long Joke</title>
 <description>&lt;img src="http://www.harihareswara.net/graphics/nycb/2010/03/whee.jpg" align="right"&gt;
In 2001 my sister Susanna &lt;A href="http://www.harihareswara.net/2001/07/09/2"&gt;sent me the birthday card you see before you&lt;/a&gt;. It said "Whee! You're &lt;strike&gt;3&lt;/strike&gt; 22!" I thought this was hilarious, and I kept the card.

&lt;p&gt;Then Susanna had a daughter, and I had an idea. Recently Maggie turned three, and I &lt;a href="http://swishina.blogspot.com/2010/03/whee-youre-3.html"&gt;gave my niece the birthday card&lt;/a&gt; Susanna had sent me eight years earlier. "Whee! You're &lt;strike&gt;3&lt;/strike&gt; &lt;strike&gt;22&lt;/strike&gt; 3!" The payoff was worth it. "I laughed for like 5 minutes," said Susanna.

&lt;p&gt;Recently I was doing a video chat with Susanna and I mentioned:

&lt;blockquote&gt;
&lt;p&gt;L: So I'm jogging for an hour every day, and I realized I wasn't doing enough reading, so I decided I also needed to read for half an hour every day. And I also want to devote half an hour to games, though that's not as much of a problem. And I think I should also allocate at least half an hour for writing. But if I keep dividing up my free time like this then my whole life will be...

&lt;p&gt;S: Organized?
&lt;/blockquote&gt;

&lt;p&gt;Hmm.</description>
 <pubDate>Fri, 12 Mar 2010 12:47:54 GMT</pubDate>
 <guid isPermaLink="true">http://www.harihareswara.net/2010/03/12/1</guid>
</item>
<item>
 <title>"Frankly, I do not feel this hatred."</title>
 <description>The Israeli fanzine &lt;i&gt;Bli Panika&lt;/i&gt; (Don't Panic) has published an awesome &lt;a href="http://www.blipanika.co.il/?p=1887"&gt;Hebrew translation&lt;/a&gt; of 
&lt;a href="http://strangehorizons.com/2009/20090713/dinosaurs-f.shtml"&gt;&lt;i&gt;Let Us Now Praise Awesome Dinosaurs&lt;/i&gt;&lt;/a&gt; by Ehud Maimon. Google Translate translates the title back into English as "Mention dinosaurs and glory", and Tark and Entippa's names are transliterated Tariq and Antipathy. Pretty fun!

&lt;p&gt;Back when I first heard about this project, I mentioned to editor Rami Shal'heveth that the story's title is a riff on a phrase &lt;a href="http://www.sacred-texts.com/bib/apo/sir044.htm"&gt;originally in Hebrew&lt;/a&gt;, but he probably already knew that. Actually, no: "Ben-Sira's book is one of those canonical texts that everybody knows of, but nobody reads."
</description>
 <pubDate>Fri, 12 Mar 2010 11:39:55 GMT</pubDate>
 <category domain="http://www.harihareswara.net/nb/nb.cgi/category/nycb/">writing</category>
 <guid isPermaLink="true">http://www.harihareswara.net/2010/03/12/0</guid>
</item>
<item>
 <title>It's All Fun And Games</title>
 <description>Check out &lt;a href="http://www.newgrounds.com/portal/view/529992"&gt;REDDER&lt;/a&gt;, the psychotropic game with the palindromic name. I'm a big fan of the strange effect that happens as you play, but I won't mention too much to avoid whatever passes for spoilers when it comes to strange gameplay effects.</description>
 <pubDate>Thu, 11 Mar 2010 01:29:06 GMT</pubDate>
 <category domain="http://www.harihareswara.net/nb/nb.cgi/category/nycb/">games</category>
 <guid isPermaLink="true">http://www.harihareswara.net/2010/03/10/0</guid>
</item>
<item>
 <description>Tired of finding kitten? In &lt;a href="http://jayisgames.com/archives/2010/03/robot_wants_kitty.php"&gt;Robot Wants Kitty&lt;/a&gt;, kitten is dangled just out of your reach for the whole game. And since there's a power-up early on that makes precision movement pretty much impossible, I never found kitten. On the plus side, hey, it's another robotfindskittenlike game.</description>
 <pubDate>Mon, 08 Mar 2010 18:44:37 GMT</pubDate>
 <category domain="http://www.harihareswara.net/nb/nb.cgi/category/nycb/">robotfindskitten</category>
 <guid isPermaLink="true">http://www.harihareswara.net/2010/03/08/0</guid>
</item>
<item>
 <title>Work humor</title>
 <description>&lt;blockquote&gt;
"I will lock you and [x] in a room for a week to sort this out."&lt;br /&gt;
"We would spend that week planning vengeance on you for locking us in a room!"&lt;br /&gt;
"The scenario you put forward seems all too plausible."
&lt;/blockquote&gt;</description>
 <pubDate>Sat, 06 Mar 2010 00:58:44 GMT</pubDate>
 <guid isPermaLink="true">http://www.harihareswara.net/2010/03/05/0</guid>
</item>
<item>
 <title>Incomprehensible Joke</title>
 <description>&lt;blockquote&gt;
S: "I always wondered what would happen if you put a disc in the Wii the wrong way."
&lt;br /&gt;
L: "It shows &lt;a href="http://www.youtube.com/watch?v=NCPhpEsQkY0"&gt;a Koopa Troopa on its back&lt;/a&gt;."
&lt;/blockquote&gt;</description>
 <pubDate>Thu, 04 Mar 2010 21:21:52 GMT</pubDate>
 <category domain="http://www.harihareswara.net/nb/nb.cgi/category/nycb/">games</category>
 <guid isPermaLink="true">http://www.harihareswara.net/2010/03/04/1</guid>
</item>
<item>
 <description>Last week Sumana and I went to the launch party for &lt;a href="http://nkjemisin.com/"&gt;N.K. Jemisin's epic "The Hundred Thousand Kingdoms"&lt;/a&gt;. Nora founded the writing group I'm in, and I read and critiqued a draft of the novel just before she sold it. Then she left the writing group and went off to be a famous novelist.

&lt;p&gt;I always have a difficult time at events held in bars, but Sumana is very good at introducing me to people. For instance, I met Saladin Ahmed, who along with Nora was nominated for a Nebula this year. And then comes &lt;a href="http://www.sfsignal.com/archives/2010/03/mind-meld-more-nebula-worthy-works-of-fictionpicked-by-some-of-this-years-nebula-nominees/"&gt;this SF Signal interview with Saladin, Nora, and many other Nebula nominees&lt;/a&gt;. "If your work couldn't have been on the ballot this year, what work would you have liked in its place?" Saladin:

&lt;blockquote&gt;
I'd also have been happy to see more two-fisted fun on the ballot. Two of the absolute best stories I read this year were "Zeppelin City" by Michael Swanwick and Eileen Gunn, and "Let Us Now Praise Awesome Dinosaurs" by Leonard Richardson. Both were ridiculously enjoyable and Nebula-worthy to my mind. 
&lt;/blockquote&gt;

&lt;p&gt;I'm encouraged!</description>
 <pubDate>Thu, 04 Mar 2010 20:47:46 GMT</pubDate>
 <category domain="http://www.harihareswara.net/nb/nb.cgi/category/nycb/">literature</category>
 <category domain="http://www.harihareswara.net/nb/nb.cgi/category/nycb/">writing</category>
 <guid isPermaLink="true">http://www.harihareswara.net/2010/03/04/0</guid>
</item>
<item>
 <title>Star Trek vs. Batman</title>
 <description>No need to dream, &lt;a href="http://www.racsofilms.com/stvb-episodes.htm"&gt;it's a filmed mashup&lt;/a&gt; of the 1960s Star Trek and the 1960s Batman. The Batman writing is pretty decent, but the Star Trek writing is bland and doesn't capture the feel of the series.</description>
 <pubDate>Tue, 02 Mar 2010 22:27:31 GMT</pubDate>
 <category domain="http://www.harihareswara.net/nb/nb.cgi/category/nycb/">film</category>
 <guid isPermaLink="true">http://www.harihareswara.net/2010/03/02/0</guid>
</item>
 </channel>
</rss>
