<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>

<channel>
	<title>unitstep.net &#187; fix</title>
	<atom:link href="http://unitstep.net/blog/category/fix/feed/" rel="self" type="application/rss+xml" />
	<link>http://unitstep.net</link>
	<description>the home of peter chng</description>
	<pubDate>Sun, 05 Oct 2008 17:42:16 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.2</generator>
	<language>en</language>
			<item>
		<title>Fixing the small title bar text in GNOME with Compiz enabled</title>
		<link>http://unitstep.net/blog/2008/05/29/fixing-the-small-title-bar-text-in-gnome-with-compiz-enabled/</link>
		<comments>http://unitstep.net/blog/2008/05/29/fixing-the-small-title-bar-text-in-gnome-with-compiz-enabled/#comments</comments>
		<pubDate>Fri, 30 May 2008 00:34:38 +0000</pubDate>
		<dc:creator>Peter Chng</dc:creator>
		
		<category><![CDATA[compiz]]></category>

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

		<category><![CDATA[linux mint]]></category>

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

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

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

		<guid isPermaLink="false">http://unitstep.net/?p=327</guid>
		<description><![CDATA[If you&#8217;re running GNOME and have enabled Compiz effects, you may have noticed that title bar text - the descriptions at the top of windows - have inexplicably got smaller.  This problem is especially relevant and noticeable in Linux Mint and other Ubuntu-based  distributions, as I learned when setting up a machine for [...]]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;re running GNOME and have enabled <a href="http://compiz.org/">Compiz effects</a>, you may have noticed that title bar text - the descriptions at the top of windows - have inexplicably got smaller.  This problem is especially relevant and noticeable in <a href="http://www.linuxmint.com/">Linux Mint</a> and other <a href="http://www.ubuntu.com/">Ubuntu-based </a> distributions, as I learned when setting up a machine for my Mom to use.  You can see an example of the small/broken title bar text size below. (This was with the default settings)</p>
<p class="image"><a rel="lightbox" href='http://unitstep.net/wordpress/wp-content/uploads/2008/05/titlebar-before-fix.jpg' title="Small (broken) title bar text"><img src="http://unitstep.net/wordpress/wp-content/uploads/2008/05/titlebar-before-fix-300x204.jpg" alt="Small (broken) title bar text" title="Small (broken) title bar text" /></a></p>
<p>A quick fix would be just to increase the title bar font size in the appearance settings, but this would result in larger-than-normal title bar text if you were to disable the Compiz effects.  This smaller text is actually a slight bug, and can be fixed by entering the command <code>compiz --version</code> in the terminal.  After doing this, you&#8217;ll see the title bar text increase back to the normal size - invoking <code>compiz</code> seems to cause the manager to reset the size back. However, the changes do not persist after a reboot or after logging back in and it&#8217;s impractical to have to do this every time. </p>
<p>As with all tedious tasks, the best way to accomplish them is with a script.  Here&#8217;s a nice workaround.</p>
<p>It turns out other people were having the same problem as I.  Searching lead to a thread which <a href="http://ubuntuforums.org/showthread.php?t=599192">suggested the <code>compiz --version</code> command</a> and another which suggested <a href="http://ubuntuforums.org/showthread.php?t=507217">using a bash script</a>.  </p>
<p>Combining the two, I came up with this.  Simply follow these steps and the fix should automatically be enabled after every time you login.</p>
<ol>
<li>
<h4>Make the script file</h4>
<p>Create a file and name it something like &#8220;compiz-fix&#8221;.  Open it in your favourite text editor (<a href="http://en.wikipedia.org/wiki/Nano_%28text_editor%29">nano</a> is my current favourite, after dealing with systems at work that only have <a href="http://en.wikipedia.org/wiki/Vi">vi</a>).</p>
<p>Enter the following lines:</p>
<pre><code>sleep 10
compiz --version</code></pre>
<p>These two commands enable the fix to work.  Here, we&#8217;re waiting/sleeping for 10 seconds after login to make sure that Compiz has time to start up - or else the <code>compiz --version</code> command will have no effect.  You may have to change the sleep period on your system depending on how long it takes to login, but 10 seconds should be enough.
</li>
<li>
<h4>Make the script executable</h4>
<p>This is straightforward, simply open a terminal window and <a href="http://www.freeos.com/guides/lsst/ch02sec01.html">chmod +x {script-file-name}</a>.
</li>
<li>
<h4>Make the script run at startup</h4>
<p>In Linux Mint this is done by going to <strong>Preferences -> Sessions</strong> and then adding an entry to the &#8220;Startup Programs&#8221; tab. </p>
<p>The command should be something like this:</p>
<pre><code>bash /home/&lt;user_name&gt;/compiz-fix</code></pre>
<p>This is assuming you&#8217;ve saved the &#8220;compiz-fix&#8221; script under your home directory.
</li>
</ol>
<p>And then you&#8217;re done! You should now notice the proper title bar text size every time you login, as seen below:</p>
<p class="image"><a rel="lightbox" href='http://unitstep.net/wordpress/wp-content/uploads/2008/05/titlebar-after-fix.jpg' title="Properly sized title bar text"><img src="http://unitstep.net/wordpress/wp-content/uploads/2008/05/titlebar-after-fix-300x207.jpg" alt="Properly sized title bar text" title="Properly sized title bar text" /></a></p>
<p>This fix was used in Linux Mint 4.0 (Darya) but should also apply to Ubuntu 7.10 (Gutsy Gibbon), upon which it is based and possibly also Ubuntu 8.04 (Hardy Heron) and Linux Mint 5.0, assuming the problem hasn&#8217;t already been fixed.</p>
<hr/>Copyright &copy; 2008 <strong><a href="http://unitstep.net">unitstep.net</a></strong>. This Feed is for personal non-commercial use only. If you are not reading this material in your news aggregator, the site you are looking at is guilty of copyright infringement. Please contact <strong><a href="mailto:webmaster@unitstep.net">webmaster@unitstep.net</a></strong> for more information.<br/><span style="float: right;font-size: 7pt"><a href="http://blog.taragana.com/index.php/archive/wordpress-plugins-provided-by-taraganacom/">Plugin</a> by <a href="http://www.taragana.com/">Taragana</a></span>]]></content:encoded>
			<wfw:commentRss>http://unitstep.net/blog/2008/05/29/fixing-the-small-title-bar-text-in-gnome-with-compiz-enabled/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Using Logitech&#8217;s SetPoint Connect Utility to fix your mouse&#8217;s wireless connection</title>
		<link>http://unitstep.net/blog/2008/04/19/using-logitechs-setpoint-connect-utility-to-fix-your-mouses-wireless-connection/</link>
		<comments>http://unitstep.net/blog/2008/04/19/using-logitechs-setpoint-connect-utility-to-fix-your-mouses-wireless-connection/#comments</comments>
		<pubDate>Sat, 19 Apr 2008 21:07:06 +0000</pubDate>
		<dc:creator>Peter Chng</dc:creator>
		
		<category><![CDATA[fix]]></category>

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

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

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

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

		<category><![CDATA[vx revolution]]></category>

		<guid isPermaLink="false">http://unitstep.net/?p=318</guid>
		<description><![CDATA[I recently bought a Logitech VX Revolution off eBay from a discount-store selling open-box and refurbished items.  I intended to use it for my laptop as a portable mouse with just as many features as a desktop mouse.  When I received it, the mouse could not connect to the receiver no matter what [...]]]></description>
			<content:encoded><![CDATA[<p>I recently bought a <a href="http://www.logitech.com/index.cfm/394/165&#038;cl=us,en">Logitech VX Revolution</a> off eBay from a discount-store selling open-box and refurbished items.  I intended to use it for my laptop as a portable mouse with just as many features as a desktop mouse.  When I received it, the mouse could not connect to the receiver no matter what I tried. (Perhaps this was why it was an open box item)</p>
<p>Nothing appeared wrong with the mouse and plugging in the receiver did cause Windows to automatically detect it as a mouse.  I was about ready to contact the seller and request a refund but some searching <a href="http://forum.notebookreview.com/showthread.php?t=177733">turned up a helpful forum thread</a> with users describing the exact same problem as me.  Thankfully, the fix is very simple: Use the <a href="http://fileforum.betanews.com/detail/Logitech_SetPoint_32bit/1145287886/1">Logitech SetPoint Connect Utility</a> to re-synchronize/reconnect your mouse with the receiver.</p>
<h3>Mismatch</h3>
<p>Usually, if a Logitech mouse cannot connect with the receiver automatically, it is a case of mismatch between the mouse and the receiver.  Usually, this is solved by pressing the &#8220;Connect&#8221; or &#8220;Reset&#8221; button on the bottom of the mouse, which causes the mouse/receiver to synchronize back together on the same channel.  Most of the time, the mouse and receiver are already paired together at the factory so there&#8217;s no need for this process.</p>
<p>However, with the VX Revolution, there is no reset button on the mouse.  (The power or on/off button doesn&#8217;t seem to have a &#8220;reset&#8221; effect)  Thus, to &#8220;reset&#8221; the VX Revolution to get it to connect to a receiver you have to press a predefined and cryptic sequence of buttons on the mouse.  This information is conveyed to you when you use the Logitech SetPoint Connect Utility:</p>
<p class="image"><a href='http://unitstep.net/wordpress/wp-content/uploads/2008/04/logitech-setpoint-connect-utility.png'><img src="http://unitstep.net/wordpress/wp-content/uploads/2008/04/logitech-setpoint-connect-utility-small.png" alt="" title="logitech-setpoint-connect-utility-small" width="300" height="199" class="alignnone size-medium wp-image-319" /></a></p>
<p>After carrying out that complicated sequence of steps, the VX Revolution worked! I should note that I&#8217;m not sure if you even <em>need</em> to install SetPoint in order to carry out the reset/reconnection procedure.  Though, it may be worthwhile thanks to some <a href="http://unitstep.net/blog/2006/08/03/enabling-all-options-on-logitech-mice-using-uberoptions-and-setpoint/">nice additions available for SetPoint</a> that really unleash all of your mouse&#8217;s potential.</p>
<hr/>Copyright &copy; 2008 <strong><a href="http://unitstep.net">unitstep.net</a></strong>. This Feed is for personal non-commercial use only. If you are not reading this material in your news aggregator, the site you are looking at is guilty of copyright infringement. Please contact <strong><a href="mailto:webmaster@unitstep.net">webmaster@unitstep.net</a></strong> for more information.<br/><span style="float: right;font-size: 7pt"><a href="http://blog.taragana.com/index.php/archive/wordpress-plugins-provided-by-taraganacom/">Plugin</a> by <a href="http://www.taragana.com/">Taragana</a></span>]]></content:encoded>
			<wfw:commentRss>http://unitstep.net/blog/2008/04/19/using-logitechs-setpoint-connect-utility-to-fix-your-mouses-wireless-connection/feed/</wfw:commentRss>
		</item>
		<item>
		<title>ThreatFire hanging or slowing down MySQL?</title>
		<link>http://unitstep.net/blog/2008/04/12/threatfire-hanging-or-slowing-down-mysql/</link>
		<comments>http://unitstep.net/blog/2008/04/12/threatfire-hanging-or-slowing-down-mysql/#comments</comments>
		<pubDate>Sat, 12 Apr 2008 16:10:02 +0000</pubDate>
		<dc:creator>Peter Chng</dc:creator>
		
		<category><![CDATA[development]]></category>

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

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

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

		<guid isPermaLink="false">http://unitstep.net/?p=316</guid>
		<description><![CDATA[
After seeing glowing recommendations for the heuristic-based ThreatFire anti-malware app from PC Tools, I decided to install it to complement my antivirus scanner and other anti-spyware tools such as Spybot-S&#038;D and Ad-Aware.
Initially, it worked fine.  While I don&#8217;t know how much protection it really added, it was intuitive, easy to configure and didn&#8217;t slow [...]]]></description>
			<content:encoded><![CDATA[<p class="image align-right"><img src="http://unitstep.net/wordpress/wp-content/uploads/2008/04/threatfire-xampp.jpg" alt="XAMPP and ThreatFire" title="threatfire-xampp" width="200" height="145" /></p>
<p>After seeing <a href="http://www.maximumpc.com/article/internet_security_2_0?page=0%2C3">glowing</a> <a href="http://lifehacker.com/344645/protect-your-pc-from-viruses-in-real+time-with-threatfire">recommendations</a> for the heuristic-based <a href="http://www.threatfire.com/">ThreatFire</a> anti-malware app from PC Tools, I decided to install it to complement my antivirus scanner and other anti-spyware tools such as <a href="http://www.safer-networking.org/en/index.html">Spybot-S&#038;D</a> and <a href="http://www.lavasoftusa.com/">Ad-Aware</a>.</p>
<p>Initially, it worked fine.  While I don&#8217;t know how much protection it really added, it was intuitive, easy to configure and didn&#8217;t slow down my system like many other real-time scanners might have.  However, I ran into some trouble with my web development environment, consisting of Apache, MySQL and <acronym class="uttInitialism" title="PHP: Hypertext Preprocessor">PHP</acronym> (in the form of <a href="http://www.apachefriends.org/en/xampp.html">XAMPP</a>) that I could only attribute to ThreatFire&#8217;s presence.</p>
<h3>The symptoms</h3>
<p>With ThreatFire installed and enabled, requesting any pages from Apache that would result in MySQL access took painfully long.  Accessing static pages or scripts that did not use the MySQL database did not hang. At first, I thought it was a problem with the application/scripts I was working on, but other popular third-party scripts, such as <a href="http://www.phpmyadmin.net/">phpMyAdmin</a>, were also slow or unresponsive.  The server appeared to &#8220;hang&#8221; for about 10-15 seconds before producing any response.  This was on a local server.</p>
<p>I tried several different courses of action, such as:</p>
<ul>
<li>Enabling logging of slow queries with the <code>--log-slow-queries</code> option.</li>
<li>Adding the MySQL binaries (<code>mysqld.exe</code> and <code>mysqld-nt.exe</code>) to the ThreatFire exclusion/ignore list</li>
<li>Reinstalling XAMPP</li>
</ul>
<p>None of these worked.  In particular, logging slow queries did not produce any logs, which seemed to indicate that MySQL was hanging even before the queries were executed.  Surprisingly, logging the execution time of <acronym class="uttInitialism" title="PHP: Hypertext Preprocessor">PHP</acronym> scripts did not seem to indicate any problems either.  The queries I was executing and that datasets I was working on were also small and unlikely to be a contributing factor - any query, no matter how simple, seemed to hang.  </p>
<p>When I suspended or removed ThreatFire, the problems immediately went away.  Strangely, as I noted above, adding the MySQL binaries to the exclusion list did not help.  What was more interesting is that ThreatFire did not popup any warnings.  Usually, when &#8220;suspicious behaviour&#8221; is detected, ThreatFire will prompt you for a decision.  I did not notice any of this.</p>
<h3>ThreatFire is not bad</h3>
<p>The purpose of this is not to bash ThreatFire; it&#8217;s clearly a good tool and has definitive advantages, but just may not be well-suited to development environments where multiple servers are running.  I also wanted to provide this information to anyone else who may have been struggling with a slow/unresponsive server because of the same situation as mine.</p>
<hr/>Copyright &copy; 2008 <strong><a href="http://unitstep.net">unitstep.net</a></strong>. This Feed is for personal non-commercial use only. If you are not reading this material in your news aggregator, the site you are looking at is guilty of copyright infringement. Please contact <strong><a href="mailto:webmaster@unitstep.net">webmaster@unitstep.net</a></strong> for more information.<br/><span style="float: right;font-size: 7pt"><a href="http://blog.taragana.com/index.php/archive/wordpress-plugins-provided-by-taraganacom/">Plugin</a> by <a href="http://www.taragana.com/">Taragana</a></span>]]></content:encoded>
			<wfw:commentRss>http://unitstep.net/blog/2008/04/12/threatfire-hanging-or-slowing-down-mysql/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Ultraedit, PHP 5 and the function list.</title>
		<link>http://unitstep.net/blog/2007/06/10/ultraedit-php-5-and-the-function-list/</link>
		<comments>http://unitstep.net/blog/2007/06/10/ultraedit-php-5-and-the-function-list/#comments</comments>
		<pubDate>Sun, 10 Jun 2007 18:12:27 +0000</pubDate>
		<dc:creator>Peter Chng</dc:creator>
		
		<category><![CDATA[fix]]></category>

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

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

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

		<guid isPermaLink="false">http://unitstep.net/blog/2007/06/10/ultraedit-php-5-and-the-function-list/</guid>
		<description><![CDATA[
I was working on some PHP development recently with my editor of choice, UltraEdit.  In my view, UltraEdit is the text editor to use. (Assuming you&#8217;re in a Windows environment)  It basically has everything I need, and is especially well-suited for web development.  Where it may fall short is for developing desktop [...]]]></description>
			<content:encoded><![CDATA[<p class="image align-right"><a href="http://www.ultraedit.com"><img src="/wordpress/wp-content/uploads/2007/06/ultraedit.gif" alt="UltraEdit" /></a></p>
<p>I was working on some <acronym class="uttInitialism" title="PHP: Hypertext Preprocessor">PHP</acronym> development recently with my editor of choice, <a href="http://www.ultraedit.com">UltraEdit</a>.  In my view, UltraEdit is <em>the</em> text editor to use. (Assuming you&#8217;re in a Windows environment)  It basically has everything I need, and is especially well-suited for web development.  Where it may fall short is for developing desktop applications, as then a specific <abbr title="Integrated Development Environment">IDE</abbr> may offer more features, though UltraEdit can be configured to work with compilers and so forth.  (<a href="http://www.ultraedit.com/index.php?name=Content&#038;pid=150">UEStudio</a> is probably a better choice in this case)</p>
<p>While I don&#8217;t want to argue about the merits of UltraEdit, as people&#8217;s passion for their text-editors seem to border on the religious, I wanted to point out a potential solution to a code highlighting problem some of you may have encountered when developing with <acronym class="uttInitialism" title="PHP: Hypertext Preprocessor">PHP</acronym> 5.</p>
<h3>Missing functions in the function list</h3>
<p>UltraEdit supports code highlighting through its <code>wordfile.txt</code> file, which stores the configuration information for highlighting different languages based on their file extension(s).  This file can be found in the directory you installed UltraEdit to, or it can be accessed via the configuration menu.  This file determines what language highlighting options show up in the &#8220;View As&#8221; list.  It also allows the function list to display a list of functions/methods in the current file by defining what strings are function declarations. </p>
<p><a href="http://www.php.net"><acronym class="uttInitialism" title="PHP: Hypertext Preprocessor">PHP</acronym> 5</a> supports <a href="http://ca3.php.net/zend-engine-2.php">classes and objects</a> better than previous versions.  In particular, setting the <a href="http://ca3.php.net/manual/en/language.oop5.visibility.php">visibility of members</a> is now supported.  So, you can define, for example, methods to be public, protected or private. (The default is public)<br />
However, when using one of these keywords to define a method, the method seemed to disappear from the function list.  This was with using UltraEdit 12.10.  </p>
<h3>Modifying the UltraEdit wordfile file</h3>
<p>You need to get the <a href="ftp://www.ultraedit.com/wf/php5.txt"><acronym class="uttInitialism" title="PHP: Hypertext Preprocessor">PHP</acronym> 5 word file</a> and then add it to your word file.  Open up <code>wordfile.txt</code> (in UltraEdit, of course!), and delete the entire definition block previously used for <acronym class="uttInitialism" title="PHP: Hypertext Preprocessor">PHP</acronym>.  It&#8217;ll start at a line of text that begins with:</p>
<pre><code>Lx"<acronym class="uttInitialism" title="PHP: Hypertext Preprocessor">PHP</acronym>"</code></pre>
<p>Where &#8216;x&#8217; is a number.  The end will be just before the next language definition, which will be something like:</p>
<pre><code>L(x+1)"LanguageName"</code></pre>
<p>You need to delete everything starting from the the first line to just before that last line.  Then, you can copy and paste in the contents of the <a href="ftp://www.ultraedit.com/wf/php5.txt"><acronym class="uttInitialism" title="PHP: Hypertext Preprocessor">PHP</acronym> 5 word file</a>, changing the first line&#8217;s <code>L20</code> to <code>Lx</code>, where &#8216;x&#8217; was the number as before.  Public, protected and private-declared methods should now show up in the function list.</p>
<h3>UltraEdit and Regular Expressions</h3>
<p>The UltraEdit word file is actually a bunch of <a href="http://en.wikipedia.org/wiki/Regular_expressions">regular expressions</a> that tell UltraEdit which lines are function declarations (among other things) so that it can populate the function list with them.  In the past, it would <a href="http://simonwillison.net/2003/Mar/23/ultraEditRegularExpressions/#c9953">appear that the wordfile doesn&#8217;t use Unix-style RegExps</a> but instead uses some sort of UltraEdit format.  I don&#8217;t know if this behaviour has been changed since then, but looking at the word file, it appears that this is still the case.  </p>
<p>You see, UltraEdit has its own style of regular expressions.  While you have the option of searching within text files using either UltraEdit&#8217;s style, Unix, or Perl-compatible regular expressions, it seems as though the word file language definitions must use UltraEdit-style regular expressions.</p>
<hr/>Copyright &copy; 2008 <strong><a href="http://unitstep.net">unitstep.net</a></strong>. This Feed is for personal non-commercial use only. If you are not reading this material in your news aggregator, the site you are looking at is guilty of copyright infringement. Please contact <strong><a href="mailto:webmaster@unitstep.net">webmaster@unitstep.net</a></strong> for more information.<br/><span style="float: right;font-size: 7pt"><a href="http://blog.taragana.com/index.php/archive/wordpress-plugins-provided-by-taraganacom/">Plugin</a> by <a href="http://www.taragana.com/">Taragana</a></span>]]></content:encoded>
			<wfw:commentRss>http://unitstep.net/blog/2007/06/10/ultraedit-php-5-and-the-function-list/feed/</wfw:commentRss>
		</item>
		<item>
		<title>AMD Dual-Core fix for games</title>
		<link>http://unitstep.net/blog/2007/05/19/amd-dual-core-fix-for-games/</link>
		<comments>http://unitstep.net/blog/2007/05/19/amd-dual-core-fix-for-games/#comments</comments>
		<pubDate>Sat, 19 May 2007 16:11:25 +0000</pubDate>
		<dc:creator>Peter Chng</dc:creator>
		
		<category><![CDATA[CPU]]></category>

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

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

		<category><![CDATA[dual-core]]></category>

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

		<guid isPermaLink="false">http://unitstep.net/blog/2007/05/19/amd-dual-core-fix-for-games/</guid>
		<description><![CDATA[After I built my AMD Athlon X2-based dual-core system last year, I started noticing some weird speed issues in certain games.  At seemingly random times, the games would speedup and slowdown, making things very jerky and jumpy.  This would basically make the game unplayable.  It turns out that this is a known [...]]]></description>
			<content:encoded><![CDATA[<p>After I built my AMD Athlon X2-based dual-core system <a href="http://unitstep.net/blog/2006/05/28/new-computer/">last year</a>, I started noticing some weird speed issues in certain games.  At seemingly random times, the games would speedup and slowdown, making things very jerky and jumpy.  This would basically make the game unplayable.  It turns out that this is a <a href="http://developer.amd.com/assets/TSC_Dual-Core_Utility.pdf">known</a> <a href="http://msdn2.microsoft.com/en-us/library/bb173458.aspx">problem</a> and can occur when single-threaded games run on a dual-core system.  (So you may even experience these problems on an Intel dual-core system.)</p>
<p>The solution is <a href="http://www.hardforum.com/showthread.php?t=983781">nicely outlined in the [H]ard|OCP Forums</a>, where it&#8217;s aptly known as the &#8220;Benny Hill Effect&#8221;.  Turns out that the problem has to do with power state management issues and how they affect the read time stamp counter instruction (RDTSC), which is used for timing.  I followed the guide, and it fixed my problems.</p>
<p>The games that I noticed the timing issues in were <abbr title="Need for Speed: Most Wanted">NFS:MW</abbr>, Rome Total War and <abbr title="Grand Theft Auto">GTA</abbr> San Andreas.  This is by no means a complete list of games that are affected by this issue.  Some of my own observations and suggestions for fixing the problem:</p>
<ul>
<li>I installed the &#8220;AMD Dual-Core Optimizer&#8221;, but found that while it fixed some of the jerky games, it caused problems such as video distortion in other games</li>
<li>So, I uninstalled the fix, and strangely, the jerkiness in games remained gone <strong>and</strong> all previously caused problems were removed as well</li>
<li>This may have been the result of the &#8220;/usepmtimer&#8221; switch being added to the &#8220;boot.ini&#8221; file (This may have been all that was needed)</li>
</ul>
<p>Regardless, the <a href="http://www.hardforum.com/showthread.php?t=983781">guide in the [H]ard|OCP Forums</a> is quite extensive, and you should be able to solve any of your dual-core related gameplay issues by reading it.</p>
<hr/>Copyright &copy; 2008 <strong><a href="http://unitstep.net">unitstep.net</a></strong>. This Feed is for personal non-commercial use only. If you are not reading this material in your news aggregator, the site you are looking at is guilty of copyright infringement. Please contact <strong><a href="mailto:webmaster@unitstep.net">webmaster@unitstep.net</a></strong> for more information.<br/><span style="float: right;font-size: 7pt"><a href="http://blog.taragana.com/index.php/archive/wordpress-plugins-provided-by-taraganacom/">Plugin</a> by <a href="http://www.taragana.com/">Taragana</a></span>]]></content:encoded>
			<wfw:commentRss>http://unitstep.net/blog/2007/05/19/amd-dual-core-fix-for-games/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Fixing sound interference on the Asus A8N32-SLI Deluxe</title>
		<link>http://unitstep.net/blog/2007/05/17/fixing-sound-interference-on-the-asus-a8n32-sli-deluxe/</link>
		<comments>http://unitstep.net/blog/2007/05/17/fixing-sound-interference-on-the-asus-a8n32-sli-deluxe/#comments</comments>
		<pubDate>Thu, 17 May 2007 21:54:39 +0000</pubDate>
		<dc:creator>Peter Chng</dc:creator>
		
		<category><![CDATA[Hardware]]></category>

		<category><![CDATA[a8n32-sli]]></category>

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

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

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

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

		<guid isPermaLink="false">http://unitstep.net/blog/2007/05/17/fixing-sound-interference-on-the-asus-a8n32-sli-deluxe/</guid>
		<description><![CDATA[If you&#8217;re running an Asus A8N32-SLI Deluxe motherboard like me, and are using the onboard Realtek ALC850 audio (AC &#8216;97 compatible), you may have experienced high levels of sound interference on the audio outputs.  This interference manifests itself as &#8220;static&#8221; on your speakers, and appears to be correlated with system activity, such as: accessing [...]]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;re running an <a href="http://www.asus.com/products4.aspx?modelmenu=1&#038;model=744&#038;l1=3&#038;l2=15&#038;l3=226">Asus A8N32-SLI Deluxe</a> motherboard <a href="/blog/2006/05/28/new-computer/">like me</a>, and are using the onboard Realtek ALC850 audio (AC &#8216;97 compatible), you may have experienced high levels of sound interference on the audio outputs.  This interference manifests itself as &#8220;static&#8221; on your speakers, and appears to be correlated with system activity, such as: accessing the HDD, network activity or even moving the mouse. The static can be quite noticeable, and is especially annoying when there&#8217;s nothing else coming out from the speakers, or if you&#8217;re using headphones.  In particular, the interference is unacceptable at high volume levels.</p>
<h3>The cause</h3>
<p>The cause of this interference is from the PC speaker, or rather, how the pass-through of the PC speaker to the onboard audio, was implemented.  The onboard audio is automatically setup to receive PC speaker signals from your motherboard and route them to the outputs.  This path was not very well isolated and as a result interference (<abbr title="Electromagnetic Interference">EMI</abbr>) from other system components can creep in, resulting in the noisy output from your speakers.  </p>
<h3>Solution: Mute it</h3>
<p>The solution is to mute the PC speaker output on the onboard Realtek audio.  This can be accomplished in two ways, depending on your situation and needs. </p>
<p>The first is in software, and requires that you have the Realtek audio drivers installed, <strong>not</strong> the default nForce audio drivers, despite the fact that they work well with the A8N32-SLI Deluxe, an nForce 4 board. You can grab the Realtek drivers from <a href="http://support.asus.com/download/download.aspx?SLanguage=en-us&#038;model=A8N32-SLI%20Deluxe">Asus&#8217; site</a> or a later version from <a href="http://www.download.com/Realtek-AC-97-WDM-Driver-Windows-98-Me-2000-XP-2003-/3000-2120_4-10238712.html">Download.com</a>. </p>
<ol>
<li>Open volume properties (either by clicking the systray icon or through Control Panel)</li>
<li>Click on <code>Options &gt; Properties</code> and make sure that &#8220;PC Speaker&#8221; is checked, then click &#8220;OK&#8221;</li>
<li>Now, mute the PC Speaker input</li>
</ol>
<p>This should have removed or reduced most of the sound interference - this worked well for me.  If not, try muting other inputs, such as AUX or Line In, that you may not be using. </p>
<h3>Getting rid of interference while using NVidia&#8217;s drivers</h3>
<p>The second method, if you choose to stick with NVidia&#8217;s nForce audio drivers, is a bit more complicated.  For some reason, the nForce audio drivers do not give an option to mute the PC speaker.  I am guessing this was because the nForce audio drivers need to work with a variety of nForce motherboards, so they have to stick with something that&#8217;ll work with a reference design.  Since not all nForce motherboards might use the Realtek audio and may not use the PC speaker input functionality, it could be problematic to code the drivers for this.  </p>
<p>Thus, you&#8217;ll have to disable the PC speaker in hardware.  This is done by opening your case and <em>disconnecting</em> the PC speaker connector from the motherboard.  This seems to break the connection to the PC speaker input to the onboard audio, removing most of the interference.  This also worked for me.  While you&#8217;re inside of your case, you may want to clean out some of the dust like I did. </p>
<h3>Which method is better?</h3>
<p>At the surface, it may seem like the software solution, using Realtek&#8217;s drivers just to disable the PC speaker input, is better and easier.  While it is easier, I didn&#8217;t really like the audio control panel provided by Realtek.  While it had plenty of features, I just didn&#8217;t like the look &#038; feel, nor did I appreciate the lack of an equalizer.  </p>
<p class="image">
<a rel="lightbox" href='http://unitstep.net/wordpress/wp-content/uploads/2007/05/realtek-sound.png' title='Realtek control panel'><img src='http://unitstep.net/wordpress/wp-content/uploads/2007/05/realtek-sound.thumbnail.png' alt='Realtek control panel' /></a>
</p>
<p>The NVidia control panel, by contrast, looks more polished and offers a fully-featured graphic equalizer, that not only shows the different frequency ranges but also each channel.  It also has a convenient &#8220;Night Mode&#8221; that automatically reduces bass and dynamic range for a quieter listening experience. </p>
<p class="image">
<a rel="lightbox" href='http://unitstep.net/wordpress/wp-content/uploads/2007/05/nvidia-sound.png' title='NVidia control panel'><img src='http://unitstep.net/wordpress/wp-content/uploads/2007/05/nvidia-sound.thumbnail.png' alt='NVidia control panel' /></a>
</p>
<p>I was living with this problem for over eight months, and just assumed it was because of the low-cost onboard audio.  I was at the point of buying a separate soundcard just to alleviate the problem, before I stumbled across the <a href="http://forums.nvidia.com/lofiversion/index.php?t16352.html">solution</a> in <a href="http://forums.nvidia.com/index.php?showtopic=14539">several</a> <a href="http://www.hardwareanalysis.com/content/topic/54010/">forums</a>.  It seems like quite a lot of other people have experienced this trouble.  Hopefully Asus won&#8217;t let this happen in any more of their motherboard designs.  However, Asus motherboards have always been rock-solid in terms of stability for me, so I don&#8217;t think I&#8217;ll switch anytime soon.</p>
<hr/>Copyright &copy; 2008 <strong><a href="http://unitstep.net">unitstep.net</a></strong>. This Feed is for personal non-commercial use only. If you are not reading this material in your news aggregator, the site you are looking at is guilty of copyright infringement. Please contact <strong><a href="mailto:webmaster@unitstep.net">webmaster@unitstep.net</a></strong> for more information.<br/><span style="float: right;font-size: 7pt"><a href="http://blog.taragana.com/index.php/archive/wordpress-plugins-provided-by-taraganacom/">Plugin</a> by <a href="http://www.taragana.com/">Taragana</a></span>]]></content:encoded>
			<wfw:commentRss>http://unitstep.net/blog/2007/05/17/fixing-sound-interference-on-the-asus-a8n32-sli-deluxe/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Taking the www out of the web</title>
		<link>http://unitstep.net/blog/2006/12/27/taking-the-www-out-of-the-web/</link>
		<comments>http://unitstep.net/blog/2006/12/27/taking-the-www-out-of-the-web/#comments</comments>
		<pubDate>Wed, 27 Dec 2006 18:47:32 +0000</pubDate>
		<dc:creator>Peter Chng</dc:creator>
		
		<category><![CDATA[fix]]></category>

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

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

		<guid isPermaLink="false">http://unitstep.net/blog/2006/12/27/taking-the-www-out-of-the-web/</guid>
		<description><![CDATA[Despite the phrase &#8220;World-Wide Web&#8221; being as dated and passÃ© as claims of Al Gore &#8220;inventing the Internet&#8221;, the term persists today as the most popular and unnecessary subdomain for websites.  Should it really be necessary to type &#8220;www&#8221; before every domain name?  Furthermore, does it even have any more relevance?
Since the major [...]]]></description>
			<content:encoded><![CDATA[<p>Despite the phrase &#8220;World-Wide Web&#8221; being as dated and <i>passÃ©</i> as claims of Al Gore <a href="http://en.wikipedia.org/wiki/Al_gore#1999_CNN_interview">&#8220;inventing the Internet&#8221;</a>, the term persists today as the most popular and unnecessary subdomain for websites.  Should it really be necessary to type &#8220;www&#8221; before every domain name?  Furthermore, does it even have any more relevance?</p>
<p>Since the major use of Internet is for accessing websites, the &#8220;www&#8221; prefix shouldn&#8217;t be needed anymore.  It is an archaic holdover from a previous era, one where browser wars meant IE vs. Netscape and where Geocities was <em>the</em> place to be.  Thankfully, the folks over at <a href="http://no-www.org/">no-www</a> have been aiming to improve this for some time.</p>
<h3>So what&#8217;s the big deal?</h3>
<p>Well, it&#8217;s not such a big deal, more just a pet peeve of mine.  Most sites out there are thankfully configured well enough so that navigating to &#8220;domain.com&#8221; just redirects you to &#8220;www.domain.com&#8221; with no damage done.  However, some servers are setup so that navigating to &#8220;domain.com&#8221; <em>doesn&#8217;t</em> work, and this forces you to type in the &#8220;www&#8221; subdomain before.  This really doesn&#8217;t make sense in today&#8217;s world.</p>
<p>In my opinion, all websites should be set up with the no-www version as the default.  Using the &#8220;www&#8221; subdomain should redirect you to the no-www version, with no harm done.  This is known as <a href="http://no-www.org/faq.php">Class-B compliance</a>, according to the no-www folks, and it&#8217;s probably going to be the best way to go for some time, since many people still use the &#8220;www&#8221;, after having the phrase drilled into their heads during the late 90&#8217;s. </p>
<h3>So, how to fix it?</h3>
<p>If you&#8217;ve signed up for hosting from a provider, chances are they&#8217;ve already implemented some sort of compliance, but not the optimal type.  For example, most hosting providers will automatically redirect the no-www request to the www one.  So, under this configuration, someone entering &#8220;domain.com&#8221; would be redirected to &#8220;www.domain.com&#8221;.  No big deal, but things could be better.  After all, the no-www version is shorter and thus requires less typing and less space.  Good if you want to save a few cents on your business cards.</p>
<p>Fixing it is a simple effort that takes a minute or so.  All you have to do is edit the <code>.htaccess</code> file in the root of your website, if you&#8217;re using Apache.  Here&#8217;s the following directive I&#8217;m using.</p>
<pre>
<code># BEGIN no-www
&lt;IfModule mod_rewrite.c&gt;
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.unitstep\.net$ [NC]
RewriteRule ^(.*)$ http://unitstep.net/$1 [R=301,L]
&lt;/IfModule&gt;
# END no-www</code>
</pre>
<p>The <code>RewriteRule</code> uses a 301 - this is a special <acronym class="uttInitialism" title="HyperText Transfer Protocol">HTTP</acronym> code used to tell of a permanent redirection.  Browsers and search engines crawling your site will interpret this as an instruction that your website has permanently moved to the non-www address.  This is most important for search engines, so that they know that the no-www version is not <a href="http://googlewebmastercentral.blogspot.com/2006/12/deftly-dealing-with-duplicate-content.html">just a duplicate</a> or different website than the previous www version.  The 301 instruction tells them that the old www version doesn&#8217;t exist anymore, and it has been moved to the no-www address. </p>
<p>Taking it a step further, you could also redirect <em>any</em> subdomain to just the root.  For example, I also own the domain &#8220;peterchng.com&#8221;, and wanted to redirect any request to that address, subdomains included, to my main site.  Here&#8217;s the directives I used.</p>
<pre>
<code># BEGIN peterchng.com FORWARD
&lt;IfModule mod_rewrite.c&gt;
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(([a-zA-Z0-9]+)\.)*peterchng\.com$ [NC]
RewriteRule ^(.*)$ http://unitstep.net/$1 [R=301,L]
&lt;/IfModule&gt;
# END peterchng.com FORWARD</code>
</pre>
<p>Go ahead, try typing in <a href="http://who.the.heck.is.peterchng.com">&#8220;who.the.heck.is.peterchng.com&#8221;</a> into your browser, and you&#8217;ll see it redirects right back to this site.</p>
<p>You&#8217;ll want to be careful when using these directives - if you actually do have separate websites on different subdomains, they&#8217;ll be inaccessible if you do this!  I&#8217;ve been using it until I find a use for peterchng.com - or a different use for unitstep.net.  </p>
<h3>Why all the trouble then?</h3>
<p>With all the trouble of going of removing the &#8220;www&#8221; you may wonder why it was ever used in the first place.  Well, IIRC, in the early years of the Internet, websites or <acronym class="uttInitialism" title="HyperText Transfer Protocol">HTTP</acronym> wasn&#8217;t the main use.  Other services/protocols such as gopher, FTP and telnet were probably a lot more dominant.  So, it made sense to set up a separate subdomain that would be used to accept <acronym class="uttInitialism" title="HyperText Transfer Protocol">HTTP</acronym> connections.  This would make it easier for users to distinguish between the services offered from a particular domain.  However, since <acronym class="uttInitialism" title="HyperText Transfer Protocol">HTTP</acronym> has grown to eclipse those traditional services, the use of www is almost superfluous nowadays.</p>
<hr/>Copyright &copy; 2008 <strong><a href="http://unitstep.net">unitstep.net</a></strong>. This Feed is for personal non-commercial use only. If you are not reading this material in your news aggregator, the site you are looking at is guilty of copyright infringement. Please contact <strong><a href="mailto:webmaster@unitstep.net">webmaster@unitstep.net</a></strong> for more information.<br/><span style="float: right;font-size: 7pt"><a href="http://blog.taragana.com/index.php/archive/wordpress-plugins-provided-by-taraganacom/">Plugin</a> by <a href="http://www.taragana.com/">Taragana</a></span>]]></content:encoded>
			<wfw:commentRss>http://unitstep.net/blog/2006/12/27/taking-the-www-out-of-the-web/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Clean out your laptop&#8217;s heatsink/fan</title>
		<link>http://unitstep.net/blog/2006/09/10/clean-out-your-laptops-heatsinkfan/</link>
		<comments>http://unitstep.net/blog/2006/09/10/clean-out-your-laptops-heatsinkfan/#comments</comments>
		<pubDate>Sun, 10 Sep 2006 15:43:00 +0000</pubDate>
		<dc:creator>Peter Chng</dc:creator>
		
		<category><![CDATA[Hardware]]></category>

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

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

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

		<guid isPermaLink="false">http://unitstep.net/blog/2006/09/10/clean-out-your-laptops-heatsinkfan/</guid>
		<description><![CDATA[My laptop, a three-year old Dell Inspiron 5100, was recently suffering from some heat-related issues that manifested themselves in slowdowns and sometimes shutdowns.  You see, the CPU in this laptop is an Intel desktop 2.8 GHz P4 - one of the truly hot-running CPUs, made before Intel decided that clock speed wasn&#8217;t everything under [...]]]></description>
			<content:encoded><![CDATA[<p>My laptop, a three-year old Dell Inspiron 5100, was recently suffering from some heat-related issues that manifested themselves in slowdowns and sometimes shutdowns.  You see, the CPU in this laptop is an Intel <em>desktop</em> 2.8 GHz P4 - one of the truly hot-running CPUs, made before Intel decided that <a href="http://www.anandtech.com/mobile/showdoc.aspx?i=2663">clock speed wasn&#8217;t everything</a> under the sun, and thus is probably not the best part to include in a laptop.  When I first purchased the laptop, it was able to run CPU-intensive apps well, though it did occassionally overheat.  However, after three years of use, it would routinely overheat to the point that it would always throttle itself to a lower speed, resulting in my system becoming very slow - things like browsing the Internet or trying to watch video on YouTube just wouldn&#8217;t work very well.</p>
<p>I finally decided to take a look at the heatsink/fan area - it didn&#8217;t <em>look</em> like it had a lot of dust in it, but then again, I had been lazy.  Not any more - I took a can of compressed air and aimed straight at it.  Immediately, a huge puff of extremely fine dust spurted out and I had to cover my face.  I then proceeded to spray out the rest of the dust until no more was seen.  Now, the laptop runs like it was brand new.  If you have a laptop that&#8217;s getting very hot, invest in a can of compressed air, but make sure you&#8217;re in an area that you feel comfortable scattering with very fine dust particles.</p>
<hr/>Copyright &copy; 2008 <strong><a href="http://unitstep.net">unitstep.net</a></strong>. This Feed is for personal non-commercial use only. If you are not reading this material in your news aggregator, the site you are looking at is guilty of copyright infringement. Please contact <strong><a href="mailto:webmaster@unitstep.net">webmaster@unitstep.net</a></strong> for more information.<br/><span style="float: right;font-size: 7pt"><a href="http://blog.taragana.com/index.php/archive/wordpress-plugins-provided-by-taraganacom/">Plugin</a> by <a href="http://www.taragana.com/">Taragana</a></span>]]></content:encoded>
			<wfw:commentRss>http://unitstep.net/blog/2006/09/10/clean-out-your-laptops-heatsinkfan/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Getting Matlab to run on a newer Athlon 64 (X2) CPU</title>
		<link>http://unitstep.net/blog/2006/08/21/getting-matlab-to-run-on-a-newer-athlon-64-x2-cpu/</link>
		<comments>http://unitstep.net/blog/2006/08/21/getting-matlab-to-run-on-a-newer-athlon-64-x2-cpu/#comments</comments>
		<pubDate>Tue, 22 Aug 2006 00:46:20 +0000</pubDate>
		<dc:creator>Peter Chng</dc:creator>
		
		<category><![CDATA[fix]]></category>

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

		<guid isPermaLink="false">http://unitstep.net/blog/2006/08/21/getting-matlab-to-run-on-a-newer-athlon-64-x2-cpu/</guid>
		<description><![CDATA[I recently installed Matlab v7.0 (R14) on my new computer and ran into some troubles.  After starting Matlab, the program window would open as normal, but then it would shutdown almost immediately, usually after about a second or so delay, allowing me to tantalizingly see that it almost working.  I did a search [...]]]></description>
			<content:encoded><![CDATA[<p>I recently installed Matlab v7.0 (R14) on my <a href="http://unitstep.net/blog/2006/05/28/new-computer/">new computer</a> and ran into some troubles.  After starting Matlab, the program window would open as normal, but then it would shutdown almost immediately, usually after about a second or so delay, allowing me to tantalizingly see that it almost working.  I did a search and found <a href="http://asadasif.com/index.php?itemid=2">this helpful article</a> on how to fix the problem.</p>
<p>The issue (Matlab closing right after start-up) stems from Matlab (at least this version, the newer versions might not be affected) not &#8220;recognizing&#8221; the processor string for newer AMD Athlon 64-based processors; in my case, I had an Athlon 64 X2 3800+.  Matlab relies on different Basic Linear Algebra Subprograms (or <abbr title="Basic Linear Algebra Subprograms">BLAS</abbr>) routines for different types of CPUs, and these are stored in different <abbr title="Dynamic Link Library">DLL</abbr> files.</p>
<p>The <abbr title="Basic Linear Algebra Subprograms">BLAS</abbr> file responsible for telling Matlab which <abbr title="Dynamic Link Library">DLL</abbr> file to use for what type of CPU is located at: </p>
<p><code>%MATLAB7%\bin\win32\blas.spec</code><br />
<span class="note">(where <code>%MATLAB7%</code> is the path to your Matlab installation)</span></p>
<p>To fix the problem, open up the file in a text-editor, and add the following two lines to the bottom:</p>
<pre>
<code>AuthenticAMD Family 15 Model 12 atlas_Athlon.dll # Athlon 64 (Newcastle)
AuthenticAMD Family 15 Model * atlas_Athlon.dll # AMD64</code></pre>
<p>This will tell Matlab to use the <strong>proper</strong> <abbr title="Dynamic Link Library">DLL</abbr> file with your newer AMD-64-based CPU, instead of apparently defaulting to using a Pentium <abbr title="Dynamic Link Library">DLL</abbr> file when an unrecognized CPU is detected.</p>
<h3>More on the problem</h3>
<p>As mentioned, the problem stems from the CPU being unrecognized by Matlab&#8217;s configuration file.  All CPUs have some sort of identifier string, and Matlab uses this to determine what <abbr title="Dynamic Link Library">DLL</abbr> file to use.  When an unrecognized CPU string is detected, it apparently defaults to using a Pentium <abbr title="Dynamic Link Library">DLL</abbr> file; this results in Matlab crashing when it&#8217;s run on an AMD-64-based CPU, and results in the crash-on-start behaviour.</p>
<p>Why the different <abbr title="Dynamic Link Library">DLL</abbr> files for different CPUs? My guess is that the <abbr title="Basic Linear Algebra Subprograms">BLAS</abbr>, upon which Matlab is based, are optimized or made to work better with select CPUs.  It should be noted that these problems may not be experienced if you&#8217;re running a more current version of Matlab.</p>
<p>I did a little more searching and found <a href="http://newsreader.mathworks.com/WebX?14@338.nV1cb9iHImm@.ef28925">this forum thread</a> over at the Matlab website, where a different fix for the same problem is presented.  It involves setting a Windows environment variable instead of editing the <code>blas.spec</code> file, but should do the same thing; I haven&#8217;t tried it.  This <a href="http://www.codecomments.com/archive381-2005-5-505181.html">other forum thread</a> also details a similar procedure. </p>
<p>Hope this helps in fixing any Matlab ailments you might have had, because running into a problem like this can be frustrating as heck when you need to have an assignment done for tomorrow!</p>
<h3>Update</h3>
<p>I&#8217;d just like to say that a dual-core setup <em>totally rocks</em>.  It&#8217;s awesome to be able to still play <abbr title="Counter-Strike: Source">CS:S</abbr> while running a Matlab simulation.</p>
<hr/>Copyright &copy; 2008 <strong><a href="http://unitstep.net">unitstep.net</a></strong>. This Feed is for personal non-commercial use only. If you are not reading this material in your news aggregator, the site you are looking at is guilty of copyright infringement. Please contact <strong><a href="mailto:webmaster@unitstep.net">webmaster@unitstep.net</a></strong> for more information.<br/><span style="float: right;font-size: 7pt"><a href="http://blog.taragana.com/index.php/archive/wordpress-plugins-provided-by-taraganacom/">Plugin</a> by <a href="http://www.taragana.com/">Taragana</a></span>]]></content:encoded>
			<wfw:commentRss>http://unitstep.net/blog/2006/08/21/getting-matlab-to-run-on-a-newer-athlon-64-x2-cpu/feed/</wfw:commentRss>
		</item>
		<item>
		<title>WordPress and password-protected directories: How to make them work together</title>
		<link>http://unitstep.net/blog/2006/08/15/wordpress-and-password-protected-directories/</link>
		<comments>http://unitstep.net/blog/2006/08/15/wordpress-and-password-protected-directories/#comments</comments>
		<pubDate>Wed, 16 Aug 2006 03:27:06 +0000</pubDate>
		<dc:creator>Peter Chng</dc:creator>
		
		<category><![CDATA[apache]]></category>

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

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

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

		<guid isPermaLink="false">http://unitstep.net/blog/2006/08/15/wordpress-and-password-protected-directories/</guid>
		<description><![CDATA[If you have WordPress installed in the root directory of your website, as many people do, then the entire website is subject to the .htaccess rules defined by WordPress, if you&#8217;re using a permalink structure that uses mod_rewrite. (Again, most people use this option, as it allows for human-readable URIs instead of ones filled with [...]]]></description>
			<content:encoded><![CDATA[<p>If you have WordPress installed in the root directory of your website, as many people do, then the entire website is subject to the <code>.htaccess</code> rules defined by WordPress, if you&#8217;re using a permalink structure that uses <code>mod_rewrite</code>. (Again, most people use this option, as it allows for human-readable URIs instead of ones filled with GET queries)  Because the WordPress <code>.htaccess</code> file resides in the site root folder, it allows WordPress to handle all URIs relating to requests from the site - this is good, as it allows WordPress to handle 404s nicely, and you can define 404 pages from within WordPress rather than having to resort to server directives.</p>
<p>However, this can create problems if you want to create password-protected directories.  Accessing them sometimes doesn&#8217;t work because of WordPress&#8217;s <code>.htaccess</code> file, however this isn&#8217;t a WordPress problem <i style="latin">per se</i>, but rather a problem with how Apache has been set up.  I ran into this problem - I tried accessing a password-protected directory that I knew had been set up properly, but I kept getting a 404 error and was redirected to my WordPress theme&#8217;s 404 page.  After a little bit of searching over at the <a href="http://wordpress.org/support/">WordPress support boards</a>, I found some solutions that were sort of messy, involving editing WordPress files or adding a lot to the <code>.htaccess</code> file. </p>
<p>However, after looking for a bit more, I found <a href="http://www.ju-ju.com/2006/03/17/wordpress-404-error/">this page</a>, where the author outlines his fix; but later on a comment posted to his site provided me with the fix I wanted - <a href="http://textpattern.com/faq/173/password-protected-directories-with-htaccess">something simple</a>.  Though that site deals with <a href="http://textpattern.com/">TextPattern</a>, another blogging platform, apparently it handles requests in a similar manner to WordPress.</p>
<p>The problem lies with improperly set (usually non-specified) <code>ErrorDocument</code> directives.  In this case, the responsible error codes are <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.2">401</a> (Unauthorized) and <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.4">403</a> (Forbidden).  These directives are used to tell Apache what document to send or display to the user when each of these error codes are encountered.  If these are set to point to a non-existant file, WordPress ends up handling the request - which in these cases, it treats just like a 404.  When you try to access a password-protected resource, Apache first sends a 401 (Unauthorized), as a challenge to provide the proper credentials (login/password); if the error directive for this points to non-existant file, then the request is improperly passed on to WordPress and then treated like a 404 here.</p>
<p>To fix it, you need to specify the error directives in your root <code>.htaccess</code> file, which if you have WordPress in the root, is the same file that WordPress uses.  If you open it up, you should find WordPress&#8217; rules in there, which will look something like this</p>
<pre><code># BEGIN WordPress
&lt;ifmodule mod_rewrite.c&gt;
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
&lt;/ifmodule&gt;
# END WordPress</code></pre>
<p>Add the following lines to the <code>.htaccess</code> file.</p>
<pre><code>ErrorDocument 401 /&lt;PATH_TO_ERROR_DOCS&gt;/401.html
ErrorDocument 403 /&lt;PATH_TO_ERROR_DOCS&gt;/403.html</code></pre>
<p>Where 401.html and 403.html are the pages you want shown when each of those respective errors are encountered.  These should be static pages. (eg. not server-side scripts)  This fix worked like a charm for me.</p>
<hr/>Copyright &copy; 2008 <strong><a href="http://unitstep.net">unitstep.net</a></strong>. This Feed is for personal non-commercial use only. If you are not reading this material in your news aggregator, the site you are looking at is guilty of copyright infringement. Please contact <strong><a href="mailto:webmaster@unitstep.net">webmaster@unitstep.net</a></strong> for more information.<br/><span style="float: right;font-size: 7pt"><a href="http://blog.taragana.com/index.php/archive/wordpress-plugins-provided-by-taraganacom/">Plugin</a> by <a href="http://www.taragana.com/">Taragana</a></span>]]></content:encoded>
			<wfw:commentRss>http://unitstep.net/blog/2006/08/15/wordpress-and-password-protected-directories/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
