<?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>&#62;devblog_ &#187; programming</title>
	<atom:link href="http://devblog.itsth.com/category/programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://devblog.itsth.com</link>
	<description>Thoughts on developing shareware</description>
	<lastBuildDate>Wed, 14 Dec 2011 16:29:59 +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>The secret back-to-edit hotkey</title>
		<link>http://devblog.itsth.com/2011/06/02/the-secret-back-to-edit-hotkey/</link>
		<comments>http://devblog.itsth.com/2011/06/02/the-secret-back-to-edit-hotkey/#comments</comments>
		<pubDate>Thu, 02 Jun 2011 08:55:52 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[back-to-edit]]></category>
		<category><![CDATA[editing]]></category>
		<category><![CDATA[hotkey]]></category>
		<category><![CDATA[redo]]></category>
		<category><![CDATA[undo]]></category>

		<guid isPermaLink="false">http://devblog.itsth.com/?p=170</guid>
		<description><![CDATA[Just a tiny trick today. When you&#8217;re programming, you&#8217;re often&#8230; typing something Then you browse through the same file, look for something copy something And now you want to get back  to the place that you previously edited. There&#8217;s a secret hotkey (actually a sequence) for that which works in most editors: Ctrl+Z, Ctrl+Y. Works [...]]]></description>
			<content:encoded><![CDATA[<p>Just a tiny trick today.</p>
<p>When you&#8217;re programming, you&#8217;re often&#8230;</p>
<ul>
<li>typing something</li>
<li>Then you browse through the same file, look for something</li>
<li>copy something</li>
<li>And now you want to get back  to the place that you previously edited.</li>
</ul>
<p>There&#8217;s a secret hotkey (actually a sequence) for that which works in most editors: Ctrl+Z, Ctrl+Y.</p>
<p>Works in Visual Studio, Word, text editors, etc.</p>
]]></content:encoded>
			<wfw:commentRss>http://devblog.itsth.com/2011/06/02/the-secret-back-to-edit-hotkey/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Useful function: EnableWindowsDependingOn</title>
		<link>http://devblog.itsth.com/2011/03/21/useful-function-enablewindowsdependingon/</link>
		<comments>http://devblog.itsth.com/2011/03/21/useful-function-enablewindowsdependingon/#comments</comments>
		<pubDate>Mon, 21 Mar 2011 14:48:11 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[C++]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://devblog.itsth.com/?p=161</guid>
		<description><![CDATA[One of my favorite internal functions. It helps my manage my app&#8217;s GUI. Checkboxes that cause their sub-elements to be greyed out when not checked can be easily handled by this: bool EnableWindowsDependingOn (CWnd *pParent, DWORD DependingOnThisCheckbox, DWORD Value1, ...) { va_list marker; bool bState = (((CButton*)pParent-&#62;GetDlgItem(DependingOnThisCheckbox))-&#62;GetCheck()!=0); DWORD i=Value1; va_start (marker, Value1); while (i != [...]]]></description>
			<content:encoded><![CDATA[<p>One of my favorite internal functions. It helps my manage my app&#8217;s GUI. Checkboxes that cause their sub-elements to be greyed out when not checked can be easily handled by this:</p>
<pre>bool EnableWindowsDependingOn (CWnd *pParent, DWORD DependingOnThisCheckbox, DWORD Value1, ...)
{
 va_list marker;

 bool bState = (((CButton*)pParent-&gt;GetDlgItem(DependingOnThisCheckbox))-&gt;GetCheck()!=0);

 DWORD i=Value1;
 va_start (marker, Value1);
 while (i != 0)
 {
 if (i&lt;=0xffff)
 {
 if (pParent-&gt;GetDlgItem(i))
 pParent-&gt;GetDlgItem(i)-&gt;EnableWindow (bState);
 }
 else
 ((CWnd*)i)-&gt;EnableWindow (bState);

 i = va_arg (marker, long);
 }
 va_end (marker);

 return (bState);
}
</pre>
<p>It excepts the this pointer of your CDialog and the id of the master checkbox. Then you can append any number of sub-element ids or pointers. And finally a NULL. Example:<br />
EnableWindowsDependingOn (this, IDC_CHECK1, IDC_EDIT1, IDC_EDIT2, NULL);</p>
<p>This would enable the two edit boxes if the checkbox is enabled.</p>
]]></content:encoded>
			<wfw:commentRss>http://devblog.itsth.com/2011/03/21/useful-function-enablewindowsdependingon/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Win+Tab in Debugging</title>
		<link>http://devblog.itsth.com/2010/12/31/wintab-in-debugging/</link>
		<comments>http://devblog.itsth.com/2010/12/31/wintab-in-debugging/#comments</comments>
		<pubDate>Fri, 31 Dec 2010 10:21:40 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[debuggung]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[Windows 7]]></category>

		<guid isPermaLink="false">http://devblog.itsth.com/?p=155</guid>
		<description><![CDATA[Placing a breakpoint can be dangerous. In some code sections, like drawing a menu, Windows doesn&#8217;t like to be interrupted. The debugger will stop your application, but your app will remain on-screen and Alt+Tab and all other options of changing the current application are blocked. Except, if you&#8217;re using Windows 7. For some reason the [...]]]></description>
			<content:encoded><![CDATA[<p>Placing a breakpoint can be dangerous. In some code sections, like drawing a menu, Windows doesn&#8217;t like to be interrupted. The debugger will stop your application, but your app will remain on-screen and Alt+Tab and all other options of changing the current application are blocked.</p>
<p>Except, if you&#8217;re using Windows 7.</p>
<p>For some reason the 3d-flipping mode with Win+Tab still works. And allows you to switch to the debugger.</p>
]]></content:encoded>
			<wfw:commentRss>http://devblog.itsth.com/2010/12/31/wintab-in-debugging/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Devloping asp.NET websites in 3 simple steps&#8230;</title>
		<link>http://devblog.itsth.com/2010/12/07/devloping-asp-net-websites-in-3-simple-steps/</link>
		<comments>http://devblog.itsth.com/2010/12/07/devloping-asp-net-websites-in-3-simple-steps/#comments</comments>
		<pubDate>Tue, 07 Dec 2010 12:44:02 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[microsoft]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[rant]]></category>

		<guid isPermaLink="false">http://devblog.itsth.com/?p=150</guid>
		<description><![CDATA[Step 1: Waste hours researching to find out how to do something trivial. (Like renaming the insert link) Step 2: Curse Microsoft Step 3: Throw out the MS way and program it yourself. Repeat for every trivial issue.]]></description>
			<content:encoded><![CDATA[<p>Step 1: Waste hours researching to find out how to do something trivial. (Like renaming the insert link)</p>
<p>Step 2: Curse Microsoft</p>
<p>Step 3: Throw out the MS way and program it yourself.</p>
<p>Repeat for every trivial issue.</p>
]]></content:encoded>
			<wfw:commentRss>http://devblog.itsth.com/2010/12/07/devloping-asp-net-websites-in-3-simple-steps/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Visual Studio 2005: Speeding up compiles</title>
		<link>http://devblog.itsth.com/2010/10/19/visual-studio-2005-speeding-up-compiles/</link>
		<comments>http://devblog.itsth.com/2010/10/19/visual-studio-2005-speeding-up-compiles/#comments</comments>
		<pubDate>Tue, 19 Oct 2010 21:49:05 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[C++]]></category>
		<category><![CDATA[microsoft]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://devblog.itsth.com/?p=139</guid>
		<description><![CDATA[There&#8217;s a hidden switch in Visual Studio 2005 while doubles compile speed. I know, it sounds ridiculous.  But I&#8217;ve tested it. It&#8217;s MUCH faster now. The switch works by enabling multi-core processing. I have no idea why Microsoft has hidden this, instead of making it a big, obvious feature. Anyways. You can enable it by [...]]]></description>
			<content:encoded><![CDATA[<p>There&#8217;s a hidden switch in Visual Studio 2005 while doubles compile speed.</p>
<p>I know, it sounds ridiculous.  But I&#8217;ve tested it. It&#8217;s MUCH faster now. The switch works by enabling multi-core processing. I have no idea why Microsoft has hidden this, instead of making it a big, obvious feature.</p>
<p>Anyways. You can enable it by adding /MP to the &#8220;Additional options&#8221; in &#8220;Configuration properties &gt; C/C++ &gt; Commandline&#8221;.</p>
<p>(Found it at <a href="http://lahsiv.net/blog/?p=40">1</a> and <a href="http://blog.280z28.org/archives/2007/10/17/">2</a>)</p>
]]></content:encoded>
			<wfw:commentRss>http://devblog.itsth.com/2010/10/19/visual-studio-2005-speeding-up-compiles/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dangerous CFile::GetStatus</title>
		<link>http://devblog.itsth.com/2010/10/01/dangerous-cfilegetstatus/</link>
		<comments>http://devblog.itsth.com/2010/10/01/dangerous-cfilegetstatus/#comments</comments>
		<pubDate>Fri, 01 Oct 2010 11:57:09 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[C++]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[Dangerous]]></category>
		<category><![CDATA[GetStatus]]></category>

		<guid isPermaLink="false">http://devblog.itsth.com/?p=133</guid>
		<description><![CDATA[The third (and I hope final) dangerous posting. This code looks harmless enough: CFileStatus rStatus; CFile::GetStatus (MyFilename, rStatus); And it will work most of the time. But CFileStatus uses CTime, which is limited to dates after 1.1.1970. If you apply this code to a file with a file-modification date of e.g. 1.1.1960, GetStatus will raise [...]]]></description>
			<content:encoded><![CDATA[<p>The third (and I hope final) <a href="http://devblog.itsth.com/tag/dangerous/">dangerous</a> posting.</p>
<p>This code looks harmless enough:</p>
<pre>CFileStatus rStatus;
CFile::GetStatus (MyFilename, rStatus);</pre>
<p>And it will work most of the time. But CFileStatus uses CTime, which is limited to dates after 1.1.1970. If you apply this code to a file with a file-modification date of e.g. 1.1.1960, GetStatus will raise an exception. (Which it isn&#8217;t documented to to.) And if you don&#8217;t catch that, it will terminate your program.</p>
]]></content:encoded>
			<wfw:commentRss>http://devblog.itsth.com/2010/10/01/dangerous-cfilegetstatus/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dangerous printf</title>
		<link>http://devblog.itsth.com/2010/09/17/dangerous-printf/</link>
		<comments>http://devblog.itsth.com/2010/09/17/dangerous-printf/#comments</comments>
		<pubDate>Fri, 17 Sep 2010 16:53:03 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[C++]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[Dangerous]]></category>
		<category><![CDATA[printf]]></category>

		<guid isPermaLink="false">http://devblog.itsth.com/?p=127</guid>
		<description><![CDATA[It took quite some time until I found this bug. Here&#8217;s a simplified version of what caused it: char dir[2048]; GetCurrentDirectory(2048, dir); printf(CString("Current dir is:")+dir)); That&#8217;s doesn&#8217;t look bad, does it? And (like in the great programmer quotes), it works on my computer. But it doesn&#8217;t work if the customer&#8217;s current folder is something like [...]]]></description>
			<content:encoded><![CDATA[<p>It took quite some time until I found this bug. Here&#8217;s a simplified version of what caused it:</p>
<pre>char dir[2048];
GetCurrentDirectory(2048, dir);
printf(CString("Current dir is:")+dir));</pre>
<p>That&#8217;s doesn&#8217;t look bad, does it? And (like in the great <a href="http://archive.kaskus.us/thread/1187451/">programmer quotes</a>), it works on my computer. But it doesn&#8217;t work if the customer&#8217;s current folder is something like &#8220;%&amp;§something&#8221;, because it contains %s.</p>
<p>So don&#8217;t throw any external data at the first parameter of printf, sprintf, etc; instead put it into the following parameters.</p>
<p>printf(&#8220;Current dir is: %s&#8221;, dir);</p>
]]></content:encoded>
			<wfw:commentRss>http://devblog.itsth.com/2010/09/17/dangerous-printf/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dangerous COleDateTime::ParseDateTime</title>
		<link>http://devblog.itsth.com/2010/08/20/dangerous-coledatetimeparsedatetime/</link>
		<comments>http://devblog.itsth.com/2010/08/20/dangerous-coledatetimeparsedatetime/#comments</comments>
		<pubDate>Fri, 20 Aug 2010 11:59:40 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[C++]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[COleDateTime]]></category>
		<category><![CDATA[Dangerous]]></category>
		<category><![CDATA[ParseDateTime]]></category>

		<guid isPermaLink="false">http://devblog.itsth.com/?p=116</guid>
		<description><![CDATA[COleDateTime::ParseDateTime is a handy function to parse a date string into a COleDateTime (and then SYSTEMTIME and then CTime). The problem is that the expected date format depends on the user&#8217;s system settings. If you&#8217;re parsing a string that is always in the same format (from a file or from the internet), then parsing might [...]]]></description>
			<content:encoded><![CDATA[<p>COleDateTime::ParseDateTime is a handy function to parse a date string into a COleDateTime (and then SYSTEMTIME and then CTime).</p>
<p>The problem is that the expected date format depends on the user&#8217;s system settings. If you&#8217;re parsing a string that is always in the same format (from a file or from the internet), then parsing might work on your computer, but fail on the customer&#8217;s computer (in another country).</p>
<p>Solution: Use the locale ID parameter to force the parsing language.</p>
]]></content:encoded>
			<wfw:commentRss>http://devblog.itsth.com/2010/08/20/dangerous-coledatetimeparsedatetime/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CMap: Mapping CString to CStringArray</title>
		<link>http://devblog.itsth.com/2010/08/09/cmap-mapping-cstring-to-cstringarray/</link>
		<comments>http://devblog.itsth.com/2010/08/09/cmap-mapping-cstring-to-cstringarray/#comments</comments>
		<pubDate>Mon, 09 Aug 2010 10:10:29 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[C++]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[MFC]]></category>

		<guid isPermaLink="false">http://devblog.itsth.com/?p=109</guid>
		<description><![CDATA[Just a simple MFC trick. To map from CString to CStringArray use: CMap&#60;CString, LPCTSTR, CStringArrayX, CStringArrayX&#38;&#62; where CStringArrayX is defined as: class CStringArrayX : public CStringArray { public: CStringArrayX() {} CStringArrayX(const CStringArrayX &#38;qSource); CStringArrayX &#38;operator = (const CStringArrayX &#38;qSource); }; CStringArrayX::CStringArrayX (const CStringArrayX &#38;qSource) { SetSize (qSource.GetSize()); for (long c=qSource.GetSize()-1; c&#62;=0; c--) (*this)[c]=qSource[c]; } CStringArrayX [...]]]></description>
			<content:encoded><![CDATA[<p>Just a simple MFC trick. To map from CString to CStringArray use:</p>
<p>CMap&lt;CString, LPCTSTR, CStringArrayX, CStringArrayX&amp;&gt;</p>
<p>where CStringArrayX is defined as:</p>
<pre>class CStringArrayX : public CStringArray
{
 public:
 CStringArrayX() {}
 CStringArrayX(const CStringArrayX &amp;qSource);
 CStringArrayX &amp;operator = (const CStringArrayX &amp;qSource);
};
</pre>
<pre>CStringArrayX::CStringArrayX (const CStringArrayX &amp;qSource)
{
 SetSize (qSource.GetSize());

 for (long c=qSource.GetSize()-1; c&gt;=0; c--)
   (*this)[c]=qSource[c];
}
</pre>
<pre>CStringArrayX &amp;CStringArrayX::operator = (const CStringArrayX &amp;qSource)
{
 SetSize (qSource.GetSize());
</pre>
<pre> for (long c=qSource.GetSize()-1; c&gt;=0; c--)
   (*this)[c]=qSource[c];
</pre>
<pre> return (*this);
}
</pre>
<p>Hopefully this post keeps some people from searching as long as I did&#8230; <img src='http://devblog.itsth.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://devblog.itsth.com/2010/08/09/cmap-mapping-cstring-to-cstringarray/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Silencing command line builds</title>
		<link>http://devblog.itsth.com/2010/08/02/silencing-command-line-builds/</link>
		<comments>http://devblog.itsth.com/2010/08/02/silencing-command-line-builds/#comments</comments>
		<pubDate>Mon, 02 Aug 2010 11:13:32 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[C++]]></category>
		<category><![CDATA[freeware]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[build]]></category>
		<category><![CDATA[silent]]></category>
		<category><![CDATA[verbose]]></category>

		<guid isPermaLink="false">http://devblog.itsth.com/?p=104</guid>
		<description><![CDATA[My builds have become more and more complex. Especially when releasing a new version it wasn&#8217;t always easy to tell at first glance whether all build steps succeeded. Some tools (I&#8217;m not telling names, here) are quite verbose and &#8220;pollute&#8221; the build log with things that I don&#8217;t really care about. Here&#8217;s a simple freeware [...]]]></description>
			<content:encoded><![CDATA[<p>My builds have become more and more complex. Especially when releasing a new version it wasn&#8217;t always easy to tell at first glance whether all build steps succeeded. Some tools (I&#8217;m not telling names, here) are quite verbose and &#8220;pollute&#8221; the build log with things that I don&#8217;t really care about.</p>
<p>Here&#8217;s a simple freeware tool that I wrote to fix this: SilentCommandline.exe. It works as a DOS pipe with filter functions that can be configured in two external text files.</p>
<h3>Using SilentCommandline:</h3>
<p>Simply append it to your build batch files:</p>
<pre>yourbuildcommand.exe |SilentCommandline.exe</pre>
<p>It will take all output of  yourbuildcommand.exe, check if you want to see it and print it to stdout. To configure what you want to see, create 2 text files in the same folder where you keep SilentComandline.exe and name them silentlines.txt and silentlinesre.txt.</p>
<h3>Config files:</h3>
<p>The first one is simple. On string per line. If one of the strings equals a line from your build output, then this line will not be printed. You can use that for static texts that are always the same. Example:</p>
<pre>Succeeded</pre>
<p>The second file works basically the same, but allows you to use regular expressions in each line. Use it to handle build outputs that might change. Example:</p>
<pre>Protected[0-9]* blocks of [0-9]* blocks total.</pre>
<h3>Download:</h3>
<p>Here&#8217;s the download link to <a href="http://www.itsth.com/download/SilentCommandline.exe">SilentCommandLine.exe</a></p>
<p>System requirements: Windows</p>
]]></content:encoded>
			<wfw:commentRss>http://devblog.itsth.com/2010/08/02/silencing-command-line-builds/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

