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

<channel>
	<title>YouCode</title>
	<atom:link href="http://youcode.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://youcode.wordpress.com</link>
	<description>An Invalid Exception of a Nullterminated mind</description>
	<lastBuildDate>Sat, 19 Nov 2011 17:59:58 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='youcode.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>YouCode</title>
		<link>http://youcode.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://youcode.wordpress.com/osd.xml" title="YouCode" />
	<atom:link rel='hub' href='http://youcode.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Managed Metadata using Taxonomy web Service</title>
		<link>http://youcode.wordpress.com/2011/11/18/managed-metadata-using-taxonomy-web-service/</link>
		<comments>http://youcode.wordpress.com/2011/11/18/managed-metadata-using-taxonomy-web-service/#comments</comments>
		<pubDate>Fri, 18 Nov 2011 21:44:26 +0000</pubDate>
		<dc:creator>sj</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">https://youcode.wordpress.com/?p=16</guid>
		<description><![CDATA[Client Object Model (OM) is fairly limited when it comes to all the functionalities provided by Sharepoint. Managed Metadata Services is one of them. To access them, Sharepoint exposes a web service called TaxonomyClientService. The asmx can be accessed at: http://myserver/_vti_bin/TaxonomyClientService.asmx Not surprisingly, it exposes the bare minimum for clients to access the data and [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=youcode.wordpress.com&amp;blog=7895492&amp;post=16&amp;subd=youcode&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p align="justify">Client Object Model (OM) is fairly limited when it comes to all the functionalities provided by Sharepoint. Managed Metadata Services is one of them. To access them, Sharepoint exposes a web service called <strong>TaxonomyClientService</strong>.</p>
<p align="justify">The asmx can be accessed at: <em><a href="http://myserver/_vti_bin/TaxonomyClientService.asmx">http://myserver/_vti_bin/TaxonomyClientService.asmx</a></em></p>
<p align="justify">Not surprisingly, it exposes the bare minimum for clients to access the data and display them. Clients won’t be able to manipulate the data with the APIs exposed. <a title="MSDN: TaxonomyClientService" href="http://msdn.microsoft.com/en-us/library/ee562146.aspx" target="_blank">Following</a> are the methods exposed:</p>
<ul>
<li><a href="http://ln1-sp2010std-1/_vti_bin/TaxonomyClientService.asmx?op=AddTerms">AddTerms</a> </li>
<li><a href="http://ln1-sp2010std-1/_vti_bin/TaxonomyClientService.asmx?op=GetChildTermsInTerm">GetChildTermsInTerm</a> </li>
<li><a href="http://ln1-sp2010std-1/_vti_bin/TaxonomyClientService.asmx?op=GetChildTermsInTermSet">GetChildTermsInTermSet</a> </li>
<li><a href="http://ln1-sp2010std-1/_vti_bin/TaxonomyClientService.asmx?op=GetKeywordTermsByGuids">GetKeywordTermsByGuids</a> </li>
<li><a href="http://ln1-sp2010std-1/_vti_bin/TaxonomyClientService.asmx?op=GetTermSets">GetTermSets</a> </li>
<li><a href="http://ln1-sp2010std-1/_vti_bin/TaxonomyClientService.asmx?op=GetTermsByLabel">GetTermsByLabel</a> </li>
</ul>
<p>So, to get going, we’ll need to add the service reference to the asmx in the Visual Studio project. Once done, it can be accessed using its SOAP client.</p>
<p>Once the web reference has been added, a proxy to the service can be created:</p>
<p>    &lt;p&gt;public static TaxonomywebserviceSoapClient CreateProxy(string siteUrl)    &lt;br /&gt;{     &lt;br /&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160; BasicHttpBinding basicHttpBinding = default(BasicHttpBinding);     &lt;br /&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160; TaxonomywebserviceSoapClient proxy = null;     &lt;br /&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160; try     &lt;br /&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {     &lt;br /&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; basicHttpBinding = GetBasicHttpBinding();&lt;/p&gt;  &lt;p&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; // The endpoints are setup towards the sub website which should be searched    &lt;br /&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; EndpointAddress endpoint = new EndpointAddress(siteUrl +&#160; &lt;br /&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &amp;quot;/_vti_bin/TaxonomyClientService.asmx&amp;quot;);     &lt;br /&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; proxy = new TaxonomywebserviceSoapClient(basicHttpBinding, endpoint);&lt;/p&gt;  &lt;p&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; // We go under impersonation and current networkcredentials    &lt;br /&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; // to sharepoint services.     &lt;br /&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; proxy.ClientCredentials.Windows.AllowedImpersonationLevel =&#160; &lt;br /&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; TokenImpersonationLevel.Impersonation;     &lt;br /&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; proxy.ClientCredentials.Windows.ClientCredential =&#160; &lt;br /&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; CredentialCache.DefaultNetworkCredentials;     &lt;br /&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }     &lt;br /&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160; catch (Exception ex)     &lt;br /&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {     &lt;br /&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; EventLog.WriteEntry(ex.Message + ex.StackTrace);     &lt;br /&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }     &lt;br /&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;br /&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160; return proxy;     &lt;br /&gt;}&lt;/p&gt;  &lt;p&gt;private static BasicHttpBinding GetBasicHttpBinding()    &lt;br /&gt;{     &lt;br /&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160; BasicHttpBinding basicHttpBinding = new BasicHttpBinding();     &lt;br /&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160; try     &lt;br /&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {     &lt;br /&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; basicHttpBinding.Security.Mode =     &lt;br /&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; BasicHttpSecurityMode.TransportCredentialOnly;     &lt;br /&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; basicHttpBinding.MaxBufferSize = 2097152;     &lt;br /&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; basicHttpBinding.MaxBufferPoolSize = 2097152;     &lt;br /&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; basicHttpBinding.MaxReceivedMessageSize = 2097152;     &lt;br /&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; basicHttpBinding.ReaderQuotas.MaxStringContentLength = 65536;     &lt;br /&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; //Security can be set to Windows. Ntlm, None, Digest, Certificate or Basic     &lt;br /&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; basicHttpBinding.Security.Transport.ClientCredentialType =     &lt;br /&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; HttpClientCredentialType.Ntlm;     &lt;br /&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }     &lt;br /&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160; catch (Exception ex)     &lt;br /&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {     &lt;br /&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; EventLog.WriteEntry(&amp;quot;TaxonomyViewer&amp;quot;, &amp;quot;ex.Message + ex.StackTrace);     &lt;br /&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; throw;     &lt;br /&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }     &lt;br /&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160; return basicHttpBinding;     &lt;br /&gt;}&lt;/p&gt; 
<p>Once the proxy is there for the web service, we can use the Client Object Model to fetch the SchemaXML containing all the info about the managed metadata field. The SchemaXML looks something like this:</p>
<p>&lt;Field Type=&quot;TaxonomyFieldType&quot; DisplayName=&quot;MMColumn1&quot; List=&quot;{821fc609-d88a-4b4f-9edc-36c7054ea8b6}&quot; WebId=&quot;7368b749-307f-40c6-b20b-406410cfe056&quot;   <br />&#160;&#160;&#160;&#160;&#160;&#160; ShowField=&quot;Term1033&quot; Required=&quot;FALSE&quot; EnforceUniqueValues=&quot;FALSE&quot; ID=&quot;{6e71ecab-32e8-4fe2-86ea-023aa32a3386}&quot;    <br />&#160;&#160;&#160;&#160;&#160;&#160; SourceID=&quot;{78f88b4b-d2c1-4e9c-bcc9-514816471c03}&quot; StaticName=&quot;MMColumn1&quot; Name=&quot;MMColumn1&quot; ColName=&quot;int1&quot; RowOrdinal=&quot;0&quot; Version=&quot;1&quot;&gt;    <br />&#160; &lt;Default&gt;6;#ChildTerm111|03389ff4-33b4-4ff8-9ac1-e9621a8ee77a&lt;/Default&gt;    <br />&#160; &lt;Customization&gt;    <br />&#160;&#160;&#160; &lt;ArrayOfProperty&gt;    <br />&#160;&#160;&#160;&#160;&#160; &lt;Property&gt;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;Name&gt;<strong>SspId</strong>&lt;/Name&gt;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;Value xmlns:q1=&quot;<a href="http://www.w3.org/2001/XMLSchema&quot;">http://www.w3.org/2001/XMLSchema&quot;</a> p4:type=&quot;q1:string&quot; xmlns:p4=&quot;<a href="http://www.w3.org/2001/XMLSchema-instance&quot;">http://www.w3.org/2001/XMLSchema-instance&quot;</a>&gt;ba1108c5-2fae-4cda-bb89-a00953f73993&lt;/Value&gt;    <br />&#160;&#160;&#160;&#160;&#160; &lt;/Property&gt;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;Name&gt;<strong>TermSetId</strong>&lt;/Name&gt;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;Value xmlns:q2=&quot;<a href="http://www.w3.org/2001/XMLSchema&quot;">http://www.w3.org/2001/XMLSchema&quot;</a> p4:type=&quot;q2:string&quot; xmlns:p4=&quot;<a href="http://www.w3.org/2001/XMLSchema-instance&quot;">http://www.w3.org/2001/XMLSchema-instance&quot;</a>&gt;2db8b15a-2f1d-4e67-b6c5-53d49be53726&lt;/Value&gt;    <br />&#160;&#160;&#160;&#160;&#160; &lt;/Property&gt;    <br />&#160;&#160;&#160;&#160;&#160; &lt;Property&gt;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;Name&gt;IsKeyword&lt;/Name&gt;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;Value xmlns:q8=&quot;<a href="http://www.w3.org/2001/XMLSchema&quot;">http://www.w3.org/2001/XMLSchema&quot;</a> p4:type=&quot;q8:boolean&quot; xmlns:p4=&quot;<a href="http://www.w3.org/2001/XMLSchema-instance&quot;">http://www.w3.org/2001/XMLSchema-instance&quot;</a>&gt;false&lt;/Value&gt;    <br />&#160;&#160;&#160;&#160;&#160; &lt;/Property&gt;    <br />&#160;&#160;&#160;&#160;&#160; …    <br />&#160;&#160;&#160; &lt;/ArrayOfProperty&gt;    <br />&#160; &lt;/Customization&gt;    <br />&lt;/Field&gt;</p>
<p>Important things to note above are:</p>
<ol>
<li>FieldType: TaxonomyFieldType for a single value field or TaxonomyFieldTypeMulti for a multi-value field</li>
<li>SspId: TermStore Guid</li>
<li>TermSetId: Term Set Guid</li>
</ol>
<p>So, now we use the client OM to get the above into action</p>
<p>public static Field GetField(string siteUrl, string strList, string strField)   <br />{    <br />&#160;&#160;&#160; try    <br />&#160;&#160;&#160; {    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; ClientContext clientContext = new ClientContext(siteUrl);    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; List oList = clientContext.Web.Lists.GetByTitle(strList);</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; clientContext.Load(oList, f =&gt; f.Fields);   <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; clientContext.ExecuteQuery();</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; clientContext.Load(oList.Fields, fs =&gt; fs.Include( f =&gt; f.Title,   <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; f =&gt; f.TypeAsString, f =&gt; f.SchemaXml));    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; clientContext.ExecuteQuery();</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; Field oField = null;   <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; foreach (Field field in oList.Fields)    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; {    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if (field.Title.Equals(strField, StringComparison.InvariantCultureIgnoreCase))    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; oField = field;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; break;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; return oField;   <br />&#160;&#160;&#160; }    <br />&#160;&#160;&#160; catch (Exception ex)    <br />&#160;&#160;&#160; {    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; EventLog.WriteEntry(ex.Message + ex.StackTrace);     <br />&#160;&#160;&#160; }</p>
<p>&#160;&#160;&#160; return null;   <br />}</p>
<p>SchemaXML obtained above can be used to get the terms in the term set.</p>
<p>void TestTermSets(TaxonomywebserviceSoapClient service, Guid termStoreId, Guid termSetId)   <br />&#160;&#160;&#160; {    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; string sXmlTimeStamp;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; XNode xnSspIds = new XElement(&quot;sspIds&quot;, new XElement(&quot;sspId&quot;, termStoreId));    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; XNode xnTermSetIds = new XElement(&quot;termSetIds&quot;, new XElement(&quot;termSetId&quot;, termSetId));    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; XNode xnDateTimes = new XElement(&quot;dateTimes&quot;, new XElement(&quot;dateTime&quot;, (new DateTime(1900, 1, 1)).ToString(&quot;s&quot;)));    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; XNode xnVersions = new XElement(&quot;versions&quot;, new XElement(&quot;version&quot;, 0));</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; try   <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; {    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; string sXml;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Stopwatch watch = new Stopwatch();    </p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; sXml = service.GetTermSets(xnSspIds.ToString(SaveOptions.DisableFormatting),    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; xnTermSetIds.ToString(SaveOptions.DisableFormatting),    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; CultureInfo.GetCultureInfo(&quot;en-US&quot;).LCID,    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; xnDateTimes.ToString(SaveOptions.DisableFormatting),    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; xnVersions.ToString(SaveOptions.DisableFormatting),    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; out sXmlTimeStamp);    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; }    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; catch (Exception ex)    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; {    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; EventLog.WriteEntry(ex.Message + ex.StackTrace);    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; }    <br />&#160;&#160;&#160; }</p>
<p>The XML returned contains all the info one needs for the term set.</p>
<p>&lt;TermStore&gt;   <br />&#160; &lt;T a9=&quot;e93dc490-6d97-42e4-8b14-8b0c63e4e693&quot; a21=&quot;false&quot; a61=&quot;0&quot;&gt;    <br />&#160;&#160;&#160; &lt;LS&gt;    <br />&#160;&#160;&#160;&#160;&#160; &lt;TL a32=&quot;Term1&quot; a31=&quot;true&quot; /&gt;    <br />&#160;&#160;&#160; &lt;/LS&gt;    <br />&#160;&#160;&#160; &lt;DS /&gt;    <br />&#160;&#160;&#160; &lt;TMS&gt;    <br />&#160;&#160;&#160;&#160;&#160; &lt;TM a24=&quot;bb58a4cf-0b70-4c71-a319-261da6b13e5f&quot; a12=&quot;TermSet1&quot; a40=&quot;&quot; a17=&quot;true&quot; a67=&quot;&quot; a45=&quot;e93dc490-6d97-42e4-8b14-8b0c63e4e693&quot; a69=&quot;true&quot; /&gt;    <br />&#160;&#160;&#160; &lt;/TMS&gt;    <br />&#160; &lt;/T&gt;    <br />&#160; &lt;T a9=&quot;ddaac853-68a4-46ee-b91c-8182679f51b4&quot; a21=&quot;false&quot; a61=&quot;0&quot;&gt;    <br />&#160;&#160;&#160; &lt;LS&gt;    <br />&#160;&#160;&#160;&#160;&#160; &lt;TL a32=&quot;Term2&quot; a31=&quot;true&quot; /&gt;    <br />&#160;&#160;&#160; &lt;/LS&gt;    <br />&#160;&#160;&#160; &lt;DS /&gt;    <br />&#160;&#160;&#160; &lt;TMS&gt;    <br />&#160;&#160;&#160;&#160;&#160; &lt;TM a24=&quot;bb58a4cf-0b70-4c71-a319-261da6b13e5f&quot; a12=&quot;TermSet1&quot; a40=&quot;&quot; a17=&quot;true&quot; a67=&quot;&quot; a45=&quot;ddaac853-68a4-46ee-b91c-8182679f51b4&quot; a69=&quot;true&quot; /&gt;    <br />&#160;&#160;&#160; &lt;/TMS&gt;    <br />&#160; &lt;/T&gt;    <br />&#160; &lt;T a9=&quot;9ac515de-6bfc-4d2e-9dba-d902e6d40539&quot; a21=&quot;false&quot; a61=&quot;0&quot;&gt;    <br />&#160;&#160;&#160; &lt;LS&gt;    <br />&#160;&#160;&#160;&#160;&#160; &lt;TL a32=&quot;Term3&quot; a31=&quot;true&quot; /&gt;    <br />&#160;&#160;&#160; &lt;/LS&gt;    <br />&#160;&#160;&#160; &lt;DS /&gt;    <br />&#160;&#160;&#160; &lt;TMS&gt;    <br />&#160;&#160;&#160;&#160;&#160; &lt;TM a24=&quot;bb58a4cf-0b70-4c71-a319-261da6b13e5f&quot; a12=&quot;TermSet1&quot; a40=&quot;&quot; a17=&quot;true&quot; a67=&quot;&quot; a45=&quot;9ac515de-6bfc-4d2e-9dba-d902e6d40539&quot; /&gt;    <br />&#160;&#160;&#160; &lt;/TMS&gt;    <br />&#160; &lt;/T&gt;    <br />&lt;/TermStore&gt;</p>
<p>More info about the cryptic attributes are in the Microsoft Enterprise Managed Metadata Web Service <a href="http://msdn.microsoft.com/en-us/library/dd962601(v=office.12).aspx">Protocol Specification</a>.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/youcode.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/youcode.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/youcode.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/youcode.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/youcode.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/youcode.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/youcode.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/youcode.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/youcode.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/youcode.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/youcode.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/youcode.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/youcode.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/youcode.wordpress.com/16/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=youcode.wordpress.com&amp;blog=7895492&amp;post=16&amp;subd=youcode&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://youcode.wordpress.com/2011/11/18/managed-metadata-using-taxonomy-web-service/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/75c545ce00ffeeacf56c9d4665bfd594?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">sj</media:title>
		</media:content>
	</item>
		<item>
		<title>Consecutive Sum</title>
		<link>http://youcode.wordpress.com/2011/03/22/consecutive-sum/</link>
		<comments>http://youcode.wordpress.com/2011/03/22/consecutive-sum/#comments</comments>
		<pubDate>Tue, 22 Mar 2011 19:31:28 +0000</pubDate>
		<dc:creator>sj</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">https://youcode.wordpress.com/2011/03/22/consecutive-sum/</guid>
		<description><![CDATA[PROBLEM: Given an integer X, find the series of consecutive integers such that their sum is equal to this integer. Eg. X=18, consecutive integers={3 4 5 6}, X=24, consecutive integers = {7 8 9} SOLUTION: Algo: Have start and end counter First, increment end counter and keep on adding till sum exceeds target Second, increment [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=youcode.wordpress.com&amp;blog=7895492&amp;post=11&amp;subd=youcode&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><strong>PROBLEM: </strong>Given an integer X, find the series of consecutive integers such that their sum is equal to this integer. Eg. X=18, consecutive integers={3 4 5 6}, X=24, consecutive integers = {7 8 9}</p>
<p><strong>SOLUTION:<br />
</strong><strong><br />
Algo:</strong></p>
<ol>
<li>Have start and end counter</li>
<li>First, increment end counter and keep on adding till sum exceeds target</li>
<li>Second, increment start counter and keep on decreseasing sum till sum becomes less than target</li>
<li>This way, keep on moving the counters till the required zone is narrowed down</li>
</ol>
<p><pre class="brush: cpp;">
#include &quot;stdio.h&quot;
#define SUMEQUALSTARGET(sum, target) \
    if ((sum) == (target))  \
    {                       \
            bFound == true; \
            break;          \
    }

int consecutiveSum(int target, int* psc, int* pec)
{
    int sum = 0, startCounter = 1, endCounter = 0;
    bool bFound = false;

    if (target &lt;= 0)
    {
        printf(&quot;ERROR: Invalid target %d&quot;, target);
        return 0;
    }

    while (!bFound)
    {
        SUMEQUALSTARGET(sum, target);

        // increase the endCounter
        while (sum &lt; target)
        {
            endCounter++;
            sum += endCounter;

            SUMEQUALSTARGET(sum, target);
            if (startCounter == endCounter)
            {
                break;
            }
        }

        // increase the startCounter
        while (sum &gt; target)
        {
            sum -= startCounter;
            startCounter++;

            SUMEQUALSTARGET(sum, target);
            if (startCounter == endCounter)
            {
                break;
            }
        }
    }

    *psc = startCounter;
    *pec = endCounter;
    return sum;
}

int main()
{
    int startCounter = 0, endCounter = 0;

    for (int target = 1; target &lt;= 50; target++)
    {
        if (!consecutiveSum(target, &amp;startCounter, &amp;endCounter))
        {
            printf(&quot;%s&quot;, &quot;consecutiveSum failed for target=%d&quot;, target);
            return -1;
        }

        printf(&quot;%d\t&quot;, target);
        for (int i = startCounter; i &lt;= endCounter; i++)
        {
            printf(&quot;%d &quot;, i);
        }
        printf(&quot;\n&quot;);
    }

    return 0;
}
</pre></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/youcode.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/youcode.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/youcode.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/youcode.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/youcode.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/youcode.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/youcode.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/youcode.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/youcode.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/youcode.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/youcode.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/youcode.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/youcode.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/youcode.wordpress.com/11/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=youcode.wordpress.com&amp;blog=7895492&amp;post=11&amp;subd=youcode&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://youcode.wordpress.com/2011/03/22/consecutive-sum/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/75c545ce00ffeeacf56c9d4665bfd594?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">sj</media:title>
		</media:content>
	</item>
		<item>
		<title>Shuffling contents of an array</title>
		<link>http://youcode.wordpress.com/2011/03/22/shuffling-contents-of-an-array/</link>
		<comments>http://youcode.wordpress.com/2011/03/22/shuffling-contents-of-an-array/#comments</comments>
		<pubDate>Tue, 22 Mar 2011 19:12:13 +0000</pubDate>
		<dc:creator>sj</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">https://youcode.wordpress.com/2011/03/22/shuffling-contents-of-an-array/</guid>
		<description><![CDATA[QUESTION: Given an array, shuffle its content in a complete random manner such that the position of all the elements are changed and none of the elements are lost during shuffling. NOTE: A simple rotation etc. of array is not considered shuffling. ANSWER: Algo: Start from the first position. Find a random element for this [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=youcode.wordpress.com&amp;blog=7895492&amp;post=8&amp;subd=youcode&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><strong>QUESTION:</strong> Given an array, shuffle its content in a complete random manner such that the position of all the elements are changed and none of the elements are lost during shuffling. NOTE: A simple rotation etc. of array is not considered shuffling.</p>
<p><strong>ANSWER: </strong>Algo:</p>
<ol>
<li>Start from the first position. Find a random element for this position. Swap the current element at this first position with the found random element. </li>
<li>Repeat the process to the next element, swapping its contents with a randomly found element. Swapping ensures that no element is lost/overwritten. </li>
</ol>
<pre class="code"><span style="color:blue;">    void </span>ShuffleArray(<span style="color:blue;">int </span>arr[], <span style="color:blue;">int </span>size)
    {
        <span style="color:blue;">for </span>(<span style="color:blue;">int </span>i = 0; i &lt; size; i++)
        {
            <span style="color:green;">// find the random element for the ith array element
            </span><span style="color:blue;">int </span>index = i + (rand() % (size - i));

            <span style="color:green;">// now swap the two
            </span><span style="color:blue;">int </span>temp   = arr[i];
            arr[i]     = arr[index];
            arr[index] = temp;
        }
    }</pre>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/youcode.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/youcode.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/youcode.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/youcode.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/youcode.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/youcode.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/youcode.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/youcode.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/youcode.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/youcode.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/youcode.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/youcode.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/youcode.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/youcode.wordpress.com/8/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=youcode.wordpress.com&amp;blog=7895492&amp;post=8&amp;subd=youcode&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://youcode.wordpress.com/2011/03/22/shuffling-contents-of-an-array/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/75c545ce00ffeeacf56c9d4665bfd594?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">sj</media:title>
		</media:content>
	</item>
		<item>
		<title>Making an XBAP application full-trust</title>
		<link>http://youcode.wordpress.com/2009/06/24/making-an-xbap-application-full-trust/</link>
		<comments>http://youcode.wordpress.com/2009/06/24/making-an-xbap-application-full-trust/#comments</comments>
		<pubDate>Wed, 24 Jun 2009 11:34:33 +0000</pubDate>
		<dc:creator>sj</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://youcode.wordpress.com/2009/06/24/making-an-xbap-application-full-trust/</guid>
		<description><![CDATA[XBAP application when loaded in a web browser by default runs in partial-trust, hence any extra access from it may (will) throw security exceptions (like System.Net.Webpermission). This makes sense, as the security sandbox won’t allow such accesses to happen when the application is running in partial-trust. Solutions: Run the XBAP application from the same URI [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=youcode.wordpress.com&amp;blog=7895492&amp;post=5&amp;subd=youcode&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p align="justify">XBAP application when loaded in a web browser by default runs in partial-trust, hence any extra access from it may (will) throw security exceptions (like System.Net.Webpermission). This makes sense, as the security sandbox won’t allow such accesses to happen when the application is running in partial-trust.</p>
<p align="justify">Solutions:</p>
<ol>
<li>
<div>Run the XBAP application from the same URI as the host service (it can be a WCF service). So, if the WCF service is hosted at <a href="http://mydomain/myservice">http://mydomain/myservice</a>, then the XBAP should also run from <a href="http://mydomain/myXbapApp">http://mydomain/myXbapApp</a>. Now, this basically means that both service and XBAP app are running from the same domain <a href="http://mydomain">http://mydomain</a>. Why this? Because, CLR identifies an object (application) through certain parameters, the site and URI being one of them. Hence, only if the XBAP app originates from the same domain, it will trust it. No wonder, when the XBAP app is run from the local machine, all works good, but the moment it is share out to a network share or copied around and then run, it fails with some security exception.</div>
<p>For debugging purposes, one can also use the hack mentioned <a href="http://www.codeexperiment.com/post/Debugging-XBAPWCF-Applications.aspx" target="_blank">here</a>, using the PresentationHost.exe to make it <em>appear</em> that the XBAP is indeed running from the same location as the service. But one cannot take this approach everytime as using another exe to launch the XBAP app is not a good idea.</p>
</li>
<li>
<div>Make the XBAP full-trust        <br />Ofcourse this calls for security implications, but if done with open eyes, it can be fine. It calls for making the XBAP application full-trust, either by Visual Studio-&gt;Project Settings-&gt;Security-&gt;FullTrust, or by editing the app.manifest and adding <span style="text-decoration:underline;"><strong>Unrestricted=&quot;true&quot;</strong></span> in &lt;PermissionSet&gt; attribute.</div>
<p>Once that is done, still the app won’t load in the browser as it won’t be granted full-trust just because it declares its self as full-trust! So, way out is to sign the application manifest with one’s own private key, then import that key to the browser as a Trusted Publisher and then run the application.</p>
<p>Basically following steps are reqd:</p>
<ol>
<ol>
<li>VisualStudio-&gt;ProjectProperties-&gt;Signing-&gt;SignClickOnceManifests-&gt;CreateTestCertificate-&gt;MoreDetails-&gt;CopyToFile-&gt;save the certificate to disk. </li>
<li>
<div>VisualStudio-&gt;ProjectProperties-&gt;Signing-&gt;SignClickOnceManifests-&gt;SelectFromStore-&gt;select the test certificate</div>
</li>
<li>
<div>Publish the app (VisualStudio-&gt;ProjectProperties-&gt;Publish) to any location like a network path.</div>
</li>
<li>
<div>Browser (on the machine where you want to load the XBAP) –&gt; Tools-&gt;Options-&gt;Content-&gt;Certificates-&gt;TrustedRootCertificationAuthorities-&gt;Import-&gt;add the private saved certificate</div>
</li>
<li>
<div>Do the same for Browser-&gt;Tools-&gt;Options-&gt;Content-&gt;Certificates-&gt;TrustedPublishers also.</div>
</li>
<li>Now running the XBAP will work! Why? Well, then the XBAP is loaded by the browser, its signature is validated the existing one in the store and it is certified as full-trust.
<p>A good pictorial representation of above step-by-step is shown <a href="http://blogs.microsoft.co.il/blogs/maxim/archive/2008/03/05/wpf-xbap-as-full-trust-application.aspx" target="_blank">here</a>. </li>
</ol>
</ol>
</li>
</ol>
<p align="justify">While this works, news is that in .Net 4.0, this will be available via a prompt mechanism, wherein, when the app declares itself as full-trust and tries to access a resource, a prompt will be thrown to the user to allow the action to take place. Let’s hope this comes soon!</p>
<p align="justify">S&amp;y</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/youcode.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/youcode.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/youcode.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/youcode.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/youcode.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/youcode.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/youcode.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/youcode.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/youcode.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/youcode.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/youcode.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/youcode.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/youcode.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/youcode.wordpress.com/5/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=youcode.wordpress.com&amp;blog=7895492&amp;post=5&amp;subd=youcode&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://youcode.wordpress.com/2009/06/24/making-an-xbap-application-full-trust/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/75c545ce00ffeeacf56c9d4665bfd594?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">sj</media:title>
		</media:content>
	</item>
		<item>
		<title>What is Partial-Trust anyways?</title>
		<link>http://youcode.wordpress.com/2009/05/29/what-is-partial-trust-anyways/</link>
		<comments>http://youcode.wordpress.com/2009/05/29/what-is-partial-trust-anyways/#comments</comments>
		<pubDate>Fri, 29 May 2009 14:16:21 +0000</pubDate>
		<dc:creator>sj</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[full trust]]></category>
		<category><![CDATA[WCF]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://youcode.wordpress.com/2009/05/29/what-is-partial-trust-anyways/</guid>
		<description><![CDATA[For an application running inbox, there is hardly any worry for ‘trust’. But the moment the boundaries are breached, a need arises for limited trust across these boundaries. In short, what is trust? According to Webster’s: trust, n Pronunciation: \ˈtrəst\ a: assured reliance on the character, ability, strength, or truth of someone or something b: [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=youcode.wordpress.com&amp;blog=7895492&amp;post=3&amp;subd=youcode&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p align="justify">For an application running inbox, there is hardly any worry for ‘trust’. But the moment the boundaries are breached, a need arises for limited trust across these boundaries.</p>
<p align="justify">In short, what is trust? According to Webster’s:</p>
<p align="justify">trust, n<br />
Pronunciation: \ˈtrəst\<br />
a: assured reliance on the character, ability, strength, or truth of someone or something b: one in which confidence is placed</p>
<p align="justify">So, simply elaborated as an example, a program running in the local disk has more trust than a program running over the network share for obvious reasons. Trust, thus, for a program can be defined at various levels: full, partial, low etc., each having its own nuances. A program developed and tested to run under full trust can fail completely when run under partial trust.</p>
<p align="justify">One should thus take care and look ahead when developing a program which might have to run under various scenarios: local, intranet or internet. A nice nifty article by Keith Brown explains the whole basics about trust and how to program around it. Here’s the link: <a title="Programming for Partial Trust" href="http://msdn.microsoft.com/en-us/library/ms364059(VS.80).aspx" target="_blank">Programming for Partial Trust</a></p>
<p align="justify">It paints a fair picture of this whole trust thing with various practical notes and examples. Nice read.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/youcode.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/youcode.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/youcode.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/youcode.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/youcode.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/youcode.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/youcode.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/youcode.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/youcode.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/youcode.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/youcode.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/youcode.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/youcode.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/youcode.wordpress.com/3/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=youcode.wordpress.com&amp;blog=7895492&amp;post=3&amp;subd=youcode&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://youcode.wordpress.com/2009/05/29/what-is-partial-trust-anyways/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/75c545ce00ffeeacf56c9d4665bfd594?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">sj</media:title>
		</media:content>
	</item>
	</channel>
</rss>
