<?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/"
	>

<channel>
	<title>Daniel Shorten</title>
	<atom:link href="http://daniel.shortens.net/feed" rel="self" type="application/rss+xml" />
	<link>http://daniel.shortens.net</link>
	<description></description>
	<pubDate>Wed, 17 Mar 2010 05:04:43 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Put a pretty face on it!</title>
		<link>http://daniel.shortens.net/weblog/put-a-pretty-face-on-it</link>
		<comments>http://daniel.shortens.net/weblog/put-a-pretty-face-on-it#comments</comments>
		<pubDate>Wed, 17 Mar 2010 04:51:23 +0000</pubDate>
		<dc:creator>Daniel Shorten</dc:creator>
		
		<category><![CDATA[Weblog]]></category>

		<guid isPermaLink="false">http://daniel.shortens.net/?p=398</guid>
		<description><![CDATA[Apparently a pretty, smiling face is a good idea in anyone&#8217;s marketing campaign, even if the face has nothing to do with the product or service being sold. Don&#8217;t get me wrong; I&#8217;m not trying to say that there are no attractive women in IT, or that women shouldn&#8217;t be associated with technology careers. I [...]]]></description>
			<content:encoded><![CDATA[<p><img src="/wp-content/uploads/2010/03/advisory.gif" alt="Audience advisory: cynical content" width="158" height="107" align="left" />Apparently a pretty, smiling face is a good idea in anyone&#8217;s marketing campaign, even if the face has nothing to do with the product or service being sold. Don&#8217;t get me wrong; I&#8217;m not trying to say that there are no attractive women in IT, or that women shouldn&#8217;t be associated with technology careers. I was just struck today with how abruptly the marketing ploy ended at <a title="PrepLogic Web site" href="http://www.preplogic.com/products/career-choices/" target="_blank">PrepLogic.com</a>.<span id="more-398"></span></p>
<p><img src="/wp-content/uploads/2010/03/preplogic.jpg" alt="" align="right" />I was reading some technology article today, when suddenly this beautiful blonde-haired woman scrolled onto the right side of the screen.  Above her, the text &#8220;Free IT Training.&#8221;  Call me sexist but, in my experience, beautiful young women and IT don&#8217;t often come as a package.  &#8220;Maybe this company is different,&#8221; I thought.  &#8220;Maybe they emphasize women&#8217;s place in the IT industry; or, better yet, maybe this pretty girl is <em>teaching</em> these IT courses.&#8221;</p>
<p>So I clicked on over to <a href="http://www.preplogic.com/products/career-choices/" target="_blank">PrepLogic.com</a> and, sure enough, found more pictures of this beautiful blonde. Even more curious now, I signed up for the Free 15-minute Guides, wondering if these might be 15 minutes of an attractive IT professional giving me tips on Windows 2008 Server, or some industry-standard Cisco router.</p>
<p>I was disappointed to find that the 15-minute Guide was only a 14-page summary of the Microsoft 70-290 exam—probably handy if you happen to be preparing for that test, but somewhat cold and lonely compared to that initial splash page.</p>
<p>Wondering what became of Miss IT Certification and what I guessed might be a progressive statement by PrepLogic, I turned to Google to help me uncover any relevant video footage. <a title="Google Video results from preplogic.com" href="http://video.google.ca/videosearch?q=site%3Apreplogic.com" target="_blank">What I found</a> was more representative of the IT industry I know. Moustaches. Thinning hair. And not on women.</p>
<p><img title="IT Guy" src="/wp-content/uploads/2010/03/moustache.jpg" alt="IT guy with moustache" width="297" height="228" /></p>
<p>Why didn&#8217;t they put this guy under their ad?  He looks like a person that knows information technology.  If you watch his video, he definitely sounds like he knows his stuff.</p>
<p>I guess the moral of this whole story, after poking fun at the <a title="Perceived rightly or wrongly..." href="http://www.isgtw.org/?pid=1000760" target="_blank">perceived incongruity of a young beautiful woman and the IT industry</a>, is that I stopped what I was doing, I looked at their ad, I visited their site, and I signed up for their free offer! Whether or not a pretty girl&#8217;s face belongs on an IT ad can be hotly debated, but it drew a click, a signup, and a blog post from one sucker.</p>
<p>&#8230; I feel like the joke&#8217;s on me.</p>
<p>I hope you&#8217;re happy, Miss IT Certification.</p>
]]></content:encoded>
			<wfw:commentRss>http://daniel.shortens.net/weblog/put-a-pretty-face-on-it/feed</wfw:commentRss>
		</item>
		<item>
		<title>Inside Out Brochure</title>
		<link>http://daniel.shortens.net/portfolio/print/inside-out-brochure</link>
		<comments>http://daniel.shortens.net/portfolio/print/inside-out-brochure#comments</comments>
		<pubDate>Tue, 15 Sep 2009 23:47:09 +0000</pubDate>
		<dc:creator>Daniel Shorten</dc:creator>
		
		<category><![CDATA[Print]]></category>

		<guid isPermaLink="false">http://daniel.shortens.net/?p=378</guid>
		<description><![CDATA[A lengthwise tri-fold brochure, designed for Balmoral Bible Chapel to promote their fall kick-off Sunday. The design is interactive, provokes curiosity, and conveys personality and excitement.
]]></description>
			<content:encoded><![CDATA[<p>A lengthwise tri-fold brochure, designed for Balmoral Bible Chapel to promote their fall kick-off Sunday. The design is interactive, provokes curiosity, and conveys personality and excitement.</p>
]]></content:encoded>
			<wfw:commentRss>http://daniel.shortens.net/portfolio/print/inside-out-brochure/feed</wfw:commentRss>
		</item>
		<item>
		<title>HostPapa: The Good, the Bad, and the Ugly</title>
		<link>http://daniel.shortens.net/weblog/hostpapa-the-good-the-bad-and-the-ugly</link>
		<comments>http://daniel.shortens.net/weblog/hostpapa-the-good-the-bad-and-the-ugly#comments</comments>
		<pubDate>Sun, 23 Aug 2009 03:13:11 +0000</pubDate>
		<dc:creator>Daniel Shorten</dc:creator>
		
		<category><![CDATA[Weblog]]></category>

		<guid isPermaLink="false">http://daniel.shortens.net/?p=367</guid>
		<description><![CDATA[The hosting market is a jungle. There are tons of hosts offering unlimited bandwidth, unlimited storage space, unlimited email accounts. But when the rubber hit the road, all I wanted was small-scale service I could count on.
I&#8217;ve had great personal experience with 1&#38;1; maybe I can write more about them another day. But I was [...]]]></description>
			<content:encoded><![CDATA[<p>The hosting market is a jungle. There are tons of hosts offering unlimited bandwidth, unlimited storage space, unlimited email accounts. But when the rubber hit the road, all I wanted was small-scale service I could count on.<span id="more-367"></span></p>
<p>I&#8217;ve had great personal experience with <a href="http://www.1and1.com">1&amp;1</a>; maybe I can write more about them another day. But I was helping a client migrate from an unreliable host, so I was very concerned about customer support as well as reliability. I&#8217;ve read horrific reports of 1&amp;1 customers trying to get help over the phone from someone in India, which is nowhere close to the actual data centers. In spite of my good experience with 1&amp;1, critical reviews made me nervous.</p>
<p>So I started searching for Canadian hosts, and <a href="http://hostpapa.com">HostPapa</a> seemed to come highly recommended. They&#8217;re a relatively new host but seem to have a very loyal and satisfied client base. Having run a successful business in the UK, they decided to open up a base in Ontario. Among other <a href="http://hostpapa.com/Plan_Features.shtml">encouraging offerings</a>, they promise 99.9% uptime, a state-of-the-art data center, and that they purchase &#8220;green energy&#8221; credits according to their energy consumption. Their technical support is also located in Ontario, which reassured me.</p>
<p>I was sold. I signed up for three years of service.</p>
<p>On day one I started transferring my client&#8217;s Web site to the new Web space. Before all of it was transferred, I got an error about exceeding available disk space. I phoned customer support and quickly discovered that, truly, the server was out of disk space. Apparently another user had decided to take them up on their offer of unlimited disk space and filled up the whole server. So I had to wait for a day for them to sort that out.</p>
<p>The next day I was able to get the Web site up.</p>
<p>I was designing a Web app for this client that would not be hosted at HostPapa, so I needed access to the DNS records to set up a subdomain for the external app. I soon realized that the admin interface used by HostPapa would not give me this degree of control, so I contacted support to see if they could add a DNS record for me.  I gave them the address of my other host and they said that they could.</p>
<p>At least four days later, the subdomain was still not working. I asked support about it, and they said they were still working on it. Later I received an email saying that my ticket had been resolved, only to see that support had created a subdomain for a folder in the <code>public_html</code> directory of my HostPapa account. Definitely not what I had asked for.</p>
<p><em>(As an aside, 1&amp;1 allows you do this easily using their admin interface; the new subdomain and DNS entries are sometimes functional within minutes.)</em></p>
<p>So I decided to transfer the domain away from HostPapa to a DNS server that I could control. During this wait, I had created all of the employees email accounts by uploading a CSV file with email addresses and passwords. I then I transferred all the mail from the old host to the new accounts using <a href="http://freshmeat.net/projects/imapsync/">imapsync</a>.</p>
<p>Web site and email were transferred, up, and working better for my client than they had in months. For a day or so. Suddenly email was down because of some certificate inconsistency on HostPapa&#8217;s end. This problem persisted for most of a day, and I was becoming more and more nervous that this was a taste of the 99.9% uptime that I had signed my client up for.</p>
<p>To their credit, HostPapa&#8217;s technical support was always very easy to contact and transparent in addressing problems. After the first two weeks of madness, my client settled into a very reliable experience with the host&#8230;</p>
<p>&#8230; until last week, when there was some massive hardware failure on HostPapa servers. Mail was recovered, as well as Web files, but the MySQL database that stored not only the content of my client&#8217;s Web site but also all of the HTML and CSS templates was lost, leaving the home page a white screen with a database error message.</p>
<p>I&#8217;m trying to give an objective account of my experience with HostPapa. No host is perfect. Obviously I&#8217;ve had months of seamless service. However, migration and initial setup was brutal, and within one year of service, I&#8217;ve lost my database. There are tons of complaints online about big hosts like 1&amp;1. I can say two things:</p>
<ol>
<li>I&#8217;ve been with 1&amp;1 for at least five times as long as HostPapa and have never lost any data due to their fault.</li>
<li>I&#8217;d rather have service that just works than great customer support to help me handle all the problems.</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://daniel.shortens.net/weblog/hostpapa-the-good-the-bad-and-the-ugly/feed</wfw:commentRss>
		</item>
		<item>
		<title>Production, Staging, and Development: Tips and Best Practices</title>
		<link>http://daniel.shortens.net/weblog/production-staging-and-development-tips-and-best-practices</link>
		<comments>http://daniel.shortens.net/weblog/production-staging-and-development-tips-and-best-practices#comments</comments>
		<pubDate>Fri, 03 Jul 2009 19:07:57 +0000</pubDate>
		<dc:creator>Daniel Shorten</dc:creator>
		
		<category><![CDATA[Weblog]]></category>

		<guid isPermaLink="false">http://daniel.shortens.net/?p=313</guid>
		<description><![CDATA[If you&#8217;re only dealing with a simple Web site that you develop and deploy in one iteration, you may never have to worry about updating it, or you may be able to get away with hot fixes, straight to the live site. However, once you start dealing with a project of considerable complexity, and one [...]]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;re only dealing with a simple Web site that you develop and deploy in one iteration, you may never have to worry about updating it, or you may be able to get away with hot fixes, straight to the live site. However, once you start dealing with a project of considerable complexity, and one with multiple development iterations, there&#8217;s no way around some sort of tiered system for update deployment—unless you write perfect code, in which case you should stop reading my blog and go make a million dollars.<span id="more-313"></span></p>
<p>The trouble of course is that as you&#8217;re developing a new feature, you make changes or additions to the existing code of your application. But let&#8217;s say you can&#8217;t always write perfect code, and can&#8217;t predict the effects of your new code. If something breaks, any of the people using your system will see the wreck, all of a sudden. For the users, it would be like trying to drive a car while a service technician is working on the transmission: very difficult, and very annoying.</p>
<p>So, don&#8217;t do work on the live (production) site—only update it when you&#8217;re 99% certain that your updates are working properly.  A few technicalities arise:</p>
<ol>
<li>If you can&#8217;t work in the Production environment, where do you work?  And how can your working environment (Development) be as similar as possible to Production?</li>
<li>How do you move code (and data, and other components) between Development and Production? How do you make sure that you&#8217;re working off of current Production data? How do you deploy an update to Production smoothly (without taking forever, without missing a file/update)?</li>
<li>How do you design your application so that it can be shoved around (from Production to Staging, to Development) without breaking paths, database connections.</li>
</ol>
<p>The good news is that, with a little work and foresight, all these considerations can be easily managed.</p>
<h2>Development and Staging</h2>
<p>Your development tiers will depend on the size and complexity if your project.  For instance, if there is only one developer, you can get away with a single development environment where you do your work before updating.</p>
<p>As soon as there are multiple developers working on the same project, it becomes desirable for each person or team to have a &#8220;sandbox,&#8221; where one can mess around while building new functionality.  And once there are multiple components being built at a time, it becomes necessary to have another type of workspace (typically called a Staging environment) where all of the separate components can be tested together, before they are released to Production.</p>
<p>So how do you make a development environment?</p>
<h2>Creating the Development Environment</h2>
<p>Some people have the luxury of working with <a href="http://en.wikipedia.org/wiki/Virtual_private_server">Virtual Servers</a>, where it&#8217;s trivial to &#8220;clone&#8221; the Production server, giving you an exact copy to fool around with. In this case, there are fewer considerations in obtaining a development environment.</p>
<p>If you aren&#8217;t working with virtual servers, you might have to manually make a copy of Production.  In this case, it&#8217;s easier to ensure congruence between Development and Production if Development can run on the same server as Production.  This is likely not feasible for large projects, since Production will need all available resources to serve clients.</p>
<h2>Transferring Code and Data</h2>
<p>In any case, working without a virtual server requires some manual copying, so the key is <strong>automate</strong>.</p>
<p>Write a script that copies the production databases to a new test version.  With MySQL (if you have the right permissions), you can just copy the database folder in /var/lib/mysql (or wherever your database files are kept).</p>
<p>In my case, I check out code from a version control repository to start a fresh development environment, but the repository doesn&#8217;t track every single thing that the application needs to run. For all those extra things, add them to some kind of shell script so that you can get set up right away.</p>
<p>Speaking of version control, I&#8217;ve found this to be a huge help in managing code between Development and Production. I&#8217;m not sure if this is an accepted best practice, but it&#8217;s working for me. Using <a href="http://git-scm.com/">git</a>, I keep Production managed under its own repository. When I want to start a fresh development server, I check out (clone) the Production code. As I work, I commit any changes to my development repository. Then, when I&#8217;m ready to release the new features to Production, I use git&#8217;s <code>pull</code> command to fetch updates from Development and apply them to Production. The big advantage I find here is that I don&#8217;t have to keep track of what I&#8217;ve changed; as long as I commit the changes, git knows what to update.<!--more--></p>
<p>Note that even if you were sure that your code worked, you wouldn&#8217;t want to use <code>pull</code> to update Production unless you were certain that there wouldn&#8217;t be any conflicts when merging the new code with the old code. This isn&#8217;t usually a problem with a small number of developers, but with multiple branches of code, conflicts may arise that need to be manually sorted out.</p>
<p>Obviously proper testing standards fit into the updating process, but that&#8217;s another topic for another time.</p>
<h2>Application Design</h2>
<p>To make development server setup as quick as possible (and many other maintenance tasks), any global, server-specific variables or configuration should be specified in a separate configuration file: database connection information, server path, base URL for the Web site, debug settings. I keep these settings in a file that isn&#8217;t even tracked by version control. That way (if I&#8217;m really smart), I can write a script that will copy all the production code, data, etc., and create the configuration file with all the appropriate test database connection info and all the paths to wherever my development server is installed.</p>
<p>With all server-specific settings isolated, it&#8217;s easy to copy your code between servers, because you know it will be grabbing the right path and connection information from the respective configuration file.</p>
<p>With good design and a little work, starting a fresh, up-to-date development environment will be a command away at the shell prompt. Wow! Almost makes you want to write that next login screen!</p>
]]></content:encoded>
			<wfw:commentRss>http://daniel.shortens.net/weblog/production-staging-and-development-tips-and-best-practices/feed</wfw:commentRss>
		</item>
		<item>
		<title>Wild Rose Fibres</title>
		<link>http://daniel.shortens.net/portfolio/webdesign/wild-rose-fibres</link>
		<comments>http://daniel.shortens.net/portfolio/webdesign/wild-rose-fibres#comments</comments>
		<pubDate>Fri, 05 Jun 2009 18:19:22 +0000</pubDate>
		<dc:creator>Daniel Shorten</dc:creator>
		
		<category><![CDATA[Web Design]]></category>

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

		<guid isPermaLink="false">http://daniel.shortens.net/?p=333</guid>
		<description><![CDATA[This Central-Alberta-based business has been online for a few years, showcasing their selection of spinning fibres, wheels, and accessories. As a part of new ownership and direction, Wild Rose Fibres decided to leverage new Internet technology to launch a redesigned and automated e-commerce site.
The new Web site allows products and prices to be managed from [...]]]></description>
			<content:encoded><![CDATA[<p>This Central-Alberta-based business has been online for a few years, showcasing their selection of spinning fibres, wheels, and accessories. As a part of new ownership and direction, Wild Rose Fibres decided to leverage new Internet technology to launch a redesigned and automated e-commerce site.</p>
<p>The new Web site allows products and prices to be managed from a store back end, where products can be immediately added or removed, and special offers or product features can be applied. Customers can complete their transactions online at their convenience.</p>
<p>This site features a clean graphic design, and was built using the <a href="http://www.djangoproject.com">Django</a> Python Web framework, using <a href="http://www.satchmoproject.com">Satchmo</a> for the store shell.</p>
<p><a href="http://wildrosefibres.ca">Visit site »</a></p>
]]></content:encoded>
			<wfw:commentRss>http://daniel.shortens.net/portfolio/webdesign/wild-rose-fibres/feed</wfw:commentRss>
		</item>
		<item>
		<title>Red Deer Pet Cremation Service</title>
		<link>http://daniel.shortens.net/portfolio/webdesign/red-deer-pet-cremation-service</link>
		<comments>http://daniel.shortens.net/portfolio/webdesign/red-deer-pet-cremation-service#comments</comments>
		<pubDate>Fri, 05 Jun 2009 17:53:50 +0000</pubDate>
		<dc:creator>Daniel Shorten</dc:creator>
		
		<category><![CDATA[Web Design]]></category>

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

		<guid isPermaLink="false">http://daniel.shortens.net/?p=328</guid>
		<description><![CDATA[Formerly known as the Red Deer Pet Cemetary, the Red Deer Pet Cremation Service is a well-established local business that has been serving the community since 1997. They carry a wide variety of pet urns and were often asked if their inventory could be browsed online.
The new Web site and catalogue make it easy for [...]]]></description>
			<content:encoded><![CDATA[<p>Formerly known as the Red Deer Pet Cemetary, the Red Deer Pet Cremation Service is a well-established local business that has been serving the community since 1997. They carry a wide variety of pet urns and were often asked if their inventory could be browsed online.</p>
<p>The new Web site and catalogue make it easy for customers to view the selection of urns and keepsakes while giving the business a confident online presence that matches their established identity.</p>
<p>I also provided the product photography service for this project.</p>
<p><a href="http://reddeerpetcremationservice.com">Visit site »</a></p>
]]></content:encoded>
			<wfw:commentRss>http://daniel.shortens.net/portfolio/webdesign/red-deer-pet-cremation-service/feed</wfw:commentRss>
		</item>
		<item>
		<title>Simple WordPress Thumbnail Snippets</title>
		<link>http://daniel.shortens.net/weblog/simple-wordpress-thumbnail-snippets</link>
		<comments>http://daniel.shortens.net/weblog/simple-wordpress-thumbnail-snippets#comments</comments>
		<pubDate>Thu, 04 Jun 2009 04:46:51 +0000</pubDate>
		<dc:creator>Daniel Shorten</dc:creator>
		
		<category><![CDATA[Weblog]]></category>

		<guid isPermaLink="false">http://daniel.shortens.net/?p=315</guid>
		<description><![CDATA[Thumbnails are really handy, depending on the type of site you&#8217;re designing. The nice thing is that WordPress automatically generates several thumbnail sizes of uploaded images.
You likely noticed that the title uses the term Snippets as opposed to Plugins.  These could be put into plugin form, but they can also be added to a [...]]]></description>
			<content:encoded><![CDATA[<p>Thumbnails are really handy, depending on the type of site you&#8217;re designing. The nice thing is that WordPress automatically generates several thumbnail sizes of uploaded images.</p>
<p>You likely noticed that the title uses the term Snippets as opposed to Plugins.  These could be put into plugin form, but they can also be added to a WordPress theme&#8217;s <code>functions.php</code> file. I&#8217;m not sure of the version compatibility of the code; it&#8217;s been tested with WordPress 2.7.<span id="more-315"></span></p>
<h2>Post Thumbnail</h2>
<p>This is a minimal-overhead thumbnail solution. It makes use of WordPress&#8217;s default thumbnail behaviour. I like this approach because it&#8217;s relatively foolproof if I&#8217;m asking non-technical clients to upload photos—they don&#8217;t have to know anything about the thumbnails, they just need to dump in the source file.</p>
<p>If you look under <strong>Settings &gt; Media</strong> in the WordPress admin, you&#8217;ll see three image sizes that you can configure. When you add an image to the media library of a post, WordPress will upload the original <em>and</em> save three smaller versions (provided that the image you uploaded was bigger than these in the first place). So in the end you&#8217;ll have four image sizes: full (original), large, medium, and thumbnail.</p>
<p>If you plan your design carefully, this should be enough sizes to make you&#8217;re life pretty easy. For instance, I designed a site where various products were stored as posts. For each post, I added a product photo to the media library. I had 150 x 150 thumbnails in the catalogue, 200 x 133 thumbnails on the home page, and a 300 x 200 size on the single product page. The user could then click to view the full size.</p>
<p>I made all of this happen by adding the following code to the theme&#8217;s functions.php:</p>
<pre class="code">function get_image_url($parent_id, $size='thumbnail', $return=false) {
    $images =&amp; get_children('post_parent=' . $parent_id .'&amp;post_type=attachment&amp;post_mime_type=image');
    if (is_array($images)) {
        foreach ($images as $attachment_id =&gt; $attachment) {
            $result = wp_get_attachment_image_src($attachment_id, $size);
            $result = $result[0];
            if ($return)
                return $result;
            else {
                echo $result;
                return;
            }
        }
    }
    else
        if ($return)
            return false;
}</pre>
<p>Then, when I want the URL to the medium thumbnail for a post, I just use this in my template:</p>
<pre class="code">get_image_url($post-&gt;ID, 'medium');</pre>
<p>Essentially, this will grab the first image in the media library of the given post.  Like I said, the size options are <code>'full'</code>, <code>'large'</code>, <code>'medium'</code>, and <code>'thumbnail'</code>. The function echoes the URL by default.  If you want to store the URL for use later, set the <code>$return</code> parameter to <code>true</code>.</p>
<h2>Category Thumbnail</h2>
<p>In the same vein, I&#8217;ve needed a category thumbnail on a couple of occasions, when most of my posts are prominently associated with images.</p>
<p>Please note that the following snippet makes use of a <a href="/wp-content/uploads/2009/06/random-termpost.zip">modified version</a> of <a href="http://www.screenflicker.com/">Mike Stickel</a>&#8217;s <em>Random posts from random terms</em> plugin. I just modified it for easier access to his useful utility functions.</p>
<p>The function grabs a random post from a specific category and gets its thumbnail (using the previous function):</p>
<pre class="code">function get_category_image_url($category_id, $size='thumbnail', $return=false) {
    $random_post = ms_random_post($category_id, 1, false);
    if (sizeof($random_post) &gt; 0) {
        if ($return)
            return get_image_url($random_post[0]['id'], $size, true);
        else
            get_image_url($random_post[0]['id'], $size, false);
    }
    else
        if ($return)
            return false;
}</pre>
<p>Now I can quickly get a relevant thumbnail for a category:</p>
<pre class="code">get_category_image_url($category_id);</pre>
<p>As you can see from the function definitions, size defaults to <code>thumbnail</code>.</p>
<p>If these snippets don&#8217;t do exactly what you need them to do, they are hopefully simple enough that you can adapt them to your requirements.</p>
]]></content:encoded>
			<wfw:commentRss>http://daniel.shortens.net/weblog/simple-wordpress-thumbnail-snippets/feed</wfw:commentRss>
		</item>
		<item>
		<title>Plugin Options in WordPress 2.7</title>
		<link>http://daniel.shortens.net/weblog/plugin-options</link>
		<comments>http://daniel.shortens.net/weblog/plugin-options#comments</comments>
		<pubDate>Wed, 13 May 2009 02:53:32 +0000</pubDate>
		<dc:creator>Daniel Shorten</dc:creator>
		
		<category><![CDATA[Weblog]]></category>

		<guid isPermaLink="false">http://daniel.shortens.net/?p=284</guid>
		<description><![CDATA[I was trying to install Robert Plank&#8217;s Action PopUp plugin on a WordPress MU blog today. The plugin would activate, but when I tried to update any of its settings, I would get an error message:
Error! Options page not found.
At first I wondered if the plugin was not compatible with the 2.7 version of WordPress, but [...]]]></description>
			<content:encoded><![CDATA[<p>I was trying to install Robert Plank&#8217;s <a href="http://www.actionpopup.com/">Action PopUp</a> plugin on a <a href="http://mu.wordpress.org/">WordPress MU</a> blog today. The plugin would activate, but when I tried to update any of its settings, I would get an error message:</p>
<blockquote><p>Error! Options page not found.</p></blockquote>
<p>At first I wondered if the plugin was not compatible with the 2.7 version of WordPress, but it seemed to work fine on one of my vanilla WordPress 2.7 installations. Must be an MU problem.<span id="more-284"></span></p>
<p>It turns out that the new <a title="WordPress Codex" href="http://codex.wordpress.org/Settings_API">Settings API</a> in WordPress 2.7 owes partial thanks to WordPress MU development. Whereas use of the API is still optional in plain WordPress, MU requires plugins to get on board and scrap the old way of storing settings.</p>
<p>The WordPress Codex has the <a title="Plugins Need To Register Their Options" href="http://codex.wordpress.org/Migrating_Plugins_and_Themes_to_2.7#Plugins_Need_to_Register_Their_Options">official story</a>. I&#8217;ll give you my version&#8230;</p>
<p>First, if you don&#8217;t have one already, you&#8217;ll need to create a function and add it as a WordPress <code>admin_init</code> action. It&#8217;ll look something like this:</p>
<pre class="code">function myplugin_admin_init() {
    register_setting('myplugin-options', 'myplugin-option1');
    register_setting('myplugin-options', 'myplugin-option2');
} 

add_action('admin_init', 'myplugin_admin_init');</pre>
<p>Currently, it seems that the only documentation for these functions is in the <a href="http://trac.wordpress.org/browser/trunk/wp-admin/includes/plugin.php">wp-admin/includes/plugin.php source file</a>.</p>
<p>Basically, <code>register_setting</code> takes three arguments. The first an option group name, so a unique identifier for the all the options for your plugin. The second argument is the name for a single option—it should be unique to avoid conflicts with other plugins. Every option on your plugin settings page needs one.</p>
<p>The third argument is optional; you can specify the name of a callback function (as a string) to sanitize user input before it is stored in the database.</p>
<p>Once you&#8217;ve registered all of your options, you can build your admin settings form like this:</p>
<pre class="code">&lt;form method="post" action="options.php"&gt;

&lt;?php settings_fields('myplugin-options'); ?&gt;

&lt;input type="text" name="myplugin-option1" value="&lt;?php echo get_option('myplugin-option1'); ?&gt;" /&gt;
&lt;input type="checkbox" name="myplugin-option2" /&gt;
&lt;input type="submit" value="Save changes" class="button" /&gt;

&lt;/form&gt;</pre>
<p>The important thing is that the settings_fields() function appear inside the settings form. As the WordPress Codex explains:</p>
<blockquote><p><code>settings_fields()</code> outputs all of the hidden fields that options.php will check, <strong>including the nonce</strong>. You no longer need to setup the <strong>page_options hidden field</strong> if you use the new API.</p></blockquote>
<p>Then, just make sure that the <code>name</code> attribute of your form inputs matches the option name you registered with WordPress.</p>
<p>Thanks to <a title="Plugin Options Pages in WordPress 2.7" href="http://maisonbisson.com/blog/post/13208/making-plugin-options-pages-compatible-with-wordpress-27/">Casey Bisson</a> for his help with this.</p>
]]></content:encoded>
			<wfw:commentRss>http://daniel.shortens.net/weblog/plugin-options/feed</wfw:commentRss>
		</item>
		<item>
		<title>Satchmo</title>
		<link>http://daniel.shortens.net/weblog/satchmo</link>
		<comments>http://daniel.shortens.net/weblog/satchmo#comments</comments>
		<pubDate>Thu, 07 May 2009 05:25:45 +0000</pubDate>
		<dc:creator>Daniel Shorten</dc:creator>
		
		<category><![CDATA[Weblog]]></category>

		<guid isPermaLink="false">http://daniel.shortens.net/?p=264</guid>
		<description><![CDATA[I launched my first e-commerce site this month, and it&#8217;s running on Satchmo pre-0.9 (trunk).  Satchmo is a &#8220;framework&#8221; for building Web stores, itself built upon the Django Web application framework.
You can find a complete list of Satchmo&#8217;s impressive features on the project&#8217;s Web site.  I&#8217;ll talk about some particulars that I found invaluable in [...]]]></description>
			<content:encoded><![CDATA[<p>I launched my first e-commerce site this month, and it&#8217;s running on <a title="Satchmo home page" href="http://www.satchmoproject.com">Satchmo</a> pre-0.9 (trunk).  Satchmo is a &#8220;framework&#8221; for building Web stores, itself built upon the <a title="Django home page" href="http://www.djangoproject.com">Django</a> Web application framework.</p>
<p>You can find a complete list of Satchmo&#8217;s <a href="http://www.satchmoproject.com/docs/svn/features.html">impressive features</a> on the project&#8217;s Web site.  I&#8217;ll talk about some particulars that I found invaluable in developing the Wild Rose Fibres store.<span id="more-264"></span></p>
<h2>Product Variations</h2>
<p>The majority of the products for sale at Wild Rose Fibres come in different shapes and sizes, so to speak.  The same type of fibre can come in various colours, and may be available in different package sizes.  Describing this information on a static HTML site is fairly simple, but becomes complicated when you need to represent it in an automated system.</p>
<p style="text-align: center;"><img class="size-full wp-image-266 aligncenter" title="variation_manager" src="http://daniel.shortens.net/wp-content/uploads/2009/05/variation_manager.jpg" alt="Variation Manager" width="342" height="330" /></p>
<p>Satchmo&#8217;s Variation Manager helps automate the creation of all the combinations you might have on a single product.  For example, we have &#8220;bamboo&#8221; fibre that not only comes in different package sizes, but also in a plethora of different colours.  In a less sophisticated system, I might have to manually create Bamboo—Jade (2oz), Bamboo—Azure (2oz), and on and on for <em>number of colours</em> times <em>number of package sizes</em>.  Instead, Satchmo shows me a list of possible combinations (based on the options I specify), I select them, and Satchmo creates them.</p>
<p>I still have to enter specifics for each variation (if each one has a different price or a different photo), but the beautiful thing is that after I do this, it renders automatically in the storefront in option-list, AJAX-updating glory:</p>
<p style="text-align: center;"><img class="size-full wp-image-271" title="options" src="http://daniel.shortens.net/wp-content/uploads/2009/05/options.jpg" alt="Bamboo Options" width="322" height="184" /></p>
<h2>Custom Payment Modules</h2>
<p>When I began the project, I was assuming that I would be using one of the many payment gateways that Satchmo already supports.  I was faced with a bit more of a challenge when my client informed me that, since she was already signing up for other services, it would be more convenient to do payment through her bank: TD.</p>
<p>TD uses <a href="http://www.beanstream.com/">Beanstream</a> for payment processing, a gateway unsupported by Satchmo (at the time of this writing).</p>
<p>Thankfully, the Satchmo project provides good <a title="Custom payment module documentation" href="http://www.satchmoproject.com/docs/svn/custom-payment.html">documentation</a> for dropping in your own payment module.  Because Satchmo comes with a variety of payment modules, new ones can often be modelled directly off of old ones.  In my case, I found that the Google Checkout module closely resembled my Beanstream needs (I also used a bit from the Protx module).</p>
<p>For anyone who needs a head start on interfacing with a Beanstream shopping cart, feel free to check out my <a title="Beanstream shopping cart interface module (20KB zip)" href="http://daniel.shortens.net/wp-content/uploads/2009/05/beanstream.zip">module</a>.</p>
<h2>PCI DSS Compliance</h2>
<p>When you&#8217;re dealing in any way with payment cards on a Web site, you need to be aware of the Payment Card Industry Data Security Standard; it&#8217;s a set of requirements that credit card companies and banks require you to meet depending on how you handle customers&#8217; card information.</p>
<p>Satchmo is designed to be able to meet PCI DSS standards at multiple levels, depending on your needs.  It can store credit card information securely using strong encryption.  It&#8217;s easy to switch on SSL at checkout for secure entry of payment info.  Or, if you&#8217;re like me and decide to avoid the PCI hassle altogether, you can ensure that no credit card info is stored and simply ship customers off to the payment gateway&#8217;s server to complete payment.</p>
<h2>User Group</h2>
<p>The Satchmo Users group has been a great help for the times that I was stumped.  Especially, I want to thank Bruce Kroeze, Chris Moffitt, and Bob Waycott for making the software what it is and for devoting so much to the community.</p>
<p> </p>
<p>I could go on about <a href="http://www.satchmoproject.com/docs/svn/shipping.html">shipping</a> and <a href="http://www.satchmoproject.com/docs/svn/custom-product.html">product modules</a>, the <a href="http://www.satchmoproject.com/docs/svn/translation.html">translation</a> support, and the power available thanks to Django and Python.  I think the results of Satchmo-based stores like <a title="Ooh-Ga-Boo-Ga Island Traders" href="http://oohgabooga.com/">Ooh-Ga-Boo-Ga</a> and <a title="Live Your Passion Apparel and Gear" href="http://www.liveyourpassiongear.com/">Live Your Passion</a> speak for the power and flexibility of this open source solution.</p>
]]></content:encoded>
			<wfw:commentRss>http://daniel.shortens.net/weblog/satchmo/feed</wfw:commentRss>
		</item>
		<item>
		<title>Update all 04/08/2009</title>
		<link>http://daniel.shortens.net/bookmarks/update-all-04082009</link>
		<comments>http://daniel.shortens.net/bookmarks/update-all-04082009#comments</comments>
		<pubDate>Wed, 08 Apr 2009 00:32:38 +0000</pubDate>
		<dc:creator>Daniel Shorten</dc:creator>
		
		<category><![CDATA[My bookmarks]]></category>

		<guid isPermaLink="false">http://daniel.shortens.net/bookmarks/update-all-04082009</guid>
		<description><![CDATA[

Philadelphia Web Design by Jeremy Zevin
tags: portfolio, design

Posted from Diigo. The rest of my favorite links are here.
]]></description>
			<content:encoded><![CDATA[<ul class='diigo-linkroll'>
<li>
<p class='diigo-link'><a rel='nofollow' href='http://www.jeremyzevin.com/'>Philadelphia Web Design by Jeremy Zevin</a></p>
<p class='diigo-tags'><a style='color:#000 !important;text-decoration:none !important;' href='http://www.diigo.com/cloud/danielshorten'>tags</a>: <a href='http://www.diigo.com/user/danielshorten/portfolio'>portfolio</a>, <a href='http://www.diigo.com/user/danielshorten/design'>design</a></p>
</ul>
<p>Posted from <a href='http://www.diigo.com'>Diigo</a>. The rest of my <a href='http://www.diigo.com/user/danielshorten'>favorite links</a> are here.</p>
]]></content:encoded>
			<wfw:commentRss>http://daniel.shortens.net/bookmarks/update-all-04082009/feed</wfw:commentRss>
		</item>
	</channel>
</rss>
