<?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>SIGTTOU &#187; Bob Somers</title>
	<atom:link href="http://sigttou.com/author/admin/feed" rel="self" type="application/rss+xml" />
	<link>http://sigttou.com</link>
	<description>Just another background process...</description>
	<lastBuildDate>Sun, 04 Jul 2010 02:08:28 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Compiling Lua with Visual Studio 2010</title>
		<link>http://sigttou.com/lua-visual-studio-2010-2</link>
		<comments>http://sigttou.com/lua-visual-studio-2010-2#comments</comments>
		<pubDate>Tue, 04 May 2010 06:03:15 +0000</pubDate>
		<dc:creator>Bob Somers</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[Scripting]]></category>

		<guid isPermaLink="false">http://sigttou.com/?p=193</guid>
		<description><![CDATA[It&#8217;s not often I have to venture into the Microsoftland development environment, but when I do it always seems to take me a while to get used to their visual projects instead of good &#8216;ole Makefiles. I&#8217;ve been using Lua &#8230; <a href="http://sigttou.com/lua-visual-studio-2010-2">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s not often I have to venture into the Microsoftland development environment, but when I do it always seems to take me a while to get used to their visual projects instead of good &#8216;ole Makefiles. I&#8217;ve been using Lua to extend my C and C++ apps a lot recently, so I suddenly found myself needing to include the Lua static library with a Visual Studio 2010 project.</p>
<p>There are already binary distributions out there, but I like to compile things myself, so I whipped up a Visual Studio 2010 project to compile the Lua static library (<code>lua.lib</code>) the command line interpreter (<code>lua.exe</code>) and the script compiler (<code>luac.exe</code>).</p>
<p>First things first. If you just want a zip file with those three binary files (the library is Visual Studio 2010 compatible), look no further:</p>
<ul>
<li><a href="http://sigttou.com/files/lua-5.1.4-bin-vs2010.zip">Lua 5.1.4 binaries compiled with VS 2010</a> (<code>lua</code>, <code>luac</code>, <code>lua.lib</code>, and necessary headers)</li>
</ul>
<p>If you want to build Lua 5.1.4 yourself (like me) just grab the most recent copy of the 5.1.4 source code from the <a href="http://www.lua.org">Lua website</a>. Next, grab these Visual Studio 2010 project files and solution file:</p>
<ul>
<li><a href="http://sigttou.com/files/lua-5.1.4-proj-vs2010.zip">Lua 5.1.4 Visual Studio 2010 projects</a> (to build the binaries yourself)</li>
</ul>
<p>To use the project files, just unzip them into the root directory of your Lua source files (where the <code>README</code>, <code>INSTALL</code>, and <code>COPYRIGHT</code> files are). Then, load up <code>lua-vs2010.sln</code> in Visual Studio 2010. You should see three projects. The first, <code>lualib</code> will build the static library under <code>lib/lua.lib</code>. The second and third, <code>lua</code> and <code>luac</code> will build the Lua interpreter and compiler under <code>bin/lua.exe</code> and <code>bin/luac.exe</code>.</p>
<p>Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://sigttou.com/lua-visual-studio-2010-2/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Installing TrueType Fonts in Fedora</title>
		<link>http://sigttou.com/fedora-truetype-fonts</link>
		<comments>http://sigttou.com/fedora-truetype-fonts#comments</comments>
		<pubDate>Thu, 15 Apr 2010 03:06:46 +0000</pubDate>
		<dc:creator>Bob Somers</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://sigttou.com/?p=180</guid>
		<description><![CDATA[I&#8217;ve haven&#8217;t written recently because I was completely bogged down finishing up my Bachelors degree and applying to grad schools, but here&#8217;s a quick tip for those of you looking for a painless way to install third party TrueType fonts &#8230; <a href="http://sigttou.com/fedora-truetype-fonts">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve haven&#8217;t written recently because I was completely bogged down finishing up my Bachelors degree and applying to grad schools, but here&#8217;s a quick tip for those of you looking for a painless way to install third party TrueType fonts in Fedora. This may work in other Linux distros, but Fedora is my distro of choice so that&#8217;s why it&#8217;s used here.</p>
<p>If you need to install fonts accessible to all users on the system, you have to do some more complicated voodoo. I hate voodoo, so I&#8217;m not going to cover that.</p>
<p>If all you need is to install a font for your own user, it&#8217;s just this simple:</p>
<p>Put your <code>myfont.ttf</code> file in your home directory, under directory called <code>/.fonts/</code>. So in other words, your font lives at:</p>
<p><code>/home/youruser/.fonts/myfont.ttf</code></p>
<p>Create the directory if it doesn&#8217;t already exist. Finally, restart any application you want to use that font in, and you should see it show up. You&#8217;re good to go.</p>
]]></content:encoded>
			<wfw:commentRss>http://sigttou.com/fedora-truetype-fonts/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fixing the Fedora 12 VirtualBox Guest Additions problem</title>
		<link>http://sigttou.com/fedora12-virtualbox-fix</link>
		<comments>http://sigttou.com/fedora12-virtualbox-fix#comments</comments>
		<pubDate>Fri, 08 Jan 2010 05:26:30 +0000</pubDate>
		<dc:creator>Bob Somers</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://sigttou.com/?p=167</guid>
		<description><![CDATA[I&#8217;m a frequent VirtualBox user, and as I&#8217;ve noted in my previous posts, I&#8217;m an avid fan of Fedora as well. However, there is a nasty bug in the most recent version of VirtualBox (3.1.2) when combined with Fedora 12. &#8230; <a href="http://sigttou.com/fedora12-virtualbox-fix">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m a frequent <a href="http://www.virtualbox.org/">VirtualBox</a> user, and as I&#8217;ve noted in my previous posts, I&#8217;m an avid fan of <a href="http://fedoraproject.org/">Fedora</a> as well.</p>
<p>However, there is a nasty bug in the most recent version of VirtualBox (3.1.2) when combined with Fedora 12. After installing the Guest Additions kernel modules <a href="http://www.virtualbox.org/manual/UserManual.html#id2507643">as per the user docs</a>, the system boots to a black screen with a cryptic error message that looks like a SELinux labeling problem (it&#8217;s not).</p>
<p><code>type=1305 audit(12587840002.571:32444): audit_enabled=0 old=1 auid=4294967295 ses=4294967295 subj=system_u:system_r:readahead_t:s0 res=1</code></p>
<p>The problem is actually with the Guest Additions video driver, the one that gives you the nice resizable desktop window. Once the driver is built and installed, for some reason the X server can&#8217;t find any screens and refuses to start.</p>
<p>Until the bug gets fixed in the video driver, here&#8217;s how you can fix the system so that it will boot correctly, although you&#8217;ll lose the dynamic resizing ability. You&#8217;ll have to stick with fixed, predefined resolutions for now.</p>
<ol>
<li>Mount a Fedora 12 ISO, such as the full or network install discs, and boot to it. Boot into Rescue Mode from the GRUB bootloader screen.</li>
<li>Breeze through the language and network options, but be sure to have it mount your hard disk image (it will mount under /mnt/sysimage).</li>
<li>Drop into a shell and change into your hard disk&#8217;s X11 config directory, so that would be:<br />
<code>cd /mnt/sysimage/etc/X11</code></li>
<li>Edit your xorg.conf file&#8230; but wait! In Fedora 12, they switched to HAL for X configuration, so there is no xorg.conf file! Never fear, you just need to create one and it will override the HAL:<br />
<code>vi xorg.conf</code></li>
<li>Now, use the following settings for the new xorg.conf file:
<pre>
Section "Device"
    Identifier "Configured Video Device"
    Driver "vboxvideo"
EndSection

Section "Monitor"
    Identifier "Configured Monitor"
EndSection

Section "Screen"
    Identifier "Configured Screen"
    Monitor "Configured Monitor"
    Device "Configured Video Device"
    SubSection "Display"
        Depth 24
        Modes "1440x900" "1680x1050"
    EndSubSection
EndSection

Section "InputDevice"
    Identifier "vboxmouse"
    Driver "vboxmouse"
    Option "CorePointer"
    Option "Device" "/dev/input/mice"
EndSection

Section "ServerLayout"
   Identifier   "Default Layout"
   Screen      "Configured Screen"   0 0
   InputDevice   "vboxmouse"
EndSection
</pre>
</li>
<li>You&#8217;ll see I&#8217;ve defined two resolutions, 1440&#215;900 and 1680&#215;1050. What this allows me to do is work windowed at 1440&#215;900 and if I want to go full screen (remember, dynamic resizing won&#8217;t work) I can hit the full screen shortcut in VirtualBox (Host+F) and change the resolution within Fedora to match my screen res.</li>
<li>Save from vi (:wq) and reboot the system. Remember to unmount the install disc! The system should boot correctly now, albeit without dynamic resizing.</li>
</ol>
<p>A huge thanks goes out to <a href="http://forums.virtualbox.org/viewtopic.php?f=7&#038;t=24851">Jits in the VirtualBox forums</a> for this fix!</p>
]]></content:encoded>
			<wfw:commentRss>http://sigttou.com/fedora12-virtualbox-fix/feed</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Include dependencies</title>
		<link>http://sigttou.com/include-dependencies</link>
		<comments>http://sigttou.com/include-dependencies#comments</comments>
		<pubDate>Tue, 22 Dec 2009 06:56:46 +0000</pubDate>
		<dc:creator>Bob Somers</dc:creator>
				<category><![CDATA[C/C++]]></category>
		<category><![CDATA[Code]]></category>

		<guid isPermaLink="false">http://sigttou.com/?p=139</guid>
		<description><![CDATA[Generally when I write software, I try to keep things relatively well organized. Inevitably, however, things are going to get a bit messy, especially if you&#8217;re working on a large, disorganized codebase that you didn&#8217;t write to begin with&#8230; say, &#8230; <a href="http://sigttou.com/include-dependencies">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Generally when I write software, I try to keep things relatively well organized. Inevitably, however, things are going to get a bit messy, especially if you&#8217;re working on a large, disorganized codebase that you didn&#8217;t write to begin with&#8230; say, oh&#8230; something like the <a href="http://developer.valvesoftware.com">Source SDK</a>.</p>
<p>Frequently you have some class which is composed inside another class, but occasionally needs to access the class it&#8217;s composed inside of. Basically, the classes are composed inside each other, though the abstraction really only makes sense in one direction. Confused yet?</p>
<p>In this example, we&#8217;ll use a Refrigerator class which stores inside it an instance of a Cheese class. Why cheese, you ask? Because cheese is delicious. Also, our refrigerator is from the future and can slice and serve cheese just like the built in ice maker and water dispenser. It&#8217;s a pretty sweet fridge.</p>
<p>Now, we were all taught to keep our <code class="prettyprint">#include</code>s in our header files, not the implementation files, so like good little programmers we construct our classes like so:</p>
<p><strong>refrigerator.h</strong></p>
<pre class="prettyprint">#include "cheese.h"

class Refrigerator {
private:
    Cheese *pCheese;
    int temp = 35;

public:
    void ServeCheese();
    int GetTemp();
};</pre>
<p><strong>refrigerator.cpp</strong></p>
<pre class="prettyprint">#include "refrigerator.h"

void Refrigerator::ServeCheese() {
    printf("Now dispensing %s cheese!\n", pCheese->GetFlavor());
}

int Refrigerator::GetTemp() {
    return temp;
}</pre>
<p><strong>cheese.h</strong></p>
<pre class="prettyprint">class Cheese {
private:
    Refrigerator *pFridge;
public:
    char *GetFlavor();
    void CheckTemp();
    void BeginMolding();
};</pre>
<p><strong>cheese.cpp</strong></p>
<pre class="prettyprint">#include "cheese.h"

void Cheese::CheckTemp() {
    if (pFridge->GetTemp() > 45) {
        BeginMolding();
    }
}

char *Cheese::GetFlavor() {
    return "cheddar";
}
</pre>
<p>I&#8217;ve left out the constructors in this example for brevity, but let&#8217;s assume that they get the pointers set up correctly so that our instance of the Refrigerator class has a correct pointer to an instance of the Cheese class and vice versa.</p>
<p>Now, at this point you may be screaming that this needs to be refactored and reorganized. Yes, it probably does. But there are many instances where you simply can&#8217;t, and in fact the abstraction really only makes sense one way. The fridge has cheese in it, but the cheese certainly doesn&#8217;t have a fridge in it. We just need that pesky reference around so we can check the temperature of the fridge every so often.</p>
<p><em>(Yes, I am aware that the fridge could push it&#8217;s temperature down to all the items in it, ala the <a href="http://en.wikipedia.org/wiki/Observer_pattern">Observer Pattern</a>. Yes I am aware that would be a better solution. But this is a contrived example anyway, so stick with me here.)</em></p>
<p>Now, the code given above doesn&#8217;t compile, because the Cheese class has no idea what the heck this Refrigerator class is, so we either need to include it or forward declare it. If we try to do this:</p>
<p><strong>cheese.h</strong></p>
<pre class="prettyprint">#include "refrigerator.h"</pre>
<p>our compiler (more specifically, the preprocessor) is going to get very angry at us, depending on which order it decides to compile refrigerator and cheese. The solution, is a forward delcaration:</p>
<p><strong>cheese.h</strong></p>
<pre class="prettyprint">class Refrigerator;

class Cheese {
    // ...etc...
};</pre>
<p>Basically what this does is tell the compiler, &#8220;Hey! There&#8217;s this class called Refrigerator that I might talk about, so here&#8217;s an empty declaration of it!&#8221;</p>
<p>The problem, though, is that this is rather limiting. Within the Cheese class, we can declare pointers to Refrigerator class, no problem. Pointers are of fixed size, so the compiler doesn&#8217;t much what care what it&#8217;s a pointer <strong><em>to</em></strong>, since it knows how much memory it needs to hold a pointer to it. When we try to access members of the class, though, like properties or methods, it falls apart because as far as the compiler knows, the class is empty. After all, we told it the Refrigerator class didn&#8217;t have anything in it.</p>
<p>So if we can&#8217;t <code class="prettyprint">#include</code> it and forward declaring it doesn&#8217;t give us what we want, what can we do?</p>
<p>Well, we can do <strong>both</strong>. Kind of.</p>
<p>The solution is to forward declare in your header file, and <code>#include</code> in your implementation file. This will avoid the preprocessor headaches of of the chicken and egg <code class="prettyprint">#include</code>, while allowing us to access the members of forward declared class in the implementation. In other words, here&#8217;s the fix:</p>
<p><strong>cheese.h</strong></p>
<pre class="prettyprint">class Refrigerator;

class Cheese {
    ...
};</pre>
<p><strong>cheese.cpp</strong></p>
<pre class="prettyprint">#include "cheese.h"
#include "refrigerator.h"
</pre>
<p>Again, it goes without saying, the better solution is to refactor or rearchitect your code if you can. These kind of hacks can get really out of hand and are usually a good <a href="http://en.wikipedia.org/wiki/Code_smell">code smell</a> that something needs to be fixed at a deeper level. However, if you&#8217;re working on a large codebase that you can&#8217;t change, this can help out a lot.</p>
]]></content:encoded>
			<wfw:commentRss>http://sigttou.com/include-dependencies/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Removing entities in the Source SDK</title>
		<link>http://sigttou.com/removing-entities</link>
		<comments>http://sigttou.com/removing-entities#comments</comments>
		<pubDate>Sat, 24 Oct 2009 23:54:49 +0000</pubDate>
		<dc:creator>Bob Somers</dc:creator>
				<category><![CDATA[C/C++]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[Gaming]]></category>

		<guid isPermaLink="false">http://sigttou.com/?p=133</guid>
		<description><![CDATA[I haven&#8217;t written for a while, mainly because I&#8217;ve been busy with classes and studying for the GRE for my grad school applications, but here&#8217;s a quick tip for those of you meddling around with the Source SDK. It&#8217;s well &#8230; <a href="http://sigttou.com/removing-entities">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I haven&#8217;t written for a while, mainly because I&#8217;ve been busy with classes and studying for the GRE for my grad school applications, but here&#8217;s a quick tip for those of you meddling around with the Source SDK.</p>
<p>It&#8217;s well documented on how you go about spawning entities, but I couldn&#8217;t find a good place explaining how to <em>remove</em> spawned entities through code.</p>
<p><strong>Don&#8217;t</strong> try meddling with the global entity list (<code class="prettyprint">gEntList</code>) or calling its <code class="prettyprint">RemoveEntity()</code> method. It doesn&#8217;t do what you want.</p>
<p><strong>Instead</strong>, used one of the super-handy <code class="prettyprint">UTIL_*</code> functions. Given a pointer to the entity you want to remove, simply use:</p>
<p><code class="prettyprint">UTIL_Remove(pEntity);</code></p>
<p>Poof. Entity gone. Remember, entities are created and destroyed on the <strong>server side only.</strong> The server will automatically broadcast any changes to the entity list to its connected clients for you.</p>
]]></content:encoded>
			<wfw:commentRss>http://sigttou.com/removing-entities/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dual videocards without SLI</title>
		<link>http://sigttou.com/dual-videocards</link>
		<comments>http://sigttou.com/dual-videocards#comments</comments>
		<pubDate>Tue, 22 Sep 2009 08:03:39 +0000</pubDate>
		<dc:creator>Bob Somers</dc:creator>
				<category><![CDATA[Gaming]]></category>
		<category><![CDATA[Hardware]]></category>

		<guid isPermaLink="false">http://sigttou.com/?p=118</guid>
		<description><![CDATA[I just recently upgraded my workstation to a quad monitor setup, because you can never have enough screen real estate. I originally had a dual-monitor setup on a single videocard, an nVidia GeForce 8800 GT. A friend of mine sold &#8230; <a href="http://sigttou.com/dual-videocards">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I just recently upgraded my workstation to a quad monitor setup, because you can never have enough screen real estate. I originally had a dual-monitor setup on a single videocard, an nVidia GeForce 8800 GT.</p>
<p>A friend of mine sold me 2 older 19&#8243; flat panels for just $50, but I needed a second videocard to drive the extra displays. Although I absolutely detest shopping there and I avoid it at all costs, I picked up a GeForce 9800 GT from Best Buy. Don&#8217;t worry, it was on sale so I was getting screwed slightly less than usual.</p>
<p>Interestingly enough, the 9800 is practically identical to the 8800. The two biggest differences are the move to the smaller manufacturing process (55nm from 65nm) and an updated BIOS on the card. This particular model is made by PNY and is tagged with an &#8220;EE&#8221; at the end to denote that it&#8217;s an &#8220;Energy Efficient&#8221; edition. Basically it means that it doesn&#8217;t require the standard 6-pin PCI-E graphics card power connection from your PSU. It draws all of it&#8217;s power (only 66 watts under full load!) from the PCI-E bus. Thankfully my 550 watt power supply is beefy enough to drive both cards without breaking a sweat.</p>
<p>Installation was simple enough. Getting Windows XP to recognize the second card was another story, though.</p>
<p>See, what you&#8217;re supposed to be able to do is just drop the card into the second slot and when you reboot, Windows will happily say &#8220;Wow, cool, nice new videocard! Lemme install those drivers for ya so you can get started experiencing multi-monitor bliss!&#8221; In fact, my copy of Windows just said &#8220;New videocard? Huh? Nobody tells me nutin&#8217;.&#8221;</p>
<p>And thus the issue debugging begins. I really hate this part.</p>
<p>First up was checking that the card was seated correctly. In the process of reseating the card, I noticed a small daughter card between my videocard slots that allowed you to specify if you were using single or dual videocards. &#8220;Sweet,&#8221; I thought, &#8220;this is the problem right here. I swapped the daughter card around to &#8220;dual videocards&#8221;Â  and booted up the rig.</p>
<p>No dice.</p>
<p>Next I thought perhaps the nVidia drivers only detected new cards when they were installed. I wiped off the current nVidia drivers and downloaded the latest copy. After reinstalling the video drivers, Windows still had no idea the second videocard was even there.</p>
<p>As I was double checking my motherboard manual to make sure dual videocards <em><strong>without</strong></em> SLI was indeed supported, I noticed that when one card is installed it runs at 16x speed. When two cards are installed, however, it splits the PCI-E bus and runs both cards in x8. &#8220;Perfect,&#8221; I thought, &#8220;I&#8217;ll just check the bus speed to see if the motherboard even sees the card.&#8221;</p>
<p>After locating the window in the nVidia control panel that shows you the PCI-E bus stats, I verfied that indeed, my single card (the 8800 GT) was running in x8. The motherboard was detecting the second card.</p>
<p>By this point, you&#8217;re probably wondering why I was using the 9800 GT (the newer card) as my secondary graphics card and the older 8800 GT as the primary card.</p>
<p>The only negative comment I found when looking through reviews of the PNY 9800 GT EE was that for some reason the fan seemed locked to 45% speed. Normally the fan spins up as necessary to cool offÂ  the card under higher load, but this card didn&#8217;t seem to do that. You can adjust the fan speed manually through the nTune software, but I didn&#8217;t particularly feel like adjusting this every time I played a game, or have my computer sound like a Harrier jet 24/7. (It already sounds like a idling tractor.) Since the cards are practically identical performance-wise, I figured I&#8217;d leave the 8800 pulling gaming duty while the 9800 only had to push out the pixels to the 2 new monitors.</p>
<p>Since the 9800 wasn&#8217;t being detected by Windows, I then figured that maybe I&#8217;d try swapping the cards. After installing the 9800 in the primary slot and the 8800 in the secondary slot, I was greeted to a driver installation of my 9800, but my 8800 was nowhere to be found. At this point, I was seriously worried that somehow my motherboard&#8217;s second PCI-E slot was unusable.</p>
<p>I gave it one last hurrah and swapped the cards back. As soon as I booted up, I was greeted by nVidia&#8217;s multi-monitor setup wizard and Windows dutifully installing the 9800 drivers again. All four monitors were working.</p>
<p><strong>Moral of the story:</strong> If your secondary card isn&#8217;t getting detected, install it in the primary slot and give Windows a chance to see it and install the drivers. Then swap it back to the secondary slot.</p>
<p>Lastly, this post couldn&#8217;t possibly be complete without pictures!</p>
<div id="attachment_122" class="wp-caption alignnone" style="width: 493px"><img class="size-full wp-image-122 " title="Quad Monitors" src="http://sigttou.com/wp-content/uploads/quad_monitors1.jpg" alt="Four monitors means I can get my LCD tan 4 times quicker. I better get some more sunscreen!" width="483" height="362" /><p class="wp-caption-text">Four monitors means I can get my LCD tan 4x quicker!</p></div>
<div id="attachment_124" class="wp-caption alignnone" style="width: 493px"><img class="size-full wp-image-124 " title="Quad Monitors TF2" src="http://sigttou.com/wp-content/uploads/quad_monitors2.jpg" alt="Playing Team Fortress 2 across three screens is only one of many uses!" width="483" height="362" /><p class="wp-caption-text">Playing Team Fortress 2 across three screens is only one of many uses!</p></div>
<p>If you&#8217;re feeling particularly brave, check out these screenshots to see what I&#8217;m seeing when I play Team Fortress 2. Thanks to the <a title="SoftTH gives you software triple head." href="http://www.kegetys.net/SoftTH/" target="_blank">SoftTH</a> utility, I can get triple head gaming without the Matrox hardware adapter!</p>
<div id="attachment_126" class="wp-caption alignnone" style="width: 310px"><a href="http://sigttou.com/wp-content/uploads/plrpipeline1.jpg"><img class="size-medium wp-image-126" title="plr_pipeline as Pyro" src="http://sigttou.com/wp-content/uploads/plrpipeline1-300x62.jpg" alt="plr_pipeline as Pyro with SoftTH" width="300" height="62" /></a><p class="wp-caption-text">plr_pipeline as Pyro with SoftTH</p></div>
<div id="attachment_127" class="wp-caption alignnone" style="width: 310px"><a href="http://sigttou.com/wp-content/uploads/plrpipeline2.jpg"><img class="size-medium wp-image-127" title="plr_pipeline as Soldier" src="http://sigttou.com/wp-content/uploads/plrpipeline2-300x62.jpg" alt="plr_pipeline as Soldier with SoftTH" width="300" height="62" /></a><p class="wp-caption-text">plr_pipeline as Soldier with SoftTH</p></div>
]]></content:encoded>
			<wfw:commentRss>http://sigttou.com/dual-videocards/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Awesome regex test tool</title>
		<link>http://sigttou.com/regex-test-tool</link>
		<comments>http://sigttou.com/regex-test-tool#comments</comments>
		<pubDate>Sat, 05 Sep 2009 06:27:44 +0000</pubDate>
		<dc:creator>Bob Somers</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://sigttou.com/?p=113</guid>
		<description><![CDATA[So I&#8217;m working with a friend to develop a regex that matches something out of an API response, when we really wish we could quickly prototype a regex. Now, there are plenty of tools to do this, some are even &#8230; <a href="http://sigttou.com/regex-test-tool">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>So I&#8217;m working with a friend to develop a regex that matches something out of an API response, when we really wish we could quickly prototype a regex. Now, there are plenty of tools to do this, some are even freeware, but all them need to be downloaded and installed. I realize it sounds pathetic to say that I was too lazy to download and install a tool, but to be honest I really don&#8217;t need more tiny, rarely-used apps cluttering up my system. There&#8217;s <em>got</em> to be a web-based tool to do this, I thought.</p>
<p>Google did not disappoint. I found this <strong>awesome</strong> web-based regex test tool built on Adobe Flex called <a href="http://gskinner.com/RegExr/">RegExr</a>. If you&#8217;ve got Flash installed, it runs right in your browser.</p>
<p>Not only does it show you what it&#8217;s matching live as you type, what your match groups contain, what each chunk of your regex means, etc., but it&#8217;s also got a phenomenal quick-reference sidebar for all those handy meta-characters. You can even save your favorite regexs and browse other people&#8217;s favorite submissions.</p>
<p>We need more tools like this. I was able to quickly and easily prototype a regex in no time at all, and the app took about 10 seconds to figure out how to use.</p>
<p>Thanks, <a href="http://gskinner.com">gskinner.com</a>! You guys are awesome!</p>
]]></content:encoded>
			<wfw:commentRss>http://sigttou.com/regex-test-tool/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Know your text editor</title>
		<link>http://sigttou.com/know-your-text-editor</link>
		<comments>http://sigttou.com/know-your-text-editor#comments</comments>
		<pubDate>Thu, 23 Jul 2009 02:41:36 +0000</pubDate>
		<dc:creator>Bob Somers</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Tools]]></category>

		<guid isPermaLink="false">http://sigttou.com/?p=81</guid>
		<description><![CDATA[Let&#8217;s examine why it&#8217;s important as a programmer to really know your text editor, but in a different light that usual. Traditionally programmers are concerned with knowing all the tricks of their editor so that they can make use of &#8230; <a href="http://sigttou.com/know-your-text-editor">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Let&#8217;s examine why it&#8217;s important as a programmer to really know your text editor, but in a different light that usual. Traditionally programmers are concerned with knowing all the tricks of their editor so that they can make use of them. Instead, let&#8217;s look at an example of why you should know what your editor does so it doesn&#8217;t screw you over.</p>
<p>Today at work a coworker received a large volume of joke emails telling them how bad their coding style was, with links to example code telling them to &#8220;learn how to program&#8221;. This was in response to what he thought was a simple 6-line change, but was actually a 22,000-line &#8220;oops&#8221;.</p>
<p>He opened up a file that&#8217;s roughly 25,000 lines (let&#8217;s not get into why it&#8217;s that long&#8230;) to make a simple change. After adding about 6 lines, he saved, quit, and committed the change to the repository. His editor of choice is vim (as is mine).</p>
<p>For those of you unfamiliar with vim, it&#8217;s a text-based editor that has a fairly steep learning curve. It takes years to truly master, but the power it offers you is incredible. In vim you start in command mode, which let you enter vim commands much like you would on a command line. You can switch to insert mode to actually insert text into your document, or other modes for formatting and whatnot.</p>
<p>Well in this case, the programmer accidentally brushed the escape key while he was typing, which brought him out of insert mode and into command mode. What he thought was being typed into a comment in his code was actually being typed into the vim command line. He must have brushed some other keys as well, because here&#8217;s the unfortunate key sequence that he ended up entering:</p>
<pre>:% &lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;</pre>
<p>For those of you not well-versed in vim commands, here&#8217;s an explanation. The colon starts a command, and the % symbol is like a wildcard for the command, applying it to the entire file instead of the current selection. Each <code>&lt;</code> character shifts the current selection one tab stop to the left. Similarly, the <code>&gt;</code> character shifts the current selection one tab stop to the right. It&#8217;s phenomenally handy for quickly adjusting the level that a block of code is indented.</p>
<p>However, what that above command will do is basically crush every level of indention against the left margin, and then apply that to the entire file. What you end up with is having every line of your beautifully indented code smashed down to column 0. No indention. None.</p>
<p>As vim was updating this change to the swap file (remember, there were 25,000 lines) he saved and quit. The file had been updated, but his screen had not, so he had no idea he&#8217;d accidentally just nuked the indention of the entire file.</p>
<p>It was his commit to the repository that threw up the red flag. This was supposed to be a small bug fix. However, the commit email, sent out to the entire mailing list, contained a 22,000 line diff. Woops.</p>
<p>After looking at the changes and chuckling over the fact that the file was completely unreadable now, many people on the coding team sent him joke emails about &#8220;what crappy coding style&#8221; he had, with links to &#8220;learn how to program&#8221;.</p>
<p>Now, naturally this took only about 2 seconds to fix, since the code was under source control. But the point still stands. Not only learn your editor, but watch it with a careful eye when you&#8217;re working with it, lest all those features that are there to increase productivity turn against you.</p>
]]></content:encoded>
			<wfw:commentRss>http://sigttou.com/know-your-text-editor/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ban programmers, not functions</title>
		<link>http://sigttou.com/ban-programmers-not-functions</link>
		<comments>http://sigttou.com/ban-programmers-not-functions#comments</comments>
		<pubDate>Tue, 07 Jul 2009 19:35:16 +0000</pubDate>
		<dc:creator>Bob Somers</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://sigttou.com/?p=71</guid>
		<description><![CDATA[So my daily travels around the intertubes landed me on a very interesting blog post by Microsoft&#8217;s Security Development Lifecycle team (which they call SDL, not to be confused with the arguably more useful Simple DirectMedia Layer library). The post &#8230; <a href="http://sigttou.com/ban-programmers-not-functions">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>So my daily travels around the intertubes landed me on a very interesting <a href="http://blogs.msdn.com/sdl/archive/2009/05/14/please-join-me-in-welcoming-memcpy-to-the-sdl-rogues-gallery.aspx">blog post by Microsoft&#8217;s Security Development Lifecycle team</a> (which they call SDL, not to be confused with the arguably more useful <a href="http://www.libsdl.org/">Simple DirectMedia Layer</a> library). The post centered around them adding <code class="prettyprint">memcpy()</code> to the banned functions list in favor of their more &#8220;secure&#8221; variant, <code class="prettyprint">memcpy_s()</code>, which takes and checks the size of the destination buffer.</p>
<p>Before I explain why I think this is another example of Microsoft spending their time doing something incredibly useless instead of innovating, let me explain that all these blasted <code class="prettyprint">_s</code> functions are one of the reasons I detest the Windows API so much.</p>
<p>I had the unfortunate &#8220;pleasure&#8221; of digging rather deep into the Windows API for a project I was working on this past spring quarter. For those of you who haven&#8217;t ventured into the Windows API, let me say this: It&#8217;s so incredibly confusing that it doesn&#8217;t even look like C anymore.</p>
<p>Almost everything uses custom types, even when there&#8217;s no logical reason to do so. The Linux API does this to some extent, but not nearly as bad as Microsoft.</p>
<p>Secondly, there seems to be no rhyme or reason as to what these types are named. Some are named as <code class="prettyprint">ALL_CAPITALS_TYPE</code>, others <code class="prettyprint">_use_this_strange_underscore_prefix</code>, and some use the standard <code class="prettyprint">type_t</code>. If you start to use almost any standard library C function, you&#8217;ll inevitably be told by the compiler that you&#8217;re doing it wrong, and should use <code class="prettyprint">strcpy_s()</code>, or <code class="prettyprint">_strcpy_s()</code>, or <code class="prettyprint">_s_t_r_c_p_y_s_()</code>. Seriously, their API has got more underscores than Bill Gates has dollar bills.</p>
<p>What this gives you is this strange, alien language that vaguely resembles C, but is so ugly and hideous that you&#8217;re afraid to touch it. Apple has Objective-C. Microsoft has Franken-C.</p>
<p>So let me back up and explain this blog post I mentioned earlier. I&#8217;m a bit behind on this one (I&#8217;ll admit I&#8217;m not often found venturing into the MSDN blogs) but back in May the SDL announced that they were adding <code class="prettyprint">memcpy()</code> to their banned functions list, to join <code class="prettyprint">strcpy()</code>, <code class="prettyprint">strcat()</code>, <code class="prettyprint">strncpy()</code>, <code class="prettyprint">strncat()</code>, <code class="prettyprint">gets()</code>, and others.</p>
<p>They announced it&#8217;s replacement, <code class="prettyprint">memcpy_s()</code> (soon to be replaced by <code class="prettyprint">_memcpy_s()</code> and <code class="prettyprint">_m_e_m_c_p_y_s_()</code> I&#8217;m sure), which takes one additional argument: the size of the destination buffer.</p>
<p>This is aimed make usages of <code class="prettyprint">memcpy()</code> more secure, by only copying up to the size of the destination buffer bytes, even if that&#8217;s less than the length of the bytes you want to copy. You go from using this:</p>
<pre class="prettyprint">memcpy(dst, src, len);</pre>
<p>to using this:</p>
<pre class="prettyprint">memcpy_s(dst, sizeof(dst), src, len);</pre>
<p>This sounds reasonable, except most Windows programmers will just do this:</p>
<pre class="prettyprint">memcpy_s(dst, len, src, len);</pre>
<p>which makes your &#8220;secure&#8221; version useless.</p>
<p>The problem here is not that <code class="prettyprint">memcpy()</code> doesn&#8217;t check the size of the destination buffer, but rather that some programmers are using it without thinking. A 50 caliber sniper rifle is a very powerful tool in the hands of a marksman, but in a cage full of chimpanzees, the results could be disastrous.</p>
<blockquote><p>If nothing else, memcpy_s() makes you think about the size of the target buffer.</p></blockquote>
<p>I suppose, unless you&#8217;re one of the mindless programmers using <code class="prettyprint">memcpy()</code> unsafely before, in which case you&#8217;ll learn the new and improved mindless version <code class="prettyprint">memcpy_s(dst, len, src, len)</code> and continue on your merry way.</p>
<p>My point here is that banning functions that are the common source of security vulnerabilities doesn&#8217;t fix the problem, because the problem isn&#8217;t with the functions. These functions are well documented and we know exactly how they work and what their dangers are. <strong>The problem is with the programmers.</strong></p>
<p>You&#8217;ve got to teach your programmers how to use these functions securely, or at least evaluate when they should ask for someone to review their code. If training isn&#8217;t an option, there&#8217;s a better option than banning these functions.</p>
<p><strong>Ban programmers who use them wrong.</strong> Yes, banish them to the land of C# and other fluffy dynamic languages with garbage collectors and infinite buffers. They&#8217;ll do far less harm there.</p>
<p>The key to doing memory management correctly (which includes using <code class="prettyprint">memcpy()</code>, <code class="prettyprint">strcpy()</code>, etc. in safe ways) is to completely engage your brain when you&#8217;re doing it. <strong>You cannot zone out when writing memory managing code.</strong> Although given the quality of code coming out of Redmond, I would not be surprised if most of the programmers have their brains permanently switched off.</p>
<p>As classic-Microsoft as this blog post was, the best line was last one.</p>
<blockquote><p>I wonder when Larry, Steve and Linus will start banning strcpy() in their products?</p></blockquote>
<p>Words cannot express the hilarity that ensued when I read this line. Maybe, just maybe, the reason they haven&#8217;t found the need to ban them is because <strong>they&#8217;re using them correctly.</strong> Perhaps if Microsoft tried that every once in a while, they would churn out more secure products themselves without having to resort to Franken-C.</p>
]]></content:encoded>
			<wfw:commentRss>http://sigttou.com/ban-programmers-not-functions/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SSL detection by PHP scripts run through FastCGI on nginx</title>
		<link>http://sigttou.com/ssl-php-fastcgi-nginx</link>
		<comments>http://sigttou.com/ssl-php-fastcgi-nginx#comments</comments>
		<pubDate>Sat, 04 Jul 2009 00:53:59 +0000</pubDate>
		<dc:creator>Bob Somers</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://sigttou.com/?p=66</guid>
		<description><![CDATA[How&#8217;s that title for acronym soup? I ran across this issue when playing around with nginx. I was trying to set up phpMyAdmin for SQL administration, but ran into a rather peculiar issue. To explain the problem, let me give &#8230; <a href="http://sigttou.com/ssl-php-fastcgi-nginx">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>How&#8217;s that title for acronym soup?</p>
<p>I ran across this issue when playing around with <a href="http://wiki.nginx.org">nginx</a>. I was trying to set up <a href="http://www.phpmyadmin.net">phpMyAdmin</a> for SQL administration, but ran into a rather peculiar issue. To explain the problem, let me give you some context.</p>
<p>I&#8217;m running nginx only on port 443, using SSL for everything. As I&#8217;m going through the setup for phpMyAdmin, imagine my surprise when it alerts me that I&#8217;m not using an SSL connection. In fact, it&#8217;s impossible for me <strong>not</strong> to use SSL, because there&#8217;s no regular HTTP server running on port 80. I continued with the setup anyway, checking the ForceSSL option which requires all phpMyAdmin requests to be done over SSL. When I finished installing it and tried to log in, I got a Firefox error that it was stuck in a redirect loop.</p>
<p>Much Google searching later, I still couldn&#8217;t find the problem. This was when I remembered that PHP is configured differently on nginx that is typically done with Apache. With Apache, many people use the mod_php module that compiles PHP support directly into the server. With nginx, you generally process PHP requests using FastCGI.</p>
<p>I wondered if perhaps the fact that the connection was taking place over SSL wasn&#8217;t being passed through to the FastCGI process. If that was the case, the phpMyAdmin setup script wouldn&#8217;t know it was being invoked over HTTPS, and when you tried to log in it would try to forward you to the HTTPS url, which is the same page you had just requested. That would push you into an infite redirect loop.</p>
<p>In fact, that&#8217;s exactly what was happening. You can fix this with a simple addition to your nginx.conf file:</p>
<pre>server {
    listen 443;
    ... more config here, include SSL ...
    location ~ \.php$ {
        ... FastCGI config here ...
        fastcgi_param HTTPS on;
    }
}</pre>
<p>That <code>fastcgi_param HTTPS on;</code> line does the trick. Now the PHP script knows it&#8217;s being invoked over SSL and doesn&#8217;t try to infinitely redirect you. Awesome.</p>
]]></content:encoded>
			<wfw:commentRss>http://sigttou.com/ssl-php-fastcgi-nginx/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
