<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-2149165178736128353</id><updated>2012-01-04T12:53:35.673+04:00</updated><category term='Mail'/><category term='Crystal Reports'/><category term='Code Snippets'/><category term='OpenNetCF'/><category term='LINQ'/><category term='Globalization'/><category term='Windows XP'/><category term='Visual Studio'/><category term='Pocket PC 2003 SE Emulator'/><category term='Log4net'/><category term='Subversion'/><category term='.Net 1.1'/><category term='Certification'/><category term='.Net CF 2.0'/><category term='Ashvin Gunga'/><category term='Troubleshooting'/><category term='SQL Server'/><category term='Nokia N95'/><category term='YouTube'/><category term='Tips'/><category term='Mobile Software'/><category term='Programming'/><category term='ASP.NET'/><category term='Event Logs'/><category term='JDeveloper'/><category term='C#'/><category term='Netbeans'/><category term='Windows Mobile 5.0'/><category term='Audio'/><category term='Code Coverage'/><category term='Event Viewer'/><category term='MCTS'/><category term='Dotfuscator'/><category term='Tools'/><category term='Device'/><category term='Eqatec'/><category term='Databases'/><category term='.NET 2.0'/><category term='.NET 3.5'/><title type='text'>ASHVIN'S TECHNICAL BLOG</title><subtitle type='html'>technical? personal? professional? 

It's all about sharing...</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://moiashvin-tech.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://moiashvin-tech.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>ashvin</name><uri>http://www.blogger.com/profile/00922391930245622789</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_MGI3FYgA_3c/Sz0gYk3D9UI/AAAAAAAACnU/k5b8SZoi0r4/S220/26122009454.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>77</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-2149165178736128353.post-8166889041132358983</id><published>2010-04-25T11:27:00.000+04:00</published><updated>2010-04-25T11:27:54.464+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Programming'/><category scheme='http://www.blogger.com/atom/ns#' term='Ashvin Gunga'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><title type='text'>Determine list of printers installed in C# (.Net Framework)</title><content type='html'>1. Add System.Drawing library as reference.&lt;br /&gt;&lt;br /&gt;2. Import the System.Drawing.Printing.&lt;br /&gt;&lt;div style="-moz-background-clip: -moz-initial; -moz-background-inline-policy: -moz-initial; -moz-background-origin: -moz-initial; background: white none repeat scroll 0% 0%; color: black; font-family: Courier New; font-size: 10pt;"&gt;&lt;div style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;using&lt;/span&gt; System.Drawing.Printing;&lt;br /&gt;&lt;br /&gt;&lt;div style="margin: 0px;"&gt;3. &lt;span style="color: #2b91af;"&gt;PrinterSettings&lt;/span&gt;.InstalledPrinters is a string collection of the printer names installed on the machine&lt;/div&gt;&lt;div style="margin: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin: 0px;"&gt;Example to output all printers on Console:&lt;/div&gt;&lt;div style="margin: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="-moz-background-clip: -moz-initial; -moz-background-inline-policy: -moz-initial; -moz-background-origin: -moz-initial; background: white none repeat scroll 0% 0%; color: black; font-family: Courier New; font-size: 10pt;"&gt; &lt;div style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;using&lt;/span&gt; System;&lt;/div&gt;&lt;div style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;using&lt;/span&gt; System.Collections.Generic;&lt;/div&gt;&lt;div style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;using&lt;/span&gt; System.Text;&lt;/div&gt;&lt;div style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;using&lt;/span&gt; System.Drawing.Printing;&lt;/div&gt;&lt;div style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;using&lt;/span&gt; System.Windows.Forms;&lt;/div&gt;&lt;div style="margin: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;namespace&lt;/span&gt; PrintersDemo&lt;/div&gt;&lt;div style="margin: 0px;"&gt;{&lt;/div&gt;&lt;div style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;class&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;Program&lt;/span&gt;&lt;/div&gt;&lt;div style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/div&gt;&lt;div style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;static&lt;/span&gt; &lt;span style="color: blue;"&gt;void&lt;/span&gt; Main(&lt;span style="color: blue;"&gt;string&lt;/span&gt;[] args)&lt;/div&gt;&lt;div style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/div&gt;&lt;div style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;for&lt;/span&gt;(&lt;span style="color: blue;"&gt;int&lt;/span&gt; i = 0; i &amp;lt; &lt;span style="color: #2b91af;"&gt;PrinterSettings&lt;/span&gt;.InstalledPrinters.Count; i++)&lt;/div&gt;&lt;div style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/div&gt;&lt;div style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: #2b91af;"&gt;Console&lt;/span&gt;.WriteLine(&lt;span style="color: #2b91af;"&gt;PrinterSettings&lt;/span&gt;.InstalledPrinters[i]);&lt;/div&gt;&lt;div style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/div&gt;&lt;div style="margin: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: #2b91af;"&gt;Console&lt;/span&gt;.ReadLine();&lt;/div&gt;&lt;div style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/div&gt;&lt;div style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/div&gt;&lt;div style="margin: 0px;"&gt;}&lt;/div&gt;&lt;/div&gt;&lt;div style="-moz-background-clip: -moz-initial; -moz-background-inline-policy: -moz-initial; -moz-background-origin: -moz-initial; background: white none repeat scroll 0% 0%; color: black; font-family: Courier New; font-size: 10pt;"&gt;  &lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2149165178736128353-8166889041132358983?l=moiashvin-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://moiashvin-tech.blogspot.com/feeds/8166889041132358983/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2149165178736128353&amp;postID=8166889041132358983' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/8166889041132358983'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/8166889041132358983'/><link rel='alternate' type='text/html' href='http://moiashvin-tech.blogspot.com/2010/04/determine-list-of-printers-installed-in.html' title='Determine list of printers installed in C# (.Net Framework)'/><author><name>ashvin</name><uri>http://www.blogger.com/profile/00922391930245622789</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_MGI3FYgA_3c/Sz0gYk3D9UI/AAAAAAAACnU/k5b8SZoi0r4/S220/26122009454.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2149165178736128353.post-1973072814077472905</id><published>2010-04-25T11:11:00.000+04:00</published><updated>2010-04-25T11:11:36.668+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Ashvin Gunga'/><category scheme='http://www.blogger.com/atom/ns#' term='Troubleshooting'/><category scheme='http://www.blogger.com/atom/ns#' term='JDeveloper'/><title type='text'>JDeveloper: ORA-01882: timezone region found found</title><content type='html'>&lt;div style="text-align: justify;"&gt;When trying to deploy your web application using JDeveloper to the integrated WebLogic, if you get the following error:&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;b&gt;(oracle.jbo.JboException) JBO-29000: Unexpected exception java.sql.SQLDataException, msg=ORA-01882: timezone region not found&lt;/b&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_MGI3FYgA_3c/S9PpEVDzKII/AAAAAAAACq8/0Qo6R837NOQ/s1600/timezone+region+not+found.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="290" src="http://2.bp.blogspot.com/_MGI3FYgA_3c/S9PpEVDzKII/AAAAAAAACq8/0Qo6R837NOQ/s400/timezone+region+not+found.jpg" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;then to resolve this issue,&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;1. Goto Application menu and select Project Properties&lt;/div&gt;&lt;div style="text-align: justify;"&gt;2. In the Project Properties window, On the left pane, select Run/Debug/Profile&lt;/div&gt;&lt;div style="text-align: justify;"&gt;3. On the right pane, Edit the Default configuration (or double click on Default)&lt;/div&gt;&lt;div style="text-align: justify;"&gt;4. In the Edit run configuration window, select Launch Settings&lt;/div&gt;&lt;div style="text-align: justify;"&gt;5. For 'Java option' text box, add &lt;b&gt;-Duser.timezone="+04:00"&lt;/b&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;You will probably need to save and restart JDeveloper for the changes to take effect.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2149165178736128353-1973072814077472905?l=moiashvin-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://moiashvin-tech.blogspot.com/feeds/1973072814077472905/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2149165178736128353&amp;postID=1973072814077472905' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/1973072814077472905'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/1973072814077472905'/><link rel='alternate' type='text/html' href='http://moiashvin-tech.blogspot.com/2010/04/jdeveloper-ora-01882-timezone-region.html' title='JDeveloper: ORA-01882: timezone region found found'/><author><name>ashvin</name><uri>http://www.blogger.com/profile/00922391930245622789</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_MGI3FYgA_3c/Sz0gYk3D9UI/AAAAAAAACnU/k5b8SZoi0r4/S220/26122009454.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_MGI3FYgA_3c/S9PpEVDzKII/AAAAAAAACq8/0Qo6R837NOQ/s72-c/timezone+region+not+found.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2149165178736128353.post-3442364239618157532</id><published>2010-04-24T18:12:00.000+04:00</published><updated>2010-04-24T18:12:01.721+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Tips'/><category scheme='http://www.blogger.com/atom/ns#' term='Ashvin Gunga'/><category scheme='http://www.blogger.com/atom/ns#' term='Windows XP'/><title type='text'>Command to launch Remote Desktop Connection</title><content type='html'>Just type &lt;b&gt;mstsc &lt;/b&gt;in the Run window or the command prompt window, and the Remote Desktop Connection window will pop up ...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2149165178736128353-3442364239618157532?l=moiashvin-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://moiashvin-tech.blogspot.com/feeds/3442364239618157532/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2149165178736128353&amp;postID=3442364239618157532' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/3442364239618157532'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/3442364239618157532'/><link rel='alternate' type='text/html' href='http://moiashvin-tech.blogspot.com/2010/04/command-to-launch-remote-desktop.html' title='Command to launch Remote Desktop Connection'/><author><name>ashvin</name><uri>http://www.blogger.com/profile/00922391930245622789</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_MGI3FYgA_3c/Sz0gYk3D9UI/AAAAAAAACnU/k5b8SZoi0r4/S220/26122009454.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2149165178736128353.post-1064861232668914816</id><published>2009-06-11T09:13:00.002+04:00</published><updated>2009-06-11T09:20:22.950+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Programming'/><category scheme='http://www.blogger.com/atom/ns#' term='Tips'/><category scheme='http://www.blogger.com/atom/ns#' term='Ashvin Gunga'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><title type='text'>GetDeviceVersion() in RAPI fix</title><content type='html'>&lt;div align="justify"&gt;I have got a desktop application that determines the operating system's version of the device (I have used a Windows Mobile 5.0 device) connected to PC via ActiveSync. When calling the method GetDeviceVersion() exposed in the RAPI class in the OpenNETCF.Desktop.Communication library, the application crashes with the following exceptions:&lt;br /&gt;&lt;br /&gt;When running the solution in Debug configuration:&lt;br /&gt;&lt;em&gt;System.NullReferenceException was unhandled&lt;br /&gt;Message="Object reference not set to an instance of an object."&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;When running the solution in Release configuration:&lt;br /&gt;&lt;em&gt;System.AccessViolationException was unhandled&lt;br /&gt;Message="Attempted to read or write protected memory. This is often an indication that other memory is corrupt."&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;When running the exe application:&lt;br /&gt;&lt;em&gt;Unhandled exception at 0x00000000 in XXXApplicationNameXXX.exe: 0xC0000005: Access violation reading location 0x00000000.&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;The solution to any of these issues is to PInvoke the method CeGetVersionEx() rather than the one provided in the RAPI class.&lt;br /&gt;&lt;br /&gt;&lt;div style="font-family: Courier New; font-size: 10pt; color: black; background: white;"&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: green;"&gt;//PInvoke Declarations&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;[&lt;span style="color: #2b91af;"&gt;StructLayout&lt;/span&gt;(&lt;span style="color: #2b91af;"&gt;LayoutKind&lt;/span&gt;.Sequential,&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; CharSet = &lt;span style="color: #2b91af;"&gt;CharSet&lt;/span&gt;.Unicode)]&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;struct&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;CEOSVERSIONINFO&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;{&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;internal&lt;/span&gt; &lt;span style="color: blue;"&gt;int&lt;/span&gt; dwOSVersionInfoSize;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;int&lt;/span&gt; dwMajorVersion;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;int&lt;/span&gt; dwMinorVersion;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;int&lt;/span&gt; dwBuildNumber;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;PlatformType&lt;/span&gt; dwPlatformId;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; [&lt;span style="color: #2b91af;"&gt;MarshalAs&lt;/span&gt;(&lt;span style="color: #2b91af;"&gt;UnmanagedType&lt;/span&gt;.ByValTStr, SizeConst = 128)]&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;string&lt;/span&gt; szCSDVersion;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;}&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;[&lt;span style="color: #2b91af;"&gt;DllImport&lt;/span&gt;(&lt;span style="color: #a31515;"&gt;"rapi.dll"&lt;/span&gt;, &lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; CharSet = &lt;span style="color: #2b91af;"&gt;CharSet&lt;/span&gt;.Unicode, &lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SetLastError = &lt;span style="color: blue;"&gt;true&lt;/span&gt;)]&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;internal&lt;/span&gt; &lt;span style="color: blue;"&gt;static&lt;/span&gt; &lt;span style="color: blue;"&gt;extern&lt;/span&gt; &lt;span style="color: blue;"&gt;int&lt;/span&gt; &lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; CeGetVersionEx(&lt;span style="color: blue;"&gt;ref&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;CEOSVERSIONINFO&lt;/span&gt; lpVersionInformation);&lt;/p&gt;&lt;/div&gt;&lt;br/&gt;&lt;br/&gt;&lt;div style="font-family: Courier New; font-size: 10pt; color: black; background: white;"&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: green;"&gt;//PInvoke Call&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;CEOSVERSIONINFO&lt;/span&gt; osVersionInfo = &lt;span style="color: blue;"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;CEOSVERSIONINFO&lt;/span&gt;();&lt;/p&gt;&lt;p style="margin: 0px;"&gt;CeGetVersionEx(&lt;span style="color: blue;"&gt;ref&lt;/span&gt; osVersionInfo);&lt;/p&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Source: &lt;a href="http://community.opennetcf.com/forums/t/6371.aspx"&gt;opennetcf&lt;/a&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2149165178736128353-1064861232668914816?l=moiashvin-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://moiashvin-tech.blogspot.com/feeds/1064861232668914816/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2149165178736128353&amp;postID=1064861232668914816' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/1064861232668914816'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/1064861232668914816'/><link rel='alternate' type='text/html' href='http://moiashvin-tech.blogspot.com/2009/06/getdeviceversion-in-rapi-fix.html' title='GetDeviceVersion() in RAPI fix'/><author><name>ashvin</name><uri>http://www.blogger.com/profile/00922391930245622789</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_MGI3FYgA_3c/Sz0gYk3D9UI/AAAAAAAACnU/k5b8SZoi0r4/S220/26122009454.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2149165178736128353.post-6408982094993334861</id><published>2009-05-28T14:15:00.001+04:00</published><updated>2009-05-28T14:20:46.532+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Programming'/><category scheme='http://www.blogger.com/atom/ns#' term='Tips'/><category scheme='http://www.blogger.com/atom/ns#' term='Ashvin Gunga'/><category scheme='http://www.blogger.com/atom/ns#' term='.NET 2.0'/><title type='text'>Adding the XML Declaration when calling DataSet.WriteXml(Stream stream) method</title><content type='html'>&lt;div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;"   &gt;&lt;p style="MARGIN: 0px"&gt;&lt;span style="color:blue;"&gt;using&lt;/span&gt; (&lt;span style="color:#2b91af;"&gt;DataSet&lt;/span&gt; ds = &lt;span style="color:blue;"&gt;new&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;DataSet&lt;/span&gt;())&lt;/p&gt;&lt;p style="MARGIN: 0px"&gt;{&lt;/p&gt;&lt;p style="MARGIN: 0px"&gt;&lt;span style="color:green;"&gt;//TODO: fill the ds with appropriate data&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN: 0px"&gt;&lt;span style="color:#2b91af;"&gt;XmlTextWriter&lt;/span&gt; stream = &lt;span style="color:blue;"&gt;new&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN: 0px"&gt;&lt;span style="color:#2b91af;"&gt;XmlTextWriter&lt;/span&gt;(&lt;span style="color:#a31515;"&gt;@"C:/xmltest.xml"&lt;/span&gt;, &lt;span style="color:#2b91af;"&gt;Encoding&lt;/span&gt;.UTF8);&lt;/p&gt;&lt;p style="MARGIN: 0px"&gt;ds.WriteXml(stream);&lt;/p&gt;&lt;p style="MARGIN: 0px"&gt;stream.Close();&lt;/p&gt;&lt;p style="MARGIN: 0px"&gt;}&lt;/p&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;The above example attempts to write the content of the DataSet to an xml file using the DataSet.WriteXml method. The xml file doesn't contain the XML declaration.&lt;br /&gt;&lt;br /&gt;Content of xml file:&lt;br /&gt;&lt;br /&gt;&lt;div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;"   &gt;&lt;p style="MARGIN: 0px"&gt;&lt;span style="color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;NewDataSet&lt;/span&gt;&lt;span style="color:blue;"&gt; /&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;TIP&lt;/strong&gt;: To include the XML declaration in the output file, call the method &lt;span style="color:#000099;"&gt;WriteStartDocument()&lt;/span&gt; on the stream object prior to the WriteXml() method call.&lt;br /&gt;&lt;br /&gt;&lt;div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;"   &gt;&lt;p style="MARGIN: 0px"&gt;&lt;span style="color:blue;"&gt;using&lt;/span&gt; (&lt;span style="color:#2b91af;"&gt;DataSet&lt;/span&gt; ds = &lt;span style="color:blue;"&gt;new&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;DataSet&lt;/span&gt;())&lt;/p&gt;&lt;p style="MARGIN: 0px"&gt;{&lt;/p&gt;&lt;p style="MARGIN: 0px"&gt;&lt;span style="color:green;"&gt;//TODO: fill the ds with appropriate data&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN: 0px"&gt;&lt;span style="color:#2b91af;"&gt;XmlTextWriter&lt;/span&gt; stream = &lt;span style="color:blue;"&gt;new&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN: 0px"&gt;&lt;span style="color:#2b91af;"&gt;XmlTextWriter&lt;/span&gt;(&lt;span style="color:#a31515;"&gt;@"C:/xmltest.xml"&lt;/span&gt;, &lt;span style="color:#2b91af;"&gt;Encoding&lt;/span&gt;.UTF8);&lt;/p&gt;&lt;p style="MARGIN: 0px"&gt;&lt;strong&gt;stream.WriteStartDocument();&lt;/strong&gt;&lt;/p&gt;&lt;p style="MARGIN: 0px"&gt;ds.WriteXml(stream);&lt;/p&gt;&lt;p style="MARGIN: 0px"&gt;stream.Close();&lt;/p&gt;&lt;p style="MARGIN: 0px"&gt;}&lt;/p&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Content of xml file:&lt;br /&gt;&lt;br /&gt;&lt;div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;"   &gt;&lt;p style="MARGIN: 0px"&gt;&lt;span style="color:blue;"&gt;&amp;lt;?&lt;/span&gt;&lt;span style="color:#a31515;"&gt;xml&lt;/span&gt;&lt;span style="color:blue;"&gt; &lt;/span&gt;&lt;span style="color:red;"&gt;version&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;"&lt;span style="color:blue;"&gt;1.0&lt;/span&gt;"&lt;span style="color:blue;"&gt; &lt;/span&gt;&lt;span style="color:red;"&gt;encoding&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;"&lt;span style="color:blue;"&gt;utf-8&lt;/span&gt;"&lt;span style="color:blue;"&gt;?&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN: 0px"&gt;&lt;span style="color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;NewDataSet&lt;/span&gt;&lt;span style="color:blue;"&gt; /&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2149165178736128353-6408982094993334861?l=moiashvin-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://moiashvin-tech.blogspot.com/feeds/6408982094993334861/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2149165178736128353&amp;postID=6408982094993334861' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/6408982094993334861'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/6408982094993334861'/><link rel='alternate' type='text/html' href='http://moiashvin-tech.blogspot.com/2009/05/adding-xml-declaration-when-calling.html' title='Adding the XML Declaration when calling DataSet.WriteXml(Stream stream) method'/><author><name>ashvin</name><uri>http://www.blogger.com/profile/00922391930245622789</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_MGI3FYgA_3c/Sz0gYk3D9UI/AAAAAAAACnU/k5b8SZoi0r4/S220/26122009454.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2149165178736128353.post-7107532449362945143</id><published>2009-05-24T20:12:00.006+04:00</published><updated>2009-05-24T20:32:02.247+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Programming'/><category scheme='http://www.blogger.com/atom/ns#' term='.NET 3.5'/><title type='text'>Application Settings in .Net Framework</title><content type='html'>&lt;div align="justify"&gt;The .Net Framework allows us to create and access values that persist from application session to application session. These values are called settings.For example, settings can be used to store user preferences, color scheme of application, or web server address used by the application.&lt;br /&gt;&lt;br /&gt;Settings have four properties: &lt;u&gt;Name&lt;/u&gt; (also used to access it at run-time), &lt;u&gt;Type&lt;/u&gt; (represents type of setting), &lt;u&gt;Value&lt;/u&gt; and &lt;u&gt;Scope&lt;/u&gt; (can be either User or Application). A setting with Application scope represents a value that is used by the entire application regardless of the user, whereas a setting with User scope is more likely to be user-specific.&lt;br /&gt;&lt;br /&gt;&lt;em&gt;Application&lt;/em&gt; settings are read-only and values can be changed at design time, while &lt;em&gt;User&lt;/em&gt; settings can be changed at run-time as well.&lt;br /&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;/div&gt;&lt;br /&gt;&lt;div align="justify"&gt;The Settings Editor in Visual Studio can be opened by double click Settings.settings under the Properties folder in Solution Explorer.&lt;/div&gt;&lt;br /&gt;&lt;a href="http://1.bp.blogspot.com/_MGI3FYgA_3c/ShlzCXYw5oI/AAAAAAAACnI/_DMuGt7it_k/s1600-h/ApplicationSettings.jpg"&gt;&lt;img style="MARGIN: 0px 10px 10px 0px; WIDTH: 400px; HEIGHT: 195px; CURSOR: hand" id="BLOGGER_PHOTO_ID_5339425317699249794" border="0" alt="" src="http://1.bp.blogspot.com/_MGI3FYgA_3c/ShlzCXYw5oI/AAAAAAAACnI/_DMuGt7it_k/s400/ApplicationSettings.jpg" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;div align="justify"&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;br /&gt;&lt;strong&gt;Loading settings at run-time&lt;/strong&gt; &lt;/div&gt;&lt;p style="MARGIN: 0px; BACKGROUND: 0% 50%" align="justify"&gt;&lt;span style="color:blue;"&gt;this&lt;/span&gt;.Title = Properties.&lt;span style="color:#2b91af;"&gt;Settings&lt;/span&gt;.Default.ApplicationName;&lt;br /&gt;&lt;/p&gt;&lt;p style="MARGIN: 0px; BACKGROUND: 0% 50%" align="justify"&gt;txtName.Text = Properties.&lt;span style="color:#2b91af;"&gt;Settings&lt;/span&gt;.Default.Name;&lt;br /&gt;&lt;/p&gt;&lt;p style="MARGIN: 0px; BACKGROUND: 0% 50%" align="justify"&gt;txtAddress.Text = Properties.&lt;span style="color:#2b91af;"&gt;Settings&lt;/span&gt;.Default.Address;&lt;br /&gt;&lt;/p&gt;&lt;p style="MARGIN: 0px; BACKGROUND: 0% 50%" align="justify"&gt;txtNationality.Text = Properties.&lt;span style="color:#2b91af;"&gt;Settings&lt;/span&gt;.Default.Nationality;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Saving user setings at run-time&lt;/strong&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style="MARGIN: 0px; BACKGROUND: 0% 50%" align="justify"&gt;Properties.&lt;span style="color:#2b91af;"&gt;Settings&lt;/span&gt;.Default.Name = txtName.Text;&lt;br /&gt;&lt;/p&gt;&lt;p style="MARGIN: 0px; BACKGROUND: 0% 50%" align="justify"&gt;Properties.&lt;span style="color:#2b91af;"&gt;Settings&lt;/span&gt;.Default.Nationality = txtNationality.Text;&lt;br /&gt;&lt;/p&gt;&lt;p style="MARGIN: 0px; BACKGROUND: 0% 50%" align="justify"&gt;Properties.&lt;span style="color:#2b91af;"&gt;Settings&lt;/span&gt;.Default.Address = txtAddress.Text;&lt;br /&gt;&lt;/p&gt;&lt;p style="MARGIN: 0px; BACKGROUND: 0% 50%" align="justify"&gt;Properties.&lt;span style="color:#2b91af;"&gt;Settings&lt;/span&gt;.Default.Save();&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://sites.google.com/site/moiashvin/downloads/ApplicationSettingsExample.rar?attredirects=0"&gt;Download Example&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2149165178736128353-7107532449362945143?l=moiashvin-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://moiashvin-tech.blogspot.com/feeds/7107532449362945143/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2149165178736128353&amp;postID=7107532449362945143' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/7107532449362945143'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/7107532449362945143'/><link rel='alternate' type='text/html' href='http://moiashvin-tech.blogspot.com/2009/05/application-settings-in-net-framework.html' title='Application Settings in .Net Framework'/><author><name>ashvin</name><uri>http://www.blogger.com/profile/00922391930245622789</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_MGI3FYgA_3c/Sz0gYk3D9UI/AAAAAAAACnU/k5b8SZoi0r4/S220/26122009454.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_MGI3FYgA_3c/ShlzCXYw5oI/AAAAAAAACnI/_DMuGt7it_k/s72-c/ApplicationSettings.jpg' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2149165178736128353.post-2293417118599293067</id><published>2009-05-14T21:46:00.003+04:00</published><updated>2009-05-14T21:51:15.717+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Programming'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><category scheme='http://www.blogger.com/atom/ns#' term='.NET 2.0'/><title type='text'>Single Instance applications using WindowsFormsApplicationBase available in Microsoft.VisualBasic.dll</title><content type='html'>&lt;div align="justify"&gt;&lt;em&gt;Have you ever thought of using the &lt;strong&gt;WindowsFormsApplicationBase &lt;/strong&gt;class (available in Microsoft.VisualBasic.dll) in a C# solution to implement a Single Instance application? &lt;/em&gt;&lt;br /&gt;&lt;br /&gt;Actually, there are a number of ways to write Single Instance applications, such as Mutexes, Processes and so on and so forth. However, the WindowsFormsApplicationBase class provides a very elegant way to achieve the same result.&lt;br /&gt;&lt;br /&gt;Click &lt;a href="http://www.openwinforms.com/single_instance_application.html"&gt;here&lt;/a&gt;, &lt;a href="http://www.hanselman.com/blog/TheWeeklySourceCode31SingleInstanceWinFormsAndMicrosoftVisualBasicdll.aspx"&gt;here&lt;/a&gt; and &lt;a href="http://blogs.msdn.com/pedrosilva/archive/2005/03/09/391381.aspx"&gt;here&lt;/a&gt; for some cool examples and as such, I don't need to write any sample code and/or demo here ;-)&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2149165178736128353-2293417118599293067?l=moiashvin-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://moiashvin-tech.blogspot.com/feeds/2293417118599293067/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2149165178736128353&amp;postID=2293417118599293067' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/2293417118599293067'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/2293417118599293067'/><link rel='alternate' type='text/html' href='http://moiashvin-tech.blogspot.com/2009/05/single-instance-applications-using.html' title='Single Instance applications using WindowsFormsApplicationBase available in Microsoft.VisualBasic.dll'/><author><name>ashvin</name><uri>http://www.blogger.com/profile/00922391930245622789</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_MGI3FYgA_3c/Sz0gYk3D9UI/AAAAAAAACnU/k5b8SZoi0r4/S220/26122009454.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2149165178736128353.post-1078916189417208792</id><published>2009-04-21T09:26:00.003+04:00</published><updated>2009-04-21T09:39:57.450+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='.Net CF 2.0'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><category scheme='http://www.blogger.com/atom/ns#' term='Visual Studio'/><title type='text'>Smart Device CAB Project includes wrong localized resources</title><content type='html'>&lt;div style="text-align: justify;"&gt;&lt;a href="http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=117453"&gt;http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=117453&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;When the projects in Visual Studion 2005 are compiled, different satellite assemblies are normally generated in different folders e.g. \obj\release\&lt;%lang%&gt;\ where &lt;%lang%&gt; can be fr, gb and pt, just to mention a few.&lt;br /&gt;&lt;br /&gt;The INF file contents will also point to the different resource aseemblies for each resource. (though the name of these assemblies are same, the path are still different). However, I think the CabWiz.exe believes that all these assemblies are same (as they share the same name), and hence include the same assembly in the cab file for each different language.&lt;br /&gt;&lt;br /&gt;The issue and workarounds described in the above link.&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2149165178736128353-1078916189417208792?l=moiashvin-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://moiashvin-tech.blogspot.com/feeds/1078916189417208792/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2149165178736128353&amp;postID=1078916189417208792' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/1078916189417208792'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/1078916189417208792'/><link rel='alternate' type='text/html' href='http://moiashvin-tech.blogspot.com/2009/04/smart-device-cab-project-includes-wrong.html' title='Smart Device CAB Project includes wrong localized resources'/><author><name>ashvin</name><uri>http://www.blogger.com/profile/00922391930245622789</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_MGI3FYgA_3c/Sz0gYk3D9UI/AAAAAAAACnU/k5b8SZoi0r4/S220/26122009454.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2149165178736128353.post-2136077321160729165</id><published>2009-02-27T15:41:00.001+05:00</published><updated>2009-02-27T15:46:23.433+05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Ashvin Gunga'/><category scheme='http://www.blogger.com/atom/ns#' term='Device'/><title type='text'>Run an application when device connects to PC via ActiveSync</title><content type='html'>&lt;div align="justify"&gt;To run an application when a PDA device connects to the PC via ActiveSync, the AutoStartOnConnect registry key can be used. The key resides at HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows CE Services\AutoStartOnConnect in the Windows Registry Editor.&lt;br /&gt;&lt;br /&gt;When a device connects to the PC, ActiveSync enumerates all the string values under the AutoStartOnConnect key and attempts to launch the specified applications.&lt;br /&gt;&lt;br /&gt;Similarly, the registry key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows CE Services\AutoStartOnDisconnect can be used when a device is disconnected from the PC. &lt;/div&gt;&lt;div align="justify"&gt;&lt;br /&gt;&lt;a href="http://2.bp.blogspot.com/_MGI3FYgA_3c/SafEDsKShDI/AAAAAAAACm4/wMbYHs6_zsY/s1600-h/AutoStartOnConnect.gif"&gt;&lt;img id="BLOGGER_PHOTO_ID_5307426253552387122" style="FLOAT: left; MARGIN: 0px 10px 10px 0px; WIDTH: 400px; CURSOR: hand; HEIGHT: 109px" alt="" src="http://2.bp.blogspot.com/_MGI3FYgA_3c/SafEDsKShDI/AAAAAAAACm4/wMbYHs6_zsY/s400/AutoStartOnConnect.gif" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2149165178736128353-2136077321160729165?l=moiashvin-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://moiashvin-tech.blogspot.com/feeds/2136077321160729165/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2149165178736128353&amp;postID=2136077321160729165' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/2136077321160729165'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/2136077321160729165'/><link rel='alternate' type='text/html' href='http://moiashvin-tech.blogspot.com/2009/02/run-application-when-device-connects-to.html' title='Run an application when device connects to PC via ActiveSync'/><author><name>ashvin</name><uri>http://www.blogger.com/profile/00922391930245622789</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_MGI3FYgA_3c/Sz0gYk3D9UI/AAAAAAAACnU/k5b8SZoi0r4/S220/26122009454.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_MGI3FYgA_3c/SafEDsKShDI/AAAAAAAACm4/wMbYHs6_zsY/s72-c/AutoStartOnConnect.gif' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2149165178736128353.post-7981872555265820914</id><published>2009-02-04T13:46:00.001+05:00</published><updated>2009-02-04T13:52:00.590+05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Programming'/><category scheme='http://www.blogger.com/atom/ns#' term='Tips'/><category scheme='http://www.blogger.com/atom/ns#' term='Ashvin Gunga'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><category scheme='http://www.blogger.com/atom/ns#' term='.NET 2.0'/><title type='text'>Coding Style: WaitCursor encapsulation</title><content type='html'>&lt;div align="justify"&gt;Often during long processes, we need to display the WaitCursor to give feedback to the users. Changing the mouse cursor to WaitCursor, and then back to the default cursor may be achieved as follows:&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;!--{\rtf1\ansi\ansicpg\lang1024\noproof1252\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Courier New;}}{\colortbl;??\red0\green128\blue0;\red255\green255\blue255;\red43\green145\blue175;\red0\green0\blue0;}??\fs20 \cf1 // change to WaitCursor\par ??\cf3 Cursor\cf0 .Current = \cf3 Cursors\cf0 .WaitCursor;\par ??\par ??\cf1 // DO SOMETHING\par ??\par ??// change to default cursor\par ??\cf3 Cursor\cf0 .Current = \cf3 Cursors\cf0 .Default;}--&gt;&lt;p style="BACKGROUND: white; MARGIN: 0pxfont-family:Courier New;font-size:10pt;color:black;"   &gt;&lt;span style="color:#2b91af;"&gt;    1&lt;/span&gt; &lt;span style="color:green;"&gt;// change to WaitCursor&lt;/span&gt;&lt;/p&gt;&lt;p style="BACKGROUND: white; MARGIN: 0pxfont-family:Courier New;font-size:10pt;color:black;"   &gt;&lt;span style="color:#2b91af;"&gt;    2&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;Cursor&lt;/span&gt;.Current = &lt;span style="color:#2b91af;"&gt;Cursors&lt;/span&gt;.WaitCursor;&lt;/p&gt;&lt;p style="BACKGROUND: white; MARGIN: 0pxfont-family:Courier New;font-size:10pt;color:black;"   &gt;&lt;span style="color:#2b91af;"&gt;    3&lt;/span&gt; &lt;/p&gt;&lt;p style="BACKGROUND: white; MARGIN: 0pxfont-family:Courier New;font-size:10pt;color:black;"   &gt;&lt;span style="color:#2b91af;"&gt;    4&lt;/span&gt; &lt;span style="color:green;"&gt;// DO SOMETHING&lt;/span&gt;&lt;/p&gt;&lt;p style="BACKGROUND: white; MARGIN: 0pxfont-family:Courier New;font-size:10pt;color:black;"   &gt;&lt;span style="color:#2b91af;"&gt;    5&lt;/span&gt; &lt;/p&gt;&lt;p style="BACKGROUND: white; MARGIN: 0pxfont-family:Courier New;font-size:10pt;color:black;"   &gt;&lt;span style="color:#2b91af;"&gt;    6&lt;/span&gt; &lt;span style="color:green;"&gt;// change to default cursor&lt;/span&gt;&lt;/p&gt;&lt;p style="BACKGROUND: white; MARGIN: 0pxfont-family:Courier New;font-size:10pt;color:black;"   &gt;&lt;span style="color:#2b91af;"&gt;    7&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;Cursor&lt;/span&gt;.Current = &lt;span style="color:#2b91af;"&gt;Cursors&lt;/span&gt;.Default;&lt;/p&gt;&lt;div align="justify"&gt;&lt;br /&gt;&lt;br /&gt;Now, assume that an exception is thrown during the processing (i.e. DO SOMETHING), the cursor may never change back to the default state. Hence, we may need to use a try and finally block to ensure that the cursor is changed back when either the processing is successfully completed or an exception is thrown. The code will now be as follows:&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;!--{\rtf1\ansi\ansicpg\lang1024\noproof1252\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Courier New;}}{\colortbl;??\red0\green128\blue0;\red255\green255\blue255;\red43\green145\blue175;\red0\green0\blue0;\red0\green0\blue255;}??\fs20 \cf1 // change to WaitCursor\par ??\cf3 Cursor\cf0 .Current = \cf3 Cursors\cf0 .WaitCursor;\par ??\par ??\cf5 try\par ??\cf0 \{\par ??    \cf1 // DO SOMETHING\par ??\cf0 \}\par ??\cf5 finally\par ??\cf0 \{\par ??    \cf1 // change to default cursor\par ??\cf0     \cf3 Cursor\cf0 .Current = \cf3 Cursors\cf0 .Default;\par ??\}}--&gt;&lt;p style="BACKGROUND: white; MARGIN: 0pxfont-family:Courier New;font-size:10pt;color:black;"   &gt;&lt;span style="color:#2b91af;"&gt;    1&lt;/span&gt; &lt;span style="color:green;"&gt;// change to WaitCursor&lt;/span&gt;&lt;/p&gt;&lt;p style="BACKGROUND: white; MARGIN: 0pxfont-family:Courier New;font-size:10pt;color:black;"   &gt;&lt;span style="color:#2b91af;"&gt;    2&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;Cursor&lt;/span&gt;.Current = &lt;span style="color:#2b91af;"&gt;Cursors&lt;/span&gt;.WaitCursor;&lt;/p&gt;&lt;p style="BACKGROUND: white; MARGIN: 0pxfont-family:Courier New;font-size:10pt;color:black;"   &gt;&lt;span style="color:#2b91af;"&gt;    3&lt;/span&gt; &lt;/p&gt;&lt;p style="BACKGROUND: white; MARGIN: 0pxfont-family:Courier New;font-size:10pt;color:black;"   &gt;&lt;span style="color:#2b91af;"&gt;    4&lt;/span&gt; &lt;span style="color:blue;"&gt;try&lt;/span&gt;&lt;/p&gt;&lt;p style="BACKGROUND: white; MARGIN: 0pxfont-family:Courier New;font-size:10pt;color:black;"   &gt;&lt;span style="color:#2b91af;"&gt;    5&lt;/span&gt; {&lt;/p&gt;&lt;p style="BACKGROUND: white; MARGIN: 0pxfont-family:Courier New;font-size:10pt;color:black;"   &gt;&lt;span style="color:#2b91af;"&gt;    6&lt;/span&gt;     &lt;span style="color:green;"&gt;// DO SOMETHING&lt;/span&gt;&lt;/p&gt;&lt;p style="BACKGROUND: white; MARGIN: 0pxfont-family:Courier New;font-size:10pt;color:black;"   &gt;&lt;span style="color:#2b91af;"&gt;    7&lt;/span&gt; }&lt;/p&gt;&lt;p style="BACKGROUND: white; MARGIN: 0pxfont-family:Courier New;font-size:10pt;color:black;"   &gt;&lt;span style="color:#2b91af;"&gt;    8&lt;/span&gt; &lt;span style="color:blue;"&gt;finally&lt;/span&gt;&lt;/p&gt;&lt;p style="BACKGROUND: white; MARGIN: 0pxfont-family:Courier New;font-size:10pt;color:black;"   &gt;&lt;span style="color:#2b91af;"&gt;    9&lt;/span&gt; {&lt;/p&gt;&lt;p style="BACKGROUND: white; MARGIN: 0pxfont-family:Courier New;font-size:10pt;color:black;"   &gt;&lt;span style="color:#2b91af;"&gt;   10&lt;/span&gt;     &lt;span style="color:green;"&gt;// change to default cursor&lt;/span&gt;&lt;/p&gt;&lt;p style="BACKGROUND: white; MARGIN: 0pxfont-family:Courier New;font-size:10pt;color:black;"   &gt;&lt;span style="color:#2b91af;"&gt;   11&lt;/span&gt;     &lt;span style="color:#2b91af;"&gt;Cursor&lt;/span&gt;.Current = &lt;span style="color:#2b91af;"&gt;Cursors&lt;/span&gt;.Default;&lt;/p&gt;&lt;p style="BACKGROUND: white; MARGIN: 0pxfont-family:Courier New;font-size:10pt;color:black;"   &gt;&lt;span style="color:#2b91af;"&gt;   12&lt;/span&gt; }&lt;/p&gt;&lt;div align="justify"&gt;&lt;br /&gt;&lt;br /&gt;As changing the cursor to the busy state and back to the normal state is repeated in different methods, a further improvement would be to encapsulate this piece of functionality in a class. Then, a using statement can be used to handle the cursor states during processing.&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;!--{\rtf1\ansi\ansicpg\lang1024\noproof1252\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Courier New;}}{\colortbl;??\red128\green128\blue128;\red255\green255\blue255;\red0\green128\blue0;\red0\green0\blue255;\red0\green0\blue0;\red43\green145\blue175;}??\fs20 \cf1 ///\cf3  \cf1 &lt;summary&gt;\par ??///\cf3  Handles wait cursor\par ??\cf1 ///\cf3  \cf1 &lt;/summary&gt;\par ??\cf4 public\cf0  \cf4 class\cf0  \cf6 WaitCursor\cf0  : \cf6 IDisposable\par ??\cf0 \{\par ??    \cf4 public\cf0  WaitCursor()\par ??    \{\par ??        \cf6 Cursor\cf0 .Current = \cf6 Cursors\cf0 .WaitCursor;\par ??    \}\par ??\par ??    \cf4 public\cf0  \cf4 void\cf0  Dispose()\par ??    \{\par ??        \cf6 Cursor\cf0 .Current = \cf6 Cursors\cf0 .Default;\par ??    \}\par ??\}}--&gt;&lt;p style="BACKGROUND: white; MARGIN: 0pxfont-family:Courier New;font-size:10pt;color:black;"   &gt;&lt;span style="color:#2b91af;"&gt;   23&lt;/span&gt; &lt;span style="color:gray;"&gt;///&lt;/span&gt;&lt;span style="color:green;"&gt; &lt;/span&gt;&lt;span style="color:gray;"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="BACKGROUND: white; MARGIN: 0pxfont-family:Courier New;font-size:10pt;color:black;"   &gt;&lt;span style="color:#2b91af;"&gt;   24&lt;/span&gt; &lt;span style="color:gray;"&gt;///&lt;/span&gt;&lt;span style="color:green;"&gt; Handles wait cursor&lt;/span&gt;&lt;/p&gt;&lt;p style="BACKGROUND: white; MARGIN: 0pxfont-family:Courier New;font-size:10pt;color:black;"   &gt;&lt;span style="color:#2b91af;"&gt;   25&lt;/span&gt; &lt;span style="color:gray;"&gt;///&lt;/span&gt;&lt;span style="color:green;"&gt; &lt;/span&gt;&lt;span style="color:gray;"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="BACKGROUND: white; MARGIN: 0pxfont-family:Courier New;font-size:10pt;color:black;"   &gt;&lt;span style="color:#2b91af;"&gt;   26&lt;/span&gt; &lt;span style="color:blue;"&gt;public&lt;/span&gt; &lt;span style="color:blue;"&gt;class&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;WaitCursor&lt;/span&gt; : &lt;span style="color:#2b91af;"&gt;IDisposable&lt;/span&gt;&lt;/p&gt;&lt;p style="BACKGROUND: white; MARGIN: 0pxfont-family:Courier New;font-size:10pt;color:black;"   &gt;&lt;span style="color:#2b91af;"&gt;   27&lt;/span&gt; {&lt;/p&gt;&lt;p style="BACKGROUND: white; MARGIN: 0pxfont-family:Courier New;font-size:10pt;color:black;"   &gt;&lt;span style="color:#2b91af;"&gt;   28&lt;/span&gt;     &lt;span style="color:blue;"&gt;public&lt;/span&gt; WaitCursor()&lt;/p&gt;&lt;p style="BACKGROUND: white; MARGIN: 0pxfont-family:Courier New;font-size:10pt;color:black;"   &gt;&lt;span style="color:#2b91af;"&gt;   29&lt;/span&gt;     {&lt;/p&gt;&lt;p style="BACKGROUND: white; MARGIN: 0pxfont-family:Courier New;font-size:10pt;color:black;"   &gt;&lt;span style="color:#2b91af;"&gt;   30&lt;/span&gt;         &lt;span style="color:#2b91af;"&gt;Cursor&lt;/span&gt;.Current = &lt;span style="color:#2b91af;"&gt;Cursors&lt;/span&gt;.WaitCursor;&lt;/p&gt;&lt;p style="BACKGROUND: white; MARGIN: 0pxfont-family:Courier New;font-size:10pt;color:black;"   &gt;&lt;span style="color:#2b91af;"&gt;   31&lt;/span&gt;     }&lt;/p&gt;&lt;p style="BACKGROUND: white; MARGIN: 0pxfont-family:Courier New;font-size:10pt;color:black;"   &gt;&lt;span style="color:#2b91af;"&gt;   32&lt;/span&gt; &lt;/p&gt;&lt;p style="BACKGROUND: white; MARGIN: 0pxfont-family:Courier New;font-size:10pt;color:black;"   &gt;&lt;span style="color:#2b91af;"&gt;   33&lt;/span&gt;     &lt;span style="color:blue;"&gt;public&lt;/span&gt; &lt;span style="color:blue;"&gt;void&lt;/span&gt; Dispose()&lt;/p&gt;&lt;p style="BACKGROUND: white; MARGIN: 0pxfont-family:Courier New;font-size:10pt;color:black;"   &gt;&lt;span style="color:#2b91af;"&gt;   34&lt;/span&gt;     {&lt;/p&gt;&lt;p style="BACKGROUND: white; MARGIN: 0pxfont-family:Courier New;font-size:10pt;color:black;"   &gt;&lt;span style="color:#2b91af;"&gt;   35&lt;/span&gt;         &lt;span style="color:#2b91af;"&gt;Cursor&lt;/span&gt;.Current = &lt;span style="color:#2b91af;"&gt;Cursors&lt;/span&gt;.Default;&lt;/p&gt;&lt;p style="BACKGROUND: white; MARGIN: 0pxfont-family:Courier New;font-size:10pt;color:black;"   &gt;&lt;span style="color:#2b91af;"&gt;   36&lt;/span&gt;     }&lt;/p&gt;&lt;p style="BACKGROUND: white; MARGIN: 0pxfont-family:Courier New;font-size:10pt;color:black;"   &gt;&lt;span style="color:#2b91af;"&gt;   37&lt;/span&gt; }&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;!--{\rtf1\ansi\ansicpg\lang1024\noproof1252\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Courier New;}}{\colortbl;??\red0\green0\blue255;\red255\green255\blue255;\red0\green0\blue0;\red43\green145\blue175;\red0\green128\blue0;}??\fs20 \cf1 using\cf0  (\cf1 new\cf0  \cf4 WaitCursor\cf0 ())\par ??\{\par ??   \cf5 // DO SOMETHING\par ??\cf0 \}}--&gt;&lt;div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;"   &gt;&lt;p style="MARGIN: 0px"&gt;&lt;span style="color:#2b91af;"&gt; 1742&lt;/span&gt; &lt;span style="color:blue;"&gt;using&lt;/span&gt; (&lt;span style="color:blue;"&gt;new&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;WaitCursor&lt;/span&gt;())&lt;/p&gt;&lt;p style="MARGIN: 0px"&gt;&lt;span style="color:#2b91af;"&gt; 1743&lt;/span&gt; {&lt;/p&gt;&lt;p style="MARGIN: 0px"&gt;&lt;span style="color:#2b91af;"&gt; 1744&lt;/span&gt;    &lt;span style="color:green;"&gt;// DO SOMETHING&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN: 0px"&gt;&lt;span style="color:#2b91af;"&gt; 1745&lt;/span&gt; }&lt;/p&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2149165178736128353-7981872555265820914?l=moiashvin-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://moiashvin-tech.blogspot.com/feeds/7981872555265820914/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2149165178736128353&amp;postID=7981872555265820914' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/7981872555265820914'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/7981872555265820914'/><link rel='alternate' type='text/html' href='http://moiashvin-tech.blogspot.com/2009/02/coding-style-waitcursor-encapsulation.html' title='Coding Style: WaitCursor encapsulation'/><author><name>ashvin</name><uri>http://www.blogger.com/profile/00922391930245622789</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_MGI3FYgA_3c/Sz0gYk3D9UI/AAAAAAAACnU/k5b8SZoi0r4/S220/26122009454.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2149165178736128353.post-1950555892159425198</id><published>2008-12-01T21:30:00.002+05:00</published><updated>2008-12-01T21:32:38.391+05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='MCTS'/><category scheme='http://www.blogger.com/atom/ns#' term='Ashvin Gunga'/><category scheme='http://www.blogger.com/atom/ns#' term='Certification'/><title type='text'>MCTS: .Net Framework 2.0 Windows Application achieved!</title><content type='html'>&lt;div style="text-align: justify;"&gt;Good evening everyone.&lt;br /&gt;&lt;br /&gt;Today is indeed a special day for me, as I am going to have my first ever certification. I took the &lt;a href="http://www.microsoft.com/learning/en/us/exams/70-526.mspx"&gt;70-526 Microsoft .NET Framework 2.0 – Windows-Based Client Development&lt;/a&gt; examination in the morning at the CTI Prometric Centre and I have passed with a score of 980 out of 1000.&lt;br /&gt;&lt;br /&gt;I also completed the &lt;a href="http://www.microsoft.com/learning/en/us/exams/70-536.aspx"&gt;70-536 Microsoft .NET Framework – Application Development Foundation&lt;/a&gt; examination last October (with a score of 947 out of 1000), so I am now a Microsoft Certified Technology Specialist: .NET Framework 2.0 Windows Applications.&lt;br /&gt;&lt;br /&gt;Read more about the MCTS: .Net Framework 2.0 Windows Application &lt;a href="http://www.microsoft.com/learning/mcp/mcts/winapps/default.mspx"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;There are actually about 15,469 professionals worldwide with this certification, and working as a .NET developer for more than 2 years and spending a couple of months preparing for these two examinations, I am finally going to be one of them. Objective met!!!&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2149165178736128353-1950555892159425198?l=moiashvin-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://moiashvin-tech.blogspot.com/feeds/1950555892159425198/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2149165178736128353&amp;postID=1950555892159425198' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/1950555892159425198'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/1950555892159425198'/><link rel='alternate' type='text/html' href='http://moiashvin-tech.blogspot.com/2008/12/mcts-net-framework-20-windows.html' title='MCTS: .Net Framework 2.0 Windows Application achieved!'/><author><name>ashvin</name><uri>http://www.blogger.com/profile/00922391930245622789</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_MGI3FYgA_3c/Sz0gYk3D9UI/AAAAAAAACnU/k5b8SZoi0r4/S220/26122009454.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2149165178736128353.post-6754176830596220711</id><published>2008-11-25T08:53:00.007+05:00</published><updated>2008-11-25T09:10:36.479+05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Ashvin Gunga'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL Server'/><title type='text'>Manually enable remote connections in SQL Server 2005</title><content type='html'>&lt;div align="justify"&gt;The default configuration of the SQL Server 2005 doesn't allow remote connections. Hence, the error message "An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)" when creating a new SQL Server database or connecting to an existing database in Visual Studio 2005 (VS2005).&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;a href="http://1.bp.blogspot.com/_MGI3FYgA_3c/SSt2vkAFteI/AAAAAAAAB1Y/rU3xOzbKSS0/s1600-h/Error.gif"&gt;&lt;img id="BLOGGER_PHOTO_ID_5272438348257277410" style="DISPLAY: block; MARGIN: 0px auto 10px; WIDTH: 400px; CURSOR: hand; HEIGHT: 190px; TEXT-ALIGN: center" alt="" src="http://1.bp.blogspot.com/_MGI3FYgA_3c/SSt2vkAFteI/AAAAAAAAB1Y/rU3xOzbKSS0/s400/Error.gif" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;To manually enable remote connections on the SQL Server,&lt;br /&gt;&lt;br /&gt;1. Open the SQL Server Surface Area Configuration through Start menu.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/_MGI3FYgA_3c/SSt3ospDcyI/AAAAAAAAB1g/WJ96vQHHBJs/s1600-h/SurfaceAreaConfig.gif"&gt;&lt;img id="BLOGGER_PHOTO_ID_5272439329829122850" style="DISPLAY: block; MARGIN: 0px auto 10px; WIDTH: 400px; CURSOR: hand; HEIGHT: 313px; TEXT-ALIGN: center" alt="" src="http://3.bp.blogspot.com/_MGI3FYgA_3c/SSt3ospDcyI/AAAAAAAAB1g/WJ96vQHHBJs/s400/SurfaceAreaConfig.gif" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;2. Next, select Surface Area Configuration for Services and Connections.&lt;br /&gt;&lt;br /&gt;3. On the left panel, expand the SQL Server instance -&gt; Database Engine -&gt; Remote Connections. Then, on the right panel, select Local and remote connections - Using TCP/IP only.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://2.bp.blogspot.com/_MGI3FYgA_3c/SSt4gNY49uI/AAAAAAAAB1o/_DtdpZfJ98E/s1600-h/RemoteConnections.gif"&gt;&lt;img id="BLOGGER_PHOTO_ID_5272440283512501986" style="DISPLAY: block; MARGIN: 0px auto 10px; WIDTH: 400px; CURSOR: hand; HEIGHT: 302px; TEXT-ALIGN: center" alt="" src="http://2.bp.blogspot.com/_MGI3FYgA_3c/SSt4gNY49uI/AAAAAAAAB1o/_DtdpZfJ98E/s400/RemoteConnections.gif" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;4. Also, make sure that the SQL Server Browser service is running.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://2.bp.blogspot.com/_MGI3FYgA_3c/SSt5N7SFsXI/AAAAAAAAB1w/Dgp6j8be-5w/s1600-h/SqlBrowser.gif"&gt;&lt;img id="BLOGGER_PHOTO_ID_5272441068926120306" style="DISPLAY: block; MARGIN: 0px auto 10px; WIDTH: 400px; CURSOR: hand; HEIGHT: 304px; TEXT-ALIGN: center" alt="" src="http://2.bp.blogspot.com/_MGI3FYgA_3c/SSt5N7SFsXI/AAAAAAAAB1w/Dgp6j8be-5w/s400/SqlBrowser.gif" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;5. Finally, restart the SQL Server instance. This can be done in the Services list under Administrative Tools in Control Panel.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://4.bp.blogspot.com/_MGI3FYgA_3c/SSt5nMgGaUI/AAAAAAAAB14/Jmz077aeULs/s1600-h/RestartServer.gif"&gt;&lt;img id="BLOGGER_PHOTO_ID_5272441503045019970" style="DISPLAY: block; MARGIN: 0px auto 10px; WIDTH: 400px; CURSOR: hand; HEIGHT: 213px; TEXT-ALIGN: center" alt="" src="http://4.bp.blogspot.com/_MGI3FYgA_3c/SSt5nMgGaUI/AAAAAAAAB14/Jmz077aeULs/s400/RestartServer.gif" border="0" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2149165178736128353-6754176830596220711?l=moiashvin-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://moiashvin-tech.blogspot.com/feeds/6754176830596220711/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2149165178736128353&amp;postID=6754176830596220711' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/6754176830596220711'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/6754176830596220711'/><link rel='alternate' type='text/html' href='http://moiashvin-tech.blogspot.com/2008/11/manually-enable-remote-connections-in.html' title='Manually enable remote connections in SQL Server 2005'/><author><name>ashvin</name><uri>http://www.blogger.com/profile/00922391930245622789</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_MGI3FYgA_3c/Sz0gYk3D9UI/AAAAAAAACnU/k5b8SZoi0r4/S220/26122009454.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_MGI3FYgA_3c/SSt2vkAFteI/AAAAAAAAB1Y/rU3xOzbKSS0/s72-c/Error.gif' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2149165178736128353.post-7227815361478563862</id><published>2008-11-21T08:36:00.002+05:00</published><updated>2008-11-21T08:39:12.703+05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Ashvin Gunga'/><category scheme='http://www.blogger.com/atom/ns#' term='Visual Studio'/><title type='text'>Build setup project and msi file using command-line</title><content type='html'>&lt;div align="justify"&gt;Command build the VS2005 deployment (or setup) project and create the msi file:&lt;/div&gt;&lt;div align="justify"&gt;&lt;br /&gt;"C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\devenv.exe" &lt;span style="color:#ff6600;"&gt;SOLUTIONNAME.sln&lt;/span&gt; /Build "Release" /project &lt;span style="color:#ff6600;"&gt;SETUPPROJECTNAME.vdproj&lt;/span&gt; /projectconfig "Release"&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2149165178736128353-7227815361478563862?l=moiashvin-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://moiashvin-tech.blogspot.com/feeds/7227815361478563862/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2149165178736128353&amp;postID=7227815361478563862' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/7227815361478563862'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/7227815361478563862'/><link rel='alternate' type='text/html' href='http://moiashvin-tech.blogspot.com/2008/11/build-setup-project-and-msi-file-using.html' title='Build setup project and msi file using command-line'/><author><name>ashvin</name><uri>http://www.blogger.com/profile/00922391930245622789</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_MGI3FYgA_3c/Sz0gYk3D9UI/AAAAAAAACnU/k5b8SZoi0r4/S220/26122009454.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2149165178736128353.post-2505135350522503723</id><published>2008-11-14T10:12:00.002+05:00</published><updated>2008-11-14T10:14:31.656+05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Programming'/><category scheme='http://www.blogger.com/atom/ns#' term='Ashvin Gunga'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><category scheme='http://www.blogger.com/atom/ns#' term='.NET 2.0'/><title type='text'>ArgumentException Column  does not belong to table </title><content type='html'>&lt;div align="justify"&gt;When using ADO.Net, I got the following error:&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;img id="BLOGGER_PHOTO_ID_5268376837808204722" style="DISPLAY: block; MARGIN: 0px auto 10px; WIDTH: 400px; CURSOR: hand; HEIGHT: 231px; TEXT-ALIGN: center" alt="" src="http://2.bp.blogspot.com/_MGI3FYgA_3c/SR0I0ih0K7I/AAAAAAAAB0w/2DpOaAZUhIs/s400/Column+Issue.gif" border="0" /&gt; &lt;p align="justify"&gt; Column &lt;columnname&gt;does not belong to table &lt;tablename&gt;. A simple fix will be to check if the column exists before accessing the column in the table. This can be done as follows:&lt;br /&gt;&lt;/p&gt;&lt;!--{\rtf1\ansi\ansicpg\lang1024\noproof1252\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Courier New;}}{\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0??;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;??\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;??\red128\green0\blue128;\red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;??\red192\green192\blue192;}??\fs20 \cf2 if\cf0  (row.Table.Columns.Contains(ColumnName))\par ??\{\par ??    \cf11 // proceed here\par ??\cf0 \}}--&gt;&lt;p style="BACKGROUND: white; MARGIN: 0pxfont-family:Courier New;font-size:8pt;color:black;"   &gt;&lt;span style="color:blue;"&gt;if&lt;/span&gt; (row.Table.Columns.Contains(ColumnName))&lt;/p&gt;&lt;p style="BACKGROUND: white; MARGIN: 0pxfont-family:Courier New;font-size:8pt;color:black;"   &gt;{&lt;/p&gt;&lt;p style="BACKGROUND: white; MARGIN: 0px" face="Courier New" size="8pt" color="black"&gt;   &lt;span style="color:green;"&gt;// proceed here&lt;/span&gt;&lt;/p&gt;&lt;p style="BACKGROUND: white; MARGIN: 0px" face="Courier New" size="8pt" color="black"&gt;}&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2149165178736128353-2505135350522503723?l=moiashvin-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://moiashvin-tech.blogspot.com/feeds/2505135350522503723/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2149165178736128353&amp;postID=2505135350522503723' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/2505135350522503723'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/2505135350522503723'/><link rel='alternate' type='text/html' href='http://moiashvin-tech.blogspot.com/2008/11/argumentexception-column-does-not.html' title='ArgumentException Column &lt;ColumnName&gt; does not belong to table &lt;TableName&gt;'/><author><name>ashvin</name><uri>http://www.blogger.com/profile/00922391930245622789</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_MGI3FYgA_3c/Sz0gYk3D9UI/AAAAAAAACnU/k5b8SZoi0r4/S220/26122009454.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_MGI3FYgA_3c/SR0I0ih0K7I/AAAAAAAAB0w/2DpOaAZUhIs/s72-c/Column+Issue.gif' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2149165178736128353.post-7560296632129899449</id><published>2008-10-27T16:55:00.009+05:00</published><updated>2008-10-27T23:33:22.537+05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Code Snippets'/><category scheme='http://www.blogger.com/atom/ns#' term='Ashvin Gunga'/><category scheme='http://www.blogger.com/atom/ns#' term='Visual Studio'/><title type='text'>Code Snippets: Monitor class for thread-safety</title><content type='html'>&lt;div style="text-align: justify;"&gt;Code Snippets is an interesting in-built feature of Visual Studio 2005. Code snippets are normally used in the Code Editor by first typing a shortcut (short name or alias), and then pressing TAB key. The code snippet shortcut/alias will then expand into a programming construct. This can make writing program code quicker, easier and more reliable.&lt;br /&gt;&lt;br /&gt;To use the code snippets, use any of the follwing ways:&lt;br /&gt;&lt;br /&gt;1. Right click in Code Editor and select the Insert Code Snippet menu command,&lt;br /&gt;2. Activate the code snippet list by typing CTRL + K followed by X.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://2.bp.blogspot.com/_MGI3FYgA_3c/SQWtL-nDwvI/AAAAAAAAB0A/Mt8qfwm_RV8/s1600-h/CodeSnippet.gif"&gt;&lt;img id="BLOGGER_PHOTO_ID_5261802160949281522" style="margin: 0px auto 10px; display: block; width: 400px; height: 168px; text-align: center;" alt="" src="http://2.bp.blogspot.com/_MGI3FYgA_3c/SQWtL-nDwvI/AAAAAAAAB0A/Mt8qfwm_RV8/s400/CodeSnippet.gif" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;The Code Snippets Manager, found under the Tools menu, allows us to manage code snippets (add/remove) that will be available to insert into the code. It can also be accessted by CTRL K, followed by B.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://1.bp.blogspot.com/_MGI3FYgA_3c/SQWs94cebJI/AAAAAAAABz4/7ZJZb-Oo1Ow/s1600-h/CodeSnippetMgr.gif"&gt;&lt;img id="BLOGGER_PHOTO_ID_5261801918776110226" style="margin: 0px auto 10px; display: block; width: 400px; height: 302px; text-align: center;" alt="" src="http://1.bp.blogspot.com/_MGI3FYgA_3c/SQWs94cebJI/AAAAAAAABz4/7ZJZb-Oo1Ow/s400/CodeSnippetMgr.gif" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;The code snippets are stored as XML in .snippet files, and any user-defined snippet can be easily imported through the Code Snippets Manager and used during coding.&lt;br /&gt;&lt;br /&gt;As a example, I will write a code snippet in order to use the Monitor.Enter and Monitor.Exit methods for thread-safe code (as we already have the 'lock' code snippet in VS2005) as shown below:&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div    style="background: white none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;font-family:Courier New;font-size:10pt;color:black;"&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="color:blue;"&gt;try&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;{&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;    System.Threading.&lt;span style="color: rgb(43, 145, 175);"&gt;Monitor&lt;/span&gt;.Enter(obj);&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt; &lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;    &lt;span style="color:green;"&gt;// do some work here&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;}&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="color:blue;"&gt;finally&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;{&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;    System.Threading.&lt;span style="color: rgb(43, 145, 175);"&gt;Monitor&lt;/span&gt;.Exit(obj);&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;}&lt;/pre&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&gt;&gt;&gt; Create the code snippet and store it as monitor.xml&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div    style="background: white none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;font-family:Courier New;font-size:10pt;color:black;"&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="color:blue;"&gt;&amp;lt;?&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;xml&lt;/span&gt;&lt;span style="color:blue;"&gt; &lt;/span&gt;&lt;span style="color:red;"&gt;version&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;"&lt;span style="color:blue;"&gt;1.0&lt;/span&gt;"&lt;span style="color:blue;"&gt; &lt;/span&gt;&lt;span style="color:red;"&gt;encoding&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;"&lt;span style="color:blue;"&gt;utf-8&lt;/span&gt;"&lt;span style="color:blue;"&gt; ?&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;CodeSnippets&lt;/span&gt;&lt;span style="color:blue;"&gt; &lt;/span&gt;&lt;span style="color:red;"&gt;xmlns&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;"&lt;span style="color:blue;"&gt;http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet&lt;/span&gt;"&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="color:blue;"&gt;  &amp;lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;CodeSnippet&lt;/span&gt;&lt;span style="color:blue;"&gt; &lt;/span&gt;&lt;span style="color:red;"&gt;Format&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;"&lt;span style="color:blue;"&gt;1.0.0&lt;/span&gt;"&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="color:blue;"&gt;    &amp;lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;Header&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="color:blue;"&gt;      &amp;lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;Title&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;monitor&lt;span style="color:blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;Title&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="color:blue;"&gt;      &amp;lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;Shortcut&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;monitor&lt;span style="color:blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;Shortcut&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="color:blue;"&gt;      &amp;lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;Description&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;Code snippet to use Monitor class for thread-safety&lt;span style="color:blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;Description&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="color:blue;"&gt;      &amp;lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;Author&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;Ashvin Gunga&lt;span style="color:blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;Author&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="color:blue;"&gt;      &amp;lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;SnippetTypes&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="color:blue;"&gt;        &amp;lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;SnippetType&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;Expansion&lt;span style="color:blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;SnippetType&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="color:blue;"&gt;      &amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;SnippetTypes&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="color:blue;"&gt;    &amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;Header&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="color:blue;"&gt;    &amp;lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;Snippet&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="color:blue;"&gt;      &amp;lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;Declarations&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="color:blue;"&gt;        &amp;lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;Literal&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="color:blue;"&gt;          &amp;lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;ID&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;expression&lt;span style="color:blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;ID&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="color:blue;"&gt;          &amp;lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;ToolTip&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;Expression to evaluate&lt;span style="color:blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;ToolTip&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="color:blue;"&gt;          &amp;lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;Default&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;AnObject&lt;span style="color:blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;Default&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="color:blue;"&gt;        &amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;Literal&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="color:blue;"&gt;      &amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;Declarations&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="color:blue;"&gt;      &amp;lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;Code&lt;/span&gt;&lt;span style="color:blue;"&gt; &lt;/span&gt;&lt;span style="color:red;"&gt;Language&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;"&lt;span style="color:blue;"&gt;csharp&lt;/span&gt;"&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="color:blue;"&gt;        &amp;lt;![CDATA[&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="color:gray;"&gt;          try&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="color:gray;"&gt;          {&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="color:gray;"&gt;          System.Threading.Monitor.Enter($expression$);&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="color:gray;"&gt;          //TODO: Enter your code here&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="color:gray;"&gt;          $selected$ $end$&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="color:gray;"&gt;          }&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="color:gray;"&gt;          finally&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="color:gray;"&gt;          {&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="color:gray;"&gt;          System.Threading.Monitor.Exit($expression$);&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="color:gray;"&gt;          }&lt;/span&gt;&lt;span style="color:blue;"&gt;]]&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="color:blue;"&gt;      &amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;Code&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="color:blue;"&gt;    &amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;Snippet&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="color:blue;"&gt;  &amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;CodeSnippet&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="color:blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;CodeSnippets&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&gt;&gt;&gt; Use the Code Snippets Manager and import the monitor.snippet file under My Code Snippets&lt;br /&gt;&lt;br /&gt;&lt;a href="http://4.bp.blogspot.com/_MGI3FYgA_3c/SQWs1yIp39I/AAAAAAAABzw/fXvTiS7vink/s1600-h/CodeSnippetImport.gif"&gt;&lt;img id="BLOGGER_PHOTO_ID_5261801779643408338" style="margin: 0px auto 10px; display: block; width: 400px; height: 301px; text-align: center;" alt="" src="http://4.bp.blogspot.com/_MGI3FYgA_3c/SQWs1yIp39I/AAAAAAAABzw/fXvTiS7vink/s400/CodeSnippetImport.gif" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&gt;&gt;&gt; Now, in the code, type monitor and press TAB. The monitor shortcut is expanded to:&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Courier New; font-size: 10pt; color: black; background: white;"&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;try&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;{&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Threading.&lt;span style="color: #2b91af;"&gt;Monitor&lt;/span&gt;.Enter(AnObject);&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: green;"&gt;//TODO: Enter your code here&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;}&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;finally&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;{&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Threading.&lt;span style="color: #2b91af;"&gt;Monitor&lt;/span&gt;.Exit(AnObject);&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;}&lt;/pre&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 102, 0); font-weight: bold;"&gt;Downloads&lt;/span&gt;&lt;br /&gt;&lt;a href="http://msdn.microsoft.com/en-us/vs2005/aa718338.aspx"&gt;Visual Studio 2005 Code Snippets&lt;/a&gt; can be downloaded &lt;a href="http://msdn.microsoft.com/en-us/cc507827.aspx"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2149165178736128353-7560296632129899449?l=moiashvin-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://moiashvin-tech.blogspot.com/feeds/7560296632129899449/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2149165178736128353&amp;postID=7560296632129899449' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/7560296632129899449'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/7560296632129899449'/><link rel='alternate' type='text/html' href='http://moiashvin-tech.blogspot.com/2008/10/code-snippets-monitor-class-for-thread.html' title='Code Snippets: Monitor class for thread-safety'/><author><name>ashvin</name><uri>http://www.blogger.com/profile/00922391930245622789</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_MGI3FYgA_3c/Sz0gYk3D9UI/AAAAAAAACnU/k5b8SZoi0r4/S220/26122009454.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_MGI3FYgA_3c/SQWtL-nDwvI/AAAAAAAAB0A/Mt8qfwm_RV8/s72-c/CodeSnippet.gif' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2149165178736128353.post-7612707007271103021</id><published>2008-10-25T10:00:00.018+04:00</published><updated>2008-10-25T11:01:26.389+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Programming'/><category scheme='http://www.blogger.com/atom/ns#' term='Ashvin Gunga'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><category scheme='http://www.blogger.com/atom/ns#' term='Crystal Reports'/><category scheme='http://www.blogger.com/atom/ns#' term='.NET 2.0'/><title type='text'>Load data from XML file into Crystal Reports</title><content type='html'>&lt;div align="justify"&gt;In this post, I will demonstrate how we can display data found in an XML file in a Crystal Report in C# using .NET Framework. It is easier to understand the whole thing when there is no need to write code for database (such as Oracle, Access or SQL) access or adapter or connection objects.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Pre-requisite:&lt;/strong&gt; Crystal Reports installed on the machine, along with Visual Studio 2005.&lt;br /&gt;&lt;br /&gt;1. The first thing is to create a new Windows Application (here I've named it XmlToCrystalReports) in VS2005.&lt;br /&gt;&lt;br /&gt;2. I will add an Employees.xml file to the project, under a DATA folder. The xml file will contain data about employees.&lt;br /&gt;&lt;br /&gt;Right click on the Windows Application in the Solution Explorer. Select Add -&gt; Add New Item. Choose XML File in the Add New Item form, name it Employees.xml and select Add..&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;a href="http://4.bp.blogspot.com/_MGI3FYgA_3c/SQK2xXfu5bI/AAAAAAAABxw/4-tFpOWpMUc/s1600-h/AddEmployeesXml.jpg"&gt;&lt;img id="BLOGGER_PHOTO_ID_5260968273959118258" style="DISPLAY: block; MARGIN: 0px auto 10px; WIDTH: 400px; CURSOR: hand; HEIGHT: 242px; TEXT-ALIGN: center" alt="" src="http://4.bp.blogspot.com/_MGI3FYgA_3c/SQK2xXfu5bI/AAAAAAAABxw/4-tFpOWpMUc/s400/AddEmployeesXml.jpg" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;3. Populate the xml file with test data.&lt;br /&gt;&lt;div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;"   &gt;&lt;pre style="MARGIN: 0px"&gt;&lt;span style="color:blue;"&gt;&amp;lt;?&lt;/span&gt;&lt;span style="color:#a31515;"&gt;xml&lt;/span&gt;&lt;span style="color:blue;"&gt; &lt;/span&gt;&lt;span style="color:red;"&gt;version&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;"&lt;span style="color:blue;"&gt;1.0&lt;/span&gt;"&lt;span style="color:blue;"&gt; &lt;/span&gt;&lt;span style="color:red;"&gt;encoding&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;"&lt;span style="color:blue;"&gt;utf-8&lt;/span&gt;"&lt;span style="color:blue;"&gt; ?&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="MARGIN: 0px"&gt;&lt;span style="color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Employees&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="MARGIN: 0px"&gt;&lt;span style="color:blue;"&gt;  &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Employee&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="MARGIN: 0px"&gt;&lt;span style="color:blue;"&gt;    &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Id&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;1&lt;span style="color:blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Id&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="MARGIN: 0px"&gt;&lt;span style="color:blue;"&gt;    &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Name&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;John&lt;span style="color:blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Name&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="MARGIN: 0px"&gt;&lt;span style="color:blue;"&gt;    &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Position&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;Team Leader&lt;span style="color:blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Position&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="MARGIN: 0px"&gt;&lt;span style="color:blue;"&gt;    &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Experience&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;6&lt;span style="color:blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Experience&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="MARGIN: 0px"&gt;&lt;span style="color:blue;"&gt;  &amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Employee&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="MARGIN: 0px"&gt;&lt;span style="color:blue;"&gt;  &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Employee&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="MARGIN: 0px"&gt;&lt;span style="color:blue;"&gt;    &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Id&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;2&lt;span style="color:blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Id&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="MARGIN: 0px"&gt;&lt;span style="color:blue;"&gt;    &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Name&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;Frank&lt;span style="color:blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Name&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="MARGIN: 0px"&gt;&lt;span style="color:blue;"&gt;    &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Position&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;Analyst Programmer&lt;span style="color:blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Position&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="MARGIN: 0px"&gt;&lt;span style="color:blue;"&gt;    &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Experience&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;3&lt;span style="color:blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Experience&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="MARGIN: 0px"&gt;&lt;span style="color:blue;"&gt;  &amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Employee&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="MARGIN: 0px"&gt;&lt;span style="color:blue;"&gt;  &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Employee&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="MARGIN: 0px"&gt;&lt;span style="color:blue;"&gt;    &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Id&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;3&lt;span style="color:blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Id&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="MARGIN: 0px"&gt;&lt;span style="color:blue;"&gt;    &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Name&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;Michael&lt;span style="color:blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Name&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="MARGIN: 0px"&gt;&lt;span style="color:blue;"&gt;    &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Position&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;Senior Analyst Programmer&lt;span style="color:blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Position&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="MARGIN: 0px"&gt;&lt;span style="color:blue;"&gt;    &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Experience&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;5&lt;span style="color:blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Experience&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="MARGIN: 0px"&gt;&lt;span style="color:blue;"&gt;  &amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Employee&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="MARGIN: 0px"&gt;&lt;span style="color:blue;"&gt;  &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Employee&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="MARGIN: 0px"&gt;&lt;span style="color:blue;"&gt;    &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Id&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;4&lt;span style="color:blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Id&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="MARGIN: 0px"&gt;&lt;span style="color:blue;"&gt;    &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Name&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;Thomas&lt;span style="color:blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Name&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="MARGIN: 0px"&gt;&lt;span style="color:blue;"&gt;    &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Position&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;Senior Analyst Programmer&lt;span style="color:blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Position&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="MARGIN: 0px"&gt;&lt;span style="color:blue;"&gt;    &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Experience&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;4&lt;span style="color:blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Experience&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="MARGIN: 0px"&gt;&lt;span style="color:blue;"&gt;  &amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Employee&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="MARGIN: 0px"&gt;&lt;span style="color:blue;"&gt;  &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Employee&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="MARGIN: 0px"&gt;&lt;span style="color:blue;"&gt;    &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Id&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;5&lt;span style="color:blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Id&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="MARGIN: 0px"&gt;&lt;span style="color:blue;"&gt;    &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Name&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;Alan&lt;span style="color:blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Name&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="MARGIN: 0px"&gt;&lt;span style="color:blue;"&gt;    &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Position&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;Trainee Analyst Programmer&lt;span style="color:blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Position&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="MARGIN: 0px"&gt;&lt;span style="color:blue;"&gt;    &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Experience&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;0.5&lt;span style="color:blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Experience&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="MARGIN: 0px"&gt;&lt;span style="color:blue;"&gt;  &amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Employee&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="MARGIN: 0px"&gt;&lt;span style="color:blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Employees&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;4. Next, I will add a Crystal Report to the project.&lt;br /&gt;&lt;br /&gt;Right click on the Windows Application in the Solution Explorer. Select Add - Add New Item.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/_MGI3FYgA_3c/SQK4sn6gjBI/AAAAAAAABx4/e84Jlp54vNY/s1600-h/AddNewItem.jpg"&gt;&lt;img id="BLOGGER_PHOTO_ID_5260970391490300946" style="DISPLAY: block; MARGIN: 0px auto 10px; WIDTH: 285px; CURSOR: hand; HEIGHT: 400px; TEXT-ALIGN: center" alt="" src="http://3.bp.blogspot.com/_MGI3FYgA_3c/SQK4sn6gjBI/AAAAAAAABx4/e84Jlp54vNY/s400/AddNewItem.jpg" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;Choose Crystal Report, name it EmployeesReport.rpt, and select Add.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://4.bp.blogspot.com/_MGI3FYgA_3c/SQK5CcU2htI/AAAAAAAAByA/s-IxgWQJN5o/s1600-h/AddNewItem_CrystalReport.jpg"&gt;&lt;img id="BLOGGER_PHOTO_ID_5260970766336689874" style="DISPLAY: block; MARGIN: 0px auto 10px; WIDTH: 400px; CURSOR: hand; HEIGHT: 243px; TEXT-ALIGN: center" alt="" src="http://4.bp.blogspot.com/_MGI3FYgA_3c/SQK5CcU2htI/AAAAAAAAByA/s-IxgWQJN5o/s400/AddNewItem_CrystalReport.jpg" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;The Crystal Reports Gallery pops up. I will leave the default options and select OK.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://1.bp.blogspot.com/_MGI3FYgA_3c/SQK57xUVlUI/AAAAAAAAByI/8w5di65v9fY/s1600-h/CreateReportDocument.jpg"&gt;&lt;img id="BLOGGER_PHOTO_ID_5260971751224218946" style="DISPLAY: block; MARGIN: 0px auto 10px; WIDTH: 333px; CURSOR: hand; HEIGHT: 400px; TEXT-ALIGN: center" alt="" src="http://1.bp.blogspot.com/_MGI3FYgA_3c/SQK57xUVlUI/AAAAAAAAByI/8w5di65v9fY/s400/CreateReportDocument.jpg" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;The Standard Report Creation Wizard is shown, along with a list of available data sources. Under Project Data -&gt; .NET Objects, double click on XmlToCrystalReports.MainForm.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://2.bp.blogspot.com/_MGI3FYgA_3c/SQK64Cl9B0I/AAAAAAAAByQ/od6E0WEaDoA/s1600-h/StandardReportCreation.jpg"&gt;&lt;img id="BLOGGER_PHOTO_ID_5260972786653660994" style="DISPLAY: block; MARGIN: 0px auto 10px; WIDTH: 400px; CURSOR: hand; HEIGHT: 315px; TEXT-ALIGN: center" alt="" src="http://2.bp.blogspot.com/_MGI3FYgA_3c/SQK64Cl9B0I/AAAAAAAAByQ/od6E0WEaDoA/s400/StandardReportCreation.jpg" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;The ADO.NET form is shown. Browse and select the Employees.xml file created earlier and choose Finish.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://4.bp.blogspot.com/_MGI3FYgA_3c/SQK70cfmRBI/AAAAAAAAByY/uofpX3CgaJI/s1600-h/ChooseXmlFile.jpg"&gt;&lt;img id="BLOGGER_PHOTO_ID_5260973824398476306" style="DISPLAY: block; MARGIN: 0px auto 10px; WIDTH: 392px; CURSOR: hand; HEIGHT: 400px; TEXT-ALIGN: center" alt="" src="http://4.bp.blogspot.com/_MGI3FYgA_3c/SQK70cfmRBI/AAAAAAAAByY/uofpX3CgaJI/s400/ChooseXmlFile.jpg" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;And we are back in the Standard Report Creation Wizard. The Employee table is now shown under the Available Data Sources tree. Select the Employee table, move it to the right under the Selected Tables tree and choose Next.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://4.bp.blogspot.com/_MGI3FYgA_3c/SQK8WugZovI/AAAAAAAAByg/pLbqRQGAGBY/s1600-h/SelectTable.jpg"&gt;&lt;img id="BLOGGER_PHOTO_ID_5260974413349233394" style="DISPLAY: block; MARGIN: 0px auto 10px; WIDTH: 400px; CURSOR: hand; HEIGHT: 313px; TEXT-ALIGN: center" alt="" src="http://4.bp.blogspot.com/_MGI3FYgA_3c/SQK8WugZovI/AAAAAAAAByg/pLbqRQGAGBY/s400/SelectTable.jpg" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;Now, we will need to select the appropriate fields to be displayed in the crystal report. So, move all the fields under the Fields to Display tree on the right and select Finish.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://1.bp.blogspot.com/_MGI3FYgA_3c/SQK83WKnBwI/AAAAAAAAByo/mxRAni8oor0/s1600-h/SelectTable.jpg"&gt;&lt;img id="BLOGGER_PHOTO_ID_5260974973751068418" style="DISPLAY: block; MARGIN: 0px auto 10px; WIDTH: 400px; CURSOR: hand; HEIGHT: 313px; TEXT-ALIGN: center" alt="" src="http://1.bp.blogspot.com/_MGI3FYgA_3c/SQK83WKnBwI/AAAAAAAAByo/mxRAni8oor0/s400/SelectTable.jpg" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;The EmployeesReport.rpt is added to the project and shown in the designer, with a pre-defined layout.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://4.bp.blogspot.com/_MGI3FYgA_3c/SQK9zTPmN2I/AAAAAAAAByw/qGpIRXe8lLE/s1600-h/ReportsRaw.jpg"&gt;&lt;img id="BLOGGER_PHOTO_ID_5260976003758831458" style="DISPLAY: block; MARGIN: 0px auto 10px; WIDTH: 400px; CURSOR: hand; HEIGHT: 145px; TEXT-ALIGN: center" alt="" src="http://4.bp.blogspot.com/_MGI3FYgA_3c/SQK9zTPmN2I/AAAAAAAAByw/qGpIRXe8lLE/s400/ReportsRaw.jpg" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;5. Format the crystal report to meet your needs (example, change font size, add title in header)&lt;br /&gt;&lt;br /&gt;&lt;a href="http://1.bp.blogspot.com/_MGI3FYgA_3c/SQK-fQr_EDI/AAAAAAAABy4/7QjVLINtiEA/s1600-h/ReportsFormatted.jpg"&gt;&lt;img id="BLOGGER_PHOTO_ID_5260976758986838066" style="DISPLAY: block; MARGIN: 0px auto 10px; WIDTH: 400px; CURSOR: hand; HEIGHT: 160px; TEXT-ALIGN: center" alt="" src="http://1.bp.blogspot.com/_MGI3FYgA_3c/SQK-fQr_EDI/AAAAAAAABy4/7QjVLINtiEA/s400/ReportsFormatted.jpg" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;6. The Solution Explorer will now be as follows:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://2.bp.blogspot.com/_MGI3FYgA_3c/SQK_C5TizaI/AAAAAAAABzA/EcrNp-4Ho1E/s1600-h/SolutionExplorer.jpg"&gt;&lt;img id="BLOGGER_PHOTO_ID_5260977371185597858" style="DISPLAY: block; MARGIN: 0px auto 10px; WIDTH: 282px; CURSOR: hand; HEIGHT: 259px; TEXT-ALIGN: center" alt="" src="http://2.bp.blogspot.com/_MGI3FYgA_3c/SQK_C5TizaI/AAAAAAAABzA/EcrNp-4Ho1E/s400/SolutionExplorer.jpg" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;7. Now to view the report when the application runs, we will need to add a Crystal Report Viewer to the main form. The Crystal Report Viewer component is available in the Toolbox under Crystal Reports.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://1.bp.blogspot.com/_MGI3FYgA_3c/SQK_doouTZI/AAAAAAAABzI/sMnMkDiHqeU/s1600-h/CrystalReportsViewer.jpg"&gt;&lt;img id="BLOGGER_PHOTO_ID_5260977830567497106" style="DISPLAY: block; MARGIN: 0px auto 10px; WIDTH: 264px; CURSOR: hand; HEIGHT: 99px; TEXT-ALIGN: center" alt="" src="http://1.bp.blogspot.com/_MGI3FYgA_3c/SQK_doouTZI/AAAAAAAABzI/sMnMkDiHqeU/s400/CrystalReportsViewer.jpg" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href="http://2.bp.blogspot.com/_MGI3FYgA_3c/SQK_-0n2FQI/AAAAAAAABzQ/kKdG0eOPzoE/s1600-h/CrystalReports_OnForm.jpg"&gt;&lt;img id="BLOGGER_PHOTO_ID_5260978400720721154" style="DISPLAY: block; MARGIN: 0px auto 10px; WIDTH: 400px; CURSOR: hand; HEIGHT: 386px; TEXT-ALIGN: center" alt="" src="http://2.bp.blogspot.com/_MGI3FYgA_3c/SQK_-0n2FQI/AAAAAAAABzQ/kKdG0eOPzoE/s400/CrystalReports_OnForm.jpg" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;We can hide the Group Tree found on the left by setting the DisplayGroupTree to false in the Properties Window.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://2.bp.blogspot.com/_MGI3FYgA_3c/SQLAdUrAcoI/AAAAAAAABzY/67-iR_EUKZI/s1600-h/CrystalReports_OnForm1.jpg"&gt;&lt;img id="BLOGGER_PHOTO_ID_5260978924719993474" style="DISPLAY: block; MARGIN: 0px auto 10px; WIDTH: 400px; CURSOR: hand; HEIGHT: 389px; TEXT-ALIGN: center" alt="" src="http://2.bp.blogspot.com/_MGI3FYgA_3c/SQLAdUrAcoI/AAAAAAAABzY/67-iR_EUKZI/s400/CrystalReports_OnForm1.jpg" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;8. The last step is during form load, we will need to (1) load the XML file into a dataset, (2) create an EmployeesReport instance and set the data source to the dataset created, and (3) set the ReportSource of the crystal viewer to the instance of the EmployeesReport.&lt;br /&gt;&lt;br /&gt;&lt;div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;"   &gt;&lt;pre style="MARGIN: 0px"&gt;&lt;span style="color:blue;"&gt;private&lt;/span&gt; &lt;span style="color:blue;"&gt;void&lt;/span&gt; Form1_Load(&lt;span style="color:blue;"&gt;object&lt;/span&gt; sender, &lt;span style="color:#2b91af;"&gt;EventArgs&lt;/span&gt; e)&lt;/pre&gt;&lt;pre style="MARGIN: 0px"&gt;{&lt;/pre&gt;&lt;pre style="MARGIN: 0px"&gt;    &lt;span style="color:#2b91af;"&gt;DataSet&lt;/span&gt; dsEmployees = &lt;span style="color:blue;"&gt;new&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;DataSet&lt;/span&gt;();&lt;/pre&gt;&lt;pre style="MARGIN: 0px"&gt;    dsEmployees.ReadXml(&lt;span style="color:#a31515;"&gt;@"DATA\Employees.xml"&lt;/span&gt;);&lt;/pre&gt;&lt;pre style="MARGIN: 0px"&gt; &lt;/pre&gt;&lt;pre style="MARGIN: 0px"&gt;    &lt;span style="color:#2b91af;"&gt;EmployeesReport&lt;/span&gt; report = &lt;span style="color:blue;"&gt;new&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;EmployeesReport&lt;/span&gt;();&lt;/pre&gt;&lt;pre style="MARGIN: 0px"&gt; &lt;/pre&gt;&lt;pre style="MARGIN: 0px"&gt;    report.SetDataSource(dsEmployees);&lt;/pre&gt;&lt;pre style="MARGIN: 0px"&gt;    crystalReportViewer1.ReportSource = report;&lt;/pre&gt;&lt;pre style="MARGIN: 0px"&gt; &lt;/pre&gt;&lt;pre style="MARGIN: 0px"&gt;}&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;9. Run the application, and (if everything is ok) the Crystal Reports Viewer will display the employee displays found the the xml file.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/_MGI3FYgA_3c/SQLCS6Fnk8I/AAAAAAAABzg/BAFP4fomVls/s1600-h/Output.jpg"&gt;&lt;img id="BLOGGER_PHOTO_ID_5260980944808416194" style="DISPLAY: block; MARGIN: 0px auto 10px; WIDTH: 400px; CURSOR: hand; HEIGHT: 285px; TEXT-ALIGN: center" alt="" src="http://3.bp.blogspot.com/_MGI3FYgA_3c/SQLCS6Fnk8I/AAAAAAAABzg/BAFP4fomVls/s400/Output.jpg" border="0" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2149165178736128353-7612707007271103021?l=moiashvin-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://moiashvin-tech.blogspot.com/feeds/7612707007271103021/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2149165178736128353&amp;postID=7612707007271103021' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/7612707007271103021'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/7612707007271103021'/><link rel='alternate' type='text/html' href='http://moiashvin-tech.blogspot.com/2008/10/load-data-from-xml-file-into-crystal.html' title='Load data from XML file into Crystal Reports'/><author><name>ashvin</name><uri>http://www.blogger.com/profile/00922391930245622789</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_MGI3FYgA_3c/Sz0gYk3D9UI/AAAAAAAACnU/k5b8SZoi0r4/S220/26122009454.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_MGI3FYgA_3c/SQK2xXfu5bI/AAAAAAAABxw/4-tFpOWpMUc/s72-c/AddEmployeesXml.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2149165178736128353.post-4933962301960955564</id><published>2008-10-24T22:52:00.013+04:00</published><updated>2008-10-25T00:38:26.849+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Programming'/><category scheme='http://www.blogger.com/atom/ns#' term='Tools'/><category scheme='http://www.blogger.com/atom/ns#' term='Dotfuscator'/><category scheme='http://www.blogger.com/atom/ns#' term='Ashvin Gunga'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><title type='text'>Dotfuscate</title><content type='html'>&lt;div align="justify"&gt;&lt;strong&gt;&lt;span style="color:#006600;"&gt;Introduction&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;The Microsoft .NET compiler converts the C# source code into Microsoft Intermediate Language (MSIL). However, with the use of a good decompiler tool and a few mouse clicks, any person can revert this .NET compiled code to its original C# source code. Hence, we need to protect the source code, including the 'trade secrets and logic' from attackers, especially when distributing the libraries/executables to third parties. A viable solution is the use of an Obfuscation Tool such as the .NET Dotfuscator (or simply, Dotfuscator).&lt;br /&gt;&lt;br /&gt;The definition of 'obfuscate' is 'to confuse' or 'to make obscure or unclear', and that's exactly what an obfuscator tool will do. The Obfuscator will apply behavior preserving transformations on the code so that the functionality is preserved but the readability or understandability of the code is drastically reduced. The aim is to confuse observers while giving a consistent behavior to the Runtime Environment.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#006600;"&gt;Main strategies of an obsfuscator&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;em&gt;&lt;strong&gt;Compaction&lt;/strong&gt;&lt;/em&gt;&lt;br /&gt;The entire application is analysed and unused members are identified and removed from the obfuscated assembly. This is called the Compaction process. The unused members include unused classes, methods, instance variables and design time metadata, just to name a few. For example, a common library may offer a lot of functionalities but only a few are used in the application. So, these unused methods can be safely removed. Compacted programs also tend to load faster and run using less memory.&lt;br /&gt;&lt;br /&gt;&lt;em&gt;&lt;strong&gt;Overload Induction&lt;/strong&gt;&lt;/em&gt;&lt;br /&gt;The obfuscator renames all program identifiers to small, meaningless names. The Overload Induction mechanism works by identifying colliding set of methods across inheritance hierarchies and renaming such sets according to some enumeration (e.g. the alphabet). This method determines all opportunities for name reuse and hence, you may find more than 30% of ALL methods renamed to a single letter 'a'. Another advantage is the final program size of the obfuscated code is reduced by approximately 10% as there is heavy reuse of identify names.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;em&gt;String Encryption&lt;/em&gt;&lt;br /&gt;&lt;/strong&gt;Another interesting feature is the implementation of the runtime decrypted string encryption. An encryption algorithm is applied to all string literals and constants so as to make reverse-engineering even harder. This is very useful to hide hardcoded SQL strings, usernames and passwords that may be found in the code. Also, a decryption algorithm is inserted in the obfuscated code and later called at runtime to get back the original string literals.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;em&gt;Control Flow obfuscation&lt;/em&gt;&lt;br /&gt;&lt;/strong&gt;Control Flow obfuscation is yet another strong form of code protection. Here the flow of the program is changed so that the link between the original code and the obfuscated code breaks. It also ensures that no bug is introduced. For example, a for loop statement may be transformed into a while loop, a switch statement may be converted to a nested if statement and go to statements and labels may be introduced, just to name a few. This in turn transform the neat logic and flows in the original source code into a 'spaghetti-like' code to confuse the readers and any reverse engineering tool.&lt;br /&gt;&lt;br /&gt;&lt;em&gt;&lt;strong&gt;Assembly Linking&lt;/strong&gt;&lt;/em&gt;&lt;br /&gt;Multiple input assemblies are also combined into one or more output assemblies.&lt;br /&gt;&lt;br /&gt;&lt;img src="http://www.preemptive.com/images/stories/simple_linking.gif" /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#006600;"&gt;&lt;strong&gt;PreEmptive Solutions Dotfuscator flavors&lt;/strong&gt;&lt;br /&gt;&lt;/span&gt;There are currently two different version of the Dotfuscator: Professional Edition and Community Edition. The Community Edition is an entry level obfuscator and is included in Visual Studio 2005 Pro. The Professional Edition provides superior protection to foil decompilation, size reduction to conserve memory and improve load times, incremental obfuscation to release patches, watermarking to track pirates and so on and so forth.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#006600;"&gt;Simple Dotfuscator Demonstration&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;em&gt;1. Create your project in VS2005. Here, I shall use a simple application that print numbers 1 to 100.&lt;/em&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;"   &gt;&lt;pre style="MARGIN: 0px"&gt;&lt;span style="color:blue;"&gt;using&lt;/span&gt; System;&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;"   &gt;&lt;pre style="MARGIN: 0px"&gt;&lt;span style="color:blue;"&gt;using&lt;/span&gt; System.Collections.Generic;&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;"   &gt;&lt;pre style="MARGIN: 0px"&gt;&lt;span style="color:blue;"&gt;using&lt;/span&gt; System.Text;&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;"   &gt;&lt;pre style="MARGIN: 0px"&gt; &lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;"   &gt;&lt;pre style="MARGIN: 0px"&gt;&lt;span style="color:blue;"&gt;namespace&lt;/span&gt; DotfuscateDemo&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;"   &gt;&lt;pre style="MARGIN: 0px"&gt;{&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;"   &gt;&lt;pre style="MARGIN: 0px"&gt;    &lt;span style="color:blue;"&gt;class&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;Program&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;"   &gt;&lt;pre style="MARGIN: 0px"&gt;    {&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;"   &gt;&lt;pre style="MARGIN: 0px"&gt;        &lt;span style="color:blue;"&gt;private&lt;/span&gt; &lt;span style="color:blue;"&gt;double&lt;/span&gt; unUsedDouble;&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;"   &gt;&lt;pre style="MARGIN: 0px"&gt; &lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;"   &gt;&lt;pre style="MARGIN: 0px"&gt;        &lt;span style="color:gray;"&gt;///&lt;/span&gt;&lt;span style="color:green;"&gt; &lt;/span&gt;&lt;span style="color:gray;"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;"   &gt;&lt;pre style="MARGIN: 0px"&gt;        &lt;span style="color:gray;"&gt;///&lt;/span&gt;&lt;span style="color:green;"&gt; Gets or sets the un used double.&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;"   &gt;&lt;pre style="MARGIN: 0px"&gt;        &lt;span style="color:gray;"&gt;///&lt;/span&gt;&lt;span style="color:green;"&gt; &lt;/span&gt;&lt;span style="color:gray;"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;"   &gt;&lt;pre style="MARGIN: 0px"&gt;        &lt;span style="color:gray;"&gt;///&lt;/span&gt;&lt;span style="color:green;"&gt; &lt;/span&gt;&lt;span style="color:gray;"&gt;&amp;lt;value&amp;gt;&lt;/span&gt;&lt;span style="color:green;"&gt;The un used double.&lt;/span&gt;&lt;span style="color:gray;"&gt;&amp;lt;/value&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;"   &gt;&lt;pre style="MARGIN: 0px"&gt;        &lt;span style="color:blue;"&gt;public&lt;/span&gt; &lt;span style="color:blue;"&gt;double&lt;/span&gt; UnUsedDouble&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;"   &gt;&lt;pre style="MARGIN: 0px"&gt;        {&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;"   &gt;&lt;pre style="MARGIN: 0px"&gt;            &lt;span style="color:blue;"&gt;get&lt;/span&gt; { &lt;span style="color:blue;"&gt;return&lt;/span&gt; unUsedDouble; }&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;"   &gt;&lt;pre style="MARGIN: 0px"&gt;            &lt;span style="color:blue;"&gt;set&lt;/span&gt; { unUsedDouble = &lt;span style="color:blue;"&gt;value&lt;/span&gt;; }&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;"   &gt;&lt;pre style="MARGIN: 0px"&gt;        }&lt;/pre&gt;&lt;/div&gt;&lt;div style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: Courier New"&gt;&lt;pre style="MARGIN: 0px"&gt; &lt;/pre&gt;&lt;/div&gt;&lt;div style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: Courier New"&gt;&lt;pre style="MARGIN: 0px"&gt;        &lt;span style="color:gray;"&gt;///&lt;/span&gt;&lt;span style="color:green;"&gt; &lt;/span&gt;&lt;span style="color:gray;"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: Courier New"&gt;&lt;pre style="MARGIN: 0px"&gt;        &lt;span style="color:gray;"&gt;///&lt;/span&gt;&lt;span style="color:green;"&gt; Main method&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: Courier New"&gt;&lt;pre style="MARGIN: 0px"&gt;        &lt;span style="color:gray;"&gt;///&lt;/span&gt;&lt;span style="color:green;"&gt; &lt;/span&gt;&lt;span style="color:gray;"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: Courier New"&gt;&lt;pre style="MARGIN: 0px"&gt;        &lt;span style="color:gray;"&gt;///&lt;/span&gt;&lt;span style="color:green;"&gt; &lt;/span&gt;&lt;span style="color:gray;"&gt;&amp;lt;param name="args"&amp;gt;&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: Courier New"&gt;&lt;pre style="MARGIN: 0px"&gt;        &lt;span style="color:blue;"&gt;public&lt;/span&gt; &lt;span style="color:blue;"&gt;static&lt;/span&gt; &lt;span style="color:blue;"&gt;void&lt;/span&gt; Main(&lt;span style="color:blue;"&gt;string&lt;/span&gt;[] args)&lt;/pre&gt;&lt;/div&gt;&lt;div style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: Courier New"&gt;&lt;pre style="MARGIN: 0px"&gt;        {&lt;/pre&gt;&lt;/div&gt;&lt;div style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: Courier New"&gt;&lt;pre style="MARGIN: 0px"&gt;            Print1ToN(100);&lt;/pre&gt;&lt;/div&gt;&lt;div style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: Courier New"&gt;&lt;pre style="MARGIN: 0px"&gt;            &lt;span style="color:#2b91af;"&gt;Console&lt;/span&gt;.ReadLine();&lt;/pre&gt;&lt;/div&gt;&lt;div style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: Courier New"&gt;&lt;pre style="MARGIN: 0px"&gt;        }&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;"   &gt;&lt;pre style="MARGIN: 0px"&gt; &lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white" color="black" size="10pt" face="Courier New"&gt;&lt;pre style="MARGIN: 0px"&gt;        &lt;span style="color:gray;"&gt;///&lt;/span&gt;&lt;span style="color:green;"&gt; &lt;/span&gt;&lt;span style="color:gray;"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white" color="black" size="10pt" face="Courier New"&gt;&lt;pre style="MARGIN: 0px"&gt;        &lt;span style="color:gray;"&gt;///&lt;/span&gt;&lt;span style="color:green;"&gt; Print1s to N.&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white" color="black" size="10pt" face="Courier New"&gt;&lt;pre style="MARGIN: 0px"&gt;        &lt;span style="color:gray;"&gt;///&lt;/span&gt;&lt;span style="color:green;"&gt; &lt;/span&gt;&lt;span style="color:gray;"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white" color="black" size="10pt" face="Courier New"&gt;&lt;pre style="MARGIN: 0px"&gt;        &lt;span style="color:gray;"&gt;///&lt;/span&gt;&lt;span style="color:green;"&gt; &lt;/span&gt;&lt;span style="color:gray;"&gt;&amp;lt;param name="nValue"&amp;gt;&lt;/span&gt;&lt;span style="color:green;"&gt;The n value.&lt;/span&gt;&lt;span style="color:gray;"&gt;&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white" color="black" size="10pt" face="Courier New"&gt;&lt;pre style="MARGIN: 0px"&gt;        &lt;span style="color:blue;"&gt;private&lt;/span&gt; &lt;span style="color:blue;"&gt;static&lt;/span&gt; &lt;span style="color:blue;"&gt;void&lt;/span&gt; Print1ToN(&lt;span style="color:blue;"&gt;int&lt;/span&gt; nValue)&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white" color="black" size="10pt" face="Courier New"&gt;&lt;pre style="MARGIN: 0px"&gt;        {&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white" color="black" size="10pt" face="Courier New"&gt;&lt;pre style="MARGIN: 0px"&gt;            &lt;span style="color:blue;"&gt;for&lt;/span&gt; (&lt;span style="color:blue;"&gt;int&lt;/span&gt; i = 1; i &amp;lt;= nValue; i++)&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white" color="black" size="10pt" face="Courier New"&gt;&lt;pre style="MARGIN: 0px"&gt;            {&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white" color="black" size="10pt" face="Courier New"&gt;&lt;pre style="MARGIN: 0px"&gt;                &lt;span style="color:#2b91af;"&gt;Console&lt;/span&gt;.WriteLine(i);&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white" color="black" size="10pt" face="Courier New"&gt;&lt;pre style="MARGIN: 0px"&gt;            }&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white" color="black" size="10pt" face="Courier New"&gt;&lt;pre style="MARGIN: 0px"&gt;        }&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white" color="black" size="10pt" face="Courier New"&gt;&lt;pre style="MARGIN: 0px"&gt;    }&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white" color="black" size="10pt" face="Courier New"&gt;&lt;pre style="MARGIN: 0px"&gt;}&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;br /&gt;2. Build your project to get the assemblies that needs to be dotfuscated.&lt;br /&gt;&lt;br /&gt;3. In Visual Studio 2005, open the Dotfuscator Community Edition found under Tools menu.&lt;br /&gt;&lt;br /&gt;&lt;img id="BLOGGER_PHOTO_ID_5260810079028520178" style="DISPLAY: block; MARGIN: 0px auto 10px; WIDTH: 306px; CURSOR: hand; HEIGHT: 400px; TEXT-ALIGN: center" alt="" src="http://3.bp.blogspot.com/_MGI3FYgA_3c/SQIm5NdKJPI/AAAAAAAABxA/65jhqDtA3-c/s400/Dotfuscate1.jpg" border="0" /&gt;&lt;br /&gt;4. On the 'Select Project Type' screen, select the 'Create New Project' option.&lt;br /&gt;&lt;br /&gt;&lt;img id="BLOGGER_PHOTO_ID_5260811084963046338" style="DISPLAY: block; MARGIN: 0px auto 10px; WIDTH: 400px; CURSOR: hand; HEIGHT: 132px; TEXT-ALIGN: center" alt="" src="http://4.bp.blogspot.com/_MGI3FYgA_3c/SQInzw2o48I/AAAAAAAABxI/5jYJG3IBvOg/s400/Dotfuscate2.jpg" border="0" /&gt;&lt;br /&gt;5. Now we are ready to dotfuscate the project asssembly.&lt;br /&gt;&lt;br /&gt;Select the Input tab on the Dotfuscator main window.&lt;br /&gt;&lt;br /&gt;Select the option 'Browse and add assemblies to list' (this is an open folder icon) and add the project assembly.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/_MGI3FYgA_3c/SQIpbvWcPsI/AAAAAAAABxQ/5NQxXyLkCt4/s1600-h/Dotfuscate3.jpg"&gt;&lt;img id="BLOGGER_PHOTO_ID_5260812871265959618" style="DISPLAY: block; MARGIN: 0px auto 10px; WIDTH: 400px; CURSOR: hand; HEIGHT: 131px; TEXT-ALIGN: center" alt="" src="http://3.bp.blogspot.com/_MGI3FYgA_3c/SQIpbvWcPsI/AAAAAAAABxQ/5NQxXyLkCt4/s400/Dotfuscate3.jpg" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;6. There are other features available in the different tabs on the window and many of them may also be disable if you using the Community Edition. To keep this example simple, I will go directly to the dotfuscation process.&lt;br /&gt;&lt;br /&gt;7. Now its time to save the project using Save Project under File menu. The solution is saved as an xml file.&lt;br /&gt;&lt;br /&gt;8. The final step is to kick off the obfuscation process. This is done by selecting the Build Project option (play icon).&lt;br /&gt;&lt;br /&gt;9. Once the build is completed, a Build Statistics is shown giving summary details of the obfuscated code changes.&lt;br /&gt;&lt;br /&gt;&lt;img id="BLOGGER_PHOTO_ID_5260815106492530706" style="DISPLAY: block; MARGIN: 0px auto 10px; WIDTH: 386px; CURSOR: hand; HEIGHT: 400px; TEXT-ALIGN: center" alt="" src="http://3.bp.blogspot.com/_MGI3FYgA_3c/SQIrd2N_ABI/AAAAAAAABxY/YPbqZRloTX4/s400/Dotfuscate4.jpg" border="0" /&gt;&lt;br /&gt;10. You can now find the dotfuscated assemblies in a folder named Dotfuscated at the location where you saved the project xml file.&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#6600cc;"&gt;Before obfuscation...&lt;br /&gt;&lt;/span&gt;&lt;img id="BLOGGER_PHOTO_ID_5260816617679094738" style="DISPLAY: block; MARGIN: 0px auto 10px; WIDTH: 299px; CURSOR: hand; HEIGHT: 260px; TEXT-ALIGN: center" alt="" src="http://4.bp.blogspot.com/_MGI3FYgA_3c/SQIs1z08A9I/AAAAAAAABxg/UoJXPnz-qfs/s400/DotfuscateBefore.jpg" border="0" /&gt; &lt;span style="color:#6600cc;"&gt;After obfuscation...&lt;/span&gt;&lt;br /&gt;&lt;img id="BLOGGER_PHOTO_ID_5260817259751467602" style="DISPLAY: block; MARGIN: 0px auto 10px; WIDTH: 232px; CURSOR: hand; HEIGHT: 267px; TEXT-ALIGN: center" alt="" src="http://3.bp.blogspot.com/_MGI3FYgA_3c/SQItbLu66lI/AAAAAAAABxo/64TqMnpPfSI/s400/DotfuscateAfter.jpg" border="0" /&gt; &lt;strong&gt;&lt;span style="color:#006600;"&gt;Worth noting facts about Dotfuscator&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;A command line interface is available and thus, makes it suitable for integration into scripting environments or automated build processes.&lt;br /&gt;&lt;br /&gt;ASP.NET code behind assemblies can be obfuscated using the Dotfuscator.&lt;br /&gt;&lt;br /&gt;Dotfuscator will solely work on the compiled .NET assemblies and the original source code is never affected.&lt;br /&gt;&lt;br /&gt;Dotfuscator is not a profiler (a very common misconception!!!).&lt;br /&gt;&lt;br /&gt;Dotfuscator supports the Microsoft .NET Compact Framework.&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#009900;"&gt;&lt;strong&gt;And finally ...&lt;/strong&gt;&lt;br /&gt;&lt;/span&gt;Last but not least, it is important to know that obfuscation (or even encryption) is not 100% protected and secure. The only aim is to make the reverse engineering process extremely time consuming and painful so that it's not worth the effort and hence, stopping any potential attacker.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#009900;"&gt;References&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;a href="http://msdotnetsupport.blogspot.com/"&gt;Microsoft .NET Support Team Blog&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.preemptive.com/"&gt;Preemptive Solutions&lt;/a&gt;&lt;br /&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/ms227255.aspx"&gt;The Dotfuscator Solution&lt;/a&gt; &lt;/p&gt;&lt;p&gt; &lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2149165178736128353-4933962301960955564?l=moiashvin-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://moiashvin-tech.blogspot.com/feeds/4933962301960955564/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2149165178736128353&amp;postID=4933962301960955564' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/4933962301960955564'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/4933962301960955564'/><link rel='alternate' type='text/html' href='http://moiashvin-tech.blogspot.com/2008/10/dotfuscate.html' title='Dotfuscate'/><author><name>ashvin</name><uri>http://www.blogger.com/profile/00922391930245622789</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_MGI3FYgA_3c/Sz0gYk3D9UI/AAAAAAAACnU/k5b8SZoi0r4/S220/26122009454.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_MGI3FYgA_3c/SQIm5NdKJPI/AAAAAAAABxA/65jhqDtA3-c/s72-c/Dotfuscate1.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2149165178736128353.post-589258600801375752</id><published>2008-10-23T16:40:00.000+04:00</published><updated>2008-10-23T16:41:10.028+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='.Net CF 2.0'/><category scheme='http://www.blogger.com/atom/ns#' term='Programming'/><category scheme='http://www.blogger.com/atom/ns#' term='Ashvin Gunga'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><title type='text'>Hide ListView border in .NET Compact Framework</title><content type='html'>To disable (or hide) the border of a ListView control in .NET Compact Framework, &lt;br /&gt;&lt;br /&gt;1. Declare the following PInvoke methods... &lt;br /&gt;&lt;!--{\rtf1\ansi\ansicpg\lang1024\noproof1252\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Courier New;}}{\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0??;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;??\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;??\red128\green0\blue128;\red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;??\red192\green192\blue192;}??\fs20 \cf2 #region\cf0  PInvoke Declarations\par ??\cf2 const\cf0  \cf2 int\cf0  GWL_STYLE = -16;\par ??\cf2 const\cf0  \cf2 int\cf0  WS_BORDER = 0x00800000;\par ??\cf2 const\cf0  \cf2 int\cf0  SWP_NOSIZE = 0x1;\par ??\cf2 const\cf0  \cf2 int\cf0  SWP_NOMOVE = 0x2;\par ??\cf2 const\cf0  \cf2 int\cf0  SWP_FRAMECHANGED = 0x20;\par ??\par ??[\cf10 DllImport\cf0 (\cf13 "coredll.dll"\cf0 )]\par ??\cf2 private\cf0  \cf2 static\cf0  \cf2 extern\cf0  \cf2 int\cf0  GetWindowLong(\cf10 IntPtr\cf0  hWnd, \cf2 int\cf0  nIndex);\par ??\par ??[\cf10 DllImport\cf0 (\cf13 "coredll.dll"\cf0 )]\par ??\cf2 private\cf0  \cf2 extern\cf0  \cf2 static\cf0  \cf2 void\cf0  SetWindowLong(\cf10 IntPtr\cf0  hwnd, \cf2 int\cf0  nIndex, \cf2 int\cf0  dwNewLong);\par ??\par ??[\cf10 DllImport\cf0 (\cf13 "coredll.dll"\cf0 )]\par ??\cf2 private\cf0  \cf2 static\cf0  \cf2 extern\cf0  \cf2 bool\cf0  SetWindowPos(\cf10 IntPtr\cf0  hwnd, \cf10 IntPtr\cf0  hWndInsertAfter,\par ??    \cf2 int\cf0  x, \cf2 int\cf0  y, \cf2 int\cf0  cx, \cf2 int\cf0  cy, \cf2 int\cf0  uflags);\par ??\cf2 #endregion}--&gt;&lt;div style="font-family: Courier New; font-size: 8pt; color: black; background: white;"&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;#region&lt;/span&gt; PInvoke Declarations&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;const&lt;/span&gt; &lt;span style="color: blue;"&gt;int&lt;/span&gt; GWL_STYLE = -16;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;const&lt;/span&gt; &lt;span style="color: blue;"&gt;int&lt;/span&gt; WS_BORDER = 0x00800000;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;const&lt;/span&gt; &lt;span style="color: blue;"&gt;int&lt;/span&gt; SWP_NOSIZE = 0x1;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;const&lt;/span&gt; &lt;span style="color: blue;"&gt;int&lt;/span&gt; SWP_NOMOVE = 0x2;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;const&lt;/span&gt; &lt;span style="color: blue;"&gt;int&lt;/span&gt; SWP_FRAMECHANGED = 0x20;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;[&lt;span style="color: teal;"&gt;DllImport&lt;/span&gt;(&lt;span style="color: maroon;"&gt;"coredll.dll"&lt;/span&gt;)]&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;private&lt;/span&gt; &lt;span style="color: blue;"&gt;static&lt;/span&gt; &lt;span style="color: blue;"&gt;extern&lt;/span&gt; &lt;span style="color: blue;"&gt;int&lt;/span&gt; GetWindowLong(&lt;span style="color: teal;"&gt;IntPtr&lt;/span&gt; hWnd, &lt;span style="color: blue;"&gt;int&lt;/span&gt; nIndex);&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;[&lt;span style="color: teal;"&gt;DllImport&lt;/span&gt;(&lt;span style="color: maroon;"&gt;"coredll.dll"&lt;/span&gt;)]&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;private&lt;/span&gt; &lt;span style="color: blue;"&gt;extern&lt;/span&gt; &lt;span style="color: blue;"&gt;static&lt;/span&gt; &lt;span style="color: blue;"&gt;void&lt;/span&gt; SetWindowLong(&lt;span style="color: teal;"&gt;IntPtr&lt;/span&gt; hwnd, &lt;span style="color: blue;"&gt;int&lt;/span&gt; nIndex, &lt;span style="color: blue;"&gt;int&lt;/span&gt; dwNewLong);&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;[&lt;span style="color: teal;"&gt;DllImport&lt;/span&gt;(&lt;span style="color: maroon;"&gt;"coredll.dll"&lt;/span&gt;)]&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;private&lt;/span&gt; &lt;span style="color: blue;"&gt;static&lt;/span&gt; &lt;span style="color: blue;"&gt;extern&lt;/span&gt; &lt;span style="color: blue;"&gt;bool&lt;/span&gt; SetWindowPos(&lt;span style="color: teal;"&gt;IntPtr&lt;/span&gt; hwnd, &lt;span style="color: teal;"&gt;IntPtr&lt;/span&gt; hWndInsertAfter,&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;  &lt;span style="color: blue;"&gt;int&lt;/span&gt; x, &lt;span style="color: blue;"&gt;int&lt;/span&gt; y, &lt;span style="color: blue;"&gt;int&lt;/span&gt; cx, &lt;span style="color: blue;"&gt;int&lt;/span&gt; cy, &lt;span style="color: blue;"&gt;int&lt;/span&gt; uflags);&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;#endregion&lt;/span&gt;&lt;/p&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;2. Write a ShowListViewBorder method...&lt;br /&gt;&lt;!--{\rtf1\ansi\ansicpg\lang1024\noproof1252\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Courier New;}}{\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0??;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;??\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;??\red128\green0\blue128;\red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;??\red192\green192\blue192;}??\fs20 \cf15 ///\cf11  \cf15 &amp;lt;summary&amp;gt;\par ??///\cf11  Shows the list view border.\par ??\cf15 ///\cf11  \cf15 &amp;lt;/summary&amp;gt;\par ??///\cf11  \cf15 &amp;lt;param name="handle"&amp;gt;\cf11 The handle.\cf15 &amp;lt;/param&amp;gt;\par ??///\cf11  \cf15 &amp;lt;param name="showBorder"&amp;gt;\cf11 if set to \cf15 &amp;lt;c&amp;gt;\cf11 true\cf15 &amp;lt;/c&amp;gt;\cf11  [show border].\cf15 &amp;lt;/param&amp;gt;\par ??\cf2 private\cf0  \cf2 void\cf0  ShowListViewBorder(\cf10 IntPtr\cf0  handle, \cf2 bool\cf0  showBorder)\par ??\{\par ??    \cf2 int\cf0  style = GetWindowLong(handle, GWL_STYLE);\par ??    \cf2 if\cf0  (showBorder)\par ??    \{\par ??        style |= WS_BORDER;\par ??    \}\par ??    \cf2 else\par ??\cf0     \{\par ??        style &amp;amp;= ~WS_BORDER;\par ??    \}\par ??    SetWindowLong(handle, GWL_STYLE, style);\par ??    SetWindowPos(handle, \cf10 IntPtr\cf0 .Zero, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED);\par ??\}}--&gt;&lt;div style="font-family: Courier New; font-size: 8pt; color: black; background: white;"&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: gray;"&gt;///&lt;/span&gt;&lt;span style="color: green;"&gt; &lt;/span&gt;&lt;span style="color: gray;"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: gray;"&gt;///&lt;/span&gt;&lt;span style="color: green;"&gt; Shows the list view border.&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: gray;"&gt;///&lt;/span&gt;&lt;span style="color: green;"&gt; &lt;/span&gt;&lt;span style="color: gray;"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: gray;"&gt;///&lt;/span&gt;&lt;span style="color: green;"&gt; &lt;/span&gt;&lt;span style="color: gray;"&gt;&amp;lt;param name="handle"&amp;gt;&lt;/span&gt;&lt;span style="color: green;"&gt;The handle.&lt;/span&gt;&lt;span style="color: gray;"&gt;&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: gray;"&gt;///&lt;/span&gt;&lt;span style="color: green;"&gt; &lt;/span&gt;&lt;span style="color: gray;"&gt;&amp;lt;param name="showBorder"&amp;gt;&lt;/span&gt;&lt;span style="color: green;"&gt;if set to &lt;/span&gt;&lt;span style="color: gray;"&gt;&amp;lt;c&amp;gt;&lt;/span&gt;&lt;span style="color: green;"&gt;true&lt;/span&gt;&lt;span style="color: gray;"&gt;&amp;lt;/c&amp;gt;&lt;/span&gt;&lt;span style="color: green;"&gt; [show border].&lt;/span&gt;&lt;span style="color: gray;"&gt;&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;private&lt;/span&gt; &lt;span style="color: blue;"&gt;void&lt;/span&gt; ShowListViewBorder(&lt;span style="color: teal;"&gt;IntPtr&lt;/span&gt; handle, &lt;span style="color: blue;"&gt;bool&lt;/span&gt; showBorder)&lt;/p&gt;&lt;p style="margin: 0px;"&gt;{&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;  &lt;span style="color: blue;"&gt;int&lt;/span&gt; style = GetWindowLong(handle, GWL_STYLE);&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;  &lt;span style="color: blue;"&gt;if&lt;/span&gt; (showBorder)&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;  {&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp; style |= WS_BORDER;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;  }&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;  &lt;span style="color: blue;"&gt;else&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;  {&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp; style &amp;amp;= ~WS_BORDER;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;  }&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;  SetWindowLong(handle, GWL_STYLE, style);&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;  SetWindowPos(handle, &lt;span style="color: teal;"&gt;IntPtr&lt;/span&gt;.Zero, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED);&lt;/p&gt;&lt;p style="margin: 0px;"&gt;}&lt;/p&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;3. Call the ShowListViewBorder...&lt;br /&gt;&lt;!--{\rtf1\ansi\ansicpg\lang1024\noproof1252\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Courier New;}}{\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0??;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;??\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;??\red128\green0\blue128;\red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;??\red192\green192\blue192;}??\fs20 ShowListViewBorder(window.lvwDetails.Handle, \cf2 false\cf0 );}--&gt;&lt;div style="font-family: Courier New; font-size: 8pt; color: black; background: white;"&gt;&lt;p style="margin: 0px;"&gt;ShowListViewBorder(window.lvwDetails.Handle, &lt;span style="color: blue;"&gt;false&lt;/span&gt;);&lt;/p&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2149165178736128353-589258600801375752?l=moiashvin-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://moiashvin-tech.blogspot.com/feeds/589258600801375752/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2149165178736128353&amp;postID=589258600801375752' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/589258600801375752'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/589258600801375752'/><link rel='alternate' type='text/html' href='http://moiashvin-tech.blogspot.com/2008/10/hide-listview-border-in-net-compact.html' title='Hide ListView border in .NET Compact Framework'/><author><name>ashvin</name><uri>http://www.blogger.com/profile/00922391930245622789</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_MGI3FYgA_3c/Sz0gYk3D9UI/AAAAAAAACnU/k5b8SZoi0r4/S220/26122009454.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2149165178736128353.post-5500956384309412837</id><published>2008-10-05T22:44:00.004+04:00</published><updated>2008-10-05T23:07:27.716+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Tips'/><category scheme='http://www.blogger.com/atom/ns#' term='Ashvin Gunga'/><category scheme='http://www.blogger.com/atom/ns#' term='Visual Studio'/><title type='text'>'Beautify' C# source code in VS2005</title><content type='html'>&lt;div style="text-align: justify;"&gt;Many times I have been asked whether it is possible to 'beautify' the C# source code in Visual Studio 2005. The answer is yes, we can.&lt;br /&gt;&lt;br /&gt;In VS2005, the Format Document command found in the Edit -&gt; Advanced Menu is available. The keyboard shortcut is:&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style="font-size:180%;"&gt;&lt;span style="font-weight: bold; color: rgb(0, 0, 153);"&gt;Ctrl-k, Ctrl-d&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;(i.e. press ctrl, k and d keys simultaneously)&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Before Format Document command...&lt;/span&gt;&lt;br /&gt;&lt;div    style="background: white none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;font-family:Courier New;font-size:10pt;color:black;"&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="color:blue;"&gt;public&lt;/span&gt; &lt;span style="color:blue;"&gt;class&lt;/span&gt; &lt;span style="color: rgb(43, 145, 175);"&gt;Divider&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;{&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="color:blue;"&gt;public&lt;/span&gt; &lt;span style="color:blue;"&gt;static&lt;/span&gt; &lt;span style="color:blue;"&gt;double&lt;/span&gt; Divide(&lt;span style="color:blue;"&gt;int&lt;/span&gt; divident, &lt;span style="color:blue;"&gt;int&lt;/span&gt; divisor)&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;{&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="color:blue;"&gt;try&lt;/span&gt;{&lt;span style="color:blue;"&gt;return&lt;/span&gt; divident / divisor;}&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="color:blue;"&gt;catch&lt;/span&gt; (&lt;span style="color: rgb(43, 145, 175);"&gt;Exception&lt;/span&gt; ex){&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="color:blue;"&gt;throw&lt;/span&gt; ex;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;}&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;}&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt; &lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="color:blue;"&gt;public&lt;/span&gt; &lt;span style="color:blue;"&gt;static&lt;/span&gt; &lt;span style="color:blue;"&gt;void&lt;/span&gt; Main() { &lt;span style="color:blue;"&gt;try&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;{&lt;span style="color: rgb(43, 145, 175);"&gt;Divider&lt;/span&gt;.Divide(30, 0);}&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="color:blue;"&gt;catch&lt;/span&gt; (&lt;span style="color: rgb(43, 145, 175);"&gt;Exception&lt;/span&gt; ex)&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;{&lt;span style="color: rgb(43, 145, 175);"&gt;Debug&lt;/span&gt;.WriteLine(ex.StackTrace);&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;}&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;}&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;}&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;After Format Document command...&lt;/span&gt;&lt;br /&gt;&lt;div    style="background: white none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;font-family:Courier New;font-size:10pt;color:black;"&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="color:blue;"&gt;public&lt;/span&gt; &lt;span style="color:blue;"&gt;class&lt;/span&gt; &lt;span style="color: rgb(43, 145, 175);"&gt;Divider&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;{&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;    &lt;span style="color:blue;"&gt;public&lt;/span&gt; &lt;span style="color:blue;"&gt;static&lt;/span&gt; &lt;span style="color:blue;"&gt;double&lt;/span&gt; Divide(&lt;span style="color:blue;"&gt;int&lt;/span&gt; divident, &lt;span style="color:blue;"&gt;int&lt;/span&gt; divisor)&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;    {&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;        &lt;span style="color:blue;"&gt;try&lt;/span&gt; { &lt;span style="color:blue;"&gt;return&lt;/span&gt; divident / divisor; }&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;        &lt;span style="color:blue;"&gt;catch&lt;/span&gt; (&lt;span style="color: rgb(43, 145, 175);"&gt;Exception&lt;/span&gt; ex)&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;        {&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;            &lt;span style="color:blue;"&gt;throw&lt;/span&gt; ex;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;        }&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;    }&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt; &lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;    &lt;span style="color:blue;"&gt;public&lt;/span&gt; &lt;span style="color:blue;"&gt;static&lt;/span&gt; &lt;span style="color:blue;"&gt;void&lt;/span&gt; Main()&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;    {&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;        &lt;span style="color:blue;"&gt;try&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;        { &lt;span style="color: rgb(43, 145, 175);"&gt;Divider&lt;/span&gt;.Divide(30, 0); }&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;        &lt;span style="color:blue;"&gt;catch&lt;/span&gt; (&lt;span style="color: rgb(43, 145, 175);"&gt;Exception&lt;/span&gt; ex)&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;        {&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;            &lt;span style="color: rgb(43, 145, 175);"&gt;Debug&lt;/span&gt;.WriteLine(ex.StackTrace);&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;        }&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;    }&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;}&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-weight: bold;"&gt;Tip:&lt;/span&gt; Another way to achieve the same result is to&lt;span style="font-style: italic;"&gt; first find the last closing bracket in the source and then delete it, and finally re-type it&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;You can also check out the other interesting features available on the Edit -&gt; Advanced menu:&lt;br /&gt;&lt;br/&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://3.bp.blogspot.com/_MGI3FYgA_3c/SOkO9NrLNeI/AAAAAAAABw4/Ra5poDXnD6s/s400/VS2005-Edit-Advanced.jpg" alt="" id="BLOGGER_PHOTO_ID_5253746885109954018" border="0" /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2149165178736128353-5500956384309412837?l=moiashvin-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://moiashvin-tech.blogspot.com/feeds/5500956384309412837/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2149165178736128353&amp;postID=5500956384309412837' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/5500956384309412837'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/5500956384309412837'/><link rel='alternate' type='text/html' href='http://moiashvin-tech.blogspot.com/2008/10/beautify-c-source-code-in-vs2005.html' title='&apos;Beautify&apos; C# source code in VS2005'/><author><name>ashvin</name><uri>http://www.blogger.com/profile/00922391930245622789</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_MGI3FYgA_3c/Sz0gYk3D9UI/AAAAAAAACnU/k5b8SZoi0r4/S220/26122009454.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_MGI3FYgA_3c/SOkO9NrLNeI/AAAAAAAABw4/Ra5poDXnD6s/s72-c/VS2005-Edit-Advanced.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2149165178736128353.post-817933950655074475</id><published>2008-09-28T20:28:00.003+04:00</published><updated>2008-09-28T20:42:16.705+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Programming'/><category scheme='http://www.blogger.com/atom/ns#' term='Ashvin Gunga'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><category scheme='http://www.blogger.com/atom/ns#' term='.NET 2.0'/><title type='text'>Null-coalescing operator in .NET Framework</title><content type='html'>&lt;div style="text-align: justify;"&gt;The post &lt;a href="http://moiashvin-tech.blogspot.com/2008/06/declaring-variables-as-nullable-in-c.html"&gt;Declaring variables as nullable in c#&lt;/a&gt; describes how nullable value types can be declared used in C#.&lt;br /&gt;&lt;br /&gt;.NET Framework also provides the &lt;span style="font-size:130%;"&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;?? operator&lt;/span&gt;&lt;/span&gt;, called the &lt;span style="font-weight: bold;"&gt;null-coalescing operator&lt;/span&gt;, and its primary use is to define a default value for a nullable value types as well as reference types. It returns the left-hand operand if it is not null; otherwise it returns the right operand.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;As an example, if the following code is run, the intValue will be 1, since nullInt is null&lt;/span&gt;.&lt;br /&gt;&lt;/div&gt;&lt;div    style="background: white none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;font-family:Courier New;font-size:10pt;color:black;"&gt;&lt;br /&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;Nullable&lt;/span&gt;&amp;lt;&lt;span style="color:blue;"&gt;int&lt;/span&gt;&amp;gt; nullInt = &lt;span style="color:blue;"&gt;null&lt;/span&gt;;&lt;/pre&gt;&lt;br /&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="color:blue;"&gt;int&lt;/span&gt; intValue = nullInt ?? 1;&lt;/pre&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2149165178736128353-817933950655074475?l=moiashvin-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://moiashvin-tech.blogspot.com/feeds/817933950655074475/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2149165178736128353&amp;postID=817933950655074475' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/817933950655074475'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/817933950655074475'/><link rel='alternate' type='text/html' href='http://moiashvin-tech.blogspot.com/2008/09/null-coalescing-operator-in-net.html' title='Null-coalescing operator in .NET Framework'/><author><name>ashvin</name><uri>http://www.blogger.com/profile/00922391930245622789</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_MGI3FYgA_3c/Sz0gYk3D9UI/AAAAAAAACnU/k5b8SZoi0r4/S220/26122009454.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2149165178736128353.post-5338127109194848302</id><published>2008-09-25T15:59:00.010+04:00</published><updated>2008-09-25T16:28:06.893+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Tools'/><category scheme='http://www.blogger.com/atom/ns#' term='Ashvin Gunga'/><category scheme='http://www.blogger.com/atom/ns#' term='Eqatec'/><title type='text'>Walkthrough EQATEC Tracer</title><content type='html'>&lt;div align="justify"&gt;&lt;strong&gt;1: Create application in .NET&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;I have written a simple test application, TestEqatecTracer, to play with the new tool EQATEC .NET Tracer (which I mentioned in the previous post). In the TestEqatecTracer application,&lt;br /&gt;&lt;br /&gt;- names are populated in a list structure,&lt;br /&gt;- list is then sorted using the List.Sort() ,&lt;br /&gt;- finally, the list is sorted by the last character using SortByLastCharacter Comparer class. &lt;/div&gt;&lt;br /&gt;&lt;hr /&gt;&lt;!--{\rtf1\ansi\ansicpg\lang1024\noproof1252\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Courier New;}}{\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0??;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;??\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;??\red128\green0\blue128;\red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;??\red192\green192\blue192;}??\fs20 \cf2 using\cf0  System;\par ??\cf2 using\cf0  System.Collections.Generic;\par ??\cf2 using\cf0  System.Text;\par ??\par ??\cf2 namespace\cf0  TestEqatecTracer\par ??\{\par ??    \cf2 public\cf0  \cf2 class\cf0  \cf10 SortByLastCharacter\cf0  : \cf10 IComparer\cf0 &amp;lt;\cf2 string\cf0 &amp;gt;\par ??    \{\par ??\cf2         #region\cf0  IComparer&amp;lt;string&amp;gt; Members\par ??\par ??        \cf2 public\cf0  \cf2 int\cf0  Compare(\cf2 string\cf0  x, \cf2 string\cf0  y)\par ??        \{\par ??            \cf2 if\cf0  (\cf2 string\cf0 .IsNullOrEmpty(x) || \cf2 string\cf0 .IsNullOrEmpty(y))\par ??                \cf2 return\cf0  0;\par ??            \cf2 else\par ??\cf0                 \cf2 return\cf0  x[x.Length - 1].CompareTo(y[y.Length - 1]);\par ??        \}\par ??\par ??\cf2         #endregion\par ??\cf0     \}\par ??\par ??    \cf2 public\cf0  \cf2 class\cf0  \cf10 Program\par ??\cf0     \{\par ??        \cf2 static\cf0  \cf2 void\cf0  Main(\cf2 string\cf0 [] args)\par ??        \{\par ??            \cf10 List\cf0 &amp;lt;\cf2 string\cf0 &amp;gt; names = \cf2 new\cf0  \cf10 List\cf0 &amp;lt;\cf2 string\cf0 &amp;gt;();\par ??            names.Add(\cf13 "John"\cf0 );\par ??            names.Add(\cf13 "Frank"\cf0 );\par ??            names.Add(\cf13 "Andy"\cf0 );\par ??            names.Add(\cf13 "Brain"\cf0 );\par ??\par ??            \cf10 Console\cf0 .WriteLine(\cf13 "Initial names: "\cf0 );\par ??            PrintNames(names);\par ??            \cf10 Console\cf0 .WriteLine();\par ??\par ??            \cf10 Console\cf0 .WriteLine(\cf13 "Names sorted: "\cf0 );\par ??            names.Sort();\par ??            PrintNames(names);\par ??            \cf10 Console\cf0 .WriteLine();\par ??\par ??            \cf10 Console\cf0 .WriteLine(\cf13 "Names sorted by last character: "\cf0 );\par ??            names.Sort(\cf2 new\cf0  \cf10 SortByLastCharacter\cf0 ());\par ??            PrintNames(names);\par ??            \cf10 Console\cf0 .WriteLine();\par ??           \par ??            \cf10 Console\cf0 .ReadLine();\par ??        \}\par ??\par ??        \cf2 private\cf0  \cf2 static\cf0  \cf2 void\cf0  PrintNames(\cf10 List\cf0 &amp;lt;\cf2 string\cf0 &amp;gt; names)\par ??        \{\par ??            \cf2 if\cf0  (names != \cf2 null\cf0 )\par ??            \{\par ??                \cf2 foreach\cf0  (\cf2 string\cf0  name \cf2 in\cf0  names)\par ??                    \cf10 Console\cf0 .WriteLine(name);\par ??            \}\par ??        \}\par ??    \}\par ??\}}--&gt;&lt;div style="font-family: Courier New; font-size: 8pt; color: black; background: white;"&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;using&lt;/span&gt; System;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;using&lt;/span&gt; System.Collections.Generic;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;using&lt;/span&gt; System.Text;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;namespace&lt;/span&gt; TestEqatecTracer&lt;/p&gt;&lt;p style="margin: 0px;"&gt;{&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;  &lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;class&lt;/span&gt; &lt;span style="color: teal;"&gt;SortByLastCharacter&lt;/span&gt; : &lt;span style="color: teal;"&gt;IComparer&lt;/span&gt;&amp;lt;&lt;span style="color: blue;"&gt;string&lt;/span&gt;&amp;gt;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;  {&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp; #region&lt;/span&gt; IComparer&amp;lt;string&amp;gt; Members&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp; &lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;int&lt;/span&gt; Compare(&lt;span style="color: blue;"&gt;string&lt;/span&gt; x, &lt;span style="color: blue;"&gt;string&lt;/span&gt; y)&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp; {&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;if&lt;/span&gt; (&lt;span style="color: blue;"&gt;string&lt;/span&gt;.IsNullOrEmpty(x) || &lt;span style="color: blue;"&gt;string&lt;/span&gt;.IsNullOrEmpty(y))&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;  &lt;span style="color: blue;"&gt;return&lt;/span&gt; 0;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;else&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;  &lt;span style="color: blue;"&gt;return&lt;/span&gt; x[x.Length - 1].CompareTo(y[y.Length - 1]);&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp; }&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp; #endregion&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;  }&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;  &lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;class&lt;/span&gt; &lt;span style="color: teal;"&gt;Program&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;  {&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp; &lt;span style="color: blue;"&gt;static&lt;/span&gt; &lt;span style="color: blue;"&gt;void&lt;/span&gt; Main(&lt;span style="color: blue;"&gt;string&lt;/span&gt;[] args)&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp; {&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &lt;span style="color: teal;"&gt;List&lt;/span&gt;&amp;lt;&lt;span style="color: blue;"&gt;string&lt;/span&gt;&amp;gt; names = &lt;span style="color: blue;"&gt;new&lt;/span&gt; &lt;span style="color: teal;"&gt;List&lt;/span&gt;&amp;lt;&lt;span style="color: blue;"&gt;string&lt;/span&gt;&amp;gt;();&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; names.Add(&lt;span style="color: maroon;"&gt;"John"&lt;/span&gt;);&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; names.Add(&lt;span style="color: maroon;"&gt;"Frank"&lt;/span&gt;);&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; names.Add(&lt;span style="color: maroon;"&gt;"Andy"&lt;/span&gt;);&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; names.Add(&lt;span style="color: maroon;"&gt;"Brain"&lt;/span&gt;);&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &lt;span style="color: teal;"&gt;Console&lt;/span&gt;.WriteLine(&lt;span style="color: maroon;"&gt;"Initial names: "&lt;/span&gt;);&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; PrintNames(names);&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &lt;span style="color: teal;"&gt;Console&lt;/span&gt;.WriteLine();&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &lt;span style="color: teal;"&gt;Console&lt;/span&gt;.WriteLine(&lt;span style="color: maroon;"&gt;"Names sorted: "&lt;/span&gt;);&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; names.Sort();&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; PrintNames(names);&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &lt;span style="color: teal;"&gt;Console&lt;/span&gt;.WriteLine();&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &lt;span style="color: teal;"&gt;Console&lt;/span&gt;.WriteLine(&lt;span style="color: maroon;"&gt;"Names sorted by last character: "&lt;/span&gt;);&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; names.Sort(&lt;span style="color: blue;"&gt;new&lt;/span&gt; &lt;span style="color: teal;"&gt;SortByLastCharacter&lt;/span&gt;());&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; PrintNames(names);&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &lt;span style="color: teal;"&gt;Console&lt;/span&gt;.WriteLine();&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &lt;span style="color: teal;"&gt;Console&lt;/span&gt;.ReadLine();&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp; }&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp; &lt;span style="color: blue;"&gt;private&lt;/span&gt; &lt;span style="color: blue;"&gt;static&lt;/span&gt; &lt;span style="color: blue;"&gt;void&lt;/span&gt; PrintNames(&lt;span style="color: teal;"&gt;List&lt;/span&gt;&amp;lt;&lt;span style="color: blue;"&gt;string&lt;/span&gt;&amp;gt; names)&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp; {&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;if&lt;/span&gt; (names != &lt;span style="color: blue;"&gt;null&lt;/span&gt;)&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; {&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;  &lt;span style="color: blue;"&gt;foreach&lt;/span&gt; (&lt;span style="color: blue;"&gt;string&lt;/span&gt; name &lt;span style="color: blue;"&gt;in&lt;/span&gt; names)&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp; &lt;span style="color: teal;"&gt;Console&lt;/span&gt;.WriteLine(name);&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; }&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp; }&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;  }&lt;/p&gt;&lt;p style="margin: 0px;"&gt;}&lt;/p&gt;&lt;/div&gt;&lt;hr /&gt;&lt;br /&gt;&lt;div align="justify"&gt;&lt;strong&gt;2. Instrumentation Process&lt;br /&gt;&lt;/strong&gt;&lt;br /&gt;Now open the EQATEC Tracer tool. In the Instrumentor tab, browse and locate the assemblies of the application. The drag and drop feature can also be used.&lt;br /&gt;&lt;br /&gt;&lt;em&gt;The list of all assemblies in the selected folder will be shown in the Assembly List.&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;Select the assemblies that will be analysed in the list shown, and start the instrumentation process by selecting the "Instrument currently selected assemblies" button and a modified version of the assemblies will be then generated. &lt;em&gt;The instrumentation process injects trace statements in the assemblies.&lt;br /&gt;&lt;/em&gt;&lt;/div&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;img id="BLOGGER_PHOTO_ID_5249928161070382898" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://1.bp.blogspot.com/_MGI3FYgA_3c/SNt92ODrfzI/AAAAAAAABwg/e0oIhhcr6WY/s400/Eqatec0.gif" border="0" /&gt; &lt;hr /&gt;&lt;br /&gt;&lt;strong&gt;3. Select methods to trace&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Click the flash icon to launch the modified application. The application view will then change to the Viewer tab.&lt;br /&gt;&lt;br /&gt;After connecting to the application, the Control tree is populated with the classes and methods of the assemblies. Select ones that needs to be traced by checking the boxes.&lt;br /&gt;&lt;br /&gt;The LocalHost represents the local machine. If the application is a device application, then the IP address of the device should be entered.&lt;br /&gt;&lt;br /&gt;&lt;img id="BLOGGER_PHOTO_ID_5249928545070396034" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://2.bp.blogspot.com/_MGI3FYgA_3c/SNt-MkkasoI/AAAAAAAABwo/SCDIyoOy4dA/s400/EqatecControlTree.gif" border="0" /&gt; &lt;hr /&gt;&lt;br&gt;&lt;strong&gt;4. View trace results&lt;/strong&gt; &lt;p&gt;&lt;/p&gt;&lt;p&gt;Now connect to the application using the "Play" button.&lt;br /&gt;&lt;br /&gt;And the trace will be shown in the Trace Viewer.&lt;br&gt;&lt;br /&gt;&lt;a href="http://1.bp.blogspot.com/_MGI3FYgA_3c/SNt-w35g74I/AAAAAAAABww/qzQC2Rt1_EU/s1600-h/EqatecViewer.gif"&gt;&lt;img id="BLOGGER_PHOTO_ID_5249929168734449538" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://1.bp.blogspot.com/_MGI3FYgA_3c/SNt-w35g74I/AAAAAAAABww/qzQC2Rt1_EU/s400/EqatecViewer.gif" border="0" /&gt;&lt;/a&gt; &lt;hr /&gt;&lt;br /&gt;25/09/2008 15:51:18 (1) enter Program.Main ( String[], )&lt;br /&gt;25/09/2008 15:51:18 (1) enter+leave Program.PrintNames ( List`1[System.String], )&lt;br /&gt;25/09/2008 15:51:18 (1) enter+leave Program.PrintNames ( List`1[System.String], )&lt;br /&gt;25/09/2008 15:51:18 (1) enter+leave SortByLastCharacter..ctor ()&lt;br /&gt;25/09/2008 15:51:18 (1) enter SortByLastCharacter.Compare ( "Andy", "Brain", )&lt;br /&gt;25/09/2008 15:51:18 (1) leave SortByLastCharacter.Compare ( 11, )&lt;br /&gt;25/09/2008 15:51:18 (1) enter SortByLastCharacter.Compare ( "Brain", "John", )&lt;br /&gt;25/09/2008 15:51:18 (1) leave SortByLastCharacter.Compare ( 0, )&lt;br /&gt;25/09/2008 15:51:18 (1) enter SortByLastCharacter.Compare ( "Andy", "John", )&lt;br /&gt;25/09/2008 15:51:18 (1) leave SortByLastCharacter.Compare ( 11, )&lt;br /&gt;25/09/2008 15:51:18 (1) enter SortByLastCharacter.Compare ( "Brain", "John", )&lt;br /&gt;25/09/2008 15:51:18 (1) leave SortByLastCharacter.Compare ( 0, )&lt;br /&gt;25/09/2008 15:51:18 (1) enter SortByLastCharacter.Compare ( "John", "Andy", )&lt;br /&gt;25/09/2008 15:51:18 (1) leave SortByLastCharacter.Compare ( -11, )&lt;br /&gt;25/09/2008 15:51:18 (1) enter SortByLastCharacter.Compare ( "John", "Frank", )&lt;br /&gt;25/09/2008 15:51:18 (1) leave SortByLastCharacter.Compare ( 3, )&lt;br /&gt;25/09/2008 15:51:18 (1) enter SortByLastCharacter.Compare ( "John", "John", )&lt;br /&gt;25/09/2008 15:51:18 (1) leave SortByLastCharacter.Compare ( 0, )&lt;br /&gt;25/09/2008 15:51:18 (1) enter SortByLastCharacter.Compare ( "John", "John", )&lt;br /&gt;25/09/2008 15:51:18 (1) leave SortByLastCharacter.Compare ( 0, )&lt;br /&gt;25/09/2008 15:51:18 (1) enter SortByLastCharacter.Compare ( "Brain", "Andy", )&lt;br /&gt;25/09/2008 15:51:18 (1) leave SortByLastCharacter.Compare ( -11, )&lt;br /&gt;25/09/2008 15:51:18 (1) enter SortByLastCharacter.Compare ( "Brain", "Andy", )&lt;br /&gt;25/09/2008 15:51:18 (1) leave SortByLastCharacter.Compare ( -11, )&lt;br /&gt;25/09/2008 15:51:18 (1) enter SortByLastCharacter.Compare ( "Brain", "Brain", )&lt;br /&gt;25/09/2008 15:51:18 (1) leave SortByLastCharacter.Compare ( 0, )&lt;br /&gt;25/09/2008 15:51:18 (1) enter SortByLastCharacter.Compare ( "Brain", "Andy", )&lt;br /&gt;25/09/2008 15:51:18 (1) leave SortByLastCharacter.Compare ( -11, )&lt;br /&gt;25/09/2008 15:51:18 (1) enter SortByLastCharacter.Compare ( "Brain", "Brain", )&lt;br /&gt;25/09/2008 15:51:18 (1) leave SortByLastCharacter.Compare ( 0, )&lt;br /&gt;25/09/2008 15:51:18 (1) enter+leave Program.PrintNames ( List`1[System.String], )&lt;br /&gt;&lt;hr /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2149165178736128353-5338127109194848302?l=moiashvin-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://moiashvin-tech.blogspot.com/feeds/5338127109194848302/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2149165178736128353&amp;postID=5338127109194848302' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/5338127109194848302'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/5338127109194848302'/><link rel='alternate' type='text/html' href='http://moiashvin-tech.blogspot.com/2008/09/walkthrough-eqatec-tracer.html' title='Walkthrough EQATEC Tracer'/><author><name>ashvin</name><uri>http://www.blogger.com/profile/00922391930245622789</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_MGI3FYgA_3c/Sz0gYk3D9UI/AAAAAAAACnU/k5b8SZoi0r4/S220/26122009454.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_MGI3FYgA_3c/SNt92ODrfzI/AAAAAAAABwg/e0oIhhcr6WY/s72-c/Eqatec0.gif' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2149165178736128353.post-8834922338199824402</id><published>2008-09-25T08:53:00.002+04:00</published><updated>2008-09-25T08:57:32.331+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Tools'/><category scheme='http://www.blogger.com/atom/ns#' term='Ashvin Gunga'/><category scheme='http://www.blogger.com/atom/ns#' term='Eqatec'/><title type='text'>EQATEC Tracer</title><content type='html'>&lt;div align="justify"&gt;Another free developer tool has been released yesterday - the EQUATEC Tracer.&lt;br /&gt;&lt;br /&gt;Here's the email extract from the EQATEC development team:&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#000066;"&gt;We're happy to announce the release of yet another development tool, the EQATEC Tracer.&lt;br /&gt;&lt;br /&gt;In summary, the tracer will show how your .NET code is executed live. It's great for debugging and no source code changes are needed: just point the tracer to your app, run the modified code, and start watching the trace output. It's that simple.&lt;br /&gt;&lt;br /&gt;The tracer is useful for all .NET developers, but especially for those doing embedded development in .NET Compact Framework: it allows you to enable in-target-debugging during development or at customer sites - a situation where a traditional debugger isn't an option. Letting the tracer add trace-instructions to all methods and turn them on/off at runtime can easily save many, many days of work, so you can spend your time on the fun and interesting parts instead of adding endless trace-messages.&lt;br /&gt;&lt;br /&gt;Some functional highlights include:&lt;br /&gt;&lt;br /&gt;- Add trace to any .NET apps - no source code changes needed&lt;br /&gt;- Enable tracing at runtime for all method calls, parameters, exceptions etc&lt;br /&gt;- Works with both .NET Compact Framework and the full .NET Framework&lt;br /&gt;- Very low overhead when tracing is turned off&lt;br /&gt;- View trace output from PC or device remotely over network connection&lt;br /&gt;- On the fly enabling and disabling of trace instructions&lt;br /&gt;- Trace each thread in a separate window&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The EQATEC Tracer can be downloaded &lt;a href="http://www.eqatec.com/tools/tracer"&gt;here&lt;/a&gt; under BSD license terms.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2149165178736128353-8834922338199824402?l=moiashvin-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://moiashvin-tech.blogspot.com/feeds/8834922338199824402/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2149165178736128353&amp;postID=8834922338199824402' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/8834922338199824402'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/8834922338199824402'/><link rel='alternate' type='text/html' href='http://moiashvin-tech.blogspot.com/2008/09/eqatec-tracer.html' title='EQATEC Tracer'/><author><name>ashvin</name><uri>http://www.blogger.com/profile/00922391930245622789</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_MGI3FYgA_3c/Sz0gYk3D9UI/AAAAAAAACnU/k5b8SZoi0r4/S220/26122009454.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2149165178736128353.post-9083880082340500424</id><published>2008-09-23T11:33:00.003+04:00</published><updated>2008-09-23T11:44:30.144+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Programming'/><category scheme='http://www.blogger.com/atom/ns#' term='Ashvin Gunga'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><category scheme='http://www.blogger.com/atom/ns#' term='.NET 2.0'/><title type='text'>CommaDelimitedStringCollection class in .NET Framework</title><content type='html'>&lt;div align="justify"&gt;One simple but yet very interesting and useful class in .NET Framework that allows the creation of comma separated string from a list of string items is the &lt;u&gt;CommaDelimitedStringCollection&lt;/u&gt;. This class is found in the &lt;u&gt;System.Configuration&lt;/u&gt; namespace. So, we can stop reinventing the wheel each time we need such a collection, and instead, make use of this ready-made class.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Sample code...&lt;/b&gt;&lt;br /&gt;&lt;/div&gt;&lt;p style="BACKGROUND: white; MARGIN: 0pxfont-family:Courier New;font-size:10pt;color:black;"   &gt;&lt;span style="color:teal;"&gt;CommaDelimitedStringCollection&lt;/span&gt; sites = &lt;span style="color:blue;"&gt;new&lt;/span&gt; &lt;span style="color:teal;"&gt;CommaDelimitedStringCollection&lt;/span&gt;();&lt;/p&gt;&lt;p style="BACKGROUND: white; MARGIN: 0pxfont-family:Courier New;font-size:10pt;color:black;"   &gt;sites.Add(&lt;span style="color:maroon;"&gt;"www.yahoo.com"&lt;/span&gt;);&lt;/p&gt;&lt;p style="BACKGROUND: white; MARGIN: 0pxfont-family:Courier New;font-size:10pt;color:black;"   &gt;sites.Add(&lt;span style="color:maroon;"&gt;"www.google.com"&lt;/span&gt;);&lt;/p&gt;&lt;p style="BACKGROUND: white; MARGIN: 0pxfont-family:Courier New;font-size:10pt;color:black;"   &gt;&lt;/p&gt;&lt;p style="BACKGROUND: white; MARGIN: 0pxfont-family:Courier New;font-size:10pt;color:black;"   &gt;sites.AddRange(&lt;span style="color:blue;"&gt;new&lt;/span&gt; &lt;span style="color:blue;"&gt;string&lt;/span&gt;[] { &lt;span style="color:maroon;"&gt;"moiashvin-tech.blogspot.com"&lt;/span&gt;, &lt;span style="color:maroon;"&gt;"www.lexpress.mu"&lt;/span&gt; });&lt;/p&gt;&lt;p style="BACKGROUND: white; MARGIN: 0px" color="black" size="10pt" face="Courier New"&gt;&lt;/p&gt;&lt;p style="BACKGROUND: white; MARGIN: 0px" color="black" size="10pt" face="Courier New"&gt;&lt;span style="color:teal;"&gt;Console&lt;/span&gt;.WriteLine(sites.ToString());&lt;/p&gt;&lt;br /&gt;&lt;b&gt;Output...&lt;/b&gt;&lt;br /&gt;www.yahoo.com,www.google.com,moiashvin-tech.blogspot.com,www.lexpress.mu&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2149165178736128353-9083880082340500424?l=moiashvin-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://moiashvin-tech.blogspot.com/feeds/9083880082340500424/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2149165178736128353&amp;postID=9083880082340500424' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/9083880082340500424'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/9083880082340500424'/><link rel='alternate' type='text/html' href='http://moiashvin-tech.blogspot.com/2008/09/commadelimitedstringcollection-class-in.html' title='CommaDelimitedStringCollection class in .NET Framework'/><author><name>ashvin</name><uri>http://www.blogger.com/profile/00922391930245622789</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_MGI3FYgA_3c/Sz0gYk3D9UI/AAAAAAAACnU/k5b8SZoi0r4/S220/26122009454.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2149165178736128353.post-2307865845103129135</id><published>2008-09-21T14:29:00.011+04:00</published><updated>2008-09-21T21:59:13.733+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Code Coverage'/><category scheme='http://www.blogger.com/atom/ns#' term='Ashvin Gunga'/><title type='text'>100% code coverage - good but not preeminent</title><content type='html'>&lt;div align="justify"&gt;I was configuring TestDriven.NET on my machine, and the idea of writing a few lines about code coverage popped in my mind. There have been continuous debates and discussions about this particular topic in the past years and thousands of words have already been written by experts in the field. Everyone can have a different opinion about testing, and more importantly code coverage (as this is what the post is all about), and so do I.&lt;br /&gt;&lt;br /&gt;We, programmers (irrespective of the programming language that we use), have one common goal in our respective objectives - to write good quality code. And by good quality code, I mean code that implements correctly the desired functionality, is in line with industry (or corporate) standards while following the appropriate coding guidelines, uses constraint resources of the environment and infrastructures in an optimal way and is easily maintainable, just to mention a few. Last but not least, another feature of the good quality code is also 'bug free' code.&lt;br /&gt;&lt;br /&gt;The testing phase in a software development life cycle ensures that the code is well-tested using an appropriate strategy. Different types of tests, such as unit tests, integration tests and system tests, just to name a few, are conducted. Once the tests are completed, code coverage reports are usually produced.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;em&gt;"Testing never proves the absence of faults, it only shows their presence."&lt;/em&gt;&lt;/strong&gt; - Edsger Dijkstra&lt;br /&gt;&lt;br /&gt;What is code coverage? Code coverage tells us how much of our code have we tested. It gives helpful information about the part of the code that has been exercised, and hence, a complete new perspective to the testing paradigms. However, the toughest task is to be able to correctly interpret the code coverage results (or say, reports). And that's where development teams and programmers often make their first mistake.&lt;br /&gt;&lt;br /&gt;Many professionals in the software development field believe that a 100% code coverage means that the application is bug free. Hold on. Take a moment and give this a second thought. Are you indeed such a believer?&lt;br /&gt;&lt;br /&gt;According to me, 100% code coverage is good but not preeminent. Not preeminent? Yes, I believe there is nothing extraordinary with a 100% code coverage. Does the 100% coverage guarantee that all the tests have been done in the right way? Does it guarantee that the selected test cases and test data are indeed correct? Does it guarantee that we haven't missed any corner case? What about a missing functionality in the code, will the 100% coverage identify it? The answers are a big NO. This is neither the Test Driven Development nor the code coverage fault. It's a failing of the way the results are interpreted. The focus should be more on the test strategies, scenarios and data rather than on the code coverage.&lt;br /&gt;&lt;br /&gt;Let me give a very basic example. I have a static Divide() method in the Divider class that accepts a dividend and divisor and returns the quotient.&lt;br /&gt;&lt;/div&gt;&lt;br/&gt;&lt;div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;"   &gt;&lt;pre style="MARGIN: 0px"&gt;&lt;span style="color:blue;"&gt;using&lt;/span&gt; System;&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;"   &gt;&lt;pre style="MARGIN: 0px"&gt;&lt;span style="color:blue;"&gt;using&lt;/span&gt; System.Collections.Generic;&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;"   &gt;&lt;pre style="MARGIN: 0px"&gt;&lt;span style="color:blue;"&gt;using&lt;/span&gt; System.Text;&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;"   &gt;&lt;pre style="MARGIN: 0px"&gt; &lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;"   &gt;&lt;pre style="MARGIN: 0px"&gt;&lt;span style="color:blue;"&gt;namespace&lt;/span&gt; CodeCoverageTests&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;"   &gt;&lt;pre style="MARGIN: 0px"&gt;{&lt;/pre&gt;&lt;/div&gt;&lt;div style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: Courier New"&gt;&lt;pre style="MARGIN: 0px"&gt;    &lt;span style="color:blue;"&gt;public&lt;/span&gt; &lt;span style="color:blue;"&gt;class&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;Divider&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: Courier New"&gt;&lt;pre style="MARGIN: 0px"&gt;    {&lt;/pre&gt;&lt;/div&gt;&lt;div style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: Courier New"&gt;&lt;pre style="MARGIN: 0px"&gt;        &lt;span style="color:blue;"&gt;public&lt;/span&gt; &lt;span style="color:blue;"&gt;static&lt;/span&gt; &lt;span style="color:blue;"&gt;double&lt;/span&gt; Divide(&lt;span style="color:blue;"&gt;int&lt;/span&gt; divident, &lt;span style="color:blue;"&gt;int&lt;/span&gt; divisor)&lt;/pre&gt;&lt;/div&gt;&lt;div style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: Courier New"&gt;&lt;pre style="MARGIN: 0px"&gt;        {&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white" face="Courier New" size="10pt" color="black"&gt;&lt;pre style="MARGIN: 0px"&gt;            &lt;span style="color:blue;"&gt;return&lt;/span&gt; dividend / divisor;&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white" face="Courier New" size="10pt" color="black"&gt;&lt;pre style="MARGIN: 0px"&gt;        }&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white" face="Courier New" size="10pt" color="black"&gt;&lt;pre style="MARGIN: 0px"&gt;    }&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white" face="Courier New" size="10pt" color="black"&gt;&lt;pre style="MARGIN: 0px"&gt;}&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;I will use the DividerTest class to test this Divide() method using the NUnit tool.&lt;br /&gt;&lt;br /&gt;&lt;div style="BACKGROUND: white" face="Courier New" size="10pt" color="black"&gt;&lt;pre style="MARGIN: 0px"&gt;&lt;span style="color:blue;"&gt;using&lt;/span&gt; System;&lt;/pre&gt;&lt;pre style="MARGIN: 0px"&gt;&lt;span style="color:blue;"&gt;using&lt;/span&gt; System.Collections.Generic;&lt;/pre&gt;&lt;pre style="MARGIN: 0px"&gt;&lt;span style="color:blue;"&gt;using&lt;/span&gt; System.Text;&lt;/pre&gt;&lt;pre style="MARGIN: 0px"&gt;&lt;span style="color:blue;"&gt;using&lt;/span&gt; NUnit.Framework;&lt;/pre&gt;&lt;pre style="MARGIN: 0px"&gt; &lt;/pre&gt;&lt;pre style="MARGIN: 0px"&gt;&lt;span style="color:blue;"&gt;namespace&lt;/span&gt; CodeCoverageTests&lt;/pre&gt;&lt;pre style="MARGIN: 0px"&gt;{&lt;/pre&gt;&lt;pre style="MARGIN: 0px"&gt;    [&lt;span style="color:#2b91af;"&gt;TestFixture&lt;/span&gt;]&lt;/pre&gt;&lt;pre style="MARGIN: 0px"&gt;    &lt;span style="color:blue;"&gt;public&lt;/span&gt; &lt;span style="color:blue;"&gt;class&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;DividerTest&lt;/span&gt;&lt;/pre&gt;&lt;pre style="MARGIN: 0px"&gt;    {&lt;/pre&gt;&lt;pre style="MARGIN: 0px"&gt;        [&lt;span style="color:#2b91af;"&gt;Test&lt;/span&gt;]&lt;/pre&gt;&lt;pre style="MARGIN: 0px"&gt;        &lt;span style="color:blue;"&gt;public&lt;/span&gt; &lt;span style="color:blue;"&gt;void&lt;/span&gt; TestDivide()&lt;/pre&gt;&lt;pre style="MARGIN: 0px"&gt;        {&lt;/pre&gt;&lt;pre style="MARGIN: 0px"&gt;            &lt;span style="color:#2b91af;"&gt;Assert&lt;/span&gt;.AreEqual(10.0, &lt;span style="color:#2b91af;"&gt;Divider&lt;/span&gt;.Divide(30, 3), &lt;span style="color:#a31515;"&gt;"Incorrect division."&lt;/span&gt;);&lt;/pre&gt;&lt;pre style="MARGIN: 0px"&gt;        }&lt;/pre&gt;&lt;pre style="MARGIN: 0px"&gt;    }&lt;/pre&gt;&lt;pre style="MARGIN: 0px"&gt;}&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;When run, the test is passed successfully.&lt;br /&gt;&lt;img id="BLOGGER_PHOTO_ID_5248420114270593154" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://3.bp.blogspot.com/_MGI3FYgA_3c/SNYiSV8dIII/AAAAAAAABwY/PZxCMjTiimY/s400/UnitTest.jpg" border="0" /&gt;&lt;br /&gt;&lt;br /&gt;And more importantly, the code coverage shows a 100% figure.&lt;br /&gt;&lt;img id="BLOGGER_PHOTO_ID_5248420058863411794" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://3.bp.blogspot.com/_MGI3FYgA_3c/SNYiPHiWolI/AAAAAAAABwQ/qT5OVv7j4P8/s400/CodeCoverage.jpg" border="0" /&gt; &lt;p align="justify"&gt;&lt;br /&gt;With this figure, it gives the impression that this is really a good piece of work, with tests passed succesfully, and above all, a code coverage of 100%.&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#000099;"&gt;&lt;strong&gt;Ladies and Gentlemen: Don't be fooled by the coverage report.&lt;/strong&gt;&lt;/span&gt; That's how Andrew Glover expressed himself in his &lt;a href = "http://www-128.ibm.com/developerworks/java/library/j-cq01316/index.html"&gt;article “In pursuit of code quality: Don’t be fooled by the coverage report”&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Call the method Divide() with 0 as the divisor and the program will throw a DivisionByZero exception. This is just a simple example to show how wrong one can be when assuming that a piece of code with 100% code coverage is bug free.&lt;br /&gt;&lt;br /&gt;&lt;em&gt;Code coverage is a very good indicator of how various sections of the code were tested. It is here to work as a complement, not the primarily indicator, for the overall code quality picture.&lt;/em&gt; &lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2149165178736128353-2307865845103129135?l=moiashvin-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://moiashvin-tech.blogspot.com/feeds/2307865845103129135/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2149165178736128353&amp;postID=2307865845103129135' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/2307865845103129135'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/2307865845103129135'/><link rel='alternate' type='text/html' href='http://moiashvin-tech.blogspot.com/2008/09/100-code-coverage-good-but-not.html' title='100% code coverage - good but not preeminent'/><author><name>ashvin</name><uri>http://www.blogger.com/profile/00922391930245622789</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_MGI3FYgA_3c/Sz0gYk3D9UI/AAAAAAAACnU/k5b8SZoi0r4/S220/26122009454.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_MGI3FYgA_3c/SNYiSV8dIII/AAAAAAAABwY/PZxCMjTiimY/s72-c/UnitTest.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2149165178736128353.post-1684096313398456414</id><published>2008-09-18T19:45:00.003+04:00</published><updated>2008-09-18T19:50:22.604+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Ashvin Gunga'/><category scheme='http://www.blogger.com/atom/ns#' term='Netbeans'/><title type='text'>Netbeans free DVD distribution program suspended indefinitely</title><content type='html'>&lt;div align="justify"&gt;Extract of the email from Netbeans Webmaster...&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#000099;"&gt;I regret to inform you that the DVD distribution program has been suspended indefinitely as we evaluate options to simplify the distribution of NetBeans software.&lt;br /&gt;&lt;br /&gt;Since August 30th, 2005, NetBeans.org has shipped more than 225,000 CDs &amp;amp; DVDs to developers around the world through this initiative! During this period, NetBeans has experienced explosive growth as a download, media kit, and a community. To stay ahead of this encouraging trend we are looking into ways to effectively satisfy increasing demand for NetBeans software worldwide. Please bear with us. &lt;br /&gt;&lt;br /&gt;In the interim, we are offering the same great contents of NetBeans IDE 6.1 ML DVD Starter Kit as an ISO image that you are free to download and burn. Alternatively, visit our download page for installer bundles as lightweight as 18MB. In the near future we also hope to offer our downloads via mirrors and bittorrent ...&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2149165178736128353-1684096313398456414?l=moiashvin-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://moiashvin-tech.blogspot.com/feeds/1684096313398456414/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2149165178736128353&amp;postID=1684096313398456414' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/1684096313398456414'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/1684096313398456414'/><link rel='alternate' type='text/html' href='http://moiashvin-tech.blogspot.com/2008/09/netbeans-free-dvd-distribution-program.html' title='Netbeans free DVD distribution program suspended indefinitely'/><author><name>ashvin</name><uri>http://www.blogger.com/profile/00922391930245622789</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_MGI3FYgA_3c/Sz0gYk3D9UI/AAAAAAAACnU/k5b8SZoi0r4/S220/26122009454.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2149165178736128353.post-1026449261145315847</id><published>2008-09-15T21:20:00.008+04:00</published><updated>2008-09-15T21:41:31.265+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Databases'/><category scheme='http://www.blogger.com/atom/ns#' term='ASP.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='Ashvin Gunga'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL Server'/><title type='text'>Logon failed for user MACHINENAME/ASPNET</title><content type='html'>&lt;div align="justify"&gt;Some weeks back, everything was working fine with the login MYCOMPUTER/ASPNET on the SQL Express Server. &lt;/div&gt;&lt;div align="justify"&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;/div&gt;&lt;br /&gt;&lt;div align="justify"&gt;I formatted my machine recently and during 're-installation' of the operating system, I used a &lt;span style="color:#ff0000;"&gt;MACHINENAME&lt;/span&gt; instead of the default MYCOMPUTER. &lt;/div&gt;&lt;div align="justify"&gt;&lt;/div&gt;&lt;br /&gt;&lt;div align="justify"&gt;&lt;/div&gt;&lt;div align="justify"&gt;Then, I run the aspnet_regiis command and it seems to me that the user &lt;span style="color:#ff0000;"&gt;MACHINENAME&lt;/span&gt;/ASPNET has been created and is also being used as login onto the database. &lt;/div&gt;&lt;div align="left"&gt;&lt;br /&gt;The client application throws the following exception:&lt;br /&gt;&lt;br /&gt;&lt;em&gt;System.Data.SqlClient.SqlException: Cannot open database "&lt;span style="color:#ff0000;"&gt;XXXDATABASEXXX.MDF&lt;/span&gt;" requested by the login. The login failed.&lt;br /&gt;Login failed for user '&lt;span style="color:#ff0000;"&gt;MACHINENAME&lt;/span&gt;\ASPNET'.&lt;br /&gt;at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)&lt;br /&gt;at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)&lt;br /&gt;... ... ... ...&lt;/em&gt;&lt;/div&gt;&lt;div align="left"&gt;&lt;em&gt;... ... ... ...&lt;/em&gt; &lt;/div&gt;&lt;div align="left"&gt;&lt;br /&gt;The database should now be configured to recognise this new &lt;span style="color:#ff0000;"&gt;MACHINENAME&lt;/span&gt;/ASPNET user.&lt;/div&gt;&lt;div align="left"&gt;&lt;/div&gt;&lt;div align="left"&gt;&lt;/div&gt;&lt;br /&gt;&lt;div align="left"&gt;I tried to replace the &lt;span style="color:#000000;"&gt;MYCOMPUTER&lt;/span&gt;/ASPNET user with &lt;span style="color:#ff0000;"&gt;MACHINENAME&lt;/span&gt;/ASPNET user in the database properties but can't find the &lt;span style="color:#ff0000;"&gt;MACHINENAME&lt;/span&gt;/ASPNET user in the available list of users. Any reason for that???&lt;br /&gt;&lt;br /&gt;Anyways, instead of losing precious time finding the right way, the following SQL statement will create the user on the database and allow successful login. Just you have to make sure that the appropriate permissions are set once the user has been created.&lt;/div&gt;&lt;div align="left"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;USE [&lt;span style="color:#ff0000;"&gt;XXXDATABASEXXX.MDF&lt;/span&gt;]&lt;br /&gt;CREATE USER [&lt;span style="color:#ff0000;"&gt;MACHINENAME&lt;/span&gt;\ASPNET] FOR LOGIN [&lt;span style="color:#ff0000;"&gt;MACHINENAME&lt;/span&gt;\ASPNET]&lt;br /&gt;GO&lt;/span&gt; &lt;/div&gt;&lt;br /&gt;&lt;div align="left"&gt;&lt;/div&gt;&lt;div align="left"&gt;Don't forget to change XXXDATABASEXXX and MACHINENAME to the appropriate names on your machine...&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2149165178736128353-1026449261145315847?l=moiashvin-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://moiashvin-tech.blogspot.com/feeds/1026449261145315847/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2149165178736128353&amp;postID=1026449261145315847' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/1026449261145315847'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/1026449261145315847'/><link rel='alternate' type='text/html' href='http://moiashvin-tech.blogspot.com/2008/09/logon-failed-for-user-machinenameaspnet.html' title='Logon failed for user MACHINENAME/ASPNET'/><author><name>ashvin</name><uri>http://www.blogger.com/profile/00922391930245622789</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_MGI3FYgA_3c/Sz0gYk3D9UI/AAAAAAAACnU/k5b8SZoi0r4/S220/26122009454.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2149165178736128353.post-8308392354533597062</id><published>2008-09-12T08:50:00.010+04:00</published><updated>2008-09-23T11:46:21.085+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='.Net CF 2.0'/><category scheme='http://www.blogger.com/atom/ns#' term='Programming'/><category scheme='http://www.blogger.com/atom/ns#' term='Ashvin Gunga'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><category scheme='http://www.blogger.com/atom/ns#' term='.NET 2.0'/><title type='text'>Predicates: List.Find() method</title><content type='html'>&lt;div align="justify"&gt;When it comes to searching an element in a list in C#, it seems easier to write a for loop, and iterate over the elements until the desired element is found. In other words, a linear or sequential search.&lt;br /&gt;&lt;br /&gt;As an example, a LocationVO has two members: Code and Description.&lt;br /&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;"   &gt;&lt;pre style="MARGIN: 0px"&gt;&lt;span style="color:blue;"&gt;public&lt;/span&gt; &lt;span style="color:blue;"&gt;class&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;LocationVO&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;"   &gt;&lt;pre style="MARGIN: 0px"&gt;{&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;"   &gt;&lt;pre style="MARGIN: 0px"&gt;    &lt;span style="color:blue;"&gt;private&lt;/span&gt; &lt;span style="color:blue;"&gt;string&lt;/span&gt; code;&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;"   &gt;&lt;pre style="MARGIN: 0px"&gt; &lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;"   &gt;&lt;pre style="MARGIN: 0px"&gt;    &lt;span style="color:gray;"&gt;///&lt;/span&gt;&lt;span style="color:green;"&gt; &lt;/span&gt;&lt;span style="color:gray;"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;"   &gt;&lt;pre style="MARGIN: 0px"&gt;    &lt;span style="color:gray;"&gt;///&lt;/span&gt;&lt;span style="color:green;"&gt; Gets or sets the code.&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;"   &gt;&lt;pre style="MARGIN: 0px"&gt;    &lt;span style="color:gray;"&gt;///&lt;/span&gt;&lt;span style="color:green;"&gt; &lt;/span&gt;&lt;span style="color:gray;"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;"   &gt;&lt;pre style="MARGIN: 0px"&gt;    &lt;span style="color:gray;"&gt;///&lt;/span&gt;&lt;span style="color:green;"&gt; &lt;/span&gt;&lt;span style="color:gray;"&gt;&amp;lt;value&amp;gt;&lt;/span&gt;&lt;span style="color:green;"&gt;The code.&lt;/span&gt;&lt;span style="color:gray;"&gt;&amp;lt;/value&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;"   &gt;&lt;pre style="MARGIN: 0px"&gt;    &lt;span style="color:blue;"&gt;public&lt;/span&gt; &lt;span style="color:blue;"&gt;string&lt;/span&gt; Code&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;"   &gt;&lt;pre style="MARGIN: 0px"&gt;    {&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;"   &gt;&lt;pre style="MARGIN: 0px"&gt;        &lt;span style="color:blue;"&gt;get&lt;/span&gt; { &lt;span style="color:blue;"&gt;return&lt;/span&gt; code; }&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;"   &gt;&lt;pre style="MARGIN: 0px"&gt;        &lt;span style="color:blue;"&gt;set&lt;/span&gt; { code = &lt;span style="color:blue;"&gt;value&lt;/span&gt;; }&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;"   &gt;&lt;pre style="MARGIN: 0px"&gt;    }&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;"   &gt;&lt;pre style="MARGIN: 0px"&gt; &lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;"   &gt;&lt;pre style="MARGIN: 0px"&gt;    &lt;span style="color:blue;"&gt;private&lt;/span&gt; &lt;span style="color:blue;"&gt;string&lt;/span&gt; description;&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;"   &gt;&lt;pre style="MARGIN: 0px"&gt; &lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;"   &gt;&lt;pre style="MARGIN: 0px"&gt;    &lt;span style="color:gray;"&gt;///&lt;/span&gt;&lt;span style="color:green;"&gt; &lt;/span&gt;&lt;span style="color:gray;"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: Courier New"&gt;&lt;pre style="MARGIN: 0px"&gt;    &lt;span style="color:gray;"&gt;///&lt;/span&gt;&lt;span style="color:green;"&gt; Gets or sets the description.&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: Courier New"&gt;&lt;pre style="MARGIN: 0px"&gt;    &lt;span style="color:gray;"&gt;///&lt;/span&gt;&lt;span style="color:green;"&gt; &lt;/span&gt;&lt;span style="color:gray;"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: Courier New"&gt;&lt;pre style="MARGIN: 0px"&gt;    &lt;span style="color:gray;"&gt;///&lt;/span&gt;&lt;span style="color:green;"&gt; &lt;/span&gt;&lt;span style="color:gray;"&gt;&amp;lt;value&amp;gt;&lt;/span&gt;&lt;span style="color:green;"&gt;The description.&lt;/span&gt;&lt;span style="color:gray;"&gt;&amp;lt;/value&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: Courier New"&gt;&lt;pre style="MARGIN: 0px"&gt;    &lt;span style="color:blue;"&gt;public&lt;/span&gt; &lt;span style="color:blue;"&gt;string&lt;/span&gt; Description&lt;/pre&gt;&lt;/div&gt;&lt;div style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: Courier New"&gt;&lt;pre style="MARGIN: 0px"&gt;    {&lt;/pre&gt;&lt;/div&gt;&lt;div style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: Courier New"&gt;&lt;pre style="MARGIN: 0px"&gt;        &lt;span style="color:blue;"&gt;get&lt;/span&gt; { &lt;span style="color:blue;"&gt;return&lt;/span&gt; description; }&lt;/pre&gt;&lt;/div&gt;&lt;div style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: Courier New"&gt;&lt;pre style="MARGIN: 0px"&gt;        &lt;span style="color:blue;"&gt;set&lt;/span&gt; { description = &lt;span style="color:blue;"&gt;value&lt;/span&gt;; }&lt;/pre&gt;&lt;/div&gt;&lt;div style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: Courier New"&gt;&lt;pre style="MARGIN: 0px"&gt;    }&lt;/pre&gt;&lt;/div&gt;&lt;div style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: Courier New"&gt;&lt;pre style="MARGIN: 0px"&gt;}&lt;/pre&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;br /&gt;The list declaration would be as follows:&lt;br /&gt;&lt;span style="color:#2b91af;"&gt;List&lt;/span&gt;&amp;lt;&lt;span style="color:#2b91af;"&gt;LocationVO&lt;/span&gt;&amp;gt; locations = &lt;span style="color:blue;"&gt;new&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;List&lt;/span&gt;&amp;lt;&lt;span style="color:#2b91af;"&gt;LocationVO&lt;/span&gt;&amp;gt;();&lt;/div&gt;&lt;br /&gt;And the linear search would be:&lt;br /&gt;&lt;div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;"   &gt;&lt;pre style="MARGIN: 0px"&gt;&lt;span style="color:gray;"&gt;///&lt;/span&gt;&lt;span style="color:green;"&gt; &lt;/span&gt;&lt;span style="color:gray;"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="MARGIN: 0px"&gt;&lt;span style="color:gray;"&gt;///&lt;/span&gt;&lt;span style="color:green;"&gt; Finds the business location.&lt;/span&gt;&lt;/pre&gt;&lt;pre style="MARGIN: 0px"&gt;&lt;span style="color:gray;"&gt;///&lt;/span&gt;&lt;span style="color:green;"&gt; &lt;/span&gt;&lt;span style="color:gray;"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="MARGIN: 0px"&gt;&lt;span style="color:gray;"&gt;///&lt;/span&gt;&lt;span style="color:green;"&gt; &lt;/span&gt;&lt;span style="color:gray;"&gt;&amp;lt;param name="code"&amp;gt;&lt;/span&gt;&lt;span style="color:green;"&gt;The code.&lt;/span&gt;&lt;span style="color:gray;"&gt;&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="MARGIN: 0px"&gt;&lt;span style="color:gray;"&gt;///&lt;/span&gt;&lt;span style="color:green;"&gt; &lt;/span&gt;&lt;span style="color:gray;"&gt;&amp;lt;returns&amp;gt;&amp;lt;/returns&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="MARGIN: 0px"&gt;&lt;span style="color:blue;"&gt;public&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;LocationVO&lt;/span&gt; FindLocation(&lt;span style="color:blue;"&gt;string&lt;/span&gt; code)&lt;/pre&gt;&lt;pre style="MARGIN: 0px"&gt;{&lt;/pre&gt;&lt;pre style="MARGIN: 0px"&gt;    &lt;span style="color:blue;"&gt;if&lt;/span&gt; (locations != &lt;span style="color:blue;"&gt;null&lt;/span&gt;)&lt;/pre&gt;&lt;pre style="MARGIN: 0px"&gt;    {&lt;/pre&gt;&lt;pre style="MARGIN: 0px"&gt;        &lt;span style="color:blue;"&gt;for&lt;/span&gt; (&lt;span style="color:blue;"&gt;int&lt;/span&gt; i = 0; i &amp;lt; locations.Count; i++)&lt;/pre&gt;&lt;pre style="MARGIN: 0px"&gt;        {&lt;/pre&gt;&lt;pre style="MARGIN: 0px"&gt;            &lt;span style="color:blue;"&gt;if&lt;/span&gt; (locations[i].Code = code)&lt;/pre&gt;&lt;pre style="MARGIN: 0px"&gt;                &lt;span style="color:blue;"&gt;return&lt;/span&gt; locations[i];&lt;/pre&gt;&lt;pre style="MARGIN: 0px"&gt;        }&lt;/pre&gt;&lt;pre style="MARGIN: 0px"&gt;    }&lt;/pre&gt;&lt;pre style="MARGIN: 0px"&gt;    &lt;span style="color:blue;"&gt;return&lt;/span&gt; &lt;span style="color:blue;"&gt;null&lt;/span&gt;;&lt;/pre&gt;&lt;pre style="MARGIN: 0px"&gt;}&lt;/pre&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;br /&gt;&lt;strong&gt;Predicates&lt;/strong&gt;&lt;br /&gt;An more elegant way is to use the List.Find() method. This method uses a predicate that defines the search criteria. If an element has to be searched by using another criteria (e.g. using the description property rather than the code one), it would be better to write another predicate rather than duplicating the linear search algorithm in the source code.&lt;br /&gt;&lt;span style="color:gray;"&gt;///&lt;/span&gt;&lt;span style="color:green;"&gt; &lt;/span&gt;&lt;span style="color:gray;"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;"   &gt;&lt;pre style="MARGIN: 0px"&gt;&lt;span style="color:gray;"&gt;///&lt;/span&gt;&lt;span style="color:green;"&gt; Finds the location using predicate.&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;"   &gt;&lt;pre style="MARGIN: 0px"&gt;&lt;span style="color:gray;"&gt;///&lt;/span&gt;&lt;span style="color:green;"&gt; &lt;/span&gt;&lt;span style="color:gray;"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white" color="black" size="10pt" face="Courier New"&gt;&lt;pre style="MARGIN: 0px"&gt;&lt;span style="color:gray;"&gt;///&lt;/span&gt;&lt;span style="color:green;"&gt; &lt;/span&gt;&lt;span style="color:gray;"&gt;&amp;lt;param name="code"&amp;gt;&lt;/span&gt;&lt;span style="color:green;"&gt;The code.&lt;/span&gt;&lt;span style="color:gray;"&gt;&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white" color="black" size="10pt" face="Courier New"&gt;&lt;pre style="MARGIN: 0px"&gt;&lt;span style="color:gray;"&gt;///&lt;/span&gt;&lt;span style="color:green;"&gt; &lt;/span&gt;&lt;span style="color:gray;"&gt;&amp;lt;returns&amp;gt;&amp;lt;/returns&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white" color="black" size="10pt" face="Courier New"&gt;&lt;pre style="MARGIN: 0px"&gt;&lt;span style="color:blue;"&gt;public&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;LocationVO&lt;/span&gt; FindLocationUsingPredicate(&lt;span style="color:blue;"&gt;string&lt;/span&gt; code)&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white" color="black" size="10pt" face="Courier New"&gt;&lt;pre style="MARGIN: 0px"&gt;{&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white" color="black" size="10pt" face="Courier New"&gt;&lt;pre style="MARGIN: 0px"&gt;    &lt;span style="color:#2b91af;"&gt;LocationVO&lt;/span&gt; vo = locations.Find(&lt;span style="color:blue;"&gt;delegate&lt;/span&gt;(&lt;span style="color:#2b91af;"&gt;LocationVO&lt;/span&gt; curr)&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white" color="black" size="10pt" face="Courier New"&gt;&lt;pre style="MARGIN: 0px"&gt;    {&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white" color="black" size="10pt" face="Courier New"&gt;&lt;pre style="MARGIN: 0px"&gt;        &lt;span style="color:blue;"&gt;return&lt;/span&gt; curr.Code == code;&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white" color="black" size="10pt" face="Courier New"&gt;&lt;pre style="MARGIN: 0px"&gt;    });&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white" color="black" size="10pt" face="Courier New"&gt;&lt;pre style="MARGIN: 0px"&gt; &lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white" color="black" size="10pt" face="Courier New"&gt;&lt;pre style="MARGIN: 0px"&gt;    &lt;span style="color:blue;"&gt;return&lt;/span&gt; vo;&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white" color="black" size="10pt" face="Courier New"&gt;&lt;pre style="MARGIN: 0px"&gt;}&lt;/pre&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;br /&gt;The List.FindAll() method is yet another interesting method that returns all instances matching the search criteria. &lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2149165178736128353-8308392354533597062?l=moiashvin-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://moiashvin-tech.blogspot.com/feeds/8308392354533597062/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2149165178736128353&amp;postID=8308392354533597062' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/8308392354533597062'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/8308392354533597062'/><link rel='alternate' type='text/html' href='http://moiashvin-tech.blogspot.com/2008/09/predicates-listfind-method.html' title='Predicates: List.Find() method'/><author><name>ashvin</name><uri>http://www.blogger.com/profile/00922391930245622789</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_MGI3FYgA_3c/Sz0gYk3D9UI/AAAAAAAACnU/k5b8SZoi0r4/S220/26122009454.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2149165178736128353.post-8240450480301194619</id><published>2008-08-07T20:25:00.008+04:00</published><updated>2008-08-07T20:39:18.971+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Programming'/><category scheme='http://www.blogger.com/atom/ns#' term='Ashvin Gunga'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><category scheme='http://www.blogger.com/atom/ns#' term='.NET 2.0'/><title type='text'>No setter for KeyChar property in KeyPressEventArgs class</title><content type='html'>&lt;div align="justify"&gt;Have you ever tried to set the property KeyChar of the KeyPressEventArgs class? At least, we should be able to do that when looking at the tooltip documentation.&lt;br /&gt;&lt;br /&gt;&lt;img id="BLOGGER_PHOTO_ID_5231813189548388594" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://2.bp.blogspot.com/_MGI3FYgA_3c/SJsiYGY8MPI/AAAAAAAABwA/m0LhJYWfGpE/s400/KeyPress_mistake_i.gif" border="0" /&gt;However, no matter how much you struggle, it will never compile. The reason is simple - a minor mistake in the documentation for the KeyChar property. KeyChar has only the getter and NO SETTER.&lt;br /&gt;&lt;br /&gt;&lt;img id="BLOGGER_PHOTO_ID_5231813340382307394" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://4.bp.blogspot.com/_MGI3FYgA_3c/SJsig4SjJEI/AAAAAAAABwI/Ab6geA2RCwQ/s400/KeyPress_mistake.gif" border="0" /&gt; &lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2149165178736128353-8240450480301194619?l=moiashvin-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://moiashvin-tech.blogspot.com/feeds/8240450480301194619/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2149165178736128353&amp;postID=8240450480301194619' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/8240450480301194619'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/8240450480301194619'/><link rel='alternate' type='text/html' href='http://moiashvin-tech.blogspot.com/2008/08/no-setter-for-keychar-property-in.html' title='No setter for KeyChar property in KeyPressEventArgs class'/><author><name>ashvin</name><uri>http://www.blogger.com/profile/00922391930245622789</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_MGI3FYgA_3c/Sz0gYk3D9UI/AAAAAAAACnU/k5b8SZoi0r4/S220/26122009454.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_MGI3FYgA_3c/SJsiYGY8MPI/AAAAAAAABwA/m0LhJYWfGpE/s72-c/KeyPress_mistake_i.gif' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2149165178736128353.post-4525618916201454510</id><published>2008-08-06T22:36:00.008+04:00</published><updated>2008-08-06T22:53:09.813+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='.Net CF 2.0'/><category scheme='http://www.blogger.com/atom/ns#' term='Programming'/><category scheme='http://www.blogger.com/atom/ns#' term='Ashvin Gunga'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><title type='text'>Drawing rotated text in .Net Compact Framework</title><content type='html'>&lt;div align="justify"&gt;To draw rotated text in applications targeting mobile devices, the LogFont class in the .Net Compact Framework exposes the desired methods. Read more on MSDN &lt;a href="http://msdn.microsoft.com/en-us/library/microsoft.windowsce.forms.logfont.aspx"&gt;here&lt;/a&gt;.&lt;/div&gt;&lt;p align="center"&gt;&lt;img id="BLOGGER_PHOTO_ID_5231478289312272690" style="MARGIN: 0px 10px 10px 0px; CURSOR: hand" alt="" src="http://1.bp.blogspot.com/_MGI3FYgA_3c/SJnxyVygUTI/AAAAAAAABv4/XRF9tsQ0V6E/s400/rotate_text_360.gif" border="0" /&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2149165178736128353-4525618916201454510?l=moiashvin-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://moiashvin-tech.blogspot.com/feeds/4525618916201454510/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2149165178736128353&amp;postID=4525618916201454510' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/4525618916201454510'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/4525618916201454510'/><link rel='alternate' type='text/html' href='http://moiashvin-tech.blogspot.com/2008/08/draw-rotated-text-in-net-compact.html' title='Drawing rotated text in .Net Compact Framework'/><author><name>ashvin</name><uri>http://www.blogger.com/profile/00922391930245622789</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_MGI3FYgA_3c/Sz0gYk3D9UI/AAAAAAAACnU/k5b8SZoi0r4/S220/26122009454.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_MGI3FYgA_3c/SJnxyVygUTI/AAAAAAAABv4/XRF9tsQ0V6E/s72-c/rotate_text_360.gif' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2149165178736128353.post-4098100792885792415</id><published>2008-08-03T20:49:00.004+04:00</published><updated>2008-08-03T20:57:37.038+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Subversion'/><category scheme='http://www.blogger.com/atom/ns#' term='Ashvin Gunga'/><category scheme='http://www.blogger.com/atom/ns#' term='Windows XP'/><title type='text'>Subversion Repository on Windows</title><content type='html'>&lt;div align="justify"&gt;While installing and configuring Subversion for a second time on my machine (yes, a second time since I had to format my pc some weeks back), I thought about writing a post with the steps. But the good thing is there is already a very very very good article that gives a &lt;a href="http://www.stanford.edu/~bsuter/subversion-setup-guide/"&gt;Step-by-Step instructions for running a Subversion repository under Windows&lt;/a&gt;, and it covers the downloads, installation, configuration and usage. Click &lt;a href="http://www.stanford.edu/~bsuter/subversion-setup-guide/"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;... And you can find a lot more articles &lt;a href="http://www.google.com/"&gt;here&lt;/a&gt; as well. &lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2149165178736128353-4098100792885792415?l=moiashvin-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://moiashvin-tech.blogspot.com/feeds/4098100792885792415/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2149165178736128353&amp;postID=4098100792885792415' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/4098100792885792415'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/4098100792885792415'/><link rel='alternate' type='text/html' href='http://moiashvin-tech.blogspot.com/2008/08/subversion-repository-on-windows.html' title='Subversion Repository on Windows'/><author><name>ashvin</name><uri>http://www.blogger.com/profile/00922391930245622789</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_MGI3FYgA_3c/Sz0gYk3D9UI/AAAAAAAACnU/k5b8SZoi0r4/S220/26122009454.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2149165178736128353.post-5995361212623730127</id><published>2008-07-29T22:24:00.001+04:00</published><updated>2008-07-29T22:27:27.491+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Nokia N95'/><category scheme='http://www.blogger.com/atom/ns#' term='Ashvin Gunga'/><title type='text'>Nokia N95 MAC Address</title><content type='html'>&lt;div align="justify"&gt;To check the MAC address of the WLAN adapter for phones running on the S60 operating systems (for example, the Nokia N95), type the following code in the standby mode:&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;*#62209526# &lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;The MAC address of some phone can also be obtained on the label under the battery.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2149165178736128353-5995361212623730127?l=moiashvin-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://moiashvin-tech.blogspot.com/feeds/5995361212623730127/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2149165178736128353&amp;postID=5995361212623730127' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/5995361212623730127'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/5995361212623730127'/><link rel='alternate' type='text/html' href='http://moiashvin-tech.blogspot.com/2008/07/nokia-n95-mac-address.html' title='Nokia N95 MAC Address'/><author><name>ashvin</name><uri>http://www.blogger.com/profile/00922391930245622789</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_MGI3FYgA_3c/Sz0gYk3D9UI/AAAAAAAACnU/k5b8SZoi0r4/S220/26122009454.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2149165178736128353.post-5110660165469714496</id><published>2008-07-28T20:21:00.007+04:00</published><updated>2008-07-28T21:14:16.791+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='.Net CF 2.0'/><category scheme='http://www.blogger.com/atom/ns#' term='Programming'/><category scheme='http://www.blogger.com/atom/ns#' term='Windows Mobile 5.0'/><category scheme='http://www.blogger.com/atom/ns#' term='Ashvin Gunga'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><title type='text'>Synchronize Timezone for Windows Mobile 5.0 devices in C# and .Net Compact Framework</title><content type='html'>&lt;div align="justify"&gt;&lt;strong&gt;Synchronize Timezone for Windows Mobile 5.0 devices in C# and .Net Compact Framework&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Many forums on the web have the issue of timezone synchronization for the WM5.0 devices posted and unanswered. Changing the timezone information on a Windows Mobile 5.0 device is not as straight forward as a Windows CE 5.0 one. The latter keep all the different timezones in the device registry, while the former has the timezones in a file on its file system.&lt;br /&gt;&lt;br /&gt;To correctly change current timezone for applications in C# running on the Windows Mobile 5.0 platform, the PInvoke calls can be used. To make life easier, I would recommend the OpenNETCF library as it already wraps the PInvoke calls and their complexity in managed classes.&lt;br /&gt;&lt;br /&gt;In the OpenNETCF.Win32 namespace, the TimeZoneCollection class exposes the Initialize() method that loads an array of timezone structures into memory. The Initialize() method of the TimeZoneCollection class uses the PInvoke call&lt;br /&gt;&lt;br /&gt;[&lt;span style="color:#2b91af;"&gt;DllImport&lt;/span&gt;(&lt;span style="color:#a31515;"&gt;"citydb"&lt;/span&gt;)]&lt;/div&gt;&lt;div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;" align="justify"   &gt;&lt;pre style="MARGIN: 0px"&gt;&lt;span style="color:blue;"&gt;extern&lt;/span&gt; &lt;span style="color:blue;"&gt;static&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;IntPtr&lt;/span&gt; ClockGetTimeZoneDataByOffset(&lt;span style="color:blue;"&gt;int&lt;/span&gt; nOffset);&lt;/pre&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;br /&gt;to get all the different timezones available on the device.&lt;br /&gt;&lt;br /&gt;Once all the different timezones have been loaded, it is easy to loop through the collection and pick up the appropriate timezone and then call the SetTimeZoneInformation() method found in the DateEx class within the same namespace.&lt;br /&gt;&lt;br /&gt;However, when the TimeZoneCollection is instantiated and initialized, a native exception is thrown on the device, similar to the following:&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;" align="justify"   &gt;&lt;pre style="MARGIN: 0px"&gt;&lt;span style="color:#2b91af;"&gt;TimeZoneCollection&lt;/span&gt; tzc = &lt;span style="color:blue;"&gt;new&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;TimeZoneCollection&lt;/span&gt;();&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white" align="justify" face="Courier New" size="10pt" color="black"&gt;&lt;pre style="MARGIN: 0px"&gt;tzc.Initialize();&lt;/pre&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;img id="BLOGGER_PHOTO_ID_5228102565184913522" style="MARGIN: 0px 10px 10px 0px; CURSOR: hand" alt="" src="http://bp3.blogger.com/_MGI3FYgA_3c/SI3zlVcnwHI/AAAAAAAABvw/jaL7om4xd-A/s400/native_exception_timezone_sync1.gif" border="0" /&gt;&lt;br /&gt;&lt;img id="BLOGGER_PHOTO_ID_5228101714126607938" style="MARGIN: 0px 10px 10px 0px; CURSOR: hand" alt="" src="http://bp2.blogger.com/_MGI3FYgA_3c/SI3yzzAglkI/AAAAAAAABvo/a0uj7Uj-12U/s400/native_exception_timezone_sync2.gif" border="0" /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://blog.opennetcf.com/ctacke/default.aspx"&gt;Chris Tacke&lt;/a&gt; mentioned about a bug in the OpenNETCF code in his blog, and to get over this exception, the PInvoke definition must be changed so that it accepts a second parameter that is a ref int (the original only has one parameter, which is incorrect). Hence, the PInvoke definition will be as follows:&lt;br /&gt;&lt;br /&gt;[&lt;span style="color:#2b91af;"&gt;DllImport&lt;/span&gt;(&lt;span style="color:#a31515;"&gt;"citydb"&lt;/span&gt;)]&lt;/div&gt;&lt;div align="justify"&gt;&lt;span style="color:blue;"&gt;extern&lt;/span&gt; &lt;span style="color:blue;"&gt;static&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;IntPtr&lt;/span&gt; ClockGetTimeZoneDataByOffset(&lt;span style="color:blue;"&gt;int&lt;/span&gt; nOffset, &lt;span style="color:blue;"&gt;ref&lt;/span&gt; &lt;span style="color:blue;"&gt;int&lt;/span&gt; fix);&lt;/div&gt;&lt;div align="justify"&gt;&lt;br /&gt;If you need further information or still having problems, please do not hesitate to let me know. &lt;br /&gt;&lt;br /&gt;&lt;em&gt;Last but not the least, talking about the real synchronization, my application's server tier already handled all the complexity (i.e. determining the correct time, and timezone for the device and providing the timezone bias), so I just had to set the timezone and time correctly using the provided bias.&lt;/em&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2149165178736128353-5110660165469714496?l=moiashvin-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://moiashvin-tech.blogspot.com/feeds/5110660165469714496/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2149165178736128353&amp;postID=5110660165469714496' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/5110660165469714496'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/5110660165469714496'/><link rel='alternate' type='text/html' href='http://moiashvin-tech.blogspot.com/2008/07/synchronize-timezone-for-windows-mobile.html' title='Synchronize Timezone for Windows Mobile 5.0 devices in C# and .Net Compact Framework'/><author><name>ashvin</name><uri>http://www.blogger.com/profile/00922391930245622789</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_MGI3FYgA_3c/Sz0gYk3D9UI/AAAAAAAACnU/k5b8SZoi0r4/S220/26122009454.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://bp3.blogger.com/_MGI3FYgA_3c/SI3zlVcnwHI/AAAAAAAABvw/jaL7om4xd-A/s72-c/native_exception_timezone_sync1.gif' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2149165178736128353.post-3322785952314459338</id><published>2008-07-26T14:14:00.012+04:00</published><updated>2008-07-30T11:45:41.509+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Nokia N95'/><category scheme='http://www.blogger.com/atom/ns#' term='Mobile Software'/><category scheme='http://www.blogger.com/atom/ns#' term='Ashvin Gunga'/><title type='text'>N95 Barcode Reader</title><content type='html'>&lt;div align="justify"&gt;Nokia N95 allows creation, sharing and scanning of barcodes. Yes barcodes!!!&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;1. Create the barcode&lt;/strong&gt;&lt;br /&gt;The barcode can be created by using different kind of generators. And there are many free online generators as well. For example, &lt;a href="http://www.terryburton.co.uk/barcodewriter/generator/"&gt;here&lt;/a&gt; or &lt;a href="http://www.idautomation.com/java/dmservlet.html"&gt;here&lt;/a&gt;. I will use the &lt;a href="http://83.145.232.112/create.jsp"&gt;Nokia's Mobile Codes service&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;The barcode below is one for this blog's url http://moiashvin-tech.blogspot.com:&lt;br /&gt;&lt;br /&gt;&lt;img id="BLOGGER_PHOTO_ID_5227269474966135874" style="FLOAT: left; MARGIN: 0px 10px 10px 0px; CURSOR: hand" alt="" src="http://bp1.blogger.com/_MGI3FYgA_3c/SIr95GiZZEI/AAAAAAAABu4/psmZ63WeIJ0/s400/moiashvin-tech.gif" border="0" /&gt;&lt;br /&gt;&lt;br /&gt;These barcodes can also be used in websites, emails, or documents and at the same time protect the data from spambots.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;2. Reading the barcode&lt;br /&gt;&lt;/strong&gt;&lt;br /&gt;Now to read the barcode, there are various readers available for the S60 mobile phones. For example, &lt;a href="http://reader.kaywa.com/"&gt;Kaywa Reader&lt;/a&gt;, &lt;a href="http://www.activeprint.org/download.html"&gt;Glass Reader&lt;/a&gt;, &lt;a href="http://www.upc.fi/en/upcode/instructions/download/"&gt;UpCode Reader&lt;/a&gt; and &lt;a href="http://semacode.org/software/"&gt;Semacode Reader&lt;/a&gt;, just to name a few.&lt;br /&gt;&lt;br /&gt;Here, I will use the &lt;a href="http://europe.nokia.com/A4149142"&gt;Nokia Barcode Reader&lt;/a&gt; that comes with the mobile phone by default.&lt;br /&gt;&lt;br /&gt;&lt;img id="BLOGGER_PHOTO_ID_5227274708096742642" style="FLOAT: left; MARGIN: 0px 10px 10px 0px; CURSOR: hand" alt="" src="http://bp0.blogger.com/_MGI3FYgA_3c/SIsCptd9dPI/AAAAAAAABvQ/trJOaOFMcrU/s400/Screenshot0045.jpg" border="0" /&gt;&lt;br /&gt;&lt;img id="BLOGGER_PHOTO_ID_5227274590696788434" style="FLOAT: left; MARGIN: 0px 10px 10px 0px; CURSOR: hand" alt="" src="http://bp0.blogger.com/_MGI3FYgA_3c/SIsCi4HoUdI/AAAAAAAABvI/hoWK6NHlt-U/s400/Screenshot0046.jpg" border="0" /&gt;&lt;br /&gt;&lt;img id="BLOGGER_PHOTO_ID_5227274795114727650" style="FLOAT: left; MARGIN: 0px 10px 10px 0px; CURSOR: hand" alt="" src="http://bp2.blogger.com/_MGI3FYgA_3c/SIsCuxoqiOI/AAAAAAAABvY/1VYURAisbKw/s400/Screenshot0047.jpg" border="0" /&gt;&lt;br /&gt;&lt;br /&gt;&lt;img id="BLOGGER_PHOTO_ID_5227275005248164866" style="FLOAT: left; MARGIN: 0px 10px 10px 0px; CURSOR: hand" alt="" src="http://bp1.blogger.com/_MGI3FYgA_3c/SIsC7AcYVAI/AAAAAAAABvg/o2nCXy4L5_Q/s400/Screenshot0048.jpg" border="0" /&gt; &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Updated on 30/Jul/08:&lt;/strong&gt;&lt;br /&gt;Why is this needed? A comment posted from one of the nokia forums:&lt;br /&gt;&lt;br /&gt;&lt;em&gt;Actually this is a massive usage in Japan that is spreading across the globe. In Japan you find adverts, posters, magazines etc with them and more commonly, every businessman has one on his business card so the recipient can scan it straight into the phone!&lt;br /&gt;&lt;br /&gt;For a real practical situation, imagine this:&lt;br /&gt;You see poster for a gig you are interested in. The poster has a QR code (2D barcode), you scan it and the resulting link takes the phone browser straight to a secure site where you buy tickets!&lt;br /&gt;&lt;br /&gt;It really does have a lot of potential. It is also useful if you want to view a web page on your phone to save typing in a long address. I have a firefox plugin which generates the barcode for the page you are on when you hover over a status bar icon. You can then scan that straight off the screen for future use on your phone!&lt;br /&gt;&lt;br /&gt;Source: http://www.allaboutsymbian.com/&lt;/em&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2149165178736128353-3322785952314459338?l=moiashvin-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://moiashvin-tech.blogspot.com/feeds/3322785952314459338/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2149165178736128353&amp;postID=3322785952314459338' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/3322785952314459338'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/3322785952314459338'/><link rel='alternate' type='text/html' href='http://moiashvin-tech.blogspot.com/2008/07/n95-barcode-reader.html' title='N95 Barcode Reader'/><author><name>ashvin</name><uri>http://www.blogger.com/profile/00922391930245622789</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_MGI3FYgA_3c/Sz0gYk3D9UI/AAAAAAAACnU/k5b8SZoi0r4/S220/26122009454.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://bp1.blogger.com/_MGI3FYgA_3c/SIr95GiZZEI/AAAAAAAABu4/psmZ63WeIJ0/s72-c/moiashvin-tech.gif' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2149165178736128353.post-4003612858083565806</id><published>2008-07-26T13:51:00.001+04:00</published><updated>2008-07-26T13:52:56.284+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Programming'/><category scheme='http://www.blogger.com/atom/ns#' term='Ashvin Gunga'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><category scheme='http://www.blogger.com/atom/ns#' term='.NET 3.5'/><title type='text'>C# 3.0 Object and Collection Initializers</title><content type='html'>&lt;div align="justify"&gt;In this article, I will talk about Object and Collection Initializers in C# 3.0.&lt;br /&gt;&lt;br /&gt;Object initializers let us assign values to any accessible fields or properties of an object at the time of creation without having to explicitly invoke a constructor.&lt;br /&gt;&lt;br /&gt;When using .Net 2.0, to initialize an instance of a User, we would (1) either overload the constructors, (2) or create an instance first and assign values accordingly.&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;" align="justify"   &gt;&lt;pre style="MARGIN: 0px"&gt;&lt;span style="color:#2b91af;"&gt;User&lt;/span&gt; oldUser = &lt;span style="color:blue;"&gt;new&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;User&lt;/span&gt;();&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;" align="justify"   &gt;&lt;pre style="MARGIN: 0px"&gt;oldUser.UserId = &lt;span style="color:#a31515;"&gt;"OUSR"&lt;/span&gt;;&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;" align="justify"   &gt;&lt;pre style="MARGIN: 0px"&gt;oldUser.UserName = &lt;span style="color:#a31515;"&gt;"Old User"&lt;/span&gt;;&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;" align="justify"   &gt;&lt;pre style="MARGIN: 0px"&gt;oldUser.UserEmail = &lt;span style="color:#a31515;"&gt;"old.user@somewhere.com"&lt;/span&gt;;&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;" align="justify"   &gt;&lt;pre style="MARGIN: 0px"&gt;oldUser.UserLevel = 3;&lt;/pre&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;br /&gt;&lt;br /&gt;Now, with C# 3.0 and .NET 3.5, we will be able to initialize the object by creating the instance and assigning the values to the properties in a single statement. Using this new syntax, the code will look like:&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;" align="justify"   &gt;&lt;pre style="MARGIN: 0px"&gt;&lt;span style="color:#2b91af;"&gt;User&lt;/span&gt; test = &lt;span style="color:blue;"&gt;new&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;User&lt;/span&gt; { UserId = &lt;span style="color:#a31515;"&gt;"NUSR"&lt;/span&gt;, UserName = &lt;span style="color:#a31515;"&gt;"New User"&lt;/span&gt;,&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;" align="justify"   &gt;&lt;pre style="MARGIN: 0px"&gt; UserEmail = &lt;span style="color:#a31515;"&gt;"new.user@anywhere.com"&lt;/span&gt;, UserLevel = 3};&lt;/pre&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;br /&gt;&lt;br /&gt;Similarly, if we had to create a list of users in .NET 2.0, we would first create the list and then add the users one by one.&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;" align="justify"   &gt;&lt;pre style="MARGIN: 0px"&gt;&lt;span style="color:#2b91af;"&gt;User&lt;/span&gt; oldUser = &lt;span style="color:blue;"&gt;new&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;User&lt;/span&gt;();&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;" align="justify"   &gt;&lt;pre style="MARGIN: 0px"&gt;oldUser.UserId = &lt;span style="color:#a31515;"&gt;"OUSR"&lt;/span&gt;;&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;" align="justify"   &gt;&lt;pre style="MARGIN: 0px"&gt;oldUser.UserName = &lt;span style="color:#a31515;"&gt;"Old User"&lt;/span&gt;;&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;" align="justify"   &gt;&lt;pre style="MARGIN: 0px"&gt;oldUser.UserEmail = &lt;span style="color:#a31515;"&gt;"old.user@somewhere.com"&lt;/span&gt;;&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;" align="justify"   &gt;&lt;pre style="MARGIN: 0px"&gt;oldUser.UserLevel = 5;&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;" align="justify"   &gt;&lt;pre style="MARGIN: 0px"&gt; &lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;" align="justify"   &gt;&lt;pre style="MARGIN: 0px"&gt;&lt;span style="color:#2b91af;"&gt;User&lt;/span&gt; newIser = &lt;span style="color:blue;"&gt;new&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;User&lt;/span&gt;();&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;" align="justify"   &gt;&lt;pre style="MARGIN: 0px"&gt;newIser.UserId = &lt;span style="color:#a31515;"&gt;"NUSR"&lt;/span&gt;;&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;" align="justify"   &gt;&lt;pre style="MARGIN: 0px"&gt;newIser.UserName = &lt;span style="color:#a31515;"&gt;"New User"&lt;/span&gt;;&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;" align="justify"   &gt;&lt;pre style="MARGIN: 0px"&gt;newIser.UserEmail = &lt;span style="color:#a31515;"&gt;"new.user@anywhere.com"&lt;/span&gt;;&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;" align="justify"   &gt;&lt;pre style="MARGIN: 0px"&gt;newIser.UserLevel = 3;&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;" align="justify"   &gt;&lt;pre style="MARGIN: 0px"&gt; &lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;" align="justify"   &gt;&lt;pre style="MARGIN: 0px"&gt;&lt;span style="color:#2b91af;"&gt;List&lt;/span&gt;&amp;lt;&lt;span style="color:#2b91af;"&gt;User&lt;/span&gt;&amp;gt; users = &lt;span style="color:blue;"&gt;new&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;List&lt;/span&gt;&amp;lt;&lt;span style="color:#2b91af;"&gt;User&lt;/span&gt;&amp;gt;();&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white" align="justify" color="black" size="10pt" face="Courier New"&gt;&lt;pre style="MARGIN: 0px"&gt;users.Add(oldUser);&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white" align="justify" color="black" size="10pt" face="Courier New"&gt;&lt;pre style="MARGIN: 0px"&gt;users.Add(newIser);&lt;/pre&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;br /&gt;&lt;br /&gt;And now, with C# 3.0 and .NET 3.5, this can be achieved in just one single statement:&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white" align="justify" color="black" size="10pt" face="Courier New"&gt;&lt;pre style="MARGIN: 0px"&gt;&lt;span style="color:#2b91af;"&gt;List&lt;/span&gt;&amp;lt;&lt;span style="color:#2b91af;"&gt;User&lt;/span&gt;&amp;gt; users = &lt;span style="color:blue;"&gt;new&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;List&lt;/span&gt;&amp;lt;&lt;span style="color:#2b91af;"&gt;User&lt;/span&gt;&amp;gt; {&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white" align="justify" color="black" size="10pt" face="Courier New"&gt;&lt;pre style="MARGIN: 0px"&gt;    &lt;span style="color:blue;"&gt;new&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;User&lt;/span&gt; { UserId = &lt;span style="color:#a31515;"&gt;"OUSR"&lt;/span&gt;, UserName = &lt;span style="color:#a31515;"&gt;"Old User"&lt;/span&gt;,&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white" align="justify" color="black" size="10pt" face="Courier New"&gt;&lt;pre style="MARGIN: 0px"&gt;        UserEmail = &lt;span style="color:#a31515;"&gt;"old.user@somewhere.com"&lt;/span&gt;, UserLevel = 5},&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white" align="justify" color="black" size="10pt" face="Courier New"&gt;&lt;pre style="MARGIN: 0px"&gt;    &lt;span style="color:blue;"&gt;new&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;User&lt;/span&gt; { UserId = &lt;span style="color:#a31515;"&gt;"NUSR"&lt;/span&gt;, UserName = &lt;span style="color:#a31515;"&gt;"New User"&lt;/span&gt;,&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white" align="justify" color="black" size="10pt" face="Courier New"&gt;&lt;pre style="MARGIN: 0px"&gt;        UserEmail = &lt;span style="color:#a31515;"&gt;"new.user@anywhere.com"&lt;/span&gt;, UserLevel = 3}&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white" align="justify" color="black" size="10pt" face="Courier New"&gt;&lt;pre style="MARGIN: 0px"&gt;};&lt;/pre&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2149165178736128353-4003612858083565806?l=moiashvin-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://moiashvin-tech.blogspot.com/feeds/4003612858083565806/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2149165178736128353&amp;postID=4003612858083565806' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/4003612858083565806'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/4003612858083565806'/><link rel='alternate' type='text/html' href='http://moiashvin-tech.blogspot.com/2008/07/c-30-object-and-collection-initializers.html' title='C# 3.0 Object and Collection Initializers'/><author><name>ashvin</name><uri>http://www.blogger.com/profile/00922391930245622789</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_MGI3FYgA_3c/Sz0gYk3D9UI/AAAAAAAACnU/k5b8SZoi0r4/S220/26122009454.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2149165178736128353.post-8309385309746669821</id><published>2008-07-26T12:46:00.003+04:00</published><updated>2008-07-26T13:10:48.343+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Programming'/><category scheme='http://www.blogger.com/atom/ns#' term='Ashvin Gunga'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><category scheme='http://www.blogger.com/atom/ns#' term='.NET 3.5'/><title type='text'>C# 3.0 Automatic Properties</title><content type='html'>&lt;div align="justify"&gt;The C# 3.0 has a very interesting feature: Automatic Properties.&lt;br /&gt;&lt;br /&gt;So far, with C# 2.0 and Visual Studio 2005, we have enjoyed the 'Right-Click --&gt; Refactor --&gt; Encapsulate Field' option to automatically generate properties in the classes. And hence, as an example, a User class will look like:&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;" align="justify"   &gt;&lt;pre style="MARGIN: 0px"&gt;    &lt;span style="color:blue;"&gt;public&lt;/span&gt; &lt;span style="color:blue;"&gt;class&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;User&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;" align="justify"   &gt;&lt;pre style="MARGIN: 0px"&gt;    {&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;" align="justify"   &gt;&lt;pre style="MARGIN: 0px"&gt;        &lt;span style="color:blue;"&gt;private&lt;/span&gt; &lt;span style="color:blue;"&gt;string&lt;/span&gt; userId;&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;" align="justify"   &gt;&lt;pre style="MARGIN: 0px"&gt; &lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;" align="justify"   &gt;&lt;pre style="MARGIN: 0px"&gt;        &lt;span style="color:gray;"&gt;///&lt;/span&gt;&lt;span style="color:green;"&gt; &lt;/span&gt;&lt;span style="color:gray;"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;" align="justify"   &gt;&lt;pre style="MARGIN: 0px"&gt;        &lt;span style="color:gray;"&gt;///&lt;/span&gt;&lt;span style="color:green;"&gt; Gets or sets the user id.&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;" align="justify"   &gt;&lt;pre style="MARGIN: 0px"&gt;        &lt;span style="color:gray;"&gt;///&lt;/span&gt;&lt;span style="color:green;"&gt; &lt;/span&gt;&lt;span style="color:gray;"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;" align="justify"   &gt;&lt;pre style="MARGIN: 0px"&gt;        &lt;span style="color:gray;"&gt;///&lt;/span&gt;&lt;span style="color:green;"&gt; &lt;/span&gt;&lt;span style="color:gray;"&gt;&amp;lt;value&amp;gt;&lt;/span&gt;&lt;span style="color:green;"&gt;The user id.&lt;/span&gt;&lt;span style="color:gray;"&gt;&amp;lt;/value&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;" align="justify"   &gt;&lt;pre style="MARGIN: 0px"&gt;        &lt;span style="color:blue;"&gt;public&lt;/span&gt; &lt;span style="color:blue;"&gt;string&lt;/span&gt; UserId&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;" align="justify"   &gt;&lt;pre style="MARGIN: 0px"&gt;        {&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;" align="justify"   &gt;&lt;pre style="MARGIN: 0px"&gt;            &lt;span style="color:blue;"&gt;get&lt;/span&gt; { &lt;span style="color:blue;"&gt;return&lt;/span&gt; userId; }&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;" align="justify"   &gt;&lt;pre style="MARGIN: 0px"&gt;            &lt;span style="color:blue;"&gt;set&lt;/span&gt; { userId = &lt;span style="color:blue;"&gt;value&lt;/span&gt;; }&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;" align="justify"   &gt;&lt;pre style="MARGIN: 0px"&gt;        }&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;" align="justify"   &gt;&lt;pre style="MARGIN: 0px"&gt; &lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;" align="justify"   &gt;&lt;pre style="MARGIN: 0px"&gt;        &lt;span style="color:blue;"&gt;private&lt;/span&gt; &lt;span style="color:blue;"&gt;string&lt;/span&gt; userName;&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;" align="justify"   &gt;&lt;pre style="MARGIN: 0px"&gt; &lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;" align="justify"   &gt;&lt;pre style="MARGIN: 0px"&gt;        &lt;span style="color:gray;"&gt;///&lt;/span&gt;&lt;span style="color:green;"&gt; &lt;/span&gt;&lt;span style="color:gray;"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;" align="justify"   &gt;&lt;pre style="MARGIN: 0px"&gt;        &lt;span style="color:gray;"&gt;///&lt;/span&gt;&lt;span style="color:green;"&gt; Gets or sets the name of the user.&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;" align="justify"   &gt;&lt;pre style="MARGIN: 0px"&gt;        &lt;span style="color:gray;"&gt;///&lt;/span&gt;&lt;span style="color:green;"&gt; &lt;/span&gt;&lt;span style="color:gray;"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;" align="justify"   &gt;&lt;pre style="MARGIN: 0px"&gt;        &lt;span style="color:gray;"&gt;///&lt;/span&gt;&lt;span style="color:green;"&gt; &lt;/span&gt;&lt;span style="color:gray;"&gt;&amp;lt;value&amp;gt;&lt;/span&gt;&lt;span style="color:green;"&gt;The name of the user.&lt;/span&gt;&lt;span style="color:gray;"&gt;&amp;lt;/value&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;" align="justify"   &gt;&lt;pre style="MARGIN: 0px"&gt;        &lt;span style="color:blue;"&gt;public&lt;/span&gt; &lt;span style="color:blue;"&gt;string&lt;/span&gt; UserName&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;" align="justify"   &gt;&lt;pre style="MARGIN: 0px"&gt;        {&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;" align="justify"   &gt;&lt;pre style="MARGIN: 0px"&gt;            &lt;span style="color:blue;"&gt;get&lt;/span&gt; { &lt;span style="color:blue;"&gt;return&lt;/span&gt; userName; }&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;" align="justify"   &gt;&lt;pre style="MARGIN: 0px"&gt;            &lt;span style="color:blue;"&gt;set&lt;/span&gt; { userName = &lt;span style="color:blue;"&gt;value&lt;/span&gt;; }&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;" align="justify"   &gt;&lt;pre style="MARGIN: 0px"&gt;        }&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;" align="justify"   &gt;&lt;pre style="MARGIN: 0px"&gt; &lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;" align="justify"   &gt;&lt;pre style="MARGIN: 0px"&gt;        &lt;span style="color:blue;"&gt;private&lt;/span&gt; &lt;span style="color:blue;"&gt;string&lt;/span&gt; userEmail;&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;" align="justify"   &gt;&lt;pre style="MARGIN: 0px"&gt; &lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;" align="justify"   &gt;&lt;pre style="MARGIN: 0px"&gt;        &lt;span style="color:gray;"&gt;///&lt;/span&gt;&lt;span style="color:green;"&gt; &lt;/span&gt;&lt;span style="color:gray;"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;" align="justify"   &gt;&lt;pre style="MARGIN: 0px"&gt;        &lt;span style="color:gray;"&gt;///&lt;/span&gt;&lt;span style="color:green;"&gt; Gets or sets the user email.&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;" align="justify"   &gt;&lt;pre style="MARGIN: 0px"&gt;        &lt;span style="color:gray;"&gt;///&lt;/span&gt;&lt;span style="color:green;"&gt; &lt;/span&gt;&lt;span style="color:gray;"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;" align="justify"   &gt;&lt;pre style="MARGIN: 0px"&gt;        &lt;span style="color:gray;"&gt;///&lt;/span&gt;&lt;span style="color:green;"&gt; &lt;/span&gt;&lt;span style="color:gray;"&gt;&amp;lt;value&amp;gt;&lt;/span&gt;&lt;span style="color:green;"&gt;The user email.&lt;/span&gt;&lt;span style="color:gray;"&gt;&amp;lt;/value&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;" align="justify"   &gt;&lt;pre style="MARGIN: 0px"&gt;        &lt;span style="color:blue;"&gt;public&lt;/span&gt; &lt;span style="color:blue;"&gt;string&lt;/span&gt; UserEmail&lt;/pre&gt;&lt;/div&gt;&lt;div style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: Courier New" align="justify"&gt;&lt;pre style="MARGIN: 0px"&gt;        {&lt;/pre&gt;&lt;/div&gt;&lt;div style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: Courier New" align="justify"&gt;&lt;pre style="MARGIN: 0px"&gt;            &lt;span style="color:blue;"&gt;get&lt;/span&gt; { &lt;span style="color:blue;"&gt;return&lt;/span&gt; userEmail; }&lt;/pre&gt;&lt;/div&gt;&lt;div style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: Courier New" align="justify"&gt;&lt;pre style="MARGIN: 0px"&gt;            &lt;span style="color:blue;"&gt;set&lt;/span&gt; { userEmail = &lt;span style="color:blue;"&gt;value&lt;/span&gt;; }&lt;/pre&gt;&lt;/div&gt;&lt;div style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: Courier New" align="justify"&gt;&lt;pre style="MARGIN: 0px"&gt;        }&lt;/pre&gt;&lt;/div&gt;&lt;div style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: Courier New" align="justify"&gt;&lt;pre style="MARGIN: 0px"&gt; &lt;/pre&gt;&lt;/div&gt;&lt;div style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: Courier New" align="justify"&gt;&lt;pre style="MARGIN: 0px"&gt;        &lt;span style="color:blue;"&gt;private&lt;/span&gt; &lt;span style="color:blue;"&gt;int&lt;/span&gt; userLevel;&lt;/pre&gt;&lt;/div&gt;&lt;div style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: Courier New" align="justify"&gt;&lt;pre style="MARGIN: 0px"&gt; &lt;/pre&gt;&lt;/div&gt;&lt;div style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: Courier New" align="justify"&gt;&lt;pre style="MARGIN: 0px"&gt;        &lt;span style="color:gray;"&gt;///&lt;/span&gt;&lt;span style="color:green;"&gt; &lt;/span&gt;&lt;span style="color:gray;"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: Courier New" align="justify"&gt;&lt;pre style="MARGIN: 0px"&gt;        &lt;span style="color:gray;"&gt;///&lt;/span&gt;&lt;span style="color:green;"&gt; Gets or sets the user level.&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: Courier New" align="justify"&gt;&lt;pre style="MARGIN: 0px"&gt;        &lt;span style="color:gray;"&gt;///&lt;/span&gt;&lt;span style="color:green;"&gt; &lt;/span&gt;&lt;span style="color:gray;"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: Courier New" align="justify"&gt;&lt;pre style="MARGIN: 0px"&gt;        &lt;span style="color:gray;"&gt;///&lt;/span&gt;&lt;span style="color:green;"&gt; &lt;/span&gt;&lt;span style="color:gray;"&gt;&amp;lt;value&amp;gt;&lt;/span&gt;&lt;span style="color:green;"&gt;The user level.&lt;/span&gt;&lt;span style="color:gray;"&gt;&amp;lt;/value&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: Courier New" align="justify"&gt;&lt;pre style="MARGIN: 0px"&gt;        &lt;span style="color:blue;"&gt;public&lt;/span&gt; &lt;span style="color:blue;"&gt;int&lt;/span&gt; UserLevel&lt;/pre&gt;&lt;/div&gt;&lt;div style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: Courier New" align="justify"&gt;&lt;pre style="MARGIN: 0px"&gt;        {&lt;/pre&gt;&lt;/div&gt;&lt;div style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: Courier New" align="justify"&gt;&lt;pre style="MARGIN: 0px"&gt;            &lt;span style="color:blue;"&gt;get&lt;/span&gt; { &lt;span style="color:blue;"&gt;return&lt;/span&gt; userLevel; }&lt;/pre&gt;&lt;/div&gt;&lt;div style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: Courier New" align="justify"&gt;&lt;pre style="MARGIN: 0px"&gt;            &lt;span style="color:blue;"&gt;set&lt;/span&gt; { userLevel = &lt;span style="color:blue;"&gt;value&lt;/span&gt;; }&lt;/pre&gt;&lt;/div&gt;&lt;div style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: Courier New" align="justify"&gt;&lt;pre style="MARGIN: 0px"&gt;        }&lt;/pre&gt;&lt;/div&gt;&lt;div style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: Courier New" align="justify"&gt;&lt;pre style="MARGIN: 0px"&gt;    }&lt;/pre&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;br /&gt;&lt;br /&gt;Now, with C# 3.0, the User class will look as follows:&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;" align="justify"   &gt;&lt;pre style="MARGIN: 0px"&gt;    &lt;span style="color:blue;"&gt;public&lt;/span&gt; &lt;span style="color:blue;"&gt;class&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;User&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;" align="justify"   &gt;&lt;pre style="MARGIN: 0px"&gt;    {&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;" align="justify"   &gt;&lt;pre style="MARGIN: 0px"&gt;        &lt;span style="color:gray;"&gt;///&lt;/span&gt;&lt;span style="color:green;"&gt; &lt;/span&gt;&lt;span style="color:gray;"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;" align="justify"   &gt;&lt;pre style="MARGIN: 0px"&gt;        &lt;span style="color:gray;"&gt;///&lt;/span&gt;&lt;span style="color:green;"&gt; Gets or sets the user id.&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;" align="justify"   &gt;&lt;pre style="MARGIN: 0px"&gt;        &lt;span style="color:gray;"&gt;///&lt;/span&gt;&lt;span style="color:green;"&gt; &lt;/span&gt;&lt;span style="color:gray;"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;" align="justify"   &gt;&lt;pre style="MARGIN: 0px"&gt;        &lt;span style="color:blue;"&gt;public&lt;/span&gt; &lt;span style="color:blue;"&gt;string&lt;/span&gt; UserId { &lt;span style="color:blue;"&gt;get&lt;/span&gt;; &lt;span style="color:blue;"&gt;set&lt;/span&gt;; }&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;" align="justify"   &gt;&lt;pre style="MARGIN: 0px"&gt; &lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white" align="justify" face="Courier New" size="10pt" color="black"&gt;&lt;pre style="MARGIN: 0px"&gt;        &lt;span style="color:gray;"&gt;///&lt;/span&gt;&lt;span style="color:green;"&gt; &lt;/span&gt;&lt;span style="color:gray;"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white" align="justify" face="Courier New" size="10pt" color="black"&gt;&lt;pre style="MARGIN: 0px"&gt;        &lt;span style="color:gray;"&gt;///&lt;/span&gt;&lt;span style="color:green;"&gt; Gets or sets the user name.&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white" align="justify" face="Courier New" size="10pt" color="black"&gt;&lt;pre style="MARGIN: 0px"&gt;        &lt;span style="color:gray;"&gt;///&lt;/span&gt;&lt;span style="color:green;"&gt; &lt;/span&gt;&lt;span style="color:gray;"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white" align="justify" face="Courier New" size="10pt" color="black"&gt;&lt;pre style="MARGIN: 0px"&gt;        &lt;span style="color:blue;"&gt;public&lt;/span&gt; &lt;span style="color:blue;"&gt;string&lt;/span&gt; UserName { &lt;span style="color:blue;"&gt;get&lt;/span&gt;; &lt;span style="color:blue;"&gt;set&lt;/span&gt;; }&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white" align="justify" face="Courier New" size="10pt" color="black"&gt;&lt;pre style="MARGIN: 0px"&gt; &lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white" align="justify" face="Courier New" size="10pt" color="black"&gt;&lt;pre style="MARGIN: 0px"&gt;        &lt;span style="color:gray;"&gt;///&lt;/span&gt;&lt;span style="color:green;"&gt; &lt;/span&gt;&lt;span style="color:gray;"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white" align="justify" face="Courier New" size="10pt" color="black"&gt;&lt;pre style="MARGIN: 0px"&gt;        &lt;span style="color:gray;"&gt;///&lt;/span&gt;&lt;span style="color:green;"&gt; Gets or sets the user email.&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white" align="justify" face="Courier New" size="10pt" color="black"&gt;&lt;pre style="MARGIN: 0px"&gt;        &lt;span style="color:gray;"&gt;///&lt;/span&gt;&lt;span style="color:green;"&gt; &lt;/span&gt;&lt;span style="color:gray;"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white" align="justify" face="Courier New" size="10pt" color="black"&gt;&lt;pre style="MARGIN: 0px"&gt;        &lt;span style="color:blue;"&gt;public&lt;/span&gt; &lt;span style="color:blue;"&gt;string&lt;/span&gt; UserEmail { &lt;span style="color:blue;"&gt;get&lt;/span&gt;; &lt;span style="color:blue;"&gt;set&lt;/span&gt;; }&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white" align="justify" face="Courier New" size="10pt" color="black"&gt;&lt;pre style="MARGIN: 0px"&gt; &lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white" align="justify" face="Courier New" size="10pt" color="black"&gt;&lt;pre style="MARGIN: 0px"&gt;        &lt;span style="color:gray;"&gt;///&lt;/span&gt;&lt;span style="color:green;"&gt; &lt;/span&gt;&lt;span style="color:gray;"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white" align="justify" face="Courier New" size="10pt" color="black"&gt;&lt;pre style="MARGIN: 0px"&gt;        &lt;span style="color:gray;"&gt;///&lt;/span&gt;&lt;span style="color:green;"&gt; Gets or sets the user level.&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white" align="justify" face="Courier New" size="10pt" color="black"&gt;&lt;pre style="MARGIN: 0px"&gt;        &lt;span style="color:gray;"&gt;///&lt;/span&gt;&lt;span style="color:green;"&gt; &lt;/span&gt;&lt;span style="color:gray;"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white" align="justify" face="Courier New" size="10pt" color="black"&gt;&lt;pre style="MARGIN: 0px"&gt;        &lt;span style="color:blue;"&gt;public&lt;/span&gt; &lt;span style="color:blue;"&gt;int&lt;/span&gt; UserLevel { &lt;span style="color:blue;"&gt;get&lt;/span&gt;; &lt;span style="color:blue;"&gt;set&lt;/span&gt;; }&lt;/pre&gt;&lt;/div&gt;&lt;div style="BACKGROUND: white" align="justify" face="Courier New" size="10pt" color="black"&gt;&lt;pre style="MARGIN: 0px"&gt;    }&lt;/pre&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;br /&gt;&lt;br /&gt;When the code is compiled, the compiler will automatically generate the appropriate fields when encountering the empty get and/or set blocks. However, note that these automatic properties are normally used in situations where no body is in the get or set blocks. &lt;br /&gt;&lt;br /&gt;And, going one step further, the compiler generated code for these automatic properties is as follows:&lt;br /&gt;&lt;br /&gt;&lt;img id="BLOGGER_PHOTO_ID_5227246694077244242" style="FLOAT: left; MARGIN: 0px 10px 10px 0px; CURSOR: hand" alt="" src="http://bp3.blogger.com/_MGI3FYgA_3c/SIrpLFHPI1I/AAAAAAAABuw/Q0PLfSGdBzM/s400/User_3.5_a.gif" border="0" /&gt;&lt;img id="BLOGGER_PHOTO_ID_5227246567546998866" style="FLOAT: left; MARGIN: 0px 10px 10px 0px; CURSOR: hand" alt="" src="http://bp2.blogger.com/_MGI3FYgA_3c/SIrpDtwE0FI/AAAAAAAABuo/Cl3SxfmCuDw/s400/User_3.5_b.gif" border="0" /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2149165178736128353-8309385309746669821?l=moiashvin-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://moiashvin-tech.blogspot.com/feeds/8309385309746669821/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2149165178736128353&amp;postID=8309385309746669821' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/8309385309746669821'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/8309385309746669821'/><link rel='alternate' type='text/html' href='http://moiashvin-tech.blogspot.com/2008/07/c-30-automatic-properties.html' title='C# 3.0 Automatic Properties'/><author><name>ashvin</name><uri>http://www.blogger.com/profile/00922391930245622789</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_MGI3FYgA_3c/Sz0gYk3D9UI/AAAAAAAACnU/k5b8SZoi0r4/S220/26122009454.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://bp3.blogger.com/_MGI3FYgA_3c/SIrpLFHPI1I/AAAAAAAABuw/Q0PLfSGdBzM/s72-c/User_3.5_a.gif' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2149165178736128353.post-9018622336584598503</id><published>2008-07-26T11:58:00.002+04:00</published><updated>2008-07-26T12:03:58.783+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Programming'/><category scheme='http://www.blogger.com/atom/ns#' term='Ashvin Gunga'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><category scheme='http://www.blogger.com/atom/ns#' term='.NET 3.5'/><category scheme='http://www.blogger.com/atom/ns#' term='LINQ'/><title type='text'>LINQ - Restriction Operator 'where'</title><content type='html'>The .NET Framework 3.5 version extends the .NET Framework 2.0 and 3.0 versions. One of the new features is the Language-Integrated Query (LINQ) and this extends powerful query capabilities to the C# language syntax (and VB as well) in the form of standard easily-learned query patterns.&lt;br /&gt;&lt;br /&gt;A very simple program that displays the odd digits in LINQ:&lt;br /&gt;&lt;br /&gt;&lt;div style="BACKGROUND: white;font-family:Courier New;font-size:10pt;color:black;"   &gt;&lt;br /&gt;&lt;pre style="MARGIN: 0px"&gt;&lt;span style="color:blue;"&gt;using&lt;/span&gt; System;&lt;/pre&gt;&lt;pre style="MARGIN: 0px"&gt;&lt;span style="color:blue;"&gt;using&lt;/span&gt; System.Collections.Generic;&lt;/pre&gt;&lt;pre style="MARGIN: 0px"&gt;&lt;span style="color:blue;"&gt;using&lt;/span&gt; System.Linq;&lt;/pre&gt;&lt;pre style="MARGIN: 0px"&gt;&lt;span style="color:blue;"&gt;using&lt;/span&gt; System.Text;&lt;/pre&gt;&lt;pre style="MARGIN: 0px"&gt;&lt;span style="color:blue;"&gt;&lt;/span&gt; &lt;/pre&gt;&lt;pre style="MARGIN: 0px"&gt;&lt;span style="color:blue;"&gt;namespace&lt;/span&gt; TestLinQ&lt;/pre&gt;&lt;pre style="MARGIN: 0px"&gt;{&lt;/pre&gt;&lt;pre style="MARGIN: 0px"&gt;    &lt;span style="color:blue;"&gt;class&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;Program&lt;/span&gt;&lt;/pre&gt;&lt;pre style="MARGIN: 0px"&gt;    {&lt;/pre&gt;&lt;pre style="MARGIN: 0px"&gt;        &lt;span style="color:blue;"&gt;static&lt;/span&gt; &lt;span style="color:blue;"&gt;void&lt;/span&gt; Main(&lt;span style="color:blue;"&gt;string&lt;/span&gt;[] args)&lt;/pre&gt;&lt;pre style="MARGIN: 0px"&gt;        {&lt;/pre&gt;&lt;pre style="MARGIN: 0px"&gt;           &lt;span style="color:green;"&gt;// declare an array of integers&lt;/span&gt;&lt;/pre&gt;&lt;pre style="MARGIN: 0px"&gt;           &lt;span style="color:blue;"&gt;int&lt;/span&gt;[] digits = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };&lt;/pre&gt;&lt;pre style="MARGIN: 0px"&gt; &lt;/pre&gt;&lt;pre style="MARGIN: 0px"&gt;           &lt;span style="color:green;"&gt;// find all odd digits&lt;/span&gt;&lt;/pre&gt;&lt;pre style="MARGIN: 0px"&gt;           var oddDigits = from n &lt;span style="color:blue;"&gt;in&lt;/span&gt; digits where n % 2 == 1 select n;&lt;/pre&gt;&lt;br /&gt;&lt;pre style="MARGIN: 0px"&gt;           &lt;span style="color:green;"&gt;// display all odd digits&lt;/span&gt;&lt;/pre&gt;&lt;pre style="MARGIN: 0px"&gt;           &lt;span style="color:blue;"&gt;foreach&lt;/span&gt;(var x &lt;span style="color:blue;"&gt;in&lt;/span&gt; oddDigits)&lt;/pre&gt;&lt;pre style="MARGIN: 0px"&gt;           {&lt;/pre&gt;&lt;pre style="MARGIN: 0px"&gt;              &lt;span style="color:#2b91af;"&gt;Console&lt;/span&gt;.WriteLine(x);&lt;/pre&gt;&lt;pre style="MARGIN: 0px"&gt;           }&lt;/pre&gt;&lt;pre style="MARGIN: 0px"&gt;        }&lt;/pre&gt;&lt;pre style="MARGIN: 0px"&gt;    }&lt;/pre&gt;&lt;pre style="MARGIN: 0px"&gt;}&lt;/pre&gt;&lt;pre style="MARGIN: 0px"&gt; &lt;/pre&gt;&lt;/div&gt;This is indeed my first LINQ experience ;-), more precisely with the restriction operation 'where' ...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2149165178736128353-9018622336584598503?l=moiashvin-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://moiashvin-tech.blogspot.com/feeds/9018622336584598503/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2149165178736128353&amp;postID=9018622336584598503' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/9018622336584598503'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/9018622336584598503'/><link rel='alternate' type='text/html' href='http://moiashvin-tech.blogspot.com/2008/07/linq-restriction-operator-where.html' title='LINQ - Restriction Operator &apos;where&apos;'/><author><name>ashvin</name><uri>http://www.blogger.com/profile/00922391930245622789</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_MGI3FYgA_3c/Sz0gYk3D9UI/AAAAAAAACnU/k5b8SZoi0r4/S220/26122009454.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2149165178736128353.post-4698787521434578994</id><published>2008-07-16T21:09:00.002+04:00</published><updated>2008-07-17T19:52:39.352+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='.Net 1.1'/><category scheme='http://www.blogger.com/atom/ns#' term='Ashvin Gunga'/><category scheme='http://www.blogger.com/atom/ns#' term='Visual Studio'/><title type='text'>Projects targeting .NET Compact Framework 1.0 require version 1.1 of the .NET Framework, which is not detected on this machine.</title><content type='html'>&lt;div align="justify"&gt;I tried to compile a C# solution, containing one Smartphone 2003 .NET Compact Framework 1.1 project, in Visual Studio 2005 and got the following error:&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;em&gt;Projects targeting .NET Compact Framework 1.0 require version 1.1 of the .NET Framework, which is not detected on this machine.&lt;br /&gt;&lt;/em&gt;&lt;/strong&gt;&lt;br /&gt;This has been explained on the MSDN page &lt;a href="http://msdn.microsoft.com/en-us/library/ms184406(VS.80).aspx"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Apparently, the .NET Framework 1.1 was not installed on my machine. This framework can be downloaded &lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=262D25E3-F589-4842-8157-034D1E7CF3A3&amp;displaylang=en"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;One thing worth noting is that having the .NET Framework 2.0 is not sufficient to build the .NET Framework 1.1 projects. We need to get it installed on the machine first!&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2149165178736128353-4698787521434578994?l=moiashvin-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://moiashvin-tech.blogspot.com/feeds/4698787521434578994/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2149165178736128353&amp;postID=4698787521434578994' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/4698787521434578994'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/4698787521434578994'/><link rel='alternate' type='text/html' href='http://moiashvin-tech.blogspot.com/2008/07/projects-targeting-net-compact.html' title='Projects targeting .NET Compact Framework 1.0 require version 1.1 of the .NET Framework, which is not detected on this machine.'/><author><name>ashvin</name><uri>http://www.blogger.com/profile/00922391930245622789</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_MGI3FYgA_3c/Sz0gYk3D9UI/AAAAAAAACnU/k5b8SZoi0r4/S220/26122009454.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2149165178736128353.post-3819742600014274580</id><published>2008-07-12T23:44:00.005+04:00</published><updated>2008-07-12T23:56:38.844+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Ashvin Gunga'/><category scheme='http://www.blogger.com/atom/ns#' term='Windows XP'/><title type='text'>Determine if a computer is 32-bit or 64-bit Microsoft Windows XP</title><content type='html'>&lt;div align="justify"&gt;There are different ways to determine a computer is running a 32-bit or 64-bit Microsoft Windows operating system. In this post, I will talk only for the Windows XP Professional operating system.&lt;br /&gt;&lt;br /&gt;Right-click My Computer --&gt; Select Properties --&gt; In General tab,&lt;br /&gt;&lt;br /&gt;for a 32-bit version, the operating system will appear as "Microsoft Windows XP Professional Version &lt;year&gt;" (e.g. 2002) under the System section and,&lt;br /&gt;&lt;br /&gt;for a 64-bit version, the operating system will appear as "Microsoft Windows XP Professional x64 Edition Version &lt;year&gt;".&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;img id="BLOGGER_PHOTO_ID_5222218572137451730" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://bp1.blogger.com/_MGI3FYgA_3c/SHkMH3OzUNI/AAAAAAAABuY/_O6zni6W3UY/s400/32-bit+operating+system.gif" border="0" /&gt;&lt;br /&gt;More information &lt;a href="http://support.microsoft.com/kb/827218"&gt;here&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2149165178736128353-3819742600014274580?l=moiashvin-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://moiashvin-tech.blogspot.com/feeds/3819742600014274580/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2149165178736128353&amp;postID=3819742600014274580' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/3819742600014274580'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/3819742600014274580'/><link rel='alternate' type='text/html' href='http://moiashvin-tech.blogspot.com/2008/07/determine-if-computer-is-32-bit-or-64.html' title='Determine if a computer is 32-bit or 64-bit Microsoft Windows XP'/><author><name>ashvin</name><uri>http://www.blogger.com/profile/00922391930245622789</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_MGI3FYgA_3c/Sz0gYk3D9UI/AAAAAAAACnU/k5b8SZoi0r4/S220/26122009454.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://bp1.blogger.com/_MGI3FYgA_3c/SHkMH3OzUNI/AAAAAAAABuY/_O6zni6W3UY/s72-c/32-bit+operating+system.gif' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2149165178736128353.post-1975868175786109851</id><published>2008-07-12T21:18:00.005+04:00</published><updated>2008-07-12T21:28:04.015+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Audio'/><category scheme='http://www.blogger.com/atom/ns#' term='Ashvin Gunga'/><category scheme='http://www.blogger.com/atom/ns#' term='Troubleshooting'/><category scheme='http://www.blogger.com/atom/ns#' term='Windows XP'/><title type='text'>Troubleshooting the Realtek HD Audio Sound Manager</title><content type='html'>&lt;div align="justify"&gt;Following a full format of my machine, I have re-installed the Realtek HD Audio Sound Manager. The rear speakers and front panel mic jack wasn't working for some reasons and it seems there was no easy way to fix this problem - no obvious configuration in the Sound Manager panels, the devices were working properly on the Device Manager, the installation of latest drivers doesn't change anything... and many other users having the same problem on the internet technical forums.&lt;br /&gt;&lt;br /&gt;However, I have solved this issue months back when first installing the drivers, and I have solved it once again for a second time. So, if you having the same problem, try the following:&lt;br /&gt;&lt;br /&gt;1. Open the &lt;strong&gt;Realtek HD Audio Sound Manager &lt;/strong&gt;and click the Connector Settings option;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;img id="BLOGGER_PHOTO_ID_5222178718863504722" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://bp0.blogger.com/_MGI3FYgA_3c/SHjn4GN2tVI/AAAAAAAABuI/BhjdRSuecV0/s400/realtek1.gif" border="0" /&gt;&lt;br /&gt;2. Check (or select) the &lt;strong&gt;Disable front panel jack detection&lt;/strong&gt;.&lt;br /&gt;&lt;br /&gt;&lt;img id="BLOGGER_PHOTO_ID_5222178943700399362" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://bp3.blogger.com/_MGI3FYgA_3c/SHjoFLzJdQI/AAAAAAAABuQ/lsFBhypkPW0/s400/readltek2.gif" border="0" /&gt;&lt;br /&gt;&lt;br /&gt;And, it works!!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2149165178736128353-1975868175786109851?l=moiashvin-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://moiashvin-tech.blogspot.com/feeds/1975868175786109851/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2149165178736128353&amp;postID=1975868175786109851' title='7 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/1975868175786109851'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/1975868175786109851'/><link rel='alternate' type='text/html' href='http://moiashvin-tech.blogspot.com/2008/07/troubleshooting-realtek-hd-audio-sound.html' title='Troubleshooting the Realtek HD Audio Sound Manager'/><author><name>ashvin</name><uri>http://www.blogger.com/profile/00922391930245622789</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_MGI3FYgA_3c/Sz0gYk3D9UI/AAAAAAAACnU/k5b8SZoi0r4/S220/26122009454.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://bp0.blogger.com/_MGI3FYgA_3c/SHjn4GN2tVI/AAAAAAAABuI/BhjdRSuecV0/s72-c/realtek1.gif' height='72' width='72'/><thr:total>7</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2149165178736128353.post-1276194956525355270</id><published>2008-07-06T15:12:00.005+04:00</published><updated>2008-07-06T15:29:43.212+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Programming'/><category scheme='http://www.blogger.com/atom/ns#' term='Ashvin Gunga'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><category scheme='http://www.blogger.com/atom/ns#' term='.NET 2.0'/><category scheme='http://www.blogger.com/atom/ns#' term='Mail'/><title type='text'>Embed image in HTML message in .NET Framework</title><content type='html'>&lt;div align="justify"&gt;Adding an image to an email message in .NET Framework is quite simple by using the attachment features. However doing so, the receiver of the email will have to explicitly open the image (or download it first) when opening the message.&lt;br /&gt;&lt;br /&gt;An alternative way would be to use an HTML-formatted message and embed the image in the message. In this way, as the receiver opens the message, the image will appear automatically.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;em&gt;How is it achieved in .NET Framework?&lt;/em&gt;&lt;/strong&gt; Very simple.&lt;br /&gt;&lt;br /&gt;1. Create an email message, setting the from address, to address and subject text accordingly.&lt;br /&gt;2. Create an html body, and use the &lt;em&gt;img &lt;/em&gt;tag to embed the image. Set the content id (cid) in the src attribute correctly.&lt;br /&gt;3. Create an alternative view for the html message.&lt;br /&gt;4. Create linked resource object for the image to be embedded. Set the content id.&lt;br /&gt;5. Add the newly created linked resource object to the html alternative view.&lt;br /&gt;6. Add the alternative view to the email message.&lt;br /&gt;7. Set the IsBodyHtml property to true.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://bp0.blogger.com/_MGI3FYgA_3c/SHCsURttWTI/AAAAAAAABuA/5MJWqI6w7KE/s1600-h/17.jpg"&gt;&lt;img id="BLOGGER_PHOTO_ID_5219861432474884402" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://bp0.blogger.com/_MGI3FYgA_3c/SHCsURttWTI/AAAAAAAABuA/5MJWqI6w7KE/s400/17.jpg" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;8. Send the email message using SmtpClient (not in this post).&lt;br /&gt;&lt;br /&gt;&lt;img id="BLOGGER_PHOTO_ID_5219859855925299938" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://bp3.blogger.com/_MGI3FYgA_3c/SHCq4gm_yuI/AAAAAAAABt4/IqHOqaRGsvI/s400/18.jpg" border="0" /&gt; &lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2149165178736128353-1276194956525355270?l=moiashvin-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://moiashvin-tech.blogspot.com/feeds/1276194956525355270/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2149165178736128353&amp;postID=1276194956525355270' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/1276194956525355270'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/1276194956525355270'/><link rel='alternate' type='text/html' href='http://moiashvin-tech.blogspot.com/2008/07/embed-image-in-html-message-in-net.html' title='Embed image in HTML message in .NET Framework'/><author><name>ashvin</name><uri>http://www.blogger.com/profile/00922391930245622789</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_MGI3FYgA_3c/Sz0gYk3D9UI/AAAAAAAACnU/k5b8SZoi0r4/S220/26122009454.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://bp0.blogger.com/_MGI3FYgA_3c/SHCsURttWTI/AAAAAAAABuA/5MJWqI6w7KE/s72-c/17.jpg' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2149165178736128353.post-754290187258225609</id><published>2008-07-05T21:18:00.008+04:00</published><updated>2008-07-05T21:41:28.828+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Programming'/><category scheme='http://www.blogger.com/atom/ns#' term='Globalization'/><category scheme='http://www.blogger.com/atom/ns#' term='Ashvin Gunga'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><category scheme='http://www.blogger.com/atom/ns#' term='.NET 2.0'/><title type='text'>HelloWorld example illustrating Globalization feature in .NET Framework</title><content type='html'>&lt;div align="justify"&gt;In this simple example, I will illustrate globalization feature of .NET Framework via the ResourceManager and the CultureInfo classes.&lt;br /&gt;&lt;br /&gt;&lt;em&gt;Step 1:&lt;/em&gt; Create a console application. Under the Properties folder, there exists one resource file, namely Resources.resx.&lt;br /&gt;&lt;br /&gt;Open the file and add a new entry:&lt;br /&gt;&lt;br /&gt;HelloTest &gt; Hello World. Welcome to my blog.&lt;br /&gt;&lt;br /&gt;&lt;em&gt;Step 2:&lt;/em&gt; Now, right click the Properties folder and add a new resource file using the Add -&gt; Add New Item. Name it as Resources.it.resx.&lt;br /&gt;&lt;br /&gt;Open the newly created resource file and add a new entry:&lt;br /&gt;&lt;br /&gt;HelloTest &gt; Ciao mondo. Benvenuto al mio blog.&lt;br /&gt;&lt;br /&gt;&lt;em&gt;Step 3:&lt;/em&gt; Repeat Step 2, by adding a new resource file. Name it Resources.fr.resx and add a new entry:&lt;br /&gt;&lt;br /&gt;HelloTest &gt; Bonjour monde. Bienvenue à mon blog.&lt;br /&gt;&lt;br /&gt;So far,&lt;br /&gt;&lt;img id="BLOGGER_PHOTO_ID_5219583926921678994" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://bp3.blogger.com/_MGI3FYgA_3c/SG-v7U-BUJI/AAAAAAAABtY/ccUL82KuXEk/s400/14.JPG" border="0" /&gt;&lt;br /&gt;&lt;strong&gt;Step 4:&lt;/strong&gt; Instantiate the ResourceManager class. Use the GetString() method to get the correct text to be displayed based on the desired culture.&lt;br /&gt;&lt;br /&gt;The ResourceManager picks up the correct text for the culture.&lt;br /&gt;&lt;img id="BLOGGER_PHOTO_ID_5219584739899642658" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://bp3.blogger.com/_MGI3FYgA_3c/SG-wqpjEkyI/AAAAAAAABtg/pBLE99e0jSc/s400/15.jpg" border="0" /&gt;&lt;br /&gt;Output:&lt;br /&gt;&lt;img id="BLOGGER_PHOTO_ID_5219585121201152642" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://bp3.blogger.com/_MGI3FYgA_3c/SG-xA2Ab4oI/AAAAAAAABto/VcICbbBQBsg/s400/16.jpg" border="0" /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2149165178736128353-754290187258225609?l=moiashvin-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://moiashvin-tech.blogspot.com/feeds/754290187258225609/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2149165178736128353&amp;postID=754290187258225609' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/754290187258225609'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/754290187258225609'/><link rel='alternate' type='text/html' href='http://moiashvin-tech.blogspot.com/2008/07/helloworld-example-illustrating.html' title='HelloWorld example illustrating Globalization feature in .NET Framework'/><author><name>ashvin</name><uri>http://www.blogger.com/profile/00922391930245622789</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_MGI3FYgA_3c/Sz0gYk3D9UI/AAAAAAAACnU/k5b8SZoi0r4/S220/26122009454.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://bp3.blogger.com/_MGI3FYgA_3c/SG-v7U-BUJI/AAAAAAAABtY/ccUL82KuXEk/s72-c/14.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2149165178736128353.post-792680338703197820</id><published>2008-07-05T20:22:00.010+04:00</published><updated>2008-07-05T20:31:06.812+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Programming'/><category scheme='http://www.blogger.com/atom/ns#' term='Globalization'/><category scheme='http://www.blogger.com/atom/ns#' term='Ashvin Gunga'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><category scheme='http://www.blogger.com/atom/ns#' term='.NET 2.0'/><title type='text'>Registration and Persistance of Custom Culture in .NET Framework</title><content type='html'>&lt;div align="justify"&gt;Writing the previous post about Creating a Custom Culture in .NET Framework, one question came in my mind: where the information about this new custom culture is stored on the computer? what the register method does with the CultureAndRegionInfoBuilder instance? And after some research work, I have got the needed details.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Registration of Custom Culture&lt;/strong&gt;&lt;br /&gt;The registration process, when calling the Register() method, does the following:&lt;br /&gt;&lt;br /&gt;1. An .nlp file is created. This file contains all information defined in the CultureAndRegionInfoBuilder instance.&lt;br /&gt;&lt;br /&gt;2. Next, the .nlp file is stored in the %WINDIR%\Globalization system directory on the computer (i.e. C:\WINDOWS\Globalization\). Hence, the culture information will still be available when the computer is restarted at a later time. &lt;/div&gt;&lt;div align="justify"&gt; &lt;/div&gt;&lt;div align="justify"&gt; &lt;/div&gt;&lt;div align="justify"&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;img id="BLOGGER_PHOTO_ID_5219566146595188882" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://bp3.blogger.com/_MGI3FYgA_3c/SG-fwYF18JI/AAAAAAAABtI/-3cCJwLHEy4/s400/12.jpg" border="0" /&gt; &lt;/div&gt;&lt;p align="justify"&gt;Note: Since the .nlp file is stored in a system directory, to register a custom culture you must have administrative priviledges on the computer.&lt;br /&gt;&lt;br /&gt;3. The final step is the preparation of the .NET Framework to search the %WINDIR%\Globalization system directory the next time there is a request to create a new custom culture. An InvalidOperationException will be thrown if an attempt to register a culture more than once is made.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Persistance of Custom Culture&lt;/strong&gt;&lt;br /&gt;Another interesting feature about the CultureAndRegionInfoBuilder is its ability to write an XML representation of the object to a specified file. This can be achieved using the Save() method.&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#006600;"&gt;// save the new culture&lt;br /&gt;// for instantiation of the infoBuilder object, see previous post&lt;br /&gt;&lt;/span&gt;&lt;span style="color:#000099;"&gt;infoBuilder.Save("c:/en-mu.xml");&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/p&gt;&lt;img id="BLOGGER_PHOTO_ID_5219566476241196898" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://bp3.blogger.com/_MGI3FYgA_3c/SG-gDkHk12I/AAAAAAAABtQ/WzlGNPru56U/s400/13.jpg" border="0" /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2149165178736128353-792680338703197820?l=moiashvin-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://moiashvin-tech.blogspot.com/feeds/792680338703197820/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2149165178736128353&amp;postID=792680338703197820' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/792680338703197820'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/792680338703197820'/><link rel='alternate' type='text/html' href='http://moiashvin-tech.blogspot.com/2008/07/registration-and-persistance-of-custom.html' title='Registration and Persistance of Custom Culture in .NET Framework'/><author><name>ashvin</name><uri>http://www.blogger.com/profile/00922391930245622789</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_MGI3FYgA_3c/Sz0gYk3D9UI/AAAAAAAACnU/k5b8SZoi0r4/S220/26122009454.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://bp3.blogger.com/_MGI3FYgA_3c/SG-fwYF18JI/AAAAAAAABtI/-3cCJwLHEy4/s72-c/12.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2149165178736128353.post-3928787962553862410</id><published>2008-07-05T19:38:00.005+04:00</published><updated>2008-07-05T19:47:49.131+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Programming'/><category scheme='http://www.blogger.com/atom/ns#' term='Globalization'/><category scheme='http://www.blogger.com/atom/ns#' term='Ashvin Gunga'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><category scheme='http://www.blogger.com/atom/ns#' term='.NET 2.0'/><title type='text'>Creating a Custom Culture in .NET Framework</title><content type='html'>&lt;div align="justify"&gt;Another interesting topic on cultures in .NET Framework is creating a custom culture. This is very useful if the predefined cultures in .NET Framework or the underlying windows operating system do not provide the required information.&lt;br /&gt;&lt;br /&gt;The &lt;span style="color:#006600;"&gt;CultureAndRegionInfoBuilder&lt;/span&gt; class allows the creating of custom cultures from scratch or based on existing cultures.&lt;br /&gt;&lt;br /&gt;For instance, if we try to create a CultureInfo object for "&lt;strong&gt;en-MU&lt;/strong&gt;", an exception is thrown.&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#000099;"&gt;CultureInfo muCultureInfo = new CultureInfo("en-MU");&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;img id="BLOGGER_PHOTO_ID_5219555241185151698" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://bp1.blogger.com/_MGI3FYgA_3c/SG-V1mReitI/AAAAAAAABsw/kLw5ttkBCo8/s400/9.jpg" border="0" /&gt;&lt;br /&gt;&lt;br /&gt;I will now create this custom "en-MU" culture by using the existing cultures.&lt;br /&gt;&lt;br /&gt;&lt;em&gt;Step 1:&lt;/em&gt; Add a reference to &lt;span style="color:#006600;"&gt;sysglobl.dll&lt;/span&gt; in the project. This library can be found in the Microsoft .NET folder (e.g. C:\Windows\Microsoft.NET\Framework\v2.0.50727\).&lt;br /&gt;&lt;br /&gt;&lt;em&gt;Step 2:&lt;/em&gt; Add the namespaces &lt;span style="color:#006600;"&gt;System&lt;/span&gt; and &lt;span style="color:#006600;"&gt;System.Globalization&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#000099;"&gt;using System;&lt;br /&gt;using System.Globalization;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;em&gt;Step 3:&lt;/em&gt; Create an instance of the &lt;span style="color:#006600;"&gt;CultureAndRegionInfoBuilder&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#000099;"&gt;CultureAndRegionInfoBuilder infoBuilder&lt;br /&gt;= new CultureAndRegionInfoBuilder("en-MU", CultureAndRegionModifiers.None);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The &lt;span style="color:#006600;"&gt;CultureAndRegionModifiers.None&lt;/span&gt; is used since the custom culture is a specific one. More information about the CultureAndRegionModifiers enumeration &lt;a href="http://msdn.microsoft.com/en-us/library/system.globalization.cultureandregionmodifiers(VS.80).aspx"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;em&gt;Step 4:&lt;/em&gt; To keep the new custom culture simple, I will use a combination of the existing en-GB and fr-FR cultures. Hence, in this step, the culture and region details will be loaded in the new culture.&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#000099;"&gt;CultureInfo frCulture = new CultureInfo("fr-FR");&lt;br /&gt;CultureInfo gbCulture = new CultureInfo("en-GB");&lt;br /&gt;infoBuilder.LoadDataFromCultureInfo(frCulture);&lt;br /&gt;infoBuilder.LoadDataFromRegionInfo(new RegionInfo(gbCulture.LCID));&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;em&gt;Step 5:&lt;/em&gt; The new custom culture is now ready. However, additional details can be further changes to have more precise information.&lt;br /&gt;&lt;br /&gt;For example,&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#000099;"&gt;infoBuilder.CultureEnglishName = "Mauritius";&lt;br /&gt;infoBuilder.CurrencyEnglishName = "Mauritian Rupees";&lt;br /&gt;infoBuilder.TwoLetterISORegionName = "MU";&lt;br /&gt;infoBuilder.NumberFormat.CurrencySymbol = "Rs";&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;em&gt;Step 6:&lt;/em&gt; Register the new custom culture on the local computer and makes the culture available to the application(s).&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#000099;"&gt;infoBuilder.Register();&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;img id="BLOGGER_PHOTO_ID_5219555540655241234" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://bp2.blogger.com/_MGI3FYgA_3c/SG-WHB4teBI/AAAAAAAABs4/j7eJ-fmQ55E/s400/10.jpg" border="0" /&gt;&lt;br /&gt;&lt;br /&gt;Now, the culture "en-MU" can be successfully instantiated.&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#000099;"&gt;CultureInfo muCultureInfo = new CultureInfo("en-MU");&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;img id="BLOGGER_PHOTO_ID_5219555870641303378" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://bp2.blogger.com/_MGI3FYgA_3c/SG-WaPLhL1I/AAAAAAAABtA/OHKnsUvrwvI/s400/11.jpg" border="0" /&gt;&lt;br /&gt;&lt;br /&gt;Note: To unregister the custom culture, the Unregister() method can be used.&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#000099;"&gt;CultureAndRegionInfoBuilder.Unregister("en-MU");&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2149165178736128353-3928787962553862410?l=moiashvin-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://moiashvin-tech.blogspot.com/feeds/3928787962553862410/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2149165178736128353&amp;postID=3928787962553862410' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/3928787962553862410'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/3928787962553862410'/><link rel='alternate' type='text/html' href='http://moiashvin-tech.blogspot.com/2008/07/creating-custom-culture-in-net.html' title='Creating a Custom Culture in .NET Framework'/><author><name>ashvin</name><uri>http://www.blogger.com/profile/00922391930245622789</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_MGI3FYgA_3c/Sz0gYk3D9UI/AAAAAAAACnU/k5b8SZoi0r4/S220/26122009454.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://bp1.blogger.com/_MGI3FYgA_3c/SG-V1mReitI/AAAAAAAABsw/kLw5ttkBCo8/s72-c/9.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2149165178736128353.post-3560110694546287423</id><published>2008-07-05T12:36:00.016+04:00</published><updated>2008-07-05T19:48:18.108+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Programming'/><category scheme='http://www.blogger.com/atom/ns#' term='Globalization'/><category scheme='http://www.blogger.com/atom/ns#' term='Ashvin Gunga'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><category scheme='http://www.blogger.com/atom/ns#' term='.NET 2.0'/><title type='text'>Cultures in .NET Framework</title><content type='html'>&lt;div align="justify"&gt;The .NET Framework provides the CultureInfo class in System.Globalization namespace that allows manipulation and retrieval of information about the cultural context in which an application is running.&lt;br /&gt;&lt;br /&gt;First of all, it is important to elaborate on the different culture categories available. The cultures in .NET can be grouped into three categories:&lt;br /&gt;&lt;br /&gt;&lt;em&gt;1. Invariant Culture&lt;/em&gt;&lt;br /&gt;This culture category is culture-insensitive and is used as a default culture when consistency is desired.&lt;br /&gt;&lt;br /&gt;&lt;em&gt;2. Neutral Culture&lt;/em&gt;&lt;br /&gt;A neutral culture is associated with a language but has no relationship to countries or regions. For example, the English spoken in UK is different from that spoken in the US. English (en), French (fr) and Spanish (sp) are examples of neutral cultures. This culture category will be designated by the first two characters in the CultureInfo class of .NET. If only the two letters are specified, they will be the Neutral class.&lt;br /&gt;&lt;br /&gt;&lt;em&gt;3. Specific Culture&lt;/em&gt;&lt;br /&gt;This category is the most precise and is represented by a neutral culture, a hyphen, and then a specific culture abbreviation. For instance, in "fr-FR", fr is the neutral culture (French) and FR represents the specific culture (France).&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;CultureInfo in .NET Framework&lt;/strong&gt;&lt;br /&gt;The current culture information can be obtained via the CurrentCulture property of the executing thread's CurrentThread property.&lt;br /&gt;&lt;br /&gt;&lt;em&gt;CultureInfo cultureInfo = Thread.CurrentThread.CurrentCulture;&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;&lt;img id="BLOGGER_PHOTO_ID_5219450564734119938" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://bp3.blogger.com/_MGI3FYgA_3c/SG82ooGwcAI/AAAAAAAABr4/PZm2x3BWi60/s400/2.jpg" border="0" /&gt;&lt;br /&gt;&lt;img id="BLOGGER_PHOTO_ID_5219450648805108610" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://bp0.blogger.com/_MGI3FYgA_3c/SG82thS164I/AAAAAAAABsA/dJE2zQ8WLt8/s400/3.jpg" border="0" /&gt;&lt;br /&gt;&lt;br /&gt;&lt;img id="BLOGGER_PHOTO_ID_5219452174085846962" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://bp0.blogger.com/_MGI3FYgA_3c/SG84GTaG97I/AAAAAAAABsI/cg-5oBg6rCc/s400/4.jpg" border="0" /&gt;&lt;br /&gt;&lt;img id="BLOGGER_PHOTO_ID_5219452225415332770" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://bp2.blogger.com/_MGI3FYgA_3c/SG84JSoAw6I/AAAAAAAABsQ/eH7BhtlFZCs/s400/5.jpg" border="0" /&gt;&lt;br /&gt;&lt;br /&gt;&lt;img id="BLOGGER_PHOTO_ID_5219453436793894482" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://bp2.blogger.com/_MGI3FYgA_3c/SG85PzXKtlI/AAAAAAAABsY/IGlnzeJUcg8/s400/6.jpg" border="0" /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Enumerating all available cultures&lt;/strong&gt;&lt;br /&gt;To get hold of all the different cultures available, the following code can be used:&lt;br /&gt;&lt;br /&gt;&lt;em&gt;CultureInfo[] cultures = CultureInfo.GetCultures(CultureTypes.AllCultures);&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;The GetCultures() method accept the CultureTypes enum as an input parameter. &lt;br /&gt;&lt;br /&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="http://bp2.blogger.com/_MGI3FYgA_3c/SG9DpWiIPeI/AAAAAAAABsg/qmwQaz2hqoI/s400/7.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5219464870848118242" /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Windows XP Regional Options&lt;/strong&gt;&lt;br /&gt;Go to Control Panel --&gt; Regional and Language Options --&gt; Regional Options Tab&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;img id="BLOGGER_PHOTO_ID_5219447256583047810" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://bp2.blogger.com/_MGI3FYgA_3c/SG8zoESFCoI/AAAAAAAABrw/LHvfmHP-gAM/s400/1.jpg" border="0" /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;RegionInfo in .NET Framework&lt;/strong&gt;&lt;br /&gt;            CultureInfo cultureInfo = Thread.CurrentThread.CurrentCulture;&lt;br /&gt;            RegionInfo regionInfo = new RegionInfo(cultureInfo.LCID);&lt;br /&gt;&lt;br /&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="http://bp3.blogger.com/_MGI3FYgA_3c/SG9GYabpMlI/AAAAAAAABso/yYYaF8yELMw/s400/8.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5219467878371766866" /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2149165178736128353-3560110694546287423?l=moiashvin-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://moiashvin-tech.blogspot.com/feeds/3560110694546287423/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2149165178736128353&amp;postID=3560110694546287423' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/3560110694546287423'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/3560110694546287423'/><link rel='alternate' type='text/html' href='http://moiashvin-tech.blogspot.com/2008/07/cultures-in-net-framework.html' title='Cultures in .NET Framework'/><author><name>ashvin</name><uri>http://www.blogger.com/profile/00922391930245622789</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_MGI3FYgA_3c/Sz0gYk3D9UI/AAAAAAAACnU/k5b8SZoi0r4/S220/26122009454.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://bp3.blogger.com/_MGI3FYgA_3c/SG82ooGwcAI/AAAAAAAABr4/PZm2x3BWi60/s72-c/2.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2149165178736128353.post-8380157121351357723</id><published>2008-07-02T10:52:00.001+04:00</published><updated>2008-07-02T10:55:47.264+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Programming'/><category scheme='http://www.blogger.com/atom/ns#' term='Ashvin Gunga'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><category scheme='http://www.blogger.com/atom/ns#' term='.NET 2.0'/><title type='text'>C# Form Keyboard Events - KeyPreview property</title><content type='html'>&lt;div align="justify"&gt;If you encounter a situation where you want your C# form to see the key events that happen on its controls, then set the Form.KeyPreview property to true.&lt;br /&gt;&lt;br /&gt;We have been working on one of the Symbol devices, namely, WT4090 and there was the need to close the form when the user presses the ESC button. The KeyDown event is triggered correctly as long as the form is without any control, and once a control is added, the KeyDown event stopped being triggered. The solution was to set:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;&lt;strong&gt;&lt;span style="color:#ff6600;"&gt;Form.KeyPreview = true&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;strong&gt;Remarks from MSDN&lt;/strong&gt;&lt;br /&gt;&lt;em&gt;When this property is set to true, the form will receive all KeyPress, KeyDown, and KeyUp events. After the form's event handlers have completed processing the keystroke, the keystroke is then assigned to the control with focus. For example, if the KeyPreview property is set to true and the currently selected control is a TextBox, after the keystroke is handled by the event handlers of the form the TextBox control will receive the key that was pressed. To handle keyboard events only at the form level and not allow controls to receive keyboard events, set the KeyPressEventArgs.Handled property in your form's KeyPress event handler to true.&lt;br /&gt;&lt;br /&gt;You can use this property to process most keystrokes in your application and either handle the keystroke or call the appropriate control to handle the keystroke. For example, when an application uses function keys, you might want to process the keystrokes at the form level rather than writing code for each control that might receive keystroke events.&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;Source: &lt;a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.form.keypreview(VS.80).aspx"&gt;here&lt;/a&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2149165178736128353-8380157121351357723?l=moiashvin-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://moiashvin-tech.blogspot.com/feeds/8380157121351357723/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2149165178736128353&amp;postID=8380157121351357723' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/8380157121351357723'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/8380157121351357723'/><link rel='alternate' type='text/html' href='http://moiashvin-tech.blogspot.com/2008/07/c-form-keyboard-events-keypreview.html' title='C# Form Keyboard Events - KeyPreview property'/><author><name>ashvin</name><uri>http://www.blogger.com/profile/00922391930245622789</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_MGI3FYgA_3c/Sz0gYk3D9UI/AAAAAAAACnU/k5b8SZoi0r4/S220/26122009454.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2149165178736128353.post-937837505634920902</id><published>2008-06-27T13:07:00.008+04:00</published><updated>2008-06-27T13:21:21.966+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Programming'/><category scheme='http://www.blogger.com/atom/ns#' term='Event Logs'/><category scheme='http://www.blogger.com/atom/ns#' term='Event Viewer'/><category scheme='http://www.blogger.com/atom/ns#' term='Ashvin Gunga'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><category scheme='http://www.blogger.com/atom/ns#' term='.NET 2.0'/><title type='text'>Working with event logs</title><content type='html'>&lt;div align="justify"&gt;The .Net Framework provides the EventLog class in the System.Configuration namespace that allows us to create and manage log entries. In this article, I will describe how this can be achieved in just a few lines of codes.&lt;br /&gt;&lt;br /&gt;a) Creating an Event Log&lt;br /&gt;&lt;br /&gt;The EventLog class allows us to create an event log. Here are a couple of overloaded constructors available, but here, I am going to use the simplest one by providing a name for the log only. Also, to use the event log, the Source property needs to be specified and a message needs to be written as well.&lt;br /&gt;&lt;br /&gt;Next, to write an entry, I will use the WriteEntry method, by giving the message and the entry type.&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;img id="BLOGGER_PHOTO_ID_5216485499929196562" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://bp3.blogger.com/_MGI3FYgA_3c/SGSt7I9BeBI/AAAAAAAABqM/w7vQUdYVQS8/s400/createlog.gif" border="0" /&gt;&lt;br /&gt;&lt;br /&gt;If the code is executed, the new event log will be visible in the Windows Event Viewer.&lt;br /&gt;&lt;br /&gt;&lt;img id="BLOGGER_PHOTO_ID_5216485711597575490" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://bp3.blogger.com/_MGI3FYgA_3c/SGSuHdesnUI/AAAAAAAABqc/A1q_Jo4Z6lU/s400/createlog_result.gif" border="0" /&gt;&lt;br /&gt;&lt;br /&gt;&lt;img id="BLOGGER_PHOTO_ID_5216485592227930994" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://bp0.blogger.com/_MGI3FYgA_3c/SGSuAgywY3I/AAAAAAAABqU/ci9gveAVqI8/s400/createlog_result2.gif" border="0" /&gt;&lt;br /&gt;&lt;br /&gt;b) Deleting an Event Log&lt;br /&gt;&lt;br /&gt;&lt;img id="BLOGGER_PHOTO_ID_5216485802378706514" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://bp2.blogger.com/_MGI3FYgA_3c/SGSuMvqmvlI/AAAAAAAABqk/cwDRxK5Vp7o/s400/deletelog.gif" border="0" /&gt;&lt;br /&gt;&lt;br /&gt;c) Getting existing event logs&lt;br /&gt;&lt;br /&gt;&lt;img id="BLOGGER_PHOTO_ID_5216485934955770978" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://bp3.blogger.com/_MGI3FYgA_3c/SGSuUdjcNGI/AAAAAAAABq0/QyUcU-6oSkc/s400/eventlogs.gif" border="0" /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2149165178736128353-937837505634920902?l=moiashvin-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://moiashvin-tech.blogspot.com/feeds/937837505634920902/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2149165178736128353&amp;postID=937837505634920902' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/937837505634920902'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/937837505634920902'/><link rel='alternate' type='text/html' href='http://moiashvin-tech.blogspot.com/2008/06/working-with-event-logs.html' title='Working with event logs'/><author><name>ashvin</name><uri>http://www.blogger.com/profile/00922391930245622789</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_MGI3FYgA_3c/Sz0gYk3D9UI/AAAAAAAACnU/k5b8SZoi0r4/S220/26122009454.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://bp3.blogger.com/_MGI3FYgA_3c/SGSt7I9BeBI/AAAAAAAABqM/w7vQUdYVQS8/s72-c/createlog.gif' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2149165178736128353.post-6453392973560985194</id><published>2008-06-27T11:13:00.002+04:00</published><updated>2008-06-27T13:21:48.383+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Event Logs'/><category scheme='http://www.blogger.com/atom/ns#' term='Event Viewer'/><category scheme='http://www.blogger.com/atom/ns#' term='Ashvin Gunga'/><category scheme='http://www.blogger.com/atom/ns#' term='Windows XP'/><title type='text'>Event Viewer and event logs in Windows XP</title><content type='html'>&lt;div align="justify"&gt;The Event Log Service in Windows XP records application, security and system events in its Event Viewer. Here an event is any significant occurence in an application and/or system that requires notification to the users. The event logs allow us to obtain information about hardware, software or any system components, identify and diagnose current system problems or even assist in prediction of potential system problems.&lt;br /&gt;&lt;br /&gt;&lt;em&gt;&lt;strong&gt;Event Logs in Windows XP&lt;/strong&gt;&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;1. Application log&lt;br /&gt;2. Security log&lt;br /&gt;3. System log&lt;br /&gt;&lt;br /&gt;&lt;em&gt;&lt;strong&gt;Viewing the Event Logs in XP&lt;/strong&gt;&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;Start --&gt; Control Panel --&gt; Performance and Maintenance --&gt; Administrative Tools --&gt; Event Viewer&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;img id="BLOGGER_PHOTO_ID_5216455985321066482" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://bp3.blogger.com/_MGI3FYgA_3c/SGSTFKeFv_I/AAAAAAAABqE/e6lIN0ZJFXo/s400/Initial.gif" border="0" /&gt;&lt;br /&gt;&lt;br /&gt;For more information about Event Viewer and event logs, read the nice article How to view and manage event logs in Event Viewer in Windows XP &lt;a href="http://support.microsoft.com/kb/308427"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Coming next: Event Logs in .Net 2.0&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2149165178736128353-6453392973560985194?l=moiashvin-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://moiashvin-tech.blogspot.com/feeds/6453392973560985194/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2149165178736128353&amp;postID=6453392973560985194' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/6453392973560985194'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/6453392973560985194'/><link rel='alternate' type='text/html' href='http://moiashvin-tech.blogspot.com/2008/06/event-viewer-and-event-logs-in-windows.html' title='Event Viewer and event logs in Windows XP'/><author><name>ashvin</name><uri>http://www.blogger.com/profile/00922391930245622789</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_MGI3FYgA_3c/Sz0gYk3D9UI/AAAAAAAACnU/k5b8SZoi0r4/S220/26122009454.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://bp3.blogger.com/_MGI3FYgA_3c/SGSTFKeFv_I/AAAAAAAABqE/e6lIN0ZJFXo/s72-c/Initial.gif' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2149165178736128353.post-4756189439592604860</id><published>2008-06-21T20:27:00.006+04:00</published><updated>2008-06-21T20:56:45.504+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Nokia N95'/><category scheme='http://www.blogger.com/atom/ns#' term='YouTube'/><category scheme='http://www.blogger.com/atom/ns#' term='Mobile Software'/><category scheme='http://www.blogger.com/atom/ns#' term='Ashvin Gunga'/><title type='text'>YouTube for Mobile</title><content type='html'>&lt;div align="justify"&gt;YouTube for Mobile is a mobile application that will allow you to browse and watch YouTube videos from your handset. I have tried it on my Nokia N95, and it works great.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;the main features ...&lt;/strong&gt;&lt;br /&gt;- browse by popular videos (most viewed, top rated, featured), related videos or keyword search;&lt;br /&gt;- sign into your YouTube account and access your own videos, subscriptions and favourites;&lt;br /&gt;- upload videos from the mobile phone to YouTube directly;&lt;br /&gt;- Similar look and feel of the YouTube website version;&lt;br /&gt;- supported phones are Nokia's N73, N95, E65, 6110, 6120 and Sony Ericsson's K800 and W880&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;some other facts ...&lt;/strong&gt;&lt;br /&gt;- applicant has been written in java;&lt;br /&gt;- works best with 3G coverage (and my home MyT connection as well);&lt;br /&gt;- video is in .3gp format and of lower quality than the video on the YouTube website;&lt;br /&gt;- supported phones are Nokia's N73, N95, E65, 6110, 6120 and Sony Ericsson's K800 and W880;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;YouTube installation ...&lt;/strong&gt;&lt;br /&gt;To install the YouTube application, use your mobile phone and go to&lt;br /&gt;&lt;br /&gt;&lt;em&gt;m.youtube.com/app&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;and follow the instructions to download and install YouTube on the phone. Upon successful completion, the YouTube icon will appear on the applications menu.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;the sound issue on Nokia phones ...&lt;/strong&gt;&lt;br /&gt;&lt;em&gt;For Nokia devices, you must have the Warning Tones enabled in your phone's settings to hear audio in YouTube. This setting can be found in "Profiles" &gt; "Current Profile" &gt; "Personalize" &gt; "Warning Tones." &lt;/em&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;snapshots...&lt;/strong&gt;&lt;br /&gt;&lt;p align="center"&gt;Launch YouTube Mobile Client from Menu ...&lt;/p&gt;&lt;br /&gt;&lt;img id="BLOGGER_PHOTO_ID_5214050732487293586" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://bp3.blogger.com/_MGI3FYgA_3c/SFwHhBbFOpI/AAAAAAAABp0/zlv7a8M0qYM/s400/Screenshot0023.jpg" border="0" /&gt;&lt;br /&gt;&lt;p align="center"&gt;YouTube Mobile Client is launched, and enters the Home menu ...&lt;/p&gt;&lt;br /&gt;&lt;img id="BLOGGER_PHOTO_ID_5214050629387657810" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://bp3.blogger.com/_MGI3FYgA_3c/SFwHbBWNolI/AAAAAAAABps/var88gfMhM0/s400/Screenshot0025.jpg" border="0" /&gt; &lt;p align="center"&gt;Search a video on YouTube ...&lt;/p&gt;&lt;br /&gt;&lt;img id="BLOGGER_PHOTO_ID_5214050373817218018" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://bp0.blogger.com/_MGI3FYgA_3c/SFwHMJReM-I/AAAAAAAABpk/flDLhz-ezZI/s400/Screenshot0026.jpg" border="0" /&gt;&lt;br /&gt;&lt;img id="BLOGGER_PHOTO_ID_5214049819279845010" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://bp2.blogger.com/_MGI3FYgA_3c/SFwGr3ddZpI/AAAAAAAABpc/dGk2Gqeb4Js/s400/Screenshot0029.jpg" border="0" /&gt; &lt;p align="center"&gt;Video presented with small thumbnail and related descriptive information ...&lt;/p&gt;&lt;br /&gt;&lt;img id="BLOGGER_PHOTO_ID_5214049507939088866" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://bp2.blogger.com/_MGI3FYgA_3c/SFwGZvoCeeI/AAAAAAAABpU/vW56e1GWdKw/s400/Screenshot0030.jpg" border="0" /&gt; &lt;p align="center"&gt;Video starts with same look and feel as YouTube.com ...&lt;/p&gt;&lt;br /&gt;&lt;img id="BLOGGER_PHOTO_ID_5214049262143738322" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://bp2.blogger.com/_MGI3FYgA_3c/SFwGLb93EdI/AAAAAAAABpM/y5MnPgPhfpg/s400/Screenshot0032.jpg" border="0" /&gt;&lt;br /&gt;&lt;img id="BLOGGER_PHOTO_ID_5214049043609479906" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://bp2.blogger.com/_MGI3FYgA_3c/SFwF-t3O6uI/AAAAAAAABpE/pDDics5QvH4/s400/Screenshot0036.jpg" border="0" /&gt;&lt;br /&gt;&lt;p align="center"&gt;Additional options available ...&lt;/p&gt;&lt;br /&gt;&lt;img id="BLOGGER_PHOTO_ID_5214048894851120546" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://bp0.blogger.com/_MGI3FYgA_3c/SFwF2DsefaI/AAAAAAAABo8/A8Qjp4tsvtU/s400/Screenshot0037.jpg" border="0" /&gt; &lt;p align="center"&gt;Logon YouTube using my account ...&lt;/p&gt;&lt;br /&gt;&lt;img id="BLOGGER_PHOTO_ID_5214048351756241586" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://bp3.blogger.com/_MGI3FYgA_3c/SFwFWcgkSrI/AAAAAAAABo0/xSsdR22Aq5c/s400/Screenshot0039.jpg" border="0" /&gt; &lt;p align="center"&gt;View my videos ...&lt;/p&gt;&lt;br /&gt;&lt;img id="BLOGGER_PHOTO_ID_5214048272944904754" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://bp3.blogger.com/_MGI3FYgA_3c/SFwFR26eujI/AAAAAAAABos/5sYRkz7yqT4/s400/Screenshot0040.jpg" border="0" /&gt;&lt;br /&gt;&lt;p align="center"&gt;Closing the application ...&lt;/p&gt;&lt;br /&gt;&lt;img id="BLOGGER_PHOTO_ID_5214048140550943074" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://bp1.blogger.com/_MGI3FYgA_3c/SFwFKJtTMWI/AAAAAAAABok/vVO8_-C4Ql8/s400/Screenshot0045.jpg" border="0" /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;further information...&lt;/strong&gt;&lt;br /&gt;&lt;a href="http://www.youtube.com/yt_mobile_app"&gt;here&lt;/a&gt; and &lt;a href="http://www.allaboutsymbian.com/news/item/6611_Official_YouTube_Mobile_Client.php"&gt;here&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2149165178736128353-4756189439592604860?l=moiashvin-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://moiashvin-tech.blogspot.com/feeds/4756189439592604860/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2149165178736128353&amp;postID=4756189439592604860' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/4756189439592604860'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/4756189439592604860'/><link rel='alternate' type='text/html' href='http://moiashvin-tech.blogspot.com/2008/06/youtube-for-mobile.html' title='YouTube for Mobile'/><author><name>ashvin</name><uri>http://www.blogger.com/profile/00922391930245622789</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_MGI3FYgA_3c/Sz0gYk3D9UI/AAAAAAAACnU/k5b8SZoi0r4/S220/26122009454.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://bp3.blogger.com/_MGI3FYgA_3c/SFwHhBbFOpI/AAAAAAAABp0/zlv7a8M0qYM/s72-c/Screenshot0023.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2149165178736128353.post-5705392864008092968</id><published>2008-06-11T20:31:00.003+04:00</published><updated>2008-06-11T20:35:26.025+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Programming'/><category scheme='http://www.blogger.com/atom/ns#' term='Ashvin Gunga'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><category scheme='http://www.blogger.com/atom/ns#' term='.NET 2.0'/><title type='text'>Declaring variables as nullable in C#</title><content type='html'>Nullable variables can be declared if you want to determine whether a value has been assigned or not.&lt;br /&gt;&lt;br /&gt;Two ways:&lt;br /&gt;&lt;br /&gt;1. Use Nullable type&lt;br /&gt;Nullable&lt;bool&gt; b = null;&lt;br /&gt;&lt;br /&gt;2. Use C# shorthand notation&lt;br /&gt;bool? b = null;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2149165178736128353-5705392864008092968?l=moiashvin-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://moiashvin-tech.blogspot.com/feeds/5705392864008092968/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2149165178736128353&amp;postID=5705392864008092968' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/5705392864008092968'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/5705392864008092968'/><link rel='alternate' type='text/html' href='http://moiashvin-tech.blogspot.com/2008/06/declaring-variables-as-nullable-in-c.html' title='Declaring variables as nullable in C#'/><author><name>ashvin</name><uri>http://www.blogger.com/profile/00922391930245622789</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_MGI3FYgA_3c/Sz0gYk3D9UI/AAAAAAAACnU/k5b8SZoi0r4/S220/26122009454.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2149165178736128353.post-5926269098012305529</id><published>2008-06-11T16:36:00.005+04:00</published><updated>2008-06-12T10:05:17.359+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Ashvin Gunga'/><category scheme='http://www.blogger.com/atom/ns#' term='Device'/><title type='text'>Launch a program on a device remotely from the desktop using RAPI Start</title><content type='html'>&lt;div align="left"&gt;&lt;strong&gt;Pre-requisites:&lt;/strong&gt;&lt;br /&gt;1. Windows Mobile Developer Power Toys is installed on your pc. This can be downloaded &lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=74473fd6-1dcc-47aa-ab28-6a2b006edfe9&amp;amp;DisplayLang=en"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;2. Microsoft ActiveSync is installed on your pc. This can be downloaded &lt;a href="http://www.microsoft.com/windowsmobile/activesync/activesync45.mspx"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;3. Device is connected to the pc via ActiveSync.&lt;br /&gt;&lt;br /&gt;4. The program to be launched has already been deployed on the device.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Procedure:&lt;/strong&gt;&lt;br /&gt;To launch a program on a device remotely via command-line,&lt;br /&gt;&lt;br /&gt;1. Open Command Prompt Window&lt;br /&gt;&lt;br /&gt;2. Go to *installation path of Windows Mobile Developer Power Toys*\RAPI_Start&lt;br /&gt;&lt;br /&gt;&lt;em&gt;cd C:\Program Files\Windows Mobile Developer Power Toys\RAPI_Start &lt;/em&gt;&lt;br /&gt;&lt;br /&gt;3. Type &lt;strong&gt;rapistart &lt;/strong&gt;*path of program on device to be launched enclosed between double quotes (see example below)*&lt;br /&gt;&lt;br /&gt;Example:&lt;br /&gt;&lt;em&gt;rapistart "\Program Files\HelloWorldApplication\HelloWorldApplication.exe"&lt;/em&gt; &lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2149165178736128353-5926269098012305529?l=moiashvin-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://moiashvin-tech.blogspot.com/feeds/5926269098012305529/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2149165178736128353&amp;postID=5926269098012305529' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/5926269098012305529'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/5926269098012305529'/><link rel='alternate' type='text/html' href='http://moiashvin-tech.blogspot.com/2008/06/launch-program-on-device-remotely-from.html' title='Launch a program on a device remotely from the desktop using RAPI Start'/><author><name>ashvin</name><uri>http://www.blogger.com/profile/00922391930245622789</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_MGI3FYgA_3c/Sz0gYk3D9UI/AAAAAAAACnU/k5b8SZoi0r4/S220/26122009454.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2149165178736128353.post-5641344862405515163</id><published>2008-06-09T19:30:00.009+04:00</published><updated>2008-06-09T20:21:52.963+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='.Net CF 2.0'/><category scheme='http://www.blogger.com/atom/ns#' term='Ashvin Gunga'/><category scheme='http://www.blogger.com/atom/ns#' term='.NET 2.0'/><category scheme='http://www.blogger.com/atom/ns#' term='OpenNetCF'/><title type='text'>.Net Compact Framework and OpenNetCF</title><content type='html'>The slides of a small presentation I made on .Net Compact Framework and OpenNetCF...&lt;br /&gt;&lt;br /&gt;&lt;img id="BLOGGER_PHOTO_ID_5209905734700216594" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://bp3.blogger.com/_MGI3FYgA_3c/SE1NqZYTsRI/AAAAAAAABns/KJLTeSScZck/s400/1.png" border="0" /&gt;&lt;br /&gt;&lt;img id="BLOGGER_PHOTO_ID_5209905656762170722" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://bp1.blogger.com/_MGI3FYgA_3c/SE1Nl3CbfWI/AAAAAAAABnk/SxaHJn6yFUg/s400/2.png" border="0" /&gt;&lt;br /&gt;&lt;img id="BLOGGER_PHOTO_ID_5209905551244593746" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://bp2.blogger.com/_MGI3FYgA_3c/SE1Nft9FClI/AAAAAAAABnc/4zZt7ZNjRTQ/s400/3.png" border="0" /&gt;&lt;br /&gt;&lt;img id="BLOGGER_PHOTO_ID_5209905391184901170" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://bp3.blogger.com/_MGI3FYgA_3c/SE1NWZr39DI/AAAAAAAABnU/cfiDDRbDgPg/s400/4.png" border="0" /&gt;&lt;br /&gt;&lt;img id="BLOGGER_PHOTO_ID_5209905282597243186" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://bp2.blogger.com/_MGI3FYgA_3c/SE1NQFKjyTI/AAAAAAAABnM/JBiPQ5d2Luk/s400/5.png" border="0" /&gt;&lt;br /&gt;&lt;img id="BLOGGER_PHOTO_ID_5209905147305640562" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://bp0.blogger.com/_MGI3FYgA_3c/SE1NINKhwnI/AAAAAAAABnE/jwL7gE-WNMY/s400/6.png" border="0" /&gt;&lt;br /&gt;&lt;img id="BLOGGER_PHOTO_ID_5209904757657797794" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://bp0.blogger.com/_MGI3FYgA_3c/SE1MxhnPhKI/AAAAAAAABm8/zAiMUch4Xhs/s400/7.png" border="0" /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2149165178736128353-5641344862405515163?l=moiashvin-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://moiashvin-tech.blogspot.com/feeds/5641344862405515163/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2149165178736128353&amp;postID=5641344862405515163' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/5641344862405515163'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/5641344862405515163'/><link rel='alternate' type='text/html' href='http://moiashvin-tech.blogspot.com/2008/06/net-compact-framework-and-opennetcf.html' title='.Net Compact Framework and OpenNetCF'/><author><name>ashvin</name><uri>http://www.blogger.com/profile/00922391930245622789</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_MGI3FYgA_3c/Sz0gYk3D9UI/AAAAAAAACnU/k5b8SZoi0r4/S220/26122009454.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://bp3.blogger.com/_MGI3FYgA_3c/SE1NqZYTsRI/AAAAAAAABns/KJLTeSScZck/s72-c/1.png' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2149165178736128353.post-6797076200170269305</id><published>2008-05-06T20:20:00.006+04:00</published><updated>2008-05-06T20:33:04.014+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Programming'/><category scheme='http://www.blogger.com/atom/ns#' term='Subversion'/><category scheme='http://www.blogger.com/atom/ns#' term='Ashvin Gunga'/><title type='text'>Tip: Remove the hidden .svn folders</title><content type='html'>&lt;div align="justify"&gt;Are you using subversion as your source code repository? Do you want to delete all the .svn hidden folders inside your project folder? Last year, I got the solution I required from Jon Galloway's blog @ &lt;a href="http://weblogs.asp.net/jgalloway/archive/2007/02/24/shell-command-remove-svn-folders.aspx"&gt;here&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;img id="BLOGGER_PHOTO_ID_5197302923846061058" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://bp0.blogger.com/_MGI3FYgA_3c/SCCHeQXxjAI/AAAAAAAABlU/9tvTrZLb9g4/s400/1.jpg" border="0" /&gt;&lt;br /&gt;l&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2149165178736128353-6797076200170269305?l=moiashvin-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://moiashvin-tech.blogspot.com/feeds/6797076200170269305/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2149165178736128353&amp;postID=6797076200170269305' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/6797076200170269305'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/6797076200170269305'/><link rel='alternate' type='text/html' href='http://moiashvin-tech.blogspot.com/2008/05/tip-remove-hidden-svn-folders.html' title='Tip: Remove the hidden .svn folders'/><author><name>ashvin</name><uri>http://www.blogger.com/profile/00922391930245622789</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_MGI3FYgA_3c/Sz0gYk3D9UI/AAAAAAAACnU/k5b8SZoi0r4/S220/26122009454.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://bp0.blogger.com/_MGI3FYgA_3c/SCCHeQXxjAI/AAAAAAAABlU/9tvTrZLb9g4/s72-c/1.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2149165178736128353.post-4900592458003067195</id><published>2008-05-06T19:46:00.006+04:00</published><updated>2008-05-06T20:18:12.593+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Programming'/><category scheme='http://www.blogger.com/atom/ns#' term='Ashvin Gunga'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><category scheme='http://www.blogger.com/atom/ns#' term='Log4net'/><title type='text'>Initialization code for log4net in c# web service project</title><content type='html'>&lt;div align="justify"&gt;log4net is the .NET version of the Java logger, log4j. I have used it in both .NET Full and .NET CF Framework projects. Now, I have developed a sample web service and successfully configured the application to use log4net. The one tricky part is to correctly tell the application to load the configuration settings when it starts.&lt;br /&gt;&lt;br /&gt;The initialization code can be put in the the web project's Global.asax.cs:&lt;br /&gt;&lt;/div&gt;&lt;img id="BLOGGER_PHOTO_ID_5197296090553093106" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://bp1.blogger.com/_MGI3FYgA_3c/SCCBQgXxi_I/AAAAAAAABlM/sk5dz0IRw90/s400/1.jpg" border="0" /&gt;&lt;br /&gt;The Application_Start method is called automatically when the web service is loaded, and thus, it is the ideal place to initialize the log4net environment.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://logging.apache.org/log4net/index.html"&gt;More info on log4net&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2149165178736128353-4900592458003067195?l=moiashvin-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://moiashvin-tech.blogspot.com/feeds/4900592458003067195/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2149165178736128353&amp;postID=4900592458003067195' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/4900592458003067195'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/4900592458003067195'/><link rel='alternate' type='text/html' href='http://moiashvin-tech.blogspot.com/2008/05/initialization-code-for-log4net-in-c.html' title='Initialization code for log4net in c# web service project'/><author><name>ashvin</name><uri>http://www.blogger.com/profile/00922391930245622789</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_MGI3FYgA_3c/Sz0gYk3D9UI/AAAAAAAACnU/k5b8SZoi0r4/S220/26122009454.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://bp1.blogger.com/_MGI3FYgA_3c/SCCBQgXxi_I/AAAAAAAABlM/sk5dz0IRw90/s72-c/1.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2149165178736128353.post-5115425675725175843</id><published>2008-05-02T11:24:00.003+04:00</published><updated>2008-05-02T11:31:57.705+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Ashvin Gunga'/><category scheme='http://www.blogger.com/atom/ns#' term='Windows XP'/><title type='text'>Creating shortcut for Add/Remove Programs window</title><content type='html'>&lt;div align="justify"&gt;Here's a cool tip to directly open the Add/Remove Programs window without going through the Control Panel window.&lt;br /&gt;&lt;br /&gt;Type &lt;strong&gt;control appwiz.cpl&lt;/strong&gt; in the Run command window and click OK.&lt;br /&gt;&lt;br /&gt;In my case, I needed a shorcut the desktop to the Add/Remove Programs and here are the basic steps:&lt;br /&gt;&lt;br /&gt;1. Right-click on the desktop&lt;br /&gt;2. Select New -&gt; Shortcut&lt;br /&gt;3. In the Create Shorcut window, enter &lt;strong&gt;control appwiz.cpl&lt;/strong&gt; and click Next.&lt;br /&gt;4. In the Select a Title for the program, enter a descriptive name and click Finish.&lt;br /&gt;&lt;br /&gt;And if the shortcut icon is a big ugly, then you can change it as well from the shortcut properties window. &lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2149165178736128353-5115425675725175843?l=moiashvin-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://moiashvin-tech.blogspot.com/feeds/5115425675725175843/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2149165178736128353&amp;postID=5115425675725175843' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/5115425675725175843'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/5115425675725175843'/><link rel='alternate' type='text/html' href='http://moiashvin-tech.blogspot.com/2008/05/creating-shortcut-for-addremove.html' title='Creating shortcut for Add/Remove Programs window'/><author><name>ashvin</name><uri>http://www.blogger.com/profile/00922391930245622789</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_MGI3FYgA_3c/Sz0gYk3D9UI/AAAAAAAACnU/k5b8SZoi0r4/S220/26122009454.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2149165178736128353.post-8328743775394109930</id><published>2008-05-02T10:59:00.008+04:00</published><updated>2008-05-02T11:18:03.001+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Programming'/><category scheme='http://www.blogger.com/atom/ns#' term='Ashvin Gunga'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><category scheme='http://www.blogger.com/atom/ns#' term='.NET 2.0'/><title type='text'>Escape ampersand (&amp;) character in C#</title><content type='html'>&lt;div align="justify"&gt;&lt;strong&gt;Problem&lt;/strong&gt;&lt;br /&gt;Set the Text property of a Label with a string literal having ampersand (&amp;amp;) characters. When the application is run, the ampersand character is not displayed in the label.&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;p&gt;&lt;img id="BLOGGER_PHOTO_ID_5195672129058737090" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://bp3.blogger.com/_MGI3FYgA_3c/SBq8RgXxi8I/AAAAAAAABk0/qBT9DEWh0eE/s400/problem.jpg" border="0" /&gt;&lt;br /&gt;The default behaviour of Labels interprets ampersand characters (&amp;amp;) in the Lanel control's Text property as an access key prefix character, and not as a character literal.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Solution&lt;/strong&gt;&lt;br /&gt;To escape the ampersand character, I will suggest two ways.&lt;br /&gt;&lt;br /&gt;1. Use double ampersand. However, this modifies the original string literal, which you probably don't want. &lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;img id="BLOGGER_PHOTO_ID_5195673718196636626" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://bp1.blogger.com/_MGI3FYgA_3c/SBq9uAXxi9I/AAAAAAAABk8/7LGbLvVYKHQ/s400/output.jpg" border="0" /&gt;&lt;br /&gt;2. Set the Label.UseMnemonic Property to false (since by default, value for the UseMnemonic property is true).&lt;br /&gt;&lt;br /&gt;&lt;img id="BLOGGER_PHOTO_ID_5195675122650942434" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://bp0.blogger.com/_MGI3FYgA_3c/SBq-_wXxi-I/AAAAAAAABlE/F8bchKn4h_U/s400/output1.jpg" border="0" /&gt; &lt;/p&gt;&lt;br /&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.label.usemnemonic(VS.80).aspx"&gt;More information on Label.UseMnemonic Property on MSDN&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2149165178736128353-8328743775394109930?l=moiashvin-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://moiashvin-tech.blogspot.com/feeds/8328743775394109930/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2149165178736128353&amp;postID=8328743775394109930' title='10 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/8328743775394109930'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/8328743775394109930'/><link rel='alternate' type='text/html' href='http://moiashvin-tech.blogspot.com/2008/05/escape-ampersand-character-in-c.html' title='Escape ampersand (&amp;) character in C#'/><author><name>ashvin</name><uri>http://www.blogger.com/profile/00922391930245622789</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_MGI3FYgA_3c/Sz0gYk3D9UI/AAAAAAAACnU/k5b8SZoi0r4/S220/26122009454.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://bp3.blogger.com/_MGI3FYgA_3c/SBq8RgXxi8I/AAAAAAAABk0/qBT9DEWh0eE/s72-c/problem.jpg' height='72' width='72'/><thr:total>10</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2149165178736128353.post-8413475874059299206</id><published>2008-05-01T23:44:00.000+04:00</published><updated>2008-05-01T23:46:55.019+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Programming'/><category scheme='http://www.blogger.com/atom/ns#' term='Ashvin Gunga'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><category scheme='http://www.blogger.com/atom/ns#' term='.NET 2.0'/><title type='text'>Removing InstallState files after uninstallation</title><content type='html'>&lt;div align="justify"&gt;Once everything from the previous post is working, one potential problem that can be encountered is that INSTALLSTATE files are not removed after uninstallation of a .NET Framework 2.0-based application. This is an issue related to custom actions and the following article from Microsoft gives a very good description of the exact problem:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://support.microsoft.com/kb/934388"&gt;An .installstate file is not removed after you uninstall a .NET Framework 2.0-based application&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Since the Workarounds suggested in the article didn't make much sense to me, I have found another way to solve it.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Solution&lt;/strong&gt;&lt;br /&gt;the same custom action (that was initially used for Install custom action) to the Uninstall custom action.&lt;br /&gt;&lt;br /&gt;Then, Override the Uninstall method in the installer class and make sure it calls the base Uninstall method. &lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2149165178736128353-8413475874059299206?l=moiashvin-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://moiashvin-tech.blogspot.com/feeds/8413475874059299206/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2149165178736128353&amp;postID=8413475874059299206' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/8413475874059299206'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/8413475874059299206'/><link rel='alternate' type='text/html' href='http://moiashvin-tech.blogspot.com/2008/05/removing-installstate-files-after.html' title='Removing InstallState files after uninstallation'/><author><name>ashvin</name><uri>http://www.blogger.com/profile/00922391930245622789</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_MGI3FYgA_3c/Sz0gYk3D9UI/AAAAAAAACnU/k5b8SZoi0r4/S220/26122009454.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2149165178736128353.post-3063933132784769393</id><published>2008-05-01T23:07:00.005+04:00</published><updated>2008-05-01T23:32:00.430+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Programming'/><category scheme='http://www.blogger.com/atom/ns#' term='Ashvin Gunga'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><category scheme='http://www.blogger.com/atom/ns#' term='.NET 2.0'/><title type='text'>Update application config file during installation process</title><content type='html'>&lt;div align="justify"&gt;I was looking for sample code snippet(s) in the MSDN Library that allow the application's configuration file to be modified during the installation process. I've found the following article:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/aa289515.aspx"&gt;Redirecting an Application to Target a Different XML Web Service During Installation&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;That's exactly what I needed and it just took me just a couple of minutes to code it in C#.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://bp0.blogger.com/_MGI3FYgA_3c/SBoaewXxi7I/AAAAAAAABks/U3FT19WNl1Q/s1600-h/a.jpg"&gt;&lt;img id="BLOGGER_PHOTO_ID_5195494235808304050" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://bp0.blogger.com/_MGI3FYgA_3c/SBoaewXxi7I/AAAAAAAABks/U3FT19WNl1Q/s400/a.jpg" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;I think it won't be a big deal to complete the last part ... :-) Is it? &lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2149165178736128353-3063933132784769393?l=moiashvin-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://moiashvin-tech.blogspot.com/feeds/3063933132784769393/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2149165178736128353&amp;postID=3063933132784769393' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/3063933132784769393'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/3063933132784769393'/><link rel='alternate' type='text/html' href='http://moiashvin-tech.blogspot.com/2008/05/update-application-config-file-during.html' title='Update application config file during installation process'/><author><name>ashvin</name><uri>http://www.blogger.com/profile/00922391930245622789</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_MGI3FYgA_3c/Sz0gYk3D9UI/AAAAAAAACnU/k5b8SZoi0r4/S220/26122009454.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://bp0.blogger.com/_MGI3FYgA_3c/SBoaewXxi7I/AAAAAAAABks/U3FT19WNl1Q/s72-c/a.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2149165178736128353.post-2327498066427177467</id><published>2008-05-01T12:53:00.006+04:00</published><updated>2008-05-01T13:14:47.392+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Programming'/><category scheme='http://www.blogger.com/atom/ns#' term='Ashvin Gunga'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><category scheme='http://www.blogger.com/atom/ns#' term='Visual Studio'/><category scheme='http://www.blogger.com/atom/ns#' term='.NET 2.0'/><title type='text'>SetCompatibleTextRenderingDefault must be called before the first IWin32Window object is created in the application.</title><content type='html'>&lt;div align="justify"&gt;&lt;strong&gt;SetCompatibleTextRenderingDefault must be called before the first IWin32Window object is created in the application.&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Problem Description&lt;/strong&gt;&lt;br /&gt;I encountered this error when attempting to start a project's exe file compiled under the Release configuration.&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;img id="BLOGGER_PHOTO_ID_5195333548196858770" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://bp2.blogger.com/_MGI3FYgA_3c/SBmIVgXxi5I/AAAAAAAABkc/NmR6CZ0WfY0/s400/pic1.png" border="0" /&gt;&lt;br /&gt;&lt;img id="BLOGGER_PHOTO_ID_5195333479477382018" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://bp2.blogger.com/_MGI3FYgA_3c/SBmIRgXxi4I/AAAAAAAABkU/kwbRGvQn4JU/s400/pic2.png" border="0" /&gt;&lt;br /&gt;&lt;strong&gt;Analysis &amp;amp; Observations&lt;/strong&gt;&lt;br /&gt;The exe file compiled under the Debug configuration started without any problem and there were no error messages or exceptions.&lt;br /&gt;&lt;br /&gt;Starting the Release version from Visual Studio (though F5 - start debugging), it worked fine as well.&lt;br /&gt;&lt;br /&gt;The Main() function had the Application.SetCompatibleTextRenderingDefault method call in the second line before the Load method call. So, this should be working fine.&lt;br /&gt;&lt;br /&gt;&lt;img id="BLOGGER_PHOTO_ID_5195332951196404594" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://bp3.blogger.com/_MGI3FYgA_3c/SBmHywXxi3I/AAAAAAAABkM/QwB8dX4bEJo/s400/pic3.png" border="0" /&gt; &lt;p align="justify"&gt;&lt;br /&gt;The application configuration file has been renamed deployed.&lt;br /&gt;&lt;br /&gt;When starting the exe, the process shows for a second in the Task Manager and then disappears (which is not what I expected).&lt;br /&gt;&lt;br /&gt;There is no pragma code or conditional compilation sections in the code that may not execute when running in Release Mode.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Problem Cause&lt;/strong&gt;&lt;br /&gt;After all these observations and some further investigation in the code, I have finally found the real problem. The MainFormController is a singleton and had a Form as an instance member. This form was being instantiated when the class was being loaded in the memory, well before the Application.SetCompatibleTextRenderingDefault and Load method calls.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Solution&lt;/strong&gt;&lt;br /&gt;I have changed the code to lazy initialization of the form, and thus, the form will be instantiated only when it is requested for the first time. Wohoooooo. &lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2149165178736128353-2327498066427177467?l=moiashvin-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://moiashvin-tech.blogspot.com/feeds/2327498066427177467/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2149165178736128353&amp;postID=2327498066427177467' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/2327498066427177467'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/2327498066427177467'/><link rel='alternate' type='text/html' href='http://moiashvin-tech.blogspot.com/2008/05/setcompatibletextrenderingdefault-must.html' title='SetCompatibleTextRenderingDefault must be called before the first IWin32Window object is created in the application.'/><author><name>ashvin</name><uri>http://www.blogger.com/profile/00922391930245622789</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_MGI3FYgA_3c/Sz0gYk3D9UI/AAAAAAAACnU/k5b8SZoi0r4/S220/26122009454.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://bp2.blogger.com/_MGI3FYgA_3c/SBmIVgXxi5I/AAAAAAAABkc/NmR6CZ0WfY0/s72-c/pic1.png' height='72' width='72'/><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2149165178736128353.post-382338716851721382</id><published>2008-04-30T16:55:00.004+04:00</published><updated>2008-04-30T17:10:14.149+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Programming'/><category scheme='http://www.blogger.com/atom/ns#' term='Ashvin Gunga'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><category scheme='http://www.blogger.com/atom/ns#' term='.NET 2.0'/><title type='text'>Extracting string literals from Enum</title><content type='html'>public enum Users { Anonymous, Trainee, Developer, TeamLeader, Manager, Administrator}&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;A simple way to extracting the string constants from enum:&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Type userType = typeof(Users);&lt;br /&gt;&lt;br /&gt;// get names of users as string&lt;br /&gt;string[] user = Enum.GetNames(userType);&lt;br /&gt;&lt;br /&gt;// enum to string&lt;br /&gt;string anonymous = Users.Anonymous.ToString();&lt;br /&gt;&lt;br /&gt;// string to enum&lt;br /&gt;Users manager = (Users)Enum.Parse(typeof(Users), "Manager", true);&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2149165178736128353-382338716851721382?l=moiashvin-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://moiashvin-tech.blogspot.com/feeds/382338716851721382/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2149165178736128353&amp;postID=382338716851721382' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/382338716851721382'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/382338716851721382'/><link rel='alternate' type='text/html' href='http://moiashvin-tech.blogspot.com/2008/04/extracting-string-literals-from-enum.html' title='Extracting string literals from Enum'/><author><name>ashvin</name><uri>http://www.blogger.com/profile/00922391930245622789</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_MGI3FYgA_3c/Sz0gYk3D9UI/AAAAAAAACnU/k5b8SZoi0r4/S220/26122009454.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2149165178736128353.post-2514450383088225691</id><published>2008-04-29T15:24:00.005+04:00</published><updated>2008-04-30T17:11:25.227+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Programming'/><category scheme='http://www.blogger.com/atom/ns#' term='Ashvin Gunga'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><category scheme='http://www.blogger.com/atom/ns#' term='Visual Studio'/><title type='text'>Tip: Open partial class for a form in code view</title><content type='html'>&lt;div align="justify"&gt;When creating a partial class for a Form in Visual Studio, the "View Designer" button (or option) is shown. Also, opening (e.g. double click) the partial class for the form not only opens a blank form in the IDE but may also destroy the original one. However, for the Form.Designer.cs partial class, this "View Designer" option is not shown.&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;img id="BLOGGER_PHOTO_ID_5194627202170325842" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://bp1.blogger.com/_MGI3FYgA_3c/SBcF6wXxi1I/AAAAAAAABj8/hMJBaynLjrc/s400/partial1.gif" border="0" /&gt;&lt;br /&gt;&lt;br /&gt;Is it possible to tell the VS IDE not to show the "View Designer" button for these partial classes?&lt;br /&gt;Yes, one way you could tell the IDE not to show the form in the designer is to use the DesignerCategory Attribute.&lt;br /&gt;&lt;br /&gt;[System.ComponentModel.DesignerCategory("code")]&lt;br /&gt;public partial class MainForm&lt;br /&gt;{&lt;br /&gt;....&lt;br /&gt;&lt;br /&gt;&lt;img id="BLOGGER_PHOTO_ID_5194626931587386178" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://bp2.blogger.com/_MGI3FYgA_3c/SBcFrAXxi0I/AAAAAAAABj0/iWspa8CjMCU/s400/partial2.gif" border="0" /&gt;&lt;br /&gt;&lt;br /&gt;Steps to reproduce:&lt;br /&gt;1. Create a new windows application.&lt;br /&gt;2. Add a new class named PartialMainForm.cs&lt;br /&gt;3. Add the partial keyword in front of the "class Form1" declaration in the added class.&lt;br /&gt;4. Save everything.&lt;br /&gt;5. Double click the PartialMainForm.cs file in the Solution Explorer.&lt;br /&gt;6. A blank form appear.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2149165178736128353-2514450383088225691?l=moiashvin-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://moiashvin-tech.blogspot.com/feeds/2514450383088225691/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2149165178736128353&amp;postID=2514450383088225691' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/2514450383088225691'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/2514450383088225691'/><link rel='alternate' type='text/html' href='http://moiashvin-tech.blogspot.com/2008/04/tip-open-partial-class-for-form-in-code.html' title='Tip: Open partial class for a form in code view'/><author><name>ashvin</name><uri>http://www.blogger.com/profile/00922391930245622789</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_MGI3FYgA_3c/Sz0gYk3D9UI/AAAAAAAACnU/k5b8SZoi0r4/S220/26122009454.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://bp1.blogger.com/_MGI3FYgA_3c/SBcF6wXxi1I/AAAAAAAABj8/hMJBaynLjrc/s72-c/partial1.gif' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2149165178736128353.post-9037922692696546138</id><published>2008-04-01T13:44:00.001+04:00</published><updated>2008-04-01T13:46:43.860+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Programming'/><category scheme='http://www.blogger.com/atom/ns#' term='Ashvin Gunga'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><category scheme='http://www.blogger.com/atom/ns#' term='.NET 2.0'/><title type='text'>Scroll Listbox Programmatically</title><content type='html'>&lt;div align="justify"&gt;String literals can be added to a ListBox control by using the Items.Add method. However, the ListBox control doesn't scroll automatically. One way to achieve this is to use the TopIndex property. This property determines the first entry to be visible in the ListBox.&lt;br /&gt;&lt;br /&gt;Make the first entry visibile at the top of the ListBox:&lt;br /&gt;&lt;strong&gt;this.listbox1.TopIndex = 0;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Show the last string of the control visible at the bottom of the ListBox (the last entry visible):&lt;br /&gt;&lt;strong&gt;this.listbox1.TopIndex = this.listbox1.Items.Count - 1;&lt;/strong&gt; &lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2149165178736128353-9037922692696546138?l=moiashvin-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://moiashvin-tech.blogspot.com/feeds/9037922692696546138/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2149165178736128353&amp;postID=9037922692696546138' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/9037922692696546138'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/9037922692696546138'/><link rel='alternate' type='text/html' href='http://moiashvin-tech.blogspot.com/2008/04/scroll-listbox-programmatically.html' title='Scroll Listbox Programmatically'/><author><name>ashvin</name><uri>http://www.blogger.com/profile/00922391930245622789</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_MGI3FYgA_3c/Sz0gYk3D9UI/AAAAAAAACnU/k5b8SZoi0r4/S220/26122009454.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2149165178736128353.post-934302344891187817</id><published>2008-03-09T20:26:00.003+04:00</published><updated>2008-03-09T20:33:31.708+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Ashvin Gunga'/><category scheme='http://www.blogger.com/atom/ns#' term='Windows XP'/><title type='text'>Windows Firewall window using firewall.cpl</title><content type='html'>If you want to go to the Windows Firewall window, the normal way would be &lt;strong&gt;Start -&gt; Control Panel -&gt; Security Center -&gt; Windows Firewall&lt;/strong&gt;.&lt;br /&gt;&lt;br /&gt;But a faster way is: &lt;strong&gt;Start -&gt; Run &lt;/strong&gt;and type &lt;strong&gt;firewall.cpl&lt;/strong&gt; and then &lt;strong&gt;OK&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;img id="BLOGGER_PHOTO_ID_5175779707704108146" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://bp2.blogger.com/_MGI3FYgA_3c/R9QQOMFg5HI/AAAAAAAABjU/X-Sjt5rp0Dc/s400/firewall.cpl.1.jpg" border="0" /&gt;&lt;br /&gt;And here it is ...&lt;br /&gt;&lt;br /&gt;&lt;img id="BLOGGER_PHOTO_ID_5175779475775874146" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://bp0.blogger.com/_MGI3FYgA_3c/R9QQAsFg5GI/AAAAAAAABjM/O6tFtbLG6V4/s400/firewall.cpl.2.jpg" border="0" /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2149165178736128353-934302344891187817?l=moiashvin-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://moiashvin-tech.blogspot.com/feeds/934302344891187817/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2149165178736128353&amp;postID=934302344891187817' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/934302344891187817'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/934302344891187817'/><link rel='alternate' type='text/html' href='http://moiashvin-tech.blogspot.com/2008/03/windows-firewall-window-using.html' title='Windows Firewall window using firewall.cpl'/><author><name>ashvin</name><uri>http://www.blogger.com/profile/00922391930245622789</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_MGI3FYgA_3c/Sz0gYk3D9UI/AAAAAAAACnU/k5b8SZoi0r4/S220/26122009454.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://bp2.blogger.com/_MGI3FYgA_3c/R9QQOMFg5HI/AAAAAAAABjU/X-Sjt5rp0Dc/s72-c/firewall.cpl.1.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2149165178736128353.post-2961195156735050905</id><published>2008-02-12T20:56:00.000+04:00</published><updated>2008-02-12T21:00:11.106+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Ashvin Gunga'/><category scheme='http://www.blogger.com/atom/ns#' term='Visual Studio'/><title type='text'>Tip: Immediate Window on Visual Studio</title><content type='html'>&lt;div align="justify"&gt;Here is a quick tip to have the Immediate Window on Visual Studio 2005&lt;br /&gt;&lt;br /&gt;1. Go to Command Window&lt;br /&gt;If you can't find it, go to&lt;br /&gt;&lt;strong&gt;View -&gt; Other Windows -&gt; Command Window&lt;/strong&gt;&lt;br /&gt;OR simply,&lt;br /&gt;&lt;strong&gt;Ctrl + Alt + A&lt;br /&gt;&lt;/strong&gt;&lt;br /&gt;&lt;/div&gt;&lt;img id="BLOGGER_PHOTO_ID_5166139143014826274" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://bp3.blogger.com/_MGI3FYgA_3c/R7HQLd-jwSI/AAAAAAAABgM/EWmYsTdYzss/s400/1.gif" border="0" /&gt;&lt;br /&gt;&lt;br /&gt;2. Type Immed in the Command Window&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;-&gt; The Immediate Window appears!&lt;br /&gt;&lt;/strong&gt;&lt;br /&gt;&lt;img id="BLOGGER_PHOTO_ID_5166139035640643858" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://bp2.blogger.com/_MGI3FYgA_3c/R7HQFN-jwRI/AAAAAAAABgE/NgUKbCQeSvs/s400/2.gif" border="0" /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2149165178736128353-2961195156735050905?l=moiashvin-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://moiashvin-tech.blogspot.com/feeds/2961195156735050905/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2149165178736128353&amp;postID=2961195156735050905' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/2961195156735050905'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/2961195156735050905'/><link rel='alternate' type='text/html' href='http://moiashvin-tech.blogspot.com/2008/02/tip-immediate-window-on-visual-studio.html' title='Tip: Immediate Window on Visual Studio'/><author><name>ashvin</name><uri>http://www.blogger.com/profile/00922391930245622789</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_MGI3FYgA_3c/Sz0gYk3D9UI/AAAAAAAACnU/k5b8SZoi0r4/S220/26122009454.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://bp3.blogger.com/_MGI3FYgA_3c/R7HQLd-jwSI/AAAAAAAABgM/EWmYsTdYzss/s72-c/1.gif' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2149165178736128353.post-4929925201837412381</id><published>2008-01-10T18:14:00.000+04:00</published><updated>2008-01-10T18:20:14.777+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Ashvin Gunga'/><title type='text'>Free Online Barcode Generator</title><content type='html'>Here's a free online barcode generator:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.barcodesinc.com/generator/index.php"&gt;&lt;img id="BLOGGER_PHOTO_ID_5153851865277598626" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://bp2.blogger.com/_MGI3FYgA_3c/R4Yo9xbbC6I/AAAAAAAABew/Hj0U4BUQFgY/s400/FreeBarcodeGenerator.gif" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;&lt;a href="http://www.barcodesinc.com/generator/index.php"&gt;&lt;strong&gt;Free Online Barcode Generator&lt;/strong&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2149165178736128353-4929925201837412381?l=moiashvin-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://moiashvin-tech.blogspot.com/feeds/4929925201837412381/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2149165178736128353&amp;postID=4929925201837412381' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/4929925201837412381'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/4929925201837412381'/><link rel='alternate' type='text/html' href='http://moiashvin-tech.blogspot.com/2008/01/free-online-barcode-generator.html' title='Free Online Barcode Generator'/><author><name>ashvin</name><uri>http://www.blogger.com/profile/00922391930245622789</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_MGI3FYgA_3c/Sz0gYk3D9UI/AAAAAAAACnU/k5b8SZoi0r4/S220/26122009454.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://bp2.blogger.com/_MGI3FYgA_3c/R4Yo9xbbC6I/AAAAAAAABew/Hj0U4BUQFgY/s72-c/FreeBarcodeGenerator.gif' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2149165178736128353.post-8144580774666890031</id><published>2008-01-10T15:03:00.000+04:00</published><updated>2008-01-10T15:15:52.142+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Ashvin Gunga'/><category scheme='http://www.blogger.com/atom/ns#' term='Visual Studio'/><title type='text'>Add vertical rule in VS2005  IDE</title><content type='html'>&lt;div align="justify"&gt;Here is a cool tip that allows you to have a vertical rule (or say line) after 100 characters in VS IDE:&lt;br /&gt;&lt;br /&gt;1. Close Visual Studio 2005 (if open)&lt;br /&gt;2. Start &lt;strong&gt;regedit&lt;/strong&gt;&lt;br /&gt;3. Open the key &lt;strong&gt;HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\8.0\Text Editor&lt;/strong&gt;&lt;br /&gt;4. Create a new string named "Guides" and assign the value &lt;strong&gt;"RGB(128,0,0) 100"&lt;/strong&gt;.&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;img id="BLOGGER_PHOTO_ID_5153802537578204034" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://bp0.blogger.com/_MGI3FYgA_3c/R4X8GhbbC4I/AAAAAAAABec/ZrRHVq5mEXc/s400/VerticleRule_RegistrySnap.gif" border="0" /&gt;&lt;br /&gt;5. Now open Visual Studio and see the vertial rule.&lt;br /&gt;&lt;br /&gt;&lt;img id="BLOGGER_PHOTO_ID_5153804019341921170" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://bp1.blogger.com/_MGI3FYgA_3c/R4X9cxbbC5I/AAAAAAAABek/N_ayu3TzXIY/s400/VerticleRule_VS2005Snap.gif" border="0" /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2149165178736128353-8144580774666890031?l=moiashvin-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://moiashvin-tech.blogspot.com/feeds/8144580774666890031/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2149165178736128353&amp;postID=8144580774666890031' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/8144580774666890031'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/8144580774666890031'/><link rel='alternate' type='text/html' href='http://moiashvin-tech.blogspot.com/2008/01/add-vertical-rule-in-vs2005-ide.html' title='Add vertical rule in VS2005  IDE'/><author><name>ashvin</name><uri>http://www.blogger.com/profile/00922391930245622789</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_MGI3FYgA_3c/Sz0gYk3D9UI/AAAAAAAACnU/k5b8SZoi0r4/S220/26122009454.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://bp0.blogger.com/_MGI3FYgA_3c/R4X8GhbbC4I/AAAAAAAABec/ZrRHVq5mEXc/s72-c/VerticleRule_RegistrySnap.gif' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2149165178736128353.post-7448935707759096353</id><published>2007-11-06T09:55:00.001+04:00</published><updated>2008-07-05T13:25:34.063+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='.Net CF 2.0'/><category scheme='http://www.blogger.com/atom/ns#' term='Programming'/><category scheme='http://www.blogger.com/atom/ns#' term='Ashvin Gunga'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><category scheme='http://www.blogger.com/atom/ns#' term='.NET 2.0'/><title type='text'>Detect the presence of network connection</title><content type='html'>A simple way to detect the presence of network connection in a device (managed code):&lt;br /&gt;&lt;br /&gt;&lt;img id="BLOGGER_PHOTO_ID_5129602325287784178" style="DISPLAY: block; MARGIN: 0px auto 10px; WIDTH: 388px; CURSOR: hand; HEIGHT: 293px; TEXT-ALIGN: center" height="292" alt="" src="http://bp0.blogger.com/_MGI3FYgA_3c/RzACIxXLzvI/AAAAAAAABTk/haXUtQpig04/s400/pic13175.jpg" width="414" border="0" /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2149165178736128353-7448935707759096353?l=moiashvin-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://moiashvin-tech.blogspot.com/feeds/7448935707759096353/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2149165178736128353&amp;postID=7448935707759096353' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/7448935707759096353'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/7448935707759096353'/><link rel='alternate' type='text/html' href='http://moiashvin-tech.blogspot.com/2007/11/simple-way-to-detect-presence-of.html' title='Detect the presence of network connection'/><author><name>ashvin</name><uri>http://www.blogger.com/profile/00922391930245622789</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_MGI3FYgA_3c/Sz0gYk3D9UI/AAAAAAAACnU/k5b8SZoi0r4/S220/26122009454.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://bp0.blogger.com/_MGI3FYgA_3c/RzACIxXLzvI/AAAAAAAABTk/haXUtQpig04/s72-c/pic13175.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2149165178736128353.post-4524251949056945959</id><published>2007-10-24T22:13:00.001+04:00</published><updated>2008-07-05T13:25:09.941+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='.Net CF 2.0'/><category scheme='http://www.blogger.com/atom/ns#' term='Programming'/><category scheme='http://www.blogger.com/atom/ns#' term='Ashvin Gunga'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><category scheme='http://www.blogger.com/atom/ns#' term='Log4net'/><title type='text'>Log4net and .Net Compact Framework 1.0</title><content type='html'>&lt;div style="text-align: justify;"&gt; &lt;div style="text-align: justify;"&gt;Log4net, part of the Apache Logging Services project, can be a very helpful tool to log statements to different output targets. One of the features of log4net is the support for multiple frameworks. This post is just an extract from the Apache site that highlights the major differences of the compact version of log4net.&lt;br /&gt;&lt;br /&gt;&lt;/div&gt; Microsoft .NET Compact Framework 1.0&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;    * Assembly attributes&lt;/span&gt;&lt;br /&gt;The .NET Compact Framework 1.0 does not support retrieving assembly level attributes, therefore all log4net configuration attributes were removed from the .NET Compact Framework 1.0 version of log4net.&lt;br /&gt;&lt;br /&gt;For Smart-device applications, the log4net system can be configured by passing the location of the log4net configuration file to the log4net.Config.XmlConfigurator.Configure(FileInfo) method in the entry point of the application.&lt;br /&gt;&lt;br /&gt;For example:&lt;br /&gt;&lt;br /&gt;// Uncomment the next line to enable log4net internal debugging&lt;br /&gt;    // log4net.Util.LogLog.InternalDebugging = true;&lt;br /&gt;&lt;br /&gt;    // This will instruct log4net to look for a configuration file&lt;br /&gt;    // called config.log4net in the root directory of the device&lt;br /&gt;    log4net.Config.XmlConfigurator.Configure(new FileInfo(@"\config.log4net"));&lt;br /&gt;&lt;br /&gt;    // This will shutdown the log4net system&lt;br /&gt;    log4net.LogManager.Shutdown();&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;    * Notification events&lt;/span&gt;&lt;br /&gt;The .NET Compact Framework 1.0 does not support notification events during the application shutdown, therefore log4net cannot automatically hook the application shutdown notification.&lt;br /&gt;&lt;br /&gt;Applications will need to programmatically shutdown the log4net system during the application's shutdown using the log4net.LogManager.Shutdown() method in order to prevent losing logging events. See the code above for an example.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;   * FileSystemWatcher&lt;/span&gt;&lt;br /&gt;The .NET Compact Framework 1.0 does not support the System.IO.FileSystemWatcher class. As a result, the XmlConfiguratorAttribute.Watch property and the XmlConfigurator.ConfigureAndWatch methods are not available. Watching changes to the log4net configuration file is not supported on the .NET Compact Framework 1.0.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;  * UserName&lt;/span&gt;&lt;br /&gt;The .NET Compact Framework 1.0 does not support the System.Security.Principal.WindowsIdentity class. This is used to capture the current thread's user identity. Therefore the LoggingEvent.UserName property will return the value "NOT AVAILABLE".&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;  * Identity&lt;/span&gt;&lt;br /&gt;The .NET Compact Framework 1.0 does not support the System.Security.Principal.IPrincipal interface. This is used to capture the current thread's user identity. Therefore the LoggingEvent.Identity property will return the value "NOT AVAILABLE".&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;  * Environment variables&lt;/span&gt;&lt;br /&gt;The .NET Compact Framework 1.0 does not support retrieving environment variables, therefore it's not possible to substitute environment variables in parameter values when using the .NET Compact Framework 1.0 version of log4net.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;  * Serialization&lt;/span&gt;&lt;br /&gt;The .NET Compact Framework 1.0 does not support serialization, therefore none of the log4net classes in the .NET Compact Framework 1.0 version are serializable.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;  * LoggingEvent.Domain&lt;/span&gt;&lt;br /&gt;The .NET Compact Framework 1.0 does not support AppDomain functionality. The friendly name for the current AppDomain is stored in the LoggingEvent.Domain property and is accessed using the %a pattern of the PatternLayout. On the .NET Compact Framework 1.0 this value is generated by taking the file name for the application's primary module.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;Click &lt;a href="http://logging.apache.org/log4net/release/framework-support.html"&gt;here&lt;/a&gt; to visit the page directly.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2149165178736128353-4524251949056945959?l=moiashvin-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://moiashvin-tech.blogspot.com/feeds/4524251949056945959/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2149165178736128353&amp;postID=4524251949056945959' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/4524251949056945959'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/4524251949056945959'/><link rel='alternate' type='text/html' href='http://moiashvin-tech.blogspot.com/2007/10/log4net-and-net-compact-framework-10.html' title='Log4net and .Net Compact Framework 1.0'/><author><name>ashvin</name><uri>http://www.blogger.com/profile/00922391930245622789</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_MGI3FYgA_3c/Sz0gYk3D9UI/AAAAAAAACnU/k5b8SZoi0r4/S220/26122009454.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2149165178736128353.post-23524979574724675</id><published>2007-09-28T19:38:00.000+04:00</published><updated>2007-09-28T19:53:40.195+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Programming'/><category scheme='http://www.blogger.com/atom/ns#' term='Ashvin Gunga'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><category scheme='http://www.blogger.com/atom/ns#' term='.NET 2.0'/><title type='text'>Use of BeginUpdate() and EndUpdate() when populating ListView/TreeView</title><content type='html'>&lt;div align="justify"&gt;Often a listview control in C# needs to be populated with large amount of data (bulky operations, for example, adding 1000 items). For every item added in the Listview, the control will redraw itself, thus greatly reduce the overall performance.&lt;br /&gt;&lt;br /&gt;However, using the two methods BeginUpdate() and EndUpdate() while performing these bulk operations gives significant advantage. A call to BeginUpdate() can be made before adding/deleting/clearing items. This will stop any paint messages being sent or processed. Once the operation is done, the EndUpdate() can then be called.&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;img id="BLOGGER_PHOTO_ID_5115281032315365586" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://bp1.blogger.com/_MGI3FYgA_3c/Rv0g_zlzaNI/AAAAAAAABNY/QWGCrfffUMo/s400/Listview1.gif" border="0" /&gt;&lt;br /&gt;I have logged the time taken of the above code (i.e. adding 1000 items in a ListView for each button click) with and without the BeginUpdate/EndUpdate method calls using a test application.&lt;br /&gt;&lt;br /&gt;&lt;img id="BLOGGER_PHOTO_ID_5115281350142945506" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://bp3.blogger.com/_MGI3FYgA_3c/Rv0hSTlzaOI/AAAAAAAABNg/Xcxym_mf4E8/s400/performance1.gif" border="0" /&gt;&lt;br /&gt;The use BeginUpdate() and EndUpdate populates the control with a constant duration and much better performance. Amazing, isn't it?&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2149165178736128353-23524979574724675?l=moiashvin-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://moiashvin-tech.blogspot.com/feeds/23524979574724675/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2149165178736128353&amp;postID=23524979574724675' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/23524979574724675'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/23524979574724675'/><link rel='alternate' type='text/html' href='http://moiashvin-tech.blogspot.com/2007/09/use-of-beginupdate-and-endupdate-when.html' title='Use of BeginUpdate() and EndUpdate() when populating ListView/TreeView'/><author><name>ashvin</name><uri>http://www.blogger.com/profile/00922391930245622789</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_MGI3FYgA_3c/Sz0gYk3D9UI/AAAAAAAACnU/k5b8SZoi0r4/S220/26122009454.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://bp1.blogger.com/_MGI3FYgA_3c/Rv0g_zlzaNI/AAAAAAAABNY/QWGCrfffUMo/s72-c/Listview1.gif' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2149165178736128353.post-7844915497210837692</id><published>2007-09-20T11:33:00.000+04:00</published><updated>2007-09-20T11:44:16.138+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='.Net CF 2.0'/><category scheme='http://www.blogger.com/atom/ns#' term='Programming'/><category scheme='http://www.blogger.com/atom/ns#' term='Ashvin Gunga'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><category scheme='http://www.blogger.com/atom/ns#' term='Visual Studio'/><category scheme='http://www.blogger.com/atom/ns#' term='.NET 2.0'/><title type='text'>Write C# code for both full .NET Framework and .NET Compact Framework</title><content type='html'>&lt;div align="justify"&gt;&lt;strong&gt;Introduction&lt;/strong&gt;&lt;br /&gt;C# is fully supported on both the full .NET Framework and .NET Compact Framework and there are many times when a piece of code could have been used on both the "full framework" and "compact framework. A simple example would be the Business Logic as this would normally be the same in an enterprise project, whether the solution would be deployed on any of these platforms. I have attempted to write a simple application that addresses this issue, and I am sure there exist other ways to do this - google.com is a faithful friend :).&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;The Visual Studio Solution: FrameworkApps&lt;/strong&gt;&lt;br /&gt;There are three projects in the solution, and they are:&lt;br /&gt;&lt;br /&gt;1. BusinessLogic, a class library project, that implements the business logic;&lt;br /&gt;2. DesktopApp, a desktop application on the full .net framework platform;&lt;br /&gt;3. DeviceApp, a device application on the .net compact framework platform.&lt;br /&gt;&lt;br /&gt;The BusinessLogic.cs file is used by both the desktop and device application. Thus, any source files hould be added as links to the projects, to avoid duplicate source files.&lt;br /&gt;&lt;br /&gt;Here is a snapshot of the project structure:&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;img id="BLOGGER_PHOTO_ID_5112187330823648306" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://bp0.blogger.com/_MGI3FYgA_3c/RvIjSrb-9DI/AAAAAAAABMA/rcunWPMypRI/s400/framework1.gif" border="0" /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Conditional compilation&lt;/strong&gt;&lt;br /&gt;Conditional branching of the code at compile time is used to determine the code to be compiled during the compilation process. To achieve this, go to the desktop project properties and under the Build tab add a new "Conditional compilation symbol", say FULL_FRAMEWORK.&lt;br /&gt;&lt;br /&gt;&lt;img id="BLOGGER_PHOTO_ID_5112187249219269666" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://bp1.blogger.com/_MGI3FYgA_3c/RvIjN7b-9CI/AAAAAAAABL4/2ChtsXASW_Q/s400/framework2.gif" border="0" /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Implementation&lt;/strong&gt;&lt;br /&gt;Project: BusinessLogic&lt;br /&gt;Source file: BusinessLogic.cs&lt;br /&gt;&lt;br /&gt;&lt;img id="BLOGGER_PHOTO_ID_5112187111780316178" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://bp1.blogger.com/_MGI3FYgA_3c/RvIjF7b-9BI/AAAAAAAABLw/tfSYLSyuaUQ/s400/framework3.gif" border="0" /&gt;&lt;br /&gt;&lt;br /&gt;Project: DesktopApp&lt;br /&gt;Source file: Form.cs&lt;br /&gt;&lt;br /&gt;&lt;img id="BLOGGER_PHOTO_ID_5112187043060839426" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://bp1.blogger.com/_MGI3FYgA_3c/RvIjB7b-9AI/AAAAAAAABLo/4z0sjQ48jiA/s400/framework4.gif" border="0" /&gt;&lt;br /&gt;&lt;br /&gt;Project: DeviceApp&lt;br /&gt;Source file: Program.cs&lt;br /&gt;&lt;br /&gt;&lt;img id="BLOGGER_PHOTO_ID_5112186978636329970" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://bp2.blogger.com/_MGI3FYgA_3c/RvIi-Lb-8_I/AAAAAAAABLg/aa6ylovmRgE/s400/framework5.gif" border="0" /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Output&lt;/strong&gt;&lt;br /&gt;Set DesktopApp as the startup project and run the application:&lt;br /&gt;&lt;br /&gt;&lt;img id="BLOGGER_PHOTO_ID_5112186699463455714" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://bp1.blogger.com/_MGI3FYgA_3c/RvIit7b-8-I/AAAAAAAABLY/AjoJAj__hRo/s400/framework6.gif" border="0" /&gt;&lt;br /&gt;&lt;br /&gt;Set DeviceApp as the startup project and run the application:&lt;br /&gt;&lt;br /&gt;&lt;img id="BLOGGER_PHOTO_ID_5112186458945287122" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://bp1.blogger.com/_MGI3FYgA_3c/RvIif7b-89I/AAAAAAAABLQ/cRK6jIadGHM/s400/framework7.gif" border="0" /&gt;&lt;br /&gt;&lt;br /&gt;Hope it helps.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2149165178736128353-7844915497210837692?l=moiashvin-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://moiashvin-tech.blogspot.com/feeds/7844915497210837692/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2149165178736128353&amp;postID=7844915497210837692' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/7844915497210837692'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/7844915497210837692'/><link rel='alternate' type='text/html' href='http://moiashvin-tech.blogspot.com/2007/09/write-c-code-for-both-full-net.html' title='Write C# code for both full .NET Framework and .NET Compact Framework'/><author><name>ashvin</name><uri>http://www.blogger.com/profile/00922391930245622789</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_MGI3FYgA_3c/Sz0gYk3D9UI/AAAAAAAACnU/k5b8SZoi0r4/S220/26122009454.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://bp0.blogger.com/_MGI3FYgA_3c/RvIjSrb-9DI/AAAAAAAABMA/rcunWPMypRI/s72-c/framework1.gif' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2149165178736128353.post-8522496153713681741</id><published>2007-09-10T18:14:00.001+04:00</published><updated>2008-05-02T10:49:51.379+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Programming'/><category scheme='http://www.blogger.com/atom/ns#' term='Ashvin Gunga'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><category scheme='http://www.blogger.com/atom/ns#' term='Visual Studio'/><title type='text'>Automatic generation of XML Documentation in C# with GhostDoc</title><content type='html'>&lt;div style="TEXT-ALIGN: justify"&gt;Writing XML comments while coding in C# can be a tedious task at times. By installing GhostDoc, a free Visual Studio add-in, you can automate this process and get some additional minutes to concentrate on the code :-)&lt;br /&gt;&lt;br /&gt;&lt;span style="FONT-WEIGHT: bold"&gt;What does GhostDoc do?&lt;/span&gt;&lt;br /&gt;GhostDoc simply gives you a quick means of adding some comments to your classes/methods while you are using the editor to code in C#, by &lt;span style="FONT-STYLE: italic"&gt;guessing &lt;/span&gt;a suitable (and meaningful) comments and thus, automates the process.&lt;br /&gt;&lt;br /&gt;&lt;span style="FONT-WEIGHT: bold; FONT-STYLE: italic"&gt;Note: GhostDoc assumes that the code follows Microsoft's Design Guidelines for Class Library Developers.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;GhostDoc also includes options that allow you to modify existing rules and add additional rules that determine what kind of comments should be generated. Sounds exciting, isn't it?&lt;br /&gt;&lt;br /&gt;&lt;span style="FONT-WEIGHT: bold"&gt;What doesn't GhostDoc do?&lt;/span&gt;&lt;br /&gt;GhostDoc doesn't do miracles...&lt;br /&gt;&lt;br /&gt;GhostDoc is not a tool for creating the complete documentation for a given source file in one go. It can only document one member at a time, and you always have to check and, if necessary, correct the automated comments in order to meet match your preferred documentation.&lt;br /&gt;&lt;br /&gt;&lt;span style="FONT-WEIGHT: bold"&gt;Installation&lt;/span&gt;&lt;br /&gt;Download it from &lt;span style="FONT-WEIGHT: bold"&gt;&lt;a href="http://www.roland-weigelt.de/ghostdoc/"&gt;http://www.roland-weigelt.de/ghostdoc/&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="FONT-WEIGHT: bold"&gt;Usage&lt;/span&gt;&lt;br /&gt;While coding in the Visual Studio editor, right click on the class name, method, etc and select "&lt;span style="FONT-WEIGHT: bold"&gt;Document this&lt;/span&gt;".&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp0.blogger.com/_MGI3FYgA_3c/RuVTBRpQ1zI/AAAAAAAABKg/zYUNh5EcmlQ/s1600-h/ghostDoc.gif"&gt;&lt;img id="BLOGGER_PHOTO_ID_5108580633703143218" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: pointer; TEXT-ALIGN: center" alt="" src="http://bp0.blogger.com/_MGI3FYgA_3c/RuVTBRpQ1zI/AAAAAAAABKg/zYUNh5EcmlQ/s400/ghostDoc.gif" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;Give it a try!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2149165178736128353-8522496153713681741?l=moiashvin-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://moiashvin-tech.blogspot.com/feeds/8522496153713681741/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2149165178736128353&amp;postID=8522496153713681741' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/8522496153713681741'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/8522496153713681741'/><link rel='alternate' type='text/html' href='http://moiashvin-tech.blogspot.com/2007/09/automatic-generation-of-xml.html' title='Automatic generation of XML Documentation in C# with GhostDoc'/><author><name>ashvin</name><uri>http://www.blogger.com/profile/00922391930245622789</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_MGI3FYgA_3c/Sz0gYk3D9UI/AAAAAAAACnU/k5b8SZoi0r4/S220/26122009454.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://bp0.blogger.com/_MGI3FYgA_3c/RuVTBRpQ1zI/AAAAAAAABKg/zYUNh5EcmlQ/s72-c/ghostDoc.gif' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2149165178736128353.post-247096684414152245</id><published>2007-09-06T11:17:00.000+04:00</published><updated>2007-09-06T11:20:31.986+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='.Net CF 2.0'/><category scheme='http://www.blogger.com/atom/ns#' term='Programming'/><category scheme='http://www.blogger.com/atom/ns#' term='Ashvin Gunga'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><category scheme='http://www.blogger.com/atom/ns#' term='.NET 2.0'/><title type='text'>Millisecond component on .NET Compact Framework</title><content type='html'>&lt;div align="justify"&gt;One of the differences between full .NET Framework and .NET Compact Framework relates to the Time Intervals. The value returned from System.DateTime.Now is specific only to seconds, not milliseconds. Thus, the milliseconds component of the DateTime, usually expressed between 0 and 999 (in the full framework) will always be 0 on a compact framework platform.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Recommendation&lt;br /&gt;&lt;/strong&gt;&lt;br /&gt;Microsoft recommends the use of the TickCount property available in the Environment class in order to get a more precise time span measurement. This property returns the amount of time in milliseconds that has passed since the last time the computer was started.&lt;br /&gt;&lt;br /&gt;http://msdn2.microsoft.com/en-us/library/system.environment.tickcount(vs.80).aspx&lt;br /&gt;&lt;br /&gt;Hope it helps.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2149165178736128353-247096684414152245?l=moiashvin-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://moiashvin-tech.blogspot.com/feeds/247096684414152245/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2149165178736128353&amp;postID=247096684414152245' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/247096684414152245'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/247096684414152245'/><link rel='alternate' type='text/html' href='http://moiashvin-tech.blogspot.com/2007/09/millisecond-component-on-net-compact.html' title='Millisecond component on .NET Compact Framework'/><author><name>ashvin</name><uri>http://www.blogger.com/profile/00922391930245622789</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_MGI3FYgA_3c/Sz0gYk3D9UI/AAAAAAAACnU/k5b8SZoi0r4/S220/26122009454.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2149165178736128353.post-1886425727422178255</id><published>2007-09-03T20:12:00.000+04:00</published><updated>2007-09-03T20:29:00.464+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Programming'/><category scheme='http://www.blogger.com/atom/ns#' term='Ashvin Gunga'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><category scheme='http://www.blogger.com/atom/ns#' term='.NET 2.0'/><title type='text'>Optimal size of column headers in listview</title><content type='html'>When using a ListView in C# and the View property is set to View.Details, you probably want to set the width of the columns in the listview to an optimal size, without any … in the columns.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Problem&lt;/span&gt;&lt;br /&gt;If the column text strings does not fit the column width (set at design time), three dots (...) will be displayed at run time, as shown below.&lt;br /&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://bp2.blogger.com/_MGI3FYgA_3c/Rtw0-BpQ1xI/AAAAAAAABKQ/EtbrR_ROxNc/s400/1.gif" alt="" id="BLOGGER_PHOTO_ID_5106014317729339154" border="0" /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Aim&lt;/span&gt;&lt;br /&gt;Display the text fully in the column, and get rid of the ...&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Solutions??&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;For one moment, you may think of finding the length of the longest string in the column and assign it to the width of the column header. But wait, the length would be in terms of number of characters, whereas the width of the column should be in pixels. So, this will not work, unless you use a utility function to convert the length of the text (taking into consideration the font being used) and calculate it in terms of pixel. Yes it is possible :-) but you won't see it in this post!&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Correct Solution&lt;/span&gt;&lt;br /&gt;At runtime, set the Width of the ColumnHeader to:&lt;br /&gt;&lt;br /&gt;a)&lt;span style="font-weight: bold;"&gt; -1&lt;/span&gt; to adjust the width of the longest item in the column (without taking into consideration the column heading).&lt;br /&gt;&lt;br /&gt;hdrCountry.Width = -1;&lt;br /&gt;hdrName.Width = -1;&lt;br /&gt;&lt;br /&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://bp2.blogger.com/_MGI3FYgA_3c/Rtw03BpQ1wI/AAAAAAAABKI/lBPURk6eflg/s400/2.gif" alt="" id="BLOGGER_PHOTO_ID_5106014197470254850" border="0" /&gt;&lt;br /&gt;&lt;br /&gt;Now, the text in the columns is displayed correctly, but not the heading of the first column.&lt;br /&gt;&lt;br /&gt;b) &lt;span style="font-weight: bold;"&gt;-2&lt;/span&gt; to autosize width of the column, taking into consideration the column heading.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;hdrCountry.Width = -2;&lt;br /&gt;hdrName.Width = -2;&lt;br /&gt;&lt;br /&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://bp1.blogger.com/_MGI3FYgA_3c/Rtw0ixpQ1vI/AAAAAAAABKA/3G9WrP25zwg/s400/3.gif" alt="" id="BLOGGER_PHOTO_ID_5106013849577903858" border="0" /&gt;&lt;br /&gt;&lt;br /&gt;Now, it works fine. Hope it helps. &lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2149165178736128353-1886425727422178255?l=moiashvin-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://moiashvin-tech.blogspot.com/feeds/1886425727422178255/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2149165178736128353&amp;postID=1886425727422178255' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/1886425727422178255'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/1886425727422178255'/><link rel='alternate' type='text/html' href='http://moiashvin-tech.blogspot.com/2007/09/optimal-size-of-column-headers-in.html' title='Optimal size of column headers in listview'/><author><name>ashvin</name><uri>http://www.blogger.com/profile/00922391930245622789</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_MGI3FYgA_3c/Sz0gYk3D9UI/AAAAAAAACnU/k5b8SZoi0r4/S220/26122009454.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://bp2.blogger.com/_MGI3FYgA_3c/Rtw0-BpQ1xI/AAAAAAAABKQ/EtbrR_ROxNc/s72-c/1.gif' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2149165178736128353.post-7019992995410984963</id><published>2007-08-27T16:54:00.000+04:00</published><updated>2007-08-27T17:05:31.445+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Programming'/><category scheme='http://www.blogger.com/atom/ns#' term='Ashvin Gunga'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><category scheme='http://www.blogger.com/atom/ns#' term='.NET 2.0'/><title type='text'>Drawing a filled rectangle on a windows form</title><content type='html'>&lt;div align="justify"&gt;This is quite straight-forward. Override the OnPaint() method with the following code:&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;img id="BLOGGER_PHOTO_ID_5103364915613193890" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://bp2.blogger.com/_MGI3FYgA_3c/RtLLWhpQ1qI/AAAAAAAABJY/XTpBfzXOXLQ/s400/graphics.gif" border="0" /&gt; &lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;And it's done. A filled rectangle will be painted at the top of the form.&lt;br /&gt;&lt;br /&gt;The code is in the overridden OnPaint() method so that each time the form is resized/obscurred by another form, the content will be re-painted automatically. Also, it is a good practice to call the Dispose methods of objects that consume system resources heavily (e.g. Brush and Graphics objects). &lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2149165178736128353-7019992995410984963?l=moiashvin-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://moiashvin-tech.blogspot.com/feeds/7019992995410984963/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2149165178736128353&amp;postID=7019992995410984963' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/7019992995410984963'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/7019992995410984963'/><link rel='alternate' type='text/html' href='http://moiashvin-tech.blogspot.com/2007/08/drawing-filled-rectangle-on-windows.html' title='Drawing a filled rectangle on a windows form'/><author><name>ashvin</name><uri>http://www.blogger.com/profile/00922391930245622789</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_MGI3FYgA_3c/Sz0gYk3D9UI/AAAAAAAACnU/k5b8SZoi0r4/S220/26122009454.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://bp2.blogger.com/_MGI3FYgA_3c/RtLLWhpQ1qI/AAAAAAAABJY/XTpBfzXOXLQ/s72-c/graphics.gif' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2149165178736128353.post-7317265195436978194</id><published>2007-08-02T17:18:00.000+04:00</published><updated>2007-08-02T18:08:13.650+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Pocket PC 2003 SE Emulator'/><category scheme='http://www.blogger.com/atom/ns#' term='Ashvin Gunga'/><category scheme='http://www.blogger.com/atom/ns#' term='Visual Studio'/><category scheme='http://www.blogger.com/atom/ns#' term='Device'/><title type='text'>Cradle a device emulator and access the internet</title><content type='html'>&lt;div style="text-align: justify;"&gt;&lt;span style="font-style: italic;"&gt;Pre-requisites:&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Visual Studio 2005 is installed.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Microsoft ActiveSync 4.0 or later is installed.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;An internet connection is available.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Often a device emulator attempts to connect to the internet via the pc and the following message is encountered: &lt;span style="font-weight: bold;"&gt;Cannot Connect - Unable to connect: You have no modem entries created, and no network card present.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Here is a simple walkthrough, with some tips, describing how an emulator can be launched from Visual Studio, cradle it via ActiveSync and access a web page on the internet (obviously, provided that the PC is connected to the net).&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Step 1: Launch an emulator (say Pocket PC 2003 SE Emulator)&lt;br /&gt;&lt;br /&gt;a) Start Visual Studio 2005.&lt;br /&gt;&lt;br /&gt;b) Go to the &lt;span style="font-weight: bold;"&gt;Device Emulator Manager&lt;/span&gt; (Tools -&gt; Device Emulator Manager)&lt;br /&gt;A list of available emulators will be displayed in the Device Emulator Manager window.&lt;br /&gt;&lt;br /&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://bp1.blogger.com/_MGI3FYgA_3c/RrHi0OC6cKI/AAAAAAAABEs/nUOlW1lHlgg/s400/2.gif" alt="" id="BLOGGER_PHOTO_ID_5094102040284131490" border="0" /&gt;&lt;br /&gt;&lt;br /&gt;c) To start the emulator, right click &lt;span style="font-weight: bold;"&gt;PC 2003 SE Emulator&lt;/span&gt; and select &lt;span style="font-weight: bold;"&gt;Connect&lt;/span&gt;.&lt;br /&gt;The Emulator will start.&lt;br /&gt;&lt;br /&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://bp2.blogger.com/_MGI3FYgA_3c/RrHiSeC6cJI/AAAAAAAABEk/4P3SNsBq6o8/s400/3.gif" alt="" id="BLOGGER_PHOTO_ID_5094101460463546514" border="0" /&gt;&lt;br /&gt;&lt;br /&gt;Step 2: Attempt to browse a web page via Internet Explorer&lt;br /&gt;&lt;br /&gt;a) Launch Internet Explorer (Start -&gt; Internet Explorer) from the Device Emulator and your web page url, say enter www.google.com.&lt;br /&gt;&lt;br /&gt;The error message will be displayed: Cannot Connect - Unable to connect: You have no modem entries created, and no network card present.&lt;br /&gt;&lt;br /&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://bp3.blogger.com/_MGI3FYgA_3c/RrHh4uC6cII/AAAAAAAABEc/SQo_HPKoEL0/s400/4.gif" alt="" id="BLOGGER_PHOTO_ID_5094101018081915010" border="0" /&gt;&lt;br /&gt;&lt;br /&gt;Step 3: Cradle the emulator&lt;br /&gt;&lt;br /&gt;The emulator must be cradled (as it would have been the case for a physical device) and connect it to the PC via ActiveSync.&lt;br /&gt;&lt;br /&gt;a) To cradle the emulator, go to the &lt;span style="font-weight: bold;"&gt;Device Emulator Manager&lt;/span&gt; in Visual Studio (Tools -&gt; Device Emulator Manager).&lt;br /&gt;&lt;br /&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://bp3.blogger.com/_MGI3FYgA_3c/RrHheuC6cHI/AAAAAAAABEU/5SESA9BfJFg/s400/5.gif" alt="" id="BLOGGER_PHOTO_ID_5094100571405316210" border="0" /&gt;&lt;br /&gt;&lt;br /&gt;b) Right click on the connected emulator, and select &lt;span style="font-weight: bold;"&gt;Cradle&lt;/span&gt;.&lt;br /&gt;The emulator will now be cradled and connected to ActiveSync.&lt;br /&gt;&lt;br /&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://bp0.blogger.com/_MGI3FYgA_3c/RrHgg-C6cGI/AAAAAAAABEM/1drZNCl1JiI/s400/6.gif" alt="" id="BLOGGER_PHOTO_ID_5094099510548394082" border="0" /&gt;&lt;br /&gt;&lt;br /&gt;Step 4: Access the web page (repeat step 3)&lt;br /&gt;The Internet Explorer on the emulator will successfully browse to the web page.&lt;br /&gt;&lt;br /&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://bp1.blogger.com/_MGI3FYgA_3c/RrHf-OC6cFI/AAAAAAAABEE/FnNNcotEZ5o/s400/7.gif" alt="" id="BLOGGER_PHOTO_ID_5094098913547939922" border="0" /&gt;&lt;br /&gt; Great, isn't it?&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2149165178736128353-7317265195436978194?l=moiashvin-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://moiashvin-tech.blogspot.com/feeds/7317265195436978194/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2149165178736128353&amp;postID=7317265195436978194' title='7 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/7317265195436978194'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/7317265195436978194'/><link rel='alternate' type='text/html' href='http://moiashvin-tech.blogspot.com/2007/08/cradle-device-emulator-and-access.html' title='Cradle a device emulator and access the internet'/><author><name>ashvin</name><uri>http://www.blogger.com/profile/00922391930245622789</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_MGI3FYgA_3c/Sz0gYk3D9UI/AAAAAAAACnU/k5b8SZoi0r4/S220/26122009454.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://bp1.blogger.com/_MGI3FYgA_3c/RrHi0OC6cKI/AAAAAAAABEs/nUOlW1lHlgg/s72-c/2.gif' height='72' width='72'/><thr:total>7</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2149165178736128353.post-7885611689404172549</id><published>2007-07-22T10:33:00.000+04:00</published><updated>2007-07-22T10:47:55.492+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Ashvin Gunga'/><category scheme='http://www.blogger.com/atom/ns#' term='Windows XP'/><title type='text'>Skip 'blue' welcome screen on Windows XP</title><content type='html'>&lt;div align="justify"&gt;If you are using Windows Xp and want to get rid of the blue "Welcome" screen that shows up at startup (prompting you to select the correct user account and enter the password, if any), then this post can be useful :-) One reason for turning off this feature is that you can turn on your PC, and come back after some minutes and you are right on the desktop (ready for use). However, please bear in mind that although you are the sole user of the system, it is not recommended to do so as it simply means you are disabling the basic security feature that the operating system provides. So, be careful!&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;strong&gt;Pre-requisite:&lt;/strong&gt;&lt;/div&gt;&lt;div align="justify"&gt;You have currently logged on windows as Administrator and have admin rights.&lt;/div&gt;&lt;div align="justify"&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;&lt;strong&gt;Steps&lt;/strong&gt;&lt;br /&gt;&lt;/span&gt;1. Click &lt;strong&gt;Start&lt;/strong&gt; and then select &lt;strong&gt;Run&lt;/strong&gt;,&lt;br /&gt;2. In the Run window, type &lt;strong&gt;control userpasswords2&lt;/strong&gt;, and then click &lt;strong&gt;OK&lt;/strong&gt; button,&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;img id="BLOGGER_PHOTO_ID_5089906892323057026" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://bp3.blogger.com/_MGI3FYgA_3c/RqL7WeC6bYI/AAAAAAAAA-Y/9tP7FrOPs9s/s400/1.jpg" border="0" /&gt;&lt;br /&gt;&lt;em&gt;A User Accounts windows pops up.&lt;br /&gt;&lt;/em&gt;&lt;br /&gt;3. Clear the &lt;strong&gt;"Users must enter a user name and password to use this computer"&lt;/strong&gt; check box, and then click &lt;strong&gt;Apply&lt;/strong&gt;.&lt;br /&gt;&lt;br /&gt;&lt;img id="BLOGGER_PHOTO_ID_5089906733409267058" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://bp2.blogger.com/_MGI3FYgA_3c/RqL7NOC6bXI/AAAAAAAAA-Q/ik_2JDKI1BI/s400/2.jpg" border="0" /&gt;&lt;br /&gt;&lt;em&gt;You will be requested for the &lt;strong&gt;username and password&lt;/strong&gt; of the account you wish to automatically logon as for following reoots of your system.&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;4. In the &lt;strong&gt;Automatically Log On&lt;/strong&gt; window, type the required information and click &lt;strong&gt;OK&lt;/strong&gt; to close the window.&lt;br /&gt;5. Finally click &lt;strong&gt;OK&lt;/strong&gt; to close the User Accounts window.&lt;br /&gt;&lt;br /&gt;At any later stage, you can activate this security feature by following the same steps but recheck the box, at step 3.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2149165178736128353-7885611689404172549?l=moiashvin-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://moiashvin-tech.blogspot.com/feeds/7885611689404172549/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2149165178736128353&amp;postID=7885611689404172549' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/7885611689404172549'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/7885611689404172549'/><link rel='alternate' type='text/html' href='http://moiashvin-tech.blogspot.com/2007/07/skip-blue-welcome-screen-on-windows-xp.html' title='Skip &apos;blue&apos; welcome screen on Windows XP'/><author><name>ashvin</name><uri>http://www.blogger.com/profile/00922391930245622789</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_MGI3FYgA_3c/Sz0gYk3D9UI/AAAAAAAACnU/k5b8SZoi0r4/S220/26122009454.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://bp3.blogger.com/_MGI3FYgA_3c/RqL7WeC6bYI/AAAAAAAAA-Y/9tP7FrOPs9s/s72-c/1.jpg' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2149165178736128353.post-4631332736786567935</id><published>2007-07-13T20:02:00.000+04:00</published><updated>2007-07-13T21:56:45.262+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Programming'/><category scheme='http://www.blogger.com/atom/ns#' term='Ashvin Gunga'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><category scheme='http://www.blogger.com/atom/ns#' term='.NET 2.0'/><title type='text'>Setting transparent color to control's BackColor property</title><content type='html'>&lt;div align="justify"&gt;Using C# with .Net Framework 2.0, an attempt to assign a color from the &lt;span style="color:#330099;"&gt;System.Drawing.Color&lt;/span&gt; struct to the &lt;span style="color:#330099;"&gt;BackColor&lt;/span&gt; property of a window’s control, say a &lt;span style="color:#330099;"&gt;System.Windows.Forms.TextBox&lt;/span&gt;, will compile and run successfully.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Snippet 1:&lt;br /&gt;&lt;/strong&gt;&lt;span style="color:#330099;"&gt;textBox1.BackColor = Color.Cyan;&lt;/span&gt;&lt;br /&gt;&lt;em&gt;&lt;span style="color:#330099;"&gt;&lt;/span&gt;&lt;/em&gt;&lt;br /&gt;&lt;span style="color:#000000;"&gt;However, a problem arises when any transparent color (e.g. #00FEF2D4) is assigned to the BackColor property. Upon execution, a runtime exception will be thrown (see below).&lt;/span&gt; &lt;/div&gt;&lt;div align="justify"&gt;&lt;span style="color:#000000;"&gt;&lt;br /&gt;&lt;strong&gt;Snippet 2:&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;span style="color:#330099;"&gt;textBox1.BackColor = ColorTranslator.FromHtml("#00FEF2D4");&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;/span&gt;&lt;br /&gt;&lt;p align="justify"&gt;&lt;img id="BLOGGER_PHOTO_ID_5086713821799400930" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://bp2.blogger.com/_MGI3FYgA_3c/RpejRTZsReI/AAAAAAAAA6Q/N-S1rjLG1Mc/s400/Does+not+support.gif" border="0" /&gt;&lt;br /&gt;&lt;strong&gt;On msdn, the following explanation is given:&lt;br /&gt;&lt;/strong&gt;The &lt;span style="color:#330099;"&gt;BackColor&lt;/span&gt; property does not support transparent colors unless the &lt;span style="color:#330099;"&gt;SupportsTransparentBackColor&lt;/span&gt; value of &lt;span style="color:#330099;"&gt;System.Windows.Forms.ControlStyles&lt;/span&gt; is set to true.&lt;/p&gt;&lt;p align="justify"&gt;Using the control’s &lt;span style="color:#330099;"&gt;SetStyle()&lt;/span&gt; method, this &lt;span style="color:#330099;"&gt;SupportsTransparentBackColor&lt;/span&gt; value can be changed. The problem now is that &lt;span style="color:#330099;"&gt;SetStyle() &lt;/span&gt;is declared as a &lt;em&gt;protected&lt;/em&gt; method and thus, only the control’s class or any child class can call this method.&lt;/p&gt;&lt;p align="justify"&gt;&lt;img id="BLOGGER_PHOTO_ID_5086714560533775858" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://bp2.blogger.com/_MGI3FYgA_3c/Rpej8TZsRfI/AAAAAAAAA6Y/d26_7mzvHmA/s400/SetStyle().gif" border="0" /&gt;&lt;br /&gt;&lt;strong&gt;A quick solution&lt;br /&gt;&lt;/strong&gt;A possible solution is to create a class inheriting from the control’s class. For example, a &lt;span style="color:#330099;"&gt;TransparentTextBox&lt;/span&gt; class can inherit from the &lt;span style="color:#330099;"&gt;System.Windows.Forms.TextBox&lt;/span&gt;. Now, the protected &lt;span style="color:#330099;"&gt;SetStyle()&lt;/span&gt; method is accessible and the &lt;span style="color:#330099;"&gt;SupportsTransparentBackColor&lt;/span&gt; value can be set to true. The ideal place to call the &lt;span style="color:#330099;"&gt;SetStyle()&lt;/span&gt; method will be in the constructor of this new class after the &lt;span style="color:#330099;"&gt;InitializeComponent&lt;/span&gt;() method calls.&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;img id="BLOGGER_PHOTO_ID_5086715148944295426" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://bp3.blogger.com/_MGI3FYgA_3c/RpekejZsRgI/AAAAAAAAA6g/F71Ez6DkW_U/s400/customclass.gif" border="0" /&gt;&lt;br /&gt;&lt;p align="justify"&gt;It’s done. Now, as an instance of &lt;span style="color:#330099;"&gt;TransparentTextBox&lt;/span&gt; can be created and any transparent color can be set. &lt;/p&gt;&lt;p align="justify"&gt;&lt;strong&gt;Snippet 3:&lt;br /&gt;&lt;/strong&gt;&lt;span style="color:#330099;"&gt;transparentTextBox1.BackColor = ColorTranslator.FromHtml("#00FEF2D4"); &lt;/span&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;strong&gt;One major concern&lt;/strong&gt;: do we really want to subclass all controls that probably will need a transparent color? Think...&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2149165178736128353-4631332736786567935?l=moiashvin-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://moiashvin-tech.blogspot.com/feeds/4631332736786567935/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2149165178736128353&amp;postID=4631332736786567935' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/4631332736786567935'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/4631332736786567935'/><link rel='alternate' type='text/html' href='http://moiashvin-tech.blogspot.com/2007/07/setting-transparent-color-to-controls.html' title='Setting transparent color to control&apos;s BackColor property'/><author><name>ashvin</name><uri>http://www.blogger.com/profile/00922391930245622789</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_MGI3FYgA_3c/Sz0gYk3D9UI/AAAAAAAACnU/k5b8SZoi0r4/S220/26122009454.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://bp2.blogger.com/_MGI3FYgA_3c/RpejRTZsReI/AAAAAAAAA6Q/N-S1rjLG1Mc/s72-c/Does+not+support.gif' height='72' width='72'/><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2149165178736128353.post-6470194294580857634</id><published>2007-07-13T19:59:00.001+04:00</published><updated>2007-07-14T18:29:44.410+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Programming'/><category scheme='http://www.blogger.com/atom/ns#' term='Ashvin Gunga'/><title type='text'>Hello World</title><content type='html'>&lt;div align="justify"&gt;Hello World! Welcome to my new blog - &lt;strong&gt;ASHVIN"S TECHNICAL BLOG&lt;/strong&gt;.&lt;br /&gt;&lt;br /&gt;I started a personal blog &lt;a href="http://moiashvin.blogspot.com/"&gt;&lt;strong&gt;Ashvin Gunga&lt;/strong&gt;&lt;/a&gt; last year. Then, the idea to have another blog where I can share fwd emails popped in my mind. So, I created another one - &lt;a href="http://moiashvin-fwds.blogspot.com/"&gt;&lt;strong&gt;FWDs&lt;/strong&gt;&lt;/a&gt; - early this year. Weeks back I thought why not a technical blog - a blog where I can share anything I want related with technology, computing and programming. Now, it's up. I am writing my first post!&lt;br /&gt;&lt;br /&gt;Another post that I wrote on my personal blog and talks about the start of this new blog: &lt;a href="http://moiashvin.blogspot.com/2007/07/ashvins-technical-blog-httpmoiashvin.html"&gt;Ashvin's Technical Blog &lt;/a&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2149165178736128353-6470194294580857634?l=moiashvin-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://moiashvin-tech.blogspot.com/feeds/6470194294580857634/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2149165178736128353&amp;postID=6470194294580857634' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/6470194294580857634'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2149165178736128353/posts/default/6470194294580857634'/><link rel='alternate' type='text/html' href='http://moiashvin-tech.blogspot.com/2007/07/hello-world.html' title='Hello World'/><author><name>ashvin</name><uri>http://www.blogger.com/profile/00922391930245622789</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_MGI3FYgA_3c/Sz0gYk3D9UI/AAAAAAAACnU/k5b8SZoi0r4/S220/26122009454.jpg'/></author><thr:total>0</thr:total></entry></feed>
