<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="wordpress/2.0.3" -->
<rss version="2.0" 
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>

<channel>
	<title>Ye Meri Life Hai!</title>
	<link>http://ankitjain.info/ankit</link>
	<description>(ये मेरी लाईफ है)  »  It's all about Ankit ń Code ! «</description>
	<pubDate>Mon, 05 May 2008 18:59:49 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.0.3</generator>
	<language>en</language>
			<item>
		<title>Visual Studio - Database Project Not Loading</title>
		<link>http://ankitjain.info/ankit/2008/05/05/visual-studio-database-project-not-loading</link>
		<comments>http://ankitjain.info/ankit/2008/05/05/visual-studio-database-project-not-loading#comments</comments>
		<pubDate>Mon, 05 May 2008 14:50:51 +0000</pubDate>
		<dc:creator>Ankit</dc:creator>
		
	<category>Programming/Code</category>
	<category>Microsoft</category>
		<guid isPermaLink="false">http://ankitjain.info/ankit/2008/05/05/visual-studio-database-project-not-loading</guid>
		<description><![CDATA[Have you ever created a Database project and after some time you are not able to load it in the Visual Studio?  Probably you might be getting following error:

An error has occurred while establishing a connection to the server.  When connecting to SQL Server 2005, this failure may be caused by the fact [...]]]></description>
			<content:encoded><![CDATA[<p class="MsoNormal">Have you ever created a Database project and after some time you are not able to load it in the Visual Studio?  Probably you might be getting following error:</p>
<blockquote>
<p class="MsoNormal">An error has occurred while establishing a connection to the server.  When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)</p>
</blockquote>
<p class="MsoNormal">The database project requires an active database connection to load at design time. Probably it uses that to compile/verify scripts. The problem here is Visual Studio is not able to connect to any such instance. Following are few solutions (these worked for me)</p>
<ol type="1" style="margin-top: 0in" start="1">
<li class="MsoNormal">Make sure the instance to      which you want to connect is running and allows remote connections.</li>
<li class="MsoNormal">After performing step 1, if      it is still not loading then you may need to start the SQL Browser      Service. Make sure it’s running.</li>
<li class="MsoNormal">If the problem is still there,      it has to be fixed from Visual Studio itself. Actually database project do      not store to which instance it can connect. It’s a Visual Studio setting.      In VS2008 go to Tool > Options > Database Tools > Design-time Validation      Database > Connection Options. Specify your instance name here like “.\SQLEXPRESS”</li>
</ol>
<p class="MsoNormal">If the problem is still there post it to <a title="Visual Studio Team System - Database Professionals" target="_blank" href="http://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=725&#038;SiteID=1">MSDN forums</a> <img src='http://ankitjain.info/ankit/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p class="MsoNormal">Ankit</p>
]]></content:encoded>
			<wfw:commentRSS>http://ankitjain.info/ankit/2008/05/05/visual-studio-database-project-not-loading/feed/</wfw:commentRSS>
		</item>
		<item>
		<title>Sony Ericsson W660i: Features</title>
		<link>http://ankitjain.info/ankit/2008/05/04/sony-ericsson-w660i-features</link>
		<comments>http://ankitjain.info/ankit/2008/05/04/sony-ericsson-w660i-features#comments</comments>
		<pubDate>Sat, 03 May 2008 19:01:36 +0000</pubDate>
		<dc:creator>Ankit</dc:creator>
		
	<category>My Life...</category>
	<category>Technology Trends</category>
		<guid isPermaLink="false">http://ankitjain.info/ankit/2008/05/04/sony-ericsson-w660i-features</guid>
		<description><![CDATA[Two days back I bought W660i, a Walkman series mobile phone from Sony Ericsson. It features 2 MP Camera, Walkman 2.0, FM Radio, 512 MB card, Bluetooth, Video Call, Email/RSS, USB mass storage, Flight mode, Synchronization services, Stylish, … … all these in less than INR 9K.

In addition to those common features, this phone features [...]]]></description>
			<content:encoded><![CDATA[<p>Two days back I bought <a target="_blank" title="W660i Home Page" href="http://www.sonyericsson.com/cws/products/mobilephones/overview/w660i?cc=ee&#038;lc=et">W660i</a>, a Walkman series mobile phone from Sony Ericsson. It features 2 MP Camera, Walkman 2.0, FM Radio, 512 MB card, Bluetooth, Video Call, Email/RSS, USB mass storage, Flight mode, Synchronization services, Stylish, … … all these in less than INR 9K.</p>
<div style="text-align: center"><img title="Front and Side view of W660i" alt="Front and Side view of W660i" src="http://www.sonyericsson.com/cws/file/1.242891.1193019175/W660i_frontandside_image_record~black.png" /></div>
<p>In addition to those common features, this phone features something new. In this post I’m going to write those specifications which you won’t be able to know unless you buy the phone. Here are a few…</p>
<ol>
<li>Bright display! I can read text even in sun light. The phone comes with preloaded high contrast images, watching those you can see how much color contrast it delivers !!! - far from any other manufacturer in the same prize range.</li>
<li>3.5mm jack support. This allows any kind of head phones to be used with the phone.</li>
<li>Text Copy/Paste feature. Handy for coping/writing SMS.</li>
<li>J2ME with support of - Internet access, File system read/write access API, camera API, Messaging APIs, automatic start, local connectivity API, running Java apps in background.</li>
<li>You can have at max 1000 Contacts, 1000 SMS memory and 380 events/tasks. (~26MB internal memory)</li>
<li>5 alarms, and you can also set FM alarm.</li>
<li>Two kind of keypad lights. <span style="font-style: italic">White </span>for normal purpose and <span style="font-style: italic">Orange </span>when Walkman is running. The orange light blinks on the beats of the song.</li>
<li>USB charging: When you connect this phone to PC it start charging from the USB cable.</li>
<li>Flash Menu: The main menu in this phone is built using <a target="_blank" title="Adobe Flash Lite" href="http://www.adobe.com/products/flashlite/">Flash Lite</a>. You can switch the orientation and look of the menu. Menu items can be tiled, horizontally or vertical aligned, and can have cool animations.</li>
<li>Synchronization is one of the most important service that we should use. In short taking backup of the phone data. I sync my phone regularly with PC. The phone supports synchronization via USB data cable, Bluetooth, or  internet server.</li>
<li>Stereo Bluetooth, Picture Blogging, Voice Dial + Playing Caller&#8217;s name, Big Fonts, Video Ringtone, etc;</li>
</ol>
<p>Go and get the phone&#8230; it&#8217;s a worth buy cellphone.</p>
<p>Note: The camera is not good as compared to &#8216;K&#8217; series (remember it&#8217;s Walkman phone, and this is acceptable). Still it supports EXIF, Night Mode, Effects, Self Timer, Low shutter sound, etc;</p>
<p>Ankit
</p>
]]></content:encoded>
			<wfw:commentRSS>http://ankitjain.info/ankit/2008/05/04/sony-ericsson-w660i-features/feed/</wfw:commentRSS>
		</item>
		<item>
		<title>Eating Exceptions&#8230; eeehhhh!</title>
		<link>http://ankitjain.info/ankit/2008/04/24/csharp-eat-exception-try</link>
		<comments>http://ankitjain.info/ankit/2008/04/24/csharp-eat-exception-try#comments</comments>
		<pubDate>Thu, 24 Apr 2008 08:03:19 +0000</pubDate>
		<dc:creator>Ankit</dc:creator>
		
	<category>Programming/Code</category>
	<category>Coding Guidelines</category>
		<guid isPermaLink="false">http://ankitjain.info/ankit/2008/04/24/csharp-eat-exception-try</guid>
		<description><![CDATA[Following are few points you need to take care when you decide to eat an exception. These are very much specific to C# language.
a.       Limit the code block. Attempt  to wrap one or two statements within try.
b.      If an exception is eaten, log [...]]]></description>
			<content:encoded><![CDATA[<p class="MsoListParagraphCxSpMiddle">Following are few points you need to take care when you decide to eat an exception. These are very much specific to C# language.</p>
<p style="margin-left: 1in; text-indent: -0.25in" class="MsoListParagraphCxSpMiddle">a.<span style="font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal">       </span>Limit the code block. Attempt  to wrap one or two statements within <span style="font-size: 10pt; color: blue; line-height: 115%; font-family: 'Courier New'">try</span>.</p>
<p style="margin-left: 1in; text-indent: -0.25in" class="MsoListParagraphCxSpMiddle">b.<span style="font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal">      </span>If an exception is eaten, log  details to some logging mechanism. In short never write empty catch <span style="font-size: 10pt; color: blue; line-height: 115%; font-family: 'Courier New'">catch</span><span style="font-size: 10pt; line-height: 115%; font-family: 'Courier New'">(</span><span style="color: #2b91af">Exception</span>) {}.</p>
<p style="margin-left: 1in; text-indent: -0.25in" class="MsoListParagraphCxSpMiddle">c.<span style="font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal">       </span>Never eat exception that  indicates some bad behavior of code execution like - <span style="font-size: 10pt; color: #2b91af; line-height: 115%; font-family: 'Courier New'">ArgumentNullException</span>,</p>
<p style="margin-left: 1in" class="MsoListParagraphCxSpMiddle"><span style="font-size: 10pt; color: #2b91af; line-height: 115%; font-family: 'Courier New'">NullReferenceException</span>,</p>
<p style="margin-left: 1in" class="MsoListParagraphCxSpMiddle"><span style="font-size: 10pt; color: #2b91af; line-height: 115%; font-family: 'Courier New'">ArgumentNullException</span>,</p>
<p style="margin-left: 1in" class="MsoListParagraphCxSpMiddle"><span style="font-size: 10pt; color: #2b91af; line-height: 115%; font-family: 'Courier New'">InvalidCastException</span>,</p>
<p style="margin-left: 1in" class="MsoListParagraphCxSpMiddle"><span style="font-size: 10pt; color: #2b91af; line-height: 115%; font-family: 'Courier New'">InvalidOperationException</span>,</p>
<p style="margin-left: 1in" class="MsoListParagraphCxSpMiddle"><span style="font-size: 10pt; color: #2b91af; line-height: 115%; font-family: 'Courier New'">AccessViolationException</span>,  etc;</p>
<p style="margin-left: 1in; text-indent: -0.25in" class="MsoListParagraphCxSpMiddle">d.<span style="font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal">      </span>There is <a target="_blank" href="http://msdn2.microsoft.com/en-us/library/aa664760(VS.71).aspx">a big  difference between</a> <span style="font-size: 10pt; color: blue; line-height: 115%; font-family: 'Courier New'">throw</span>  and <span style="font-size: 10pt; color: blue; line-height: 115%; font-family: 'Courier New'">throw  </span><span style="font-size: 10pt; line-height: 115%; font-family: 'Courier New'">exeception</span> statements.  <a target="_blank" href="http://www.winterdom.com/weblog/PermaLink,guid,154.aspx">This is in  terms of resetting stack trace which the later does.</a> If you are writing a  framework or want to hide your internal implementation use <span style="font-size: 10pt; color: blue; line-height: 115%; font-family: 'Courier New'">throw  </span><span style="font-size: 10pt; line-height: 115%; font-family: 'Courier New'">exception</span>,  otherwise use <span style="font-size: 10pt; color: blue; line-height: 115%; font-family: 'Courier New'">throw</span> only.</p>
<p>- Ankit
</p>
]]></content:encoded>
			<wfw:commentRSS>http://ankitjain.info/ankit/2008/04/24/csharp-eat-exception-try/feed/</wfw:commentRSS>
		</item>
		<item>
		<title>Let&#8217;s Digg into Google Maps</title>
		<link>http://ankitjain.info/ankit/2008/04/17/lets-hack-google-maps</link>
		<comments>http://ankitjain.info/ankit/2008/04/17/lets-hack-google-maps#comments</comments>
		<pubDate>Thu, 17 Apr 2008 17:25:40 +0000</pubDate>
		<dc:creator>Ankit</dc:creator>
		
	<category>इंटरनेट (Internet)</category>
	<category>Programming/Code</category>
	<category>गुगल (Google)</category>
		<guid isPermaLink="false">http://ankitjain.info/ankit/2008/04/17/lets-hack-google-maps</guid>
		<description><![CDATA[The Web would not be so simpler and interactive without Ajax. This technology makes Web applications pleasant, interactive, quick responsive and light weight. Take any of the online map applications, no matter whether it is Yahoo Maps, Google Maps or Windows Live Local, and you will find awesome precession, cutting edge technology (beyond DHTML, XML [...]]]></description>
			<content:encoded><![CDATA[<p class="MsoNormal" style="text-align: justify">The Web would not be so simpler and interactive without Ajax. This technology makes Web applications pleasant, interactive, quick responsive and light weight. Take any of the online map applications, no matter whether it is Yahoo Maps, Google Maps or Windows Live Local, and you will find awesome precession, cutting edge technology (beyond DHTML, XML and JavaScript) well managed data. Being software developer, these always attract me and I want to understand the scene behind those best software architectures/implementations. Over the last few days I was studying (hacking) Google maps and wanted to see how it works? Here are my investigations.</p>
<p class="MsoNormal" style="text-align: justify"><strong>Tiles: </strong>The very first observation is – not whole map is fetched at once. Instead the entire map is divided into tiles and a series of Ajax requests are fired to retrieve some part of the actually map. As soon as a tile is fetched it is displayed at its position. Their position is <em>well calculated</em> no matter user drags the maps while requests are on the way. The benefit here is, the user interface remains responsive and it makes user eager to analyze an area of map as soon as it’s available.</p>
<p><center><a title="Pune Google Map - Slices" target="_blank" href="http://ankitjain.info/ankit/wp-content/Pune-Google-Map.jpg"> <img id="image104" alt="Pune-Google-Map.jpg" src="http://ankitjain.info/ankit/wp-content/Pune-Google-Map.thumbnail.jpg" /></a> </center> <a id="more-105"></a></p>
<p class="MsoNormal"><strong>Overlaying:</strong> The tiles can be considered basic unit of mapping applications. They are atomic and have minimal required information. The DHTML allows overlapping one tile (image) over another and makes development easier. Here is how.</p>
<p class="MsoNormal">For each type of data there exists an independent tile. The Ajax application retrieves these tiles and overlaps one above another. For example - the user requests to see map and satellite image together, and here is how the rendered image is showed.<br />
<center></p>
<table width="550" style="height: 542px">
<tr>
<td align="center"><img id="image106" alt="kh_pune.jpg" src="http://ankitjain.info/ankit/wp-content/kh_pune.jpg" /></td>
<td>+</td>
<td><img id="image107" alt="mt_pune.png" src="http://ankitjain.info/ankit/wp-content/mt_pune.png" /></td>
</tr>
<tr>
<td colspan="3">
<div align="center">||</div>
<div style="text-align: center"><img id="image108" alt="overlap_pune.JPG" src="http://ankitjain.info/ankit/wp-content/overlap_pune.JPG" /></div>
</td>
</tr>
</table>
<p></center></p>
<div align="left">
<div align="left">
<div align="left">
<div align="left">
<div align="left">
<div align="left">
<div align="left">
<div align="left">
<p class="MsoNormal"><strong>Tiles are Independent:</strong> Each tile is an independent unit and its request can be customized from client browser itself. For example making a request of <a target="_blank" href="http://kh2.google.com/kh?n=415&#038;v=22&#038;hl=en&#038;t=trtssqrtqsqqtqq">http://kh2.google.com/kh?n=415&#038;v=22&#038;hl=en&#038;t=trtssqrtqsqqtqq</a>  returns -</p>
<p class="MsoNormal">
<div style="text-align: center"><img alt="kh_pune_22.jpg" id="image109" src="http://ankitjain.info/ankit/wp-content/kh_pune_22.jpg" /></div>
<p class="MsoNormal">This is a newer image. While the request for <a target="_blank" href="http://kh2.google.com/kh?n=415&#038;v=21&#038;hl=en&#038;t=trtssqrtqsqqtqq">http://kh2.google.com/kh?n=415&#038;v=21&#038;hl=en&#038;t=trtssqrtqsqqtqq</a> yields and older image for the same area.</p>
<p class="MsoNormal">
<div style="text-align: center"><img alt="kh_pune_21.jpg" id="image110" src="http://ankitjain.info/ankit/wp-content/kh_pune_21.jpg" /></div>
<p class="MsoNormal">Here the difference in the requests is of a single parameter ‘v’ and as per my guess its ‘version’. The next parameter ‘t’ seems a combination of zoom index, and the corner coordinates. For tiles of type map having some text, their language can be controlled using ‘hl=en’. Try using ‘hl=ru’ and you can see difference. So, the JavaScript executing in the client’s browser has complete control over what to display.</p>
<p class="MsoNormal">
<p class="MsoNormal">
<p class="MsoNormal">&lt; more to come &gt;</p>
<p class="MsoNormal">- ankit</p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
]]></content:encoded>
			<wfw:commentRSS>http://ankitjain.info/ankit/2008/04/17/lets-hack-google-maps/feed/</wfw:commentRSS>
		</item>
		<item>
		<title>My Online Presence</title>
		<link>http://ankitjain.info/ankit/2008/03/17/my-online-presence-privacy</link>
		<comments>http://ankitjain.info/ankit/2008/03/17/my-online-presence-privacy#comments</comments>
		<pubDate>Mon, 17 Mar 2008 05:52:20 +0000</pubDate>
		<dc:creator>Ankit</dc:creator>
		
	<category>इंटरनेट (Internet)</category>
	<category>गुगल (Google)</category>
		<guid isPermaLink="false">http://ankitjain.info/ankit/2008/03/17/my-online-presence-privacy</guid>
		<description><![CDATA[Hi,
I&#8217;m {PREF=&#8221;ID=cfd6bd57439bc4a9:TM=1205732323:LM=1205732323:S=tT1f1NaLxjumQJbv&#8221;}. I&#8217;m a regular Internet surfer. On an average I&#8217;m online for more than 8 hours a day and that makes me to think of a new phrase - &#8216;my online presence&#8217;, and somewhere it may hurt my privacy.
In Web 2.0 big companies are competing to gain as much as information about Internet users [...]]]></description>
			<content:encoded><![CDATA[<p>Hi,</p>
<p>I&#8217;m {<a target="_blank" href="http://en.wikipedia.org/wiki/Criticism_of_Google">PREF=&#8221;ID=cfd6bd57439bc4a9:TM=1205732323:LM=1205732323:S=tT1f1NaLxjumQJbv&#8221;</a>}. I&#8217;m a regular Internet surfer. On an average I&#8217;m online for more than 8 hours a day and that makes me to think of a new phrase - &#8216;my online presence&#8217;, and somewhere it may hurt my privacy.</p>
<p class="MsoNormal">In Web 2.0 big companies are competing to gain as much as information about Internet users that they can show targeted contents especially ads.</p>
<p class="MsoNormal">The game players have already begun their game. They know about what web pages I visit, they know my friends, they know what I prefer to buy online, then know which newspaper I read frequently, which mail account I use frequently, what do I search every day, what videos I watch online, where do I live, how much time I spend on Internet, what types of ads made me to click. They have my all photographs, my daily calendar/schedule, my mails (may be your credit card statements in form of emails), and all my chat conversations. They even know what music I listen, my attitude, my behavior, and even what I&#8217;m doing currently.</p>
<p class="MsoNormal">They say it&#8217;s all automatic, machines (computers) read and process information giving you personalized service and there is no human interference. But reality may be different. Is all that these sufficient to protect your privacy?</p>
<p class="MsoNormal">Here is a bigger fear, giving all of your information in the hands on one single body! A single mistake in handling such massive information can lead to world&#8217;s biggest controversy in user&#8217;s privacy.</p>
<p class="MsoNormal">In short, I don&#8217;t want anybody to know the fact that the wristwatch I have given to my girl-friend for her last birthday was of just 100 bucks!</p>
<p class="MsoNormal">- ankit</p>
]]></content:encoded>
			<wfw:commentRSS>http://ankitjain.info/ankit/2008/03/17/my-online-presence-privacy/feed/</wfw:commentRSS>
		</item>
		<item>
		<title>A Long Absence&#8230;</title>
		<link>http://ankitjain.info/ankit/2008/03/17/a-long-absence</link>
		<comments>http://ankitjain.info/ankit/2008/03/17/a-long-absence#comments</comments>
		<pubDate>Mon, 17 Mar 2008 04:51:20 +0000</pubDate>
		<dc:creator>Ankit</dc:creator>
		
	<category>My Life...</category>
		<guid isPermaLink="false">http://ankitjain.info/ankit/2008/03/17/a-long-absence</guid>
		<description><![CDATA[A lot of topics were roaming in my mind, but not able to decide what to write and which one to take first. And it has been 6 months - I haven&#8217;t written a single blog post! All this is because of my studies, hectic schedule, didn&#8217;t get enough time and few other factors.
But, now [...]]]></description>
			<content:encoded><![CDATA[<p class="MsoNormal">A lot of topics were roaming in my mind, but not able to decide what to write and which one to take first. And it has been 6 months - I haven&#8217;t written a single blog post! All this is because of my studies, hectic schedule, didn&#8217;t get enough time and few other factors.</p>
<p class="MsoNormal">But, now Ankit is back with cool and new articles to write. And one promise to the readers of my blog - such absence will not occur again. At least I&#8217;ll try to write something about my experiences, my passions, techie stuff.</p>
<p class="MsoNormal">- ankit</p>
]]></content:encoded>
			<wfw:commentRSS>http://ankitjain.info/ankit/2008/03/17/a-long-absence/feed/</wfw:commentRSS>
		</item>
		<item>
		<title>Checklist: Cannot import webpart</title>
		<link>http://ankitjain.info/ankit/2007/09/16/sharepoint-webpart-import-error</link>
		<comments>http://ankitjain.info/ankit/2007/09/16/sharepoint-webpart-import-error#comments</comments>
		<pubDate>Sun, 16 Sep 2007 11:36:29 +0000</pubDate>
		<dc:creator>Ankit</dc:creator>
		
	<category>Microsoft</category>
	<category>Quick Tricks</category>
	<category>MOSS 2007</category>
		<guid isPermaLink="false">http://ankitjain.info/ankit/2007/09/16/sharepoint-webpart-import-error</guid>
		<description><![CDATA[While importing (drag/drop) your webpart to any SharePoint page, if you receive an error stating ‘Cannot import webpart’ or ‘unable to add selected web part(s)’… here is the check list you should look for:

Make sure the webpart      class is inherited either from Microsoft.SharePoint.WebPartPages.WebPart      or System.Web.UI.WebControls.WebParts.WebPart
The [...]]]></description>
			<content:encoded><![CDATA[<p class="MsoNormal">While importing (drag/drop) your webpart to any SharePoint page, if you receive an error stating ‘Cannot import webpart’ or ‘unable to add selected web part(s)’… here is the check list you should look for:</p>
<ol type="1" start="1" style="margin-top: 0in">
<li class="MsoNormal">Make sure the webpart      class is inherited either from <span style="font-style: italic">Microsoft.SharePoint.WebPartPages.WebPart</span>      or <em>System.Web.UI.WebControls.WebParts.WebPart</em></li>
<li class="MsoNormal"><strong>The webpart class needs to be declared public.</strong></li>
<li class="MsoNormal">Safe controls entry in      web.config file.</li>
<li class="MsoNormal">If you are referring a      webpart from GAC (i.e. assembly containing webpart class is placed in GAC)      make sure the GAC version is the latest build and IIS is re-started.</li>
</ol>
<p class="MsoNormal">- Ankit</p>
]]></content:encoded>
			<wfw:commentRSS>http://ankitjain.info/ankit/2007/09/16/sharepoint-webpart-import-error/feed/</wfw:commentRSS>
		</item>
		<item>
		<title>SharePoint: ServerContext not set to an instance</title>
		<link>http://ankitjain.info/ankit/2007/09/16/server-context-not-set-instance</link>
		<comments>http://ankitjain.info/ankit/2007/09/16/server-context-not-set-instance#comments</comments>
		<pubDate>Sun, 16 Sep 2007 11:21:46 +0000</pubDate>
		<dc:creator>Ankit</dc:creator>
		
	<category>Microsoft</category>
	<category>Quick Tricks</category>
	<category>MOSS 2007</category>
		<guid isPermaLink="false">http://ankitjain.info/ankit/2007/09/16/server-context-not-set-instance</guid>
		<description><![CDATA[I was playing through SharePoint object model and somewhere (don’t remember right now!) got an exception stating “ServerContext not set to an instance”.
My solution for this: Installed SSP (Shared Services Provider) and this problem is solved!
[ Edited:2008-03-24
 I got this error while playing with stsadm.exe command
]

]]></description>
			<content:encoded><![CDATA[<p>I was playing through SharePoint object model and somewhere (don’t remember right now!) got an exception stating “ServerContext not set to an instance”.</p>
<p>My solution for this: Installed SSP (Shared Services Provider) and this problem is solved!<br />
[ <em>Edited:2008-03-24</em><br />
 I got this error while playing with stsadm.exe command<br />
]
</p>
]]></content:encoded>
			<wfw:commentRSS>http://ankitjain.info/ankit/2007/09/16/server-context-not-set-instance/feed/</wfw:commentRSS>
		</item>
		<item>
		<title>Windows CardSpace: FAQ for ASP.NET Developers</title>
		<link>http://ankitjain.info/ankit/2007/06/19/windows-infocard-faq-developers</link>
		<comments>http://ankitjain.info/ankit/2007/06/19/windows-infocard-faq-developers#comments</comments>
		<pubDate>Tue, 19 Jun 2007 18:27:39 +0000</pubDate>
		<dc:creator>Ankit</dc:creator>
		
	<category>Programming/Code</category>
	<category>Microsoft</category>
	<category>.net 3.0</category>
		<guid isPermaLink="false">http://ankitjain.info/ankit/2007/06/19/windows-infocard-faq-developers</guid>
		<description><![CDATA[Few frequently asked question for ASP.NET developers:

The Identity Selector dialog      box is displayed only for SSL protected pages. Therefore you are required      to deploy your application on a Web server and install a SSL Certificate.
Windows CardSpace does not      work with [...]]]></description>
			<content:encoded><![CDATA[<p class="MsoNormal">Few frequently asked question for ASP.NET developers:</p>
<ol type="1" style="margin-top: 0in" start="1">
<li class="MsoNormal">The Identity Selector dialog      box is displayed only for SSL protected pages. Therefore you are required      to deploy your application on a Web server and <a target="_blank" href="http://www.microsoft.com/technet/prodtechnol/windowsserver2003/library/iis/56bdf977-14f8-4867-9c51-34c346d48b04.mspx">install a SSL Certificate</a>.</li>
<li class="MsoNormal">Windows CardSpace does not      work with Self Signed Certificates and <span lang="EN">will die horribly</span>. These certificates <a target="_blank" href="http://idunno.org/archive/2007/04/06/Self-signed-Certificates-and-CardSpace.aspx">do not have CRL field</a>. It contains a <span lang="EN">URL that CardSpace will check for the      revocation list</span>.</li>
<li class="MsoNormal">For ASP.NET developers      there is Toolbox control written by <a target="_blank" href="http://www.codecomplete.de/blogs/digitalidentity/archive/2007/03/18/visual-studio-2005-toolbox-for-windows-cardspace.aspx">Christian Arnold</a>. Add this to your Toolbox and you won’t      need to write a single line of code. <a target="_blank" href="http://www.codecomplete.de/blogs/digitalidentity/archive/2007/04/11/demo-video-use-windows-cardspace-and-the-visual-studio-toolbox-for-windows-cardspace.aspx">Watch demo</a>.</li>
<li class="MsoNormal">When you use      CardSpaceLogin controls you must run application over SSL. The      application pool also need to be run under <strong>Local System</strong>’s identify;      otherwise <em>w3wp.exe</em> process will not      be able to retrieve server’s private key. In such case you may end up with      error stating “<em>Keyset does not exist</em>”. <span style="color: red">Note:      This is not advisory if the application pool is shared with other Web applications. </span> [ Edited: Refer Barry Dorrans comment for more <a target="_blank" href="http://idunno.org/archive/2007/07/01/giving-your-web-site-process-access-to-your-ssl-certificate.aspx">details</a>.]</li>
<li class="MsoNormal">When using Information cards      there is nothing like <em>passwords</em>.</li>
<li class="MsoNormal">CardSpaceLogin controls      are integrated with your identify providers such as Forms Authentication.      For example: If you use Information Card to register a user, his details      are reflected in the identify source.</li>
</ol>
<p class="MsoNormal">
]]></content:encoded>
			<wfw:commentRSS>http://ankitjain.info/ankit/2007/06/19/windows-infocard-faq-developers/feed/</wfw:commentRSS>
		</item>
		<item>
		<title>TFS – Free Text search in History Objects</title>
		<link>http://ankitjain.info/ankit/2007/05/29/tfs-%e2%80%93-free-text-search-in-history-objects</link>
		<comments>http://ankitjain.info/ankit/2007/05/29/tfs-%e2%80%93-free-text-search-in-history-objects#comments</comments>
		<pubDate>Tue, 29 May 2007 07:52:33 +0000</pubDate>
		<dc:creator>Ankit</dc:creator>
		
	<category>Programming/Code</category>
	<category>Microsoft</category>
		<guid isPermaLink="false">http://ankitjain.info/ankit/2007/05/29/tfs-%e2%80%93-free-text-search-in-history-objects</guid>
		<description><![CDATA[It&#8217;s a best practice to add comment when you do check-in to the source control. A text comment is associated with the change you made to the item. Some of the times you need to find a particular comment, but the View History tool available with Visual Studio/TFS is limited that you can&#8217;t make a [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s a best practice to add comment when you do check-in to the source control. A text comment is associated with the change you made to the item. Some of the times you need to find a particular comment, but the <em>View History</em> tool available with Visual Studio/TFS is limited that you can&#8217;t make a search in the history results. Say you want to find all check-ins by a particular user <img src='http://ankitjain.info/ankit/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </p>
<p><img alt="History Tool in Visual Studio 2005" src="http://ankitjain.info/ankit/wp-content/052907_0752_TFSFreeText12.png" /></p>
<p>Here comes the purpose of this small add-in. It provides search within history comments and find a particular change-set instead of traversing the whole list. The plug-in goes one step forward and facilitates free text search in change-set fields. For example you can use change-set id, username or even date-time as search keywords!!!</p>
<p>The major steps involved in developing this add-in are:</p>
<ol>
<li>Writing an add-in for Visual Studio 2005,</li>
<li>Getting file history from Team Foundation Server (TFS),</li>
<li>Look for the selected item in the Visual Studio IDE,</li>
<li>Free text search along with the tools to compare two files.</li>
</ol>
<p><a id="more-97"></a></p>
<p>Visual Studio 2005 provides templates to build add-ins in few minutes. Refer <a target="_blank" href="http://www.devx.com/vstudioextensibility/Article/31354">www.devx.com</a> for step-by-step guide for building Visual Studio app-ins. Additionally, you can download <a target="_blank" href="http://www.microsoft.com/downloads/details.aspx?FamilyID=79c7e038-8768-4e1e-87ae-5bbbe3886de8&#038;displaylang=en">Visual Studio 2005 Automation Samples</a> for detailed code illustrations with documentation.</p>
<p>Once you have completed the <em>Visual Studio Add-in wizard</em> the IDE generates <span style="font-family: Courier New; font-size: 10pt">Connect.cs</span> file and dumps some code for basic functionality. The next step is to retrieve history from the TFS for selected file. Refer my previous post, <a href="http://ankitjain.info/ankit/2006/12/13/tfs-version-control-build-history">Fetching file history from TFS</a> to find out how to fetch file history objects from Version Control Server.</p>
<p>Moving forward we need to find out the currently selected item in the Visual Studio IDE. Visual Studio exposes various properties/objects allowing you to query almost any UI controls and get their status.  The following code first finds the active window. If it is Source Control Explorer and then looks for the selected item within the same.</p>
<p><!--<br />
{\rtf1\ansi\ansicpg\lang1024\noproof1252\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Courier New;}}{\colortbl;??\red0\green0\blue255;\red255\green255\blue255;\red0\green0\blue0;\red43\green145\blue175;\red0\green128\blue0;\red163\green21\blue21;}??\fs20 \cf1 public\cf0  \cf1 static\cf0  \cf1 void\cf0  GetServerUriAndItemPath(\cf4 DTE2\cf0  appObj, \cf1 ref\cf0  \cf1 string\cf0  serverUri, \cf1 ref\cf0  \cf1 string\cf0  itemPath, \cf1 ref\cf0  \cf1 bool\cf0  isFolder)\par ??\{\par ??    isFolder = \cf1 false\cf0 ;\par ??\par ??    \cf5 // Get local workspace info\par ??\cf0     \cf4 WorkspaceInfo\cf0 [] wsInfo = \cf4 Workstation\cf0 .Current.GetAllLocalWorkspaceInfo();\par ??    \cf1 if\cf0  (wsInfo.Length == 0)\par ??        \cf1 throw\cf0  \cf1 new\cf0  \cf4 TFSHistorySearchException\cf0 (\cf6 "No workspace found."\cf0 );\par ??\par ??    \cf5 // Get server Uri\par ??\cf0     serverUri = wsInfo[0].ServerUri.AbsoluteUri;\par ??\par ??    \cf5 //\'a0Get\'a0a\'a0reference\'a0to the\'a0Team\'a0Foundation\'a0Server. \par ??\cf0     \cf4 TeamFoundationServer\cf0  tfs = \cf1 new\cf0  \cf4 TeamFoundationServer\cf0 (serverUri);\par ??    \cf4 VersionControlServer\cf0  vcs = tfs.GetService(\cf1 typeof\cf0 (\cf4 VersionControlServer\cf0 )) \cf1 as\cf0  \cf4 VersionControlServer\cf0 ;\par ??\par ??    \cf5 //if Active Window is Source Control Explorer\par ??\cf0     \cf1 if\cf0  (appObj.ActiveWindow.Caption.StartsWith(\cf6 "Source Control Explorer"\cf0 ))\par ??    \{\par ??        \cf4 VersionControlExt\cf0  vce;\par ??        \cf5 // The top level class used to access all other Team Foundation Version Control Extensiblity classes\par ??\cf0         vce = appObj.GetObject(\cf6 "Microsoft.VisualStudio.TeamFoundation.VersionControl.VersionControlExt"\cf0 ) \cf1 as\cf0  \cf4 VersionControlExt\cf0 ;\par ??\par ??        \cf1 if\cf0  (!vce.Explorer.Connected)\par ??        \{\par ??            \cf1 throw\cf0  \cf1 new\cf0  \cf4 TFSHistorySearchException\cf0 (\cf6 "Source control explorer is not connected to a Team Foundation Server"\cf0 );\par ??        \}\par ??\par ??        \cf5 // Get all selected items\par ??\cf0         \cf4 VersionControlExplorerItem\cf0  []selectedItems = vce.Explorer.SelectedItems;\par ??\par ??        \cf1 if\cf0  (selectedItems.Length == 0)\par ??            \cf1 throw\cf0  \cf1 new\cf0  \cf4 TFSHistorySearchException\cf0 (\cf6 "You must select one item."\cf0 );\par ??\par ??        \cf1 if\cf0  (selectedItems.Length &amp;amp;gt; 1)\par ??            \cf1 throw\cf0  \cf1 new\cf0  \cf4 TFSHistorySearchException\cf0 (\cf6 "Multiple items selected."\cf0 );\par ??\par ??        \cf1 if\cf0  (selectedItems[0].SourceServerPath.Equals(\cf6 "$/"\cf0 ))\par ??            \cf1 throw\cf0  \cf1 new\cf0  \cf4 TFSHistorySearchException\cf0 (\cf6 "Operation is not supported for the selected item."\cf0 );\par ??        \cf5 //Take the 1st item\par ??\cf0         itemPath = selectedItems[0].SourceServerPath;\par ??        isFolder = selectedItems[0].IsFolder;\par ??    \}\par ??    \cf5 //if Active Window is Solution Explorer\par ??\cf0     \cf1 else\cf0  \cf1 if\cf0  (appObj.ActiveWindow.Caption.StartsWith(\cf6 "Solution Explorer"\cf0 ))\par ??    \{\par ??        isFolder = \cf1 false\cf0 ;\par ??        \cf1 if\cf0  (appObj.SelectedItems.MultiSelect == \cf1 true\cf0 )\par ??            \cf1 throw\cf0  \cf1 new\cf0  \cf4 TFSHistorySearchException\cf0 (\cf6 "Multiple items selected."\cf0 );\par ??\par ??        \cf4 SelectedItem\cf0  selectedItem = appObj.SelectedItems.Item(1);\par ??\par ??        \cf4 SourceControl2\cf0  sc = (\cf4 SourceControl2\cf0 )appObj.SourceControl;\par ??\par ??        \cf1 string\cf0  fileName = \cf4 String\cf0 .Empty;\par ??        \cf1 if\cf0  (selectedItem.ProjectItem != \cf1 null\cf0 )\par ??        \{\par ??            \cf5 //Its a project file\par ??\cf0             fileName = selectedItem.ProjectItem.Properties.Item(\cf6 "URL"\cf0 ).Value.ToString();\par ??            fileName = \cf4 Regex\cf0 .Replace(fileName, \cf6 "file:///"\cf0 , \cf4 String\cf0 .Empty, \cf4 RegexOptions\cf0 .IgnoreCase);\par ??            \cf1 if\cf0  (fileName.EndsWith(\cf6 "\\\\"\cf0 ))\par ??            \{\par ??                fileName = fileName.Substring(0, fileName.LastIndexOf(\cf6 '\\\\'\cf0 ));\par ??                isFolder = \cf1 true\cf0 ;\par ??            \}\par ??            \cf1 try\par ??\cf0             \{\par ??                \cf4 Item\cf0  item = vcs.GetItem(fileName);\par ??                itemPath = item.ServerItem;\par ??            \}\par ??            \cf1 catch\cf0  (Microsoft.TeamFoundation.VersionControl.Client.\cf4 VersionControlException\cf0  ex)\par ??            \{\par ??                \cf1 throw\cf0  \cf1 new\cf0  \cf4 TFSHistorySearchException\cf0 (\cf6 "Item not under source control."\cf0 , ex);\par ??            \}\par ??        \}\par ??        \cf1 else\cf0  \cf1 if\cf0  (selectedItem.Project != \cf1 null\cf0 )\par ??        \{\par ??            \cf5 //Its a project\par ??\cf0             fileName = selectedItem.Project.FileName;\par ??            \cf1 try\par ??\cf0             \{\par ??                \cf4 Item\cf0  item = vcs.GetItem(fileName);\par ??                itemPath = item.ServerItem;\par ??            \}\par ??            \cf1 catch\cf0  (Microsoft.TeamFoundation.VersionControl.Client.\cf4 VersionControlException\cf0  ex)\par ??            \{\par ??                \cf1 throw\cf0  \cf1 new\cf0  \cf4 TFSHistorySearchException\cf0 (\cf6 "Item not under source control."\cf0 , ex);\par ??            \}\par ??        \}\par ??        \cf1 else\par ??\cf0         \{\par ??            \cf1 throw\cf0  \cf1 new\cf0  \cf4 TFSHistorySearchException\cf0 (\cf6 "Operation is not supported for the selected item."\cf0 );\par ??        \}\par ??    \}\par ??    \cf1 else\par ??\cf0     \{\par ??        \cf1 throw\cf0  \cf1 new\cf0  \cf4 TFSHistorySearchException\cf0 (\cf6 "Operation is not supported for the selected item."\cf0 );\par ??    \}\par ??\}\par ??}<br />
--></p>
<div style="background: white none repeat scroll 0% 50%; font-family: Courier New; font-size: 10pt; color: black; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial">
<p style="margin: 0px"><span style="color: blue">public</span> <span style="color: blue">static</span> <span style="color: blue">void</span> GetServerUriAndItemPath(<span style="color: #2b91af">DTE2</span> appObj, <span style="color: blue">ref</span> <span style="color: blue">string</span> serverUri, <span style="color: blue">ref</span> <span style="color: blue">string</span> itemPath, <span style="color: blue">ref</span> <span style="color: blue">bool</span> isFolder)</p>
<p style="margin: 0px">{</p>
<p style="margin: 0px">isFolder = <span style="color: blue">false</span>;</p>
<p style="margin: 0px">
<p style="margin: 0px"><span style="color: green">// Get local workspace info</span></p>
<p style="margin: 0px"><span style="color: #2b91af">WorkspaceInfo</span>[] wsInfo = <span style="color: #2b91af">Workstation</span>.Current.GetAllLocalWorkspaceInfo();</p>
<p style="margin: 0px"><span style="color: blue">if</span> (wsInfo.Length == 0)</p>
<p style="margin: 0px"><span style="color: blue">throw</span> <span style="color: blue">new</span> <span style="color: #2b91af">TFSHistorySearchException</span>(<span style="color: #a31515">&#8220;No workspace found.&#8221;</span>);</p>
<p style="margin: 0px">
<p style="margin: 0px"><span style="color: green">// Get server Uri</span></p>
<p style="margin: 0px">serverUri = wsInfo[0].ServerUri.AbsoluteUri;</p>
<p style="margin: 0px">
<p style="margin: 0px"><span style="color: green">// Get a reference to the Team Foundation Server. </span></p>
<p style="margin: 0px"><span style="color: #2b91af">TeamFoundationServer</span> tfs = <span style="color: blue">new</span> <span style="color: #2b91af">TeamFoundationServer</span>(serverUri);</p>
<p style="margin: 0px"><span style="color: #2b91af">VersionControlServer</span> vcs = tfs.GetService(<span style="color: blue">typeof</span>(<span style="color: #2b91af">VersionControlServer</span>)) <span style="color: blue">as</span> <span style="color: #2b91af">VersionControlServer</span>;</p>
<p style="margin: 0px">
<p style="margin: 0px"><span style="color: green">//if Active Window is Source Control Explorer</span></p>
<p style="margin: 0px"><span style="color: blue">if</span> (appObj.ActiveWindow.Caption.StartsWith(<span style="color: #a31515">&#8220;Source Control Explorer&#8221;</span>))</p>
<p style="margin: 0px">{</p>
<p style="margin: 0px"><span style="color: #2b91af">VersionControlExt</span> vce;</p>
<p style="margin: 0px"><span style="color: green">// The top level class used to access all other Team Foundation Version Control Extensiblity classes</span></p>
<p style="margin: 0px">vce = appObj.GetObject(<span style="color: #a31515">&#8220;Microsoft.VisualStudio.TeamFoundation.VersionControl.VersionControlExt&#8221;</span>) <span style="color: blue">as</span> <span style="color: #2b91af">VersionControlExt</span>;</p>
<p style="margin: 0px">
<p style="margin: 0px"><span style="color: blue">if</span> (!vce.Explorer.Connected)</p>
<p style="margin: 0px">{</p>
<p style="margin: 0px"><span style="color: blue">throw</span> <span style="color: blue">new</span> <span style="color: #2b91af">TFSHistorySearchException</span>(<span style="color: #a31515">&#8220;Source control explorer is not connected to a Team Foundation Server&#8221;</span>);</p>
<p style="margin: 0px">}</p>
<p style="margin: 0px">
<p style="margin: 0px"><span style="color: green">// Get all selected items</span></p>
<p style="margin: 0px"><span style="color: #2b91af">VersionControlExplorerItem</span> []selectedItems = vce.Explorer.SelectedItems;</p>
<p style="margin: 0px">
<p style="margin: 0px"><span style="color: blue">if</span> (selectedItems.Length == 0)</p>
<p style="margin: 0px"><span style="color: blue">throw</span> <span style="color: blue">new</span> <span style="color: #2b91af">TFSHistorySearchException</span>(<span style="color: #a31515">&#8220;You must select one item.&#8221;</span>);</p>
<p style="margin: 0px">
<p style="margin: 0px"><span style="color: blue">if</span> (selectedItems.Length &gt; 1)</p>
<p style="margin: 0px"><span style="color: blue">throw</span> <span style="color: blue">new</span> <span style="color: #2b91af">TFSHistorySearchException</span>(<span style="color: #a31515">&#8220;Multiple items selected.&#8221;</span>);</p>
<p style="margin: 0px">
<p style="margin: 0px"><span style="color: blue">if</span> (selectedItems[0].SourceServerPath.Equals(<span style="color: #a31515">&#8220;$/&#8221;</span>))</p>
<p style="margin: 0px"><span style="color: blue">throw</span> <span style="color: blue">new</span> <span style="color: #2b91af">TFSHistorySearchException</span>(<span style="color: #a31515">&#8220;Operation is not supported for the selected item.&#8221;</span>);</p>
<p style="margin: 0px"><span style="color: green">//Take the 1st item</span></p>
<p style="margin: 0px">itemPath = selectedItems[0].SourceServerPath;</p>
<p style="margin: 0px">isFolder = selectedItems[0].IsFolder;</p>
<p style="margin: 0px">}</p>
<p style="margin: 0px"><span style="color: green">//if Active Window is Solution Explorer</span></p>
<p style="margin: 0px"><span style="color: blue">else</span> <span style="color: blue">if</span> (appObj.ActiveWindow.Caption.StartsWith(<span style="color: #a31515">&#8220;Solution Explorer&#8221;</span>))</p>
<p style="margin: 0px">{</p>
<p style="margin: 0px">isFolder = <span style="color: blue">false</span>;</p>
<p style="margin: 0px"><span style="color: blue">if</span> (appObj.SelectedItems.MultiSelect == <span style="color: blue">true</span>)</p>
<p style="margin: 0px"><span style="color: blue">throw</span> <span style="color: blue">new</span> <span style="color: #2b91af">TFSHistorySearchException</span>(<span style="color: #a31515">&#8220;Multiple items selected.&#8221;</span>);</p>
<p style="margin: 0px">
<p style="margin: 0px"><span style="color: #2b91af">SelectedItem</span> selectedItem = appObj.SelectedItems.Item(1);</p>
<p style="margin: 0px">
<p style="margin: 0px"><span style="color: #2b91af">SourceControl2</span> sc = (<span style="color: #2b91af">SourceControl2</span>)appObj.SourceControl;</p>
<p style="margin: 0px">
<p style="margin: 0px"><span style="color: blue">string</span> fileName = <span style="color: #2b91af">String</span>.Empty;</p>
<p style="margin: 0px"><span style="color: blue">if</span> (selectedItem.ProjectItem != <span style="color: blue">null</span>)</p>
<p style="margin: 0px">{</p>
<p style="margin: 0px"><span style="color: green">//Its a project file</span></p>
<p style="margin: 0px">fileName = selectedItem.ProjectItem.Properties.Item(<span style="color: #a31515">&#8220;URL&#8221;</span>).Value.ToString();</p>
<p style="margin: 0px">fileName = <span style="color: #2b91af">Regex</span>.Replace(fileName, <span style="color: #a31515">&#8220;file:///&#8221;</span>, <span style="color: #2b91af">String</span>.Empty, <span style="color: #2b91af">RegexOptions</span>.IgnoreCase);</p>
<p style="margin: 0px"><span style="color: blue">if</span> (fileName.EndsWith(<span style="color: #a31515">&#8220;\\&#8221;</span>))</p>
<p style="margin: 0px">{</p>
<p style="margin: 0px">fileName = fileName.Substring(0, fileName.LastIndexOf(<span style="color: #a31515">&#8216;\\&#8217;</span>));</p>
<p style="margin: 0px">isFolder = <span style="color: blue">true</span>;</p>
<p style="margin: 0px">}</p>
<p style="margin: 0px"><span style="color: blue">try</span></p>
<p style="margin: 0px">{</p>
<p style="margin: 0px"><span style="color: #2b91af">Item</span> item = vcs.GetItem(fileName);</p>
<p style="margin: 0px">itemPath = item.ServerItem;</p>
<p style="margin: 0px">}</p>
<p style="margin: 0px"><span style="color: blue">catch</span> (Microsoft.TeamFoundation.VersionControl.Client.<span style="color: #2b91af">VersionControlException</span> ex)</p>
<p style="margin: 0px">{</p>
<p style="margin: 0px"><span style="color: blue">throw</span> <span style="color: blue">new</span> <span style="color: #2b91af">TFSHistorySearchException</span>(<span style="color: #a31515">&#8220;Item not under source control.&#8221;</span>, ex);</p>
<p style="margin: 0px">}</p>
<p style="margin: 0px">}</p>
<p style="margin: 0px"><span style="color: blue">else</span> <span style="color: blue">if</span> (selectedItem.Project != <span style="color: blue">null</span>)</p>
<p style="margin: 0px">{</p>
<p style="margin: 0px"><span style="color: green">//Its a project</span></p>
<p style="margin: 0px">fileName = selectedItem.Project.FileName;</p>
<p style="margin: 0px"><span style="color: blue">try</span></p>
<p style="margin: 0px">{</p>
<p style="margin: 0px"><span style="color: #2b91af">Item</span> item = vcs.GetItem(fileName);</p>
<p style="margin: 0px">itemPath = item.ServerItem;</p>
<p style="margin: 0px">}</p>
<p style="margin: 0px"><span style="color: blue">catch</span> (Microsoft.TeamFoundation.VersionControl.Client.<span style="color: #2b91af">VersionControlException</span> ex)</p>
<p style="margin: 0px">{</p>
<p style="margin: 0px"><span style="color: blue">throw</span> <span style="color: blue">new</span> <span style="color: #2b91af">TFSHistorySearchException</span>(<span style="color: #a31515">&#8220;Item not under source control.&#8221;</span>, ex);</p>
<p style="margin: 0px">}</p>
<p style="margin: 0px">}</p>
<p style="margin: 0px"><span style="color: blue">else</span></p>
<p style="margin: 0px">{</p>
<p style="margin: 0px"><span style="color: blue">throw</span> <span style="color: blue">new</span> <span style="color: #2b91af">TFSHistorySearchException</span>(<span style="color: #a31515">&#8220;Operation is not supported for the selected item.&#8221;</span>);</p>
<p style="margin: 0px">}</p>
<p style="margin: 0px">}</p>
<p style="margin: 0px"><span style="color: blue">else</span></p>
<p style="margin: 0px">{</p>
<p style="margin: 0px"><span style="color: blue">throw</span> <span style="color: blue">new</span> <span style="color: #2b91af">TFSHistorySearchException</span>(<span style="color: #a31515">&#8220;Operation is not supported for the selected item.&#8221;</span>);</p>
<p style="margin: 0px">}</p>
<p style="margin: 0px">}</p>
</div>
<p>The following code is to compare two source code files and show visual difference. There is an API provided for the same.</p>
<p><!--<br />
{\rtf1\ansi\ansicpg\lang1024\noproof1252\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Courier New;}}{\colortbl;??\red0\green0\blue255;\red255\green255\blue255;\red0\green0\blue0;\red43\green145\blue175;}??\fs20 \cf1 public\cf0  \cf1 static\cf0  \cf1 void\cf0  CompareLocal(\cf1 string\cf0  localPath, \cf1 string\cf0  sourceChangesetId, \cf1 string\cf0  serverUri, \cf1 string\cf0  srcPath)\par ??\{\par ??    \cf4 TeamFoundationServer\cf0  tfs = \cf4 TeamFoundationServerFactory\cf0 .GetServer(serverUri);\par ??    \cf4 VersionControlServer\cf0  vcs = tfs.GetService(\cf1 typeof\cf0 (\cf4 VersionControlServer\cf0 )) \cf1 as\cf0  \cf4 VersionControlServer\cf0 ;\par ??\par ??    \cf4 VersionSpec\cf0  sourceVersion = \cf4 VersionSpec\cf0 .ParseSingleSpec(sourceChangesetId, vcs.TeamFoundationServer.AuthenticatedUserName);\par ??\par ??    \cf4 Difference\cf0 .VisualDiffItems(vcs, \cf4 Difference\cf0 .CreateTargetDiffItem(vcs, srcPath, sourceVersion, 0, sourceVersion), \cf4 Difference\cf0 .CreateTargetDiffItem(vcs, localPath, \cf1 null\cf0 , 0, \cf1 null\cf0 ));\par ??\}\par ??}<br />
--></p>
<div style="background: white none repeat scroll 0% 50%; font-family: Courier New; font-size: 10pt; color: black; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial">
<p style="margin: 0px"><span style="color: blue">public</span> <span style="color: blue">static</span> <span style="color: blue">void</span> CompareLocal(<span style="color: blue">string</span> localPath, <span style="color: blue">string</span> sourceChangesetId, <span style="color: blue">string</span> serverUri, <span style="color: blue">string</span> srcPath)</p>
<p style="margin: 0px">{</p>
<p style="margin: 0px"><span style="color: #2b91af">TeamFoundationServer</span> tfs = <span style="color: #2b91af">TeamFoundationServerFactory</span>.GetServer(serverUri);</p>
<p style="margin: 0px"><span style="color: #2b91af">VersionControlServer</span> vcs = tfs.GetService(<span style="color: blue">typeof</span>(<span style="color: #2b91af">VersionControlServer</span>)) <span style="color: blue">as</span> <span style="color: #2b91af">VersionControlServer</span>;</p>
<p style="margin: 0px">
<p style="margin: 0px"><span style="color: #2b91af">VersionSpec</span> sourceVersion = <span style="color: #2b91af">VersionSpec</span>.ParseSingleSpec(sourceChangesetId, vcs.TeamFoundationServer.AuthenticatedUserName);</p>
<p style="margin: 0px">
<p style="margin: 0px"><span style="color: #2b91af">Difference</span>.VisualDiffItems(vcs, <span style="color: #2b91af">Difference</span>.CreateTargetDiffItem(vcs, srcPath, sourceVersion, 0, sourceVersion), <span style="color: #2b91af">Difference</span>.CreateTargetDiffItem(vcs, localPath, <span style="color: blue">null</span>, 0, <span style="color: blue">null</span>));</p>
<p style="margin: 0px">}</p>
</div>
<p>Once the add-in is installed, it appears in the Tools menu within Visual Studio 2005. Open <em>Source Control Explorer</em> and select an item. Launch the add-in from Tools menu.</p>
<p><img src="http://ankitjain.info/ankit/wp-content/052907_0752_TFSFreeText22.png" /></p>
<p>When you search for the history of a File, you can also compare it with the local version or the latest version in the source control. These option are avaiable as context menu.</p>
<p><img src="http://ankitjain.info/ankit/wp-content/052907_0752_TFSFreeText32.png" /></p>
<p><img alt="Compare options for search results (only for file types)" src="http://ankitjain.info/ankit/wp-content/TFS-History-Compare.PNG" /></p>
<p>Following steps are required only if you download the code and try to deploy the solution to have hands on with the code.</p>
<ol>
<li>Copy the <span style="font-family: Courier New; font-size: 10pt">TFSHistorySearch.AddIn</span> file to <span style="font-family: Courier New; font-size: 10pt">%userprofile%\My Documents\Visual Studio 2005\Addins\</span> directory.</li>
<li>Update the full path of the assembly <span style="font-family: Courier New; font-size: 10pt">TFSHistorySearch.dll </span>under <span style="font-family: Courier New; font-size: 10pt">Extensibility/Addin/Assembly</span> x-path.</li>
<li>Add reference of <span style="font-family: Courier New; font-size: 10pt">TFSHistorySearch.AddIn</span> as link to the project.</li>
</ol>
<p>Download Source code &#038; Installer: <a href="http://ankitjain.info/ankit/wp-content/TFSHistorySearch.zip">TFSHistorySearch.zip</a> ~700 KB<br />
Download Installer only: <a href="http://ankitjain.info/ankit/wp-content/TFSHistorySearch-Setup.zip">TFSHistorySearch-Setup.zip</a> ~400 KB</p>
<p>Implemented by:  <a target="_blank" href="http://www.topcoder.com/tc?module=MemberProfile&#038;cr=15892009&#038;tab=long">Jagdish.Vasani</a> [at] Gmail [dot] com</p>
<p>- Ankit
</p>
]]></content:encoded>
			<wfw:commentRSS>http://ankitjain.info/ankit/2007/05/29/tfs-%e2%80%93-free-text-search-in-history-objects/feed/</wfw:commentRSS>
		</item>
	</channel>
</rss>
