<?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:blogger='http://schemas.google.com/blogger/2008' 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-8415691839245064305</id><updated>2024-10-09T07:14:58.113+05:30</updated><category term="SQL Server"/><category term="C#"/><category term="Javascript"/><category term="Silverlight"/><category term="Visual Studio"/><category term="AJAX"/><category term="Articles"/><category term="Bing"/><category term="ClearCase"/><category term="HTML5"/><category term="MSDN"/><category term="Maps"/><category term="Widget"/><category term="XML"/><title type='text'>Rajganesh Writes</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://rajganesh-mountbatton.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8415691839245064305/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://rajganesh-mountbatton.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Rajganesh Mountbatton</name><uri>http://www.blogger.com/profile/12427299066251296073</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgUurRxnxs4z-I9qkEcoO5NcEdUWxbdW2McZI45ISAVsMaxg3IDdER9UfclNeMTHc8XrH8sMI58iq74ISeRxI9TZF4oUBC2CZa4DtG7hgPjUacQoYJq-jLitd8VHU4rrDk/s220/New_Close_Up.JPG'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>18</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-8415691839245064305.post-4077145373984390568</id><published>2011-09-18T16:32:00.000+05:30</published><updated>2011-09-26T16:54:54.936+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Visual Studio"/><title type='text'>VS 2008 Setup Project Upgrade – File replacement rules for versioned and non versioned files</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEifvTcbkxIZ-eU_cz-bdin_RWl0mUyFjgDrnVq2nNJiZL4cSr9foUzMuthoDrxEwIQ4PQ8w1qjHm8CfSDjlYA-PCGmYuv4iF5DEMKxxu1jMQVBZxIF5FrrlOQk7hjUtfAu-sh8g3yJgSe2K/s1600/VS2008.bmp&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;171&quot; id=&quot;:current_picnik_image&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiw-Qac2Xkg6FDq73ODsVvLE1w1lYgTa2QUdi13EXA22CnzmKSzCbbV_Fl77whGPD1d6XvWb-hm9oscr3twNx4rauEndsp1mCKDPKGAO6nuXGX994vZjmrosK3Mrl-lAwNgaP9v6l39dyMj/s1600/16533851147_qdg4j.jpg&quot; width=&quot;200&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
Recently I ran into an interesting problem in one of a .NET Windows 
Application&#39;s Setup project. This is a .NET 3.5 application, hence used the 
visual studio 2008 setup project to build MSI installer for the application. 
While first time installation was successful, upgrade version of the setup 
project failed to update few of the files.&lt;br /&gt;
&lt;br /&gt;
After going through few MSDN link, got to know when you have an updated 
application and set RemovePreviousVersions as true in setup project “&lt;strong&gt;VS 
2005 setup project will create MSI which completely uninstalls the old version 
and reinstalls the new version&lt;/strong&gt;” but “&lt;strong&gt;VS 2008 will create MSI 
which updates the old installation based on pre defined file replacement 
rules&lt;/strong&gt;”. In simplified terms below are the rules,&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;Both the old and new files are versioned files (i.e. application’s 
executable, dll files) 
&lt;ul&gt;
&lt;li&gt;If your new file is having higher version compared to old files (e.g., old 
dll version is 1.0.0.1 and new dll version is 1.0.0.2), &lt;strong&gt;old file will be 
replaced by new file&lt;/strong&gt; 
&lt;/li&gt;
&lt;li&gt;If your new file is having same or lower version compared to old files 
(e.g., old dll version is 1.0.0.1 and new dll version is 1.0.0.0 or 1.0.0.1), 
&lt;strong&gt;old file will not be replaced by new file&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Both the old and new files are non versioned files (i.e. txt files, help 
files) 
&lt;ul&gt;
&lt;li&gt;Installer will compare the created time and the last modified time of the 
old file. If the times are not same (case when the file is modified after 
installation in users machine), &lt;strong&gt;old file will not be replaced by new 
file&lt;/strong&gt; (though your new file could be different than old file). The 
intent of this logic is to prevent Windows Installer from overwriting files that 
users have modified on their machine. 
&lt;/li&gt;
&lt;li&gt;Installer will compare the created time and the last modified time of the 
old file. If the times are same (case when user haven’t changed the file), 
&lt;strong&gt;old file will be replaced by new file&lt;/strong&gt;. &lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;
A detailed combination of the rules are given in this &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/aa367835.aspx&quot; target=&quot;_blank&quot;&gt;MSDN 
link&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
As one of my text file (non versioned) was not updated in my upgrade MSI, I 
ran the MSI with verbose log to understand how the Windows Installer treats my 
file. Below is the command to run MSI with verbose log in command prompt.&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;msiexec /i &quot;SampleInstaller.msi&quot; /l*v &quot;d:\SampleInstaller.log&quot;&lt;/code&gt;&lt;/pre&gt;
/l tells Windows Installer to create a log, * tells it to log everything and 
v tells it to use verbose mode.&lt;br /&gt;
This is the entry in log file for one of the file which failed to update.&lt;br /&gt;
&lt;blockquote&gt;
MSI (s) (60:8C) [09:48:51:735]: Executing op: 
FileCopy(SourceName=SAMPLE~1.TXT|SampleTextFile.txt,SourceCabKey=_897AF91AADD144A4A32B738927E9B501,DestName=SampleTextFile.txt,Attributes=512,FileSize=6608,PerTick=32768,,VerifyMedia=1,,,,,CheckCRC=0,,,InstallMode=58982400,,,,,,,)&lt;br /&gt;
MSI 
(s) (60:8C) [09:48:51:735]: File: C:\Program Files\Sample 
Application\SampleTextFile.txt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Won&#39;t Overwrite;&amp;nbsp;&amp;nbsp;&amp;nbsp; Won&#39;t patch;&amp;nbsp;&amp;nbsp;&amp;nbsp; Existing 
file is unversioned but modified&lt;/blockquote&gt;
The log tells that SampleTextFile.txt as “Existing file is unversioned but 
modified”, hence Windows Installer “Won&#39;t Overwrite;&amp;nbsp;&amp;nbsp;&amp;nbsp; Won&#39;t patch;”.&lt;br /&gt;
&lt;br /&gt;
Ouch, SampleTextFile.txt has been modified after it was installed, hence my 
upgrade MSI is not updating this file. What can I do to solve this?&lt;br /&gt;
&lt;br /&gt;
After googling got to know, there are no direct solutions inside Visual 
Studio (atleast to my knowledge in VS 2008). Here are the steps to follow to 
solve this issue.&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a href=&quot;http://www.softpedia.com/get/Authoring-tools/Setup-creators/Orca.shtml&quot; target=&quot;_blank&quot;&gt;Download&lt;/a&gt; ORCA, a free utility to edit the MSI packages 
&lt;/li&gt;
&lt;li&gt;Open the MSI file in ORCA editor 
&lt;/li&gt;
&lt;li&gt;Look for Property table under Tables 
&lt;/li&gt;
&lt;li&gt;Add a new property named REINSTALLMODE and set its value as amus 
&lt;/li&gt;
&lt;li&gt;Save the MSI and close ORCA&lt;/li&gt;
&lt;/ol&gt;
That&#39;s It. This property REINSTALLMODE with value amus tells the Windows 
Installer to uninstall old files and install new files &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/aa371182&quot; target=&quot;_blank&quot;&gt;irrespective of rules&lt;/a&gt; (similar to VS 2005).&lt;br /&gt;
&lt;br /&gt;
Here are the screen shots of ORCA editor.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiu2I6t9OScgbBNTet4zU46q5IIcSsUAuocXAS6EtKWn_mSXUKCVhV-CLBismw0T9WpmzUyCF902YZuipPNWCV4mjpKapGQUq4fo3atsLA-eMXP_V7c8U16FvJwroftF4DmgkkXFfcn_D7I/s1600/Blog.PNG&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiu2I6t9OScgbBNTet4zU46q5IIcSsUAuocXAS6EtKWn_mSXUKCVhV-CLBismw0T9WpmzUyCF902YZuipPNWCV4mjpKapGQUq4fo3atsLA-eMXP_V7c8U16FvJwroftF4DmgkkXFfcn_D7I/s1600/Blog.PNG&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://rajganesh-mountbatton.blogspot.com/feeds/4077145373984390568/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/8415691839245064305/4077145373984390568' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8415691839245064305/posts/default/4077145373984390568'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8415691839245064305/posts/default/4077145373984390568'/><link rel='alternate' type='text/html' href='http://rajganesh-mountbatton.blogspot.com/2011/09/vs-2008-setup-project-upgrade-file.html' title='VS 2008 Setup Project Upgrade – File replacement rules for versioned and non versioned files'/><author><name>Rajganesh Mountbatton</name><uri>http://www.blogger.com/profile/12427299066251296073</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgUurRxnxs4z-I9qkEcoO5NcEdUWxbdW2McZI45ISAVsMaxg3IDdER9UfclNeMTHc8XrH8sMI58iq74ISeRxI9TZF4oUBC2CZa4DtG7hgPjUacQoYJq-jLitd8VHU4rrDk/s220/New_Close_Up.JPG'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiw-Qac2Xkg6FDq73ODsVvLE1w1lYgTa2QUdi13EXA22CnzmKSzCbbV_Fl77whGPD1d6XvWb-hm9oscr3twNx4rauEndsp1mCKDPKGAO6nuXGX994vZjmrosK3Mrl-lAwNgaP9v6l39dyMj/s72-c/16533851147_qdg4j.jpg" height="72" width="72"/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8415691839245064305.post-572477782849002334</id><published>2011-05-30T15:54:00.001+05:30</published><updated>2011-05-31T13:11:10.828+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="HTML5"/><title type='text'>HTML5 - Canvas</title><content type='html'>&lt;p&gt;Recently got a chance to learn some of the new &lt;a href=&quot;http://dev.w3.org/html5/spec/Overview.html&quot; target=&quot;_blank&quot;&gt;HTML5 standards&lt;/a&gt;. There are lot of new features supported out of box by the browsers adapting the HTML5 syntax.&lt;/p&gt; &lt;p&gt;&lt;a href=&quot;http://diveintohtml5.org/&quot; target=&quot;_blank&quot;&gt;DIVE INTO HTML5&lt;/a&gt; is a wonderful book/tutorial on HTML5. This &lt;a href=&quot;http://net.tutsplus.com/tutorials/html-css-techniques/25-html5-features-tips-and-techniques-you-must-know/&quot; target=&quot;_blank&quot;&gt;article&lt;/a&gt;, lists out the top 28 features one must know before coding in HTML5.&lt;/p&gt; &lt;p&gt;There are many new element tags introduced by HTML5 standards. As per HTML5 standards, Canvas element is defined “&lt;em&gt;a resolution-dependent bitmap canvas which can be used for rendering graphs, game graphics, or other visual images on the fly&lt;/em&gt;”. Along with strong JavaScript support, Canvas is one of the best competitor to RIA development tools like Flash &amp;amp; Silverlight.&lt;/p&gt; &lt;p&gt;To start with HTML5 learning, I thought of migrating my &lt;a href=&quot;http://rajganesh-mountbatton.blogspot.com/2010/01/small-silverlight-puzzle-for-mix10-10k.html&quot; target=&quot;_blank&quot;&gt;MIX 10 10K coding puzzle&lt;/a&gt; developed in Silvelight to HTML5 Canvas element. Below is the puzzle displayed using Canvas element.&lt;/p&gt;&lt;iframe height=&quot;320&quot; src=&quot;http://rajganeshcanvas.appspot.com/&quot; align=&quot;left&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; width=&quot;100%&quot;&gt;   &lt;p&gt;Your browser does not support iframes.&lt;/p&gt; &lt;/iframe&gt; &lt;p&gt;The above puzzle is displayed by the below given source code.&lt;/p&gt;&lt;pre style=&quot;border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #fbfbfb; min-height: 40px; padding-left: 5px; width: 617px; padding-right: 5px; height: 309px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px&quot;&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;!DOCTYPE html&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;html&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;head&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;    &lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;title&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;Lights On&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;title&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;    &lt;span style=&quot;color: #008000&quot;&gt;&amp;lt;!--[if IE]&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;      &amp;lt;script src=&quot;http://explorercanvas.googlecode.com/svn/trunk/excanvas.js&quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;    &amp;lt;![endif]--&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;    &lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;script&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;src&lt;/span&gt;=&lt;span style=&quot;color: #0000ff&quot;&gt;&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js&quot;&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;script&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;    &lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;style&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;      #container { position: relative; background-color:#005B96; width:550px; height:280px; }   &lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;      #surface { position: relative; background-color:#ffffff; margin:9px; }   &lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;      #title {margin-left:10px; font-family:Verdana; font-size:smaller; color:White; font-weight:bold}&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;      #description {float:left; margin-left:10px; font-family:Verdana; font-size:smaller; color:White; font-weight:lighter;}&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;      #reset {float:left; margin-left:10px; font-family:Verdana; font-size:smaller; font-weight:lighter;}&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;      #clickCount {margin-left:5px; font-family:Verdana; font-size:smaller; font-weight:lighter; color:White; vertical-align:bottom;}&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;      #clickCounter {margin-left:5px; font-family:Verdana; font-size:smaller; font-weight:lighter; color:White; vertical-align:bottom;}&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;    &lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;style&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;head&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;body&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;    &lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;div&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;id&lt;/span&gt;=&lt;span style=&quot;color: #0000ff&quot;&gt;&quot;container&quot;&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;        &lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;table&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;            &lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;tr&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;                &lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;td&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;style&lt;/span&gt;=&lt;span style=&quot;color: #0000ff&quot;&gt;&quot;width:50%; vertical-align:top;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;                    &lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;span&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;id&lt;/span&gt;=&lt;span style=&quot;color: #0000ff&quot;&gt;&quot;title&quot;&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;Turn On the lights in all the cells.&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;span&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;br&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;br&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;                    &lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;span&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;id&lt;/span&gt;=&lt;span style=&quot;color: #0000ff&quot;&gt;&quot;description&quot;&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;Clicking a cell will Turn On / Off its light, as well as its Horizontal &amp;amp; Vertical adjacent cells.&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;span&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;br&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;br&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;br&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;br&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;br&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;br&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;br&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;br&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;br&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;br&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;                    &lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;input&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;type&lt;/span&gt;=&lt;span style=&quot;color: #0000ff&quot;&gt;&quot;button&quot;&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;id&lt;/span&gt;=&lt;span style=&quot;color: #0000ff&quot;&gt;&quot;reset&quot;&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;value&lt;/span&gt;=&lt;span style=&quot;color: #0000ff&quot;&gt;&quot;Restart&quot;&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;onclick&lt;/span&gt;=&lt;span style=&quot;color: #0000ff&quot;&gt;&quot;reset();&quot;&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;                    &lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;span&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;id&lt;/span&gt;=&lt;span style=&quot;color: #0000ff&quot;&gt;&quot;clickCount&quot;&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;No of Clicks: &lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;span&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;                    &lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;span&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;id&lt;/span&gt;=&lt;span style=&quot;color: #0000ff&quot;&gt;&quot;clickCounter&quot;&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;0&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;span&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;                &lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;td&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;                &lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;td&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;style&lt;/span&gt;=&lt;span style=&quot;color: #0000ff&quot;&gt;&quot;width:50%; vertical-align:middle;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;                    &lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;canvas&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;id&lt;/span&gt;=&lt;span style=&quot;color: #0000ff&quot;&gt;&quot;surface&quot;&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;Canvas is not supported&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;canvas&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt; &lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;                &lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;td&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;            &lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;tr&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;        &lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;table&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;        &lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;    &lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;div&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;    &lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;script&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;    var rowCount;&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;    var columnCount;&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;    var blockWidth;&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;    var blockHeight;&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;    var padding;    &lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;    var canvasWidth;&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;    var canvasHeight;&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;    var ctx;&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;    var blocks;&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;    var canvasLeft;&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;    var canvasTop;&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;    var clickCount;&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;    function init() {&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;        rowCount = 5;&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;        columnCount = 5;&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;        blockWidth = 50;&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;        blockHeight = 50;&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;        padding = 1;&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;        clickCount = 0;&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;        blocks = new Array(rowCount);&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;        for (i = 0; i &lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt; rowCount; i++) {&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;            blocks[i] = new Array(columnCount);&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;            for (j = 0; j &lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt; columnCount; j++) {&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;                blocks[i][j] = 0; // Set as not lighted&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;            }&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;        }&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;        &lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;        ctx = $(&#39;#surface&#39;)[0].getContext(&quot;2d&quot;);&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;        canvasWidth = ((blockWidth + padding) * columnCount) + padding;&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;        ctx.canvas.width = canvasWidth;&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;        canvasHeight = ((blockHeight + padding) * rowCount + padding);&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;        ctx.canvas.height = canvasHeight;&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;        draw();           &lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;        &lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;        canvasLeft = $(&quot;#surface&quot;).offset().left;&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;        canvasTop = $(&quot;#surface&quot;).offset().top;&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;        $(&quot;#clickCounter&quot;).text(clickCount); &lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;    }&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;    function rect(x, y, w, h) {&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;        ctx.beginPath();&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;        ctx.rect(x, y, w, h);&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;        ctx.closePath();&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;        ctx.fill();&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;    }&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;    function clear() {&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;        ctx.clearRect(0, 0, canvasWidth, canvasHeight);&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;    }&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;    function reset() {&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;        init();&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;    }&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;    function draw() {&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;        //draw blocks&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;        for (i = 0; i &lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt; rowCount; i++) {&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;            for (j = 0; j &lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt; columnCount; j++) {&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;                if (blocks[i][j] == 0) {&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;                    ctx.fillStyle = &quot;#D3D3D3&quot;;&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;                }&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;                else {&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;                    ctx.fillStyle = &quot;#FF0000&quot;;&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;                }&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;                rect((j * (blockWidth + padding)) + padding, (i * (blockHeight + padding)) + padding, blockWidth, blockHeight);&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;            }&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;        }&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;    }&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;    function onClick(e) {&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;        var x = Math.floor((e.pageX - canvasLeft) / blockWidth);&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;        var y = Math.floor((e.pageY - canvasTop) / blockHeight);&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;        var lightState;&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;        lightState = blocks[y][x] == 1 ? 0 : 1;&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;        blocks[y][x] = lightState;&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;        if (y - 1 &lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;= 0) {&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;            lightState = blocks[y - 1][x] == 1 ? 0 : 1;&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;            blocks[y - 1][x] = lightState;&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;        }&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;        if (x - 1 &amp;gt;= 0) {&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;            lightState = blocks[y][x - 1] == 1 ? 0 : 1;&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;            blocks[y][x - 1] = lightState;&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;        }&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;        if (y + 1 &lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt; rowCount) {&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;            lightState = blocks[y + 1][x] == 1 ? 0 : 1;&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;            blocks[y + 1][x] = lightState;&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;        }&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;        if (x + 1 &lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt; columnCount) {&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;            lightState = blocks[y][x + 1] == 1 ? 0 : 1;&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;            blocks[y][x + 1] = lightState;&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;        }&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;        draw();&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;        clickCount += 1;&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;        $(&quot;#clickCounter&quot;).text(clickCount);       &lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;    }        &lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;    $(document).ready(function() {&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;        init();&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;        $(&quot;#surface&quot;).click(onClick);&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;    });&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;    &lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;script&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;       &lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;body&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 11px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;html&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;/pre&gt;  </content><link rel='replies' type='application/atom+xml' href='http://rajganesh-mountbatton.blogspot.com/feeds/572477782849002334/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/8415691839245064305/572477782849002334' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8415691839245064305/posts/default/572477782849002334'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8415691839245064305/posts/default/572477782849002334'/><link rel='alternate' type='text/html' href='http://rajganesh-mountbatton.blogspot.com/2011/05/html5-canvas.html' title='HTML5 - Canvas'/><author><name>Rajganesh Mountbatton</name><uri>http://www.blogger.com/profile/12427299066251296073</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgUurRxnxs4z-I9qkEcoO5NcEdUWxbdW2McZI45ISAVsMaxg3IDdER9UfclNeMTHc8XrH8sMI58iq74ISeRxI9TZF4oUBC2CZa4DtG7hgPjUacQoYJq-jLitd8VHU4rrDk/s220/New_Close_Up.JPG'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8415691839245064305.post-3303617990984272394</id><published>2011-01-27T11:57:00.002+05:30</published><updated>2011-02-01T10:03:15.197+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Silverlight"/><title type='text'>Embedding SilverLight XAP in Blogger</title><content type='html'>I just thought of showing my simple &quot;&lt;a href=&quot;http://rajganesh-mountbatton.blogspot.com/2010/01/small-silverlight-puzzle-for-mix10-10k.html&quot;&gt;Lights On&lt;/a&gt;&quot; puzzle in my blog. I hosted my XAP file in Google sites and tried adding it in&amp;nbsp;&lt;span style=&quot;color: blue; font-size: small;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #a31515; font-size: small;&quot;&gt;object&lt;/span&gt;&lt;span style=&quot;color: blue; font-size: small;&quot;&gt;&amp;gt;&amp;nbsp;&lt;/span&gt;tag, like adding in a normal HTML file as shown below.&lt;br /&gt;
&lt;div id=&quot;codeSnippetWrapper&quot; style=&quot;background-color: #f4f4f4; border-bottom: silver 1px solid; border-left: silver 1px solid; border-right: silver 1px solid; border-top: silver 1px solid; cursor: text; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 20px 0px 10px; max-height: 200px; overflow: auto; padding-bottom: 4px; padding-left: 4px; padding-right: 4px; padding-top: 4px; text-align: left; width: 97.5%;&quot;&gt;&lt;pre id=&quot;codeSnippet&quot; style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;object&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;id&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;SL&quot;&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;data&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;data:application/x-silverlight,&quot;&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;type&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;application/x-silverlight-2&quot;&lt;/span&gt; 
&lt;span style=&quot;color: red;&quot;&gt;style&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;width: 550px; height: 280px&quot;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;param&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;name&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;source&quot;&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;value&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;https://sites.google.com/site/rajganeshmountbatton/home/blogspotdocuments/25SquarePuzzle.xap&quot;&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;/&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;param&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;name&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;minRuntimeVersion&quot;&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;value&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;3.0.40624.0&quot;&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;/&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;param&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;name&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;enableHtmlAccess&quot;&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;value&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;true&quot;&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;/&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;param&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;name&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;initParams&quot;&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;value&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;someParam=value&quot;&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;/&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;a&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;href&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;http://go.microsoft.com/fwlink/?LinkID=149156&amp;amp;v=3.0.40624.0&quot;&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;style&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;text-decoration: none;&quot;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;img&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;src&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;http://go.microsoft.com/fwlink/?LinkId=108181&quot;&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;style&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;border-style: none&quot;&lt;/span&gt;
&lt;span style=&quot;color: red;&quot;&gt;alt&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;Get Microsoft Silverlight&quot;&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;/&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;a&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;object&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;/div&gt;The above code looks good and every one expects it to work fine. But in real, it just displays a white blank SilverLight application. This is an expected behavior of SilverLight and Timheuer talks about the solution in this &lt;a href=&quot;http://timheuer.com/blog/archive/2010/06/10/troubleshooting-debugging-silverlight-cross-domain-xap-hosting.aspx&quot;&gt;link&lt;/a&gt;. &lt;br /&gt;
&lt;br /&gt;
The solution is to map proper XAP MIME Type, adding few changes in AppManifest.xml file and adding the below param tag inside the object tag as shown below. &lt;br /&gt;
&lt;br /&gt;
Below code block is the change to be done in AppManifest.xml file.&lt;div id=&quot;codeSnippetWrapper&quot; style=&quot;background-color: #f4f4f4; border-bottom: silver 1px solid; border-left: silver 1px solid; border-right: silver 1px solid; border-top: silver 1px solid; cursor: text; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 20px 0px 10px; max-height: 200px; overflow: auto; padding-bottom: 4px; padding-left: 4px; padding-right: 4px; padding-top: 4px; text-align: left; width: 97.5%;&quot;&gt;&lt;pre id=&quot;codeSnippet&quot; style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;Deployment&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;xmlns&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;http://schemas.microsoft.com/client/2007/deployment&quot;&lt;/span&gt;
&lt;span style=&quot;color: red;&quot;&gt;xmlns:x&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;http://schemas.microsoft.com/winfx/2006/xaml&quot;&lt;/span&gt;
&lt;span style=&quot;color: red;&quot;&gt;ExternalCallersFromCrossDomain&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;ScriptableOnly&quot;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;Deployment.Parts&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;Deployment.Parts&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;/span&gt;    
&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;Deployment&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0pt;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;
Param change in object tag&lt;br /&gt;
&lt;div id=&quot;codeSnippetWrapper&quot; style=&quot;background-color: #f4f4f4; border-bottom: silver 1px solid; border-left: silver 1px solid; border-right: silver 1px solid; border-top: silver 1px solid; cursor: text; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 20px 0px 10px; max-height: 200px; overflow: auto; padding-bottom: 4px; padding-left: 4px; padding-right: 4px; padding-top: 4px; text-align: left; width: 97.5%;&quot;&gt;&lt;pre id=&quot;codeSnippet&quot; style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;param&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;name&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;enableHtmlAccess&quot;&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;value&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;true&quot;&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;/div&gt;AppManifest and Param changes are in our hands and can be modified, but mapping proper MIME type for SilverLight application in Google site cannot be done. Other options are like hosting your SilverLight application in some other MIME configurable hosting provider. But there are no better free SilverLight hosting provider available. Any other options? I heard about Google app engine. So thought of trying to use app engine as host.&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0pt;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;font-family: inherit; line-height: normal; margin-bottom: 0pt;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;Here is good &lt;a href=&quot;http://weblogs.asp.net/rajbk/archive/2010/05/17/running-a-silverlight-application-in-the-google-app-engine-platform.aspx&quot;&gt;post&lt;/a&gt; about embedding SilverLight in app engine. I followed the same and hosted my application in app engine. Then changed the source attribute in the object tag to the app engine URL. What a surprise, the application worked like charm.&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;font-family: inherit; line-height: normal; margin-bottom: 0pt;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;Below is the code after hosting in the Google App Engine.&lt;/span&gt;&lt;/div&gt;&lt;div id=&quot;codeSnippetWrapper&quot; style=&quot;background-color: #f4f4f4; border-bottom: silver 1px solid; border-left: silver 1px solid; border-right: silver 1px solid; border-top: silver 1px solid; cursor: text; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 20px 0px 10px; max-height: 200px; overflow: auto; padding-bottom: 4px; padding-left: 4px; padding-right: 4px; padding-top: 4px; text-align: left; width: 97.5%;&quot;&gt;&lt;pre id=&quot;codeSnippet&quot; style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;object&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;id&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;SL&quot;&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;data&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;data:application/x-silverlight,&quot;&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;type&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;application/x-silverlight-2&quot;&lt;/span&gt; 
&lt;span style=&quot;color: red;&quot;&gt;style&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;width: 550px; height: 280px&quot;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;param&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;name&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;source&quot;&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;value&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;http://rajganeshsilverlight.appspot.com/25SquarePuzzle.xap&quot;&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;/&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;param&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;name&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;minRuntimeVersion&quot;&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;value&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;3.0.40624.0&quot;&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;/&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;param&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;name&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;enableHtmlAccess&quot;&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;value&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;true&quot;&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;/&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;param&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;name&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;initParams&quot;&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;value&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;someParam=value&quot;&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;/&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;a&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;href&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;http://go.microsoft.com/fwlink/?LinkID=149156&amp;amp;v=3.0.40624.0&quot;&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;style&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;text-decoration: none;&quot;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;img&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;src&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;http://go.microsoft.com/fwlink/?LinkId=108181&quot;&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;style&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;border-style: none&quot;&lt;/span&gt;
&lt;span style=&quot;color: red;&quot;&gt;alt&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;Get Microsoft Silverlight&quot;&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;/&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;a&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;object&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;/div&gt;&lt;span style=&quot;font-size: small;&quot;&gt;Here is the &lt;a href=&quot;http://rajganesh-mountbatton.blogspot.com/2010/01/small-silverlight-puzzle-for-mix10-10k.html&quot;&gt;link&lt;/a&gt; to my hosted SilverLight application blog. Enjoy the Light On application and try lighting up 25 squares.&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://rajganesh-mountbatton.blogspot.com/feeds/3303617990984272394/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/8415691839245064305/3303617990984272394' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8415691839245064305/posts/default/3303617990984272394'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8415691839245064305/posts/default/3303617990984272394'/><link rel='alternate' type='text/html' href='http://rajganesh-mountbatton.blogspot.com/2010/08/embedding-silverlight-xap-in-blogger.html' title='Embedding SilverLight XAP in Blogger'/><author><name>Rajganesh Mountbatton</name><uri>http://www.blogger.com/profile/12427299066251296073</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgUurRxnxs4z-I9qkEcoO5NcEdUWxbdW2McZI45ISAVsMaxg3IDdER9UfclNeMTHc8XrH8sMI58iq74ISeRxI9TZF4oUBC2CZa4DtG7hgPjUacQoYJq-jLitd8VHU4rrDk/s220/New_Close_Up.JPG'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8415691839245064305.post-883190844639316322</id><published>2010-09-01T23:30:00.000+05:30</published><updated>2010-09-01T23:30:54.099+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Bing"/><category scheme="http://www.blogger.com/atom/ns#" term="Maps"/><category scheme="http://www.blogger.com/atom/ns#" term="MSDN"/><title type='text'>Bing Maps Developer API</title><content type='html'>Good link in MSDN about the Bing Map API.&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/dd877180.aspx&quot;&gt;http://msdn.microsoft.com/en-us/library/dd877180.aspx&lt;/a&gt;</content><link rel='replies' type='application/atom+xml' href='http://rajganesh-mountbatton.blogspot.com/feeds/883190844639316322/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/8415691839245064305/883190844639316322' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8415691839245064305/posts/default/883190844639316322'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8415691839245064305/posts/default/883190844639316322'/><link rel='alternate' type='text/html' href='http://rajganesh-mountbatton.blogspot.com/2010/09/bing-maps-developer-api.html' title='Bing Maps Developer API'/><author><name>Rajganesh Mountbatton</name><uri>http://www.blogger.com/profile/12427299066251296073</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgUurRxnxs4z-I9qkEcoO5NcEdUWxbdW2McZI45ISAVsMaxg3IDdER9UfclNeMTHc8XrH8sMI58iq74ISeRxI9TZF4oUBC2CZa4DtG7hgPjUacQoYJq-jLitd8VHU4rrDk/s220/New_Close_Up.JPG'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8415691839245064305.post-2109659796955676515</id><published>2010-08-01T16:17:00.001+05:30</published><updated>2010-08-01T16:18:20.272+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Visual Studio"/><title type='text'>Visual Studio Keybinding Posters</title><content type='html'>Visual Studio team has released the shortcut keys for Visual Studio 2010 in various PDF formats.&lt;br /&gt;
&lt;br /&gt;
Here is the &lt;a href=&quot;http://www.microsoft.com/downloads/details.aspx?FamilyID=92CED922-D505-457A-8C9C-84036160639F&amp;amp;displaylang=en&quot;&gt;download link&lt;/a&gt;</content><link rel='replies' type='application/atom+xml' href='http://rajganesh-mountbatton.blogspot.com/feeds/2109659796955676515/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/8415691839245064305/2109659796955676515' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8415691839245064305/posts/default/2109659796955676515'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8415691839245064305/posts/default/2109659796955676515'/><link rel='alternate' type='text/html' href='http://rajganesh-mountbatton.blogspot.com/2010/08/visual-studio-keybinding-posters.html' title='Visual Studio Keybinding Posters'/><author><name>Rajganesh Mountbatton</name><uri>http://www.blogger.com/profile/12427299066251296073</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgUurRxnxs4z-I9qkEcoO5NcEdUWxbdW2McZI45ISAVsMaxg3IDdER9UfclNeMTHc8XrH8sMI58iq74ISeRxI9TZF4oUBC2CZa4DtG7hgPjUacQoYJq-jLitd8VHU4rrDk/s220/New_Close_Up.JPG'/></author><thr:total>0</thr:total><georss:featurename>Theni, Tamil Nadu, India</georss:featurename><georss:point>10.006377 77.472493</georss:point><georss:box>9.9641145 77.414128 10.0486395 77.530858</georss:box></entry><entry><id>tag:blogger.com,1999:blog-8415691839245064305.post-2199400997923863134</id><published>2010-01-30T18:12:00.014+05:30</published><updated>2010-08-26T18:33:54.083+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Silverlight"/><title type='text'>A Small Silverlight Puzzle for MIX10 10K Coding Challenge</title><content type='html'>&lt;div style=&quot;font-family: inherit;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;My contribution of a Small Silverlight Puzzle for MIX10 10K Coding Challenge.&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font-family: inherit;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div face=&quot;Verdana,sans-serif&quot; style=&quot;font-family: inherit;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;a href=&quot;http://mix10k.visitmix.com/Entry/Details/225&quot;&gt;http://mix10k.visitmix.com/Entry/Details/225&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font-family: inherit;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font-family: inherit;&quot;&gt;&lt;div style=&quot;font-family: inherit;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;Will upload the code once the contest completes.&lt;br /&gt;
&lt;br /&gt;
&lt;/span&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;Update 1:&lt;/b&gt; After a long break have updated the code used in this small application. You can download it &lt;a href=&quot;http://sites.google.com/site/rajganeshmountbatton/home/blogspotdocuments/25SquarePuzzle.zip&quot;&gt;here&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;span style=&quot;font-family: inherit; font-size: 10pt;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b style=&quot;font-family: inherit;&quot;&gt;Update 2:&lt;/b&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt; Tried to show that small application in Blogger, after couple of try able to show it here. Try to solve it, if you can...&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: inherit; font-size: 10pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;object data=&quot;data:application/x-silverlight-2,&quot; style=&quot;height: 280px; width: 550px;&quot; type=&quot;application/x-silverlight-2&quot;&gt;&lt;param name=&quot;source&quot; value=&quot;http://rajganeshsilverlight.appspot.com/25SquarePuzzle.xap&quot;/&gt;&lt;param name=&quot;enableHtmlAccess&quot; value=&quot;true&quot; /&gt;&lt;param name=&quot;minRuntimeVersion&quot; value=&quot;3.0.40624.0&quot; /&gt;&lt;param name=&quot;autoUpgrade&quot; value=&quot;true&quot; /&gt;&lt;a href=&quot;http://go.microsoft.com/fwlink/?LinkID=149156&amp;v=3.0.40624.0&quot; style=&quot;text-decoration: none;&quot;&gt;&lt;img src=&quot;http://go.microsoft.com/fwlink/?LinkId=108181&quot; style=&quot;border-style: none&quot; alt=&quot;Get Microsoft Silverlight&quot; /&gt;&lt;/a&gt; &lt;/object&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rajganesh-mountbatton.blogspot.com/feeds/2199400997923863134/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/8415691839245064305/2199400997923863134' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8415691839245064305/posts/default/2199400997923863134'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8415691839245064305/posts/default/2199400997923863134'/><link rel='alternate' type='text/html' href='http://rajganesh-mountbatton.blogspot.com/2010/01/small-silverlight-puzzle-for-mix10-10k.html' title='A Small Silverlight Puzzle for MIX10 10K Coding Challenge'/><author><name>Rajganesh Mountbatton</name><uri>http://www.blogger.com/profile/12427299066251296073</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgUurRxnxs4z-I9qkEcoO5NcEdUWxbdW2McZI45ISAVsMaxg3IDdER9UfclNeMTHc8XrH8sMI58iq74ISeRxI9TZF4oUBC2CZa4DtG7hgPjUacQoYJq-jLitd8VHU4rrDk/s220/New_Close_Up.JPG'/></author><thr:total>0</thr:total><georss:featurename>Theni, Tamil Nadu, India</georss:featurename><georss:point>10.006377 77.472493</georss:point><georss:box>9.9641145 77.414128 10.0486395 77.530858</georss:box></entry><entry><id>tag:blogger.com,1999:blog-8415691839245064305.post-6770340966096925167</id><published>2009-04-13T12:02:00.004+05:30</published><updated>2009-04-13T12:08:33.361+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="SQL Server"/><title type='text'>Searching Stored Procedures &amp; Functions based on the text</title><content type='html'>&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;The below script is used to get the list of Stored Procedures based on their text.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;meta content=&quot;text/html; charset=utf-8&quot; http-equiv=&quot;Content-Type&quot;&gt;&lt;/meta&gt;&lt;meta content=&quot;Word.Document&quot; name=&quot;ProgId&quot;&gt;&lt;/meta&gt;&lt;meta content=&quot;Microsoft Word 11&quot; name=&quot;Generator&quot;&gt;&lt;/meta&gt;&lt;meta content=&quot;Microsoft Word 11&quot; name=&quot;Originator&quot;&gt;&lt;/meta&gt;&lt;link href=&quot;file:///C:%5CDOCUME%7E1%5Ce335972%5CLOCALS%7E1%5CTemp%5Cmsohtml1%5C01%5Cclip_filelist.xml&quot; rel=&quot;File-List&quot;&gt;&lt;/link&gt;&lt;style&gt;
&lt;!--
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
	{mso-style-parent:&quot;&quot;;
	margin:0in;
	margin-bottom:.0001pt;
	mso-pagination:widow-orphan;
	font-size:12.0pt;
	font-family:&quot;Times New Roman&quot;;
	mso-fareast-font-family:&quot;Times New Roman&quot;;}
