<?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/"
	>

<channel>
	<title>jcarle.com &#187; .NET Framework</title>
	<atom:link href="http://www.jcarle.com/category/net-framework/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.jcarle.com</link>
	<description>The musings of a developer</description>
	<lastBuildDate>Mon, 21 Mar 2011 16:53:22 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Trusting Network Shares with Visual Studio 2010 / .NET Framework v4.0</title>
		<link>http://www.jcarle.com/2011/01/20/trusting-network-shares-with-visual-studio-2010-net-framework-v4-0/</link>
		<comments>http://www.jcarle.com/2011/01/20/trusting-network-shares-with-visual-studio-2010-net-framework-v4-0/#comments</comments>
		<pubDate>Thu, 20 Jan 2011 21:10:28 +0000</pubDate>
		<dc:creator>Jean-Sebastien Carle</dc:creator>
				<category><![CDATA[.NET Framework]]></category>
		<category><![CDATA[Visual Studio]]></category>

		<guid isPermaLink="false">http://www.jcarle.com/?p=298</guid>
		<description><![CDATA[If you are like me and you store all your code on a server, you will have likely learned about trusting a network share using CasPol.exe. However, when moving from Visual Studio 2008 (.NET Framework 2.0/3.0/3.5) over to Visual Studio 2010 (.NET Framework 4.0), you may find yourself scratching your head. If you are used [...]]]></description>
			<content:encoded><![CDATA[<p>If you are like me and you store all your code on a server, you will have likely learned about trusting a network share using CasPol.exe. However, when moving from Visual Studio 2008 (.NET Framework 2.0/3.0/3.5) over to Visual Studio 2010 (.NET Framework 4.0), you may find yourself scratching your head.</p>
<p><span id="more-298"></span>If you are used to using the Visual Studio Command Prompt to quickly get to CasPol, you may find that some of your projects will not seem to respect your new FullTrust settings. The reason is that, unless you are carefully paying attention, the Visual Studio Command Prompt defaults to adding the .NET Framework 4.0 folder to its path. If your project is still running under .NET Framework 2.0/3.0/3.5, it will require setting CasPol for those versions as well. Just a note, I have also personally had more success with using 1 as a code group instead of 1.2.</p>
<p>To trust a network share for all versions of the .NET Framework, simply call CasPol for each version using the full path as below:</p>
<pre class="brush: bash; title: ; notranslate">
C:\Windows\Microsoft.NET\Framework\v2.0.50727\CasPol -m -ag 1 -url file://YourSharePath\* FullTrust
C:\Windows\Microsoft.NET\Framework\v4.0.30319\CasPol -m -ag 1 -url file://YourSharePath\* FullTrust
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.jcarle.com/2011/01/20/trusting-network-shares-with-visual-studio-2010-net-framework-v4-0/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Communicating multi-byte integers across platforms</title>
		<link>http://www.jcarle.com/2011/01/06/communicating-multi-byte-integers-across-platforms/</link>
		<comments>http://www.jcarle.com/2011/01/06/communicating-multi-byte-integers-across-platforms/#comments</comments>
		<pubDate>Thu, 06 Jan 2011 05:36:35 +0000</pubDate>
		<dc:creator>Jean-Sebastien Carle</dc:creator>
				<category><![CDATA[.NET Framework]]></category>

		<guid isPermaLink="false">http://www.jcarle.com/?p=292</guid>
		<description><![CDATA[Developing applications that communicate between different platforms can quickly hit ground if multi-byte integers are sent without taking the proper byte order into account. We often forgotten to watch for this as most of us stick to a single platform during development. Thankfully, the .NET Framework has taken all the guesswork out with a pair [...]]]></description>
			<content:encoded><![CDATA[<p>Developing applications that communicate between different platforms can quickly hit ground if multi-byte integers are sent without taking the proper byte order into account. We often forgotten to watch for this as most of us stick to a single platform during development. Thankfully, the .NET Framework has taken all the guesswork out with a pair of simple methods.</p>
<p><span id="more-292"></span></p>
<p>Before transmitting integers over the wire, a quick call to <a href="http://msdn.microsoft.com/en-us/library/system.net.ipaddress.hosttonetworkorder.aspx">IPAddress.HostToNetworkOrder()</a> will change the byte order to the communications standard of significant byte first. Receiving integers also requires a single call to <a href="http://msdn.microsoft.com/en-us/library/system.net.ipaddress.networktohostorder.aspx">IPAddress.NetworkToHostOrder()</a> to ensure the proper value is understood from the incoming bytes.</p>
<p>Read over the “<a href="http://www.codeguru.com/Cpp/Cpp/cpp_mfc/bits/article.php/c6803/">Sockets Byte-Ordering Primer</a>” article over at <a href="http://www.codeguru.com/">codeguru.com</a> and the “<a href="http://www.developer.com/net/csharp/article.php/3331571">Converting &#038; Sending Sockets Data with a Leading Length Value</a>” article over at <a href="http://www.developer.com/">developer.com</a> for some great in-depth explanations on the matter.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jcarle.com/2011/01/06/communicating-multi-byte-integers-across-platforms/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Extending the SqlDataAdapter with a FillTimeout</title>
		<link>http://www.jcarle.com/2009/07/21/extending-the-sqldataadapter-with-a-filltimeout/</link>
		<comments>http://www.jcarle.com/2009/07/21/extending-the-sqldataadapter-with-a-filltimeout/#comments</comments>
		<pubDate>Tue, 21 Jul 2009 04:30:24 +0000</pubDate>
		<dc:creator>Jean-Sebastien Carle</dc:creator>
				<category><![CDATA[.NET Framework]]></category>

		<guid isPermaLink="false">http://www.jcarle.com/?p=62</guid>
		<description><![CDATA[The SqlDataAdapter has a CommandTimeout property but does offer any method to set any kind of timeout during the Fill method. If you are returning rather large data sets, you can quickly run into a problem. The obvious solution would be to inherit the SqlDataAdapter and simply override the Fill method, except that the SqlDataAdapter [...]]]></description>
			<content:encoded><![CDATA[<p>The SqlDataAdapter has a CommandTimeout property but does offer any method to set any kind of timeout during the Fill method. If you are returning rather large data sets, you can quickly run into a problem. The obvious solution would be to inherit the SqlDataAdapter and simply override the Fill method, except that the SqlDataAdapter cannot be inherited. As a result, we must implement the same methods that the SqlDataAdapter does and attach them to a private internal SqlDataAdapter to do all the heavy lifting. With the use of anonymous delegates, we can easily rework the Fill methods to offer a new FillTimeout property and throw an exception when we exceed our desired timeout.</p>
<p><span id="more-62"></span></p>
<pre class="brush: csharp; title: ; notranslate">
public int FillTimeout
{
    get { return _fillTimeout; }
    set { _fillTimeout = value; }
}

public int Fill(DataSet dataSet)
{
    if (_fillTimeout == 0)
    {
        return _adapter.Fill(dataSet);
    }
    else
    {
        int rows = 0;
        Thread fillThread = new Thread(delegate() { rows = _adapter.Fill(dataSet); });
        fillThread.Start();
        if (fillThread.Join(_fillTimeout * 1000))
        {
            return rows;
        }
        else
        {
            try
            {
                fillThread.Abort();
            }
            catch (ThreadAbortException)
            {
                Thread.ResetAbort();
            }
            throw new TimeoutException();
        }
    }
}
</pre>
<p>Download the full ExtendedSqlDataAdapter class : <a href="http://www.jcarle.com/wp-content/uploads/2009/07/ExtendedSqlDataAdapter.cs">ExtendedSqlDataAdapter.cs</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.jcarle.com/2009/07/21/extending-the-sqldataadapter-with-a-filltimeout/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

