<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:copyright="http://blogs.law.harvard.edu/tech/rss" xmlns:image="http://purl.org/rss/1.0/modules/image/">
    <channel>
        <title>CCook's Blog</title>
        <link>http://charlesrcook.com/Default.aspx</link>
        <description />
        <language>en-US</language>
        <copyright>CCook</copyright>
        <managingEditor>charles@charlesrcook.com</managingEditor>
        <generator>Subtext Version 1.9.5.177</generator>
        <image>
            <title>CCook's Blog</title>
            <url>http://charlesrcook.com/images/RSS2Image.gif</url>
            <link>http://charlesrcook.com/Default.aspx</link>
            <width>77</width>
            <height>60</height>
        </image>
        <item>
            <title>Creating a Bejeweled Blitz Bot in C#</title>
            <link>http://charlesrcook.com/archive/2010/09/05/creating-a-bejeweled-blitz-bot-in-c.aspx</link>
            <description>&lt;p&gt;One of the more addictive games out there is Bejeweled Blitz on Facebook.   It's fun to play, but as a programmer one thing nags at you as you play.  The thought 'I could program something that would do this much better.'  I program mostly scientific codes and business applications.  A bot application is quite different, and hence a great project.  I'll cover the process of making a bot here; however, I will not give a direct download.  If you want to run the bot you will have to compile your own application.  Cheating isn't the goal here.
&lt;/p&gt;&lt;p&gt;First, credit where it is due, &lt;a href="http://mikevallotton.wordpress.com/2009/08/19/i-cheat-at-bejeweled-blitz/"&gt;Mike Vallotton posted on the same topic&lt;/a&gt;.  Between this and his article assembling a bot should be straight forward.  My additions are in locating the game window, using statistics to identify game pieces, and using a damper on game moves.  He reports a score of 212K; I have reached 1.06M without much attention to the pattern recognition.  
&lt;/p&gt;&lt;p&gt;The approach is to create a bot that interfaces with the game in the same way a user would, through the mouse.  Doing so involves three major steps, reading the game state from the screen, solving for a move, and finally making the move.  Reading the game state from screenshots may be the trickiest of the three.
&lt;/p&gt;&lt;h2&gt;Locating the game window
&lt;/h2&gt;&lt;p&gt;Locating where the game window is on the screen was one of the more interesting problems to solve.  While we could use some libraries to get the window location of a browser which contains the Bejeweled game, we would not know where within the window the game resides.  Further, when needing to know where the game is to the pixel, the game location on the page is far too volatile with changing ads, content, etc.  
&lt;/p&gt;&lt;p&gt;To find the window I use a screenshot of the whole desktop and then find the game within this image.  Doing a per-pixel match is absurdly expensive, so I use an idea I borrowed from &lt;a href="http://www.math.ust.hk/~mawang/teaching/math532/mgtut.pdf"&gt;multigrid solvers&lt;/a&gt;, yet much simpler.    To find the window I first capture a screenshot and crop it down to the game I want to find, and save it to disk; In this case the title screen of the game.  Then I take a screenshot of the desktop captured during the run and attempt to find the title screen within.
&lt;/p&gt;&lt;p&gt;To find the title screen I first convert both images to grayscale by simply taking the red channel.  With grayscale images we then have a two dimensional array to work with, speeding things up a bit.  To speed things up further, both images are scaled down to 0.10 their original size (this is the idea of successive scales is borrowed from the multigrid solver).  Then the title screen is subtracted from the array at various locations.  After the subtraction the two dimensional array is summed to get a total sum value.  The location where the sum has the least value is taken to be the location where the window is located. 
&lt;/p&gt;&lt;p&gt;For the first levels of locating we do not need to be exact; we are just looking for regions where the title screen is so that the next level will have a reduced area to search.  For the first search I stepped across the screenshot by 2 pixels (20 pixels on the original image).  This then locates the game title screen to +/- (2*10) pixels on the screen.  Great, now we can resize to 0.25 and search a 10 by 10 region.  This is repeated at 0.50 before searching the final full scale screenshot.  I prefer to work in Matlab for such operations.  This does require &lt;a href="http://www.mathworks.com/matlabcentral/fileexchange/12987-integrating-matlab-with-c"&gt;compiling the Matlab code and referencing it from the .NET application&lt;/a&gt;.  
&lt;/p&gt;&lt;p&gt;The C# code to get a screenshot and call the compiled Matlab function:
&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;pre&gt;&lt;code&gt;&lt;span style="font-family:Consolas"&gt;&lt;span style="color:blue"&gt;private&lt;/span&gt; &lt;span style="color:blue"&gt;void&lt;/span&gt; FindGameScreen()&lt;br /&gt;{&lt;br /&gt;
					&lt;br /&gt;    &lt;span style="color:#2b91af"&gt;Rectangle&lt;/span&gt; r = &lt;span style="color:blue"&gt;new&lt;/span&gt; &lt;span style="color:#2b91af"&gt;Rectangle&lt;/span&gt;(0, 0,&lt;br /&gt;        &lt;span style="color:#2b91af"&gt;Screen&lt;/span&gt;.PrimaryScreen.Bounds.Width,&lt;br /&gt;        &lt;span style="color:#2b91af"&gt;Screen&lt;/span&gt;.PrimaryScreen.Bounds.Height);&lt;br /&gt;
					&lt;br /&gt;    &lt;span style="color:#2b91af"&gt;Bitmap&lt;/span&gt; bmp = &lt;span style="color:blue"&gt;new&lt;/span&gt; &lt;span style="color:#2b91af"&gt;Bitmap&lt;/span&gt;(r.Width, r.Height);&lt;br /&gt;
					&lt;br /&gt;    &lt;span style="color:blue"&gt;using&lt;/span&gt; (&lt;span style="color:#2b91af"&gt;Graphics&lt;/span&gt; g = &lt;span style="color:#2b91af"&gt;Graphics&lt;/span&gt;.FromImage(bmp))&lt;br /&gt;    {&lt;br /&gt;        g.CopyFromScreen(&lt;br /&gt;            &lt;span style="color:blue"&gt;new&lt;/span&gt; &lt;span style="color:#2b91af"&gt;Point&lt;/span&gt;(0, 0),&lt;br /&gt;            &lt;span style="color:blue"&gt;new&lt;/span&gt; &lt;span style="color:#2b91af"&gt;Point&lt;/span&gt;(0, 0),&lt;br /&gt;            r.Size);&lt;br /&gt;    }&lt;br /&gt;
					&lt;br /&gt;    &lt;span style="color:blue"&gt;int&lt;/span&gt;[,] bmpmat = &lt;span style="color:blue"&gt;new&lt;/span&gt; &lt;span style="color:blue"&gt;int&lt;/span&gt;[r.Height, r.Width];&lt;br /&gt;    &lt;span style="color:blue"&gt;for&lt;/span&gt; (&lt;span style="color:blue"&gt;int&lt;/span&gt; i = 0; i &amp;lt; r.Width; i++)&lt;br /&gt;        &lt;span style="color:blue"&gt;for&lt;/span&gt; (&lt;span style="color:blue"&gt;int&lt;/span&gt; j = 0; j &amp;lt; r.Height; j++)&lt;br /&gt;        {&lt;br /&gt;            &lt;span style="color:#2b91af"&gt;Color&lt;/span&gt; pixelColor = bmp.GetPixel(i, j);&lt;br /&gt;            bmpmat[j, i] = pixelColor.R;&lt;br /&gt;        }&lt;br /&gt;
					&lt;br /&gt;
					&lt;br /&gt;    &lt;span style="color:blue"&gt;var&lt;/span&gt; bmpinp = (&lt;span style="color:#2b91af"&gt;MWNumericArray&lt;/span&gt;)bmpmat;&lt;br /&gt;    &lt;span style="color:blue"&gt;var&lt;/span&gt; fileinp = (&lt;span style="color:#2b91af"&gt;MWCharArray&lt;/span&gt;)&lt;span style="color:#a31515"&gt;@"gametitle.bmp"&lt;/span&gt;;&lt;br /&gt;    &lt;span style="color:#2b91af"&gt;MWArray&lt;/span&gt; test = (&lt;span style="color:#2b91af"&gt;MWNumericArray&lt;/span&gt;)findWindow.findwindow(bmpinp, fileinp);&lt;br /&gt;
					&lt;br /&gt;    &lt;span style="color:blue"&gt;double&lt;/span&gt;[,] data = (&lt;span style="color:blue"&gt;double&lt;/span&gt;[,])test.ToArray();&lt;br /&gt;    &lt;span style="color:blue"&gt;double&lt;/span&gt; x = data[0, 0];&lt;br /&gt;    &lt;span style="color:blue"&gt;double&lt;/span&gt; y = data[0, 1];&lt;br /&gt;    gamex = &lt;span style="color:#2b91af"&gt;Convert&lt;/span&gt;.ToInt32(x);&lt;br /&gt;    gamey = &lt;span style="color:#2b91af"&gt;Convert&lt;/span&gt;.ToInt32(y);&lt;br /&gt;}
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;
 &lt;/p&gt;&lt;p&gt;The Matlab code which performs the described method:
&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New"&gt;&lt;span style="color:forestgreen; font-size:10pt"&gt;%&lt;/span&gt;&lt;span style="font-size:12pt"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New"&gt;&lt;span style="color:forestgreen; font-size:10pt"&gt;% Uses rescaling to find successive approximate locations of the window,&lt;/span&gt;&lt;span style="font-size:12pt"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New"&gt;&lt;span style="color:forestgreen; font-size:10pt"&gt;% finally finding the location to the pixel.&lt;/span&gt;&lt;span style="font-size:12pt"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New"&gt;&lt;span style="font-size:10pt"&gt;&lt;span style="color:blue"&gt;function&lt;/span&gt;&lt;span style="color:black"&gt; [data]= findwindow(fullscreen, game_filename)&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:12pt"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New"&gt;&lt;span style="color:black; font-size:10pt"&gt;    gametitle = imread(game_filename);&lt;/span&gt;&lt;span style="font-size:12pt"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New"&gt;&lt;span style="color:black; font-size:10pt"&gt;    fullscreen = uint8(fullscreen);&lt;/span&gt;&lt;span style="font-size:12pt"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;    
 &lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New"&gt;&lt;span style="color:black; font-size:10pt"&gt;    gametitle = gametitle(:,:,1);&lt;/span&gt;&lt;span style="font-size:12pt"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;    
 &lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New"&gt;&lt;span style="color:black; font-size:10pt"&gt;    fullscreen2 = imresize(fullscreen,.1);&lt;/span&gt;&lt;span style="font-size:12pt"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New"&gt;&lt;span style="color:black; font-size:10pt"&gt;    gametitle2 = imresize(gametitle,.1);&lt;/span&gt;&lt;span style="font-size:12pt"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;    
 &lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New"&gt;&lt;span style="color:black; font-size:10pt"&gt;    [x,y] = findwindow2(fullscreen2,gametitle2,1,1,0,0,2);&lt;/span&gt;&lt;span style="font-size:12pt"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;    
 &lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New"&gt;&lt;span style="color:black; font-size:10pt"&gt;    x = x*10;&lt;/span&gt;&lt;span style="font-size:12pt"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New"&gt;&lt;span style="color:black; font-size:10pt"&gt;    y = y*10;    &lt;/span&gt;&lt;span style="font-size:12pt"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;    
 &lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New"&gt;&lt;span style="color:black; font-size:10pt"&gt;    fullscreen2 = imresize(fullscreen,.25);&lt;/span&gt;&lt;span style="font-size:12pt"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New"&gt;&lt;span style="color:black; font-size:10pt"&gt;    gametitle2 = imresize(gametitle,.25);&lt;/span&gt;&lt;span style="font-size:12pt"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;    
 &lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New"&gt;&lt;span style="color:black; font-size:10pt"&gt;    x = x*.25-6*3;&lt;/span&gt;&lt;span style="font-size:12pt"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New"&gt;&lt;span style="color:black; font-size:10pt"&gt;    y = y*.25-6*3;&lt;/span&gt;&lt;span style="font-size:12pt"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New"&gt;&lt;span style="color:black; font-size:10pt"&gt;    xn = x+2*6*3;&lt;/span&gt;&lt;span style="font-size:12pt"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New"&gt;&lt;span style="color:black; font-size:10pt"&gt;    yn = y+2*6*3;&lt;/span&gt;&lt;span style="font-size:12pt"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New"&gt;&lt;span style="font-size:10pt"&gt;&lt;span style="color:black"&gt;
				&lt;/span&gt;&lt;span style="color:blue"&gt;if&lt;/span&gt;&lt;span style="color:black"&gt; (x&amp;lt;1)&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:12pt"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New"&gt;&lt;span style="color:black; font-size:10pt"&gt;        x=1;&lt;/span&gt;&lt;span style="font-size:12pt"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New"&gt;&lt;span style="font-size:10pt"&gt;&lt;span style="color:black"&gt;
				&lt;/span&gt;&lt;span style="color:blue"&gt;end&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:12pt"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New"&gt;&lt;span style="font-size:10pt"&gt;&lt;span style="color:black"&gt;
				&lt;/span&gt;&lt;span style="color:blue"&gt;if&lt;/span&gt;&lt;span style="color:black"&gt; (y&amp;lt;1)&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:12pt"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New"&gt;&lt;span style="color:black; font-size:10pt"&gt;        y=1;&lt;/span&gt;&lt;span style="font-size:12pt"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New"&gt;&lt;span style="font-size:10pt"&gt;&lt;span style="color:black"&gt;
				&lt;/span&gt;&lt;span style="color:blue"&gt;end&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:12pt"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;    
 &lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New"&gt;&lt;span style="color:black; font-size:10pt"&gt;    [x,y] = findwindow2(fullscreen2,gametitle2,x,y,xn,yn,3);&lt;/span&gt;&lt;span style="font-size:12pt"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;    
 &lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New"&gt;&lt;span style="color:black; font-size:10pt"&gt;    x = x*4;&lt;/span&gt;&lt;span style="font-size:12pt"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New"&gt;&lt;span style="color:black; font-size:10pt"&gt;    y = y*4;&lt;/span&gt;&lt;span style="font-size:12pt"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New"&gt;&lt;span style="font-size:10pt"&gt;&lt;span style="color:black"&gt;
				&lt;/span&gt;&lt;span style="color:blue"&gt;if&lt;/span&gt;&lt;span style="color:black"&gt; (x&amp;lt;1)&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:12pt"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New"&gt;&lt;span style="color:black; font-size:10pt"&gt;        x=1;&lt;/span&gt;&lt;span style="font-size:12pt"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New"&gt;&lt;span style="font-size:10pt"&gt;&lt;span style="color:black"&gt;
				&lt;/span&gt;&lt;span style="color:blue"&gt;end&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:12pt"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New"&gt;&lt;span style="font-size:10pt"&gt;&lt;span style="color:black"&gt;
				&lt;/span&gt;&lt;span style="color:blue"&gt;if&lt;/span&gt;&lt;span style="color:black"&gt; (y&amp;lt;1)&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:12pt"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New"&gt;&lt;span style="color:black; font-size:10pt"&gt;        y=1;&lt;/span&gt;&lt;span style="font-size:12pt"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New"&gt;&lt;span style="font-size:10pt"&gt;&lt;span style="color:black"&gt;
				&lt;/span&gt;&lt;span style="color:blue"&gt;end&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:12pt"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New"&gt;&lt;span style="color:forestgreen; font-size:10pt"&gt;%     &lt;/span&gt;&lt;span style="font-size:12pt"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New"&gt;&lt;span style="color:black; font-size:10pt"&gt;    fullscreen2 = imresize(fullscreen,.5);&lt;/span&gt;&lt;span style="font-size:12pt"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New"&gt;&lt;span style="color:black; font-size:10pt"&gt;    gametitle2 = imresize(gametitle,.5);&lt;/span&gt;&lt;span style="font-size:12pt"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New"&gt;&lt;span style="color:forestgreen; font-size:10pt"&gt;%     &lt;/span&gt;&lt;span style="font-size:12pt"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New"&gt;&lt;span style="color:black; font-size:10pt"&gt;    x = x*.5-3*3&lt;/span&gt;&lt;span style="font-size:12pt"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New"&gt;&lt;span style="color:black; font-size:10pt"&gt;    y = y*.5-3*3&lt;/span&gt;&lt;span style="font-size:12pt"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New"&gt;&lt;span style="color:black; font-size:10pt"&gt;    xn = x+2*3*3;&lt;/span&gt;&lt;span style="font-size:12pt"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New"&gt;&lt;span style="color:black; font-size:10pt"&gt;    yn = y+2*3*3;&lt;/span&gt;&lt;span style="font-size:12pt"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New"&gt;&lt;span style="color:forestgreen; font-size:10pt"&gt;%     &lt;/span&gt;&lt;span style="font-size:12pt"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New"&gt;&lt;span style="color:black; font-size:10pt"&gt;    [x,y] = findwindow2(fullscreen2,gametitle2,x,y,xn,yn,3);&lt;/span&gt;&lt;span style="font-size:12pt"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;    
 &lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New"&gt;&lt;span style="color:black; font-size:10pt"&gt;    x = x*2;&lt;/span&gt;&lt;span style="font-size:12pt"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New"&gt;&lt;span style="color:black; font-size:10pt"&gt;    y=y*2;&lt;/span&gt;&lt;span style="font-size:12pt"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New"&gt;&lt;span style="font-size:10pt"&gt;&lt;span style="color:black"&gt;
				&lt;/span&gt;&lt;span style="color:blue"&gt;if&lt;/span&gt;&lt;span style="color:black"&gt; (x&amp;lt;1)&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:12pt"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New"&gt;&lt;span style="color:black; font-size:10pt"&gt;        x=1;&lt;/span&gt;&lt;span style="font-size:12pt"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New"&gt;&lt;span style="font-size:10pt"&gt;&lt;span style="color:black"&gt;
				&lt;/span&gt;&lt;span style="color:blue"&gt;end&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:12pt"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New"&gt;&lt;span style="font-size:10pt"&gt;&lt;span style="color:black"&gt;
				&lt;/span&gt;&lt;span style="color:blue"&gt;if&lt;/span&gt;&lt;span style="color:black"&gt; (y&amp;lt;1)&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:12pt"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New"&gt;&lt;span style="color:black; font-size:10pt"&gt;        y=1;&lt;/span&gt;&lt;span style="font-size:12pt"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New"&gt;&lt;span style="font-size:10pt"&gt;&lt;span style="color:black"&gt;
				&lt;/span&gt;&lt;span style="color:blue"&gt;end&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:12pt"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New"&gt;&lt;span style="color:forestgreen; font-size:10pt"&gt;%    &lt;/span&gt;&lt;span style="font-size:12pt"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New"&gt;&lt;span style="color:black; font-size:10pt"&gt;    x = x-2*3&lt;/span&gt;&lt;span style="font-size:12pt"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New"&gt;&lt;span style="color:black; font-size:10pt"&gt;    y = y-2*3&lt;/span&gt;&lt;span style="font-size:12pt"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New"&gt;&lt;span style="color:black; font-size:10pt"&gt;    xn = x+2*2*3;&lt;/span&gt;&lt;span style="font-size:12pt"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New"&gt;&lt;span style="color:black; font-size:10pt"&gt;    yn = y+2*2*3;&lt;/span&gt;&lt;span style="font-size:12pt"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New"&gt;&lt;span style="color:forestgreen; font-size:10pt"&gt;%    &lt;/span&gt;&lt;span style="font-size:12pt"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New"&gt;&lt;span style="color:black; font-size:10pt"&gt;    [x,y] = findwindow2(fullscreen,gametitle,x,y,xn,yn,1);&lt;/span&gt;&lt;span style="font-size:12pt"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;    
 &lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New"&gt;&lt;span style="color:black; font-size:10pt"&gt;    data = [x,y]&lt;/span&gt;&lt;span style="font-size:12pt"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New"&gt;&lt;span style="color:blue; font-size:10pt"&gt;end&lt;/span&gt;&lt;span style="font-size:12pt"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt; 
 &lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New"&gt;&lt;span style="font-size:10pt"&gt;&lt;span style="color:blue"&gt;function&lt;/span&gt;&lt;span style="color:black"&gt; [x,y] = findwindow2(fullscreen,gametitle,x0,y0,xn,yn,stepsize)&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:12pt"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;    
 &lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New"&gt;&lt;span style="color:black; font-size:10pt"&gt;    xmin=0;&lt;/span&gt;&lt;span style="font-size:12pt"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New"&gt;&lt;span style="color:black; font-size:10pt"&gt;    ymin=0;&lt;/span&gt;&lt;span style="font-size:12pt"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New"&gt;&lt;span style="color:black; font-size:10pt"&gt;    testmin = inf;&lt;/span&gt;&lt;span style="font-size:12pt"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;    
 &lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New"&gt;&lt;span style="color:black; font-size:10pt"&gt;    [gheight, gwidth] = size(gametitle);&lt;/span&gt;&lt;span style="font-size:12pt"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New"&gt;&lt;span style="color:black; font-size:10pt"&gt;    [fheight, fwidth] = size(fullscreen)&lt;/span&gt;&lt;span style="font-size:12pt"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;    
 &lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New"&gt;&lt;span style="font-size:10pt"&gt;&lt;span style="color:black"&gt;
				&lt;/span&gt;&lt;span style="color:blue"&gt;if&lt;/span&gt;&lt;span style="color:black"&gt; (xn == 0)&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:12pt"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New"&gt;&lt;span style="color:black; font-size:10pt"&gt;        xn=fwidth-gwidth-stepsize&lt;/span&gt;&lt;span style="font-size:12pt"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New"&gt;&lt;span style="font-size:10pt"&gt;&lt;span style="color:black"&gt;
				&lt;/span&gt;&lt;span style="color:blue"&gt;end&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:12pt"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New"&gt;&lt;span style="font-size:10pt"&gt;&lt;span style="color:black"&gt;
				&lt;/span&gt;&lt;span style="color:blue"&gt;if&lt;/span&gt;&lt;span style="color:black"&gt; (yn == 0)&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:12pt"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New"&gt;&lt;span style="color:black; font-size:10pt"&gt;        yn = fheight-gheight-stepsize&lt;/span&gt;&lt;span style="font-size:12pt"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New"&gt;&lt;span style="font-size:10pt"&gt;&lt;span style="color:black"&gt;
				&lt;/span&gt;&lt;span style="color:blue"&gt;end&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:12pt"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;    
 &lt;/p&gt;&lt;p&gt;    
 &lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New"&gt;&lt;span style="font-size:10pt"&gt;&lt;span style="color:black"&gt;
				&lt;/span&gt;&lt;span style="color:blue"&gt;for&lt;/span&gt;&lt;span style="color:black"&gt;(x=x0:stepsize:xn)&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:12pt"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New"&gt;&lt;span style="font-size:10pt"&gt;&lt;span style="color:black"&gt;
				&lt;/span&gt;&lt;span style="color:blue"&gt;for&lt;/span&gt;&lt;span style="color:black"&gt;(y=y0:stepsize:yn)&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:12pt"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New"&gt;&lt;span style="color:black; font-size:10pt"&gt;            test = error_fun([x,y]);&lt;/span&gt;&lt;span style="font-size:12pt"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New"&gt;&lt;span style="font-size:10pt"&gt;&lt;span style="color:black"&gt;
				&lt;/span&gt;&lt;span style="color:blue"&gt;if&lt;/span&gt;&lt;span style="color:black"&gt; (test &amp;lt; testmin)&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:12pt"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New"&gt;&lt;span style="color:black; font-size:10pt"&gt;                xmin = x;&lt;/span&gt;&lt;span style="font-size:12pt"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New"&gt;&lt;span style="color:black; font-size:10pt"&gt;                ymin = y;&lt;/span&gt;&lt;span style="font-size:12pt"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New"&gt;&lt;span style="color:black; font-size:10pt"&gt;                testmin = test;&lt;/span&gt;&lt;span style="font-size:12pt"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New"&gt;&lt;span style="font-size:10pt"&gt;&lt;span style="color:black"&gt;
				&lt;/span&gt;&lt;span style="color:blue"&gt;end&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:12pt"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New"&gt;&lt;span style="font-size:10pt"&gt;&lt;span style="color:black"&gt;
				&lt;/span&gt;&lt;span style="color:blue"&gt;end&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:12pt"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New"&gt;&lt;span style="font-size:10pt"&gt;&lt;span style="color:black"&gt;
				&lt;/span&gt;&lt;span style="color:blue"&gt;end&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:12pt"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;    
 &lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New"&gt;&lt;span style="color:black; font-size:10pt"&gt;    x=xmin;&lt;/span&gt;&lt;span style="font-size:12pt"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New"&gt;&lt;span style="color:black; font-size:10pt"&gt;    y=ymin;&lt;/span&gt;&lt;span style="font-size:12pt"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;    
 &lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New"&gt;&lt;span style="font-size:10pt"&gt;&lt;span style="color:black"&gt;
				&lt;/span&gt;&lt;span style="color:blue"&gt;function&lt;/span&gt;&lt;span style="color:black"&gt; f = error_fun(x)&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:12pt"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New"&gt;&lt;span style="color:black; font-size:10pt"&gt;         f= test_sub(x(1),x(2),fullscreen,gametitle);&lt;/span&gt;&lt;span style="font-size:12pt"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New"&gt;&lt;span style="font-size:10pt"&gt;&lt;span style="color:black"&gt;
				&lt;/span&gt;&lt;span style="color:blue"&gt;end&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:12pt"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New"&gt;&lt;span style="color:blue; font-size:10pt"&gt;end&lt;/span&gt;&lt;span style="font-size:12pt"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt; 
 &lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New"&gt;&lt;span style="font-size:10pt"&gt;&lt;span style="color:blue"&gt;function&lt;/span&gt;&lt;span style="color:black"&gt; fit = test_sub(x, y, full, game)&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:12pt"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New"&gt;&lt;span style="color:black; font-size:10pt"&gt;   x = round(x);&lt;/span&gt;&lt;span style="font-size:12pt"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New"&gt;&lt;span style="color:black; font-size:10pt"&gt;   y = round(y);&lt;/span&gt;&lt;span style="font-size:12pt"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New"&gt;&lt;span style="color:black; font-size:10pt"&gt;   [height, width] = size(game);&lt;/span&gt;&lt;span style="font-size:12pt"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New"&gt;&lt;span style="color:black; font-size:10pt"&gt;   sub = full(y:y+height-1,x:x+width-1);&lt;/span&gt;&lt;span style="font-size:12pt"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New"&gt;&lt;span style="color:black; font-size:10pt"&gt;   sub = sub-game;&lt;/span&gt;&lt;span style="font-size:12pt"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New"&gt;&lt;span style="color:black; font-size:10pt"&gt;   fit = sum(sum(sub,1));&lt;/span&gt;&lt;span style="font-size:12pt"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New"&gt;&lt;span style="color:blue; font-size:10pt"&gt;end&lt;/span&gt;&lt;span style="font-size:12pt"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;
 &lt;/p&gt;&lt;h2&gt;Recognizing pieces
&lt;/h2&gt;&lt;p&gt;To get the game state from the screenshots I chose to avoid OCR methods and just go with a statistical approach.  The idea was that the histogram for a piece will be unique from the other colors.  For example, the mean red value for red would be different than that of the other pieces.  To get the reference statistics from the game I used &lt;a href="http://www.aforgenet.com/"&gt;AForge.NET&lt;/a&gt;.  The Framework comes with a nice application to work with images and a library to reference from the bot.  
&lt;/p&gt;&lt;p&gt;The first step is to collect statistics for all the game pieces.  To do this, get a screenshot of all of them, and then crop down to just the game pieces.  Each piece has some shape surrounded by the background board.  To improve the statistics I chose to grab a 20 by 20 pixel box centered on the piece location.  That is to say, crop down the 40 by 40 location to just the inner 20 by 20 and what remains is the core of a game piece.  
&lt;/p&gt;&lt;p&gt;The statistics I collected using AForge .NET. 
&lt;/p&gt;&lt;div&gt;&lt;table style="border-collapse:collapse" border="0"&gt;&lt;colgroup&gt;&lt;col style="width:64px" /&gt;&lt;col style="width:89px" /&gt;&lt;col style="width:103px" /&gt;&lt;col style="width:93px" /&gt;&lt;/colgroup&gt;&lt;tbody valign="top"&gt;&lt;tr style="height: 20px"&gt;&lt;td style="padding-left: 7px; padding-right: 7px; border-top:  solid #4f81bd 1.0pt; border-left:  none; border-bottom:  solid #4f81bd 1.0pt; border-right:  none"&gt;&lt;p&gt;&lt;span style="color:black"&gt;&lt;strong&gt;Piece&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="padding-left: 7px; padding-right: 7px; border-top:  solid #4f81bd 1.0pt; border-left:  none; border-bottom:  solid #4f81bd 1.0pt; border-right:  none"&gt;&lt;p style="text-align: right"&gt;&lt;span style="color:black"&gt;&lt;strong&gt;Red Mean&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="padding-left: 7px; padding-right: 7px; border-top:  solid #4f81bd 1.0pt; border-left:  none; border-bottom:  solid #4f81bd 1.0pt; border-right:  none"&gt;&lt;p style="text-align: right"&gt;&lt;span style="color:black"&gt;&lt;strong&gt;Green Mean&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="padding-left: 7px; padding-right: 7px; border-top:  solid #4f81bd 1.0pt; border-left:  none; border-bottom:  solid #4f81bd 1.0pt; border-right:  none"&gt;&lt;p style="text-align: right"&gt;&lt;span style="color:black"&gt;&lt;strong&gt;Blue Mean&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style="height: 20px; background: #d3dfee"&gt;&lt;td style="padding-left: 7px; padding-right: 7px; border-left:  none; border-right:  none"&gt;&lt;p&gt;&lt;span style="color:black"&gt;&lt;strong&gt;white&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="padding-left: 7px; padding-right: 7px; border-left:  none; border-right:  none"&gt;&lt;p style="text-align: right"&gt;&lt;span style="color:black"&gt;218.79&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="padding-left: 7px; padding-right: 7px; border-left:  none; border-right:  none"&gt;&lt;p style="text-align: right"&gt;&lt;span style="color:black"&gt;218.79&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="padding-left: 7px; padding-right: 7px; border-left:  none; border-right:  none"&gt;&lt;p style="text-align: right"&gt;&lt;span style="color:black"&gt;218.79&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style="height: 20px"&gt;&lt;td style="padding-left: 7px; padding-right: 7px"&gt;&lt;p&gt;&lt;span style="color:black"&gt;&lt;strong&gt;purple&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="padding-left: 7px; padding-right: 7px"&gt;&lt;p style="text-align: right"&gt;&lt;span style="color:black"&gt;176.7325&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="padding-left: 7px; padding-right: 7px"&gt;&lt;p style="text-align: right"&gt;&lt;span style="color:black"&gt;38.1&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="padding-left: 7px; padding-right: 7px"&gt;&lt;p style="text-align: right"&gt;&lt;span style="color:black"&gt;177.2425&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style="height: 20px; background: #d3dfee"&gt;&lt;td style="padding-left: 7px; padding-right: 7px; border-left:  none; border-right:  none"&gt;&lt;p&gt;&lt;span style="color:black"&gt;&lt;strong&gt;blue&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="padding-left: 7px; padding-right: 7px; border-left:  none; border-right:  none"&gt;&lt;p style="text-align: right"&gt;&lt;span style="color:black"&gt;16.975&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="padding-left: 7px; padding-right: 7px; border-left:  none; border-right:  none"&gt;&lt;p style="text-align: right"&gt;&lt;span style="color:black"&gt;109.5675&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="padding-left: 7px; padding-right: 7px; border-left:  none; border-right:  none"&gt;&lt;p style="text-align: right"&gt;&lt;span style="color:black"&gt;204.7625&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style="height: 20px"&gt;&lt;td style="padding-left: 7px; padding-right: 7px"&gt;&lt;p&gt;&lt;span style="color:black"&gt;&lt;strong&gt;green&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="padding-left: 7px; padding-right: 7px"&gt;&lt;p style="text-align: right"&gt;&lt;span style="color:black"&gt;43.06&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="padding-left: 7px; padding-right: 7px"&gt;&lt;p style="text-align: right"&gt;&lt;span style="color:black"&gt;214.2775&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="padding-left: 7px; padding-right: 7px"&gt;&lt;p style="text-align: right"&gt;&lt;span style="color:black"&gt;75.365&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style="height: 20px; background: #d3dfee"&gt;&lt;td style="padding-left: 7px; padding-right: 7px; border-left:  none; border-right:  none"&gt;&lt;p&gt;&lt;span style="color:black"&gt;&lt;strong&gt;yellow&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="padding-left: 7px; padding-right: 7px; border-left:  none; border-right:  none"&gt;&lt;p style="text-align: right"&gt;&lt;span style="color:black"&gt;227.01&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="padding-left: 7px; padding-right: 7px; border-left:  none; border-right:  none"&gt;&lt;p style="text-align: right"&gt;&lt;span style="color:black"&gt;197.165&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="padding-left: 7px; padding-right: 7px; border-left:  none; border-right:  none"&gt;&lt;p style="text-align: right"&gt;&lt;span style="color:black"&gt;28&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style="height: 20px"&gt;&lt;td style="padding-left: 7px; padding-right: 7px"&gt;&lt;p&gt;&lt;span style="color:black"&gt;&lt;strong&gt;orange&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="padding-left: 7px; padding-right: 7px"&gt;&lt;p style="text-align: right"&gt;&lt;span style="color:black"&gt;238.49&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="padding-left: 7px; padding-right: 7px"&gt;&lt;p style="text-align: right"&gt;&lt;span style="color:black"&gt;143.535&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="padding-left: 7px; padding-right: 7px"&gt;&lt;p style="text-align: right"&gt;&lt;span style="color:black"&gt;55.7425&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style="height: 20px; background: #d3dfee"&gt;&lt;td style="padding-left: 7px; padding-right: 7px; border-left:  none; border-bottom:  solid #4f81bd 1.0pt; border-right:  none"&gt;&lt;p&gt;&lt;span style="color:black"&gt;&lt;strong&gt;red&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="padding-left: 7px; padding-right: 7px; border-left:  none; border-bottom:  solid #4f81bd 1.0pt; border-right:  none"&gt;&lt;p style="text-align: right"&gt;&lt;span style="color:black"&gt;242.855&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="padding-left: 7px; padding-right: 7px; border-left:  none; border-bottom:  solid #4f81bd 1.0pt; border-right:  none"&gt;&lt;p style="text-align: right"&gt;&lt;span style="color:black"&gt;31.28&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="padding-left: 7px; padding-right: 7px; border-left:  none; border-bottom:  solid #4f81bd 1.0pt; border-right:  none"&gt;&lt;p style="text-align: right"&gt;&lt;span style="color:black"&gt;62.07&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;p&gt;
 &lt;/p&gt;&lt;p&gt;Great, we now have readily available statistics to match a game piece too.  Further, the statistics are calculated by the same library so matching should be good.
