<?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>Selva [Ne0] Samuel</title>
	<atom:link href="http://selvasamuel.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://selvasamuel.wordpress.com</link>
	<description>Thoughts from the dark dungeons of a restless, curious mind...</description>
	<lastBuildDate>Sun, 31 Jul 2011 19:57:48 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='selvasamuel.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Selva [Ne0] Samuel</title>
		<link>http://selvasamuel.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://selvasamuel.wordpress.com/osd.xml" title="Selva [Ne0] Samuel" />
	<atom:link rel='hub' href='http://selvasamuel.wordpress.com/?pushpress=hub'/>
		<item>
		<title>CryptoAPI: How to import a certificate</title>
		<link>http://selvasamuel.wordpress.com/2008/06/09/cryptoapi-how-to-import-a-certificate/</link>
		<comments>http://selvasamuel.wordpress.com/2008/06/09/cryptoapi-how-to-import-a-certificate/#comments</comments>
		<pubDate>Mon, 09 Jun 2008 16:16:10 +0000</pubDate>
		<dc:creator>ne0</dc:creator>
				<category><![CDATA[C/C++]]></category>
		<category><![CDATA[Coding is fun]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[Windows API]]></category>
		<category><![CDATA[CryptoAPI]]></category>

		<guid isPermaLink="false">http://selvasamuel.wordpress.com/?p=103</guid>
		<description><![CDATA[Following is the C code to import a certificate into the Windows trusted root certificate store using CryptoAPI: PCCERT_CONTEXT pCertCtx = NULL; if (CryptQueryObject ( &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;CERT_QUERY_OBJECT_FILE, &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;L"D:\\selva\\b64.cer", &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;CERT_QUERY_CONTENT_FLAG_ALL, &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;CERT_QUERY_FORMAT_FLAG_ALL, &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;0, &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;NULL, &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;NULL, &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;NULL, &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;NULL, &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;NULL, &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;(const void **)&#38;pCertCtx) != 0) &#8230; <a href="http://selvasamuel.wordpress.com/2008/06/09/cryptoapi-how-to-import-a-certificate/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=selvasamuel.wordpress.com&amp;blog=182760&amp;post=103&amp;subd=selvasamuel&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Following is the C code to import a certificate into the Windows trusted root certificate store using CryptoAPI:</p>
<p><code>PCCERT_CONTEXT pCertCtx = NULL;</code></p>
<p><code>if (CryptQueryObject (<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CERT_QUERY_OBJECT_FILE,<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;L"D:\\selva\\b64.cer",<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CERT_QUERY_CONTENT_FLAG_ALL,<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CERT_QUERY_FORMAT_FLAG_ALL,<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0,<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;NULL,<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;NULL,<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;NULL,<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;NULL,<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;NULL,<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(const void **)&amp;pCertCtx) != 0)<br />
{<br />
&nbsp;&nbsp;&nbsp;&nbsp;HCERTSTORE hCertStore = CertOpenStore (<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CERT_STORE_PROV_SYSTEM,<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0,<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0,<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CERT_STORE_OPEN_EXISTING_FLAG |<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CERT_SYSTEM_STORE_LOCAL_MACHINE,<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;L"ROOT");<br />
&nbsp;&nbsp;&nbsp;&nbsp;if (hCertStore != NULL)<br />
&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (CertAddCertificateContextToStore (<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;hCertStore,<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pCertCtx,<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CERT_STORE_ADD_ALWAYS,<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;NULL))<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cout &lt;&lt; "Added certificate to store." &lt;&lt; endl;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</code></p>
<p><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (CertCloseStore (hCertStore, 0))<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cout &lt;&lt; "Cert. store handle closed." &lt;&lt; endl;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;}</code></p>
<p><code>&nbsp;&nbsp;&nbsp;&nbsp;if (pCertCtx)<br />
&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CertFreeCertificateContext (pCertCtx);<br />
&nbsp;&nbsp;&nbsp;&nbsp;}<br />
}</code></p>
<p><strong>NOTE:</strong> I have tested the above code to import DER encoded and Base-64 encoded certificates.</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/selvasamuel.wordpress.com/103/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/selvasamuel.wordpress.com/103/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/selvasamuel.wordpress.com/103/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/selvasamuel.wordpress.com/103/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/selvasamuel.wordpress.com/103/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/selvasamuel.wordpress.com/103/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/selvasamuel.wordpress.com/103/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/selvasamuel.wordpress.com/103/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/selvasamuel.wordpress.com/103/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/selvasamuel.wordpress.com/103/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/selvasamuel.wordpress.com/103/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/selvasamuel.wordpress.com/103/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/selvasamuel.wordpress.com/103/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/selvasamuel.wordpress.com/103/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/selvasamuel.wordpress.com/103/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/selvasamuel.wordpress.com/103/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=selvasamuel.wordpress.com&amp;blog=182760&amp;post=103&amp;subd=selvasamuel&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://selvasamuel.wordpress.com/2008/06/09/cryptoapi-how-to-import-a-certificate/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/309d636ef9bded425e9c5e417dc067ef?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ne0</media:title>
		</media:content>
	</item>
		<item>
		<title>Boxing/Unboxing in .NET</title>
		<link>http://selvasamuel.wordpress.com/2008/03/14/boxingunboxing-in-net/</link>
		<comments>http://selvasamuel.wordpress.com/2008/03/14/boxingunboxing-in-net/#comments</comments>
		<pubDate>Fri, 14 Mar 2008 13:00:45 +0000</pubDate>
		<dc:creator>ne0</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[C# concepts]]></category>
		<category><![CDATA[Coding is fun]]></category>

		<guid isPermaLink="false">http://selvasamuel.wordpress.com/2008/03/14/boxingunboxing-in-net/</guid>
		<description><![CDATA[This post has been long overdue; I should have posted it two months back. Anyway, a couple of my friends attended training in .NET concepts sponsored by my company. They came back from the training and discussed with me the &#8230; <a href="http://selvasamuel.wordpress.com/2008/03/14/boxingunboxing-in-net/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=selvasamuel.wordpress.com&amp;blog=182760&amp;post=102&amp;subd=selvasamuel&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>This post has been long overdue; I should have posted it two months back. Anyway, a couple of my friends attended training in .NET concepts sponsored by my company. They came back from the training and discussed with me the stuff they had learnt. One of the fellows mentioned that they had been taught that <code>int.ToString()</code> converts an integer (a value type) to a string (a reference type) and hence, boxes the <code>int</code>. On the other hand, <code>int.Parse()</code> converts a string to an integer and hence, unboxes the string. When I heard that, I knew deep within me that what they had been taught was incorrect. But, I did not know why. So, I set out to find the answer. To find out what happens during a call to <code>int.ToString()</code>, I decompiled mscorlib.dll (It is present is the .NET Framework directory which on my machine happens to be C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727) which contains the implementation of <code>Int32</code> using <a href="http://www.aisto.com/roeder/dotnet/Download.aspx?File=Reflector">Lutz Roeder&#8217;s .NET Reflector</a>.</p>
<p>The implementation of <code>ToString()</code> is as follows:</p>
<p><code>public override string ToString()<br />
{<br />
&nbsp;&nbsp;&nbsp;&nbsp;return Number.FormatInt32(<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;this,<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;null,<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;NumberFormatInfo.CurrentInfo);<br />
}</code></p>
<p>The <code>Number.FormatInt32()</code> method is declared as follows:</p>
<p><code>[MethodImpl(MethodImplOptions.InternalCall)]<br />
public static extern string FormatInt32(<br />
&nbsp;&nbsp;&nbsp;&nbsp;int value,<br />
&nbsp;&nbsp;&nbsp;&nbsp;string format,<br />
&nbsp;&nbsp;&nbsp;&nbsp;NumberFormatInfo info);</code></p>
<p>According to MSDN, the <code>extern</code> modifier is used in C# to declare a method that is implemented externally. So, the question is: where is <code>FormatInt32()</code> (see above code fragment) implemented? The answer lies in the <code>MethodImpl</code> attribute which decorates the method declaration. According to MSDN, <code>MethodImplOptions.InternalCall</code> specifies that the method is implemented in the CLR itself. So, I proceeded to download SSCLI a.k.a. Rotor (source code to a working implementation of the CLR) from <a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=8C09FD61-3F26-4555-AE17-3121B4F51D4D&amp;displaylang=en">here</a>.</p>
<p>I learnt from <a href="http://msdn2.microsoft.com/en-us/magazine/cc163896.aspx?code=true">this site</a> that the ecall.cpp file (which is located at \clr\src\vm\ecall.cpp in the SSCLI) contains a table that maps managed internal call methods to unmanaged C++ implementations. I searched for <code>FormatInt32</code> and found the following code:</p>
<p><code>FCFuncElement("FormatInt32", COMNumber::FormatInt32)</code></p>
<p>This tells that the implementation of <code>FormatInt32</code> method is actually the implementation of the native C++ <code>COMNumber::FormatInt32</code> function. So, the next question is where do I find the implementation of <code>COMNumber::FormatInt32</code> function? I noticed that there was a file named comnumber.cpp in the \clr\src\vm directory. I opened the file and started to examine the <code>COMNumber::FormatInt32</code> function. I discovered that <code>COMNumber::FormatInt32</code> calls <code>COMNumber::Int32ToDecChars</code> function. This function is defined as follows:</p>
<p><code>wchar_t* COMNumber::Int32ToDecChars(<br />
&nbsp;&nbsp;&nbsp;&nbsp;wchar_t* p,<br />
&nbsp;&nbsp;&nbsp;&nbsp;unsigned int value,<br />
&nbsp;&nbsp;&nbsp;&nbsp;int digits)<br />
{<br />
&nbsp;&nbsp;&nbsp;&nbsp;LEAF_CONTRACT<br />
&nbsp;&nbsp;&nbsp;&nbsp;_ASSERTE(p != NULL);</code></p>
<p><code>&nbsp;&nbsp;&nbsp;&nbsp;while (--digits &gt;= 0 || value != 0) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*--p = value % 10 + '0';<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;value /= 10;<br />
&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;return p;<br />
}</code></p>
<p>As you can see here, <code>COMNumber::Int32ToDecChars</code> takes each digit of the integer starting from the rightmost digit and proceeding to the leftmost, converts it to the equivalent character and stores it in a string and returns the string. There is actually more action that goes on inside <code>COMNumber::FormatInt32</code> but, I won&#8217;t be discussing that here. The core function is performed by <code>COMNumber::Int32ToDecChars</code>. So, I would wrap up the discussion of <code>int.ToString()</code> function by saying that it converts individual digits of an integer to their equivalent characters, stores them in a string and returns the string.</p>
<p>Next, I tried to figure out what goes on inside <code>int.Parse()</code>. I used .NET reflector and found out that it is pretty similar to what <code>int.ToString()</code> does. The string is read character-by-character, converted to its equivalent digit and added to a number after the digits converted previously have been shifted by one position.</p>
<p>Most C# textbooks provide an example as shown below for boxing/unboxing:</p>
<p><code>int i = 1729;<br />
object o = i; // Boxing<br />
int j = (int)o; // Unboxing</code></p>
<p><code>int.ToString()</code> and <code>int.Parse()</code> cannot be used in the above manner and so, these functions are not even remotely related to boxing/unboxing.</p>
<p>My final task was to find out what actually happens during boxing/unboxing. The documentation that is available made my task easy. I referred the following:</p>
<ol>
<li>C# Language Specification</li>
<li>Shared Source CLI Essentials &#8211; By David Stutz, Ted Neward and Geoff Schilling</li>
</ol>
<p>See the excerpts from Shared Source CLI Essentials:</p>
<blockquote><p> By default, when an instance of a value type is passed from one location to another as a method parameter, it is copied in its entirety. At times, however, developers will want or need to take the value type and use it in a manner consistent with reference types. In these situations, the value type can be &#8220;boxed&#8221;: a reference type instance will be created whose data is the value type, and a reference to that instance is passed instead. Naturally, the reverse is also possible, to take the boxed value type and dereference it back into a value type &#8211; this is called &#8220;unboxing&#8221;.</p>
<p>The <code>box</code> instruction is a typesafe operation that converts a value type instance to an instance of a reference type that inherits from <code>System.Object</code>. It does so by making a copy of the instance and embedding it in a newly allocated object. For every value type defined, the type system defines a corresponding reference type called the <i>boxed type</i>. The representation of a boxed value is a location where a value of the value type may be stored; in essence, a single-field reference type whose field is that of the value type. Note that this boxed type is never visible to anyone outside the CLI&#8217;s implementation-the boxed type is silently generated by the CLI itself, and is not accessible for programmer use. (It is purely an implementation detail that would have no real utility were it exposed.)</p></blockquote>
<p>This is made clearer by the C# language specification. Please refer to section 4.3 of the specification.</p>
<p><b>REFERENCES:</b></p>
<ol>
<li><a href="http://www.oreilly.com/catalog/sscliess/chapter/ch03.pdf">Chapter 3 of Shared Source CLI Essentials &#8211; By David Stutz, Ted Neward and Geoff Schilling</a></li>
<li><a href="http://download.microsoft.com/download/3/8/8/388e7205-bc10-4226-b2a8-75351c669b09/CSharp%20Language%20Specification.doc">C# Language Specification 3.0</a></li>
<li><a href="http://msdn2.microsoft.com/en-us/magazine/cc163896.aspx?code=true">.NET Matters, MSDN Magazine, November 2004</a></li>
<li><a href="http://msdn2.microsoft.com/en-us/library/e59b22c5(VS.80).aspx">The extern modifier on MSDN</a></li>
<li><a href="http://msdn2.microsoft.com/en-us/library/system.runtime.compilerservices.methodimplattribute.aspx">The MethodImplAttribute Class on MSDN</a></li>
<li><a href="http://msdn2.microsoft.com/en-us/library/system.runtime.compilerservices.methodimploptions.aspx">The MethodImplOptions Enumeration on MSDN</a></li>
</ol>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/selvasamuel.wordpress.com/102/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/selvasamuel.wordpress.com/102/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/selvasamuel.wordpress.com/102/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/selvasamuel.wordpress.com/102/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/selvasamuel.wordpress.com/102/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/selvasamuel.wordpress.com/102/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/selvasamuel.wordpress.com/102/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/selvasamuel.wordpress.com/102/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/selvasamuel.wordpress.com/102/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/selvasamuel.wordpress.com/102/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/selvasamuel.wordpress.com/102/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/selvasamuel.wordpress.com/102/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/selvasamuel.wordpress.com/102/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/selvasamuel.wordpress.com/102/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/selvasamuel.wordpress.com/102/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/selvasamuel.wordpress.com/102/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=selvasamuel.wordpress.com&amp;blog=182760&amp;post=102&amp;subd=selvasamuel&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://selvasamuel.wordpress.com/2008/03/14/boxingunboxing-in-net/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/309d636ef9bded425e9c5e417dc067ef?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ne0</media:title>
		</media:content>
	</item>
		<item>
		<title>Alice, Bob and Rubik&#8217;s cube</title>
		<link>http://selvasamuel.wordpress.com/2008/01/07/alice-bob-and-rubiks-cube/</link>
		<comments>http://selvasamuel.wordpress.com/2008/01/07/alice-bob-and-rubiks-cube/#comments</comments>
		<pubDate>Mon, 07 Jan 2008 10:48:17 +0000</pubDate>
		<dc:creator>ne0</dc:creator>
				<category><![CDATA[Rubik's cube]]></category>
		<category><![CDATA[Trash Bin]]></category>

		<guid isPermaLink="false">http://selvasamuel.wordpress.com/2008/01/07/alice-bob-and-rubiks-cube/</guid>
		<description><![CDATA[During the week before Christmas, I convinced myself that I had to solve the Rubik&#8217;s cube. So, on Friday evening, I took a printout of the beginner&#8217;s tutorial by Jasmine Lee. I got my cube the next day. After fiddling &#8230; <a href="http://selvasamuel.wordpress.com/2008/01/07/alice-bob-and-rubiks-cube/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=selvasamuel.wordpress.com&amp;blog=182760&amp;post=100&amp;subd=selvasamuel&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>During the week before Christmas, I convinced myself that I had to solve the Rubik&#8217;s cube. So, on Friday evening, I took a printout of the <a href="http://peter.stillhq.com/jasmine/rubikscubesolution.html">beginner&#8217;s tutorial by Jasmine Lee</a>. I got my cube the next day. After fiddling with the cube for well over two hours, I finally solved it. It was about 1 a.m. The next day, I got myself to solve the cube without referring back to the tutorial. After much practice, I was even able to slash down my solving time to 6-7 minutes. My current record is 4:30 minutes.</p>
<p>Last evening, when I was playing with my cube, I had an epiphany. I realized that solving the Rubik&#8217;s cube is very much like doing <a href="http://en.wikipedia.org/wiki/Cryptanalysis">cryptanalysis</a>. The solved cube is our <a href="http://en.wikipedia.org/wiki/Plaintext">plain text</a>. The cube can be scrambled (<a href="http://en.wikipedia.org/wiki/Encryption">encrypted</a>) using an algorithm such as <a href="http://en.wikipedia.org/wiki/Tyson_Mao">F B&#8217; U F2 R2 D&#8217; R2 L2 D&#8217; B&#8217; R2 F2 D&#8217; B2 L F2 U&#8217; R2 F2 L2 U F&#8217; R&#8217; D&#8217; L</a>. The <a href="http://en.wikipedia.org/wiki/Key_(cryptography)">key</a> can be the colour of one of the four faces &#8211; front, left, back or right &#8211; before starting the encryption. If we know the algorithm and the key, we could solve the cube. But since this is not known, other techniques (cryptanalysis) are employed to solve the cube.</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/selvasamuel.wordpress.com/100/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/selvasamuel.wordpress.com/100/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/selvasamuel.wordpress.com/100/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/selvasamuel.wordpress.com/100/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/selvasamuel.wordpress.com/100/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/selvasamuel.wordpress.com/100/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/selvasamuel.wordpress.com/100/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/selvasamuel.wordpress.com/100/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/selvasamuel.wordpress.com/100/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/selvasamuel.wordpress.com/100/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/selvasamuel.wordpress.com/100/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/selvasamuel.wordpress.com/100/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/selvasamuel.wordpress.com/100/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/selvasamuel.wordpress.com/100/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/selvasamuel.wordpress.com/100/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/selvasamuel.wordpress.com/100/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=selvasamuel.wordpress.com&amp;blog=182760&amp;post=100&amp;subd=selvasamuel&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://selvasamuel.wordpress.com/2008/01/07/alice-bob-and-rubiks-cube/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/309d636ef9bded425e9c5e417dc067ef?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ne0</media:title>
		</media:content>
	</item>
		<item>
		<title>Some more COM+ configuration issues</title>
		<link>http://selvasamuel.wordpress.com/2007/12/10/some-more-com-configuration-issues/</link>
		<comments>http://selvasamuel.wordpress.com/2007/12/10/some-more-com-configuration-issues/#comments</comments>
		<pubDate>Mon, 10 Dec 2007 10:16:26 +0000</pubDate>
		<dc:creator>ne0</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Coding is fun]]></category>
		<category><![CDATA[COM+]]></category>
		<category><![CDATA[Enterprise Services]]></category>
		<category><![CDATA[Life @ Aztec]]></category>

		<guid isPermaLink="false">http://selvasamuel.wordpress.com/2007/12/10/some-more-com-configuration-issues/</guid>
		<description><![CDATA[As the release date of our project was nearing, I had become a bit busier in the past few weeks. That would explain the absence of any activity in this blog. The long coding and debugging sessions were fun. We &#8230; <a href="http://selvasamuel.wordpress.com/2007/12/10/some-more-com-configuration-issues/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=selvasamuel.wordpress.com&amp;blog=182760&amp;post=99&amp;subd=selvasamuel&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>As the release date of our project was nearing, I had become a bit busier in the past few weeks. That would explain the absence of any activity in this blog. The long coding and debugging sessions were fun. We faced plenty of issues during deployment in our test environment. Had loads of fun solving them, though at times it was pretty stressful. Learnt a lot! Here, I am posting a couple of issues we faced and how we solved them.</p>
<p>We have a COM+ application in our project. It was working fine until one fine day, it started throwing the following error:</p>
<p><em> 8000401A &#8211; &#8220;The server process could not be started because the   configured identity is incorrect. Check the username and password.&#8221;</em></p>
<p>It turned out that all this while, whenever we had tested the COM+ application, someone was &#8220;interactively logged&#8221; into the server console. But, this time no one was. The identity for the COM+ application had been set as Interactive User. So, we got this error. Changing the identity to Local Service fixed this issue. But, the application threw another exception:</p>
<p><em>System.Data.Odbc.OdbcException: ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified</em></p>
<p>This was because we had configured a User DSN to connect to the database. A user DSN is visible only to the user for whom it is configured. As the identity for the COM+ application had been set as Local Service, it was unable to find the DSN. Configuring a System DSN which is visible to all users of a machine solved this issue.</p>
<p>The COM+ application was making certain changes to the configured IPSec policy. It was working fine until the above changes were made after which it started throwing the following error:</p>
<p><em>ERR IPSec [05073] Unable to open Policy Store.</em></p>
<p>Clearly this was a user permission issue. So, the identity of the COM+ application was changed to &#8220;Administrator&#8221; instead of &#8220;Local Service&#8221;. And then, we all lived happily until the next bug showed its ugly face.</p>
<p><strong>REFERENCES:</strong></p>
<ol>
<li><a href="http://support.microsoft.com/kb/305761">KB 305761: COM+ server application that uses interactive user identity fails to load</a></li>
</ol>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/selvasamuel.wordpress.com/99/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/selvasamuel.wordpress.com/99/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/selvasamuel.wordpress.com/99/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/selvasamuel.wordpress.com/99/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/selvasamuel.wordpress.com/99/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/selvasamuel.wordpress.com/99/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/selvasamuel.wordpress.com/99/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/selvasamuel.wordpress.com/99/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/selvasamuel.wordpress.com/99/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/selvasamuel.wordpress.com/99/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/selvasamuel.wordpress.com/99/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/selvasamuel.wordpress.com/99/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/selvasamuel.wordpress.com/99/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/selvasamuel.wordpress.com/99/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/selvasamuel.wordpress.com/99/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/selvasamuel.wordpress.com/99/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=selvasamuel.wordpress.com&amp;blog=182760&amp;post=99&amp;subd=selvasamuel&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://selvasamuel.wordpress.com/2007/12/10/some-more-com-configuration-issues/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/309d636ef9bded425e9c5e417dc067ef?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ne0</media:title>
		</media:content>
	</item>
		<item>
		<title>Logic-based hidden item seeking game</title>
		<link>http://selvasamuel.wordpress.com/2007/10/17/logic-based-hidden-item-seeking-game/</link>
		<comments>http://selvasamuel.wordpress.com/2007/10/17/logic-based-hidden-item-seeking-game/#comments</comments>
		<pubDate>Wed, 17 Oct 2007 08:58:43 +0000</pubDate>
		<dc:creator>ne0</dc:creator>
				<category><![CDATA[Interesting articles]]></category>
		<category><![CDATA[Minesweeper]]></category>

		<guid isPermaLink="false">http://selvasamuel.wordpress.com/2007/10/17/logic-based-hidden-item-seeking-game/</guid>
		<description><![CDATA[I stumbled upon this humorous article by David Vronay about the complexities of UI design. In the article, Vronay describes the challenges faced by the Minesweeper development team of Microsoft. By the way, David, I guess it would be a &#8230; <a href="http://selvasamuel.wordpress.com/2007/10/17/logic-based-hidden-item-seeking-game/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=selvasamuel.wordpress.com&amp;blog=182760&amp;post=98&amp;subd=selvasamuel&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I stumbled upon <a href="http://shellrevealed.com/blogs/shellblog/archive/2006/09/26/The-UI-design-minefield-_2D00_-er_2E002E002E00_-flower-field_3F003F00_.aspx">this humorous article</a> by <a href="http://research.microsoft.com/users/davevr/">David Vronay</a> about the complexities of UI design. In the article, Vronay describes the challenges faced by the Minesweeper development team of Microsoft.</p>
<p>By the way, David, I guess it would be a good idea to replace mines with bugs. You may have to do some work in finding out the most loathsome bug. If you ask me, my guess would be a <a href="http://en.wikipedia.org/wiki/Bedbug">bed bug</a>.</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/selvasamuel.wordpress.com/98/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/selvasamuel.wordpress.com/98/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/selvasamuel.wordpress.com/98/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/selvasamuel.wordpress.com/98/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/selvasamuel.wordpress.com/98/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/selvasamuel.wordpress.com/98/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/selvasamuel.wordpress.com/98/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/selvasamuel.wordpress.com/98/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/selvasamuel.wordpress.com/98/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/selvasamuel.wordpress.com/98/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/selvasamuel.wordpress.com/98/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/selvasamuel.wordpress.com/98/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/selvasamuel.wordpress.com/98/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/selvasamuel.wordpress.com/98/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/selvasamuel.wordpress.com/98/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/selvasamuel.wordpress.com/98/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=selvasamuel.wordpress.com&amp;blog=182760&amp;post=98&amp;subd=selvasamuel&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://selvasamuel.wordpress.com/2007/10/17/logic-based-hidden-item-seeking-game/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/309d636ef9bded425e9c5e417dc067ef?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ne0</media:title>
		</media:content>
	</item>
		<item>
		<title>Chak de India!</title>
		<link>http://selvasamuel.wordpress.com/2007/09/25/chak-de-india/</link>
		<comments>http://selvasamuel.wordpress.com/2007/09/25/chak-de-india/#comments</comments>
		<pubDate>Tue, 25 Sep 2007 06:50:42 +0000</pubDate>
		<dc:creator>ne0</dc:creator>
				<category><![CDATA[Cricket]]></category>
		<category><![CDATA[India]]></category>
		<category><![CDATA[Sports]]></category>

		<guid isPermaLink="false">http://selvasamuel.wordpress.com/2007/09/25/chak-de-india/</guid>
		<description><![CDATA[Kudos to Team India for bringing home the Twenty20 World cup. Hats off to M S Dhoni and his boys for this feat. Photo courtesy: http://worldtwenty20.yahoo.com/<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=selvasamuel.wordpress.com&amp;blog=182760&amp;post=95&amp;subd=selvasamuel&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Kudos to Team India for bringing home the Twenty20 World cup.</p>
<p style="text-align:center;"><img src="http://selvasamuel.files.wordpress.com/2007/09/india_wins_t20_wc.jpg?w=500" /></p>
<p>Hats off to M S Dhoni and his boys for this feat.</p>
<p style="text-align:center;"><img src="http://selvasamuel.files.wordpress.com/2007/09/dhoni_with_the_t20_cup.jpg?w=500" /></p>
<p><strong><u>Photo courtesy</u>:</strong> <a href="http://worldtwenty20.yahoo.com/">http://worldtwenty20.yahoo.com/</a></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/selvasamuel.wordpress.com/95/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/selvasamuel.wordpress.com/95/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/selvasamuel.wordpress.com/95/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/selvasamuel.wordpress.com/95/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/selvasamuel.wordpress.com/95/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/selvasamuel.wordpress.com/95/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/selvasamuel.wordpress.com/95/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/selvasamuel.wordpress.com/95/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/selvasamuel.wordpress.com/95/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/selvasamuel.wordpress.com/95/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/selvasamuel.wordpress.com/95/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/selvasamuel.wordpress.com/95/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/selvasamuel.wordpress.com/95/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/selvasamuel.wordpress.com/95/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/selvasamuel.wordpress.com/95/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/selvasamuel.wordpress.com/95/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=selvasamuel.wordpress.com&amp;blog=182760&amp;post=95&amp;subd=selvasamuel&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://selvasamuel.wordpress.com/2007/09/25/chak-de-india/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/309d636ef9bded425e9c5e417dc067ef?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ne0</media:title>
		</media:content>

		<media:content url="http://selvasamuel.files.wordpress.com/2007/09/india_wins_t20_wc.jpg" medium="image" />

		<media:content url="http://selvasamuel.files.wordpress.com/2007/09/dhoni_with_the_t20_cup.jpg" medium="image" />
	</item>
		<item>
		<title>How to find the NetBIOS name of a domain</title>
		<link>http://selvasamuel.wordpress.com/2007/09/21/how-to-find-the-netbios-name-of-a-domain/</link>
		<comments>http://selvasamuel.wordpress.com/2007/09/21/how-to-find-the-netbios-name-of-a-domain/#comments</comments>
		<pubDate>Fri, 21 Sep 2007 14:04:39 +0000</pubDate>
		<dc:creator>ne0</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[C#]]></category>

		<guid isPermaLink="false">http://selvasamuel.wordpress.com/2007/09/21/how-to-find-the-netbios-name-of-a-domain/</guid>
		<description><![CDATA[Following is the C# code needed to find the NetBIOS name of a domain from Active Directory: using System; using System.DirectoryServices; void PrintNetBIOSName() { &#160;&#160;&#160;&#160;string netBIOSName = null; &#160;&#160;&#160;&#160;DirectoryEntry rootDSE = new DirectoryEntry( &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;"LDAP://&#60;server address&#62;/rootDSE", &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;"&#60;username&#62;", "&#60;password&#62;"); &#160;&#160;&#160;&#160;string domain = &#8230; <a href="http://selvasamuel.wordpress.com/2007/09/21/how-to-find-the-netbios-name-of-a-domain/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=selvasamuel.wordpress.com&amp;blog=182760&amp;post=94&amp;subd=selvasamuel&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Following is the C# code needed to find the NetBIOS name of a domain from Active Directory:</p>
<p><code>using System;<br />
using System.DirectoryServices;</code></p>
<p><code>void PrintNetBIOSName()<br />
{<br />
&nbsp;&nbsp;&nbsp;&nbsp;string netBIOSName = null;<br />
&nbsp;&nbsp;&nbsp;&nbsp;DirectoryEntry rootDSE = new DirectoryEntry(<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"LDAP://&lt;server address&gt;/rootDSE",<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"&lt;username&gt;", "&lt;password&gt;");<br />
&nbsp;&nbsp;&nbsp;&nbsp;string domain = (string)rootDSE.Properties[<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"defaultNamingContext"][0];</code></p>
<p><code>&nbsp;&nbsp;&nbsp;&nbsp;if (!String.IsNullOrEmpty(domain))<br />
&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DirectoryEntry parts = new DirectoryEntry(<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"LDAP://&lt;server address&gt;/CN=Partitions<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;,CN=Configuration," + domain,<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"&lt;username&gt;", "&lt;password&gt;");</code></p>
<p><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;foreach (DirectoryEntry part in parts.Children)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if ((string)part.Properties[<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"nCName"][0] == domain)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;netBIOSName = (string)part.Properties[<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"NetBIOSName"][0];<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</code></p>
<p><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Console.WriteLine(netBIOSName);<br />
&nbsp;&nbsp;&nbsp;&nbsp;}<br />
}</code></p>
<p><strong>REFERENCES:</strong></p>
<ol>
<li><a href="http://home.hot.rr.com/graye/CodeSnippets.htm">http://home.hot.rr.com/graye/CodeSnippets.htm</a></li>
<li><a href="http://msdn2.microsoft.com/en-us/library/aa772152.aspx">Binding to Active Directory Domain Services (MSDN)</a></li>
</ol>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/selvasamuel.wordpress.com/94/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/selvasamuel.wordpress.com/94/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/selvasamuel.wordpress.com/94/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/selvasamuel.wordpress.com/94/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/selvasamuel.wordpress.com/94/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/selvasamuel.wordpress.com/94/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/selvasamuel.wordpress.com/94/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/selvasamuel.wordpress.com/94/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/selvasamuel.wordpress.com/94/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/selvasamuel.wordpress.com/94/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/selvasamuel.wordpress.com/94/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/selvasamuel.wordpress.com/94/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/selvasamuel.wordpress.com/94/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/selvasamuel.wordpress.com/94/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/selvasamuel.wordpress.com/94/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/selvasamuel.wordpress.com/94/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=selvasamuel.wordpress.com&amp;blog=182760&amp;post=94&amp;subd=selvasamuel&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://selvasamuel.wordpress.com/2007/09/21/how-to-find-the-netbios-name-of-a-domain/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/309d636ef9bded425e9c5e417dc067ef?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ne0</media:title>
		</media:content>
	</item>
		<item>
		<title>Exposing events from custom controls in .NET</title>
		<link>http://selvasamuel.wordpress.com/2007/09/13/exposing-events-from-custom-controls-in-net/</link>
		<comments>http://selvasamuel.wordpress.com/2007/09/13/exposing-events-from-custom-controls-in-net/#comments</comments>
		<pubDate>Thu, 13 Sep 2007 13:11:30 +0000</pubDate>
		<dc:creator>ne0</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Custom Controls]]></category>
		<category><![CDATA[Windows Forms]]></category>

		<guid isPermaLink="false">http://selvasamuel.wordpress.com/2007/09/13/exposing-events-from-custom-controls-in-net/</guid>
		<description><![CDATA[Recently, one of my very good friends asked me to help him with a problem. I noticed that he was using a custom control. To solve the problem, I needed to expose an event from the control. This was something &#8230; <a href="http://selvasamuel.wordpress.com/2007/09/13/exposing-events-from-custom-controls-in-net/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=selvasamuel.wordpress.com&amp;blog=182760&amp;post=93&amp;subd=selvasamuel&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Recently, one of my very good friends asked me to help him with a problem. I noticed that he was using a custom control. To solve the problem, I needed to expose an event from the control. This was something I had never bothered about before. I stumbled upon this wonderful article in my quest to solve it. Thought it would help somebody else. So, I am posting the links here:</p>
<ul>
<li><a href="http://www.ondotnet.com/pub/a/dotnet/2002/04/15/events.html?page=1">Writing C# custom events &#8211; Part I</a></li>
<li><a href="http://www.ondotnet.com/pub/a/dotnet/2002/04/15/events.html?page=2">Writing C# custom events &#8211; Part II</a></li>
</ul>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/selvasamuel.wordpress.com/93/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/selvasamuel.wordpress.com/93/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/selvasamuel.wordpress.com/93/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/selvasamuel.wordpress.com/93/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/selvasamuel.wordpress.com/93/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/selvasamuel.wordpress.com/93/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/selvasamuel.wordpress.com/93/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/selvasamuel.wordpress.com/93/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/selvasamuel.wordpress.com/93/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/selvasamuel.wordpress.com/93/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/selvasamuel.wordpress.com/93/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/selvasamuel.wordpress.com/93/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/selvasamuel.wordpress.com/93/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/selvasamuel.wordpress.com/93/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/selvasamuel.wordpress.com/93/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/selvasamuel.wordpress.com/93/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=selvasamuel.wordpress.com&amp;blog=182760&amp;post=93&amp;subd=selvasamuel&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://selvasamuel.wordpress.com/2007/09/13/exposing-events-from-custom-controls-in-net/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/309d636ef9bded425e9c5e417dc067ef?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ne0</media:title>
		</media:content>
	</item>
		<item>
		<title>The Gift of God</title>
		<link>http://selvasamuel.wordpress.com/2007/08/01/the-gift-of-god/</link>
		<comments>http://selvasamuel.wordpress.com/2007/08/01/the-gift-of-god/#comments</comments>
		<pubDate>Wed, 01 Aug 2007 14:55:58 +0000</pubDate>
		<dc:creator>ne0</dc:creator>
				<category><![CDATA[Christian poems]]></category>

		<guid isPermaLink="false">http://selvasamuel.wordpress.com/2007/08/01/the-gift-of-god/</guid>
		<description><![CDATA[Long before the day when Mary gave birth, Before God formed man from the dust of the earth, Before the stars into the heavens were hurled, There was the Lamb slain from the foundation of the world. Before the deadly &#8230; <a href="http://selvasamuel.wordpress.com/2007/08/01/the-gift-of-god/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=selvasamuel.wordpress.com&amp;blog=182760&amp;post=92&amp;subd=selvasamuel&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Long before the day when Mary gave birth,<br />
Before God formed man from the dust of the earth,<br />
Before the stars into the heavens were hurled,<br />
There was the Lamb slain from the foundation of the world.</p>
<p>Before the deadly fall of the race,<br />
God&#8217;s plan of redemption was already in place.<br />
His own Son would die on an old rugged cross,<br />
To save His creation from eternal loss.</p>
<p>God foretold His coming from the opening book,<br />
The Seed of the woman for whom we should look.<br />
Abraham, Isaac, and the sacrificial ram,<br />
Foretold the sacrifice of the great I AM.</p>
<p>The prophets proclaimed the place of His birth:<br />
Bethlehem of Judea, where God came to earth.<br />
His name did the prophets clearly foretell:<br />
Mighty God, Prince of Peace, Immanuel.</p>
<p>In the fullness of time God&#8217;s word came to pass,<br />
The birth of the Savior to a young virgin lass.<br />
His mission on earth was finally unfurled,<br />
The Lamb of God, to take away the sin of the world.</p>
<p>The way to the Father was shown us by Christ,<br />
He said, &#8220;I am the way, the truth, and the life.&#8221;<br />
He came to release the death grip of sin,<br />
He went to the cross our redemption to win.</p>
<p>It was for our sin that He suffered and bled,<br />
Yet triumphant, victorious, He rose from the dead.<br />
Now seated in heaven He eternally lives,<br />
Mercy and forgiveness freely He gives.</p>
<p>Salvation is promised to all who&#8217;ll receive.<br />
Trust the Lord Jesus and in Him alone believe.<br />
Repent of your sin and for His mercy do plead,<br />
And from sin, death, and hell you will surely be freed.</p>
<p>O this Christmas may your life truly start.<br />
May the glory of God shine into your heart.<br />
May the gift of God &#8212; His Son Jesus Christ<br />
Bring true peace and joy into your life.</p>
<p>And what can separate us from such wonderful love<br />
So rich and so full from our great God above?<br />
Nothing, no nothing, in all creation can part<br />
The Lord Jesus Christ from a redeemed, trusting heart.</p>
<p><em>Michael Lindell</em></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/selvasamuel.wordpress.com/92/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/selvasamuel.wordpress.com/92/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/selvasamuel.wordpress.com/92/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/selvasamuel.wordpress.com/92/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/selvasamuel.wordpress.com/92/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/selvasamuel.wordpress.com/92/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/selvasamuel.wordpress.com/92/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/selvasamuel.wordpress.com/92/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/selvasamuel.wordpress.com/92/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/selvasamuel.wordpress.com/92/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/selvasamuel.wordpress.com/92/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/selvasamuel.wordpress.com/92/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/selvasamuel.wordpress.com/92/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/selvasamuel.wordpress.com/92/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/selvasamuel.wordpress.com/92/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/selvasamuel.wordpress.com/92/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=selvasamuel.wordpress.com&amp;blog=182760&amp;post=92&amp;subd=selvasamuel&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://selvasamuel.wordpress.com/2007/08/01/the-gift-of-god/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/309d636ef9bded425e9c5e417dc067ef?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ne0</media:title>
		</media:content>
	</item>
		<item>
		<title>Programmers</title>
		<link>http://selvasamuel.wordpress.com/2007/07/26/programmers/</link>
		<comments>http://selvasamuel.wordpress.com/2007/07/26/programmers/#comments</comments>
		<pubDate>Thu, 26 Jul 2007 09:58:57 +0000</pubDate>
		<dc:creator>ne0</dc:creator>
				<category><![CDATA[Quotes]]></category>

		<guid isPermaLink="false">http://selvasamuel.wordpress.com/2007/07/26/programmers/</guid>
		<description><![CDATA[Most of the good programmers do programming not because they expect to get paid or get adulation by the public, but because it is fun to program. - Linus Torvalds<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=selvasamuel.wordpress.com&amp;blog=182760&amp;post=91&amp;subd=selvasamuel&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><em>Most of the  good programmers do programming not because they expect to get paid or get  adulation by the public, but because it is </em><em><strong>fun</strong> to program.</em></p>
<p align="right"><strong>- Linus Torvalds</strong></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/selvasamuel.wordpress.com/91/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/selvasamuel.wordpress.com/91/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/selvasamuel.wordpress.com/91/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/selvasamuel.wordpress.com/91/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/selvasamuel.wordpress.com/91/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/selvasamuel.wordpress.com/91/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/selvasamuel.wordpress.com/91/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/selvasamuel.wordpress.com/91/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/selvasamuel.wordpress.com/91/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/selvasamuel.wordpress.com/91/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/selvasamuel.wordpress.com/91/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/selvasamuel.wordpress.com/91/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/selvasamuel.wordpress.com/91/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/selvasamuel.wordpress.com/91/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/selvasamuel.wordpress.com/91/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/selvasamuel.wordpress.com/91/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=selvasamuel.wordpress.com&amp;blog=182760&amp;post=91&amp;subd=selvasamuel&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://selvasamuel.wordpress.com/2007/07/26/programmers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/309d636ef9bded425e9c5e417dc067ef?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ne0</media:title>
		</media:content>
	</item>
	</channel>
</rss>
