<?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>Laurens Van Keer</title>
	<atom:link href="http://laurens.vankeer.eu/feed" rel="self" type="application/rss+xml" />
	<link>http://laurens.vankeer.eu</link>
	<description>Laurens.VanKeer.eu</description>
	<lastBuildDate>Sat, 22 Aug 2009 18:20:00 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>PokerRanker &#8211; A poker hand evaluator in C++/CLI</title>
		<link>http://laurens.vankeer.eu/poker/pokerranker</link>
		<comments>http://laurens.vankeer.eu/poker/pokerranker#comments</comments>
		<pubDate>Tue, 11 Aug 2009 14:10:32 +0000</pubDate>
		<dc:creator>Laurens</dc:creator>
				<category><![CDATA[Poker]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[CLI]]></category>

		<guid isPermaLink="false">http://laurens.vankeer.eu/?p=112</guid>
		<description><![CDATA[
PokerRanker is a Windows application I wrote several months ago. Today I finally took the time to share it on my blog.  
This program demonstrates a collection of essential C++/CLI classes for poker (Texas Hold &#8216;em) applications: Card, Deck, Hand and HandEvaluator. The latter, HandEvaluator, is based on the 7 card hand evaluator written [...]]]></description>
			<content:encoded><![CDATA[<div style="float: right; margin: 0px 0px 5px 10px;"><a href="http://laurens.vankeer.eu/images/PokerRanker_screenshot.png"><img src="http://laurens.vankeer.eu/images/PokerRanker_thumb.png" alt="PokerRanker" /></a></div>
<p>PokerRanker is a Windows application I wrote several months ago. Today I finally took the time to share it on my blog. <img src='http://laurens.vankeer.eu/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>This program demonstrates a collection of essential C++/CLI classes for poker (Texas Hold &#8216;em) applications: Card, Deck, Hand and HandEvaluator. The latter, HandEvaluator, is based on <a href="http://spaz.ca/poker/">the 7 card hand evaluator written in Java by the University of Alberta</a>.</p>
<p>It&#8217;s not the fastest evaluator available, but it&#8217;s a pretty simple one and does the trick for most poker applications. If you really need a lightning fast hand evaluator, check out <a href="http://www.codingthewheel.com/archives/poker-hand-evaluator-roundup">this blog post by Coding The Wheel</a> for a hand evaluator roundup. You&#8217;ll need to do the conversion to C++/CLI by yourself though.</p>
<p>PokerRanker is licensed under the terms of the GNU Lesser General Public License.</p>
<p><a href="http://laurens.vankeer.eu/files/PokerRanker.zip">Click here to download the ZIP file containing all the project source files.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://laurens.vankeer.eu/poker/pokerranker/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Back from Scotland</title>
		<link>http://laurens.vankeer.eu/general/back-from-scotland</link>
		<comments>http://laurens.vankeer.eu/general/back-from-scotland#comments</comments>
		<pubDate>Sat, 08 Aug 2009 14:29:50 +0000</pubDate>
		<dc:creator>Laurens</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[news]]></category>

		<guid isPermaLink="false">http://laurens.vankeer.eu/?p=102</guid>
		<description><![CDATA[
Last week I went cycling in Scotland with four friends. We took the ferry from Zeebrugge to Rosyth and cycled around Scotland. We visited Edinburgh, Elgin, Dufftown, Keith, Inverness, Loch Ness, Glasgow and many small villages in between. It was fun, but tiring.  
In other news&#8230; I&#8217;ve been working on a few new (poker [...]]]></description>
			<content:encoded><![CDATA[<div style="float: left; margin: 0px 10px 5px 0px;"><img src="http://laurens.vankeer.eu/images/scotland_cycling.jpg" alt="Cycling at Scotland!" /></div>
<p>Last week I went cycling in Scotland with four friends. We took the ferry from Zeebrugge to Rosyth and cycled around Scotland. We visited Edinburgh, Elgin, Dufftown, Keith, Inverness, Loch Ness, Glasgow and many small villages in between. It was fun, but tiring. <img src='http://laurens.vankeer.eu/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>In other news&#8230; I&#8217;ve been working on a few new (poker related) software projects lately. Well, actually most of them are already finished for months, but I didn&#8217;t bother publishing them because I had other things on my mind (exams e.g.). So I&#8217;ll probably post more updates on these projects <em>soon</em>.</p>
]]></content:encoded>
			<wfw:commentRss>http://laurens.vankeer.eu/general/back-from-scotland/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SimpleCap &#8211; A TCP packet sniffer written in C++/CLI</title>
		<link>http://laurens.vankeer.eu/programming/simplecap</link>
		<comments>http://laurens.vankeer.eu/programming/simplecap#comments</comments>
		<pubDate>Thu, 14 May 2009 19:42:54 +0000</pubDate>
		<dc:creator>Laurens</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[CLI]]></category>

		<guid isPermaLink="false">http://laurens.vankeer.eu/?p=73</guid>
		<description><![CDATA[
For one of my latest projects, I needed to capture certain TCP packets coming from a certain IP address and port. This is called a packet sniffer.
Luckily, a complete Windows packet capture library already exists: WinPcap (based on the libpcap Unix API). This is a popular library used by many well known packet capture applications, [...]]]></description>
			<content:encoded><![CDATA[<div style="float: right; margin: 0px 0px 5px 10px;"><a href="http://laurens.vankeer.eu/images/SimpleCap.png"><img src="http://laurens.vankeer.eu/images/SimpleCap_thumb.png" alt="SimpleCap" /></a></div>
<p>For one of my latest projects, I needed to capture certain TCP packets coming from a certain IP address and port. This is called a packet sniffer.</p>
<p>Luckily, a complete Windows packet capture library already exists: <a href="http://www.winpcap.org/">WinPcap</a> (based on the libpcap Unix API). This is a popular library used by many well known packet capture applications, such as <a href="http://www.wireshark.org/">Wireshark</a>. The documentation for WinPcap is decent, but IMHO there aren&#8217;t that many C++ examples of simple Windows packet sniffers (let alone examples in C++/CLI&#8230;). So I wrote a TCP packet sniffer in C++/CLI myself, using <a href="http://www.winpcap.org/docs/docs_40_2/html/group__wpcap__tut.html">the UDP sniffer tutorial</a> as a reference. The result is a small Windows application I called <strong>SimpleCap</strong>.</p>
<p>SimpleCap v0.1 can currently capture TCP packets from either all sources, or from a specific IP address and port. Not quite the next Wireshark, but the goal was only to show how I implemented a TCP packet sniffer in Visual C++. I hope I succeeded. If there are any problems, please let me know (either in the comment section or via the contact page).</p>
<p><a href="http://laurens.vankeer.eu/files/SimpleCap.zip">Click here to download the SimpleCap v0.1 source files.</a></p>
<p>When starting your own packet capture project in Visual C++, don&#8217;t forget to:</p>
<ul>
<li>Include all WinPcap header files</li>
<li>Add the following dependencies to your project: Ws2_32.lib (Winsock library) and wpcap.lib (WinPcap library).<br />
Do this by opening project properties -> Linker -> Input -> Additional Dependencies: Ws2_32.lib wpcap.lib</li>
<li>Set the /clr option (Common Language Runtime Support) on via project properties -> General -> CLR support</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://laurens.vankeer.eu/programming/simplecap/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WinRegEx &#8211; A primitive regex tester in C++/CLI</title>
		<link>http://laurens.vankeer.eu/programming/winregex</link>
		<comments>http://laurens.vankeer.eu/programming/winregex#comments</comments>
		<pubDate>Thu, 02 Apr 2009 21:07:43 +0000</pubDate>
		<dc:creator>Laurens</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[CLI]]></category>
		<category><![CDATA[Regular Expressions]]></category>

		<guid isPermaLink="false">http://laurens.vankeer.eu/?p=57</guid>
		<description><![CDATA[
While working on a project in Visual C++ (more info coming soon), I encountered some difficulties with System::Text::RegularExpressions. So I started a little side-project specifically aimed at testing this regex library. The result is this little, trivial (but useful) regular expression tester.
Download links:
the executable (for Windows platforms only obviously)
VC++ project files
]]></description>
			<content:encoded><![CDATA[<div style="float: right; margin-left: 10px; margin-bottom: 10px;"><a href="http://laurens.vankeer.eu/images/WinRegEx.png"><img src="http://laurens.vankeer.eu/images/WinRegEx_thumb.png" alt="" /></a></div>
<p>While working on a project in Visual C++ (more info coming soon), I encountered some difficulties with System::Text::RegularExpressions. So I started a little side-project specifically aimed at testing this regex library. The result is this little, trivial (but useful) regular expression tester.</p>
<p>Download links:<br />
<a href="http://laurens.vankeer.eu/files/WinRegEx.zip">the executable (for Windows platforms only obviously)</a><br />
<a href="http://laurens.vankeer.eu/files/WinRegEx_source.zip">VC++ project files</a></p>
]]></content:encoded>
			<wfw:commentRss>http://laurens.vankeer.eu/programming/winregex/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Coding Tip: selecting a row from a matrix in managed C++</title>
		<link>http://laurens.vankeer.eu/programming/coding-tip-selecting-a-row-from-a-matrix-in-managed-cpp</link>
		<comments>http://laurens.vankeer.eu/programming/coding-tip-selecting-a-row-from-a-matrix-in-managed-cpp#comments</comments>
		<pubDate>Sun, 29 Mar 2009 18:43:22 +0000</pubDate>
		<dc:creator>Laurens</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[Coding Tip]]></category>

		<guid isPermaLink="false">http://laurens.vankeer.eu/?p=53</guid>
		<description><![CDATA[I decided to update my blog now and then with coding tips for various languages I work in. These will usually be my own solutions for problems on which I can&#8217;t immediately find a clear answer on.
This first tip is specifically for writing managed C++ (in Microsoft&#8217;s Visual C++).
Suppose you have a function that accepts [...]]]></description>
			<content:encoded><![CDATA[<p>I decided to update my blog now and then with coding tips for various languages I work in. These will usually be my own solutions for problems on which I can&#8217;t immediately find a clear answer on.</p>
<p>This first tip is specifically for writing managed C++ (in Microsoft&#8217;s Visual C++).</p>
<p>Suppose you have a function that accepts a managed integer array as a parameter.</p>

<div class="wp_syntax"><div class="code"><pre class="cpp" style="font-family:monospace;"><span style="color: #0000ff;">void</span> foo<span style="color: #008000;">&#40;</span>array<span style="color: #000080;">&lt;</span><span style="color: #0000ff;">int</span><span style="color: #000080;">&gt;</span><span style="color: #000040;">^</span> row<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span></pre></div></div>

<p>And suppose you have a managed integer matrix.</p>

<div class="wp_syntax"><div class="code"><pre class="cpp" style="font-family:monospace;">array<span style="color: #000080;">&lt;</span><span style="color: #0000ff;">int</span>, <span style="color: #0000dd;">2</span><span style="color: #000080;">&gt;</span><span style="color: #000040;">^</span> matrix <span style="color: #000080;">=</span> <span style="color: #008000;">&#123;</span><span style="color: #008000;">&#123;</span><span style="color: #0000dd;">1</span>,<span style="color: #0000dd;">2</span>,<span style="color: #0000dd;">3</span><span style="color: #008000;">&#125;</span>,<span style="color: #008000;">&#123;</span><span style="color: #0000dd;">3</span>,<span style="color: #0000dd;">4</span>,<span style="color: #0000dd;">5</span><span style="color: #008000;">&#125;</span>,<span style="color: #008000;">&#123;</span><span style="color: #0000dd;">6</span>,<span style="color: #0000dd;">7</span>,<span style="color: #0000dd;">8</span><span style="color: #008000;">&#125;</span>,<span style="color: #008000;">&#123;</span><span style="color: #0000dd;">9</span>,<span style="color: #0000dd;">10</span>,<span style="color: #0000dd;">11</span><span style="color: #008000;">&#125;</span><span style="color: #008000;">&#125;</span><span style="color: #008080;">;</span></pre></div></div>

<p>How do you pass a row (e.g. row 2) from this matrix to that function?</p>
<p>One way to do this, is by using native pointers. You could pin the matrix in the memory using the pin_ptr keyword (<a href="http://msdn.microsoft.com/en-us/library/1dz8byfh(VS.80).aspx">see MSDN library</a>) and then pass a pointer to the function as an int*.<br />
(with thanks to &#8220;Alex F&#8221; from <a href="http://www.codeguru.com/forum/showthread.php?p=1826985">the CodeGuru forums</a>)</p>
<p>Another way is to use the following function I wrote:</p>

<div class="wp_syntax"><div class="code"><pre class="cpp" style="font-family:monospace;">array<span style="color: #000080;">&lt;</span><span style="color: #0000ff;">int</span><span style="color: #000080;">&gt;</span><span style="color: #000040;">^</span> getRowFromMatrix<span style="color: #008000;">&#40;</span>array<span style="color: #000080;">&lt;</span><span style="color: #0000ff;">int</span>, <span style="color: #0000dd;">2</span><span style="color: #000080;">&gt;</span><span style="color: #000040;">^</span> matrix, <span style="color: #0000ff;">int</span> row<span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
	array<span style="color: #000080;">&lt;</span><span style="color: #0000ff;">int</span><span style="color: #000080;">&gt;</span><span style="color: #000040;">^</span> rowArray <span style="color: #000080;">=</span> gcnew array<span style="color: #000080;">&lt;</span><span style="color: #0000ff;">int</span><span style="color: #000080;">&gt;</span><span style="color: #008000;">&#40;</span>matrix<span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span>GetLength<span style="color: #008000;">&#40;</span><span style="color: #0000dd;">1</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
	<span style="color: #0000ff;">for</span> <span style="color: #008000;">&#40;</span><span style="color: #0000ff;">int</span> i<span style="color: #000080;">=</span><span style="color: #0000dd;">0</span><span style="color: #008080;">;</span> i<span style="color: #000080;">&lt;</span>matrix<span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span>GetLength<span style="color: #008000;">&#40;</span><span style="color: #0000dd;">1</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span> i<span style="color: #000040;">++</span><span style="color: #008000;">&#41;</span>
		rowArray<span style="color: #008000;">&#91;</span>i<span style="color: #008000;">&#93;</span> <span style="color: #000080;">=</span> matrix<span style="color: #008000;">&#91;</span>row, i<span style="color: #008000;">&#93;</span><span style="color: #008080;">;</span>
	<span style="color: #0000ff;">return</span> rowArray<span style="color: #008080;">;</span>
<span style="color: #008000;">&#125;</span></pre></div></div>

<p>Easy, right? <img src='http://laurens.vankeer.eu/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://laurens.vankeer.eu/programming/coding-tip-selecting-a-row-from-a-matrix-in-managed-cpp/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
