﻿<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" version="2.0">
  <channel>
    <title>Windojitsu -- code</title>
    <link>http://www.windojitsu.com/</link>
    <description>.NET kung-fu in the ancient and venerable style of Win32</description>
    <language>en-us</language>
    <copyright>© 2004-2006 Shawn A. Van Ness. All rights reserved.</copyright>
    <pubDate>Mon, 31 Dec 2007 03:12:00 GMT</pubDate>
    <lastBuildDate>Mon, 31 Dec 2007 03:12:00 GMT</lastBuildDate>
    <generator>Windojitsu Blogun v2.4</generator>
    <item>
      <title>.NET: Robust Comparison of Floating-point Values</title>
      <description>&lt;p&gt;A clever technique for the robust comparison of floating-point values -- reinterpreting 
the bits as sign-magnitude integers -- using purely verifiable, managed code.&lt;/p&gt;
&lt;p&gt;Inspiration comes from
&lt;a href="http://www.cygnus-software.com/papers/comparingfloats/comparingfloats.htm"&gt;Bruce 
Dawson&lt;/a&gt; (by way of Kim Gräsman) and
&lt;a href="http://groups.yahoo.com/group/win_tech_off_topic/message/31670"&gt;Jeroen Frijters&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Some unit tests are included, but swim at your own risk, ok?&lt;/p&gt;</description>
      <link>http://www.windojitsu.com/code/floatcomparer.html</link>
      <category>code</category>
      <guid>http://www.windojitsu.com/code/floatcomparer.html</guid>
      <pubDate>Wed, 29 Sep 2004 17:27:07 GMT</pubDate>
    </item>
    <item>
      <title>.NET: Jitsu.Collections.Specialized.ByteVector</title>
      <description>&lt;p&gt;Strongly-typed collection class for
&lt;a href="http://msdn.microsoft.com/library/en-us/cpref/html/frlrfsystembyteclasstopic.asp"&gt;
System.Byte&lt;/a&gt; -- manages storage as a byte[] internally, to avoid both boxing and excess 
heap allocations.&amp;nbsp; Use this class as a template for your own custom collection types.&lt;/p&gt;</description>
      <link>http://www.windojitsu.com/code/jitsu.collections.specialized.bytevector.cs.html</link>
      <category>code</category>
      <guid>http://www.windojitsu.com/code/jitsu.collections.specialized.bytevector.cs.html</guid>
      <pubDate>Thu, 06 May 2004 03:08:45 GMT</pubDate>
    </item>
    <item>
      <title>.NET: ColorConsole class</title>
      <description>&lt;p&gt;A p/invoke wrapper for
&lt;a href="http://msdn.microsoft.com/library/en-us/dllproc/base/setconsoletextattribute.asp"&gt;
SetConsoleTextAttribute&lt;/a&gt; -- for writing colored text to the console.&lt;/p&gt;</description>
      <link>http://www.windojitsu.com/code/colorconsole.cs.html</link>
      <category>code</category>
      <guid>http://www.windojitsu.com/code/colorconsole.cs.html</guid>
      <pubDate>Sun, 22 Feb 2004 03:03:35 GMT</pubDate>
    </item>
    <item>
      <title>.NET: AsyncStreamPump class</title>
      <description>&lt;p&gt;The 
&lt;a href="http://msdn.microsoft.com/library/en-us/cpguide/html/cpconioasynchronouscompletion.asp"&gt;
programming model for asynchronous I/O&lt;/a&gt; is an alien beast. You call 
&lt;a href="http://msdn.microsoft.com/library/en-us/cpref/html/frlrfSystemIOStreamClassBeginReadTopic.asp"&gt;
BeginRead&lt;/a&gt;, specifying a callback function to be invoked asynchronously when the read 
operation completes (or the stream is closed). But you&amp;#39;re not given the actual data -- for 
that, you have to call &lt;i&gt;back&lt;/i&gt; into the stream&amp;#39;s 
&lt;a href="http://msdn.microsoft.com/library/en-us/cpref/html/frlrfsystemiostreamclassendreadtopic.asp"&gt;
EndRead&lt;/a&gt; method, and then reestablish the async read by calling 
&lt;a href="http://msdn.microsoft.com/library/en-us/cpref/html/frlrfSystemIOStreamClassBeginReadTopic.asp"&gt;
BeginRead&lt;/a&gt;, again. It&amp;#39;s really quite a chore, because you have to have cached that 
&lt;a href="http://msdn.microsoft.com/library/en-us/cpref/html/frlrfsystemiostreamclasstopic.asp"&gt;
Stream&lt;/a&gt; object somewhere... 
&lt;i&gt;&lt;b&gt;Uncle!&lt;/b&gt;&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;Doesn&amp;#39;t .NET have a nice, tidy event model? Yes it does. Can&amp;#39;t we just subscribe to 
receive the data as it comes in, without writing two pages of boilerplate code juggling 
streams, buffers, and 
&lt;a href="http://msdn.microsoft.com/library/en-us/cpref/html/frlrfsystemiasyncresultclasstopic.asp"&gt;
IAsyncResult&lt;/a&gt; references? Yes we can.&lt;/p&gt;

