<?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>cat brain.log &#124; less &#187; Gotchas</title>
	<atom:link href="http://log.largevoid.com/cat/gotchas/feed/" rel="self" type="application/rss+xml" />
	<link>http://log.largevoid.com</link>
	<description>Getting it down on `paper`</description>
	<lastBuildDate>Mon, 06 Feb 2012 06:23:55 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Disable Annoying Camera and Video Sounds on Rooted Android</title>
		<link>http://log.largevoid.com/2011/08/disable-annoying-camera-and-video-sounds-on-rooted-android/</link>
		<comments>http://log.largevoid.com/2011/08/disable-annoying-camera-and-video-sounds-on-rooted-android/#comments</comments>
		<pubDate>Wed, 03 Aug 2011 23:27:10 +0000</pubDate>
		<dc:creator>Paul</dc:creator>
				<category><![CDATA[Gotchas]]></category>
		<category><![CDATA[Reference]]></category>
		<category><![CDATA[Scripts, Tricks and Hacks]]></category>
		<category><![CDATA[adb]]></category>
		<category><![CDATA[Android]]></category>
		<category><![CDATA[CyanogenMod]]></category>

		<guid isPermaLink="false">http://log.largevoid.com/?p=582</guid>
		<description><![CDATA[Pre-req: Fastboot drivers installed. ROM: CyanogenMod 7.1 RC1 (YMMV). Phone: HTC Desire &#8211; BravoC DVT2 Enable USB debugging. Connect your phone to your computer. Bring up a command prompt. Change to android-sdk-windows directory. adb remount adb shell cd system/media/audio/ui mv camera_click.ogg camera_click.og_ mv VideoRecord.ogg VideoRecord.og_ Source: http://android.modaco.com/topic/319541-camera-shutter-sound/ Reference: http://theunlockr.com/2009/10/06/how-to-set-up-adb-usb-drivers-for-android-devices/]]></description>
			<content:encoded><![CDATA[<p>Pre-req: Fastboot drivers <a href="http://theunlockr.com/2011/08/02/how-to-gain-s-off-flash-a-custom-recovery-and-root-your-android-phone-using-the-revolutionary-method/">installed</a>.<br />
ROM: CyanogenMod 7.1 RC1 (YMMV).<br />
Phone: HTC Desire &#8211; BravoC DVT2</p>
<p>Enable USB debugging.<br />
Connect your phone to your computer.<br />
Bring up a command prompt.<br />
Change to android-sdk-windows directory.</p>

<div class="wp_syntax"><div class="code"><pre class="dos" style="font-family:monospace;">adb remount
adb shell
<span style="color: #b1b100; font-weight: bold;">cd</span> system/media/audio/ui
mv camera_click.ogg camera_click.og_
mv VideoRecord.ogg VideoRecord.og_</pre></div></div>

<p>Source: <a href="http://android.modaco.com/topic/319541-camera-shutter-sound/">http://android.modaco.com/topic/319541-camera-shutter-sound/</a><br />
Reference: <a href="http://android.modaco.com/topic/319541-camera-shutter-sound/">http://theunlockr.com/2009/10/06/how-to-set-up-adb-usb-drivers-for-android-devices/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://log.largevoid.com/2011/08/disable-annoying-camera-and-video-sounds-on-rooted-android/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>New BIOS Power Management and Linux</title>
		<link>http://log.largevoid.com/2011/06/new-bios-power-management-and-linux/</link>
		<comments>http://log.largevoid.com/2011/06/new-bios-power-management-and-linux/#comments</comments>
		<pubDate>Thu, 16 Jun 2011 22:03:57 +0000</pubDate>
		<dc:creator>Paul</dc:creator>
				<category><![CDATA[Gotchas]]></category>
		<category><![CDATA[System Administration]]></category>
		<category><![CDATA[acpi]]></category>
		<category><![CDATA[bios]]></category>
		<category><![CDATA[intel]]></category>
		<category><![CDATA[msi]]></category>
		<category><![CDATA[power management]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://log.largevoid.com/?p=546</guid>
		<description><![CDATA[I just bought new hardware and wanted to run Linux on it. Hardware Specs: Motherboard: MSI P67A-C43 B3 CPU: Intel Core i5-2500K Memory: Corsair CMZ4GX3M1A1600C9 Vengeance 2x4GB DDR3 Video: MSI R5450-MD1GD3H 1GB DDR3 Case: Thermaltake V3 Black Edition Power: Diablotek PSDA600 DA Series 600W Storage: Seagate ST31000520AS Barracuda 1TB 5900 RPM My GO-TO Linux distro [...]]]></description>
			<content:encoded><![CDATA[<p>I just bought new hardware and wanted to run Linux on it.</p>
<p>Hardware Specs:</p>
<ul>
<li>Motherboard: MSI P67A-C43 B3</li>
<li>CPU: Intel Core i5-2500K</li>
<li>Memory: Corsair CMZ4GX3M1A1600C9 Vengeance 2x4GB DDR3</li>
<li>Video: MSI R5450-MD1GD3H 1GB DDR3</li>
<li>Case: Thermaltake V3 Black Edition</li>
<li>Power: Diablotek PSDA600 DA Series 600W</li>
<li>Storage: Seagate ST31000520AS Barracuda 1TB 5900 RPM</li>
</ul>
<p>My GO-TO Linux distro is Ubuntu, so I happily the downloaded <a href="http://www.ubuntu.com/download/server/download">the latest 64-bit server edition</a>, 11.04.  I copy the ISO to my <a href="http://www.amazon.com/SanDisk-Cruzer-Flash-Drive-SDCZ36-016G-A11/dp/B001T99ZTI/">16 GB SanDisk Cruzer USB stick</a> using the <a href="http://unetbootin.sourceforge.net/">UNetbootin software</a> mentioned as an alternative to usb-creator in the <a title="HOWTO Install Ubuntu from a USB stick" href="https://help.ubuntu.com/community/Installation/FromUSBStick">Ubuntu docs</a>.</p>
<p>Now we get ready to install.  After plugging in the USB drive and booting the computer with the USB drive, I&#8217;m presented with various boot options.  I go with the default.  A few seconds later, my computer restarts.  I can&#8217;t get through the install without the computer restarting at seemingly random intervals.</p>
<p>After thorough research, most options recommend appending <code>expert acpi=off</code> to the install command.  After doing this, I am at least partially successful (after a few restarts when my USB keyboard wasn&#8217;t recognized).   I am able to install the operating system.  However, when the installation is complete and I reboot, the operating system never successfully loads.  Instead, my computer endlessly reboots, attempts to load OS, fails and reboots.</p>
<p>After more reading (<a title="Ubuntu Boot Options" href="https://help.ubuntu.com/community/BootOptions">1</a>, <a title="acpi=off noapic nolapic" href="http://ubuntuforums.org/showthread.php?t=414884">2</a>), commentators recommend that I edit the grub boot configuration and append <code>acpi=off</code> to the boot command, run <code>update-grub</code> and restart.  This DID NOT WORK for me.  You can test to see if it does work by editing the boot command by typing &#8216;e&#8217; when you see the grub boot loader screen.</p>
<div id="attachment_554" class="wp-caption aligncenter" style="width: 430px"><img class="size-medium wp-image-554" title="Grub bootloader screen" src="http://log.largevoid.com/wp-content/uploads/2011/06/IMG_0106-420x315.jpg" alt="" width="420" height="315" /><p class="wp-caption-text">The Grub bootloader screen</p></div>
<div id="attachment_555" class="wp-caption aligncenter" style="width: 430px"><a href="http://log.largevoid.com/wp-content/uploads/2011/06/IMG_0107.jpg"><img class="size-medium wp-image-555" title="Editing the boot record" src="http://log.largevoid.com/wp-content/uploads/2011/06/IMG_0107-420x315.jpg" alt="" width="420" height="315" /></a><p class="wp-caption-text">Editing the Grub boot record</p></div>
<p>After sleeping on it, I did even more research (<a title="Why acpi=off" href="http://forums.opensuse.org/english/get-technical-help-here/install-boot-login/406732-acpi-off.html">1</a>) on what ACPI does.  Now, since I have super new hardware, I hardly expected Linux to support its cutting edge features.  So what are those cutting edge features?  Besides a clickable BIOS, most of those features pertain to new power management features of the newest Intel CPUs.</p>
<p>New power-related BIOS features (and my recommended states):</p>
<ul>
<li>EuP 2013 (<span style="color: green;">Enabled</span>)</li>
<li>CPU Phase Control (<span style="color: red;">Disabled</span>)</li>
<li>C1E Support <span style="color: red;">(Disabled</span>)</li>
<li>Intel C-State (<span style="color: red;">Disabled</span>)</li>
</ul>
<p>Through brute force, I was able to determine which power settings affected the Linux boot process.  I had to fully disable the Intel CPU-related power management.  This unfortunately means that my server will waste power when it&#8217;s not under load.  Too bad, huh?  Oh yeah, I reinstalled Ubuntu Server 11.04 after disabling these power settings in BIOS &#8212; you know, just in case.</p>
<p>So in summary, 1: disable CPU phase control, 2: disable C1E support, and 3: disable Intel C-State.  EuP 2013 can remain enabled, as I didn&#8217;t encounter any complications when it was enabled.</p>
<p style="text-align: center;"><img class="aligncenter size-medium wp-image-549" title="Power Management Summary" src="http://log.largevoid.com/wp-content/uploads/2011/06/IMG_0096-420x315.jpg" alt="" width="420" height="315" /></p>
<p>One more thing, if you&#8217;re doing a fresh install, may I recommend AHCI mode for your SATA drives?  Better to do this before you install the OS.  This option had nothing to do with the problem stated above, but is good to have.</p>
<div id="attachment_548" class="wp-caption aligncenter" style="width: 430px"><img class="size-medium wp-image-548 " title="SATA Mode - AHCI Enabled" src="http://log.largevoid.com/wp-content/uploads/2011/06/IMG_0104-420x315.jpg" alt="It's ok to enable AHCI" width="420" height="315" /><p class="wp-caption-text">It&#39;s ok to enable AHCI</p></div>
]]></content:encoded>
			<wfw:commentRss>http://log.largevoid.com/2011/06/new-bios-power-management-and-linux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery and Radio Inputs on Internet Explorer: Use Caution</title>
		<link>http://log.largevoid.com/2011/03/jquery-and-radio-inputs-on-internet-explorer-use-caution/</link>
		<comments>http://log.largevoid.com/2011/03/jquery-and-radio-inputs-on-internet-explorer-use-caution/#comments</comments>
		<pubDate>Wed, 30 Mar 2011 04:53:27 +0000</pubDate>
		<dc:creator>Paul</dc:creator>
				<category><![CDATA[Gotchas]]></category>
		<category><![CDATA[input]]></category>
		<category><![CDATA[internet explorer]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[onchange]]></category>

		<guid isPermaLink="false">http://log.largevoid.com/?p=524</guid>
		<description><![CDATA[Today&#8217;s entry comes from that fantastically obtuse world of Internet Exploder. The lesson today is: wrap your onchange functions in a container function. The problem: Radio input change events in Internet Explorer are not sufficiently executed when triggered using the jQuery.change method, passing in a named function reference as a parameter. The clicked radio button [...]]]></description>
			<content:encoded><![CDATA[<p>Today&#8217;s entry comes from that fantastically obtuse world of Internet Exploder.  The lesson today is: wrap your onchange functions in a container function.</p>
<p><strong>The problem:</strong> Radio input <code>change</code> events in Internet Explorer are not sufficiently executed when triggered using the <code>jQuery.change</code> method, passing in a named function reference as a parameter.  The clicked radio button does not remain selected after the event is fired.  No radio buttons are selected after the <code>change</code> method is called, even though the function reference is subsequently executed.</p>
<p><strong>The players:</strong><br />
Windows 7, Internet Explorer 8, jQuery 1.4.2, 1.4.3, and/or 1.4.4.</p>
<p><strong>Works:</strong><br />
<code>jQuery('input[name="radioSet"]').change(function() { updateDisplay(); });</code></p>
<p><strong>Doesn&#8217;t Work:</strong><br />
<code>jQuery('input[name="radioSet"]').change(updateDisplay);</code></p>
<p>That input referenced above is supposed to be a collection of radio buttons.  In html, it would look like:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;label&gt;&lt;input type=&quot;radio&quot; name=&quot;radioSet&quot; value=&quot;42&quot; /&gt; The Answer&lt;/label&gt;
&lt;label&gt;&lt;input type=&quot;radio&quot; name=&quot;radioSet&quot; value=&quot;?&quot; /&gt; The Question&lt;/label&gt;</pre></div></div>

<p>The <code>updateDisplay</code> is a function defined elsewhere that tries to read the value of the radio group.  It&#8217;s defined something like this:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">function</span> updateDisplay<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #003366; font-weight: bold;">var</span> value <span style="color: #339933;">=</span> jQuery<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'input[name=&quot;radioSet&quot;]'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">val</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span> value <span style="color: #339933;">==</span> <span style="color: #3366CC;">&quot;?&quot;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;What is the meaning of life, the universe, and everything?&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;Don't forget your towel.&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>The bewildered developer asks no further questions.  There is no good reason for using Internet Explorer.  The IE developers eat kittens.  This is just another demonic prank of theirs.  I hope you haven&#8217;t wasted too much time trying to figure this out.</p>
]]></content:encoded>
			<wfw:commentRss>http://log.largevoid.com/2011/03/jquery-and-radio-inputs-on-internet-explorer-use-caution/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Your Emails are Public Domain</title>
		<link>http://log.largevoid.com/2011/02/your-emails-are-public-domain/</link>
		<comments>http://log.largevoid.com/2011/02/your-emails-are-public-domain/#comments</comments>
		<pubDate>Mon, 14 Feb 2011 00:33:43 +0000</pubDate>
		<dc:creator>Paul</dc:creator>
				<category><![CDATA[Gotchas]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[hotmail]]></category>
		<category><![CDATA[logs]]></category>
		<category><![CDATA[MSN]]></category>
		<category><![CDATA[security]]></category>

		<guid isPermaLink="false">http://log.largevoid.com/?p=512</guid>
		<description><![CDATA[Here&#8217;s a scary little bit of information I uncovered by accident. I own and operate a local server. I don&#8217;t advertise its existence, as it&#8217;s primarily used as a local file server, backup, and job processing machine. One of my &#8220;constituents&#8221; had asked for some data that I happened to have archived a while back. [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a scary little bit of information I uncovered by accident.  I own and operate a local server.  I don&#8217;t advertise its existence, as it&#8217;s primarily used as a local file server, backup, and job processing machine.  One of my &#8220;constituents&#8221; had asked for some data that I happened to have archived a while back.  I placed the data on this server, generated a unique URL so that this person could access the data, and then I emailed the URL to him.  The email address is an &#8220;<strong>@hotmail.com</strong>&#8221; address.</p>
<p>I&#8217;m scrolling through my apache error logs, when I notice a 404 for a lower-case version of the unique URL described above.  When I traceroute the location of access, I notice the access came from an MSN machine in a different location than the person I had intended to send the link to.  The intended recipient had not left the state, let alone city, so it&#8217;s impossible that the accessor of the link is the intended recipient.  I know that this person has not forwarded or shared the URL, and I&#8217;m fairly confident that there is no spyware on this person&#8217;s computer.</p>
<p>The only logical explanation is that MSN (hotmail) is <em>skimming</em> emails, <em>harvesting</em> URLs to <em>populate</em> the Microsoft search engine.</p>
<p>If the above explanation holds, there are two very big problems with this practice.  First, it&#8217;s a violation of <strong>user privacy</strong>.  Second, it&#8217;s a <strong>security risk</strong>.  Imagine if the custom URL had an email address embedded in it?  Or worse, some confidential data.  Since the MSN link harvester followed the URL, it has unsuspectingly provided this private data to 3rd party machine via http server logs.</p>
<p>Want to embarrass someone? Send an email to someone with an @hotmail.com address, where the body of the message is  a bunch of URLs to sites of ill repute.  Include a url parameter implicating various members of congress (or other organization).  Have site&#8217;s records subpoenaed/published (perhaps a bit tricky, unless you happen to own the site of ill repute).  Let important persons attempt to explain how their credentials ended up in site&#8217;s records.</p>
<p>I do not recommend this, but maybe someone will finally hold Microsoft accountable for its invasion of privacy.</p>
<p><strong>TL;DR</strong> I emailed a URL to a friend with an @hotmail.com email address, an MSN bot followed the URL.  Hotmail.com does not protect its users&#8217; privacy.</p>
<p><strong>EDIT:</strong> It was brought to my attention that I have overlooked the possibility of clicked links being tracked and followed.  This would be similar to the <a href="http://searchengineland.com/google-bing-is-cheating-copying-our-search-results-62914">BingGate scandal</a> from a few weeks ago.  Refutation: <a href="http://www.puremango.co.uk/2011/02/what-on-earth-are-google-doing/">Bing is only tracking visited content</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://log.largevoid.com/2011/02/your-emails-are-public-domain/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Linux Mail Forwarding</title>
		<link>http://log.largevoid.com/2010/08/linux-mail-forwarding/</link>
		<comments>http://log.largevoid.com/2010/08/linux-mail-forwarding/#comments</comments>
		<pubDate>Mon, 23 Aug 2010 21:05:59 +0000</pubDate>
		<dc:creator>Paul</dc:creator>
				<category><![CDATA[Gotchas]]></category>
		<category><![CDATA[cron]]></category>
		<category><![CDATA[crontab]]></category>
		<category><![CDATA[foward]]></category>
		<category><![CDATA[mail]]></category>
		<category><![CDATA[sendmail]]></category>

		<guid isPermaLink="false">http://log.largevoid.com/?p=429</guid>
		<description><![CDATA[If you want to forward mail on a linux machine that you happen to have an account on, follow these simple steps. touch ~/.forward chmod 644 ~/.forward vi ~/.forward Contents of ~/.forward should be a comma or newline separated list of email addresses to forward mail to.  The following are correctly formatted: .forward files and [...]]]></description>
			<content:encoded><![CDATA[<p>If you want to forward mail on a linux machine that you happen to have an account on, follow these simple steps.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">touch</span> ~<span style="color: #000000; font-weight: bold;">/</span>.forward
<span style="color: #c20cb9; font-weight: bold;">chmod</span> <span style="color: #000000;">644</span> ~<span style="color: #000000; font-weight: bold;">/</span>.forward
<span style="color: #c20cb9; font-weight: bold;">vi</span> ~<span style="color: #000000; font-weight: bold;">/</span>.forward</pre></div></div>

<p>Contents of <code>~/.forward</code> should be a comma or newline separated list of email addresses to forward mail to.  The following are correctly formatted: <code>.forward</code> files and a brief description of each.</p>
<p>Forward all local email to <code>email@example.com</code>:</p>
<pre>email@example.com</pre>
<p>Forward all local email to both <code>email@example.com</code> and <code>alternate@domain.com</code>:</p>
<pre>email@example.com, alternate@domain.com</pre>
<p>Use the local mail spool, keep a copy in the user&#8217;s <code>~/archive/mail</code> file, <em>and</em> forward a copy to <code>email@example.com</code>:</p>
<pre>\user, "/home/user/archive/mail", email@example.com</pre>
<p>The <strong>permissions</strong> of the <code>.forward</code> file must be read-only for group and other.  Failure to secure your <code>.forward</code> file will cause sendmail to ignore its existence.</p>
<p>GOTCHA!</p>
]]></content:encoded>
			<wfw:commentRss>http://log.largevoid.com/2010/08/linux-mail-forwarding/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Big MySQL Table? Watch the keyfile Length</title>
		<link>http://log.largevoid.com/2010/08/big-mysql-table-watch-the-keyfile-length/</link>
		<comments>http://log.largevoid.com/2010/08/big-mysql-table-watch-the-keyfile-length/#comments</comments>
		<pubDate>Tue, 03 Aug 2010 02:07:17 +0000</pubDate>
		<dc:creator>Paul</dc:creator>
				<category><![CDATA[Gotchas]]></category>
		<category><![CDATA[CHECK TABLE]]></category>
		<category><![CDATA[index]]></category>
		<category><![CDATA[MAX_ROWS]]></category>
		<category><![CDATA[myisamchk]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[REPAIR TABLE]]></category>
		<category><![CDATA[USE_FRM]]></category>

		<guid isPermaLink="false">http://log.largevoid.com/?p=417</guid>
		<description><![CDATA[I made some large tables (around 3-4 billion records each) and then tried to create indexes on one column in each of them. I found that MySQL stopped at a seemingly arbitrary maximum index file size (.MYI file) for both of them. When I tried to open either table, I received an error message &#8220;ERROR [...]]]></description>
			<content:encoded><![CDATA[<p>I made some large tables (around 3-4 billion records each) and then tried to create indexes on one column in each of them. I found that MySQL stopped at a seemingly arbitrary maximum index file size (.MYI file) for both of them. When I tried to open either table, I received an error message &#8220;ERROR 1016 (HY000): Can&#8217;t open file: &#8216;mytable.MYI&#8217; (errno: 144)&#8221; indicating that the index file was crashed.</p>
<p><code>CHECK TABLE mytable QUICK</code> reported &#8216;warning : Keyfile is almost full, 17179867136 of 17179867136 used&#8217; Then <code>myisamchk -dv mytable</code> reported similar information under &#8216;Max keyfile length,&#8221; and reported &#8220;Keyfile pointer (bytes): 3&#8242;</p>
<p>After a little digging around, I realized that a 3-byte keyfile pointer only allows the index file to hold 2^24 blocks (about 16 million blocks of 1024 bytes each). My index file was holding about 110 keys per block (e.g., each record needed 4 bytes for the key value, plus 4 bytes for the datafile pointer, and maybe one byte for null/housekeeping, and then each block kept a little more empty space). So the 3-byte keyfile pointer only allowed MySQL to index about 1.8 billion records. Then it gave up, leaving a corrupted index file.</p>
<p>I have found no documentation for how MySQL decides how big a keyfile pointer to use in the .MYI file. I had no trouble adding 3-4 billion records to the MYD file, so it didn&#8217;t occur to me that there would be a problem with the MAX_ROWS clause of the CREATE TABLE command (which I hadn&#8217;t specified). But that turned out to be the problem.</p>
<p>I recovered my data table without the index file, then issued <code>ALTER TABLE <mytable> MAX_ROWS=4000000000, ADD INDEX (mykey);</code> and now it looks like everything will be OK.</p>
<p>Here&#8217;s how I got my table back, without the index file (similar to what&#8217;s described above):</p>
<ol>
<li>make a backup of the data file (mytable.myd), just in case</li>
<li>create a new empty table with the same structure as the existing table, but no index keys.</li>
<li>copy the .FRM and .MYI files from the new (empty) table over the existing mytable.frm and mytable.myi files.</li>
<li>issue <code>REPAIR TABLE mytable USE_FRM;</code> It is very important to include the USE_FRM clause. That way, MySQL knows to make a new (empty) .MYI file that matches the .MYD file, rather than truncating the .MYD file to match the .MYI file. You will eventually get a message along the lines of &#8220;Number of rows changed from 0 to xxxx&#8221;.</li>
<li>Now you have a working table, with no indexes. Then you can set MAX_ROWS to something appropriate, and try again to make the indexes.</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://log.largevoid.com/2010/08/big-mysql-table-watch-the-keyfile-length/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Files Ending in .php.html Unexpectedly Being Processed by the PHP Engine</title>
		<link>http://log.largevoid.com/2010/07/files-ending-in-php-html-unexpectedly-being-processed-by-the-php-engine/</link>
		<comments>http://log.largevoid.com/2010/07/files-ending-in-php-html-unexpectedly-being-processed-by-the-php-engine/#comments</comments>
		<pubDate>Thu, 29 Jul 2010 18:14:29 +0000</pubDate>
		<dc:creator>Paul</dc:creator>
				<category><![CDATA[Gotchas]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[httpd.conf]]></category>
		<category><![CDATA[mod_php]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[php.conf]]></category>
		<category><![CDATA[phpDocumentor]]></category>
		<category><![CDATA[syntax error]]></category>

		<guid isPermaLink="false">http://log.largevoid.com/?p=413</guid>
		<description><![CDATA[Apache/2.2.3 (Red Hat), PHP 5.1.6 and phpDocumentor v1.4.3 weren&#8217;t getting along. phpDocumentor was generating HTML with filenames of the form script.php.html. Apache&#8217;s mod_php wanted to interpret script.php.html as a PHP script and was throwing errors about improper formatting: PHP Parse error: syntax error, unexpected T_STRING in /var/www/default/docs/out/lib/lib/_php---obj---FFT.php.html on line 1, referer:... I wanted script.php.html to [...]]]></description>
			<content:encoded><![CDATA[<p>Apache/2.2.3 (Red Hat), PHP 5.1.6 and phpDocumentor v1.4.3  weren&#8217;t getting along.  phpDocumentor was generating HTML with filenames of the form <em>script.php.html</em>. Apache&#8217;s mod_php wanted to interpret script.php.html as a PHP script and was throwing errors about improper formatting:</p>
<p><code>PHP Parse error:  syntax error, unexpected T_STRING in /var/www/default/docs/out/lib/lib/_php---obj---FFT.php.html on line 1, referer:...</code></p>
<p>I wanted script<em>.php.html</em> to be treated as an HTML file and not be processed by the php engine.  This double-extension was causing me grief.  The docs claimed that only files <strong>ending </strong>in the extension will be handled by the AddHandler command.  I was incredulous of this claim, especially in light of Apache&#8217;s ability to do content negotiation with those <em>.var </em>language files.</p>
<p>Q: Why was this happening?  I first guessed it may have been due to mod_mime, but quickly ruled that out.   I then guessed it was the MultiView option&#8230; Maybe, this is one mechanism that governs content negotiation&#8230; The documentation claims:</p>
<pre># The index.html.var file (a type-map) is used to deliver content-
# negotiated documents.  The MultiViews Option can be used for the
# same purpose, but it is much slower.</pre>
<p>This statement lead me to suspect that my problem may actually be caused by an issue with the <em>AddHandler</em> option, since an AddHandler command must be executed to associate <code>type-map</code> with that <code>.var</code> extension.</p>
<p>Ah me, time is money, and in the end, I actually didn&#8217;t diagnose the problem, but I did discover (by trial and error) a <strong>workaround</strong>.</p>
<p>In file <em>/etc/httpd/conf.d/php.conf</em>, I surrounded</p>
<pre>AddHandler php5-script .php
AddType text/html .php
</pre>
<p>with</p>
<pre>&lt;Files ~ "\.php$"&gt;
  AddHandler php5-script .php
  AddType text/html .php
&lt;/Files&gt;</pre>
<p>Now, only files explicitly ending in &#8220;.php&#8221; will be treated as a php5-script.  Take that!</p>
]]></content:encoded>
			<wfw:commentRss>http://log.largevoid.com/2010/07/files-ending-in-php-html-unexpectedly-being-processed-by-the-php-engine/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP 5.1+ Date vs Strftime Timezone Annoyance</title>
		<link>http://log.largevoid.com/2010/02/php-date-strftime-timezone-annoyance/</link>
		<comments>http://log.largevoid.com/2010/02/php-date-strftime-timezone-annoyance/#comments</comments>
		<pubDate>Mon, 22 Feb 2010 02:10:45 +0000</pubDate>
		<dc:creator>Paul</dc:creator>
				<category><![CDATA[Gotchas]]></category>
		<category><![CDATA[gotcha]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[putenv]]></category>
		<category><![CDATA[reverse compatable]]></category>
		<category><![CDATA[timezone]]></category>

		<guid isPermaLink="false">http://log.largevoid.com/?p=302</guid>
		<description><![CDATA[In the old PHP4 days, you could change the default timezone by: putenv("TZ=America/Los_Angeles");. In php5, you can still do this and it&#8217;ll work for strtotime, strftime, gmstftime (maybe more). It will not work for methods date and gmdate. For those, starting in version 5.1, you&#8217;ll need to call date_default_timezone_set("America/Los_Angeles");. This is just another one of [...]]]></description>
			<content:encoded><![CDATA[<p>In the old PHP4 days, you could change the default timezone by: <code>putenv("TZ=America/Los_Angeles");</code>.  In php5, you can still do this and it&#8217;ll work for strtotime, strftime, gmstftime (maybe more).  It will not work for methods date and gmdate.  For those, starting in version 5.1, you&#8217;ll need to call <code>date_default_timezone_set("America/Los_Angeles");</code>.  This is just another one of those annoying things that make PHP a dying language.</p>
<p>Together, to be cross-version compliant:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #990000;">putenv</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;TZ=America/Los_Angeles&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> <span style="color: #990000;">function_exists</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;date_default_timezone_set&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> 
 <span style="color: #990000;">date_default_timezone_set</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;America/Los_Angeles&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>We need both to be reverse-compatible with PHP4.</p>
]]></content:encoded>
			<wfw:commentRss>http://log.largevoid.com/2010/02/php-date-strftime-timezone-annoyance/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
<!-- This Quick Cache file was built for (  log.largevoid.com/cat/gotchas/feed/ ) in 0.53245 seconds, on Feb 8th, 2012 at 4:36 am UTC. -->
<!-- This Quick Cache file will automatically expire ( and be re-built automatically ) on Feb 8th, 2012 at 5:36 am UTC -->
