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

<channel>
	<title>geek ramblings &#187; Development</title>
	<atom:link href="http://dougal.gunters.org/blog/category/development/feed" rel="self" type="application/rss+xml" />
	<link>http://dougal.gunters.org</link>
	<description>Random musings of a Southern geek</description>
	<pubDate>Tue, 22 Apr 2008 18:24:49 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.2-alpha</generator>
	<language>en</language>
			<item>
		<title>Atlanta PHP</title>
		<link>http://dougal.gunters.org/blog/2008/04/02/atlanta-php</link>
		<comments>http://dougal.gunters.org/blog/2008/04/02/atlanta-php#comments</comments>
		<pubDate>Wed, 02 Apr 2008 15:42:16 +0000</pubDate>
		<dc:creator>Dougal</dc:creator>
		
		<category><![CDATA[Community]]></category>

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

		<category><![CDATA[Operating Systems]]></category>

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

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

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

		<category><![CDATA[.net]]></category>

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

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

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

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

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

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

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

		<guid isPermaLink="false">http://dougal.gunters.org/?p=901</guid>
		<description><![CDATA[<p>Tomorrow night, I will be attending the April <a href="http://www.atlantaphp.org/">Atlanta <acronym title='Php Hypertext Processor'><span class='caps'>PHP</span></acronym></a> meeting. My friend <a href="http://blogs.msdn.com/glengordon">Glen Gordon</a> will be giving a presentation titled, &#8220;<a href="http://www.atlantaphp.org/archive/77">Iâ€™m a <acronym title='Php Hypertext Processor'><span class='caps'>PHP</span></acronym> dev! Why should I care about Microsoft?</a>&#8221;</p>
<blockquote><p>There are a host of technologies and tools from Microsoft that can add value to your <acronym title='Php Hypertext Processor'><span class='caps'>PHP</span></acronym> solutions, save you time, and are just plain cool. [...]</p></blockquote><script type="text/javascript">SHARETHIS.addEntry({ title: "Atlanta PHP", url: "http://dougal.gunters.org/blog/2008/04/02/atlanta-php" });</script>]]></description>
			<content:encoded><![CDATA[<p>Tomorrow night, I will be attending the April <a href="http://www.atlantaphp.org/">Atlanta <acronym title='Php Hypertext Processor'><span class='caps'>PHP</span></acronym></a> meeting. My friend <a href="http://blogs.msdn.com/glengordon">Glen Gordon</a> will be giving a presentation titled, &#8220;<a href="http://www.atlantaphp.org/archive/77">Iâ€™m a <acronym title='Php Hypertext Processor'><span class='caps'>PHP</span></acronym> dev! Why should I care about Microsoft?</a>&#8221;</p>
<blockquote><p>There are a host of technologies and tools from Microsoft that can add value to your <acronym title='Php Hypertext Processor'><span class='caps'>PHP</span></acronym> solutions, save you time, and are just plain cool. This presentation will cover server technologies like FastCGI, <acronym title='Internet Infomation Server'><span class='caps'>IIS</span></acronym> and the <acronym title='Php Hypertext Processor'><span class='caps'>PHP</span></acronym> <acronym title='Structured Query Language'><span class='caps'>SQL</span></acronym> Server Driver, client technologies like the ASP.NET <acronym title='Asynchronous Javascript and XML'><span class='caps'>AJAX</span></acronym> Library and Silverlight, as well as developer tools. This is not a sales pitch â€“ itâ€™s a technical walkthrough with demos, and will give you pointers to lots of resources for digging deeper.</p></blockquote>
<p>I&#8217;m sure Glen&#8217;s talk will be interesting, and I&#8217;m looking forward to a chance to catch up on the current state of web servers in Microsoft-land. While I tend to use unix-based systems for most of my own work, there are plenty of organizations who are standardized on Microsoft products, and you have to be able to be able to work with what they have. Case in point, my wife is hoping to set up a WordPress website for her department at work, and they&#8217;ll probably set it up on a Windows-based server.</p>
<p>If anybody reading this is planning to attend, please introduce yourself. I&#8217;ll be wearing a <a href="http://wordpress.org/">WordPress</a> shirt.</p>
<p><a href="http://sharethis.com/item?&wp=2.5.2-alpha&amp;publisher=06a70a77-1fc0-46a9-81d1-6a696e6ed23f&amp;title=Atlanta+PHP&amp;url=http%3A%2F%2Fdougal.gunters.org%2Fblog%2F2008%2F04%2F02%2Fatlanta-php">ShareThis</a></p>]]></content:encoded>
			<wfw:commentRss>http://dougal.gunters.org/blog/2008/04/02/atlanta-php/feed</wfw:commentRss>
		</item>
		<item>
		<title>Internet Explorer 8: Progress!</title>
		<link>http://dougal.gunters.org/blog/2008/03/06/internet-explorer-8-progress</link>
		<comments>http://dougal.gunters.org/blog/2008/03/06/internet-explorer-8-progress#comments</comments>
		<pubDate>Thu, 06 Mar 2008 15:35:26 +0000</pubDate>
		<dc:creator>Dougal</dc:creator>
		
		<category><![CDATA[Browsers]]></category>

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

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

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

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

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

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

		<category><![CDATA[Web Design]]></category>

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

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

		<category><![CDATA[ie8 ie7]]></category>

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

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

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

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

		<guid isPermaLink="false">http://dougal.gunters.org/?p=888</guid>
		<description><![CDATA[<p>
It seems that Microsoft has reversed their previous decision to make Internet Explorer 8 crippled by default. They will be enabling the <a href="http://blogs.msdn.com/ie/archive/2008/03/03/microsoft-s-interoperability-principles-and-ie8.aspx">standards compliant mode by default in IE8</a>, and webmasters will have to use the <code>X-UA-Compatible</code> header to force it into <acronym title='Internet Explorer 7'><span class='caps'>IE7</span></acronym> mode, for sites that can&#8217;t be updated immediately. [...]</p><script type="text/javascript">SHARETHIS.addEntry({ title: "Internet Explorer 8: Progress!", url: "http://dougal.gunters.org/blog/2008/03/06/internet-explorer-8-progress" });</script>]]></description>
			<content:encoded><![CDATA[<p>
It seems that Microsoft has reversed their previous decision to make Internet Explorer 8 crippled by default. They will be enabling the <a href="http://blogs.msdn.com/ie/archive/2008/03/03/microsoft-s-interoperability-principles-and-ie8.aspx">standards compliant mode by default in IE8</a>, and webmasters will have to use the <code>X-UA-Compatible</code> header to force it into <acronym title='Internet Explorer 7'><span class='caps'>IE7</span></acronym> mode, for sites that can&#8217;t be updated immediately. Huzzah for progress!
</p>
<p>
And on that note, I&#8217;ll mention that <a href="http://www.microsoft.com/windows/products/winfamily/ie/ie8/default.mspx">Internet Explorer 8 Beta 1 is available for download</a>. Go break the web!</p>
<p><a href="http://sharethis.com/item?&wp=2.5.2-alpha&amp;publisher=06a70a77-1fc0-46a9-81d1-6a696e6ed23f&amp;title=Internet+Explorer+8%3A+Progress%21&amp;url=http%3A%2F%2Fdougal.gunters.org%2Fblog%2F2008%2F03%2F06%2Finternet-explorer-8-progress">ShareThis</a></p>]]></content:encoded>
			<wfw:commentRss>http://dougal.gunters.org/blog/2008/03/06/internet-explorer-8-progress/feed</wfw:commentRss>
		</item>
		<item>
		<title>Internet Explorer 8: This is progress?</title>
		<link>http://dougal.gunters.org/blog/2008/01/23/ie8-for-better-and-worse</link>
		<comments>http://dougal.gunters.org/blog/2008/01/23/ie8-for-better-and-worse#comments</comments>
		<pubDate>Wed, 23 Jan 2008 14:25:25 +0000</pubDate>
		<dc:creator>Dougal</dc:creator>
		
		<category><![CDATA[Browsers]]></category>

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

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

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

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

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

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

		<category><![CDATA[Web Design]]></category>

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

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

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

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

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

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

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

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

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

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

		<guid isPermaLink="false">http://dougal.gunters.org/blog/2008/01/23/ie8-for-better-and-worse</guid>
		<description><![CDATA[<p>
<a href="http://blogs.msdn.com/ie/archive/2007/12/19/internet-explorer-8-and-acid2-a-milestone.aspx">Internet Explorer 8 passes the Acid2 test</a>. Huzzah!
</p>
<p>
But waitaminnit&#8230; What&#8217;s this stuff about forward compatibility by adding some <a href="http://blogs.msdn.com/ie/archive/2008/01/21/compatibility-and-ie8.aspx">new <code>X-UA-Compatible</code> header</a> to my pages or my server? Am I reading this right? Are you telling me that in order for IE8 to use its fully compliant rendering, we have to add something new to our pages? And that if we don&#8217;t, it will fall back to rendering pages just like <acronym title='Internet Explorer 7'><span class='caps'>IE7</span></acronym>? Is that what this means?
</p>
<p>
That&#8217;s just dumb.
</p>
<p>
Screw their stupid &#8220;<a href="http://blogs.msdn.com/ie/archive/2008/01/21/compatibility-and-ie8.aspx">don&#8217;t break the web</a>&#8221; motto. [...]</p><script type="text/javascript">SHARETHIS.addEntry({ title: "Internet Explorer 8: This is progress?", url: "http://dougal.gunters.org/blog/2008/01/23/ie8-for-better-and-worse" });</script>]]></description>
			<content:encoded><![CDATA[<p>
<a href="http://blogs.msdn.com/ie/archive/2007/12/19/internet-explorer-8-and-acid2-a-milestone.aspx">Internet Explorer 8 passes the Acid2 test</a>. Huzzah!
</p>
<p>
But waitaminnit&#8230; What&#8217;s this stuff about forward compatibility by adding some <a href="http://blogs.msdn.com/ie/archive/2008/01/21/compatibility-and-ie8.aspx">new <code>X-UA-Compatible</code> header</a> to my pages or my server? Am I reading this right? Are you telling me that in order for IE8 to use its fully compliant rendering, we have to add something new to our pages? And that if we don&#8217;t, it will fall back to rendering pages just like <acronym title='Internet Explorer 7'><span class='caps'>IE7</span></acronym>? Is that what this means?
</p>
<p>
That&#8217;s just dumb.
</p>
<p>
Screw their stupid &#8220;<a href="http://blogs.msdn.com/ie/archive/2008/01/21/compatibility-and-ie8.aspx">don&#8217;t break the web</a>&#8221; motto. Break it! <strong>Break the web in the name of progress!</strong> How will we ever move forward if you keep dragging us back? And while you&#8217;re at it, quit trying to misdirect us with that &#8220;don&#8217;t break the web&#8221; nonsense. Putting out a browser with excellent <acronym title='Cascading Style Sheets'><span class='caps'>CSS</span></acronym> support is not &#8220;breaking the web&#8221;, it&#8217;s fixing it! There&#8217;s no real shame in putting out a <em>better</em> product, and admitting that the previous versions had flaws. This is a concept called &#8220;continuous incremental improvement&#8221;.
</p>
<p>
There has already been a lot of reaction from the web development community. There are <a href="http://alistapart.com/articles/beyonddoctype">several</a> <a href="http://alistapart.com/articles/fromswitchestotargets">big</a> <a href="http://www.zeldman.com/2008/01/22/in-defense-of-version-targeting/">names</a> behind the idea. There are <a href="http://annevankesteren.nl/2008/01/ie-lock-in">several</a> <a href="http://ejohn.org/blog/meta-madness/">big</a> <a href="http://www.isolani.co.uk/blog/standards/EndOfLineInternetExplorer">names</a> against it. I&#8217;m not a big name, but I fall in the latter camp. This is not &#8220;forward compatibility&#8221;, it&#8217;s not &#8220;forward&#8221; anything. This is keeping progress of the Internet Explorer browser and adoption of better standards at a crawl instead of letting them make an evolutionary jump.
</p>
<p>Oh, and unless I&#8217;m missing something here, there was already a mechanism in place that the <acronym title='Internet Explorer'><span class='caps'>IE</span></acronym> team has <em>already</em> encouraged web developers to use, which could do the same job: <a href="http://blogs.msdn.com/ie/archive/2005/10/12/480242.aspx">conditional comments</a>. What&#8217;s that? Oh yeah, <a href="http://www.webstandards.org/2005/11/03/ie7-conditional-comments/">there are problems with that, too</a>.</p>
<p>
If you need more reading material on this subject, check out <a href="http://del.icio.us/wearehugh/pleasesirmayihaveanother">Mark Pilgrim&#8217;s links</a>. At the time of this writing, he has pointers to 29 articles, and I&#8217;m sure there will be more.</p>
<p><a href="http://sharethis.com/item?&wp=2.5.2-alpha&amp;publisher=06a70a77-1fc0-46a9-81d1-6a696e6ed23f&amp;title=Internet+Explorer+8%3A+This+is+progress%3F&amp;url=http%3A%2F%2Fdougal.gunters.org%2Fblog%2F2008%2F01%2F23%2Fie8-for-better-and-worse">ShareThis</a></p>]]></content:encoded>
			<wfw:commentRss>http://dougal.gunters.org/blog/2008/01/23/ie8-for-better-and-worse/feed</wfw:commentRss>
		</item>
		<item>
		<title>14+ Awesome WordPress-powered sites</title>
		<link>http://dougal.gunters.org/blog/2007/07/16/14-awesome-wordpress-powered-sites</link>
		<comments>http://dougal.gunters.org/blog/2007/07/16/14-awesome-wordpress-powered-sites#comments</comments>
		<pubDate>Mon, 16 Jul 2007 14:54:37 +0000</pubDate>
		<dc:creator>Dougal</dc:creator>
		
		<category><![CDATA[Design]]></category>

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

		<category><![CDATA[Web Design]]></category>

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

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

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

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

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

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

		<guid isPermaLink="false">http://dougal.gunters.org/blog/2007/07/16/14-awesome-wordpress-powered-sites</guid>
		<description><![CDATA[<div class="pull-quote">
<a href="http://www.welovewp.com/"><img src="/pics/welovewp.com.png" alt="[A screenshot of welovewp.com]" /></a>
<p>WeLoveWP.com highlights great looking WordPress sites, and it&#8217;s powered by WordPress, too!</p>
</div>
<p>
From time to time, someone will hear that I&#8217;m involved with <a href="http://wordpress.org/">WordPress,</a> and ask me a few questions about it. [...]</p><script type="text/javascript">SHARETHIS.addEntry({ title: "14+ Awesome WordPress-powered sites", url: "http://dougal.gunters.org/blog/2007/07/16/14-awesome-wordpress-powered-sites" });</script>]]></description>
			<content:encoded><![CDATA[<div class="pull-quote">
<a href="http://www.welovewp.com/"><img src="/pics/welovewp.com.png" alt="[A screenshot of welovewp.com]" /></a></p>
<p>WeLoveWP.com highlights great looking WordPress sites, and it&#8217;s powered by WordPress, too!</p>
</div>
<p>
From time to time, someone will hear that I&#8217;m involved with <a href="http://wordpress.org/">WordPress,</a> and ask me a few questions about it. Some people already have a WordPress-powered site (either self-hosted, or on <a href="http://wordpress.com/">wordpress.com</a>), and some have never actually used it, but they&#8217;ve heard of it. Often, they just want me to show them a WordPress site, so they can see what it looks like. Occasionally, someone will ask whether any big companies or famous people use WordPress. And one thing I often hear is along the lines of, <q>it just does weblogs, if I have a business site, I&#8217;d want to use something else, right?</q> But in reality, WordPress is an excellent tool for managing a business site. When I tell people this, they&#8217;ll often ask me for some examples of non-blog sites using WordPress.
</p>
<p>
So I end up searching for old bookmarks, looking through my feed archives, and checking the <a href="http://codex.wordpress.org/">Codex</a> until I find some suitable choices. Likewise, if someone just wants to see some examples of WP sites, I want to show them something that really stands out.
</p>
<p>
Now I&#8217;m finally going to document a really nice selection of sites that I can point them to for several examples, a sort of &#8220;Best of WordPress&#8221;. Some sites just look good. Some are examples of famous celebrities, companies, or organizations. Others showcase WP in a non-blog capacity. In no particular order, here is my list of <strong>Awesome WordPress Sites</strong>:
</p>
<p><span id="more-823"></span></p>
<ul>
<li>Alex King&#8217;s <a href="http://crowdfavorite.net/">Crowd Favorite</a> not only has great design, but is a perfect example of using WordPress to power a business site.</li>
<li>And Crowd Favorite, in turn, is responsible for <a href="http://allthingsd.com/">All Things Digital</a>, which is powered by <a href="http://mu.wordpress.org/">WordPress-MU</a>. Alex also has a great series of articles about <a href="http://alexking.org/blog/2006/11/02/building-v2-part1">building a customized WP site</a>.</li>
<li><a href="http://chickspeak.com/">ChickSpeak</a> is another WordPress-MU site, with a focus  on women&#8217;s issues. It&#8217;s structured more like a social network than a blog. There&#8217;s <a href="http://www.blazenewmedia.com/articles/chickspeak-a-wordpress-mu-based-social-network">an article outlining ChickSpeak&#8217;s development</a> that&#8217;s interesting, as well. <a class='via' href="http://photomatt.net/">via: photomatt</a></li>
<li>If you grew up in the eighties like my wife and I, then you can remember when musician <a href="http://blog.thomasdolby.com/">Thomas Dolby</a> was blinding everybody with science.</li>
<li><a href="http://politicalticker.blogs.cnn.com/">CNN&#8217;s Political Ticker</a> blog is a WordPress.com <a href="http://wordpress.com/vip-hosting/">VIP Hosting</a> site.</li>
<li>Robert Scoble&#8217;s <a href="http://scobleizer.com/">Scobleizer</a> blog is another WordPress.com VIP site. Scoble has been an icon in weblog circles for many years now, and is famous for his prolific output, as well as for being an author and a former Microsoft technical evangelist .</li>
<li><a href="http://yodel.yahoo.com/">Yodel Anecdotal</a> is Yahoo&#8217;s corporate blog.
</li>
<li><a href="http://www.deliciousdays.com/">delicious:days</a> is a food blog that looks good enough to eat. Simply beautiful.</li>
<li><a href="http://center.arc.nasa.gov/">NASA Ames Research Center</a> is powered by WordPress. This group is responsible for many of NASA&#8217;s cutting-edge research projects.</li>
<li><a href="http://blog.us.playstation.com/">PlayStation.Blog</a> is the official PlayStation blog from Sony U.S.</li>
<li>Nancy Pelosi, the first female Speaker of the House, has a blog called <a href="http://speaker.gov/blog/">The Gavel</a>. WordPress is in ur guvrnment blogging ur lejislashun!</li>
<li>Ford Motor Company&#8217;s <a href="http://autoshows.ford.com/">Global Auto Shows</a> site doesn&#8217;t look much like a blog, but it&#8217;s all wrapped up in WordPressian goodness.</li>
<li><a href="http://www.cssremix.com/"><acronym title='Cascading Style Sheets'><span class='caps'>CSS</span></acronym> Remix</a> is a showcase of sites with<br />
great design. And the site itself looks schweet.</li>
<li><a href="http://www.welovewp.com/">welovewp.com</a> highlights many WP-powered sites. Some are business-oriented, some are more standard blogs, but all of them have really great design. Oh, and of course, welovewp.com is powered  by WordPress, as well.</li>
</ul>
<p>
Of course, the sites I&#8217;ve listed here are only the tip of the iceburg. There are <em>tons</em> of fantastic WordPress sites in the wild that deserve as much attention as these. Do you know of some? Post them here, and whenever somebody asks you about great WordPress sites, you can just give them a link to this post!</p>
<p><a href="http://sharethis.com/item?&wp=2.5.2-alpha&amp;publisher=06a70a77-1fc0-46a9-81d1-6a696e6ed23f&amp;title=14%2B+Awesome+WordPress-powered+sites&amp;url=http%3A%2F%2Fdougal.gunters.org%2Fblog%2F2007%2F07%2F16%2F14-awesome-wordpress-powered-sites">ShareThis</a></p>]]></content:encoded>
			<wfw:commentRss>http://dougal.gunters.org/blog/2007/07/16/14-awesome-wordpress-powered-sites/feed</wfw:commentRss>
		</item>
		<item>
		<title>Perl geekery: building hashes</title>
		<link>http://dougal.gunters.org/blog/2007/06/21/perl-geekery-building-hashes</link>
		<comments>http://dougal.gunters.org/blog/2007/06/21/perl-geekery-building-hashes#comments</comments>
		<pubDate>Thu, 21 Jun 2007 10:31:58 +0000</pubDate>
		<dc:creator>Dougal</dc:creator>
		
		<category><![CDATA[Development]]></category>

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

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

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

		<guid isPermaLink="false">http://dougal.gunters.org/blog/2007/06/21/perl-geekery-building-hashes</guid>
		<description><![CDATA[<p>
Say we&#8217;re writing a program in Perl, and we need to pass a lot of data back and forth between subroutines. Using global variables is bad practice, and we often use the slightly-less-bad method of passing around a big hash variable. But it&#8217;s a pain to always use the values in the hash, so a lot of our code uses individual scalar variables, and stick them into (and pull them out of) the hash as needed. [...]</p><script type="text/javascript">SHARETHIS.addEntry({ title: "Perl geekery: building hashes", url: "http://dougal.gunters.org/blog/2007/06/21/perl-geekery-building-hashes" });</script>]]></description>
			<content:encoded><![CDATA[<p>
Say we&#8217;re writing a program in Perl, and we need to pass a lot of data back and forth between subroutines. Using global variables is bad practice, and we often use the slightly-less-bad method of passing around a big hash variable. But it&#8217;s a pain to always use the values in the hash, so a lot of our code uses individual scalar variables, and stick them into (and pull them out of) the hash as needed. But when you have a <em>lot</em> of values to move around, it&#8217;s a pain in the neck. You don&#8217;t want a big, ugly block of code like this:
</p>
<pre><code>
#...assume that we declared %hash,
#   $foo, $bar, $baz, etc previously...
$hash{'foo'} = $foo;
$hash{'bar'} = $bar;
$hash{'baz'} = $baz;
# ...ad nauseum...
</code></pre>
<p>
Surely, there&#8217;s a more elegant way to do this, right? Of course there is. The mantra of perl programmers is <acronym title='There is More Than One Way To Do It (tim toady)'><span class='caps'>TMTOWTDI</span></acronym> (There&#8217;s More Than One Way To Do It)! The first and most obvious approach that comes to mind is to use &#8220;variable variables&#8221;, technically known as &#8220;symbolic references&#8221;:
</p>
<pre><code>
my %hash;
my @vars = qw(foo bar baz);
foreach my $var (@vars) {
  # This uses a symbolic reference. When $var is 'foo',
  # then saying $$var is like saying $foo.
  $hash{$var} = $$var;
}
</code></pre>
<p>
The problem is that symbolic references are frowned upon, and will cause perl to get angry with you if you&#8217;re running with <code>use strict</code> (as you should be). You can get around this by declaring the scope of <var>$foo</var> and friends as &#8216;our&#8217; instead of &#8216;my&#8217;, and by using <code>no strict 'refs'</code> inside the <code>foreach</code> loop. I&#8217;m pretty sure that this wouldn&#8217;t cause any memory leaks, but it&#8217;s still an iffy solution because you have to change the scope of a bunch of your variables to &#8216;our&#8217;, which might have undesired side-effects.
</p>
<p>
The next refactoring is a nice improvement. The main difference is that it requires you to stick your list of values into a temporary array. Just keep in mind that this array will be modified (emptied) in the process:
</p>
<pre><code>
my %hash;
my @keys = qw(foo bar baz);
my @values = ($foo, $bar, $baz);
foreach my $key (@keys) {
  $hash{$key} = shift @values;
}
</code></pre>
<p>
Ah, much better! No problems running strict, and not too ugly. A final improvement, suggested to me by David Narayan, is to use a hash slice:
</p>
<pre><code>
my %hash;
my @keys = qw(foo bar baz);
my @values = ($foo, $bar, $baz);
@hash{@keys} = @values;
</code></pre>
<p>
That&#8217;s about as succinct as it&#8217;s going to get. The only disadvantage here might be if your list of key/value pairs was large, this would probably use a lot of memory. In that case, you&#8217;d probably want to use the <code>foreach</code> loop, as in the previous example.</p>
<p><a href="http://sharethis.com/item?&wp=2.5.2-alpha&amp;publisher=06a70a77-1fc0-46a9-81d1-6a696e6ed23f&amp;title=Perl+geekery%3A+building+hashes&amp;url=http%3A%2F%2Fdougal.gunters.org%2Fblog%2F2007%2F06%2F21%2Fperl-geekery-building-hashes">ShareThis</a></p>]]></content:encoded>
			<wfw:commentRss>http://dougal.gunters.org/blog/2007/06/21/perl-geekery-building-hashes/feed</wfw:commentRss>
		</item>
		<item>
		<title>Using the WordPress Object Cache</title>
		<link>http://dougal.gunters.org/blog/2006/07/21/using-the-wordpress-object-cache</link>
		<comments>http://dougal.gunters.org/blog/2006/07/21/using-the-wordpress-object-cache#comments</comments>
		<pubDate>Fri, 21 Jul 2006 16:46:57 +0000</pubDate>
		<dc:creator>Dougal</dc:creator>
		
		<category><![CDATA[Development]]></category>

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

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

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

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

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

		<guid isPermaLink="false">http://dougal.gunters.org/blog/2006/07/21/using-the-wordpress-object-cache</guid>
		<description><![CDATA[<p>
I&#8217;ve been planning to write up a plugin to serve as an example of using the <a href="http://codex.wordpress.org/Function_Reference/WP_Cache">WordPress Object Cache</a>, but haven&#8217;t had time to finish it up. However, this topic came up on the <a href="http://codex.wordpress.org/Mailing_Lists#Hackers">wp-hackers mailing list</a> recently, so I thought that I would go ahead and give a brief rundown on how to use the cache from within your own plugins.
</p>
<p>
The goal of the WordPress Object Cache is to provide a way to persistently store results from expensive queries in an external cache file. [...]</p><script type="text/javascript">SHARETHIS.addEntry({ title: "Using the WordPress Object Cache", url: "http://dougal.gunters.org/blog/2006/07/21/using-the-wordpress-object-cache" });</script>]]></description>
			<content:encoded><![CDATA[<p>
I&#8217;ve been planning to write up a plugin to serve as an example of using the <a href="http://codex.wordpress.org/Function_Reference/WP_Cache">WordPress Object Cache</a>, but haven&#8217;t had time to finish it up. However, this topic came up on the <a href="http://codex.wordpress.org/Mailing_Lists#Hackers">wp-hackers mailing list</a> recently, so I thought that I would go ahead and give a brief rundown on how to use the cache from within your own plugins.
</p>
<p>
The goal of the WordPress Object Cache is to provide a way to persistently store results from expensive queries in an external cache file. This lets us avoid re-querying the database or re-fetching information from an external web service if we think that the data hasn&#8217;t changed. It should be noted, however, that some server environments have trouble using the cache. It is up to you to monitor your server to determine whether use of the cache will benefit your sites,</p>
<p>
Using the object cache is actually quite simple. You write data to the cache using <code>wp_cache_set()</code>, and you read cached data with <code>wp_cache_get()</code>.
</p>
<p>
Before I get to the sample code, there are some other things you&#8217;ll need to check. The object cache is disabled by default. In order to enable it, you&#8217;ll need to edit your <code>wp-config.php</code> file. Add the following lines, after the setting for <code>WP_LANG</code>:
</p>
<pre><code>
// Enable the WordPress Object Cache:
define(ENABLE_CACHE, true);
</code></pre>
<p>
Also, make sure that there is <strong>not</strong> a define for a <code>DISABLE_CACHE</code>  constant. In addition, you will need to make sure that you have a <code>wp-content/cache</code> subdirectory on your host, and that it is writable by your web server process. I assume that if you are planning to write code to use the object cache, that you know how to handle this on your host server.
</p>
<p>
That said, let&#8217;s take a look at how you use the <code>wp_cache_get()</code> and wp_cache_set()</code> functions in your own code. First, we&#8217;ll examine how we put data into the cache. Think of the cache as a set of containers, each of which can store several data packets. You can name the containers and the packets within, so that you know how to retrieve them later. In these examples, I am naming the container <var>mycache</var>, and we&#8217;ll call the data packet <var>mysettings</var>. It would probably be a good convention to name your own container based on the name of your plugin, and name the packets based on what kind of information you are storing (e.g. <var>userdata</var> or <var>popularpostinfo</var>).
</p>
<p>
Here&#8217;s how we write data to the cache:
</p>
<pre><code>
  // Whenever we need to rewrite the cache data:
  // This could be calling a database, webservice, etc.
  $mydata = my_complicated_data_query();
  $myexpire = 60 * 60 * 24; // Cache data for one day (86400 seconds)
  wp_cache_set('mysettings', $mydata, 'mycache', $myexpire);
</code></pre>
<p>
You&#8217;ll have to determine the best point in your code to do this depending on what kind of data you&#8217;re caching. For example, if you are caching user profile data, you might want to update the cache anytime a user&#8217;s profile changes by hooking into the <code>profile_update()</code> <acronym title='Application Interface'><span class='caps'>API</span></acronym> hook.
</p>
<p>
Now, when you want to avoid that complicated database query, check the cache first. If your information is not already in the cache, or if it has expired, <code>wp_cache_get()</code> will return <var>false</var>. In that case, you&#8217;ll need to re-query the database for the information. Otherwise, it will return whatever data structure that you previously stored.
</p>
<pre><code>
  // First of all, before you try to access the user data, check
  // the cache.
  $mydata = wp_cache_get('mysettings', 'mycache');

  if (false === $mydata) {
    // The cache data doesn't exist or it's expired.
    // Do whatever we need to populate $mydata from the
    // database normally... 

    $mydata = my_complicated_data_query();

    // Since we know that the cache isn't up to date, we should
    // write this fresh information to it now, so that we can avoid
    // the query next time.
    $myexpire = 60 * 60 * 24; // Cache data for one day (86400 seconds)
    wp_cache_set('mysettings', $mydata, 'mycache', $myexpire);
  }
</code></pre>
<p>
It&#8217;s up to you to decide an appropriate amount of time to cache your data and to determine which <acronym title='Application Interface'><span class='caps'>API</span></acronym> action hooks should trigger cache updates. A whole day will be too long for some types of information. But with this basic information in hand, it should be relatively easy for plugin authors to take advantage of the object cache.</p>
<p><a href="http://sharethis.com/item?&wp=2.5.2-alpha&amp;publisher=06a70a77-1fc0-46a9-81d1-6a696e6ed23f&amp;title=Using+the+WordPress+Object+Cache&amp;url=http%3A%2F%2Fdougal.gunters.org%2Fblog%2F2006%2F07%2F21%2Fusing-the-wordpress-object-cache">ShareThis</a></p>]]></content:encoded>
			<wfw:commentRss>http://dougal.gunters.org/blog/2006/07/21/using-the-wordpress-object-cache/feed</wfw:commentRss>
		</item>
		<item>
		<title>A Software Development Analogy</title>
		<link>http://dougal.gunters.org/blog/2006/05/23/a-software-development-analogy</link>
		<comments>http://dougal.gunters.org/blog/2006/05/23/a-software-development-analogy#comments</comments>
		<pubDate>Tue, 23 May 2006 18:20:03 +0000</pubDate>
		<dc:creator>Dougal</dc:creator>
		
		<category><![CDATA[Development]]></category>

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

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

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

		<guid isPermaLink="false">http://dougal.gunters.org/blog/2006/05/23/a-software-development-analogy</guid>
		<description><![CDATA[<p>
Alice takes her car to a repair shop on Monday. She walks inside and talks to Bob, the customer service representative behind the counter. &#8220;My car seems to work pretty well, but occassionally it makes an odd noise. When can you have it fixed, and how much will it cost?&#8221;
</p>
<p>
Bob smiles and replies, &#8220;we can have your car ready by noon on Friday, and it will cost $200.&#8221; Alice says that this is acceptable, and leaves her car to be worked on.
</p>
<p>
On Wednesday afternoon, Bob talks to Charlie, the mechanic. [...]</p><script type="text/javascript">SHARETHIS.addEntry({ title: "A Software Development Analogy", url: "http://dougal.gunters.org/blog/2006/05/23/a-software-development-analogy" });</script>]]></description>
			<content:encoded><![CDATA[<p>
Alice takes her car to a repair shop on Monday. She walks inside and talks to Bob, the customer service representative behind the counter. &#8220;My car seems to work pretty well, but occassionally it makes an odd noise. When can you have it fixed, and how much will it cost?&#8221;
</p>
<p>
Bob smiles and replies, &#8220;we can have your car ready by noon on Friday, and it will cost $200.&#8221; Alice says that this is acceptable, and leaves her car to be worked on.
</p>
<p>
On Wednesday afternoon, Bob talks to Charlie, the mechanic. &#8220;How are you progressing on Miss Alice&#8217;s repairs?&#8221; Charlie gives Bob a blank look.
</p>
<p>
&#8220;I gave it a quick look yesterday, but I haven&#8217;t even started working on her car. I&#8217;m still finishing up the work on Mr. Durham&#8217;s truck.&#8221;
</p>
<p>
&#8220;Haven&#8217;t started? We have to get her car working by Friday at noon!&#8221; Bob exclaims.
</p>
<p>
Charlie narrows his eyes and shrugs. &#8220;That&#8217;s not going to happen. I had to order some parts, and they won&#8217;t even be here until tomorrow.&#8221;
</p>
<p>
Bob gives Charlie a pained look and sputters, &#8220;surely you realize that Miss Alice is an important customer? She works for a company that has a fleet of leased cars, and they get all their servicing from us. If we don&#8217;t have her car ready on time, we could lose that contract!&#8221;
</p>
<p>
Charlie looks back and Bob and replies, &#8220;Maybe you should have thought of that earlier. And maybe you should have asked me what my repair schedule looked like before you gave her an ETA on her repairs. Better yet, you probably should have asked Dave, since he&#8217;s the shop manager. But, no &#8212; you ignored our normal workflow, and now I&#8217;m going to have to work overtime because of your mistake. And when this lady gets her car back, if everything works fine, she&#8217;ll send you a nice thank you note, and the shop owner will congratulate you. But if I make a mistake in my hurry to meet your unreasonable deadline, you&#8217;ll blame me, and the shop owner might fire me. Is that basically right?&#8221;
</p>
<p>
&#8220;Yup.&#8221;
</p>
<p>
&#8220;I guess I&#8217;d better get to work, then.&#8221;
</p>
<p> <a href="http://www.myshopping.com.au/PT--84_Software">Software Australia</a> Buy software online in Australia</p>
<p><a href="http://sharethis.com/item?&wp=2.5.2-alpha&amp;publisher=06a70a77-1fc0-46a9-81d1-6a696e6ed23f&amp;title=A+Software+Development+Analogy&amp;url=http%3A%2F%2Fdougal.gunters.org%2Fblog%2F2006%2F05%2F23%2Fa-software-development-analogy">ShareThis</a></p>]]></content:encoded>
			<wfw:commentRss>http://dougal.gunters.org/blog/2006/05/23/a-software-development-analogy/feed</wfw:commentRss>
		</item>
	</channel>
</rss>
