<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
    <title>mason</title>
    <link rel="alternate" type="text/html" href="http://www.masonsimon.com/mt/" />
    <link rel="self" type="application/atom+xml" href="http://www.masonsimon.com/mt/atom.xml" />
    <id>tag:www.masonsimon.com,2008-06-11:/mt//1</id>
    <updated>2008-10-28T17:46:57Z</updated>
    
    <generator uri="http://www.sixapart.com/movabletype/">Movable Type Pro 4.21-en</generator>

<entry>
    <title>How to solve &quot;unknown error&quot; when installing a device driver in Windows Vista</title>
    <link rel="alternate" type="text/html" href="http://www.masonsimon.com/mt/2008/10/how-to-solve-unknown-error-whe.html" />
    <id>tag:www.masonsimon.com,2008:/mt//1.17</id>

    <published>2008-10-28T17:27:17Z</published>
    <updated>2008-10-28T17:46:57Z</updated>

    <summary>Windows Update kept trying to upgrade my graphics card (Intel 945GM in Lenovo X60 tablet) and failing. I tried manually upgrading the driver with ones from both Intel and Lenovo, and neither worked. Here are the steps that solved my...</summary>
    <author>
        <name>mason</name>
        
    </author>
    
    
    <content type="html" xml:lang="en" xml:base="http://www.masonsimon.com/mt/">
        Windows Update kept trying to upgrade my graphics card (Intel 945GM in Lenovo X60 tablet) and failing. I tried manually upgrading the driver with ones from both Intel and Lenovo, and neither worked. Here are the steps that solved my problem:
        <![CDATA[1) Open windows explorer to "c:\Windows\inf\"<div>2) Right click "INFCACHE.1" and select "Properties"<br /></div><div>3) Go to the "Security" tab and click "Edit"</div><div>4) Select "Users" and then check "Full control" under the "Allow" column below, then hit "OK"</div><div>5) "OK" again</div><div>6) Now right click "INFCACHE.1" and "Rename" it to "INFCACHE.1.old"</div><div><br /></div><div>I also did this for "setupapi.ev1", "setupapi.ev2", "setupapi.ev3", and "drvindex.dat", but I'm not sure they're necessary.</div><div><br /></div><div>7) Try installing your driver again (you might need to restart before doing this, I'm not sure)</div><div><br /></div><div>If that works it's probably safe to delete those files you renamed to ".old" (Windows should have made fresh ones, minus the ".old" extension). Apparently that INFCACHE file can get junked up, but Windows doesn't know to recreate it unless you manually remove (or rename) it.</div><div><br /></div><div><br /></div><div>These links helped me out:</div><div><a href="http://support.microsoft.com/kb/940199">http://support.microsoft.com/kb/940199</a></div><div><a href="http://forums.logitech.com/logitech/board/message?board.id=bluetooth&amp;message.id=3755">http://forums.logitech.com/logitech/board/message?board.id=bluetooth&amp;message.id=3755</a></div><div><a href="http://www.broadbandreports.com/forum/r18594702-Vista-Corrupt-INFCACHE1">http://www.broadbandreports.com/forum/r18594702-Vista-Corrupt-INFCACHE1</a></div>]]>
    </content>
</entry>

<entry>
    <title>Random grammatical sentence generator using CFG</title>
    <link rel="alternate" type="text/html" href="http://www.masonsimon.com/mt/2008/10/random-grammatical-sentence-ge.html" />
    <id>tag:www.masonsimon.com,2008:/mt//1.16</id>

    <published>2008-10-18T05:47:09Z</published>
    <updated>2008-10-18T17:13:32Z</updated>

    <summary>Context-free grammars (CFGs) can be used as a model for natural language. That means they capture the structure of language in a relatively simple form that can be reasoned about and used to generate new instances of natural language. My natural...</summary>
    <author>
        <name>mason</name>
        
    </author>
    
    
    <content type="html" xml:lang="en" xml:base="http://www.masonsimon.com/mt/">
        <![CDATA[<a href="http://en.wikipedia.org/wiki/Context-free_grammar">Context-free grammars</a> (CFGs) can be used as a model for natural language. That means they capture the structure of language in a relatively simple form that can be reasoned about and used to generate new instances of natural language. My natural language processing book says CFGs were proven insufficient for modeling German spoken in Zurich (<a href="http://www.amazon.com/gp/product/0131873210?ie=UTF8&amp;tag=dorcod-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=0131873210">Speech and Language Processing (2nd Edition)</a>, p.538), but they're good enough to bring you the following silly, random, grammatical sentences:]]>
        <![CDATA[<script>

function randInt(low_bound_inclusive, high_bound_inclusive) {
    var range = high_bound_inclusive - low_bound_inclusive;
    var r = Math.random();
    r = r * range;
    r = r + low_bound_inclusive;
    r = Math.round(r);
    return r;
}



proper_nouns = [
    'John',
    'Mary'
];

nominals = [
    'fish',
    'cat',
    'dog',
    'zebra',
    'horse',
    'donkey',
    'giraffe',
    'walrus',
];

determiners = [
    'the',
    'a',
];

past_tense_verbs = [
    'ate',
    'dragged in',
    'befriended',
    'saluted',
];

// cfg maps between a non-terminal symbol and the list of expansions it can have
cfg = {
    'S': ['NP VP'],
    'NP': ['DN', 'PN'],
    'DN': ['DET N', 'DET N that NP V'],
    'PN': proper_nouns,
    'VP': ['V NP'],
    'V': past_tense_verbs,
    'DET': determiners,
    'N': nominals,
}
var nonterminals = [
    'S',
    'PN',
    'VP',
    'V',
    'NP',
    'DET',
    'N', 
    'DN',
];


function generate(g) {
    var tokens = g.split(' ');
    for (var i = 0; i < tokens.length; i++) { var token = tokens[i];
        for (var j = 0; j < nonterminals.length; j++) {
            var nonterminal = nonterminals[j];
            if (token === nonterminal) {
                // select one of the possible expansions of token to use
                var expansions = cfg[nonterminal];
                var expansion = expansions[randInt(0, expansions.length-1)];

                // now replace this instance of token with a recursive expansion of its expansion
                g = g.replace(token, generate(expansion));
                break;
            }
        }
        // if no nonterminal matched, then token was a terminal symbol
    }
    // all nonterminal symbols have been replaced by terminal ones
    return g;
}

document.writeln('<ul>');
for (var i = 0; i < 5; i++) {
  var sentence = generate('S');
  document.writeln('<li>' + sentence + '</li>');
}
document.writeln('</ul>');
</script>

They may not make sense. They may be hard to understand. But they should be grammatical. <div><br /></div><div>Refresh to see more. View source to see how it's done.</div>]]>
    </content>
</entry>

<entry>
    <title>Is the Problem of Other Minds a problem?</title>
    <link rel="alternate" type="text/html" href="http://www.masonsimon.com/mt/2008/09/is-the-problem-of-other-minds.html" />
    <id>tag:www.masonsimon.com,2008:/mt//1.15</id>

    <published>2008-09-27T16:37:51Z</published>
    <updated>2008-09-27T15:50:38Z</updated>

    <summary>The Book of Tea contains an excerpt I love:One day Soshi was walking on the bank of a river with a friend. &quot;How delightfully the fishes are enjoying themselves in the water!&quot; exclaimed Soshi. His friend spake to him thus:...</summary>
    <author>
        <name>mason</name>
        
    </author>
    
    
    <content type="html" xml:lang="en" xml:base="http://www.masonsimon.com/mt/">
        <![CDATA[<div><a href="http://www.amazon.com/gp/redirect.html?ie=UTF8&amp;location=http%3A%2F%2Fwww.amazon.com%2FBook-Tea-Kakuzo-Okakura%2Fdp%2F4990284836%3Fie%3DUTF8%26s%3Dbooks%26qid%3D1222533715%26sr%3D8-1&amp;tag=dorcod-20&amp;linkCode=ur2&amp;camp=1789&amp;creative=9325">The Book of Tea</a><img src="http://www.assoc-amazon.com/e/ir?t=dorcod-20&amp;l=ur2&amp;o=1" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /> contains an excerpt I love:</div><div><br /></div>One day Soshi was walking on the bank of a river with a friend. "How delightfully the fishes are enjoying themselves in the water!" exclaimed Soshi. His friend spake to him thus: "You are not a fish; how do you know that the fishes are enjoying themselves?" "You are not myself," returned Soshi; "how do you know that I do not know that the fishes are enjoying themselves?"]]>
        
    </content>
</entry>

<entry>
    <title>Find yourself in photos of the SF Marathon (more coming soon)</title>
    <link rel="alternate" type="text/html" href="http://www.masonsimon.com/mt/2008/09/find-yourself-in-photos-of-the.html" />
    <id>tag:www.masonsimon.com,2008:/mt//1.14</id>

    <published>2008-09-11T15:10:57Z</published>
    <updated>2008-09-27T15:56:19Z</updated>

    <summary>I ran the half-marathon in San Francisco this past summer. It was amazing. Afterwards I wanted pictures to remember it by--specifically, pictures that had me in them to remember my experience. Before the race, MarathonFoto informed me that &quot;you and your...</summary>
    <author>
        <name>mason</name>
        
    </author>
    
    
    <content type="html" xml:lang="en" xml:base="http://www.masonsimon.com/mt/">
        <![CDATA[<p>I ran the half-marathon in San Francisco this past summer. It was amazing. Afterwards I wanted pictures to remember it by--specifically, pictures that had <b>me</b> in them to remember <b>my</b> experience. Before the race, <a href="http://www.marathonfoto.com" rel="nofollow">MarathonFoto</a> informed me that "you and your family will not have to worry about trying to capture your special race moments" because they would take pictures. Great! They neglected to mention those pictures would cost $40 each to download.</p>

<p>I liked the pictures, but that heads-up they gave before the race was slimy. I wondered, "how can I make a better, cheaper service for finding photos of myself (and put these guys out of business :P)?" The result is <a href="http://www.bibfind.com">bibfind.com</a>: a crowd-sourced photo tagging system that uses the bib numbers worn by runners to identify them in photos.</p>]]>
        <![CDATA[<span class="Apple-style-span" style="border-collapse: collapse; color: rgb(0, 0, 0); "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(51, 51, 51);">I like to say it's powered by our collective narcissism. When you go to <a href="http://www.bibfind.com" style="text-decoration: underline; ">bibfind.com</a> you get to select the race you ran and enter the bib number you'd like to see photos of. But before you get to see those photos, you've got to look at some random photos from the race, and tag them with the bib numbers you see. Then you are shown the photos you searched for (assuming such photos exist and have been tagged).</span></span><div><br /></div><div>At this point the only photos in the system are ones posted on <a href="http://flickr.com">flickr</a> of the SF Marathon, but I'll expand to other races and photo services when the site is ripe enough. If you ran the SF Marathon or know anyone who did, try to find yourself at <a href="http://www.bibfind.com" style="text-decoration: underline; ">bibfind.com</a>. If you just want to check the site out, try searching for bib #  8685; you'll see a hilarious photo.</div><div><br /></div><div>If you've got any questions or suggestions, leave a comment here or use the link at the bottom of the site to put in feedback.</div>]]>
    </content>
</entry>

<entry>
    <title>Automatic style-checking with Strunk and White&apos;s rules</title>
    <link rel="alternate" type="text/html" href="http://www.masonsimon.com/mt/2008/09/automatic-style-checking-with.html" />
    <id>tag:www.masonsimon.com,2008:/mt//1.13</id>

    <published>2008-09-05T17:15:49Z</published>
    <updated>2008-09-06T17:04:45Z</updated>

    <summary>I read The Elements of Style by Strunk and White to get better at writing. The biggest section is on common misuses of words and expressions in English. I thought the section was valuable, but more than I&apos;d be able...</summary>
    <author>
        <name>mason</name>
        
    </author>
    
    
    <content type="html" xml:lang="en" xml:base="http://www.masonsimon.com/mt/">
        <![CDATA[<p>I read <a href="http://www.amazon.com/gp/redirect.html?ie=UTF8&amp;location=http%3A%2F%2Fwww.amazon.com%2FElements-Style-Third-William-Strunk%2Fdp%2F0024181900%3Fie%3DUTF8%26s%3Dbooks%26qid%3D1220631204%26sr%3D8-2&amp;tag=dorcod-20&amp;linkCode=ur2&amp;camp=1789&amp;creative=9325">The Elements of Style by Strunk and White</a><img style="margin: 0px; border-top-style: none! important; border-right-style: none! important; border-left-style: none! important; border-bottom-style: none! important" height="1" alt="" src="http://www.assoc-amazon.com/e/ir?t=dorcod-20&amp;l=ur2&amp;o=1" width="1" border="0" /> to get better at writing. The biggest section is on common misuses of words and expressions in English. I thought the section was valuable, but more than I'd be able to keep in my head while writing. To solve that problem, I made a script that analyzes some given text and then annotates each potential misuse with a link to Strunk's guidance.</p> ]]>
        <![CDATA[<script>







	// this is a list of commonly misused expressions' names and definitions (in regex form), each with a link giving detail on usage
	var cm = [
		['All right',
		 /\bal(l )?right/gi,
		 'http://crockford.com/wrrrld/style5.html#1'],

		['As good or better than',
		 /\bas good or better than/gi,
		 'http://crockford.com/wrrrld/style5.html#2'],

		['As to whether',
		 /\bas to whether/gi,
		 'http://crockford.com/wrrrld/style5.html#3'],

		['Bid',
		 /\b(?:bid|bade)\b/gi,
		 'http://crockford.com/wrrrld/style5.html#4'],

		['Case',
		 /\bcases?\b/gi,
		 'http://crockford.com/wrrrld/style5.html#5'],

		['Certainly',
		 /\bcertainly\b/gi,
		 'http://crockford.com/wrrrld/style5.html#6'],

		['Character',
		 /\bcharacter\b/gi,
		 'http://crockford.com/wrrrld/style5.html#7'],

		['Claim, vb.',
		 /\bclaim(?:ed)?\b/gi,
		 'http://crockford.com/wrrrld/style5.html#8'],

		['Compare',
		 /\bcompare\b/gi,
		 'http://crockford.com/wrrrld/style5.html#9'],

		['Clever',
		 /\bclever\b/gi,
		 'http://crockford.com/wrrrld/style5.html#10'],

		['Consider',
		 /\bconsider(?:ed)?\b/gi,
		 'http://crockford.com/wrrrld/style5.html#11'],

		['Dependable',
		 /\bdependable\b/gi,
		 'http://crockford.com/wrrrld/style5.html#12'],

		['Due to',
		 /\bdue to\b/gi,
		 'http://crockford.com/wrrrld/style5.html#13'],

		['Effect',
		 /\b(?:effect|affect)\b/gi,
		 'http://crockford.com/wrrrld/style5.html#14'],

		['Etc',
		 /\betc\.*\b/gi,
		 'http://crockford.com/wrrrld/style5.html#15'],

		['Fact',
		 /\bfact\b/gi,
		 'http://crockford.com/wrrrld/style5.html#16'],

		['Factor',
		 /\bfactor\b/gi,
		 'http://crockford.com/wrrrld/style5.html#17'],

		['Feature',
		 /\bfeature\b/gi,
		 'http://crockford.com/wrrrld/style5.html#18'],

		['Fix',
		 /\bfix\b/gi,
		 'http://crockford.com/wrrrld/style5.html#19'],

		['He is a man who',
		 /\bis a \w+ (?:who|which)\b/gi,
		 'http://crockford.com/wrrrld/style5.html#20'],

		['However',
		 /\bhowever\b/gi,
		 'http://crockford.com/wrrrld/style5.html#21'],

		['Kind of',
		 /\b(?:kind of|sort of)\b/gi,
		 'http://crockford.com/wrrrld/style5.html#22'],

		['Less',
		 /\b(?:less|fewer)\b/gi,
		 'http://crockford.com/wrrrld/style5.html#23'],

		['Line, along these lines',
		 /\balong (?:these|those|the)(?: same)? lines?\b/gi,
		 'http://crockford.com/wrrrld/style5.html#24'],

		['Literal, literally',
		 /\bliteral(?:ly)?\b/gi,
		 'http://crockford.com/wrrrld/style5.html#25'],

		['Lose out',
		 /\blose out\b/gi,
		 'http://crockford.com/wrrrld/style5.html#26'],

		['Most',
		 /\bmost\b/gi,
		 'http://crockford.com/wrrrld/style5.html#27'],

		['Nature',
		 /\bnature\b/gi,
		 'http://crockford.com/wrrrld/style5.html#28'],

		['Near by',
		 /\bnear ?by\b/gi,
		 'http://crockford.com/wrrrld/style5.html#29'],

		['Oftentimes, ofttimes',
		 /\b(?:oftentimes|ofttimes)\b/gi,
		 'http://crockford.com/wrrrld/style5.html#30'],

		['One hundred and one',
		 /\bone[ -]hundred(?:[ -]and)?[ -]one\b/gi,
		 'http://crockford.com/wrrrld/style5.html#31'],

		['One of the most',
		 /\bone of the most\b/gi,
		 'http://crockford.com/wrrrld/style5.html#32'],

		['People',
		 /\bthe (?:people|public)\b/gi,
		 'http://crockford.com/wrrrld/style5.html#33'],

		['Phase',
		 /\bphase\b/gi,
		 'http://crockford.com/wrrrld/style5.html#34'],

		['Possess',
		 /\bposses(?:ed|or)?\b/gi,
		 'http://crockford.com/wrrrld/style5.html#35'],

		['Respective, respectively',
		 /\brespective(?:ly)?\b/gi,
		 'http://crockford.com/wrrrld/style5.html#36'],

		['So (for emphasis)',
		 /\bso\b/gi,
		 'http://crockford.com/wrrrld/style5.html#37'],

		['State',
		 /\bstate\b/gi,
		 'http://crockford.com/wrrrld/style5.html#39'],

		['Student body',
		 /\bstudent body\b/gi,
		 'http://crockford.com/wrrrld/style5.html#40'],

		['System',
		 /\bsystem\b/gi,
		 'http://crockford.com/wrrrld/style5.html#41'],

		['Thanking you in advance',
		 /\b(?:thanking you in advance|thanks in advance|TIA)\b/gi,
		 'http://crockford.com/wrrrld/style5.html#42'],

		['They',
		 /\b(?:they|he or she|him or her|his or hers?)\b/gi,
		 'http://crockford.com/wrrrld/style5.html#43'],

		['Very',
		 /\bvery\b/gi,
		 'http://crockford.com/wrrrld/style5.html#44'],

		['Viewpoint',
		 /\bviewpoint\b/gi,
		 'http://crockford.com/wrrrld/style5.html#45'],

		['While',
		 /\bwhile\b/gi,
		 'http://crockford.com/wrrrld/style5.html#46'],

		['Whom',
		 /\bwhom\b/gi,
		 'http://crockford.com/wrrrld/style5.html#47'],

		['Worth while',
		 /\bworth ?while\b/gi,
		 'http://crockford.com/wrrrld/style5.html#48'],

		['Would',
		 /\b(?:would|should)\b/gi,
		 'http://crockford.com/wrrrld/style5.html#49'],
	];

	
	var N = cm.length;
	N = 48; // for some reason Windows Live Writer was counting wrong so I had to manually set this

	function analyze_and_annotate_text(text) {
		text = text.replace(/\n/g, '<br/ / / />');
		var out = document.getElementById('output');
		for (var i = 0; i < N-1; i+=1) {
			var name = cm[i][0],
			    regex = cm[i][1],
			    link = cm[i][2];
			text = text.replace(regex, '$& [<a href='+link+'>'+name+'</a>]');
		}
		out.innerHTML = text;
	}</script>  <div>In the box below, type or paste the text to style-check.    <br /><textarea id="text_to_check" rows="15" cols="50">Would you consider trying this out to see if it's worthwhile?</textarea><button onclick="analyze_and_annotate_text(document.getElementById('text_to_check').value)">style-check</button>     <p>The text you entered above is reproduced below. Inserted after each potential misuse is an annotation pointing you to the relevant comment by Strunk.</p>    <br />    <div id="output"></div>    <p></p> </div>]]>
    </content>
</entry>

<entry>
    <title>Making whitespace meaningful in order of operations</title>
    <link rel="alternate" type="text/html" href="http://www.masonsimon.com/mt/2008/08/making-whitespace-meaningful-i.html" />
    <id>tag:www.masonsimon.com,2008:/mt//1.12</id>

    <published>2008-08-30T03:23:06Z</published>
    <updated>2008-09-06T16:55:46Z</updated>

    <summary>Of all the mundane details that programming bothers me with, operator precedence/arithmetical order of operations pisses me off the most. Pardon the vulgarity, but if you&apos;ve ever had to wonder whether 5 + 6 * 2 was equal to 22...</summary>
    <author>
        <name>mason</name>
        
    </author>
    
    
    <content type="html" xml:lang="en" xml:base="http://www.masonsimon.com/mt/">
        <![CDATA[<p>Of all the mundane details that programming bothers me with, operator precedence/arithmetical order of operations pisses me off the most. Pardon the vulgarity, but if you've ever had to wonder whether 5 + 6 * 2 was equal to 22 or 17, or even worse--had a bug caused by guessing wrong in that sort of situation, you know how I feel.</p>  <p> </p>  ]]>
        <![CDATA[<p>I like using whitespace to disambiguate that sort of expression for myself, as in 5+6 * 2 (note the lack of space between "5", "+", and "2"). This works great; the "5+6" groups together to our eyes because of the lack of space, and is clearly separate from the "*" and "2" because of the intervening whitespace. (If you're interested: this sort of thing was studied by the German Gestalt psychologists.) The problem with using a scheme like this isn't that it doesn't work for us--it works great; the problem is that all programming languages I know of disregard the information contained in the whitespace. So while I'd say 5+6 * 2 equals 22, the computer would say otherwise.</p>  <p> </p>  <p>Steve McConnell recommends you "use more parentheses than you think you need" (pg738 in <a href="http://www.amazon.com/gp/redirect.html?ie=UTF8&amp;location=http%3A%2F%2Fwww.amazon.com%2FCode-Complete-Practical-Handbook-Construction%2Fdp%2F0735619670%2F&amp;tag=dorcod-20&amp;linkCode=ur2&amp;camp=1789&amp;creative=9325">Code Complete, 2nd edition</a><img style="margin: 0px; border-top-style: none! important; border-right-style: none! important; border-left-style: none! important; border-bottom-style: none! important" height="1" alt="" src="http://www.assoc-amazon.com/e/ir?t=dorcod-20&amp;l=ur2&amp;o=1" width="1" border="0" />). That solution is very practical, but it amounts to giving in to the language. I'm an idealistic young kid, and I think we should make the languages suit us instead of changing ourselves to suit the languages. I've also taken enough philosophy courses that just thinking bores me, so here's some action:</p>  <p> </p>  <div><script type="text/javascript">

	function thoughtful_evaluate(expression) {
		var x = '';
		var chunks = expression.split(/\s/);
		for (i in chunks) {	var chunk = chunks[i];
			if (chunk.match(/^[\+\-\/\*]$/) != null)
				// this chunk is a single operator
				x += chunk;
			else
				x += eval(chunk);
		}
		return eval(x);
	}

	function compute_results() {
		var x = document.getElementById('t').value;

		if (x.match(/^[1234567890\+\-\/\*\s]*$/) == null) {
			alert('invalid expression; only numbers and arithmetic operators are allowed.');
		}

		document.getElementById('standard_result').innerHTML = eval(x);
		document.getElementById('thoughtful_result').innerHTML = thoughtful_evaluate(x);
	}</script>Type an arithmetic expression in the box below and then click "evaluate".     <br /><input value="5+6 * 2" id="t" /><button onclick="compute_results();">evaluate</button>     <br />Below, you see the results of evaluating the above expression under two different schemes: <a href="http://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Operators/Operator_Precedence#Table">JavaScript's standard order of operations</a> and my "thoughtful" order of operations which groups expressions based on whitespace.     <table><tbody>       <tr>         <td><b>standard</b></td>          <td id="standard_result"> </td>       </tr>        <tr>         <td><b>thoughtful</b></td>          <td id="thoughtful_result"> </td>       </tr>     </tbody></table> </div>  <p> </p>  <p>The code that accomplishes this feat is simple; view source to see exactly how it's done. The heavy lifting is accomplished in under 10 lines of code, and those aren't very dense lines either.</p>  <p> </p>  <p>Now the real question is, will I find some open source language and implement this thoughtful grouping? We'll see...</p>]]>
    </content>
</entry>

<entry>
    <title>Spatial Frequency in Vision and (a bit about) Art</title>
    <link rel="alternate" type="text/html" href="http://www.masonsimon.com/mt/2008/08/spatial-frequency-in-vision-an.html" />
    <id>tag:www.masonsimon.com,2008:/mt//1.11</id>

    <published>2008-08-15T21:19:44Z</published>
    <updated>2008-09-27T15:53:58Z</updated>

    <summary>I just gave a presentation in my Cognitive Neuroscience course at Stanford about Oliva and Schyns&apos; paper &quot;Coarse Blobs or Fine Edges? Evidence That Information Diagnosticity Changes the Perception of Complex Visual Stimuli&quot;, doi:10.1006/cogp.1997.0667. I was happy with the presentation, so...</summary>
    <author>
        <name>mason</name>
        
    </author>
    
    
    <content type="html" xml:lang="en" xml:base="http://www.masonsimon.com/mt/">
        <![CDATA[<p>I just gave a presentation in my Cognitive Neuroscience course at Stanford about Oliva and Schyns' paper <a href="http://dx.doi.org/10.1006/cogp.1997.0667">"Coarse Blobs or Fine Edges? Evidence That Information Diagnosticity Changes the Perception of Complex Visual Stimuli", doi:10.1006/cogp.1997.0667</a>. I was happy with the presentation, so I post my slides here for anyone who's interested.</p> ]]>
        <![CDATA[<iframe src="http://docs.google.com/EmbedSlideshow?docid=dc7zxs8q_498894pwcp&amp;size=m" frameborder="0" width="555" height="451"></iframe>]]>
    </content>
</entry>

<entry>
    <title>iphone call data visualization</title>
    <link rel="alternate" type="text/html" href="http://www.masonsimon.com/mt/2008/07/iphone-call-data-visualization.html" />
    <id>tag:www.masonsimon.com,2008:/mt//1.10</id>

    <published>2008-07-31T04:54:40Z</published>
    <updated>2008-09-06T16:57:07Z</updated>

    <summary>I read Edward Tufte&apos;s book The Visual Display of Quantitative Information, and afterwards I was burning to visualize some data. I settled on charting the time of day that I make phone calls at.  ...</summary>
    <author>
        <name>mason</name>
        
    </author>
    
    
    <content type="html" xml:lang="en" xml:base="http://www.masonsimon.com/mt/">
        <![CDATA[<p>I read Edward Tufte's book <a href="http://www.amazon.com/gp/redirect.html?ie=UTF8&amp;location=http%3A%2F%2Fwww.amazon.com%2FVisual-Display-Quantitative-Information-2nd%2Fdp%2F0961392142%3Fie%3DUTF8%26s%3Dbooks%26qid%3D1217475484%26sr%3D8-1&amp;tag=dorcod-20&amp;linkCode=ur2&amp;camp=1789&amp;creative=9325">The Visual Display of Quantitative Information</a><img style="margin: 0px; border-top-style: none! important; border-right-style: none! important; border-left-style: none! important; border-bottom-style: none! important" height="1" alt="" src="http://www.assoc-amazon.com/e/ir?t=dorcod-20&amp;l=ur2&amp;o=1" width="1" border="0" />, and afterwards I was burning to visualize some data. I settled on charting the time of day that I make phone calls at.</p>  <p> </p>  <h2></h2>  ]]>
        <![CDATA[<h3><strong>the graphic</strong></h3>  <p><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="784" alt="call graphic" src="http://www.masonsimon.com/mt/WindowsLiveWriter/iphonecalldatavisualization_121B1/call%20graphic_3.png" width="388" align="right" border="0" />Thinking about this data, it occurred to me that a simple bar chart or histogram would be inappropriate, because I'd have to choose some arbitrary point at which to start drawing the bars, say midnight, with the result that 11pm would end up on the other side of the chart. That would be wrong, because in reality one comes right after the other. To solve that problem, I decided to plot my calls in a circle. The result is that the angular distance between two data measures on the chart corresponds directly with their temporal distance (fancy term isn't it?).</p>  <p> </p>  <p>Similarly, the "small multiple" (Tufte's term) plots for each weekday are arranged in a flattened clockwise loop to keep temporally adjacent days near to each other.</p>  <p> </p>  <p>Initially, I envisioned this plot as a circular histogram, and that's how I coded it. Then I had the idea of making those small multiple plots for the individual days, and I realized that I'd need to use a consistent scale for comparisons between those plots to be meaningful. So it turned into a circular bar chart.</p>  <p> </p>  <p>I liked the way that looked, but one of Tufte's points kept nagging me: he says that the amount of visual real-estate you give to the representations of your data points should be directly proportional to the magnitude of those data points (I'm paraphrasing, accurately I hope). Looking at my circular bar chart, I realized that I was violating that principle, and that he was right about it. I varied the radius of each circular "bar" in proportion to the amount of calls during the corresponding hour, but the area of a pie slice (segment of a circle) is proportional to the square of the radius of the pie. That means that the area of the circular bar for an hour with 5 calls would be less than half the area for the circular bar representing 10 calls. So I scrapped the bars in favor of lines; they're one-dimensional, and so are the data they represent.</p>  <p> </p>  <p>The lines for daytime hours are colored in shades of yellow, and nighttime ones in shades of blue. Tufte says that most people can distinguish blue from other colors, even if they're colorblind, and as a bonus, there's some semantic relationship between those colors and the hours of the day they correspond with (skycolor). Unfortunately the yellow is hard to see against a white background. Expletive deleted.</p>  <p> </p>  <h3><strong>the making of</strong></h3>  <p>To get at my phone's call data, I mangled mrflip's perl code for extracting the SQLite database from the iphone's backup files (see <a href="http://groups.google.com/group/iphonewebdev/browse_thread/thread/ee513eec0f7b4f94/514ace960061bce8?lnk=gst&amp;q=extract">this thread</a>). Then I put together some python scripts to digest the call data into a form that's conducive to charting and send it down the pipeline to a buggy little piece of <a href="http://processing.org">Processing</a> code that draws the actual graphics. The bugs have to do with the calculation of the low, median, and high values that are labeled on the charts, but I touched up the graphic in Photoshop to mask the issues.</p>  <p> </p>  <p>That cover-up was a profound philosophical moment for me. I had the option of tightening my code to handle all cases, pass all unit tests (hah! as if I wrote those), and be prepared for use by total strangers. But as the gears in my mind spun up to design this bulletproof algorithm, the monkeywrench of cool rationality fell in. Taking that code from functional with bugs to bugless would have taken a disproportionate amount of time. I'm ok with mostly bugless, because this code is throwaway; it was just a tool I made as one step in the process of generating the chart.</p>  <p> </p>  <p>This is what I like most about being able to code: if I don't have the tools I need to make something, I can make the tools.</p>]]>
    </content>
</entry>

<entry>
    <title>WANTED: Engineer to make wildest fantasies reality</title>
    <link rel="alternate" type="text/html" href="http://www.masonsimon.com/mt/2008/07/wanted-engineer-to-make-wildes.html" />
    <id>tag:www.masonsimon.com,2008:/mt//1.9</id>

    <published>2008-07-07T17:33:35Z</published>
    <updated>2008-09-11T23:35:05Z</updated>

    <summary>As a software engineer with experience doing web development, I hear a lot of people with ideas for hot new websites. In most of these situations where there&apos;s an idea looking for someone to implement it, I get the sense...</summary>
    <author>
        <name>mason</name>
        
    </author>
    
    
    <content type="html" xml:lang="en" xml:base="http://www.masonsimon.com/mt/">
        <![CDATA[<p>As a software engineer with experience doing web development, I hear a lot of people with ideas for hot new websites. In most of these situations where there's an idea looking for someone to implement it, I get the sense that the software engineer's point of view isn't understood. Here's my edited response to a request for someone with spare time to implement an idea that was described at the level of detail of requiring community features and that users be able to upload content:</p>]]>
        <![CDATA[<p style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 1em; font-weight: normal; margin-top: 0px; margin-right: 0px; margin-bottom: 0.75em; margin-left: 0px; ">--------------------------</p><p style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 1em; font-weight: normal; margin-top: 0px; margin-right: 0px; margin-bottom: 0.75em; margin-left: 0px; ">Let me start by saying that I think it's great that neat opportunities for web developers are posted on this list. Keep 'em coming! But as a software engineer I tend to have reservations about "I have an idea; now I need an <br />engineer" type requests, so I thought I'd lay out my thought process here for the benefit of everyone. Before I start, a caveat: I may not be representative of all web developers; I believe there are websites where you can go to post a job description and have someone remotely code your site for you, but I'm not the sort of engineer that looks for jobs there, so please take what I have to say with this in mind.</p><p style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 1em; font-weight: normal; margin-top: 0px; margin-right: 0px; margin-bottom: 0.75em; margin-left: 0px; ">First question I usually have is "what's the idea?" I have a mountain of ideas to implement whenever I find the time and inclination, so an overly vague description is unlikely to get me interested. Of course I understand the desire to protect your idea, but for me at least, the description has to be more of a sales pitch than a "need handyman to build 4'x6' doghouse"-style ad in the paper.</p><p style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 1em; font-weight: normal; margin-top: 0px; margin-right: 0px; margin-bottom: 0.75em; margin-left: 0px; ">The secrecy also raises a big red flag for me. I think: he's protecting the idea, so he's in love with it, and without any detail on his background, I have to assume that the idea person ("Idea" from now on) is non-technical. <br />From that combination I conclude that I'll have to do more work than Idea realizes and thus suggests, Idea will be frustrated by the slow rate of progess relative to his expectations, AND Idea will believe that the idea is worth at least as much as my implementation (which is taking so damn long!), so he'll be unwilling to give up an appropriate amount of equity/cash. All of these conclusions might be wrong. Idea might be a PhD in CS who got an MBA, now works at a nice consulting firm, and just wants to do this idea on the side but doesn't have time to code it himself. But I need to hear this up front, otherwise I assume the worst (described above) and nothing is going to get me to play a role in that sad story.</p><p style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 1em; font-weight: normal; margin-top: 0px; margin-right: 0px; margin-bottom: 0.75em; margin-left: 0px; ">After that initial stuff is out of the way, I'm curious what I can expect from this project. Is it going to be fun from a technical standpoint? Web development involves a lot of mindless drudgery, particularly when it comes to tweaking the visual aspects of a website. So either the idea should be so exciting that I won't mind that stuff, there should be a graphic designer taking care of front-end details, or the financial prospects have to be good enough that I can slog through it (but this option is probably not the most preferable). Which brings me to...</p><p style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 1em; font-weight: normal; margin-top: 0px; margin-right: 0px; margin-bottom: 0.75em; margin-left: 0px; ">What's it going to pay? I'm not necessarily interested in exact dollars, but more, what sort of cash-equity combination is it. If it's all cash, this might be the sort of job for one of those rent-a-coder websites; if it's all equity, then how will my equity compare to Idea's? If it's not all one or the other, what sort of mix is it (and I'm still interested in how my proportion compares to Idea's)? If the equity is significant (and it probably should be to get our interests aligned) then sell me on the business merits. I've already got a fancy piece of paper entitling me to thousands of shares in a tech-startup, so if you want to sell me another, it had better be even fancier (I'm joking :P) or I also need to be convinced that yours will be worth the ink it's printed with.</p><p style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 1em; font-weight: normal; margin-top: 0px; margin-right: 0px; margin-bottom: 0.75em; margin-left: 0px; ">--------------------------</p><p style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 1em; font-weight: normal; margin-top: 0px; margin-right: 0px; margin-bottom: 0.75em; margin-left: 0px; "> </p><p style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 1em; font-weight: normal; margin-top: 0px; margin-right: 0px; margin-bottom: 0.75em; margin-left: 0px; ">Hopefully that gave you a peek into the software engineer's perspective on ideas needing an engineer, because propositions that take this perspective into account are way more likely to get my attention (and other engineers too I'd guess). It probably sounded one-sided, because I'm sure I'm biased here. I understand that we engineer's need business people too; there are plenty of business administration tasks that I'm sure I'd find even less interesting than making the corners on some box render correctly across all the browsers out there. So good luck with whatever idea you're pursuing!</p>]]>
    </content>
</entry>

<entry>
    <title>typography exercise</title>
    <link rel="alternate" type="text/html" href="http://www.masonsimon.com/mt/2008/06/typography-exercise.html" />
    <id>tag:www.masonsimon.com,2008:/mt//1.8</id>

    <published>2008-06-17T21:10:50Z</published>
    <updated>2008-06-17T21:10:50Z</updated>

    <summary><![CDATA[I've been reading a book on typography called &quot;thinking with type&quot;, and one of the recommended exercises is to present a word using a design that expresses the word's meaning. I chose &quot;collapsed&quot;, after a good run had drained me....]]></summary>
    <author>
        <name>mason</name>
        
    </author>
    
    
    <content type="html" xml:lang="en" xml:base="http://www.masonsimon.com/mt/">
        <![CDATA[<p>I've been reading a book on typography called <a href="http://www.amazon.com/gp/redirect.html?ie=UTF8&amp;location=http%3A%2F%2Fwww.amazon.com%2FThinking-Type-Critical-Designers-Students%2Fdp%2F1568984480&amp;tag=dorcod-20&amp;linkCode=ur2&amp;camp=1789&amp;creative=9325">&quot;thinking with type&quot;</a>, and one of the recommended exercises is to present a word using a design that expresses the word's meaning. I chose &quot;collapsed&quot;, after a good run had drained me.</p>  <p>&#160;</p>  <p><a href="http://www.masonsimon.com/mt/WindowsLiveWriter/typographyexercise_F195/collapsed_2.png"><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="36" alt="collapsed" src="http://www.masonsimon.com/mt/WindowsLiveWriter/typographyexercise_F195/collapsed_thumb.png" width="240" align="left" border="0" /></a>&#160;</p>  <p>&#160;</p>  <p>&#160;</p>  <p>This technique visualizes the meaning of a word in addition to calling it by name. </p>]]>
        
    </content>
</entry>

<entry>
    <title>Pascal&apos;s Triangle</title>
    <link rel="alternate" type="text/html" href="http://www.masonsimon.com/mt/2008/06/pascals-triangle.html" />
    <id>tag:www.masonsimon.com,2008:/mt//1.7</id>

    <published>2008-06-16T03:09:58Z</published>
    <updated>2008-09-06T16:58:49Z</updated>

    <summary>I&apos;ve been brushing up on calculus with Gilbert Strang&apos;s excellent book, and when I got to a part about binomial expansion I decided to do some sort of visualization of Pascal&apos;s Triangle. I didn&apos;t have much success visualizing the whole...</summary>
    <author>
        <name>mason</name>
        
    </author>
    
    
    <content type="html" xml:lang="en" xml:base="http://www.masonsimon.com/mt/">
        <![CDATA[<p>I've been brushing up on calculus with <a href="http://ocw.mit.edu/ans7870/resources/Strang/strangtext.htm">Gilbert Strang's excellent book</a>, and when I got to a part about binomial expansion I decided to do some sort of visualization of <a href="http://en.wikipedia.org/wiki/Pascal's_triangle">Pascal's Triangle</a>. I didn't have much success visualizing the whole thing, so I threw together an applet in <a href="http://processing.org/">Processing</a> that lets you see a subset of the triangle at a time.</p>  ]]>
        <![CDATA[<!--[if !IE]> --> <object classid="java:pascals_triangle_visualization.class" type="application/x-java-applet" archive="pascals_triangle_visualization.jar" width="522" height="550" standby="Loading Processing software..."> <param name="codebase" value="http://www.masonsimon.com/mt/" /> <param name="archive" value="pascals_triangle_visualization.jar" />  <param name="mayscript" value="true" /> <param name="scriptable" value="true" />  <param name="image" value="loading.gif" /> <param name="boxmessage" value="Loading Processing software..." /> <param name="boxbgcolor" value="#FFFFFF" />  <param name="test_string" value="outer" /> <!--<![endif]-->  <object classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" codebase="http://java.sun.com/update/1.4.2/jinstall-1_4_2_12-windows-i586.cab" width="522" height="550" standby="Loading Processing software..."> <param name="codebase" value="http://www.masonsimon.com/mt/" /> <param name="code" value="pascals_triangle_visualization" /> <param name="archive" value="pascals_triangle_visualization.jar" />  <param name="mayscript" value="true" /> <param name="scriptable" value="true" />  <param name="image" value="loading.gif" /> <param name="boxmessage" value="Loading Processing software..." /> <param name="boxbgcolor" value="#FFFFFF" />  <param name="test_string" value="inner" />  <p> <strong> This browser does not have a Java Plug-in. <br /> <a href="http://java.sun.com/products/plugin/downloads/index.html" title="Download Java Plug-in"> 	Get the latest Java Plug-in here. </a> </strong> </p>  </object>  <!--[if !IE]> --> </object> <!--<![endif]-->   <p>Here's how it works: in the text field at the bottom you enter a number. All entries in Pascal's Triangle divisible by the number you entered will be shown, provided they are in the part of Pascal's Triangle that's shown in the applet. The powers of 2 are the most interesting; I like 64. Have fun!</p>]]>
    </content>
</entry>

<entry>
    <title>AI in the UI: making search boxes learn when you&apos;re done typing</title>
    <link rel="alternate" type="text/html" href="http://www.masonsimon.com/mt/2008/06/ai-in-the-ui-1.html" />
    <id>tag:www.masonsimon.com,2008:/mt//1.6</id>

    <published>2008-06-12T12:29:54Z</published>
    <updated>2008-09-06T16:59:11Z</updated>

    <summary>This article is about what I call &quot;live search boxes&quot;. They&apos;re the text boxes that perform some sort of search while you type.  Google Suggest and iTunes both have them. But I have a problem with how they work, and...</summary>
    <author>
        <name>mason</name>
        
    </author>
    
    
    <content type="html" xml:lang="en" xml:base="http://www.masonsimon.com/mt/">
        <![CDATA[<p>This article is about what I call "live search boxes". They're the text boxes that perform some sort of search while you type.  <a href="http://www.google.com/webhp?complete=1&amp;hl=en">Google Suggest</a> and iTunes both have them. But I have a problem with how they work, and I've got a solution too. </p>  <p> </p>  <h1></h1>  ]]>
        <![CDATA[<h2>the problem</h2>  <p>These things start searching before I'm done typing, which is distracting and inefficient. They're distracting, because the first part of my search may not yield results that are relevant once the whole thing is in. For example, see the screenshots below of me searching for "free running" with Google Suggest. The results after typing "free" don't overlap at all with the results after the full query "free running" is entered. </p>  <p><a href="http://www.masonsimon.com/mt/WindowsLiveWriter/AIintheUI_7780/google%20suggest%20free_4.png"><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="164" alt="google suggest free" src="http://www.masonsimon.com/mt/WindowsLiveWriter/AIintheUI_7780/google%20suggest%20free_thumb_1.png" width="244" border="0" /></a> <a href="http://www.masonsimon.com/mt/WindowsLiveWriter/AIintheUI_7780/google%20suggest%20free%20running_4.png"><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="168" alt="google suggest free running" src="http://www.masonsimon.com/mt/WindowsLiveWriter/AIintheUI_7780/google%20suggest%20free%20running_thumb_1.png" width="244" border="0" /></a> </p>  <p>These live search boxes are also inefficient, because if they run a search while I'm typing, another search will be necessary when I'm done; but as long as I'm typing I can't click on the intermediate results, so they're wasted. In the iTunes screenshot below I'm searching for "bon jovi" but it does a premature search for "bon". That does bring up the right results, but it brings up some wrong results along with them, and if it had been patient enough to wait the milliseconds for me to finish typing " jovi" I would have gotten the exact results I wanted.</p>  <p><a href="http://www.masonsimon.com/mt/WindowsLiveWriter/AIintheUI_7780/itunes%20bon%20search_4.png"><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="108" alt="itunes bon search" src="http://www.masonsimon.com/mt/WindowsLiveWriter/AIintheUI_7780/itunes%20bon%20search_thumb_1.png" width="467" border="0" /></a> </p>  <p>I admit that when my computer is running smoothly these intermediate results just flash by until I've finished typing and my final results are shown. But when my computer isn't at full processing capacity, the intermediate searches can be slow enough that they cause iTunes to freeze temporarily, and interfere with me typing out my full query. That's what really gets me about live search boxes with this behavior: <em>they can make it harder to do the search I want to do.</em></p>  <p><em></em></p>  <p>Maybe an analogy is useful. In the gym at my school the men's locker room has toilets with those infrared sensors that lets them detect when they're occupied, and flush when appropriate. When functioning correctly, this system works exactly how I want the live search to work: the device accepts input from the user, and when it has detected that the user is finished inputting, it processes the input appropriately. Unfortunately, the sensor systems don't work properly, and they frequently process input while it's still coming in. As with the search boxes above, this operation is inefficient (here in terms of water usage) and believe me it's distracting. But the correct functioning of these toilet systems gives the perfect analog of my solution to the live search box problem. </p>  <p> </p>  <p>sidenote: I feel justified using toilet humor to describe this problem because Jef Raskin did it too; "A search is either incremental or excremental." (footnote on p.126 of Jef Raskin, The Humane Interface, 2000).</p>  <p> </p>  <p><em></em></p>  <p><em></em></p>  <h2>my solution</h2>  <p>The problem was that these search boxes start searching before I'm done typing, so the solution should be apparent. It's to make the damn boxes wait for me (and you and everyone else) to finish typing! A simple way to accomplish this would be to wait half a second or so after the user types each character, and if another character hasn't been typed in that half-second, assume the user is done typing and run the query. The problem with this approach is that users can have different typing speeds, and a one-size-fits-all delay of 0.5 seconds (or 0.3 or 1.2 or whatever) before searching may not be appropriate to all of them. If 0.5 seconds is too long, there will be an annoying lag before the search is run, and if it's too short, then the search box will be at least as bad as the ones I just finished griping about.</p>  <p> </p>  <p>Because individual variation is the issue, we need a solution that varies with the user. This can be accomplished with some <em>really</em> basic artificial intelligence. At a high level, my method is to watch how fast the user types by counting the milliseconds between keystrokes, fit a simple probabilistic model (specifically, a <a href="http://en.wikipedia.org/wiki/Normal_distribution">Gaussian</a>) to that data to describe the user's typing speed, and then use that model to determine the amount of time beyond which it's very unlikely for the user to type another character. Once that (probabilistic) upper limit has passed without any typing activity, I run the search.</p>  <p> </p>  <p>Now for the details. That talk about probability probably made this sound more complicated than it is. Basically, I keep a running average of the amount of time between keystrokes, and that gives the best estimate of how much time there will be between this keystroke and the next. But this is an average, and it may be that some keystrokes are a bit slower and some are a bit faster than the average; to account for that I also track the running <a href="http://en.wikipedia.org/wiki/Standard_deviation">standard deviation</a> of keystroke times, which is a measure of how much they vary. By the <a href="http://en.wikipedia.org/wiki/68-95-99.7_rule">empirical rule</a> (and the assumption that the Gaussian is an appropriate model for these keystroke times), we know that just about all keystrokes are going to be shorter than the average plus 3 standard deviations (sigmas). So my probabilistic upper limit is set at the average plus 3 sigma, plus a little fudge factor that (hopefully) doesn't add an uncomfortable delay, but prevents short hesitations from triggering a search.</p>  <p> </p>  <h2>the result</h2> <object id="flex_ALSBox_demo" codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab" height="180" width="478" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"><param name="_cx" value="12647" /><param name="_cy" value="4763" /><param name="FlashVars" value="" /><param name="Movie" value="http://www.masonsimon.com/mt/aiintheui/flex_ALSBox_demo.swf" /><param name="Src" value="http://www.masonsimon.com/mt/aiintheui/flex_ALSBox_demo.swf" /><param name="WMode" value="Window" /><param name="Play" value="-1" /><param name="Loop" value="-1" /><param name="Quality" value="High" /><param name="SAlign" value="" /><param name="Menu" value="-1" /><param name="Base" value="" /><param name="AllowScriptAccess" value="sameDomain" /><param name="Scale" value="ShowAll" /><param name="DeviceFont" value="0" /><param name="EmbedMovie" value="0" /><param name="BGColor" value="869CA7" /><param name="SWRemote" value="" /><param name="MovieData" value="" /><param name="SeamlessTabbing" value="1" /><param name="Profile" value="0" /><param name="ProfileAddress" value="" /><param name="ProfilePort" value="0" /><param name="AllowNetworking" value="all" /><param name="AllowFullScreen" value="false" />   												 			<embed src="http://www.masonsimon.com/mt/aiintheui/flex_ALSBox_demo.swf" quality="high" bgcolor="#869ca7" width="478" height="180" name="flex_ALSBox_demo" align="middle" play="true" loop="false" allowscriptaccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.adobe.com/go/getflashplayer">				</object>]]>
    </content>
</entry>

</feed>