&lt;p&gt;Submitted for your approval: 
&lt;a href="http://www.windojitsu.com/code/asyncstreampump.cs.html"&gt;ASyncStreamPump&lt;/a&gt;, my 
attempt at a reusable solution for this problem...&amp;nbsp; useful for large file copies, 
downloads, uploads -- can even be used to proxy a network connection, with just a few 
lines of client code!&lt;/p&gt;</description>
      <link>http://www.windojitsu.com/code/asyncstreampump.cs.html</link>
      <category>code</category>
      <guid>http://www.windojitsu.com/code/asyncstreampump.cs.html</guid>
      <pubDate>Tue, 17 Feb 2004 02:32:37 GMT</pubDate>
    </item>
    <item>
      <title>.NET: RegexMarshalByRefWrapper class</title>
      <description>&lt;p&gt;Regular expressions created with 
&lt;a href="http://msdn.microsoft.com/library/en-us/cpref/html/frlrfsystemtextregularexpressionsregexoptionsclasstopic.asp"&gt;
RegexOptions.Compiled&lt;/a&gt; will leak, unless they&amp;#39;re housed in a secondary AppDomain that 
can be unloaded -- you&amp;#39;ll need this wrapper class, or something like it, to do that.&lt;/p&gt;
&lt;p&gt;A similar technique can be used with
&lt;a href="http://msdn.microsoft.com/library/en-us/cpref/html/frlrfSystemCodeDomCompiler.asp"&gt;
System.CodeDom.Compiler&lt;/a&gt; types, or anything that uses
&lt;a href="http://msdn.microsoft.com/library/en-us/cpref/html/frlrfsystemreflectionemit.asp"&gt;
Reflection.Emit&lt;/a&gt; under the hood.&lt;/p&gt;</description>
      <link>http://www.windojitsu.com/code/regexmarshalbyrefwrapper.cs.html</link>
      <category>code</category>
      <guid>http://www.windojitsu.com/code/regexmarshalbyrefwrapper.cs.html</guid>
      <pubDate>Mon, 01 Jan 0001 00:00:00 GMT</pubDate>
    </item>
    <item>
      <title>Win32: HiResTimer class</title>
      <description>&lt;p&gt;It&amp;#39;s not rocket science, but it&amp;#39;s amazing how often folks get this wrong (also 
available in &lt;a href="hirestimer.cs.html"&gt;C#&lt;/a&gt;).&lt;/p&gt;</description>
      <link>http://www.windojitsu.com/code/hirestimer.h.html</link>
      <category>code</category>
      <guid>http://www.windojitsu.com/code/hirestimer.h.html</guid>
      <pubDate>Mon, 01 Jan 0001 00:00:00 GMT</pubDate>
    </item>
    <item>
      <title>.NET: HiResTimer class</title>
      <description>&lt;p&gt;It&amp;#39;s not rocket science, but it&amp;#39;s amazing how often folks get this wrong (also 
available in &lt;a href="hirestimer.h.html"&gt;unmanaged C++&lt;/a&gt;).&lt;/p&gt;</description>
      <link>http://www.windojitsu.com/code/hirestimer.cs.html</link>
      <category>code</category>
      <guid>http://www.windojitsu.com/code/hirestimer.cs.html</guid>
      <pubDate>Mon, 01 Jan 0001 00:00:00 GMT</pubDate>
    </item>
    <item>
      <title>DCOM: PingRemoteHost function</title>
      <description>&lt;p&gt;Use this helper function to &amp;quot;ping&amp;quot; a remote DCOM server, before calling 