&lt;/p&gt;&lt;p&gt;Matching a piece to the statistics is straightforward using a &lt;a href="http://en.wikipedia.org/wiki/Sum_of_squares"&gt;Root Sum Square&lt;/a&gt; error approach.  For a statistic at a location we calculate the error to each piece and take the one with the smallest error.  The code would look something like:
&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Consolas; font-size:10pt"&gt;&lt;span style="color:blue"&gt;double&lt;/span&gt; bestScore = 255;&lt;br /&gt;&lt;span style="color:blue"&gt;double&lt;/span&gt; curScore = 0;&lt;br /&gt;&lt;span style="color:blue"&gt;foreach&lt;/span&gt; (&lt;span style="color:#2b91af"&gt;KeyValuePair&lt;/span&gt;&amp;lt;&lt;span style="color:#2b91af"&gt;Color&lt;/span&gt;, &lt;span style="color:#2b91af"&gt;List&lt;/span&gt;&amp;lt;&lt;span style="color:blue"&gt;double&lt;/span&gt;&amp;gt;&amp;gt; item &lt;span style="color:blue"&gt;in&lt;/span&gt; statReference)&lt;br /&gt;{&lt;br /&gt;    curScore = &lt;span style="color:#2b91af"&gt;Math&lt;/span&gt;.Pow(item.Value[0] / 255 - stats.Red.Mean / 255, 2)&lt;br /&gt;        + &lt;span style="color:#2b91af"&gt;Math&lt;/span&gt;.Pow(item.Value[1] / 255 - stats.Green.Mean / 255, 2)&lt;br /&gt;        + &lt;span style="color:#2b91af"&gt;Math&lt;/span&gt;.Pow(item.Value[2] / 255 - stats.Blue.Mean / 255, 2);&lt;br /&gt;    &lt;span style="color:blue"&gt;if&lt;/span&gt; (curScore &amp;lt; bestScore)&lt;br /&gt;    {&lt;br /&gt;        PieceColor = item.Key;&lt;br /&gt;        &lt;span style="color:blue"&gt;if&lt;/span&gt; (item.Key == &lt;span style="color:#2b91af"&gt;Color&lt;/span&gt;.YellowGreen)&lt;br /&gt;            PieceColor = &lt;span style="color:#2b91af"&gt;Color&lt;/span&gt;.Yellow;&lt;br /&gt;        &lt;span style="color:blue"&gt;if&lt;/span&gt; (item.Key == &lt;span style="color:#2b91af"&gt;Color&lt;/span&gt;.MediumPurple)&lt;br /&gt;            PieceColor = &lt;span style="color:#2b91af"&gt;Color&lt;/span&gt;.Purple;&lt;br /&gt;        bestScore = curScore;&lt;br /&gt;    }&lt;br /&gt;}
&lt;/span&gt;&lt;/p&gt;&lt;p&gt;
 &lt;/p&gt;&lt;p&gt;In this implementation a score, or error, is calculated by differencing the mean color values from an 'ideal' value and them performing the RSS on that value.  The score with the smallest error indicates the piece which has the closest match.  With pieces 20 by 20 and a cheap RSS being used, this method parses the game state very fast and accurately.  Note that it is important to crop down to the 'core' of the game piece as the background board tends to smooth out the statistics, especially between yellow and orange.
&lt;/p&gt;&lt;p&gt;Finding the statistics for the pieces can be done like so, where &lt;span style="font-family:Consolas"&gt;game&lt;/span&gt; is the current screenshot cropped to the game and &lt;span style="font-family:Consolas"&gt;gGamePieces&lt;/span&gt; is an array of initialized Graphics objects.
&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;pre&gt;&lt;code&gt;&lt;span style="font-family:Consolas"&gt;&lt;span style="color:blue"&gt;for&lt;/span&gt; (&lt;span style="color:blue"&gt;int&lt;/span&gt; i = 0; i &amp;lt; 8; i++)&lt;br /&gt;    &lt;span style="color:blue"&gt;for&lt;/span&gt; (&lt;span style="color:blue"&gt;int&lt;/span&gt; j = 0; j &amp;lt; 8; j++)&lt;br /&gt;    {&lt;br /&gt;        gGamePieces[i, j].DrawImage(&lt;br /&gt;            game,&lt;br /&gt;            &lt;span style="color:blue"&gt;new&lt;/span&gt; &lt;span style="color:#2b91af"&gt;Rectangle&lt;/span&gt;(&lt;br /&gt;                &lt;span style="color:blue"&gt;new&lt;/span&gt; &lt;span style="color:#2b91af"&gt;Point&lt;/span&gt;(0, 0),&lt;br /&gt;                &lt;span style="color:blue"&gt;new&lt;/span&gt; &lt;span style="color:#2b91af"&gt;Size&lt;/span&gt;(20, 20)),&lt;br /&gt;            &lt;span style="color:blue"&gt;new&lt;/span&gt; &lt;span style="color:#2b91af"&gt;Rectangle&lt;/span&gt;(&lt;br /&gt;                &lt;span style="color:blue"&gt;new&lt;/span&gt; &lt;span style="color:#2b91af"&gt;Point&lt;/span&gt;(gameStartX + (i * 40) + 10,&lt;br /&gt;                    gameStartY + (j * 40) + 10),&lt;br /&gt;                &lt;span style="color:blue"&gt;new&lt;/span&gt; &lt;span style="color:#2b91af"&gt;Size&lt;/span&gt;(20, 20)),&lt;br /&gt;            &lt;span style="color:#2b91af"&gt;GraphicsUnit&lt;/span&gt;.Pixel);&lt;br /&gt;        &lt;span style="color:#2b91af"&gt;ImageStatistics&lt;/span&gt; stats = &lt;span style="color:blue"&gt;new&lt;/span&gt; &lt;span style="color:#2b91af"&gt;ImageStatistics&lt;/span&gt;&lt;br /&gt;            (bmpGamePieces[i, j]);&lt;br /&gt;
					&lt;br /&gt;        &lt;span style="color:#2b91af"&gt;ImageStatisticsYCbCr&lt;/span&gt; stats2 = &lt;span style="color:blue"&gt;new&lt;/span&gt; &lt;span style="color:#2b91af"&gt;ImageStatisticsYCbCr&lt;/span&gt;(&lt;br /&gt;            bmpGamePieces[i, j]);&lt;br /&gt;
					&lt;br /&gt;        pGame[i, j].Parse(stats, stats2);&lt;br /&gt;    }
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;
 &lt;/p&gt;&lt;p&gt;I chose to store the piece reference statistics in a dictionary and initialize as follows:
&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;pre&gt;&lt;code&gt;&lt;span style="font-family:Consolas"&gt;&lt;span style="color:blue"&gt;private&lt;/span&gt; &lt;span style="color:blue"&gt;void&lt;/span&gt; BuildReference()&lt;br /&gt;{&lt;br /&gt;    &lt;span style="color:green"&gt;//RedMeanB    GreenMeanB    BlueMeanB&lt;/span&gt;&lt;br /&gt;    statReference = &lt;span style="color:blue"&gt;new&lt;/span&gt; &lt;span style="color:#2b91af"&gt;Dictionary&lt;/span&gt;&amp;lt;&lt;span style="color:#2b91af"&gt;Color&lt;/span&gt;, &lt;span style="color:#2b91af"&gt;List&lt;/span&gt;&amp;lt;&lt;span style="color:blue"&gt;double&lt;/span&gt;&amp;gt;&amp;gt;();&lt;br /&gt;    statReference.Add(&lt;span style="color:#2b91af"&gt;Color&lt;/span&gt;.White,&lt;br /&gt;        &lt;span style="color:blue"&gt;new&lt;/span&gt; &lt;span style="color:#2b91af"&gt;List&lt;/span&gt;&amp;lt;&lt;span style="color:blue"&gt;double&lt;/span&gt;&amp;gt; { 218.79, 218.79, 218.79 });&lt;br /&gt;    statReference.Add(&lt;span style="color:#2b91af"&gt;Color&lt;/span&gt;.Purple,&lt;br /&gt;        &lt;span style="color:blue"&gt;new&lt;/span&gt; &lt;span style="color:#2b91af"&gt;List&lt;/span&gt;&amp;lt;&lt;span style="color:blue"&gt;double&lt;/span&gt;&amp;gt; { 176.7325, 38.1, 177.2425 });&lt;br /&gt;    statReference.Add(&lt;span style="color:#2b91af"&gt;Color&lt;/span&gt;.Blue,&lt;br /&gt;        &lt;span style="color:blue"&gt;new&lt;/span&gt; &lt;span style="color:#2b91af"&gt;List&lt;/span&gt;&amp;lt;&lt;span style="color:blue"&gt;double&lt;/span&gt;&amp;gt; { 16.975, 109.5675, 204.7625 });&lt;br /&gt;    statReference.Add(&lt;span style="color:#2b91af"&gt;Color&lt;/span&gt;.Green,&lt;br /&gt;        &lt;span style="color:blue"&gt;new&lt;/span&gt; &lt;span style="color:#2b91af"&gt;List&lt;/span&gt;&amp;lt;&lt;span style="color:blue"&gt;double&lt;/span&gt;&amp;gt; { 43.06, 214.2775, 75.365 });&lt;br /&gt;    statReference.Add(&lt;span style="color:#2b91af"&gt;Color&lt;/span&gt;.Yellow,&lt;br /&gt;        &lt;span style="color:blue"&gt;new&lt;/span&gt; &lt;span style="color:#2b91af"&gt;List&lt;/span&gt;&amp;lt;&lt;span style="color:blue"&gt;double&lt;/span&gt;&amp;gt; { 227.01, 197.165, 28 });&lt;br /&gt;    statReference.Add(&lt;span style="color:#2b91af"&gt;Color&lt;/span&gt;.Orange,&lt;br /&gt;        &lt;span style="color:blue"&gt;new&lt;/span&gt; &lt;span style="color:#2b91af"&gt;List&lt;/span&gt;&amp;lt;&lt;span style="color:blue"&gt;double&lt;/span&gt;&amp;gt; { 238.49, 143.535, 55.7425 });&lt;br /&gt;    statReference.Add(&lt;span style="color:#2b91af"&gt;Color&lt;/span&gt;.Red,&lt;br /&gt;        &lt;span style="color:blue"&gt;new&lt;/span&gt; &lt;span style="color:#2b91af"&gt;List&lt;/span&gt;&amp;lt;&lt;span style="color:blue"&gt;double&lt;/span&gt;&amp;gt; { 242.855, 31.28, 62.07 });&lt;br /&gt;}
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;
 &lt;/p&gt;&lt;p&gt;We now have a way to locate the game window and identify the game pieces on the board.  We have our game state, great.
&lt;/p&gt;&lt;h2&gt;Determining a move
&lt;/h2&gt;&lt;p&gt;For this I did not do anything fancy.  With our known game state I simply search the board for any locations where swapping two pieces resulted in a three piece chain.  I didn't bother to add any checks for larger combos as I did not see this as accomplishing anything other than improving a score. 
&lt;/p&gt;&lt;p&gt;There was an additional component to determining the moves.  After doing a simple implementation I noticed an interesting dynamic feedback on the game.  The bot would move fast enough to try and create combos where they did not exist.  For example, it would swap a piece and while it was moving notice that if it also moved another piece a combo would be created while the pieces moved.  The game does not allow you to move two pieces to create a combo, so this just resulted in a bunch of spinning pieces that oscillated back and forth.  I chose to damp the board to prevent this.  
&lt;/p&gt;&lt;p&gt;To do this, I used an eight by eight double array to keep track of a delay.  Any time a move was performed I added 550 to that location and 275 to locations around it.  The values are delay values in milliseconds.  This way the bot will not move pieces away from an action in that area.  Every tick of the engine would subtract the elapsed time from the entire array.  Game moves are only made to locations where the delay value is zero (negative values are kept to zero).  This allows us to simply call all possible moves without destroying previous moves.  Note that for each tick I send moves for every possible match on the board.  I don't perform a move and exit the loop; I send them all without a Sleep.  The game does remarkably well at handling this.
&lt;/p&gt;&lt;p&gt;Running the bot is similar to a game loop.  I just created a timer which ticked at 50 milliseconds and stopped after 63 seconds (typically three seconds from the game pausing for specials).  
&lt;/p&gt;&lt;h2&gt;Making the move
&lt;/h2&gt;&lt;p&gt;Making the move involves an Interop call to user32.  Here I refer you to &lt;a href="http://mikevallotton.wordpress.com/2009/08/19/i-cheat-at-bejeweled-blitz/"&gt;Mike Vallotton's post&lt;/a&gt;. One 'gotcha' here, if you are running on x64 you need to change the offsets in the class or nothing will happen.  Also, I suggest putting in a Thread.Sleep while you test; the last thing you want is your mouse moving out of control with a bug, clicking around your Facebook page at 20 Hz.
&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;pre&gt;&lt;code&gt;&lt;span style="font-family:Consolas"&gt;[&lt;span style="color:#2b91af"&gt;StructLayout&lt;/span&gt;(&lt;span style="color:#2b91af"&gt;LayoutKind&lt;/span&gt;.Explicit)]&lt;br /&gt;&lt;span style="color:blue"&gt;private&lt;/span&gt; &lt;span style="color:blue"&gt;struct&lt;/span&gt; &lt;span style="color:#2b91af"&gt;INPUT&lt;/span&gt;&lt;br /&gt;{&lt;br /&gt;    [&lt;span style="color:#2b91af"&gt;FieldOffset&lt;/span&gt;(0)]&lt;br /&gt;    &lt;span style="color:blue"&gt;public&lt;/span&gt; &lt;span style="color:blue"&gt;int&lt;/span&gt; type;&lt;br /&gt;    [&lt;span style="color:#2b91af"&gt;FieldOffset&lt;/span&gt;(8)]&lt;br /&gt;    &lt;span style="color:blue"&gt;public&lt;/span&gt; &lt;span style="color:#2b91af"&gt;MOUSEINPUT&lt;/span&gt; mi;&lt;br /&gt;    [&lt;span style="color:#2b91af"&gt;FieldOffset&lt;/span&gt;(8)]&lt;br /&gt;    &lt;span style="color:blue"&gt;public&lt;/span&gt; &lt;span style="color:#2b91af"&gt;KEYBDINPUT&lt;/span&gt; ki;&lt;br /&gt;    [&lt;span style="color:#2b91af"&gt;FieldOffset&lt;/span&gt;(8)]&lt;br /&gt;    &lt;span style="color:blue"&gt;public&lt;/span&gt; &lt;span style="color:#2b91af"&gt;HARDWAREINPUT&lt;/span&gt; hi;&lt;br /&gt;}
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;
 &lt;/p&gt;&lt;p&gt;Of course you will need to figure out the pixel offsets for the game board within the game and how to calculate piece locations as well.  Something like the following where the &lt;span style="font-family:Consolas"&gt;gameStart &lt;/span&gt;values are found by using an image editor (the game seems to change every once in a while as they update) and the &lt;span style="font-family:Consolas"&gt;game &lt;/span&gt;locations come from the title screen locating.
&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;pre&gt;&lt;code&gt;&lt;span style="font-family:Consolas"&gt;&lt;span style="color:blue"&gt;var&lt;/span&gt; x1 = i1 * 40 + gameStartX + gameX + 20;&lt;br /&gt;&lt;span style="color:blue"&gt;var&lt;/span&gt; y1 = j1 * 40 + gameStartY + gameY + 20;&lt;br /&gt;&lt;span style="color:blue"&gt;var&lt;/span&gt; x2 = i2 * 40 + gameStartX + gameX + 20;&lt;br /&gt;&lt;span style="color:blue"&gt;var&lt;/span&gt; y2 = j2 * 40 + gameStartY + gameY + 20;&lt;br /&gt;                &lt;br /&gt;&lt;span style="color:#2b91af"&gt;SendInputClass&lt;/span&gt;.Click(x1, y1);&lt;br /&gt;
					&lt;br /&gt;&lt;span style="color:#2b91af"&gt;SendInputClass&lt;/span&gt;.Click(x2, y2);
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;
 &lt;/p&gt;&lt;p&gt;Good luck, and have fun.
&lt;/p&gt;&lt;p&gt;
 &lt;/p&gt;&lt;p&gt;
 &lt;/p&gt;&lt;p&gt;
 &lt;/p&gt;&lt;p&gt;
 &lt;/p&gt;&lt;p&gt;
 &lt;/p&gt;&lt;p&gt;
 &lt;/p&gt;&lt;p&gt;
 &lt;/p&gt;&lt;p&gt;
 &lt;/p&gt;&lt;p&gt;
 &lt;/p&gt;&lt;p&gt;  
 &lt;/p&gt;&lt;img src="http://charlesrcook.com/aggbug/59.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>CCook</dc:creator>
            <guid>http://charlesrcook.com/archive/2010/09/05/creating-a-bejeweled-blitz-bot-in-c.aspx</guid>
            <pubDate>Sun, 05 Sep 2010 19:43:12 GMT</pubDate>
            <wfw:comment>http://charlesrcook.com/comments/59.aspx</wfw:comment>
            <comments>http://charlesrcook.com/archive/2010/09/05/creating-a-bejeweled-blitz-bot-in-c.aspx#feedback</comments>
            <wfw:commentRss>http://charlesrcook.com/comments/commentRss/59.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Undo Within Selected</title>
            <category>Web Programming</category>
            <link>http://charlesrcook.com/archive/2009/06/07/undo-within-selected.aspx</link>
            <description>&lt;p&gt;Today I was working on some code, nothing particularly different than any other day.  I did something I have done thousands of times before, made some changes, and then needed to get previous code back.  This was quickly done with undo several times, copy to clip board, redo several more and then paste.  Then it hit me, why don't we have an undo within selected text?  We have a search and replace within selection.  Undo within selection complements the search and replace really well, and further, allows for quicker retrieval of code several edits ago. Particularly when the change was a single iteration ago in a particular location…  In a sense spatial undo versus temporal undo.
&lt;/p&gt;&lt;p&gt;Hopefully this will make it into Visual Studio some day, either as a power tool or third party plug-in.&lt;/p&gt;&lt;img src="http://charlesrcook.com/aggbug/57.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>CCook</dc:creator>
            <guid>http://charlesrcook.com/archive/2009/06/07/undo-within-selected.aspx</guid>
            <pubDate>Sun, 07 Jun 2009 16:53:05 GMT</pubDate>
            <wfw:comment>http://charlesrcook.com/comments/57.aspx</wfw:comment>
            <comments>http://charlesrcook.com/archive/2009/06/07/undo-within-selected.aspx#feedback</comments>
            <slash:comments>2</slash:comments>
            <wfw:commentRss>http://charlesrcook.com/comments/commentRss/57.aspx</wfw:commentRss>
        </item>
        <item>
            <title>ASP NET MVC Version 1 Released</title>
            <category>Web Programming</category>
            <link>http://charlesrcook.com/archive/2009/03/18/asp-net-mvc-version-1-released.aspx</link>
            <description>&lt;p&gt;Version 1 of ASP.NET MVC has been released, presumably for MIX in Vegas.  It's been a year following the project, and it's exciting to see MVC released after three years of development since March 16&lt;sup&gt;th&lt;/sup&gt; 2007.
&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=53289097-73ce-43bf-b6a6-35e00103cb4b&amp;amp;displaylang=en"&gt;http://www.microsoft.com/downloads/details.aspx?FamilyID=53289097-73ce-43bf-b6a6-35e00103cb4b&amp;amp;displaylang=en&lt;/a&gt;
	&lt;/p&gt;&lt;p&gt;&lt;span style="color:black; font-family:Verdana; font-size:9pt"&gt;&lt;strong&gt;Overview
&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color:black; font-family:Verdana; font-size:8pt"&gt;&lt;a name="Description" /&gt;ASP.NET MVC 1.0 provides a new Model-View-Controller (MVC) framework on top of the existing ASP.NET 3.5 runtime. This means that developers can take advantage of the MVC design patterns to create their Web Applications which includes the ability to achieve and maintain a clear separation of concerns (the UI or view from the business and application logic and backend data), as well as facilitate test driven development (TDD). The ASP.NET MVC framework defines a specific pattern to the Web Application folder structure and provides a controller base-class to handle and process requests for "actions". Developers can take advantage of the specific Visual Studio 2008 MVC templates within this release to create their Web applications, which includes the ability to select a specific Unit Test structure to accompany their Web Application development.&lt;br /&gt;&lt;br /&gt;The MVC framework is fully extensible at all points, allowing developers to create sophisticated structures that meet their needs, including for example Dependency Injection (DI) techniques, new view rendering engines or specialized controllers.&lt;br /&gt;&lt;br /&gt;As the ASP.NET MVC framework is built on ASP.NET 3.5, developers can take advantage of many existing ASP.NET 3.5 features, such as localization, authorization, Profile etc.n
&lt;/span&gt;&lt;/p&gt;&lt;p&gt;
 &lt;/p&gt;&lt;p&gt;
 &lt;/p&gt;&lt;img src="http://charlesrcook.com/aggbug/56.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>CCook</dc:creator>
            <guid>http://charlesrcook.com/archive/2009/03/18/asp-net-mvc-version-1-released.aspx</guid>
            <pubDate>Wed, 18 Mar 2009 13:21:52 GMT</pubDate>
            <wfw:comment>http://charlesrcook.com/comments/56.aspx</wfw:comment>
            <comments>http://charlesrcook.com/archive/2009/03/18/asp-net-mvc-version-1-released.aspx#feedback</comments>
            <slash:comments>1</slash:comments>
            <wfw:commentRss>http://charlesrcook.com/comments/commentRss/56.aspx</wfw:commentRss>
        </item>
        <item>
            <title>SmartPen by LiveScribe</title>
            <link>http://charlesrcook.com/archive/2009/02/13/smartpen-by-livescribe.aspx</link>
            <description>&lt;p&gt;Few gadgets actually change my life.  I have used PDAs in the past, but they were eventually neglected and never replaced.  I have owned a Tablet PC, which ended up being used just like a laptop; so much so, I replaced it with a laptop later.  I finally bought an iPod just this year, but it too it seems is going to be neglected and unused.  The &lt;a href="http://www.livescribe.com/" target="_blank"&gt;SmartPen by LiveScribe&lt;/a&gt; is different.  
&lt;/p&gt;&lt;p&gt;
 &lt;/p&gt;&lt;p&gt;The SmartPen is aptly named, for it can be used just like a pen with additional features.  The features are quite extensive, from the expected digitizing of written material to on paper translation and piano keyboards.  While the later features are more for show, there are several features which have completely changed how I do things at work and school.
&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;strong&gt;Audio Recording&lt;/strong&gt;: The audio is recorded and 'linked' to the written material.  At a latter point the audio linked to the writing can be played by 'double clicking' the content.  Great for reviewing meetings and class notes.
&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Computer Synchronization&lt;/strong&gt;: The content of the pen synchronizes with the computer by USB with a handy magnetically assisted cradle.  The benefit is that the application can search your writing for phrases rather accurately.  This is &lt;strong&gt;invaluable&lt;/strong&gt; when doing open note assignments and tests.  Some other benefits with the program are the ability to export pages as images and share the notes online through their hosted services.  
&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Math&lt;/strong&gt;: The pen does an excellent job at recording notes containing math.  This is an area where the tablet PC seriously struggled.
&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;There are a few nuances as is the case with perhaps every gadget.
&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;strong&gt;Ink&lt;/strong&gt;: I go through an ink cartridge every two and half weeks by just taking notes in courses (15 hours).  The ink is not terribly expensive however.
&lt;/li&gt;&lt;li&gt;Printing Custom Sheets: The program crashes when printing your own 'special' paper.  To work around this I had to manually grab the PostScript files from the app and use an open source PostScript printing application.  This problem was repeatable across other machines.
&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Deleting Pages&lt;/strong&gt;:  This was a surprise… You &lt;strong&gt;can't&lt;/strong&gt; delete pages.  You can delete a whole notebook though… So be careful what you write (Or what others write when testing it thinking they are funny… thanks Sean).
&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Exporting Content&lt;/strong&gt;:  There are two ways to share notes.  One is to 'copy' the page as an image, but of course the audio is lost.  The notes with the audio can be published, but only through the LiveScribe service.  I would like to host the notes myself.
&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;While using the pen, a few ideas have sprung to mind which I would really like to see in the next revision.
&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;strong&gt;Dot Matrix Overlay&lt;/strong&gt;: It would be great to be able to print documents through a LiveScribe service that simultaneously overlaid the print request with the dot matrix, and imported the template into the application.  This way the pen could be used in drafting say reports.  It should be technically feasible as PrimoPDF demonstrates.&lt;/li&gt;&lt;/ul&gt;&lt;img src="http://charlesrcook.com/aggbug/55.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>CCook</dc:creator>
            <guid>http://charlesrcook.com/archive/2009/02/13/smartpen-by-livescribe.aspx</guid>
            <pubDate>Sat, 14 Feb 2009 02:54:40 GMT</pubDate>
            <wfw:comment>http://charlesrcook.com/comments/55.aspx</wfw:comment>
            <comments>http://charlesrcook.com/archive/2009/02/13/smartpen-by-livescribe.aspx#feedback</comments>
            <slash:comments>6</slash:comments>
            <wfw:commentRss>http://charlesrcook.com/comments/commentRss/55.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Unifico Load Tested with and without WCF Remoting </title>
            <category>Web Programming</category>
            <link>http://charlesrcook.com/archive/2009/01/11/unifico-load-tested-with-and-without-wcf-remoting.aspx</link>
            <description>&lt;p&gt;This is rather exciting to me; I just ran a few load tests on Unifico with and without remoting the services with WCF bindings.  I knew the application could remote.  The concern was how efficient.  I created a quick web test that simply goes through the admin, lists the admin lists, performs a filter, edits and saves an item, then logs out.  Roughly every action was hit (eh, it's a spike :)).   I then setup the bindings and ran a load test remotely and locally (remotely being hosted on 127.0.0.1).
&lt;/p&gt;&lt;p&gt;I like to call the operating point at about 75% cpu.  This placed the local run at 282 req/s and the remote run at 214 req/s for a 75% efficiency in serializing all the service requests through WCF.  It's a crude test, but a promising one at that!  (Normally isolated servers are used, and a bunch of effort goes into the scenarios and analysis). The results are listed below, and the code is up on codeplex.
&lt;/p&gt;&lt;p&gt;
 &lt;/p&gt;&lt;h1&gt;Local Run
&lt;/h1&gt;&lt;div&gt;&lt;table style="border-collapse:collapse" border="0"&gt;&lt;colgroup&gt;&lt;col style="width:624px" /&gt;&lt;/colgroup&gt;&lt;tbody valign="top"&gt;&lt;tr&gt;&lt;td valign="middle"&gt;&lt;p style="text-align: center"&gt;&lt;span style="color:#5b5b5b; font-family:Tahoma; font-size:12pt"&gt;&lt;strong&gt;Key Indicators&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td valign="middle"&gt;&lt;p style="text-align: center"&gt;&lt;span style="font-family:Times New Roman; font-size:12pt"&gt;&lt;img src="http://www.charlesrcook.com/images/charlesrcook_com/image1.jpg" /&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td valign="middle"&gt;&lt;table style="border-collapse:collapse" border="0"&gt;&lt;colgroup&gt;&lt;col style="width:161px" /&gt;&lt;col style="width:60px" /&gt;&lt;col style="width:122px" /&gt;&lt;col style="width:67px" /&gt;&lt;col style="width:46px" /&gt;&lt;col style="width:45px" /&gt;&lt;col style="width:49px" /&gt;&lt;col style="width:33px" /&gt;&lt;col style="width:41px" /&gt;&lt;/colgroup&gt;&lt;tbody valign="top"&gt;&lt;tr&gt;&lt;td colspan="9" valign="middle" style="padding-top: 2px; padding-left: 2px; padding-bottom: 2px; padding-right: 2px"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt; &lt;/span&gt; &lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style="background: #f2efe3"&gt;&lt;td valign="middle" style="padding-top: 2px; padding-left: 2px; padding-bottom: 2px; padding-right: 2px"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;Counter&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 2px; padding-left: 2px; padding-bottom: 2px; padding-right: 2px"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;Instance&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 2px; padding-left: 2px; padding-bottom: 2px; padding-right: 2px"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;Category&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 2px; padding-left: 2px; padding-bottom: 2px; padding-right: 2px"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;Computer&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 2px; padding-left: 2px; padding-bottom: 2px; padding-right: 2px"&gt;&lt;p style="text-align: center"&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;Color&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 2px; padding-left: 2px; padding-bottom: 2px; padding-right: 2px"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;Range&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 2px; padding-left: 2px; padding-bottom: 2px; padding-right: 2px"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;Min&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 2px; padding-left: 2px; padding-bottom: 2px; padding-right: 2px"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;Max&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 2px; padding-left: 2px; padding-bottom: 2px; padding-right: 2px"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;Avg&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;User Load&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;_Total&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;LoadTest:Scenario&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;XPS720&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt; &lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;1,000&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;10&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;630&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;315&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;Requests/Sec&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;_Total&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;LoadTest:Request&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;XPS720&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt; &lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;1,000&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;0&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;411&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;231&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;Avg. Response Time&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;_Total&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;LoadTest:Request&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;XPS720&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt; &lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;10&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;0.0053&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;1.07&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;0.18&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;Errors/Sec&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;_Total&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;LoadTest:Errors&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;XPS720&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt; &lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;0&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;0&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;0&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;0&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;Threshold Violations/Sec&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;_Total&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;LoadTest:Errors&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;XPS720&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt; &lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;1&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;0&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;0.20&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;0.070&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;p&gt;
 &lt;/p&gt;&lt;div&gt;&lt;table style="border-collapse:collapse" border="0"&gt;&lt;colgroup&gt;&lt;col style="width:624px" /&gt;&lt;/colgroup&gt;&lt;tbody valign="top"&gt;&lt;tr&gt;&lt;td valign="middle"&gt;&lt;p style="text-align: center"&gt;&lt;span style="color:#5b5b5b; font-family:Tahoma; font-size:12pt"&gt;&lt;strong&gt;Controller and Agents&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td valign="middle"&gt;&lt;p style="text-align: center"&gt;&lt;span style="font-family:Times New Roman; font-size:12pt"&gt;&lt;img src="http://www.charlesrcook.com/images/charlesrcook_com/image2.jpg" /&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td valign="middle"&gt;&lt;table style="border-collapse:collapse" border="0"&gt;&lt;colgroup&gt;&lt;col style="width:149px" /&gt;&lt;col style="width:74px" /&gt;&lt;col style="width:82px" /&gt;&lt;col style="width:83px" /&gt;&lt;col style="width:57px" /&gt;&lt;col style="width:56px" /&gt;&lt;col style="width:41px" /&gt;&lt;col style="width:41px" /&gt;&lt;col style="width:41px" /&gt;&lt;/colgroup&gt;&lt;tbody valign="top"&gt;&lt;tr&gt;&lt;td colspan="9" valign="middle" style="padding-top: 2px; padding-left: 2px; padding-bottom: 2px; padding-right: 2px"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt; &lt;/span&gt; &lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style="background: #f2efe3"&gt;&lt;td valign="middle" style="padding-top: 2px; padding-left: 2px; padding-bottom: 2px; padding-right: 2px"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;Counter&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 2px; padding-left: 2px; padding-bottom: 2px; padding-right: 2px"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;Instance&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 2px; padding-left: 2px; padding-bottom: 2px; padding-right: 2px"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;Category&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 2px; padding-left: 2px; padding-bottom: 2px; padding-right: 2px"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;Computer&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 2px; padding-left: 2px; padding-bottom: 2px; padding-right: 2px"&gt;&lt;p style="text-align: center"&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;Color&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 2px; padding-left: 2px; padding-bottom: 2px; padding-right: 2px"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;Range&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 2px; padding-left: 2px; padding-bottom: 2px; padding-right: 2px"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;Min&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 2px; padding-left: 2px; padding-bottom: 2px; padding-right: 2px"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;Max&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 2px; padding-left: 2px; padding-bottom: 2px; padding-right: 2px"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;Avg&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;% Processor Time&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;_Total&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;Processor&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;XPS720&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt; &lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;100&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;4.85&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;99.9&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;63.8&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;Available MBytes&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;-&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;Memory&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;XPS720&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt; &lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;1,000&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;829&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;908&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;863&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;p&gt;
 &lt;/p&gt;&lt;p&gt;
 &lt;/p&gt;&lt;h1&gt;Remote Run
&lt;/h1&gt;&lt;p&gt;
 &lt;/p&gt;&lt;div&gt;&lt;table style="border-collapse:collapse" border="0"&gt;&lt;colgroup&gt;&lt;col style="width:624px" /&gt;&lt;/colgroup&gt;&lt;tbody valign="top"&gt;&lt;tr&gt;&lt;td valign="middle"&gt;&lt;p style="text-align: center"&gt;&lt;span style="color:#5b5b5b; font-family:Tahoma; font-size:12pt"&gt;&lt;strong&gt;Key Indicators&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td valign="middle"&gt;&lt;p style="text-align: center"&gt;&lt;span style="font-family:Times New Roman; font-size:12pt"&gt;&lt;img src="http://www.charlesrcook.com/images/charlesrcook_com/image3.jpg" /&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td valign="middle"&gt;&lt;table style="border-collapse:collapse" border="0"&gt;&lt;colgroup&gt;&lt;col style="width:161px" /&gt;&lt;col style="width:60px" /&gt;&lt;col style="width:122px" /&gt;&lt;col style="width:67px" /&gt;&lt;col style="width:46px" /&gt;&lt;col style="width:45px" /&gt;&lt;col style="width:49px" /&gt;&lt;col style="width:33px" /&gt;&lt;col style="width:41px" /&gt;&lt;/colgroup&gt;&lt;tbody valign="top"&gt;&lt;tr&gt;&lt;td colspan="9" valign="middle" style="padding-top: 2px; padding-left: 2px; padding-bottom: 2px; padding-right: 2px"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt; &lt;/span&gt; &lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style="background: #f2efe3"&gt;&lt;td valign="middle" style="padding-top: 2px; padding-left: 2px; padding-bottom: 2px; padding-right: 2px"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;Counter&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 2px; padding-left: 2px; padding-bottom: 2px; padding-right: 2px"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;Instance&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 2px; padding-left: 2px; padding-bottom: 2px; padding-right: 2px"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;Category&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 2px; padding-left: 2px; padding-bottom: 2px; padding-right: 2px"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;Computer&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 2px; padding-left: 2px; padding-bottom: 2px; padding-right: 2px"&gt;&lt;p style="text-align: center"&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;Color&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 2px; padding-left: 2px; padding-bottom: 2px; padding-right: 2px"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;Range&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 2px; padding-left: 2px; padding-bottom: 2px; padding-right: 2px"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;Min&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 2px; padding-left: 2px; padding-bottom: 2px; padding-right: 2px"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;Max&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 2px; padding-left: 2px; padding-bottom: 2px; padding-right: 2px"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;Avg&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;User Load&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;_Total&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;LoadTest:Scenario&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;XPS720&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt; &lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;1,000&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;10&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;410&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;210&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;Requests/Sec&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;_Total&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;LoadTest:Request&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;XPS720&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt; &lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;1,000&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;8.00&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;286&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;164&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;Avg. Response Time&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;_Total&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;LoadTest:Request&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;XPS720&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt; &lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;1&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;0.0086&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;0.38&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;0.094&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;Errors/Sec&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;_Total&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;LoadTest:Errors&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;XPS720&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt; &lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;0&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;0&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;0&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;0&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;Threshold Violations/Sec&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;_Total&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;LoadTest:Errors&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;XPS720&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt; &lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;1&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;0&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;0.20&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;0.058&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;p&gt;
 &lt;/p&gt;&lt;p&gt;
 &lt;/p&gt;&lt;div&gt;&lt;table style="border-collapse:collapse" border="0"&gt;&lt;colgroup&gt;&lt;col style="width:624px" /&gt;&lt;/colgroup&gt;&lt;tbody valign="top"&gt;&lt;tr&gt;&lt;td valign="middle"&gt;&lt;p style="text-align: center"&gt;&lt;span style="color:#5b5b5b; font-family:Tahoma; font-size:12pt"&gt;&lt;strong&gt;Controller and Agents&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td valign="middle"&gt;&lt;p style="text-align: center"&gt;&lt;span style="font-family:Times New Roman; font-size:12pt"&gt;&lt;img src="http://www.charlesrcook.com/images/charlesrcook_com/image4.jpg" /&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td valign="middle"&gt;&lt;table style="border-collapse:collapse" border="0"&gt;&lt;colgroup&gt;&lt;col style="width:146px" /&gt;&lt;col style="width:72px" /&gt;&lt;col style="width:80px" /&gt;&lt;col style="width:81px" /&gt;&lt;col style="width:55px" /&gt;&lt;col style="width:59px" /&gt;&lt;col style="width:40px" /&gt;&lt;col style="width:50px" /&gt;&lt;col style="width:40px" /&gt;&lt;/colgroup&gt;&lt;tbody valign="top"&gt;&lt;tr&gt;&lt;td colspan="9" valign="middle" style="padding-top: 2px; padding-left: 2px; padding-bottom: 2px; padding-right: 2px"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt; &lt;/span&gt; &lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style="background: #f2efe3"&gt;&lt;td valign="middle" style="padding-top: 2px; padding-left: 2px; padding-bottom: 2px; padding-right: 2px"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;Counter&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 2px; padding-left: 2px; padding-bottom: 2px; padding-right: 2px"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;Instance&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 2px; padding-left: 2px; padding-bottom: 2px; padding-right: 2px"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;Category&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 2px; padding-left: 2px; padding-bottom: 2px; padding-right: 2px"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;Computer&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 2px; padding-left: 2px; padding-bottom: 2px; padding-right: 2px"&gt;&lt;p style="text-align: center"&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;Color&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 2px; padding-left: 2px; padding-bottom: 2px; padding-right: 2px"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;Range&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 2px; padding-left: 2px; padding-bottom: 2px; padding-right: 2px"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;Min&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 2px; padding-left: 2px; padding-bottom: 2px; padding-right: 2px"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;Max&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 2px; padding-left: 2px; padding-bottom: 2px; padding-right: 2px"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;Avg&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;% Processor Time&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;_Total&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;Processor&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;XPS720&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt; &lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;100&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;5.65&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;98.1&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;59.2&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;Available MBytes&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;-&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;Memory&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;XPS720&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt; &lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;10,000&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;936&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;1,036&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="middle" style="padding-top: 1px; padding-left: 2px; padding-bottom: 1px; padding-right: 2px; border-bottom:  solid #f2efe3 0.75pt"&gt;&lt;p&gt;&lt;span style="font-family:Tahoma; font-size:8pt"&gt;988&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;p&gt;
 &lt;/p&gt;&lt;p&gt;
 &lt;/p&gt;&lt;img src="http://charlesrcook.com/aggbug/54.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>CCook</dc:creator>
            <guid>http://charlesrcook.com/archive/2009/01/11/unifico-load-tested-with-and-without-wcf-remoting.aspx</guid>
            <pubDate>Sun, 11 Jan 2009 06:32:37 GMT</pubDate>
            <wfw:comment>http://charlesrcook.com/comments/54.aspx</wfw:comment>
            <comments>http://charlesrcook.com/archive/2009/01/11/unifico-load-tested-with-and-without-wcf-remoting.aspx#feedback</comments>
            <slash:comments>1</slash:comments>
            <wfw:commentRss>http://charlesrcook.com/comments/commentRss/54.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Using a Recursive Expression to Create an Html Menu</title>
            <category>Web Programming</category>
            <link>http://charlesrcook.com/archive/2009/01/08/using-a-recursive-expression-to-create-an-html-menu.aspx</link>
            <description>&lt;p&gt;I find recursive expression to be really useful.  They are particularly handy when dealing with parent child relationships.  As a demonstration, see a potential method for generating a site map below:&lt;/p&gt;




&lt;div style="font-family: Courier New; font-size: 10pt; color: black; background: white;"&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;    1&lt;/span&gt; &lt;span style="color: blue;"&gt;using&lt;/span&gt; System;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;    2&lt;/span&gt; &lt;span style="color: blue;"&gt;using&lt;/span&gt; System.Collections.Generic;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;    3&lt;/span&gt; &lt;span style="color: blue;"&gt;using&lt;/span&gt; System.Linq;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;    4&lt;/span&gt; &lt;span style="color: blue;"&gt;using&lt;/span&gt; System.Text;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;    5&lt;/span&gt; &lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;    6&lt;/span&gt; &lt;span style="color: blue;"&gt;namespace&lt;/span&gt; SiteMapDemo&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;    7&lt;/span&gt; {&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;    8&lt;/span&gt;     &lt;span style="color: blue;"&gt;class&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;MenuItem&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;    9&lt;/span&gt;     {&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;   10&lt;/span&gt;         &lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;Guid&lt;/span&gt; ID { &lt;span style="color: blue;"&gt;get&lt;/span&gt;; &lt;span style="color: blue;"&gt;set&lt;/span&gt;; }&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;   11&lt;/span&gt;         &lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;Guid&lt;/span&gt;? ParentID { &lt;span style="color: blue;"&gt;get&lt;/span&gt;; &lt;span style="color: blue;"&gt;set&lt;/span&gt;; }&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;   12&lt;/span&gt;         &lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;string&lt;/span&gt; Name { &lt;span style="color: blue;"&gt;get&lt;/span&gt;; &lt;span style="color: blue;"&gt;set&lt;/span&gt;; }&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;   13&lt;/span&gt;         &lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;string&lt;/span&gt; Path { &lt;span style="color: blue;"&gt;get&lt;/span&gt;; &lt;span style="color: blue;"&gt;set&lt;/span&gt;; }&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;   14&lt;/span&gt;         &lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;int&lt;/span&gt; Rank { &lt;span style="color: blue;"&gt;get&lt;/span&gt;; &lt;span style="color: blue;"&gt;set&lt;/span&gt;; }&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;   15&lt;/span&gt;     }&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;   16&lt;/span&gt;     &lt;span style="color: blue;"&gt;class&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;Program&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;   17&lt;/span&gt;     {&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;   18&lt;/span&gt;         &lt;span style="color: blue;"&gt;static&lt;/span&gt; &lt;span style="color: blue;"&gt;void&lt;/span&gt; Main(&lt;span style="color: blue;"&gt;string&lt;/span&gt;[] args)&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;   19&lt;/span&gt;         {&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;   20&lt;/span&gt;             &lt;span style="color: #2b91af;"&gt;List&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af;"&gt;MenuItem&lt;/span&gt;&amp;gt; menu = &lt;span style="color: blue;"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;List&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af;"&gt;MenuItem&lt;/span&gt;&amp;gt;(&lt;span style="color: blue;"&gt;new&lt;/span&gt;[]{&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;   21&lt;/span&gt;                 &lt;span style="color: blue;"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;MenuItem&lt;/span&gt;{ID = &lt;span style="color: #2b91af;"&gt;Guid&lt;/span&gt;.NewGuid(), Name = &lt;span style="color: #a31515;"&gt;"First"&lt;/span&gt;, ParentID=&lt;span style="color: blue;"&gt;null&lt;/span&gt;, Path=&lt;span style="color: #a31515;"&gt;"/"&lt;/span&gt;, Rank=0},&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;   22&lt;/span&gt;                 &lt;span style="color: blue;"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;MenuItem&lt;/span&gt;{ID = &lt;span style="color: #2b91af;"&gt;Guid&lt;/span&gt;.NewGuid(), Name = &lt;span style="color: #a31515;"&gt;"Second"&lt;/span&gt;, ParentID=&lt;span style="color: blue;"&gt;null&lt;/span&gt;, Path=&lt;span style="color: #a31515;"&gt;"/second.aspx"&lt;/span&gt;,Rank=1},&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;   23&lt;/span&gt;             });&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;   24&lt;/span&gt;             menu.AddRange(&lt;span style="color: blue;"&gt;new&lt;/span&gt;[] { &lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;   25&lt;/span&gt;                 &lt;span style="color: blue;"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;MenuItem&lt;/span&gt;{ID = &lt;span style="color: #2b91af;"&gt;Guid&lt;/span&gt;.NewGuid(), Name = &lt;span style="color: #a31515;"&gt;"FirstSub"&lt;/span&gt;, ParentID=menu[0].ID, Path=&lt;span style="color: #a31515;"&gt;"/firstsub.aspx"&lt;/span&gt;,Rank=0},&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;   26&lt;/span&gt;                 &lt;span style="color: blue;"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;MenuItem&lt;/span&gt;{ID = &lt;span style="color: #2b91af;"&gt;Guid&lt;/span&gt;.NewGuid(), Name = &lt;span style="color: #a31515;"&gt;"SecondSub"&lt;/span&gt;, ParentID=menu[0].ID, Path=&lt;span style="color: #a31515;"&gt;"/secondsub.aspx"&lt;/span&gt;,Rank=1},&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;   27&lt;/span&gt;                 });&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;   28&lt;/span&gt;             &lt;span style="color: #2b91af;"&gt;Func&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af;"&gt;List&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af;"&gt;MenuItem&lt;/span&gt;&amp;gt;, &lt;span style="color: #2b91af;"&gt;Guid&lt;/span&gt;?, &lt;span style="color: blue;"&gt;string&lt;/span&gt;&amp;gt; renderMenu = &lt;span style="color: blue;"&gt;null&lt;/span&gt;;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;   29&lt;/span&gt;             renderMenu = (menus, Parent) =&amp;gt;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;   30&lt;/span&gt;             {&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;   31&lt;/span&gt;                 &lt;span style="color: blue;"&gt;var&lt;/span&gt; sub = menus.Where(m =&amp;gt; m.ParentID == Parent).OrderBy(s =&amp;gt; s.Rank).ToList();&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;   32&lt;/span&gt;                 &lt;span style="color: blue;"&gt;if&lt;/span&gt; (sub.Count &amp;gt; 0)&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;   33&lt;/span&gt;                 {&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;   34&lt;/span&gt;                     &lt;span style="color: #2b91af;"&gt;StringBuilder&lt;/span&gt; sb = &lt;span style="color: blue;"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;StringBuilder&lt;/span&gt;();&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;   35&lt;/span&gt;                     sub.ForEach(s =&amp;gt; { sb.Append(&lt;span style="color: #2b91af;"&gt;String&lt;/span&gt;.Format(&lt;span style="color: #a31515;"&gt;"&amp;lt;li&amp;gt;&amp;lt;a href=\"{0}\"&amp;gt;{1}&amp;lt;/a&amp;gt;{2}&amp;lt;/li&amp;gt;"&lt;/span&gt;, s.Path, s.Name, renderMenu(menus, s.ID))); });&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;   36&lt;/span&gt;                     &lt;span style="color: blue;"&gt;return&lt;/span&gt; sb.ToString();&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;   37&lt;/span&gt;                 }&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;   38&lt;/span&gt;                 &lt;span style="color: blue;"&gt;return&lt;/span&gt; &lt;span style="color: #a31515;"&gt;""&lt;/span&gt;;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;   39&lt;/span&gt;             };&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;   40&lt;/span&gt;             &lt;span style="color: #2b91af;"&gt;Console&lt;/span&gt;.Write(renderMenu(menu, &lt;span style="color: blue;"&gt;null&lt;/span&gt;));&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;   41&lt;/span&gt;             &lt;span style="color: #2b91af;"&gt;Console&lt;/span&gt;.ReadLine();&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;   42&lt;/span&gt;         }&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;   43&lt;/span&gt;     }&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;   44&lt;/span&gt; }&lt;/p&gt;
&lt;/div&gt;



&lt;p&gt;The output:&lt;/p&gt;

&lt;p&gt;
&amp;lt;li&amp;gt;&amp;lt;a href="http://www.charlesrcook.com/"&amp;gt;First&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;&amp;lt;a href="http://www.charlesrcook.com/firstsub.aspx"&amp;gt;FirstSub&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;&amp;lt;a href="/secondsub.aspx"&amp;gt;SecondSub&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;&amp;lt;a href="http://www.charlesrcook.com/second.aspx"&amp;gt;Second&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;
&lt;/p&gt;

&lt;img src="http://charlesrcook.com/aggbug/53.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>CCook</dc:creator>
            <guid>http://charlesrcook.com/archive/2009/01/08/using-a-recursive-expression-to-create-an-html-menu.aspx</guid>
            <pubDate>Fri, 09 Jan 2009 00:40:15 GMT</pubDate>
            <wfw:comment>http://charlesrcook.com/comments/53.aspx</wfw:comment>
            <comments>http://charlesrcook.com/archive/2009/01/08/using-a-recursive-expression-to-create-an-html-menu.aspx#feedback</comments>
            <slash:comments>1</slash:comments>
            <wfw:commentRss>http://charlesrcook.com/comments/commentRss/53.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Paging with Filters and Sorts added to Unifico</title>
            <category>Web Programming</category>
            <link>http://charlesrcook.com/archive/2009/01/04/paging-with-filters-and-sorts-added-to-unifico.aspx</link>
            <description>&lt;p&gt;Two new additions were added to Unifico: filtering on fields and sorting on fields with the help of Html Extension methods.  
&lt;/p&gt;&lt;p&gt;A PagingSet class was defined to contain configuration options for the paging.  In this way a View can still page on more than one list and maintain complete control over the Html rendered.  Every string used in the Html Helpers is pulled from the configuration (A default is made available).
&lt;/p&gt;&lt;p&gt;Several extension methods were added to the Html Helper to make rendering the controls easier.  
&lt;/p&gt;&lt;p&gt;The filtering html form can be rendered with &lt;span style="font-family:Courier New; font-size:10pt"&gt;&lt;span style="background-color:yellow"&gt;&amp;lt;%&lt;/span&gt;&lt;span style="color:blue"&gt;=&lt;/span&gt; Html.FilterInput(Paging, &lt;span style="color:#a31515"&gt;"Go"&lt;/span&gt;) &lt;span style="background-color:yellow"&gt;%&amp;gt;&lt;/span&gt;
		&lt;/span&gt;Where "go" is the button text.
&lt;/p&gt;&lt;p&gt;A sortable column header can be rendered with &lt;span style="font-family:Courier New; font-size:10pt"&gt;&lt;span style="background-color:yellow"&gt;&amp;lt;%&lt;/span&gt;&lt;span style="color:blue"&gt;=&lt;/span&gt; Html.PageSorting(Paging, &lt;span style="color:#a31515"&gt;"Email"&lt;/span&gt;,&lt;span style="color:#a31515"&gt;"E-Mail"&lt;/span&gt;)&lt;span style="background-color:yellow"&gt;%&amp;gt;&lt;/span&gt;&lt;/span&gt;
	&lt;/p&gt;&lt;p&gt;Where the paging configuration has been passed from the controller, leaving the paging control completely in the hands of the controller:
&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New; font-size:10pt"&gt;
			&lt;span style="background-color:yellow"&gt;&amp;lt;%&lt;/span&gt;
			&lt;span style="color:#2b91af"&gt;PageResponse&lt;/span&gt;&amp;lt;&lt;span style="color:#2b91af"&gt;User&lt;/span&gt;&amp;gt; Users = (&lt;span style="color:#2b91af"&gt;PageResponse&lt;/span&gt;&amp;lt;&lt;span style="color:#2b91af"&gt;User&lt;/span&gt;&amp;gt;)ViewData.Model;
&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New; font-size:10pt"&gt;
			&lt;span style="color:#2b91af"&gt;PagingSet&lt;/span&gt; Paging = (&lt;span style="color:#2b91af"&gt;PagingSet&lt;/span&gt;)ViewData[&lt;span style="color:#a31515"&gt;"PagingSet"&lt;/span&gt;];
&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New; font-size:10pt"&gt;
			&lt;span style="background-color:yellow"&gt;%&amp;gt;&lt;/span&gt;&lt;/span&gt;
	&lt;/p&gt;&lt;p&gt;View the complete "View" here, &lt;a href="http://www.codeplex.com/unifico/SourceControl/changeset/view/1798#54414"&gt;http://www.codeplex.com/unifico/SourceControl/changeset/view/1798#54414&lt;/a&gt;
	&lt;/p&gt;&lt;p&gt;View the complete Controller here, &lt;a href="http://www.codeplex.com/unifico/SourceControl/changeset/view/1798#44699"&gt;http://www.codeplex.com/unifico/SourceControl/changeset/view/1798#44699&lt;/a&gt;
	&lt;/p&gt;&lt;p&gt;The end result of all this is paging that executes through the PageRequest class, so that no changes are required of the Service and paging that executes in SQL.  It also has the nice benefit of residing completely in the QueryString and not requiring changes to the Controller's Action's parameters. 
&lt;/p&gt;&lt;p&gt;An example path created from paging with sorting and filtering: /Admin/Account/Users?expr=asdf9&amp;amp;filterby=All&amp;amp;orderby=Name&amp;amp;asc=False&amp;amp;page=1
&lt;/p&gt;&lt;p&gt;And the SQL it generates.
&lt;/p&gt;&lt;p&gt;exec sp_executesql N'SELECT TOP (10) [t0].[UserID] AS [ID], [t0].[Name], [t0].[Password], [t0].[Email]&lt;br /&gt;FROM [dbo].[User] AS [t0]&lt;br /&gt;WHERE ([t0].[Name] = @p0) OR ([t0].[Name] = @p1)&lt;br /&gt;ORDER BY [t0].[Name] DESC',N'@p0 nvarchar(5),@p1 nvarchar(5)',@p0=N'asdf9',@p1=N'asdf9'&lt;/p&gt;&lt;img src="http://charlesrcook.com/aggbug/52.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>CCook</dc:creator>
            <guid>http://charlesrcook.com/archive/2009/01/04/paging-with-filters-and-sorts-added-to-unifico.aspx</guid>
            <pubDate>Sun, 04 Jan 2009 23:25:58 GMT</pubDate>
            <wfw:comment>http://charlesrcook.com/comments/52.aspx</wfw:comment>
            <comments>http://charlesrcook.com/archive/2009/01/04/paging-with-filters-and-sorts-added-to-unifico.aspx#feedback</comments>
            <slash:comments>5</slash:comments>
            <wfw:commentRss>http://charlesrcook.com/comments/commentRss/52.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Unifico’s Account Component Gets an Admin</title>
            <category>Web Programming</category>
            <link>http://charlesrcook.com/archive/2009/01/03/unificos-account-component-gets-an-admin.aspx</link>
            <description>&lt;p&gt;The Account Component in the Unifico Framework which is serving as a sample component now has an admin.  Two supporting developments for the admin are also up: the paging HtmlHelper and &lt;span style="color:black; font-family:Arial; font-size:10pt"&gt;overridable&lt;/span&gt; embedded views.  Allowing for the embedded views to be overridden by placing new views in App.Web greatly eases development and should help in Component maintenance and versioning (new views can be made without rebuilding the component).  I am also rather happy with the eas to which views are made &lt;span style="color:black; font-family:Arial; font-size:10pt"&gt;overridable&lt;/span&gt;.
&lt;/p&gt;&lt;p&gt;The paging turned out quite well, a few changes to the PageResponse&amp;lt;T&amp;gt; to implement IPageable made things fit really nicely.  For example if PageResponse&amp;lt;User&amp;gt; is passed to the view from the controller, the paging can be generated with default settings in the snippet below.  I also made use of my &lt;a href="http://www.charlesrcook.com/archive/2008/07/23/c-extension-methods-for-asp.net-query-string-operations.aspx"&gt;QueryString extension methods&lt;/a&gt; to make it work with populated QueryStrings (and have support for many pagers).
&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New; font-size:10pt"&gt;&lt;span style="background-color:yellow"&gt;&amp;lt;%&lt;/span&gt;&lt;span style="color:blue"&gt;=&lt;/span&gt; Html.PageListing(Users) &lt;span style="background-color:yellow"&gt;%&amp;gt;&lt;/span&gt;
		&lt;/span&gt;&lt;/p&gt;&lt;p&gt;
 &lt;/p&gt;&lt;p&gt;&lt;a href="http://www.codeplex.com/unifico"&gt;http://www.codeplex.com/unifico&lt;/a&gt;
	&lt;/p&gt;&lt;img src="http://charlesrcook.com/aggbug/51.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>CCook</dc:creator>
            <guid>http://charlesrcook.com/archive/2009/01/03/unificos-account-component-gets-an-admin.aspx</guid>
            <pubDate>Sun, 04 Jan 2009 03:45:07 GMT</pubDate>
            <wfw:comment>http://charlesrcook.com/comments/51.aspx</wfw:comment>
            <comments>http://charlesrcook.com/archive/2009/01/03/unificos-account-component-gets-an-admin.aspx#feedback</comments>
            <slash:comments>1</slash:comments>
            <wfw:commentRss>http://charlesrcook.com/comments/commentRss/51.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Allowing for Dynamic Embedded View Substitution with MVC</title>
            <category>Web Programming</category>
            <link>http://charlesrcook.com/archive/2009/01/02/allowing-for-dynamic-embedded-view-substitution-with-mvc.aspx</link>
            <description>&lt;p&gt;A while back I found an interesting post on embedding resources in MVC at "The Glass is Too Big" (&lt;a href="http://www.wynia.org/wordpress/2008/12/05/aspnet-mvc-plugins/"&gt;http://www.wynia.org/wordpress/2008/12/05/aspnet-mvc-plugins/&lt;/a&gt;).  Following the method was straightforward and allowed views to be embedded within a Component Class Library.  Well, two extra items would be nice.  It would be nice to not have to write that large plug-in path, and if a view was defined in the views folder it would be returned in lieu of the embedded view.  
&lt;/p&gt;&lt;p&gt;Adding this support required two modifications.  First the AssemblyResourceProvider was modified to check for the view's existence by adding a Regex pattern match and checking for the file.  If the file is found within the view folder, the file is returned, if not the embedded resource will return.
&lt;/p&gt;&lt;p&gt;
 &lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="font-family:Courier New; font-size:10pt"&gt;&lt;span style="color:#2b91af"&gt;   58&lt;/span&gt;&lt;span style="color:black"&gt;             &lt;/span&gt;&lt;span style="color:green"&gt;// Check to see if a file has been added to the views folder.  If so, return that view.&lt;/span&gt;&lt;span style="color:black"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="font-family:Courier New; font-size:10pt"&gt;&lt;span style="color:#2b91af"&gt;   59&lt;/span&gt;&lt;span style="color:black"&gt;             &lt;/span&gt;&lt;span style="color:#2b91af"&gt;Match&lt;/span&gt;&lt;span style="color:black"&gt; m = &lt;/span&gt;&lt;span style="color:#2b91af"&gt;Regex&lt;/span&gt;&lt;span style="color:black"&gt;.Match(path, &lt;/span&gt;&lt;span style="color:#a31515"&gt;@"~/Plugin/[\w\.]+.dll/([\w\.]+).Views.([\w\.]+).aspx"&lt;/span&gt;&lt;span style="color:black"&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="font-family:Courier New; font-size:10pt"&gt;&lt;span style="color:#2b91af"&gt;   60&lt;/span&gt;&lt;span style="color:black"&gt;             &lt;/span&gt;&lt;span style="color:blue"&gt;if&lt;/span&gt;&lt;span style="color:black"&gt; (m.Success)
&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="font-family:Courier New; font-size:10pt"&gt;&lt;span style="color:#2b91af"&gt;   61&lt;/span&gt;&lt;span style="color:black"&gt;             {
&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="font-family:Courier New; font-size:10pt"&gt;&lt;span style="color:#2b91af"&gt;   62&lt;/span&gt;&lt;span style="color:black"&gt;                 &lt;/span&gt;&lt;span style="color:blue"&gt;string&lt;/span&gt;&lt;span style="color:black"&gt; assemblyMatch = m.Groups[1].Value;
&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="font-family:Courier New; font-size:10pt"&gt;&lt;span style="color:#2b91af"&gt;   63&lt;/span&gt;&lt;span style="color:black"&gt;                 &lt;/span&gt;&lt;span style="color:blue"&gt;string&lt;/span&gt;&lt;span style="color:black"&gt; viewPath = m.Groups[2].Value;
&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="font-family:Courier New; font-size:10pt"&gt;&lt;span style="color:#2b91af"&gt;   64&lt;/span&gt;&lt;span style="color:black"&gt;                 &lt;/span&gt;&lt;span style="color:blue"&gt;string&lt;/span&gt;&lt;span style="color:black"&gt; physicalPath = &lt;/span&gt;&lt;span style="color:#2b91af"&gt;HttpContext&lt;/span&gt;&lt;span style="color:black"&gt;.Current.Server.MapPath(&lt;/span&gt;&lt;span style="color:#2b91af"&gt;String&lt;/span&gt;&lt;span style="color:black"&gt;.Format(&lt;/span&gt;&lt;span style="color:#a31515"&gt;"~/Views/{0}/{1}.aspx"&lt;/span&gt;&lt;span style="color:black"&gt;,
&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="font-family:Courier New; font-size:10pt"&gt;&lt;span style="color:#2b91af"&gt;   65&lt;/span&gt;&lt;span style="color:black"&gt;                     assemblyMatch, viewPath.Replace(&lt;/span&gt;&lt;span style="color:#a31515"&gt;"."&lt;/span&gt;&lt;span style="color:black"&gt;, &lt;/span&gt;&lt;span style="color:#a31515"&gt;"/"&lt;/span&gt;&lt;span style="color:black"&gt;)));
&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="font-family:Courier New; font-size:10pt"&gt;&lt;span style="color:#2b91af"&gt;   66&lt;/span&gt;&lt;span style="color:black"&gt;                 &lt;/span&gt;&lt;span style="color:blue"&gt;if&lt;/span&gt;&lt;span style="color:black"&gt; (&lt;/span&gt;&lt;span style="color:#2b91af"&gt;File&lt;/span&gt;&lt;span style="color:black"&gt;.Exists(physicalPath))
&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="font-family:Courier New; font-size:10pt"&gt;&lt;span style="color:#2b91af"&gt;   67&lt;/span&gt;&lt;span style="color:black"&gt;                     &lt;/span&gt;&lt;span style="color:blue"&gt;return&lt;/span&gt;&lt;span style="color:black"&gt;
			&lt;/span&gt;&lt;span style="color:#2b91af"&gt;File&lt;/span&gt;&lt;span style="color:black"&gt;.Open(physicalPath,&lt;/span&gt;&lt;span style="color:#2b91af"&gt;FileMode&lt;/span&gt;&lt;span style="color:black"&gt;.Open);
&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="font-family:Courier New; font-size:10pt"&gt;&lt;span style="color:#2b91af"&gt;   68&lt;/span&gt;&lt;span style="color:black"&gt;             }
&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.codeplex.com/unifico/SourceControl/changeset/view/1491#9855"&gt;http://www.codeplex.com/unifico/SourceControl/changeset/view/1491#9855&lt;/a&gt;
	&lt;/p&gt;&lt;p&gt;
 &lt;/p&gt;&lt;p&gt;To avoid having to write out the plug-in strings I wrote an extension method to write it and return the ViewResult.  Reflection is used to gather the assembly name.
&lt;/p&gt;&lt;p&gt;
 &lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="font-family:Courier New; font-size:10pt"&gt;&lt;span style="color:#2b91af"&gt;    9&lt;/span&gt;&lt;span style="color:black"&gt;     &lt;/span&gt;&lt;span style="color:blue"&gt;public&lt;/span&gt;&lt;span style="color:black"&gt;
			&lt;/span&gt;&lt;span style="color:blue"&gt;static&lt;/span&gt;&lt;span style="color:black"&gt;
			&lt;/span&gt;&lt;span style="color:blue"&gt;class&lt;/span&gt;&lt;span style="color:black"&gt;
			&lt;/span&gt;&lt;span style="color:#2b91af"&gt;ControllerPluginPathExtender&lt;/span&gt;&lt;span style="color:black"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="font-family:Courier New; font-size:10pt"&gt;&lt;span style="color:#2b91af"&gt;   10&lt;/span&gt;&lt;span style="color:black"&gt;     {
&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="font-family:Courier New; font-size:10pt"&gt;&lt;span style="color:#2b91af"&gt;   11&lt;/span&gt;&lt;span style="color:black"&gt;         &lt;/span&gt;&lt;span style="color:blue"&gt;public&lt;/span&gt;&lt;span style="color:black"&gt;
			&lt;/span&gt;&lt;span style="color:blue"&gt;static&lt;/span&gt;&lt;span style="color:black"&gt;
			&lt;/span&gt;&lt;span style="color:#2b91af"&gt;ViewResult&lt;/span&gt;&lt;span style="color:black"&gt; PluginView(&lt;/span&gt;&lt;span style="color:blue"&gt;this&lt;/span&gt;&lt;span style="color:black"&gt;
			&lt;/span&gt;&lt;span style="color:#2b91af"&gt;Controller&lt;/span&gt;&lt;span style="color:black"&gt; controller)
&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="font-family:Courier New; font-size:10pt"&gt;&lt;span style="color:#2b91af"&gt;   12&lt;/span&gt;&lt;span style="color:black"&gt;         {
&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="font-family:Courier New; font-size:10pt"&gt;&lt;span style="color:#2b91af"&gt;   13&lt;/span&gt;&lt;span style="color:black"&gt;             &lt;/span&gt;&lt;span style="color:blue"&gt;string&lt;/span&gt;&lt;span style="color:black"&gt; controllerName = controller.RouteData.GetRequiredString(&lt;/span&gt;&lt;span style="color:#a31515"&gt;"controller"&lt;/span&gt;&lt;span style="color:black"&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="font-family:Courier New; font-size:10pt"&gt;&lt;span style="color:#2b91af"&gt;   14&lt;/span&gt;&lt;span style="color:black"&gt;             &lt;/span&gt;&lt;span style="color:blue"&gt;string&lt;/span&gt;&lt;span style="color:black"&gt; viewName = controller.RouteData.GetRequiredString(&lt;/span&gt;&lt;span style="color:#a31515"&gt;"action"&lt;/span&gt;&lt;span style="color:black"&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="font-family:Courier New; font-size:10pt"&gt;&lt;span style="color:#2b91af"&gt;   15&lt;/span&gt;&lt;span style="color:black"&gt;             &lt;/span&gt;&lt;span style="color:blue"&gt;string&lt;/span&gt;&lt;span style="color:black"&gt; assemblyName = controller.GetType().Assembly.FullName.Split(&lt;/span&gt;&lt;span style="color:#a31515"&gt;','&lt;/span&gt;&lt;span style="color:black"&gt;)[0];
&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="font-family:Courier New; font-size:10pt"&gt;&lt;span style="color:#2b91af"&gt;   16&lt;/span&gt;&lt;span style="color:black"&gt;             &lt;/span&gt;&lt;span style="color:blue"&gt;string&lt;/span&gt;&lt;span style="color:black"&gt; pluginPath = &lt;/span&gt;&lt;span style="color:#2b91af"&gt;String&lt;/span&gt;&lt;span style="color:black"&gt;.Format(
&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="font-family:Courier New; font-size:10pt"&gt;&lt;span style="color:#2b91af"&gt;   17&lt;/span&gt;&lt;span style="color:black"&gt;                     &lt;/span&gt;&lt;span style="color:#a31515"&gt;@"~/Plugin/{0}.dll/{0}.Views.{1}.{2}.aspx"&lt;/span&gt;&lt;span style="color:black"&gt;,
&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="font-family:Courier New; font-size:10pt"&gt;&lt;span style="color:#2b91af"&gt;   18&lt;/span&gt;&lt;span style="color:black"&gt;                     assemblyName,controllerName,viewName
&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="font-family:Courier New; font-size:10pt"&gt;&lt;span style="color:#2b91af"&gt;   19&lt;/span&gt;&lt;span style="color:black"&gt;                     );
&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="font-family:Courier New; font-size:10pt"&gt;&lt;span style="color:#2b91af"&gt;   20&lt;/span&gt;&lt;span style="color:black"&gt;             &lt;/span&gt;&lt;span style="color:blue"&gt;return&lt;/span&gt;&lt;span style="color:black"&gt;
			&lt;/span&gt;&lt;span style="color:blue"&gt;new&lt;/span&gt;&lt;span style="color:black"&gt;
			&lt;/span&gt;&lt;span style="color:#2b91af"&gt;ViewResult&lt;/span&gt;&lt;span style="color:black"&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="font-family:Courier New; font-size:10pt"&gt;&lt;span style="color:#2b91af"&gt;   21&lt;/span&gt;&lt;span style="color:black"&gt;                 ViewName = pluginPath
&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="font-family:Courier New; font-size:10pt"&gt;&lt;span style="color:#2b91af"&gt;   22&lt;/span&gt;&lt;span style="color:black"&gt;             };
&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="font-family:Courier New; font-size:10pt"&gt;&lt;span style="color:#2b91af"&gt;   23&lt;/span&gt;&lt;span style="color:black"&gt;         }
&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="font-family:Courier New; font-size:10pt"&gt;&lt;span style="color:#2b91af"&gt;   24&lt;/span&gt;&lt;span style="color:black"&gt;     }
&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.codeplex.com/unifico/SourceControl/changeset/view/1491#52892"&gt;http://www.codeplex.com/unifico/SourceControl/changeset/view/1491#52892&lt;/a&gt;
	&lt;/p&gt;&lt;p&gt;Now using the embedded option is less tedious, for example:
&lt;/p&gt;&lt;p&gt;
 &lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="font-family:Courier New; font-size:10pt"&gt;&lt;span style="color:#2b91af"&gt;   33&lt;/span&gt;&lt;span style="color:black"&gt; 
&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="font-family:Courier New; font-size:10pt"&gt;&lt;span style="color:#2b91af"&gt;   34&lt;/span&gt;&lt;span style="color:black"&gt;         [&lt;/span&gt;&lt;span style="color:#2b91af"&gt;Authorize&lt;/span&gt;&lt;span style="color:black"&gt;(Roles=&lt;/span&gt;&lt;span style="color:#a31515"&gt;"Admin"&lt;/span&gt;&lt;span style="color:black"&gt;)]
&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="font-family:Courier New; font-size:10pt"&gt;&lt;span style="color:#2b91af"&gt;   35&lt;/span&gt;&lt;span style="color:black"&gt;         &lt;/span&gt;&lt;span style="color:blue"&gt;public&lt;/span&gt;&lt;span style="color:black"&gt;
			&lt;/span&gt;&lt;span style="color:#2b91af"&gt;ActionResult&lt;/span&gt;&lt;span style="color:black"&gt; Index()
&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="font-family:Courier New; font-size:10pt"&gt;&lt;span style="color:#2b91af"&gt;   36&lt;/span&gt;&lt;span style="color:black"&gt;         {
&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="font-family:Courier New; font-size:10pt"&gt;&lt;span style="color:#2b91af"&gt;   37&lt;/span&gt;&lt;span style="color:black"&gt;             ViewData[&lt;/span&gt;&lt;span style="color:#a31515"&gt;"Title"&lt;/span&gt;&lt;span style="color:black"&gt;] = &lt;/span&gt;&lt;span style="color:#a31515"&gt;"Account Admin Home"&lt;/span&gt;&lt;span style="color:black"&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="font-family:Courier New; font-size:10pt"&gt;&lt;span style="color:#2b91af"&gt;   38&lt;/span&gt;&lt;span style="color:black"&gt;             ViewData[&lt;/span&gt;&lt;span style="color:#a31515"&gt;"Message"&lt;/span&gt;&lt;span style="color:black"&gt;] = &lt;/span&gt;&lt;span style="color:#a31515"&gt;"Welcome to the account admin"&lt;/span&gt;&lt;span style="color:black"&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="font-family:Courier New; font-size:10pt"&gt;&lt;span style="color:#2b91af"&gt;   39&lt;/span&gt;&lt;span style="color:black"&gt; 
&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="font-family:Courier New; font-size:10pt"&gt;&lt;span style="color:#2b91af"&gt;   40&lt;/span&gt;&lt;span style="color:black"&gt;             &lt;/span&gt;&lt;span style="color:blue"&gt;return&lt;/span&gt;&lt;span style="color:black"&gt;
			&lt;/span&gt;&lt;span style="color:blue"&gt;this&lt;/span&gt;&lt;span style="color:black"&gt;.PluginView();
&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="font-family:Courier New; font-size:10pt"&gt;&lt;span style="color:#2b91af"&gt;   41&lt;/span&gt;&lt;span style="color:black"&gt;             &lt;/span&gt;&lt;span style="color:green"&gt;//return View("~/Plugin/App.Account.dll/App.Account.Views.Admin.Index.aspx");&lt;/span&gt;&lt;span style="color:black"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="font-family:Courier New; font-size:10pt"&gt;&lt;span style="color:#2b91af"&gt;   42&lt;/span&gt;&lt;span style="color:black"&gt;         }
&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;
 &lt;/p&gt;&lt;p&gt;It would be nice to not have to use 'this', but I can't see a way around it without rebuilding MVC, not something I want to start doing.  Also some caching and less reflection might be nice. &lt;/p&gt;

&lt;br /&gt;&lt;br /&gt;
&lt;p&gt;Update: The VewData and TempData have to be added to pass the models to the view&lt;/p&gt;
&lt;div style="font-family: Courier New; font-size: 10pt; color: black; background: white;"&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;   11&lt;/span&gt;         &lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;static&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;ViewResult&lt;/span&gt; PluginView(&lt;span style="color: blue;"&gt;this&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;Controller&lt;/span&gt; controller)&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;   12&lt;/span&gt;         {&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;   13&lt;/span&gt;             &lt;span style="color: blue;"&gt;string&lt;/span&gt; controllerName = controller.RouteData.GetRequiredString(&lt;span style="color: #a31515;"&gt;"controller"&lt;/span&gt;);&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;   14&lt;/span&gt;             &lt;span style="color: blue;"&gt;string&lt;/span&gt; viewName = controller.RouteData.GetRequiredString(&lt;span style="color: #a31515;"&gt;"action"&lt;/span&gt;);&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;   15&lt;/span&gt;             &lt;span style="color: blue;"&gt;string&lt;/span&gt; assemblyName = controller.GetType().Assembly.FullName.Split(&lt;span style="color: #a31515;"&gt;','&lt;/span&gt;)[0];&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;   16&lt;/span&gt;             &lt;span style="color: blue;"&gt;string&lt;/span&gt; pluginPath = &lt;span style="color: #2b91af;"&gt;String&lt;/span&gt;.Format(&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;   17&lt;/span&gt;                     &lt;span style="color: #a31515;"&gt;@"~/Plugin/{0}.dll/{0}.Views.{1}.{2}.aspx"&lt;/span&gt;,&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;   18&lt;/span&gt;                     assemblyName,controllerName,viewName&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;   19&lt;/span&gt;                     );&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;   20&lt;/span&gt;             &lt;span style="color: blue;"&gt;return&lt;/span&gt; &lt;span style="color: blue;"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;ViewResult&lt;/span&gt;{&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;   21&lt;/span&gt;                 ViewName = pluginPath,&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;   22&lt;/span&gt;                 ViewData = controller.ViewData,&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;   23&lt;/span&gt;                 TempData = controller.TempData&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;   24&lt;/span&gt;             };&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;   25&lt;/span&gt;         }&lt;/p&gt;
&lt;/div&gt;

&lt;img src="http://charlesrcook.com/aggbug/50.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>CCook</dc:creator>
            <guid>http://charlesrcook.com/archive/2009/01/02/allowing-for-dynamic-embedded-view-substitution-with-mvc.aspx</guid>
            <pubDate>Sat, 03 Jan 2009 03:18:45 GMT</pubDate>
            <wfw:comment>http://charlesrcook.com/comments/50.aspx</wfw:comment>
            <comments>http://charlesrcook.com/archive/2009/01/02/allowing-for-dynamic-embedded-view-substitution-with-mvc.aspx#feedback</comments>
            <slash:comments>6</slash:comments>
            <wfw:commentRss>http://charlesrcook.com/comments/commentRss/50.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Paging Helpers in Unifico, Filtered and Sorted Paging</title>
            <category>Web Programming</category>
            <link>http://charlesrcook.com/archive/2008/12/31/paging-helpers-in-unifico-filtered-and-sorted-paging.aspx</link>
            <description>&lt;p&gt;Unifico has a few paging helpers to make service methods easily paged from a client.  Essentially the framework makes consuming a page request object as simple as calling .ToList() on an IQueryable source.  The object, the PageRequest, has two collections, Filters and Sorts with several constructors to make instantiation easy.  The collections are rather straight forward, providing filtering and sorting ability on a paging source.  The uniqueness comes from the ability to request multiple filters and sorts together, along with a paging request.  This request is then execute on the IQueryable source, so if DLINQ is used, results in exactly two database hits.  A COUNT statement is executed to find out how many pages there are, and a single select statement providing the paged results.   This is all done without exposing LINQ or IQueryable to the service's client.
&lt;/p&gt;&lt;p&gt;Making an existing source page-able is rather simple, compare the two implementations.
&lt;/p&gt;&lt;p&gt;Without paging implemented:
&lt;/p&gt;&lt;p&gt;
 &lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="font-family:Courier New; font-size:10pt"&gt;&lt;span style="color:#2b91af"&gt;   44&lt;/span&gt;&lt;span style="color:black"&gt;         &lt;/span&gt;&lt;span style="color:blue"&gt;public&lt;/span&gt;&lt;span style="color:black"&gt;
			&lt;/span&gt;&lt;span style="color:#2b91af"&gt;List&lt;/span&gt;&lt;span style="color:black"&gt;&amp;lt;App.Account.Models.&lt;/span&gt;&lt;span style="color:#2b91af"&gt;Role&lt;/span&gt;&lt;span style="color:black"&gt;&amp;gt; GetRoles()
&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="font-family:Courier New; font-size:10pt"&gt;&lt;span style="color:#2b91af"&gt;   45&lt;/span&gt;&lt;span style="color:black"&gt;         {
&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="font-family:Courier New; font-size:10pt"&gt;&lt;span style="color:#2b91af"&gt;   46&lt;/span&gt;&lt;span style="color:black"&gt;             &lt;/span&gt;&lt;span style="color:blue"&gt;return&lt;/span&gt;&lt;span style="color:black"&gt; accountRepository.GetRoles().ToList();
&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="font-family:Courier New; font-size:10pt"&gt;&lt;span style="color:#2b91af"&gt;   47&lt;/span&gt;&lt;span style="color:black"&gt;         }
&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;
 &lt;/p&gt;&lt;p&gt;
 &lt;/p&gt;&lt;p&gt;With paging implemented:
&lt;/p&gt;&lt;p&gt;
 &lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="font-family:Courier New; font-size:10pt"&gt;&lt;span style="color:#2b91af"&gt;   43&lt;/span&gt;&lt;span style="color:black"&gt;         &lt;/span&gt;&lt;span style="color:blue"&gt;public&lt;/span&gt;&lt;span style="color:black"&gt;
			&lt;/span&gt;&lt;span style="color:#2b91af"&gt;PageResponse&lt;/span&gt;&lt;span style="color:black"&gt;&amp;lt;App.Account.Models.&lt;/span&gt;&lt;span style="color:#2b91af"&gt;Role&lt;/span&gt;&lt;span style="color:black"&gt;&amp;gt; GetRolePage(&lt;/span&gt;&lt;span style="color:#2b91af"&gt;PageRequest&lt;/span&gt;&lt;span style="color:black"&gt; PageRequest)
&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="font-family:Courier New; font-size:10pt"&gt;&lt;span style="color:#2b91af"&gt;   44&lt;/span&gt;&lt;span style="color:black"&gt;         {
&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="font-family:Courier New; font-size:10pt"&gt;&lt;span style="color:#2b91af"&gt;   45&lt;/span&gt;&lt;span style="color:black"&gt;             &lt;/span&gt;&lt;span style="color:blue"&gt;return&lt;/span&gt;&lt;span style="color:black"&gt; accountRepository.GetRoles().ToPageResponse(PageRequest);
&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="font-family:Courier New; font-size:10pt"&gt;&lt;span style="color:#2b91af"&gt;   46&lt;/span&gt;&lt;span style="color:black"&gt;         }
&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;
 &lt;/p&gt;&lt;p&gt;
 &lt;/p&gt;&lt;p&gt;Utilizing the paging is almost painfully easy.
&lt;/p&gt;&lt;p&gt;Grabbing the first page at a size of ten:
&lt;/p&gt;&lt;p&gt;
 &lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="font-family:Courier New; font-size:10pt"&gt;&lt;span style="color:#2b91af"&gt;  120&lt;/span&gt;&lt;span style="color:black"&gt; &lt;/span&gt;&lt;span style="color:#2b91af"&gt;PageResponse&lt;/span&gt;&lt;span style="color:black"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#2b91af"&gt;Role&lt;/span&gt;&lt;span style="color:black"&gt;&amp;gt; rolePage = accountService.GetRolePage(&lt;/span&gt;&lt;span style="color:blue"&gt;new&lt;/span&gt;&lt;span style="color:black"&gt;
			&lt;/span&gt;&lt;span style="color:#2b91af"&gt;PageRequest&lt;/span&gt;&lt;span style="color:black"&gt;(0, 10));
&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;
 &lt;/p&gt;&lt;p&gt;
 &lt;/p&gt;&lt;p&gt;Or grabbing the first page sorting by the role's name (ascending):
&lt;/p&gt;&lt;p&gt;
 &lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="font-family:Courier New; font-size:10pt"&gt;&lt;span style="color:#2b91af"&gt;  120&lt;/span&gt;&lt;span style="color:black"&gt;             &lt;/span&gt;&lt;span style="color:#2b91af"&gt;PageResponse&lt;/span&gt;&lt;span style="color:black"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#2b91af"&gt;Role&lt;/span&gt;&lt;span style="color:black"&gt;&amp;gt; rolePage = accountService.GetRolePage(&lt;/span&gt;&lt;span style="color:blue"&gt;new&lt;/span&gt;&lt;span style="color:black"&gt;
			&lt;/span&gt;&lt;span style="color:#2b91af"&gt;PageRequest&lt;/span&gt;&lt;span style="color:black"&gt;(0, 10, &lt;/span&gt;&lt;span style="color:#a31515"&gt;"Name"&lt;/span&gt;&lt;span style="color:black"&gt;, &lt;/span&gt;&lt;span style="color:#a31515"&gt;"string"&lt;/span&gt;&lt;span style="color:black"&gt;, &lt;/span&gt;&lt;span style="color:blue"&gt;true&lt;/span&gt;&lt;span style="color:black"&gt;));
&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;
 &lt;/p&gt;&lt;p&gt;
 &lt;/p&gt;&lt;p&gt;Or fully defining the page request:
&lt;/p&gt;&lt;p&gt;
 &lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="font-family:Courier New; font-size:10pt"&gt;&lt;span style="color:#2b91af"&gt;  120&lt;/span&gt;&lt;span style="color:black"&gt;             accountService.GetRolePage(&lt;/span&gt;&lt;span style="color:blue"&gt;new&lt;/span&gt;&lt;span style="color:black"&gt;
			&lt;/span&gt;&lt;span style="color:#2b91af"&gt;PageRequest&lt;/span&gt;&lt;span style="color:black"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="font-family:Courier New; font-size:10pt"&gt;&lt;span style="color:#2b91af"&gt;  121&lt;/span&gt;&lt;span style="color:black"&gt;             {
&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="font-family:Courier New; font-size:10pt"&gt;&lt;span style="color:#2b91af"&gt;  122&lt;/span&gt;&lt;span style="color:black"&gt;                 Index = 2,
&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="font-family:Courier New; font-size:10pt"&gt;&lt;span style="color:#2b91af"&gt;  123&lt;/span&gt;&lt;span style="color:black"&gt;                 PageSize = 10,
&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="font-family:Courier New; font-size:10pt"&gt;&lt;span style="color:#2b91af"&gt;  124&lt;/span&gt;&lt;span style="color:black"&gt;                 Filters = &lt;/span&gt;&lt;span style="color:blue"&gt;new&lt;/span&gt;&lt;span style="color:black"&gt;
			&lt;/span&gt;&lt;span style="color:#2b91af"&gt;ContractList&lt;/span&gt;&lt;span style="color:black"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#2b91af"&gt;Filter&lt;/span&gt;&lt;span style="color:black"&gt;&amp;gt;(
&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="font-family:Courier New; font-size:10pt"&gt;&lt;span style="color:#2b91af"&gt;  125&lt;/span&gt;&lt;span style="color:black"&gt;                     &lt;/span&gt;&lt;span style="color:blue"&gt;new&lt;/span&gt;&lt;span style="color:black"&gt;[]{&lt;/span&gt;&lt;span style="color:blue"&gt;new&lt;/span&gt;&lt;span style="color:black"&gt;
			&lt;/span&gt;&lt;span style="color:#2b91af"&gt;Filter&lt;/span&gt;&lt;span style="color:black"&gt; { BinaryExpression=&lt;/span&gt;&lt;span style="color:#2b91af"&gt;FilterBinaryExpression&lt;/span&gt;&lt;span style="color:black"&gt;.Equal, Parameter=&lt;/span&gt;&lt;span style="color:#a31515"&gt;"Name"&lt;/span&gt;&lt;span style="color:black"&gt;, TypeName=&lt;/span&gt;&lt;span style="color:#a31515"&gt;"String"&lt;/span&gt;&lt;span style="color:black"&gt;,Value=&lt;/span&gt;&lt;span style="color:#a31515"&gt;"Admin"&lt;/span&gt;&lt;span style="color:black"&gt;},
&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="font-family:Courier New; font-size:10pt"&gt;&lt;span style="color:#2b91af"&gt;  126&lt;/span&gt;&lt;span style="color:black"&gt;                         &lt;/span&gt;&lt;span style="color:blue"&gt;new&lt;/span&gt;&lt;span style="color:black"&gt;
			&lt;/span&gt;&lt;span style="color:#2b91af"&gt;Filter&lt;/span&gt;&lt;span style="color:black"&gt; { BinaryExpression=&lt;/span&gt;&lt;span style="color:#2b91af"&gt;FilterBinaryExpression&lt;/span&gt;&lt;span style="color:black"&gt;.GreaterThan, Parameter=&lt;/span&gt;&lt;span style="color:#a31515"&gt;"Level"&lt;/span&gt;&lt;span style="color:black"&gt;, TypeName=&lt;/span&gt;&lt;span style="color:#a31515"&gt;"Int32"&lt;/span&gt;&lt;span style="color:black"&gt;, Value=1}}),
&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="font-family:Courier New; font-size:10pt"&gt;&lt;span style="color:#2b91af"&gt;  127&lt;/span&gt;&lt;span style="color:black"&gt;                 Sorts = &lt;/span&gt;&lt;span style="color:blue"&gt;new&lt;/span&gt;&lt;span style="color:black"&gt;
			&lt;/span&gt;&lt;span style="color:#2b91af"&gt;ContractList&lt;/span&gt;&lt;span style="color:black"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#2b91af"&gt;Sort&lt;/span&gt;&lt;span style="color:black"&gt;&amp;gt;(
&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="font-family:Courier New; font-size:10pt"&gt;&lt;span style="color:#2b91af"&gt;  128&lt;/span&gt;&lt;span style="color:black"&gt;                     &lt;/span&gt;&lt;span style="color:blue"&gt;new&lt;/span&gt;&lt;span style="color:black"&gt;[] { &lt;/span&gt;&lt;span style="color:blue"&gt;new&lt;/span&gt;&lt;span style="color:black"&gt;
			&lt;/span&gt;&lt;span style="color:#2b91af"&gt;Sort&lt;/span&gt;&lt;span style="color:black"&gt; { Ascending = &lt;/span&gt;&lt;span style="color:blue"&gt;true&lt;/span&gt;&lt;span style="color:black"&gt;, TypeName = &lt;/span&gt;&lt;span style="color:#a31515"&gt;"Int32"&lt;/span&gt;&lt;span style="color:black"&gt;, Parameter = &lt;/span&gt;&lt;span style="color:#a31515"&gt;"Level"&lt;/span&gt;&lt;span style="color:black"&gt; } })
&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="font-family:Courier New; font-size:10pt"&gt;&lt;span style="color:#2b91af"&gt;  129&lt;/span&gt;&lt;span style="color:black"&gt;             });
&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="font-family:Courier New; font-size:10pt"&gt;&lt;span style="color:#2b91af"&gt;  130&lt;/span&gt;&lt;span style="color:black"&gt;             &lt;/span&gt;&lt;span style="color:green"&gt;/* Executes&lt;/span&gt;&lt;span style="color:black"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="font-family:Courier New; font-size:10pt"&gt;&lt;span style="color:#2b91af"&gt;  131&lt;/span&gt;&lt;span style="color:black"&gt; &lt;/span&gt;&lt;span style="color:green"&gt;            SELECT [t1].[RoleID] AS [ID], [t1].[Name], [t1].[Level] AS [Level]&lt;/span&gt;&lt;span style="color:black"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="font-family:Courier New; font-size:10pt"&gt;&lt;span style="color:#2b91af"&gt;  132&lt;/span&gt;&lt;span style="color:black"&gt; &lt;/span&gt;&lt;span style="color:green"&gt;            FROM (&lt;/span&gt;&lt;span style="color:black"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="font-family:Courier New; font-size:10pt"&gt;&lt;span style="color:#2b91af"&gt;  133&lt;/span&gt;&lt;span style="color:black"&gt; &lt;/span&gt;&lt;span style="color:green"&gt;                SELECT ROW_NUMBER() OVER (ORDER BY [t0].[Level]) AS [ROW_NUMBER], [t0].[RoleID], [t0].[Name], [t0].[Level]&lt;/span&gt;&lt;span style="color:black"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="font-family:Courier New; font-size:10pt"&gt;&lt;span style="color:#2b91af"&gt;  134&lt;/span&gt;&lt;span style="color:black"&gt; &lt;/span&gt;&lt;span style="color:green"&gt;                FROM [dbo].[Role] AS [t0]&lt;/span&gt;&lt;span style="color:black"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="font-family:Courier New; font-size:10pt"&gt;&lt;span style="color:#2b91af"&gt;  135&lt;/span&gt;&lt;span style="color:black"&gt; &lt;/span&gt;&lt;span style="color:green"&gt;                WHERE ([t0].[Level] &amp;gt; 1) AND ([t0].[Name] = 'Admin')&lt;/span&gt;&lt;span style="color:black"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="font-family:Courier New; font-size:10pt"&gt;&lt;span style="color:#2b91af"&gt;  136&lt;/span&gt;&lt;span style="color:black"&gt; &lt;/span&gt;&lt;span style="color:green"&gt;                ) AS [t1]&lt;/span&gt;&lt;span style="color:black"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="font-family:Courier New; font-size:10pt"&gt;&lt;span style="color:#2b91af"&gt;  137&lt;/span&gt;&lt;span style="color:black"&gt; &lt;/span&gt;&lt;span style="color:green"&gt;            WHERE [t1].[ROW_NUMBER] BETWEEN 20 + 1 AND 20 + 10&lt;/span&gt;&lt;span style="color:black"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="font-family:Courier New; font-size:10pt"&gt;&lt;span style="color:#2b91af"&gt;  138&lt;/span&gt;&lt;span style="color:black"&gt; &lt;/span&gt;&lt;span style="color:green"&gt;            ORDER BY [t1].[ROW_NUMBER]&lt;/span&gt;&lt;span style="color:black"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="font-family:Courier New; font-size:10pt"&gt;&lt;span style="color:#2b91af"&gt;  139&lt;/span&gt;&lt;span style="color:black"&gt; &lt;/span&gt;&lt;span style="color:green"&gt;            */&lt;/span&gt;&lt;span style="color:black"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;
 &lt;/p&gt;&lt;p&gt;
 &lt;/p&gt;&lt;p&gt;I'm sure you have notice the TypeName properties and wondered why they are there.  They enable the helper's methods to work with the expression tree before the query has been executed.  Notice that the paging occurs in SQL against the table names and columns, not against the models.  While the syntax is nowhere near that of LINQ, it seals of the service and keeps the paging responsibility within the service without requiring the service to handle specific paging requests. A similar method can be used to search multiple sources, and will be added shortly.  Ohh, and it works across WCF.
&lt;/p&gt;&lt;p&gt;
 &lt;/p&gt;&lt;p&gt;&lt;a href="http://www.codeplex.com/unifico" target="_blank"&gt;&lt;h1&gt;&lt;span style="color:blue; text-decoration:underline"&gt;The Unifico Framework&lt;/span&gt;&lt;/h1&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://charlesrcook.com/aggbug/49.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>CCook</dc:creator>
            <guid>http://charlesrcook.com/archive/2008/12/31/paging-helpers-in-unifico-filtered-and-sorted-paging.aspx</guid>
            <pubDate>Thu, 01 Jan 2009 01:59:16 GMT</pubDate>
            <wfw:comment>http://charlesrcook.com/comments/49.aspx</wfw:comment>
            <comments>http://charlesrcook.com/archive/2008/12/31/paging-helpers-in-unifico-filtered-and-sorted-paging.aspx#feedback</comments>
            <slash:comments>5</slash:comments>
            <wfw:commentRss>http://charlesrcook.com/comments/commentRss/49.aspx</wfw:commentRss>
        </item>
    </channel>
</rss>