@page Section1
	{size:8.5in 11.0in;
	margin:1.0in 1.25in 1.0in 1.25in;
	mso-header-margin:.5in;
	mso-footer-margin:.5in;
	mso-paper-source:0;}
div.Section1
	{page:Section1;}
--&gt;
&lt;/style&gt;  &lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;color: blue; font-family: &amp;quot;Courier New&amp;quot;; font-size: small;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: small;&quot;&gt; &lt;span style=&quot;color: grey;&quot;&gt;*&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;FROM&lt;/span&gt; &lt;span style=&quot;color: green;&quot;&gt;INFORMATION_SCHEMA.ROUTINES&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;WHERE&lt;/span&gt; ROUTINE_TYPE &lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;&#39;PROCEDURE&#39;&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;AND&lt;/span&gt; ROUTINE_DEFINITION &lt;span style=&quot;color: grey;&quot;&gt;LIKE&lt;/span&gt; &lt;/span&gt;&lt;meta content=&quot;text/html; charset=utf-8&quot; http-equiv=&quot;Content-Type&quot;&gt;&lt;/meta&gt;&lt;meta content=&quot;Word.Document&quot; name=&quot;ProgId&quot;&gt;&lt;/meta&gt;&lt;meta content=&quot;Microsoft Word 11&quot; name=&quot;Generator&quot;&gt;&lt;/meta&gt;&lt;meta content=&quot;Microsoft Word 11&quot; name=&quot;Originator&quot;&gt;&lt;/meta&gt;&lt;link href=&quot;file:///C:%5CDOCUME%7E1%5Ce335972%5CLOCALS%7E1%5CTemp%5Cmsohtml1%5C01%5Cclip_filelist.xml&quot; rel=&quot;File-List&quot;&gt;&lt;/link&gt;&lt;style&gt;
&lt;!--
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
	{mso-style-parent:&quot;&quot;;
	margin:0in;
	margin-bottom:.0001pt;
	mso-pagination:widow-orphan;
	font-size:12.0pt;
	font-family:&quot;Times New Roman&quot;;
	mso-fareast-font-family:&quot;Times New Roman&quot;;}
