<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">
  <channel>
    <title>ffuts.org</title>
    <link>http://www.ffuts.org</link>
    <description>ffuts.org Feed</description>
    <language>en-us</language>
    <generator>Symphony (build )</generator>
    <atom:link href="http://www.ffuts.org/rss/" rel="self" type="application/rss+xml"/>
    <item>
      <title>Logitech G500 Gaming Mouse - Impressions</title>
      <link>http://www.ffuts.org/blog/logitech-g500-gaming-mouse-impressions/</link>
      <pubDate>Sat, 22 May 2010 16:06 -0700</pubDate>
      <guid>http://www.ffuts.org/blog/logitech-g500-gaming-mouse-impressions/</guid>
      <description>&lt;p&gt;Got a Logitech G500 mouse recently and I thought I&amp;#8217;d just quickly note my impressions of the mouse and its associated software. First, some background on my previous (non-throwaway) mice to give an idea of what I&amp;#8217;ve used before:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Logitech MX1000: a wireless mouse that had little to no lag in my particular environment, in contrast to:&lt;/li&gt;
&lt;li&gt;Logitech MX Revolution: the wireless mouse Logitech sent me as a replacement for the MX1000 above; had &lt;em&gt;two&lt;/em&gt; wheels, one of which had a free spinning mode; unfortunately had terrible interference problems for me and was essentially unusable&lt;/li&gt;
&lt;li&gt;Razer DeathAdder: a wired mouse with a great shape, just wish it had more buttons&lt;/li&gt;
&lt;li&gt;Purchased the Logitech G500 because my Razer mouse was double-clicking sporadically and developed a flaky scroll wheel (scrolling down would sometimes scroll up)&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;I don&amp;#8217;t have much to say about the mouse itself that hasn&amp;#8217;t already been said on the internet &amp;#8211; it feels good in the hand and has plenty of buttons. I&amp;#8217;m going to focus on the part I found more interesting, the on-board memory.&lt;/p&gt;

&lt;p&gt;Now, one problem with most of these mice is that while the left, right, middle, and two side buttons (Mouse4 and Mouse5) are supported natively by Windows, any additional buttons on them require the appropriate drivers to be installed. This isn&amp;#8217;t necessarily bad in itself, but I always liked the ideal of a mouse that just works, fully functional, without requiring any drivers. The DeathAdder added on-board memory to avoid this issue, so you could do things like save a macro to Mouse5 and bring it to another computer and have that macro available. Unfortunately, it only had five buttons, all of which already have standard functions, so I never found a good use for this feature. However, the on-board memory did let you save your mouse DPI settings, which was somewhat useful.&lt;/p&gt;

&lt;p&gt;The G500 also has on-board memory, but this time it also has the spare buttons to make it worthwhile. In addition to the five standard buttons, the G500 has one extra side button, two DPI buttons, a left wheel tilt and a right wheel tilt. All of these are programmable and, as long as you stick to commands that can be sent by a keyboard or a mouse (including standard media keys like volume and playback controls), will work on any computer without drivers. It apparently does this by acting as several human interface devices, including a keyboard and a mouse:&lt;/p&gt;

&lt;p&gt;&lt;a href="http://s.ffuts.org/images/logitech_g500_properties.png"&gt;&lt;img src="http://s.ffuts.org/images/logitech_g500_properties_thumb.jpg" alt="Logitech G500 Properties Dialog Thumbnail" height="200" width="162" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It&amp;#8217;s pretty interesting assigning a keystroke like &amp;#8216;A&amp;#8217; to a side button or having your DPI buttons control the system&amp;#8217;s volume. After setting my bindings up I uninstalled the SetPoint software and still have a fully working mouse. Neat.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Accessing a Git repository with TortoiseHg on Windows</title>
      <link>http://www.ffuts.org/blog/accessing-a-git-repository-with-tortoisehg-on-windows/</link>
      <pubDate>Fri, 09 Apr 2010 10:31 -0700</pubDate>
      <guid>http://www.ffuts.org/blog/accessing-a-git-repository-with-tortoisehg-on-windows/</guid>
      <description>&lt;p&gt;If you&amp;#8217;re using Hg and you want to get hold of a Git repository there is an extension, hg-git, that lets you do this.&lt;/p&gt;

&lt;p&gt;On Windows the installation process for this hasn&amp;#8217;t always been the easiest, as you needed to first install the dulwich Python library (which I always seemed to have trouble doing) and then hg-git. The TortoiseHg guys have made this a lot easier in recent versions of TortoiseHg, as they now include the dulwich libraries.&lt;/p&gt;

&lt;p&gt;So, step by step:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;You&amp;#8217;ll need &lt;a href="http://bitbucket.org/tortoisehg/stable/wiki/Home"&gt;TortoiseHg 0.9.3&lt;/a&gt; or later. Get the latest version.&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Bring up a command line and enter this line to clone the latest hg-git to your desired directory (this is &amp;#8220;installing&amp;#8221; hg-git). I&amp;#8217;ll use &lt;code&gt;D:\TortoiseHg\hg-git&lt;/code&gt; in this example.&lt;/p&gt;

&lt;pre&gt;
&gt; hg clone http://bitbucket.org/durin42/hg-git/ D:\TortoiseHg\hg-git
&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Open up your user-specific &lt;code&gt;Mercurial.ini&lt;/code&gt;. The location of this file may change occasionally, read the &lt;a href="http://www.selenic.com/mercurial/hgrc.5.html"&gt;Mercurial docs&lt;/a&gt; if you have trouble finding it.&lt;br /&gt;
On Windows Vista and Windows 7 this file is typically located at:&lt;/p&gt;

&lt;pre&gt;C:\Users\YourUsername\Mercurial.ini&lt;/pre&gt;

&lt;p&gt;while on Windows XP you&amp;#8217;ll find it at:&lt;/p&gt;

&lt;pre&gt;C:\Documents and Settings\YourUsername\Mercurial.ini&lt;/pre&gt;

&lt;p&gt;Alternatively, bring up the Windows &amp;#8220;Run&amp;#8221; dialog and enter:&lt;/p&gt;

&lt;pre&gt;%USERPROFILE%\Mercurial.ini&lt;/pre&gt;

&lt;p&gt;which will work on all recent Windows platforms.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Navigate down to the &lt;code&gt;[extensions]&lt;/code&gt; section and add this line to that section:&lt;/p&gt;

&lt;pre&gt;hggit = D:\TortoiseHg\hg-git&lt;/pre&gt;

&lt;p&gt;Where &lt;code&gt;D:\TortoiseHg\hg-git&lt;/code&gt; is the directory you cloned hg-git to earlier. This line may already exist or may be commented out with a semicolon, in that case just remove the semicolon and update the directory.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Now you can clone a Git repository like so:&lt;/p&gt;

&lt;pre&gt;
&gt; hg clone git://github.com/richhickey/clojure.git D:\TargetDirectory
&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The result is you&amp;#8217;ll have a Mercurial enabled repository at &lt;code&gt;D:\TargetDirectory&lt;/code&gt;. You can &lt;code&gt;push&lt;/code&gt;, &lt;code&gt;pull&lt;/code&gt;, and generally treat it as an Hg repository. Try&lt;/p&gt;

&lt;pre&gt;
&gt; hg help hggit
&lt;/pre&gt;

&lt;p&gt;for additional help and information, or check the &lt;a href="http://mercurial.selenic.com/wiki/HgGit"&gt;HgGit page&lt;/a&gt; on the Mercurial wiki.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;</description>
    </item>
    <item>
      <title>Great Boost Documentation</title>
      <link>http://www.ffuts.org/blog/great-boost-documentation/</link>
      <pubDate>Sat, 03 Apr 2010 18:20 -0700</pubDate>
      <guid>http://www.ffuts.org/blog/great-boost-documentation/</guid>
      <description>&lt;p&gt;I found out from the &lt;a href="http://sandfly.net.nz/blog/2010/04/a-better-boost-book/"&gt;Life of Andrew&lt;/a&gt; blog that there is a new source for &lt;a href="http://en.highscore.de/cpp/boost/"&gt;Boost information&lt;/a&gt; available. It&amp;#8217;s a Creative Commons licensed book covering a wide range of Boost libraries, some of which are usually under-represented documentation-wise (looking at you, ASIO). It was originally written in German by &lt;a href="http://www.highscore.de/"&gt;Boris Schäling&lt;/a&gt;, but &lt;a href="http://www.andreasmasur.com/"&gt;Andreas Masur&lt;/a&gt; has translated it into English for those of us who aren&amp;#8217;t so culturally adapted.&lt;/p&gt;

&lt;p&gt;A brief skim of the book gives an extremely promising impression and I think it&amp;#8217;ll be one of the first resources I point newcomers to Boost to in the future.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Simplify signals and slots connections with unique connections in Qt 4.6</title>
      <link>http://www.ffuts.org/blog/simplify-signals-and-slots-connections-with-unique-connections-in-qt-46/</link>
      <pubDate>Tue, 12 Jan 2010 14:43 -0700</pubDate>
      <guid>http://www.ffuts.org/blog/simplify-signals-and-slots-connections-with-unique-connections-in-qt-46/</guid>
      <description>&lt;p&gt;Somehow there&amp;#8217;s absolutely no mention of this in the &lt;a href="http://doc.trolltech.com/4.6/qt4-6-intro.html"&gt;What&amp;#8217;s New in Qt 4.6&lt;/a&gt; summary, but one of my favorite new features in Qt 4.6 is a surprisingly simple one: the &lt;a href="http://doc.trolltech.com/4.6/qt.html#ConnectionType-enum"&gt;&lt;code&gt;Qt::UniqueConnection&lt;/code&gt;&lt;/a&gt; connection type.&lt;/p&gt;

&lt;p&gt;The default connection type for &lt;a href="http://doc.trolltech.com/4.6/qobject.html#connect"&gt;&lt;code&gt;connect()&lt;/code&gt;&lt;/a&gt; is &lt;code&gt;Qt::AutoConnection&lt;/code&gt;, which sets up either a direct or queued connection depending on whether the signaling object and receiving slot are in the same thread or not. This connection type allows you to connect a particular signal/slot pair multiple times (so emitting a signal once could call a slot twice) which has caught me on a number of occasions.&lt;/p&gt;

&lt;p&gt;This is really simple to work around: you can add some bookkeeping to keep track of that particular connection or you can use &lt;code&gt;disconnect()&lt;/code&gt; where appropriate to maintain 0 or 1 connections. The new &lt;code&gt;Qt::UniqueConnection&lt;/code&gt; connection type, on the other hand, lets you be sure that a connection is made only once. It&amp;#8217;s not something you always need, but when you do, it lets you keep your code a bit cleaner.&lt;/p&gt;

&lt;p&gt;One caveat is that &lt;code&gt;Qt::UniqueConnection&lt;/code&gt; makes a unique &lt;code&gt;Qt::AutoConnection&lt;/code&gt;, meaning you don&amp;#8217;t have the ability to explicitly specify a unique queued connection, for example. In a case like that you will have to keep track of the connections yourself, as before.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Qt 4.6 has prebuilt binaries for Visual Studio</title>
      <link>http://www.ffuts.org/blog/qt-46-has-prebuilt-binaries-for-visual-studio/</link>
      <pubDate>Wed, 02 Dec 2009 12:42 -0700</pubDate>
      <guid>http://www.ffuts.org/blog/qt-46-has-prebuilt-binaries-for-visual-studio/</guid>
      <description>&lt;p&gt;I&amp;#8217;ve just found out that Qt 4.6 actually includes prebuilt LGPL binaries for Visual Studio 2008, so there&amp;#8217;s little reason to spend time building Qt unless you need to use some other version of Visual Studio.&lt;/p&gt;

