<?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>michael&#039;s thoughts &#187; tutorial and how to</title>
	<atom:link href="http://www.michaelridley.info//category/tutorial-and-how-to/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.michaelridley.info</link>
	<description></description>
	<lastBuildDate>Sun, 05 Feb 2012 14:59:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Excluding Categories from The Loop with WordPress Template Tags</title>
		<link>http://www.michaelridley.info/2009/01/01/excluding-categories-from-the-loop-with-wordpress-template-tags/</link>
		<comments>http://www.michaelridley.info/2009/01/01/excluding-categories-from-the-loop-with-wordpress-template-tags/#comments</comments>
		<pubDate>Thu, 01 Jan 2009 22:45:30 +0000</pubDate>
		<dc:creator>Michael Ridley</dc:creator>
				<category><![CDATA[tech]]></category>
		<category><![CDATA[tutorial and how to]]></category>
		<category><![CDATA[template tags]]></category>
		<category><![CDATA[theme]]></category>
		<category><![CDATA[twitter tools]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.secretelite.com/michael/?p=484</guid>
		<description><![CDATA[When I redesigned this site&#8217;s WordPress theme, I decided I wanted to show the most two recent posts at the top followed by the next 8 posts with just the title and a link to the post, so that the front page does not scroll forever.  That&#8217;s simple enough to do with the template tag [&#8230;] <a class="more-link" href="http://www.michaelridley.info/2009/01/01/excluding-categories-from-the-loop-with-wordpress-template-tags/">&#8595; Read the rest of this entry...</a>]]></description>
			<content:encoded><![CDATA[<p>When I redesigned this site&#8217;s WordPress theme, I decided I wanted to show the most two recent posts at the top followed by the next 8 posts with just the title and a link to the post, so that the front page does not scroll forever.  That&#8217;s simple enough to do with the template tag <a href="http://codex.wordpress.org/Template_Tags/query_posts">query_posts()</a>, but I ran into an unexpected problem with my initial approach and the <a href="http://alexking.org/projects/wordpress">Twitter Tools</a> plugin.</p>
<p><span id="more-484"></span></p>
<p>Initially I had the code as:</p>
<blockquote>
<pre>&lt;?php query_posts('showposts=8?offset=2'); ?&gt;</pre>
</blockquote>
<p>Simple enough, but I am using the wonderful Twitter Tools plugin to automatically create a daily post with my tweets.  Because I tweet more frequently than I update this blog, the list of older posts was dominated by twitter updates.</p>
<p>I wanted the list to show only actual blog posts, not twitter updates.  So I changed the code to be as follows:</p>
<blockquote>
<pre>&lt;?php query_posts('showposts=8?offset=2?cat=-54'); ?&gt;</pre>
</blockquote>
<p>Category 54 is my twitter category, so this would grab 8 non-twitter updates.  But it turns out, this didn&#8217;t work either.  The problem was that the offset and category filters start from the top, so if my second most recent post was a twitter post it would filter that out, and then offset from 2, which would mean that if the third most recent post was not a twitter update it wouldn&#8217;t show up at all.  Not what I wanted.</p>
<p>So I tried changing the offset to 1, but that doesn&#8217;t work because if the most recent updates are not twitter updates then it will show the second post twice &#8211; once in long form and once in the older posts section.</p>
<p>So I again changed my query_posts() call to look like:</p>
<blockquote>
<pre>&lt;?php query_posts('offset=2'); ?&gt;</pre>
</blockquote>
<p>and then added in some logic in The Loop to manually filter out twitter posts using the <a href="http://codex.wordpress.org/Template_Tags/in_category">in_category()</a> template tag:</p>
<blockquote>
<pre> &lt;?php if ( in_category(54) ) {
} else { ?&gt;
...show the post link...</pre>
</blockquote>
<p>Sadly I lose the ability to keep it at a constant 8 posts, although I could change the code again to grab some large number of posts and keep a counter and manually break from The Loop once I&#8217;ve actually displayed the 8 post links.  But I&#8217;m happy with how it&#8217;s working for now.</p>
<p>Just thought I&#8217;d share this, since it took me a few minutes to find the correct template tags to make this work.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.michaelridley.info/2009/01/01/excluding-categories-from-the-loop-with-wordpress-template-tags/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Using Sync in a Blink with Google Contact Groups</title>
		<link>http://www.michaelridley.info/2008/12/29/using-sync-in-a-blink-with-google-contact-groups/</link>
		<comments>http://www.michaelridley.info/2008/12/29/using-sync-in-a-blink-with-google-contact-groups/#comments</comments>
		<pubDate>Mon, 29 Dec 2008 05:11:44 +0000</pubDate>
		<dc:creator>Michael Ridley</dc:creator>
				<category><![CDATA[iPhone]]></category>
		<category><![CDATA[tech]]></category>
		<category><![CDATA[tutorial and how to]]></category>
		<category><![CDATA[contact groups]]></category>
		<category><![CDATA[contacts]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[ota]]></category>
		<category><![CDATA[sync]]></category>
		<category><![CDATA[sync in a blink]]></category>
		<category><![CDATA[wireless]]></category>

		<guid isPermaLink="false">http://www.secretelite.com/michael/?p=439</guid>
		<description><![CDATA[The latest version of the Sync in a Blink iPhone app supports Google Contact Groups.  This is a wonderful feature addition, as Google adds all correspondents to its &#8220;Suggested Contacts&#8221; group which then sync down to the iPhone which probably isn&#8217;t desirable.  I don&#8217;t really want all the mailing lists and support email addresses I [&#8230;] <a class="more-link" href="http://www.michaelridley.info/2008/12/29/using-sync-in-a-blink-with-google-contact-groups/">&#8595; Read the rest of this entry...</a>]]></description>
			<content:encoded><![CDATA[<p>The latest version of the Sync in a Blink iPhone app supports Google Contact Groups.  This is a wonderful feature addition, as Google adds all correspondents to its &#8220;Suggested Contacts&#8221; group which then sync down to the iPhone which probably isn&#8217;t desirable.  I don&#8217;t really want all the mailing lists and support email addresses I correspond with to show up as contacts on my iPhone.  By creating an &#8220;iPhone Contacts&#8221; group, I can avoid that problem.</p>
<p>Unfortunately, the way contact groups are supported on the iPhone and their interaction with Sync in a Blink is not entirely intuitive.  After configuring Sync in a Blink to only sync the &#8220;iPhone Contacts&#8221; group, I found that newly created contacts on the iPhone were not syncing back to Google.  I initially thought this may be a limitation of the iPhone, but it&#8217;s not.  There is a way to make this work.</p>
<p><span id="more-439"></span>When I added a new contact, I tried editing the contact details to add it into the &#8220;iPhone Contacts&#8221; group, but unfortunately the iPhone contact editor doesn&#8217;t support editing groups.  Hopefully some day it will, but today it doesn&#8217;t.  The key is to create the new contact within the &#8220;iPhone Contacts&#8221; group.</p>
<p>When I clicked on &#8220;Contacts&#8221; from my iPhone home screen, it was defaulting to &#8220;All Contacts&#8221; but if I clicked back to &#8220;Groups&#8221; I could then select &#8220;iPhone Contacts&#8221; and add then add a new contact.  That contact would be added into the &#8220;iPhone Contacts&#8221; group.</p>
<p><img src="http://www.secretelite.com/michael/wp-content/uploads/2008/12/siab_pic_1.jpg" alt="Select the correct Contact Group" /></p>
<p><img src="http://www.secretelite.com/michael/wp-content/uploads/2008/12/siab_pic_2.jpg" alt="The iPhone Contacts Group" /></p>
<p>If you always remember to add new contacts into the correct Contact Group then you&#8217;re done.  Happy syncing.  Unfortunately, I didn&#8217;t figure this out until I already had added several contacts in the &#8220;All Contacts&#8221; group and no easy way to move them over to &#8220;iPhone Contacts&#8221;.  There may be a way to change the Contact Group of an existing contact, but if there is I don&#8217;t know about it.</p>
<p>Instead I found a different workaround.  It&#8217;s slightly clunky but better than not having my contacts sync.  It uses the Merge Contacts feature of Sync in a Blink.</p>
<p>The first step is to create a contact within the &#8220;iPhone Contacts&#8221; group with the same name.  This new contact doesn&#8217;t need to actually have any other contact details, just the name.  Everything else will be merged from the existing contact with Sync in a Blink.  When browsing &#8220;All Contacts&#8221; there will now be two people with the same name, one in &#8220;All Contacts&#8221; and one from &#8220;iPhone Contacts&#8221;.<br />
<img src="http://www.secretelite.com/michael/wp-content/uploads/2008/12/siab_pic_3.jpg" alt="Duplicates of Example2 Person" /></p>
<p>In the above example you can see there are two copies of &#8220;Example2 Person&#8221;.</p>
<p>Now we need to use the Sync in a Blink Merge Contacts feature to sync the &#8220;All Contacts&#8221; version with the &#8220;iPhone Contacts&#8221; version.</p>
<p><img src="http://www.secretelite.com/michael/wp-content/uploads/2008/12/siab_pic_4.jpg" alt="Sync in a Blink Merge Contacts" /></p>
<p><img src="http://www.secretelite.com/michael/wp-content/uploads/2008/12/siab_pic_5.jpg" alt="Select correct contact group" /></p>
<p><img src="http://www.secretelite.com/michael/wp-content/uploads/2008/12/siab_pic_6.jpg" alt="Select iPhone Contacts version of Example2 Person" /></p>
<p>Notice in the above screenshots I have selected the &#8220;iPhone Contacts&#8221; version of &#8220;Example2 Person&#8221; to sync.  This is important!  While I could have selected both from &#8220;All Contacts&#8221;, that will not preserve the fact that the new blank contact is in &#8220;iPhone Contacts&#8221;.  Why?  I don&#8217;t know, but it doesn&#8217;t.  So be sure to select the new dummy contact from within your contact group!</p>
<p>Next we select the original &#8220;Example2 Person&#8221; contact to sync with.</p>
<p><img src="http://www.secretelite.com/michael/wp-content/uploads/2008/12/siab_pic_7.jpg" alt="Merge screen" /></p>
<p><img src="http://www.secretelite.com/michael/wp-content/uploads/2008/12/siab_pic_8.jpg" alt="Select All Contacts version of Example 2" /></p>
<p><img src="http://www.secretelite.com/michael/wp-content/uploads/2008/12/siab_pic_9.jpg" alt="Merge contacts" /></p>
<p><img src="http://www.secretelite.com/michael/wp-content/uploads/2008/12/siab_pic_10.jpg" alt="Merge options" /></p>
<p>Notice in the above screenshot that it shows the &#8220;iPhone Contacts&#8221; Contact Group selected.  If it doesn&#8217;t show that option, a step was missed and this procedure isn&#8217;t working.  Normally there would be phone numbers, email addresses, etc.  In my case I don&#8217;t have that information for my example contact since it&#8217;s not important for showing the procedure.  But when you merge your contacts you should actually see all the contact details.  Make sure that the real data is checked so you don&#8217;t lose any information.</p>
<p>Once everything looks good in the Merge Fields screen, it&#8217;s time to complete the sync.</p>
<p><img src="http://www.secretelite.com/michael/wp-content/uploads/2008/12/siab_pic_11.jpg" alt="Merge preview" /></p>
<p><img src="http://www.secretelite.com/michael/wp-content/uploads/2008/12/siab_pic_12.jpg" alt="Merge confirmation" /></p>
<p>As the screen suggests, it would be a good idea to sync with Google Contacts at this point.  In the sync summary screen you should see that your iPhone contact was added to Google.</p>
<p>While none of this is rocket science, it did have me banging my head against the wall slightly.  So I hope this information will help others avoid my frustration!</p>
<p>It would be nice if a future version of the iPhone software and/or Sync in a Blink would make it easier to directly edit the Contact Group of an existing contact, so that creating a dummy contact and then syncing it would not be necessary.</p>
<p>I also wish there were an easy way to get a delta between the &#8220;All Contacts&#8221; group and my &#8220;iPhone Contacts&#8221; group so I could see exactly who is included in &#8220;All Contacts&#8221; and missing from &#8220;iPhone Contacts&#8221;.  At the moment I have to do this manually, and as I have over 330 contacts in my phone it&#8217;s tedious and error prone.  I still have about 6 more contacts in my &#8220;All Contacts&#8221; group than in my &#8220;iPhone Contacts&#8221; group.  One of these days I&#8217;ll have time to track down the differences.  But not today!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.michaelridley.info/2008/12/29/using-sync-in-a-blink-with-google-contact-groups/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Monitoring WordPress with Nagios</title>
		<link>http://www.michaelridley.info/2008/09/03/monitoring-wordpress-with-nagios/</link>
		<comments>http://www.michaelridley.info/2008/09/03/monitoring-wordpress-with-nagios/#comments</comments>
		<pubDate>Thu, 04 Sep 2008 01:20:35 +0000</pubDate>
		<dc:creator>Michael Ridley</dc:creator>
				<category><![CDATA[tech]]></category>
		<category><![CDATA[tutorial and how to]]></category>

		<guid isPermaLink="false">http://www.secretelite.com/michael/2008/09/03/monitoring-wordpress-with-nagios/</guid>
		<description><![CDATA[I recently set up Nagois to monitor our Dreamhost sites in support of Communications Tool &#38; Die.  I ran into a mysterious problem, however.  When I would set the nagios check_http to point to the blog URL it would always return a status of 301 (permanent redirect) and say everything was OK.  When I updated the [&#8230;] <a class="more-link" href="http://www.michaelridley.info/2008/09/03/monitoring-wordpress-with-nagios/">&#8595; Read the rest of this entry...</a>]]></description>
			<content:encoded><![CDATA[<div>
<p>I recently set up Nagois to monitor our Dreamhost sites in support of <a href="http://www.commtd.com">Communications Tool &amp; Die</a>.  I ran into a mysterious problem, however.  When I would set the nagios check_http to point to the blog URL it would always return a status of 301 (permanent redirect) and say everything was OK.  When I updated the check options to include -f follow it would complain about reaching the maximum number of redirects and bailing out.</p>
<p>After looking into the problem I realized that the issue is that the Apache server is listing the port in the virtual host address in the HTTP header.  For whatever reason, the version of check_http that is bundled in the <a href="http://nagiosplugins.org/">nagios plugins</a> 1.4.12 release can&#8217;t handle that and bombs out.  A bug has already been filed and the version in the subversion repository trunk/ has the patch to fix it.  So the solution was to check out the subversion copy and build my own version of check_http.  This should be fixed in the next bundled release of the nagios plugins package, but if you can&#8217;t wait that long all you have to do is recompile from source.</div>
]]></content:encoded>
			<wfw:commentRss>http://www.michaelridley.info/2008/09/03/monitoring-wordpress-with-nagios/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fix for wp-amazon in WordPress 2.3.1</title>
		<link>http://www.michaelridley.info/2007/11/11/fix-for-wp-amazon-in-wordpress-231/</link>
		<comments>http://www.michaelridley.info/2007/11/11/fix-for-wp-amazon-in-wordpress-231/#comments</comments>
		<pubDate>Sun, 11 Nov 2007 21:20:07 +0000</pubDate>
		<dc:creator>Michael Ridley</dc:creator>
				<category><![CDATA[tech]]></category>
		<category><![CDATA[tutorial and how to]]></category>
		<category><![CDATA[amazon]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.secretelite.com/michael/2007/11/11/fix-for-wp-amazon-in-wordpress-231/</guid>
		<description><![CDATA[I use the excellent wp-amazon WordPress plugin to insert Amazon associate links into this site. Unfortunately the version from the web site hasn&#8217;t been updated in a long time and it doesn&#8217;t work in the newer releases of WordPress. In looking at the support form I found a link to this patch. I followed these [&#8230;] <a class="more-link" href="http://www.michaelridley.info/2007/11/11/fix-for-wp-amazon-in-wordpress-231/">&#8595; Read the rest of this entry...</a>]]></description>
			<content:encoded><![CDATA[<p>I use the excellent <a href="http://manalang.wordpress.com/wp-amazon/">wp-amazon</a> WordPress plugin to insert Amazon associate links into this site.  Unfortunately the version from the web site hasn&#8217;t been updated in a long time and it doesn&#8217;t work in the newer releases of WordPress.  In looking at the <a href="http://groups.google.com/group/wp-amazon/">support form</a> I found a link to <a href="http://www.gnifty.net/code/wp-amazon/">this patch</a>.</p>
<p>I followed these instructions and lo and behold it worked.  Posted as a public service to other WordPress users.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.michaelridley.info/2007/11/11/fix-for-wp-amazon-in-wordpress-231/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

