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

<channel>
	<title>Steven Engelhardt</title>
	<atom:link href="http://www.deez.info/sengelha/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.deez.info/sengelha</link>
	<description>A financial industry software developer's thoughts and insights</description>
	<pubDate>Tue, 24 Jun 2008 04:12:36 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
	<language>en</language>
			<item>
		<title>Stitched Panorama Pictures</title>
		<link>http://www.deez.info/sengelha/2008/06/23/stitched-panorama-pictures/</link>
		<comments>http://www.deez.info/sengelha/2008/06/23/stitched-panorama-pictures/#comments</comments>
		<pubDate>Tue, 24 Jun 2008 03:50:05 +0000</pubDate>
		<dc:creator>Steve</dc:creator>
		
		<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://www.deez.info/sengelha/?p=5489</guid>
		<description><![CDATA[
Using Hugin (based on a recommendation from Keith) and some pictures I took last summer, I have created a few stitched panoramic pictures from last year&#8217;s Wisconsin vacation:









]]></description>
			<content:encoded><![CDATA[<p>
Using <a href="http://hugin.sourceforge.net/">Hugin</a> (based on a recommendation from <a href="http://www.kgarner.com/blog/">Keith</a>) and some pictures I took last summer, I have created a few stitched panoramic pictures from last year&#8217;s Wisconsin vacation:
</p>
<p>
<a href='http://www.deez.info/sengelha/wp-content/uploads/2008/06/lake-arbutus.jpg'><img src="http://www.deez.info/sengelha/wp-content/uploads/2008/06/lake-arbutus-300x87.jpg" alt="" title="Lake Arbutus" width="300" height="87" class="alignnone size-medium wp-image-5490" /></a>
</p>
<p>
<a href='http://www.deez.info/sengelha/wp-content/uploads/2008/06/wisconsin-house.jpg'><img src="http://www.deez.info/sengelha/wp-content/uploads/2008/06/wisconsin-house-300x31.jpg" alt="" title="Wisconsin House" width="300" height="31" class="alignnone size-medium wp-image-5490" /></a>
</p>
<p>
<a href='http://www.deez.info/sengelha/wp-content/uploads/2008/06/fishing-spot.jpg'><img src="http://www.deez.info/sengelha/wp-content/uploads/2008/06/fishing-spot-300x39.jpg" alt="" title="Fishing Spot" width="300" height="39" class="alignnone size-medium wp-image-5490" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.deez.info/sengelha/2008/06/23/stitched-panorama-pictures/feed/</wfw:commentRss>
		</item>
		<item>
		<title>What I&#8217;m Reading</title>
		<link>http://www.deez.info/sengelha/2008/06/20/what-im-reading/</link>
		<comments>http://www.deez.info/sengelha/2008/06/20/what-im-reading/#comments</comments>
		<pubDate>Fri, 20 Jun 2008 14:43:48 +0000</pubDate>
		<dc:creator>Steve</dc:creator>
		
		<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://www.deez.info/sengelha/?p=5483</guid>
		<description><![CDATA[
Now that I have completed my degree in Computational Finance from DePaul University, I have far more time for leisurely activities such as reading books.  Here&#8217;s what I&#8217;ve been reading recently:







How to Lie With Statistics by Darrell Huff and Irving Geis.







When Genius Failed: The Rise and Fall of Long-Term Capital Management by Roger Lowenstein.







The [...]]]></description>
			<content:encoded><![CDATA[<p>
Now that I have completed my degree in <a href="http://www.cdm.depaul.edu/academics/Pages/MSinCOmputationalFinance.aspx">Computational Finance</a> from <a href="http://www.depaul.edu/">DePaul University</a>, I have far more time for leisurely activities such as reading books.  Here&#8217;s what I&#8217;ve been reading recently:
</p>
<table>
<tr valign="top">
<td>
<a href='http://www.amazon.com/How-Lie-Statistics-Darrell-Huff/dp/0393310728/ref=pd_bbs_sr_1?ie=UTF8&#038;s=books&#038;qid=1213972016&#038;sr=1-1'><img src="http://www.deez.info/sengelha/wp-content/uploads/2008/06/howtoliewithstatistics.jpg" alt="How to Lie With Statistics" title="howtoliewithstatistics" width="150" height="150" class="alignnone size-thumbnail wp-image-5488" /></a>
</td>
<td>
<a href="http://www.amazon.com/How-Lie-Statistics-Darrell-Huff/dp/0393310728/ref=pd_bbs_sr_1?ie=UTF8&#038;s=books&#038;qid=1213972016&#038;sr=1-1">How to Lie With Statistics</a> by Darrell Huff and Irving Geis.
</td>
</tr>
<tr valign="top">
<td>
<a href='http://www.amazon.com/When-Genius-Failed-Long-Term-Management/dp/0375758259/ref=pd_bbs_sr_1?ie=UTF8&#038;s=books&#038;qid=1213972065&#038;sr=1-1'><img src="http://www.deez.info/sengelha/wp-content/uploads/2008/06/whengeniusfailed-150x150.jpg" alt="When Genius Failed" title="whengeniusfailed" width="150" height="150" class="alignnone size-thumbnail wp-image-5487" /></a>
</td>
<td>
<a href="http://www.amazon.com/When-Genius-Failed-Long-Term-Management/dp/0375758259/ref=pd_bbs_sr_1?ie=UTF8&#038;s=books&#038;qid=1213972065&#038;sr=1-1">When Genius Failed: The Rise and Fall of Long-Term Capital Management</a> by Roger Lowenstein.
</td>
</tr>
<tr valign="top">
<td>
<a href='http://www.amazon.com/Underpants-Steve-Martin/dp/0786888245/ref=pd_bbs_2?ie=UTF8&#038;s=books&#038;qid=1213972040&#038;sr=1-2'><img src="http://www.deez.info/sengelha/wp-content/uploads/2008/06/theunderpants-150x150.jpg" alt="The Underpants" title="theunderpants" width="150" height="150" class="alignnone size-thumbnail wp-image-5486" /></a>
</td>
<td>
<a href="http://www.amazon.com/Underpants-Steve-Martin/dp/0786888245/ref=pd_bbs_2?ie=UTF8&#038;s=books&#038;qid=1213972040&#038;sr=1-2">The Underpants</a> by Steve Martin.
</td>
</tr>
<tr valign="top">
<td>
<a href='http://www.amazon.com/Intelligent-Investor-Book-Practical-Counsel/dp/B0002X1JKU'><img src="http://www.deez.info/sengelha/wp-content/uploads/2008/06/theintelligentinvestor-150x150.jpg" alt="The Intelligent Investor" title="theintelligentinvestor" width="150" height="150" class="alignnone size-thumbnail wp-image-5485" /></a>
</td>
<td>
<a href="http://www.amazon.com/Intelligent-Investor-Book-Practical-Counsel/dp/B0002X1JKU">The Intelligent Investor: The Definitive Book on Value Investing (Revised Edition)</a> by Benjamin Graham.
</td>
</tr>
</table>
]]></content:encoded>
			<wfw:commentRss>http://www.deez.info/sengelha/2008/06/20/what-im-reading/feed/</wfw:commentRss>
		</item>
		<item>
		<title>2008 Cubs Predictions: Take 4</title>
		<link>http://www.deez.info/sengelha/2008/06/12/2008-cubs-predictions-take-4/</link>
		<comments>http://www.deez.info/sengelha/2008/06/12/2008-cubs-predictions-take-4/#comments</comments>
		<pubDate>Thu, 12 Jun 2008 15:27:21 +0000</pubDate>
		<dc:creator>Steve</dc:creator>
		
		<category><![CDATA[Baseball]]></category>

		<guid isPermaLink="false">http://www.deez.info/sengelha/?p=5482</guid>
		<description><![CDATA[

Latest Cubs prediction: 110-54 (0.362 team OBP, 3.66 team ERA, underlying equation).    (Previous predictions: 112-50, 113-49, 90-62)


We&#8217;ll have to see how Soriano&#8217;s broken finger affects the Cubs&#8217; team OBP and thus the prediction.
]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.cubs.com/"><img style="float:right; margin: 0 0 10px 10px;" src="http://www.deez.info/sengelha/wp-content/uploads/2007/07/cubs-logo.gif" alt="Chicago Cubs Logo" /></a></p>
<p>
Latest Cubs prediction: <b>110-54</b> (0.362 team OBP, 3.66 team ERA, <a href="http://www.deez.info/sengelha/2006/05/09/2006-baseball-predictions/">underlying equation</a>).    (Previous predictions: <a href="http://www.deez.info/sengelha/2008/05/23/2008-cubs-predictions-take-3/">112-50</a>, <a href="http://www.deez.info/sengelha/2008/04/23/2008-cubs-predictions-take-2/">113-49</a>, <a href="http://www.deez.info/sengelha/2008/04/08/2008-cubs-predictions/">90-62</a>)
</p>
<p>
We&#8217;ll have to see how <a href="http://chicago.cubs.mlb.com/news/article.jsp?ymd=20080611&#038;content_id=2893561&#038;vkey=news_chc&#038;fext=.jsp&#038;c_id=chc">Soriano&#8217;s broken finger</a> affects the Cubs&#8217; team OBP and thus the prediction.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.deez.info/sengelha/2008/06/12/2008-cubs-predictions-take-4/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Balloon Tooltips</title>
		<link>http://www.deez.info/sengelha/2008/06/12/balloon-tooltips/</link>
		<comments>http://www.deez.info/sengelha/2008/06/12/balloon-tooltips/#comments</comments>
		<pubDate>Thu, 12 Jun 2008 15:17:17 +0000</pubDate>
		<dc:creator>Steve</dc:creator>
		
		<category><![CDATA[Win32]]></category>

		<guid isPermaLink="false">http://www.deez.info/sengelha/?p=5477</guid>
		<description><![CDATA[
In the Windows XP login screen, the password text box will warn you with a balloon tooltip if you accidentally turn Caps Lock on:



The balloon tooltip appears to be a Windows tooltip common control with the TTS_BALLOON style.


To replicate this functionality, I decided to write a function called ShowMsgBalloon() which, given a control and the [...]]]></description>
			<content:encoded><![CDATA[<p>
In the Windows XP login screen, the password text box will warn you with a balloon tooltip if you accidentally turn Caps Lock on:
</p>
<p><a href='http://www.deez.info/sengelha/wp-content/uploads/2008/06/winxp-caps-lock-msg.png'><img src="http://www.deez.info/sengelha/wp-content/uploads/2008/06/winxp-caps-lock-msg-300x154.png" alt="Windows XP Caps Lock Warning Message" title="winxp-caps-lock-msg" width="300" height="154" class="alignnone size-medium wp-image-5481" /></a></p>
<p>
The balloon tooltip appears to be a <a href="http://msdn.microsoft.com/en-us/library/bb760250(VS.85).aspx">Windows tooltip common control</a> with the <a href="http://msdn.microsoft.com/en-us/library/bb760248(VS.85).aspx">TTS_BALLOON style</a>.
</p>
<p>
To replicate this functionality, I decided to write a function called <code>ShowMsgBalloon()</code> which, given a control and the various balloon tooltip parameters, creates and shows the balloon tooltip below the control.
</p>
<p>
The key insight to making <code>ShowMsgBallon()</code> work as intended was to use the <a href="http://msdn.microsoft.com/en-us/library/bb760252(VS.85).aspx"><code>TTF_TRACK</code></a> option to create a tracking tooltip.  This will immediately show the tooltip without requiring the user to position the mouse over the control.  The main downside to using <code>TTF_TRACK</code> is that the tooltip will not move with the control if the window is moved; you need to manually move the tooltip using <code>TTM_TRACKPOSITION</code> as required.  One could probably make this automatic by subclassing the tooltip&#8217;s parent control and handling <a href="http://msdn.microsoft.com/en-us/library/ms632652(VS.85).aspx"><code>WM_WINDOWPOSCHANGED</code></a> messages.
</p>
<p>
Here is the source code to <code>ShowMsgBalloon()</code>.  When you are done with the balloon, call <a href="http://msdn.microsoft.com/en-us/library/ms632682.aspx"><code>DestroyWindow()</code></a> on the returned <code>HWND</code>.  Note: you may want your application to <a href="http://msdn.microsoft.com/en-us/library/ms997646.aspx">use comctl32.dll version 6</a> as it will lead to a nicer visual style, including a close button.
</p>
<div class="dean_ch" style="white-space: nowrap;">
<ol>
<li class="li1">
<div class="de1"><span class="co2">#include &lt;windows.h&gt;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co2">#include &lt;commctrl.h&gt;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="co1">// Options to ShowMsgBallon() (see dwOpts parameter). &nbsp;These are the</span></div>
</li>
<li class="li2">
<div class="de2"><span class="co1">// standard icon types for balloon tooltips.</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co2">#define SMB_ICON_INFO &nbsp; &nbsp;(1 &lt;&lt; 0)</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co2">#define SMB_ICON_WARNING (1 &lt;&lt; 1)</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co2">#define SMB_ICON_ERROR &nbsp; (1 &lt;&lt; 2)</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li2">
<div class="de2"><span class="co1">// Given the options passed to ShowMsgBalloon(), determine what</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co1">// parameter to send to TTM_SETTITLE for the balloon tooltip&#8217;s icon.</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw4">static</span> DWORD</div>
</li>
<li class="li1">
<div class="de1">GetTitleIcon<span class="br0">&#40;</span>DWORD dwOpts<span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#123;</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>dwOpts &amp; SMB_ICON_INFO<span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> TTI_INFO;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw1">else</span> <span class="kw1">if</span> <span class="br0">&#40;</span>dwOpts &amp; SMB_ICON_WARNING<span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> TTI_WARNING;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw1">else</span> <span class="kw1">if</span> <span class="br0">&#40;</span>dwOpts &amp; SMB_ICON_ERROR<span class="br0">&#41;</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> TTI_ERROR;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw1">else</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> <span class="nu0">0</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li2">
<div class="de2"><span class="co1">// Create and show a balloon tooltip immediately below the control</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co1">// hwndCtrl with the given title, message, and options.</span></div>
</li>
<li class="li1">
<div class="de1">HWND</div>
</li>
<li class="li1">
<div class="de1">ShowMsgBalloon<span class="br0">&#40;</span>HWND hwndCtrl, LPCTSTR szTitle, LPCTSTR szMsg,</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;DWORD dwOpts<span class="br0">&#41;</span></div>
</li>
<li class="li2">
<div class="de2"><span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; HWND hwndRet = <span class="kw2">NULL</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; HWND hwndTT = <span class="kw2">NULL</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; TOOLINFO ti = <span class="br0">&#123;</span> <span class="nu0">0</span> <span class="br0">&#125;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; RECT rc;</div>
</li>
<li class="li2">
<div class="de2">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="co1">// Even though TTS_CLOSE is always specified, a close button will</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="co1">// only be shown if your application has a manifest that requires</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="co1">// comctl32.dll version 6.</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; hwndTT = CreateWindow</div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#40;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; TOOLTIPS_CLASS,</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; TEXT<span class="br0">&#40;</span><span class="st0">&quot;&quot;</span><span class="br0">&#41;</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; WS_POPUP | TTS_NOPREFIX | TTS_BALLOON | TTS_CLOSE,</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; CW_USEDEFAULT, CW_USEDEFAULT,</div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; CW_USEDEFAULT, CW_USEDEFAULT,</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; hwndCtrl,</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">NULL</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">NULL</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">NULL</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>hwndTT == <span class="kw2">NULL</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">goto</span> Cleanup;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="co1">// By using TTTOOLINFO_V1_SIZE rather than sizeof(TOOLINFO),</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; <span class="co1">// we don&#8217;t require users to be using comctl32 version 6.</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; ti.<span class="me1">cbSize</span> = TTTOOLINFO_V1_SIZE;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; ti.<span class="me1">uFlags</span> = TTF_TRACK;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; ti.<span class="me1">hwnd</span> = hwndCtrl;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; ti.<span class="me1">lpszText</span> = const_cast&lt;LPTSTR&gt;<span class="br0">&#40;</span>szMsg<span class="br0">&#41;</span>;</div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>!SendMessage<span class="br0">&#40;</span>hwndTT, TTM_ADDTOOL, <span class="nu0">0</span>, <span class="br0">&#40;</span>LPARAM<span class="br0">&#41;</span> &amp;ti<span class="br0">&#41;</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">goto</span> Cleanup;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>!SendMessage<span class="br0">&#40;</span>hwndTT, TTM_SETTITLE, GetTitleIcon<span class="br0">&#40;</span>dwOpts<span class="br0">&#41;</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="br0">&#40;</span>LPARAM<span class="br0">&#41;</span> szTitle<span class="br0">&#41;</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">goto</span> Cleanup;</div>
</li>
<li class="li2">
<div class="de2">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="co1">// Position the tooltip below the control</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>!GetWindowRect<span class="br0">&#40;</span>hwndCtrl, &amp;rc<span class="br0">&#41;</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">goto</span> Cleanup;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; SendMessage<span class="br0">&#40;</span>hwndTT, TTM_TRACKPOSITION, <span class="nu0">0</span>,</div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MAKELONG<span class="br0">&#40;</span>rc.<span class="me1">left</span> + <span class="nu0">10</span>, rc.<span class="me1">bottom</span><span class="br0">&#41;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="co1">// Show the tooltip</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>!SendMessage<span class="br0">&#40;</span>hwndTT, TTM_TRACKACTIVATE, <span class="kw2">TRUE</span>, <span class="br0">&#40;</span>LPARAM<span class="br0">&#41;</span> &amp;ti<span class="br0">&#41;</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">goto</span> Cleanup;</div>
</li>
<li class="li2">
<div class="de2">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; hwndRet = hwndTT;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; hwndTT = <span class="kw2">NULL</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">Cleanup:</div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>hwndTT != <span class="kw2">NULL</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; ::<span class="me2">DestroyWindow</span><span class="br0">&#40;</span>hwndTT<span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw1">return</span> hwndRet;</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
</ol>
</div>
<p><del datetime="2008-06-12T15:16:12+00:00"></del></p>
]]></content:encoded>
			<wfw:commentRss>http://www.deez.info/sengelha/2008/06/12/balloon-tooltips/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Escaping Strings in XPath 1.0</title>
		<link>http://www.deez.info/sengelha/2008/06/03/escaping-strings-in-xpath-10/</link>
		<comments>http://www.deez.info/sengelha/2008/06/03/escaping-strings-in-xpath-10/#comments</comments>
		<pubDate>Wed, 04 Jun 2008 00:59:03 +0000</pubDate>
		<dc:creator>Steve</dc:creator>
		
		<category><![CDATA[C++]]></category>

		<category><![CDATA[XPath]]></category>

		<guid isPermaLink="false">http://www.deez.info/sengelha/?p=5476</guid>
		<description><![CDATA[
XPath is a language for selecting nodes from an XML document.  XPath is used extensively in XSLT and other XML technologies.  I also vastly prefer using XPath (e.g. with XPathNavigator) over the XML DOM when manipulating XML in a non-streaming fashion.


In XPath, strings must be delimited by either single or double quotes.  [...]]]></description>
			<content:encoded><![CDATA[<p>
<a href="http://en.wikipedia.org/wiki/XPath">XPath</a> is a language for selecting nodes from an XML document.  XPath is used extensively in <a href="http://en.wikipedia.org/wiki/XSLT">XSLT</a> and other XML technologies.  I also vastly prefer using XPath (e.g. with <a href="http://msdn.microsoft.com/en-us/library/system.xml.xpath.xpathnavigator.aspx">XPathNavigator</a>) over the XML <a href="http://en.wikipedia.org/wiki/Document_Object_Model">DOM</a> when manipulating XML in a non-streaming fashion.
</p>
<p>
In XPath, strings must be delimited by either single or double quotes.  Given a quote character used to delimit a string, one can&#8217;t represent that same quote character within the string.  This means that if you decide to use single quotes to delimit your XPath string, you couldn&#8217;t represent the string <code>O'Reilly</code>; use double quotes, and you can&#8217;t represent <code>"Hello"</code>.
</p>
<p>
However, given a quote delimiter, you can represent the <i>other</i> quote character.  We can use this observation along with the <a href="http://www.w3.org/2005/xpath-functions/#concat"><code>concat</code> XPath function</a> to devise a general quoting rule for XPath strings.  It&#8217;s easiest to show this via a series of examples:
</p>
<table border="1" style="margin-bottom: 1em;">
<tr>
<th>Original String</th>
<th>Quoted XPath String</th>
</tr>
<tr>
<td><code>a</code></td>
<td><code>'a'</code> (or <code>"a"</code>)</td>
</tr>
<tr>
<td><code>O'Reilly</code></td>
<td><code>"O'Reilly"</code></td>
</tr>
<tr>
<td><code>"Hello"</code></td>
<td><code>'"Hello"'</code></td>
</tr>
<tr>
<td><code>"Hello, Mr. O'Reilly"</code></td>
<td><code>concat('"Hello, Mr. O', "'Reilly", '"')</code></td>
</tr>
</table>
<p>
Below is a piece of C++ code which implements these quotation rules:
</p>
<div class="dean_ch" style="white-space: nowrap;">
<ol>
<li class="li1">
<div class="de1">std::<span class="me2">string</span></div>
</li>
<li class="li1">
<div class="de1">QuoteXPathString<span class="br0">&#40;</span><span class="kw4">const</span> std::<span class="me2">string</span>&amp; xpath<span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="co1">// If we don&#8217;t have any single or double-quote characters, quote the</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; <span class="co1">// expression in single quotes.</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; std::<span class="me2">string</span>::<span class="me2">size_type</span> pos = xpath.<span class="me1">find_first_of</span><span class="br0">&#40;</span><span class="st0">&quot;&#8217;<span class="es0">\&quot;</span>&quot;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>pos == std::<span class="me2">string</span>::<span class="me2">npos</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> <span class="st0">&quot;&#8217;&quot;</span> + xpath + <span class="st0">&quot;&#8217;&quot;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; <span class="co1">// If we cannot find the alternate quotation character, quote the</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="co1">// expression in the alternate quotation character.</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw4">char</span> chOther = <span class="br0">&#40;</span>xpath<span class="br0">&#91;</span>pos<span class="br0">&#93;</span> == <span class="st0">&#8216;&quot;&#8217;</span> ? <span class="st0">&#8216;<span class="es0">\&#8217;</span>&#8216;</span> : <span class="st0">&#8216;&quot;&#8217;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; pos = xpath.<span class="me1">find</span><span class="br0">&#40;</span>chOther, pos + <span class="nu0">1</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>pos == std::<span class="me2">string</span>::<span class="me2">npos</span><span class="br0">&#41;</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> chOther + xpath + chOther;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="co1">// The string has both quotation characters. &nbsp;We need to use concat()</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="co1">// to form the string.</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; std::<span class="me2">stringstream</span> ss;</div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; ss &lt;&lt; <span class="st0">&quot;concat(&quot;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp;&lt;&lt; chOther</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp;&lt;&lt; xpath.<span class="me1">substr</span><span class="br0">&#40;</span><span class="nu0">0</span>, pos<span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp;&lt;&lt; chOther;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw1">do</span> <span class="br0">&#123;</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; chOther = <span class="br0">&#40;</span>xpath<span class="br0">&#91;</span>pos<span class="br0">&#93;</span> == <span class="st0">&#8216;&quot;&#8217;</span> ? <span class="st0">&#8216;<span class="es0">\&#8217;</span>&#8216;</span> : <span class="st0">&#8216;&quot;&#8217;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; std::<span class="me2">string</span>::<span class="me2">size_type</span> pos2 = xpath.<span class="me1">find</span><span class="br0">&#40;</span>chOther, pos + <span class="nu0">1</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; ss &lt;&lt; <span class="st0">&#8216;,&#8217;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;&lt; chOther</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;&lt; xpath.<span class="me1">substr</span><span class="br0">&#40;</span>pos, pos2 - pos<span class="br0">&#41;</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;&lt; chOther;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; pos = pos2;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="br0">&#125;</span> <span class="kw1">while</span> <span class="br0">&#40;</span>pos != std::<span class="me2">string</span>::<span class="me2">npos</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; ss &lt;&lt; <span class="st0">&quot;)&quot;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; <span class="kw1">return</span> ss.<span class="me1">str</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
</ol>
</div>
<p>
Usage looks like:
</p>
<div class="dean_ch" style="white-space: nowrap;">
<ol>
<li class="li1">
<div class="de1">std::<span class="me2">string</span> lastName = &#8230;; <span class="co1">// May come from user input</span></div>
</li>
<li class="li1">
<div class="de1">std::<span class="me2">string</span> xpath = <span class="st0">&quot;//Customer[LastName = &quot;</span> +</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; QuoteXPathString<span class="br0">&#40;</span>lastName<span class="br0">&#41;</span> + <span class="st0">&quot;]&quot;</span>;</div>
</li>
</ol>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.deez.info/sengelha/2008/06/03/escaping-strings-in-xpath-10/feed/</wfw:commentRss>
		</item>
		<item>
		<title>2008 Cubs Predictions: Take 3</title>
		<link>http://www.deez.info/sengelha/2008/05/23/2008-cubs-predictions-take-3/</link>
		<comments>http://www.deez.info/sengelha/2008/05/23/2008-cubs-predictions-take-3/#comments</comments>
		<pubDate>Fri, 23 May 2008 15:11:29 +0000</pubDate>
		<dc:creator>Steve</dc:creator>
		
		<category><![CDATA[Baseball]]></category>

		<guid isPermaLink="false">http://www.deez.info/sengelha/?p=5474</guid>
		<description><![CDATA[

Latest Cubs prediction: 112-50 (0.368 team OBP, 3.73 team ERA, underlying equation).    (Previous predictions: 113-49, 90-62)


To contrast, a simple extrapolation of their current 28-19 record predicts 97-65.  97-65 seems a lot more realistic than 112-50.
]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.cubs.com/"><img style="float:right; margin: 0 0 10px 10px;" src="http://www.deez.info/sengelha/wp-content/uploads/2007/07/cubs-logo.gif" alt="Chicago Cubs Logo" /></a></p>
<p>
Latest Cubs prediction: <b>112-50</b> (0.368 team OBP, 3.73 team ERA, <a href="http://www.deez.info/sengelha/2006/05/09/2006-baseball-predictions/">underlying equation</a>).    (Previous predictions: <a href="http://www.deez.info/sengelha/2008/04/23/2008-cubs-predictions-take-2/">113-49</a>, <a href="http://www.deez.info/sengelha/2008/04/08/2008-cubs-predictions/">90-62</a>)
</p>
<p>
To contrast, a simple extrapolation of their current 28-19 record predicts 97-65.  97-65 seems a lot more realistic than 112-50.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.deez.info/sengelha/2008/05/23/2008-cubs-predictions-take-3/feed/</wfw:commentRss>
		</item>
		<item>
		<title>2008 Cubs Predictions: Take 2</title>
		<link>http://www.deez.info/sengelha/2008/04/23/2008-cubs-predictions-take-2/</link>
		<comments>http://www.deez.info/sengelha/2008/04/23/2008-cubs-predictions-take-2/#comments</comments>
		<pubDate>Thu, 24 Apr 2008 04:09:54 +0000</pubDate>
		<dc:creator>Steve</dc:creator>
		
		<category><![CDATA[Baseball]]></category>

		<guid isPermaLink="false">http://www.deez.info/sengelha/?p=5473</guid>
		<description><![CDATA[

The problems with my regression which &#8220;predicts&#8221; a baseball team&#8217;s win-loss record are the following:


The regression is extremely sensitive to the input parameters, many of which are quite unstable throughout the year.  For example, one extra point (0.001) of team OBP results in 0.6 extra predicted wins.
The standard error of the prediction is quite [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.cubs.com/"><img style="float:right; margin: 0 0 10px 10px;" src="http://www.deez.info/sengelha/wp-content/uploads/2007/07/cubs-logo.gif" alt="Chicago Cubs Logo" /></a></p>
<p>
The problems with my <a href="http://www.deez.info/sengelha/2006/05/09/2006-baseball-predictions/">regression</a> which &#8220;predicts&#8221; a baseball team&#8217;s win-loss record are the following:
</p>
<ol>
<li>The regression is extremely sensitive to the input parameters, many of which are quite unstable throughout the year.  For example, one extra point (0.001) of team OBP results in 0.6 extra predicted wins.</li>
<li>The standard error of the prediction is quite high (4.68).</li>
<li>The regression doesn&#8217;t seem to be much better than linearly extrapolating a team&#8217;s current win-loss record to the entire season.</li>
</ol>
<p>
To demonstrate my point, a run of the regression against the current Cubs team statistics (0.371 team OBP, 3.81 team ERA) now predicts a record of <b>113-49</b>, a swing of 23 wins in a matter of 15 days.  This record would put them 3 wins shy of the regular season win record&mdash;first achieved by the 1906 Cubs (in a 152-game season) and again by Lou Piniella&#8217;s 2001 Seattle Mariners.
</p>
<p>
It&#8217;s clear that this new prediction is the consequence of the Cubs&#8217; hot streak.  Let&#8217;s hope they can keep it going.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.deez.info/sengelha/2008/04/23/2008-cubs-predictions-take-2/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Fact-Checking the WSJ</title>
		<link>http://www.deez.info/sengelha/2008/04/23/fact-checking-the-wsj-2/</link>
		<comments>http://www.deez.info/sengelha/2008/04/23/fact-checking-the-wsj-2/#comments</comments>
		<pubDate>Wed, 23 Apr 2008 14:47:04 +0000</pubDate>
		<dc:creator>Steve</dc:creator>
		
		<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://www.deez.info/sengelha/?p=5472</guid>
		<description><![CDATA[
Well, the original source of the error was somebody the WSJ quoted, but they took it the next step without correction:



Until recently, for instance, the Lincoln Navigator offered 128 options on its console alone.


&#8220;You know what 128-factorial is&#8212;it&#8217;s a lot of combinations,&#8221; Mr. Mulally joked at a conference recently, mocking the number of designs theoretically [...]]]></description>
			<content:encoded><![CDATA[<p>
Well, the original source of the error was somebody the WSJ quoted, but they took it the next step without correction:
</p>
<blockquote>
<p>
Until recently, for instance, the Lincoln Navigator offered 128 options on its console alone.
</p>
<p>
&#8220;You know what 128-factorial is&mdash;it&#8217;s a lot of combinations,&#8221; Mr. Mulally joked at a conference recently, mocking the number of designs theoretically resulting from mixing-and-matching the options.  (Answer: 3.85620482 x 10 to the 215th power.)
</p>
</blockquote>
<p>
<cite>Spector, Mike.  &#8220;Ford Eyes More Cuts as Recovery Advances; Earnings Improve&#8221;.  <u>The Wall Street Journal</u> 23 April 2008: A1, A14.</cite>
</p>
<p>
128-factorial is the correct number of combinations of options only <i>if the order in which you pick the options is important</i>.  It almost certainly is not.  Instead, assuming each option is independent and can be either on or off, the correct number of combinations is 2^128&mdash;3.4 x 10^38.  Mr. Mulally was off by a factor of 177.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.deez.info/sengelha/2008/04/23/fact-checking-the-wsj-2/feed/</wfw:commentRss>
		</item>
		<item>
		<title>The Role of Ratings Agencies in the Credit Crisis</title>
		<link>http://www.deez.info/sengelha/2008/04/22/the-role-of-ratings-agencies-in-the-credit-crisis/</link>
		<comments>http://www.deez.info/sengelha/2008/04/22/the-role-of-ratings-agencies-in-the-credit-crisis/#comments</comments>
		<pubDate>Wed, 23 Apr 2008 03:45:18 +0000</pubDate>
		<dc:creator>Steve</dc:creator>
		
		<category><![CDATA[Economics]]></category>

		<guid isPermaLink="false">http://www.deez.info/sengelha/?p=5471</guid>
		<description><![CDATA[
Roger Lowenstein has written a fascinating article for the New York Times Magazine entitled Triple-A Failure which explores the role of rating agencies in the credit crisis.  It even explains the process rating of an actual mortgage-backed security:



The business of assigning a rating to a mortgage security is a complicated affair, and Moody’s recently [...]]]></description>
			<content:encoded><![CDATA[<p>
Roger Lowenstein has written a fascinating article for the <a href="http://www.nytimes.com/pages/magazine/">New York Times Magazine</a> entitled <a href="http://www.nytimes.com/2008/04/27/magazine/27Credit-t.html">Triple-A Failure</a> which explores the role of rating agencies in the credit crisis.  It even explains the process rating of an actual mortgage-backed security:
</p>
<blockquote>
<p>
The business of assigning a rating to a mortgage security is a complicated affair, and Moody’s recently was willing to walk me through an actual mortgage-backed security step by step. I was led down a carpeted hallway to a well-appointed conference room to meet with three specialists in mortgage-backed paper. Moody’s was fair-minded in choosing an example; the case they showed me, which they masked with the name “Subprime XYZ,” was a pool of 2,393 mortgages with a total face value of $430 million.
</p>
<p>
&#8230;
</p>
<p>
<b>Moody’s did not have access to the individual loan files, much less did it communicate with the borrowers or try to verify the information they provided in their loan applications</b>. “We aren’t loan officers,” Claire Robinson, a 20-year veteran who is in charge of asset-backed finance for Moody’s, told me. “Our expertise is as statisticians on an aggregate basis. We want to know, of 1,000 individuals, based on historical performance, what percent will pay their loans?”
</p>
<p>
&#8230;
</p>
<p>
<b>In the frenetic, deal-happy climate of 2006, the Moody’s analyst had only a single day to process the credit data from the bank.</b>
</p>
<p>
&#8230;
</p>
<p>
<b>Mortgage-backed securities like those in Subprime XYZ were not the terminus of the great mortgage machine. They were, in fact, building blocks for even more esoteric vehicles known as collateralized debt obligations, or C.D.O.’s.</b>
</p>
</blockquote>
<p>
We built a financial house of cards on ratings agencies&#8217; models, and these models turned out to be disastrously wrong.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.deez.info/sengelha/2008/04/22/the-role-of-ratings-agencies-in-the-credit-crisis/feed/</wfw:commentRss>
		</item>
		<item>
		<title>One-Time People Magazine&#8217;s Sexiest Man Alive</title>
		<link>http://www.deez.info/sengelha/2008/04/22/one-time-people-magazines-sexiest-man-alive/</link>
		<comments>http://www.deez.info/sengelha/2008/04/22/one-time-people-magazines-sexiest-man-alive/#comments</comments>
		<pubDate>Wed, 23 Apr 2008 02:39:56 +0000</pubDate>
		<dc:creator>Steve</dc:creator>
		
		<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://www.deez.info/sengelha/?p=5469</guid>
		<description><![CDATA[
Guess who People magazine voted the Sexiest Man Alive in 1992?




Yep, that&#8217;s right, Nick Nolte.
]]></description>
			<content:encoded><![CDATA[<p>
Guess who People magazine voted the Sexiest Man Alive in 1992?
</p>
<p><span id="more-5469"></span><br />
<a href='http://www.deez.info/sengelha/wp-content/uploads/2008/04/noltenick.jpg'><img src="http://www.deez.info/sengelha/wp-content/uploads/2008/04/noltenick-291x300.jpg" alt="Nick Nolte" title="Nick Nolte" width="291" height="300" class="alignnone size-medium wp-image-5470" /></a></p>
<p>
Yep, that&#8217;s right, <a href="http://en.wikipedia.org/wiki/Nick_Nolte">Nick Nolte</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.deez.info/sengelha/2008/04/22/one-time-people-magazines-sexiest-man-alive/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