&lt;p&gt;The &lt;a href="http://qt.nokia.com/downloads/windows-cpp-vs2008"&gt;prebuilt binaries are downloadable from here&lt;/a&gt;. Alternatively, you can visit the &lt;a href="http://qt.nokia.com/downloads"&gt;Qt download page&lt;/a&gt;, choose LGPL, and look on the right hand side of the page for the download link.&lt;/p&gt;

&lt;p&gt;I highly recommend using the prebuilt libraries, as you will save a tremendous amount of time (it takes hours to build Qt). After you finish downloading and installing the libraries, install the &lt;a href="http://qt.nokia.com/downloads/visual-studio-add-in"&gt;Visual Studio add-in&lt;/a&gt; to make it easier to handle the custom build steps for moc and ui files.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Qt 4.6 is out, compiling it with MSVC</title>
      <link>http://www.ffuts.org/blog/qt-46-is-out-compiling-it-with-msvc/</link>
      <pubDate>Wed, 02 Dec 2009 01:39 -0700</pubDate>
      <guid>http://www.ffuts.org/blog/qt-46-is-out-compiling-it-with-msvc/</guid>
      <description>&lt;p&gt;Qt 4.6 has been released (with some &lt;a href="http://doc.trolltech.com/4.6/qt4-6-intro.html"&gt;new features&lt;/a&gt;) so I&amp;#8217;ve taken the opportunity to make sure my &lt;a href="http://www.ffuts.org/blog/compile-qt-45-for-visual-studio-using-your-multi-core-processor/"&gt;instructions on how to compile Qt with Visual Studio&lt;/a&gt; are still accurate. The additional steps on how to take advantage of your multi-core processor (using &lt;code&gt;jom&lt;/code&gt;) still work, as well.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;[Edit: Qt 4.6 actually has &lt;a href="http://www.ffuts.org/blog/qt-46-has-prebuilt-binaries-for-visual-studio/"&gt;prebuilt binaries/libraries&lt;/a&gt; for Visual Studio 2008, which is preferable to spending hours building Qt]&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;I&amp;#8217;ve made a note in the article but I&amp;#8217;ll repeat it here because it&amp;#8217;s a major time-saver: you should delete, from your Qt folder, these instances of &lt;code&gt;mocinclude.tmp&lt;/code&gt;:&lt;/p&gt;

&lt;pre&gt;
\Qt\2009.05\qt\src\3rdparty\webkit\WebCore\tmp\moc\debug_shared\mocinclude.tmp
\Qt\2009.05\qt\src\3rdparty\webkit\WebCore\tmp\moc\release_shared\mocinclude.tmp
\Qt\2009.05\qt\src\script\tmp\moc\debug_shared\mocinclude.tmp
\Qt\2009.05\qt\src\script\tmp\moc\release_shared\mocinclude.tmp
&lt;/pre&gt;

&lt;p&gt;Deleting the first two &lt;code&gt;mocinclude.tmp&lt;/code&gt; files will prevent a &lt;code&gt;LNK2019&lt;/code&gt; error while building Webkit, while deleting the last two (which are new in Qt 4.6, as far as I can tell) will prevent an &lt;code&gt;Error: Unknown interface&lt;/code&gt; while trying to build &lt;code&gt;qscriptextensionplugin.h&lt;/code&gt;.&lt;/p&gt;</description>
    </item>
    <item>
      <title>An update on building Boost with MSVC (still with dual/quad/multi-core action)</title>
      <link>http://www.ffuts.org/blog/an-update-on-building-boost-with-msvc-still-with-dual-quad-multi-core-action/</link>
      <pubDate>Thu, 19 Nov 2009 02:05 -0700</pubDate>
      <guid>http://www.ffuts.org/blog/an-update-on-building-boost-with-msvc-still-with-dual-quad-multi-core-action/</guid>
      <description>&lt;p&gt;I&amp;#8217;ve noticed that in recent versions of Boost (1.39.0 and newer) there is a way to do a &lt;a href="http://www.boost.org/doc/libs/release/more/getting_started/windows.html#or-simplified-build-from-source"&gt;&amp;#8220;Simplified Build from Source&amp;#8221;&lt;/a&gt; if you&amp;#8217;re using Microsoft Visual Studio. Here are the steps as I like to write them:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="http://www.boost.org/users/download/"&gt;Download&lt;/a&gt; the latest version of Boost and extract it to some location (we&amp;#8217;ll assume &lt;code&gt;D:\Boost\&lt;/code&gt;), making sure to maintain the directory structure.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;In a command prompt, navigate to your Boost library folder (&lt;code&gt;D:\Boost\boost_1_41_0\&lt;/code&gt;) and then use this command, which builds your very own copy of Boost Jam (a build system):&lt;/p&gt;

&lt;pre&gt;
&amp;gt; bootstrap
&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Now, in the same command prompt, enter this command, where N is the number of processors/cores you have available for compiling (for example, &lt;code&gt;-j4&lt;/code&gt; if you have a quad-core processor):&lt;/p&gt;

&lt;pre&gt;
&amp;gt; bjam.exe -jN
&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Wait.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;After the build completes you will have a &lt;code&gt;stage&lt;/code&gt; subdirectory (&lt;code&gt;D:\Boost\boost_1_41_0\stage\&lt;/code&gt;) which will contain a &lt;code&gt;lib&lt;/code&gt; subdirectory, containing the compiled libraries.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This simplified process removes the need to get a copy of Boost Jam, which, as trivial as it sounds, really does make a big difference to the friendliness of the entire procedure. It also reduces the number of necessary arguments to zero (or one, if you consider multi-core a necessity), although there are some situations where you may still need the older arguments (in which case I refer you to my previous &lt;a href="http://www.ffuts.org/blog/building-boost-now-with-dual-quad-multi-core-action/"&gt;entry on the subject&lt;/a&gt;).&lt;/p&gt;</description>
    </item>
    <item>
      <title>SteveStreeting.com's great series of articles about distributed version control systems</title>
      <link>http://www.ffuts.org/blog/stevestreetingcoms-great-series-of-articles-about-distributed-version-control-systems/</link>
      <pubDate>Sat, 07 Nov 2009 00:43 -0700</pubDate>
      <guid>http://www.ffuts.org/blog/stevestreetingcoms-great-series-of-articles-about-distributed-version-control-systems/</guid>
      <description>&lt;p&gt;Steve Streeting (the man behind &lt;a href="http://www.ogre3d.org"&gt;OGRE&lt;/a&gt;, a 3D graphics engine) has been writing about his experiments with distributed version control systems, particularly &lt;a href="http://en.wikipedia.org/wiki/Mercurial"&gt;Mercurial&lt;/a&gt; and &lt;a href="http://en.wikipedia.org/wiki/Git_(software)"&gt;Git&lt;/a&gt;. In particular, his &lt;a href="http://www.stevestreeting.com/2009/11/06/dvcs-score-card/"&gt;latest blog post&lt;/a&gt; contains a summary of his experiences with the two version control systems and is probably the most in-depth article I&amp;#8217;ve read on the topic.&lt;/p&gt;

&lt;p&gt;The most interesting portions of the article (and &lt;a href="http://www.stevestreeting.com/tag/dvcs/"&gt;his prior posts&lt;/a&gt;) are the ones which talk directly about managing the OGRE source within each of the two &lt;abbr title="distributed version control systems"&gt;DVCSs&lt;/abbr&gt;. OGRE is not a small project and it&amp;#8217;s very illuminating to read about what parts of a (distributed) version control system are important to a larger project, as this is stuff you may not personally experience until it&amp;#8217;s too late to change your mind.&lt;/p&gt;

&lt;p&gt;For my own personal projects I use &lt;a href="http://en.wikipedia.org/wiki/Subversion_(software)"&gt;Subversion&lt;/a&gt; (&lt;a href="http://tortoisesvn.tigris.org/"&gt;TortoiseSVN&lt;/a&gt; is a great piece of software) and I&amp;#8217;m not in any particular rush to switch over to a &lt;abbr title="distributed version control system"&gt;DVCS&lt;/abbr&gt; just yet. It&amp;#8217;s simple, straightforward and fits well with my workflow. For larger projects, especially ones where you&amp;#8217;re collaborating with people across the Internet, I&amp;#8217;d give some serious thought to using a &lt;abbr title="distributed version control system"&gt;DVCS&lt;/abbr&gt; and reading about other people&amp;#8217;s experiences is extremely helpful.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Windows Sidebar Gadgets</title>
      <link>http://www.ffuts.org/blog/windows-sidebar-gadgets/</link>
      <pubDate>Mon, 12 Oct 2009 11:57 -0700</pubDate>
      <guid>http://www.ffuts.org/blog/windows-sidebar-gadgets/</guid>
      <description>&lt;p&gt;Windows Vista and Windows 7 provides what they call Windows (Sidebar) Gadgets (the Sidebar moniker is removed in Windows 7). These gadgets do the same thing as similar products from Yahoo (formerly known as Konfabulator) and Apple (the Dashboard), providing small amounts of functionality and information within easy reach.&lt;/p&gt;

&lt;p&gt;The Windows Live Gallery is a perfect example of how not to make a download center. If you take a look at the Sidebar gadgets category, most are of rather poor quality, and a fair number of the good ones use plagiarized skins and/or code.&lt;/p&gt;

&lt;p&gt;There&amp;#8217;s no community presence on a site like that, and without a community to help deter poor behavior I think the free-for-all atmosphere makes it hard for the good submissions to float to the top. &lt;a href="http://www.deviantart.com/"&gt;deviantART&lt;/a&gt; is a great example of a site that does the right stuff; their Sidebar gadgets section is cleaner and easier to use.&lt;/p&gt;

&lt;p&gt;Anyway, I bring this up because there are some gadgets on &lt;a href="http://thehobbylounge.com/forum/"&gt;The Hobby Lounge&lt;/a&gt; which you won&amp;#8217;t find on deviantART and unfortunately exist in a plagiarized state on the Windows Live Gallery. I was in the process of updating some of my older gadgets from this site and it took me a surprisingly long time to find the website again, even though I knew exactly what I was looking for. My google-fu is usually pretty decent so I figure I&amp;#8217;ll make a note of it here for myself and maybe help them get noticed a bit more.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Optimization switches and Visual Studio 2008</title>
      <link>http://www.ffuts.org/blog/optimization-switches-and-visual-studio-2008/</link>
      <pubDate>Fri, 02 Oct 2009 15:29 -0700</pubDate>
      <guid>http://www.ffuts.org/blog/optimization-switches-and-visual-studio-2008/</guid>
      <description>&lt;p&gt;In a &lt;a href="http://www.ffuts.org/blog/dont-spend-time-micromanaging-optimization-options-in-visual-c/"&gt;previous&lt;/a&gt; entry I noted that you generally do not need to micromanage your optimization switches.&lt;/p&gt;

