<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0"><channel><title>Reflections of my thoughts....</title><link>http://codereflect.com</link><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/SharingMyThoughts" /><description>On Windows Programming, Technical Tips etc...</description><language>en</language><lastBuildDate>Tue, 24 Aug 2010 08:05:02 PDT</lastBuildDate><generator>http://wordpress.org/?v=3.0.1</generator><sy:updatePeriod xmlns:sy="http://purl.org/rss/1.0/modules/syndication/">hourly</sy:updatePeriod><sy:updateFrequency xmlns:sy="http://purl.org/rss/1.0/modules/syndication/">1</sy:updateFrequency><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/SharingMyThoughts" /><feedburner:info uri="sharingmythoughts" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><feedburner:emailServiceId>SharingMyThoughts</feedburner:emailServiceId><feedburner:feedburnerHostname>http://feedburner.google.com</feedburner:feedburnerHostname><item><title>Dvorak Simplified Keyboard</title><link>http://feedproxy.google.com/~r/SharingMyThoughts/~3/pcrothvQAoQ/</link><category>Tips</category><category>dvorak</category><category>keyboard</category><category>qwerty</category><category>typewriter</category><category>typist</category><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Sarath</dc:creator><pubDate>Tue, 24 Aug 2010 07:54:53 PDT</pubDate><guid isPermaLink="false">http://codereflect.com/2010/08/24/dvorak-simplified-keyboard/</guid><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[<div class="tw_button" style="float: left; margin-right: 10px;"><a href="http://twitter.com/share?url=http%3A%2F%2Fcodereflect.com%2F2010%2F08%2F24%2Fdvorak-simplified-keyboard%2F&amp;via=codereflect&amp;text=Dvorak+Simplified+Keyboard&amp;related=sarat:Codereflect+Author&amp;lang=en&amp;count=vertical" style="" class="twitter-share-button">Tweet</a></div>
<p>This is the new keyboard layout I’ve ever heard of since QWERTY. I thought QWERTY is the most usable keyboard. But on reading about this keyboard layout, it’s promising. Reducing your typing effort</p>
<p><a href="http://codereflect.com/wp-content/uploads/2010/08/dvork.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="dvork" border="0" alt="dvork" src="http://codereflect.com/wp-content/uploads/2010/08/dvork_thumb.png" width="613" height="206" /></a> </p>
<p>The Dvorak keyboard is patented in 1936 by Dr.August Dvorak and his brother in William Dealey. The proponents of the keyboard says, the keyboard layout only requires small amount of movements to reduce the typing effort compared to standard QWERTY keyboard. Also it purported to reduce the repetitive strain injuries. Even though it was offered with major operating systems includes Windows, Linux and MacOS etc in addition to QWERTY keyboard, it failed to become popular
<p>Some of the advantages on using Dvorak Keyboard are</p>
<p><strong>QWERTY Keyboard is for Typewriters – </strong>QWERTY keyboard was born in order to solve the mechanical problems found in the initial typewriter layout. It’s good for type writers but not for typist.</p>
<p><strong>Speed Boost </strong>- Dvorak layout contains 70% of most used keys in the home row (in qwerty keyboard, the row contains asdf keys). 22% on the top row and 8% in the bottom row. In QWERTY, only 32% of keystrokes are on the home row. Which means most of the time, typists’ fingers are either reaching up for the top row (52%) or down for the bottom row (16%). So not only does QWERTY do nothing for typists, it actually hinders them. It further improves the speed by containing the vowels on the left side of the home row and most used <a href="http://en.wikipedia.org/wiki/Consonant">consonants</a> on right. Alternating between either fingers are faster.</p>
<p><strong>Less mistakes </strong>– Homerow is where typists make less mistakes. As mentioned before, 70% of the most used keys are in homerow which helps you to reduce the typing errors. But this is not the case for QWERTY. Most of the time, we will have to move away from homerow.</p>
<p>Better health – In Dvorak layout, typists finger travels 1.5 km per day while on QWERTY it’s 30 km per day. These extra miles are more error prone and stress on fingers.</p>
<p><strong>Easy to switch from QWERTY </strong>– Studies have proved, Dvorak is easy to switch from QWERTY typist. There are lot of helpful games to learn about Dvorak typing.</p>
<p>Despite of these advantages, Dvorak can’t become popular. Simple people don’t want to change. Just think, do you want to join the prestigious club of Dvorak, which includes Matt Mullenweg of WordPress, Bram Cohen., inventor of BitTorent and finally Barbara Blackburn, Worlds fastest typist.</p>
<p>Further reading – </p>
<p><a href="http://en.wikipedia.org/wiki/Dvorak_Simplified_Keyboard">Dvorak Simplified Keyboard – Wikipedia</a></p>
<p><a href="http://workawesome.com/productivity/dvorak-keyboard-layout/">7 Reasons to Switch to Dvorak Keyboard &#8211; Work Awesome</a></p>
<p><a href="http://www.codinghorror.com/blog/2009/02/have-keyboard-will-program.html">Have Keyboard will program – Coding horror</a></p>
<p>&#160;</p>
<p><a href="http://en.wikipedia.org/wiki/File:KB_United_States_Dvorak.svg">Image Originally Taken from Wikipedia, under Wiki Common License</a>.</p>
</p>
<div class="tw_button" style="float: left; margin-right: 10px;"><a href="http://twitter.com/share?url=http%3A%2F%2Fcodereflect.com%2F2010%2F08%2F24%2Fdvorak-simplified-keyboard%2F&amp;via=codereflect&amp;text=Dvorak+Simplified+Keyboard&amp;related=sarat:Codereflect+Author&amp;lang=en&amp;count=vertical" style="" class="twitter-share-button">Tweet</a></div>

<p><a href="http://feedads.g.doubleclick.net/~a/6Y7YIY_qXwM0OTjvUjPDqUdIJSs/0/da"><img src="http://feedads.g.doubleclick.net/~a/6Y7YIY_qXwM0OTjvUjPDqUdIJSs/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/6Y7YIY_qXwM0OTjvUjPDqUdIJSs/1/da"><img src="http://feedads.g.doubleclick.net/~a/6Y7YIY_qXwM0OTjvUjPDqUdIJSs/1/di" border="0" ismap="true"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/SharingMyThoughts?a=pcrothvQAoQ:9VB4jPg3C6M:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/SharingMyThoughts?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/SharingMyThoughts?a=pcrothvQAoQ:9VB4jPg3C6M:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/SharingMyThoughts?i=pcrothvQAoQ:9VB4jPg3C6M:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/SharingMyThoughts?a=pcrothvQAoQ:9VB4jPg3C6M:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/SharingMyThoughts?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/SharingMyThoughts?a=pcrothvQAoQ:9VB4jPg3C6M:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/SharingMyThoughts?d=dnMXMwOfBR0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/SharingMyThoughts?a=pcrothvQAoQ:9VB4jPg3C6M:Uw9eXibygTk"><img src="http://feeds.feedburner.com/~ff/SharingMyThoughts?i=pcrothvQAoQ:9VB4jPg3C6M:Uw9eXibygTk" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/SharingMyThoughts/~4/pcrothvQAoQ" height="1" width="1"/>]]></content:encoded><description>Tweet
&lt;p&gt;This is the new keyboard layout I’ve ever heard of since QWERTY. I thought QWERTY is the most usable keyboard. But on reading about this keyboard layout, it’s promising. Reducing your typing effort&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;The Dvorak keyboard is patented in 1936 by Dr.August Dvorak and his brother in William Dealey. The proponents of the keyboard says, the &lt;span style="color:#777"&gt; . . . &amp;#8594; Read More: &lt;a href="http://codereflect.com/2010/08/24/dvorak-simplified-keyboard/"&gt;Dvorak Simplified Keyboard&lt;/a&gt;&lt;/span&gt;</description><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://codereflect.com/2010/08/24/dvorak-simplified-keyboard/feed/</wfw:commentRss><slash:comments xmlns:slash="http://purl.org/rss/1.0/modules/slash/">0</slash:comments><feedburner:origLink>http://codereflect.com/2010/08/24/dvorak-simplified-keyboard/</feedburner:origLink></item><item><title>How to enable Direct2D Rendering with Firefox 4 Nightly Builds?</title><link>http://feedproxy.google.com/~r/SharingMyThoughts/~3/sWYZE1uz1AA/</link><category>Tips</category><category>browser</category><category>tools</category><category>Browser</category><category>Direct2D</category><category>Firefox 4</category><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Sarath</dc:creator><pubDate>Sun, 22 Aug 2010 17:11:13 PDT</pubDate><guid isPermaLink="false">http://codereflect.com/2010/08/23/how-to-enable-direct2d-rendering-with-firefox-4-nightly-builds/</guid><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[<div class="tw_button" style="float: left; margin-right: 10px;"><a href="http://twitter.com/share?url=http%3A%2F%2Fcodereflect.com%2F2010%2F08%2F23%2Fhow-to-enable-direct2d-rendering-with-firefox-4-nightly-builds%2F&amp;via=codereflect&amp;text=How+to+enable+Direct2D+Rendering+with+Firefox+4+Nightly+Builds%3F&amp;related=sarat:Codereflect+Author&amp;lang=en&amp;count=vertical" style="" class="twitter-share-button">Tweet</a></div>
<p>Finally Direct2D rendering is here with Firefox 4 nightly build.</p>
<p>Prerequisites</p>
<ul>
<li>Windows 7/Vista with latest service pack </li>
<li>You should have DirectX 9/10 enabled Graphics card </li>
</ul>
<p>&#160;</p>
<p>1. Download Firefox <a href="http://nightly.mozilla.org/">nightly build</a></p>
<p>2. Take configuration page by navigating to <b>about:config </b>from address bar</p>
<p>3. Change<b> mozilla.widget.render-mode</b> value to 6 (default is –1)</p>
<p><a href="file:///C:\Users\rockr\AppData\Local\Temp\WindowsLiveWriter1286139640\supfilesBAA086\image%5b8%5d.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="clip_image001" border="0" alt="clip_image001" src="http://codereflect.com/wp-content/uploads/2010/08/clip_image001.png" width="584" height="174" /></a></p>
<p>4. Change<b> gfx.font_rendering.directwrite.enabled</b> to <b>true (</b>Just double click<b>. </b>default value is false<b>)</b></p>
<p><a href="file:///C:\Users\rockr\AppData\Local\Temp\WindowsLiveWriter1286139640\supfilesBAA086\image%5b9%5d.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="clip_image002" border="0" alt="clip_image002" src="http://codereflect.com/wp-content/uploads/2010/08/clip_image002.png" width="577" height="231" /></a></p>
<p>We can’t ensure it’s drawing using Direct2D because some plugins may force the browser to draw using GDI. If possible disable/remove the plugins </p>
<p>Now how to test it?</p>
<p>Check the following tests. Probably these test should execute so smoothly if hardware accelerated.</p>
<p><a href="http://ie.microsoft.com/testdrive/Performance/PsychedelicBrowsing/">http://ie.microsoft.com/testdrive/Performance/PsychedelicBrowsing/</a></p>
<p><a href="http://people.mozilla.com/~vladimir/demos/photos.svg">http://people.mozilla.com/~vladimir/demos/photos.svg</a></p>
<p><a href="file:///C:\Users\rockr\AppData\Local\Temp\WindowsLiveWriter1286139640\supfilesBAA086\Minefield%5b11%5d.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="clip_image003" border="0" alt="clip_image003" src="http://codereflect.com/wp-content/uploads/2010/08/clip_image003.png" width="596" height="584" /></a></p>
<p><a href="http://www.basschouten.com/blog1.php/2009/11/22/direct2d-hardware-rendering-a-browser">Bas Schouten has published the performance gain of Direct2D over conventional GDI interface.</a></p>
<p><a href="http://www.basschouten.com/blog1.php/2009/11/22/direct2d-hardware-rendering-a-browser"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="clip_image004" border="0" alt="clip_image004" src="http://codereflect.com/wp-content/uploads/2010/08/clip_image004.png" width="602" height="482" /></a></p>
<p>Image Courtesy <a href="http://www.basschouten.com/blog1.php/2009/11/22/direct2d-hardware-rendering-a-browser">Bas Schouten</a></p>
<p><a name="_GoBack"></a></p>
<div class="tw_button" style="float: left; margin-right: 10px;"><a href="http://twitter.com/share?url=http%3A%2F%2Fcodereflect.com%2F2010%2F08%2F23%2Fhow-to-enable-direct2d-rendering-with-firefox-4-nightly-builds%2F&amp;via=codereflect&amp;text=How+to+enable+Direct2D+Rendering+with+Firefox+4+Nightly+Builds%3F&amp;related=sarat:Codereflect+Author&amp;lang=en&amp;count=vertical" style="" class="twitter-share-button">Tweet</a></div>

