<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-6767707</id><updated>2011-11-14T14:07:42.532+10:30</updated><title type='text'>Rafe's Blog</title><subtitle type='html'>I'm pretty hopeless at keeping this thing up-to-date...</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://ralphbecket.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://ralphbecket.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Rafe</name><uri>http://www.blogger.com/profile/10169325688704651715</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Ejdzr5ACvJA/Sf1Q7ykJ8WI/AAAAAAAAAsQ/iesdshoWcgo/s320/P5240040.JPG'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>82</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-6767707.post-2704681854215545940</id><published>2011-11-14T14:05:00.001+10:30</published><updated>2011-11-14T14:07:22.149+10:30</updated><title type='text'>SnippetCompiler</title><content type='html'>From time to time I need to try something out in C# in a few lines of code.  It's always a bit of a pain setting up a new Visual Studio solution for the purpose (I've traditionally used a &lt;i&gt;PlayPen&lt;/i&gt;&amp;nbsp;project for this). &amp;nbsp;I've recently discovered this little gem: &lt;a href="http://www.sliver.com/dotnet/SnippetCompiler/"&gt;SnippetCompiler&lt;/a&gt;. &amp;nbsp;It's essentially a mini-IDE for just this situation. &amp;nbsp;Smashing!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6767707-2704681854215545940?l=ralphbecket.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ralphbecket.blogspot.com/feeds/2704681854215545940/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6767707&amp;postID=2704681854215545940' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/2704681854215545940'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/2704681854215545940'/><link rel='alternate' type='text/html' href='http://ralphbecket.blogspot.com/2011/11/snippetcompiler.html' title='SnippetCompiler'/><author><name>Rafe</name><uri>http://www.blogger.com/profile/10169325688704651715</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Ejdzr5ACvJA/Sf1Q7ykJ8WI/AAAAAAAAAsQ/iesdshoWcgo/s320/P5240040.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6767707.post-8447743434325880082</id><published>2011-09-29T15:44:00.002+09:30</published><updated>2011-10-01T18:27:28.512+09:30</updated><title type='text'>The Birthday "Paradox" and Guid Collisions</title><content type='html'>&lt;b&gt;The Birthday Paradox&lt;/b&gt; asks the question: how many people do you need in a room before you have a 50/50 chance of at least one pair sharing a birthday?  It is a "paradox" only in the sense that the answer is a surprisingly small number to most.&lt;br /&gt;&lt;br /&gt;Here's how it works.&lt;br /&gt;&lt;br /&gt;Let `p` = "the probability of at least one shared birthday among `n` people".&lt;br /&gt;&lt;br /&gt;We assume a year of `T = 365` days and, as usual with probability problems, we recast it by looking for the complement of the answer.&lt;br /&gt;&lt;br /&gt;Let `p = 1 - q`, (i.e., `q` is the chance of no shared birthdays at all).&lt;br /&gt;&lt;br /&gt;Well, there are `^T C_n` ways of picking `n` distinct days from `T` and there are `n!` ways of arranging each combination and there are `T^n` possible combinations.  Hence,&lt;br /&gt;&lt;br /&gt;`q = n! (^T C_n) / T^n`&lt;br /&gt;&lt;br /&gt;We expand `q` as follows:&lt;br /&gt;&lt;br /&gt;`q = (n! T!) / ((T - n)! n! T^n)`&lt;br /&gt;`qquad = (T!) / ((T - n)! T^n)`&lt;br /&gt;`qquad = ((T - 0) / T) . ((T - 1) / T) . ((T - 2) / T) ... ((T - (n-1)) / T)`&lt;br /&gt;`qquad = (1 - 0/T) . (1 - 1/T) . (1 - 2/T) ... (1 - (n-1)/T)`&lt;br /&gt;&lt;br /&gt;When `x` is small, we can use the approximation `e^x ~~ 1 + x`.  This give us&lt;br /&gt;&lt;br /&gt;`q ~~ e^(-0/T) . e^(-1/T) . e^(-2/T) ... e^(-(n-1)/T)`&lt;br /&gt;`qquad = e^[-(n(n-1))/(2T)]`&lt;br /&gt;&lt;br /&gt;And, since we're approximating, `n(n-1) ~~ n^2`, hence&lt;br /&gt;&lt;br /&gt;`q ~~ e^(-n^2/(2T))`&lt;br /&gt;&lt;br /&gt;Through the magic of logarithms we can infer that&lt;br /&gt;&lt;br /&gt;`p = 1 - q`&lt;br /&gt;`qquad ~~ 1 - e^(-n^2/(2T))`&lt;br /&gt;&lt;br /&gt;`e^(-n^2/(2T)) ~~ 1 - p`&lt;br /&gt;&lt;br /&gt;`-n^2 ~~ 2T ln (1 - p)`&lt;br /&gt;&lt;br /&gt;`n^2 ~~ -2T ln (1 - p)`&lt;br /&gt;&lt;br /&gt;`n ~ = sqrt[-2T ln (1 - p)]`&lt;br /&gt;&lt;br /&gt;Now, for `p ~~ 1/2`, we need `n = 23`.&lt;br /&gt;&lt;br /&gt;So, at any given soccer match, there is a 50/50 chance that at least one pair drawn from the players and the referee will share a birthday.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Guid collisions&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;A guid is, essentially, a 128-bit random number.  Guids are used as an easy way of giving statistically (globally!) unique names to things without ever having to look at any of the other things that we have named, or anyone else has named, or will ever be named.&lt;br /&gt;&lt;br /&gt;How many things do we have to name before we risk, say, a one in a &lt;i&gt;billion&lt;/i&gt; chance of a naming collision?&lt;br /&gt;&lt;br /&gt;`n ~~ sqrt(-2^129*ln(1 - 10^-9))`&lt;br /&gt;`qquad ~~ 10^15`&lt;br /&gt;&lt;br /&gt;That is, we can assign guids to about a &lt;i&gt;million billion&lt;/i&gt; things before we have a one in a billion chance of a collision.  Having even a million records in any application is rare.  To put this in perspective, a billion seconds is roughly thirty years.&lt;br /&gt;&lt;br /&gt;For almost all applications, this means &lt;b&gt;you don't have to worry about guid collisions!&lt;/b&gt; [There's a much higher chance of something else being wrong with your program than a guid collision causing you trouble -- indeed, adding code to work around guid collisions is quite likely to increase the likelihood of a bug in your program.]&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6767707-8447743434325880082?l=ralphbecket.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ralphbecket.blogspot.com/feeds/8447743434325880082/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6767707&amp;postID=8447743434325880082' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/8447743434325880082'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/8447743434325880082'/><link rel='alternate' type='text/html' href='http://ralphbecket.blogspot.com/2011/09/birthday-paradox-and-guid-collisions.html' title='The Birthday &quot;Paradox&quot; and Guid Collisions'/><author><name>Rafe</name><uri>http://www.blogger.com/profile/10169325688704651715</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Ejdzr5ACvJA/Sf1Q7ykJ8WI/AAAAAAAAAsQ/iesdshoWcgo/s320/P5240040.JPG'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6767707.post-5638158459196698037</id><published>2011-07-19T14:57:00.000+09:30</published><updated>2011-07-19T14:57:11.485+09:30</updated><title type='text'>Robustness of the thermometer record</title><content type='html'>&lt;a href="http://rankexploits.com/musings/2011/a-monte-carlo-approach-to-estimating-sampling-error"&gt;This&lt;/a&gt; is an interesting post up at The Blackboard: it turns out that taking random 10% samples of the weather stations and computing global means gives you a very consistent picture (also, check out Steven Mosher's &lt;a href="http://rankexploits.com/musings/2011/a-monte-carlo-approach-to-estimating-sampling-error/#comment-79089"&gt;comment&lt;/a&gt;). &amp;nbsp;This seems to align with Anthony Watts' &lt;a href="http://surfacestations.org/"&gt;Surfacestations &lt;/a&gt;project, which found that (somewhat to my surprise, at least) the poor siting of the majority of US weather stations doesn't actually affect the numbers very much.&lt;br /&gt;&lt;br /&gt;These are both instances of good, basic fact checking carried out and reported honestly by eeevil sceptics.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6767707-5638158459196698037?l=ralphbecket.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ralphbecket.blogspot.com/feeds/5638158459196698037/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6767707&amp;postID=5638158459196698037' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/5638158459196698037'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/5638158459196698037'/><link rel='alternate' type='text/html' href='http://ralphbecket.blogspot.com/2011/07/robustness-of-thermometer-record.html' title='Robustness of the thermometer record'/><author><name>Rafe</name><uri>http://www.blogger.com/profile/10169325688704651715</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Ejdzr5ACvJA/Sf1Q7ykJ8WI/AAAAAAAAAsQ/iesdshoWcgo/s320/P5240040.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6767707.post-1174402741356483781</id><published>2011-07-05T10:32:00.000+09:30</published><updated>2011-07-05T10:32:56.134+09:30</updated><title type='text'>Climate Model Accuracy on Absolute Temperature</title><content type='html'>It has always bugged me that the output of climate models are reported as trends rather than as absolutes. &amp;nbsp;Lucia Liljegren at &lt;a href="http://rankexploits.com/"&gt;The Blackboard&lt;/a&gt; put&lt;a href="http://rankexploits.com/musings/wp-content/uploads/2009/03/temperatures_absolute.jpg"&gt;Climate model absolute temperatures&lt;/a&gt; together some time ago, which I think is illuminating. &amp;nbsp;The climate models are way off base, it would seem.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6767707-1174402741356483781?l=ralphbecket.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ralphbecket.blogspot.com/feeds/1174402741356483781/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6767707&amp;postID=1174402741356483781' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/1174402741356483781'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/1174402741356483781'/><link rel='alternate' type='text/html' href='http://ralphbecket.blogspot.com/2011/07/climate-model-accuracy-on-absolute.html' title='Climate Model Accuracy on Absolute Temperature'/><author><name>Rafe</name><uri>http://www.blogger.com/profile/10169325688704651715</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Ejdzr5ACvJA/Sf1Q7ykJ8WI/AAAAAAAAAsQ/iesdshoWcgo/s320/P5240040.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6767707.post-5021165614288280699</id><published>2011-05-03T14:55:00.000+09:30</published><updated>2011-05-03T14:55:10.044+09:30</updated><title type='text'>Adding Files Etc. as "Resources" to Visual Studio Projects</title><content type='html'>I recently wrote a unit test that needed some data that was too large to fit into a string literal. &amp;nbsp;To fix the problem, I added the file containing the string data as a &lt;i&gt;resource&lt;/i&gt;&amp;nbsp;to my project:&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;In &lt;i&gt;Solution Explorer&lt;/i&gt;, right click on the project &lt;i&gt;Properties&lt;/i&gt;;&lt;/li&gt;&lt;li&gt;Click on &lt;i&gt;Open&lt;/i&gt;;&lt;/li&gt;&lt;li&gt;Click on the &lt;i&gt;Resources&lt;/i&gt;&amp;nbsp;tab;&lt;/li&gt;&lt;li&gt;Click on &lt;i&gt;Add Resource&lt;/i&gt;&amp;nbsp;and follow the dialogue for adding a file.&lt;/li&gt;&lt;/ul&gt;In the source code I can refer to the string contents of my resource file simply as&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;i&gt;MyNameSpace.&lt;b&gt;Properties.Resources.&lt;/b&gt;MyResourceName&lt;/i&gt;&lt;/li&gt;&lt;/ul&gt;Of course, this scheme also works for data needed in other situations (e.g., logo images), not just unit tests.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6767707-5021165614288280699?l=ralphbecket.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ralphbecket.blogspot.com/feeds/5021165614288280699/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6767707&amp;postID=5021165614288280699' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/5021165614288280699'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/5021165614288280699'/><link rel='alternate' type='text/html' href='http://ralphbecket.blogspot.com/2011/05/adding-files-etc-as-resources-to-visual.html' title='Adding Files Etc. as &quot;Resources&quot; to Visual Studio Projects'/><author><name>Rafe</name><uri>http://www.blogger.com/profile/10169325688704651715</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Ejdzr5ACvJA/Sf1Q7ykJ8WI/AAAAAAAAAsQ/iesdshoWcgo/s320/P5240040.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6767707.post-2990818122651601032</id><published>2011-04-15T11:14:00.006+09:30</published><updated>2011-04-18T11:57:28.337+09:30</updated><title type='text'>Regular Expressions and State Machines</title><content type='html'>I recently found out that some of my colleagues did not know (much) about regular expressions or state machines. &amp;nbsp;These are &lt;b style="background-color: yellow;"&gt;amazingly useful&lt;/b&gt; concepts that I use on a daily basis, so I thought I'd try to set down everything you need to know about these subjects in one page (or thereabouts).&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Regular Expressions for Searching&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;The most common use of regular expressions is for searching through text files. &amp;nbsp;For example, if I wanted to search my source code for all class definitions that include the word 'Collection' in their class names, I would search on the following regular expression: '&lt;i&gt;class .*Collection&lt;/i&gt;'. &amp;nbsp;This is read as "the word &lt;i&gt;class&lt;/i&gt;, followed by a space, followed by zero or more of (&lt;i&gt;*&lt;/i&gt;) any character (&lt;i&gt;.&lt;/i&gt;), followed by the word &lt;i&gt;Collection&lt;/i&gt;". &amp;nbsp;That is, most characters are interpreted literally in a regular expression, but some are treated specially (e.g., '&lt;i&gt;.&lt;/i&gt;' and '&lt;i&gt;*&lt;/i&gt;').&lt;br /&gt;&lt;br /&gt;Here's the typical core grammar of regular expressions (I use &lt;i&gt;a, b, c&lt;/i&gt;&amp;nbsp;to denote non-special characters and &lt;i&gt;x, y, z&lt;/i&gt;&amp;nbsp;to denote arbitrary regular expressions):&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;i&gt;a&lt;/i&gt;  --  the regular expression matching the (non-special) character 'a';&lt;/li&gt;&lt;li&gt;&lt;i&gt;xy&lt;/i&gt;&amp;nbsp;-- the regular expression matching &lt;i&gt;x&lt;/i&gt;&amp;nbsp;followed by &lt;i&gt;y&lt;/i&gt;;&lt;/li&gt;&lt;li&gt;&lt;i&gt;(x)&lt;/i&gt;&amp;nbsp;-- the regular expression matching &lt;i&gt;x&lt;/i&gt;&amp;nbsp;(it is sometimes useful to treat a complex regular expression as a single item);&lt;/li&gt;&lt;li&gt;&lt;i&gt;x|y&lt;/i&gt;&amp;nbsp;-- the regular expression matching &lt;i&gt;x&lt;/i&gt;&amp;nbsp;or &lt;i&gt;y&lt;/i&gt;;&lt;/li&gt;&lt;li&gt;&lt;i&gt;x*&lt;/i&gt;&amp;nbsp;-- the regular expression matching zero or more instances of &lt;i&gt;x;&lt;/i&gt;&lt;/li&gt;&lt;li&gt;nil -- the regular expression matching the empty string (which in practice is just written as the empty string, rather than 'nil').&lt;/li&gt;&lt;/ul&gt;So, for example, the regular expression '&lt;i&gt;(aa|bb)*c&lt;/i&gt;' matches any sequence of &lt;i&gt;aa&lt;/i&gt;&amp;nbsp;or &lt;i&gt;bb&lt;/i&gt;&amp;nbsp;pairs, followed by a &lt;i&gt;c&lt;/i&gt;. &amp;nbsp;That is, the &lt;i&gt;language&lt;/i&gt;&amp;nbsp;recognised by '&lt;i&gt;(aa|bb)*c&lt;/i&gt;' consists of the strings &lt;i&gt;{c, aac, bbc, aaaac, aabbc, bbaac, bbbbc, ...}&lt;/i&gt;.&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;In practice, the language of regular expressions is extended with plenty of syntactic sugar. &amp;nbsp;Here are some standard extensions:&lt;/div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;&lt;i&gt;x+&lt;/i&gt;&amp;nbsp;-- the regular expression matching one or more instances of &lt;i&gt;x&lt;/i&gt;&amp;nbsp;(i.e., &lt;i&gt;x+ = xx*&lt;/i&gt;);&lt;/li&gt;&lt;li&gt;&lt;i&gt;x?&lt;/i&gt;&amp;nbsp;-- the regular expression matching zero or one instance of &lt;i&gt;x&lt;/i&gt;&amp;nbsp;(i.e., &lt;i&gt;x? = (x|&lt;/i&gt;nil&lt;i&gt;);&lt;/i&gt;&lt;/li&gt;&lt;li&gt;&lt;i&gt;[abc]&lt;/i&gt;&amp;nbsp;-- the regular expression matching any of the characters &lt;i&gt;a, b, &lt;/i&gt;or &lt;i&gt;c&lt;/i&gt;;&lt;/li&gt;&lt;li&gt;&lt;i&gt;[a-f]&lt;/i&gt;&amp;nbsp;-- the regualar expression matching any of the characters in the range &lt;i&gt;a..f&lt;/i&gt;;&lt;/li&gt;&lt;li&gt;&lt;i&gt;[^abc]&lt;/i&gt;&amp;nbsp;-- the regular expression matching any character that is &lt;i&gt;not a, b, &lt;/i&gt;or &lt;i&gt;c&lt;/i&gt;;&lt;/li&gt;&lt;li&gt;&lt;i&gt;[^a-f]&lt;/i&gt;&amp;nbsp;-- the regular expression matching any character that is &lt;i&gt;not&lt;/i&gt;&amp;nbsp;in the range &lt;i&gt;a..f&lt;/i&gt;;&lt;/li&gt;&lt;li&gt;&lt;i&gt;^&lt;/i&gt;&amp;nbsp;-- the regular expression matching the start of a line of text;&lt;/li&gt;&lt;li&gt;&lt;i&gt;\$&lt;/i&gt;&amp;nbsp;-- the regular expression matching the end of a line of text;&lt;/li&gt;&lt;li&gt;&lt;i&gt;\a&lt;/i&gt;&amp;nbsp;-- the regular expression matching the escape sequence &lt;i&gt;a&lt;/i&gt;&amp;nbsp;(e.g., &lt;i&gt;\*&lt;/i&gt;&amp;nbsp;matches a literal *, \t matches a tab character, \( matches an open parenthesis, etc.)&lt;/li&gt;&lt;/ul&gt;There are many more (see, e.g.,&amp;nbsp;&lt;a href="http://msdn.microsoft.com/en-us/library/az24scfc(v=VS.100).aspx"&gt;http://msdn.microsoft.com/en-us/library/az24scfc(v=VS.100).aspx&lt;/a&gt;&amp;nbsp;for the .NET 4 regular expression language).&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Learning these is easy and &lt;i&gt;really, really useful!&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;State Machines&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Imagine a machine with a set of lights. &amp;nbsp;Each light is called a &lt;i&gt;state&lt;/i&gt;&amp;nbsp;and the machine is called a &lt;i&gt;state machine&lt;/i&gt;. &amp;nbsp;When the machine is started, it always starts with a particular light on (all other lights are off); this is the &lt;i&gt;start state&lt;/i&gt;.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The machine takes as input a sequence of &lt;i&gt;symbols &lt;/i&gt;of some type (e.g., characters, GUI events, messages, whatever you like.). &amp;nbsp;As each symbol is read by the machine, which light is shining changes depending on which light was shining just before the new symbol was read &lt;i&gt;and&lt;/i&gt;&amp;nbsp;on what particular symbol was just read in. &amp;nbsp;For example, if the machine is in state 3, say (i.e., light number three is on) and the next symbol read in is a 'q', then light 3 might turn off and light 7 might come one (i.e., reading a 'q' when in state 3 causes the machine to change to state 7). &amp;nbsp;The machine has a &lt;i&gt;transition rule&lt;/i&gt;&amp;nbsp;like this for every possible input for every possible state.&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Each of the lights on the machine is either red or green. &amp;nbsp;The green lights denote &lt;i&gt;accepting states&lt;/i&gt;&amp;nbsp;and the red lights denote &lt;i&gt;non-accepting states&lt;/i&gt;. &amp;nbsp;If the input sequence finishes with the machine showing a green light, then the input sequence was &lt;i&gt;accepted&lt;/i&gt;&amp;nbsp;by the state machine. &amp;nbsp;Otherwise the input sequence was not accepted.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The &lt;i&gt;language&lt;/i&gt;&amp;nbsp;accepted by the state machine is the set of input sequences that leave it in an accepting state. &amp;nbsp;In fact, every&amp;nbsp;&lt;i&gt;regular expression&lt;/i&gt;&amp;nbsp;has a corresponding state machine and &lt;i&gt;vice versa&lt;/i&gt;&amp;nbsp;-- they are two ways of describing the same thing!&lt;br /&gt;&lt;br /&gt;For example, here's a state machine to match our earlier pattern &lt;i&gt;(aa|bb)*c&lt;/i&gt;:&lt;br /&gt;&lt;br /&gt;&lt;table frame="box" rules="all"&gt;&lt;tbody&gt;&lt;tr&gt; &lt;th&gt;State                            &lt;/th&gt;&lt;th&gt;Input &lt;/th&gt;&lt;th&gt;Next state&lt;/th&gt;&lt;/tr&gt;&lt;tr&gt; &lt;th rowspan="4"&gt;s1 [start]             &lt;/th&gt;&lt;td&gt;a     &lt;/td&gt;&lt;td&gt;s2&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;                                      &lt;td&gt;b     &lt;/td&gt;&lt;td&gt;s3&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;                                      &lt;td&gt;c     &lt;/td&gt;&lt;td&gt;s4&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;                                      &lt;td&gt;(...) &lt;/td&gt;&lt;td&gt;s5&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt; &lt;th rowspan="2"&gt;s2                     &lt;/th&gt;&lt;td&gt;a     &lt;/td&gt;&lt;td&gt;s1&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;                                      &lt;td&gt;(...) &lt;/td&gt;&lt;td&gt;s5&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt; &lt;th rowspan="2"&gt;s3                     &lt;/th&gt;&lt;td&gt;b     &lt;/td&gt;&lt;td&gt;s1&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;                                      &lt;td&gt;(...) &lt;/td&gt;&lt;td&gt;s5&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt; &lt;th rowspan="1" style="color: green;"&gt;s4         [accepting] &lt;/th&gt;&lt;td&gt;(...) &lt;/td&gt;&lt;td&gt;s5&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt; &lt;th rowspan="1"&gt;s5 [error]             &lt;/th&gt;&lt;td&gt;(...) &lt;/td&gt;&lt;td&gt;s5&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Observe the inclusion of an &lt;i&gt;error state&lt;/i&gt;&amp;nbsp;(&lt;i&gt;s5&lt;/i&gt;) which, like the Hotel California, you can never leave.  This state just ensures that the state machine never enters an accepting state once the input has differed from the pattern we are trying to match.&lt;br /&gt;&lt;br /&gt;[Aside: the fancy name for what I've just described is a &lt;i&gt;deterministic finite automaton&lt;/i&gt;&amp;nbsp;or &lt;i&gt;DFA&lt;/i&gt;.]&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;Deterministic and Non-deterministic State Machines&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;The state machine described above is &lt;i&gt;deterministic&lt;/i&gt;, meaning it is only ever in one state and each state transition is defined entirely by the current state and the next symbol to be read. &amp;nbsp;This is a very useful notion for designing programs that have to process sequences.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;One can also imagine a &lt;i&gt;nondeterministic&lt;/i&gt;&amp;nbsp;state machine. &amp;nbsp;Such a machine would works like this: at any point, any collection of lights can be on (i.e., the machine &lt;i&gt;could be in any&amp;nbsp;one&lt;/i&gt;&amp;nbsp;of these states given the input so far). The transition rules are relaxed so that each state can have multiple possible successors for each input, plus have the option of having successor states that can be reached &lt;i&gt;without consuming any input at all&lt;/i&gt;. &amp;nbsp;For example, the transition rules for state 3 might say "&lt;i&gt;move to state 7 after reading a 'q' &lt;/i&gt;&lt;i&gt;&lt;b&gt;or &lt;/b&gt;move to state 8 after reading a 'q' &lt;b&gt;or&lt;/b&gt;&amp;nbsp;move to state 9 without reading anything&lt;/i&gt;". &amp;nbsp;So, for our non-deterministic state machine, if light 3 is one of the lights that is currently on, then light 9 must also be on (because it is a "no input" successor to 3); also, if a 'q' is read next, then both lights 7 and 8 will come on.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Why is this idea useful? &amp;nbsp;Well, here's the magic: &lt;i&gt;you can always turn a non-deterministic state machine into a deterministic state machine &lt;/i&gt;(how this magic happens is a little beyond the scope of this article, but the starting point is to imagine every possible subset of lights on the &lt;i&gt;non-deterministic&lt;/i&gt;&amp;nbsp;state machine as corresponding to a single state on the equivalent &lt;i&gt;deterministic&lt;/i&gt;&amp;nbsp;state machine).&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;It's easy to see how to construct a deterministic state machine that handles simple sequences of symbols or repetition of simple sequences, the tricky bit is handling &lt;i&gt;alternation&lt;/i&gt;&amp;nbsp;(i.e., regular expressions of the form &lt;i&gt;x|y&lt;/i&gt;). &amp;nbsp;The easiest way of constructing a state machine to match &lt;i&gt;x|y&lt;/i&gt;&amp;nbsp;is to construct a &lt;i&gt;non-deterministic&lt;/i&gt;&amp;nbsp;state machine from the two state machines for recognising &lt;i&gt;x&lt;/i&gt;&amp;nbsp;and &lt;i&gt;y &lt;/i&gt;(hopefully you can imagine how this might be done without too much difficulty), &lt;i&gt;then&lt;/i&gt;&amp;nbsp;we can turn that into a &lt;i&gt;deterministic&lt;/i&gt;&amp;nbsp;state machine.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;In practice, textual regular expressions are typically just compiled into representations of their &lt;i&gt;non-deterministic&lt;/i&gt;&amp;nbsp;state machines and the matching algorithm simulates all possible state transitions at each point. &amp;nbsp;This is actually quite effective, since the cost of searching a string of &lt;i&gt;m&lt;/i&gt;&amp;nbsp;characters with an &lt;i&gt;n&lt;/i&gt;&amp;nbsp;state machine is just&amp;nbsp;&lt;i&gt;O(mn)&lt;/i&gt;&amp;nbsp;(and typically much less).&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;What Can't Regular Expressions Match?&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;Roughly speaking, regular expressions can't match any pattern that requires counting to arbitrarily large numbers. &amp;nbsp;For example, you can't write a regular expression that checks whether the parentheses ( ) in a program are properly balanced, because a program can contain any number of parentheses. &amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;[What follows is for extra credit.]&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;There is something called the &lt;i&gt;pumping lemma&lt;/i&gt;, which says that for any state machine with &lt;i&gt;n&lt;/i&gt;&amp;nbsp;states that accepts some input of length &lt;i&gt;n&lt;/i&gt;&amp;nbsp;or more symbols, then that input can be written &lt;i&gt;somehow&amp;nbsp;&lt;/i&gt;as &lt;i&gt;xyz&lt;/i&gt;&amp;nbsp;(where &lt;i&gt;y&lt;/i&gt;&amp;nbsp;is a non-empty sequence and the length of &lt;i&gt;xy&lt;/i&gt;&amp;nbsp;is at most &lt;i&gt;n&lt;/i&gt;) and the machine must also accept all patterns of the form &lt;i&gt;xy*z&lt;/i&gt;&amp;nbsp;(i.e., the machine had to go through at least one loop while recognising the &lt;i&gt;y&lt;/i&gt;&amp;nbsp;part in &lt;i&gt;xyz&lt;/i&gt;). &amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;How does this relate to counting patterns? &amp;nbsp;Well, let's say we &lt;i&gt;did &lt;/i&gt;claim to have a state machine with 4 states that matched &lt;i&gt;all and only&lt;/i&gt; programs with properly balanced parentheses. &amp;nbsp;Now consider the balanced input sequence '((((a))))', which our state machine duly accepts. &amp;nbsp;The pumping lemma tells us that this must be decomposable as some &lt;i&gt;xyz&lt;/i&gt;&amp;nbsp;where &lt;i&gt;y&lt;/i&gt;&amp;nbsp;is non-empty and the length of &lt;i&gt;xy&lt;/i&gt;&amp;nbsp;is at most 4. &amp;nbsp;Well, we only have four possibilities for &lt;i&gt;x&lt;/i&gt;&amp;nbsp;and &lt;i&gt;y&lt;/i&gt;&amp;nbsp;here -- it doesn't matter which one we end up with. &amp;nbsp;Let's say the answer happens to be &lt;i&gt;x = '&lt;/i&gt;(((' and &lt;i&gt;y = '&lt;/i&gt;(' -- leaving &lt;i&gt;z = 'a&lt;/i&gt;))))'&lt;i&gt;.&lt;/i&gt;&amp;nbsp;&amp;nbsp;The pumping lemma says that our machine must accept all strings of the form &lt;i&gt;xy*z&lt;/i&gt;, which clearly includes just &lt;i&gt;xz&lt;/i&gt;, namely '(((a))))', which is clearly not balanced! &amp;nbsp;Therefore our claim must be wrong: our 7 state machine &lt;i&gt;does not&lt;/i&gt;&amp;nbsp;match all and only well balanced programs. &amp;nbsp;Since there is nothing in our argument that really depends on the 4 states starting point, the same thing must be true for &lt;i&gt;any number&lt;/i&gt;&amp;nbsp;of states that a parenthesis-matching state machine might have. &amp;nbsp;Therefore, &lt;i&gt;there is no regular expression (or state machine) that matches all and only well balanced programs&lt;/i&gt;. &amp;nbsp;If you don't believe me, I encourage you to have a go at designing such a state machine!&lt;/div&gt;&lt;div&gt;&lt;br /&gt;I find all this stuff really rather beautiful.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;What About Counting Support in Modern Regular Expressions?&lt;/b&gt;&lt;br /&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;br /&gt;Modern textual regular expressions usually include some support for counting, such as &lt;i&gt;x{40,70}&lt;/i&gt;&amp;nbsp;meaning "&lt;i&gt;between 40 and 70 instances of the pattern x&lt;/i&gt;". &amp;nbsp;This functionality comes at a cost: since the size of the equivalent ordinary regular expressions for these "counting" patterns quickly grows out of hand, they are implemented using backtracking pattern matchers. &amp;nbsp;These are exponentially slower than non-deterministic state machines and it is easy to construct pathological search patterns that will cause these matching algorithms to take forever.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Further Reading&lt;/b&gt;&lt;br /&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;br /&gt;&lt;a href="http://swtch.com/~rsc/regexp/regexp1.html"&gt;Here&lt;/a&gt; is a brilliant paper on implementing regular expression matchers.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6767707-2990818122651601032?l=ralphbecket.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ralphbecket.blogspot.com/feeds/2990818122651601032/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6767707&amp;postID=2990818122651601032' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/2990818122651601032'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/2990818122651601032'/><link rel='alternate' type='text/html' href='http://ralphbecket.blogspot.com/2011/04/regular-expressions-and-state-machines.html' title='Regular Expressions and State Machines'/><author><name>Rafe</name><uri>http://www.blogger.com/profile/10169325688704651715</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Ejdzr5ACvJA/Sf1Q7ykJ8WI/AAAAAAAAAsQ/iesdshoWcgo/s320/P5240040.JPG'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6767707.post-5850645608040936068</id><published>2011-03-24T09:30:00.001+10:30</published><updated>2011-03-24T09:36:15.922+10:30</updated><title type='text'>Bayes' Theorem</title><content type='html'>&lt;div class="MsoNormal"&gt;&lt;span style="color: #1f497d;"&gt;I recently read this beautiful explanation of Bayes’ theorem.&amp;nbsp; I’d always thought it was a statement of philosophy, but it isn’t: it comes from plain old probabilities.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span style="color: #1f497d;"&gt;The formula for the conditional probability of &lt;i&gt;A &lt;/i&gt;being true given that &lt;i&gt;B &lt;/i&gt;is true is&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span style="color: #1f497d;"&gt;&lt;i&gt;P(A | B) = P(A &amp;amp; B) / P(B)&lt;/i&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span style="color: #1f497d;"&gt;That is, the proportion of things that are &lt;i&gt;A &lt;/i&gt;that are in &lt;i&gt;B &lt;/i&gt;is equal to the fraction of the proportion of things that are &lt;i&gt;A and&lt;/i&gt; &lt;i&gt;B &lt;/i&gt;over the proportion of things that are &lt;i&gt;B &lt;/i&gt;(I like to think of these things in terms of Venn diagrams).&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span style="color: #1f497d;"&gt;We can rearrange the above to get&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span style="color: #1f497d;"&gt;&lt;i&gt;P(A &amp;amp; B) = P(A | B).P(B)&lt;/i&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span style="color: #1f497d;"&gt;Now for Bayes’ theorem: let’s write &lt;i&gt;H &lt;/i&gt;for our hypothesis and &lt;i&gt;E &lt;/i&gt;for our evidence.&amp;nbsp; We want to know how seeing the evidence &lt;i&gt;E &lt;/i&gt;affects the probability of our hypothesis &lt;i&gt;H &lt;/i&gt;being true.&amp;nbsp; From the first rule above we have&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span style="color: #1f497d;"&gt;&lt;i&gt;P(H | E) = P(H &amp;amp; E) / P(E)&lt;/i&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span style="color: #1f497d;"&gt;Now we can apply the second rule to &lt;i&gt;P(H &amp;amp; E)&lt;/i&gt; to get&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span style="color: #1f497d;"&gt;&lt;i&gt;P(H | E) = P(E | H).P(H) / P(E)&lt;/i&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span style="color: #1f497d;"&gt;Et voila!&amp;nbsp; No magic at all.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span style="color: #1f497d;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span style="color: #1f497d;"&gt;As an aside, the&lt;a href="http://en.wikipedia.org/wiki/Raven_paradox"&gt; raven paradox&lt;/a&gt; has convinced me that Bayesianism is philosophically superior to frequentism.&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6767707-5850645608040936068?l=ralphbecket.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ralphbecket.blogspot.com/feeds/5850645608040936068/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6767707&amp;postID=5850645608040936068' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/5850645608040936068'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/5850645608040936068'/><link rel='alternate' type='text/html' href='http://ralphbecket.blogspot.com/2011/03/bayes-theorem.html' title='Bayes&apos; Theorem'/><author><name>Rafe</name><uri>http://www.blogger.com/profile/10169325688704651715</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Ejdzr5ACvJA/Sf1Q7ykJ8WI/AAAAAAAAAsQ/iesdshoWcgo/s320/P5240040.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6767707.post-8577066005545504167</id><published>2011-03-22T09:42:00.000+10:30</published><updated>2011-03-22T09:42:02.934+10:30</updated><title type='text'>Radiation</title><content type='html'>&lt;a href="http://xkcd.com/radiation/"&gt;This chart&lt;/a&gt; tells you all you need to know.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6767707-8577066005545504167?l=ralphbecket.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ralphbecket.blogspot.com/feeds/8577066005545504167/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6767707&amp;postID=8577066005545504167' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/8577066005545504167'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/8577066005545504167'/><link rel='alternate' type='text/html' href='http://ralphbecket.blogspot.com/2011/03/radiation.html' title='Radiation'/><author><name>Rafe</name><uri>http://www.blogger.com/profile/10169325688704651715</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Ejdzr5ACvJA/Sf1Q7ykJ8WI/AAAAAAAAAsQ/iesdshoWcgo/s320/P5240040.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6767707.post-6109964650368195699</id><published>2011-01-10T10:27:00.003+10:30</published><updated>2011-01-10T11:32:44.828+10:30</updated><title type='text'>Debugging WCF</title><content type='html'>I'm relatively new to the world of Microsoft foundation libraries. &amp;nbsp;For the most part I am impressed, but I cannot understand the idea of development libraries doing their best to hide errors from you unless you first speak the magic rites (I would have thought there ought to be magic rites to cause error hiding, not the other way around). &amp;nbsp;Anyway, WCF -- Windows Communications Foundation -- is a pretty good RPC system which has this property. &amp;nbsp;To turn on tracing so you can debug your application, follow &lt;a href="http://davybrion.com/blog/2008/08/easing-the-pain-of-wcf-debugging/"&gt;this&lt;/a&gt;&amp;nbsp;advice:&lt;br /&gt;&lt;blockquote&gt;&lt;div style="color: #2a2a2a; font-family: Verdana, Tahoma, Arial, sans-serif; font-size: 11px; line-height: 1.5em; margin-bottom: 15px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;After some Live Searching (i was actually googling, but let’s make Microsoft think at least someone outside of Redmond uses Live Search) i discovered that you can enable WCF tracing. Bingo! Why didn’t Juval Lowy’s book mention this? It’s supposed to be the WCF Bible…. Oh well, thanks to Google, i mean Live Search, we now know how to enable WCF’s tracing:&lt;/div&gt;&lt;div style="color: #2a2a2a; font-family: Verdana, Tahoma, Arial, sans-serif; font-size: 11px; line-height: 1.5em; margin-bottom: 15px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;code&gt;&lt;/code&gt;&lt;/div&gt;&lt;span class="Apple-style-span" style="color: #2a2a2a; font-family: Verdana, Tahoma, Arial, sans-serif; font-size: 11px;"&gt;&lt;code&gt;&lt;/code&gt;&lt;/span&gt;&lt;br /&gt;&lt;div style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial;"&gt;&lt;div style="color: black; font-family: Consolas; font-size: 10pt; line-height: 1.5em; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;span class="Apple-style-span" style="color: #2a2a2a; font-family: Verdana, Tahoma, Arial, sans-serif; font-size: 11px;"&gt;&lt;code&gt;&lt;span style="color: blue;"&gt;&amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515;"&gt;system.diagnostics&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="color: black; font-family: Consolas; font-size: 10pt; line-height: 1.5em; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;span class="Apple-style-span" style="color: #2a2a2a; font-family: Verdana, Tahoma, Arial, sans-serif; font-size: 11px;"&gt;&lt;code&gt;&lt;span style="color: blue;"&gt;&amp;nbsp; &amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515;"&gt;trace&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: red;"&gt;autoflush&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;true&lt;/span&gt;"&lt;span style="color: blue;"&gt;&amp;nbsp;/&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="color: black; font-family: Consolas; font-size: 10pt; line-height: 1.5em; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;span class="Apple-style-span" style="color: #2a2a2a; font-family: Verdana, Tahoma, Arial, sans-serif; font-size: 11px;"&gt;&lt;code&gt;&lt;span style="color: blue;"&gt;&amp;nbsp; &amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515;"&gt;sources&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="color: black; font-family: Consolas; font-size: 10pt; line-height: 1.5em; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;span class="Apple-style-span" style="color: #2a2a2a; font-family: Verdana, Tahoma, Arial, sans-serif; font-size: 11px;"&gt;&lt;code&gt;&lt;span style="color: blue;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515;"&gt;source&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: red;"&gt;name&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;System.ServiceModel&lt;/span&gt;"&lt;/code&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="color: black; font-family: Consolas; font-size: 10pt; line-height: 1.5em; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;span class="Apple-style-span" style="color: #2a2a2a; font-family: Verdana, Tahoma, Arial, sans-serif; font-size: 11px;"&gt;&lt;code&gt;&lt;span style="color: blue;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: red;"&gt;switchValue&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;Information, ActivityTracing&lt;/span&gt;"&lt;/code&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="color: black; font-family: Consolas; font-size: 10pt; line-height: 1.5em; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;span class="Apple-style-span" style="color: #2a2a2a; font-family: Verdana, Tahoma, Arial, sans-serif; font-size: 11px;"&gt;&lt;code&gt;&lt;span style="color: blue;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: red;"&gt;propagateActivity&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;true&lt;/span&gt;"&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="color: black; font-family: Consolas; font-size: 10pt; line-height: 1.5em; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;span class="Apple-style-span" style="color: #2a2a2a; font-family: Verdana, Tahoma, Arial, sans-serif; font-size: 11px;"&gt;&lt;code&gt;&lt;span style="color: blue;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515;"&gt;listeners&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="color: black; font-family: Consolas; font-size: 10pt; line-height: 1.5em; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;span class="Apple-style-span" style="color: #2a2a2a; font-family: Verdana, Tahoma, Arial, sans-serif; font-size: 11px;"&gt;&lt;code&gt;&lt;span style="color: blue;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515;"&gt;add&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: red;"&gt;name&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;wcfTraceListener&lt;/span&gt;"&lt;span style="color: blue;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: red;"&gt;type&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;System.Diagnostics.XmlWriterTraceListener&lt;/span&gt;"&lt;span style="color: blue;"&gt;&lt;/span&gt;&lt;span style="color: red;"&gt;initializeData&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;WcfTrace.svclog&lt;/span&gt;"&lt;span style="color: blue;"&gt;&amp;nbsp;/&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="color: black; font-family: Consolas; font-size: 10pt; line-height: 1.5em; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;span class="Apple-style-span" style="color: #2a2a2a; font-family: Verdana, Tahoma, Arial, sans-serif; font-size: 11px;"&gt;&lt;code&gt;&lt;span style="color: blue;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;/&lt;span style="color: #a31515;"&gt;listeners&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="line-height: 1.5em; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;div style="color: black; font-family: Consolas; font-size: 10pt;"&gt;&lt;span class="Apple-style-span" style="color: #2a2a2a; font-family: Verdana, Tahoma, Arial, sans-serif; font-size: 11px;"&gt;&lt;code&gt;&lt;span style="color: blue;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/code&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: monospace; font-size: 11px;"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: monospace; font-size: 11px; line-height: 20px;"&gt;&lt;span style="color: #a31515;"&gt;source&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="line-height: 1.5em; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;div style="color: black; font-family: Consolas; font-size: 10pt;"&gt;&lt;span class="Apple-style-span" style="color: #2a2a2a; font-family: Verdana, Tahoma, Arial, sans-serif; font-size: 11px;"&gt;&lt;code&gt;&lt;span style="color: blue;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/code&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: monospace; font-size: 11px;"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: monospace; font-size: 11px; line-height: 20px;"&gt;&lt;span style="color: #a31515;"&gt;sources&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="line-height: 1.5em; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;div style="color: black; font-family: Consolas; font-size: 10pt;"&gt;&lt;span class="Apple-style-span" style="color: #2a2a2a; font-family: Verdana, Tahoma, Arial, sans-serif; font-size: 11px;"&gt;&lt;code&gt;&lt;span style="color: blue;"&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/code&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: monospace; font-size: 11px;"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: monospace; font-size: 11px; line-height: 20px;"&gt;&lt;span style="color: #a31515;"&gt;system.diagnostics&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="color: #2a2a2a; font-family: Verdana, Tahoma, Arial, sans-serif; font-size: 11px; line-height: 1.5em; margin-bottom: 15px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;code&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style="color: #2a2a2a; font-family: Verdana, Tahoma, Arial, sans-serif; font-size: 11px; line-height: 1.5em; margin-bottom: 15px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;You can also use the Service Configuration Editor tool which is available in the Windows SDK, but spare yourself the pain of that tool and just copy/paste this xml in your config file.&lt;/div&gt;&lt;div style="color: #2a2a2a; font-family: Verdana, Tahoma, Arial, sans-serif; font-size: 11px; line-height: 1.5em; margin-bottom: 15px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;Now run the service again, and do whatever it was that triggered the weird client-side exception. After the exception occurred, open the WcfTrace.svclog file with either an editor (it’s not very readable though) or with the Microsoft Service Trace Viewer tool (which is not too bad actually).&lt;/div&gt;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6767707-6109964650368195699?l=ralphbecket.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ralphbecket.blogspot.com/feeds/6109964650368195699/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6767707&amp;postID=6109964650368195699' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/6109964650368195699'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/6109964650368195699'/><link rel='alternate' type='text/html' href='http://ralphbecket.blogspot.com/2011/01/debugging-wcf.html' title='Debugging WCF'/><author><name>Rafe</name><uri>http://www.blogger.com/profile/10169325688704651715</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Ejdzr5ACvJA/Sf1Q7ykJ8WI/AAAAAAAAAsQ/iesdshoWcgo/s320/P5240040.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6767707.post-1146095109759118059</id><published>2010-12-09T11:22:00.000+10:30</published><updated>2010-12-09T11:22:03.998+10:30</updated><title type='text'>Mark Twain</title><content type='html'>&lt;span class="Apple-style-span" style="font-size: x-large;"&gt;A Plan for the Improvement of English Spelling &lt;/span&gt;&lt;br /&gt;&lt;i&gt;by Mark Twain&lt;/i&gt;&lt;br /&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;br /&gt;For example, in Year 1 that useless letter "c" would be dropped to be replased either by "k" or "s", and likewise "x" would no longer be part of the alphabet. The only kase in which "c" would be retained would be the "ch" formation, which will be dealt with later. Year 2 might reform "w" spelling, so that "which" and "one" would take the same konsonant, wile Year 3 might well abolish "y" replasing it with "i" and Iear 4 might fiks the "g/j" anomali wonse and for all. Jenerally, then, the improvement would kontinue iear bai iear with Iear 5 doing awai with useless double konsonants, and Iears 6-12 or so modifaiing vowlz and the rimeining voist and unvoist konsonants. Bai Iear 15 or sou, it wud fainali bi posibl tu meik ius ov thi ridandant letez "c", "y" and "x" -- bai now jast a memori in the maindz ov ould doderez -- tu riplais "ch", "sh", and "th" rispektivli. Fainali, xen, aafte sam 20 iers ov orxogrefkl riform, wi wud hev a lojikl, kohirnt speling in ius xrewawt xe Ingliy-spiking werld.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6767707-1146095109759118059?l=ralphbecket.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ralphbecket.blogspot.com/feeds/1146095109759118059/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6767707&amp;postID=1146095109759118059' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/1146095109759118059'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/1146095109759118059'/><link rel='alternate' type='text/html' href='http://ralphbecket.blogspot.com/2010/12/mark-twain.html' title='Mark Twain'/><author><name>Rafe</name><uri>http://www.blogger.com/profile/10169325688704651715</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Ejdzr5ACvJA/Sf1Q7ykJ8WI/AAAAAAAAAsQ/iesdshoWcgo/s320/P5240040.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6767707.post-4885193867637554990</id><published>2010-11-16T10:13:00.001+10:30</published><updated>2010-11-17T14:23:06.063+10:30</updated><title type='text'>.NET: IEnumerable is *not* lazy</title><content type='html'>Just spent ten minutes working this one out.&lt;br /&gt;&lt;br /&gt;If you have a variable&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;IEnumerable&amp;lt;Foo&amp;gt; SomeFoos = [...LINQ expression returning an enumerable...];&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;and then do this&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;foreach (var foo in SomeFoos) { [...update foo...] }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;you &lt;i&gt;will almost certainly not&lt;/i&gt;&amp;nbsp;see any changes in the values in &lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;SomeFoos&lt;/span&gt;. &amp;nbsp;Why not? &amp;nbsp;Because each time you iterate through &lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;SomeFoos&lt;/span&gt;, the enumerator is run again, quite possibly recreating each item.&lt;br /&gt;&lt;br /&gt;A solution is to force each item in &lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;SomeFoos &lt;/span&gt;to be manifested once. &amp;nbsp;For example,&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;List&amp;lt;Foo&amp;gt; SomeFoos = [...LINQ expression returning an enumerable...].ToList();&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Now things will work as expected.&lt;br /&gt;&lt;br /&gt;[N.B. &amp;nbsp;When I say "laziness", I refer to the standard functional programming practice of replacing an evaluated thunk with the result, thereby avoiding any repeated processing effort on subsequent reads of the thunk.]&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6767707-4885193867637554990?l=ralphbecket.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ralphbecket.blogspot.com/feeds/4885193867637554990/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6767707&amp;postID=4885193867637554990' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/4885193867637554990'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/4885193867637554990'/><link rel='alternate' type='text/html' href='http://ralphbecket.blogspot.com/2010/11/net-ienumerable-is-not-lazy.html' title='.NET: IEnumerable is *not* lazy'/><author><name>Rafe</name><uri>http://www.blogger.com/profile/10169325688704651715</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Ejdzr5ACvJA/Sf1Q7ykJ8WI/AAAAAAAAAsQ/iesdshoWcgo/s320/P5240040.JPG'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6767707.post-1762578779681394680</id><published>2010-11-11T13:51:00.000+10:30</published><updated>2010-11-11T13:51:21.256+10:30</updated><title type='text'>WPF: Making ListBoxItems stretch the width of the ListBox</title><content type='html'>This is unbelievably hard for something which must be universally desired.&lt;br /&gt;&lt;br /&gt;By default, &lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;ListBoxItems &lt;/span&gt;occupy the width required by their contents, not by the width of the containing &lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;ListBox&lt;/span&gt;. &amp;nbsp;This causes your optimistically formatted columns in each &lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;ListBox &lt;/span&gt;to fail to align.&lt;br /&gt;&lt;br /&gt;Instead, add this in the &lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;Resources&lt;/span&gt;&amp;nbsp;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;&lt;usercontrol.resources&gt;&lt;/usercontrol.resources&gt;&lt;/span&gt;section:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;&amp;lt;Style x:Key="StretchingListBoxItemStyle" TargetType="ListBoxItem"&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;lt;Setter Property="HorizontalContentAlignment" Value="Stretch"/&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;&amp;lt;/Style&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;and add &lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;ItemContainerStyle="{StaticResource StretchingListBoxItemStyle}"&lt;/span&gt; to your &lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;ListBox &lt;/span&gt;attributes.&lt;br /&gt;&lt;br /&gt;Strewth.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6767707-1762578779681394680?l=ralphbecket.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ralphbecket.blogspot.com/feeds/1762578779681394680/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6767707&amp;postID=1762578779681394680' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/1762578779681394680'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/1762578779681394680'/><link rel='alternate' type='text/html' href='http://ralphbecket.blogspot.com/2010/11/wpf-making-listboxitems-stretch-width.html' title='WPF: Making ListBoxItems stretch the width of the ListBox'/><author><name>Rafe</name><uri>http://www.blogger.com/profile/10169325688704651715</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Ejdzr5ACvJA/Sf1Q7ykJ8WI/AAAAAAAAAsQ/iesdshoWcgo/s320/P5240040.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6767707.post-2170483336156013144</id><published>2010-10-08T16:22:00.003+10:30</published><updated>2010-10-08T16:22:28.117+10:30</updated><title type='text'>How to Make Visual Studio Really, Really Responsive</title><content type='html'>Turn off ReSharper. &amp;nbsp;So far, I miss it not a whit.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6767707-2170483336156013144?l=ralphbecket.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ralphbecket.blogspot.com/feeds/2170483336156013144/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6767707&amp;postID=2170483336156013144' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/2170483336156013144'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/2170483336156013144'/><link rel='alternate' type='text/html' href='http://ralphbecket.blogspot.com/2010/10/how-to-make-visual-studio-really-really.html' title='How to Make Visual Studio Really, Really Responsive'/><author><name>Rafe</name><uri>http://www.blogger.com/profile/10169325688704651715</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Ejdzr5ACvJA/Sf1Q7ykJ8WI/AAAAAAAAAsQ/iesdshoWcgo/s320/P5240040.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6767707.post-6177652223732121616</id><published>2010-10-08T15:54:00.000+10:30</published><updated>2010-10-08T15:54:15.883+10:30</updated><title type='text'>Configuring Visual Studio 2010's Tooltip Colours</title><content type='html'>This has taken some finding. &amp;nbsp;First, install the &lt;a href="http://visualstudiogallery.msdn.microsoft.com/en-us/d0d33361-18e2-46c0-8ff2-4adea1e34fef"&gt;Productivity PowerTools Add-in&lt;/a&gt;. &amp;nbsp;Then go to &lt;i&gt;Tools &amp;gt; Options... &amp;gt; Environment &amp;gt; Fonts and Colors &amp;gt; Text Editor&lt;/i&gt; and change the settings for the &lt;i&gt;Signature Help&lt;/i&gt; items.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6767707-6177652223732121616?l=ralphbecket.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ralphbecket.blogspot.com/feeds/6177652223732121616/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6767707&amp;postID=6177652223732121616' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/6177652223732121616'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/6177652223732121616'/><link rel='alternate' type='text/html' href='http://ralphbecket.blogspot.com/2010/10/configuring-visual-studio-2010s-tooltip.html' title='Configuring Visual Studio 2010&apos;s Tooltip Colours'/><author><name>Rafe</name><uri>http://www.blogger.com/profile/10169325688704651715</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Ejdzr5ACvJA/Sf1Q7ykJ8WI/AAAAAAAAAsQ/iesdshoWcgo/s320/P5240040.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6767707.post-303593255697189509</id><published>2010-10-08T15:19:00.000+10:30</published><updated>2010-10-08T15:19:54.684+10:30</updated><title type='text'>Excellent C# Resource</title><content type='html'>&lt;a href="http://www.blackwasp.co.uk/Articles.aspx"&gt;http://www.blackwasp.co.uk/Articles.aspx&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6767707-303593255697189509?l=ralphbecket.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ralphbecket.blogspot.com/feeds/303593255697189509/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6767707&amp;postID=303593255697189509' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/303593255697189509'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/303593255697189509'/><link rel='alternate' type='text/html' href='http://ralphbecket.blogspot.com/2010/10/excellent-c-resource.html' title='Excellent C# Resource'/><author><name>Rafe</name><uri>http://www.blogger.com/profile/10169325688704651715</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Ejdzr5ACvJA/Sf1Q7ykJ8WI/AAAAAAAAAsQ/iesdshoWcgo/s320/P5240040.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6767707.post-6811122905306259184</id><published>2010-10-01T16:28:00.002+09:30</published><updated>2010-10-01T16:28:54.198+09:30</updated><title type='text'>Making things stretch in WPF</title><content type='html'>I quote from a &lt;a href="http://stackoverflow.com/questions/36108/how-to-get-controls-in-wpf-to-fill-available-space"&gt;StackOverflow reply&lt;/a&gt; by one Matt Hamilton:&lt;br /&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="border-collapse: collapse; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 18px;"&gt;&lt;div style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; clear: both; font-size: 14px; margin-bottom: 1em; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline; word-wrap: break-word;"&gt;There are also some properties you can set to force a control to fill its available space when it would otherwise not do so. For example, you can say:&lt;/div&gt;&lt;pre class="prettyprint" style="background-attachment: initial; background-clip: initial; background-color: #eeeeee; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; font-size: 14px; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 0px; max-height: 600px; overflow-x: auto; overflow-y: auto; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px; vertical-align: baseline; width: auto;"&gt;&lt;code style="background-attachment: initial; background-clip: initial; background-color: #eeeeee; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;&lt;span class="typ" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: #2b91af; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;HorizontalContentAlignment&lt;/span&gt;&lt;span class="pun" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;=&lt;/span&gt;&lt;span class="str" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: maroon; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;"Stretch"&lt;/span&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;div style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; clear: both; font-size: 14px; margin-bottom: 1em; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline; word-wrap: break-word;"&gt;... to force the contents of a control to stretch horizontally. Or you can say:&lt;/div&gt;&lt;pre class="prettyprint" style="background-attachment: initial; background-clip: initial; background-color: #eeeeee; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; font-size: 14px; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 0px; max-height: 600px; overflow-x: auto; overflow-y: auto; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px; vertical-align: baseline; width: auto;"&gt;&lt;code style="background-attachment: initial; background-clip: initial; background-color: #eeeeee; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;&lt;span class="typ" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: #2b91af; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;HorizontalAlignment&lt;/span&gt;&lt;span class="pun" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;=&lt;/span&gt;&lt;span class="str" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: maroon; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;"Stretch"&lt;/span&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;div style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; clear: both; font-size: 14px; margin-bottom: 1em; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline; word-wrap: break-word;"&gt;... to force the control itself to stretch horizontally to fill its parent.&lt;/div&gt;&lt;/span&gt;&lt;/blockquote&gt;That should come in handy in future.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6767707-6811122905306259184?l=ralphbecket.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ralphbecket.blogspot.com/feeds/6811122905306259184/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6767707&amp;postID=6811122905306259184' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/6811122905306259184'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/6811122905306259184'/><link rel='alternate' type='text/html' href='http://ralphbecket.blogspot.com/2010/10/making-things-stretch-in-wpf.html' title='Making things stretch in WPF'/><author><name>Rafe</name><uri>http://www.blogger.com/profile/10169325688704651715</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Ejdzr5ACvJA/Sf1Q7ykJ8WI/AAAAAAAAAsQ/iesdshoWcgo/s320/P5240040.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6767707.post-8382605082010230519</id><published>2010-09-30T09:37:00.003+09:30</published><updated>2010-10-04T11:02:20.300+10:30</updated><title type='text'>Synchronization in .NET: ManualResetEvents and Monitors</title><content type='html'>I recently needed to simultaneously wake an arbitrary number of waiting threads, each waiting on some condition. &amp;nbsp;My first approach was to have a shared &lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;ManualResetEvent&lt;/span&gt;, a subclass of &lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;EventWaitHandle &lt;/span&gt;with the property that &lt;i&gt;"Once it has been signaled, &lt;/i&gt;&lt;span class="input"&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;&lt;i&gt;ManualResetEvent&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;&lt;i&gt; &lt;/i&gt;&lt;/span&gt;&lt;i&gt;remains signaled until it is manually  reset. That is, calls to &lt;/i&gt;&lt;span class="input"&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;&lt;i&gt;WaitOne&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;&lt;i&gt; &lt;/i&gt;&lt;/span&gt;&lt;i&gt;return  immediately."&lt;/i&gt; (MSDN docs.) &amp;nbsp;[.NET also has &lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;AutoResetEvents&lt;/span&gt;, but with these only &lt;i&gt;one &lt;/i&gt;waiting thread is woken when the event is signalled.]&lt;br /&gt;&lt;br /&gt;The idiom I was using was this: I had a global &lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;ManualResetEvent &lt;/span&gt;called &lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;WakeUp&lt;/span&gt;; threads waiting on the condition would call &lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;WakeUp.WaitOne() &lt;/span&gt;(causing them to sleep until...); a thread identifying the waking condition would call &lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;WakeUp.Set(); WakeUp.Reset()&lt;/span&gt;. &amp;nbsp;My reading of the MSDN documentation is that the call to &lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;Set() &lt;/span&gt;should wake &lt;i&gt;all&lt;/i&gt;&amp;nbsp;waiting threads, while the call to &lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;Reset()&lt;/span&gt; should reset the event handle for the next wake-up signal.&lt;br /&gt;&lt;br /&gt;Tragically, this did not work and my program would randomly flounder. &amp;nbsp;If I added a delay between the &lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;Set() &lt;/span&gt;and &lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;Reset() &lt;/span&gt;calls, the likelihood of floundering reduced, but wasn't eliminated -- and, besides, that is too disgraceful a hack to contemplate for more than a moment.&lt;br /&gt;&lt;br /&gt;The &lt;i&gt;right&lt;/i&gt;&amp;nbsp;solution was to use a Monitor. &amp;nbsp;The idiom here is as follows:&lt;br /&gt;&lt;br /&gt;&lt;b&gt;For Threads Waiting On Some Condition&lt;/b&gt;&lt;br /&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;Monitor.Enter(SyncObj);&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;while (!condition) { Monitor.Wait(SyncObj); }&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;Monitor.Exit(SyncObj);&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;which can be abbreviated to&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;lock (SyncObj) {&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;&amp;nbsp;&amp;nbsp;while (!condition) { Monitor.Wait(SyncObj); }&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;For Threads Establishing Some Condition&lt;/b&gt;&lt;br /&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;Monitor.Enter(SyncObj);&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;// Establish condition.&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;Monitor.PulseAll(SyncObj);&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;Monitor.Exit(SyncObj);&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;which can be abbreviated to&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;&lt;div style="font-family: 'Times New Roman'; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: 'Times New Roman'; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;lock (SyncObj) {&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: 'Times New Roman'; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;&amp;nbsp;&amp;nbsp;// Establish condition.&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: 'Times New Roman'; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;&amp;nbsp;&amp;nbsp;Monitor.PulseAll(SyncObj);&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: 'Times New Roman'; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Peace at last... &amp;nbsp;(For the curious, in this particular application it would not have been sensible to set up a separate event handle for each condition, which is what one would normally do.)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6767707-8382605082010230519?l=ralphbecket.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ralphbecket.blogspot.com/feeds/8382605082010230519/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6767707&amp;postID=8382605082010230519' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/8382605082010230519'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/8382605082010230519'/><link rel='alternate' type='text/html' href='http://ralphbecket.blogspot.com/2010/09/synchronization-net-manualresetevents.html' title='Synchronization in .NET: ManualResetEvents and Monitors'/><author><name>Rafe</name><uri>http://www.blogger.com/profile/10169325688704651715</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Ejdzr5ACvJA/Sf1Q7ykJ8WI/AAAAAAAAAsQ/iesdshoWcgo/s320/P5240040.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6767707.post-8016520697119651409</id><published>2010-09-22T15:07:00.000+09:30</published><updated>2010-09-22T15:07:13.472+09:30</updated><title type='text'>State Machine Compiler</title><content type='html'>I've just read about &lt;a href="http://smc.sourceforge.net/"&gt;SMC&lt;/a&gt;, an open source state-machine compiler targetting multiple languages, including C#. &amp;nbsp;I can see this coming in rather handy.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6767707-8016520697119651409?l=ralphbecket.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ralphbecket.blogspot.com/feeds/8016520697119651409/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6767707&amp;postID=8016520697119651409' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/8016520697119651409'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/8016520697119651409'/><link rel='alternate' type='text/html' href='http://ralphbecket.blogspot.com/2010/09/state-machine-compiler.html' title='State Machine Compiler'/><author><name>Rafe</name><uri>http://www.blogger.com/profile/10169325688704651715</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Ejdzr5ACvJA/Sf1Q7ykJ8WI/AAAAAAAAAsQ/iesdshoWcgo/s320/P5240040.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6767707.post-1485075067863594607</id><published>2010-09-13T14:02:00.000+09:30</published><updated>2010-09-13T14:02:45.781+09:30</updated><title type='text'>Trouble with nulls</title><content type='html'>Following a conversation with a colleague, I have decided to put to paper what I think is wrong with nulls.&lt;br /&gt;&lt;br /&gt;Essentially, this: to the compiler, null means "uninitialised". &amp;nbsp;It is the default value given to references.&lt;br /&gt;&lt;br /&gt;As programmers, however, we invariably overload null with other meanings, such as "the empty list", "the empty string", "the unspecified option", and so forth.&lt;br /&gt;&lt;br /&gt;This is bad, because I want the tools (compiler, debugger, etc.) to tell me the difference between "I have forgotten to initialise this variable" and "I have put the wrong value in this variable".&lt;br /&gt;&lt;br /&gt;As it is, I end up with a bastardised mixture of meanings in my code requiring a &lt;i&gt;lot&lt;/i&gt;&amp;nbsp;of checking that would otherwise be redundant.&lt;br /&gt;&lt;br /&gt;Maybe code contracts will be able to clean up this mess...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6767707-1485075067863594607?l=ralphbecket.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ralphbecket.blogspot.com/feeds/1485075067863594607/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6767707&amp;postID=1485075067863594607' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/1485075067863594607'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/1485075067863594607'/><link rel='alternate' type='text/html' href='http://ralphbecket.blogspot.com/2010/09/trouble-with-nulls.html' title='Trouble with nulls'/><author><name>Rafe</name><uri>http://www.blogger.com/profile/10169325688704651715</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Ejdzr5ACvJA/Sf1Q7ykJ8WI/AAAAAAAAAsQ/iesdshoWcgo/s320/P5240040.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6767707.post-3356365448158275699</id><published>2010-09-06T12:09:00.000+09:30</published><updated>2010-09-06T12:09:55.555+09:30</updated><title type='text'>Equality in C#</title><content type='html'>&lt;a href="http://www.codeproject.com/KB/dotnet/IEquatable.aspx"&gt;Here&lt;/a&gt; is a good article on the subject.&lt;br /&gt;&lt;br /&gt;I wish, I wish, I wish that C# had ditched nulls and default reference equality; that's such a 1960s resource limited way of thinking. &amp;nbsp;Equality should mean structural equality by default; one should have to explicitly ask for reference equality or nullable types.&lt;br /&gt;&lt;br /&gt;Oh well, here's the summary:&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Implement IEquatable&lt;t&gt;.Equals(T).&lt;/t&gt;&lt;/li&gt;&lt;ul&gt;&lt;li&gt;Remember to check for null and reference equality.&lt;/li&gt;&lt;/ul&gt;&lt;li&gt;Override object.Equals(object).&lt;/li&gt;&lt;li&gt;object.Equals(object, object) does what you expect by first testing for nulls and reference equality.&lt;/li&gt;&lt;li&gt;Override object.GetHashCode.&lt;/li&gt;&lt;li&gt;If you implement == (reference equality by default), also implement !=.&lt;/li&gt;&lt;li&gt;Implement the == and != operators for value types to avoid the need for boxing.&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6767707-3356365448158275699?l=ralphbecket.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ralphbecket.blogspot.com/feeds/3356365448158275699/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6767707&amp;postID=3356365448158275699' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/3356365448158275699'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/3356365448158275699'/><link rel='alternate' type='text/html' href='http://ralphbecket.blogspot.com/2010/09/equality-in-c.html' title='Equality in C#'/><author><name>Rafe</name><uri>http://www.blogger.com/profile/10169325688704651715</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Ejdzr5ACvJA/Sf1Q7ykJ8WI/AAAAAAAAAsQ/iesdshoWcgo/s320/P5240040.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6767707.post-8249320233844182433</id><published>2010-09-01T15:20:00.000+09:30</published><updated>2010-09-01T15:20:20.385+09:30</updated><title type='text'>WPF and XAML</title><content type='html'>WPF is Windows Presentation Foundation. &amp;nbsp;It seems like a first class framework to me.&lt;br /&gt;&lt;br /&gt;XAML is Microsoft's eXtensible Application Markup Language. &amp;nbsp;It is a way of describing user interfaces in XML. &amp;nbsp;It is rich and powerful.&lt;br /&gt;&lt;br /&gt;But, why, in the name of all that is holy, is it not composable?! &amp;nbsp;For the life of me, I cannot understand why a fragment X works as expected in context Y, but not in context Z. &amp;nbsp;Nor does the documentation I have been wading through (as in, trying to make progress through the Augean stables) been of any help. &amp;nbsp;The whole of the net is filled with anecdotal solutions to common problems with, so far, not one whit of a general set of principles to help guide one through the quagmire of UI development using XAML. &amp;nbsp;I am giving serious consideration to not using it on my next project, but rather coding everything up directly in C#. &amp;nbsp;I would put money on this being vastly more productive.&lt;br /&gt;&lt;br /&gt;I have just ordered a book on the subject that sounds as though it will explain things to my satisfaction ("Applications = Code + Markup" by Charles Petzold, who is apparently something of a luminary). &amp;nbsp;Of course, this being a modern programming book it doubles as a keep-fit device, weighing in at something over 1000 pages.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6767707-8249320233844182433?l=ralphbecket.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ralphbecket.blogspot.com/feeds/8249320233844182433/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6767707&amp;postID=8249320233844182433' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/8249320233844182433'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/8249320233844182433'/><link rel='alternate' type='text/html' href='http://ralphbecket.blogspot.com/2010/09/wpf-and-xaml.html' title='WPF and XAML'/><author><name>Rafe</name><uri>http://www.blogger.com/profile/10169325688704651715</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Ejdzr5ACvJA/Sf1Q7ykJ8WI/AAAAAAAAAsQ/iesdshoWcgo/s320/P5240040.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6767707.post-576322480603243083</id><published>2010-08-10T09:48:00.000+09:30</published><updated>2010-08-10T09:48:11.558+09:30</updated><title type='text'>PowerTab for PowerShell</title><content type='html'>PowerShell is excellent.&lt;br /&gt;&lt;br /&gt;The default command line environment was obviously written by a bunch of monkeys (who on Earth wants to block select &lt;i&gt;rectangles &lt;/i&gt;of text rather than lines of text?).&lt;br /&gt;&lt;br /&gt;PowerTab is a module that goes some way towards fixing the woeful keep-tabbing-until-you-hit-the-completion-you-want tab-completion behaviour.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6767707-576322480603243083?l=ralphbecket.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ralphbecket.blogspot.com/feeds/576322480603243083/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6767707&amp;postID=576322480603243083' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/576322480603243083'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/576322480603243083'/><link rel='alternate' type='text/html' href='http://ralphbecket.blogspot.com/2010/08/powertab-for-powershell.html' title='PowerTab for PowerShell'/><author><name>Rafe</name><uri>http://www.blogger.com/profile/10169325688704651715</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Ejdzr5ACvJA/Sf1Q7ykJ8WI/AAAAAAAAAsQ/iesdshoWcgo/s320/P5240040.JPG'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6767707.post-2608390693751565632</id><published>2010-08-05T12:56:00.000+09:30</published><updated>2010-08-05T12:56:29.025+09:30</updated><title type='text'>Dates and Times and Timezones and .NET</title><content type='html'>Yesterday I learned something about parsing dates and times. &amp;nbsp;I was trying to get a .NET application to process date/time strings of the form "2010-08-04T16:30:00 CEST" using DateTime.TryParse. &amp;nbsp;This approach didn't work because .NET doesn't grok timezone strings like "CEST" (Central European Summer Time).&lt;br /&gt;&lt;br /&gt;My first thought was that since CEST is defined as UTC+2 (i.e., Universal Coordinated Time plus two hours), I could rewrite these date/time strings as "2010-08-04T16:30:00+02:00", which DateTime.TryParse can handle (note that the timezone delta on the end must be &lt;i&gt;subtracted&lt;/i&gt;&amp;nbsp;from the preceding date/time to obtain UTC). &amp;nbsp;My attempts to tackle this were stymied by the fact that timezone names &lt;i&gt;are not unique.&lt;/i&gt;&amp;nbsp;&amp;nbsp;For example, CST can mean either Central Summer Time or Central Standard Time, and that's just in Australia!&lt;br /&gt;&lt;br /&gt;So, to conclude, for the love of all that is holy, &lt;b&gt;don't use timezone names&lt;/b&gt;&amp;nbsp;in your date/time strings. &amp;nbsp;Use attached UTC deltas instead.&lt;br /&gt;&lt;br /&gt;[For those who are wondering, as I did, the difference between UTC and GMT is never allowed to exceed 0.9s; UTC is atomic clock time with some leap seconds added here and there; GMT is not.]&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6767707-2608390693751565632?l=ralphbecket.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ralphbecket.blogspot.com/feeds/2608390693751565632/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6767707&amp;postID=2608390693751565632' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/2608390693751565632'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/2608390693751565632'/><link rel='alternate' type='text/html' href='http://ralphbecket.blogspot.com/2010/08/dates-and-times-and-timezones-and-net.html' title='Dates and Times and Timezones and .NET'/><author><name>Rafe</name><uri>http://www.blogger.com/profile/10169325688704651715</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Ejdzr5ACvJA/Sf1Q7ykJ8WI/AAAAAAAAAsQ/iesdshoWcgo/s320/P5240040.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6767707.post-923682482512044358</id><published>2010-07-29T22:32:00.000+09:30</published><updated>2010-07-29T22:32:17.209+09:30</updated><title type='text'>DNS Problems with Blizzard's StarCraft II Patch Installer</title><content type='html'>After much anticipation, my copy of StarCraft II arrived in the post yesterday. &amp;nbsp;I installed it. &amp;nbsp;I ran it. &amp;nbsp;It immediately started downloading a patch. &amp;nbsp;Ten megabytes later, I lost all internet connectivity. &amp;nbsp;Again, again, and a-bloody-gain. &amp;nbsp;Now, it turns out I had recently upgraded to Windows 7, a thing of beauty, which automatically ran a network diagnostic tool and reported that there was a problem with the DNS service. &amp;nbsp;Hmm, thinks I, maybe iiNet (who are my otherwise rather good ISP) have cocked up their DNS server. &amp;nbsp;After a bit of resettery, I discover that Google have a publically available DNS server (8.8.8.8). &amp;nbsp;I add this as the backup DNS server and, lo and behold, glorious sustained connectivity.&lt;br /&gt;&lt;br /&gt;Having shared this with you, I am now about to abandon society and join the StarCraftiverse for some time. &amp;nbsp;Adieu.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6767707-923682482512044358?l=ralphbecket.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ralphbecket.blogspot.com/feeds/923682482512044358/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6767707&amp;postID=923682482512044358' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/923682482512044358'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/923682482512044358'/><link rel='alternate' type='text/html' href='http://ralphbecket.blogspot.com/2010/07/dns-problems-with-blizzards-starcraft.html' title='DNS Problems with Blizzard&apos;s StarCraft II Patch Installer'/><author><name>Rafe</name><uri>http://www.blogger.com/profile/10169325688704651715</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Ejdzr5ACvJA/Sf1Q7ykJ8WI/AAAAAAAAAsQ/iesdshoWcgo/s320/P5240040.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6767707.post-4836053755250636751</id><published>2010-06-25T16:25:00.000+09:30</published><updated>2010-06-25T16:25:40.850+09:30</updated><title type='text'>Changing Jobs!</title><content type='html'>After nine excellent years at the University of Melbourne, I'm leaving to take up a new position as a senior software engineer at an IT firm in the heart of Melbourne. &amp;nbsp;I'll miss working with everyone at the University, but I'm also very excited about the new challenge. &amp;nbsp;The chaps here had a whip-round and bought me a 1997 Speyside single malt. &amp;nbsp;FANTASTIC! &amp;nbsp;This bottle is what I believe is cask strength, at nearly 60% alchohol, and will have to be approached with caution.&lt;br /&gt;&lt;br /&gt;Farewell drinks tonight!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6767707-4836053755250636751?l=ralphbecket.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ralphbecket.blogspot.com/feeds/4836053755250636751/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6767707&amp;postID=4836053755250636751' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/4836053755250636751'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/4836053755250636751'/><link rel='alternate' type='text/html' href='http://ralphbecket.blogspot.com/2010/06/changing-jobs.html' title='Changing Jobs!'/><author><name>Rafe</name><uri>http://www.blogger.com/profile/10169325688704651715</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Ejdzr5ACvJA/Sf1Q7ykJ8WI/AAAAAAAAAsQ/iesdshoWcgo/s320/P5240040.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6767707.post-3063267262182216291</id><published>2010-06-09T11:11:00.000+09:30</published><updated>2010-06-09T11:11:40.260+09:30</updated><title type='text'>Searle on Deconstructionism</title><content type='html'>&lt;a href="http://free--expression.blogspot.com/2007/10/john-searle-on-derrida.html"&gt;This&lt;/a&gt; is John Searle's priceless take on deconstructionism.  One footnote is particularly amusing:&lt;br /&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: Trebuchet, 'Trebuchet MS', Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;I said that deconstruction had found little appeal among professional philosophers. But there are some notable exceptions, much prized by deconstructioni&lt;wbr&gt;&lt;/wbr&gt;sts. They tend to be ambiguous allies. One of these characterized Derrida as "the sort of philosopher who gives bullshit a bad name." We cannot, of course, exclude the possibility that this may be an expression of praise in the deconstructioni&lt;wbr&gt;&lt;/wbr&gt;st vocabulary.&lt;/span&gt;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6767707-3063267262182216291?l=ralphbecket.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ralphbecket.blogspot.com/feeds/3063267262182216291/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6767707&amp;postID=3063267262182216291' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/3063267262182216291'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/3063267262182216291'/><link rel='alternate' type='text/html' href='http://ralphbecket.blogspot.com/2010/06/searle-on-deconstructionism.html' title='Searle on Deconstructionism'/><author><name>Rafe</name><uri>http://www.blogger.com/profile/10169325688704651715</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Ejdzr5ACvJA/Sf1Q7ykJ8WI/AAAAAAAAAsQ/iesdshoWcgo/s320/P5240040.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6767707.post-5834305514369833246</id><published>2010-06-02T14:23:00.000+09:30</published><updated>2010-06-02T14:23:07.550+09:30</updated><title type='text'>A marvellous crytpic crossword clue</title><content type='html'>&lt;b&gt;Clue:&lt;/b&gt; hijklmno (5 letters)&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Answer:&lt;/b&gt; &lt;span style="color:black;background-color:black"&gt;water&lt;/span&gt; (highlight with your mouse to see the solution).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6767707-5834305514369833246?l=ralphbecket.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ralphbecket.blogspot.com/feeds/5834305514369833246/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6767707&amp;postID=5834305514369833246' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/5834305514369833246'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/5834305514369833246'/><link rel='alternate' type='text/html' href='http://ralphbecket.blogspot.com/2010/06/marvellous-crytpic-crossword-clue.html' title='A marvellous crytpic crossword clue'/><author><name>Rafe</name><uri>http://www.blogger.com/profile/10169325688704651715</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Ejdzr5ACvJA/Sf1Q7ykJ8WI/AAAAAAAAAsQ/iesdshoWcgo/s320/P5240040.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6767707.post-3460860563346313452</id><published>2010-05-01T16:48:00.002+09:30</published><updated>2010-05-01T16:48:56.846+09:30</updated><title type='text'>C# Namespaces</title><content type='html'>&lt;h2&gt;Do not use the same name for a namespace and a class.&lt;/h2&gt;It only leads to madness and divorce.&lt;br /&gt;&lt;br /&gt;I've just spent a merry half hour finding this out.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6767707-3460860563346313452?l=ralphbecket.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ralphbecket.blogspot.com/feeds/3460860563346313452/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6767707&amp;postID=3460860563346313452' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/3460860563346313452'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/3460860563346313452'/><link rel='alternate' type='text/html' href='http://ralphbecket.blogspot.com/2010/05/c-namespaces.html' title='C# Namespaces'/><author><name>Rafe</name><uri>http://www.blogger.com/profile/10169325688704651715</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Ejdzr5ACvJA/Sf1Q7ykJ8WI/AAAAAAAAAsQ/iesdshoWcgo/s320/P5240040.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6767707.post-7322781236585426338</id><published>2010-04-30T10:35:00.000+09:30</published><updated>2010-04-30T10:35:58.967+09:30</updated><title type='text'>WotD: tropology and tropometer</title><content type='html'>From Jarrold's Dictionary of Difficult Words:&lt;br /&gt;&lt;br /&gt;&lt;b&gt;tropology&lt;/b&gt;, n. figurative style of writing; interpretation of Bible stressing figurative nature of language.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;tropometer&lt;/b&gt;, n. instr. measuring rotation.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6767707-7322781236585426338?l=ralphbecket.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ralphbecket.blogspot.com/feeds/7322781236585426338/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6767707&amp;postID=7322781236585426338' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/7322781236585426338'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/7322781236585426338'/><link rel='alternate' type='text/html' href='http://ralphbecket.blogspot.com/2010/04/wotd-tropology-and-tropometer.html' title='WotD: tropology and tropometer'/><author><name>Rafe</name><uri>http://www.blogger.com/profile/10169325688704651715</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Ejdzr5ACvJA/Sf1Q7ykJ8WI/AAAAAAAAAsQ/iesdshoWcgo/s320/P5240040.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6767707.post-1751316811835042468</id><published>2010-04-29T09:21:00.000+09:30</published><updated>2010-04-29T09:21:00.246+09:30</updated><title type='text'>WotD: ambry and ambsace</title><content type='html'>From Jarrold's Dictionary of Difficult Words:&lt;br /&gt;&lt;br /&gt;&lt;b&gt;ambry&lt;/b&gt; n. niche; cupboard, espec. containing sacred vessels in chancel.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;ambsace&lt;/b&gt; n. double ace; lowest score; bad luck.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6767707-1751316811835042468?l=ralphbecket.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ralphbecket.blogspot.com/feeds/1751316811835042468/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6767707&amp;postID=1751316811835042468' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/1751316811835042468'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/1751316811835042468'/><link rel='alternate' type='text/html' href='http://ralphbecket.blogspot.com/2010/04/wotd-ambry-and-ambsace.html' title='WotD: ambry and ambsace'/><author><name>Rafe</name><uri>http://www.blogger.com/profile/10169325688704651715</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Ejdzr5ACvJA/Sf1Q7ykJ8WI/AAAAAAAAAsQ/iesdshoWcgo/s320/P5240040.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6767707.post-6635097687782227140</id><published>2010-04-28T11:46:00.000+09:30</published><updated>2010-04-28T11:46:36.458+09:30</updated><title type='text'>False positives</title><content type='html'>Consider an individual X who is tested for a disease.&lt;br /&gt;Let D mean "X has the disease" and -D mean "X does not have the disease".&lt;br /&gt;Let T mean "X has tested positive for the disease".&lt;br /&gt;Let P(A) mean "the probability that A is true".&lt;br /&gt;Let P(A|B) mean "the probability that A is true given that B is true".&lt;br /&gt;&lt;br /&gt;&lt;b&gt;We are given P(D), P(T|D), and P(T|-D).&lt;/b&gt;&lt;br /&gt;(i.e.: the probability that X has the disease; the probability of getting a positive test if X really does have the disease; and the probability of getting a false positive test if X actually doesn't have the disease, respectively).&lt;br /&gt;Note that P(-D) = 1 - P(D).&lt;br /&gt;&lt;br /&gt;&lt;b&gt;What is P(D|T)?&lt;/b&gt;&lt;br /&gt;(i.e.: what is the probability that X has the disease given that X tested positive for the disease?)&lt;br /&gt;&lt;br /&gt;Let u = P(D).P(T|D) be the probability that X tests positive &lt;em&gt;and&lt;/em&gt; has the disease.&lt;br /&gt;Let v = P(-D).P(T|-D) be the probability that X tests positive &lt;em&gt;and yet&lt;/em&gt; doesn't have the disease.&lt;br /&gt;&lt;br /&gt;These are the only ways X can get a positive test result.  It follows that&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Solution: P(D|T) = u/(u + v)&lt;/b&gt;&lt;br /&gt;(i.e.: the probability that X has the disease given X tested positive is the fraction of positive results for X that are actually correct).&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Practical application.&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Since disease is rare, P(-D) will be much larger than P(D).  Therefore if P(T|-D) (the chance of a false positive) is not &lt;em&gt;very&lt;/em&gt; small, then v = P(-D).P(T|-D) will be large, hence P(D|T) will be relatively low (i.e., a positive test will probably not mean that X actually has the disease).&lt;br /&gt;&lt;br /&gt;Bottom line: make sure your tests have a low false-positive rate.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6767707-6635097687782227140?l=ralphbecket.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ralphbecket.blogspot.com/feeds/6635097687782227140/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6767707&amp;postID=6635097687782227140' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/6635097687782227140'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/6635097687782227140'/><link rel='alternate' type='text/html' href='http://ralphbecket.blogspot.com/2010/04/false-positives.html' title='False positives'/><author><name>Rafe</name><uri>http://www.blogger.com/profile/10169325688704651715</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Ejdzr5ACvJA/Sf1Q7ykJ8WI/AAAAAAAAAsQ/iesdshoWcgo/s320/P5240040.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6767707.post-2751075367253213774</id><published>2010-04-23T12:36:00.002+09:30</published><updated>2010-04-27T12:41:34.041+09:30</updated><title type='text'>Covariance and Contravariance</title><content type='html'>On occasion I've mixed these terms up.  Taking X : T to mean "X has/is compatible with type T", then:&lt;br /&gt;&lt;br /&gt;X : T is &lt;em&gt;covariant&lt;/em&gt; if X can also take on a subtype of T;&lt;br /&gt;&lt;br /&gt;X : T is &lt;em&gt;contravariant&lt;/em&gt; if X can also take on a supertype of T.&lt;br /&gt;&lt;br /&gt;Consider the expression Ys = map(F, Xs) where&lt;br /&gt;Xs : list(Tx),&lt;br /&gt;Ys : list(Ty), and&lt;br /&gt;F : U -&gt; V.&lt;br /&gt;&lt;br /&gt;Clearly F must accept values of type Tx (or some supertype thereof), therefore U must be of type Tx (or some &lt;em&gt;supertype&lt;/em&gt; thereof), hence F is &lt;em&gt;contravariant in its argument&lt;/em&gt;.&lt;br /&gt;&lt;br /&gt;On the other hand, F must return values of type Ty (or some subtype thereof), therefore V must be of type Ty (or some &lt;em&gt;subtype&lt;/em&gt; thereof), hence F is &lt;em&gt;covariant in its return type&lt;/em&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6767707-2751075367253213774?l=ralphbecket.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ralphbecket.blogspot.com/feeds/2751075367253213774/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6767707&amp;postID=2751075367253213774' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/2751075367253213774'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/2751075367253213774'/><link rel='alternate' type='text/html' href='http://ralphbecket.blogspot.com/2010/04/covariance-and-contravariance.html' title='Covariance and Contravariance'/><author><name>Rafe</name><uri>http://www.blogger.com/profile/10169325688704651715</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Ejdzr5ACvJA/Sf1Q7ykJ8WI/AAAAAAAAAsQ/iesdshoWcgo/s320/P5240040.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6767707.post-2693125734946921430</id><published>2010-04-19T14:00:00.000+09:30</published><updated>2010-04-19T14:00:11.434+09:30</updated><title type='text'>Ugly Betty - Nooooooooo!</title><content type='html'>Ugly Betty has aired it's final episode.  We grow sad...&lt;br /&gt;&lt;br /&gt;UB was the finest, smartest comedy I've seen on television and the cast and scriptwriters managed to maintain the level from start to end throughout all four of its seasons.  Good for them for finishing it well rather than running the show into the ground.&lt;br /&gt;&lt;br /&gt;UB was the comedy that the West Wing writers could have written.  It was just that good.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6767707-2693125734946921430?l=ralphbecket.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ralphbecket.blogspot.com/feeds/2693125734946921430/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6767707&amp;postID=2693125734946921430' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/2693125734946921430'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/2693125734946921430'/><link rel='alternate' type='text/html' href='http://ralphbecket.blogspot.com/2010/04/ugly-betty-nooooooooo.html' title='Ugly Betty - Nooooooooo!'/><author><name>Rafe</name><uri>http://www.blogger.com/profile/10169325688704651715</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Ejdzr5ACvJA/Sf1Q7ykJ8WI/AAAAAAAAAsQ/iesdshoWcgo/s320/P5240040.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6767707.post-4945853918981853376</id><published>2010-04-03T11:50:00.000+10:30</published><updated>2010-04-03T11:50:03.971+10:30</updated><title type='text'>My First StarCraft On-line Win!</title><content type='html'>Kum bay yah, I have finally won a game.  This is more of an achievement than you think given how bad I am at StarCraft.  (I play as 'theoctopi' on ICCup if anyone's interested.)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6767707-4945853918981853376?l=ralphbecket.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ralphbecket.blogspot.com/feeds/4945853918981853376/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6767707&amp;postID=4945853918981853376' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/4945853918981853376'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/4945853918981853376'/><link rel='alternate' type='text/html' href='http://ralphbecket.blogspot.com/2010/04/my-first-starcraft-on-line-win.html' title='My First StarCraft On-line Win!'/><author><name>Rafe</name><uri>http://www.blogger.com/profile/10169325688704651715</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Ejdzr5ACvJA/Sf1Q7ykJ8WI/AAAAAAAAAsQ/iesdshoWcgo/s320/P5240040.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6767707.post-3967819913725861024</id><published>2010-04-03T11:48:00.000+10:30</published><updated>2010-04-03T11:48:18.453+10:30</updated><title type='text'>Extended C type generator tools</title><content type='html'>I've extended my set of &lt;a href="http://code.google.com/p/rafestools/source/browse/#svn/trunk"&gt;C tools&lt;/a&gt; for generating common data types.  Now there are generators for list types, 'maybe' types, and expanding array types.  Now with one command line invocation you can generate hundreds of lines of bug-free (!) boilerplate C code.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6767707-3967819913725861024?l=ralphbecket.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ralphbecket.blogspot.com/feeds/3967819913725861024/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6767707&amp;postID=3967819913725861024' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/3967819913725861024'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/3967819913725861024'/><link rel='alternate' type='text/html' href='http://ralphbecket.blogspot.com/2010/04/extended-c-type-generator-tools.html' title='Extended C type generator tools'/><author><name>Rafe</name><uri>http://www.blogger.com/profile/10169325688704651715</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Ejdzr5ACvJA/Sf1Q7ykJ8WI/AAAAAAAAAsQ/iesdshoWcgo/s320/P5240040.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6767707.post-4031698406605930917</id><published>2010-03-30T09:31:00.000+10:30</published><updated>2010-03-30T09:31:48.738+10:30</updated><title type='text'>Tool for generating algebraic types in C</title><content type='html'>I've spent a few evenings crafting a tool to automatically generate C code implementing algebraic data types (or discriminated union types) from short specification files.  For example, the following specification&lt;br /&gt;&lt;pre&gt;@ type a_b_tree&lt;br /&gt;@ constructor a&lt;br /&gt;@ constructor b&lt;br /&gt;@ constructor branch&lt;br /&gt;l : a_b_tree *&lt;br /&gt;r : a_b_tree *&lt;br /&gt;@{&lt;br /&gt;    if (l == NULL || r == NULL) {&lt;br /&gt;        fprintf(stderr, "a_b_tree: branch cannot have NULL arguments.\n");&lt;br /&gt; exit(1);&lt;br /&gt;    }&lt;br /&gt;}@&lt;br /&gt;@ end&lt;br /&gt;&lt;/pre&gt;expands to 144 lines of C (counting the .h and .c files).&lt;br /&gt;&lt;br /&gt;The transformation supports&lt;br /&gt;&lt;ul&gt;&lt;li&gt; generation of constructor, deconstructor, and freeing functions;&lt;br /&gt;&lt;li&gt; optimised handling of constructors with no arguments (memory is not allocated for separate instances of these);&lt;br /&gt;&lt;li&gt; optimised handling of types with only a single constructor (there is no need in this case to distinguish between the type and its constructor);&lt;br /&gt;&lt;li&gt; user specifiable malloc and free functions;&lt;br /&gt;&lt;li&gt; user specifiable header and footer code for the generated .h and .c files.&lt;br /&gt;&lt;/ul&gt;You can download this tool &lt;a href="http://code.google.com/p/dutypes/"&gt;here&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6767707-4031698406605930917?l=ralphbecket.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ralphbecket.blogspot.com/feeds/4031698406605930917/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6767707&amp;postID=4031698406605930917' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/4031698406605930917'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/4031698406605930917'/><link rel='alternate' type='text/html' href='http://ralphbecket.blogspot.com/2010/03/tool-for-generating-algebraic-types-in.html' title='Tool for generating algebraic types in C'/><author><name>Rafe</name><uri>http://www.blogger.com/profile/10169325688704651715</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Ejdzr5ACvJA/Sf1Q7ykJ8WI/AAAAAAAAAsQ/iesdshoWcgo/s320/P5240040.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6767707.post-3761486225221807258</id><published>2010-03-11T12:15:00.000+10:30</published><updated>2010-03-11T12:15:11.622+10:30</updated><title type='text'>The anomaly method and UHI</title><content type='html'>&lt;a href="http://rankexploits.com/musings/2010/in-search-of-the-uhi-signal/"&gt;This&lt;/a&gt; is rather interesting.  It seems the anomaly method of only considering digressions from the mean of a temperature series (i.e., the series' anomalies) does account for the urban heat island effect (i.e., it effectively removes the unwanted UHI component from the signal).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6767707-3761486225221807258?l=ralphbecket.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ralphbecket.blogspot.com/feeds/3761486225221807258/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6767707&amp;postID=3761486225221807258' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/3761486225221807258'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/3761486225221807258'/><link rel='alternate' type='text/html' href='http://ralphbecket.blogspot.com/2010/03/anomaly-method-and-uhi.html' title='The anomaly method and UHI'/><author><name>Rafe</name><uri>http://www.blogger.com/profile/10169325688704651715</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Ejdzr5ACvJA/Sf1Q7ykJ8WI/AAAAAAAAAsQ/iesdshoWcgo/s320/P5240040.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6767707.post-3305905709689741738</id><published>2010-03-04T15:36:00.000+10:30</published><updated>2010-03-04T15:36:41.100+10:30</updated><title type='text'>Grammar</title><content type='html'>&lt;a href="http://alt-usage-english.org/humorousrules.html"&gt;This&lt;/a&gt; is witty and helpful.&lt;br /&gt;&lt;br /&gt;I particularly like&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Don't string too many prepositional phrases together unless you are walking through the valley of the shadow of death.&lt;br /&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6767707-3305905709689741738?l=ralphbecket.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ralphbecket.blogspot.com/feeds/3305905709689741738/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6767707&amp;postID=3305905709689741738' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/3305905709689741738'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/3305905709689741738'/><link rel='alternate' type='text/html' href='http://ralphbecket.blogspot.com/2010/03/grammar.html' title='Grammar'/><author><name>Rafe</name><uri>http://www.blogger.com/profile/10169325688704651715</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Ejdzr5ACvJA/Sf1Q7ykJ8WI/AAAAAAAAAsQ/iesdshoWcgo/s320/P5240040.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6767707.post-6777823413909795421</id><published>2010-03-01T10:00:00.009+10:30</published><updated>2010-03-11T12:16:00.926+10:30</updated><title type='text'>Cute "proof" of Pythagoras' theorem</title><content type='html'>[For reasons I have yet to fathom, the ASCIIMathML plugin doesn't want to work for this page...]&lt;br /&gt;&lt;br /&gt;I'm reading &lt;a href="http://www.amazon.com/Mathematical-Mechanic-Physical-Reasoning-Problems/dp/0691140200"&gt;The Mathematical Mechanic&lt;/a&gt; by Mark Levi, a tour of various mathematical results that can be obtained much more directly (albeit without proof) by appealing to our mechanical intuition.&lt;br /&gt;&lt;br /&gt;Here's a beautiful proof from the book of Pythagoras' theorem, `a^2 + b^2 = c^2` where `a` and `b` are the opposite and adjacent sides of a right angled triangle and `c` is the hypotenuse.&lt;br /&gt;&lt;br /&gt;Consider an ice skater of mass `m` on a perfectly smooth ice rink.  The skater starts in the South West corner of the rink and pushes off against the South wall; the skater is now moving North with velocity `a` and hence has kinetic energy `ma^2/2`.  Next the skater pushes off against the West wall and adds an Easterly component `b` to their velocity.  The energy acquired from this second push is `mb^2/2`.  Now, the skater's overall velocity is `c` and overall kinetic energy is `mc^2/2`.  But this must be the sum of the energy acquired from each push, hence `ma^2/2 + mb^2/2 = mc^2/2`.  Cancel the `m/2` terms and you have Pythagoras' theorem!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6767707-6777823413909795421?l=ralphbecket.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ralphbecket.blogspot.com/feeds/6777823413909795421/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6767707&amp;postID=6777823413909795421' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/6777823413909795421'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/6777823413909795421'/><link rel='alternate' type='text/html' href='http://ralphbecket.blogspot.com/2010/03/im-reading-mathematical-mechanic-by.html' title='Cute &quot;proof&quot; of Pythagoras&apos; theorem'/><author><name>Rafe</name><uri>http://www.blogger.com/profile/10169325688704651715</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Ejdzr5ACvJA/Sf1Q7ykJ8WI/AAAAAAAAAsQ/iesdshoWcgo/s320/P5240040.JPG'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6767707.post-2674537679169056342</id><published>2010-02-24T14:58:00.001+10:30</published><updated>2010-02-24T15:00:11.208+10:30</updated><title type='text'>A roguelike I can enjoy</title><content type='html'>&lt;a href="http://crawl.akrasiac.org/"&gt;Dungeon Crawl&lt;/a&gt; is a roguelike that I can actually enjoy over a coffee break (i.e., I don't have to dedicate years of my life to it).  And you can play it over ssh.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6767707-2674537679169056342?l=ralphbecket.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ralphbecket.blogspot.com/feeds/2674537679169056342/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6767707&amp;postID=2674537679169056342' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/2674537679169056342'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/2674537679169056342'/><link rel='alternate' type='text/html' href='http://ralphbecket.blogspot.com/2010/02/roguelike-i-can-enjoy.html' title='A roguelike I can enjoy'/><author><name>Rafe</name><uri>http://www.blogger.com/profile/10169325688704651715</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Ejdzr5ACvJA/Sf1Q7ykJ8WI/AAAAAAAAAsQ/iesdshoWcgo/s320/P5240040.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6767707.post-597197309108572388</id><published>2010-02-23T09:48:00.003+10:30</published><updated>2010-02-23T09:51:21.711+10:30</updated><title type='text'>Latin phrases</title><content type='html'>&lt;ul&gt;&lt;li&gt;&lt;i&gt;"Nil carborundum illigitimi"&lt;/i&gt; - don't let the bastards get you down.;&lt;/li&gt;&lt;li&gt;&lt;i&gt;"Nullius in verba"&lt;/i&gt; - take no-one's word for it (motto of the Royal Society, apparently suspended for climate related issues);&lt;/li&gt;&lt;/ul&gt;and my personal favourite:&lt;div&gt;&lt;ul&gt;&lt;li&gt;&lt;i&gt;"Sic biscuitus disintegrat"&lt;/i&gt; - that's the way the cookie crumbles.&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6767707-597197309108572388?l=ralphbecket.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ralphbecket.blogspot.com/feeds/597197309108572388/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6767707&amp;postID=597197309108572388' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/597197309108572388'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/597197309108572388'/><link rel='alternate' type='text/html' href='http://ralphbecket.blogspot.com/2010/02/latin-phrases.html' title='Latin phrases'/><author><name>Rafe</name><uri>http://www.blogger.com/profile/10169325688704651715</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Ejdzr5ACvJA/Sf1Q7ykJ8WI/AAAAAAAAAsQ/iesdshoWcgo/s320/P5240040.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6767707.post-5243251547805492340</id><published>2010-02-22T13:43:00.003+10:30</published><updated>2010-02-22T13:48:16.230+10:30</updated><title type='text'>Probability</title><content type='html'>There's an &lt;a href="http://wmbriggs.com/blog/?p=1928#comments"&gt;interesting discussion&lt;/a&gt; on probability at William Brigg's blog.&lt;br /&gt;&lt;br /&gt;Briggs claims, and is supported by some of his readers, that given&lt;br /&gt;&lt;ul&gt;&lt;br /&gt;&lt;li&gt; I have some six sided object in my pocket&lt;br /&gt;&lt;li&gt; Exactly one face is inscribed with '6'&lt;br /&gt;&lt;/ul&gt;&lt;br /&gt;we can conclude&lt;br /&gt;&lt;ul&gt;&lt;br /&gt;&lt;li&gt; P(a '6' shows uppermost after a roll) = 1/6.&lt;br /&gt;&lt;/ul&gt;&lt;br /&gt;&lt;br /&gt;I, and some other readers, contend that no such statement can be made.  The discussion is interesting because some, like myself, see probability as a description of reality, whereas others see probability as a description of a state of knowledge.&lt;br /&gt;&lt;br /&gt;I'll be fascinated to see how this one turns out.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6767707-5243251547805492340?l=ralphbecket.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ralphbecket.blogspot.com/feeds/5243251547805492340/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6767707&amp;postID=5243251547805492340' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/5243251547805492340'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/5243251547805492340'/><link rel='alternate' type='text/html' href='http://ralphbecket.blogspot.com/2010/02/probability.html' title='Probability'/><author><name>Rafe</name><uri>http://www.blogger.com/profile/10169325688704651715</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Ejdzr5ACvJA/Sf1Q7ykJ8WI/AAAAAAAAAsQ/iesdshoWcgo/s320/P5240040.JPG'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6767707.post-1681633411112644129</id><published>2010-02-20T15:19:00.002+10:30</published><updated>2010-02-20T15:22:29.198+10:30</updated><title type='text'>Nuclear Power and Sustainability</title><content type='html'>&lt;a href="http://www.inference.phy.cam.ac.uk/withouthotair/c24/page_161.shtml"&gt;This&lt;/a&gt; is excellent: all the costs and numbers in context.  If there's one good thing about AGW madness, it's that nuclear power is back on the table as a viable option.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6767707-1681633411112644129?l=ralphbecket.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ralphbecket.blogspot.com/feeds/1681633411112644129/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6767707&amp;postID=1681633411112644129' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/1681633411112644129'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/1681633411112644129'/><link rel='alternate' type='text/html' href='http://ralphbecket.blogspot.com/2010/02/nuclear-power-and-sustainability.html' title='Nuclear Power and Sustainability'/><author><name>Rafe</name><uri>http://www.blogger.com/profile/10169325688704651715</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Ejdzr5ACvJA/Sf1Q7ykJ8WI/AAAAAAAAAsQ/iesdshoWcgo/s320/P5240040.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6767707.post-7364630912370115092</id><published>2010-02-09T11:10:00.002+10:30</published><updated>2010-02-09T11:12:23.882+10:30</updated><title type='text'>Global temperature reconstructions</title><content type='html'>&lt;a href="http://www.c3headlines.com/temperature-charts-historical-proxies.html"&gt;This&lt;/a&gt; is an interesting and large collection of temperature reconstructions derived from various proxies.  There is a pronounced Mediaeval Warm Period in most of them.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6767707-7364630912370115092?l=ralphbecket.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ralphbecket.blogspot.com/feeds/7364630912370115092/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6767707&amp;postID=7364630912370115092' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/7364630912370115092'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/7364630912370115092'/><link rel='alternate' type='text/html' href='http://ralphbecket.blogspot.com/2010/02/global-temperature-reconstructions.html' title='Global temperature reconstructions'/><author><name>Rafe</name><uri>http://www.blogger.com/profile/10169325688704651715</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Ejdzr5ACvJA/Sf1Q7ykJ8WI/AAAAAAAAAsQ/iesdshoWcgo/s320/P5240040.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6767707.post-5972150764242365886</id><published>2010-02-08T16:35:00.001+10:30</published><updated>2010-02-08T16:37:31.781+10:30</updated><title type='text'>Homeopathic dilutions</title><content type='html'>&lt;a href="http://timesonline.typepad.com/science/2010/01/homeopathy-by-the-mindboggling-numbers.html"&gt;This&lt;/a&gt; is a hoot!&lt;br /&gt;&lt;br /&gt;A quote from the full article:&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;Molecules are tiny: it takes about a billion of them to cover a standard metric full-stop. To put homeopathy in a medicinal context, if you wanted to consume a normal 500mg paracetamol dose you would need ten million billion homeopathic pills. Where each pill is the same mass as the Milky Way galaxy. There is actually not enough matter in the entire known Universe to make the homeopathic equivalent of a single paracetamol pill.&lt;br /&gt;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6767707-5972150764242365886?l=ralphbecket.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ralphbecket.blogspot.com/feeds/5972150764242365886/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6767707&amp;postID=5972150764242365886' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/5972150764242365886'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/5972150764242365886'/><link rel='alternate' type='text/html' href='http://ralphbecket.blogspot.com/2010/02/homeopathic-dilutions.html' title='Homeopathic dilutions'/><author><name>Rafe</name><uri>http://www.blogger.com/profile/10169325688704651715</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Ejdzr5ACvJA/Sf1Q7ykJ8WI/AAAAAAAAAsQ/iesdshoWcgo/s320/P5240040.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6767707.post-6835916363297255317</id><published>2010-02-02T10:45:00.000+10:30</published><updated>2010-02-02T10:46:37.671+10:30</updated><title type='text'>Handy WPF Tutorial</title><content type='html'>&lt;a href="http://www.wpftutorial.net/"&gt;This&lt;/a&gt; is a very helpful site.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6767707-6835916363297255317?l=ralphbecket.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ralphbecket.blogspot.com/feeds/6835916363297255317/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6767707&amp;postID=6835916363297255317' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/6835916363297255317'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/6835916363297255317'/><link rel='alternate' type='text/html' href='http://ralphbecket.blogspot.com/2010/02/handy-wpf-tutorial.html' title='Handy WPF Tutorial'/><author><name>Rafe</name><uri>http://www.blogger.com/profile/10169325688704651715</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Ejdzr5ACvJA/Sf1Q7ykJ8WI/AAAAAAAAAsQ/iesdshoWcgo/s320/P5240040.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6767707.post-7342688411596274379</id><published>2010-01-20T13:45:00.002+10:30</published><updated>2010-11-17T14:17:47.822+10:30</updated><title type='text'>I dearly love the English language</title><content type='html'>I like things to be simple and regular.&lt;br /&gt;&lt;br /&gt;Except for &lt;a href="http://users.tinyonline.co.uk/gswithenbank/funnyeng.htm"&gt;English&lt;/a&gt;.  And women.&lt;br /&gt;&lt;br /&gt;You should also read &lt;a href="http://www.allowe.com/Humor/book/The%20Rules%20of%20Writing.htm"&gt;this&lt;/a&gt;. &amp;nbsp;I particularly like&lt;br /&gt;&lt;ul&gt;&lt;li&gt;"Beware of malapropisms. They are a communist submersive plot."&lt;/li&gt;&lt;li&gt;"Don't string too many prepositional phrases together unless you are walking through the valley of the shadow of death."&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6767707-7342688411596274379?l=ralphbecket.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ralphbecket.blogspot.com/feeds/7342688411596274379/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6767707&amp;postID=7342688411596274379' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/7342688411596274379'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/7342688411596274379'/><link rel='alternate' type='text/html' href='http://ralphbecket.blogspot.com/2010/01/i-dearly-love-english-language.html' title='I dearly love the English language'/><author><name>Rafe</name><uri>http://www.blogger.com/profile/10169325688704651715</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Ejdzr5ACvJA/Sf1Q7ykJ8WI/AAAAAAAAAsQ/iesdshoWcgo/s320/P5240040.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6767707.post-7686041420806296547</id><published>2010-01-20T11:25:00.001+10:30</published><updated>2010-01-20T11:27:18.377+10:30</updated><title type='text'>Gnu readline wrapper</title><content type='html'>I've just come across &lt;a href="http://utopia.knoware.nl/~hlub/uck/rlwrap/"&gt;rlwrap&lt;/a&gt;, a neat little &lt;tt&gt;readline&lt;/tt&gt; wrapper for other scripts and programs.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6767707-7686041420806296547?l=ralphbecket.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ralphbecket.blogspot.com/feeds/7686041420806296547/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6767707&amp;postID=7686041420806296547' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/7686041420806296547'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/7686041420806296547'/><link rel='alternate' type='text/html' href='http://ralphbecket.blogspot.com/2010/01/gnu-readline-wrapper.html' title='Gnu readline wrapper'/><author><name>Rafe</name><uri>http://www.blogger.com/profile/10169325688704651715</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Ejdzr5ACvJA/Sf1Q7ykJ8WI/AAAAAAAAAsQ/iesdshoWcgo/s320/P5240040.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6767707.post-5090611466656058396</id><published>2010-01-10T09:50:00.002+10:30</published><updated>2010-01-10T09:51:34.792+10:30</updated><title type='text'>British Isles Snowbound</title><content type='html'>This is an amazing satellite image:&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://wattsupwiththat.files.wordpress.com/2010/01/modis_uk_snow.jpg"&gt;&lt;img style="float:right; margin:0 0 10px 10px;cursor:pointer; cursor:hand;width: 634px; height: 650px;" src="http://wattsupwiththat.files.wordpress.com/2010/01/modis_uk_snow.jpg" border="0" alt="" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6767707-5090611466656058396?l=ralphbecket.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ralphbecket.blogspot.com/feeds/5090611466656058396/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6767707&amp;postID=5090611466656058396' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/5090611466656058396'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/5090611466656058396'/><link rel='alternate' type='text/html' href='http://ralphbecket.blogspot.com/2010/01/british-isles-snowbound.html' title='British Isles Snowbound'/><author><name>Rafe</name><uri>http://www.blogger.com/profile/10169325688704651715</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Ejdzr5ACvJA/Sf1Q7ykJ8WI/AAAAAAAAAsQ/iesdshoWcgo/s320/P5240040.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6767707.post-6329908089939834453</id><published>2009-12-21T09:20:00.003+10:30</published><updated>2009-12-21T09:38:07.713+10:30</updated><title type='text'>Aikido</title><content type='html'>My &lt;a href="http://martial.com.au"&gt;aikido club&lt;/a&gt; held a &lt;a href="http://www.martial.com.au/download/attendees20091212.jpg"&gt;black-belt grading&lt;/a&gt; last weekend.  There were some excellent demonstrations of technique, including one standout first degree test and at least one top notch second degree test.&lt;br /&gt;&lt;br /&gt;Since I wasn't up for grading, I had to take ukemi (i.e., act as a crash test dummy for the deshi who were grading).  Somehow, every time I was called up the technique was something like shiho nage, which is one of the scariest throws to take.  I was more than a little chuffed to find I'm finally relaxed enough to take these big throws without having to worry - if anything, I was having fun.&lt;br /&gt;&lt;br /&gt;Th day after, however, I felt as though I'd been through the spin cycle in a washing machine.  Ouch.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6767707-6329908089939834453?l=ralphbecket.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ralphbecket.blogspot.com/feeds/6329908089939834453/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6767707&amp;postID=6329908089939834453' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/6329908089939834453'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/6329908089939834453'/><link rel='alternate' type='text/html' href='http://ralphbecket.blogspot.com/2009/12/aikido.html' title='Aikido'/><author><name>Rafe</name><uri>http://www.blogger.com/profile/10169325688704651715</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Ejdzr5ACvJA/Sf1Q7ykJ8WI/AAAAAAAAAsQ/iesdshoWcgo/s320/P5240040.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6767707.post-3632848774898897770</id><published>2009-11-30T16:20:00.000+10:30</published><updated>2009-11-30T16:21:54.106+10:30</updated><title type='text'>An interesting discussion</title><content type='html'>Take a look at &lt;a href="http://wattsupwiththat.com/2009/11/29/when-results-go-bad"&gt;this&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6767707-3632848774898897770?l=ralphbecket.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ralphbecket.blogspot.com/feeds/3632848774898897770/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6767707&amp;postID=3632848774898897770' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/3632848774898897770'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/3632848774898897770'/><link rel='alternate' type='text/html' href='http://ralphbecket.blogspot.com/2009/11/interesting-discussion.html' title='An interesting discussion'/><author><name>Rafe</name><uri>http://www.blogger.com/profile/10169325688704651715</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Ejdzr5ACvJA/Sf1Q7ykJ8WI/AAAAAAAAAsQ/iesdshoWcgo/s320/P5240040.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6767707.post-2800368390502093191</id><published>2009-11-25T12:36:00.003+10:30</published><updated>2009-11-25T12:52:41.271+10:30</updated><title type='text'>Scientific integrity</title><content type='html'>&lt;a href="http://omniclimate.wordpress.com/2009/11/24/willis-vs-the-cru-a-history-of-foi-evasion/"&gt;Incredible.&lt;/a&gt;  In fact, the whole &lt;a href="http://www.anelegantchaos.org/"&gt;"climategate"&lt;/a&gt; release of letters is some of the best scientific street theatre we've had in decades.&lt;br /&gt;&lt;br /&gt;The Australian press has, so far, been virtually silent on the issue, even though this unauthorized release of thousands of e-mails and files from the top players in climate science casts serious doubt on the credibility of climate reconstructions and the integrity of some key figures.  This is especially significant now because of the carbon emissions (economic suicide) legislation currently being bulldozed through parliament.&lt;br /&gt;&lt;br /&gt;Part of the reason may be because of the embarrassing level of uncritical support that the local science journalists have provided over the years to any alarming climate science findings.  [Note to journalists: we scientists spend a lot of time being wrong - that's why it's called research and not engineering.]&lt;span style="display: block;" id="formatbar_Buttons"&gt;&lt;span class="on down" style="display: block;" id="formatbar_CreateLink" title="Link" onmouseover="ButtonHoverOn(this);" onmouseout="ButtonHoverOff(this);" onmouseup="" onmousedown="CheckFormatting(event);FormatbarButton('richeditorframe', this, 8);ButtonMouseDown(this);"&gt;&lt;img src="http://www.blogger.com/img/blank.gif" alt="Link" class="gl_link" border="0" /&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6767707-2800368390502093191?l=ralphbecket.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ralphbecket.blogspot.com/feeds/2800368390502093191/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6767707&amp;postID=2800368390502093191' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/2800368390502093191'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/2800368390502093191'/><link rel='alternate' type='text/html' href='http://ralphbecket.blogspot.com/2009/11/scientific-integrity.html' title='Scientific integrity'/><author><name>Rafe</name><uri>http://www.blogger.com/profile/10169325688704651715</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Ejdzr5ACvJA/Sf1Q7ykJ8WI/AAAAAAAAAsQ/iesdshoWcgo/s320/P5240040.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6767707.post-3385765451596758186</id><published>2009-09-25T11:32:00.005+09:30</published><updated>2009-09-25T21:27:07.173+09:30</updated><title type='text'>Corruption of the scientific process</title><content type='html'>&lt;a href="http://www.scribd.com/doc/18773744/How-to-Publish-a-Scientific-Comment-in-1-2-3-Easy-Steps"&gt;This&lt;/a&gt; is an amusing and disturbing description of a scientist trying to get a journal to publish his reply to a paper erroneously refuting his life's work.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The author refrains from mentioning his field, but it isn't the first time a story like this has come to my attention (see, e.g., Steve McIntyre's various experiences in the world of climate research at &lt;a href="http://www.climateaudit.org/"&gt;www.climateaudit.org&lt;/a&gt;).&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Here's another amusing/disturbing &lt;a href="http://bishophill.squarespace.com/blog/2008/8/11/caspar-and-the-jesus-paper.html"&gt;story&lt;/a&gt; from the top ranks of the climate world.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Astounding.  Compared with the commonly held myth that "peer reviewed" means "case proven", this sort of thing can only be doing real damage to both the scientific process and the wider public perception of science.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;Addendum&lt;/b&gt;: I should qualify that last remark that by explaining that I am, and have been, a reviewer for several top tier computer science conferences for about a decade.  My job as a reviewer is to decide (a) whether a paper is original, (b) whether it defends its thesis, (c) whether it has provided satisfactory answers to the reader's questions, (d) whether it is readable, and (e) whether it explains the research well enough for the work to be reproduced with reasonable effort by any other member of the community.  If a paper fails this last hurdle then it is essentially a set of claims lacking adequate support.  Now, even if I recommend a paper for publication, that does not mean I accept its conclusions as truth.  Rather, I am suggesting that the work is of sufficient value that it may be worth replication.  &lt;i&gt;Replication&lt;/i&gt;, not publication, is the gold standard of science.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6767707-3385765451596758186?l=ralphbecket.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ralphbecket.blogspot.com/feeds/3385765451596758186/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6767707&amp;postID=3385765451596758186' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/3385765451596758186'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/3385765451596758186'/><link rel='alternate' type='text/html' href='http://ralphbecket.blogspot.com/2009/09/corruption-of-scientific-process.html' title='Corruption of the scientific process'/><author><name>Rafe</name><uri>http://www.blogger.com/profile/10169325688704651715</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Ejdzr5ACvJA/Sf1Q7ykJ8WI/AAAAAAAAAsQ/iesdshoWcgo/s320/P5240040.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6767707.post-556922194788073160</id><published>2009-09-11T10:36:00.006+09:30</published><updated>2009-09-11T20:19:53.305+09:30</updated><title type='text'>The Coloured Stamps Problem</title><content type='html'>This is a trickier variant of the &lt;a href="http://ralphbecket.blogspot.com/2009/09/coloured-hats-problem.html"&gt;Coloured Hats&lt;/a&gt; problem, due to Raymond Smullyan.&lt;br /&gt;&lt;br /&gt;This time a mischievous student has placed two stamps on the foreheads of each of  three sleeping philosophers, X, Y, and Z.  The student then wakes them and explains that the pairs of stamps were drawn randomly from a set of four green and four red stamps (the remaining pair of stamps being hidden).  He proceeds to ask each of the philosophers in turn whether they know which colour stamps are on their forehead:&lt;br /&gt;X: no.&lt;br /&gt;Y: no.&lt;br /&gt;Z: no.&lt;br /&gt;Then the student goes around the group again asking the same question:&lt;br /&gt;X: no.&lt;br /&gt;Y: yes!&lt;br /&gt;How did Y solve the problem?&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Solution&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Let us write rr, gg, and rg for the three possible stamp combinations (red/red, green/green, and red/green).  We will write &lt;span style="font-style: italic;"&gt;X is rr&lt;/span&gt; to denote X having red/red on his forehead, and so on.&lt;br /&gt;&lt;br /&gt;We can immediately reject the X is gg and Z is gg case, since Y would know immediately that he is rr (but doesn't).  Similarly for X is rr and Z is rr.&lt;br /&gt;&lt;br /&gt;So Y starts by &lt;span style="font-style: italic;"&gt;assuming&lt;/span&gt;&lt;span&gt; Y is rr&lt;/span&gt;&lt;span style="font-style: italic;"&gt;.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;We can eliminate all possibilities where X is rr (since Z would immediately deduce that he is gg) or Z is rr (since X would immediately deduce he is gg).&lt;br /&gt;&lt;br /&gt;This leaves the possibilities&lt;br /&gt;&lt;ul&gt;&lt;li&gt;X is gg and Z is rg, or&lt;br /&gt;&lt;/li&gt;&lt;li&gt;X is rg and Z is gg, or&lt;br /&gt;&lt;/li&gt;&lt;li&gt;X is rg and Z is rg&lt;span style="font-style: italic;"&gt;.&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-style: italic;"&gt;&lt;span style="font-style: italic;"&gt;&lt;span style="font-style: italic;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;If X is gg, then Z&lt;/span&gt; knows he is not rr (since X would know he is gg, but he doesn't), and that he is not gg (since Y would know he is rr, but he doesn't), hence Z would know that Z is rg.  He doesn't, hence X cannot be gg.&lt;br /&gt;&lt;br /&gt;If Z is gg, then X would know on the second round that he was rg.  He doesn't, hence Z cannot be gg.&lt;br /&gt;&lt;br /&gt;The remaining possibility is X is rg and Z is rg.  In this case, after the first round, X would know he must be rg, but he doesn't.  Therefore X cannot be rg.&lt;br /&gt;&lt;br /&gt;Y therefore concludes that he &lt;span style="font-style: italic;"&gt;cannot&lt;/span&gt; be rr.&lt;br /&gt;&lt;br /&gt;By symmetry, Y also concludes that he cannot be&lt;span style="font-style: italic;"&gt; gg&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;Therefore, Y knows he must be&lt;span style="font-style: italic;"&gt;&lt;/span&gt; rg.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6767707-556922194788073160?l=ralphbecket.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ralphbecket.blogspot.com/feeds/556922194788073160/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6767707&amp;postID=556922194788073160' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/556922194788073160'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/556922194788073160'/><link rel='alternate' type='text/html' href='http://ralphbecket.blogspot.com/2009/09/coloured-stamps-problem.html' title='The Coloured Stamps Problem'/><author><name>Rafe</name><uri>http://www.blogger.com/profile/10169325688704651715</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Ejdzr5ACvJA/Sf1Q7ykJ8WI/AAAAAAAAAsQ/iesdshoWcgo/s320/P5240040.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6767707.post-6653177929089563408</id><published>2009-09-11T10:22:00.002+09:30</published><updated>2009-09-11T10:34:53.911+09:30</updated><title type='text'>The Coloured Hats Problem</title><content type='html'>I've been enjoying Raymond Smullyan's "Satan, Cantor, and Infinity", trying to solve all the problems therein.  This one is cute:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;The Coloured Hats Problem&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;A student has placed a green hat on the head of each of three sleeping philosophers, X, Y, and Z.  He wakes them up and explains that each of them is wearing a red hat or a green hat, but of course none can see what they themselves are wearing.  The student first asks the philosophers to raise their hand if they can see at least one green hat.  Of course, all three raise their hands.  The student then tells them to put their hands down if they know the colour of their own hat.  After a few seconds thought, the smartest philosopher puts her hand down.  How did she solve the problem?&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Solution&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Let's assume the smart philosopher is X.  X reasons that &lt;span style="font-style: italic;"&gt;if X had a red&lt;/span&gt; hat then one of the other philosophers, Y say, would be able to immediately deduce that their hat must be green because Z raised his hand (Z sees at least one green hat).  Since this has not happened, X concludes that &lt;span style="font-style: italic;"&gt;her hat cannot be red&lt;/span&gt; and therefore must be green.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6767707-6653177929089563408?l=ralphbecket.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ralphbecket.blogspot.com/feeds/6653177929089563408/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6767707&amp;postID=6653177929089563408' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/6653177929089563408'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/6653177929089563408'/><link rel='alternate' type='text/html' href='http://ralphbecket.blogspot.com/2009/09/coloured-hats-problem.html' title='The Coloured Hats Problem'/><author><name>Rafe</name><uri>http://www.blogger.com/profile/10169325688704651715</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Ejdzr5ACvJA/Sf1Q7ykJ8WI/AAAAAAAAAsQ/iesdshoWcgo/s320/P5240040.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6767707.post-4671625985210327620</id><published>2009-08-19T16:41:00.001+09:30</published><updated>2009-08-19T16:42:34.754+09:30</updated><title type='text'>The Stony Brook Algorithm Repository</title><content type='html'>I've just stumbled across the &lt;a href="http://www.cs.sunysb.edu/%7Ealgorith/"&gt;Stony Brook Algorithm Repository&lt;/a&gt;.  Could be handy.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6767707-4671625985210327620?l=ralphbecket.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ralphbecket.blogspot.com/feeds/4671625985210327620/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6767707&amp;postID=4671625985210327620' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/4671625985210327620'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/4671625985210327620'/><link rel='alternate' type='text/html' href='http://ralphbecket.blogspot.com/2009/08/stony-brook-algorithm-repository.html' title='The Stony Brook Algorithm Repository'/><author><name>Rafe</name><uri>http://www.blogger.com/profile/10169325688704651715</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Ejdzr5ACvJA/Sf1Q7ykJ8WI/AAAAAAAAAsQ/iesdshoWcgo/s320/P5240040.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6767707.post-517443306642428595</id><published>2009-08-16T12:33:00.003+09:30</published><updated>2009-08-16T12:38:21.126+09:30</updated><title type='text'>Tents puzzle google gadget</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_Ejdzr5ACvJA/Sod35Oqp71I/AAAAAAAAAvM/7r3oY9H7Q1M/s1600-h/tents_screenshot.jpg"&gt;&lt;img style="float:right; margin:0 0 10px 10px;cursor:pointer; cursor:hand;width: 192px; height: 320px;" src="http://3.bp.blogspot.com/_Ejdzr5ACvJA/Sod35Oqp71I/AAAAAAAAAvM/7r3oY9H7Q1M/s320/tents_screenshot.jpg" border="0" alt="" id="BLOGGER_PHOTO_ID_5370392905735860050" /&gt;&lt;/a&gt;&lt;br /&gt;I finally got around to setting up my tents puzzle as a Google gadget.  You can use the &lt;a href="http://hosting.gmodules.com/ig/gadgets/file/100039392818962997713/tents.xml"&gt;this&lt;/a&gt; link to add it to your iGoogle page.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I used the Google gadget editor to handle things.  It's quirky, but usable, although I really wouldn't want to develop anything serious in it to start with.  For a start, it doesn't work in Chrome at present, nor does the preview window seem to display things like tabs or dynamic height control.  I'm sure all these things will be fixed before too long.&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6767707-517443306642428595?l=ralphbecket.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ralphbecket.blogspot.com/feeds/517443306642428595/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6767707&amp;postID=517443306642428595' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/517443306642428595'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/517443306642428595'/><link rel='alternate' type='text/html' href='http://ralphbecket.blogspot.com/2009/08/tents-puzzle-google-gadget.html' title='Tents puzzle google gadget'/><author><name>Rafe</name><uri>http://www.blogger.com/profile/10169325688704651715</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Ejdzr5ACvJA/Sf1Q7ykJ8WI/AAAAAAAAAsQ/iesdshoWcgo/s320/P5240040.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_Ejdzr5ACvJA/Sod35Oqp71I/AAAAAAAAAvM/7r3oY9H7Q1M/s72-c/tents_screenshot.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6767707.post-8055017272528290167</id><published>2009-08-03T14:09:00.000+09:30</published><updated>2009-08-03T14:10:15.254+09:30</updated><title type='text'>Watchmen</title><content type='html'>Brilliant, brilliant film.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6767707-8055017272528290167?l=ralphbecket.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ralphbecket.blogspot.com/feeds/8055017272528290167/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6767707&amp;postID=8055017272528290167' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/8055017272528290167'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/8055017272528290167'/><link rel='alternate' type='text/html' href='http://ralphbecket.blogspot.com/2009/08/watchmen.html' title='Watchmen'/><author><name>Rafe</name><uri>http://www.blogger.com/profile/10169325688704651715</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Ejdzr5ACvJA/Sf1Q7ykJ8WI/AAAAAAAAAsQ/iesdshoWcgo/s320/P5240040.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6767707.post-8159979868908356911</id><published>2009-07-28T10:27:00.002+09:30</published><updated>2009-07-28T10:56:18.568+09:30</updated><title type='text'>Fillomino puzzles</title><content type='html'>I work on the &lt;a href="http://www.g12.cs.mu.oz.au/minizinc/index.html"&gt;G12&lt;/a&gt; constraint programming system.  I've been putting together models for the forthcoming MiniZinc Constraint Solver Challenge; one of the most interesting was finding a model for &lt;a href="http://www.menneske.no/fillomino/eng/"&gt;fillomino&lt;/a&gt; puzzles.  A fillomino puzzle looks like this (which I took from Vegard Hanssens' page to which I just linked):&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;1 . . . 1&lt;br /&gt;. . . 1 .&lt;br /&gt;2 4 . . .&lt;br /&gt;1 . 2 1 .&lt;br /&gt;3 . 1 . 2&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;The goal is to complete the grid by dividing it into "regions" (where a region is a maximally contiguous set of cells connected by their edges) where each cell in a region is labelled with the size of the region.  Thus, a 1-region will contain a single 1 and have no bordering 1-regions; a 2-region will consist of two neighbouring cells containing 2s and have no bordering 2-regions; and so forth.  Some regions may start with more than one cell filled in; some may have no clues filled in at the start.  The solution to the problem above is&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;1 4 2 2 1&lt;br /&gt;2 4 4 1 4&lt;br /&gt;2 4 2 4 4&lt;br /&gt;1 3 2 1 4&lt;br /&gt;3 3 1 2 2&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;This is a surprisingly difficult puzzle to model due to the region contiguity constraints.  My solution works as follows:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;each cell is a potential "root" of a region (and each region has a single root);&lt;/li&gt;&lt;li&gt;neighbouring cells are either in the same region (and hence have the same number) or are in different regions (which must have different numbers);&lt;/li&gt;&lt;li&gt;each cell has a time step at which we label it (region roots are labelled at step 1, all other cells are labelled later);&lt;/li&gt;&lt;li&gt;any cell labelled at step t &gt; 1 must be part of the region of a neighbouring cell labelled at step t;&lt;/li&gt;&lt;li&gt;each region must be labelled with the size of the region.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;The time step labelling and the unique roots constraints ensure that regions grow contiguously.  The problem with this model is that it is hard to get decent propagation out of it (propagation is where the search tree is pruned as far as possible after each choice point).  A human solver will recognise that there's no point trying to fill in a region of four cells with 5s; I have not yet found any good way of describing this information in the model.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6767707-8159979868908356911?l=ralphbecket.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ralphbecket.blogspot.com/feeds/8159979868908356911/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6767707&amp;postID=8159979868908356911' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/8159979868908356911'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/8159979868908356911'/><link rel='alternate' type='text/html' href='http://ralphbecket.blogspot.com/2009/07/fillomino-puzzles.html' title='Fillomino puzzles'/><author><name>Rafe</name><uri>http://www.blogger.com/profile/10169325688704651715</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Ejdzr5ACvJA/Sf1Q7ykJ8WI/AAAAAAAAAsQ/iesdshoWcgo/s320/P5240040.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6767707.post-3763868395062965098</id><published>2009-07-28T10:23:00.003+09:30</published><updated>2009-07-28T10:27:05.967+09:30</updated><title type='text'>Google Wave</title><content type='html'>I watched the &lt;a href="http://wave.google.com/"&gt;Google Wave&lt;/a&gt; presentation over the weekend.  Wave is an open collaborative editing system that integrates e-mail, blogging, wikies, photo albums, various kinds of polling and data collection, under a single, simple abstraction.  If it is as easy to use in practice as the demo looks, my guess is that it will radically change how people interact over the internet.  Very, very cool.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6767707-3763868395062965098?l=ralphbecket.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ralphbecket.blogspot.com/feeds/3763868395062965098/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6767707&amp;postID=3763868395062965098' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/3763868395062965098'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/3763868395062965098'/><link rel='alternate' type='text/html' href='http://ralphbecket.blogspot.com/2009/07/google-wave.html' title='Google Wave'/><author><name>Rafe</name><uri>http://www.blogger.com/profile/10169325688704651715</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Ejdzr5ACvJA/Sf1Q7ykJ8WI/AAAAAAAAAsQ/iesdshoWcgo/s320/P5240040.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6767707.post-4617973380997313426</id><published>2009-07-24T15:20:00.010+09:30</published><updated>2009-07-27T10:26:14.450+09:30</updated><title type='text'></title><content type='html'>I've just come across &lt;a href="http://www1.chapman.edu/~jipsen/asciimath.html"&gt;ASCIIMathML&lt;/a&gt;.  It's superb!&lt;br /&gt;&lt;br /&gt;`e^(ipi)=-1`&lt;br /&gt;&lt;br /&gt;`mu = E(X) = sum_x.x*P(X = x)`&lt;br /&gt;&lt;br /&gt;`sigma^2 = V(X) = sum_x.(x-E(X))^2`&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;b&gt;Update&lt;/b&gt;: there appears to be a bug in Chrome's rendering of these formulae in that the first `x`s should appear under the `sum` signs, not after them.  I've added some '.'s to make the meaning clearer for Chrome users.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6767707-4617973380997313426?l=ralphbecket.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ralphbecket.blogspot.com/feeds/4617973380997313426/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6767707&amp;postID=4617973380997313426' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/4617973380997313426'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/4617973380997313426'/><link rel='alternate' type='text/html' href='http://ralphbecket.blogspot.com/2009/07/ive-just-come-across-asciimathml.html' title=''/><author><name>Rafe</name><uri>http://www.blogger.com/profile/10169325688704651715</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Ejdzr5ACvJA/Sf1Q7ykJ8WI/AAAAAAAAAsQ/iesdshoWcgo/s320/P5240040.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6767707.post-7234007651012511998</id><published>2009-07-14T10:20:00.004+09:30</published><updated>2009-07-16T11:45:49.673+09:30</updated><title type='text'>Solar power</title><content type='html'>&lt;a href="http://carbon-sense.com/wp-content/uploads/2009/07/solar-realities.pdf"&gt;This&lt;/a&gt; is a very interesting analysis of the cost of using solar power to provide base load electricity in Australia.&lt;br /&gt;&lt;br /&gt;The numbers show that the Queanbeyan Solar Farm, which has been running in New South Wales since 1999, operates at a mean efficiency of 13.7%, with almost all energy being produced between 9a.m. and 3p.m., which is well outside the peak demand times.  To move to an entirely solar based power system would therefore require masses of storage capacity, the cheapest of which would be pumped hydroelectric schemes.  By the time you add everything up, the financial and environmental impact of going fully solar makes the whole idea impossible.&lt;br /&gt;&lt;br /&gt;By contrast, going fully nuclear is &lt;span style="font-style: italic;"&gt;vastly&lt;/span&gt; cheaper and, surprisingly, cleaner.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Update&lt;/span&gt;: &lt;a href="http://carbon-sense.com/wp-content/uploads/2009/02/wind-power.pdf"&gt;here's&lt;/a&gt; a similar analysis for wind power.  It doesn't look good, either.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6767707-7234007651012511998?l=ralphbecket.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ralphbecket.blogspot.com/feeds/7234007651012511998/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6767707&amp;postID=7234007651012511998' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/7234007651012511998'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/7234007651012511998'/><link rel='alternate' type='text/html' href='http://ralphbecket.blogspot.com/2009/07/solar-power.html' title='Solar power'/><author><name>Rafe</name><uri>http://www.blogger.com/profile/10169325688704651715</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Ejdzr5ACvJA/Sf1Q7ykJ8WI/AAAAAAAAAsQ/iesdshoWcgo/s320/P5240040.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6767707.post-7101943743939367005</id><published>2009-07-13T10:07:00.002+09:30</published><updated>2009-07-13T10:14:13.208+09:30</updated><title type='text'>Sleep habits</title><content type='html'>For the last couple of years or so I've found myself going to bed around 2 a.m.  It's nice to have an hour to myself after the rest of the house is in bed, but staying up until the small hours has not been sensible.  I've been increasingly ratty and lethargic and it's had an impact on the quality of my life.  Last week my doctor told me to hit the sack as soon as I feel sleepy (usually before 11 p.m.), rather than push through the initial feeling of tiredness as I have been doing.  Having tried this approach for a few days, I can't believe the difference it has made already: I feel years younger.  Magic!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6767707-7101943743939367005?l=ralphbecket.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ralphbecket.blogspot.com/feeds/7101943743939367005/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6767707&amp;postID=7101943743939367005' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/7101943743939367005'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/7101943743939367005'/><link rel='alternate' type='text/html' href='http://ralphbecket.blogspot.com/2009/07/sleep-habits.html' title='Sleep habits'/><author><name>Rafe</name><uri>http://www.blogger.com/profile/10169325688704651715</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Ejdzr5ACvJA/Sf1Q7ykJ8WI/AAAAAAAAAsQ/iesdshoWcgo/s320/P5240040.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6767707.post-192433310534168912</id><published>2009-07-03T15:39:00.002+09:30</published><updated>2009-07-03T16:27:01.937+09:30</updated><title type='text'>Scientific discourse and the climate debate</title><content type='html'>I've been following the global warming debate fairly closely for several years now.  For a number of reasons, I am definitely skeptical about the standard alarming "concensus" predictions.  To put it plainly, I remain to be convinced that the claims made really do stand up to scrutiny.  For example, climate models are often consistently &lt;a href="http://rankexploits.com/musings/2008/questionanswer-about-pielke-srs-post/"&gt;one or two degrees off&lt;/a&gt; the measured absolute temperature, which is why you only see reports of temperature anomalies - departures from some baseline.  This, to me, rather flies in the face of glib claims that the models are "just physics".  I have other issues with the models, but I don't want to talk about them right now.&lt;br /&gt;&lt;br /&gt;What is depressing is the brutal, and in many cases embarrassing, level at which the climate debate is conducted.  In any other field of science it is normal to have disagreements.  Traditionally when this happens, one side or the other will eventually change their minds either through force of argument ("your logic is unassailable") or through reproducible experiment ("here is uncontrovertible evidence").  The argument may be vigorous, but it's almost never personal: the two sides can still go and enjoy a beer together even though they disagree.&lt;br /&gt;&lt;br /&gt;The climate debate does not work this way.  Instead of dispassionate argument, deeply unpleasant rhetorical devices are the norm.  Here's a list I've observed in common use:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Pretend there is no debate.  The matter is settled.  Anyone who disagrees is either uninformed, deluded, or pushing some nefarious agenda.&lt;/li&gt;&lt;li&gt;Dismissing an argument simply because of who advanced it (ad hominem attacks are everywhere).&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Compare the other side to some unpleasant group: if you disagree, then you're a denialist.&lt;/li&gt;&lt;li&gt;Question the intelligence and/or integrity of anyone who is not convinced.&lt;/li&gt;&lt;li&gt;Appeal to authority (which is apparently infallible).&lt;/li&gt;&lt;li&gt;You are not a climate scientist (and apparently therefore incapable of understanding or criticising any aspect of any climate science work).&lt;/li&gt;&lt;li&gt;Withholding of data and/or code so that results cannot be reproduced.&lt;/li&gt;&lt;li&gt;Censorship of critical commentary (thereby presenting a one-sided view of the debate).&lt;/li&gt;&lt;li&gt;There is a concensus.  (I know of no other field where this argument would be advanced with a straight face.)&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;There are sinners on both sides, but in my experience the vast bulk of the mud slinging comes from the "warmists".  Joining any discussion forum on the topic as a skeptic usually requires a strong stomach, a sense of humour, and is likely to leave an unpleasant taste in the mouth.  What annoys me more than anything else is that the animosity makes it really hard to have a sensible argument: the warmists may well be correct, but they aren't going to convince me using the tactics I listed above.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6767707-192433310534168912?l=ralphbecket.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ralphbecket.blogspot.com/feeds/192433310534168912/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6767707&amp;postID=192433310534168912' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/192433310534168912'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/192433310534168912'/><link rel='alternate' type='text/html' href='http://ralphbecket.blogspot.com/2009/07/scientific-discourse-and-climate-debate.html' title='Scientific discourse and the climate debate'/><author><name>Rafe</name><uri>http://www.blogger.com/profile/10169325688704651715</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Ejdzr5ACvJA/Sf1Q7ykJ8WI/AAAAAAAAAsQ/iesdshoWcgo/s320/P5240040.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6767707.post-5035964215232904489</id><published>2009-06-29T12:31:00.002+09:30</published><updated>2009-06-29T12:37:04.094+09:30</updated><title type='text'>ICFP Contest 2009</title><content type='html'>I spent a chunk of the weekend having a go at this year's &lt;a href="www.icfpcontest.org"&gt;ICFP contest&lt;/a&gt;.  I have to say I didn't find the task very engaging: it was all about moving a satellite into different orbits and rendezvousing with other satellites.  Being a computer scientist and not a rocket scientist I found this challenging in a tedious way: the problem revolved around the kinds of continuous mathematics I haven't been good at since I was at school, lo these many years ago.  Oh well, I had some minor successes, but spent most of my time screwing up pages of bad rocket calculations.  Hopefully next year's contest will appeal to me more.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6767707-5035964215232904489?l=ralphbecket.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ralphbecket.blogspot.com/feeds/5035964215232904489/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6767707&amp;postID=5035964215232904489' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/5035964215232904489'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/5035964215232904489'/><link rel='alternate' type='text/html' href='http://ralphbecket.blogspot.com/2009/06/icfp-contest-2009.html' title='ICFP Contest 2009'/><author><name>Rafe</name><uri>http://www.blogger.com/profile/10169325688704651715</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Ejdzr5ACvJA/Sf1Q7ykJ8WI/AAAAAAAAAsQ/iesdshoWcgo/s320/P5240040.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6767707.post-5347649709374182362</id><published>2009-05-25T12:05:00.001+09:30</published><updated>2009-05-25T12:06:52.889+09:30</updated><title type='text'>JavaScript: DOM quick reference</title><content type='html'>&lt;a href="http://www.howtocreate.co.uk/tutorials/javascript/domstructure"&gt;This&lt;/a&gt; is a rather handy quick reference to the JavaScript DOM interface.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6767707-5347649709374182362?l=ralphbecket.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ralphbecket.blogspot.com/feeds/5347649709374182362/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6767707&amp;postID=5347649709374182362' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/5347649709374182362'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/5347649709374182362'/><link rel='alternate' type='text/html' href='http://ralphbecket.blogspot.com/2009/05/javascript-dom-quick-reference.html' title='JavaScript: DOM quick reference'/><author><name>Rafe</name><uri>http://www.blogger.com/profile/10169325688704651715</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Ejdzr5ACvJA/Sf1Q7ykJ8WI/AAAAAAAAAsQ/iesdshoWcgo/s320/P5240040.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6767707.post-746041379943470934</id><published>2009-05-20T14:23:00.003+09:30</published><updated>2009-05-20T14:27:24.783+09:30</updated><title type='text'>Google Pages is migrating to Google Sites</title><content type='html'>The problem here is that Google Sites doesn't support JavaScript, which is going to make my tents &lt;a href="http://ralphbecket.googlepages.com/tents.html"&gt;puzzle&lt;/a&gt; unplayable.  However, it turns out &lt;a href="http://code.google.com/apis/gadgets/docs/legacy/basic.html"&gt;Google Gadgets&lt;/a&gt; is just what I need.  I'll be looking into this over the next few evenings.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6767707-746041379943470934?l=ralphbecket.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ralphbecket.blogspot.com/feeds/746041379943470934/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6767707&amp;postID=746041379943470934' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/746041379943470934'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/746041379943470934'/><link rel='alternate' type='text/html' href='http://ralphbecket.blogspot.com/2009/05/google-pages-is-migrating-to-google.html' title='Google Pages is migrating to Google Sites'/><author><name>Rafe</name><uri>http://www.blogger.com/profile/10169325688704651715</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Ejdzr5ACvJA/Sf1Q7ykJ8WI/AAAAAAAAAsQ/iesdshoWcgo/s320/P5240040.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6767707.post-8551445451850383369</id><published>2009-05-17T11:45:00.003+09:30</published><updated>2009-05-17T13:26:41.956+09:30</updated><title type='text'>Variable capture in C# closures</title><content type='html'>You have to be careful about variable capture when constructing lambdas in C#.  The following code does not do what you might imagine:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;var xs = new List&amp;lt;Action&amp;gt;();&lt;br /&gt;for(var x = 0; x &amp;lt; 10; x++) {&lt;br /&gt;   xs.Add(() =&amp;gt; {Console.Write(x + " ");});&lt;br /&gt;};&lt;br /&gt;foreach (var a in xs) {&lt;br /&gt;   a();&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;This prints the following: &lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;10 10 10 10 10 10 10 10 10 10&lt;/span&gt;&lt;br /&gt;The reason is that the &lt;span class="Apple-style-span" style="font-style: italic;"&gt;variable &lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;x&lt;/span&gt; is captured by the lambdas, not the &lt;span class="Apple-style-span" style="font-style: italic;"&gt;value &lt;/span&gt;of &lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;x&lt;/span&gt; at the time the lambda is created.&lt;br /&gt;&lt;br /&gt;To avoid this situation we have to make a local copy of &lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;x&lt;/span&gt; for each lambda:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;var xs = new List&amp;lt;Action&amp;gt;();&lt;br /&gt;for(var x = 0; x &amp;lt; 10; x++) {&lt;br /&gt;   var &lt;span class="Apple-style-span" style="color: rgb(255, 0, 0);"&gt;x_copy &lt;/span&gt;= x;&lt;br /&gt;   xs.Add(() =&amp;gt; {Console.Write(&lt;span class="Apple-style-span" style="color: rgb(255, 0, 0);"&gt;x_copy &lt;/span&gt;+ " ");});&lt;br /&gt;};&lt;br /&gt;foreach (var a in xs) {&lt;br /&gt;   a();&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;This prints &lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;0 1 2 3 4 5 6 7 8 9&lt;/span&gt; as expected.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6767707-8551445451850383369?l=ralphbecket.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ralphbecket.blogspot.com/feeds/8551445451850383369/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6767707&amp;postID=8551445451850383369' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/8551445451850383369'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/8551445451850383369'/><link rel='alternate' type='text/html' href='http://ralphbecket.blogspot.com/2009/05/variable-capture-in-c-closures.html' title='Variable capture in C# closures'/><author><name>Rafe</name><uri>http://www.blogger.com/profile/10169325688704651715</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Ejdzr5ACvJA/Sf1Q7ykJ8WI/AAAAAAAAAsQ/iesdshoWcgo/s320/P5240040.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6767707.post-6757515205684606482</id><published>2009-05-10T13:06:00.001+09:30</published><updated>2009-05-10T13:08:33.475+09:30</updated><title type='text'>Plants vs Zombies</title><content type='html'>"I know you're in there, I can smell your &lt;span class="Apple-style-span" style="font-size: x-large;"&gt;&lt;span class="Apple-style-span" style="font-style: italic;"&gt;&lt;span class="Apple-style-span" style="color: rgb(153, 51, 153);"&gt;braiiiiins!&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;"&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I'm having a hoot playing this &lt;a href="http://www.google.com.au/url?sa=t&amp;amp;source=web&amp;amp;ct=res&amp;amp;cd=3&amp;amp;url=http%3A%2F%2Fwww.popcap.com%2Fgames%2Fpvz&amp;amp;ei=y0sGSv3gLIy66wPe-_WKAw&amp;amp;usg=AFQjCNETdhZe-zpEXbGsEHlYZLX8g7o5Wg"&gt;game&lt;/a&gt;.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6767707-6757515205684606482?l=ralphbecket.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ralphbecket.blogspot.com/feeds/6757515205684606482/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6767707&amp;postID=6757515205684606482' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/6757515205684606482'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/6757515205684606482'/><link rel='alternate' type='text/html' href='http://ralphbecket.blogspot.com/2009/05/plants-vs-zombies.html' title='Plants vs Zombies'/><author><name>Rafe</name><uri>http://www.blogger.com/profile/10169325688704651715</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Ejdzr5ACvJA/Sf1Q7ykJ8WI/AAAAAAAAAsQ/iesdshoWcgo/s320/P5240040.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6767707.post-1851141674955507553</id><published>2009-05-07T15:17:00.008+09:30</published><updated>2009-05-08T10:33:33.828+09:30</updated><title type='text'>Coin tossing problem</title><content type='html'>I saw aproblem posed at Lubos Motl's blog that started me thinking about this question: how likely is a run of h heads or more in k tosses of a fair coin?&lt;br /&gt;&lt;br /&gt;I came up with a recurrence relation.  Let &lt;span class="Apple-style-span" style="font-style: italic;"&gt;P(h, k) = n(h, k) / 2^k&lt;/span&gt; be the probability, where &lt;span class="Apple-style-span" style="font-style: italic;"&gt;n(h, k)&lt;/span&gt; is the number of sequences of length &lt;span class="Apple-style-span" style="font-style: italic;"&gt;k &lt;/span&gt;containing a run of &lt;span class="Apple-style-span" style="font-style: italic;"&gt;h &lt;/span&gt;or more heads.&lt;br /&gt;&lt;br /&gt;If &lt;span class="Apple-style-span" style="font-style: italic;"&gt;h &gt; k&lt;/span&gt; then &lt;span class="Apple-style-span" style="font-style: italic;"&gt;n(h, k) = 0&lt;/span&gt;.  Otherwise we have two possibilities for a sequence containing &lt;span class="Apple-style-span" style="font-style: italic;"&gt;h &lt;/span&gt;or more heads in a row:&lt;ul&gt;&lt;li&gt;an initial run of &lt;span class="Apple-style-span" style="font-style: italic;"&gt;h &lt;/span&gt;heads, followed by &lt;span class="Apple-style-span" style="font-style: italic;"&gt;k-h&lt;/span&gt; "don't care" tosses or&lt;br /&gt;&lt;/li&gt;&lt;li&gt;a prefix of length &lt;span class="Apple-style-span" style="font-style: italic;"&gt;j &amp;lt; k-h-1&lt;/span&gt; not containing a run of &lt;span class="Apple-style-span" style="font-style: italic;"&gt;h &lt;/span&gt;heads, followed by a tail, followed by &lt;span class="Apple-style-span" style="font-style: italic;"&gt;h &lt;/span&gt;heads, followed by &lt;span class="Apple-style-span" style="font-style: italic;"&gt;k-j-h-1&lt;/span&gt; "don't care" tosses.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;Assuming now that &lt;span class="Apple-style-span" style="font-style: italic;"&gt;h &amp;lt;= k&lt;/span&gt;, we have&lt;br /&gt;&lt;br /&gt;n&lt;span class="Apple-style-span" style="font-style: italic;"&gt;(h, k) = 2^(k-h) + sum (j in 0..k-h-1) (2^(k-j-h-1).nbar(h, j))&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;where &lt;span class="Apple-style-span" style="font-style: italic;"&gt;nbar(h, j) = 2^j - n(h, j)&lt;/span&gt; is the number of sequences of length &lt;span class="Apple-style-span" style="font-style: italic;"&gt;j &lt;/span&gt;that &lt;span class="Apple-style-span" style="font-style: italic;"&gt;do not&lt;/span&gt; contain a run of &lt;span class="Apple-style-span" style="font-style: italic;"&gt;h &lt;/span&gt;or more heads.  This gives&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-style: italic;"&gt;n(h, k)&lt;br /&gt;= 2^(k-h) + sum (j in 0..k-h-1) (2^(k-j-h-1).2^j - 2^(k-j-h-1).n(h, j))&lt;br /&gt;= 2^(k-h) + (k-h).2^(k-h-1) - sum (j in 0..k-h-1) (2^(k-j-h-1).n(h, j))&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Let's try this out.  Consider the case &lt;span class="Apple-style-span" style="font-style: italic;"&gt;h = 2&lt;/span&gt;.&lt;ul&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-style: italic;"&gt;k = 2&lt;/span&gt; sequences are {HH};&lt;br /&gt;&lt;span class="Apple-style-span" style="font-style: italic;"&gt;n(2, 2) = 2^0 = 1&lt;/span&gt;.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-style: italic;"&gt;k = 3&lt;/span&gt; sequences are {HH*, THH};&lt;br /&gt;&lt;span class="Apple-style-span" style="font-style: italic;"&gt;n(2, 3) = 2^1 + 2^0 - 2^0.n(2, 0) = 3&lt;/span&gt;.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-style: italic;"&gt;k = 4&lt;/span&gt; sequences are {HH**, THH*, *THH};&lt;br /&gt;&lt;span class="Apple-style-span" style="font-style: italic;"&gt;n(2, 4) = 2^2 + 2.2^1 - 2^1.n(2, 0) - 2^0.n(2, 1) = 8&lt;/span&gt;.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-style: italic;"&gt;k = 5&lt;/span&gt; sequences are {HH***, THH**, *THH*, T*THH, HTTHH}.&lt;br /&gt;&lt;span class="Apple-style-span" style="font-style: italic;"&gt;n(2, 5) = 2^3 + 3.2^2 - 2^2.n(2, 0) - 2^1.n(2, 1) - 2^0.n(2, 2) = 19&lt;/span&gt;.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;...&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6767707-1851141674955507553?l=ralphbecket.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ralphbecket.blogspot.com/feeds/1851141674955507553/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6767707&amp;postID=1851141674955507553' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/1851141674955507553'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/1851141674955507553'/><link rel='alternate' type='text/html' href='http://ralphbecket.blogspot.com/2009/05/coin-tossing-problem.html' title='Coin tossing problem'/><author><name>Rafe</name><uri>http://www.blogger.com/profile/10169325688704651715</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Ejdzr5ACvJA/Sf1Q7ykJ8WI/AAAAAAAAAsQ/iesdshoWcgo/s320/P5240040.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6767707.post-8520249738632513927</id><published>2009-05-05T10:17:00.002+09:30</published><updated>2009-05-05T10:19:19.198+09:30</updated><title type='text'>Play by web board games</title><content type='html'>I've recently discovered &lt;a href="http://www.mabiweb.com"&gt;MaBiWeb&lt;/a&gt;, an on-line interface to a dozen or so "Euro"-board games. It's free, has a simple interface, and the pace is about right for me (one or two turns per day).  Recommended.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6767707-8520249738632513927?l=ralphbecket.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ralphbecket.blogspot.com/feeds/8520249738632513927/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6767707&amp;postID=8520249738632513927' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/8520249738632513927'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/8520249738632513927'/><link rel='alternate' type='text/html' href='http://ralphbecket.blogspot.com/2009/05/play-by-web-board-games.html' title='Play by web board games'/><author><name>Rafe</name><uri>http://www.blogger.com/profile/10169325688704651715</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Ejdzr5ACvJA/Sf1Q7ykJ8WI/AAAAAAAAAsQ/iesdshoWcgo/s320/P5240040.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6767707.post-2368116288160528210</id><published>2009-05-04T15:13:00.009+09:30</published><updated>2009-05-18T11:54:43.557+09:30</updated><title type='text'>Escaping code symbols in blog postings</title><content type='html'>I wrote two bookmarklets to help escape code symbols in &amp;lt;textarea&amp;gt;s in blog postings (e.g., convert &lt;span style="font-family:courier new;"&gt;&amp;lt;&lt;/span&gt; to &lt;span style="font-family:courier new;"&gt;&amp;amp;lt;&lt;/span&gt; and so forth): &lt;a href="javascript:(function(){var%20textareas=document.getElementsByTagName(%22textarea%22);for(var%20i=textareas.length-1;i%3e=0;i--){textarea=textareas[i];var%20start=textarea.selectionStart;var%20end=textarea.selectionEnd;var%20prefix=textarea.value.substring(0,start);var%20text=textarea.value.substring(start,end);var%20suffix=textarea.value.substring(end,textarea.value.length);text=text.replace(/%26/g,%27%26amp;%27);text=text.replace(/%3c/g,%27%26lt;%27);text=text.replace(/%3e/g,%27%26gt;%27);text=text.replace(/%22/g,%27%26quot;%27);textarea.value=prefix+text+suffix;}})()"&gt;Escape&lt;/a&gt; and &lt;a href="javascript:(function(){var%20textareas=document.getElementsByTagName(%22textarea%22);for(var%20i=textareas.length-1;i%3e=0;i--){textarea=textareas[i];var%20start=textarea.selectionStart;var%20end=textarea.selectionEnd;var%20prefix=textarea.value.substring(0,start);var%20text=textarea.value.substring(start,end);var%20suffix=textarea.value.substring(end,textarea.value.length);text=text.replace(/%26lt;/g,%27%3c%27);text=text.replace(/%26gt;/g,%27%3e%27);text=text.replace(/%26quot;/g,%27%22%27);text=text.replace(/%26amp;/g,%27%26%27);textarea.value=prefix+text+suffix;}})()"&gt;Unescape&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;I used a &lt;a href="http://subsimple.com/bookmarklets/jsbuilder.htm"&gt;bookmarklet editor&lt;/a&gt; to create them, then dragged the editor generated links on to my bookmark bar.  To use them, I highlight the appropriate part of a textarea and click Escape or Unescape on the bookmark bar.&lt;br /&gt;&lt;br /&gt;Here's Escape:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;javascript:&lt;br /&gt;(function(){&lt;br /&gt; var textareas=document.getElementsByTagName('textarea');&lt;br /&gt; for(var i=textareas.length-1;i&amp;gt;=0;i--){&lt;br /&gt;   textarea=textareas[i];&lt;br /&gt;   var start=textarea.selectionStart;&lt;br /&gt;   var end=textarea.selectionEnd;&lt;br /&gt;   var prefix=textarea.value.substring(0,start);&lt;br /&gt;   var text=textarea.value.substring(start,end);&lt;br /&gt;   var suffix=textarea.value.substring(end,textarea.value.length);&lt;br /&gt;   text=text.replace(/&amp;amp;/g,'&amp;amp;amp;');&lt;br /&gt;   text=text.replace(/&amp;lt;/g,'&amp;amp;lt;');&lt;br /&gt;   text=text.replace(/&amp;gt;/g,'&amp;amp;gt;');&lt;br /&gt;   text=text.replace(/"/g,'&amp;amp;quot;');&lt;br /&gt;   textarea.value=prefix+text+suffix;&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;)()&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Here's Unescape:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;javascript:&lt;br /&gt;(function(){&lt;br /&gt; var textareas=document.getElementsByTagName('textarea');&lt;br /&gt; for(var i=textareas.length-1;i&gt;=0;i--){&lt;br /&gt;   textarea=textareas[i];&lt;br /&gt;   var start=textarea.selectionStart;&lt;br /&gt;   var end=textarea.selectionEnd;&lt;br /&gt;   var prefix=textarea.value.substring(0,start);&lt;br /&gt;   var text=textarea.value.substring(start,end);&lt;br /&gt;   var suffix=textarea.value.substring(end,textarea.value.length);&lt;br /&gt;   text=text.replace(/&amp;amp;lt;/g,'&amp;lt;');&lt;br /&gt;   text=text.replace(/&amp;amp;gt;/g,'&amp;gt;');&lt;br /&gt;   text=text.replace(/&amp;amp;quot;/g,'&amp;quot;');&lt;br /&gt;   text=text.replace(/&amp;amp;amp;/g,'&amp;amp;');&lt;br /&gt;   textarea.value=prefix+text+suffix;&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;)()&lt;/pre&gt;To add these as links you need to perform the following substitutions:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;s/ /%20/g;s/'/%27/g;s/"/%22/gs;s/&amp;amp;/%26/g;s/&amp;lt;/%3c/g;s/&amp;gt;/%3e/g&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;By the way, if anyone knows how to identify in a bookmarklet which &amp;lt;textarea&amp;gt; in an HTML page has the focus, please let me know!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6767707-2368116288160528210?l=ralphbecket.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ralphbecket.blogspot.com/feeds/2368116288160528210/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6767707&amp;postID=2368116288160528210' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/2368116288160528210'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/2368116288160528210'/><link rel='alternate' type='text/html' href='http://ralphbecket.blogspot.com/2009/05/escaping-code-symbols-in-blog-postings.html' title='Escaping code symbols in blog postings'/><author><name>Rafe</name><uri>http://www.blogger.com/profile/10169325688704651715</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Ejdzr5ACvJA/Sf1Q7ykJ8WI/AAAAAAAAAsQ/iesdshoWcgo/s320/P5240040.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6767707.post-5893202288478036852</id><published>2009-05-03T17:38:00.001+09:30</published><updated>2009-05-03T17:39:45.007+09:30</updated><title type='text'></title><content type='html'>&lt;a href="http://4.bp.blogspot.com/_Ejdzr5ACvJA/Sf1Q7ykJ8WI/AAAAAAAAAsQ/iesdshoWcgo/s1600-h/P5240040.JPG"&gt;&lt;img style="CLEAR: both; FLOAT: left; MARGIN: 0px 10px 10px 0px" alt="" src="http://4.bp.blogspot.com/_Ejdzr5ACvJA/Sf1Q7ykJ8WI/AAAAAAAAAsQ/iesdshoWcgo/s320/P5240040.JPG" border="0" /&gt;&lt;/a&gt;Me punting on the Cam in 2008.  (I just found this while rooting through my photo albums.)&lt;div style="clear:both; text-align:LEFT"&gt;&lt;a href="http://picasa.google.com/blogger/" target="ext"&gt;&lt;img src="http://photos1.blogger.com/pbp.gif" alt="Posted by Picasa" style="border: 0px none ; padding: 0px; background: transparent none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;" align="middle" border="0" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6767707-5893202288478036852?l=ralphbecket.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ralphbecket.blogspot.com/feeds/5893202288478036852/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6767707&amp;postID=5893202288478036852' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/5893202288478036852'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/5893202288478036852'/><link rel='alternate' type='text/html' href='http://ralphbecket.blogspot.com/2009/05/me-punting-on-cam-in-2008.html' title=''/><author><name>Rafe</name><uri>http://www.blogger.com/profile/10169325688704651715</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Ejdzr5ACvJA/Sf1Q7ykJ8WI/AAAAAAAAAsQ/iesdshoWcgo/s320/P5240040.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_Ejdzr5ACvJA/Sf1Q7ykJ8WI/AAAAAAAAAsQ/iesdshoWcgo/s72-c/P5240040.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6767707.post-5018404746264961780</id><published>2009-05-03T16:59:00.009+09:30</published><updated>2009-05-20T11:17:44.355+09:30</updated><title type='text'>WPF: StackPanel vs DockPanel and ScrollViewer</title><content type='html'>Mucking around with WPF (Microsoft's latest and nicest way of putting GUIs together), I spent an hour googling to find the following gem.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;A StackPanel allows its children to occupy whatever space they need.  Therefore, you will never see a scroll bar you have attached (via a ScrollViewer) to a child of a StackPanel unless you have explicitly set the ScrollViewer Height property.  You won't see the scroll bar because the child will be under the impression it has all the room it needs.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;A DockPanel, on the other hand, requests that its children limit themselves to the area in the window occupied by the DockPanel.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;img src="http://4.bp.blogspot.com/_Ejdzr5ACvJA/Sf1MerpidNI/AAAAAAAAAr8/LeIHsVx6AEU/s320/ScrollViewerInDockPanel.jpg" style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 320px; height: 294px;" alt="" id="BLOGGER_PHOTO_ID_5331501623873270994" border="0" /&gt;&lt;div&gt;On the left you can see an application where a ScrollViewer is attached to a StackPanel in a child of a DockPanel.  The scroll bar is visible because the StackPanel cannot be fully displayed in the area made available by the DockPanel.  The document structure looks something like this:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;DockPanel&lt;br /&gt; ...&lt;br /&gt; TabControl DockPanel.Dock=Top&lt;br /&gt;   TabItem&lt;br /&gt;     ScrollViewer&lt;br /&gt;       StackPanel&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;br /&gt;&lt;img src="http://4.bp.blogspot.com/_Ejdzr5ACvJA/Sf1Mp60NQlI/AAAAAAAAAsE/eL22IATidKk/s320/ScrollViewerInStackPanel.jpg" style="margin: 0pt 0pt 10px 10px; float: right; cursor: pointer; width: 320px; height: 320px;" alt="" id="BLOGGER_PHOTO_ID_5331501816923112018" border="0" /&gt;&lt;/div&gt;On the right you can see the same application where the ScrollViewer's parent is a child of a StackPanel.  The scroll bar is not shown because the child StackPanel thinks it has all the display area it needs.  This document structure looks something like this:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;StackPanel&lt;/span&gt;&lt;br /&gt; ...&lt;br /&gt; TabControl DockPanel.Dock=Top&lt;br /&gt;   TabItem&lt;br /&gt;     ScrollViewer&lt;br /&gt;       StackPanel&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6767707-5018404746264961780?l=ralphbecket.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ralphbecket.blogspot.com/feeds/5018404746264961780/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6767707&amp;postID=5018404746264961780' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/5018404746264961780'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/5018404746264961780'/><link rel='alternate' type='text/html' href='http://ralphbecket.blogspot.com/2009/05/wpf-stackpanel-vs-dockpanel-and.html' title='WPF: StackPanel vs DockPanel and ScrollViewer'/><author><name>Rafe</name><uri>http://www.blogger.com/profile/10169325688704651715</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Ejdzr5ACvJA/Sf1Q7ykJ8WI/AAAAAAAAAsQ/iesdshoWcgo/s320/P5240040.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_Ejdzr5ACvJA/Sf1MerpidNI/AAAAAAAAAr8/LeIHsVx6AEU/s72-c/ScrollViewerInDockPanel.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6767707.post-1822292020315502370</id><published>2009-05-03T14:52:00.003+09:30</published><updated>2009-05-03T16:58:37.483+09:30</updated><title type='text'>JavaScript</title><content type='html'>I've been learning a bit about JavaScript (&lt;a href="http://docs.google.com/Doc?id=dcr7ktmw_11238352cg8"&gt;here&lt;/a&gt; are my notes).  It's essentially Lisp based on hash tables rather than lists.  Here's my implementation of the &lt;a href="http://ralphbecket.googlepages.com/tents.html"&gt;Tents&lt;/a&gt; puzzle you can play in your web browser, which uses the rather excellent &lt;a href="http://jquery.com/"&gt;jQuery&lt;/a&gt; library (highly recommended for all your web page manipulation).&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6767707-1822292020315502370?l=ralphbecket.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ralphbecket.blogspot.com/feeds/1822292020315502370/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6767707&amp;postID=1822292020315502370' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/1822292020315502370'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/1822292020315502370'/><link rel='alternate' type='text/html' href='http://ralphbecket.blogspot.com/2009/05/ive-been-learning-bit-about-javascript.html' title='JavaScript'/><author><name>Rafe</name><uri>http://www.blogger.com/profile/10169325688704651715</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Ejdzr5ACvJA/Sf1Q7ykJ8WI/AAAAAAAAAsQ/iesdshoWcgo/s320/P5240040.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6767707.post-8801606764740089834</id><published>2009-05-03T14:51:00.002+09:30</published><updated>2009-05-03T16:58:25.126+09:30</updated><title type='text'>Build your own HTPC/media centre</title><content type='html'>I built a home theatre PC (HTPC)/media centre about eighteen months ago.  It is fantastic!&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a href="http://docs.google.com/Doc?id=dcr7ktmw_10fnjmqb"&gt;Here&lt;/a&gt; are my notes on the construction.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6767707-8801606764740089834?l=ralphbecket.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ralphbecket.blogspot.com/feeds/8801606764740089834/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6767707&amp;postID=8801606764740089834' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/8801606764740089834'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/8801606764740089834'/><link rel='alternate' type='text/html' href='http://ralphbecket.blogspot.com/2009/05/i-built-home-theatre-pc-htpcmedia.html' title='Build your own HTPC/media centre'/><author><name>Rafe</name><uri>http://www.blogger.com/profile/10169325688704651715</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Ejdzr5ACvJA/Sf1Q7ykJ8WI/AAAAAAAAAsQ/iesdshoWcgo/s320/P5240040.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6767707.post-141487410031760596</id><published>2009-05-03T14:50:00.002+09:30</published><updated>2009-05-03T16:58:00.632+09:30</updated><title type='text'>Visual Studio Shortcuts</title><content type='html'>&lt;a href="http://docs.google.com/Doc?id=dcr7ktmw_109xtxzdqgd"&gt;Here's&lt;/a&gt; my list of Visual Studio shortcuts for C#.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6767707-141487410031760596?l=ralphbecket.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ralphbecket.blogspot.com/feeds/141487410031760596/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6767707&amp;postID=141487410031760596' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/141487410031760596'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/141487410031760596'/><link rel='alternate' type='text/html' href='http://ralphbecket.blogspot.com/2009/05/heres-my-list-of-visual-studio.html' title='Visual Studio Shortcuts'/><author><name>Rafe</name><uri>http://www.blogger.com/profile/10169325688704651715</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Ejdzr5ACvJA/Sf1Q7ykJ8WI/AAAAAAAAAsQ/iesdshoWcgo/s320/P5240040.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6767707.post-9003746226939372165</id><published>2009-05-03T14:42:00.003+09:30</published><updated>2009-05-03T16:57:28.233+09:30</updated><title type='text'>C#</title><content type='html'>I've been spending some time learning C#.  I spent two years as a post-doc researcher with Microsoft Research in Cambridge who have recruited some of the finest language researchers in the world.  I'm not a fan of OO languages, but the bright chaps and chapesses at MSR have been doing a decent job pushing functional programming and decent type systems into .NET and C#.  After &lt;a href="http://www.mercury.csse.unimelb.edu.au/"&gt;Mercury&lt;/a&gt;, C# is now my second language of choice for large scale programming.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a href="http://docs.google.com/Doc?id=dcr7ktmw_8fjvdpr"&gt;Here&lt;/a&gt; are some notes I've been making.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6767707-9003746226939372165?l=ralphbecket.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ralphbecket.blogspot.com/feeds/9003746226939372165/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6767707&amp;postID=9003746226939372165' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/9003746226939372165'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/9003746226939372165'/><link rel='alternate' type='text/html' href='http://ralphbecket.blogspot.com/2009/05/ive-been-spending-some-time-learning-c.html' title='C#'/><author><name>Rafe</name><uri>http://www.blogger.com/profile/10169325688704651715</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Ejdzr5ACvJA/Sf1Q7ykJ8WI/AAAAAAAAAsQ/iesdshoWcgo/s320/P5240040.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6767707.post-7509099333189662615</id><published>2009-05-03T14:40:00.002+09:30</published><updated>2009-05-03T14:42:06.790+09:30</updated><title type='text'>It's been a while</title><content type='html'>Good grief, I'm shocking at updating these things.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;News since my last missive:&lt;/div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;I'm now married;&lt;/li&gt;&lt;li&gt;I'm a second degree blackbelt in aikido;&lt;/li&gt;&lt;li&gt;I've become a father.&lt;/li&gt;&lt;/ul&gt;Lawks.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6767707-7509099333189662615?l=ralphbecket.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ralphbecket.blogspot.com/feeds/7509099333189662615/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6767707&amp;postID=7509099333189662615' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/7509099333189662615'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/7509099333189662615'/><link rel='alternate' type='text/html' href='http://ralphbecket.blogspot.com/2009/05/its-been-while.html' title='It&apos;s been a while'/><author><name>Rafe</name><uri>http://www.blogger.com/profile/10169325688704651715</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Ejdzr5ACvJA/Sf1Q7ykJ8WI/AAAAAAAAAsQ/iesdshoWcgo/s320/P5240040.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6767707.post-113133423287029946</id><published>2005-11-07T11:43:00.000+10:30</published><updated>2005-11-07T14:06:59.366+10:30</updated><title type='text'>Blackbelt</title><content type='html'>&lt;span style="font-weight: bold;"&gt;My Blackbelt Grading&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;I took my aikido blackbelt test on Saturday (5 November 2005) and passed! Two days later and I still have an enormous grin plastered across my face. This grading was, I suppose, the first major examination I've had since I sat my first degree back in '92 (my Ph.D. viva in '98 was nerve wracking, but in that situation &lt;span style="font-style: italic;"&gt;I&lt;/span&gt; was the expert in the room). I've always enjoyed exams; I get butterflies, but I still usually manage to have fun. My blackbelt test was a bit different in that I was performing in front of the entire dojo and a scary Sensei.&lt;br /&gt;&lt;br /&gt;I was convinced I'd fluffed it up. Everything was going really well: I reckon I was doing solid, spirited, precise technique, with virtually no corrections from the auxiliary examiners on my mat, until it came to kokyu nage, when my mind went completely blank and I froze up. It was a total nightmare: Sensei was going off at me, everybody was&lt;br /&gt;waiting for me to do something, and I couldn't think of a single thing. I started thinking through everything I knew, picked the one thing I couldn't think of the name for, and it turned out to be right. Thank God. (Kokyu nage is the kind of "miscellanous" bin of aikido technique.) The nightmare continued. The next technique Sensei asked for - and he was still focussing on me - was tsuki tenchi nage (tsuki = straight punch, tenchi nage = Heaven-and-Earth throw), something which &lt;span style="font-style: italic;"&gt;all&lt;/span&gt; the senpai I'd asked assured me didn't exist. So while everyone else on the mats was looking confused, I was the one getting the grilling. In the end I made something up and it must have been mildly convincing because I got away with it! In the break between gradings, everybody, including the instructors, were all trying out tsuki tenchi nage to try and work out what on Earth it might be... I'll have to ask Sensei what the answer is. The second set of candidates were a bit luckier: they had an identical test except no tsuki tenchi nage, lucky buggers. Anyway, after a second disaster I was sure I'd failed, so I just relaxed and tried to have fun. I was so frazzled that doing the high falls, which usually scare the bejeesus out of me, were a breeze. In fact, I think that was the most fun part of my test.&lt;br /&gt;&lt;br /&gt;Richard said the look of surprise on my face when Sensei told me I'd passed was priceless.&lt;br /&gt;&lt;br /&gt;Anyway, now that I'm a blackbelt I get to wear the hakama: the enormous baggy black aikido pants.  Excellent! &lt;span style="font-weight: bold;"&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6767707-113133423287029946?l=ralphbecket.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ralphbecket.blogspot.com/feeds/113133423287029946/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6767707&amp;postID=113133423287029946' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/113133423287029946'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/113133423287029946'/><link rel='alternate' type='text/html' href='http://ralphbecket.blogspot.com/2005/11/blackbelt.html' title='Blackbelt'/><author><name>Rafe</name><uri>http://www.blogger.com/profile/10169325688704651715</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Ejdzr5ACvJA/Sf1Q7ykJ8WI/AAAAAAAAAsQ/iesdshoWcgo/s320/P5240040.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6767707.post-113020423617527592</id><published>2005-10-25T10:46:00.000+09:30</published><updated>2005-10-25T13:09:48.036+09:30</updated><title type='text'>Claire, Jill, Fergus, Rulande, and more aikido</title><content type='html'>&lt;span style="font-weight: bold;"&gt;Claire&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Friday I met up after work for drinks with Claire, who I haven't seen in over a decade. Claire is an old friend of Sarah, who I was going out with in Cambridge over ten years ago. I received an e-mail from Sarah out of the blue mentioning that Claire was working for six months in Melbourne, didn't know anyone yet, and could I take her out and get some drink into her. Which I did. I caught up with Claire at the Trust, an excellent city pub on Flinders Lane. Amazingly we recognised one another immediately! Anyway, we drank many drinks, ate some high quality Chinese food at Ants on the Tree in Chinatown, failed to get into Loop (apparently full to capacity), managed to get a few martinis in at the neighbouring bar (whose name I have never learned), and basically had a complete hoot. Much fun.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Jill&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The next day I got up late and hungover and made a total horlicks of taking a short-cut to Hawthorne East where&lt;br /&gt;Ammy and her mum Jill live. I arrived an hour late, which meant Ammy (a punctuality Nazi) was furious with me for at least ten minutes. God, I love a woman who forgives easily and I am going to marry her. Which, essentially, was the reason I was at Jill's place: Ammy had insisted that the Right Thing to Do was to ask for her mum's blessing before buying rings and proposing and that sort of thing. So I did and Jill (who had advanced notice) make a good attempt at looking surprised and then welcomed me into the family. The bottle of vintage Domaine Chandon I'd brought with me may also have helped. Jill is very like my mum in many respects and five minutes later she was making weakly veiled suggestions that I do something about my hair...&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Fergus and Rulande&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Fergus and Rulande are back in Melbourne for a couple of weeks and Ammy and I had them around to my place on Saturday night for dinner. In the end I cleaned and Ammy cooked: a kind of chilli con carne soup which turned out excellently. Much booze was consumed and a good night had by all. Marriage definitely suits F + R. Hopefully we'll get drunk with them again e're they fly back to Oregon.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Aikido&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;I've been training like crazy the last couple of months what with my black belt test coming on 5 November. The scariest thing by any reach has been learning high-falls. High-falls are necessary when someone is really going for it and is about to take off your head or your arm during a throw. When that happens you don't have time for a break-fall, which is where you fall underneath the attack. Past a certain level, you have to take high-falls instead, which involve doing a somersault in mid-air over the stressed joint (so this usually happens somewhere between waist and shoulder height) and hitting the mat with a spectacular thump on the other side. Eventually most people learn to do this with grace and style, but (a) I'm a rank beginner at these falls and (b) they scare the willies out of me. The trick is to be moving slightly ahead of the person throwing you, be very relaxed, jump &lt;span style="font-style: italic;"&gt;high&lt;/span&gt;, stay connected with nage (the thrower), and not look down. Anyway, I did some pre-class training on Friday with Stewart, who is a seven foot giant with a black belt. I took high falls from him out of all the techniques I need for my black belt, they didn't hurt, and I was having a whale of a time (love those endorphins...). So Friday and Saturday I was feeling pretty good about my aikido.&lt;br /&gt;&lt;br /&gt;Then on Sunday I went and trained in the park with Lucy and Elli and Dhao (who are also going for black belt) as has become our custom. Training went well until Richard, Lucy's fiancee, all round excellent chap, and superb nidan (second degree black belt), came over to test my high falls. Now Richard always does technique in a very effective, tight, correct fashion, which is actually much harder and scarier to fall out of in my humble opinion. Richard differs on this, but I think he sometimes forgets quite how much distance there is between a first and second degree black belt. Either way, after a fair deal of advice and correction I started thinking about the bloody high falls rather than just doing them, which for me is a fatal mistake. I ended up with sore joints and bruises and a severely battered ego. Grrrr!&lt;br /&gt;&lt;br /&gt;But all is not lost. I trained a bit more on Monday evening with Neela and did passable high falls out of shiho nage and juuji garame, two of the scary throws. So I am resolved to avoid further advice from Richard on the topic (Rich has been &lt;span style="font-style: italic;"&gt;so&lt;/span&gt; much help in training it's not true, but he just makes me more scared of the forward high falls when he tries to help there), just keep practicing, and hope not to need an ambulance on the big day!&lt;br /&gt;&lt;br /&gt;Jiu waza (dealing with multiple attackers) is definitely improving. Got some very helpful sneaky-fix-up advice from James, another tops nidan.&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6767707-113020423617527592?l=ralphbecket.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ralphbecket.blogspot.com/feeds/113020423617527592/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6767707&amp;postID=113020423617527592' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/113020423617527592'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/113020423617527592'/><link rel='alternate' type='text/html' href='http://ralphbecket.blogspot.com/2005/10/claire-jill-fergus-rulande-and-more.html' title='Claire, Jill, Fergus, Rulande, and more aikido'/><author><name>Rafe</name><uri>http://www.blogger.com/profile/10169325688704651715</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Ejdzr5ACvJA/Sf1Q7ykJ8WI/AAAAAAAAAsQ/iesdshoWcgo/s320/P5240040.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6767707.post-108181648375070168</id><published>2004-04-13T10:01:00.000+09:30</published><updated>2005-10-25T10:45:51.106+09:30</updated><title type='text'></title><content type='html'>I declare this blog open!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6767707-108181648375070168?l=ralphbecket.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/108181648375070168'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6767707/posts/default/108181648375070168'/><link rel='alternate' type='text/html' href='http://ralphbecket.blogspot.com/2004/04/i-declare-this-blog-open.html' title=''/><author><name>Rafe</name><uri>http://www.blogger.com/profile/10169325688704651715</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Ejdzr5ACvJA/Sf1Q7ykJ8WI/AAAAAAAAAsQ/iesdshoWcgo/s320/P5240040.JPG'/></author></entry></feed>