&lt;p&gt;However, in Visual Studio 2008 (both with and without SP1) there is a bug where the default optimization switch, &lt;code&gt;/O2&lt;/code&gt;, is &lt;em&gt;not applied&lt;/em&gt; even when shown in the IDE under &lt;code&gt;Configuration Properties-&amp;gt;C/C++-&amp;gt;Optimization&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;This happens when you select &lt;code&gt;&amp;lt;inherit from parent or project defaults&amp;gt;&lt;/code&gt;. Instead, you want to explicitly set &lt;code&gt;Maximize Speed (/O2)&lt;/code&gt; (it will show up in bold when explicitly set). You should also verify that the &lt;code&gt;/O2&lt;/code&gt; flag is being applied by viewing the command line (&lt;code&gt;Configuration Properties-&amp;gt;C/C++-&amp;gt;Command Line&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;There is more about this bug on &lt;a href="http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=383764"&gt;Microsoft Connect&lt;/a&gt;, where it&amp;#8217;s also noted that this bug will be fixed in Visual Studio 2010.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Right-click context menus with Qt</title>
      <link>http://www.ffuts.org/blog/right-click-context-menus-with-qt/</link>
      <pubDate>Thu, 23 Jul 2009 20:47 -0700</pubDate>
      <guid>http://www.ffuts.org/blog/right-click-context-menus-with-qt/</guid>
      <description>&lt;p&gt;Getting right-clicks to popup a context menu is pretty straightforward in Qt. There are just a couple of things to watch out for&amp;#8230;&lt;/p&gt;

&lt;p&gt;First, there are several ways to tell Qt you want a context menu. One approach is to subclass the widget and override the &lt;code&gt;QWidget::contextMenuEvent()&lt;/code&gt; event handler. However, I think the easiest approach is to call &lt;code&gt;setContextMenuPolicy(Qt::CustomContextMenu)&lt;/code&gt; on the widget you want, and then connect the &lt;code&gt;customContextMenuRequested()&lt;/code&gt; signal to the appropriate slot:&lt;/p&gt;

&lt;pre class="prettyprint"&gt;// myWidget is any QWidget-derived class
myWidget-&amp;gt;setContextMenuPolicy(Qt::CustomContextMenu);
connect(myWidget, SIGNAL(customContextMenuRequested(const QPoint&amp;amp;)),
    this, SLOT(ShowContextMenu(const QPoint&amp;amp;)));
&lt;/pre&gt;

&lt;p&gt;Next, note that the &lt;code&gt;const QPoint&amp;amp; pos&lt;/code&gt; parameter in the &lt;code&gt;customContextMenuRequested()&lt;/code&gt; signal is &lt;a href="http://doc.trolltech.com/4.5/qwidget.html#customContextMenuRequested"&gt;normally in widget coordinates&lt;/a&gt;. However, also note that classes which inherit from &lt;code&gt;QAbstractScrollArea&lt;/code&gt;&lt;sup id="fnref:viewportclasses"&gt;&lt;a href="#fn:viewportclasses" rel="footnote"&gt;1&lt;/a&gt;&lt;/sup&gt; instead use the coordinates of their &lt;code&gt;viewport()&lt;/code&gt;. Either way, you will need to map these coordinates to global coordinates using &lt;code&gt;mapToGlobal()&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Finally, simply either &lt;code&gt;popup()&lt;/code&gt; or &lt;code&gt;exec()&lt;/code&gt; your &lt;code&gt;QMenu&lt;/code&gt;. Remember that &lt;code&gt;popup()&lt;/code&gt; is non-blocking, so if you wish to use that, make sure your &lt;code&gt;QMenu&lt;/code&gt; is created on the heap!&lt;/p&gt;

&lt;pre class="prettyprint"&gt;void MyClass::ShowContextMenu(const QPoint&amp;amp; pos) // this is a slot
{
    // for most widgets
    QPoint globalPos = myWidget-&amp;gt;mapToGlobal(pos);
    // for QAbstractScrollArea and derived classes you would use:
    // QPoint globalPos = myWidget-&amp;gt;viewport()-&amp;gt;mapToGlobal(pos); 

    QMenu myMenu;
    myMenu.addAction("Menu Item 1");
    // ...

    QAction* selectedItem = myMenu.exec(globalPos);
    if (selectedItem)
    {
        // something was chosen, do stuff
    }
    else
    {
        // nothing was chosen
    }
}
&lt;/pre&gt;

&lt;div class="footnotes"&gt;
&lt;hr /&gt;
&lt;ol&gt;

&lt;li id="fn:viewportclasses"&gt;
&lt;p&gt;Examples include &lt;code&gt;QTreeWidget&lt;/code&gt;, &lt;code&gt;QTreeView&lt;/code&gt;, &lt;code&gt;QListWidget&lt;/code&gt;, &lt;code&gt;QListView&lt;/code&gt;, &lt;code&gt;QTableWidget&lt;/code&gt;, &lt;code&gt;QTableView&lt;/code&gt;, &lt;code&gt;QTextEdit&lt;/code&gt;, &lt;code&gt;QPlainTextEdit&lt;/code&gt;, and &lt;code&gt;QMdiArea&lt;/code&gt;.&amp;#160;&lt;a href="#fnref:viewportclasses" rev="footnote"&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;

&lt;/ol&gt;
&lt;/div&gt;</description>
    </item>
    <item>
      <title>Consolas is a poor choice for web use</title>
      <link>http://www.ffuts.org/blog/consolas-is-a-poor-choice-for-web-use/</link>
      <pubDate>Mon, 06 Jul 2009 15:22 -0700</pubDate>
      <guid>http://www.ffuts.org/blog/consolas-is-a-poor-choice-for-web-use/</guid>
      <description>&lt;p&gt;&lt;a href="http://en.wikipedia.org/wiki/Consolas"&gt;Consolas&lt;/a&gt;, with &lt;a href="http://en.wikipedia.org/wiki/ClearType"&gt;ClearType&lt;/a&gt; enabled, is a gorgeous font, and is my preferred monospaced font. However, take a look at it without ClearType (there&amp;#8217;s a sample image on the linked Wikipedia article)&amp;#8212;those jaggies hurt.&lt;/p&gt;

&lt;p&gt;That&amp;#8217;s why you shouldn&amp;#8217;t define Consolas in your style sheets. You can&amp;#8217;t know/assume that everyone who views your webpage will have ClearType on (or at least some form of font-smoothing), and those who don&amp;#8217;t have it enabled will suffer through text that looks as though it were drawn freehand with a mouse.&lt;/p&gt;

&lt;p&gt;Instead, unless you are going for a specific effect such as trying to mimic old &lt;a href="http://en.wikipedia.org/wiki/Terminal_(font)"&gt;terminals&lt;/a&gt;, keep your &lt;code&gt;font-family&lt;/code&gt; for &lt;code&gt;&amp;lt;pre&amp;gt;&lt;/code&gt; and &lt;code&gt;&amp;lt;code&amp;gt;&lt;/code&gt; elements short and to the point. I personally use&lt;/p&gt;

&lt;pre class="prettyprint"&gt;font-family: "Lucida Console", "Monaco", "DejaVu Sans Mono", monospace;
&lt;/pre&gt;

&lt;p&gt;which is usually enough to keep Courier (+ New) out of the way. If someone is missing all of these fonts they&amp;#8217;ll likely have a decent enough substitute.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Compile Qt 4.5 for Visual Studio, using your multi-core processor</title>
      <link>http://www.ffuts.org/blog/compile-qt-45-for-visual-studio-using-your-multi-core-processor/</link>
      <pubDate>Thu, 25 Jun 2009 20:28 -0700</pubDate>
      <guid>http://www.ffuts.org/blog/compile-qt-45-for-visual-studio-using-your-multi-core-processor/</guid>
      <description>&lt;p&gt;If you want to use Qt 4.5 with Visual Studio you&amp;#8217;ll need to compile it yourself. The instructions are simple, and fairly well documented on &lt;a href="http://www.google.com/search?hl=en&amp;amp;q=compile+qt+visual+studio"&gt;various blogs and websites&lt;/a&gt;. Essentially: &lt;em&gt;(read steps 7 and on for multi-threading information)&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;[Edit: These steps still apply for Qt 4.6, but Qt 4.6 actually has &lt;a href="http://www.ffuts.org/blog/qt-46-has-prebuilt-binaries-for-visual-studio/"&gt;prebuilt binaries/libraries&lt;/a&gt; for Visual Studio 2008 which I highly suggest looking at instead]&lt;/em&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;This step is important.&lt;/strong&gt; You will potentially save some time by deleting these &lt;code&gt;mocinclude.tmp&lt;/code&gt; files:&lt;/p&gt;

&lt;pre&gt;
\Qt\2009.05\qt\src\3rdparty\webkit\WebCore\tmp\moc\debug_shared\mocinclude.tmp
\Qt\2009.05\qt\src\3rdparty\webkit\WebCore\tmp\moc\release_shared\mocinclude.tmp
\Qt\2009.05\qt\src\script\tmp\moc\debug_shared\mocinclude.tmp
\Qt\2009.05\qt\src\script\tmp\moc\release_shared\mocinclude.tmp
&lt;/pre&gt;

&lt;p&gt;Deleting the first two &lt;code&gt;mocinclude.tmp&lt;/code&gt; files will prevent a LNK2019 error from building Webkit, while deleting the last two (which are present in Qt 4.6) will prevent &lt;code&gt;Error: Unknown interface&lt;/code&gt; from occurring while trying to build &lt;code&gt;qscriptextensionplugin.h&lt;/code&gt;. If you&amp;#8217;re missing any of them don&amp;#8217;t fret, it&amp;#8217;s actually a good thing.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Using a &lt;em&gt;Visual Studio Command Prompt&lt;/em&gt;, navigate to your Qt folder (I&amp;#8217;ll use &lt;code&gt;D:\Coding\Qt\2009.05&lt;/code&gt; in this example).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Go to the Qt folder inside there (e.g. &lt;code&gt;D:\Coding\Qt\2009.05\qt&lt;/code&gt;). It&amp;#8217;s the one that contains &lt;code&gt;configure.exe&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Enter the following command, changing &lt;code&gt;win32-msvc2008&lt;/code&gt; to &lt;code&gt;win32-msvc2005&lt;/code&gt; if necessary.&lt;/p&gt;

&lt;pre class="prettyprint"&gt;&amp;gt; configure -opensource -shared -ltcg -no-qt3support -platform win32-msvc2008
&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;What this does is fairly self explanatory. The &lt;code&gt;-shared&lt;/code&gt; switch will make sure that Qt is configured for dynamic linking (even though that&amp;#8217;s usually the default option there&amp;#8217;s no guarantee). We need to specify the &lt;code&gt;-ltcg&lt;/code&gt; switch to turn on &lt;em&gt;Link Time Code Generation&lt;/em&gt;. LTCG is off by default since, in combination with a statically built Qt, it will make linking very slow for any projects that use Qt. However, if we configure Qt for dynamic linking this won&amp;#8217;t be an issue.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You can add or remove switches as desired (try &lt;code&gt;configure help&lt;/code&gt;) but I find most of the defaults suitable. Sure, you may not need OpenGL (or SQL or Phonon or&amp;#8230;) support right now, but it&amp;#8217;s a separate module anyway and you&amp;#8217;re already compiling the rest of Qt.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;All you need to do now is run &lt;code&gt;nmake&lt;/code&gt;&amp;#8230;&lt;em&gt;but wait&lt;/em&gt;.&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Do you have a dual-core or quad-core processor or can take advantage of multi-threaded compilation? Get the &lt;code&gt;jom&lt;/code&gt; tool instead. There&amp;#8217;s some info about &lt;code&gt;jom&lt;/code&gt; in this &lt;a href="http://labs.trolltech.com/blogs/2009/03/27/speeding-up-visual-c-qt-builds/"&gt;Qt Labs Blogs article&lt;/a&gt;. You can download the latest version of &lt;code&gt;jom&lt;/code&gt; from &lt;a href="ftp://ftp.qt.nokia.com/jom/"&gt;ftp://ftp.qt.nokia.com/jom/&lt;/a&gt; (&lt;code&gt;jom.zip&lt;/code&gt; should be just fine).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Use &lt;code&gt;jom&lt;/code&gt; by simply unzipping and running it in the same directory as &lt;code&gt;configure&lt;/code&gt; (which is still the same as before, &lt;code&gt;D:\Coding\Qt\2009.05\qt&lt;/code&gt;).&lt;/p&gt;

&lt;pre class="prettyprint"&gt;&amp;gt; jom
&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Happily build Qt much faster. For example, on my machine (a Core 2 Quad) it took an hour for the build to complete.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Unless you really enjoy manually handling custom build steps, don&amp;#8217;t forget to get the &lt;a href="http://www.qtsoftware.com/downloads/visual-studio-add-in"&gt;Qt Visual Studio Add-In&lt;/a&gt;. After installing it make sure that it&amp;#8217;s aware of the location of your Qt installation (&lt;code&gt;Qt-&amp;gt;Qt Options&lt;/code&gt;) and then use &lt;code&gt;File-&amp;gt;New-&amp;gt;Project...&lt;/code&gt; and select one of the Qt templates to get started.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;</description>
    </item>
    <item>
      <title>#include Guidelines</title>
      <link>http://www.ffuts.org/blog/include-guidelines/</link>
      <pubDate>Mon, 22 Jun 2009 19:20 -0700</pubDate>
      <guid>http://www.ffuts.org/blog/include-guidelines/</guid>
      <description>&lt;p&gt;This is mostly for my own reference, but here are some of the guidelines I like to follow when it comes to &lt;code&gt;#include&lt;/code&gt;s in C++. Given &lt;code&gt;foo.cpp&lt;/code&gt; and &lt;code&gt;foo.h&lt;/code&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;foo.h&lt;/code&gt; should include everything it mentions and no more. For example, if you use &lt;code&gt;boost::random&lt;/code&gt; in the implementation, don&amp;#8217;t &lt;code&gt;#include &amp;lt;boost/random.hpp&amp;gt;&lt;/code&gt; in &lt;code&gt;foo.h&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;foo.cpp&lt;/code&gt; should also include everything it mentions and no more.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;foo.cpp&lt;/code&gt;&amp;#8217;s first include should be &lt;code&gt;#include "foo.h"&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Precompiled headers, if used, should be specified in &lt;code&gt;foo.cpp&lt;/code&gt; only and will need to be the first &lt;code&gt;#include&lt;/code&gt; (&lt;code&gt;#include "foo.h"&lt;/code&gt; will then be the second).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Except for the above two exceptions, the order I like to follow for &lt;code&gt;#include&lt;/code&gt;s is:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Headers from your own project (generally of the form &lt;code&gt;#include "baz.h"&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;Headers from non-standard libraries (such as Qt)&lt;/li&gt;
&lt;li&gt;Standard libraries (I include Boost in here because I use it so pervasively)&lt;/li&gt;
&lt;li&gt;Platform headers (like &lt;code&gt;#include &amp;lt;windows.h&amp;gt;&lt;/code&gt;)&lt;/li&gt;
&lt;/ol&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Within each of the above groups try to alphabetically order the &lt;code&gt;#include&lt;/code&gt;s if at all possible.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Forward declare whenever you can get away with it.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;</description>
    </item>
    <item>
      <title>The difference between Qt::Key_Enter and Qt::Key_Return</title>
      <link>http://www.ffuts.org/blog/the-difference-between-qt-key-enter-and-qt-key-r/</link>
      <pubDate>Wed, 10 Jun 2009 10:48 -0700</pubDate>
      <guid>http://www.ffuts.org/blog/the-difference-between-qt-key-enter-and-qt-key-r/</guid>
      <description>&lt;p&gt;It&amp;#8217;s specified in the &lt;a href="http://doc.trolltech.com/4.5/qt.html#Key-enum"&gt;documentation&lt;/a&gt;, though in a slightly subtle manner. Essentially, &lt;code&gt;Qt::Key_Enter&lt;/code&gt; is the keypad Enter, while &lt;code&gt;Qt::Key_Return&lt;/code&gt; is the &amp;#8220;regular&amp;#8221; Enter, the one which you normally use while typing.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Visual Studio 2010 sounds pretty neat so far</title>
      <link>http://www.ffuts.org/blog/visual-studio-2010-sounds-pretty-neat-so-far/</link>
      <pubDate>Tue, 09 Jun 2009 10:04 -0700</pubDate>
      <guid>http://www.ffuts.org/blog/visual-studio-2010-sounds-pretty-neat-so-far/</guid>
      <description>&lt;p&gt;I&amp;#8217;m a very big fan of the Visual Studio IDE (I think it&amp;#8217;s the best around, for any platform). However, Microsoft has historically put less of a emphasis on the C++ portion and the past couple of versions have had only minor bullet points on the C++ side.&lt;/p&gt;

&lt;p&gt;I think they&amp;#8217;ve wizened up a bit and the next Visual C++, 2010, has some notable improvements in store (C++0x support, for one). They&amp;#8217;ve also put a lot of work into completely reworking their C++ IntelliSense engine. There&amp;#8217;s not much for me to say, really, as they have a great &lt;a href="http://blogs.msdn.com/vcblog/default.aspx"&gt;blog&lt;/a&gt;. I&amp;#8217;ll just highlight some of the articles I found the most interesting, which coincidentally all focus on IntelliSense:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="http://blogs.msdn.com/vcblog/archive/2009/01/27/dev10-is-just-the-beginning.aspx"&gt;A bit of history about the current IntelliSense engine, FEACP&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://blogs.msdn.com/vcblog/archive/2009/03/10/testing-vc-compiler-and-intellisense.aspx"&gt;Just how do they test it anyway?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://blogs.msdn.com/vcblog/archive/2009/05/27/rebuilding-intellisense.aspx"&gt;Details about the upcoming engine&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://blogs.msdn.com/vcblog/archive/2009/06/01/c-gets-squiggles.aspx"&gt;Squiggles.&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</description>
    </item>
    <item>
      <title>Qt: staticMetaObject is not a member of...</title>
      <link>http://www.ffuts.org/blog/qt-staticmetaobject-is-not-a-member-of/</link>
      <pubDate>Fri, 29 May 2009 21:11 -0700</pubDate>
      <guid>http://www.ffuts.org/blog/qt-staticmetaobject-is-not-a-member-of/</guid>
      <description>&lt;p&gt;Just got this error message while compiling a tiny class that derives from &lt;code&gt;QTreeWidgetItem&lt;/code&gt;:&lt;/p&gt;

&lt;pre&gt;
error C2039: 'staticMetaObject' : is not a member of 'QTreeWidgetItem'
&lt;/pre&gt;

&lt;p&gt;What this is saying is that &lt;code&gt;QTreeWidgetItem&lt;/code&gt; does not inherit from &lt;code&gt;QObject&lt;/code&gt;, meaning that your own, singly-inherited class also does not inherit from &lt;code&gt;QObject&lt;/code&gt;. Inheriting from &lt;code&gt;QObject&lt;/code&gt; is &lt;a href="http://doc.trolltech.com/qobject.html#Q_OBJECT"&gt;one of the prerequisites&lt;/a&gt; to using the &lt;code&gt;Q_OBJECT&lt;/code&gt; macro, which, if you&amp;#8217;re anything like me, you automatically insert into any Qt GUI related class.&lt;/p&gt;

&lt;p&gt;If you&amp;#8217;re not using any of the meta object stuff in your subclass, such as signals/slots or properties, just take out the &lt;code&gt;Q_OBJECT&lt;/code&gt; macro. If you need to use signals and slots, you&amp;#8217;ll need to make your subclass multiply-inherit from &lt;code&gt;QObject&lt;/code&gt; as well. If you take this route, remember that &amp;#8220;&lt;em&gt;&lt;a href="http://doc.trolltech.com/4.5/moc.html"&gt;Multiple Inheritance Requires QObject to Be First&lt;/a&gt;&lt;/em&gt;&amp;#8221;, otherwise you&amp;#8217;ll get either the same error as above, or something along the lines of &amp;#8220;&lt;code&gt;YourClass&lt;/code&gt; inherits from two QObject subclasses&amp;#8221; from the moc.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Captchas shouldn't be the default defense against bots</title>
      <link>http://www.ffuts.org/blog/captchas-shouldnt-be-the-default-defense-against-b/</link>
      <pubDate>Thu, 21 May 2009 15:17 -0700</pubDate>
      <guid>http://www.ffuts.org/blog/captchas-shouldnt-be-the-default-defense-against-b/</guid>
      <description>&lt;p&gt;&lt;a href="http://en.wikipedia.org/wiki/Captcha"&gt;Captchas&lt;/a&gt; are useful to prevent bots or similarly automated activities from occurring. However, they&amp;#8217;re not perfect and many of them can be broken with a targeted attack. In a sort of arms race fashion, captchas get more and more intricate, but some take this a bit too far and aren&amp;#8217;t really even human solvable.&lt;/p&gt;

&lt;p&gt;In any case, large sites have to have some way to separate bots from humans, and captchas may be the only solution. It&amp;#8217;s still an arms race, but at least the large sites have the resources to throw at it.&lt;/p&gt;

&lt;p&gt;What about the small sites? Your blog about your cat? Your forum for fellow gum-chewers? Do you really need (or want) a captcha for these types of sites? Unfortunately, what happens is a crawler stumbles upon your site, notices it uses some popular blog or forum application it knows about, and attempts to register so it can subsequently flood your site with spam. If you use a popular application, such as &lt;a href="http://www.phpbb.com/"&gt;phpBB3&lt;/a&gt; (for the sake of argument), once the generic, built-in captcha gets broken, all non-customized phpBB3 sites are vulnerable. So a spammer just needs to try to break this one particular captcha and suddenly they&amp;#8217;ve unlocked the ability to spam millions of forums. It provides the volume that spammers need to make spam work.&lt;/p&gt;

&lt;p&gt;What I suggest instead is that the default mode of operation for a forum (or any application, really) should be to ask a simple question upon registration, with both the answer and question provided by the person who is running the site:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Q: What is my cat&amp;#8217;s name?&lt;br /&gt;
  A: Fluffy&lt;br /&gt;&lt;/p&gt;
  
  &lt;p&gt;Q: Which of the following is a brand of gum? Oreos, Jellybeans, Trident, Snickers&lt;br /&gt;
  A: Trident&lt;br /&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Incidentally, yes/no type questions should be disallowed, as the answers (&amp;#8216;yes&amp;#8217; and &amp;#8216;no&amp;#8217;) would be common enough to automate.&lt;/p&gt;

&lt;p&gt;Now, spamming your forum requires actual human intervention. Obviously this sort of approach will fail if you have a large or popular site, but if you own such a site you already know you have to take more steps to protect your site.&lt;/p&gt;

&lt;p&gt;One potential problem is I could see lists of questions/answers being hand-generated and passed around, but this could be mitigated by expiring questions/answers after some time. If you&amp;#8217;re feeling particularly clever you could even flag the old answer as being a &amp;#8216;bot-answer&amp;#8217;, which might work well in concert with an &lt;a href="http://en.wikipedia.org/wiki/Akismet"&gt;Akismet&lt;/a&gt; type service:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Q: How old is my cat?&lt;br /&gt;
  A: Fluffy &lt;em&gt;(hello, bot!)&lt;/em&gt;&lt;br /&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Anyway, I feel that captchas are a bit of dead end in terms of anti-spam measures for small sites. Small sites are not typical targets for spammers, as the reward is not worth the effort. However, if all these small sites are protected by the same captcha, breaking that captcha gives that spammer access to &lt;em&gt;(small-sites &amp;#215; millions)&lt;/em&gt;, which &lt;em&gt;is&lt;/em&gt; worth the effort.&lt;/p&gt;</description>
    </item>
    <item>
      <title>More thoughts on Qt 4.5</title>
      <link>http://www.ffuts.org/blog/more-thoughts-on-qt-45/</link>
      <pubDate>Thu, 07 May 2009 16:35 -0700</pubDate>
      <guid>http://www.ffuts.org/blog/more-thoughts-on-qt-45/</guid>
      <description>&lt;p&gt;I&amp;#8217;ve been using Qt 4.5 for a couple more weeks now and I&amp;#8217;ve had a few more thoughts on the framework.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;I don&amp;#8217;t know if I could handle using the plain Win32 API for GUI ever again&lt;/li&gt;
&lt;li&gt;Even with Qt&amp;#8217;s &amp;#8220;parent handles the deletion of its children&amp;#8221; memory management system it&amp;#8217;s still easier to use (and reason about) &lt;code&gt;shared_ptr&lt;/code&gt; or another smart pointer, as long as you&amp;#8217;re not working with widgets or similar GUI elements. If you&amp;#8217;re working with GUI elements, Qt&amp;#8217;s memory management works perfectly and makes sense.&lt;/li&gt;
&lt;li&gt;You can assume that any &lt;code&gt;addWidget()&lt;/code&gt;-like function will take ownership unless explicitly stated otherwise. I still wish they would just say straight out that &amp;#8220;this function takes ownership&amp;#8221;.&lt;/li&gt;
&lt;li&gt;In my opinion the documentation would be much improved for newcomers if they had a &amp;#8220;Qt Best Practices&amp;#8221; section. You can get a sense of how things should be structured if you look at their sample programs, but there&amp;#8217;s a lot to go through.&lt;/li&gt;
&lt;li&gt;Other than those two nitpicks, the documentation is consistently quite good.&lt;/li&gt;
&lt;li&gt;I would suggest that you avoid using the &lt;a href="http://doc.qtsoftware.com/4.5/containers.html"&gt;Qt containers&lt;/a&gt; and instead favor the standard C++ containers whenever possible. There&amp;#8217;s less to learn, and most C++ programmers will have a firm grasp of the containers in the &lt;code&gt;std&lt;/code&gt; namespace. Some Qt functions do return &lt;a href="http://doc.trolltech.com/4.5/qstringlist.html"&gt;&lt;code&gt;QStringList&lt;/code&gt;&lt;/a&gt; or some other Qt container, in which case you may as well just leave it in the container you get it in.&lt;/li&gt;
&lt;li&gt;On the other hand, if you&amp;#8217;re going to use Qt, you may as well use &lt;a href="http://doc.trolltech.com/4.5/qstring.html"&gt;&lt;code&gt;QString&lt;/code&gt;&lt;/a&gt; everywhere. It&amp;#8217;s used extensively through the Qt framework, so you won&amp;#8217;t be able to avoid it. It&amp;#8217;s a pretty decent string library anyway, with plenty of useful functions, and it handles Unicode cleanly in my experience.&lt;/li&gt;
&lt;li&gt;&lt;a href="http://doc.trolltech.com/4.5/qtextedit.html"&gt;&lt;code&gt;QTextEdit&lt;/code&gt;&lt;/a&gt; isn&amp;#8217;t particularly performant, particularly when you resize it and it has to perform lots of word wrap calculations. Use &lt;a href="http://doc.trolltech.com/4.5/qplaintextedit.html"&gt;&lt;code&gt;QPlainTextEdit&lt;/code&gt;&lt;/a&gt; if you can.&lt;/li&gt;
&lt;/ul&gt;</description>
    </item>
    <item>
      <title>A really quick boost::random guide</title>
      <link>http://www.ffuts.org/blog/a-really-quick-boost-random-guide/</link>
      <pubDate>Wed, 06 May 2009 20:03 -0700</pubDate>
      <guid>http://www.ffuts.org/blog/a-really-quick-boost-random-guide/</guid>
      <description>&lt;p&gt;This is a really short and quick guide on how to use &lt;code&gt;boost::random&lt;/code&gt;. The best place to start is, as always, the &lt;a href="http://www.boost.org/doc/libs/release/libs/random/index.html"&gt;documentation&lt;/a&gt;, but Boost also provides a &lt;a href="http://www.boost.org/doc/libs/release/libs/random/random_demo.cpp"&gt;simple sample program&lt;/a&gt; that covers the library in a good &amp;#8220;how to get started&amp;#8221; fashion.&lt;/p&gt;

&lt;p&gt;What I&amp;#8217;m about to write here is even shorter and less detailed &amp;#8211; it&amp;#8217;s just the basic code needed to generate some random numbers.&lt;/p&gt;

&lt;pre class="prettyprint"&gt;// Initialize a random number generator.
// Boost provides a bunch of these, note that some of them are not meant
// for direct user usage and you should instead use a specialization (for 
// example, don't use linear_congruential and use minstd_rand or 
// minstd_rand0 instead)

// This constructor seeds the generator with the current time.
// As mentioned in Boost's sample program, time(0) is not a great seed,
// but you can probably get away with it for most situations.
// Consider using more precise timers such as gettimeofday on *nix or
// GetTickCount/timeGetTime/QueryPerformanceCounter on Windows.
boost::mt19937 randGen(std::time(0));

// Now we set up a distribution. Boost provides a bunch of these as well.
// This is the preferred way to generate numbers in a certain range.
// In this example we initialize a uniform distribution between 0 and the max
// value that an unsigned char can hold (255 for most architectures)
boost::uniform_int&amp;lt;&amp;gt; uInt8Dist(0, std::numeric_limits&amp;lt;unsigned char&amp;gt;::max());

// Finally, declare a variate_generator which maps the random number
// generator and the distribution together. This variate_generator
// is usable like a function call.
boost::variate_generator&amp;lt; boost::mt19937&amp;amp;, boost::uniform_int&amp;lt;&amp;gt; &amp;gt; 
    GetRand(randGen, uInt8Dist);

// Generate a random number
int aRandomNumber = GetRand();
&lt;/pre&gt;</description>
    </item>
    <item>
      <title>Namespaces are one honking great idea</title>
      <link>http://www.ffuts.org/blog/namespaces-are-one-honking-great-idea/</link>
      <pubDate>Wed, 29 Apr 2009 09:17 -0700</pubDate>
      <guid>http://www.ffuts.org/blog/namespaces-are-one-honking-great-idea/</guid>
      <description>&lt;p&gt;The title of this post comes from the last line of &lt;em&gt;&lt;a href="http://www.python.org/dev/peps/pep-0020/"&gt;The Zen of Python&lt;/a&gt;&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;It applies to C++ too: namespaces are great. Namespaces let the &lt;a href="http://www.boost.org/"&gt;Boost&lt;/a&gt; folks contain all sorts of widely varying libraries without having to worry about naming collisions in user code. Namespaces let you mix multiple libraries easily and safely. Namespaces let you group sets of related free functions together, without needing a class. Namespaces also let you work around one thing I&amp;#8217;ve always found a bit unusual with enums: the way they don&amp;#8217;t have their own scope.&lt;/p&gt;

&lt;pre class="prettyprint"&gt;enum ValidValues
{
    Value1,
    Value2
};
&lt;/pre&gt;

&lt;p&gt;This ends up declaring &lt;code&gt;Value1&lt;/code&gt; and &lt;code&gt;Value2&lt;/code&gt; in the underlying scope. What I like to do is wrap the enum in a namespace:&lt;/p&gt;

&lt;pre class="prettyprint"&gt;namespace ValidValues
{
    enum Enum
    {
        Value1,
        Value2
    };
}
&lt;/pre&gt;

&lt;p&gt;This sticks &lt;code&gt;Value1&lt;/code&gt; and &lt;code&gt;Value2&lt;/code&gt; in the &lt;code&gt;ValidValues&lt;/code&gt; namespace. The only disadvantage is declaring a variable of this enum type gets a bit silly and inconsistent. For example:&lt;/p&gt;

&lt;pre class="prettyprint"&gt;ValidValues var = Value1; // error, ValidValues is a namespace, Value1 is undefined
ValidValues::Enum var = Value1; // error, Value1 is undefined
ValidValues::Enum var = ValidValues::Value1; // okay
&lt;/pre&gt;

&lt;p&gt;This is yet another area where C++0x will offer its own solution, in this case, &lt;a href="http://en.wikipedia.org/wiki/C%2B%2B0x#Strongly_typed_enumerations"&gt;strongly typed enumerations&lt;/a&gt;.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Right aligning a button in a QToolBar</title>
      <link>http://www.ffuts.org/blog/right-aligning-a-button-in-a-qtoolbar/</link>
      <pubDate>Thu, 23 Apr 2009 08:32 -0700</pubDate>
      <guid>http://www.ffuts.org/blog/right-aligning-a-button-in-a-qtoolbar/</guid>
      <description>&lt;p&gt;Sometimes you will want to add a right-aligned button to a &lt;code&gt;QToolBar&lt;/code&gt;. The first thing that probably comes to mind is to add a &lt;code&gt;QSpacerItem&lt;/code&gt; to the toolbar, but that won&amp;#8217;t work as &lt;code&gt;QSpacerItem&lt;/code&gt; is not a child of &lt;code&gt;QWidget&lt;/code&gt;, so you can&amp;#8217;t use the &lt;code&gt;addWidget()&lt;/code&gt; member of &lt;code&gt;QToolBar&lt;/code&gt;. Instead, make a basic &lt;code&gt;QWidget&lt;/code&gt;, set its &lt;code&gt;sizePolicy&lt;/code&gt; to &lt;code&gt;Expanding&lt;/code&gt;, and add that widget to your &lt;code&gt;QToolBar&lt;/code&gt;. For example:&lt;/p&gt;

&lt;pre class="prettyprint"&gt;QWidget* spacer = new QWidget();
spacer-&amp;gt;setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
// toolBar is a pointer to an existing toolbar
toolBar-&amp;gt;addWidget(spacer);
toolBar-&amp;gt;addAction("Right-aligned button");
&lt;/pre&gt;

&lt;p&gt;If you end up using a lot of these spacers you could even create a subclass.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Qt 4.5</title>
      <link>http://www.ffuts.org/blog/qt-45/</link>
      <pubDate>Mon, 20 Apr 2009 09:16 -0700</pubDate>
      <guid>http://www.ffuts.org/blog/qt-45/</guid>
      <description>&lt;p&gt;&lt;a href="http://www.qtsoftware.com/products/"&gt;Qt&lt;/a&gt; is a well known cross platform framework. It&amp;#8217;s probably most well known as the framework on which &lt;a href="http://www.kde.org/"&gt;KDE&lt;/a&gt; is written.&lt;/p&gt;

&lt;p&gt;Anyway, over the weekend I experimented with it a bit, and in terms of C++ GUI development it&amp;#8217;s a breath of fresh air. It approaches the ease of use of the .net GUI facilities, which is great for a language with no built in introspection abilities. The &amp;#8220;moc&amp;#8221; preprocessor that Qt requires (that lets them do things such as signals and slots) you to run on your source files is still a bit weird, but it&amp;#8217;s really not as bad as it seems.&lt;/p&gt;

&lt;p&gt;The Qt framework is also impressively comprehensive, making it very easy to code applications directly against Qt, instead of coding against a particular OS or a particular compiler.&lt;/p&gt;

&lt;p&gt;The style of the framework itself is more traditional than the common notion of modern C++, having more of an emphasis on subclassing and overriding virtual functions than on generic algorithms. The memory management system is definitely foreign: they encourage you to allocate on the heap, yet there are very few &lt;code&gt;delete&lt;/code&gt; statements. The way it works is that &lt;code&gt;QObject&lt;/code&gt;s (Qt&amp;#8217;s base class) accept a pointer to a parent in their constructor, which makes that particular &lt;code&gt;QObject&lt;/code&gt; a child of the parent. When the parent is deleted, it takes care of deleting all its children. It&amp;#8217;s a change from RAII, for sure.&lt;/p&gt;

&lt;p&gt;It also takes a couple of hours to compile Visual Studio compatible versions of the various components, so don&amp;#8217;t do it as a last minute thing.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Porting a Winsock application to Linux...select(2) is not as simple as MSDN makes it seem</title>
      <link>http://www.ffuts.org/blog/porting-a-winsock-application-to-linuxselect2-is-n/</link>
      <pubDate>Fri, 10 Apr 2009 17:54 -0700</pubDate>
      <guid>http://www.ffuts.org/blog/porting-a-winsock-application-to-linuxselect2-is-n/</guid>
      <description>&lt;p&gt;I&amp;#8217;m in the middle of porting bits of a Winsock application to Linux. Luckily when I first wrote the networking bits I had made an effort to write it in a somewhat cross platform manner. As a result, I stuck to &lt;code&gt;select()&lt;/code&gt;, &lt;code&gt;send()&lt;/code&gt;, &lt;code&gt;recv()&lt;/code&gt;, and all the other function calls that Winsock provides that are close to the &lt;a href="http://en.wikipedia.org/wiki/Berkeley_sockets"&gt;Berkeley socket interface&lt;/a&gt;. Things go pretty smoothly, although for some reason there&amp;#8217;s this really weird pause when connecting that didn&amp;#8217;t exist before&amp;#8230;&lt;/p&gt;

&lt;p&gt;Finally I hit a point where, for some reason, I couldn&amp;#8217;t establish a connection to the server and it just times out. That&amp;#8217;s really strange, so I threw good old debug statements all over the place and find out that this &lt;code&gt;select()&lt;/code&gt; call is not doing much of a select:&lt;/p&gt;

&lt;pre class="prettyprint"&gt;if (select(0, &amp;amp;rdset, &amp;amp;wtset, &amp;amp;errset, &amp;amp;tv) &amp;gt; 0)
&lt;/pre&gt;

&lt;p&gt;Notice the 0? &lt;a href="http://msdn.microsoft.com/en-us/library/ms740141(VS.85).aspx"&gt;MSDN&lt;/a&gt; states that it is:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;code&gt;nfds&lt;/code&gt;&lt;br /&gt;
  Ignored. The nfds parameter is included only for compatibility with Berkeley sockets.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Then I check the &lt;a href="http://linux.die.net/man/2/select"&gt;equivalent docs&lt;/a&gt; on the Linux side of things:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;code&gt;nfds&lt;/code&gt; is the highest-numbered file descriptor in any of the three sets, plus 1.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Well, if I set &lt;code&gt;nfds&lt;/code&gt; to 0, &lt;code&gt;select()&lt;/code&gt; won&amp;#8217;t be doing very much selecting! Windows has &lt;code&gt;FD_SETSIZE&lt;/code&gt; at 64 by default, and it ignores &lt;code&gt;nfds&lt;/code&gt; and just checks whatever descriptors are in the &lt;code&gt;fd_set&lt;/code&gt;s that you pass to it. Linux considers sockets and files the same thing, and thus has a much higher &lt;code&gt;FD_SETSIZE&lt;/code&gt; (1024 and 4096 seem to be common). You don&amp;#8217;t want &lt;code&gt;select()&lt;/code&gt; checking 4096 descriptors, so you set nfds to the highest file descriptor you want it to check, plus one. (As an aside, setting nfds to &lt;code&gt;FD_SETSIZE&lt;/code&gt; is a bad idea.)&lt;/p&gt;

&lt;pre class="prettyprint"&gt;if (select(my_socket + 1, &amp;amp;rdset, &amp;amp;wtset, &amp;amp;errset, &amp;amp;tv) &amp;gt; 0)
&lt;/pre&gt;

&lt;p&gt;Where &lt;code&gt;my_socket&lt;/code&gt; is an appropriate file descriptor (such as the one returned by &lt;code&gt;socket()&lt;/code&gt;). This works just fine in Windows too, since it ignores the &lt;code&gt;nfds&lt;/code&gt; parameter.&lt;/p&gt;

&lt;p&gt;Armed with this newfound knowledge, I go and fix all the other &lt;code&gt;select()&lt;/code&gt; statements in my code, which ends up fixing the weird pause as well. Effectively, without a proper &lt;code&gt;nfds&lt;/code&gt; value, &lt;code&gt;select()&lt;/code&gt; just acts as a timer and blocks until the specified amount of time has elapsed.&lt;/p&gt;</description>
    </item>
    <item>
      <title>All AJAX sites need a fancy indeterminate progress indicator...</title>
      <link>http://www.ffuts.org/blog/all-ajax-sites-need-a-fancy-indeterminate-progress/</link>
      <pubDate>Sun, 05 Apr 2009 20:22 -0700</pubDate>
      <guid>http://www.ffuts.org/blog/all-ajax-sites-need-a-fancy-indeterminate-progress/</guid>
      <description>&lt;p&gt;&lt;a href="http://www.ajaxload.info/"&gt;Ajaxload&lt;/a&gt; is a neat little site that generates those throbbers/spinning wheels that are in vogue nowadays. Your website/application won&amp;#8217;t be complete without one, after all.&lt;/p&gt;</description>
    </item>
    <item>
      <title>PNG has a well designed magic number (or FourCC)</title>
      <link>http://www.ffuts.org/blog/png-has-a-well-designed-magic-number-or-fourcc/</link>
      <pubDate>Fri, 03 Apr 2009 17:20 -0700</pubDate>
      <guid>http://www.ffuts.org/blog/png-has-a-well-designed-magic-number-or-fourcc/</guid>
      <description>&lt;p&gt;Even with all the XML floating around, binary formats still have their place. It&amp;#8217;s good practice to place an identifier at the beginning of the binary file, so that the file type can be determined even in the absence of a proper file extension.&lt;/p&gt;

&lt;p&gt;The simplest route to take is to just stuff some plain text there:&lt;/p&gt;

&lt;pre&gt;
[M Y F I L E][rest of file]
&lt;/pre&gt;

&lt;p&gt;However, consider following the design of the PNG magic number, described in detail in &lt;a href="http://www.libpng.org/pub/png/book/chapter08.html"&gt;the PNG book&lt;/a&gt;. With some really neat design they are able to quickly detect some common forms of corruption caused by an incompatible transfer mechanism. In that case your identifier may look like:&lt;/p&gt;

&lt;pre&gt;
[\211 M Y F I L E \r \n \032 \n][rest of file]
&lt;/pre&gt;

&lt;p&gt;With an identifier like this many common forms of transfer corruption can be quickly identified, and you can spit out a simple &amp;#8220;corrupt file&amp;#8221; message instead of trying to read a broken file.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Don't forget about copy constructors and the copy assignment operator</title>
      <link>http://www.ffuts.org/blog/dont-forget-about-copy-constructors-and-the-copy-assignment-operator/</link>
      <pubDate>Fri, 03 Apr 2009 12:30 -0700</pubDate>
      <guid>http://www.ffuts.org/blog/dont-forget-about-copy-constructors-and-the-copy-assignment-operator/</guid>
      <description>&lt;p&gt;Something that I&amp;#8217;ve always found handy to do is to decide, right away, what the copy semantics of a particular class are. Generally it turns out that it makes no sense (or is a lot of work) to allow copying, in which case the standard approach is to define the copy constructor and assignment operator as &lt;code&gt;private&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;An alternative approach and one that I think is a bit more self-documenting, is to inherit from &lt;a href="http://www.boost.org/doc/libs/1_38_0/libs/utility/utility.htm#Class_noncopyable"&gt;&lt;code&gt;boost::noncopyable&lt;/code&gt;&lt;/a&gt;. This achieves the same effect and makes it immediately obvious that the class will not allow copying.&lt;/p&gt;

&lt;pre class="prettyprint"&gt;class MyClass : boost::noncopyable { };
&lt;/pre&gt;

&lt;p&gt;The most correct way to use &lt;code&gt;boost::noncopyable&lt;/code&gt; is to inherit it privately, since inheriting it publicly could let people do really funny stuff like:&lt;/p&gt;

&lt;pre class="prettyprint"&gt;void stuff(const boost::noncopyable&amp;amp; obj);
&lt;/pre&gt;

&lt;p&gt;&lt;a href="http://groups.google.com/group/comp.lang.c++/browse_thread/thread/830d8840c2b86114"&gt;(more details here)&lt;/a&gt;&lt;/p&gt;</description>
    </item>
    <item>
      <title>A RapidXML gotcha</title>
      <link>http://www.ffuts.org/blog/a-rapidxml-gotcha/</link>
      <pubDate>Thu, 26 Mar 2009 13:00 -0700</pubDate>
      <guid>http://www.ffuts.org/blog/a-rapidxml-gotcha/</guid>
      <description>&lt;p&gt;I just spent a couple of hours trying to track down why I was seemingly losing data values while modifying nodes in the DOM. It&amp;#8217;s spelled out in the documentation, but it definitely threw me for a loop (I would consider this behavior surprising). Basically, RapidXML gives you the ability to assign/modify the value of a node and it also likes to create data nodes when you parse a document. When printing, the data node takes precedence over the value.&lt;/p&gt;

&lt;p&gt;When you create a document from scratch this likely won&amp;#8217;t bite you, but when you parse an existing document and neglect to supply the &lt;code&gt;parse_no_data_nodes&lt;/code&gt; flag, the parser creates data nodes. If you try to update your values with the &lt;code&gt;value()&lt;/code&gt; function, it works just fine (and you can even pull it back out without any problems), but when you use the &lt;code&gt;print()&lt;/code&gt; function, the data node (which you haven&amp;#8217;t updated) will show up instead.&lt;/p&gt;

&lt;p&gt;What made this even more difficult to track down was how &lt;code&gt;value()&lt;/code&gt; will return the first data node it finds if there isn&amp;#8217;t a value yet, so it really does seem like you have a value already. I&amp;#8217;ve updated my &lt;a href="http://www.ffuts.org/blog/quick-notes-on-how-to-use-rapidxml/"&gt;prior RapidXML entry&lt;/a&gt; to include the &lt;code&gt;parse_no_data_nodes&lt;/code&gt; flag, which may save someone some time down the road.&lt;/p&gt;</description>
    </item>
    <item>
      <title>shared_ptr is great...but sometimes auto_ptr is actually better!</title>
      <link>http://www.ffuts.org/blog/shared-ptr-is-greatbut-sometimes-auto-ptr-is-actua/</link>
      <pubDate>Sat, 21 Mar 2009 18:04 -0700</pubDate>
      <guid>http://www.ffuts.org/blog/shared-ptr-is-greatbut-sometimes-auto-ptr-is-actua/</guid>
      <description>&lt;p&gt;Modern C++ programming benefits greatly from smart pointers. Smart pointers automate the error-prone process of making sure you have a matching number of &lt;code&gt;new&lt;/code&gt; and &lt;code&gt;delete&lt;/code&gt; statements. There&amp;#8217;s even one included in the C++ standard library: &lt;code&gt;std::auto_ptr&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;It&amp;#8217;s not a true general purpose smart pointer, however. For one, it has somewhat unusual transfer-of-ownership semantics:&lt;/p&gt;

&lt;pre class="prettyprint"&gt;std::auto_ptr&amp;lt;MyClass&amp;gt; a(new MyClass());
std::auto_ptr&amp;lt;MyClass&amp;gt; b = a;
// a now points to nothing!
&lt;/pre&gt;

&lt;p&gt;This also makes it dangerous to use in containers, as described in &lt;a href="http://www.gotw.ca/publications/using_auto_ptr_effectively.htm"&gt;&lt;em&gt;Using auto_ptr Effectively&lt;/em&gt;&lt;/a&gt;. On the other hand, &lt;code&gt;shared_ptr&lt;/code&gt; (which will be available in the next C++ standard, C++0x, and is now available in the &lt;a href="http://www.boost.org/doc/libs/release/libs/smart_ptr/shared_ptr.htm"&gt;Boost libraries&lt;/a&gt;) is a reference counting smart pointer. It keeps track of the number of references to a particular object, and when there are no more references, it deletes the object. This is safe to use in containers. In fact, you can use &lt;code&gt;shared_ptr&lt;/code&gt; pretty much everywhere and you will never have to worry about manually releasing memory again (cycles and threading are pretty much the only major problems).&lt;/p&gt;

&lt;p&gt;However, while &lt;code&gt;shared_ptr&lt;/code&gt; is a great general purpose smart pointer, &lt;code&gt;auto_ptr&lt;/code&gt; has its uses. If you have a function that involves transfer-of-ownership semantics (whether receiving or giving), why not use the smart pointer that perfectly captures those requirements? The &amp;#8216;sources&amp;#8217; (creates and then gives away ownership) and &amp;#8216;sinks&amp;#8217; (takes ownership) described in the &lt;a href="http://www.gotw.ca/publications/using_auto_ptr_effectively.htm"&gt;&lt;em&gt;Using auto_ptr Effectively&lt;/em&gt;&lt;/a&gt; article is a prime example of this. Instead of using comments to specify that the caller of a function must manage the lifetime of the returned object, &lt;code&gt;auto_ptr&lt;/code&gt; forces them to manage it (and if they don&amp;#8217;t, it&amp;#8217;ll clean itself up anyway). &lt;code&gt;shared_ptr&lt;/code&gt; will likely work just as well, but it doesn&amp;#8217;t capture the semantics.&lt;/p&gt;

&lt;p&gt;Another noteworthy reason to use &lt;code&gt;auto_ptr&lt;/code&gt; when the semantics are suitable is that while &lt;code&gt;auto_ptr&lt;/code&gt; can give away ownership to &lt;code&gt;shared_ptr&lt;/code&gt;, &lt;code&gt;shared_ptr&lt;/code&gt; cannot give away ownership to &lt;code&gt;auto_ptr&lt;/code&gt; or another smart pointer (there is no &lt;code&gt;release()&lt;/code&gt; function in &lt;code&gt;shared_ptr&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;&lt;code&gt;auto_ptr&lt;/code&gt; is &lt;a href="http://www.informit.com/guides/content.aspx?g=cplusplus&amp;amp;seqNum=400"&gt;on its way to deprecation&lt;/a&gt;, but we haven&amp;#8217;t even seen C++0x yet, so I wouldn&amp;#8217;t worry too much about it. Its replacement, &lt;code&gt;unique_ptr&lt;/code&gt;, will have the same transfer-of-ownership semantics, just implemented in a much safer way, so it&amp;#8217;d be worth the effort to get used to using the right smart pointer for the job.&lt;/p&gt;

&lt;p&gt;Speaking of which, do you know what &lt;code&gt;scoped_ptr&lt;/code&gt; is?&lt;/p&gt;</description>
    </item>
    <item>
      <title>Don't spend time micromanaging optimization options in Visual C++</title>
      <link>http://www.ffuts.org/blog/dont-spend-time-micromanaging-optimization-options-in-visual-c/</link>
      <pubDate>Sat, 14 Mar 2009 14:37 -0700</pubDate>
      <guid>http://www.ffuts.org/blog/dont-spend-time-micromanaging-optimization-options-in-visual-c/</guid>
      <description>&lt;p&gt;It&amp;#8217;s surprisingly common to see people ask what the best Visual C++ optimization options are for their C++ code.&lt;/p&gt;

&lt;p&gt;The best answer is to profile and benchmark.&lt;/p&gt;

&lt;p&gt;Failing that, it&amp;#8217;s pretty simple. Use &lt;code&gt;/O2&lt;/code&gt; to optimize for speed, and &lt;code&gt;/O1&lt;/code&gt; to optimize for size. That&amp;#8217;s (almost) it. If you have a large program you will probably benefit more from optimizing for size:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Generally speaking, small applications should be compiled with /O2, and large applications should be compiled with /O1 because very large applications can end up putting a lot of stress on the instruction cache of the processor, and this can lead to worse performance. To minimize this, use /O1 to reduce the amount of &amp;#8220;code bloat&amp;#8221; introduced by the optimizer from certain transformations such a loop unrolling or selection of larger, faster sequences of code. [&lt;a href="http://msdn.microsoft.com/en-us/library/aa290055.aspx"&gt;MSDN&lt;/a&gt;]&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;But what about &lt;em&gt;Enable Intrinsic Functions&lt;/em&gt; (&lt;code&gt;/Oi&lt;/code&gt;), &lt;em&gt;Omit Frame Pointers&lt;/em&gt; (&lt;code&gt;/Oy&lt;/code&gt;), etc.?&lt;/p&gt;

&lt;p&gt;Check out the &lt;a href="http://msdn.microsoft.com/en-us/library/8f8h5cxt.aspx"&gt;documentation&lt;/a&gt; for &lt;code&gt;/O2&lt;/code&gt; and &lt;code&gt;/O1&lt;/code&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;/O1&lt;/code&gt; (Minimize Size) : Equivalent to /Og /Os /Oy /Ob2 /Gs /GF /Gy&lt;/li&gt;
&lt;li&gt;&lt;code&gt;/O2&lt;/code&gt; (Maximize Speed) : Equivalent to /Og /Oi /Ot /Oy /Ob2 /Gs /GF /Gy&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;They are already all specified. Yes, the property pages say &lt;em&gt;Disabled&lt;/em&gt; or &lt;em&gt;No&lt;/em&gt;, but what they really mean is &lt;em&gt;Default&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;The only general optimization I&amp;#8217;m aware of that doesn&amp;#8217;t fall in this category is &lt;em&gt;Whole Program Optimization&lt;/em&gt; (&lt;code&gt;/GL&lt;/code&gt;), which also requires &lt;em&gt;Link Time Code Generation&lt;/em&gt; (&lt;code&gt;/LTCG&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;Finally, what about &lt;em&gt;Full Optimization&lt;/em&gt; (&lt;code&gt;/Ox&lt;/code&gt;)?&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;In general, /O2 should be preferred over /Ox and /O1 over /Oxs. [&lt;a href="http://msdn.microsoft.com/en-us/library/59a3b321.aspx"&gt;MSDN&lt;/a&gt;]&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;[Edit: Note that there is an IDE bug in Visual Studio 2008 which may affect whether or not optimizations are applied. &lt;a href="http://www.ffuts.org/blog/optimization-switches-and-visual-studio-2008/"&gt;I write more about it here.&lt;/a&gt;]&lt;/p&gt;</description>
    </item>
    <item>
      <title>Several compilation options I use with C++ projects in Visual Studio</title>
      <link>http://www.ffuts.org/blog/several-compilation-options-i-use-with-c-project/</link>
      <pubDate>Thu, 12 Mar 2009 16:39 -0700</pubDate>
      <guid>http://www.ffuts.org/blog/several-compilation-options-i-use-with-c-project/</guid>
      <description>&lt;p&gt;These are compilation options that I typically enable for any C++ projects in Visual Studio. They should go in the project&amp;#8217;s property settings, under &lt;em&gt;Configuration Properties&lt;/em&gt;&amp;#8594;&lt;em&gt;C/C++&lt;/em&gt;&amp;#8594;&lt;em&gt;Command Line&lt;/em&gt;, in the &lt;em&gt;Additional options&lt;/em&gt; textbox. They are listed here exactly as they should be entered in that box (equal signs and all).&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;/MP&lt;/code&gt; : This enables multi-process compilation, which can provide a significant speed boost on the multi-core processor you likely have in your development (or build) machine. As the MSDN documentation states, it is not compatible with the &lt;em&gt;Enable Minimal Rebuild&lt;/em&gt; option, which, depending on the situation, may negate any performance advantage this switch has. Disabling minimal rebuild is not as bad as it sounds&lt;sup id="fnref:minimalrebuild"&gt;&lt;a href="#fn:minimalrebuild" rel="footnote"&gt;1&lt;/a&gt;&lt;/sup&gt; and in my projects I&amp;#8217;ve found that using &lt;code&gt;/MP&lt;/code&gt; confers a significant improvement in compilation time. You definitely want to enable it for &lt;em&gt;Release&lt;/em&gt; builds, at least. &lt;a href="http://msdn.microsoft.com/en-us/library/bb385193.aspx"&gt;Reference&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;/D_CRT_SECURE_NO_WARNINGS&lt;/code&gt; : This switch disables the warnings that Visual Studio spits out if you use any of the &lt;strong&gt;C&lt;/strong&gt; &lt;strong&gt;R&lt;/strong&gt;un&lt;strong&gt;T&lt;/strong&gt;ime functions that Microsoft has provided secure replacements for (such as &lt;code&gt;strncpy&lt;/code&gt;). This isn&amp;#8217;t necessarily a bad idea, but their safe functions are not part of the standard and are thus non-portable. &lt;a href="http://msdn.microsoft.com/en-us/library/8ef0s5kh.aspx"&gt;Reference&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;/D_SCL_SECURE_NO_WARNINGS&lt;/code&gt; : Just like the switch above, only for the &lt;strong&gt;S&lt;/strong&gt;tandard &lt;strong&gt;C&lt;/strong&gt;++ &lt;strong&gt;L&lt;/strong&gt;ibrary (anything in the &lt;code&gt;std&lt;/code&gt; namespace). &lt;a href="http://msdn.microsoft.com/en-us/library/aa985974.aspx"&gt;Reference&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;/D_SECURE_SCL=0&lt;/code&gt; : Disables checked iterators. Disabling this feature can improve performance when using iterators, at the expense of less protection against unsafe iterator use. Generally there isn&amp;#8217;t too much of a performance difference (a Visual C++ lead states that they measured about a 6% difference in &lt;a href="http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=105752"&gt;this feedback / bug page&lt;/a&gt;) so it may be worth leaving it on most of the time. &lt;a href="http://msdn.microsoft.com/en-us/library/aa985896.aspx"&gt;Reference&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Note that &lt;code&gt;/D_CRT_SECURE_NO_&lt;em&gt;WARNINGS&lt;/em&gt;&lt;/code&gt; and &lt;code&gt;/D_SCL_SECURE_NO_&lt;em&gt;WARNINGS&lt;/em&gt;&lt;/code&gt; are &lt;code&gt;/D_CRT_SECURE_NO_&lt;em&gt;DEPRECATE&lt;/em&gt;&lt;/code&gt; and &lt;code&gt;/D_SCL_SECURE_NO_&lt;em&gt;DEPRECATE&lt;/em&gt;&lt;/code&gt;, respectively, in versions prior to Visual Studio 2008.&lt;/p&gt;

&lt;div class="footnotes"&gt;
&lt;hr /&gt;
&lt;ol&gt;

&lt;li id="fn:minimalrebuild"&gt;
&lt;p&gt;Disabling Minimal Rebuild does not mean that the whole project gets rebuilt every time, just that Visual Studio uses a &amp;#8220;was this .cpp/.h modified?&amp;#8221; approach instead of trying to determine if the exact changes you made warrant a recompile.&amp;#160;&lt;a href="#fnref:minimalrebuild" rev="footnote"&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;

&lt;/ol&gt;
&lt;/div&gt;</description>
    </item>
    <item>
      <title>Stop wasting time stepping into functions you don't care about in Microsoft Visual Studio (C++)</title>
      <link>http://www.ffuts.org/blog/stop-wasting-time-stepping-into-functions-you-dont/</link>
      <pubDate>Mon, 09 Mar 2009 17:58 -0700</pubDate>
      <guid>http://www.ffuts.org/blog/stop-wasting-time-stepping-into-functions-you-dont/</guid>
      <description>&lt;p&gt;The Visual Studio debugger is amazingly useful. However, you soon learn to sigh the moment you come into contact with something like this:&lt;/p&gt;

&lt;pre class="prettyprint"&gt;boost::scoped_ptr&amp;lt;Startup&amp;gt; dlg(
    new Startup(settings-&amp;gt;GetWindowPosition()));
&lt;/pre&gt;

&lt;p&gt;You want to step into the &lt;code&gt;Startup&lt;/code&gt; constructor, but there is a lot of stuff in your way.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;First you will step into &lt;code&gt;shared_ptr::operator-&amp;gt;&lt;/code&gt; (did I mention that &lt;code&gt;settings&lt;/code&gt; was a &lt;code&gt;shared_ptr&lt;/code&gt;?).&lt;/li&gt;
&lt;li&gt;Then you will step into &lt;code&gt;GetWindowPosition()&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Then into &lt;code&gt;operator new&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;And then into your &lt;code&gt;Startup&lt;/code&gt; constructor. Yes!&lt;/li&gt;
&lt;li&gt;And finally you&amp;#8217;ll finish with the &lt;code&gt;scoped_ptr&lt;/code&gt; constructor if you so choose.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If you&amp;#8217;ve done this a lot you&amp;#8217;ve probably gotten really good at the &lt;em&gt;Step Out&lt;/em&gt; shortcut (Shift-F11).&lt;/p&gt;

&lt;p&gt;Well, here are two alternatives!&lt;/p&gt;

&lt;p&gt;First, while program execution is paused, right-click anywhere in the source window and look for the &lt;em&gt;Step Into Specific&lt;/em&gt; item. You can select any of these functions to instantly step inside.&lt;/p&gt;

&lt;p&gt;Alternatively, there is a special undocumented (and unsupported) registry key that you can use to specify functions that you always want to skip. Navigate to &lt;code&gt;HKLM\SOFTWARE\Microsoft\VisualStudio\9.0\NativeDE\StepOver&lt;/code&gt; (users of a 64-bit variant of Windows will want to check &lt;code&gt;HKLM\SOFTWARE\Wow6432Node\Microsoft\...&lt;/code&gt; instead) and add some string values like this example:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Name: 50 (priority, higher values have greater priority)&lt;br /&gt;
  Value: &lt;code&gt;std\:\:.*=NoStepInto&lt;/code&gt;&lt;/p&gt;
  
  &lt;p&gt;Name: 60&lt;br /&gt;
  Value: &lt;code&gt;operator new=NoStepInto&lt;/code&gt;&lt;/p&gt;
  
  &lt;p&gt;Name: 70&lt;br /&gt;
  Value: &lt;code&gt;boost\:\:.*=NoStepInto&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The backslashes are necessary because &lt;code&gt;:&lt;/code&gt; (colon) is a special character in &lt;a href="http://msdn.microsoft.com/en-us/library/2k3te2cs(VS.80).aspx"&gt;Visual Studio regex&lt;/a&gt;. You sometimes see two backslashes used in other examples, this is only necessary if you are directly editing a &lt;code&gt;.reg&lt;/code&gt; file (which I don&amp;#8217;t recommend). These rules will adjust the behaviour of the &lt;em&gt;Step-Into&lt;/em&gt; command and make it skip anything from the &lt;code&gt;std&lt;/code&gt; or &lt;code&gt;boost&lt;/code&gt; namespaces, as well as the basic &lt;code&gt;operator new&lt;/code&gt;. It will still step into an overloaded &lt;code&gt;operator new&lt;/code&gt;, so don&amp;#8217;t fear. There are more details on &lt;a href="http://blogs.msdn.com/andypennell/archive/2004/02/06/69004.aspx"&gt;this blog post&lt;/a&gt;, as well as &lt;a href="http://groups.google.com/group/microsoft.public.vsnet.debugging/msg/26addb1b539883e8"&gt;microsoft.public.vsnet.debugging&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;One more thing: you can combine these two approaches. Say that you&amp;#8217;ve added a skip for the entire &lt;code&gt;boost&lt;/code&gt; namespace, but you decide you really want to take a peek inside one particular line and see exactly what is happening to your parameters. Pause execution on that line, and then right-click and use &lt;em&gt;Step Into Specific&lt;/em&gt;. This is still the same list as before and it works the same as before, regardless of any NoStepInto rules.&lt;/p&gt;</description>
    </item>
    <item>
      <title>rwb_question, a FluxBB Captcha-Question extension</title>
      <link>http://www.ffuts.org/blog/rwb-question-a-fluxbb-captcha-question-extension/</link>
      <pubDate>Thu, 05 Mar 2009 15:16 -0700</pubDate>
      <guid>http://www.ffuts.org/blog/rwb-question-a-fluxbb-captcha-question-extension/</guid>
      <description>&lt;p&gt;Here&amp;#8217;s a quick little extension I wrote for the &lt;a href="http://fluxbb.org/"&gt;FluxBB&lt;/a&gt; forums. It lets you ask a simple question to the user which they must answer correctly in order to register. I find this sort of anti-spam solution more than enough for low traffic forums, and somewhat paradoxically more effective than a standard image based CAPTCHA (for small forums).&lt;/p&gt;

&lt;p&gt;This extension is for FluxBB v1.3-r718 and has not been tested on any other version of FluxBB. I imagine with a little modification it&amp;#8217;d work with PunBB as well, but that hasn&amp;#8217;t been tested. Install this extension by extracting it to your &lt;code&gt;/extensions&lt;/code&gt; folder, and then activate it through the admin control panel.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://s.ffuts.org/images/rwb_question_preview.png"&gt;&lt;img src="http://s.ffuts.org/images/rwb_question_preview_thumb.jpg" alt="rwb_question preview" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="http://s.ffuts.org/files/rwb_question.zip"&gt;Download rwb_question here.&lt;/a&gt;&lt;/p&gt;</description>
    </item>
    <item>
      <title>Boost.Thread triggers warning C4103 in Microsoft Visual Studio</title>
      <link>http://www.ffuts.org/blog/boostthread-triggers-warning-c4103-in-microsoft-vi/</link>
      <pubDate>Mon, 02 Mar 2009 17:28 -0700</pubDate>
      <guid>http://www.ffuts.org/blog/boostthread-triggers-warning-c4103-in-microsoft-vi/</guid>
      <description>&lt;p&gt;Got a whole mess of warnings when I moved some of my includes around, particularly this one: &lt;code&gt;#include &amp;lt;boost/thread.hpp&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;pre&gt;
abi_prefix.hpp(19) : warning C4103: 
'd:\boost\boost_1_38_0\boost\config\abi_prefix.hpp' : 
alignment changed after including header, may be due to missing 
#pragma pack(pop)
&lt;/pre&gt;

&lt;p&gt;Some experimentation reveals that including &lt;code&gt;thread.hpp&lt;/code&gt; before &lt;code&gt;winsock2.h&lt;/code&gt; triggers all these warnings. The simple solution is to just move &lt;code&gt;#include &amp;lt;boost/thread.hpp&amp;gt;&lt;/code&gt; down below &lt;code&gt;#include &amp;lt;winsock2.h&amp;gt;&lt;/code&gt;.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Building Boost (now with dual/quad/multi-core action!)</title>
      <link>http://www.ffuts.org/blog/building-boost-now-with-dual-quad-multi-core-action/</link>
      <pubDate>Mon, 02 Mar 2009 16:27 -0700</pubDate>
      <guid>http://www.ffuts.org/blog/building-boost-now-with-dual-quad-multi-core-action/</guid>
      <description>&lt;p&gt;&lt;em&gt;Update: More recent versions of Boost (1.39.0 and later) have a simpler build process, which I&amp;#8217;ve &lt;a href="http://www.ffuts.org/blog/an-update-on-building-boost-with-msvc-still-with-dual-quad-multi-core-action/"&gt;written about here&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Steps to build the non-header-only Boost libraries on Windows, such as &lt;code&gt;Boost.Thread&lt;/code&gt; and &lt;code&gt;Boost.Regex&lt;/code&gt;, using Microsoft Visual Studio:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="http://www.boost.org/users/download/"&gt;Download&lt;/a&gt; the latest version of Boost and extract it to some location, say, &lt;code&gt;D:\Boost\&lt;/code&gt;, making sure to maintain the directory structure&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="http://www.boost.org/users/download/"&gt;Download&lt;/a&gt; the latest version of Boost Jam (you want the ntx86 binaries) and extract it to some location (probably the same as above), again making sure to maintain the directory structure&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Your directory structure should now consist of &lt;code&gt;D:\Boost\boost_1_38_0\&lt;/code&gt; and &lt;code&gt;D:\Boost\boost-jam-3.1.17-1-ntx86\&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Make sure you have lots of hard drive space (at least 5GB)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;In a command prompt, navigate to your Boost library folder (&lt;code&gt;D:\Boost\boost_1_38_0\&lt;/code&gt;) and then use this command (read further down if you want details about what these arguments are doing):&lt;/p&gt;

&lt;pre&gt;
&amp;gt; ..\boost-jam-3.1.17-1-ntx86\bjam.exe --toolset=msvc --build-type=complete stage
&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If you have a dual/quad/many-core processor or can otherwise take advantage of parallel jobs, also add the &lt;code&gt;-jN&lt;/code&gt; switch, where &lt;code&gt;N&lt;/code&gt; is the number of jobs to run at a time (e.g. &lt;code&gt;bjam.exe -j4 --toolset=msvc&lt;/code&gt;).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;And wait. This will take a very long time.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;After it completes you will have a &lt;code&gt;stage&lt;/code&gt; subdirectory (&lt;code&gt;D:\Boost\boost_1_38_0\stage\&lt;/code&gt;) which will contain a &lt;code&gt;lib&lt;/code&gt; subdirectory, containing the compiled libraries. You may move these anywhere you wish.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You will also have a &lt;code&gt;bin.v2&lt;/code&gt; subdirectory which was used for temporary files. You may delete this folder to reclaim some hard drive space.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;More details:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;--toolset=msvc&lt;/code&gt; : tells Boost Jam to compile with Microsoft Visual Studio.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;--build-type=complete&lt;/code&gt; : notes that you want every possible combination built (Debug/Release, Multi/Single threaded, Static/Shared).&lt;/p&gt;

&lt;p&gt;&lt;code&gt;stage&lt;/code&gt; : a build target which builds the compiled libraries to the stage directory (which you can set with &lt;code&gt;--stagedir=&amp;lt;STAGEDIR&amp;gt;&lt;/code&gt;). Contrast this with the &lt;code&gt;install&lt;/code&gt; target, which builds the compiled libraries, but &lt;em&gt;also&lt;/em&gt; copies the header-only libraries to a particular location. This is generally an unnecessary step since you&amp;#8217;ve already extracted the Boost headers somewhere already. Look inside the &lt;code&gt;Jamroot&lt;/code&gt; file inside your Boost folder for more details.&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
