<?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>Hot Koehls</title>
	<atom:link href="http://frankkoehl.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://frankkoehl.com</link>
	<description>The more you know, the more you don&#039;t know</description>
	<lastBuildDate>Thu, 28 Jun 2012 02:54:36 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>Display line numbers in WebSVN file detail view</title>
		<link>http://frankkoehl.com/2012/06/display-line-numbers-in-websvn-file-detail-view/</link>
		<comments>http://frankkoehl.com/2012/06/display-line-numbers-in-websvn-file-detail-view/#comments</comments>
		<pubDate>Wed, 20 Jun 2012 13:17:30 +0000</pubDate>
		<dc:creator>Frank</dc:creator>
				<category><![CDATA[For techies]]></category>

		<guid isPermaLink="false">http://frankkoehl.com/?p=1477</guid>
		<description><![CDATA[WebSVN is an open source subversion repository browser written in PHP, offering a compelling alternative to the more obtuse ViewVC and the commercial Atlassian Fisheye. By default, WebSVN does not display line numbers when looking at the contents of a single file (i.e. URL&#8217;s containing filedetails.php). Fortunately, this is easily corrected if you enable Geshi [...]]]></description>
				<content:encoded><![CDATA[<p><a href="http://www.websvn.info/">WebSVN</a> is an open source subversion repository browser written in PHP, offering a compelling alternative to the more obtuse <a href="http://www.viewvc.org/">ViewVC</a> and the commercial <a href="http://www.atlassian.com/software/fisheye/overview">Atlassian Fisheye</a>.</p>
<p>By default, WebSVN does not display line numbers when looking at the contents of a single file (i.e. URL&#8217;s containing <code>filedetails.php</code>). Fortunately, this is easily corrected if you enable Geshi syntax highlighting. It&#8217;s enabled by default, but double-check the contents of <code>include/config.php</code>, making sure that the line <code>$config->useGeshi();</code> is present and not commented out.</p>
<p>With that done, open include/svnlook.php and go to line 806, which looks like this:</p>
<pre class="brush: php; title: ; notranslate">$this-&gt;geshi-&gt;set_tab_width($this-&gt;repConfig-&gt;getExpandTabsBy());</pre>
<p>Create a new line and insert the following immediately after it:</p>
<pre class="brush: php; title: ; notranslate">$this-&gt;geshi-&gt;enable_line_numbers(GESHI_NORMAL_LINE_NUMBERS);</pre>
<p>Save your changes and reload the file detail view, and Geshi should now display line numbers along the left-hand margin. With this simple change, I use WebSVN to effectively conduct group code reviews.</p>
<p>Note that WebSVN can still choose not to use Geshi if there&#8217;s no support for the language in question, in which case there won&#8217;t be any line numbers.</p>
]]></content:encoded>
			<wfw:commentRss>http://frankkoehl.com/2012/06/display-line-numbers-in-websvn-file-detail-view/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>It&#8217;s dangerous to go alone</title>
		<link>http://frankkoehl.com/2012/03/its-dangerous-to-go-alone/</link>
		<comments>http://frankkoehl.com/2012/03/its-dangerous-to-go-alone/#comments</comments>
		<pubDate>Wed, 07 Mar 2012 20:50:19 +0000</pubDate>
		<dc:creator>Frank</dc:creator>
				<category><![CDATA[For everyone]]></category>

		<guid isPermaLink="false">http://frankkoehl.com/?p=1469</guid>
		<description><![CDATA[Take one of these! Print, hang outside your office or cubicle. Your goblin-slaying co-workers will thank you.]]></description>
				<content:encoded><![CDATA[<p>Take one of these!</p>
<p><a href="http://frankkoehl.com/wp-content/uploads/Dangerous-go-alone.bmp"><img src="http://frankkoehl.com/wp-content/uploads/Dangerous-go-alone.bmp" alt="Take this!" title="It&#039;s dangerous to go alone" class="alignnone size-full wp-image-1470" /></a></p>
<p>Print, hang outside your office or cubicle. Your goblin-slaying co-workers will thank you.</p>
]]></content:encoded>
			<wfw:commentRss>http://frankkoehl.com/2012/03/its-dangerous-to-go-alone/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Create Self-Signed Wildcard SSL Certificate</title>
		<link>http://frankkoehl.com/2012/02/create-self-signed-wildcard-ssl-certificate/</link>
		<comments>http://frankkoehl.com/2012/02/create-self-signed-wildcard-ssl-certificate/#comments</comments>
		<pubDate>Fri, 24 Feb 2012 15:16:34 +0000</pubDate>
		<dc:creator>Frank</dc:creator>
				<category><![CDATA[For techies]]></category>

		<guid isPermaLink="false">http://frankkoehl.com/?p=1437</guid>
		<description><![CDATA[Here&#8217;s the command list to quickly create a self-signed SSL certificate from the Linux command line. You can copy/paste each line to the shell to generate the key. It assumes you will place each set of SSL files under a directory assigned per domain; at the end you will have a directory that contains the [...]]]></description>
				<content:encoded><![CDATA[<p>Here&#8217;s the command list to quickly create a self-signed SSL certificate from the Linux command line. You can copy/paste each line to the shell to generate the key.</p>
<p>It assumes you will place each set of SSL files under a directory assigned per domain; at the end you will have a directory that contains the newly created <code>.host</code>, <code>.key</code>, <code>.pem</code> and <code>.info</code> files.</p>
<pre class="brush: bash; title: ; notranslate">
mkdir /etc/ssl/subdomain.domain.com

cd /etc/ssl/subdomain.domain.com

openssl genrsa 2048 &gt; host.key

openssl req -new -x509 -nodes -sha1 -days 3650 -key host.key &gt; host.cert

# Enter subdomain.domain.com for Common Name. It's the 6th option in the dialog.
# All other options can be left blank for defaults
# For wildcard SSL, enter *.domain.com

openssl x509 -noout -fingerprint -text &lt; host.cert &gt; host.info

cat host.cert host.key &gt; host.pem

chmod 400 host.key host.pem
</pre>
<p>A signed SSL certificate is necessary for all your public-facing domains. But you can save yourself a lot of time and money by using self-signed certificates on sites that have a limited or more technical audience. For example, I use self-signed certificates for all the installations of phpMyAdmin that I set up.</p>
<p>The protection you get from a self-signed certificate is exactly the same as one you pay for; the browser warning that pops up is the only difference. Click through it and you&#8217;re good to go.</p>
]]></content:encoded>
			<wfw:commentRss>http://frankkoehl.com/2012/02/create-self-signed-wildcard-ssl-certificate/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>What comes after the yottabyte?</title>
		<link>http://frankkoehl.com/2012/01/what-comes-after-the-yottabyte/</link>
		<comments>http://frankkoehl.com/2012/01/what-comes-after-the-yottabyte/#comments</comments>
		<pubDate>Mon, 16 Jan 2012 22:52:04 +0000</pubDate>
		<dc:creator>Frank</dc:creator>
				<category><![CDATA[For everyone]]></category>

		<guid isPermaLink="false">http://frankkoehl.com/?p=1433</guid>
		<description><![CDATA[I was reviewing the data storage requirements for a project recently which had me talking in terabytes, and thinking long-term in petabytes. For those of you who don&#8217;t know, tera- and peta- are the binary prefixes for measuring units of digital information that come after giga- (as in &#8220;gigabyte&#8221;). The list of prefixes, which most [...]]]></description>
				<content:encoded><![CDATA[<p>I was reviewing the data storage requirements for a project recently which had me talking in terabytes, and thinking long-term in petabytes. For those of you who don&#8217;t know, <em>tera-</em> and <em>peta-</em> are the binary prefixes for measuring units of digital information that come after <em>giga-</em> (as in &#8220;gigabyte&#8221;). </p>
<p>The list of prefixes, which most people started using with the term &#8220;kilobyte,&#8221; are collectively called the <strong>SI Prefixes</strong>. SI prefixes are defined under the International System of Units (&#8220;SI&#8221; for short), which is maintained by the International Bureau of Weights and Measures.</p>
<p>But there&#8217;s a problem; currently the list has 5 more prefixes past giga: tera, peta, exa, zetta, and yotta. Translation: we&#8217;re out of prefixes in just a few more generations, probably faster if Moore&#8217;s Law has anything to say about it. Indeed, you may have noticed how much quicker the public dialog went from megabyte to gigabyte than it did to make the same transition from kilobyte to megabyte. What to do?</p>
<p>One answer is to draw from existing lists of unofficial prefixes, currently used mostly by theoretical mathematicians. But given the speed at which we are advancing, it is safe to assume that we&#8217;re going to speed through individual prefixes quickly, resulting in more terminology overlap in common vernacular. For example, data centers are already discussing their capacity in the petabyte and exabyte range, and we haven&#8217;t even seen those hit mainstream yet.</p>
<p>Therefore I posit that it&#8217;s worth considering using a system that has <strong>inherent ordering</strong>, i.e. an existing list that we can <strong>repurpose</strong>. This speeds adoption, eliminates confusion, and solidifies the naming convention for a much longer period with minimal effort. </p>
<p>Looking at the problem in this light, I quickly identified the <strong>Greek Alphabet</strong> as very viable candidate:</p>
<ul>
<li>Current SI prefixes match mnemonically with Greek letters (you can hear the similarity between &#8220;gigabyte&#8221; and &#8220;thetabyte&#8221;).</li>
<li>The list is universal, eliminating the need to debate on future prefix selection and ordering. Anyone who&#8217;s suffered &#8220;death by committee&#8221; knows what I&#8217;m talking about.</li>
<li>It can instantly extend the SI prefix list another 24 levels.</li>
<li>The Greeks themselves attached numerical values to each letter.</li>
<li>There is some precedent: The National Weather Service names tropical storms after Greek letters once the A-Z naming list is exhausted.</li>
</ul>
<p>Best of all, the doomsayers of the future might point to the Omegabyte as a sign of the end times. I think I know what the Mayan&#8217;s were thinking:</p>
<p><img src="http://frankkoehl.com/wp-content/uploads/2231353.jpg" alt="Mayan Calendar Mystery" title="Mayan Calendar Mystery" width="425" height="500" class="aligncenter size-full wp-image-1434" /></p>
<p>Additional reading and sources:</p>
<ul>
<li><a href="http://en.wikipedia.org/wiki/SI_prefix">Wikipedia: SI prefix list</a></li>
<li><a href="http://en.wikipedia.org/wiki/Greek_alphabet">Wikipedia: Greek Alphabet</a></li>
<li><a href="http://en.wikipedia.org/wiki/Non-SI_unit_prefix">Wikipedia: Non-SI unit prefixes</a></li>
<li><a href="http://www.nhc.noaa.gov/aboutnames.shtml">NOAA Worldwide Tropical Cyclone Names</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://frankkoehl.com/2012/01/what-comes-after-the-yottabyte/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Write code like they do in Hollywood</title>
		<link>http://frankkoehl.com/2011/12/write-code-like-they-do-in-hollywood/</link>
		<comments>http://frankkoehl.com/2011/12/write-code-like-they-do-in-hollywood/#comments</comments>
		<pubDate>Tue, 13 Dec 2011 23:07:13 +0000</pubDate>
		<dc:creator>Frank</dc:creator>
				<category><![CDATA[For everyone]]></category>

		<guid isPermaLink="false">http://frankkoehl.com/?p=1419</guid>
		<description><![CDATA[Want to look like a badass hacker in front of your friends? Head over hackertyper.com and just start pushing buttons. As long as you avoid mashing your palms against the keyboard, your non-techie friends will look at you like this.]]></description>
				<content:encoded><![CDATA[<p>Want to look like a badass hacker in front of your friends?</p>
<p><a href="http://hackertyper.com/" title="Hacker Typer">Head over hackertyper.com and just start pushing buttons.</a></p>
<p>As long as you avoid mashing your palms against the keyboard, your non-techie friends will look at you like this.</p>
<p><img src="http://frankkoehl.com/wp-content/uploads/post-73-1208845854-300x160.jpg" alt="matrix shades" title="matrix shades" width="300" height="160" class="aligncenter size-medium wp-image-1420" /></p>
]]></content:encoded>
			<wfw:commentRss>http://frankkoehl.com/2011/12/write-code-like-they-do-in-hollywood/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Brian Rolle machine gun celebration</title>
		<link>http://frankkoehl.com/2011/11/brian-rolle-machine-gun-celebration/</link>
		<comments>http://frankkoehl.com/2011/11/brian-rolle-machine-gun-celebration/#comments</comments>
		<pubDate>Mon, 21 Nov 2011 18:53:36 +0000</pubDate>
		<dc:creator>Frank</dc:creator>
				<category><![CDATA[For everyone]]></category>

		<guid isPermaLink="false">http://frankkoehl.com/?p=1403</guid>
		<description><![CDATA[I&#8217;m not much of a sports guy, but this sack celebration by Eagles&#8217; Linebacker Brian Rolle in last night&#8217;s game against the Giants has to be one of the best defensive celebrations I&#8217;ve ever seen. Equal parts hilarious and badass! (Apologies for the gif format, the NFL gestapo makes it hard to find real video [...]]]></description>
				<content:encoded><![CDATA[<p>I&#8217;m not much of a sports guy, but this sack celebration by Eagles&#8217; Linebacker Brian Rolle in last night&#8217;s game against the Giants has to be one of the best defensive celebrations I&#8217;ve ever seen.</p>
<p><a href="http://frankkoehl.com/wp-content/uploads/452140312.gif"><img src="http://frankkoehl.com/wp-content/uploads/452140312.gif" alt="Brian Rolle machine gun celebration" title="Brian Rolle machine gun celebration" width="600" height="334" class="alignnone size-full wp-image-1404" /></a></p>
<p>Equal parts hilarious and badass!</p>
<p>(Apologies for the gif format, the NFL gestapo makes it hard to find real video clips.)</p>
]]></content:encoded>
			<wfw:commentRss>http://frankkoehl.com/2011/11/brian-rolle-machine-gun-celebration/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Fix WordPress &#8220;Fatal error: Allowed memory size&#8221; messages</title>
		<link>http://frankkoehl.com/2011/10/fix-wordpress-fatal-error-allowed-memory-size-messages/</link>
		<comments>http://frankkoehl.com/2011/10/fix-wordpress-fatal-error-allowed-memory-size-messages/#comments</comments>
		<pubDate>Thu, 27 Oct 2011 04:38:51 +0000</pubDate>
		<dc:creator>Frank</dc:creator>
				<category><![CDATA[For techies]]></category>

		<guid isPermaLink="false">http://frankkoehl.com/?p=1391</guid>
		<description><![CDATA[You may (or may not) have noticed this site was down for the past few days, displaying a blank page no matter what URL was entered. After recalling that I had turned off PHP error onscreen outputting, I was presented with this lovely message: Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to [...]]]></description>
				<content:encoded><![CDATA[<p>You may (or may not) have noticed this site was down for the past few days, displaying a blank page no matter what URL was entered. After recalling that I had turned off PHP error onscreen outputting, I was presented with this lovely message:</p>
<pre>
Fatal error: Allowed memory size of 33554432 bytes exhausted 
(tried to allocate XX bytes) in /some/file on line XX
</pre>
<p>This is a general PHP error, but the exact amount (<code>33554432 bytes</code>) occurs very frequently on WordPress sites. Here&#8217;s what&#8217;s happening, and how to fix it.</p>
<p>Every installation of PHP has an ini value called <code>memory_limit</code>, which hardcaps how much memory PHP may use on any given request. There are other ini settings that dictate the memory usage for specific actions, like <code>post_max_size</code>, but this one is universally applied; you can&#8217;t load anymore than what this value dictates.</p>
<p>I do a lot of stuff with files in PHP, so I blow this value out from it&#8217;s default of 128 MB up to 2 GB. I set this globally in my <code>php.ini</code> file like so:</p>
<pre>memory_limit = 2G</pre>
<p>I could also set this value from inside an .htaccess file:</p>
<pre>php_value memory_limit 2G</pre>
<p>Since this value was set before the site even loads, imagine my surprise when PHP is telling me that the limit is now 33554432 bytes, or 32 MB. The limit was changed by a define in WordPress called <code>WP_MEMORY_LIMIT</code>. </p>
<p>Here&#8217;s where things go awry. WordPress tries to check the existing <code>memory_limit</code> before applying it&#8217;s own terms, however <strong>the value must be set in terms of MB</strong>. Look back at my example settings; the PHP memory shorthand allows me to set in gigabytes using a &#8220;<code>G</code>&#8220;. But WordPress does a straight integer comparison to figure out if the existing setting is more/less than 32 MB. Here&#8217;s the offending code, a portion of an if statement on line 42 in <code>wp-includes/default-constants.php</code></p>
<pre>( (int) @ini_get('memory_limit') < abs(intval(WP_MEMORY_LIMIT)) ) )</pre>
<p>What you end with in that sample is essentially <code>if (2 < 32)</code>, which resolves true and thus WordPress applies it's own default limits.</p>
<p>You have three options to rectify the situation: two easy fixes, plus one badass "server-baller" fix. First the easy ones. As WordPress <a href="http://codex.wordpress.org/Editing_wp-config.php#Increasing_memory_allocated_to_PHP">outlines in the article on increasing memory</a>, simply define <code>WP_MEMORY_LIMIT</code> in <code>wp-config.php</code> using MB syntax. If I wanted to set it to 2 GB, it would look like this:</p>
<pre>define('WP_MEMORY_LIMIT', '2048M');</pre>
<p>Your value will be honored as long as it is an integer value greater than 32, but could break if WordPress changes it's memory size comparison calculation.</p>
<p>Alternatively, I could change my the <code>memory_limit</code> setting directly in <code>php.ini</code> or <code>.htaccess</code> to use MB syntax:</p>
<pre>

memory_limit = 2048M

[.htaccess]
php_value memory_limit 2048M
</pre>
<p>Realistically I would probably edit php.ini. Well, that is, I <strong>would</strong>, if I didn't know about the badass server-baller third option, which overrides <code>php.ini</code> AND prevents WordPress (or any other site for that matter) from making any changes to the value.</p>
<p>Look back at my <code>.htaccess</code> setting, and notice that I set the value using the command <code>php_value</code>. PHP has a similar command called <code>php_<span class='red'>admin</span>_value</code>, which you can use for setting all the same stuff as <code>php_value</code>. </p>
<p>The difference: <code>php_admin_value</code> can only be set within Apache configurations, i.e. it <strong>cannot</strong> be used inside of <code>.htaccess</code> files. Furthermore, any value set using <code>php_admin_value</code> cannot be overridden by any later calls to <code>php_value</code> or <code>ini_set</code>. You can override <code>php.ini</code> defaults, and lock that value in for the remainder of the request.</p>
<p>So back to our WordPress example, I opened the <code>VirtualHost</code> for frankkoehl.com and entered this line:</p>
<pre>php_admin_value memory_limit 2G</pre>
<p>Now the site will always allow a memory limit of 2 GB, no matter what. WordPress can try and set whatever value it likes, it will never be recognized.</p>
<p>Note that this function requires that you have access to Apache configurations, at least the ones running your site. Most shared hosting packages won't offer this level of access.</p>
<p>It's worth mentioning that WordPress sets a default value of 32 MB, lower than PHP's own default of 128 MB. I disagree that such a low limit is necessary, but they are trying to be good stewards to servers everywhere, so I can see where they're coming from. </p>
<p>I still have no idea why this memory issue popped up in the first place, but it gave me an excuse to share a cool configuration option that has saved me from having to scour code on several bloated, crappy sites to find obscure ini settings. I have a recent <a href="http://stackoverflow.com/questions/5628148/disable-e-deprecated-in-php-error-log">real-world example you can read about on Stack Overflow</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://frankkoehl.com/2011/10/fix-wordpress-fatal-error-allowed-memory-size-messages/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Recover hijacked default keyword search engine in Firefox</title>
		<link>http://frankkoehl.com/2011/09/recover-hijacked-default-keyword-search-engine-in-firefox/</link>
		<comments>http://frankkoehl.com/2011/09/recover-hijacked-default-keyword-search-engine-in-firefox/#comments</comments>
		<pubDate>Fri, 09 Sep 2011 18:47:16 +0000</pubDate>
		<dc:creator>Frank</dc:creator>
				<category><![CDATA[For everyone]]></category>

		<guid isPermaLink="false">http://frankkoehl.com/?p=1384</guid>
		<description><![CDATA[Earlier today I installed what I thought was an update to the Xvid codec in order to watch a video. I should have been more careful with the source, as their installer proceeded to modify my Firefox installation, adding some junk toolbar called &#8220;Start Now&#8221; and changing my default search engine to Bing. (Sidebar: they [...]]]></description>
				<content:encoded><![CDATA[<p>Earlier today I installed what I <strong>thought</strong> was an update to the Xvid codec in order to watch a video. I should have been more careful with the source, as their installer proceeded to modify my Firefox installation, adding some junk toolbar called &#8220;Start Now&#8221; and changing my default search engine to Bing.</p>
<p>(Sidebar: they can plead ignorance all they want, I&#8217;m certain the MS overlords are using every back-alley approach they can find to break the Google stranglehold.)</p>
<p>The toolbar was easy enough to remove, find it in the addons and push the &#8220;Remove&#8221; button. Changing my keyword search engine back proved a little more difficult.</p>
<p>A little background: the <em>keyword search engine</em> is the site that comes up when you type a word or phrase (not a URL) into the address bar (not the search bar). For example, if you open Firefox, enter &#8220;hot koehl&#8221;, and click go, you&#8217;ll likely end up on a Google search results page. I disable the search box entirely and use this method for almost all my searching. Very handy.</p>
<p>These asshats modified the Firefox configuration to send me to Bing without any warning or consent. To change it back, open a new tab and type <code>about:config</code> in the address bar. Enter the phrase <code>keyword.url</code> in the search bar that appears near the top.</p>
<p>The default is Google, so we can simply reset it by right-clicking the line and choosing the &#8220;Reset&#8221; option. Restart your browser and you should be good to go.</p>
<p>This type of adware typically modifies the search bar as well, so you should have a look at the config settings for <code>browser.search</code> while you&#8217;re at it. Config entries appear in bold if they&#8217;ve been modified from the default value.</p>
<p><a href="http://kb.mozillazine.org/Keyword.url">Further reading on Firefox&#8217;s <code>keyword</code> functionality found over at mozillaZine.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://frankkoehl.com/2011/09/recover-hijacked-default-keyword-search-engine-in-firefox/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using hashmarks for URL anchors in Apache rewrites</title>
		<link>http://frankkoehl.com/2011/05/using-hashmarks-for-url-anchors-in-apache-rewrites/</link>
		<comments>http://frankkoehl.com/2011/05/using-hashmarks-for-url-anchors-in-apache-rewrites/#comments</comments>
		<pubDate>Wed, 04 May 2011 18:09:13 +0000</pubDate>
		<dc:creator>Frank</dc:creator>
				<category><![CDATA[For techies]]></category>

		<guid isPermaLink="false">http://frankkoehl.com/?p=1338</guid>
		<description><![CDATA[Today I had to make an Apache rewrite that redirected a custom URL not only to a different page, but also to a specific anchor link on the destination page. In other words, /foobar had to actually load /some/other/url#foobar. However, by default Apache rewrites will escape the hash (#) symbol, converting to its hexcode equivalent [...]]]></description>
				<content:encoded><![CDATA[<p>Today I had to make an Apache rewrite that redirected a custom URL not only to a different page, but also to a specific anchor link on the destination page. In other words, <code>/foobar</code> had to actually load <code>/some/other/url#foobar</code>.</p>
<p>However, by default Apache rewrites will escape the hash <code>(#)</code> symbol, converting to its hexcode equivalent <code>%23</code>. </p>
<p>So this rewrite&#8230;</p>
<pre>RewriteRule ^/foobar/?$ /some/other/url#foobar/ [R=301,L]</pre>
<p>will produce this URL&#8230;</p>
<pre>http://example.com/some/other/url%23foobar</pre>
<p>In order to make this rewrite work, we must <strong>prevent Apache from escaping the hash mark</strong> by using the <code>noescape</code> flag. A little tweak to the rewrite, and we&#8217;re good to go&#8230;</p>
<pre>RewriteRule ^/foobar/?$ /some/other/url#foobar/ [R=301,L,NE]</pre>
<p>See that little <code>NE</code> on the end? That&#8217;s all we need to make rewrite anchors work.</p>
<p>Documentation on all the rewrite flags can be found in the <a href="http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html#rewriterule">Apache docs for the RewriteRule Directive</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://frankkoehl.com/2011/05/using-hashmarks-for-url-anchors-in-apache-rewrites/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Remove parent directories from tar archives</title>
		<link>http://frankkoehl.com/2011/04/remove-parent-directories-from-tar-archives/</link>
		<comments>http://frankkoehl.com/2011/04/remove-parent-directories-from-tar-archives/#comments</comments>
		<pubDate>Sun, 10 Apr 2011 18:43:52 +0000</pubDate>
		<dc:creator>Frank</dc:creator>
				<category><![CDATA[For techies]]></category>

		<guid isPermaLink="false">http://frankkoehl.com/?p=1335</guid>
		<description><![CDATA[You run a Linux web server, and have painstakingly crafted custom backup processes for all your important data. Undoubtedly, the backup copies end up being stored in the form of a tar archive. Everything works great &#8212; copies are made, compressed, and sent off-site. There&#8217;s just one naggy little issue: whenever you open one of [...]]]></description>
				<content:encoded><![CDATA[<p>You run a Linux web server, and have painstakingly crafted custom backup processes for all your important data. Undoubtedly, the backup copies end up being stored in the form of a <a href="http://www.computerhope.com/unix/utar.htm">tar archive</a>. Everything works great &#8212; copies are made, compressed, and sent off-site. There&#8217;s just one naggy little issue: whenever you open one of those tar backups, it includes the entire directory tree above the folder you actually need. </p>
<p>This problem always drove me nuts when creating MySQL database backups. I want to make a tar backup of <code>/var/lib/mysql/database_name</code> and call it <code>database_name.tar.gz</code>. If I then unpack the tar under <code>/root</code>, I&#8217;ll have a bunch of worthless subfolders to drill down through: <code>/root<strong color="red">/var/lib/mysql/</strong>database_name</code>. All I really want is the <code>database_name</code> folder, the <code>/var/lib/mysql/</code> parent directories can all go away.</p>
<p>Here&#8217;s how to get rid of those pesky parent folders once and for all. Before running your tar command, you must first use <code>cd</code> to move into the parent directory that contains the folder you want. Then, within your call to tar, leave the parent folders off your target files/folders.</p>
<p>Here&#8217;s the command sequence for previous example:</p>
<pre>
cd /var/lib/mysql
tar -czf /any/folder/you/want/database_name.tar.gz database_name
</pre>
<p>The resulting file will unpack directly into a single subfolder called <code>database_name</code>.</p>
<p>If you run your tar process as part of a larger scripting event, your script might not run/maintain a shell interface. In these cases, the <code>cd</code> command will be executed in a vacuum, and won&#8217;t have any effect. I run into this problem when I try to perform shell magic inside of PHP scripts. </p>
<p>Fortunately, there&#8217;s an easy workaround: you can append multiple shell commands together using <code>&#038;&#038;</code>. With <code>&#038;&#038;</code>, each command will be executed and completed before the next one begins, mimicking a person typing out commands one line at a time. </p>
<p>Here&#8217;s what our MySQL example looks like as a single line:</p>
<pre>
cd /var/lib/mysql &#038;&#038; tar -czf /any/folder/you/want/database_name.tar.gz database_name
</pre>
<p>Enjoy your tar backups sans worthless parent directories!</p>
]]></content:encoded>
			<wfw:commentRss>http://frankkoehl.com/2011/04/remove-parent-directories-from-tar-archives/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
