<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="wordpress/2.2.2" -->
<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/"
	>

<channel>
	<title>if you want something done right... DIY.</title>
	<link>http://krisgale.com</link>
	<description>meanderings of a computer scientist on the brink of sheer insanity.</description>
	<pubDate>Thu, 10 Apr 2008 19:20:04 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.2.2</generator>
	<language>en</language>
			<item>
		<title>debugging gallery2 after upgrade</title>
		<link>http://krisgale.com/debugging-gallery2-after-upgrade/</link>
		<comments>http://krisgale.com/debugging-gallery2-after-upgrade/#comments</comments>
		<pubDate>Thu, 10 Apr 2008 17:23:37 +0000</pubDate>
		<dc:creator>krisgale</dc:creator>
		
		<category><![CDATA[gallery2]]></category>

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

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

		<guid isPermaLink="false">http://krisgale.com/debugging-gallery2/</guid>
		<description><![CDATA[no idea what version to which this applies as i&#8217;ve never installed or configured gallery2, but here&#8217;s the process by which i just now debugged one particular gallery2 install&#8230;
gallery2/config.php
line 30 - @ini_set(&#8217;display_errors&#8217;, 1);
line 134 - $gallery-&#62;setDebug(&#8217;buffered&#8217;);
1st error:
Unknown column &#8216;g2_Item.g_renderer&#8217;
grep -r &#8216;renderer&#8217; *
modules/core/classes/GalleryStorage/schema.tpl:
CREATE TABLE DB_TABLE_PREFIXItem(
&#8230;
DB_COLUMN_PREFIXownerId int(11) NOT NULL,
DB_COLUMN_PREFIXrenderer varchar(128),
ALTER TABLE g2_Item ADD g_renderer VARCHAR(128) NULL AFTER [...]]]></description>
			<content:encoded><![CDATA[<p>no idea what version to which this applies as i&#8217;ve never installed or configured gallery2, but here&#8217;s the process by which i just now debugged one particular gallery2 install&#8230;</p>
<p>gallery2/config.php</p>
<p>line 30 - <em>@ini_set(&#8217;display_errors&#8217;, 1);</em><br />
line 134 - <em>$gallery-&gt;setDebug(&#8217;buffered&#8217;);</em></p>
<p><strong>1st error:<br />
Unknown column &#8216;g2_Item.g_renderer&#8217;</strong></p>
<p>grep -r &#8216;renderer&#8217; *</p>
<p>modules/core/classes/GalleryStorage/schema.tpl:</p>
<p>CREATE TABLE DB_TABLE_PREFIXItem(<br />
&#8230;<br />
DB_COLUMN_PREFIXownerId int(11) NOT NULL,<br />
DB_COLUMN_PREFIXrenderer varchar(128),</p>
<p><em>ALTER TABLE g2_Item ADD g_renderer VARCHAR(128) NULL AFTER g_ownerId;</em></p>
<p><strong>2nd error:<br />
Unknown column &#8216;g2_Comment.g_author&#8217;</strong></p>
<p>grep -r &#8216;PREFIXauthor&#8217; *</p>
<p>modules/comment/classes/GalleryStorage/schema.tpl:</p>
<p>CREATE TABLE DB_TABLE_PREFIXComment(<br />
&#8230;<br />
DB_COLUMN_PREFIXdate int(11) NOT NULL,<br />
DB_COLUMN_PREFIXauthor varchar(128),</p>
<p><em>ALTER TABLE g2_Comment ADD g_author VARCHAR(128) NULL AFTER g_date;</em></p>
<p>perhaps this may help someone else out there.</p>
]]></content:encoded>
			<wfw:commentRss>http://krisgale.com/debugging-gallery2-after-upgrade/feed/</wfw:commentRss>
		</item>
		<item>
		<title>beware of table alias in LEFT JOIN</title>
		<link>http://krisgale.com/beware-of-table-alias-in-left-join/</link>
		<comments>http://krisgale.com/beware-of-table-alias-in-left-join/#comments</comments>
		<pubDate>Mon, 07 Apr 2008 17:00:00 +0000</pubDate>
		<dc:creator>krisgale</dc:creator>
		
		<category><![CDATA[syntax]]></category>

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

		<guid isPermaLink="false">http://krisgale.com/beware-of-table-alias-in-left-join/</guid>
		<description><![CDATA[when mixing standard selects containing table aliases with LEFT JOIN&#8217;s you need be aware of a critical change as of mysql 5&#8230; if you reference a table alias in an ON clause the same way you might have in verison 4, mysql may report an &#8216;unknown column&#8217; error.
so, a query of the form:
SELECT a.id FROM [...]]]></description>
			<content:encoded><![CDATA[<p>when mixing standard selects containing table aliases with LEFT JOIN&#8217;s you need be aware of a critical change as of mysql 5&#8230; if you reference a table alias in an ON clause the same way you might have in verison 4, mysql may report an &#8216;unknown column&#8217; error.</p>
<p>so, a query of the form:</p>
<p><tt>SELECT a.id FROM alpha a, beta b<br />
LEFT JOIN gamma g ON (g.id = a.gamma_id)<br />
WHERE b.id = a.beta_id</tt></p>
<p>would report error #1054 - Unknown column &#8216;a.gamma_id&#8217; in &#8216;on clause&#8217;</p>
<p>whereas:</p>
<p><tt>SELECT a.id FROM <strong>(</strong>alpha a, beta b<strong>)</strong><br />
LEFT JOIN gamma g ON (g.id = a.gamma_id)<br />
WHERE b.id = a.beta_id</tt></p>
<p>&#8230; would not.</p>
<p>in case you failed to detect the subtle difference between the two, it&#8217;s the inclusion of the now-apparently-very-important parentheses around the list of tables before the LEFT JOIN.</p>
<p>this &#8216;bug&#8217; <a href="http://bugs.mysql.com/bug.php?id=35242" target="_blank">has been reported</a> to mysql ab (even though they claim is <a href="http://dev.mysql.com/doc/refman/5.0/en/join.html" target="_blank">not a bug</a>).</p>
]]></content:encoded>
			<wfw:commentRss>http://krisgale.com/beware-of-table-alias-in-left-join/feed/</wfw:commentRss>
		</item>
		<item>
		<title>mapping movabletype url&#8217;s to wordpress</title>
		<link>http://krisgale.com/mapping-movabletype-urls-to-wordpress/</link>
		<comments>http://krisgale.com/mapping-movabletype-urls-to-wordpress/#comments</comments>
		<pubDate>Fri, 28 Mar 2008 17:41:32 +0000</pubDate>
		<dc:creator>krisgale</dc:creator>
		
		<category><![CDATA[movabletype]]></category>

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

		<guid isPermaLink="false">http://krisgale.com/mapping-movabletype-urls-to-wordpress/</guid>
		<description><![CDATA[if you&#8217;ve divorced movabletype, successfully exported and imported your existing posts, and eloped with wordpress, undoubtedly you&#8217;ll want to maintain all the inbound links google and other search engines have accumulated over time so that your adoring public will still be able to locate your scribblings&#8230;
here are the three most important classes of url&#8217;s to [...]]]></description>
			<content:encoded><![CDATA[<p>if you&#8217;ve divorced movabletype, successfully exported and imported your existing posts, and eloped with wordpress, undoubtedly you&#8217;ll want to maintain all the inbound links google and other search engines have accumulated over time so that your adoring public will still be able to locate your scribblings&#8230;</p>
<p>here are the three most important classes of url&#8217;s to preserve:</p>
<p><strong>1. category </strong></p>
<p>MT &#8212; /archives/{category_name}<br />
WP &#8212; /category/{category-name}</p>
<p><strong>2. monthly archive</strong></p>
<p>MT &#8212; /archives/{year}/{month}/<br />
WP &#8212; /{year}/{month}/</p>
<p><strong>3. post</strong></p>
<p>MT &#8212; /archives/{year}/{month}/{slug}.html<br />
WP &#8212; /{year}/{month}/{day}/{slug}/</p>
<p>you&#8217;ll note that none of the wordpress url&#8217;s contain the <tt>archives/</tt> prefix.  you can use this to your advantage in the url rewrite rule you&#8217;ll define in your .htaccess file.</p>
<p><tt>RewriteRule ^archives/(.*) mt-wp.php?$1</tt></p>
<p>in the above example, everything after <tt>archives/</tt> in the incoming url will be passed to a php script called <tt>mt-wp.php</tt> which will do the work of determining which of the above three url classes it is, reformatting the url to the appropriate one used by wordpress, and either redirecting to that url or serving it up by proxy.</p>
<p>for [<strong>1</strong>] you will merely replace underscores with dashes. for [<strong>2</strong>] you will use the query string as-is. [<strong>3</strong>] is slightly trickier and is the reason why you&#8217;ll handle redirection (or proxy, using a socket connection or the cURL library) in a [insert language du jour here] script instead of a set of three RewriteRule&#8217;s.</p>
<p>movabletype&#8217;s post slugs are more brief than the ones wordpress generates, and, whereas movabletype does not include the full date of the post in its url, wordpress does.</p>
<p>unless you were in the habit of writing a slew of posts any given month with utterly similar headlines, it should be sufficient to use just the first two words from movabletype&#8217;s slug, in addition to the month and year, as keys to locating that post in your wordpress database. break up the slug portion of the url into words using the underscore as your delimiter, and concatenate the first two words together with a dash: <tt>word1_word2_word3</tt> becomes <tt>word1-word2</tt>.</p>
<p>now, query:</p>
<blockquote><p>SELECT guid FROM wp_1_posts<br />
WHERE post_name LIKE &#8216;{word1}-{word2}%&#8217;<br />
AND post_date LIKE &#8216;{year}-{month}%&#8217;</p></blockquote>
<p>i find it wonderfully convenient, especially for the purposes of this exercise, that wordpress provides the full url to the post in the <tt>guid</tt> column.</p>
<p>*substitute wp_1_posts for the table containing the posts you&#8217;ve imported from movabletype.</p>
<p>if you&#8217;ve been following so far, generating code in your language of choice to do all of this should be a walk in the park. i leave it to you&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://krisgale.com/mapping-movabletype-urls-to-wordpress/feed/</wfw:commentRss>
		</item>
		<item>
		<title>dear microsoft,</title>
		<link>http://krisgale.com/dear-microsoft/</link>
		<comments>http://krisgale.com/dear-microsoft/#comments</comments>
		<pubDate>Mon, 24 Mar 2008 19:11:20 +0000</pubDate>
		<dc:creator>krisgale</dc:creator>
		
		<category><![CDATA[annoyances]]></category>

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

		<guid isPermaLink="false">http://krisgale.com/dear-microsoft/</guid>
		<description><![CDATA[in response to this update about the &#8216;css improvements&#8217; in IE8, and my previous post about your brilliant &#8216;version targeting&#8217; concept, i have the following recommendation:
GIVE UP.
what a sordid history &#8220;your&#8221; browser has endured!it is time you sent it off on an ice floe.
]]></description>
			<content:encoded><![CDATA[<p>in response to <a href="http://msdn2.microsoft.com/en-us/library/cc304082(VS.85).aspx" target="_blank">this</a> update about the &#8216;css improvements&#8217; in IE8, and my previous post about your <em>brilliant</em> &#8216;version targeting&#8217; concept, i have the following recommendation:</p>
<p><strong><a href="http://developer.mozilla.org/en/docs/XULRunner" target="_blank">GIVE UP.</a></strong></p>
<p>what a <a href="http://en.wikipedia.org/wiki/History_of_Internet_Explorer" target="_blank">sordid history</a> &#8220;your&#8221; browser has endured!<br />it is time you sent it off on an ice floe.</p>
]]></content:encoded>
			<wfw:commentRss>http://krisgale.com/dear-microsoft/feed/</wfw:commentRss>
		</item>
		<item>
		<title>the only valid measurement of code quality</title>
		<link>http://krisgale.com/the-only-valid-measurement-of-code-quality/</link>
		<comments>http://krisgale.com/the-only-valid-measurement-of-code-quality/#comments</comments>
		<pubDate>Mon, 24 Mar 2008 13:30:54 +0000</pubDate>
		<dc:creator>krisgale</dc:creator>
		
		<category><![CDATA[best practice]]></category>

		<category><![CDATA[project management]]></category>

		<guid isPermaLink="false">http://krisgale.com/the-only-valid-measurement-of-code-quality/</guid>
		<description><![CDATA[WTFs/minute
]]></description>
			<content:encoded><![CDATA[<p><strong><a href="http://www.osnews.com/story/19266/WTFs_m" target="_blank">WTFs/minute</a></strong></p>
]]></content:encoded>
			<wfw:commentRss>http://krisgale.com/the-only-valid-measurement-of-code-quality/feed/</wfw:commentRss>
		</item>
		<item>
		<title>unless you explicitly say otherwise, IE8 will behave exactly like IE7</title>
		<link>http://krisgale.com/unless-you-explicitly-say-otherwise-ie8-will-behave-exactly-like-ie7/</link>
		<comments>http://krisgale.com/unless-you-explicitly-say-otherwise-ie8-will-behave-exactly-like-ie7/#comments</comments>
		<pubDate>Thu, 20 Mar 2008 03:44:00 +0000</pubDate>
		<dc:creator>krisgale</dc:creator>
		
		<category><![CDATA[compatibility hacks]]></category>

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

		<guid isPermaLink="false">http://krisgale.com/unless-you-explicitly-say-otherwise-ie8-will-behave-exactly-like-ie7/</guid>
		<description><![CDATA[say what?
&#8216;The proposed default behavior for version targeting in Internet Explorer solves the problem of “breaking the web” in much the same way that decapitation solves the problem of headaches.&#8217;
README
]]></description>
			<content:encoded><![CDATA[<p>say what?</p>
<blockquote><p>&#8216;The proposed default behavior for version targeting in Internet Explorer solves the problem of “breaking the web” in much the same way that decapitation solves the problem of headaches.&#8217;</p></blockquote>
<p><a href="http://www.alistapart.com/articles/theyshootbrowsers" title="They Shoot Browsers, Don't They?" target="_blank">README</a></p>
]]></content:encoded>
			<wfw:commentRss>http://krisgale.com/unless-you-explicitly-say-otherwise-ie8-will-behave-exactly-like-ie7/feed/</wfw:commentRss>
		</item>
		<item>
		<title>quick fix for mysql character set issues</title>
		<link>http://krisgale.com/quick-fix-for-mysql-character-set-issues/</link>
		<comments>http://krisgale.com/quick-fix-for-mysql-character-set-issues/#comments</comments>
		<pubDate>Wed, 06 Feb 2008 00:24:41 +0000</pubDate>
		<dc:creator>krisgale</dc:creator>
		
		<category><![CDATA[mysql]]></category>

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

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

		<guid isPermaLink="false">http://krisgale.com/quick-fix-for-mysql-character-set-issues/</guid>
		<description><![CDATA[if, after painfully specifying character set and collation for your database, all your tables, and all columns within them, you&#8217;re still experiencing discrepencies between what your database is storing (eg. strings appear correct from within phpMyAdmin) versus what your website is displaying from database query results (question marks instead of your fancy quotes), try this:
mysql_query(&#8221;SET [...]]]></description>
			<content:encoded><![CDATA[<p>if, after painfully specifying character set and collation for your database, all your tables, and all columns within them, you&#8217;re still experiencing <em>discrepencies</em> between what your database is <em>storing</em> (eg. strings appear correct from within phpMyAdmin) versus what your website is <em>displaying</em> from database query results (question marks instead of your fancy quotes), <em>try this</em>:</p>
<p><tt>mysql_query(&#8221;SET character_set_client = utf8;&#8221;);<br />
mysql_query(&#8221;SET character_set_results = utf8;&#8221;);</tt></p>
<p>those two lines should go right after your <tt>mysql_connect()</tt> and <tt>mysql_select_db()</tt>.</p>
<p>after several hours of trial-and-error i arrived at the above solution as if by magick. here&#8217;s hoping it helps someone else&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://krisgale.com/quick-fix-for-mysql-character-set-issues/feed/</wfw:commentRss>
		</item>
		<item>
		<title>rss feeds, flash, and caching</title>
		<link>http://krisgale.com/rss-feeds-flash-and-caching/</link>
		<comments>http://krisgale.com/rss-feeds-flash-and-caching/#comments</comments>
		<pubDate>Fri, 01 Feb 2008 18:45:03 +0000</pubDate>
		<dc:creator>krisgale</dc:creator>
		
		<category><![CDATA[flash]]></category>

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

		<guid isPermaLink="false">http://krisgale.com/rss-feeds-flash-and-caching/</guid>
		<description><![CDATA[if you&#8217;re using a 3rd party player to share content on your site that&#8217;s driven by an rss feed, like the blip.tv &#8217;show&#8217; player, you should be aware that flash player may cache the rss feed itself for quite some time. so, despite updating your channel with a new video, flash may be &#8217;stuck&#8217; on [...]]]></description>
			<content:encoded><![CDATA[<p>if you&#8217;re using a 3rd party player to share content on your site that&#8217;s driven by an rss feed, like the <a href="http://blip.tv" target="_blank">blip.tv</a> &#8217;show&#8217; player, you should be aware that flash player may cache the rss feed itself for quite some time. so, despite updating your channel with a new video, flash may be &#8217;stuck&#8217; on only older entries contained in the rss feed it already downloaded, making your homepage not-so-fresh.</p>
<p>here&#8217;s a workaround: add a variable to the part of the url in the player code containing the location of the rss feed that will change, say, every minute or ever second; a timestamp.</p>
<p>so, for example if you have the blip.tv show player on your homepage displaying any videos on myshow.blip.tv containing the search term &#8216;otters&#8217;&#8230;</p>
<p><tt>&#038;file=http%3A%2F%2Fmyshow.blip.tv%2Frss%2Fflash%3Fsearch%3Dotters</tt></p>
<p>you would add a timestamp:</p>
<p><tt>%3Dotters<b>%26ts%3D&lt;?php print(date(&#8221;YmdHi&#8221;)); ?&gt;</b></tt></p>
<p>the above would ensure the show player is up-to-the-minute.</p>
]]></content:encoded>
			<wfw:commentRss>http://krisgale.com/rss-feeds-flash-and-caching/feed/</wfw:commentRss>
		</item>
		<item>
		<title>ever wonder why a cookie disappears if served during a redirect?</title>
		<link>http://krisgale.com/ever-wonder-why-a-cookie-disappears-if-served-during-a-redirect/</link>
		<comments>http://krisgale.com/ever-wonder-why-a-cookie-disappears-if-served-during-a-redirect/#comments</comments>
		<pubDate>Fri, 01 Feb 2008 05:19:53 +0000</pubDate>
		<dc:creator>krisgale</dc:creator>
		
		<category><![CDATA[cookies]]></category>

		<guid isPermaLink="false">http://krisgale.com/ever-wonder-why-a-cookie-disappears-if-served-during-a-redirect/</guid>
		<description><![CDATA[this is a phenomenon i have long wondered about, myself, the answer to which came to light upon reading further into rfc-2109 after yesterday&#8217;s post.
so why can you not serve a &#8216;plain vanilla&#8217; cookie (only name or name and expires attributes provided) during a redirect and expect it to still be there afterward? security.
to quote [...]]]></description>
			<content:encoded><![CDATA[<p>this is a phenomenon i have long wondered about, myself, the answer to which came to light upon reading further into <a href="http://www.ietf.org/rfc/rfc2109.txt" target="_blank">rfc-2109</a> after yesterday&#8217;s post.</p>
<p>so why can you not serve a &#8216;plain vanilla&#8217; cookie (only name or name and expires attributes provided) during a redirect and expect it to still be there afterward? <em>security</em>.</p>
<p>to quote the above rfc:</p>
<blockquote><p>unverifiable transactions typically arise when a user agent&#8230; resolves redirection (3xx) responses from an origin server&#8230; when it makes an unverifiable transaction, a user agent must enable a session only if a cookie with a domain attribute D was sent or received in its origin transaction, such that the host name in the request-uri of the unverifiable transaction domain-matches D.</p>
<p>this restriction prevents a malicious service author from using unverifiable transactions to induce a user agent to start or continue a session with a server in a different domain.</p></blockquote>
<p>so now you know. if you really want to construct your application such that cookies get served &#8216;between&#8217; pages (i.e. upon completion of a script that processes a form and then redirects to an appopriate follow-up or confirmation page), you need to serve a fully-qualified cookie (domain included and most likely path also, e.g. &#8216;Set-Cookie; variable=&#8230;; domain=&#8230;; path=/; expires=&#8230;&#8217;).</p>
<p>and to think that for years i never knew this behavior was by design, and have implemented methods to ensure that my cookies always get served on the <em>arrival</em> page <em>after</em> any redirect &#8212; as you can imagine this method requires not-so-nice forwarding and later detection of data delivered in get or post variables; not to mention that the set-cookie headers themselves must be echoed <em>before </em>any content is delivered (lest ye see a &#8220;headers already sent&#8221; error).</p>
]]></content:encoded>
			<wfw:commentRss>http://krisgale.com/ever-wonder-why-a-cookie-disappears-if-served-during-a-redirect/feed/</wfw:commentRss>
		</item>
		<item>
		<title>header(&#8221;Set-Cookie:&#8230; temporary cookies must be first-served</title>
		<link>http://krisgale.com/header-set-cookie-temporary-cookies-must-be-first-served/</link>
		<comments>http://krisgale.com/header-set-cookie-temporary-cookies-must-be-first-served/#comments</comments>
		<pubDate>Thu, 31 Jan 2008 18:20:54 +0000</pubDate>
		<dc:creator>krisgale</dc:creator>
		
		<category><![CDATA[cookies]]></category>

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

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

		<guid isPermaLink="false">http://krisgale.com/headerset-cookie-temporary-cookies-must-be-first-served/</guid>
		<description><![CDATA[when you&#8217;re &#8220;rolling your own&#8221; session management by using header(&#8221;Set-Cookie:&#8230; and you&#8217;re mixing temporary cookies with ones that have an expires= attribute, you may notice erratic behavior unless you set the temporary parameters first.
for example,
header(&#8221;Set-Cookie: permanent=important; expires=Sun, 17-Jan-2037 23:59:59 GMT&#8221;);
header(&#8221;Set-Cookie: temporary=trivial&#8221;);
may not work as expected, whereas if you switch the two around, you&#8217;re good to [...]]]></description>
			<content:encoded><![CDATA[<p>when you&#8217;re &#8220;rolling your own&#8221; session management by using <tt>header(&#8221;Set-Cookie:</tt>&#8230; and you&#8217;re mixing temporary cookies with ones that have an <tt>expires=</tt> attribute, you may notice erratic behavior unless you set the temporary parameters <em>first</em>.</p>
<p>for example,</p>
<p><tt>header(&#8221;Set-Cookie: permanent=important; expires=Sun, 17-Jan-2037 23:59:59 GMT&#8221;);<br />
header(&#8221;Set-Cookie: temporary=trivial&#8221;);</tt></p>
<p>may not work as expected, whereas if you switch the two around, you&#8217;re good to go.</p>
<p>i wonder if <a href="http://www.rfc.net/rfc2109.html">rfc-2109</a> mentions anything about this&#8230;</p>
<p>p.s. yes, i do prefer <a href="http://wp.netscape.com/newsref/std/cookie_spec.html" target="_blank">netscape&#8217;s standard</a> for set-cookie syntax.</p>
]]></content:encoded>
			<wfw:commentRss>http://krisgale.com/header-set-cookie-temporary-cookies-must-be-first-served/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