<p><a href="http://feedads.g.doubleclick.net/~a/lbeywo8kSDVlUwse-Za7eIEgaOg/0/da"><img src="http://feedads.g.doubleclick.net/~a/lbeywo8kSDVlUwse-Za7eIEgaOg/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/lbeywo8kSDVlUwse-Za7eIEgaOg/1/da"><img src="http://feedads.g.doubleclick.net/~a/lbeywo8kSDVlUwse-Za7eIEgaOg/1/di" border="0" ismap="true"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/SharingMyThoughts?a=sWYZE1uz1AA:h_PksjbA9GI:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/SharingMyThoughts?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/SharingMyThoughts?a=sWYZE1uz1AA:h_PksjbA9GI:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/SharingMyThoughts?i=sWYZE1uz1AA:h_PksjbA9GI:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/SharingMyThoughts?a=sWYZE1uz1AA:h_PksjbA9GI:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/SharingMyThoughts?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/SharingMyThoughts?a=sWYZE1uz1AA:h_PksjbA9GI:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/SharingMyThoughts?d=dnMXMwOfBR0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/SharingMyThoughts?a=sWYZE1uz1AA:h_PksjbA9GI:Uw9eXibygTk"><img src="http://feeds.feedburner.com/~ff/SharingMyThoughts?i=sWYZE1uz1AA:h_PksjbA9GI:Uw9eXibygTk" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/SharingMyThoughts/~4/sWYZE1uz1AA" height="1" width="1"/>]]></content:encoded><description>Tweet
&lt;p&gt;Finally Direct2D rendering is here with Firefox 4 nightly build.&lt;/p&gt;
&lt;p&gt;Prerequisites&lt;/p&gt;

Windows 7/Vista with latest service pack 
You should have DirectX 9/10 enabled Graphics card 

