<?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>sixohthree.com &#187; Programming</title>
	<atom:link href="http://sixohthree.com/tag/programming/feed" rel="self" type="application/rss+xml" />
	<link>http://sixohthree.com</link>
	<description>The Weblog of Adam Backstrom</description>
	<lastBuildDate>Wed, 16 May 2012 15:01:59 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Light Reading</title>
		<link>http://sixohthree.com/1456/light-reading</link>
		<comments>http://sixohthree.com/1456/light-reading#comments</comments>
		<pubDate>Tue, 11 Jan 2011 13:58:03 +0000</pubDate>
		<dc:creator>Adam Backstrom</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[oop]]></category>

		<guid isPermaLink="false">http://mu.sixohthree.com/sixohthree/?p=1456</guid>
		<description><![CDATA[Picked up Clean Code and Design Patterns based on some programmers.se recommendations. Hopefully I&#8217;ll be able to apply the concepts to PHP.]]></description>
			<content:encoded><![CDATA[<p>Picked up <a href="http://www.amazon.com/Clean-Code-Handbook-Software-Craftsmanship/dp/0132350882">Clean Code</a> and <a href="http://www.amazon.com/Design-Patterns-Elements-Reusable-Object-Oriented/dp/0201633612">Design Patterns</a> based on some <a href="http://programmers.stackexchange.com/">programmers.se</a> recommendations. Hopefully I&#8217;ll be able to apply the concepts to PHP.</p>
]]></content:encoded>
			<wfw:commentRss>http://sixohthree.com/1456/light-reading/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP 5.3.0 Changes</title>
		<link>http://sixohthree.com/748/php-530-changes</link>
		<comments>http://sixohthree.com/748/php-530-changes#comments</comments>
		<pubDate>Thu, 19 Mar 2009 15:19:52 +0000</pubDate>
		<dc:creator>Adam Backstrom</dc:creator>
				<category><![CDATA[Personal]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://blogs.bwerp.net/?p=748</guid>
		<description><![CDATA[PHP 5.3.0 looks promising.]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify">PHP 5.3.0 looks promising. So far:</p>
<ul>
<li><a href="http://www.php.net/manual/en/language.oop5.overloading.php#language.oop5.overloading.methods">__callStatic()</a></li>
<li><a href="http://bugs.php.net/bug.php?id=33595">Circular reference garbage collection</a></li>
<li><a href="http://php.net/manual/en/function.get-called-class.php">get_called_class()</a></li>
<li><a href="http://wiki.php.net/rfc/closures">Closures</a></li>
<li><a href="http://www.php.net/manual/en/datetime.gettimestamp.php">DateTime::getTimestamp()</a></li>
<li><a href="http://us.php.net/manual/en/language.namespaces.php">Namespaces</a></li>
<li><a href="http://us.php.net/lsb">Late Static Binding</a></li>
<li><a href="http://docs.php.net/manual/en/book.phar.php">Phar</a> as part of the default install</li>
<li><var>__DIR__</var> — no more <code>dirname(__FILE__)</code>!</li>
</ul>
<p>PHP 5.3.0 was <a href="http://www.php.net/archive/2009.php#id2009-06-30-1">released</a> on 23 June, 2009! A <a href="http://docs.php.net/migration53">migration guide</a> is available.</p>
]]></content:encoded>
			<wfw:commentRss>http://sixohthree.com/748/php-530-changes/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Variable Variables and Arrays</title>
		<link>http://sixohthree.com/664/variable-variables-and-arrays</link>
		<comments>http://sixohthree.com/664/variable-variables-and-arrays#comments</comments>
		<pubDate>Tue, 23 Dec 2008 19:04:00 +0000</pubDate>
		<dc:creator>Adam Backstrom</dc:creator>
				<category><![CDATA[Web]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://blogs.bwerp.net/?p=664</guid>
		<description><![CDATA[Memorize the order of operations, I guess.]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m a big fan of PHP&#8217;s <a href="http://www.php.net/manual/en/language.variables.variable.php">variable variables</a> functionality. It&#8217;s great for abstracting code with this sort of syntax:</p>
<pre><code>$property_name = 'color';
echo $theClass-&gt;$property_name; // same as $theClass-&gt;color</code></pre>
<p>The <a href="http://www.php.net/manual/en/language.variables.variable.php">documentation</a> does mention a potential tripping point with array index ambiguity. You might expect the following references to be equal:</p>
<pre><code>$prop = 'internalArray';
$theClass = new stdClass;
$theClass-&gt;internalArray = array('red', 'white', 'blue');
echo $theClass-&gt;internalArray[2] == $theClass-&gt;$prop[2] ? "equal" : "not equal";</code></pre>
<p>However, the above code will output &#8220;not equal&#8221; because <var>$prop[2]</var> is evaluated first. This returns a character index within <var>$prop</var>, so the final check is against <var>$theClass-&gt;t</var>, which is not set. Curly braces around the property can be used to clarify your meaning:</p>
<pre><code>echo $theClass-&gt;internalArray[3] == $theClass-&gt;{$prop}[2] ? "equal" : "not equal";</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://sixohthree.com/664/variable-variables-and-arrays/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Smarter Parsing with Smarty</title>
		<link>http://sixohthree.com/512/smarter-parsing-with-smarty</link>
		<comments>http://sixohthree.com/512/smarter-parsing-with-smarty#comments</comments>
		<pubDate>Sun, 10 Aug 2008 21:07:53 +0000</pubDate>
		<dc:creator>Adam Backstrom</dc:creator>
				<category><![CDATA[Web]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[smarty]]></category>

		<guid isPermaLink="false">http://blogs.bwerp.net/?p=512</guid>
		<description><![CDATA[Don't gobble my markup.]]></description>
			<content:encoded><![CDATA[<p>My day job makes heavy use of <a href="http://www.smarty.net/">Smarty</a> for page templating. We&#8217;re currently moving away from <a href="http://www.phpxtemplate.org/HomePage">XTemplate</a>, which I generally don&#8217;t like, but it does have one nice feature: curly braces in CSS and JavaScript blocks aren&#8217;t interpreted as template tags. I set out to determine if this behavior could be easily applied to Smarty.</p>
<h3>The Problem</h3>
<p>By default, Smarty uses curly braces to denote template tags, ie. <code>{foreach from=$widgets item=widget}</code>. The left and right tag delimiter are configurable, defaulting to <code>{</code> and <code>}</code>, respectively. Whitespace is allowed after the left delimiter. This means the following CSS rule is interpreted as a Smarty tag:</p>
<pre><code>&lt;style type="text/css"&gt;
body { font-size: 80%; }
&lt;/script&gt;</code></pre>
<p>This would generate an error, claiming &#8220;syntax error: unrecognized tag: font-size: 80%.&#8221; You can use the <a href="/~adam/2008/08/10/literal.txt"><code>{literal}</code> tag</a> to escape a block of text, or <a href="/~adam/2008/08/10/ldelim.txt">use <code>{ldelim}</code></a> instead of &#8220;{&#8220;, or <a href="/~adam/2008/08/10/custom-delim.txt">change the delimiter</a> to something less common like <code>&lt;!--{</code>. I would prefer the XTemplate behavior.</p>
<h3>The Solution</h3>
<p>Here is <a href="/~adam/wp-uploads/2008/08/smarty-tag-whitespace.patch">a patch</a> that modifies Smarty to ignore left delimiters which are immediately followed by whitespace. <code>{foreach}</code> would be parsed, but <code>{ foreach}</code> would not. This has potential security implications since an errant space could expose part of your template to the world, but it has the potential to simplify some very convoluted markup.</p>
<p>I&#8217;ve done some <a href="/~adam/2008/08/10/testing.txt">limited testing</a> (including creating a one-character template tag) and it seems to work fine. I&#8217;ll have to try with some more complicated templates, but hopefully this will make its way into our Smarty as a custom mod. (Thankfully we deploy Smarty via Subversion, so it&#8217;s relatively easy to mod the local library install.)</p>
]]></content:encoded>
			<wfw:commentRss>http://sixohthree.com/512/smarter-parsing-with-smarty/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ADOdb, MySQL, and Transactions</title>
		<link>http://sixohthree.com/493/adodb-mysql-and-transactions</link>
		<comments>http://sixohthree.com/493/adodb-mysql-and-transactions#comments</comments>
		<pubDate>Wed, 23 Jul 2008 16:03:55 +0000</pubDate>
		<dc:creator>Adam Backstrom</dc:creator>
				<category><![CDATA[Personal]]></category>
		<category><![CDATA[ADOdb]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://blogs.bwerp.net/?p=493</guid>
		<description><![CDATA[Transactions should be supported by everything.]]></description>
			<content:encoded><![CDATA[<p><img class="alignright size-full wp-image-495" src="/~adam/wp-uploads/2008/07/myisam.png" alt="" width="193" height="190" />I was just bit by some assumptions I made with <a href="http://adodb.sourceforge.net/">ADOdb</a>, MySQL 5, and transaction support. I&#8217;ve been using <a href="http://phplens.com/adodb/tutorial.smart.transactions.html">Smart Transactions</a> with success on other systems, but during my current project I noticed the SQL commands were being processed without respecting my <code>FailTrans()</code> call.</p>
<p>Turns out I was using a storage engine that did not support transactions. While InnoDB is ACID-compliant, <a href="http://dev.mysql.com/doc/refman/5.0/en/ansi-diff-transactions.html">MyISAM has no support for transactions</a>. Whoops. A few <code>ALTER TABLE</code>s later and I&#8217;m back in business.</p>
]]></content:encoded>
			<wfw:commentRss>http://sixohthree.com/493/adodb-mysql-and-transactions/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Python Indentation and Vim</title>
		<link>http://sixohthree.com/442/python-indentation-and-vim</link>
		<comments>http://sixohthree.com/442/python-indentation-and-vim#comments</comments>
		<pubDate>Sat, 22 Mar 2008 19:55:00 +0000</pubDate>
		<dc:creator>Adam Backstrom</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[Vim]]></category>

		<guid isPermaLink="false">http://blogs.bwerp.net/archives/2008/03/22/vim</guid>
		<description><![CDATA[Holy wars, to some.]]></description>
			<content:encoded><![CDATA[<p>Python&#8217;s syntax relies on indentation for statement grouping. The <a href="http://www.python.org/dev/peps/pep-0008/">convention</a> is to use spaces, but I&#8217;ve always found tabs to be easier to work with in <a href="http://www.vim.org/">vim</a>. My largest gripe: if I mis-tabbed, I had to press &#8220;delete&#8221; four times to erase all the spaces I created. Turns out, that needn&#8217;t be the case: vim can detect multi-space indentation and delete one &#8220;tab&#8221; at a time.</p>
<p>Here are some good resources I found while digging into this:</p>
<ol>
<li><a href="http://jaeger.festing.org/changelog/1128.html">Secrets of tabs in vim</a></li>
<li><a href="http://www.vex.net/~x/python_and_vim.html">Notes on using Vim and Python</a> &#8212; check out the autoindentation based on file name, just below the main table</li>
<li><a href="http://www.vim.org/tips/tip.php?tip_id=12">Converting tabs to spaces</a></li>
</ol>
<p>Bonus: check out vimrc in the <a href="http://svn.python.org/view/python/trunk/Misc/Vim/">python &#8220;Vim&#8221; folder</a> for other helpful files.</p>
]]></content:encoded>
			<wfw:commentRss>http://sixohthree.com/442/python-indentation-and-vim/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