CoCreateInstanceEx -- thus greatly mitigating the DCOM timeout problem (at least for the 
initial activation request).&lt;/p&gt;
&lt;p&gt;&lt;i&gt;&lt;b&gt;Update -- Windows Server 2003 and Windows XP SP2 don&amp;#39;t allow 
unauthenticated DCOM activation requests, by default (if at all).&amp;nbsp; I&amp;#39;m 
removing support for bUnAuthenticated=true.&lt;/b&gt;&lt;/i&gt;&lt;/p&gt;</description>
      <link>http://www.windojitsu.com/code/atlxdcom.h.html</link>
      <category>code</category>
      <guid>http://www.windojitsu.com/code/atlxdcom.h.html</guid>
      <pubDate>Mon, 01 Jan 0001 00:00:00 GMT</pubDate>
    </item>
    <item>
      <title>Win32: ModelessDialogHook class</title>
      <description>&lt;p&gt;Encapsulating reusable dialogs as components (either in DLLs, or in COM objects) is a 
great idea -- much better than trying to reuse a .rc file -- but things get tricky if you 
like your dialogs modeless...&lt;/p&gt;</description>
      <link>http://www.windojitsu.com/code/modelessdialoghook.h.html</link>
      <category>code</category>
      <guid>http://www.windojitsu.com/code/modelessdialoghook.h.html</guid>
      <pubDate>Mon, 01 Jan 0001 00:00:00 GMT</pubDate>
    </item>
    <item>
      <title>ATL3: CSimpleVector template</title>
      <description>&lt;p&gt;The ATL3 array template (CSimpleArray) is buggy and leaky -- don&amp;#39;t use it (note: ATL7 
finally repairs the bugs in 
&lt;a href="http://msdn.microsoft.com/library/en-us/vclib/html/vclrfcsimplearray.asp"&gt;
CSimpleArray&lt;/a&gt;, and also offers a newer template, 
&lt;a href="http://msdn.microsoft.com/library/en-us/vclib/html/vclrfcatlarray.asp"&gt;CAtlArray&lt;/a&gt;).&lt;/p&gt;</description>
      <link>http://www.windojitsu.com/code/atlxvector.h.html</link>
      <category>code</category>
      <guid>http://www.windojitsu.com/code/atlxvector.h.html</guid>
      <pubDate>Mon, 01 Jan 0001 00:00:00 GMT</pubDate>
    </item>
    <item>
      <title>ATL3: CSimpleList template</title>
      <description>&lt;p&gt;As seen in &lt;a href="http://www.sellsbrothers.com/tools/attila/"&gt;Attila&lt;/a&gt; (note: ATL7 
offers similar functionality with their new 
&lt;a href="http://msdn.microsoft.com/library/en-us/vclib/html/vclrfcatllist.asp"&gt;CAtlList&lt;/a&gt; 
template).&lt;/p&gt;</description>
      <link>http://www.windojitsu.com/code/atlxlist.h.html</link>
      <category>code</category>
      <guid>http://www.windojitsu.com/code/atlxlist.h.html</guid>
      <pubDate>Mon, 01 Jan 0001 00:00:00 GMT</pubDate>
    </item>
    <item>
      <title>ATL3: CComTSTR class</title>
      <description>&lt;p&gt;The ATL3 string conversion macros are ugly (at best) or they pose terrible security 
holes (at worst) -- use this heap-based wrapper class instead (note: ATL7 offers a similar 
solution with its new 
&lt;a href="http://msdn.microsoft.com/library/en-us/vclib/html/_atl_string_conversion_macros.asp"&gt;
CW2A&lt;/a&gt; et. al. classes).&lt;/p&gt;</description>
      <link>http://www.windojitsu.com/code/atlxtstr.h.html</link>
      <category>code</category>
      <guid>http://www.windojitsu.com/code/atlxtstr.h.html</guid>
      <pubDate>Mon, 01 Jan 0001 00:00:00 GMT</pubDate>
    </item>
  </channel>
</rss>