&lt;p&gt;&amp;#160;&lt;/p&gt;
&lt;p&gt;1. Download Firefox nightly build&lt;/p&gt;
&lt;p&gt;2. Take configuration page by navigating to about:config from address bar&lt;/p&gt;
&lt;p&gt;3. Change mozilla.widget.render-mode value to 6 (default is –1)&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;4. Change gfx.font_rendering.directwrite.enabled to true (Just double click. default value is &lt;span style="color:#777"&gt; . . . &amp;#8594; Read More: &lt;a href="http://codereflect.com/2010/08/23/how-to-enable-direct2d-rendering-with-firefox-4-nightly-builds/"&gt;How to enable Direct2D Rendering with Firefox 4 Nightly Builds?&lt;/a&gt;&lt;/span&gt;</description><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://codereflect.com/2010/08/23/how-to-enable-direct2d-rendering-with-firefox-4-nightly-builds/feed/</wfw:commentRss><slash:comments xmlns:slash="http://purl.org/rss/1.0/modules/slash/">0</slash:comments><feedburner:origLink>http://codereflect.com/2010/08/23/how-to-enable-direct2d-rendering-with-firefox-4-nightly-builds/</feedburner:origLink></item><item><title>String Tokenizing and Trimming in C#</title><link>http://feedproxy.google.com/~r/SharingMyThoughts/~3/1xmGPj_2LmA/</link><category>.NET</category><category>C Sharp</category><category>code</category><category>C++</category><category>parsing</category><category>split</category><category>String</category><category>Trim</category><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Sarath</dc:creator><pubDate>Tue, 17 Aug 2010 06:39:03 PDT</pubDate><guid isPermaLink="false">http://codereflect.com/2010/08/17/string-tokenizing-and-trimming-in-c/</guid><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[<div class="tw_button" style="float: left; margin-right: 10px;"><a href="http://twitter.com/share?url=http%3A%2F%2Fcodereflect.com%2F2010%2F08%2F17%2Fstring-tokenizing-and-trimming-in-c%2F&amp;via=codereflect&amp;text=String+Tokenizing+and+Trimming+in+C%23&amp;related=sarat:Codereflect+Author&amp;lang=en&amp;count=vertical" style="" class="twitter-share-button">Tweet</a></div>
<p>I was quickly going through the String class (C#). I found Split and Trim is really handy methods of String class for text processing. <a href="http://msdn.microsoft.com/en-us/library/system.string.trim.aspx" target="_blank"></a></p>
<p><strong><a href="http://msdn.microsoft.com/en-us/library/system.string.trim.aspx" target="_blank">Trim</a> </strong></p>
<p>Usually if we call the trim function, it removes the leading and trailing spaces. Here also same, String class provides Trim function for removing leading and trailing spaces. If we need to remove only leading spaces <a href="http://msdn.microsoft.com/en-us/library/system.string.trimstart.aspx" target="_blank">TrimStart</a>and to remove trailing spaces, you can use <a href="http://msdn.microsoft.com/en-us/library/system.string.trimend.aspx" target="_blank">TrimEnd</a>function. But Trim method is overloaded to accept a character array, which can trim any of the characters specified in the array appears in the beginning or end of the string. Similarly you can use this function with TrimStart or TrimEnd function.   See the sample snippet below</p>
<pre class="brush: csharp;">
String strHw = &quot;* *_Hello World_* *&quot;;
char[] trim = { '*', ' ', '_'};
str  = strHw.Trim( trim );
Console.WriteLine(&quot;After Trimming:- &quot; + str);
</pre>
<p><strong><a href="http://msdn.microsoft.com/en-us/library/system.string.split.aspx" target="_blank">Split</a></strong></p>
<p>Split method provides painless way for tokenize the string with the given delimiters. No loops or anything required. Just call the Split function and pass the delimiters to spot the end of each tokens. The function will return a string array. This function is really handy especially for things to do like CSV (Comma Seperated values) parsing. The overloaded Split functions gives more control over the return of array( e.g. to return emptry string element or not, maximum string elements to be returned etc). <a href="http://msdn.microsoft.com/en-us/library/system.string.split.aspx" target="_blank">Please check the documentation</a> See the Sample below</p>
<pre class="brush: csharp;">
String str = &quot;Quick,Brown,Fox,Jumps Over The,Lazy Dog&quot;;
Console.WriteLine(&quot;String:-&quot; + str + &quot;Split to&quot;);

char[] delim = {',', ' '};
String[] csvArray = str.Split(delim);

foreach (String s in csvArray)
{
       Console.WriteLine(s);
}
</pre>
<div class="tw_button" style="float: left; margin-right: 10px;"><a href="http://twitter.com/share?url=http%3A%2F%2Fcodereflect.com%2F2010%2F08%2F17%2Fstring-tokenizing-and-trimming-in-c%2F&amp;via=codereflect&amp;text=String+Tokenizing+and+Trimming+in+C%23&amp;related=sarat:Codereflect+Author&amp;lang=en&amp;count=vertical" style="" class="twitter-share-button">Tweet</a></div>

<p><a href="http://feedads.g.doubleclick.net/~a/AJiHd6G4uBUldZkjFW35zLcUA9U/0/da"><img src="http://feedads.g.doubleclick.net/~a/AJiHd6G4uBUldZkjFW35zLcUA9U/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/AJiHd6G4uBUldZkjFW35zLcUA9U/1/da"><img src="http://feedads.g.doubleclick.net/~a/AJiHd6G4uBUldZkjFW35zLcUA9U/1/di" border="0" ismap="true"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/SharingMyThoughts?a=1xmGPj_2LmA:0B4vNUXpxoQ:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/SharingMyThoughts?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/SharingMyThoughts?a=1xmGPj_2LmA:0B4vNUXpxoQ:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/SharingMyThoughts?i=1xmGPj_2LmA:0B4vNUXpxoQ:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/SharingMyThoughts?a=1xmGPj_2LmA:0B4vNUXpxoQ:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/SharingMyThoughts?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/SharingMyThoughts?a=1xmGPj_2LmA:0B4vNUXpxoQ:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/SharingMyThoughts?d=dnMXMwOfBR0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/SharingMyThoughts?a=1xmGPj_2LmA:0B4vNUXpxoQ:Uw9eXibygTk"><img src="http://feeds.feedburner.com/~ff/SharingMyThoughts?i=1xmGPj_2LmA:0B4vNUXpxoQ:Uw9eXibygTk" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/SharingMyThoughts/~4/1xmGPj_2LmA" height="1" width="1"/>]]></content:encoded><description>Tweet
&lt;p&gt;I was quickly going through the String class (C#). I found Split and Trim is really handy methods of String class for text processing. &lt;/p&gt;
&lt;p&gt;Trim &lt;/p&gt;
&lt;p&gt;Usually if we call the trim function, it removes the leading and trailing spaces. Here also same, String class provides Trim function for removing leading and trailing spaces. If we need &lt;span style="color:#777"&gt; . . . &amp;#8594; Read More: &lt;a href="http://codereflect.com/2010/08/17/string-tokenizing-and-trimming-in-c/"&gt;String Tokenizing and Trimming in C#&lt;/a&gt;&lt;/span&gt;</description><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://codereflect.com/2010/08/17/string-tokenizing-and-trimming-in-c/feed/</wfw:commentRss><slash:comments xmlns:slash="http://purl.org/rss/1.0/modules/slash/">0</slash:comments><feedburner:origLink>http://codereflect.com/2010/08/17/string-tokenizing-and-trimming-in-c/</feedburner:origLink></item><item><title>How to backup your wordpress blog database?</title><link>http://feedproxy.google.com/~r/SharingMyThoughts/~3/2XvISlLAEcg/</link><category>Tips</category><category>tools</category><category>database</category><category>mysql</category><category>wordpress</category><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Sarath</dc:creator><pubDate>Sun, 15 Aug 2010 08:31:02 PDT</pubDate><guid isPermaLink="false">http://codereflect.com/?p=1257</guid><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[<div class="tw_button" style="float: left; margin-right: 10px;"><a href="http://twitter.com/share?url=http%3A%2F%2Fcodereflect.com%2F2010%2F08%2F15%2Fhow-to-backup-your-wordpress-blog-database%2F&amp;via=codereflect&amp;text=How+to+backup+your+wordpress+blog+database%3F&amp;related=sarat:Codereflect+Author&amp;lang=en&amp;count=vertical" style="" class="twitter-share-button">Tweet</a></div>
<p>For a wordpress blog, MYSQL database is it’s heart. We can restore the wordpress installation, themes plugins or anything easily but once the database is corrupted, it’s not easy to go well with your blog.</p>
<p>I had faced the server crash many times and also due to some problems at server side, my DB was filled with spams and lot of other unnecessary categories and tags. What you can do is to restore the website to previous state. If you’re a heavy blogger, it’s better to keep the backup everyday or otherwise at least once in a week.</p>
<p>Now I’m talking about the backing up the wordpress blog DB easily. Almost all hosting providers are having phpAdmin enabled through webpage to control the database but this is not really easy.</p>
<p>Previously MySQL tool was available in MYSQL website but I was suprised once I format my machine and tried to download the same application again. MySQL provides a better tool called MySQL Workbench for controlling your database. It’s not only a backup tool, but it has other features like server administration, scripting console etc.</p>
<p>Just download <a title="MySQL Workbench" href="http://wb.mysql.com/" target="_blank">MySQL Workbench</a> from MySQL Website and specify your connection strings (servername, username and password) in the “New Server Instance” option.</p>
<p><a href="http://codereflect.com/wp-content/uploads/2010/08/Picture-21.png"><img class="aligncenter size-large wp-image-1263" title="Picture 2" src="http://codereflect.com/wp-content/uploads/2010/08/Picture-21-1024x773.png" alt="" width="700" /></a></p>
<p>Finally do your backup through Manage Import/Export. Sorry I could not find any option to automate the backup. Share if you find any options
<div class="tw_button" style="float: left; margin-right: 10px;"><a href="http://twitter.com/share?url=http%3A%2F%2Fcodereflect.com%2F2010%2F08%2F15%2Fhow-to-backup-your-wordpress-blog-database%2F&amp;via=codereflect&amp;text=How+to+backup+your+wordpress+blog+database%3F&amp;related=sarat:Codereflect+Author&amp;lang=en&amp;count=vertical" style="" class="twitter-share-button">Tweet</a></div>

<p><a href="http://feedads.g.doubleclick.net/~a/6XMNP1KhIBuvG0uzrldMdEy_jJ8/0/da"><img src="http://feedads.g.doubleclick.net/~a/6XMNP1KhIBuvG0uzrldMdEy_jJ8/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/6XMNP1KhIBuvG0uzrldMdEy_jJ8/1/da"><img src="http://feedads.g.doubleclick.net/~a/6XMNP1KhIBuvG0uzrldMdEy_jJ8/1/di" border="0" ismap="true"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/SharingMyThoughts?a=2XvISlLAEcg:SouaYaNmusE:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/SharingMyThoughts?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/SharingMyThoughts?a=2XvISlLAEcg:SouaYaNmusE:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/SharingMyThoughts?i=2XvISlLAEcg:SouaYaNmusE:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/SharingMyThoughts?a=2XvISlLAEcg:SouaYaNmusE:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/SharingMyThoughts?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/SharingMyThoughts?a=2XvISlLAEcg:SouaYaNmusE:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/SharingMyThoughts?d=dnMXMwOfBR0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/SharingMyThoughts?a=2XvISlLAEcg:SouaYaNmusE:Uw9eXibygTk"><img src="http://feeds.feedburner.com/~ff/SharingMyThoughts?i=2XvISlLAEcg:SouaYaNmusE:Uw9eXibygTk" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/SharingMyThoughts/~4/2XvISlLAEcg" height="1" width="1"/>]]></content:encoded><description>Tweet
&lt;p&gt;For a wordpress blog, MYSQL database is it’s heart. We can restore the wordpress installation, themes plugins or anything easily but once the database is corrupted, it’s not easy to go well with your blog.&lt;/p&gt;
&lt;p&gt;I had faced the server crash many times and also due to some problems at server side, my DB was filled with &lt;span style="color:#777"&gt; . . . &amp;#8594; Read More: &lt;a href="http://codereflect.com/2010/08/15/how-to-backup-your-wordpress-blog-database/"&gt;How to backup your wordpress blog database?&lt;/a&gt;&lt;/span&gt;</description><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://codereflect.com/2010/08/15/how-to-backup-your-wordpress-blog-database/feed/</wfw:commentRss><slash:comments xmlns:slash="http://purl.org/rss/1.0/modules/slash/">0</slash:comments><feedburner:origLink>http://codereflect.com/2010/08/15/how-to-backup-your-wordpress-blog-database/</feedburner:origLink></item><item><title>How to use Google font API in your blog?</title><link>http://feedproxy.google.com/~r/SharingMyThoughts/~3/tgBmwsngXGA/</link><category>code</category><category>web</category><category>API</category><category>Code</category><category>css</category><category>Google</category><category>webfont</category><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Sarath</dc:creator><pubDate>Fri, 13 Aug 2010 22:16:03 PDT</pubDate><guid isPermaLink="false">http://codereflect.com/2010/08/14/how-to-use-google-font-api-in-your-blog/</guid><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[<div class="tw_button" style="float: left; margin-right: 10px;"><a href="http://twitter.com/share?url=http%3A%2F%2Fcodereflect.com%2F2010%2F08%2F14%2Fhow-to-use-google-font-api-in-your-blog%2F&amp;via=codereflect&amp;text=How+to+use+Google+font+API+in+your+blog%3F&amp;related=sarat:Codereflect+Author&amp;lang=en&amp;count=vertical" style="" class="twitter-share-button">Tweet</a></div>
<p>I like readable fonts, slightly big in size. But I&#8217;m quite bored with the standard fonts we’re seeing for ages like Arial, Verdana, Georgia etc. Recently I tried of another simple experiment with my blog by enabling open webfonts created by Google. I like the font collection provided from Google. In Windows, I like Segoe UI and Calibri which is the most readable fonts bundled with Windows. In the apple world, I personally like <a href="http://en.wikipedia.org/wiki/Helvetica" target="_blank">Helvetica</a> but the problem is, these wont run across platforms. I agree most of the visitors in my website are Windows users but I still like to have a unique look for my website across browsers and platforms. Also in the old version of Windows, Calibri and Segoe UI is not available by default. Also the purpose of this post is to letting someone know, there some simple beautiful things are happening around to try with.</p>
<p><a href="http://codereflect.com/wp-content/uploads/2010/08/font_api128.gif"><img style="border-bottom: 0px; border-left: 0px; display: inline; margin-left: 0px; border-top: 0px; margin-right: 0px; border-right: 0px" title="font_api-128" border="0" alt="font_api-128" align="left" src="http://codereflect.com/wp-content/uploads/2010/08/font_api128_thumb.gif" width="128" height="128" /></a> </p>
<p>&#160;</p>
<p>Google webfonts are available through <a href="http://code.google.com/apis/webfonts/" target="_blank">Google Fonts API</a> which helps you to add web fonts to any webpage. Google fonts are high in quality, extremely easy to use and it works with most of the browsers in any platforms. There are two methods to use Google open fonts in your website, the first one is very basic usage of CSS and second version called <a href="http://code.google.com/apis/webfonts/docs/webfont_loader.html" target="_blank">WebFont Loader</a> which is giving advanced usage of fonts and give far more flexibilty using JavaScript.</p>
<p>Here I’m covering only the basic usage of enabling Google fonts in the website.</p>
<h3>1. Add the sytlesheet link request to the required font.</h3>
<p> With a wordpress blog, I prefer you’re adding this in header.php file.</p>
<pre class="brush: css;">
&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;http://fonts.googleapis.com/css?family=Font+Name&quot;&gt;
</pre>
<h3>2. Select the CSS elements which need to apply the fonts with </h3>
<pre class="brush: css;">
CSS selector {
  font-family: 'Font Name', serif;
}
</pre>
<p>Or inline stle with div tag</p>
<pre class="brush: css;">
&lt;div style=&quot;font-family: 'Font Name', serif;&quot;&gt;Your text&lt;/div&gt;
</pre>
<p>&#160;</p>
<h3>A Simple Example</h3>
<p>Here’s the way I updated my blog font</p>
<p>Added link code in Modified Header.php </p>
<pre class="brush: css;">
&lt;link  href=&quot;//fonts.googleapis.com/css?family=Nobile:regular,italic,bold,bolditalic&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot; &gt;
</pre>
<p>Modified the stylesheet.css and select the <strong>body </strong>with the Nobile font I selected</p>
<pre class="brush: css;">
body {
  font-family: 'Nobile', serif;
  font-size: 14px;
  font-style: normal;
  font-weight: 400;
  text-shadow: none;
  text-decoration: none;
  text-transform: none;
  letter-spacing: 0em;
  word-spacing: 0em;
    line-height: 1.4em;
}
</pre>
<h3>How to easily generate the Google Font API stylesheet code?</h3>
<p>You can simply generate Google Font API CSS style sheet using <a href="http://code.google.com/webfonts/preview" target="_blank">Google font preview page</a>. The modified parts will simply highlight in Yellow color and you’ve perfect control over vertical and horizontal spacing decoration etc. I prefer you to use this page to generate flawless CSS code.</p>
</p>
<p><a href="http://codereflect.com/wp-content/uploads/2010/08/image8.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://codereflect.com/wp-content/uploads/2010/08/image_thumb8.png" width="605" height="437" /></a></p>
<div class="tw_button" style="float: left; margin-right: 10px;"><a href="http://twitter.com/share?url=http%3A%2F%2Fcodereflect.com%2F2010%2F08%2F14%2Fhow-to-use-google-font-api-in-your-blog%2F&amp;via=codereflect&amp;text=How+to+use+Google+font+API+in+your+blog%3F&amp;related=sarat:Codereflect+Author&amp;lang=en&amp;count=vertical" style="" class="twitter-share-button">Tweet</a></div>

<p><a href="http://feedads.g.doubleclick.net/~a/IH3ISQ4VeLEqXRvKdfLDoh69FkI/0/da"><img src="http://feedads.g.doubleclick.net/~a/IH3ISQ4VeLEqXRvKdfLDoh69FkI/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/IH3ISQ4VeLEqXRvKdfLDoh69FkI/1/da"><img src="http://feedads.g.doubleclick.net/~a/IH3ISQ4VeLEqXRvKdfLDoh69FkI/1/di" border="0" ismap="true"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/SharingMyThoughts?a=tgBmwsngXGA:qQs2Il2BPzA:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/SharingMyThoughts?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/SharingMyThoughts?a=tgBmwsngXGA:qQs2Il2BPzA:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/SharingMyThoughts?i=tgBmwsngXGA:qQs2Il2BPzA:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/SharingMyThoughts?a=tgBmwsngXGA:qQs2Il2BPzA:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/SharingMyThoughts?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/SharingMyThoughts?a=tgBmwsngXGA:qQs2Il2BPzA:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/SharingMyThoughts?d=dnMXMwOfBR0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/SharingMyThoughts?a=tgBmwsngXGA:qQs2Il2BPzA:Uw9eXibygTk"><img src="http://feeds.feedburner.com/~ff/SharingMyThoughts?i=tgBmwsngXGA:qQs2Il2BPzA:Uw9eXibygTk" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/SharingMyThoughts/~4/tgBmwsngXGA" height="1" width="1"/>]]></content:encoded><description>Tweet
&lt;p&gt;I like readable fonts, slightly big in size. But I&amp;#8217;m quite bored with the standard fonts we’re seeing for ages like Arial, Verdana, Georgia etc. Recently I tried of another simple experiment with my blog by enabling open webfonts created by Google. I like the font collection provided from Google. In Windows, I like Segoe UI &lt;span style="color:#777"&gt; . . . &amp;#8594; Read More: &lt;a href="http://codereflect.com/2010/08/14/how-to-use-google-font-api-in-your-blog/"&gt;How to use Google font API in your blog?&lt;/a&gt;&lt;/span&gt;</description><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://codereflect.com/2010/08/14/how-to-use-google-font-api-in-your-blog/feed/</wfw:commentRss><slash:comments xmlns:slash="http://purl.org/rss/1.0/modules/slash/">1</slash:comments><feedburner:origLink>http://codereflect.com/2010/08/14/how-to-use-google-font-api-in-your-blog/</feedburner:origLink></item><item><title>How to Integrate official tweet button to wordpress (no plugin)?</title><link>http://feedproxy.google.com/~r/SharingMyThoughts/~3/2NHOGT_pZ4E/</link><category>Tips</category><category>twitter</category><category>web</category><category>wordpress</category><category>button</category><category>share</category><category>tools</category><category>tweet</category><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Sarath</dc:creator><pubDate>Thu, 12 Aug 2010 11:58:14 PDT</pubDate><guid isPermaLink="false">http://codereflect.com/2010/08/12/how-to-integrate-official-tweet-button-to-wordpress-no-plugin/</guid><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[<div class="tw_button" style="float: left; margin-right: 10px;"><a href="http://twitter.com/share?url=http%3A%2F%2Fcodereflect.com%2F2010%2F08%2F12%2Fhow-to-integrate-official-tweet-button-to-wordpress-no-plugin%2F&amp;via=codereflect&amp;text=How+to+Integrate+official+tweet+button+to+wordpress+%28no+plugin%29%3F&amp;related=sarat:Codereflect+Author&amp;lang=en&amp;count=vertical" style="" class="twitter-share-button">Tweet</a></div>
<p>Few hours ago, @twitter has <a href="http://blog.twitter.com/2010/08/pushing-our-tweet-button.html" target="_blank">officially released their brand new tweet button</a> for content publishers to share their content through twitter. @TweetMeme has Retweet button integration with a number of blogging platform which was also used previously in this website. Now codereflect.com is integrated with brand new tweet button to share the content.</p>
<p><a href="http://codereflect.com/wp-content/uploads/2010/08/image2.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://codereflect.com/wp-content/uploads/2010/08/image_thumb2.png" width="334" height="119" /></a> </p>
<p>Twitter supports 3 different kind of buttons so far which contains a tweet button and also a retweet count linked to a twitter search page, which can display the reteweets on this same URL.</p>
<p>The steps for creating the reteweet button is quite easy. With simple 3 steps your retweet button will be ready. </p>
<p>Head to <a href="http://twitter.com/tweetbutton">http://twitter.com/tweetbutton</a></p>
<p>Choose your button type </p>
<p><a href="http://codereflect.com/wp-content/uploads/2010/08/image3.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://codereflect.com/wp-content/uploads/2010/08/image_thumb3.png" width="490" height="245" /></a> </p>
<p>The biggest advantage of twitter share option is, you can add a set of twitter account suggest to follow. </p>
<p><a href="http://codereflect.com/wp-content/uploads/2010/08/image4.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://codereflect.com/wp-content/uploads/2010/08/image_thumb4.png" width="679" height="189" /></a> </p>
<p>You’re done.</p>
<p>Now You’ve created a typical button for your website. But now let’s see how to integrate this to wordpress. The default tweet button can’t work with the dynamic post contents in the blog. But it has options to specify the felids to control all parameters associated with the tweet button and share window eventually appears on clicking it.</p>
<p>Head to Developer page to get more information about tweet button <a title="http://dev.twitter.com/pages/tweet_button" href="http://dev.twitter.com/pages/tweet_button">http://dev.twitter.com/pages/tweet_button</a></p>
<p>Here I’m talking about the javascript version of the tweet button. The parameters which can be passed to script are listed below</p>
<table border="0" cellpadding="0">
<tbody>
<tr>
<td valign="top">
<p><b>Data Source</b><b></b></p>
</td>
<td valign="top">
<p><b>Share query string</b></p>
</td>
<td valign="top">
<p><b>data-</b><b> attribute of anchor tag</b></p>
</td>
<td valign="top">
<p><b>rel=</b><b> attribute of a </b><b>link</b><b> tag</b></p>
</td>
<td valign="top">
<p><b>Default</b></p>
</td>
</tr>
<tr>
<td valign="top">
<p><b>Priority</b></p>
</td>
<td valign="top">
<p>1</p>
</td>
<td valign="top">
<p>2</p>
</td>
<td valign="top">
<p>3</p>
</td>
<td valign="top">
<p>4</p>
</td>
</tr>
<tr>
<td valign="top">
<p><b>URL to Tweet</b></p>
</td>
<td valign="top">
<p>url</p>
</td>
<td valign="top">
<p>data-url</p>
</td>
<td valign="top">
<p>rel=&quot;canonical&quot;</p>
</td>
<td valign="top">
<p>HTTP Referrer</p>
</td>
</tr>
<tr>
<td valign="top">
<p><b>via user</b></p>
</td>
<td valign="top">
<p>via</p>
</td>
<td valign="top">
<p>data-via</p>
</td>
<td valign="top">
<p>rel=&quot;me&quot;</p>
</td>
<td valign="top">&#160;</td>
</tr>
<tr>
<td valign="top">
<p><b>Tweet text</b></p>
</td>
<td valign="top">
<p>text</p>
</td>
<td valign="top">
<p>data-text</p>
</td>
<td valign="top">&#160;</td>
<td valign="top">
<p>Content of the &lt;title&gt; tag</p>
</td>
</tr>
<tr>
<td valign="top">
<p><b>Recommended accounts</b></p>
</td>
<td valign="top">
<p>related</p>
</td>
<td valign="top">
<p>data-related</p>
</td>
<td valign="top">&#160;</td>
<td valign="top">&#160;</td>
</tr>
<tr>
<td valign="top">
<p><b>Count box position</b></p>
</td>
<td valign="top">
<p>count</p>
</td>
<td valign="top">
<p>data-count</p>
</td>
<td valign="top">&#160;</td>
<td valign="top">
<p>horizontal</p>
</td>
</tr>
<tr>
<td valign="top">
<p><b>Language</b></p>
</td>
<td valign="top">
<p>lang</p>
</td>
<td valign="top">
<p>data-lang</p>
</td>
<td valign="top">&#160;</td>
<td valign="top">
<p>en</p>
</td>
</tr>
</tbody>
</table>
<p>In addition to the default button HTML code generated, we may have to add some more parameters to enable it in wordpress hosted blog</p>
<p>Modify Index.php from Appearance-&gt;Editor option</p>
<p><a href="http://codereflect.com/wp-content/uploads/2010/08/image5.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://codereflect.com/wp-content/uploads/2010/08/image_thumb5.png" width="673" height="95" /></a> </p>
<p>Copy the generated HTML code between the iteration to display the post. The screenshot is attached above. You may have to add data-url and data-text parameter to enable tweet button specfically for each post in the blog post. You can simply call the php call to get the title and and link the URL</p>
<p>Modify the Singlepost.php from Apperance-&gt;Editor Menu</p>
<p><a href="http://codereflect.com/wp-content/uploads/2010/08/image6.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://codereflect.com/wp-content/uploads/2010/08/image_thumb6.png" width="677" height="117" /></a></p>
<p>This is also done in the same fashion for PHP.</p>
<p>Finally the share window appear as follows.&#160; </p>
<p><a href="http://codereflect.com/wp-content/uploads/2010/08/image7.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://codereflect.com/wp-content/uploads/2010/08/image_thumb7.png" width="545" height="342" /></a></p>
<p> I’m not covered all the parameters listed for the tweet option. Please check the documentation it’s simple as it’s. There may be a better way for doing these things. I’m not an expert web programmer. Please share if you’ve any comments. Hope you enjoy this</p>
<div class="tw_button" style="float: left; margin-right: 10px;"><a href="http://twitter.com/share?url=http%3A%2F%2Fcodereflect.com%2F2010%2F08%2F12%2Fhow-to-integrate-official-tweet-button-to-wordpress-no-plugin%2F&amp;via=codereflect&amp;text=How+to+Integrate+official+tweet+button+to+wordpress+%28no+plugin%29%3F&amp;related=sarat:Codereflect+Author&amp;lang=en&amp;count=vertical" style="" class="twitter-share-button">Tweet</a></div>

<p><a href="http://feedads.g.doubleclick.net/~a/ljQZFSIs65Em-SGqyppbVvJFmHo/0/da"><img src="http://feedads.g.doubleclick.net/~a/ljQZFSIs65Em-SGqyppbVvJFmHo/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/ljQZFSIs65Em-SGqyppbVvJFmHo/1/da"><img src="http://feedads.g.doubleclick.net/~a/ljQZFSIs65Em-SGqyppbVvJFmHo/1/di" border="0" ismap="true"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/SharingMyThoughts?a=2NHOGT_pZ4E:tO-rsd7UbPk:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/SharingMyThoughts?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/SharingMyThoughts?a=2NHOGT_pZ4E:tO-rsd7UbPk:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/SharingMyThoughts?i=2NHOGT_pZ4E:tO-rsd7UbPk:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/SharingMyThoughts?a=2NHOGT_pZ4E:tO-rsd7UbPk:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/SharingMyThoughts?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/SharingMyThoughts?a=2NHOGT_pZ4E:tO-rsd7UbPk:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/SharingMyThoughts?d=dnMXMwOfBR0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/SharingMyThoughts?a=2NHOGT_pZ4E:tO-rsd7UbPk:Uw9eXibygTk"><img src="http://feeds.feedburner.com/~ff/SharingMyThoughts?i=2NHOGT_pZ4E:tO-rsd7UbPk:Uw9eXibygTk" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/SharingMyThoughts/~4/2NHOGT_pZ4E" height="1" width="1"/>]]></content:encoded><description>Tweet
&lt;p&gt;Few hours ago, @twitter has officially released their brand new tweet button for content publishers to share their content through twitter. @TweetMeme has Retweet button integration with a number of blogging platform which was also used previously in this website. Now codereflect.com is integrated with brand new tweet button to share the content.&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;Twitter supports 3 &lt;span style="color:#777"&gt; . . . &amp;#8594; Read More: &lt;a href="http://codereflect.com/2010/08/12/how-to-integrate-official-tweet-button-to-wordpress-no-plugin/"&gt;How to Integrate official tweet button to wordpress (no plugin)?&lt;/a&gt;&lt;/span&gt;</description><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://codereflect.com/2010/08/12/how-to-integrate-official-tweet-button-to-wordpress-no-plugin/feed/</wfw:commentRss><slash:comments xmlns:slash="http://purl.org/rss/1.0/modules/slash/">4</slash:comments><feedburner:origLink>http://codereflect.com/2010/08/12/how-to-integrate-official-tweet-button-to-wordpress-no-plugin/</feedburner:origLink></item><item><title>Visual Studio 2010 – Productivity tools</title><link>http://feedproxy.google.com/~r/SharingMyThoughts/~3/sBAW2wyAVf0/</link><category>.NET</category><category>C Sharp</category><category>C++</category><category>Technology</category><category>Tips</category><category>Visual C++</category><category>Visual Studio</category><category>Visual Studio 2010</category><category>tools</category><category>Extensibility</category><category>Productivity Tools</category><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Sarath</dc:creator><pubDate>Wed, 11 Aug 2010 10:22:25 PDT</pubDate><guid isPermaLink="false">http://codereflect.com/2010/08/11/visual-studio-2010-productivity-tools/</guid><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[<div class="tw_button" style="float: left; margin-right: 10px;"><a href="http://twitter.com/share?url=http%3A%2F%2Fcodereflect.com%2F2010%2F08%2F11%2Fvisual-studio-2010-productivity-tools%2F&amp;via=codereflect&amp;text=Visual+Studio+2010+%26ndash%3B+Productivity+tools&amp;related=sarat:Codereflect+Author&amp;lang=en&amp;count=vertical" style="" class="twitter-share-button">Tweet</a></div>
<p>Most of the Visual Studio Developers are familiar with Visual Assist X developer tool. It has really nifty features for improving the productivity. It may not be too detailed refactoring facilities or so flexible features as other tools provides like DevExpress but as a whole all we like this tool. But only one problem, it’s a paid software.</p>
<p>Visual Studio IDE is consistently getting improved over the versions but still some of the feature are missing like Symbol Search, file search within the IDE until Visual Studio 2010. It’s really important while managing large projects. The best thing in the Visual Studio 2010, is the <a href="http://msdn.microsoft.com/en-us/vstudio/vextend.aspx" target="_blank">extensibility SDK</a>. It’s far more flexible and prominent comparing to it’s predecessors.</p>
<p>Microsoft has created a really helpful site to host the useful tools for Visual Studio created by developers across the world. Even Microsoft has created some really cool tools for Visual Studio which is freely available in <a href="http://visualstudiogallery.msdn.microsoft.com/en-us/" target="_blank">Visual Studio Gallery</a>.</p>
<p>Productivity tools are one of best extensions available. It contains a bunch of features to improve your Visual Studio 2010 experience. You can download it from <a href="http://visualstudiogallery.msdn.microsoft.com/en-us/d0d33361-18e2-46c0-8ff2-4adea1e34fef?SRC=Home" target="_blank">Visual Studio Gallery</a>. The features can be simply enabled and disabled through Tools-&gt;Option menu.</p>
<p><a href="http://codereflect.com/wp-content/uploads/2010/08/image.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://codereflect.com/wp-content/uploads/2010/08/image_thumb.png" width="619" height="360" /></a> </p>
<p>Let’s have a quick look into the features. Each options are described well in their home page itself. Let’s skim through the features anyway. This contains only the features I handpicked from the whole features available. You can see the entire features the home page itself. The descriptions and screenshots are given same as the extension&#8217;s homepage.</p>
<p><strong>Solution Navigator</strong><strong>&#160; (<a href="http://blogs.msdn.com/b/visualstudio/archive/2010/07/20/solution-navigator-blog-post.aspx">More Info</a>)</strong></p>
<p><a href="http://codereflect.com/wp-content/uploads/2010/08/image1.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://codereflect.com/wp-content/uploads/2010/08/image_thumb1.png" width="341" height="430" /></a> </p>
<p>This is one of the best feature.</p>
<ul>
<li>Expand code files to navigate to its classes, expand classes to navigate to their members, and so on (C# and VB only) </li>
<li>Search your solution, all the way down to class members </li>
<li>Filter your solution or projects to see just opened files, unsaved files, and so on </li>
<li>View related information about classes and members (such as references or callers/callees for C#) </li>
<li>Preview images by hovering over them, or preview rich information by hovering over code item</li>
</ul>
<p>Solution Navigator also provides interactive tooltips in C# and VB code (replacing the default “quick info” tooltips) that give you the same kind of data, but right at your fingertips.&#160; In addition to getting the tooltips on hover, you can: </p>
<ul>
<li>Press Ctrl+1 to open a relevant tooltip at the current cursor location </li>
<li>Press Ctrl+2 to quickly navigate to any class/member in the current source file</li>
</ul>
<p><strong></strong></p>
<p><strong>Ctrl + Click Go To Definition</strong>    <br />This extension gives the editor a web browser by adding clickable hyperlinks to symbols in your code as you hold down the Ctrl key.</p>
<p><strong>Align Assignments</strong>    <br />This extension is useful for making your code a little more readable by aligning the assignments when you type Ctrl+Alt+] such that it takes this:    <br /><img alt="" src="http://i3.visualstudiogallery.msdn.microsoft.com/en-us/d0d33361-18e2-46c0-8ff2-4adea1e34fef/image/file/32145/0/align1.bmp" width="224" height="89" />    <br />And turns it into this:    <br /><img alt="" src="http://i1.visualstudiogallery.msdn.microsoft.com/en-us/d0d33361-18e2-46c0-8ff2-4adea1e34fef/image/file/32146/0/align2.bmp" width="235" height="84" />    <br /><em>Please note:</em> This may conflict with your formatting settings. E.g. in C# you will need to disable: Tools-&gt;Options-&gt;Text Editor-&gt;C#-&gt;Formatting-&gt;Spacing-&gt;&quot;Ignore spaces in declaration statements&quot;</p>
<p><strong>Triple Click</strong>    <br />It’s never been easier to select a line of code from the mouse by simple triple-clicking anywhere on the line. </p>
<p><strong>Highlight Current Line</strong>    <br />As the resolution of monitors increases, it’s becoming more difficult to find the caret in the code editor.&#160; The highlight current line extension makes it easy to find the caret by highlighting the line that the caret is on in the editor.&#160; You can even configure the default colour by changing the setting for “Current Line (Extension)” and “Current Line Inactive (Extension)” in Tools Options Fonts &amp; Colors. </p>
<p><strong>HTML Copy (<a href="http://blogs.msdn.com/b/kirillosenkov/archive/2010/06/07/copy-code-in-html-format-with-visual-studio-2010.aspx">More Info</a>)</strong>    <br />This extension provides support for the HTML Clipboard format when cutting or copying code from the editor.&#160; This means that you’ll no longer have to go fix up the formatting of your code when you paste it into a TFS bug form or any other HTML based control. </p>
<p><strong>Colorized Parameter Help</strong>    <br />This extension improves consistency with the editor by applying syntax highlighting to the contents of the Parameter Help window for C# &amp;VB.    <br />Please note: Syntax highlighting colors can be customized using the display items prefixed with “Signature Help” in the “Fonts and Colors” menu.</p>
<p><strong>Tab Well UI </strong>    <br />This extension allows you to completely customize the behavior of your document tabs from the Productivity Power Tools Options: See <a href="http://blogs.msdn.com/b/visualstudio/archive/2010/06/10/document-well-2010-plus.aspx">More Info</a></p>
<p><strong>Auto Brace Completion     <br /></strong>Automatic Brace Completion improves the productivity of writing code by automatically inserting the closing code construct when the opening construct is typed for VB &amp; C#.&#160; More specifically, this extension:</p>
<ul>
<li>Supports the following constructs: (), {}, [], &lt;&gt;, “”, and ‘’.&#160; </li>
<li>Allows you to press &lt;TAB&gt; to navigate past the next enclosing brace </li>
<li>Allows you to automatically complete a statement in C# by inserting the closing semi-colon and moving you to the next line with SHIFT + ENTER</li>
</ul>
<div class="tw_button" style="float: left; margin-right: 10px;"><a href="http://twitter.com/share?url=http%3A%2F%2Fcodereflect.com%2F2010%2F08%2F11%2Fvisual-studio-2010-productivity-tools%2F&amp;via=codereflect&amp;text=Visual+Studio+2010+%26ndash%3B+Productivity+tools&amp;related=sarat:Codereflect+Author&amp;lang=en&amp;count=vertical" style="" class="twitter-share-button">Tweet</a></div>

<p><a href="http://feedads.g.doubleclick.net/~a/p-mpNycRbwiH7kwB-IniGficiVE/0/da"><img src="http://feedads.g.doubleclick.net/~a/p-mpNycRbwiH7kwB-IniGficiVE/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/p-mpNycRbwiH7kwB-IniGficiVE/1/da"><img src="http://feedads.g.doubleclick.net/~a/p-mpNycRbwiH7kwB-IniGficiVE/1/di" border="0" ismap="true"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/SharingMyThoughts?a=sBAW2wyAVf0:_CaYNYvo5Jo:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/SharingMyThoughts?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/SharingMyThoughts?a=sBAW2wyAVf0:_CaYNYvo5Jo:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/SharingMyThoughts?i=sBAW2wyAVf0:_CaYNYvo5Jo:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/SharingMyThoughts?a=sBAW2wyAVf0:_CaYNYvo5Jo:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/SharingMyThoughts?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/SharingMyThoughts?a=sBAW2wyAVf0:_CaYNYvo5Jo:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/SharingMyThoughts?d=dnMXMwOfBR0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/SharingMyThoughts?a=sBAW2wyAVf0:_CaYNYvo5Jo:Uw9eXibygTk"><img src="http://feeds.feedburner.com/~ff/SharingMyThoughts?i=sBAW2wyAVf0:_CaYNYvo5Jo:Uw9eXibygTk" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/SharingMyThoughts/~4/sBAW2wyAVf0" height="1" width="1"/>]]></content:encoded><description>Tweet
&lt;p&gt;Most of the Visual Studio Developers are familiar with Visual Assist X developer tool. It has really nifty features for improving the productivity. It may not be too detailed refactoring facilities or so flexible features as other tools provides like DevExpress but as a whole all we like this tool. But only one problem, it’s a &lt;span style="color:#777"&gt; . . . &amp;#8594; Read More: &lt;a href="http://codereflect.com/2010/08/11/visual-studio-2010-productivity-tools/"&gt;Visual Studio 2010 &amp;#8211; Productivity tools&lt;/a&gt;&lt;/span&gt;</description><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://codereflect.com/2010/08/11/visual-studio-2010-productivity-tools/feed/</wfw:commentRss><slash:comments xmlns:slash="http://purl.org/rss/1.0/modules/slash/">0</slash:comments><feedburner:origLink>http://codereflect.com/2010/08/11/visual-studio-2010-productivity-tools/</feedburner:origLink></item><item><title>Programming Direct2D – Part 1</title><link>http://feedproxy.google.com/~r/SharingMyThoughts/~3/UlT37PIe4Vw/</link><category>C++</category><category>Codeproject</category><category>Visual C++</category><category>Visual Studio</category><category>Visual Studio 2010</category><category>Windows 7</category><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Sarath</dc:creator><pubDate>Mon, 19 Jul 2010 08:00:05 PDT</pubDate><guid isPermaLink="false">http://codereflect.com/?p=1209</guid><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[<div class="tw_button" style="float: left; margin-right: 10px;"><a href="http://twitter.com/share?url=http%3A%2F%2Fcodereflect.com%2F2010%2F07%2F19%2Fprogramming-direct2d-part-1%2F&amp;via=codereflect&amp;text=Programming+Direct2D+%E2%80%93+Part+1&amp;related=sarat:Codereflect+Author&amp;lang=en&amp;count=vertical" style="" class="twitter-share-button">Tweet</a></div>
<p>Most of the native Windows Programmers are familiar with GDI, the graphics API provided under Windows. GDI is widely used in windows applications. Later, Microsoft had introduced class-based, better services through GDI+ under Windows. Both Native programmers and Managed developers are making use of GDI/GDI+ classes and APIs.</p>
<p>But GDI was too old and was introduced with the initial versions of the Windows and over the time the capabilities of graphics hardware has grown and so does the demand for creating Visually Rich UI. With Windows 7, Microsoft has introduced a totally revamped 2D graphics subsystem called <strong><a href="http://msdn.microsoft.com/en-us/library/dd370990(VS.85).aspx" target="_blank">Direct2D</a></strong> based on their prominent Direct3D platform to create high quality 2D rendering. If you know or not, <a href="http://windows.microsoft.com/en-us/windows-vista/products/features/productivity">Windows Aero</a> system is already taking advantage of graphics hardware since Windows Vista. This is supposed to replace the GDI APIs in the coming years. Direct2D is not only available under Windows 7 but Microsoft has made it available in Window Vista with the latest service pack upgrade.</p>
<p>The major advantages of the Direct2D APIs are it&#8217;s hardware accelerated and provides high quality 2D rendering. It enables the user to create visually rich applications by paying less effort, when comparing to conventional APIs .</p>
<p>GDI uses Pixel graphics but Direct2D can supports vector graphics as well, in which mathematical formulas are used to draw the lines and curves. Vector graphics provides high quality rendering independent of resolution of the device, while the pixelated graphics has dependency with resolution which may results in choppy graphics.</p>
<p>Most of the GDI APIs are not using anti-aliasing and transparency. Ofcrouse there are functions to do so but always there&#8217;s programming cost for taking advantage of these features. Also if we apply  transparency and anti-aliasing, the computations are done using CPU. Direct2D can take advantage of graphics hardware and delegate the computationally intensive tasks to <a href="http://en.wikipedia.org/wiki/Graphics_processing_unit">GPU</a>.</p>
<p><img src="http://codereflect.com/wp-content/uploads/2010/07/071910_1523_Programming11.png" alt="" /></p>
<p>Direct2D built on top of Direct3D components. The layered architecture is described below</p>
<p><img src="http://codereflect.com/wp-content/uploads/2010/07/071910_1523_Programming21.png" alt="" /></p>
<p>You can see the underlying layers are Direct3D which make use of DXGI(DirectX Graphics Infrastructure), which manages the low level graphics related tasks that are independent of DirectX graphics runtime. DXGI provides common framework for graphics components. Simultaneously a high performance software rasterizer is available when the hardware acceleration is not possible. Another advantage of Direct2D API is, it&#8217;s using lightweight COM. It&#8217;s almost like simple C++ class. No BSTRS, COM Variants, Interfaces, Apartments etc.</p>
<p>Let&#8217;s start analyzing a simple Direct2D Program</p>
<p>There are 3 main components inevitable for enabling D2D rendering your application.</p>
<ul>
<li>A rendering Window and its handle (HWND)</li>
<li><a href="http://msdn.microsoft.com/en-us/library/dd371246(VS.85).aspx">ID2D1Factory</a> object to create the Direct2D resources</li>
<li><a href="http://msdn.microsoft.com/en-us/library/dd371461(VS.85).aspx">ID2D1HwndRenderTarget</a> object to draw the scene on the window.</li>
</ul>
<p>The below example provides steps for enabling Direct2D Rendering in your MFC Application. It&#8217;s hard to describe the parameters of all APIs. Please refer them in MSDN.</p>
<p><img src="http://codereflect.com/wp-content/uploads/2010/07/071910_1523_Programming31.png" alt="" /></p>
<h2>Create your Window</h2>
<p>Here I&#8217;m taking a dialog based application for rendering. The functions and messages may change if you&#8217;re using any other type of applications like SDI or MDI. No need to reinvent the wheel, allow the wizard to create your main dialog.</p>
<h2>Prepare your Rendering Engine</h2>
<p>Let&#8217;s delegate all the rendering tasks to another class instead of managing everything in the dialog class. I call this class as Direct2DHandler.</p>
<p>The Direct2DHandler declaration goes like below and it exposes the following functions.</p>
<pre class="brush: cpp;">
#pragma once
#include &lt;d2d1.h&gt;
#include &lt;d2d1helper.h&gt;

class Direct2DHandler
{
public:
	Direct2DHandler( HWND hWnd ); // ctor
	~Direct2DHandler(void); // dtor
	HRESULT Initialize(); // Initialize the rendering
	HRESULT OnRender(); // Called from OnPaint function
	void OnResize(UINT width, UINT height);

private:
	HRESULT CreateDeviceResources(); // Create resources for drawing
	void DiscardDeviceResources(); // Release resources for drawing

private:

	HWND					m_hWnd;
	ID2D1Factory*			m_pDirect2dFactory;
	ID2D1HwndRenderTarget*	m_pRenderTarget;
	ID2D1SolidColorBrush*	m_pLightSlateGrayBrush;
	ID2D1LinearGradientBrush* m_pLinearGradientBrush;
};
</pre>
<h3>The constructor</h3>
<p>does nothing other than calling CoInitialize() function and initialize the member variables( mostly to NULL).</p>
<h3>The Initialize function</h3>
<p>creates the Direct2D factor object, which similar the HDC (context variable) in GDI.</p>
<pre class="brush: cpp;">
HRESULT Direct2DHandler::Initialize()
{
    HRESULT hr = S_OK;

    // Create a Direct2D factory.
    hr = D2D1CreateFactory(D2D1_FACTORY_TYPE_SINGLE_THREADED, &amp;m_pDirect2dFactory);

    return hr;
}
</pre>
<p><strong>OnResize</strong></p>
<p>function handles the rendering area for the render target. We will be using whole window area in this example.<span style="font-family: Consolas; font-size: 9pt;"><br />
</span></p>
<pre class="brush: cpp;">
void Direct2DHandler::OnResize(UINT width, UINT height)
{
    if (m_pRenderTarget)
    {
        // Note: This method can fail, but it's okay to ignore the
        // error here, because the error will be returned again
        // the next time EndDraw is called.
        m_pRenderTarget-&gt;Resize(D2D1::SizeU(width, height));
    }
}
</pre>
<h3>OnRender</h3>
<p>function does the following</p>
<ol>
<li>Create the device resource for drawing (if not created)</li>
<li>Render the scene to the Window</li>
<li>Release the resources if error occurred</li>
</ol>
<p>If you&#8217;re experienced 3D programming probably you might be knowing about the role of matrix and how the affects the rendering object. The matrix can be used for representing the objects coordinates system. We can apply rotation, translation (movement) etc (collectively called transformation). on a matrix and this can be used for specifying how object must be rendered. Here we&#8217;re using <span style="font-family: Consolas; font-size: 9pt;">D2D1::Matrix3x2F::Identity() </span>helper function which creates an identity matrix(object will be rendered at origin without any transformation)</p>
<p><span style="font-family: Consolas; font-size: 9pt;"> m_pRenderTarget-&gt;<a href="http://msdn.microsoft.com/en-us/library/dd742857(VS.85).aspx">SetTransform</a>(D2D1::Matrix3x2F::Identity());<br />
</span></p>
<p>We can clear the rendering area with a default color (as the dialog background filled with some default color according to Window&#8217;s theme. Here I selected white color</p>
<p><span style="font-family: Consolas; font-size: 9pt;"> m_pRenderTarget-&gt;Clear(D2D1::ColorF(D2D1::ColorF::White));<br />
</span></p>
<p>The important thing is, whatever you draw for the scene must be done between BeginDraw() and EndDraw() APIs. The other part of this code is simply straight forward and you can easily grasp it. See the source below.</p>
<pre class="brush: cpp;">
HRESULT Direct2DHandler::OnRender()
{
	HRESULT hr = S_OK;

	hr = CreateDeviceResources();

	if (SUCCEEDED(hr))
	{
		m_pRenderTarget-&gt;BeginDraw();
		m_pRenderTarget-&gt;SetTransform(D2D1::Matrix3x2F::Identity());
		m_pRenderTarget-&gt;Clear(D2D1::ColorF(D2D1::ColorF::White));
		D2D1_SIZE_F rtSize = m_pRenderTarget-&gt;GetSize();
		// Draw a grid background.
		int width = static_cast&lt;int&gt;(rtSize.width);
		int height = static_cast&lt;int&gt;(rtSize.height);

		// Draw two rectangles.
		D2D1_RECT_F rectangle1 = D2D1::RectF(
			rtSize.width/2 - 50.0f,
			rtSize.height/2 - 50.0f,
			rtSize.width/2 + 50.0f,
			rtSize.height/2 + 50.0f
			);

		D2D1_RECT_F rectangle2 = D2D1::RectF(
			rtSize.width/2 - 100.0f,
			rtSize.height/2 - 100.0f,
			rtSize.width/2 + 100.0f,
			rtSize.height/2 + 100.0f
			);

		// Draw the outline of a rectangle.
		m_pRenderTarget-&gt;FillRectangle(&amp;rectangle2, m_pLinearGradientBrush);

		// Draw a filled rectangle.
		m_pRenderTarget-&gt;FillRectangle(&amp;rectangle1, m_pLightSlateGrayBrush);

		hr = m_pRenderTarget-&gt;EndDraw();

	}
	if (hr == D2DERR_RECREATE_TARGET)
	{
		hr = S_OK;
		DiscardDeviceResources();
	}
	return hr;
}
</pre>
<p><strong>CreateDeviceResources</strong></p>
<p>is slightly a lengthy function to initialize the required resources for rendering, like we create pens, brushes, bitmaps etc. Here mainly I&#8217;m creating a light colored solid brush and linear gradient brush to render as depicted in above picture. The comments are inlined and please read it along with the code. It will be interesting to learn about gradient brushes. If you&#8217;ve created a gradient brush in photoshop things will be far more easy. We can put stop spots to controls the end of gradients also line can be used for representing flow and angle for the gradient. Simple isn&#8217;t it? Like we create a normal gradient. See the code below.</p>
<pre class="brush: cpp;">
HRESULT Direct2DHandler::CreateDeviceResources()
{
    HRESULT hr = S_OK;

    if (!m_pRenderTarget)
    {
        RECT rc;
        GetClientRect(m_hWnd, &amp;rc);

        D2D1_SIZE_U size = D2D1::SizeU(
            rc.right - rc.left,
            rc.bottom - rc.top
            );

        // Create a Direct2D render target.
        hr = m_pDirect2dFactory-&gt;CreateHwndRenderTarget(
            D2D1::RenderTargetProperties(),
            D2D1::HwndRenderTargetProperties(m_hWnd, size),
            &amp;m_pRenderTarget
            );

        if (SUCCEEDED(hr))
        {
            // Create a gray brush.
            hr = m_pRenderTarget-&gt;CreateSolidColorBrush(
                D2D1::ColorF(D2D1::ColorF::LightSlateGray),
                &amp;m_pLightSlateGrayBrush
                );
        }

		// Create an array of gradient stops to put in the gradient stop
		// collection that will be used in the gradient brush.
		ID2D1GradientStopCollection *pGradientStops = NULL;

		D2D1_GRADIENT_STOP gradientStops[2];
		gradientStops[0].color = D2D1::ColorF(D2D1::ColorF::Maroon, 1);
		gradientStops[0].position = 0.0f;
		gradientStops[1].color = D2D1::ColorF(D2D1::ColorF::Red, 1);
		gradientStops[1].position = 1.0f;
		// Create the ID2D1GradientStopCollection from a previously
		// declared array of D2D1_GRADIENT_STOP structs.
		hr = m_pRenderTarget-&gt;CreateGradientStopCollection(
			gradientStops,
			2,
			D2D1_GAMMA_2_2,
			D2D1_EXTEND_MODE_CLAMP,
			&amp;pGradientStops
			);
		// The line that determines the direction of the gradient starts at
		// the upper-left corner of the square and ends at the lower-right corner.

		if (SUCCEEDED(hr))
		{
			hr = m_pRenderTarget-&gt;CreateLinearGradientBrush(
				D2D1::LinearGradientBrushProperties(
				D2D1::Point2F(0, 0),
				D2D1::Point2F(300, 300)),
				pGradientStops,
				&amp;m_pLinearGradientBrush
				);
		}

    }

    return hr;
}
</pre>
<h3>DiscardDeviceResources</h3>
<p>Just releases the allocated resouces. It simply uses helper macro SafeRelease described below the code.</p>
<pre class="brush: cpp;">
void Direct2DHandler::DiscardDeviceResources()
{
    SafeRelease(&amp;m_pRenderTarget);
    SafeRelease(&amp;m_pLightSlateGrayBrush);
    SafeRelease(&amp;m_pLinearGradientBrush);
}

template&lt;class Interface&gt;
inline void SafeRelease(
    Interface **ppInterfaceToRelease
    )
{
    if (*ppInterfaceToRelease != NULL)
    {
        (*ppInterfaceToRelease)-&gt;Release();

        (*ppInterfaceToRelease) = NULL;
    }
}
</pre>
<p><strong>Initializing Rendering in Dialog class</strong></p>
<p>In the</p>
<h3>OnInitDialog function,</h3>
<p>allocate memory for the Direct2DHandler class and Initialize it. You can call this from OnCreate function as well but ensure that there&#8217;s a valid Window handle is there.</p>
<pre class="brush: cpp;">
m_pRender = new Direct2DHandler( m_hWnd );
m_pRender-&gt;Initialize();
</pre>
<h3>Disable Default Background Drawing</h3>
<p>Disable the default OnErasBkgrnd function because it may cause flickering while drawing. Also we&#8217;re occupying full client area in the dialog and the background is clearing is OnRender function itself.</p>
<pre class="brush: cpp;">
BOOL CDirect2DDemoDlg::OnEraseBkgnd(CDC* pDC)
{
    return FALSE;//CDialogEx::OnEraseBkgnd(pDC);
}
</pre>
<h3>OnSize (WM_SIZE)</h3>
<p>function handles the Window size events. It will resize render target according to the Window Size.</p>
<pre class="brush: cpp;">
void CDirect2DDemoDlg::OnSize(UINT nType, int cx, int cy)
{
    CDialogEx::OnSize(nType, cx, cy);
    if( m_pRender )
        m_pRender-&gt;OnResize( cx, cy );
}
</pre>
<h3>OnPaint function</h3>
<p>calls OnRender function of Direct2DHandler to draw the scene.</p>
<pre class="brush: cpp;">
void CDirect2DDemoDlg::OnPaint()
{
    if (IsIconic())
    {
        // code for handling when window is minimized. Check original CPP file attached.
    }
    else
    {
        // CDialogEx::OnPaint(); no need to call this.
        if( m_pRender )
            m_pRender-&gt;OnRender();
    }
}
</pre>
<h3>Linking</h3>
<p>The Application must link to d2d1.lib through project settings or using #pragma comment( lib, &#8220;d2d1.lib&#8221; ) in the source file</p>
<h3> d2d1helper </h3>
<p>d2d1helper.h contains some useful functions to help the drawing. See the header for more details.</p>
<p>OK that&#8217;s the basics of creating Direct2D rendering for your Windows Application. Go ahead with the attached source code.</p>
<p>The project file is in Visual Studio 2010 format, but basically you only need to have Direct2DHandler class. You can also use other prior version of Visual Studio with Windows 7/Vista SDK.</p>
<p>Note: Take whole responsibility of downloading and executing the code shared here. Don&#8217;t sue me. It was virus free, malware free when I uploaded.</p>
<p><a href="http://cid-5544789b26bfc05d.office.live.com/embedicon.aspx/.Public/Direct2DDemo.zip">Download Demo Source code</a><br />
<iframe title ="Preview" scrolling="no" marginheight="0" marginwidth="0" frameborder="0" style="width:98px;height:115px;padding:0;background-color:#fcfcfc;" src="http://cid-5544789b26bfc05d.office.live.com/embedicon.aspx/.Public/Direct2DDemo.zip"></iframe>
<div class="tw_button" style="float: left; margin-right: 10px;"><a href="http://twitter.com/share?url=http%3A%2F%2Fcodereflect.com%2F2010%2F07%2F19%2Fprogramming-direct2d-part-1%2F&amp;via=codereflect&amp;text=Programming+Direct2D+%E2%80%93+Part+1&amp;related=sarat:Codereflect+Author&amp;lang=en&amp;count=vertical" style="" class="twitter-share-button">Tweet</a></div>

<p><a href="http://feedads.g.doubleclick.net/~a/jvxH_Z5AMMEFF2FVWvnipDJ2npQ/0/da"><img src="http://feedads.g.doubleclick.net/~a/jvxH_Z5AMMEFF2FVWvnipDJ2npQ/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/jvxH_Z5AMMEFF2FVWvnipDJ2npQ/1/da"><img src="http://feedads.g.doubleclick.net/~a/jvxH_Z5AMMEFF2FVWvnipDJ2npQ/1/di" border="0" ismap="true"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/SharingMyThoughts?a=UlT37PIe4Vw:91Fzb5jlmi8:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/SharingMyThoughts?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/SharingMyThoughts?a=UlT37PIe4Vw:91Fzb5jlmi8:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/SharingMyThoughts?i=UlT37PIe4Vw:91Fzb5jlmi8:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/SharingMyThoughts?a=UlT37PIe4Vw:91Fzb5jlmi8:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/SharingMyThoughts?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/SharingMyThoughts?a=UlT37PIe4Vw:91Fzb5jlmi8:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/SharingMyThoughts?d=dnMXMwOfBR0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/SharingMyThoughts?a=UlT37PIe4Vw:91Fzb5jlmi8:Uw9eXibygTk"><img src="http://feeds.feedburner.com/~ff/SharingMyThoughts?i=UlT37PIe4Vw:91Fzb5jlmi8:Uw9eXibygTk" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/SharingMyThoughts/~4/UlT37PIe4Vw" height="1" width="1"/>]]></content:encoded><description>Tweet
&lt;p&gt;Most of the native Windows Programmers are familiar with GDI, the graphics API provided under Windows. GDI is widely used in windows applications. Later, Microsoft had introduced class-based, better services through GDI+ under Windows. Both Native programmers and Managed developers are making use of GDI/GDI+ classes and APIs.&lt;/p&gt;
&lt;p&gt;But GDI was too old and was introduced with &lt;span style="color:#777"&gt; . . . &amp;#8594; Read More: &lt;a href="http://codereflect.com/2010/07/19/programming-direct2d-part-1/"&gt;Programming Direct2D – Part 1&lt;/a&gt;&lt;/span&gt;</description><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://codereflect.com/2010/07/19/programming-direct2d-part-1/feed/</wfw:commentRss><slash:comments xmlns:slash="http://purl.org/rss/1.0/modules/slash/">1</slash:comments><feedburner:origLink>http://codereflect.com/2010/07/19/programming-direct2d-part-1/</feedburner:origLink></item><item><title>Visual Studio 2010 – Theme Editor &amp; Hide Main Menubar extension</title><link>http://feedproxy.google.com/~r/SharingMyThoughts/~3/ANtLBdeoRuA/</link><category>Visual Studio</category><category>Visual Studio 2010</category><category>Visual Studio Editor</category><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Sarath</dc:creator><pubDate>Fri, 09 Jul 2010 09:09:40 PDT</pubDate><guid isPermaLink="false">http://codereflect.com/2010/07/09/visual-studio-2010-theme-editor/</guid><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[<div class="tw_button" style="float: left; margin-right: 10px;"><a href="http://twitter.com/share?url=http%3A%2F%2Fcodereflect.com%2F2010%2F07%2F09%2Fvisual-studio-2010-theme-editor%2F&amp;via=codereflect&amp;text=Visual+Studio+2010+%26ndash%3B+Theme+Editor+%26amp%3B+Hide+Main+Menubar+extension&amp;related=sarat:Codereflect+Author&amp;lang=en&amp;count=vertical" style="" class="twitter-share-button">Tweet</a></div>
<p>Are you really bored of the default appearance of Visual Studio? Even it’s quite different from Normal Windows (XP) Menus and toolbars, yea I’m sure it’s really nice if we can customize the colors based on our mood. </p>
<p>Here’s a free tool to play around with Visual Studio 2010. You can edit the theme for Visual Studio with <a href="http://visualstudiogallery.msdn.microsoft.com/en-us/20cd93a2-c435-4d00-a797-499f16402378">Visual Studio Color Theme Editor</a>. It comes up with some default flavors of themes but we can also customize or download pre-created themes from any website. You can see a bunch of extensions, tools, themes etc. at <a href="http://visualstudiogallery.msdn.microsoft.com/en-us">Visual Studio Gallery</a>.</p>
<p><a href="http://codereflect.com/wp-content/uploads/2010/07/image.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://codereflect.com/wp-content/uploads/2010/07/image_thumb.png" width="505" height="348" /></a> </p>
<p>Also <a href="http://studiostyles.info/">studiostyles.info</a> contains 100’s of themes to satisfy your moods. The Visual Studio 2010 extensibility library contains lot of gems to make everything in your way. Not only themes, the whole Visual Studio and it’s contents can be taken in your hand using <a href="http://msdn.microsoft.com/en-us/vstudio/vextend.aspx">Visual Studio 2010 SDK</a>. It’s much more flexible and innovative than it’s predecessors. You can get a bit more <a href="http://blogs.msdn.com/b/visualstudio/archive/2010/01/04/changing-visual-studio-s-color-palette.aspx" target="_blank">detailed scoop here</a>. Anyways have a nice time with colors <img src='http://codereflect.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><strong>Bonus: </strong>How many of you guys are fascinated with keyboard shortcuts? I usually use mouse only if I can’t operate something with keyobard. Have you ever wished, if we could hide the unusable menubar? Matthew Johnson has written a nice <a href="http://visualstudiogallery.msdn.microsoft.com/en-us/bdbcffca-32a6-4034-8e89-c31b86ad4813">extension to hide the menubar from Visual Studio 2010 IDE</a>. On hitting, alt key will enable the menubar again. You can directly press the Alt+ Any (valid) key (e.g. Alt+F, Alt+T etc.)</p>
<p><a href="http://codereflect.com/wp-content/uploads/2010/07/image1.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://codereflect.com/wp-content/uploads/2010/07/image_thumb1.png" width="422" height="175" /></a></p>
<div class="tw_button" style="float: left; margin-right: 10px;"><a href="http://twitter.com/share?url=http%3A%2F%2Fcodereflect.com%2F2010%2F07%2F09%2Fvisual-studio-2010-theme-editor%2F&amp;via=codereflect&amp;text=Visual+Studio+2010+%26ndash%3B+Theme+Editor+%26amp%3B+Hide+Main+Menubar+extension&amp;related=sarat:Codereflect+Author&amp;lang=en&amp;count=vertical" style="" class="twitter-share-button">Tweet</a></div>

<p><a href="http://feedads.g.doubleclick.net/~a/GXywSmF63N2vuTumb2Qz8aM3p0Y/0/da"><img src="http://feedads.g.doubleclick.net/~a/GXywSmF63N2vuTumb2Qz8aM3p0Y/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/GXywSmF63N2vuTumb2Qz8aM3p0Y/1/da"><img src="http://feedads.g.doubleclick.net/~a/GXywSmF63N2vuTumb2Qz8aM3p0Y/1/di" border="0" ismap="true"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/SharingMyThoughts?a=ANtLBdeoRuA:a-fXeV0MiX0:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/SharingMyThoughts?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/SharingMyThoughts?a=ANtLBdeoRuA:a-fXeV0MiX0:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/SharingMyThoughts?i=ANtLBdeoRuA:a-fXeV0MiX0:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/SharingMyThoughts?a=ANtLBdeoRuA:a-fXeV0MiX0:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/SharingMyThoughts?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/SharingMyThoughts?a=ANtLBdeoRuA:a-fXeV0MiX0:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/SharingMyThoughts?d=dnMXMwOfBR0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/SharingMyThoughts?a=ANtLBdeoRuA:a-fXeV0MiX0:Uw9eXibygTk"><img src="http://feeds.feedburner.com/~ff/SharingMyThoughts?i=ANtLBdeoRuA:a-fXeV0MiX0:Uw9eXibygTk" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/SharingMyThoughts/~4/ANtLBdeoRuA" height="1" width="1"/>]]></content:encoded><description>Tweet
&lt;p&gt;Are you really bored of the default appearance of Visual Studio? Even it’s quite different from Normal Windows (XP) Menus and toolbars, yea I’m sure it’s really nice if we can customize the colors based on our mood. &lt;/p&gt;
&lt;p&gt;Here’s a free tool to play around with Visual Studio 2010. You can edit the theme for Visual &lt;span style="color:#777"&gt; . . . &amp;#8594; Read More: &lt;a href="http://codereflect.com/2010/07/09/visual-studio-2010-theme-editor/"&gt;Visual Studio 2010 &amp;#8211; Theme Editor &amp;#38; Hide Main Menubar extension&lt;/a&gt;&lt;/span&gt;</description><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://codereflect.com/2010/07/09/visual-studio-2010-theme-editor/feed/</wfw:commentRss><slash:comments xmlns:slash="http://purl.org/rss/1.0/modules/slash/">0</slash:comments><feedburner:origLink>http://codereflect.com/2010/07/09/visual-studio-2010-theme-editor/</feedburner:origLink></item><item><title>Windows  7: Task Dialog Part 2 – A more detailed task dialog</title><link>http://feedproxy.google.com/~r/SharingMyThoughts/~3/y4nlGSVXttg/</link><category>C++</category><category>Tips</category><category>Visual C++</category><category>Visual Studio</category><category>Visual Studio 2010</category><category>Windows 7</category><category>Windows Vista</category><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Sarath</dc:creator><pubDate>Wed, 07 Jul 2010 07:48:39 PDT</pubDate><guid isPermaLink="false">http://codereflect.com/?p=1196</guid><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[<div class="tw_button" style="float: left; margin-right: 10px;"><a href="http://twitter.com/share?url=http%3A%2F%2Fcodereflect.com%2F2010%2F07%2F07%2Fwindows-7-task-dialog-part-2-a-more-detailed-task-dialog%2F&amp;via=codereflect&amp;text=Windows++7%3A+Task+Dialog+Part+2+%26ndash%3B+A+more+detailed+task+dialog&amp;related=sarat:Codereflect+Author&amp;lang=en&amp;count=vertical" style="" class="twitter-share-button">Tweet</a></div>
<p>In the last installment, we’ve seen using the basic version of task dialog. But usually when we see the task dialogs in Windows Vista or 7, it’s more detailed and can have flashy icons etc. Let’s see how to take more control over the task dialogs.</p>
<p><a href="http://msdn.microsoft.com/en-us/library/bb760544(VS.85).aspx">TaskDialogIndirect</a> function can be used to have more options with task dialogs. <a href="http://msdn.microsoft.com/en-us/library/bb787473(v=VS.85).aspx">TASKDIALOGCONFIG</a> structure is used along with TaskDialogIndirect API.</p>
<p><a href="http://codereflect.com/wp-content/uploads/2010/07/clip_image001.png"><img style="display: inline; border: 0px;" title="clip_image001" src="http://codereflect.com/wp-content/uploads/2010/07/clip_image001_thumb.png" border="0" alt="clip_image001" width="456" height="326" /></a></p>
<p>As you’re seeing above the task dialog contains different type of controls, icons and capable of displaying more information to the user. It can have lengthy big buttons, radio buttons, checkbox, footer area, progressbar, custom icon, displaying predefined buttons like OK, Cancel, Yes, No etc. even we can have control over the buttons in the titlebar( minimize, maximize button etc)</p>
<p>The following code describes creating a task dialog with more flexible options. User can specify the callback functions which can be used to control the behavior if the controls and contents in the task bar. Filling the TASKDIALOGCONFIG structure is simple and straight forward as we’re seeing the code. The detailed option can be obtained from MSDN page.</p>
<pre class="brush: cpp;">

HRESULT CALLBACK CTaskDialogSampleDlg::TaskDialogCallbackProc(
  __in  HWND hwnd,
  __in  UINT uNotification,
  __in  WPARAM wParam,
  __in  LPARAM lParam,
  __in  LONG_PTR dwRefData
)
{
	if( TDN_CREATED == uNotification )
	{
		::SendMessage( hwnd, TDM_SET_BUTTON_ELEVATION_REQUIRED_STATE, IDOK, TRUE );
		::SendMessage( hwnd, TDM_SET_PROGRESS_BAR_RANGE, 0, 100 );
	}
	else if( TDN_HYPERLINK_CLICKED == uNotification )
	{
		ShellExecute( 0, L&quot;open&quot;, (LPCTSTR) lParam, 0, 0, SW_SHOW );
	}
	else if( TDN_TIMER == uNotification )
	{
		static int i = 0;
		::SendMessage( hwnd, TDM_SET_PROGRESS_BAR_POS, i++,0 );
	}

	return 0;
}

void CTaskDialogSampleDlg::OnBnClickedButton1()
{
	int nButtonPressed                  = 0;
	TASKDIALOGCONFIG config             = {0};
	const TASKDIALOG_BUTTON buttons[]   = {
		{ IDOK, L&quot;Elevate Privilege&quot; },
		{ IDCANCEL, L&quot;Run with user privilege&quot; }
	};

	const TASKDIALOG_BUTTON radiobuttons[] = {
		{ IDCANCEL, L&quot;Test Radio&quot; }};
	config.cbSize                       = sizeof(config);
	config.hInstance                    = AfxGetApp()-&gt;m_hInstance;
	config.dwCommonButtons              = TDCBF_OK_BUTTON | TDCBF_CANCEL_BUTTON;
	config.pszMainIcon                  = TD_SHIELD_ICON;
	config.pszMainInstruction           = L&quot;Main Instruction&quot;;
	config.pszContent                   = L&quot;This is the content.&quot;;
	config.pszVerificationText          = L&quot;Conifirm license agreement&quot;;
	config.pButtons                     = buttons;
	config.cButtons                     = ARRAYSIZE(buttons);
	config.pRadioButtons				= radiobuttons;
	config.cRadioButtons				= ARRAYSIZE( radiobuttons );
	config.dwFlags						= TDF_SHOW_PROGRESS_BAR |
		TDF_EXPAND_FOOTER_AREA | TDF_ENABLE_HYPERLINKS | TDF_CAN_BE_MINIMIZED
		| TDF_USE_COMMAND_LINKS | TDF_CALLBACK_TIMER;
	config.pszExpandedInformation		= _T( &quot;&lt;a href=\&quot;http://codereflect.com/\&quot; &gt;Codereflect.com&lt;/a&gt;&quot; );
	config.pfCallback = TaskDialogCallbackProc;
	BOOL bVerification = FALSE;
	TaskDialogIndirect(&amp;config, &amp;nButtonPressed, NULL, &amp;bVerification);

	switch (nButtonPressed)
	{
	case IDOK:
		break; // the user pressed button 0 (change password).
	case IDCANCEL:
		break; // user canceled the dialog
	default:
		break; // should never happen
	}
}
</pre>
<p>The callback function is also easy to manage. There are predefined set of events for each type of control and we can simply make use of these controls by sending various messages to update its state and values. One of the best example is updating the progressbar during the lifetime of messagebox. Once the timer is enabled, the callback function will be automatically fired on discrete time interval. The <a href="http://msdn.microsoft.com/en-us/library/bb760542(v=VS.85).aspx">notify messages are specified in detail in MSDN Documentation. Please check it.</a></p>
<p>To compile this source code, please use latest version of Visual Studio 2010 or any prior version with Windows Vista/7 SDK. You can also use express edition of Visual C++ to try this API.
<div class="tw_button" style="float: left; margin-right: 10px;"><a href="http://twitter.com/share?url=http%3A%2F%2Fcodereflect.com%2F2010%2F07%2F07%2Fwindows-7-task-dialog-part-2-a-more-detailed-task-dialog%2F&amp;via=codereflect&amp;text=Windows++7%3A+Task+Dialog+Part+2+%26ndash%3B+A+more+detailed+task+dialog&amp;related=sarat:Codereflect+Author&amp;lang=en&amp;count=vertical" style="" class="twitter-share-button">Tweet</a></div>

<p><a href="http://feedads.g.doubleclick.net/~a/DvaOFrInpc-jkd-T6PdMDWhqVfU/0/da"><img src="http://feedads.g.doubleclick.net/~a/DvaOFrInpc-jkd-T6PdMDWhqVfU/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/DvaOFrInpc-jkd-T6PdMDWhqVfU/1/da"><img src="http://feedads.g.doubleclick.net/~a/DvaOFrInpc-jkd-T6PdMDWhqVfU/1/di" border="0" ismap="true"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/SharingMyThoughts?a=y4nlGSVXttg:q6YOCAD03iU:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/SharingMyThoughts?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/SharingMyThoughts?a=y4nlGSVXttg:q6YOCAD03iU:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/SharingMyThoughts?i=y4nlGSVXttg:q6YOCAD03iU:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/SharingMyThoughts?a=y4nlGSVXttg:q6YOCAD03iU:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/SharingMyThoughts?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/SharingMyThoughts?a=y4nlGSVXttg:q6YOCAD03iU:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/SharingMyThoughts?d=dnMXMwOfBR0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/SharingMyThoughts?a=y4nlGSVXttg:q6YOCAD03iU:Uw9eXibygTk"><img src="http://feeds.feedburner.com/~ff/SharingMyThoughts?i=y4nlGSVXttg:q6YOCAD03iU:Uw9eXibygTk" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/SharingMyThoughts/~4/y4nlGSVXttg" height="1" width="1"/>]]></content:encoded><description>Tweet
&lt;p&gt;In the last installment, we’ve seen using the basic version of task dialog. But usually when we see the task dialogs in Windows Vista or 7, it’s more detailed and can have flashy icons etc. Let’s see how to take more control over the task dialogs.&lt;/p&gt;
&lt;p&gt;TaskDialogIndirect function can be used to have more options with task &lt;span style="color:#777"&gt; . . . &amp;#8594; Read More: &lt;a href="http://codereflect.com/2010/07/07/windows-7-task-dialog-part-2-a-more-detailed-task-dialog/"&gt;Windows  7: Task Dialog Part 2 &amp;#8211; A more detailed task dialog&lt;/a&gt;&lt;/span&gt;</description><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://codereflect.com/2010/07/07/windows-7-task-dialog-part-2-a-more-detailed-task-dialog/feed/</wfw:commentRss><slash:comments xmlns:slash="http://purl.org/rss/1.0/modules/slash/">0</slash:comments><feedburner:origLink>http://codereflect.com/2010/07/07/windows-7-task-dialog-part-2-a-more-detailed-task-dialog/</feedburner:origLink></item></channel></rss>
