<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>On the way to be great...</title>
	<atom:link href="http://liangwu.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://liangwu.wordpress.com</link>
	<description>Coding with passion and discipline</description>
	<lastBuildDate>Tue, 21 Dec 2010 19:14:07 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='liangwu.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>On the way to be great...</title>
		<link>http://liangwu.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://liangwu.wordpress.com/osd.xml" title="On the way to be great..." />
	<atom:link rel='hub' href='http://liangwu.wordpress.com/?pushpress=hub'/>
		<item>
		<title>The Basic of Recursive Function in F#</title>
		<link>http://liangwu.wordpress.com/2010/07/17/the-basic-of-recursive-function-in-f/</link>
		<comments>http://liangwu.wordpress.com/2010/07/17/the-basic-of-recursive-function-in-f/#comments</comments>
		<pubDate>Sun, 18 Jul 2010 03:44:30 +0000</pubDate>
		<dc:creator>liangwu</dc:creator>
				<category><![CDATA[F#]]></category>
		<category><![CDATA[Functional Programming]]></category>

		<guid isPermaLink="false">https://liangwu.wordpress.com/?p=216</guid>
		<description><![CDATA[Coming from imperative paradigm, I have to admin I rarely use recursion in my code design. Because it is very natural way to use loop or to encapsulate the business logic in &#34;Iterator&#34; (even one of the patterns from GOF). But in functional language, like F#, it is very natural to design application using recursion, [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=liangwu.wordpress.com&amp;blog=807949&amp;post=216&amp;subd=liangwu&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Coming from imperative paradigm, I have to admin I rarely use recursion in my code design. Because it is very natural way to use loop or to encapsulate the business logic in &quot;Iterator&quot; (even one of the patterns from GOF).</p>
<p>But in functional language, like F#, it is very natural to design application using recursion, which make the code more concise, succinct and expressive. It tells “What”, instead of “How”.</p>
<p>Let&#8217;s take a simple Factorial function as an example to explain how recursion works.</p>
<pre class="code"><span style="color:#93c763;">let rec </span><span style="color:#e0e2e4;">factorial n </span><span style="color:#e8e2b7;">=
     </span><span style="color:#93c763;">if </span><span style="color:#e0e2e4;">n </span><span style="color:#e8e2b7;">= </span><span style="color:#ffcd22;">0 </span><span style="color:#93c763;">then </span><span style="color:#ffcd22;">1
     </span><span style="color:#93c763;">else
        </span><span style="color:#e0e2e4;">n </span><span style="color:#e8e2b7;">* </span><span style="color:#e0e2e4;"><span style="color:#e0e2e4;">factorial</span> (n </span><span style="color:#e8e2b7;">-</span><span style="color:#ffcd22;">1</span><span style="color:#e0e2e4;">)</span></pre>
<p>
  </p>
<pre class="code"><span style="color:#e0e2e4;">
</span></pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
<p>The function looks simple, which is exactly the same way as its mathematical expression.</p>
<p>But if we provide a very large number such as 1,000,000, it might raise StackOverFlow exception, because the compiler use stack to store the functions. The stack space is very precious, only 1 M. It sounds like the recursion is not applicable for processing large data. Fortunately, F# compiler can optimize recursion by applying “Tail Recursion”.</p>
<p>“Tail Recursion” is a special recursive function which does not including any other execution after the recursive call, meaning there is no “pending operation”</p>
<p>Obviously, the factorial function above is not “Tail Recursion” because it has to multiply n. How do we solve it? A common approach is to use accumulator pattern. Here is the code:</p>
<pre class="code"><span style="color:#93c763;">let rec </span><span style="color:#e0e2e4;">factorialTR n a </span><span style="color:#e8e2b7;">=
    </span><span style="color:#93c763;">if </span><span style="color:#e0e2e4;">n </span><span style="color:#e8e2b7;">= </span><span style="color:#ffcd22;">0 </span><span style="color:#93c763;">then </span><span style="color:#e0e2e4;">a
    </span><span style="color:#93c763;">else
       </span><span style="color:#e0e2e4;">factorialTR (n </span><span style="color:#e8e2b7;">- </span><span style="color:#ffcd22;">1</span><span style="color:#e0e2e4;">) (n </span><span style="color:#e8e2b7;">* </span><span style="color:#e0e2e4;">a)
</span></pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
<p>The idea is, instead of accumulating the functions in the stack, the code use a “accumulator” type to get the temporal value, which is (n * a) in the function. When it function reaches its base, it only needs to return the “accumulator” value. You see, in this case, compiler does not need to store additional additional functions in the stack any more. Makes sense, right?</p>
<p>Is Factorial function too simple? OK, let’s take some “real world” samples.</p>
<p>1. Sum a List (Just be aware the the list in F# is linked list)</p>
<pre class="code"><span style="color:#93c763;">let </span><span style="color:#e0e2e4;">tempList </span><span style="color:#e8e2b7;">= </span><span style="color:#e0e2e4;">[</span><span style="color:#ffcd22;">1 </span><span style="color:#e8e2b7;">.. </span><span style="color:#ffcd22;">1000000</span><span style="color:#e0e2e4;">]

</span><span style="color:#66747b;">// Non Tail Recursion Version
</span><span style="color:#93c763;">let rec </span><span style="color:#e0e2e4;">sumList lst </span><span style="color:#e8e2b7;">=
    </span><span style="color:#93c763;">match </span><span style="color:#e0e2e4;">lst </span><span style="color:#93c763;">with
    </span><span style="color:#e0e2e4;">| [] </span><span style="color:#93c763;">-&gt; </span><span style="color:#ffcd22;">0
    </span><span style="color:#e0e2e4;">| hd </span><span style="color:#e8e2b7;">:: </span><span style="color:#e0e2e4;">tl </span><span style="color:#93c763;">-&gt; </span><span style="color:#e0e2e4;">hd </span><span style="color:#e8e2b7;">+ </span><span style="color:#e0e2e4;">sumList tl 

sumList tempList

</span><span style="color:#66747b;">// Tail recursion version
</span><span style="color:#93c763;">let </span><span style="color:#e0e2e4;">sumListTR list  </span><span style="color:#e8e2b7;">=
    </span><span style="color:#93c763;">let rec </span><span style="color:#e0e2e4;">innerSum list total </span><span style="color:#e8e2b7;">=
         </span><span style="color:#93c763;">match </span><span style="color:#e0e2e4;">list </span><span style="color:#93c763;">with
         </span><span style="color:#e0e2e4;">| [] </span><span style="color:#93c763;">-&gt; </span><span style="color:#ffcd22;">0 </span><span style="color:#66747b;">// initial value
         </span><span style="color:#e0e2e4;">| hd </span><span style="color:#e8e2b7;">:: </span><span style="color:#e0e2e4;">tl </span><span style="color:#93c763;">-&gt;
            let </span><span style="color:#e0e2e4;">ntotal </span><span style="color:#e8e2b7;">= </span><span style="color:#e0e2e4;">hd </span><span style="color:#e8e2b7;">+ </span><span style="color:#e0e2e4;">total
            <span style="color:#e0e2e4;">innerSum </span>tl ntotal </span><span style="color:#66747b;">// don't need to store in stack
    </span><span style="color:#e0e2e4;"><span style="color:#e0e2e4;">innerSum </span>list </span><span style="color:#ffcd22;">0
</span></pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
<p>The first one is not “Tail Recursion” because the recursion function is not the “last” thing, it has to append the value with hd.</p>
<p>The second one is “Tail Recursion” since it calculates the “AsOf” value and the temporal value is one of the parameter passed in the function. There is nothing needed to be stored in the stack.</p>
<p>2. Map function (Note: Map is one of high order functions common in Functional Language)</p>
<pre class="code"><span style="color:#66747b;">// Non-Tail Recursive version map  function
</span><span style="color:#93c763;">let rec </span><span style="color:#e0e2e4;">map f list </span><span style="color:#e8e2b7;">=
    </span><span style="color:#93c763;">match </span><span style="color:#e0e2e4;">list </span><span style="color:#93c763;">with
    </span><span style="color:#e0e2e4;">| [] </span><span style="color:#93c763;">-&gt; </span><span style="color:#e0e2e4;">[]
    | hd </span><span style="color:#e8e2b7;">:: </span><span style="color:#e0e2e4;">tl </span><span style="color:#93c763;">-&gt; </span><span style="color:#e0e2e4;">(f hd) </span><span style="color:#e8e2b7;">:: </span><span style="color:#e0e2e4;">(map f tl)
</span></pre>
<p>
  </p>
<pre class="code"><span style="color:#66747b;">// Tail Recursion Version
</span></pre>
<p>
  <br /><a href="http://11011.net/software/vspaste"></a></p>
<p></p>
<pre class="code"><span style="color:#93c763;">let </span><span style="color:#e0e2e4;">mapTR f list </span><span style="color:#e8e2b7;">=
    </span><span style="color:#93c763;">let rec </span><span style="color:#e0e2e4;">loop f list acc </span><span style="color:#e8e2b7;">=
        </span><span style="color:#93c763;">match </span><span style="color:#e0e2e4;">list </span><span style="color:#93c763;">with
        </span><span style="color:#e0e2e4;">| [] </span><span style="color:#93c763;">-&gt; </span><span style="color:#e0e2e4;">acc
        | hd </span><span style="color:#e8e2b7;">:: </span><span style="color:#e0e2e4;">tl </span><span style="color:#93c763;">-&gt; </span><span style="color:#e0e2e4;">loop f tl (f hd </span><span style="color:#e8e2b7;">:: </span><span style="color:#e0e2e4;">acc) </span></pre>
<p>
  </p>
<pre class="code"><span style="color:#e0e2e4;">     </span><span style="color:#e0e2e4;">loop f (List</span><span style="color:#e8e2b7;">.</span><span style="color:#e0e2e4;">rev list) []
</span></pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
<p>“Tail Recursion” makes it a very useful in our tool box. But it might reach its own limitation that “Tail Recursion” is allow one recursion call in a function. If there have more, we cannot covert it to “Tail Recursion”, so we cannot take the optimization offered by F# compiler.</p>
<p>Take a sample when we process a Tree:</p>
<pre class="code"><span style="color:#93c763;">type </span><span style="color:#e0e2e4;">Tree</span><span style="color:#e8e2b7;">&lt;'</span><span style="color:#e0e2e4;">a</span><span style="color:#e8e2b7;">&gt; =
  </span><span style="color:#e0e2e4;">| Node </span><span style="color:#93c763;">of </span><span style="color:#e8e2b7;">'</span><span style="color:#e0e2e4;">a </span><span style="color:#e8e2b7;">* </span><span style="color:#e0e2e4;">Tree</span><span style="color:#e8e2b7;">&lt;'</span><span style="color:#e0e2e4;">a</span><span style="color:#e8e2b7;">&gt; * </span><span style="color:#e0e2e4;">Tree</span><span style="color:#e8e2b7;">&lt;'</span><span style="color:#e0e2e4;">a</span><span style="color:#e8e2b7;">&gt;
  </span><span style="color:#e0e2e4;">| Leaf </span><span style="color:#93c763;">of </span><span style="color:#e8e2b7;">'</span><span style="color:#e0e2e4;">a

</span><span style="color:#66747b;">// Non Trail Recursion version
</span><span style="color:#93c763;">let rec </span><span style="color:#e0e2e4;">treeSize </span><span style="color:#e8e2b7;">= </span><span style="color:#93c763;">function
  </span><span style="color:#e0e2e4;">| Leaf _ </span><span style="color:#93c763;">-&gt; </span><span style="color:#ffcd22;">1
  </span><span style="color:#e0e2e4;">| Node(_, left, right) </span><span style="color:#93c763;">-&gt; </span><span style="color:#e0e2e4;"><span style="color:#e0e2e4;">treeSize </span> left </span><span style="color:#e8e2b7;">+ </span><span style="color:#e0e2e4;"><span style="color:#e0e2e4;">treeSize  </span>right

</span><span style="color:#66747b;">// Trail Recursion version
</span><span style="color:#93c763;">let  </span><span style="color:#e0e2e4;"><span style="color:#e0e2e4;">treeSizeTR</span> tree </span><span style="color:#e8e2b7;">=
  </span><span style="color:#93c763;">let rec </span><span style="color:#e0e2e4;">size_acc tree acc </span><span style="color:#e8e2b7;">=
    </span><span style="color:#93c763;">match </span><span style="color:#e0e2e4;">tree </span><span style="color:#93c763;">with
    </span><span style="color:#e0e2e4;">| Leaf _ </span><span style="color:#93c763;">-&gt; </span><span style="color:#ffcd22;">1 </span><span style="color:#e8e2b7;">+ </span><span style="color:#e0e2e4;">acc
    | Node(_, left, right) </span><span style="color:#93c763;">-&gt;
        let </span><span style="color:#e0e2e4;">acc </span><span style="color:#e8e2b7;">= </span><span style="color:#e0e2e4;">size_acc left acc </span><span style="color:#66747b;">// Non Tail Recursion on left
        </span><span style="color:#e0e2e4;">size_acc right acc          </span><span style="color:#66747b;">// Tail Recursion on right
  </span><span style="color:#e0e2e4;">size_acc tree </span><span style="color:#ffcd22;">0
</span></pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
<p>You can see we provide two version of codes to process a tree. The first one is a normal approach by calling two recursive functions. It is interesting to see the second one. As you can see we only have one “Tail Recursion” when processing right side tree. So the whole solution still cannot be optimized by F# compiler.&#160; Now what we should do?</p>
<p>Let’s think about how we apply “accumulator” pattern to solve “Trail Recursion” issue again. We pass a temporal value as an argument to the function. Just be ware, in functional language like F#, function is value too. It can be passed and returned! It is a fundamental in functional programming, but it can help us to solve very tricky issue. OK, let me tell you the answer first, then explain.</p>
<p>The answer is to applying continuous passing style (CPS) by passing another function as the “remaining” of the recursive function call.&#160; So what does it mean? Still confused? Well, actually it is really confusing. It is not very easy to understand when you see it first time. Still, let’s use Fibonacci function we used in the early to illustrate how continuations works.</p>
<pre class="code"><span style="color:#93c763;">let  </span><span style="color:#e0e2e4;">fibonacciCPS n </span><span style="color:#e8e2b7;">=
  </span><span style="color:#93c763;">let rec </span><span style="color:#e0e2e4;">fibonacci_cont a cont </span><span style="color:#e8e2b7;">=
    </span><span style="color:#93c763;">if </span><span style="color:#e0e2e4;">a </span><span style="color:#e8e2b7;">&lt;= </span><span style="color:#ffcd22;">2 </span><span style="color:#93c763;">then </span><span style="color:#e0e2e4;">cont </span><span style="color:#ffcd22;">1
    </span><span style="color:#93c763;">else
      </span><span style="color:#e0e2e4;">fibonacci_cont (a </span><span style="color:#e8e2b7;">- </span><span style="color:#ffcd22;">2</span><span style="color:#e0e2e4;">) (</span><span style="color:#93c763;">fun </span><span style="color:#e0e2e4;">x </span><span style="color:#93c763;">-&gt;
        </span><span style="color:#e0e2e4;">fibonacci_cont (a </span><span style="color:#e8e2b7;">- </span><span style="color:#ffcd22;">1</span><span style="color:#e0e2e4;">) (</span><span style="color:#93c763;">fun </span><span style="color:#e0e2e4;">y </span><span style="color:#93c763;">-&gt;
          </span><span style="color:#e0e2e4;">cont(x </span><span style="color:#e8e2b7;">+ </span><span style="color:#e0e2e4;">y)))

  fibonacci_cont n (</span><span style="color:#93c763;">fun </span><span style="color:#e0e2e4;">x </span><span style="color:#93c763;">-&gt; </span><span style="color:#e0e2e4;">x)
</span></pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
<p>This implementation takes a inner recursive function by passing the number and a continuation function. Actually the continuation function is a&#160; closure function.</p>
<p>1. when a &lt;=2, it returns by applying the identifier function (fun x –&gt; x)</p>
<p>2. When a &gt; 2, it recursively calls to reach its base case by calling fibonacci_cont (a – 2), and in the same time, it builds up the closure functions. x is the result of fibonacci_cont (a –&#160; 2), and y is the result of fibonacci_cont (a –1). The add x and y.</p>
<p>3. Just be aware we use closure here, which use heap, instead of stack.</p>
<p>It really makes the logic inside out. It does not seem a very natural way when we design the code. It made my head hurt when first seeing this code. But later, I think it is very smart to pass closure function like that. It is really the beautiful side of functional programming.</p>
<p>Well, this blog might be too length. I will continue discussing recursive function later. Now let me finish this blog by putting the code to process a tress using continuation at the end.</p>
<pre class="code"><span style="color:#93c763;">let  </span><span style="color:#e0e2e4;">treeSizeCont tree </span><span style="color:#e8e2b7;">=
  </span><span style="color:#93c763;">let rec </span><span style="color:#e0e2e4;">size_acc tree acc cont </span><span style="color:#e8e2b7;">=
    </span><span style="color:#93c763;">match </span><span style="color:#e0e2e4;">tree </span><span style="color:#93c763;">with
    </span><span style="color:#e0e2e4;">| Leaf _ </span><span style="color:#93c763;">-&gt; </span><span style="color:#e0e2e4;">cont (</span><span style="color:#ffcd22;">1 </span><span style="color:#e8e2b7;">+ </span><span style="color:#e0e2e4;">acc)
    | Node(_, left, right) </span><span style="color:#93c763;">-&gt;
        </span><span style="color:#e0e2e4;">size_acc left acc (</span><span style="color:#93c763;">fun </span><span style="color:#e0e2e4;">left_size </span><span style="color:#93c763;">-&gt;
          </span><span style="color:#e0e2e4;">size_acc right left_size cont)

  size_acc tree </span><span style="color:#ffcd22;">0 </span><span style="color:#e0e2e4;">(</span><span style="color:#93c763;">fun </span><span style="color:#e0e2e4;">x </span><span style="color:#93c763;">-&gt; </span><span style="color:#e0e2e4;">x)
</span></pre>
<p>&#160;</p>
<p>Happy programming!<br />
  <br /><a href="http://11011.net/software/vspaste"></a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/liangwu.wordpress.com/216/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/liangwu.wordpress.com/216/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/liangwu.wordpress.com/216/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/liangwu.wordpress.com/216/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/liangwu.wordpress.com/216/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/liangwu.wordpress.com/216/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/liangwu.wordpress.com/216/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/liangwu.wordpress.com/216/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/liangwu.wordpress.com/216/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/liangwu.wordpress.com/216/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/liangwu.wordpress.com/216/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/liangwu.wordpress.com/216/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/liangwu.wordpress.com/216/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/liangwu.wordpress.com/216/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=liangwu.wordpress.com&amp;blog=807949&amp;post=216&amp;subd=liangwu&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://liangwu.wordpress.com/2010/07/17/the-basic-of-recursive-function-in-f/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/ef7572a12f8c9796fc7d604d6bd0476a?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">liangwu</media:title>
		</media:content>
	</item>
		<item>
		<title>Really Useful Windows Shortcuts</title>
		<link>http://liangwu.wordpress.com/2009/04/24/really-useful-windows-shortcuts/</link>
		<comments>http://liangwu.wordpress.com/2009/04/24/really-useful-windows-shortcuts/#comments</comments>
		<pubDate>Sat, 25 Apr 2009 02:14:20 +0000</pubDate>
		<dc:creator>liangwu</dc:creator>
				<category><![CDATA[Productivity]]></category>

		<guid isPermaLink="false">http://liangwu.wordpress.com/?p=77</guid>
		<description><![CDATA[One the of the tips I heard to become a productive developer is to use mouse as few as possible, put the fingers on the keyboard. Mouse clicking is sort of distraction from we are doing. Combining with any of the launcher tool, such as Slickrun, you will find you can definitely accomplish your work [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=liangwu.wordpress.com&amp;blog=807949&amp;post=77&amp;subd=liangwu&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://liangwu.files.wordpress.com/2009/05/keyboard.jpg"><img title="Keyboard" src="http://liangwu.files.wordpress.com/2009/05/keyboard_thumb.jpg?w=244&#038;h=192" border="0" alt="Keyboard" width="244" height="192" align="right" /></a>One the of the tips I heard to become a productive developer is to use mouse as few as possible, put the fingers on the keyboard.</p>
<p>Mouse clicking is sort of distraction from we are doing. Combining with any of the launcher tool, such as <a href="http://www.bayden.com/SlickRun/">Slickrun,</a> you will find you can definitely accomplish your work faster, more effectively and a lot fun!</p>
<p>Don’t try to memorize all of them at once. When you feel you need to use mouse, just do some search to see if any shortcut available. Here is the list I am using a lot as a .NET developer (visual studio and Resharper, of course!)</p>
<p>Here are some of the window-based shortcuts I collected and use very often. Hope it will help.</p>
<ul>
<li><a href="#visialstudio">Visual Studio shortcut keys</a></li>
<li><a href="http://www.jetbrains.com/resharper/docs/ReSharper45DefaultKeymap.pdf">Resharper shortcut keys (visual studio schema)</a></li>
<li><a href="#basicpc">Window common shortcut keys</a></li>
<li><a href="#webcommon">Web browser common Shortcut keys</a></li>
<li><a href="#firefox">Firefox shortcut keys</a></li>
<li><a href="#ie">Microsoft IE shortcut keys</a></li>
<li><a href="excel">Microsoft Excel shortcut keys</a></li>
<li><a href="word">Microsoft Word shortcut keys</a></li>
</ul>
<p><h3><a name="visialstudio">Visual Studio Shortcut Keys</a></h3>
<table border="1" cellspacing="0" cellpadding="1" width="447">
<tbody>
<tr>
<td width="212" valign="top">Shortcut Keys</td>
<td width="233" valign="top">Description</td>
</tr>
<tr>
<td width="212" valign="top">Ctrl + X</td>
<td width="233" valign="top">Cut the current selected item to clipboard</td>
</tr>
<tr>
<td width="212" valign="top">Ctrl + C</td>
<td width="233" valign="top">Copies the current selected item to the clipboard</td>
</tr>
<tr>
<td width="212" valign="top">Ctrl + V</td>
<td width="233" valign="top">Pastes the item in the clipboard at the cursor</td>
</tr>
<tr>
<td width="212" valign="top">Ctrl + Z</td>
<td width="233" valign="top">Undo previous editing action</td>
</tr>
<tr>
<td width="212" valign="top">Ctrl + Y</td>
<td width="233" valign="top">Redo the previous undo action</td>
</tr>
<tr>
<td width="212" valign="top">Esc</td>
<td width="233" valign="top">Closes a menu or dialog, cancels an operation in progress, or places focus in the current document window</td>
</tr>
<tr>
<td width="212" valign="top">Ctrl + S</td>
<td width="233" valign="top">Saves the selected files in the current project (usually the file that is being edited)</td>
</tr>
<tr>
<td width="212" valign="top">Ctrl + Shift + S</td>
<td width="233" valign="top">Saves all documents and projects</td>
</tr>
<tr>
<td width="212" valign="top">Shift + F12</td>
<td width="233" valign="top">Finds a reference to the selected item or the item under the cursor</td>
</tr>
<tr>
<td width="212" valign="top">Ctrl + End</td>
<td width="233" valign="top">Moves the cursor to the end of the document</td>
</tr>
<tr>
<td width="212" valign="top">Ctrl + Home</td>
<td width="233" valign="top">Moves the cursor to the start of the document</td>
</tr>
<tr>
<td width="212" valign="top">Ctrl + G</td>
<td width="233" valign="top">Displays the Go to Line dialog</td>
</tr>
<tr>
<td width="212" valign="top">Ctrl + Right Arrow</td>
<td width="233" valign="top">Moves the cursor one word to the right</td>
</tr>
<tr>
<td width="212" valign="top">Ctrl + Left Arrow</td>
<td width="233" valign="top">Moves the cursor one word to the left</td>
</tr>
<tr>
<td width="212" valign="top">Ctrl + K, Ctrl + C</td>
<td width="233" valign="top">Marks the current line or selected lines of code as a comment</td>
</tr>
<tr>
<td width="212" valign="top">Ctrl + K, Ctrl + U</td>
<td width="233" valign="top">Removes the comment syntax from the current line or currently selected lines of code</td>
</tr>
<tr>
<td width="212" valign="top">Ctl + J</td>
<td width="233" valign="top">Lists members for statement completion when editing code</td>
</tr>
<tr>
<td width="212" valign="top">Ctrl + R, Ctrl + W</td>
<td width="233" valign="top">Shows or hides spaces and tab marks</td>
</tr>
<tr>
<td width="212" valign="top">Shift-Left Arrow</td>
<td width="233" valign="top">Moves the cursor to the left one character, extending the selection</td>
</tr>
<tr>
<td width="212" valign="top">Ctrl + Shift + End</td>
<td width="233" valign="top">Moves the cursor to the end of the document, extending the selection</td>
</tr>
<tr>
<td width="212" valign="top">Ctrl + Shift + Home</td>
<td width="233" valign="top">Moves the cursor to the start of the document, extending the selection</td>
</tr>
<tr>
<td width="212" valign="top">Shift + Down Arrow</td>
<td width="233" valign="top">Moves the cursor down one line, extending the selection</td>
</tr>
<tr>
<td width="212" valign="top">Shift + End</td>
<td width="233" valign="top">Moves the cursor to the end of the current line, extending the selection</td>
</tr>
<tr>
<td width="212" valign="top">Shift + Home</td>
<td width="233" valign="top">Moves the cursor to the start of the line, extending the selection</td>
</tr>
<tr>
<td width="212" valign="top">Shift + Up Arrow</td>
<td width="233" valign="top">Moves the cursor up one line, extending the selection</td>
</tr>
<tr>
<td width="212" valign="top">Shift + Page Down</td>
<td width="233" valign="top">Extends selection down one page</td>
</tr>
<tr>
<td width="212" valign="top">Shift + Page Up</td>
<td width="233" valign="top">Extends selection up one page</td>
</tr>
<tr>
<td width="212" valign="top">Ctrl + A</td>
<td width="233" valign="top">Selects everything in the current document</td>
</tr>
<tr>
<td width="212" valign="top">Ctrl + Shift + Page Down</td>
<td width="233" valign="top">Moves the cursor to the last line in view, extending the selection</td>
</tr>
<tr>
<td width="212" valign="top">Ctrl + Shift + Page Up</td>
<td width="233" valign="top">Moves the cursor to the top of the current window,</td>
</tr>
<tr>
<td width="212" valign="top">Ctrl + Shift + Alt + Right Arrow</td>
<td width="233" valign="top">Moves the cursor to the right one word, extending the column selection</td>
</tr>
<tr>
<td width="212" valign="top">Ctrl + Shift + Left + Arrow</td>
<td width="233" valign="top">Moves the cursor one word to the left, extending the selection</td>
</tr>
<tr>
<td width="212" valign="top">Ctrl + Shift + B</td>
<td width="233" valign="top">Build the solution</td>
</tr>
<tr>
<td width="212" valign="top">Ctrl + Shift + N</td>
<td width="233" valign="top">Display the New Project dialog</td>
</tr>
<tr>
<td width="212" valign="top">Ctrl + O</td>
<td width="233" valign="top">Display open the file dialog</td>
</tr>
<tr>
<td width="212" valign="top">Ctrl + Shift + O</td>
<td width="233" valign="top">Display open project dialog</td>
</tr>
<tr>
<td width="212" valign="top">Shift + Alt + A</td>
<td width="233" valign="top">Display the Add Existing Item dialog</td>
</tr>
<tr>
<td width="212" valign="top">Ctrl + Shift + A</td>
<td width="233" valign="top">Display the Add New Item dialog</td>
</tr>
<tr>
<td width="212" valign="top">Shift + Alt + Enter</td>
<td width="233" valign="top">Toggles full screen mode</td>
</tr>
<tr>
<td width="212" valign="top">Ctrl + Tab</td>
<td width="233" valign="top">Cycles through the MDI child windows one by one</td>
</tr>
<tr>
<td width="212" valign="top">Ctrl + F</td>
<td width="233" valign="top">Display the Find dialog</td>
</tr>
<tr>
<td width="212" valign="top">Ctrl + Shift + F</td>
<td width="233" valign="top">Display the Find in Files dialog</td>
</tr>
<tr>
<td width="212" valign="top">F3</td>
<td width="233" valign="top">Find Next</td>
</tr>
<tr>
<td width="212" valign="top">Ctrl + H</td>
<td width="233" valign="top">Display the Replace dialog</td>
</tr>
<tr>
<td width="212" valign="top">Ctrl + Shift + H</td>
<td width="233" valign="top">Display the Replace in Files dialog</td>
</tr>
</tbody>
</table>
<p><a name="basicpc"><br />
</a></p>
<h3><a name="basicpc">Basic Windows shortcut keys</a></h3>
<table border="1" cellspacing="0" cellpadding="2" width="446">
<tbody>
<tr>
<td width="203" valign="top">Shortcut Keys</td>
<td width="241" valign="top">Description</td>
</tr>
<tr>
<td width="205" valign="top">Alt+F</td>
<td width="241" valign="top">File menu options in current program.</td>
</tr>
<tr>
<td width="206" valign="top">Alt+E</td>
<td width="241" valign="top">Edit options in current program</td>
</tr>
<tr>
<td width="207" valign="top">F1</td>
<td width="241" valign="top">Universal Help in almost every Windows program.</td>
</tr>
<tr>
<td width="208" valign="top">Ctrl+A</td>
<td width="241" valign="top">Select all text.</td>
</tr>
<tr>
<td width="208" valign="top">Ctrl+X</td>
<td width="241" valign="top">Cut selected item.</td>
</tr>
<tr>
<td width="208" valign="top">Shift+Del</td>
<td width="241" valign="top">Cut selected item.</td>
</tr>
<tr>
<td width="208" valign="top">Ctrl+C</td>
<td width="241" valign="top">Copy selected item.</td>
</tr>
<tr>
<td width="208" valign="top">Ctrl+Ins</td>
<td width="241" valign="top">Copy selected item</td>
</tr>
<tr>
<td width="208" valign="top">Ctrl+V</td>
<td width="241" valign="top">Paste</td>
</tr>
<tr>
<td width="208" valign="top">Shift+Ins</td>
<td width="241" valign="top">Paste</td>
</tr>
<tr>
<td width="208" valign="top">Home</td>
<td width="241" valign="top">Goes to beginning of current line.</td>
</tr>
<tr>
<td width="208" valign="top">Ctrl+Home</td>
<td width="241" valign="top">Goes to beginning of document.</td>
</tr>
<tr>
<td width="208" valign="top">End</td>
<td width="241" valign="top">Goes to end of current line.</td>
</tr>
<tr>
<td width="208" valign="top">Ctrl+End</td>
<td width="241" valign="top">Goes to end of document.</td>
</tr>
<tr>
<td width="208" valign="top">Shift+Home</td>
<td width="241" valign="top">Highlights from current position to beginning of line.</td>
</tr>
<tr>
<td width="208" valign="top">Shift+End</td>
<td width="241" valign="top">Highlights from current position to end of line.</td>
</tr>
<tr>
<td width="208" valign="top">Ctrl+Left arrow</td>
<td width="241" valign="top">Moves one word to the left at a time.</td>
</tr>
<tr>
<td width="208" valign="top">Ctrl+Right arrow</td>
<td width="241" valign="top">Moves one word to the right at a time.</td>
</tr>
<tr>
<td width="208" valign="top">Alt+Tab</td>
<td width="241" valign="top">Switch between open applications.</td>
</tr>
<tr>
<td width="208" valign="top">Alt+Shift+Tab</td>
<td width="241" valign="top">Switch backwards between open applications.</td>
</tr>
<tr>
<td width="208" valign="top">Alt+double-click</td>
<td width="241" valign="top">Display the properties of the object you double-click on.</td>
</tr>
<tr>
<td width="208" valign="top">Ctrl+Tab</td>
<td width="241" valign="top">Switches between program groups or document windows in applications</td>
</tr>
<tr>
<td width="208" valign="top">Ctrl+Shift+Tab</td>
<td width="241" valign="top">Same as above but backwards.</td>
</tr>
<tr>
<td width="208" valign="top">Alt+Print Screen</td>
<td width="241" valign="top">Create a screen shot only for the program you are currently in.</td>
</tr>
<tr>
<td width="208" valign="top">Ctrl+Alt+Del</td>
<td width="241" valign="top">Reboot the computer and/or bring up the Windows task manager.</td>
</tr>
<tr>
<td width="208" valign="top">Ctrl+Esc</td>
<td width="241" valign="top">Bring up the Windows Start menu.</td>
</tr>
<tr>
<td width="208" valign="top">Alt+Esc</td>
<td width="241" valign="top">Switch Between open applications on taskbar.</td>
</tr>
<tr>
<td width="208" valign="top">Alt+F4</td>
<td width="241" valign="top">Closes Current open program.</td>
</tr>
<tr>
<td width="208" valign="top">Ctrl+F4</td>
<td width="241" valign="top">Closes Window in Program.</td>
</tr>
<tr>
<td width="208" valign="top">Shift + Del</td>
<td width="241" valign="top">Delete programs/files without throwing them into the recycle bin.</td>
</tr>
<tr>
<td width="208" valign="top">Holding Shift</td>
<td width="241" valign="top">Boot Safe Mode or by pass system files as the computer is booting</td>
</tr>
<tr>
<td width="208" valign="top">Holding Shift</td>
<td width="241" valign="top">When putting in an audio CD, will prevent CD Player from playing.</td>
</tr>
<tr>
<td width="208" valign="top">Ctrl+F9</td>
<td width="241" valign="top">Minimize current window.</td>
</tr>
<tr>
<td width="208" valign="top">Ctrl+F10</td>
<td width="241" valign="top">Maximize currently selected window.</td>
</tr>
<tr>
<td width="208" valign="top">Windows Logo</td>
<td width="241" valign="top">Start menu</td>
</tr>
<tr>
<td width="208" valign="top">Windows Logo+R</td>
<td width="241" valign="top">Run dialog box</td>
</tr>
<tr>
<td width="208" valign="top">Windows Logo+M</td>
<td width="241" valign="top">Minimize all</td>
</tr>
<tr>
<td width="208" valign="top">SHIFT+Windows Logo+M</td>
<td width="241" valign="top">Undo minimize all</td>
</tr>
<tr>
<td width="208" valign="top">Windows Logo+F1</td>
<td width="241" valign="top">Help</td>
</tr>
<tr>
<td width="208" valign="top">Windows Logo+E</td>
<td width="241" valign="top">Windows Explorer</td>
</tr>
<tr>
<td width="208" valign="top">Windows Logo+F</td>
<td width="241" valign="top">Find files or folders</td>
</tr>
<tr>
<td width="208" valign="top">Windows Logo+D</td>
<td width="241" valign="top">Minimizes all open windows and displays the desktop</td>
</tr>
<tr>
<td width="208" valign="top">CTRL+Windows Logo+F</td>
<td width="241" valign="top">Find computer</td>
</tr>
<tr>
<td width="208" valign="top">CTRL+Windows Logo+TAB</td>
<td width="241" valign="top">Moves focus from Start, to the Quick Launch toolbar, to the system tray</td>
</tr>
<tr>
<td width="208" valign="top">Windows Logo+TAB</td>
<td width="241" valign="top">Cycle through taskbar buttons</td>
</tr>
<tr>
<td width="208" valign="top">Windows Logo+Break</td>
<td width="241" valign="top">System Properties dialog box</td>
</tr>
<tr>
<td width="208" valign="top">Windows Logo+L</td>
<td width="241" valign="top">Log off Windows</td>
</tr>
<tr>
<td width="208" valign="top">Windows Logo+P</td>
<td width="241" valign="top">Starts Print Manager</td>
</tr>
<tr>
<td width="208" valign="top">Windows Logo+C</td>
<td width="241" valign="top">Opens Control Panel</td>
</tr>
<tr>
<td width="208" valign="top">Windows Logo+V</td>
<td width="241" valign="top">Starts Clipboard</td>
</tr>
<tr>
<td width="208" valign="top">Windows Logo+R</td>
<td width="241" valign="top">Open and Run Window</td>
</tr>
</tbody>
</table>
<p><a name="webcommon"><br />
</a></p>
<h3><a name="webcommon">Web Browser common shortcut Keys</a></h3>
<table border="1" cellspacing="0" cellpadding="2" width="450">
<tbody>
<tr>
<td width="202" valign="top">Shortcut Key</td>
<td width="246" valign="top">Description</td>
</tr>
<tr>
<td width="203" valign="top">Ctrl + N</td>
<td width="246" valign="top">Open a new window</td>
</tr>
<tr>
<td width="203" valign="top">Ctrl + T</td>
<td width="246" valign="top">Open a new tab</td>
</tr>
<tr>
<td width="203" valign="top">Ctrl + W</td>
<td width="246" valign="top">Close the current window</td>
</tr>
<tr>
<td width="203" valign="top">Ctrl + R</td>
<td width="246" valign="top">Refresh</td>
</tr>
<tr>
<td width="203" valign="top">Esc</td>
<td width="246" valign="top">Stop</td>
</tr>
<tr>
<td width="203" valign="top">Alt + &lt;-</td>
<td width="246" valign="top">Back</td>
</tr>
<tr>
<td width="203" valign="top">Alt + -&gt;</td>
<td width="246" valign="top">Forward</td>
</tr>
<tr>
<td width="203" valign="top">Alt + Home</td>
<td width="246" valign="top">Go to your homepage</td>
</tr>
<tr>
<td width="203" valign="top">Alt + D</td>
<td width="246" valign="top">Move focus to the address bar to type URL</td>
</tr>
<tr>
<td width="203" valign="top">Ctrl + Enter</td>
<td width="246" valign="top">Add &#8220;<a href="http://www.&quot;">http://www.&#8221;</a> and &#8220;.com&#8221; around an address</td>
</tr>
</tbody>
</table>
<p><a name="firefox"><br />
</a></p>
<h3><a name="firefox">Mozilla Firefox shortcut Keys</a></h3>
<table border="1" cellspacing="0" cellpadding="2" width="457">
<tbody>
<tr>
<td width="200" valign="top">Shortcut Keys</td>
<td width="255" valign="top">Description</td>
</tr>
<tr>
<td width="197" valign="top">Alt + Home</td>
<td width="258" valign="top">Home</td>
</tr>
<tr>
<td width="195" valign="top">Alt + Left Arrow</td>
<td width="260" valign="top">Back a page.</td>
</tr>
<tr>
<td width="194" valign="top">Backspace</td>
<td width="261" valign="top">Back a page.</td>
</tr>
<tr>
<td width="193" valign="top">Alt + Right Arrow</td>
<td width="262" valign="top">Forward a page.</td>
</tr>
<tr>
<td width="192" valign="top">F5</td>
<td width="263" valign="top">Refresh current page, frame, or tab.</td>
</tr>
<tr>
<td width="192" valign="top">F11</td>
<td width="263" valign="top">Display the current website in full screen mode. Pressing F11 again will exit this mode.</td>
</tr>
<tr>
<td width="192" valign="top">F3</td>
<td width="263" valign="top">Find Again</td>
</tr>
<tr>
<td width="192" valign="top">Esc</td>
<td width="263" valign="top">Stop page or download from loading.</td>
</tr>
<tr>
<td width="192" valign="top">Ctrl + (- or +)</td>
<td width="263" valign="top">Increase or decrease the font size, pressing &#8216;-&#8217; will decrease and &#8216;+&#8217; will increase.</td>
</tr>
<tr>
<td width="192" valign="top">Ctrl + Enter</td>
<td width="263" valign="top">Quickly complete an address. For example, type computerhope in the address bar and press CTRL + ENTER to get http://www.computerhope.com</td>
</tr>
<tr>
<td width="192" valign="top">Shift + Enter</td>
<td width="263" valign="top">Complete a .net instead of a .com address.</td>
</tr>
<tr>
<td width="192" valign="top">Ctrl + Shift + Enter</td>
<td width="263" valign="top">Complete a .org address.</td>
</tr>
<tr>
<td width="192" valign="top">Ctrl + Shift + Del</td>
<td width="263" valign="top">Open the Clear Data window to quickly clear private data.</td>
</tr>
<tr>
<td width="192" valign="top">Ctrl + W</td>
<td width="263" valign="top">Close the current window or tab</td>
</tr>
<tr>
<td width="192" valign="top">Ctrl + D</td>
<td width="263" valign="top">Add a bookmark for the page currentlys opened.</td>
</tr>
<tr>
<td width="192" valign="top">Ctrl + I</td>
<td width="263" valign="top">Display available bookmarks.</td>
</tr>
<tr>
<td width="192" valign="top">Ctrl + J</td>
<td width="263" valign="top">Display the download window.</td>
</tr>
<tr>
<td width="192" valign="top">Ctrl + N</td>
<td width="263" valign="top">Open New browser window.</td>
</tr>
<tr>
<td width="192" valign="top">Ctrl + P</td>
<td width="263" valign="top">Print current page / frame.</td>
</tr>
<tr>
<td width="192" valign="top">Ctrl + T</td>
<td width="263" valign="top">Opens a new tab.</td>
</tr>
<tr>
<td width="192" valign="top">Ctrl + F4</td>
<td width="263" valign="top">Closes the currently selected tab.</td>
</tr>
<tr>
<td width="192" valign="top">Ctrl + Shift + T</td>
<td width="263" valign="top">Undo the close of a window.</td>
</tr>
<tr>
<td width="192" valign="top">Ctrl + Tab</td>
<td width="263" valign="top">Moves through each of the open tabs.</td>
</tr>
<tr>
<td width="192" valign="top">Ctrl + Shift + Tab</td>
<td width="263" valign="top">Swich to the previous tab</td>
</tr>
<tr>
<td width="192" valign="top">Ctrl + G</td>
<td width="263" valign="top">Find the previous occurrence of a search phrase</td>
</tr>
<tr>
<td width="192" valign="top">Ctrl + K</td>
<td width="263" valign="top">Move cursor to the Web Search Widget (top right of the screen)</td>
</tr>
<tr>
<td width="192" valign="top">Spacebar</td>
<td width="263" valign="top">Moves down a page at a time.</td>
</tr>
<tr>
<td width="192" valign="top">Shift + Spacebar</td>
<td width="263" valign="top">Moves up a page at a time.</td>
</tr>
<tr>
<td width="192" valign="top">Alt + Down arrow</td>
<td width="263" valign="top">Display all previous text entered in a text box and/or available options on drop down menu.</td>
</tr>
</tbody>
</table>
<p><a name="ie"><br />
</a></p>
<h3><a name="ie">Internet Explorer Shortcut</a></h3>
<table border="1" cellspacing="0" cellpadding="1" width="454">
<tbody>
<tr>
<td width="190" valign="top">Shortcut Keys</td>
<td width="262" valign="top">Description</td>
</tr>
<tr>
<td width="188" valign="top">Alt + Left Arrow</td>
<td width="264" valign="top">Back a page</td>
</tr>
<tr>
<td width="187" valign="top">Backspace</td>
<td width="265" valign="top">Back a page</td>
</tr>
<tr>
<td width="186" valign="top">Alt + Right Arrow</td>
<td width="266" valign="top">Forward a page.</td>
</tr>
<tr>
<td width="185" valign="top">F5</td>
<td width="267" valign="top">Refresh current page, frame, or tab.</td>
</tr>
<tr>
<td width="185" valign="top">F11</td>
<td width="267" valign="top">Display the current website in full screen mode</td>
</tr>
<tr>
<td width="185" valign="top">Esc</td>
<td width="267" valign="top">Stop page or download from loading.</td>
</tr>
<tr>
<td width="185" valign="top">Ctrl + (- or +)</td>
<td width="267" valign="top">Increase or decrease the font size, pressing &#8216;-&#8217; will decrease and &#8216;+&#8217; will increase.</td>
</tr>
<tr>
<td width="185" valign="top">Ctrl + Enter</td>
<td width="267" valign="top">Quickly complete an address. For example, type computerhope in the address bar and press CTRL + ENTER to get http://www.computerhope.com.</td>
</tr>
<tr>
<td width="185" valign="top">Ctrl + D</td>
<td width="267" valign="top">Add a Favorite for the page currently opened.</td>
</tr>
<tr>
<td width="185" valign="top">Ctrl + I</td>
<td width="267" valign="top">Display available bookmarks.</td>
</tr>
<tr>
<td width="185" valign="top">Ctrl + N</td>
<td width="267" valign="top">Open New browser window.</td>
</tr>
<tr>
<td width="185" valign="top">Ctrl + P</td>
<td width="267" valign="top">Print current page / frame.</td>
</tr>
<tr>
<td width="185" valign="top">Ctrl + T</td>
<td width="267" valign="top">Opens a new tab.</td>
</tr>
<tr>
<td width="185" valign="top">Ctrl + F4</td>
<td width="267" valign="top">Closes the currently selected tab.</td>
</tr>
<tr>
<td width="185" valign="top">Ctrl + Tab</td>
<td width="267" valign="top">Moves through each of the open tabs.</td>
</tr>
<tr>
<td width="185" valign="top">Spacebar</td>
<td width="267" valign="top">Moves down a page at a time.</td>
</tr>
<tr>
<td width="185" valign="top">Shift + Spacebar</td>
<td width="267" valign="top">Moves up a page at a time.</td>
</tr>
<tr>
<td width="185" valign="top">Alt + Down arrow</td>
<td width="267" valign="top">Display all previous text entered in a text box and/or available options on drop down menu.</td>
</tr>
</tbody>
</table>
<p><a name="excel"></a></p>
<h3><a name="excel">Microsoft Excel</a></h3>
<table border="1" cellspacing="0" cellpadding="1" width="453">
<tbody>
<tr>
<td width="186" valign="top">Shortcut Keys</td>
<td width="265" valign="top">Description</td>
</tr>
<tr>
<td width="186" valign="top">F2</td>
<td width="265" valign="top">Edit the selected cell.</td>
</tr>
<tr>
<td width="186" valign="top">F5</td>
<td width="265" valign="top">Goto a specific cell. For example, C6.</td>
</tr>
<tr>
<td width="186" valign="top">F7</td>
<td width="265" valign="top">Spell check selected text and/or document.</td>
</tr>
<tr>
<td width="186" valign="top">F11</td>
<td width="265" valign="top">Create chart.</td>
</tr>
<tr>
<td width="186" valign="top">Ctrl + Shift + ;</td>
<td width="265" valign="top">Enter the current time.</td>
</tr>
<tr>
<td width="186" valign="top">Ctrl + ;</td>
<td width="265" valign="top">Enter the current date.</td>
</tr>
<tr>
<td width="186" valign="top">Alt + Shift + F1</td>
<td width="265" valign="top">Insert New Worksheet.</td>
</tr>
<tr>
<td width="186" valign="top">Shift + F3</td>
<td width="265" valign="top">Open the Excel formula window.</td>
</tr>
<tr>
<td width="186" valign="top">Shift + F5</td>
<td width="265" valign="top">Bring up search box.</td>
</tr>
<tr>
<td width="186" valign="top">Ctrl + A</td>
<td width="265" valign="top">Select all contents of the worksheet.</td>
</tr>
<tr>
<td width="186" valign="top">Ctrl + B</td>
<td width="265" valign="top">Bold highlighted selection.</td>
</tr>
<tr>
<td width="186" valign="top">Ctrl + I</td>
<td width="265" valign="top">Italic highlighted selection.</td>
</tr>
<tr>
<td width="186" valign="top">Ctrl + K</td>
<td width="265" valign="top">Insert link.</td>
</tr>
<tr>
<td width="186" valign="top">Ctrl + U</td>
<td width="265" valign="top">Underline highlighted selection.</td>
</tr>
<tr>
<td width="186" valign="top">Ctrl + 5</td>
<td width="265" valign="top">Strikethrough highlighted selection.</td>
</tr>
<tr>
<td width="186" valign="top">Ctrl + P</td>
<td width="265" valign="top">Bring up the print dialog box to begin printing.</td>
</tr>
<tr>
<td width="186" valign="top">Ctrl + Z</td>
<td width="265" valign="top">Undo last action.</td>
</tr>
<tr>
<td width="186" valign="top">Ctrl + F6</td>
<td width="265" valign="top">Switch between open workbooks / windows.</td>
</tr>
<tr>
<td width="186" valign="top">Ctrl + Page up</td>
<td width="265" valign="top">Move between Excel work sheets in the same Excel document.</td>
</tr>
<tr>
<td width="186" valign="top">Ctrl + Page down</td>
<td width="265" valign="top">Move between Excel work sheets in the same Excel document.</td>
</tr>
<tr>
<td width="186" valign="top">Ctrl + Tab</td>
<td width="265" valign="top">Move between Two or more open Excel files.</td>
</tr>
<tr>
<td width="186" valign="top">Alt + =</td>
<td width="265" valign="top">Create a formula to sum all of the above cells</td>
</tr>
<tr>
<td width="186" valign="top">Ctrl + &#8216;</td>
<td width="265" valign="top">Insert the value of the above cell into cell currently selected.</td>
</tr>
<tr>
<td width="186" valign="top">Ctrl + Shift + !</td>
<td width="265" valign="top">Format number in comma format.</td>
</tr>
<tr>
<td width="186" valign="top">Ctrl + Shift + $</td>
<td width="265" valign="top">Format number in currency format.</td>
</tr>
<tr>
<td width="186" valign="top">Ctrl + Shift + #</td>
<td width="265" valign="top">Format number in date format.</td>
</tr>
<tr>
<td width="186" valign="top">Ctrl + Shift + %</td>
<td width="265" valign="top">Format number in percentage format.</td>
</tr>
<tr>
<td width="186" valign="top">Ctrl + Shift + ^</td>
<td width="265" valign="top">Format number in scientific format.</td>
</tr>
<tr>
<td width="186" valign="top">Ctrl + Shift + @</td>
<td width="265" valign="top">Format number in time format.</td>
</tr>
<tr>
<td width="186" valign="top">Ctrl + Arrow key</td>
<td width="265" valign="top">Move to next section of text.</td>
</tr>
<tr>
<td width="186" valign="top">Ctrl + Space</td>
<td width="265" valign="top">Select entire column.</td>
</tr>
<tr>
<td width="186" valign="top">Shift + Space</td>
<td width="265" valign="top">Select entire row.</td>
</tr>
</tbody>
</table>
<h3><a name="word">Microsoft Word</a></h3>
<table border="1" cellspacing="0" cellpadding="1" width="455">
<tbody>
<tr>
<td width="188" valign="top">Shortcut Keys</td>
<td width="265" valign="top">Description</td>
</tr>
<tr>
<td width="188" valign="top">Ctrl + A</td>
<td width="265" valign="top">Select all contents of the page.</td>
</tr>
<tr>
<td width="188" valign="top">Ctrl + B</td>
<td width="265" valign="top">Bold highlighted selection.</td>
</tr>
<tr>
<td width="188" valign="top">Ctrl + C</td>
<td width="265" valign="top">Copy selected text.</td>
</tr>
<tr>
<td width="188" valign="top">Ctrl + X</td>
<td width="265" valign="top">Cut selected text.</td>
</tr>
<tr>
<td width="188" valign="top">Ctrl + P</td>
<td width="265" valign="top">Open the print window.</td>
</tr>
<tr>
<td width="188" valign="top">Ctrl + F</td>
<td width="265" valign="top">Open find box.</td>
</tr>
<tr>
<td width="188" valign="top">Ctrl + I</td>
<td width="265" valign="top">Italic highlighted selection.</td>
</tr>
<tr>
<td width="188" valign="top">Ctrl + K</td>
<td width="265" valign="top">Insert link.</td>
</tr>
<tr>
<td width="188" valign="top">Ctrl + U</td>
<td width="265" valign="top">Underline highlighted selection.</td>
</tr>
<tr>
<td width="188" valign="top">Ctrl + V</td>
<td width="265" valign="top">Paste.</td>
</tr>
<tr>
<td width="188" valign="top">Ctrl + Y</td>
<td width="265" valign="top">Redo the last action performed.</td>
</tr>
<tr>
<td width="188" valign="top">Ctrl + Z</td>
<td width="265" valign="top">Undo last action.</td>
</tr>
</tbody>
</table>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/liangwu.wordpress.com/77/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/liangwu.wordpress.com/77/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/liangwu.wordpress.com/77/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/liangwu.wordpress.com/77/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/liangwu.wordpress.com/77/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/liangwu.wordpress.com/77/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/liangwu.wordpress.com/77/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/liangwu.wordpress.com/77/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/liangwu.wordpress.com/77/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/liangwu.wordpress.com/77/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/liangwu.wordpress.com/77/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/liangwu.wordpress.com/77/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/liangwu.wordpress.com/77/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/liangwu.wordpress.com/77/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=liangwu.wordpress.com&amp;blog=807949&amp;post=77&amp;subd=liangwu&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://liangwu.wordpress.com/2009/04/24/really-useful-windows-shortcuts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/ef7572a12f8c9796fc7d604d6bd0476a?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">liangwu</media:title>
		</media:content>

		<media:content url="http://liangwu.files.wordpress.com/2009/05/keyboard_thumb.jpg" medium="image">
			<media:title type="html">Keyboard</media:title>
		</media:content>
	</item>
		<item>
		<title>Functional programming in C# 3.0 &#8211; (1)</title>
		<link>http://liangwu.wordpress.com/2008/01/22/functional-programming-in-c-3-0-1/</link>
		<comments>http://liangwu.wordpress.com/2008/01/22/functional-programming-in-c-3-0-1/#comments</comments>
		<pubDate>Tue, 22 Jan 2008 20:30:50 +0000</pubDate>
		<dc:creator>liangwu</dc:creator>
				<category><![CDATA[C#]]></category>

		<guid isPermaLink="false">http://liangwu.wordpress.com/?p=66</guid>
		<description><![CDATA[I had a lot of fun to read Tomas Petricek&#8217;s article, &#34;Concepts behind the C# 3.0 language&#34;. Instead of listing all of the new syntax changes as most of other tutorials, Tomas shed some lights on the details about influence of the development of C# 3.0 from other languages, especially how Functional programming plays in [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=liangwu.wordpress.com&amp;blog=807949&amp;post=66&amp;subd=liangwu&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I had a lot of fun to read Tomas Petricek&#8217;s article, &quot;<a href="http://tomasp.net/blog/csharp3-concepts.aspx">Concepts behind the C# 3.0 language</a>&quot;. Instead of listing all of the new syntax changes as most of other tutorials, Tomas shed some lights on the details about influence of the development of C# 3.0 from other languages, especially how Functional programming plays in C# 3.0. Actually, Lambda Expression and LINQ are really part of that.</p>
<p>So what is functional programming? Quote from Wikipedia:</p>
<p>&quot;<b>Functional programming</b> is a <a href="http://en.wikipedia.org/wiki/Programming_paradigm">programming paradigm</a> that treats <a href="http://en.wikipedia.org/wiki/Computation">computation</a> as the evaluation of <a href="http://en.wikipedia.org/wiki/Function_%28mathematics%29">mathematical functions</a> and avoids <a href="http://en.wikipedia.org/wiki/Program_state">state</a> and <a href="http://en.wikipedia.org/wiki/Immutable_object">mutable</a> data. It emphasizes the application of functions, in contrast with the <a href="http://en.wikipedia.org/wiki/Imperative_programming">imperative programming</a> style that emphasizes changes in state.<sup><a href="http://en.wikipedia.org/wiki/Functional_programming#_note-0">[1]</a> </sup>&quot;</p>
<p>So what it really tells us? I think the main point is &quot;function is data&quot; which means function can be use to be passed as an parameter or returned argument or modified as any other data in our application. Do we gain benefit for that? Sure, we do.</p>
<p>1. Functional programming can help model data operation. Here is the sample:</p>
<div class="wlWriterSmartContent" style="display:inline;float:none;width:528px;margin:0;padding:0;">
<pre style="font-size:11px;overflow:auto;font-family:consolas;background-color:white;">
<div><span style="color:#008080;">1</span> <span style="color:#0000ff;">private</span><span style="color:#000000;"> </span><span style="color:#0000ff;">static</span><span style="color:#000000;"> </span><span style="color:#0000ff;">long</span><span style="color:#000000;"> Watch</span><span style="color:#000000;">&lt;</span><span style="color:#000000;">T</span><span style="color:#000000;">&gt;</span><span style="color:#000000;">(Action</span><span style="color:#000000;">&lt;</span><span style="color:#000000;">T</span><span style="color:#000000;">&gt;</span><span style="color:#000000;"> act, T arg)
</span><span style="color:#008080;">2</span> <span style="color:#000000;">{
</span><span style="color:#008080;">3</span> <span style="color:#000000;">        Stopwatch watch </span><span style="color:#000000;">=</span><span style="color:#000000;"> </span><span style="color:#0000ff;">new</span><span style="color:#000000;"> Stopwatch();
</span><span style="color:#008080;">4</span> <span style="color:#000000;">        watch.Start();
</span><span style="color:#008080;">5</span> <span style="color:#000000;">        act(arg);
</span><span style="color:#008080;">6</span> <span style="color:#000000;">        watch.Stop();
</span><span style="color:#008080;">7</span> <span style="color:#000000;">        </span><span style="color:#0000ff;">return</span><span style="color:#000000;"> watch.ElapsedMilliseconds;
</span><span style="color:#008080;">8</span> <span style="color:#000000;">}</span></div>
</pre>
<p><!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --></p>
</div>
<p>This Watch function is totally decoupled with the Action, which could be &quot;reading the data from database&quot;, or &quot;processing the data from a file&quot;. It leads a clean design that Watch function and the Action function can be tested separately.</p>
<p>2. Parallel programming. If you have been worked on Multi-thread programming. You know how hard it is. The limitation of imperative language like C# focuses on the state change. But functional programming is passing function as argument as we mentioned above. The state actually is only closed in the function boundary. So there is no other thread can access that data. Microsoft has released <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=e848dc1d-5be3-4941-8705-024bc7f180ba&amp;displaylang=en">PLINQ</a>, a parallel programming add-on to current .NET framework 3.5. It will be a huge benefit for any .NET who will take advantage of multi-processor computers.</p>
<p>So far, so good, right? from next one, I will illustrate the functional programming features in C# 3.0. Definitely will show more code. Please stay tune.</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/liangwu.wordpress.com/66/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/liangwu.wordpress.com/66/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/liangwu.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/liangwu.wordpress.com/66/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/liangwu.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/liangwu.wordpress.com/66/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/liangwu.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/liangwu.wordpress.com/66/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/liangwu.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/liangwu.wordpress.com/66/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/liangwu.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/liangwu.wordpress.com/66/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/liangwu.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/liangwu.wordpress.com/66/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/liangwu.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/liangwu.wordpress.com/66/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=liangwu.wordpress.com&amp;blog=807949&amp;post=66&amp;subd=liangwu&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://liangwu.wordpress.com/2008/01/22/functional-programming-in-c-3-0-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/ef7572a12f8c9796fc7d604d6bd0476a?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">liangwu</media:title>
		</media:content>
	</item>
		<item>
		<title>Create DTO with NHibernate</title>
		<link>http://liangwu.wordpress.com/2007/03/13/create-dto-with-nhibernate/</link>
		<comments>http://liangwu.wordpress.com/2007/03/13/create-dto-with-nhibernate/#comments</comments>
		<pubDate>Tue, 13 Mar 2007 15:16:37 +0000</pubDate>
		<dc:creator>liangwu</dc:creator>
				<category><![CDATA[DDD]]></category>
		<category><![CDATA[NHibernate]]></category>

		<guid isPermaLink="false">http://liangwu.wordpress.com/2007/03/13/create-dto-with-nhibernate/</guid>
		<description><![CDATA[My previous blog is about using DTO in UI/Presenter layers. Just studying Nhibernate source code now, I find a very interesting approach to populate DTO object directly from Nhibernate with Criteria and Projections. Here is the code: 1: IList resultWithAliasedBean = s.CreateCriteria(typeof(Enrolment)) 2: .CreateAlias("Student", "st") 3: .CreateAlias("Course", "co") 4: .SetProjection(Projections.ProjectionList() 5: .Add(Projections.Property("st.Name"), "studentName") 6: .Add(Projections.Property("co.Description"), [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=liangwu.wordpress.com&amp;blog=807949&amp;post=19&amp;subd=liangwu&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>My <a href="http://liangwu.wordpress.com/2007/02/13/dto-data-transfer-object-in-domain-driven-design/?csspreview=true">previous blog</a> is about using DTO in UI/Presenter layers. Just studying Nhibernate source code now, I find a very interesting approach to populate DTO object directly from Nhibernate with Criteria and Projections.<br />
Here is the code:</p>
<div class="csharpcode">
<pre><span class="lnum">   1:  </span>IList resultWithAliasedBean = s.CreateCriteria(<span class="kwrd">typeof</span>(Enrolment))</pre>
<pre><span class="lnum">   2:  </span> .CreateAlias(<span class="str">"Student"</span>, <span class="str">"st"</span>)</pre>
<pre><span class="lnum">   3:  </span> .CreateAlias(<span class="str">"Course"</span>, <span class="str">"co"</span>)</pre>
<pre><span class="lnum">   4:  </span> .SetProjection(Projections.ProjectionList()</pre>
<pre><span class="lnum">   5:  </span> .Add(Projections.Property(<span class="str">"st.Name"</span>), <span class="str">"studentName"</span>)</pre>
<pre><span class="lnum">   6:  </span> .Add(Projections.Property(<span class="str">"co.Description"</span>), <span class="str">"courseDescription"</span>)</pre>
<pre><span class="lnum">   7:  </span>)</pre>
<pre><span class="lnum">   8:  </span>.AddOrder(Order.Desc(<span class="str">"studentName"</span>))</pre>
<pre><span class="lnum">   9:  </span>.SetResultTransformer(NHibernate.Transform.Transformers
  10.  .AliasToBean(<span class="kwrd">typeof</span>(StudentDTO)))</pre>
<pre><span class="lnum">  11:  </span>.List();</pre>
</div>
<p>The Element and StudentDTO is simple enough.</p>
<div class="csharpcode">
<pre><span class="lnum">   1:  </span>        [Serializable]</pre>
<pre><span class="lnum">   2:  </span>    <span class="kwrd">public</span> <span class="kwrd">class</span> Enrolment</pre>
<pre><span class="lnum">   3:  </span></pre>
<pre><span class="lnum">   4:  </span>        <span class="kwrd">private</span> Student student;</pre>
<pre><span class="lnum">   5:  </span>        <span class="kwrd">public</span> <span class="kwrd">virtual</span> Student Student</pre>
<pre><span class="lnum">   6:  </span>        {</pre>
<pre><span class="lnum">   7:  </span>            get { <span class="kwrd">return</span> student; }</pre>
<pre><span class="lnum">   8:  </span>            set { student = <span class="kwrd">value</span>; }</pre>
<pre><span class="lnum">   9:  </span>        }</pre>
<pre><span class="lnum">  10:  </span></pre>
<pre><span class="lnum">  11:  </span>        <span class="kwrd">private</span> Course course;</pre>
<pre><span class="lnum">  12:  </span>        <span class="kwrd">public</span> <span class="kwrd">virtual</span> Course Course</pre>
<pre><span class="lnum">  13:  </span>        {</pre>
<pre><span class="lnum">  14:  </span>            get { <span class="kwrd">return</span> course; }</pre>
<pre><span class="lnum">  15:  </span>            set { course = <span class="kwrd">value</span>; }</pre>
<pre><span class="lnum">  16:  </span>        }</pre>
<pre><span class="lnum">  17:  </span></pre>
<pre><span class="lnum">  18:  </span>        <span class="kwrd">private</span> <span class="kwrd">long</span> studentNumber;</pre>
<pre><span class="lnum">  19:  </span>        <span class="kwrd">public</span> <span class="kwrd">virtual</span> <span class="kwrd">long</span> StudentNumber</pre>
<pre><span class="lnum">  20:  </span>        {</pre>
<pre><span class="lnum">  21:  </span>            get { <span class="kwrd">return</span> studentNumber; }</pre>
<pre><span class="lnum">  22:  </span>            set { studentNumber = <span class="kwrd">value</span>; }</pre>
<pre><span class="lnum">  23:  </span>        }</pre>
<pre><span class="lnum">  24:  </span></pre>
<pre><span class="lnum">  25:  </span>        <span class="kwrd">private</span> <span class="kwrd">string</span> courseCode = <span class="kwrd">string</span>.Empty;</pre>
<pre><span class="lnum">  26:  </span>        <span class="kwrd">public</span> <span class="kwrd">virtual</span> <span class="kwrd">string</span> CourseCode</pre>
<pre><span class="lnum">  27:  </span>        {</pre>
<pre><span class="lnum">  28:  </span>            get { <span class="kwrd">return</span> courseCode; }</pre>
<pre><span class="lnum">  29:  </span>            set { courseCode = <span class="kwrd">value</span>; }</pre>
<pre><span class="lnum">  30:  </span>        }</pre>
<pre><span class="lnum">  31:  </span></pre>
<pre><span class="lnum">  32:  </span>        <span class="kwrd">private</span> <span class="kwrd">short</span> year;</pre>
<pre><span class="lnum">  33:  </span>        <span class="kwrd">public</span> <span class="kwrd">virtual</span> <span class="kwrd">short</span> Year</pre>
<pre><span class="lnum">  34:  </span>        {</pre>
<pre><span class="lnum">  35:  </span>            get { <span class="kwrd">return</span> year; }</pre>
<pre><span class="lnum">  36:  </span>            set { year = <span class="kwrd">value</span>; }</pre>
<pre><span class="lnum">  37:  </span>        }</pre>
<pre><span class="lnum">  38:  </span></pre>
<pre><span class="lnum">  39:  </span>        <span class="kwrd">private</span> <span class="kwrd">short</span> semester;</pre>
<pre><span class="lnum">  40:  </span>        <span class="kwrd">public</span> <span class="kwrd">virtual</span> <span class="kwrd">short</span> Semester</pre>
<pre><span class="lnum">  41:  </span>        {</pre>
<pre><span class="lnum">  42:  </span>            get { <span class="kwrd">return</span> semester; }</pre>
<pre><span class="lnum">  43:  </span>            set { semester = <span class="kwrd">value</span>; }</pre>
<pre><span class="lnum">  44:  </span>        }</pre>
<pre><span class="lnum">  45:  </span></pre>
<pre><span class="lnum">  46:  </span>        <span class="kwrd">public</span> <span class="kwrd">override</span> <span class="kwrd">bool</span> Equals(<span class="kwrd">object</span> obj)</pre>
<pre><span class="lnum">  47:  </span>        {</pre>
<pre><span class="lnum">  48:  </span>            Enrolment that = obj <span class="kwrd">as</span> Enrolment;</pre>
<pre><span class="lnum">  49:  </span>            <span class="kwrd">if</span> (that == <span class="kwrd">null</span>)</pre>
<pre><span class="lnum">  50:  </span>                <span class="kwrd">return</span> <span class="kwrd">false</span>;</pre>
<pre><span class="lnum">  51:  </span>            <span class="kwrd">return</span> studentNumber == that.StudentNumber &amp;&amp; courseCode.Equals(that.CourseCode);</pre>
<pre><span class="lnum">  52:  </span>        }</pre>
<pre><span class="lnum">  53:  </span></pre>
<pre><span class="lnum">  54:  </span>        <span class="kwrd">public</span> <span class="kwrd">override</span> <span class="kwrd">int</span> GetHashCode()</pre>
<pre><span class="lnum">  55:  </span>        {</pre>
<pre><span class="lnum">  56:  </span>            <span class="kwrd">return</span> courseCode.GetHashCode();</pre>
<pre><span class="lnum">  57:  </span>        }</pre>
<pre><span class="lnum">  58:  </span>    }</pre>
<pre><span class="lnum">  59:  </span><span class="kwrd">public</span> <span class="kwrd">class</span> StudentDTO</pre>
<pre><span class="lnum">  60:  </span>    {</pre>
<pre><span class="lnum">  61:  </span>        <span class="kwrd">private</span> <span class="kwrd">string</span> studentName;</pre>
<pre><span class="lnum">  62:  </span>        <span class="kwrd">private</span> <span class="kwrd">string</span> courseDescription;</pre>
<pre><span class="lnum">  63:  </span></pre>
<pre><span class="lnum">  64:  </span>        <span class="kwrd">public</span> StudentDTO() { }</pre>
<pre><span class="lnum">  65:  </span></pre>
<pre><span class="lnum">  66:  </span>        <span class="kwrd">public</span> <span class="kwrd">string</span> Name</pre>
<pre><span class="lnum">  67:  </span>        {</pre>
<pre><span class="lnum">  68:  </span>            get { <span class="kwrd">return</span> studentName; }</pre>
<pre><span class="lnum">  69:  </span>        }</pre>
<pre><span class="lnum">  70:  </span></pre>
<pre><span class="lnum">  71:  </span>        <span class="kwrd">public</span> <span class="kwrd">string</span> Description</pre>
<pre><span class="lnum">  72:  </span>        {</pre>
<pre><span class="lnum">  73:  </span>            get { <span class="kwrd">return</span> courseDescription; }</pre>
<pre><span class="lnum">  74:  </span>        }</pre>
<pre><span class="lnum">  75:  </span>    }</pre>
</div>
<p>What we can do is to retrieve StudentDTO from Presenter by querying from <a href="http://www.martinfowler.com/eaaCatalog/repository.html">Repository</a>. Code is elegant and beautiful. How sexy NHibernate is!!</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/liangwu.wordpress.com/19/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/liangwu.wordpress.com/19/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/liangwu.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/liangwu.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/liangwu.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/liangwu.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/liangwu.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/liangwu.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/liangwu.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/liangwu.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/liangwu.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/liangwu.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/liangwu.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/liangwu.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/liangwu.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/liangwu.wordpress.com/19/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=liangwu.wordpress.com&amp;blog=807949&amp;post=19&amp;subd=liangwu&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://liangwu.wordpress.com/2007/03/13/create-dto-with-nhibernate/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/ef7572a12f8c9796fc7d604d6bd0476a?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">liangwu</media:title>
		</media:content>
	</item>
		<item>
		<title>DTO (Data Transfer Object) in Domain Driven Design</title>
		<link>http://liangwu.wordpress.com/2007/02/13/dto-data-transfer-object-in-domain-driven-design/</link>
		<comments>http://liangwu.wordpress.com/2007/02/13/dto-data-transfer-object-in-domain-driven-design/#comments</comments>
		<pubDate>Tue, 13 Feb 2007 14:03:21 +0000</pubDate>
		<dc:creator>liangwu</dc:creator>
				<category><![CDATA[Architecture]]></category>
		<category><![CDATA[DDD]]></category>

		<guid isPermaLink="false">http://liangwu.wordpress.com/2007/03/13/dto-data-transfer-object-in-domain-driven-design/</guid>
		<description><![CDATA[DTO (Data Transfer Object)is a very common used pattern in enterprise applications. Martin Fowler also documented it in his class book &#8220;Pattern Enterprise Application Architecture&#8220;. In the meanwhile, DTO is also a very famous &#8220;Anti-Pattern&#8221;. The pure OO purist think DTO is a devil. It is so easy to build. The object become nothing but [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=liangwu.wordpress.com&amp;blog=807949&amp;post=7&amp;subd=liangwu&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>DTO (<a href="http://en.wikipedia.org/wiki/DTO">Data Transfer Object</a>)is a very common used pattern in enterprise applications. Martin Fowler also documented <a href="http://martinfowler.com/eaaCatalog/dataTransferObject.html">it</a> in his class book &#8220;<a onclick="return mugicPopWin(this,event);" oncontextmenu="mugicRightClick(this);" href="http://www.amazon.com/Patterns-Enterprise-Application-Architecture-Martin/dp/0321127420/sr=8-1/qid=1170910861/ref=pd_bbs_sr_1/102-7899207-7706513?ie=UTF8&amp;s=books">Pattern Enterprise Application Architecture</a>&#8220;. In the meanwhile, DTO is also a very famous &#8220;Anti-Pattern&#8221;.  The pure OO purist think DTO is a devil. It is so easy to build. The object become nothing but a simple data container, which represent the data in the tables instead of the real domain objects. The business logic embedded in the application is going to shift from middle domain logic tier to tables, most of time spreaded among the stored procedures, which is leading to a unmaintainable solution.</p>
<p>So should we give up DTO totally in our application design? Absolutely not, in the other end, I find DTO still useful especially in UI and UI process layers. For example, we have a complex searching page to find customer by first name, last name, SSN, address, phone, email, and so on. those information may stay in different domain objects. It is also very hard to design a method with a very long list of parameters, not just ugly but also unmaintainable. My approach is to design DTO object pass data between UI and UI process (Presenter or Controller). Then access the service objects, and domain objects from presenter/controller. So I can design domain entity with the interfere from the special requirement of UI. Again it is important to implement MVP pattern to protect the domain object, which is also one of the important principles I heard from DDD: don&#8217;t leak business logic out of the domain object layer.</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/liangwu.wordpress.com/7/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/liangwu.wordpress.com/7/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/liangwu.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/liangwu.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/liangwu.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/liangwu.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/liangwu.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/liangwu.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/liangwu.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/liangwu.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/liangwu.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/liangwu.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/liangwu.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/liangwu.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/liangwu.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/liangwu.wordpress.com/7/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=liangwu.wordpress.com&amp;blog=807949&amp;post=7&amp;subd=liangwu&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://liangwu.wordpress.com/2007/02/13/dto-data-transfer-object-in-domain-driven-design/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/ef7572a12f8c9796fc7d604d6bd0476a?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">liangwu</media:title>
		</media:content>
	</item>
	</channel>
</rss>