@page Section1
	{size:8.5in 11.0in;
	margin:1.0in 1.25in 1.0in 1.25in;
	mso-header-margin:.5in;
	mso-footer-margin:.5in;
	mso-paper-source:0;}
div.Section1
	{page:Section1;}
--&gt;
&lt;/style&gt;&lt;span style=&quot;color: red; font-family: &amp;quot;Courier New&amp;quot;; font-size: small;&quot;&gt;&#39;Text To Be Searched&#39;&lt;/span&gt;&lt;/div&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;To search for the functions, the &lt;b&gt;ROUTINE_TYPE&lt;/b&gt; needs to be changed to &lt;b&gt;FUNCTION&lt;/b&gt; as shown below.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;style&gt;
*/
 p.MsoNormal, li.MsoNormal, div.MsoNormal
	{mso-style-parent:&quot;&quot;;
	margin:0in;
	margin-bottom:.0001pt;
	mso-pagination:widow-orphan;
	font-size:12.0pt;
	font-family:&quot;Times New Roman&quot;;
	mso-fareast-font-family:&quot;Times New Roman&quot;;}
@page Section1
	{size:8.5in 11.0in;
	margin:1.0in 1.25in 1.0in 1.25in;
	mso-header-margin:.5in;
	mso-footer-margin:.5in;
	mso-paper-source:0;}
div.Section1
	{page:Section1;}
--&gt;
&lt;/style&gt;  &lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;color: blue; font-family: &amp;quot;Courier New&amp;quot;; font-size: small;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: small;&quot;&gt; &lt;span style=&quot;color: grey;&quot;&gt;*&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;FROM&lt;/span&gt; &lt;span style=&quot;color: green;&quot;&gt;INFORMATION_SCHEMA.ROUTINES&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;WHERE&lt;/span&gt; ROUTINE_TYPE &lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;&#39;FUNCTION&#39;&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;AND&lt;/span&gt; ROUTINE_DEFINITION &lt;span style=&quot;color: grey;&quot;&gt;LIKE&lt;/span&gt; &lt;/span&gt;&lt;meta content=&quot;text/html; charset=utf-8&quot; http-equiv=&quot;Content-Type&quot;&gt;&lt;/meta&gt;&lt;meta content=&quot;Word.Document&quot; name=&quot;ProgId&quot;&gt;&lt;/meta&gt;&lt;meta content=&quot;Microsoft Word 11&quot; name=&quot;Generator&quot;&gt;&lt;/meta&gt;&lt;meta content=&quot;Microsoft Word 11&quot; name=&quot;Originator&quot;&gt;&lt;/meta&gt;&lt;link href=&quot;file:///C:%5CDOCUME%7E1%5Ce335972%5CLOCALS%7E1%5CTemp%5Cmsohtml1%5C01%5Cclip_filelist.xml&quot; rel=&quot;File-List&quot;&gt;&lt;/link&gt;&lt;style&gt;
&lt;!--
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
	{mso-style-parent:&quot;&quot;;
	margin:0in;
	margin-bottom:.0001pt;
	mso-pagination:widow-orphan;
	font-size:12.0pt;
	font-family:&quot;Times New Roman&quot;;
	mso-fareast-font-family:&quot;Times New Roman&quot;;}
@page Section1
	{size:8.5in 11.0in;
	margin:1.0in 1.25in 1.0in 1.25in;
	mso-header-margin:.5in;
	mso-footer-margin:.5in;
	mso-paper-source:0;}
div.Section1
	{page:Section1;}
