Saturday, December 26, 2009

ePatents

Microsoft just lost an appeal of a patent infringement lawsuit brought by Canada based i4i. Here's what the chairman of i4i said: "This is both a vindication for i4i and a war cry for talented inventors whose patents are infringed, ... The same guts and integrity that are needed to invent and go against the herd are at the heart of success in patent litigation against a behemoth like Microsoft."

So I looked up the patent. It addresses a standard problem in markup languages, namely, how do you separate the content from the markup. In HTML, a bold word might be represented as "One <bold>word</bold> in this sentence is bold."

But what if the content itself has tags in it. For example, to write the above paragraph I had to represent the 'bold' tags in a way that did not just make a word bold. So I had to write something like "One &lt;bold&gt;word&lt;/bold&gt; in this sentence is bold". Now imagine what the representation of that sentence is.

The patent in question solves this problem in a natural way. It simply removes all the special tags (the formatting instructions) into a separate part of the file. So our sentence would look like this (assuming it was the only thing in the file):

One word in this sentence is bold.
---- start formatting ---
<bold> at character 4
</bold> at character 8

The advantage is any tags that appear in the content are just content. If you think this solution should be obvious to any serious programmer, you're paying attention. I solve much more difficult problems than this every day at my job. This obviousness of course invalidates the patent. For this brilliant breakthrough, i4i was awarded almost $300 million.

Sunday, March 29, 2009

AJAX Client State

I've been playing with Microsoft AJAX and the AJAX Control Toolkit. Cool stuff. Judging from the blogs I've read, people have gotten ClientState working, but lots of people just avoid it because it's tricky. I have found 4 hard to debug pitfalls, that will make ClientState mysteriously stop working. In case this is of any use to anyone, here they are. I assume you are using the ACT.

1. Your extender must set EnableClientState to true before base.Init as that is when the hidden field is added.

2. Client state is not loaded until Page.PreLoad

3. Changes made after base.PreRender are lost as that is when state is pushed to the hidden field.

4. The behavior class must inherit from AjaxControlToolkit.BehaviorBase, not Sys.UI.Behavior .