--&gt;
&lt;/style&gt;&lt;span style=&quot;color: red; font-family: &amp;quot;Courier New&amp;quot;; font-size: small;&quot;&gt;&#39;Text To Be Searched&#39;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
</content><link rel='replies' type='application/atom+xml' href='http://rajganesh-mountbatton.blogspot.com/feeds/6770340966096925167/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/8415691839245064305/6770340966096925167' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8415691839245064305/posts/default/6770340966096925167'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8415691839245064305/posts/default/6770340966096925167'/><link rel='alternate' type='text/html' href='http://rajganesh-mountbatton.blogspot.com/2009/04/searching-stored-procedures-functions.html' title='Searching Stored Procedures &amp; Functions based on the text'/><author><name>Rajganesh Mountbatton</name><uri>http://www.blogger.com/profile/12427299066251296073</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgUurRxnxs4z-I9qkEcoO5NcEdUWxbdW2McZI45ISAVsMaxg3IDdER9UfclNeMTHc8XrH8sMI58iq74ISeRxI9TZF4oUBC2CZa4DtG7hgPjUacQoYJq-jLitd8VHU4rrDk/s220/New_Close_Up.JPG'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8415691839245064305.post-6131532105671495528</id><published>2008-12-05T15:56:00.004+05:30</published><updated>2008-12-05T16:16:00.838+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Articles"/><category scheme="http://www.blogger.com/atom/ns#" term="C#"/><title type='text'>Accessing the GAL (Global Address List) from ASP.NET</title><content type='html'>&lt;span style=&quot;font-size:100%;&quot;&gt;Yesterday I have written an article in CodeProject. The article&#39;s link is&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://www.codeproject.com/KB/exchange/AccessGAL.aspx&quot;&gt;http://www.codeproject.com/KB/exchange/AccessGAL.aspx&lt;/a&gt;&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://rajganesh-mountbatton.blogspot.com/feeds/6131532105671495528/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/8415691839245064305/6131532105671495528' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8415691839245064305/posts/default/6131532105671495528'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8415691839245064305/posts/default/6131532105671495528'/><link rel='alternate' type='text/html' href='http://rajganesh-mountbatton.blogspot.com/2008/12/accessing-gal-global-address-list-from.html' title='Accessing the GAL (Global Address List) from ASP.NET'/><author><name>Rajganesh Mountbatton</name><uri>http://www.blogger.com/profile/12427299066251296073</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgUurRxnxs4z-I9qkEcoO5NcEdUWxbdW2McZI45ISAVsMaxg3IDdER9UfclNeMTHc8XrH8sMI58iq74ISeRxI9TZF4oUBC2CZa4DtG7hgPjUacQoYJq-jLitd8VHU4rrDk/s220/New_Close_Up.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8415691839245064305.post-5064127870529352476</id><published>2008-09-10T09:06:00.013+05:30</published><updated>2008-09-10T10:12:06.463+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="ClearCase"/><title type='text'>Migrating Visual Studio.NET project from VisualSourceSafe to ClearCase while retaining history</title><content type='html'>&lt;span style=&quot;font-size:100%;&quot;&gt;&lt;a style=&quot;font-family: verdana;&quot; href=&quot;http://www-01.ibm.com/support/docview.wss?rs=0&amp;amp;uid=swg21222507&quot;&gt;This&lt;/a&gt;&lt;span style=&quot;font-family:verdana;&quot;&gt; article by IBM has a complete description of migrating the .NET project which is currently under the VSS to ClearCase with history. But still it doesn&#39;t much explain about exporting the project / solution from VSS and importing back to the ClearCase by using the &lt;b&gt;clearexport_ssafe&lt;/b&gt; and &lt;b&gt;clearimport&lt;/b&gt;. The below given section explains them better.&lt;br /&gt;&lt;br /&gt;To export the project&#39;s / solution&#39;s information along with history we need to use the clearexport_ssafe command in the DOS prompt. &lt;a href=&quot;http://publib.boulder.ibm.com/infocenter/cchelp/v7r0m0/index.jsp?topic=/com.ibm.rational.clearcase.books.cc_admin.doc/import-export.htm&quot;&gt;This&lt;/a&gt; article explains about the same, but still it doesn&#39;t have any sample to explain. The below given sample batch file explains it better.&lt;br /&gt;&lt;br /&gt;This is the batch file commands, which I used when migrating one of my .net project from VSS to ClearCase.&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;SET PATH=%PATH%;C:\Program Files\Microsoft Visual SourceSafe;(The loaction of the SS.exe in the machine)&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;SET SSDIR=\\NetwrokVSSDatabaseLocation\VSS DatabaseName (eg., \\TestLocation\TestDatabaseName)&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;SET SSUSER= VSS User Name (This user should be created in VSS database with blank password)&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;SS CP $/VSSProjectLocation (eg., $/TestProject)&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;clearexport_ssafe -r &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Running the above batch file, will generate a file in the same folder with the name &quot;cvt_data&quot;. This is the file having the complete VSS project data with history.&lt;br /&gt;&lt;br /&gt;Then while importing the data back to ClearCase, the command used is&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;clearimport -pcase &quot;cvt_data file location&quot;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;This command should be executed in DOS prompt in the location of VOB where you need to move your data. Consider your project&#39;s VOB is mapped to Z: directory in your machine and your project&#39;s VOB name is TestVOB. Then you chould first change the directory to &quot;Z:\TestVOB\FolderName&quot;. Then execute the above command with the correct CVT_Data file location.&lt;br /&gt;&lt;br /&gt;In the above command the switch -pcase is used to tell import utility to preserve the case of the files while importing. If this attribute is missed, by default clearimport will import the files with all lowercase letters.&lt;br /&gt;&lt;br /&gt;If you are not the VOB owner, then running the above command will give you a &quot;&lt;span style=&quot;font-weight: bold;&quot;&gt;Permission Denied&lt;/span&gt;&quot; error. To avoid this run the command with the switch -nsetevent, like shown below&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-weight: bold;font-size:100%;&quot; &gt;&lt;span style=&quot;font-family:verdana;&quot;&gt;clearimport &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-weight: bold;font-size:100%;&quot; &gt;&lt;span style=&quot;font-family:verdana;&quot;&gt;-nsetevent &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-weight: bold;font-size:100%;&quot; &gt;&lt;span style=&quot;font-family:verdana;&quot;&gt;-pcase &quot;cvt_data file location&quot;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;This will import the files exported using the &lt;span style=&quot;font-size:100%;&quot;&gt;&lt;span style=&quot;font-family:verdana;&quot;&gt;&quot;clearexport_ssafe&quot; command. Now your VOB would be having the complete VSS project&#39;s data along with history.&lt;br /&gt;&lt;br /&gt;References:&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;a href=&quot;http://www-01.ibm.com/support/docview.wss?rs=0&amp;amp;uid=swg21222507&quot;&gt;http://www-01.ibm.com/support/docview.wss?rs=0&amp;amp;uid=swg21222507&lt;/a&gt;&lt;br /&gt;&lt;a href=&quot;http://publib.boulder.ibm.com/infocenter/cchelp/v7r0m0/index.jsp?topic=/com.ibm.rational.clearcase.books.cc_admin.doc/import-export.htm&quot;&gt;http://publib.boulder.ibm.com/infocenter/cchelp/v7r0m0/index.jsp?topic=/com.ibm.rational.clearcase.books.cc_admin.doc/import-export.htm&lt;/a&gt;&lt;br /&gt;&lt;a href=&quot;http://www.astrainfotech.com/rsdc-2006-dilip.pdf&quot;&gt;http://www.astrainfotech.com/rsdc-2006-dilip.pdf&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-size:100%;&quot;&gt;&lt;span style=&quot;font-family:verdana;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://rajganesh-mountbatton.blogspot.com/feeds/5064127870529352476/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/8415691839245064305/5064127870529352476' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8415691839245064305/posts/default/5064127870529352476'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8415691839245064305/posts/default/5064127870529352476'/><link rel='alternate' type='text/html' href='http://rajganesh-mountbatton.blogspot.com/2008/09/migrating-visual-studionet-project-from.html' title='Migrating Visual Studio.NET project from VisualSourceSafe to ClearCase while retaining history'/><author><name>Rajganesh Mountbatton</name><uri>http://www.blogger.com/profile/12427299066251296073</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgUurRxnxs4z-I9qkEcoO5NcEdUWxbdW2McZI45ISAVsMaxg3IDdER9UfclNeMTHc8XrH8sMI58iq74ISeRxI9TZF4oUBC2CZa4DtG7hgPjUacQoYJq-jLitd8VHU4rrDk/s220/New_Close_Up.JPG'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8415691839245064305.post-6717701928813563489</id><published>2008-07-29T14:37:00.011+05:30</published><updated>2008-07-30T11:39:54.439+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Widget"/><title type='text'>Label Chart Widget for blogger - Using Google Charts API</title><content type='html'>&lt;span style=&quot;font-size:100%;&quot;&gt;Are you interested in showing your blogs label count as a chart, like the one available in my blog? Then follow the below and you can achieve it by some scripts and the Google Chart API.&lt;br /&gt;
&lt;br /&gt;
If you are not familiar with Google Chart API, then check it &lt;a href=&quot;http://code.google.com/apis/chart/&quot;&gt;here.&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Then the script for the Widget is as follows.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b:widget id=&#39;LabelChart&#39; locked=&#39;false&#39; title=&#39;Label Chart&#39; type=&#39;Label&#39;&amp;gt;&lt;br /&gt;
&amp;lt;b:includable id=&#39;main&#39;&amp;gt;&lt;br /&gt;
&amp;lt;b:if cond=&#39;data:title&#39;&amp;gt;&lt;br /&gt;
&amp;lt;h2&amp;gt;&amp;lt;data:title/&amp;gt;&amp;lt;/h2&amp;gt;&lt;br /&gt;
&amp;lt;/b:if&amp;gt;&lt;br /&gt;
&amp;lt;div class=&#39;widget-content&#39;&amp;gt;&lt;br /&gt;
&amp;lt;div id=&#39;LabelChartDiv&#39;/&amp;gt;&lt;br /&gt;
&amp;lt;script type=&#39;text/javascript&#39;&amp;gt;&lt;br /&gt;
var LabelArray = new Object;&lt;br /&gt;
var i=0;&lt;br /&gt;
&amp;lt;b:loop values=&#39;data:labels&#39; var=&#39;label&#39;&amp;gt;&lt;br /&gt;
var LabelName = &quot;&amp;lt;data:label.name/&amp;gt;&quot;;&lt;br /&gt;
LabelArray[LabelName] = &amp;lt;data:label.count/&amp;gt;;&lt;br /&gt;
i++&lt;br /&gt;
&amp;lt;/b:loop&amp;gt;&lt;br /&gt;
var LabelChartDivObj = document.getElementById(&#39;LabelChartDiv&#39;);&lt;br /&gt;
var ChartLocation = &#39;http://chart.apis.google.com/chart?chs=230x75&amp;amp;chd=t:&#39;;&lt;br /&gt;
var j=0;&lt;br /&gt;
for (LabelCount in LabelArray)&lt;br /&gt;
{&lt;br /&gt;
j++;&lt;br /&gt;
if(j&amp;lt;i)&lt;br /&gt;
{&lt;br /&gt;
ChartLocation = ChartLocation + LabelArray[LabelCount] + &#39;,&#39;;&lt;br /&gt;
}&lt;br /&gt;
else&lt;br /&gt;
{&lt;br /&gt;
ChartLocation = ChartLocation + LabelArray[LabelCount];&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
ChartLocation = ChartLocation + &#39;&amp;amp;cht=p&amp;amp;chl=&#39;;&lt;br /&gt;
j=0;&lt;br /&gt;
for (LabelCount1 in LabelArray)&lt;br /&gt;
{&lt;br /&gt;
j++;&lt;br /&gt;
if(j&amp;lt;i)&lt;br /&gt;
{&lt;br /&gt;
ChartLocation = ChartLocation + escape(LabelCount1) + &#39;[&#39;+ LabelArray[LabelCount1] + &#39;]|&#39;;&lt;br /&gt;
}&lt;br /&gt;
else&lt;br /&gt;
{&lt;br /&gt;
ChartLocation = ChartLocation + escape(LabelCount1) + &#39;[&#39;+ LabelArray[LabelCount1] + &#39;]&#39;;&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
LabelChartDivObj.innerHTML = &#39;&amp;lt;img src=&#39; + ChartLocation + &#39;&amp;gt;&#39;;&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/b:includable&amp;gt;&lt;br /&gt;
&amp;lt;/b:widget&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To add the above widget script, you need to go to your blogger &#39;Dashboard&#39;. Then go for &#39;Layout&#39; and &#39;Edit HTML&#39; as shown in the below image.&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;font-size:100%;&quot;&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgGxOs5hzof-cSb4sl8cmvXjYMkWyYRos1LpPNssTUtKMy3ebw5ZvX9zjmuhIho-4R1XySy64hZ13f6-yRW2LmJ8zd-vzgIkZPIkP3kcCgwM4sVVregDrEN1YQn9o_I8yArSgjjYG2hAQtf/s1600-h/Edit+HTML.bmp&quot;&gt;&lt;img style=&quot;cursor: pointer;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgGxOs5hzof-cSb4sl8cmvXjYMkWyYRos1LpPNssTUtKMy3ebw5ZvX9zjmuhIho-4R1XySy64hZ13f6-yRW2LmJ8zd-vzgIkZPIkP3kcCgwM4sVVregDrEN1YQn9o_I8yArSgjjYG2hAQtf/s400/Edit+HTML.bmp&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5228372355217182738&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;span style=&quot;font-size:100%;&quot;&gt;Then go for &#39;Edit Template&#39; section and check the &#39;&lt;label for=&quot;expandWidgets&quot;&gt;Expand Widget Templates&#39; checkbox.&lt;/label&gt;&lt;br /&gt;
&lt;br /&gt;
Now copy the above script and paste it in your template code near your normal label widget. You can find this by searching the below script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b:widget id=&quot;&#39;Label1&#39;&quot; locked=&quot;&#39;false&#39;&quot; title=&quot;&#39;Labels&#39;&quot; type=&quot;&#39;Label&#39;&quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: ID of the widget will not be same, it can be different.&lt;br /&gt;
&lt;br /&gt;
The Label widget will be having some standard code and will be end with &amp;lt;/b:widget&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Now you paste the above copied code below this end line and save your template.&lt;br /&gt;
&lt;br /&gt;
Thats all. You have made a colorful chart displaying your label counts.&lt;br /&gt;
&lt;br /&gt;
Caution: Before editing your template, always take a copy of your old template. If some thing goes wrong while editing you can always revert back.&lt;br /&gt;
&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://rajganesh-mountbatton.blogspot.com/feeds/6717701928813563489/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/8415691839245064305/6717701928813563489' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8415691839245064305/posts/default/6717701928813563489'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8415691839245064305/posts/default/6717701928813563489'/><link rel='alternate' type='text/html' href='http://rajganesh-mountbatton.blogspot.com/2008/07/label-chart-widget-for-blogger-using.html' title='Label Chart Widget for blogger - Using Google Charts API'/><author><name>Rajganesh Mountbatton</name><uri>http://www.blogger.com/profile/12427299066251296073</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgUurRxnxs4z-I9qkEcoO5NcEdUWxbdW2McZI45ISAVsMaxg3IDdER9UfclNeMTHc8XrH8sMI58iq74ISeRxI9TZF4oUBC2CZa4DtG7hgPjUacQoYJq-jLitd8VHU4rrDk/s220/New_Close_Up.JPG'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgGxOs5hzof-cSb4sl8cmvXjYMkWyYRos1LpPNssTUtKMy3ebw5ZvX9zjmuhIho-4R1XySy64hZ13f6-yRW2LmJ8zd-vzgIkZPIkP3kcCgwM4sVVregDrEN1YQn9o_I8yArSgjjYG2hAQtf/s72-c/Edit+HTML.bmp" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8415691839245064305.post-2841846648558994955</id><published>2008-07-28T10:28:00.013+05:30</published><updated>2008-07-28T11:51:57.081+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="AJAX"/><category scheme="http://www.blogger.com/atom/ns#" term="Javascript"/><title type='text'>ASP .NET AJAX Timer control : Processing client script on Tick event</title><content type='html'>&lt;span style=&quot;color: rgb(0, 0, 0); font-size: 100%;&quot;&gt;&lt;a href=&quot;http://www.asp.net/AJAX/Documentation/Live/tutorials/IntroToTimerControl.aspx&quot; style=&quot;font-family: inherit;&quot;&gt;Timer&lt;/a&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt; Control is a very handy ASP.NET AJAX Extension control used to &#39;Performs asynchronous or synchronous Web page postbacks at a defined interval&#39;.&lt;/span&gt;&lt;br style=&quot;font-family: inherit;&quot; /&gt; &lt;br style=&quot;font-family: inherit;&quot; /&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt; This control has good set of features associated with it. But still i feel there is no option to process the client scripts on the Timer&#39;s Tick event.&lt;/span&gt;&lt;br style=&quot;font-family: inherit;&quot; /&gt; &lt;br style=&quot;font-family: inherit;&quot; /&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt; The below given script explains a  workaround  to the above issue.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span style=&quot;color: green;&quot;&gt;// Access the Timer control.&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;var&lt;/span&gt; TestTimer = $find(&lt;span style=&quot;color: maroon;&quot;&gt;&#39;&amp;lt;%= TestTimer.ClientID %&amp;gt;&#39;&lt;/span&gt;);&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span style=&quot;color: green;&quot;&gt;/* Override the &#39;_doPostback&#39; (method called to fire the server Tick event) &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span style=&quot;color: green;&quot;&gt;&lt;span&gt;    &lt;/span&gt;method with your own function. */&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;TestTimer._doPostback = TimerTick;&lt;span&gt;        &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span style=&quot;color: green;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span style=&quot;color: green;&quot;&gt;// Overridden Timer Tick Function&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;function&lt;/span&gt; TimerTick()&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;{&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span&gt;    &lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;// Here this is called on every timer tick event..&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span&gt;    &lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;// So do your client processing here..&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span&gt;    &lt;/span&gt;alert(&lt;span style=&quot;color: maroon;&quot;&gt;&#39;Timer Client Click&#39;&lt;/span&gt;);&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; face=&quot;courier new&quot; style=&quot;margin: 0in 0in 0pt; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span&gt;    &lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;// Finally do the async postback..&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; face=&quot;courier new&quot; style=&quot;margin: 0in 0in 0pt; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span&gt;    &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;var&lt;/span&gt; ClientTimerId = &lt;span style=&quot;color: maroon;&quot;&gt;&#39;&amp;lt;%= tAutoSave.ClientID %&amp;gt;&#39;&lt;/span&gt;;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; face=&quot;courier new&quot; style=&quot;margin: 0in 0in 0pt; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span&gt;    &lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;// Now call the Asyncpost back method..&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; face=&quot;courier new&quot; style=&quot;margin: 0in 0in 0pt; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span&gt;    &lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;// Replace the client id&#39;s with the Unique Id..&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; face=&quot;courier new&quot; style=&quot;margin: 0in 0in 0pt; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span&gt;    &lt;/span&gt;__doAsyncPostBack(TestTimer, ClientTimerId.replace(/\_/g, &lt;span style=&quot;color: maroon;&quot;&gt;&#39;$&#39;&lt;/span&gt;),&lt;span style=&quot;color: maroon;&quot;&gt;&#39;&#39;&lt;/span&gt;);&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; face=&quot;courier new&quot; style=&quot;margin: 0in 0in 0pt; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;}&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; face=&quot;courier new&quot; style=&quot;margin: 0in 0in 0pt; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span style=&quot;color: green;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; face=&quot;courier new&quot; style=&quot;margin: 0in 0in 0pt; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span style=&quot;color: green;&quot;&gt;// Method to do async post back..&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; face=&quot;courier new&quot; style=&quot;margin: 0in 0in 0pt; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;function&lt;/span&gt; __doAsyncPostBack(sourceElement, eventTarget, eventArgument)&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; face=&quot;courier new&quot; style=&quot;margin: 0in 0in 0pt; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;{&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; face=&quot;courier new&quot; style=&quot;margin: 0in 0in 0pt; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span&gt;    &lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;// Here we need to do an async post back...&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; face=&quot;courier new&quot; style=&quot;margin: 0in 0in 0pt; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span&gt;    &lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;// Get the Form&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; face=&quot;courier new&quot; style=&quot;margin: 0in 0in 0pt; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span&gt;    &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;var&lt;/span&gt; form = Sys.WebForms.PageRequestManager.getInstance()._form;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; face=&quot;courier new&quot; style=&quot;margin: 0in 0in 0pt; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span&gt;    &lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;// Set Event target and the event arguments..&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; face=&quot;courier new&quot; style=&quot;margin: 0in 0in 0pt; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span&gt;    &lt;/span&gt;form.__EVENTTARGET.value = eventTarget;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; face=&quot;courier new&quot; style=&quot;margin: 0in 0in 0pt; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span&gt;    &lt;/span&gt;form.__EVENTARGUMENT.value = eventArgument;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; face=&quot;courier new&quot; style=&quot;margin: 0in 0in 0pt; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span&gt;    &lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;// Set the async post back as true..&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; face=&quot;courier new&quot; style=&quot;margin: 0in 0in 0pt; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span&gt;    &lt;/span&gt;Sys.WebForms.PageRequestManager.getInstance()._postBackSettings.async = &lt;span style=&quot;color: blue;&quot;&gt;true&lt;/span&gt;;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; face=&quot;courier new&quot; style=&quot;margin: 0in 0in 0pt; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span&gt;    &lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;// Set source element..&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; face=&quot;courier new&quot; style=&quot;margin: 0in 0in 0pt; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span&gt;    &lt;/span&gt;Sys.WebForms.PageRequestManager.getInstance()._postBackSettings.sourceElement = sourceElement;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; face=&quot;courier new&quot; style=&quot;margin: 0in 0in 0pt; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span&gt;    &lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;// Call the form submit..&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; face=&quot;courier new&quot; style=&quot;margin: 0in 0in 0pt; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span&gt;    &lt;/span&gt;Sys.WebForms.PageRequestManager.getInstance()._onFormSubmit();&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rajganesh-mountbatton.blogspot.com/feeds/2841846648558994955/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/8415691839245064305/2841846648558994955' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8415691839245064305/posts/default/2841846648558994955'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8415691839245064305/posts/default/2841846648558994955'/><link rel='alternate' type='text/html' href='http://rajganesh-mountbatton.blogspot.com/2008/07/asp-net-ajax-timer-control-processing.html' title='ASP .NET AJAX Timer control : Processing client script on Tick event'/><author><name>Rajganesh Mountbatton</name><uri>http://www.blogger.com/profile/12427299066251296073</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgUurRxnxs4z-I9qkEcoO5NcEdUWxbdW2McZI45ISAVsMaxg3IDdER9UfclNeMTHc8XrH8sMI58iq74ISeRxI9TZF4oUBC2CZa4DtG7hgPjUacQoYJq-jLitd8VHU4rrDk/s220/New_Close_Up.JPG'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8415691839245064305.post-5360035930082143954</id><published>2008-04-08T18:52:00.007+05:30</published><updated>2008-04-09T13:34:36.142+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="SQL Server"/><title type='text'>Using CTE and Row_Number() to get the duplicate data in SQL Server 2005</title><content type='html'>&lt;span style=&quot;font-family:verdana;&quot;&gt;This is the script to get the duplicate data from employee table, whose employee name is repeating. &lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:verdana;&quot;&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family:verdana;&quot;&gt;&lt;/span&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN: 0in 0in 0pt; mso-layout-grid-align: none&quot;&gt;&lt;span style=&quot;mso-no-proof: yes;font-family:&#39;Courier New&#39;;font-size:10;&quot;  &gt;&lt;?xml namespace=&quot;&quot; ns=&quot;urn:schemas-microsoft-com:office:office&quot; prefix=&quot;o&quot; ?&gt;&lt;?xml:namespace prefix = o /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN: 0in 0in 0pt; mso-layout-grid-align: none&quot;&gt;&lt;span style=&quot;mso-no-proof: yes;font-family:&#39;Courier New&#39;;font-size:10;color:blue;&quot;   &gt;With&lt;/span&gt;&lt;span style=&quot;mso-no-proof: yes;font-family:&#39;Courier New&#39;;font-size:10;&quot;  &gt; TestData&lt;span style=&quot;mso-spacerun: yes&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color:blue;&quot;&gt;as&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN: 0in 0in 0pt; mso-layout-grid-align: none&quot;&gt;&lt;span style=&quot;mso-no-proof: yes;font-family:&#39;Courier New&#39;;font-size:10;color:gray;&quot;   &gt;(&lt;/span&gt;&lt;span style=&quot;mso-no-proof: yes;font-family:&#39;Courier New&#39;;font-size:10;&quot;  &gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN: 0in 0in 0pt; mso-layout-grid-align: none&quot;&gt;&lt;span style=&quot;mso-no-proof: yes;font-family:&#39;Courier New&#39;;font-size:10;&quot;  &gt;&lt;span style=&quot;mso-tab-count: 1&quot;&gt;&lt;/span&gt;&lt;span style=&quot;color:blue;&quot;&gt;Select&lt;/span&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN: 0in 0in 0pt; mso-layout-grid-align: none&quot;&gt;&lt;span style=&quot;mso-no-proof: yes;font-family:&#39;Courier New&#39;;font-size:10;&quot;  &gt;&lt;span style=&quot;mso-tab-count: 2&quot;&gt;&lt;/span&gt;EmployeeId&lt;span style=&quot;color:gray;&quot;&gt;,&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN: 0in 0in 0pt; mso-layout-grid-align: none&quot;&gt;&lt;span style=&quot;mso-no-proof: yes;font-family:&#39;Courier New&#39;;font-size:10;&quot;  &gt;&lt;span style=&quot;mso-tab-count: 2&quot;&gt;&lt;/span&gt;Row_Number&lt;span style=&quot;color:gray;&quot;&gt;()&lt;/span&gt; &lt;span style=&quot;color:blue;&quot;&gt;Over&lt;/span&gt;&lt;span style=&quot;color:gray;&quot;&gt;(&lt;/span&gt; &lt;span style=&quot;color:blue;&quot;&gt;Partition&lt;/span&gt; &lt;span style=&quot;color:blue;&quot;&gt;By&lt;/span&gt; EmployeeName &lt;span style=&quot;color:blue;&quot;&gt;Order&lt;/span&gt; &lt;span style=&quot;color:blue;&quot;&gt;By&lt;/span&gt; EmployeeName&lt;span style=&quot;color:gray;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color:blue;&quot;&gt;AS&lt;/span&gt; Rowid &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN: 0in 0in 0pt; mso-layout-grid-align: none&quot;&gt;&lt;span style=&quot;mso-no-proof: yes;font-family:&#39;Courier New&#39;;font-size:10;&quot;  &gt;&lt;span style=&quot;mso-tab-count: 1&quot;&gt;&lt;/span&gt;&lt;span style=&quot;color:blue;&quot;&gt;From&lt;/span&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN: 0in 0in 0pt; mso-layout-grid-align: none&quot;&gt;&lt;span style=&quot;mso-no-proof: yes;font-family:&#39;Courier New&#39;;font-size:10;&quot;  &gt;&lt;span style=&quot;mso-tab-count: 2&quot;&gt;&lt;/span&gt;Employees&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN: 0in 0in 0pt; mso-layout-grid-align: none&quot;&gt;&lt;span style=&quot;mso-no-proof: yes;font-family:&#39;Courier New&#39;;font-size:10;color:gray;&quot;   &gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN: 0in 0in 0pt; mso-layout-grid-align: none&quot;&gt;&lt;span style=&quot;mso-no-proof: yes;font-family:&#39;Courier New&#39;;font-size:10;color:gray;&quot;   &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN: 0in 0in 0pt&quot;&gt;&lt;span style=&quot;mso-no-proof: yes;font-family:&#39;Courier New&#39;;font-size:10;color:blue;&quot;   &gt;Select&lt;/span&gt;&lt;span style=&quot;mso-no-proof: yes;font-family:&#39;Courier New&#39;;font-size:10;&quot;  &gt; EmployeeId &lt;span style=&quot;color:blue;&quot;&gt;from&lt;/span&gt; TestData &lt;span style=&quot;color:blue;&quot;&gt;Where&lt;/span&gt; RowId &lt;span style=&quot;color:gray;&quot;&gt;&amp;gt;&lt;/span&gt; 1&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family:verdana;&quot;&gt;If we need to get the duplicate records by two columns, those two columns should be in the Partition By column, and in the order by column.&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://rajganesh-mountbatton.blogspot.com/feeds/5360035930082143954/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/8415691839245064305/5360035930082143954' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8415691839245064305/posts/default/5360035930082143954'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8415691839245064305/posts/default/5360035930082143954'/><link rel='alternate' type='text/html' href='http://rajganesh-mountbatton.blogspot.com/2008/04/using-cte-and-rownumber-to-get.html' title='Using CTE and Row_Number() to get the duplicate data in SQL Server 2005'/><author><name>Rajganesh Mountbatton</name><uri>http://www.blogger.com/profile/12427299066251296073</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgUurRxnxs4z-I9qkEcoO5NcEdUWxbdW2McZI45ISAVsMaxg3IDdER9UfclNeMTHc8XrH8sMI58iq74ISeRxI9TZF4oUBC2CZa4DtG7hgPjUacQoYJq-jLitd8VHU4rrDk/s220/New_Close_Up.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8415691839245064305.post-4794995145228574700</id><published>2008-04-08T15:11:00.003+05:30</published><updated>2008-04-09T13:36:07.657+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="SQL Server"/><title type='text'>Using CTE to write recursive query in SQL Server 2005</title><content type='html'>&lt;p&gt;&lt;span style=&quot;font-family:verdana;&quot;&gt;CTE (Common Table Expression) is newly introduced in SQL Server 2005. The below given link elaborates the CTE and its advantages.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;a href=&quot;http://www.4guysfromrolla.com/webtech/071906-1.shtml&quot;&gt;&lt;span style=&quot;font-family:verdana;&quot;&gt;http://www.4guysfromrolla.com/webtech/071906-1.shtml&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style=&quot;font-family:verdana;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;a href=&quot;http://searchwindevelopment.techtarget.com/tip/0,289483,sid8_gci1278207,00.html&quot;&gt;&lt;span style=&quot;font-family:verdana;&quot;&gt;http://searchwindevelopment.techtarget.com/tip/0,289483,sid8_gci1278207,00.html&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style=&quot;font-family:verdana;&quot;&gt;&lt;br /&gt;Basically the requirement was, when an employee logs in he needs the list of employees reporting directly under him as well as the employees who are reporting under them.&lt;br /&gt;&lt;br /&gt;The database structure was like:&lt;/span&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;span style=&quot;font-family:verdana;&quot;&gt;Employee table containing the employee details like Employee Id, Name, etc.,&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style=&quot;font-family:verdana;&quot;&gt;Supervisor table containing the mapping of employee and their supervisor&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;span style=&quot;font-family:verdana;&quot;&gt;I tried out with the CTE to build a recursive function which will get the first level reporting employees and then their reporting employee. The script was given below&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN: 0in 0in 0pt&quot;&gt;&lt;span style=&quot;font-family:&#39;Courier New&#39;;font-size:10;color:blue;&quot;&gt;Declare&lt;/span&gt;&lt;span style=&quot;font-family:&#39;Courier New&#39;;font-size:10;&quot;&gt;@UserId &lt;span style=&quot;color:blue;&quot;&gt;Int&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN: 0in 0in 0pt&quot;&gt;&lt;span style=&quot;font-family:&#39;Courier New&#39;;font-size:10;color:blue;&quot;&gt;Set&lt;/span&gt;&lt;span style=&quot;font-family:&#39;Courier New&#39;;font-size:10;&quot;&gt; @UserId &lt;span style=&quot;color:gray;&quot;&gt;=&lt;/span&gt; 36332&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN: 0in 0in 0pt&quot;&gt;&lt;span style=&quot;font-family:&#39;Courier New&#39;;font-size:10;&quot;&gt;&lt;/span&gt; &lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN: 0in 0in 0pt&quot;&gt;&lt;span style=&quot;font-family:&#39;Courier New&#39;;font-size:10;color:green;&quot;&gt;-- This is the recursive function.. &lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN: 0in 0in 0pt&quot;&gt;&lt;span style=&quot;font-family:&#39;Courier New&#39;;font-size:10;color:blue;&quot;&gt;WITH&lt;/span&gt;&lt;span style=&quot;font-family:&#39;Courier New&#39;;font-size:10;&quot;&gt; EmployeeHierarchy &lt;span style=&quot;color:gray;&quot;&gt;(&lt;/span&gt;EmployeeID&lt;span style=&quot;color:gray;&quot;&gt;,&lt;/span&gt; EmployeeName&lt;span style=&quot;color:gray;&quot;&gt;,&lt;/span&gt; HierarchyLevel&lt;span style=&quot;color:gray;&quot;&gt;)&lt;/span&gt; &lt;span tyle=&quot;color: blue&quot;&gt;AS&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN: 0in 0in 0pt&quot;&gt;&lt;span style=&quot;font-family:&#39;Courier New&#39;;font-size:10;color:gray;&quot;&gt;(&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN: 0in 0in 0pt&quot;&gt;&lt;span style=&quot;font-family:&#39;Courier New&#39;;font-size:10;&quot;&gt;&lt;span style=&quot;font-size:+0;&quot;&gt;      &lt;/span&gt;&lt;span style=&quot;color:green;&quot;&gt;-- Base case&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN: 0in 0in 0pt&quot;&gt;&lt;span style=&quot;font-family:&#39;Courier New&#39;;font-size:10;&quot;&gt;&lt;span style=&quot;font-size:+0;&quot;&gt;      &lt;/span&gt;&lt;span style=&quot;color:blue;&quot;&gt;Select&lt;/span&gt;&lt;span style=&quot;font-size:+0;&quot;&gt;   &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN: 0in 0in 0pt&quot;&gt;&lt;span style=&quot;font-family:&#39;Courier New&#39;;font-size:10;&quot;&gt;&lt;span style=&quot;font-size:+0;&quot;&gt;            &lt;/span&gt;E&lt;span style=&quot;color:gray;&quot;&gt;.&lt;/span&gt;EmployeeId&lt;span style=&quot;color:gray;&quot;&gt;,&lt;/span&gt; &lt;/span&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN: 0in 0in 0pt&quot;&gt;&lt;span style=&quot;font-family:&#39;Courier New&#39;;font-size:10;&quot;&gt;&lt;span style=&quot;font-size:+0;&quot;&gt;            &lt;/span&gt;E&lt;span style=&quot;color:gray;&quot;&gt;.&lt;/span&gt;Name &lt;span style=&quot;color:blue;&quot;&gt;As&lt;/span&gt; EmployeeName&lt;span style=&quot;color:gray;&quot;&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN: 0in 0in 0pt&quot;&gt;&lt;span style=&quot;font-family:&#39;Courier New&#39;;font-size:10;&quot;&gt;&lt;span style=&quot;font-size:+0;&quot;&gt;            &lt;/span&gt;1 &lt;span style=&quot;color:blue;&quot;&gt;As&lt;/span&gt; HierarchyLevel&lt;span style=&quot;font-size:+0;&quot;&gt;                       &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN: 0in 0in 0pt&quot;&gt;&lt;span style=&quot;font-family:&#39;Courier New&#39;;font-size:10;&quot;&gt;&lt;span style=&quot;font-size:+0;&quot;&gt;      &lt;/span&gt;&lt;span style=&quot;color:blue;&quot;&gt;From&lt;/span&gt;&lt;span style=&quot;font-size:+0;&quot;&gt;  &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN: 0in 0in 0pt&quot;&gt;&lt;br /&gt;&lt;span style=&quot;font-family:&#39;Courier New&#39;;font-size:10;&quot;&gt;&lt;span style=&quot;font-size:+0;&quot;&gt;            &lt;/span&gt;Employees E&lt;span style=&quot;font-size:+0;&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;font-size:+0;&quot;&gt;                     &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN: 0in 0in 0pt&quot;&gt;&lt;span style=&quot;font-family:&#39;Courier New&#39;;font-size:10;&quot;&gt;&lt;span style=&quot;font-size:+0;&quot;&gt;      &lt;/span&gt;&lt;span style=&quot;color:blue;&quot;&gt;Where&lt;/span&gt;&lt;span style=&quot;font-size:+0;&quot;&gt;    &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN: 0in 0in 0pt&quot;&gt;&lt;span style=&quot;font-family:&#39;Courier New&#39;;font-size:10;&quot;&gt;&lt;span style=&quot;font-size:+0;&quot;&gt;            &lt;/span&gt;&lt;span style=&quot;font-size:+0;&quot;&gt; &lt;/span&gt;E&lt;span style=&quot;color:gray;&quot;&gt;.&lt;/span&gt;EmployeeId &lt;span style=&quot;color:gray;&quot;&gt;=&lt;/span&gt; @UserId&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN: 0in 0in 0pt&quot;&gt;&lt;br /&gt;&lt;span style=&quot;font-family:&#39;Courier New&#39;;font-size:10;&quot;&gt;&lt;span style=&quot;font-size:+0;&quot;&gt;      &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN: 0in 0in 0pt&quot;&gt;&lt;span style=&quot;font-family:&#39;Courier New&#39;;font-size:10;&quot;&gt;&lt;span style=&quot;font-size:+0;&quot;&gt;      &lt;/span&gt;&lt;span style=&quot;color:blue;&quot;&gt;UNION&lt;/span&gt; &lt;span style=&quot;color:gray;&quot;&gt;ALL&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN: 0in 0in 0pt&quot;&gt;&lt;span style=&quot;font-family:&#39;Courier New&#39;;font-size:10;&quot;&gt;&lt;span style=&quot;font-size:+0;&quot;&gt;      &lt;/span&gt;&lt;span style=&quot;color:green;&quot;&gt;-- Recursive step&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN: 0in 0in 0pt&quot;&gt;&lt;span style=&quot;font-family:&#39;Courier New&#39;;font-size:10;&quot;&gt;&lt;span style=&quot;font-size:+0;&quot;&gt;      &lt;/span&gt;&lt;span style=&quot;color:blue;&quot;&gt;select&lt;/span&gt;&lt;span style=&quot;font-size:+0;&quot;&gt;   &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN: 0in 0in 0pt&quot;&gt;&lt;span style=&quot;font-family:&#39;Courier New&#39;;font-size:10;&quot;&gt;&lt;span style=&quot;font-size:+0;&quot;&gt;            &lt;/span&gt;E&lt;span style=&quot;color:gray;&quot;&gt;.&lt;/span&gt;EmployeeId&lt;span style=&quot;color:gray;&quot;&gt;,&lt;/span&gt; &lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN: 0in 0in 0pt&quot;&gt;&lt;span style=&quot;font-family:&#39;Courier New&#39;;font-size:10;&quot;&gt;&lt;span style=&quot;font-size:+0;&quot;&gt;            &lt;/span&gt;E&lt;span style=&quot;color:gray;&quot;&gt;.&lt;/span&gt;Name &lt;span style=&quot;color:blue;&quot;&gt;As&lt;/span&gt; EmployeeName&lt;span style=&quot;color:gray;&quot;&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN: 0in 0in 0pt&quot;&gt;&lt;span style=&quot;font-family:&#39;Courier New&#39;;font-size:10;&quot;&gt;&lt;span style=&quot;font-size:+0;&quot;&gt;            &lt;/span&gt;eh&lt;span style=&quot;color:gray;&quot;&gt;.&lt;/span&gt;HierarchyLevel &lt;span style=&quot;color:gray;&quot;&gt;+&lt;/span&gt; 1 &lt;span style=&quot;color:blue;&quot;&gt;AS&lt;/span&gt; HierarchyLevel&lt;span style=&quot;font-size:+0;&quot;&gt;                     &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN: 0in 0in 0pt&quot;&gt;&lt;span style=&quot;font-family:&#39;Courier New&#39;;font-size:10;&quot;&gt;&lt;span style=&quot;font-size:+0;&quot;&gt;      &lt;/span&gt;&lt;span style=&quot;color:blue;&quot;&gt;FROM&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN: 0in 0in 0pt&quot;&gt;&lt;span style=&quot;font-family:&#39;Courier New&#39;;font-size:10;&quot;&gt;&lt;span style=&quot;font-size:+0;&quot;&gt;            &lt;/span&gt;Supervisors ES&lt;span style=&quot;font-size:+0;&quot;&gt;  &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN: 0in 0in 0pt&quot;&gt;&lt;span style=&quot;font-family:&#39;Courier New&#39;;font-size:10;&quot;&gt;&lt;span style=&quot;font-size:+0;&quot;&gt;            &lt;/span&gt;&lt;span style=&quot;color:gray;&quot;&gt;INNER&lt;/span&gt; &lt;span style=&quot;color:gray;&quot;&gt;Join&lt;/span&gt; Employees E &lt;span style=&quot;color:blue;&quot;&gt;On&lt;/span&gt; E&lt;span style=&quot;color:gray;&quot;&gt;.&lt;/span&gt;EmployeeId &lt;span style=&quot;color:gray;&quot;&gt;=&lt;/span&gt; ES&lt;span style=&quot;color:gray;&quot;&gt;.&lt;/span&gt;EmployeeId&lt;span style=&quot;font-size:+0;&quot;&gt;            &lt;/span&gt;&lt;span style=&quot;font-size:+0;&quot;&gt;      &lt;/span&gt;&lt;span style=&quot;color:gray;&quot;&gt;INNER&lt;/span&gt; &lt;span style=&quot;color:gray;&quot;&gt;JOIN&lt;/span&gt; EmployeeHierarchy eh &lt;span style=&quot;color:blue;&quot;&gt;ON&lt;/span&gt; ES&lt;span style=&quot;color:gray;&quot;&gt;.&lt;/span&gt;Supervisor1 &lt;span style=&quot;color:gray;&quot;&gt;=&lt;/span&gt; eh&lt;span style=&quot;color:gray;&quot;&gt;.&lt;/span&gt;EmployeeID&lt;span style=&quot;font-size:+0;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN: 0in 0in 0pt&quot;&gt;&lt;span style=&quot;font-family:&#39;Courier New&#39;;font-size:10;color:gray;&quot;&gt;)&lt;/span&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN: 0in 0in 0pt&quot;&gt;&lt;span style=&quot;font-family:&#39;Courier New&#39;;font-size:10;color:green;&quot;&gt;-- This is the final select&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN: 0in 0in 0pt&quot;&gt;&lt;span style=&quot;font-family:&#39;Courier New&#39;;font-size:10;color:blue;&quot;&gt;Select&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN: 0in 0in 0pt&quot;&gt;&lt;br /&gt;&lt;span style=&quot;font-family:&#39;Courier New&#39;;font-size:10;&quot;&gt;&lt;span style=&quot;font-size:+0;&quot;&gt;      &lt;/span&gt;E&lt;span style=&quot;color:gray;&quot;&gt;.&lt;/span&gt;EmployeeId&lt;span style=&quot;color:gray;&quot;&gt;,&lt;/span&gt; &lt;/span&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN: 0in 0in 0pt&quot;&gt;&lt;span style=&quot;font-family:&#39;Courier New&#39;;font-size:10;&quot;&gt;&lt;span style=&quot;font-size:+0;&quot;&gt;      &lt;/span&gt;E&lt;span style=&quot;color:gray;&quot;&gt;.&lt;/span&gt;EmployeeNumber &lt;span style=&quot;color:blue;&quot;&gt;As&lt;/span&gt; EmployeeNumber&lt;span style=&quot;color:gray;&quot;&gt;,&lt;/span&gt; &lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN: 0in 0in 0pt&quot;&gt;&lt;br /&gt;&lt;span style=&quot;font-family:&#39;Courier New&#39;;font-size:10;&quot;&gt;&lt;span style=&quot;font-size:+0;&quot;&gt;      &lt;/span&gt;E&lt;span style=&quot;color:gray;&quot;&gt;.&lt;/span&gt;EmployeeName&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN: 0in 0in 0pt&quot;&gt;&lt;span style=&quot;font-family:&#39;Courier New&#39;;font-size:10;color:blue;&quot;&gt;From&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN: 0in 0in 0pt&quot;&gt;&lt;span style=&quot;font-family:&#39;Courier New&#39;;font-size:10;&quot;&gt;&lt;span style=&quot;font-size:+0;&quot;&gt;      &lt;/span&gt;EmployeeHierarchy E &lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN: 0in 0in 0pt&quot;&gt;&lt;span style=&quot;font-family:&#39;Courier New&#39;;font-size:10;color:blue;&quot;&gt;Where&lt;/span&gt;&lt;/p&gt;&lt;span style=&quot;font-family:&#39;Courier New&#39;;font-size:10;&quot;&gt;&lt;span style=&quot;font-size:+0;&quot;&gt;      &lt;/span&gt;E&lt;span style=&quot;color:gray;&quot;&gt;.&lt;/span&gt;EmployeeId &lt;span style=&quot;color:gray;&quot;&gt;&amp;lt;&amp;gt;&lt;/span&gt; @UserId&lt;span style=&quot;font-size:+0;&quot;&gt; &lt;/span&gt;&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://rajganesh-mountbatton.blogspot.com/feeds/4794995145228574700/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/8415691839245064305/4794995145228574700' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8415691839245064305/posts/default/4794995145228574700'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8415691839245064305/posts/default/4794995145228574700'/><link rel='alternate' type='text/html' href='http://rajganesh-mountbatton.blogspot.com/2008/04/using-cte-to-write-recursive-query-in.html' title='Using CTE to write recursive query in SQL Server 2005'/><author><name>Rajganesh Mountbatton</name><uri>http://www.blogger.com/profile/12427299066251296073</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgUurRxnxs4z-I9qkEcoO5NcEdUWxbdW2McZI45ISAVsMaxg3IDdER9UfclNeMTHc8XrH8sMI58iq74ISeRxI9TZF4oUBC2CZa4DtG7hgPjUacQoYJq-jLitd8VHU4rrDk/s220/New_Close_Up.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8415691839245064305.post-4319183070238029337</id><published>2008-03-28T14:24:00.010+05:30</published><updated>2008-09-10T12:07:46.757+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="C#"/><title type='text'>Convert Decimal to Hours &amp; Minutes in C# .NET</title><content type='html'>&lt;span style=&quot;color: rgb(0, 0, 0);font-family:verdana;font-size:100%;&quot;  &gt;Here is a simple code to convert a decimal value to its equivalent hour and minute value.&lt;/span&gt;&lt;span style=&quot;font-size:100%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;    &lt;span style=&quot;;font-family:&#39;Courier New&#39;;font-size:100%;color:blue;&quot;   &gt;&lt;br /&gt;     double&lt;/span&gt;&lt;span style=&quot;;font-family:&#39;Courier New&#39;;font-size:100%;&quot;  &gt; Value = 1.75;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;span style=&quot;;font-family:&#39;Courier New&#39;;font-size:100%;color:blue;&quot;   &gt;double&lt;/span&gt; &lt;span style=&quot;;font-family:&#39;Courier New&#39;;font-size:100%;&quot;  &gt;Hours = &lt;span style=&quot;color:teal;&quot;&gt;Math&lt;/span&gt;.Floor(Value);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;span style=&quot;font-size:100%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;&lt;span style=&quot;;font-family:&#39;Courier New&#39;;font-size:100%;color:blue;&quot;   &gt;double&lt;/span&gt;&lt;span style=&quot;;font-family:&#39;Courier New&#39;;font-size:100%;&quot;  &gt; Minutes = (Value % 1 * 100);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;Minutes &lt;span style=&quot;;font-family:&#39;Courier New&#39;;font-size:100%;&quot;  &gt;= &lt;span style=&quot;color:teal;&quot;&gt;Math&lt;/span&gt;.Round(Minutes, 2);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;span style=&quot;font-size:100%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;&lt;span style=&quot;;font-family:&#39;Courier New&#39;;font-size:100%;color:blue;&quot;   &gt;if&lt;/span&gt;&lt;span style=&quot;;font-family:&#39;Courier New&#39;;font-size:100%;&quot;  &gt;(Minutes &gt;= 60)&lt;/span&gt;&lt;/p&gt;&lt;span style=&quot;;font-family:&#39;Courier New&#39;;font-size:100%;&quot;  &gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;span style=&quot;font-size:100%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;&lt;span style=&quot;;font-family:&#39;Courier New&#39;;font-size:100%;&quot;  &gt;&lt;span style=&quot;&quot;&gt;    &lt;/span&gt;Minutes = &lt;span style=&quot;color:teal;&quot;&gt;Math&lt;/span&gt;.Floor(Minutes/ 60) + (Minutes % 60 / 100);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;    &lt;span style=&quot;;font-family:&#39;Courier New&#39;;font-size:100%;&quot;  &gt;&lt;span style=&quot;&quot;&gt;    &lt;/span&gt;Minutes = &lt;span style=&quot;color:teal;&quot;&gt;Math&lt;/span&gt;.Round(Minutes,2);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;span style=&quot;;font-family:&#39;Courier New&#39;;font-size:100%;&quot;  &gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;&lt;span style=&quot;;font-family:&#39;Courier New&#39;;font-size:100%;color:blue;&quot;   &gt;        else&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;span style=&quot;;font-family:&#39;Courier New&#39;;font-size:100%;&quot;  &gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;span style=&quot;font-size:100%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;&lt;span style=&quot;;font-family:&#39;Courier New&#39;;font-size:100%;&quot;  &gt;&lt;span style=&quot;&quot;&gt;    &lt;/span&gt;Minutes = &lt;span style=&quot;color:teal;&quot;&gt;Math&lt;/span&gt;.Round(Minutes / 100, 2);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;span style=&quot;;font-family:&#39;Courier New&#39;;font-size:100%;&quot;  &gt;}&lt;/span&gt;&lt;span style=&quot;font-size:100%;&quot;&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;&lt;span style=&quot;;font-family:&#39;Courier New&#39;;font-size:100%;color:blue;&quot;   &gt;&lt;br /&gt;       string&lt;/span&gt;&lt;span style=&quot;;font-family:&#39;Courier New&#39;;font-size:10;&quot;  &gt;&lt;span style=&quot;font-size:100%;&quot;&gt; HoursAndMinutes = &lt;/span&gt;&lt;span style=&quot;font-size:100%;color:teal;&quot;&gt;Convert&lt;/span&gt;&lt;span style=&quot;font-size:100%;&quot;&gt;.ToString((Hours + Minutes));&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://rajganesh-mountbatton.blogspot.com/feeds/4319183070238029337/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/8415691839245064305/4319183070238029337' title='14 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8415691839245064305/posts/default/4319183070238029337'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8415691839245064305/posts/default/4319183070238029337'/><link rel='alternate' type='text/html' href='http://rajganesh-mountbatton.blogspot.com/2008/03/convert-decimal-to-hours-minutes-in-c.html' title='Convert Decimal to Hours &amp; Minutes in C# .NET'/><author><name>Rajganesh Mountbatton</name><uri>http://www.blogger.com/profile/12427299066251296073</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgUurRxnxs4z-I9qkEcoO5NcEdUWxbdW2McZI45ISAVsMaxg3IDdER9UfclNeMTHc8XrH8sMI58iq74ISeRxI9TZF4oUBC2CZa4DtG7hgPjUacQoYJq-jLitd8VHU4rrDk/s220/New_Close_Up.JPG'/></author><thr:total>14</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8415691839245064305.post-4013053846026428759</id><published>2008-03-27T14:57:00.012+05:30</published><updated>2008-04-09T13:37:32.888+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="C#"/><category scheme="http://www.blogger.com/atom/ns#" term="SQL Server"/><title type='text'>Using SMO to generate the script of triggers in SQL server 2005</title><content type='html'>&lt;span style=&quot;font-family:verdana;&quot;&gt;&lt;span style=&quot;COLOR: rgb(0,0,0)&quot;&gt;The below is the code written in C# to get the scripts of the triggers, stored procedures, views and user defined functions available in the SQL Server database.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;COLOR: rgb(0,0,0)&quot;&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;COLOR: rgb(0,0,0)&quot;&gt;This is done using the SMO class exposed by the microsoft. &lt;/span&gt;&lt;span style=&quot;COLOR: rgb(0,0,0)&quot;&gt;To use SMO in our C# code we need to reference to the Microsoft&#39;s SMO dll. This dll can be found in the C:\Program Files\Microsoft SQL Server\90\SDK\Assemblies directory. You&#39;ll need to add references to dll as shown below&lt;/span&gt; &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;&lt;span style=&quot;color:#3333ff;&quot;&gt;&lt;span style=&quot;color:#3333ff;&quot;&gt;using&lt;/span&gt; &lt;/span&gt;&lt;span style=&quot;color:#000000;&quot;&gt;Microsoft.SqlServer.Management.Smo;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color:#000000;&quot;&gt;This is the code which we can add as a method to any of the existing class file&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color:#006600;&quot;&gt;Server&lt;/span&gt; oServer = &lt;span style=&quot;color:blue;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color:teal;&quot;&gt;Server&lt;/span&gt;();&lt;?xml:namespace prefix = o /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;&lt;/span&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;color:blue;&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;try&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;oServer.ConnectionContext.ServerInstance = &lt;span style=&quot;color:maroon;&quot;&gt;&quot;TestInstance&quot;&lt;/span&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;oServer.SetDefaultInitFields(&lt;span style=&quot;color:blue;&quot;&gt;typeof&lt;/span&gt;(&lt;span style=&quot;color:teal;&quot;&gt;StoredProcedure&lt;/span&gt;), &lt;span style=&quot;color:maroon;&quot;&gt;&quot;IsSystemObject&quot;&lt;/span&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;oServer.ConnectionContext.LoginSecure = &lt;span style=&quot;color:blue;&quot;&gt;false&lt;/span&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;oServer.ConnectionContext.Login = &lt;span style=&quot;color:maroon;&quot;&gt;&quot;sa&quot;&lt;/span&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;oServer.ConnectionContext.Password = &lt;span style=&quot;color:maroon;&quot;&gt;&quot;password&quot;&lt;/span&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;oServer.ConnectionContext.Connect();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;&lt;span style=&quot;color:teal;&quot;&gt;TextWriter&lt;/span&gt; oTextWriter = &lt;span style=&quot;color:blue;&quot;&gt;null&lt;/span&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;&lt;span style=&quot;color:teal;&quot;&gt;StringBuilder&lt;/span&gt; oSBText = &lt;span style=&quot;color:blue;&quot;&gt;null&lt;/span&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;&lt;span style=&quot;color:blue;&quot;&gt;foreach&lt;/span&gt; (&lt;span style=&quot;color:teal;&quot;&gt;Database&lt;/span&gt; oDB &lt;span style=&quot;color:blue;&quot;&gt;in&lt;/span&gt; oServer.Databases)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;&lt;span style=&quot;color:blue;&quot;&gt;if&lt;/span&gt; (oDB.Name.ToUpper().Equals(&lt;span style=&quot;color:maroon;&quot;&gt;&quot;DB1&quot;&lt;/span&gt;))&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;oTextWriter = &lt;span style=&quot;color:blue;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color:teal;&quot;&gt;StreamWriter&lt;/span&gt;(&lt;span style=&quot;color:maroon;&quot;&gt;@&quot;D:\DBScripts\DbScripts1.sql&quot;&lt;/span&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;&lt;span style=&quot;color:blue;&quot;&gt;else&lt;/span&gt; &lt;span style=&quot;color:blue;&quot;&gt;if&lt;/span&gt; (oDB.Name.ToUpper().Equals(&lt;span style=&quot;color:maroon;&quot;&gt;&quot;DB2&quot;&lt;/span&gt;))&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;oTextWriter = &lt;span style=&quot;color:blue;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color:teal;&quot;&gt;StreamWriter&lt;/span&gt;(&lt;span style=&quot;color:maroon;&quot;&gt;@&quot;D:\DBScripts\DbScriptss.sql&quot;&lt;/span&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;oSBText = &lt;span style=&quot;color:blue;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color:teal;&quot;&gt;StringBuilder&lt;/span&gt;();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;&lt;span style=&quot;color:blue;&quot;&gt;if&lt;/span&gt; (oTextWriter != &lt;span style=&quot;color:blue;&quot;&gt;null&lt;/span&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;&lt;span style=&quot;color:blue;&quot;&gt;foreach&lt;/span&gt; (&lt;span style=&quot;color:teal;&quot;&gt;Table&lt;/span&gt; oTable &lt;span style=&quot;color:blue;&quot;&gt;in&lt;/span&gt; oDB.Tables)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;&lt;span style=&quot;color:teal;&quot;&gt;TriggerCollection&lt;/span&gt; oTriggerCollect = oTable.Triggers;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;&lt;span style=&quot;color:blue;&quot;&gt;if&lt;/span&gt; (oTriggerCollect.Count &gt; 0)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;oSBText.Append(&lt;span style=&quot;color:maroon;&quot;&gt;&quot;\n&quot;&lt;/span&gt; + &lt;span style=&quot;color:maroon;&quot;&gt;&quot;--&quot;&lt;/span&gt; + oDB.Name + &lt;span style=&quot;color:maroon;&quot;&gt;&quot;\n&quot;&lt;/span&gt; + &lt;span style=&quot;color:maroon;&quot;&gt;&quot;--&quot;&lt;/span&gt; + oTable.Name);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;&lt;span style=&quot;color:blue;&quot;&gt;foreach&lt;/span&gt; (&lt;span style=&quot;color:teal;&quot;&gt;Trigger&lt;/span&gt; oTrg &lt;span style=&quot;color:blue;&quot;&gt;in&lt;/span&gt; oTriggerCollect)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;color:blue;&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;try&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;oSBText.Append(&lt;span style=&quot;color:maroon;&quot;&gt;&quot;\n&quot;&lt;/span&gt; + oTrg.TextHeader + &lt;span style=&quot;color:maroon;&quot;&gt;&quot;\n&quot;&lt;/span&gt; + oTrg.TextBody); &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;&lt;span style=&quot;color:blue;&quot;&gt;catch&lt;/span&gt; (&lt;span style=&quot;color:teal;&quot;&gt;Exception&lt;/span&gt; Ex)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;&lt;span style=&quot;color:teal;&quot;&gt;TextWriter&lt;/span&gt; oErrorWriter = &lt;span style=&quot;color:blue;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color:teal;&quot;&gt;StreamWriter&lt;/span&gt;(&lt;span style=&quot;color:maroon;&quot;&gt;@&quot;D:\DBScripts\Error\Error.txt&quot;&lt;/span&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;oErrorWriter.Write(Ex.Message);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;oErrorWriter.Close();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;&lt;span style=&quot;color:blue;&quot;&gt;foreach&lt;/span&gt; (&lt;span style=&quot;color:teal;&quot;&gt;StoredProcedure&lt;/span&gt; oSP &lt;span style=&quot;color:blue;&quot;&gt;in&lt;/span&gt; oDB.StoredProcedures)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;color:blue;&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;try&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;&lt;span style=&quot;color:blue;&quot;&gt;if&lt;/span&gt; (oSP.IsSystemObject == &lt;span style=&quot;color:blue;&quot;&gt;false&lt;/span&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;oSBText.Append(&lt;span style=&quot;color:maroon;&quot;&gt;&quot;\n&quot;&lt;/span&gt; + &lt;span style=&quot;color:maroon;&quot;&gt;&quot;--&quot;&lt;/span&gt; + oDB.Name + &lt;span style=&quot;color:maroon;&quot;&gt;&quot;\n&quot;&lt;/span&gt; + &lt;span style=&quot;color:maroon;&quot;&gt;&quot;--&quot;&lt;/span&gt; + oSP.Name + &lt;span style=&quot;color:maroon;&quot;&gt;&quot;\n&quot;&lt;/span&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;&lt;span style=&quot;color:teal;&quot;&gt;StringCollection&lt;/span&gt; sc = oSP.Script();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;&lt;span style=&quot;color:blue;&quot;&gt;foreach&lt;/span&gt; (&lt;span style=&quot;color:blue;&quot;&gt;string&lt;/span&gt; s &lt;span style=&quot;color:blue;&quot;&gt;in&lt;/span&gt; sc)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;oSBText.Append(&lt;span style=&quot;color:maroon;&quot;&gt;&quot;\n&quot;&lt;/span&gt; + s);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;&lt;span style=&quot;color:blue;&quot;&gt;catch&lt;/span&gt; (&lt;span style=&quot;color:teal;&quot;&gt;Exception&lt;/span&gt; Ex)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;&lt;span style=&quot;color:teal;&quot;&gt;TextWriter&lt;/span&gt; oErrorWriter = &lt;span style=&quot;color:blue;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color:teal;&quot;&gt;StreamWriter&lt;/span&gt;(&lt;span style=&quot;color:maroon;&quot;&gt;@&quot;D:\DBScripts\Error\Error.txt&quot;&lt;/span&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;oErrorWriter.Write(Ex.Message);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;oErrorWriter.Close();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;&lt;span style=&quot;color:blue;&quot;&gt;foreach&lt;/span&gt; (&lt;span style=&quot;color:teal;&quot;&gt;View&lt;/span&gt; oV &lt;span style=&quot;color:blue;&quot;&gt;in&lt;/span&gt; oDB.Views)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;color:blue;&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;try&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;oSBText.Append(&lt;span style=&quot;color:maroon;&quot;&gt;&quot;\n&quot;&lt;/span&gt; + &lt;span style=&quot;color:maroon;&quot;&gt;&quot;--&quot;&lt;/span&gt; + oDB.Name + &lt;span style=&quot;color:maroon;&quot;&gt;&quot;\n&quot;&lt;/span&gt; + &lt;span style=&quot;color:maroon;&quot;&gt;&quot;--&quot;&lt;/span&gt; + oV.Name + &lt;span style=&quot;color:maroon;&quot;&gt;&quot;\n&quot;&lt;/span&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;&lt;span style=&quot;color:teal;&quot;&gt;StringCollection&lt;/span&gt; sc = oV.Script();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;&lt;span style=&quot;color:blue;&quot;&gt;foreach&lt;/span&gt; (&lt;span style=&quot;color:blue;&quot;&gt;string&lt;/span&gt; s &lt;span style=&quot;color:blue;&quot;&gt;in&lt;/span&gt; sc)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;oSBText.Append(&lt;span style=&quot;color:maroon;&quot;&gt;&quot;\n&quot;&lt;/span&gt; + s);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;&lt;span style=&quot;color:blue;&quot;&gt;catch&lt;/span&gt; (&lt;span style=&quot;color:teal;&quot;&gt;Exception&lt;/span&gt; Ex)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;&lt;span style=&quot;color:teal;&quot;&gt;TextWriter&lt;/span&gt; oErrorWriter = &lt;span style=&quot;color:blue;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color:teal;&quot;&gt;StreamWriter&lt;/span&gt;(&lt;span style=&quot;color:maroon;&quot;&gt;@&quot;D:\DBScripts\Error\Error.txt&quot;&lt;/span&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;oErrorWriter.Write(Ex.Message);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;oErrorWriter.Close();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;&lt;span style=&quot;color:blue;&quot;&gt;foreach&lt;/span&gt; (&lt;span style=&quot;color:teal;&quot;&gt;UserDefinedFunction&lt;/span&gt; oUDF &lt;span style=&quot;color:blue;&quot;&gt;in&lt;/span&gt; oDB.UserDefinedFunctions)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;color:blue;&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;try&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;oSBText.Append(&lt;span style=&quot;color:maroon;&quot;&gt;&quot;\n&quot;&lt;/span&gt; + &lt;span style=&quot;color:maroon;&quot;&gt;&quot;--&quot;&lt;/span&gt; + oDB.Name + &lt;span style=&quot;color:maroon;&quot;&gt;&quot;\n&quot;&lt;/span&gt; + &lt;span style=&quot;color:maroon;&quot;&gt;&quot;--&quot;&lt;/span&gt; + oUDF.Name + &lt;span style=&quot;color:maroon;&quot;&gt;&quot;\n&quot;&lt;/span&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;&lt;span style=&quot;color:teal;&quot;&gt;StringCollection&lt;/span&gt; sc = oUDF.Script();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;&lt;span style=&quot;color:blue;&quot;&gt;foreach&lt;/span&gt; (&lt;span style=&quot;color:blue;&quot;&gt;string&lt;/span&gt; s &lt;span style=&quot;color:blue;&quot;&gt;in&lt;/span&gt; sc)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;oSBText.Append(&lt;span style=&quot;color:maroon;&quot;&gt;&quot;\n&quot;&lt;/span&gt; + s);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;&lt;span style=&quot;color:blue;&quot;&gt;catch&lt;/span&gt; (&lt;span style=&quot;color:teal;&quot;&gt;Exception&lt;/span&gt; Ex)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;&lt;span style=&quot;color:teal;&quot;&gt;TextWriter&lt;/span&gt; oErrorWriter = &lt;span style=&quot;color:blue;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color:teal;&quot;&gt;StreamWriter&lt;/span&gt;(&lt;span style=&quot;color:maroon;&quot;&gt;@&quot;D:\DBScripts\Error\Error.txt&quot;&lt;/span&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;oErrorWriter.Write(Ex.Message);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;oErrorWriter.Close();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;oTextWriter.Write(oSBText.ToString());&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;oTextWriter.Close();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;oTextWriter = &lt;span style=&quot;color:blue;&quot;&gt;null&lt;/span&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;oSBText = &lt;span style=&quot;color:blue;&quot;&gt;null&lt;/span&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;&lt;span style=&quot;color:teal;&quot;&gt;Console&lt;/span&gt;.WriteLine(&lt;span style=&quot;color:maroon;&quot;&gt;&quot;Successfully Written to the file!!!&quot;&lt;/span&gt;); &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;&lt;span style=&quot;color:blue;&quot;&gt;catch&lt;/span&gt; (&lt;span style=&quot;color:teal;&quot;&gt;Exception&lt;/span&gt; Ex)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;&lt;span style=&quot;color:teal;&quot;&gt;TextWriter&lt;/span&gt; oErrorWriter = &lt;span style=&quot;color:blue;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color:teal;&quot;&gt;StreamWriter&lt;/span&gt;(&lt;span style=&quot;color:maroon;&quot;&gt;@&quot;D:\DBScripts\Error\Error.txt&quot;&lt;/span&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;oErrorWriter.Write(Ex.Message);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;oErrorWriter.Close();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;color:blue;&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;finally&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;&lt;span style=&quot;color:blue;&quot;&gt;if&lt;/span&gt; (oServer.ConnectionContext.IsOpen)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;oServer.ConnectionContext.Disconnect();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;}&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:verdana;color:#000000;&quot;&gt;To Learn more about SMO follow the below given links.&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:verdana;&quot;&gt;&lt;a href=&quot;http://msdn2.microsoft.com/hi-in/magazine/cc163409(en-us).aspx&quot;&gt;http://msdn2.microsoft.com/hi-in/magazine/cc163409(en-us).aspx&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:verdana;&quot;&gt;&lt;a href=&quot;http://www.sqlteam.com/article/scripting-database-objects-using-smo-updated&quot;&gt;http://www.sqlteam.com/article/scripting-database-objects-using-smo-updated&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span class=&quot;blsp-spelling-corrected&quot; id=&quot;SPELLING_ERROR_0&quot;   style=&quot;font-family:verdana;font-size:85%;&quot;&gt;&lt;/span&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://rajganesh-mountbatton.blogspot.com/feeds/4013053846026428759/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/8415691839245064305/4013053846026428759' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8415691839245064305/posts/default/4013053846026428759'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8415691839245064305/posts/default/4013053846026428759'/><link rel='alternate' type='text/html' href='http://rajganesh-mountbatton.blogspot.com/2008/03/using-smo-to-generate-script-of.html' title='Using SMO to generate the script of triggers in SQL server 2005'/><author><name>Rajganesh Mountbatton</name><uri>http://www.blogger.com/profile/12427299066251296073</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgUurRxnxs4z-I9qkEcoO5NcEdUWxbdW2McZI45ISAVsMaxg3IDdER9UfclNeMTHc8XrH8sMI58iq74ISeRxI9TZF4oUBC2CZa4DtG7hgPjUacQoYJq-jLitd8VHU4rrDk/s220/New_Close_Up.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8415691839245064305.post-5189615656127504898</id><published>2007-12-03T14:29:00.002+05:30</published><updated>2008-07-29T17:46:53.389+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Javascript"/><title type='text'>Masterpage – document.getElementById Issue</title><content type='html'>&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;span style=&quot;;font-family:Verdana;color:black;&quot;  &gt;Masterpage is one of the good features of the ASP.NET 2.0. But if you are a beginner in .NET 2.0 and Masterpage, you would stuck up to get the element inside a Masterpage from a JavaScript code. &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;span style=&quot;;font-family:Verdana;font-size:85%;&quot;  &gt;&lt;/span&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;span style=&quot;;font-family:Verdana;color:black;&quot;  &gt;The issue was, whenever a control is inside a Masterpage the client id of the control would get append with the content placeholder id. So for an element of id “txtTest” the client id would be something like “ctl00_ContentPlaceHolder1_ txtTest”.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;&lt;span style=&quot;;font-family:Verdana;font-size:85%;&quot;  &gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;span style=&quot;;font-family:Verdana;color:black;&quot;  &gt;So when you use the document.getElementById(‘txtTest’), you will not get the access of the txtTest textbox in JavaScript. Indeed you need to access it by calling document.getElementById(‘ctl00_ContentPlaceHolder1_ txtTest’).&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;span style=&quot;;font-family:Verdana;font-size:85%;&quot;  &gt;&lt;/span&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;span style=&quot;;font-family:Verdana;color:black;&quot;  &gt;To avoid this we can access the control by using the document.getElementById(&#39;&amp;lt;%=txtTest.ClientID%&amp;gt;&#39;). This will give you the access to txtTest text box. Now this will work fine until and unless the script is in line with the aspx page ie., if the script is included as a part of the aspx page. But the same won’t work if you have this script in a separate .js file, and add it to the aspx page.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;span style=&quot;;font-family:Verdana;font-size:85%;&quot;  &gt;&lt;/span&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;span style=&quot;;font-family:Verdana;color:black;&quot;  &gt;So in this scenario to get the access to the control, we need to hard code the control’s id. But hard coding is not an ideal way of coding. To avoid this situation what we can do is to, maintain the mapping between the client id and the server id. This can be achieved as shown below.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;span style=&quot;;font-family:Verdana;font-size:85%;&quot;  &gt;&lt;/span&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;span style=&quot;;font-family:Verdana;color:black;&quot;  &gt;First we need to declare two arrays and the first array will have the server ids of the required controls, and the second array will have the client ids of those server controls in the same order. Register these two arrays to the client side. Now create a JavaScript function, which will accept the server id and will compare the server id with the available server ids in the array and will give its position in the array. Then the same function would return you the matching client id in the same location of the client array. So we were able to get the mapping client id for the given server id.&lt;/span&gt; &lt;/span&gt;&lt;/p&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;;font-family:Verdana;color:black;&quot;  &gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;The code below shows the declaration of the array and the declaration of the JavaScript function.&lt;/span&gt;&lt;/p&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;/span&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;span style=&quot;;font-family:&#39;Courier New&#39;;color:blue;&quot;  &gt;public&lt;/span&gt;&lt;span style=&quot;font-family:&#39;Courier New&#39;;&quot;&gt; &lt;span style=&quot;color:blue;&quot;&gt;void&lt;/span&gt; RenderJSArrayWithCliendIds(&lt;span style=&quot;color:blue;&quot;&gt;params&lt;/span&gt; &lt;span style=&quot;color:teal;&quot;&gt;Control&lt;/span&gt;[] wc)&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;span style=&quot;font-family:&#39;Courier New&#39;;&quot;&gt;{&lt;/span&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;span style=&quot;font-family:&#39;Courier New&#39;;&quot;&gt;&lt;span style=&quot;color:blue;&quot;&gt;if&lt;/span&gt; (wc.Length &amp;gt; 0)&lt;/span&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;span style=&quot;font-family:&#39;Courier New&#39;;&quot;&gt;{&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;span style=&quot;font-family:&#39;Courier New&#39;;&quot;&gt;&lt;span style=&quot;color:teal;&quot;&gt;StringBuilder&lt;/span&gt; arrClientIDValue = &lt;span style=&quot;color:blue;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color:teal;&quot;&gt;StringBuilder&lt;/span&gt;();&lt;/span&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;span style=&quot;font-family:&#39;Courier New&#39;;&quot;&gt;&lt;span style=&quot;color:teal;&quot;&gt;StringBuilder&lt;/span&gt; arrServerIDValue = &lt;span style=&quot;color:blue;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color:teal;&quot;&gt;StringBuilder&lt;/span&gt;();&lt;/span&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;span style=&quot;font-family:&#39;Courier New&#39;;&quot;&gt;&lt;span style=&quot;color:green;&quot;&gt;// Get a ClientScriptManager reference from the Page class.&lt;/span&gt;&lt;/span&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;span style=&quot;font-family:&#39;Courier New&#39;;&quot;&gt;&lt;span style=&quot;color:teal;&quot;&gt;ClientScriptManager&lt;/span&gt; cs = Page.ClientScript;&lt;/span&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;span style=&quot;font-family:&#39;Courier New&#39;;&quot;&gt;&lt;span style=&quot;color:blue;&quot;&gt;for&lt;/span&gt; (&lt;span style=&quot;color:blue;&quot;&gt;int&lt;/span&gt; i = 0; i &amp;lt; wc.Length; i++)&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;span style=&quot;font-family:&#39;Courier New&#39;;&quot;&gt;{&lt;/span&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;span style=&quot;font-family:&#39;Courier New&#39;;&quot;&gt;arrClientIDValue.Append(&lt;span style=&quot;color:maroon;&quot;&gt;&quot;\&quot;&quot;&lt;/span&gt; + wc[i].ClientID + &lt;span style=&quot;color:maroon;&quot;&gt;&quot;\&quot;,&quot;&lt;/span&gt;);&lt;/span&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;span style=&quot;font-family:&#39;Courier New&#39;;&quot;&gt;arrServerIDValue.Append(&lt;span style=&quot;color:maroon;&quot;&gt;&quot;\&quot;&quot;&lt;/span&gt; + wc[i].ID + &lt;span style=&quot;color:maroon;&quot;&gt;&quot;\&quot;,&quot;&lt;/span&gt;);&lt;/span&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;span style=&quot;font-family:&#39;Courier New&#39;;&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;span style=&quot;font-family:Courier New;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;font-family:&#39;Courier New&#39;;&quot;&gt;cs.RegisterArrayDeclaration(&lt;span style=&quot;color:maroon;&quot;&gt;&quot;MyClientID&quot;&lt;/span&gt;, arrClientIDValue.ToString().Remove (arrClientIDValue.ToString().Length - 1, 1));&lt;/span&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;span style=&quot;font-family:&#39;Courier New&#39;;&quot;&gt;cs.RegisterArrayDeclaration(&lt;span style=&quot;color:maroon;&quot;&gt;&quot;MyServerID&quot;&lt;/span&gt;, arrServerIDValue.ToString().Remove(arrServerIDValue.ToString().Length - 1, 1));&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;span style=&quot;font-family:&#39;Courier New&#39;;&quot;&gt;cs.RegisterStartupScript(&lt;span style=&quot;color:blue;&quot;&gt;this&lt;/span&gt;.Page.GetType(), &lt;span style=&quot;color:maroon;&quot;&gt;&quot;key&quot;&lt;/span&gt;, &lt;span style=&quot;color:maroon;&quot;&gt;&quot;\nfunction GetClientId(serverId)\n{\nfor(i=0; i&amp;lt;MyServerID.length; i++)\n{\nif ( MyServerID[i] == serverId )\n{\nreturn MyClientID[i];\nbreak;\n}\n}\n} &quot;&lt;/span&gt;, &lt;span style=&quot;color:blue;&quot;&gt;true&lt;/span&gt;);&lt;/span&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;span style=&quot;font-family:&#39;Courier New&#39;;&quot;&gt;}&lt;/span&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;span style=&quot;font-family:&#39;Courier New&#39;;&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;&lt;span style=&quot;;font-family:Courier New;font-size:85%;&quot;  &gt;&lt;/span&gt; &lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;/span&gt;&lt;span style=&quot;font-family:Verdana;&quot;&gt;&lt;span style=&quot;color:black;&quot;&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;We can make these codes as part of a common class for all the UI pages, so that in each page if need to access any one control in the JavaScript we can simply call the below function with the parameter as the controls to be accessed. &lt;/span&gt;&lt;/p&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;/span&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 128, 0);font-size:85%;&quot; &gt;// Here give the coma seperated controls for which the client ids should be rendered&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;RenderJSArrayWithCliendIds(txtTest,lblTest);&lt;br /&gt;&lt;br /&gt;This is one of the simplest ways to have a mapping between the client and the server id. By this way no need to worry about accessing a control inside a MasterPage from an external javascript files.&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;After this codes we can access the elements which are given in the RenderJSArrayWithCliendIds function in the javascript as shown below&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;/span&gt; &lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;&lt;span style=&quot;;font-family:verdana;font-size:85%;&quot;  &gt;&lt;span style=&quot;color: rgb(0, 153, 0);&quot;&gt;// Get the text box&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(51, 51, 255);&quot;&gt;var&lt;/span&gt; txtTest = document.getElementById(GetClientId(&quot;txtTest &quot;));&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;&lt;span style=&quot;;font-family:verdana;font-size:85%;&quot;  &gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt; &lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;This will slove the issues arrised due to the change in the client id of the control which is placed inside a MasterPage.&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;Updates: &lt;/span&gt;I am not much experienced in VB, but still tried to translate the C# code to VB. Just check the below code.&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;Public Sub RenderJSArrayWithCliendIds(ByVal wc As Control())&lt;br /&gt;        If (wc.Length &gt; 0) Then&lt;br /&gt;            Dim arrClientIDValue As StringBuilder = New StringBuilder()&lt;br /&gt;            Dim arrServerIDValue As StringBuilder = New StringBuilder()&lt;br /&gt;            Dim cs As ClientScriptManager = Page.ClientScript&lt;br /&gt;            Dim frm As HtmlForm = Page.Form&lt;br /&gt;            Dim i As Integer&lt;br /&gt;            For i = 0 To wc.Length&lt;br /&gt;                arrClientIDValue.Append(&quot;\&quot;&quot; + wc[i].ClientID + &quot; \ &quot;,&quot;)&lt;br /&gt;                arrServerIDValue.Append(&quot;\&quot;&quot; + wc[i].ID + &quot; \ &quot;,&quot;)&lt;br /&gt;                i = i + 1&lt;br /&gt;            Next&lt;br /&gt;            cs.RegisterArrayDeclaration(&quot;MyClientID&quot;, arrClientIDValue.ToString().Remove(arrClientIDValue.ToString().Length - 1, 1))&lt;br /&gt;            cs.RegisterArrayDeclaration(&quot;MyServerID&quot;, arrServerIDValue.ToString().Remove(arrServerIDValue.ToString().Length - 1, 1))&lt;br /&gt;            cs.RegisterStartupScript(Page.GetType(), &quot;key&quot;, &quot;\nfunction GetClientId(serverId)\nBegin\nfori=0; i&amp;lt;MyServerID.legth; i++)\nBegin\nif ( MyServerID[i] == serverId )\nBegin\nreturn MyClientI[i];\nbeak;\nEnd\nEnd\nEnd\n \nfunction GetObject(serverId)\nBegin\nfori=0; i&amp;lt;MyServerID.legth; i++)\nBegin\nif ( MyServerID[i] == serverId )\nBegin\nreturn document.all[MyClientIDi]];\nbeak;\nEnd\nEnd\nEnd\n&quot;, True)&lt;br /&gt;        End If&lt;br /&gt;    End Sub&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;/span&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://rajganesh-mountbatton.blogspot.com/feeds/5189615656127504898/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/8415691839245064305/5189615656127504898' title='10 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8415691839245064305/posts/default/5189615656127504898'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8415691839245064305/posts/default/5189615656127504898'/><link rel='alternate' type='text/html' href='http://rajganesh-mountbatton.blogspot.com/2007/12/masterpage-documentgetelementbyid-issue.html' title='Masterpage – document.getElementById Issue'/><author><name>Rajganesh Mountbatton</name><uri>http://www.blogger.com/profile/12427299066251296073</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgUurRxnxs4z-I9qkEcoO5NcEdUWxbdW2McZI45ISAVsMaxg3IDdER9UfclNeMTHc8XrH8sMI58iq74ISeRxI9TZF4oUBC2CZa4DtG7hgPjUacQoYJq-jLitd8VHU4rrDk/s220/New_Close_Up.JPG'/></author><thr:total>10</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8415691839245064305.post-2155527471719516715</id><published>2007-10-19T08:20:00.000+05:30</published><updated>2007-10-19T09:07:43.749+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Javascript"/><title type='text'>parseInt - Javascript issue</title><content type='html'>&lt;span style=&quot;font-family:verdana;font-size:85%;color:#000000;&quot;&gt;What would be the result of the following javascript&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:verdana;font-size:85%;color:#000000;&quot;&gt;var value = &quot;08&quot;;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:verdana;font-size:85%;color:#000000;&quot;&gt;value = parseInt(value);&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:verdana;font-size:85%;color:#000000;&quot;&gt;alert(value);&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:verdana;font-size:85%;color:#000000;&quot;&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:verdana;font-size:85%;color:#000000;&quot;&gt;When we just go through the above script, we would expect the result as &quot;8&quot; should be alerted. But to all our surprise the result would be &quot;0&quot;.&lt;br /&gt;&lt;br /&gt;Let us analyze how this happened.&lt;br /&gt;&lt;br /&gt;when ever the browser tries parseInt(&quot;08&quot;), zero in front tells the browser that this is an octal (base 8) number and hence will be returned as &quot;0&quot;.&lt;br /&gt;&lt;br /&gt;This is the default behavior of the parseInt function, to read more about the function &lt;/span&gt;&lt;a href=&quot;http://www.devguru.com/Technologies/ecmaScript/quickref/parseint.html&quot;&gt;&lt;span style=&quot;font-family:verdana;font-size:85%;color:#000000;&quot;&gt;click here&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;font-family:verdana;font-size:85%;color:#000000;&quot;&gt;.&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family:verdana;font-size:85%;color:#000000;&quot;&gt;&lt;br /&gt;So what we need to do in this case?&lt;br /&gt;&lt;br /&gt;If we just check the intellisence result for the parseInt, it will be like&lt;/span&gt;&lt;br /&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiCtY9UvxkHIx13BRj7y0azkhqhKa-rLHZJkM_Vr2UD5ezQlKjBHN5Wur67FwShcC4epGyWkpMMPi8i6YnU_ZYgZBTc4K2lgR8yL0WNtxJu7IZeT0djGAuACdwgu3tBIehI1gFnjpB7iTEg/s1600-h/parseInt.bmp&quot;&gt;&lt;span style=&quot;font-family:verdana;font-size:85%;color:#000000;&quot;&gt;&lt;img id=&quot;BLOGGER_PHOTO_ID_5122883174693260882&quot; style=&quot;CURSOR: hand&quot; alt=&quot;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiCtY9UvxkHIx13BRj7y0azkhqhKa-rLHZJkM_Vr2UD5ezQlKjBHN5Wur67FwShcC4epGyWkpMMPi8i6YnU_ZYgZBTc4K2lgR8yL0WNtxJu7IZeT0djGAuACdwgu3tBIehI1gFnjpB7iTEg/s320/parseInt.bmp&quot; border=&quot;0&quot; /&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style=&quot;font-family:verdana;font-size:85%;color:#000000;&quot;&gt;So it accepts another one argument called radix, and the definition of radix is as follows&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family:verdana;font-size:85%;color:#000000;&quot;&gt;&lt;br /&gt;&quot;The radix parameter is used to specify which numeral system to be used, for example, a radix of 16 (hexadecimal) indicates that the number in the string should be parsed from a hexadecimal number to a decimal number.&quot;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family:verdana;font-size:85%;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;color:#000000;&quot;&gt;And if the radix parameter is not supplied, browser assumes the following:&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family:verdana;font-size:85%;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family:verdana;font-size:85%;&quot;&gt;&lt;ul&gt;&lt;li&gt;&lt;span style=&quot;color:#000000;&quot;&gt;If the string begins with &quot;0x&quot;, the radix is 16 (hexadecimal) &lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style=&quot;color:#000000;&quot;&gt;If the string begins with &quot;0&quot;, the radix is 8 (octal). This feature is deprecated &lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style=&quot;color:#000000;&quot;&gt;If the string begins with any other value, the radix is 10 (decimal) &lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;span style=&quot;color:#000000;&quot;&gt;So in our case, browser assumed the radix as 8 and returned a value of &quot;0&quot;. To solve this issue whenever we are calling the parseInt we should explicitly specify the radix value.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://rajganesh-mountbatton.blogspot.com/feeds/2155527471719516715/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/8415691839245064305/2155527471719516715' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8415691839245064305/posts/default/2155527471719516715'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8415691839245064305/posts/default/2155527471719516715'/><link rel='alternate' type='text/html' href='http://rajganesh-mountbatton.blogspot.com/2007/10/parseint-javascript-issue.html' title='parseInt - Javascript issue'/><author><name>Rajganesh Mountbatton</name><uri>http://www.blogger.com/profile/12427299066251296073</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgUurRxnxs4z-I9qkEcoO5NcEdUWxbdW2McZI45ISAVsMaxg3IDdER9UfclNeMTHc8XrH8sMI58iq74ISeRxI9TZF4oUBC2CZa4DtG7hgPjUacQoYJq-jLitd8VHU4rrDk/s220/New_Close_Up.JPG'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiCtY9UvxkHIx13BRj7y0azkhqhKa-rLHZJkM_Vr2UD5ezQlKjBHN5Wur67FwShcC4epGyWkpMMPi8i6YnU_ZYgZBTc4K2lgR8yL0WNtxJu7IZeT0djGAuACdwgu3tBIehI1gFnjpB7iTEg/s72-c/parseInt.bmp" height="72" width="72"/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8415691839245064305.post-7986632470124151123</id><published>2007-10-18T09:06:00.001+05:30</published><updated>2009-11-30T11:40:45.002+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="XML"/><title type='text'>XML PARSE ERROR:  Missing end-tag - Error in Export to Excel</title><content type='html'>&lt;blockquote&gt;&lt;/blockquote&gt;&lt;blockquote&gt;&lt;/blockquote&gt;&lt;div align=&quot;left&quot;&gt;&lt;span style=&quot;color: black; font-family: verdana; font-size: 85%;&quot;&gt;Last week i was debugging a strange problem which came in the export to excel option in one of our web page. We have a export method which, will accept the dataset and will loop through it and builds the XML schema for the excel.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div align=&quot;left&quot;&gt;&lt;span style=&quot;color: black; font-family: verdana; font-size: 85%;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div align=&quot;left&quot;&gt;&lt;span style=&quot;color: black; font-family: verdana; font-size: 85%;&quot;&gt;When we were using this excel method to export some data, it went fine and the response rendered the Open or Save dialog box. But when we try to open the excel file it gave a error stating the following&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div align=&quot;left&quot;&gt;&lt;span style=&quot;color: black; font-family: verdana; font-size: 85%;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;span style=&quot;font-size: 85%;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div align=&quot;left&quot;&gt;&lt;span style=&quot;font-size: 85%;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;span style=&quot;font-size: 85%;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div align=&quot;left&quot;&gt;&lt;span style=&quot;font-size: 85%;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;font-family: verdana;&quot;&gt;Problem came up in following areas during load:&lt;/span&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div align=&quot;left&quot;&gt;&lt;span style=&quot;font-size: 85%;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;font-family: verdana;&quot;&gt;Table&lt;/span&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div align=&quot;left&quot;&gt;&lt;span style=&quot;color: black; font-family: verdana; font-size: 85%;&quot;&gt;This file cannot be opened because of errors. Errors are listed in: C:\Documents and Settings\UserId\Local Settings\Temporary Internet Files\Content.MSO\90797611.log&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;span style=&quot;font-size: 85%;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div align=&quot;left&quot;&gt;&lt;span style=&quot;font-size: 85%;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;span style=&quot;font-size: 85%;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div align=&quot;left&quot;&gt;&lt;span style=&quot;font-size: 85%;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;font-family: verdana;&quot;&gt;And when we open the specified 90797611.log file the message it had was,&lt;/span&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div align=&quot;left&quot;&gt;&lt;span style=&quot;color: black; font-family: verdana; font-size: 85%;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;span style=&quot;font-size: 85%;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div align=&quot;left&quot;&gt;&lt;span style=&quot;font-size: 85%;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;span style=&quot;font-size: 85%;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div align=&quot;left&quot;&gt;&lt;i&gt;&lt;span style=&quot;font-size: 85%;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;font-family: verdana;&quot;&gt;XML PARSE ERROR: Missing end-tag&lt;br /&gt;
Error occurs at or below this element stack:&lt;br /&gt;
&amp;lt;ss:Workbook&amp;gt;&lt;br /&gt;
&amp;lt;ss:Worksheet&amp;gt;&lt;br /&gt;
&amp;lt;ss:Table&amp;gt;&lt;br /&gt;
&amp;lt;ss:Row&amp;gt;&lt;br /&gt;
&amp;lt;ss:Cell&amp;gt;&lt;br /&gt;
&amp;lt;ss:Data&amp;gt;&lt;br /&gt;
&amp;lt;ss:Font&amp;gt;&lt;br /&gt;
&amp;lt;ss:B&amp;gt;&lt;br /&gt;
&amp;lt;ss:I&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;br /&gt;
&lt;/div&gt;&lt;i&gt;&lt;/i&gt;&lt;br /&gt;
&lt;div align=&quot;left&quot;&gt;&lt;span style=&quot;color: black; font-family: verdana; font-size: 85%;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;span style=&quot;font-size: 85%;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div align=&quot;left&quot;&gt;&lt;span style=&quot;font-size: 85%;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;span style=&quot;font-size: 85%;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div align=&quot;left&quot;&gt;&lt;span style=&quot;font-size: 85%;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;font-family: verdana;&quot;&gt;By looking in to this i was not able to get any thing, after doing some R&amp;amp;D I came to a conclusion that there were some problem with regarding &lt;i&gt;&quot;&amp;lt;ss:Font&amp;gt; &amp;lt;ss:B&amp;gt; &amp;lt;ss:I&amp;gt;&quot;&lt;/i&gt;.&lt;/span&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div align=&quot;left&quot;&gt;&lt;span style=&quot;color: black; font-family: verdana; font-size: 85%;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;span style=&quot;font-size: 85%;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div align=&quot;left&quot;&gt;&lt;span style=&quot;font-size: 85%;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;span style=&quot;font-size: 85%;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div align=&quot;left&quot;&gt;&lt;span style=&quot;font-size: 85%;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;font-family: verdana;&quot;&gt;Finally i decided to have a look at the dataset which is supplied to the export method, and to my surprise there was a field with the following data in it&lt;/span&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div align=&quot;left&quot;&gt;&lt;span style=&quot;color: black; font-family: verdana; font-size: 85%;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;span style=&quot;font-size: 85%;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div align=&quot;left&quot;&gt;&lt;span style=&quot;font-size: 85%;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;span style=&quot;font-size: 85%;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div align=&quot;left&quot;&gt;&lt;span style=&quot;font-size: 85%;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;i&gt;&lt;span style=&quot;font-family: verdana;&quot;&gt;&amp;lt;Font colour=&quot;green&quot;&amp;gt;&amp;lt;B&amp;gt;&amp;lt;I&amp;gt;7358&amp;lt;/B&amp;gt;&amp;lt;/I&amp;gt;&amp;lt;/Font&amp;gt;&lt;/span&gt;&lt;/i&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div align=&quot;left&quot;&gt;&lt;span style=&quot;color: black; font-family: verdana; font-size: 85%;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;span style=&quot;font-size: 85%;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div align=&quot;left&quot;&gt;&lt;span style=&quot;font-size: 85%;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;span style=&quot;font-size: 85%;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div align=&quot;left&quot;&gt;&lt;span style=&quot;color: black; font-family: verdana; font-size: 85%;&quot;&gt;As we are building a XML, the &amp;lt;Font colour=&quot;green&quot;&amp;gt; got treated as a XML tag and it was expecting a corresponding end tag. This created the whole problem.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div align=&quot;left&quot;&gt;&lt;span style=&quot;color: black; font-family: Verdana; font-size: 85%;&quot;&gt;&lt;/span&gt; &lt;br /&gt;
&lt;/div&gt;&lt;div align=&quot;left&quot;&gt;&lt;span style=&quot;color: black; font-family: Verdana; font-size: 85%;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div align=&quot;left&quot;&gt;&lt;span style=&quot;color: black; font-family: Verdana; font-size: 85%;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div align=&quot;left&quot;&gt;&lt;span style=&quot;color: black; font-family: Verdana; font-size: 85%;&quot;&gt;After removing &lt;i&gt;&amp;lt;Font colour=&quot;green&quot;&amp;gt;&amp;lt;B&amp;gt;&amp;lt;I&amp;gt;&lt;/i&gt; from the data, every thing worked fine.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div align=&quot;left&quot;&gt;&lt;span style=&quot;font-family: Verdana; font-size: 85%;&quot;&gt;&lt;/span&gt; &lt;br /&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rajganesh-mountbatton.blogspot.com/feeds/7986632470124151123/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/8415691839245064305/7986632470124151123' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8415691839245064305/posts/default/7986632470124151123'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8415691839245064305/posts/default/7986632470124151123'/><link rel='alternate' type='text/html' href='http://rajganesh-mountbatton.blogspot.com/2007/10/xml-parse-error-missing-end-tag-error.html' title='XML PARSE ERROR:  Missing end-tag - Error in Export to Excel'/><author><name>Rajganesh Mountbatton</name><uri>http://www.blogger.com/profile/12427299066251296073</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgUurRxnxs4z-I9qkEcoO5NcEdUWxbdW2McZI45ISAVsMaxg3IDdER9UfclNeMTHc8XrH8sMI58iq74ISeRxI9TZF4oUBC2CZa4DtG7hgPjUacQoYJq-jLitd8VHU4rrDk/s220/New_Close_Up.JPG'/></author><thr:total>2</thr:total></entry></feed>