<?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:georss="http://www.georss.org/georss" 
	xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule"
>

<channel>
	<title>bioneural.net &#187; howto</title>
	<atom:link href="http://www.bioneural.net/tag/howto/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.bioneural.net</link>
	<description>bioneural.net is for stuff worth sharing: commentary by Bruce McKenzie. Major topics covered are gadgets, informatics, Internet, Mac, mobile, musings, New Zealand, photography, Project Koru, quicklinks, rant, rave, travel and Windows</description>
	<pubDate>Thu, 08 May 2008 19:36:56 +0000</pubDate>
	
	<language>en</language>
	<image>
		<title>bioneural.net</title>
		<url>http://www.bioneural.net/images/kiwi-yellow-64px.png</url>
		<link>http://www.bioneural.net</link>
		<width>64</width>
		<height>64</height>
		<description>bioneural.net</description>
	</image>
		<item>
		<title>Using faux Contacts for GTD on the iPhone</title>
		<link>http://www.bioneural.net/feeder/?FeederAction=clicked&amp;feed=Articles+%28RSS2%29&amp;seed=http%3A%2F%2Fwww.bioneural.net%2F2008%2F04%2F24%2Fusing-faux-contacts-for-gtd-on-the-iphone%2F&amp;seed_title=Using+faux+Contacts+for+GTD+on+the+iPhone</link>
		<comments>http://www.bioneural.net/feeder/?FeederAction=clicked&amp;feed=Articles+%28RSS2%29&amp;seed=http%3A%2F%2Fwww.bioneural.net%2F2008%2F04%2F24%2Fusing-faux-contacts-for-gtd-on-the-iphone%2F&amp;seed_title=Using+faux+Contacts+for+GTD+on+the+iPhone#comments</comments>
		<pubDate>Thu, 24 Apr 2008 16:16:28 +0000</pubDate>
		<dc:creator>Bruce</dc:creator>
		
		<category><![CDATA[Mobile]]></category>

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

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

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

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

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

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

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

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

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

		<guid isPermaLink="false">http://www.bioneural.net/?p=942</guid>
		<description><![CDATA[<p><a href="http://creativecommons.org/licenses/by-nc-sa/2.5/" rel="license" title="This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 2.5 License"><img src="http://www.bioneural.net/wp-content/themes/k2bn/styles/bioneural/cc.png" alt="CC" /></a> From <a href="http://www.bioneural.net/about/terms/">bioneural.net</a>:</p><p>Despite strong indications of an imminent second generation 3G <a href="http://www.apple.com/iphone/" rel="external">iPhone</a>, the recent &pound;100 price drop on the 8GB iPhone proved too tempting. I had hesitated because the iPhone failed to meet my minimum <a href="http://www.bioneural.net/2007/06/29/mac-friendly-alternatives-to-apples-1g-iphone/">requirements</a> for basic PDA functionality. With <a href="http://1password.com/" rel="external">1Password</a> mostly overcoming the secure data exchange obstacle, the remaining challenge was to find a network-independent way of managing and synchronising tasks ("to do" items). I've also been wading through David Allen's <a href="http://astore.amazon.co.uk/bioneuralnet-21/detail/0749922648/" rel="external">book</a> <em>Getting Things Done</em> in a search for ways to improve my personal productivity. Could I cherry-pick the key principles of the GTD religion and apply them on the iPhone using only the built-in apps?<br />
<span id="more-942"></span></p>
<h4>The essence of GTD</h4>
<p>The <a href="http://omnigroup.com/ftp2/pub/software/MacOSX/movies/OmniFocus/omnifocus_basics_medium.mov" rel="external">OmniFocus Basics Video</a> does a good job of distilling the core ideas in the GTD method. It outlines three concepts:</p>
<ol>
<li><strong>Actions</strong> are something you can physically do in a single step;</li>
<li><strong>Projects</strong> are activities that require more than one physical action to complete;</li>
<li><strong>Contexts</strong> are physical requirements for carrying out actions (e.g. being at work, at home, connected to the Internet, etc.)</li>
</ol>
<p>The video also summarizes three workflow steps to getting things done:</p>
<ol>
<li><strong>Capture</strong> all outstanding individual ("atomic") actions;</li>
<li><strong>Organize</strong> those actions by grouping them into projects and/ or context;</li>
<li><strong>Do</strong> the outstanding actions.</li>
</ol>
<p>Let's put that graphically (adding horizontal reorganization as part of ongoing review):</p>
<p><img src="http://www.bioneural.net/wp-content/uploads/2008/04/bioneural-gtd-essentials.jpg" width="419" height="287" alt="bioneural-gtd-essentials.jpg" /></p>
<p class="info">I'm not being strict about contexts being a physical place, person or thing: in my world a context can be a frame of mind, or an area of mental focus&mdash;whatever makes sense for grouping related actions.</p>
<h4>The wrong tool for the job?</h4>
<p>The iPhone is most certainly not ready for GTD out-of-the-box, and not everyone is comfortable relying on network access for <a href="http://www.apple.com/webapps/" rel="external">Web apps</a> solutions. This situation will soon be relieved as both <a href="http://www.omnigroup.com/applications/omnifocus/" rel="external">OmniFocus</a> and <a href="http://www.culturedcode.com/things/" rel="external">Things</a>&mdash;fine-looking desktop GTD apps&mdash;are promising iPhone-native companion apps in due course. Apple is typically silent on whether or not iCal/ Mail tasks will ever sync to iPhone without third party involvement.</p>
<p>Prior to iPhone I had been using a Palm to manage my contacts, events, tasks, and notes (paired with the ever unreliable <a href="http://www.markspace.com/" rel="external">Missing Sync</a>). Unfortunately here's where Apple's usually seamless integration falls down&mdash;two Apple products, Mac and iPhone, are less communicative that Mac plus Palm:</p>
<p><img src="http://www.bioneural.net/wp-content/uploads/2008/04/bioneural-iphone-sync.jpg" width="344" height="243" alt="bioneural-iphone-sync.jpg" /></p>
<p>The Notes app on iPhone is useless with no desktop synch, although third party <a href="http://www.ecamm.com/mac/megaphone/" rel="external">solutions</a> <a href="http://www.markspace.com/missingsync_iphone.php" rel="external">do</a> <a href="http://www.v1ru8.net/iphonenotes/" rel="external">exist</a>. Otherwise moving bidirectional data between Mac and iPhone (while avoiding "online" web or mail server connectivity) means relying on either iCal or Address Book for data entry on the Mac side.</p>
<p>Luckily both events and contacts on iPhone have notes fields, and these can be <a href="http://iphone.macworld.com/2007/07/syncing_notes_with_the_iphone.php" rel="external">used</a> to sync with data entered via iCal or Address Book on your Mac. On the Palm attached notes were helpfully identified with a little yellow icon. Such identification is lacking in iCal and in iPhone's calendar, so attached notes could easily be overlooked. Thus whenever I enter something into the notes field I make use of <a href="http://www.bioneural.net/2005/02/26/an-ical-tip-for-hidden-notes/">this</a> tip I shared 3 years ago to "unhide" that fact that there are notes attached. It also happens to be in keeping with the iPhone interface ;-)</p>
<p class="alert">There is a limit as to how much text notes fields can contain; long lists entered on your Mac may be truncated on iPhone.</p>
<h4>Separation anxiety</h4>
<p>There are broadly three types of activities to keep track of in any attempt to "get organized". There are things that need doing (e.g. "Wash the car"), things that need doing on a specific date (e.g. "Pick up dry cleaning"), and things that need doing at a specific time (e.g. keeping an appointment). I was in the habit of using both events and tasks in iCal to track actions with a due date. The fact that I can't actually describe the process by which I assigned an action to an all-day event in iCal's calendar, or alternatively to a "due date" task in iCal's to do list, is quite telling in itself.</p>
<p>A change in my practice is therefore the clear separation between undated tasks and those that fall due on a specific day. We can then apply some simple rules:</p>
<ul>
<li>Anything that must occur on a particular day at a particular time becomes a <strong>calendar <em>appointment</em></strong>;</li>
<li>Anything that must occur on a particular day becomes an all-day <strong>calendar <em>event</em></strong>;</li>
<li>Anything that must occur but is unscheduled becomes a <strong>task list <em>action</em></strong>.</li>
</ul>
<p class="info">Colour coding calendars in iCal to represent contexts is useful on the Mac; Palm preserved these as categories. Sadly all synched calendars are merged on iPhone so schedules are impossible to differentiate. Palm also indicated repeating events and connected multi-day events in month view: iPhone doesn't.</p>
<h4>Faking it</h4>
<p>Both appointments and all-day events sync both ways between iCal on the Mac and Calendar on iPhone just fine. As we all know, tasks are a different story. The system I am currently employing uses Address Book to bring tasks to the Phone app on iPhone (or Contacts on the iPod Touch) based on a few simple rules:</p>
<ul>
<li>A Group in Address Book operates like a list in Phone;</li>
<li>A list is prefixed with # (e.g. projects) unless it is a context, when @ is used;</li>
<li>The Contact field for Company Name is used as the title of an action;</li>
<li>The Contact field for notes is used for notes relating to an action;</li>
<li>An uncompleted action is prefixed with * (not unlike a list item bullet);</li>
<li>A completed action is prefixed with - to indicate readiness for deletion;</li>
<li>An action with associated notes is suffixed with &gt; to aid identification;</li>
<li>Smart Groups in Address Book are used to help collate actions.</li>
</ul>
<p class="info">Keep in mind that what I describe here is only part of the GTD workflow.</p>
<p>Here's how it all looks put together in Address Book:</p>
<p><span class="zoom">Click thumbnail to enlarge image</span><br /><a href="http://www.bioneural.net/images/enlarge/bioneural-ab-gtd-large.jpg" rel="ibox" title="Actions as faux Contacts grouped in Address Book"><img src="http://www.bioneural.net/wp-content/uploads/2008/04/bioneural-ab-gtd-thumb.jpg" width="200" height="96" alt="Actions as faux Contacts grouped in Address Book" /></a><br /><span class="caption">Actions as faux Contacts grouped in Address Book</span></p>
<p>This group-based structure is mirrored on iPhone:</p>
<p><img src="http://www.bioneural.net/wp-content/uploads/2008/04/bioneural-iphone-groups.jpg" width="174" height="225" alt="bioneural-iphone-groups.jpg" /></p>
<p>It's best to show how this works by looking at some examples.</p>
<h4>Collecting/ capturing actions</h4>
<p>The group <strong>#Collect</strong> acts as a container for capturing new actions as they are "brain dumped". Via the + button in either Address Book (Mac) or Phone (iPhone) a new action can be created within this group (with the * prefix in the Company field):</p>
<p><img src="http://www.bioneural.net/wp-content/uploads/2008/04/bioneural-collect.jpg" width="175" height="225" alt="bioneural-collect.jpg" /></p>
<h4>Organizing actions</h4>
<p>The idea is to move actions out of the #Collect list and into project or context lists where appropriate. GTD purists will likely tell you to keep your inbox empty (and here #Collect is fulfilling the inbox function). But I fail to see the point of moving actions into a new container just to keep another empty, so my #Collect serves as both inbox and "catch-all" for actions that don't fit elsewhere.</p>
<p>Some actions are not for doing here and now; I used to keep these on what I called a "rainy day" list; in GTD-speak they get grouped under the <strong>#Someday</strong> list:</p>
<p><img src="http://www.bioneural.net/wp-content/uploads/2008/04/bioneural-someday.jpg" width="173" height="225" alt="bioneural-someday.jpg" /></p>
<p>Most actions, however, will have a clear context or be part of a multi-step project. Project lists and context lists are not mutually exclusive: actions can appear under either, both, or neither. For example, sanding the dinning table and chairs is part of the #Restore dining set project, but also falls under the broader context of things to do at home, @Home:</p>
<p><img src="http://www.bioneural.net/wp-content/uploads/2008/04/bioneural-context.jpg" width="175" height="225" alt="bioneural-context.jpg" /></p>
<p>Some future actions have current dependencies. Years ago working as house surgeon I kept a daily "Chase list" in the back of a pocket notebook in my coat; things I had to do before continuing (or often formulating) a subsequent plan. For example, I might be waiting for Mrs A's chest x-ray report before deciding whether to write her up for take-home antibiotics and completing her discharge summary. I couldn't <em>do</em> the latter until I was no longer <em>waiting</em> for the former. The GTD equivalent of my chase list is <strong>#Waiting</strong>&mdash;not things I'm personally doing, but that I have an interest in nevertheless:</p>
<p><img src="http://www.bioneural.net/wp-content/uploads/2008/04/bioneural-waiting.jpg" width="175" height="225" alt="bioneural-waiting.jpg" /></p>
<p class="info">Slight dilemma: Should everything I'm waiting on have a due by date? If so, perhaps it should be scheduled in the calendar instead of on an undated task list e.g. "Loaned DVD to B" Have I got it back by end April?</p>
<p>As a Palm/ iCal to do user I sometimes used priority to indicate those things which needed doing sooner than others (1-5, high through low). Priority has its uses, but it's not always that helpful in deciding where to start. If an action belongs to a project I will add 01, 02, 03 etc. after the * prefix. This identifies the <em>sequence</em> of actions needed to progress a project, giving me a clear beginning (the lack of which is often an obstacle to undertaking something amorphous):</p>
<p><img src="http://www.bioneural.net/wp-content/uploads/2008/04/bioneural-project.jpg" width="175" height="225" alt="bioneural-project.jpg" /></p>
<p>Smart Groups don't make it over to the iPhone, and it's too unreliable to manually add every action to both a context and #All actions group/ list. So I use a Smart Group in Address Book to collect them, and from there drag to the <strong>#All actions</strong> group&mdash;which is there only for the sake of collating actions on the iPhone:</p>
<p><img src="http://www.bioneural.net/wp-content/uploads/2008/04/bioneural-all-mac.jpg" width="450" height="117" alt="bioneural-all-mac.jpg" /></p>
<p><img src="http://www.bioneural.net/wp-content/uploads/2008/04/bioneural-all-actions1.jpg" width="176" height="225" alt="bioneural-all-actions.jpg" /></p>
<p>All actions can't be next simultaneously, not even when undertaken by multitasking die-hards. Hence I created a Smart Group to collate all project actions that are "01" in the completion sequence as <strong>#Next actions</strong>. This gives me a quick way to see what I ought to be getting on with when reviewing my progress on the Mac:</p>
<p><img src="http://www.bioneural.net/wp-content/uploads/2008/04/bioneural-next-mac.jpg" width="450" height="118" alt="bioneural-next-mac.jpg" /></p>
<h4>Doing actions</h4>
<p>Some actions might be deleted immediately as they are completed, but at times it can be useful to keep reminders around for a little longer (until completion of an entire project, say). In this case I change * to - when an action is completed:</p>
<p><img src="http://www.bioneural.net/wp-content/uploads/2008/04/bioneural-done.jpg" width="177" height="225" alt="bioneural-done.jpg" /></p>
<h4>Is it worthwhile?</h4>
<p>This won't be for everyone. For some people a piece of paper with a half-dozen items on a single list will be all they genuinely need. Other folk have their fingers in many pies and it can be more challenging to honour every commitment, to follow up every loose end, and to make inroads into a tangle of multi-step projects competing for your limited attention. Personally I'm not convinced I need this&mdash;at least not <em>now</em>. But when I start on a PhD later this year and as other concurrent projects come to fruition, things could get ugly. Now seems like the right time to learn a highly structured system while under less pressure so that using it becomes a subconscious effort when the pressure is being applied. In the more immediate term I hope that by being forced to itemise project actions and order them into meaningful sequences, I hope to procrastinate less and see my projects for what they are: doable, in bite-sized chunks.</p>
<p>I do hope (and expect) a more streamlined solution will emerge with Firmware 2.0 post-SDK. But that's still at least couple of months away, and meantime I've got things to get done.</p>
<img src="http://www.bioneural.net/ff309e51/26673f11/CCBot/1.0 (+http://www.commoncrawl.org/bot.html).gif" />]]></description>
		<wfw:commentRss>http://www.bioneural.net/feeder/?FeederAction=clicked&amp;feed=Articles+%28RSS2%29&amp;seed=http%3A%2F%2Fwww.bioneural.net%2F2008%2F04%2F24%2Fusing-faux-contacts-for-gtd-on-the-iphone%2F&amp;seed_title=Using+faux+Contacts+for+GTD+on+the+iPhone/feed/</wfw:commentRss>
<enclosure url="http://omnigroup.com/ftp2/pub/software/MacOSX/movies/OmniFocus/omnifocus_basics_medium.mov" length="12125974" type="video/quicktime" />
		<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/2.5/</creativeCommons:license>
	</item>
		<item>
		<title>Customizing WordPress feed content</title>
		<link>http://www.bioneural.net/feeder/?FeederAction=clicked&amp;feed=Articles+%28RSS2%29&amp;seed=http%3A%2F%2Fwww.bioneural.net%2F2008%2F04%2F13%2Fcustomizing-wordpress-feed-content%2F&amp;seed_title=Customizing+WordPress+feed+content</link>
		<comments>http://www.bioneural.net/feeder/?FeederAction=clicked&amp;feed=Articles+%28RSS2%29&amp;seed=http%3A%2F%2Fwww.bioneural.net%2F2008%2F04%2F13%2Fcustomizing-wordpress-feed-content%2F&amp;seed_title=Customizing+WordPress+feed+content#comments</comments>
		<pubDate>Sun, 13 Apr 2008 20:38:12 +0000</pubDate>
		<dc:creator>Bruce</dc:creator>
		
		<category><![CDATA[Internet]]></category>

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

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

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

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

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

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

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

		<guid isPermaLink="false">http://www.bioneural.net/?p=920</guid>
		<description><![CDATA[<p><a href="http://creativecommons.org/licenses/by-nc-sa/2.5/" rel="license" title="This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 2.5 License"><img src="http://www.bioneural.net/wp-content/themes/k2bn/styles/bioneural/cc.png" alt="CC" /></a> From <a href="http://www.bioneural.net/about/terms/">bioneural.net</a>:</p><p>When I last <a href="http://www.bioneural.net/2006/07/20/customizing-feeds-in-wordpress-2x/">looked</a> at customizing feeds in WordPress, it was all to do with being able to offer a summary and full text feed simultaneously&mdash;making use of WordPress' flexible feed URL syntax and a .htaccess file. In this post I look at modifying the actual contents of the feed using a <a href="http://codex.wordpress.org/Theme_Development#Functions_File" rel="external">functions.php</a> file (which may already exist as part of your current theme).<br />
<span id="more-920"></span></p>
<p>Just as WordPress provides a number of hooks for adding or removing actions in your theme header (see <a href="http://www.bioneural.net/2008/01/12/spring-clean-your-wordpress-head/">here</a>), so to do the core files that generate your feeds. Editing the core files is however discouraged (it makes upgrading a pain), and although you can build your own replacement feed templates an easy alternative is adding a few lines to your theme's functions.php file.</p>
<p class="alert">As a perpetual PHP beginner I feel obliged to warn you that use of the following code is at your own risk.</p>
<p>If there are any PHP/ WordPress experts reading this who can improve on my code please make yourself known ;-)</p>
<h4>Removing WP version info</h4>
<p>Somewhere, a while back, I read a tip about not including the WordPress version you are running in your template header&mdash;potentially allowing hackers to identify you as a target if you haven't kept up-to-date. It's easy to remove if present. For example, in the <a href="http://getk2.com/" rel="external">K2</a> theme just delete the following line from header.php:</p>
<pre><code>&lt;meta name="generator" content="WordPress &lt;?php bloginfo('version'); ?&gt;" /&gt;</code></pre>
<p>I recently released that version information was still being sent out in my feed. The feed XML contained a line like this:</p>
<pre><code>&lt;generator&gt;http://wordpress.org/?v=2.x&lt;/generator&gt;</code></pre>
<p>Thanks to Peter Westwood's helpful <a href="http://blog.ftwr.co.uk/archives/2007/10/06/improving-the-wordpress-generator/" rel="external">post</a> I used my theme's functions.php file to remove this with the following code:</p>
<pre><code>//Remove WP version info
function hide_wp_vers() { return ''; }
add_filter('the_generator','hide_wp_vers');</code></pre>
<p>So wherever <code>the_generator</code> function is called (such as in the feed templates in /wp-includes) it gets replaced with... nothing. Job done.</p>
<h4>Adding a feed image</h4>
<p>A feed image (e.g. your site logo or avatar) is an <a href="http://www.rssboard.org/rss-specification#ltimagegtSubelementOfLtchannelgt" rel="external">optional</a> part of the RSS 2.0 spec and shows up in some feed readers along with the feed description. There are plenty of tutorials (search Google) that tell you how to add a feed image by editing core template files, and there are plugins that will add one for you. I had previously edited my core RSS 2.0 template, and lost the changes during upgrades more than once. To avoid this in future here's what's now in my functions.php file:</p>
<pre><code>//Add a feed image
function feed_image() { echo "&lt;image&gt;\n\t\t&lt;title&gt;bioneural.net&lt;/title&gt;\n\t\t&lt;url&gt;http://www.bioneural.net/images/kiwi-yellow-64px.png&lt;/url&gt;\n\t\t&lt;link&gt;http://www.bioneural.net&lt;/link&gt;\n\t\t&lt;width&gt;64&lt;/width&gt;\n\t\t&lt;height&gt;64&lt;/height&gt;\n\t\t&lt;description&gt;bioneural.net&lt;/description&gt;\n\t&lt;/image&gt;\n"; }
add_action('rss2_head', 'feed_image');</code></pre>
<p>Having created my <code>feed_image</code> function I use <code>add_action</code> (<a href="http://codex.wordpress.org/Function_Reference/add_action" rel="external">Codex</a>) to insert my function via the <code>rss2_head</code> hook (<a href="http://codex.wordpress.org/Plugin_API/Action_Reference#Feed_Actions" rel="external">Codex</a>).</p>
<p>Note that <code>\n</code> means new line, <code>\t</code> means tab, and <code>\r</code> (not shown) carriage return: these are just for the sake of formatting. They have no function other than making the feed XML&mdash;which you will likely never see&mdash;look more organized:</p>
<pre><code>&lt;image&gt;
	&lt;title&gt;bioneural.net&lt;/title&gt;
	&lt;url&gt;http://www.bioneural.net/images/kiwi-yellow-64px.png&lt;/url&gt;
	&lt;link&gt;http://www.bioneural.net&lt;/link&gt;
	&lt;width&gt;64&lt;/width&gt;
	&lt;height&gt;64&lt;/height&gt;
	&lt;description&gt;bioneural.net&lt;/description&gt;
&lt;/image&gt;</code>
</pre>
<p>Here's how the above renders when viewed in <a href="http://www.bloglines.com" rel="external">Bloglines</a>:</p>
<p><img src="http://www.bioneural.net/wp-content/uploads/2008/04/bloglines.jpg" width="295" height="89" alt="bloglines.jpg" /></p>
<p class="info"><em>Tip</em>: If you want to add a feed image but don't want to do it via a plugin or functions.php, you can use <em>Feed Image Burner</em> from <a href="http://www.feedburner.com" rel="external">FeedBurner</a>.</p>
<h4>Adding a content license</h4>
<p>I've noticed a rise in my content appearing on <a href="http://en.wikipedia.org/wiki/Spam_blog" rel="external">splogs</a>, usually in the form "[Some random name] wrote an interesting post today: here is an excerpt". This violates the <a href="http://creativecommons.org/" rel="external">Creative Commons</a> licensing of my content, which <a href="http://creativecommons.org/licenses/by-nc-sa/2.5/" rel="external">requires</a> correct attribution. In a similar vein I've noticed some of my images turning up on "all rights reserved" sites with no attribution. While some folk are no doubt just ignorant, the sploggers are simply morons who don't give a damn. I can't do much about the latter (although I'm giving <a href="http://redalt.com/Resources/Plugins/AntiLeech" rel="external">AntiLeech</a> a spin) but it did get me wondering what I can do to improve the visibility of my licensing terms for the benefit of those "unaware".</p>
<p>The Creative Commons Wiki <a href="http://wiki.creativecommons.org/Syndication" rel="external">links</a> to an RSS 2.0 module for annotating feeds. While this may be machine-parsable I've yet to come across a feed reader that actually picks up on it. As well as incorporating this extension I wanted to add a human-readable annotation to each feed item. This one took a bit of figuring out:</p>
<pre><code>//Add CC license to namespace, item, inline img link within description
function add_license_ns() { echo "\n\t" . 'xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule"' . "\n"; }
add_action('rss2_ns', 'add_license_ns');
function add_license_item() { echo "\t" . '&lt;creativeCommons:license&gt;http://creativecommons.org/licenses/by-nc-sa/2.5/&lt;/creativeCommons:license&gt;' . "\n"; }
add_action('rss2_item', 'add_license_item');
function add_license_img($join) {
	$join = _e('&lt;p&gt;&lt;a href="http://creativecommons.org/licenses/by-nc-sa/2.5/" rel="license" title="This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 2.5 License"&gt;&lt;img src="http://www.bioneural.net/wp-content/themes/k2bn/styles/bioneural/cc.png" alt="CC" /&gt;&lt;/a&gt; From &lt;a href="http://www.bioneural.net/about/terms/"&gt;bioneural.net&lt;/a&gt;:&lt;/p&gt;') . the_content();
	return $join;
}
add_filter('the_excerpt_rss','add_license_img');</code></pre>
<p>The first function writes the required namespace declaration; <code>add_action</code> then adds this via the <code>rss2_ns</code> hook (<a href="http://codex.wordpress.org/Plugin_API/Action_Reference#Feed_Actions" rel="external">Codex</a>). The next function/ action pair writes the module to each feed item using rss2_item (<a href="http://codex.wordpress.org/Plugin_API/Action_Reference#Feed_Actions" rel="external">Codex</a>). The third part is the human-readable bit: writing the image, text, and links and concatenating these with <code>the_content()</code> (<a href="http://codex.wordpress.org/Template_Tags/the_content" rel="external">Codex</a>) to replace <code>the_excerpt_rss()</code> (<a href="http://codex.wordpress.org/Template_Tags/the_excerpt_rss" rel="external">Codex</a>). Note also the use of the <a href="http://microformats.org/wiki/rel-license" rel="external">rel-license</a> microformat.</p>
<p class="info">For this to work you must set your <em>Reading Settings</em> in WordPress to <em>Summary</em>, even though we will be displaying the full text (replacing <code>the_excerpt_rss()</code> with <code>the_content()</code>).</p>
<p>The XML will look like this (edited for clarity):</p>
<pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;rss version="2.0"
	...
	xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule"
&gt;

&lt;channel&gt;
	...
		&lt;item&gt;
		&lt;title&gt;Web developer widgets&lt;/title&gt;
		...
		&lt;description&gt;&lt;![CDATA[&lt;p&gt;&lt;a href="http://creativecommons.org/licenses/by-nc-sa/2.5/" rel="license" title="This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 2.5 License"&gt;&lt;img src="http://www.bioneural.net/wp-content/themes/k2bn/styles/bioneural/cc.png" alt="CC" /&gt;&lt;/a&gt; From &lt;a href="http://www.bioneural.net/about/terms/"&gt;bioneural.net&lt;/a&gt;:&lt;/p&gt;&lt;p&gt;Mac-based web developers...&lt;/p&gt;]]&gt;&lt;/description&gt;
		...
		&lt;creativeCommons:license&gt;http://creativecommons.org/licenses/by-nc-sa/2.5/&lt;/creativeCommons:license&gt;
		&lt;/item&gt;</code></pre>
<p>Rendered in a feed reader humans will see this:</p>
<p><img src="http://www.bioneural.net/wp-content/uploads/2008/04/reader.jpg" width="295" height="143" alt="reader.jpg" /></p>
<p>The Creative Commons icon is hopefully recognisable and links to the correct license; the link to bioneural.net links to <a href="http://www.bioneural.net/about/terms/">additional</a> terms of use.</p>
<p class="info"><em>Tip</em>: If you prefer not to have full text feeds containing HTML tags, you could use <code>the_content_rss('', '', '', 250)</code> (<a href="http://codex.wordpress.org/Template_Tags/the_content_rss" rel="external">Codex</a>) in place of <code>the_content()</code> to produce a 250 word text-only teaser.</p>
<h4>Expanding the feed description</h4>
<p>The text of the feed description is ordinarily the same text that appears as the tagline for your blog (set in <em>General Settings</em>). You might want to keep it short in your blog header, but perhaps send a more informative version out with your feed. </p>
<p>In K2 at least the description is only used in the head:</p>
<pre><code>&lt;meta name="description" content="&lt;?php bloginfo('description'); ?&gt;" /&gt;</code></pre>
<p>and header:</p>
<pre><code>&lt;p class="description"&gt;&lt;?php bloginfo('description'); ?&gt;&lt;/p&gt;</code></pre>
<p>One solution is therefore to replace the PHP call with short fixed text descriptions (e.g. "stuff worth sharing") in your theme template (header.php) and make the description/ tagline in WP <em>General Settings</em> longer, so it gets into your feed e.g.:</p>
<pre><code>&lt;description&gt;bioneural.net is for stuff worth sharing: commentary by Bruce McKenzie. Major topics covered are gadgets, informatics, Internet, Mac, mobile, musings, New Zealand, photography, Project Koru, quicklinks, rant, rave, travel and Windows&lt;/description&gt;</code></pre>
<p>I was unable to successfully utilize <code>rss2_head</code> (<a href="http://codex.wordpress.org/Plugin_API/Action_Reference#Feed_Actions" rel="external">Codex</a>) in a way that avoided duplicate descriptions.</p>
<p class="info"><em>Tip</em>: Another way to add a more detailed description to your feed only is to use <em>Title/Description Burner</em> from <a href="http://www.feedburner.com" rel="external">FeedBurner</a>.</p>
<h4>Adding a category image</h4>
<p>I previously used the now neglected <a href="http://coffee2code.com/archives/2004/06/27/plugin-category-images/" rel="external">Category Image(s)</a> plugin to send out a category icon with each feed item, replicating their use on my blog to readily identify Mac-related posts, etc. All I needed to do was replace the default item description with this:</p>
<pre><code>&lt;description&gt;&lt;![CDATA[&lt;?php c2c_the_category_image(); ?&gt;&lt;br /&gt;&lt;br /&gt;&lt;?php the_excerpt_rss() ?&gt;]]&gt;&lt;/description&gt;</code></pre>
<p>Sadly such a trick doesn't work with the <a href="http://wordpress.org/extend/plugins/category-icons/" rel="external">Category Icons</a> plugin I am now using, but I've been in touch with the plugin author and submitted this as a feature request.</p>
<img src="http://www.bioneural.net/ff309e51/26673f11/CCBot/1.0 (+http://www.commoncrawl.org/bot.html).gif" />]]></description>
		<wfw:commentRss>http://www.bioneural.net/feeder/?FeederAction=clicked&amp;feed=Articles+%28RSS2%29&amp;seed=http%3A%2F%2Fwww.bioneural.net%2F2008%2F04%2F13%2Fcustomizing-wordpress-feed-content%2F&amp;seed_title=Customizing+WordPress+feed+content/feed/</wfw:commentRss>
		<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/2.5/</creativeCommons:license>
	</item>
		<item>
		<title>How to safely inject CSS3 using jQuery</title>
		<link>http://www.bioneural.net/feeder/?FeederAction=clicked&amp;feed=Articles+%28RSS2%29&amp;seed=http%3A%2F%2Fwww.bioneural.net%2F2008%2F02%2F14%2Fhow-to-safely-inject-css3-using-jquery%2F&amp;seed_title=How+to+safely+inject+CSS3+using+jQuery</link>
		<comments>http://www.bioneural.net/feeder/?FeederAction=clicked&amp;feed=Articles+%28RSS2%29&amp;seed=http%3A%2F%2Fwww.bioneural.net%2F2008%2F02%2F14%2Fhow-to-safely-inject-css3-using-jquery%2F&amp;seed_title=How+to+safely+inject+CSS3+using+jQuery#comments</comments>
		<pubDate>Thu, 14 Feb 2008 14:14:56 +0000</pubDate>
		<dc:creator>Bruce</dc:creator>
		
		<category><![CDATA[Internet]]></category>

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

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

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

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

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

		<guid isPermaLink="false">http://www.bioneural.net/2008/02/14/how-to-safely-inject-css3-using-jquery/</guid>
		<description><![CDATA[<p><a href="http://creativecommons.org/licenses/by-nc-sa/2.5/" rel="license" title="This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 2.5 License"><img src="http://www.bioneural.net/wp-content/themes/k2bn/styles/bioneural/cc.png" alt="CC" /></a> From <a href="http://www.bioneural.net/about/terms/">bioneural.net</a>:</p><p>So you fancy using some of that &uuml;ber-cool draft CSS3 that <a href="http://webkit.org/" rel="external">WebKit</a> browsers can handle, such as text shadows, drop shadows, opacity and rounded corners? But at the same time you want to present only valid CSS to the W3C CSS <a href="http://jigsaw.w3.org/css-validator/" rel="external">Validator</a>? It's a dilemma, but it is possible to have your cake and eat it too&mdash;albeit by hiding CSS in JavaScript and thus cheating the Validator. However, there is even a precedent for doing so.<br />
<span id="more-829"></span></p>
<p>During the course of researching my review of the <a href="http://www.bioneural.net/2008/02/06/the-best-way-to-do-corners-and-gradients/">various</a> <a href="http://www.bioneural.net/2008/02/13/corners-gradients-and-shadows-with-jquery/">ways</a> to make rounded corners, drop shadows, and gradients I learned more about <a href="http://www.w3.org/TR/css3-roadmap/" rel="external">CSS3</a> and the <a href="http://jquery.com/" rel="external">jQuery</a> JavaScript library. They just needed introducing to one another.</p>
<p><img src="http://www.bioneural.net/wp-content/uploads/2008/02/effects.jpg" width="450" height="376" alt="effects.jpg"/><br /><span class="caption">Text shadows, drop shadows, and round corners in Safari 3</span></p>
<h4>A historical precedent</h4>
<p>The concept of tricking the Validator to pass CSS that is incorrectly implemented or proprietary and not part of the W3C spec is not new. Many web developers have found it necessary to employ various hacks in their CSS to accommodate differences in the way browsers interpret the rules. Others have used proprietary code to overcome limitations or quirks in the way some browsers handle certain content. For example, the following in your document head could be used to fix IE6's lack of handling for transparent PNGs and mis-handling of the box model, floats, overflow, <a href="http://www.bioneural.net/2008/02/01/ie6-italics-and-overflow-issues/">italics</a>, etc.:</p>
<pre><code>&lt;!--[if lte IE 6]&gt;
	&lt;style type="text/css"&gt;
	#pnglogo {filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled='true',src='../logo-trans.png'); padding-top: 57px; }
	&lt;/style&gt;
	&lt;link rel="stylesheet" type="text/css" media="screen" href="../ie6-patches.css" /&gt;
&lt;![endif]--&gt;</code></pre>
<p>It's a hack: there's no other term for it. In the above example we're using proprietary conditional comments and filters to fix proprietary cock-ups. Seems fair, doesn't it?</p>
<p>So, if we can hack our way to supporting inferior or out-dated browsers, why should we not also employ hacks to support leading-edge browsers like Safari 3 that are already capable of rendering much of that draft CSS3 goodness? </p>
<h4>Using jQuery's CSS injector</h4>
<p>There are probably multiple JavaScripts that let you load CSS via the <a href="http://www.w3.org/DOM/" rel="external">DOM</a>, but since I'm using jQuery anyway that's how I've chosen to do it. If you don't have jQuery installed go <a href="http://docs.jquery.com/Downloading_jQuery" rel="external">get</a> it and load it in your document head e.g.:</p>
<pre><code>&lt;script type="text/javascript" src="../jquery-1.2.3.pack.js"&gt;&lt;/script&gt;</code></pre>
<p>Below this we create a <code>$(document).ready()</code> <a href="http://docs.jquery.com/Events/ready#fn" rel="external">function</a> so that the contents load via the DOM and hopefully before the page content is displayed. Inside this function our "content" consists of a series of CSS <a href="http://docs.jquery.com/Selectors" rel="external">selectors</a> (inside the first bracket) paired with the CSS properties we wish to inject (name and value, comma-separated) joined via <a href="http://docs.jquery.com/CSS/css#namevalue" rel="external">.css</a>. Example:</p>
<pre><code>&lt;!-- Have jQuery inject WebKit CSS via DOM on selected elements --&gt;
&lt;script type="text/javascript"&gt;
	$(document).ready(function(){
	$("h1").css("text-shadow","black 0.2em 0.3em 0.2em");
	$(".description").css("text-shadow","black 0.2em 0.3em 0.2em");
	$("#page").css("-webkit-box-shadow","#333 0px 5px 10px");
	$("#footer").css("-webkit-box-shadow","#333 0px 5px 10px");
	$(".container").css("-webkit-box-shadow","#333 0px 5px 10px");
	$(".container").css("-webkit-border-radius","10px");
});
&lt;/script&gt;</code></pre>
<p>If you had a div with the class "container koru", for <a href="http://www.bioneural.net/category/project-koru/">example</a>, Safari 3 will blend the above box-shadow and border-radius styling (as inline CSS3) with any additional CSS2.1 styling for .container or .koru present in your stylesheet. You can see what's going on using that browser's <a href="http://webkit.org/blog/122/webkit-3-10-new-things/" rel="external">Web Inspector</a>:</p>
<p><img src='http://www.bioneural.net/wp-content/uploads/2008/02/s3-inspector.jpg' alt='web-inspector' /></p>
<p class="info"><em>Note</em>: A -webkit- or -moz- prefix on CSS properties is used respectively by the Safari and Mozilla/Firefox browsers to indicate tentative support for as yet non-ratified web standards. Thus <code>-webkit-border-radius: 10px;</code> and <code>-moz-border-radius: 10px;</code> are both potentially differing implementations of "<a href="http://www.w3.org/TR/2005/WD-css3-background-20050216/#the-border-radius" rel="external">border-radius</a>".</p>
<p>OK, so the "how" is easy. Now the "Should you?"</p>
<h4>The positives</h4>
<p class="for">Effects are rendered without requiring images.</p>
<p class="for">Effects are rendered without requiring add-on JavaScript effects libraries.</p>
<p class="for">Effects are rendered without increasing page size or load time.</p>
<p class="for">Effects are rendered that may be impossible with some JavaScript or image-based techniques (e.g. anti-aliasing, liquid layout support).</p>
<p class="for">Effects can be targeted at specific web browser engines.</p>
<p class="for">No changes to semantic mark-up are required.</p>
<p class="for">Your stylesheets remain W3C-valid (if they were before!).</p>
<p class="for">Browsers simply ignore CSS properties they don't understand, so degradation is graceful.</p>
<p class="for">If JavaScript is disabled browsers will still load your stylesheets, so degradation is graceful.</p>
<p class="for">It is compatible with template-based websites in not requiring page-specific effects scripts to be inserted into mark-up.</p>
<p class="for">When the -webkit- or -moz- prefix gives way to the real deal of W3C-ratified CSS3 we can simply remove the script and move the content to our stylesheet without having to re-design effects elements or edit any mark-up.</p>
<p class="for">If you don't start using CSS3 now you might have retired before it becomes W3C-ratified.</p>
<h4>The negatives</h4>
<p class="against">Turning off your stylesheet does not disable styling loaded via the DOM.</p>
<p class="against">Effects can be targeted at specific web browser engines (like browser-targeting, a double-edged sword that undermines the uniformity of the "web experience").</p>
<p class="against">It could be construed as cheating. It is.</p>
<p>What are your views, if you have any, on the merits or otherwise of this technique?</p>
<img src="http://www.bioneural.net/ff309e51/26673f11/CCBot/1.0 (+http://www.commoncrawl.org/bot.html).gif" />]]></description>
		<wfw:commentRss>http://www.bioneural.net/feeder/?FeederAction=clicked&amp;feed=Articles+%28RSS2%29&amp;seed=http%3A%2F%2Fwww.bioneural.net%2F2008%2F02%2F14%2Fhow-to-safely-inject-css3-using-jquery%2F&amp;seed_title=How+to+safely+inject+CSS3+using+jQuery/feed/</wfw:commentRss>
		<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/2.5/</creativeCommons:license>
	</item>
		<item>
		<title>The best way to do corners and gradients</title>
		<link>http://www.bioneural.net/feeder/?FeederAction=clicked&amp;feed=Articles+%28RSS2%29&amp;seed=http%3A%2F%2Fwww.bioneural.net%2F2008%2F02%2F06%2Fthe-best-way-to-do-corners-and-gradients%2F&amp;seed_title=The+best+way+to+do+corners+and+gradients</link>
		<comments>http://www.bioneural.net/feeder/?FeederAction=clicked&amp;feed=Articles+%28RSS2%29&amp;seed=http%3A%2F%2Fwww.bioneural.net%2F2008%2F02%2F06%2Fthe-best-way-to-do-corners-and-gradients%2F&amp;seed_title=The+best+way+to+do+corners+and+gradients#comments</comments>
		<pubDate>Wed, 06 Feb 2008 14:36:17 +0000</pubDate>
		<dc:creator>Bruce</dc:creator>
		
		<category><![CDATA[Internet]]></category>

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

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

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

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

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

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

		<guid isPermaLink="false">http://www.bioneural.net/2008/02/06/the-best-way-to-do-corners-and-gradients/</guid>
		<description><![CDATA[<p><a href="http://creativecommons.org/licenses/by-nc-sa/2.5/" rel="license" title="This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 2.5 License"><img src="http://www.bioneural.net/wp-content/themes/k2bn/styles/bioneural/cc.png" alt="CC" /></a> From <a href="http://www.bioneural.net/about/terms/">bioneural.net</a>:</p><p>Rounded corners. Yes, they may be a "Web 2.0" fashion fad, but it has been clearly documented that they're a lot easier to <a href="http://www.drivl.com/posts/view/700" rel="external">make</a> than square ones. As part of my <a href="http://www.bioneural.net/2007/12/27/a-xmas-spent-upgrading-bioneuralnet/">overhaul</a> of bioneural.net I've been optimizing much of the code "under the hood", meaning a lot of the changes aren't even visible. Re-evaluating how things are put together, and considering how they could be done more efficiently or otherwise improved is a valuable exercise&mdash;that it scratches a perfectionist itch is an added bonus. In this article I look at a variety of methods for creating boxes with rounded corners and gradients. Yep, it's a showdown!<br />
<span id="more-809"></span></p>
<h4>The traditional approach</h4>
<p>The well-established method of adding corners or gradients to an element is to use multiple background images. Depending to some extent on your content, this is typically impossible to achieve without the use of non-semantic extra mark-up. For example, this box uses to extra and empty divs:</p>
<pre><code>&lt;div class="curvetop"&gt;&lt;/div&gt;
&lt;div class="curvemid"&gt;
	&lt;h2&gt;Willkommen! Welcome!&lt;/h2&gt;
	&lt;p class="german" xml:lang="de" lang="de"&gt;Willkommen auf der Projekt Koru Seite, wo Simone &amp;amp; Bruce die praktischen Aspekte eines Jahres in Neuseeland mit Euch teilen wollen. Eine Einf&amp;uuml;hrung findet Ihr &lt;a href="http://www.bioneural.net/2006/03/17/introducing-project-koru/"&gt;hier&lt;/a&gt; zusammen mit einer &lt;a href="http://www.bioneural.net/2006/03/30/the-teachings-of-te-koru/"&gt;Erkl&amp;auml;rung&lt;/a&gt; warum wir das Koru als Symbol unserer Reise gew&amp;auml;hlt haben.&lt;/p&gt;
	&lt;p class="english"&gt;Welcome to Project Koru, where Simone &amp;amp; Bruce share insight into the practicalities of organizing a year in New Zealand. You can find an introduction to the project &lt;a href="http://www.bioneural.net/2006/03/17/introducing-project-koru/"&gt;here&lt;/a&gt; together with an &lt;a href="http://www.bioneural.net/2006/03/30/the-teachings-of-te-koru/"&gt;explanation&lt;/a&gt; of why we chose the koru as the symbol for our journey.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="curvebottom"&gt;&lt;/div&gt;</code></pre>
<p>Three gradient images (2 having one rounded corner each) could then be loaded into the background of each of the three "layout classes" via CSS:</p>
<pre><code>.curvetop { height: 15px; background: #fff url('gradient-top.png') bottom left no-repeat; display: block; position: relative; margin-top: 10px; }
.curvemid { background: #fff url('gradient-bg.png') repeat-y; padding: 2px 20px !important; display: block; }
.curvebottom { height: 15px; background: #fff url('gradient-bottom.png') top left no-repeat; display: block; position: relative; margin-bottom: 10px; }</code></pre>
<p>The result:</p>
<p><img src="http://www.bioneural.net/wp-content/uploads/2008/02/rounded-welcome.jpg" width="450" height="161" alt="rounded-welcome.jpg"/></p>
<p>You could use this exact same technique for adding embellishments like borders, drop shadows and the like&mdash;but not without some Photoshop skills and a decent collection of bandwidth-hogging images if you needed multiple box styles.</p>
<h4>The challenge</h4>
<p>I devised a box that I thought would test the mettle of any technique. It consisted of just one div containing a header and a paragraph, the text in each of which should appear over a different background with one of these being a gradient (but not necessarily an image). The box should be formed with rounded corners (including on images), a white border, and a drop shadow. It should also have a number of functional characteristics:</p>
<ul>
<li>Minimal mark-up i.e. avoiding nested and/or empty tags;</li>
<li>No changes to mark-up required (but extra CSS allowed, since this could be moved to an external stlesheet);</li>
<li>Valid XHTML and CSS (2.1);</li>
<li><a href="http://en.wikipedia.org/wiki/Anti-aliasing" rel="external">Anti-aliasing</a> on the corners (inner and outer border edges);</li>
<li>Small footprint (let's say under 20KB);</li>
<li>If using JavaScript it should degrade gracefully (i.e. still looks OK if JavaScript is disabled);</li>
<li>Liquid container (adjusting container width to both content size and browser window dimensions).</li>
</ul>
<p class="info">Why the requirement for minimal markup? Forward planning. Eventually CSS3 will arrive, and there'll be no need to scour your database in order to clean out all that redundant mark-up. Just amend your CSS and delete any unemployed images or JavaScript.</p>
<p>My template XHTML and CSS rendered the following:</p>
<p><img src="http://www.bioneural.net/wp-content/uploads/2008/02/master.jpg" width="271" height="354" alt="master.jpg" /></p>
<p class="link">Here is the <a href="http://www.bioneural.net/wp-content/uploads/2008/02/corner-tests/master/master-test.html">live</a> link.</p>
<p>Finding a solution to fulfil most if not all of my form and function requirements was going to be something of a mission. There's a useful roundup of techniques <a href="http://www.smileycat.com/miaow/archives/000044.php" rel="external">here</a>, divided into those based on CSS and those based on JavaScript, with examples in both groups requiring anything from no images at all through to eight images. A particular difficulty was finding techniques not restricted by the dimensions of any required image; many of the earlier established methods were clearly devised before the availability of 23" widescreen displays (<a href="http://www.456bereastreet.com/lab/transparent_custom_corners_borders/customised.html">example</a>.)</p>
<p>I made a shortlist (in no particular order) of techniques that looked promising and set to work. I'm not going to post all the code directly into this article or it will become over-long. The files I used for each technique, together with the master template and original full packages where applicable, are available for download should you wish checkout the code or conduct further experiments. I've tested only in Safari and Firefox.</p>
<p class="download">Download the test files <a href="http://www.bioneural.net/docs/corner-tests.zip">here</a> (.zip archive, 428KB).</p>
<h4>Nifty Corners Cube</h4>
<p>First up is <a href="http://www.html.it/articoli/niftycube/index.html" rel="external">Nifty Corners Cube</a> by Alessandro Fulciniti. This method uses JavaScript and CSS; no images other than those you wish to use as backgrounds are required. Here is the result:</p>
<p><img src="http://www.bioneural.net/wp-content/uploads/2008/02/nifty.jpg" width="285" height="366" alt="nifty.jpg" /></p>
<p class="link">Here is the <a href="http://www.bioneural.net/wp-content/uploads/2008/02/corner-tests/nifty/nifty-test.html">live</a> link.</p>
<p><strong>Scoresheet:</strong></p>
<p class="for"><em>Photo background</em>: Supported.</p>
<p class="for"><em>Gradient background</em>: Supported.</p>
<p class="for"><em>Four rounded corners</em>: Yes.</p>
<p class="for"><em>Border</em>: While you can produce a <a href="http://www.html.it/articoli/niftycube/nifty11.html" rel="external">convincing</a> rounded border, using padding on the container, this would require extra mark-up in our example in order to retain the cornering on our background images.</p>
<p class="against"><em>Drop shadow</em>: Not supported.</p>
<p class="against"><em>Minimal mark-up</em>: An extra container is required to render a border with inside and outside rounding.</p>
<p class="against"><em>Static mark-up</em>: Mark-up edited to add extra container plus insert box-specific script.</p>
<p class="for"><em>W3C validity</em>: Yes.</p>
<p class="against"><em>Anti-aliasing</em>: Anti-aliasing is not working on the background images or border, although it does work on solid colour boxes in the <a href="http://www.html.it/articoli/niftycube/nifty1.html" rel="external">examples</a>.</p>
<p class="for"><em>Small footprint</em>: 10KB for CSS and JavaScript (background images additional).</p>
<p class="for"><em>Graceful degradation</em>: Renders as per the master if JavaScript disabled.</p>
<p class="for"><em>Liquidity</em>: Overriding fixed width for .cornered (and in the third case for .xtra) supports liquid layouts (case four).</p>
<p>Score: 8/12</p>
<h4>curvyCorners</h4>
<p>Cameron Cooke's <a href="http://www.curvycorners.net/" rel="external">curvyCorners</a> is another image-free JavaScript solution:</p>
<p><img src="http://www.bioneural.net/wp-content/uploads/2008/02/curvy.jpg" width="287" height="373" alt="curvy.jpg" /></p>
<p class="link">Here is the <a href="http://www.bioneural.net/wp-content/uploads/2008/02/corner-tests/curvy/curvy-test.html">live</a> link.</p>
<p><strong>Scoresheet:</strong></p>
<p class="for"><em>Photo background</em>: Supported.</p>
<p class="for"><em>Gradient background</em>: Supported.</p>
<p class="against"><em>Four rounded corners</em>: There are rounded corners, but these are rendered adjacent to our background content rather than on top of it. This <a href="http://www.curvycorners.net/examples/demos/demo2.html" rel="external">example</a> illustrates rounding on a background image, but adding a border to the containing div merely fills the cornered area with "extra" offset background (see <a href="http://www.bioneural.net/wp-content/uploads/2008/02/corner-tests/curvy/offset.jpg">here</a>).</p>
<p class="for"><em>Border</em>: Obtained by applying background and border to container.</p>
<p class="against"><em>Drop shadow</em>: Not a feature of this technique.</p>
<p class="for"><em>Minimal mark-up</em>: Yes.</p>
<p class="against"><em>Static mark-up</em>: Mark-up edited to insert box-specific script.</p>
<p class="for"><em>W3C validity</em>: Yes.</p>
<p class="against"><em>Anti-aliasing</em>: Yes, but only on the outside of the rounded border (not on images).</p>
<p class="against"><em>Small footprint</em>: 24KB for JavaScript (background images additional).</p>
<p class="for"><em>Graceful degradation</em>: Renders as per the master if JavaScript disabled.</p>
<p class="for"><em>Liquidity</em>: Overriding fixed width for .cornered supports liquid layouts (case four).</p>
<p>Score: 7/12</p>
<h4>SRCCB</h4>
<p>The "simple rounded corner CSS boxes" technique was <a href="http://www.modxcms.com/simple-rounded-corner-css-boxes.html" rel="external">devised</a> by Ryan Thrash, also accessible in the form of an online generator as <a href="http://spiffybox.com/" rel="external">Spiffy Box</a>. It uses no JavaScript and a single image combined with moderately complex CSS (which would have to be recalculated for each box size):</p>
<p><img src="http://www.bioneural.net/wp-content/uploads/2008/02/simple.jpg" width="268" height="374" alt="simple.jpg" /></p>
<p class="link">Here is the <a href="http://www.bioneural.net/wp-content/uploads/2008/02/corner-tests/simple/simple-test.html">live</a> link.</p>
<p><strong>Scoresheet:</strong></p>
<p class="for"><em>Photo background</em>: Supported (integrated into container background).</p>
<p class="for"><em>Gradient background</em>: Supported (integrated into container background).</p>
<p class="for"><em>Four rounded corners</em>: Yes (integrated into container background).</p>
<p class="for"><em>Border</em>: Yes (integrated into container background).</p>
<p class="for"><em>Drop shadow</em>: Yes (integrated into container background).</p>
<p class="against"><em>Minimal mark-up</em>: Requires two additional divs for positioning purposes.</p>
<p class="against"><em>Static mark-up</em>: Mark-up edited to insert two additional divs.</p>
<p class="for"><em>W3C validity</em>: Yes.</p>
<p class="for"><em>Anti-aliasing</em>: Yes (integrated into container background).</p>
<p class="for"><em>Small footprint</em>: 6KB image overhead compared to master with original 2 background images.</p>
<p class="for"><em>Graceful degradation</em>: Not applicable as no JavaScript.</p>
<p class="against"><em>Liquidity</em>: Depends upon fixed-width images.</p>
<p>Score: 9/12</p>
<h4>swfIR</h4>
<p>The SWF Image Replacement (<a href="http://www.swfir.com" rel="external">swfIR</a>) technique is offered by Jon Aldinger, Mark Huot, and Dan Mall. It applies to inline (cf background) images and uses JavaScript and Flash to swap out the original and deck it out with bling. It does more than we require&mdash;image rotation and stretching for example, and at first glance it certainly looked like the wrong tool for the job. I wondered, however, if we could use CSS positioning to overlay our text on top of the replaced images. It turns out you can:</p>
<p><img src="http://www.bioneural.net/wp-content/uploads/2008/02/swfir.jpg" width="255" height="394" alt="swfir.jpg" /></p>
<p class="link">Here is the <a href="http://www.bioneural.net/wp-content/uploads/2008/02/corner-tests/swfir/swfir-test.html">live</a> link.</p>
<p><strong>Scoresheet:</strong></p>
<p class="for"><em>Photo background</em>: Supported (as an inline image!).</p>
<p class="for"><em>Gradient background</em>: Supported (as an inline image!).</p>
<p class="against"><em>Four rounded corners</em>: Actually you get 6! (you could potentially blot out the bottom border on the heading using a third positioned inline image&mdash;a real hack!).</p>
<p class="for"><em>Border</em>: Yes (specified in JavaScript).</p>
<p class="for"><em>Drop shadow</em>: Yes (specified in JavaScript).</p>
<p class="against"><em>Minimal mark-up</em>: Requires insertion of two inline images.</p>
<p class="against"><em>Static mark-up</em>: Mark-up edited to insert inline images plus box-specific script.</p>
<p class="for"><em>W3C validity</em>: Yes. It does validate, but should I say "No" because it depends on Flash?</p>
<p class="for"><em>Anti-aliasing</em>: Yes.</p>
<p class="against"><em>Small footprint</em>: 25KB (24KB JavaScript and SWF; 1KB image overhead compared to master with original 2 background images.)</p>
<p class="for"><em>Graceful degradation</em>: Acceptable (just) with JavaScript disabled.</p>
<p class="against"><em>Liquidity</em>: Positioning depends upon fixed-width images.</p>
<p>Score: 7/12</p>
<h4>ShadedBorder</h4>
<p>Steffen Ruzee brings you <a href="http://www.ruzee.com/blog/shadedborder" rel="external">ShadedBorder</a>, a full-featured solution that uses only JavaScript:</p>
<p><img src="http://www.bioneural.net/wp-content/uploads/2008/02/shaded.jpg" width="273" height="374" alt="shaded.jpg" /></p>
<p class="link">Here is the <a href="http://www.bioneural.net/wp-content/uploads/2008/02/corner-tests/shaded/shaded-test.html">live</a> link.</p>
<p><strong>Scoresheet:</strong></p>
<p class="for"><em>Photo background</em>: Supported.</p>
<p class="for"><em>Gradient background</em>: Supported.</p>
<p class="for"><em>Four rounded corners</em>: Yes.</p>
<p class="against"><em>Border</em>: Yes (specified in JavaScript), but height on .sb-inner causes blue background to show through (why isn't this also an issue with the h4 background image?). Setting height to 0 removes the bar but also takes out the gradient! Admittedly, you could style the background to tone in better.</p>
<p class="for"><em>Drop shadow</em>: Yes (specified in JavaScript).</p>
<p class="against"><em>Minimal mark-up</em>: A headline with it's own style can be <a href="http://www.ruzee.com/files/shadedborder/test.html" rel="external">achieved</a> with extra mark-up, and extra script in the head, and another script that <em>must</em> be inserted before the closing body tag. This makes it fatally flawed for use in a templated system like WordPress, IMHO.</p>
<p class="against"><em>Static mark-up</em>: As above, mark-up edited at 3 points, including a necessary change from div class to ID.</p>
<p class="for"><em>W3C validity</em>: Yes.</p>
<p class="for"><em>Anti-aliasing</em>: Yes.</p>
<p class="for"><em>Small footprint</em>: 9KB JavaScript.</p>
<p class="for"><em>Graceful degradation</em>: Renders as per the master if JavaScript disabled.</p>
<p class="for"><em>Liquidity</em>: Yes (comment out width on #cornered; not shown due to duplicate IDs).</p>
<p>Score: 9/12</p>
<h4>SVG</h4>
<p>Firefox 2 and Safari 3 can both display standalone Scalable Vector Graphics (<a href="http://www.w3.org/TR/SVG/" rel="external">SVG</a>) images, an unloved W3C standard. They can't load SVG from CSS, however, making SVGs unusable as background images at this time. The option to use SVG in CSS hasn't gone beyond a <a href="http://dbaron.org/css/css-vg/" rel="external">proposal</a>, with Wikipedia <a href="http://en.wikipedia.org/wiki/Scalable_Vector_Graphics" rel="external">noting</a> "the use of SVG on the web is in its infancy". It took me quite a few hours to get to grips with the examples in the 1.1 spec and create a <a href="http://validator.w3.org/check?uri=http%3A//www.bioneural.net/wp-content/uploads/2008/02/corner-tests/svg/svg-test.xhtml" rel="external">valid</a> and functional XHTML/SVG file for testing purposes. The basic idea is to create a bordered box with rounded corners, fill it with a gradient, and apply a <a href="http://en.wikipedia.org/wiki/Gaussian_blur" rel="external">Gaussian blur</a> to a slightly offset box of the same dimensions&mdash;all with a few lines of XML. Here is our box using Opera 9.25 (Mac):</p>
<p><img src="http://www.bioneural.net/wp-content/uploads/2008/02/svg.jpg" width="279" height="372" alt="svg.jpg" /></p>
<p class="link">Here is the <a href="http://www.bioneural.net/wp-content/uploads/2008/02/corner-tests/svg/svg-test.xhtml">live</a> link (SVG-aware browser required).</p>
<p><strong>Scoresheet:</strong></p>
<p class="against"><em>Photo background</em>: Supported in CSS, but you loose the rounded corners.</p>
<p class="for"><em>Gradient background</em>: Supported without CSS via <code>linearGradient</code>.</p>
<p class="for"><em>Four rounded corners</em>: Yes via <code>rx</code> on <code>rect</code>.</p>
<p class="for"><em>Border</em>: Yes via <code>stroke</code> on <code>rect</code>.</p>
<p class="for"><em>Drop shadow</em>: Yes via <code>filter</code> with <code>feGaussianBlur</code>, <code>feOffset</code>, and <code>feMerge</code>.</p>
<p class="against"><em>Minimal mark-up</em>: Requires insertion of inline SVG image(s).</p>
<p class="against"><em>Static mark-up</em>: SVG must (currently) be added inline; also necessitates DOCTYPE change and .xhtml file extension.</p>
<p class="for"><em>W3C validity</em>: Yes.</p>
<p class="for"><em>Anti-aliasing</em>: Yes.</p>
<p class="for"><em>Small footprint</em>: 0KB (background image additional; gradient image not required).</p>
<p class="against"><em>Graceful degradation</em>: No (Internet Explorer 6 and 7 choke).</p>
<p class="against"><em>Liquidity</em>: Positioning depends upon fixed-width SVG images; <a href="http://www.bioneural.net/wp-content/uploads/2008/02/corner-tests/svg/svg-resize-test.xhtml">resizing</a> text size or browser window is problematic.</p>
<p>Score: 7/12</p>
<p><em>Update 18.03.08</em>: Safari 3.1 <a href="http://docs.info.apple.com/article.html?artnum=307467" rel="external">adds</a> support for SVG images in img elements and CSS images.</p>
<h4>CSS3</h4>
<p><a href="http://www.w3.org/TR/css3-roadmap/" rel="external">CSS3</a>, if it ever arrives, promises not only rounded corners but drop shadows and multiple background images too (oddly the draft spec doesn't mention gradients). Apple's <a href="http://www.apple.com/safari/" rel="external">Safari</a> (available for Mac and PC) already includes support for such effects&mdash;but of course it's not valid CSS. You can preview CSS3 rounded corners <a href="http://www.css3.info/preview/rounded-border/" rel="external">here</a> and <a href="http://24ways.org/2006/rounded-corner-boxes-the-css3-way" rel="external">here</a> in Firefox or Safari 3. Here is our box using Safari-specific not-quite-CSS3:</p>
<p><img src="http://www.bioneural.net/wp-content/uploads/2008/02/css3.jpg" width="293" height="371" alt="css3.jpg" /></p>
<p class="link">Here is the <a href="http://www.bioneural.net/wp-content/uploads/2008/02/corner-tests/css3/css3-test.html">live</a> link (<a href="http://webkit.org/" rel="external">WebKit</a> browser required).</p>
<p><strong>Scoresheet:</strong></p>
<p class="for"><em>Photo background</em>: Supported.</p>
<p class="for"><em>Gradient background</em>: Supported.</p>
<p class="for"><em>Four rounded corners</em>: Yes.</p>
<p class="for"><em>Border</em>: Yes.</p>
<p class="for"><em>Drop shadow</em>: Yes.</p>
<p class="for"><em>Minimal mark-up</em>: Yes.</p>
<p class="for"><em>Static mark-up</em>: Yes.</p>
<p class="against"><em>W3C validity</em>: No, but only because the standard isn't yet established.</p>
<p class="for"><em>Anti-aliasing</em>: Yes, but note anti-aliasing artefact in the bottom corners.</p>
<p class="for"><em>Small footprint</em>: 0KB (background images additional).</p>
<p class="for"><em>Graceful degradation</em>: Yes (non-CSS3 aware browsers see a plain box).</p>
<p class="for"><em>Liquidity</em>: Yes.</p>
<p>Score: 11/12</p>
<h4>Summing up</h4>
<p>Which technique you choose ultimately depends upon what you're after and what you prioritise. There is no one "best" solution that fits all requirements. In terms of form and function CSS3 has to be the clear winner if one must be chosen, with a perfect score blown only by the fact that it isn't a W3C standard (yet). Herein lies CSS3's only significant yet overwhelming drawback: what good is it if the majority users can't see the effects? At the same time I'm not personally sold on any of the alternative methods. The end results may look good; it's <em>how</em> they achieve them that I don't much care for. Although a method validates it typically involves cheating the validator (seemingly JavaScript's <em>raison d'être</em>). Just take a look at the live links with Safari's Web Inspector (<a href="http://www.bioneural.net/wp-content/uploads/2008/02/inspector.jpg">example</a>).</p>
<p>Before I put a lid on this little adventure, as Jobs would <a href="http://en.wikipedia.org/wiki/Stevenote" rel="external">say</a>, there's just <em>one more thing</em>... what about jQuery? The <a href="http://jquery.com/" rel="external">jQuery</a> library (included with WordPress and the K2 theme) can be extended to render corners, shadows, and gradients. If this article was Part 1, then that exposition forms <a href="http://www.bioneural.net/2008/02/13/corners-gradients-and-shadows-with-jquery/">Part 2</a>. <del datetime="2008-02-13T16:15:23+00:00">Coming soon</del>.</p>
<img src="http://www.bioneural.net/ff309e51/26673f11/CCBot/1.0 (+http://www.commoncrawl.org/bot.html).gif" />]]></description>
		<wfw:commentRss>http://www.bioneural.net/feeder/?FeederAction=clicked&amp;feed=Articles+%28RSS2%29&amp;seed=http%3A%2F%2Fwww.bioneural.net%2F2008%2F02%2F06%2Fthe-best-way-to-do-corners-and-gradients%2F&amp;seed_title=The+best+way+to+do+corners+and+gradients/feed/</wfw:commentRss>
		<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/2.5/</creativeCommons:license>
	</item>
		<item>
		<title>bioneural.net site preference panel revisited</title>
		<link>http://www.bioneural.net/feeder/?FeederAction=clicked&amp;feed=Articles+%28RSS2%29&amp;seed=http%3A%2F%2Fwww.bioneural.net%2F2008%2F01%2F22%2Fbioneuralnet-site-preference-panel-revisited%2F&amp;seed_title=bioneural.net+site+preference+panel+revisited</link>
		<comments>http://www.bioneural.net/feeder/?FeederAction=clicked&amp;feed=Articles+%28RSS2%29&amp;seed=http%3A%2F%2Fwww.bioneural.net%2F2008%2F01%2F22%2Fbioneuralnet-site-preference-panel-revisited%2F&amp;seed_title=bioneural.net+site+preference+panel+revisited#comments</comments>
		<pubDate>Tue, 22 Jan 2008 20:06:51 +0000</pubDate>
		<dc:creator>Bruce</dc:creator>
		
		<category><![CDATA[Internet]]></category>

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

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

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

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

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

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

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

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

		<guid isPermaLink="false">http://www.bioneural.net/2008/01/22/bioneuralnet-site-preference-panel-revisited/</guid>
		<description><![CDATA[<p><a href="http://creativecommons.org/licenses/by-nc-sa/2.5/" rel="license" title="This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 2.5 License"><img src="http://www.bioneural.net/wp-content/themes/k2bn/styles/bioneural/cc.png" alt="CC" /></a> From <a href="http://www.bioneural.net/about/terms/">bioneural.net</a>:</p><p>The <a href="http://www.bioneural.net/2006/05/11/adding-a-site-preferences-panel/">first</a> version of my site preference panel for <a href="http://wordpress.org/" rel="external">WordPress</a> needed lots of JavaScript for the toggle (<a href="http://www.bioneural.net/2008/01/06/from-protoaculous-to-jquery/">Proto.aculo.us</a>), more JavaScript to switch styles, and still more JavaScript to change text size. Version 2 still uses JavaScript for the toggle effect&mdash;but no additional load&mdash;since jQuery is already utilised by <a href="http://getk2.com/" rel="external">K2</a>. The rest is accomplished using server-side PHP, and the revised 3-column panel layout makes use of more recent CSS know-how. I've tried to modularize the preferences panel as much as possible, but some simple template editing is still required (at 4 points). It is optimised for K2 (tested using RC3 and RC4) and although I haven't tested it with other themes (that's your job!) I don't see why it couldn't be used (*Some tweaking may be required. Batteries not included.)<br />
<span id="more-785"></span></p>
<h4>Get the files</h4>
<p>Let's get it done, then come back to the how and why if you're interested. Download the files to create your own preference panel as siteprefs.zip, available <a href="http://www.bioneural.net/extra/">here</a>. Expand the archive and upload the folder "siteprefs" into your K2 main directory:</p>
<p>/wp-content/themes/k2/siteprefs/</p>
<p>At this point you may also want to download and activate the <a href="http://wordpress.org/extend/plugins/theme-switcher/" rel="external">Theme Switcher</a> plugin if you plan on allowing your audience to change the WordPress theme they see on a per-user basis (storing their preference in a cookie). Support for the plugin is built into the preference panel (see features, below).</p>
<p>It's yours to play with and customise; all I ask is that you retain the little "i" icon with it's link back to these instructions. Feedback and suggestions for improvement are welcome. If you do modify it in a novel way (or use it in a theme other than K2), please leave a comment so I and others can check it out.</p>
<p>Right then, let's hack some templates!</p>
<h4>Step 1: Look for cookies</h4>
<p>Add the following code into PHP block at the top of K2's header.php (e.g. before the closing "?&gt;"):</p>
<pre><code>// Check cookie for stored site prefs
$layout = (isset($_COOKIE['layout']) &amp;&amp; ($_COOKIE['layout'] == "alternate")) ? "alternate" : "style";</code></pre>
<p>Here, "style" is the name of your main stylesheet (style.css in K2) and "alternate" is the name of a stylesheet we'll create at Step 5. If you're not using K2 pop this between PHP start and end tags at the top of your header template and set "style" to the name of your primary CSS file.</p>
<h4>Step 2: Know your style</h4>
<p>We need to replace the relative link to your stylesheet with one into which we can insert the value of the variable <code>$layout</code>. While we're here, we might as well link to the styling for the preference panel. In the head element of header.php replace this line (or your theme's equivalent):</p>
<pre><code>&lt;link rel="stylesheet" type="text/css" media="screen" href="&lt;?php bloginfo('stylesheet_url'); ?&gt;" /&gt;</code></pre>
<p>with:</p>
<pre><code>&lt;link rel="stylesheet" type="text/css" media="screen" href="&lt;?php bloginfo('template_url'); ?&gt;/&lt;?php echo $layout; ?&gt;.css" /&gt;
&lt;link rel="stylesheet" type="text/css" media="screen" href="&lt;?php bloginfo('template_url'); ?&gt;/siteprefs/siteprefs.css" /&gt;</code></pre>
<p class="info">Your K2 custom stylesheet will still be loaded too, if you're using one.</p>
<h4>Step 3: Flick the switch</h4>
<p>Create a toggle to switch visibility of the preference panel on or off (it will be hidden on page load). The actual "switch" might be a text or an image link, inserted into an appropriate place (e.g your header or sidebar). If you prefer to add the toggle in the form of a tab in your K2 menu, look for <code>ul class="menu"</code> in header.php and replace this code:</p>
<pre><code>	&lt;?php wp_register('&lt;li class="admintab"&gt;','&lt;/li&gt;'); ?&gt;
&lt;/ul&gt;</code></pre>
<p>with the following code:</p>
<pre><code>	&lt;?php wp_register('&lt;li class="admintab"&gt;','&lt;/li&gt;'); ?&gt;
	&lt;li&gt;&lt;a id="siteprefs-toggle" href="#" title="Click to show/hide site preferences (requires JavaScript)"&gt;Prefs&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;script type="text/javascript"&gt;
	jQuery(document).ready(function() {

	// hide #siteprefs as soon as the DOM is ready
	jQuery('#siteprefs').hide();

	// toggle #siteprefs on clicking the #prefs-toogle link
	jQuery('a#siteprefs-toggle').click(function() {
	jQuery('#siteprefs').slideToggle(400);
	return false;
	});

});
&lt;/script&gt;</code></pre>
<p>If you'd rather use the supplied image (sitepref2.gif), place the following code after <code>p class="description"</code> (which is within <code>div id="header"</code>) and before <code>ul class="menu"</code> in K2's header.php. </p>
<pre><code>&lt;a id="siteprefs-toggle" href="#" title="Click to show/hide site preferences (requires JavaScript)"&gt;&lt;img src="&lt;?php bloginfo('template_directory'); ?&gt;/siteprefs/img/sitepref2.gif" width="52" height="28" alt="siteprefs" /&gt;&lt;/a&gt;
&lt;script type="text/javascript"&gt;
	jQuery(document).ready(function() {

	// hide #siteprefs as soon as the DOM is ready
	jQuery('#siteprefs').hide();

	// toggle #siteprefs on clicking the #prefs-toogle link
	jQuery('a#siteprefs-toggle').click(function() {
	jQuery('#siteprefs').slideToggle(400);
	return false;
	});

});
&lt;/script&gt;</code></pre>
<p>The CSS to position the #siteprefs-toggle image within K2's header image area is included in the download (it will be ignored if you create a menu tab instead). If this position doesn't suit your theme of course you can overwrite this in siteprefs.css. </p>
<p class="info">The toggle's "slide" effect depends on jQuery, which comes with K2 by default. If you're not using K2, you'll need to include the jQuery library in your head, find an alternative JavaScript (<a href="http://www.bioneural.net/2006/05/11/adding-a-site-preferences-panel/">here</a> is how v1 did it using Proto.aculo.us), or you may wish to dispense with the toggle altogether and ventilate your preferences permanently.</p>
<h4>Step 4: Feel included</h4>
<p>The file siteprefs.php includes the XHTML and PHP to build your preference panel. As well as providing the Theme Switcher control, it works with layout.php to toggle your main and alternate stylesheets (and store your choice in a cookie), and advises your audience on link behaviour. You can change the content of these three columns as you see fit just by editing siteprefs.php.</p>
<p>To get siteprefs.php into your theme we have to include it e.g. immediately below the closing tag of the div #header in header.php, so it appears to slide out from the K2 menu:</p>
<pre><code>&lt;?php include (TEMPLATEPATH . '/siteprefs/siteprefs.php'); ?&gt;</code></pre>
<p>If you prefer you could put it at the top of your page, in the sidebar, or in the footer. Or anywhere. For sidebar placement, for example, you would likely edit siteprefs.php and siteprefs.css to respectively create and style a single vertical column.</p>
<p>At this point, if you refresh your site you should see the bioneural.net preference panel installed. If all went well and you're using a default K2 installation, you should be something like this:</p>
<p><span class="zoom">Click thumbnail to enlarge image</span><br /><a href="http://www.bioneural.net/images/enlarge/siteprefs-large.jpg" rel="ibox" title="Site preferences installed into default K2 theme (using image toggle)"><img src="http://www.bioneural.net/wp-content/uploads/2008/01/siteprefs-thumb.jpg" width="200" height="81" alt="siteprefs-thumb.jpg" /></a><br /><span class="caption">Site preferences installed into default K2 theme (using image toggle)</span></p>
<h4>Step 5: Go alternative</h4>
<p>Finally we create an alternate stylesheet, named alternate.css (the name is specified in Step 1 and in layout.php).</p>
<p>What you put in here is up to you. You will likely want to import existing styling from your main stylesheet, and then write a handful of rules which, owing to the CSS "cascade", will overwrite some of those you just imported. </p>
<p>Here's a barebones example that increases font size and turns the default K2 fixed-width theme into a fluid/ liquid layout:</p>
<pre><code>@import 'style.css';

body { font-size: 90%; } /* approx 30% larger than K2 default */
#page { width: 100% !important; border: 0; padding: 0; }
#primary { width: 100%; margin-left: -30px; padding-left: 30px; background-color: #fff;}
.content { background-color: #fff; } /* Match bg colour to #primary */
#sidebar-main.secondary { padding-left: 30px; border-right: 10px solid #f2f2f2; padding-bottom: 20px; } /* Border colour matches bg colour of .secondary */
.secondary { width: 100% !important; margin-left: -30px; background: #f2f2f2; }
#footer { background-color: #ccc; }</code></pre>
<p>Upload alternate.css into the same directory as your main stylesheet (e.g. styles.css i.e. /wp-content/themes/k2/). This is <strong>important</strong> as the switch relies on your main and alternate stylesheets being in the same directory.</p>
<p class="info">If you're having trouble overwriting rules for your alternate stylesheet, try !important e.g. <code>width: 100% !important;</code> but bear in mind IE6 will ignore it.</p>
<h4>Build notes, features and credits</h4>
<p>You don't <em>have</em> to read on&mdash;unless you're interested in how, why, and who helped make it work the way it does ;-)</p>
<h4>The toggle effect</h4>
<p>The toggle uses the <a href="http://jquery.com/" rel="external">jQuery</a> JavaScript library and the code for this was covered in a <a href="http://www.bioneural.net/2008/01/06/from-protoaculous-to-jquery/">previous</a> article.</p>
<p>What if the user doesn't have JavaScript, or has it but disabled it? Version 1 hid the preference panel on page load using CSS, and showing it required JavaScript to change the styling to "display". Version 2 uses JavaScript to initially hide the panel, so if there is no JavaScript the panel will be revealed at the outset. Furthermore, because none of the controls in the panel utilize any JavaScript, no functionality is impaired. The only (minor) outcome is that the panel can't be hidden, but at least the "accessibility" preferences are, err, accessible.</p>
<h4>A flexible 3-column framework</h4>
<p>The XHTML mark-up and CSS for this is adapted from an <a href="http://www.alistapart.com/d/multicolumnlayouts/3ColLiquid.html" rel="external">example</a> multi-column layout given in an ALA <a href="http://www.alistapart.com/articles/multicolumnlayouts" rel="external">article</a> by <a href="http://alttag.org/" rel="external">Alan Pearce</a>. Alan cleverly builds on previous work that makes use of borders to simulate equal-height columns. Initially my mark-up used borders too, but after 2 days of trying to get it to work in IE6 and 7 with in-column padding I realised I didn't need them. </p>
<p>The fixed-width two-column K2 theme I use defaults to a width of 780px. To create our basic layout we create 3 divs (one for each column), and wrap these in a container div. The container sets up the 3 columns using floats and negative margins and then uses padding to effectively pull the outer columns back inside the container! We then create a header div and a footer div, and style the width of the outer columns (including padding) to 260px i.e. one third of our page width:</p>
<p><img src="http://www.bioneural.net/wp-content/uploads/2008/01/3-columns.jpg" width="451" height="203" alt="3-columns" /></p>
<p>We can then apply a horizontally-repeating background image to the header and footer divs, match the background colours, and clear floats for the footer to position correctly. Here's what our panel now looks like topographically:</p>
<p><img src="http://www.bioneural.net/wp-content/uploads/2008/01/topographical.jpg" width="450" height="108" alt="topographical" /></p>
<p>But the preference panel resizes, too. If your alternate stylesheet is "fluid" i.e. page content fits to the width of the browser window, the three columns will automatically space themselves out equally to fill the window:</p>
<p><img src="http://www.bioneural.net/wp-content/uploads/2008/01/fluid.jpg" width="450" height="64" alt="fluid" /></p>
<p class="info">Note that the left and right column width doesn't actually change, but the width of the middle column is no longer an implied 260px since we have set #siteprefs-center to occupy 100% width.</p>
<p>At this point everything is looking good&mdash;in Firefox, Safari, and IE7. You guessed it: Internet Exploder 6 is singing protest songs. We need to patch our CSS to make it work with IE6:</p>
<p class="bug">The IE escaping floats <a href="http://www.positioniseverything.net/explorer/escape-floats.html" rel="external">bug</a> causes the contents of #siteprefs-header not to display. We just add <code>width: 100%;</code> to fix this.</p>
<p class="bug">The IE doubled float-margin <a href="http://www.positioniseverything.net/explorer/doubled-margin.html" rel="external">bug</a> causes #siteprefs-right to float outside of #siteprefs-wrapper! To fix this we add <code>display: inline;</code> to #siteprefs-right.</p>
<h4>Switching whole themes</h4>
<p>The <a href="http://wordpress.org/extend/plugins/theme-switcher/" rel="external">Theme Switcher</a> plugin for WordPress is by <a href="http://boren.nu/" rel="external">Ryan Boren</a>. It sets a cookie so that the user's browser remembers their choice of theme for subsequent visits.</p>
<p>The bioneural.net preference panel uses conditional PHP to show the theme switcher dropdown menu or, if the TS plugin is not present or is present but not activated, they will see a "not enabled" message:</p>
<p><img src="http://www.bioneural.net/wp-content/uploads/2008/01/styling-states.jpg" width="374" height="122" alt="styling-states.jpg" /></p>
<p>There are a few other things you might consider if you allow theme switching on your site; see Ben's <a href="http://www.instigatorblog.com/10-things-you-must-do-when-changing-wordpress-themes/2007/01/15/" rel="external">list</a>. To press the point, the preference panel includes a warning when the switcher is displayed that using it "may reduce functionality". At the very least you need to allow users to easily switch back to the previous theme&mdash;otherwise they'll have to wait a year until the cookie expires (not really; they could just delete the cookie!). In the sidebar of each theme you have installed, just paste the following:</p>
<pre><code>&lt;?php if (function_exists('wp_theme_switcher')) { ?&gt;
	&lt;?php wp_theme_switcher('dropdown'); ?&gt;
&lt;?php } ?&gt;</code></pre>
<p>If you don't like the list styling, this CSS (as used in siteprefs.css) will remove it:</p>
<pre><code>#themeswitcher { list-style: none; padding-left: 0; }</code></pre>
<h4>Switching stylesheets</h4>
<p>Previously I had used JavaScript to effect both a change in layout (fixed or fluid-width) and in text size (smaller, default, larger). Both of these are really accessibility issues&mdash;adapting to the size of your screen or the acuity of your vision. Add to this the observation that enlarging text size very soon causes problems within the confines of a fixed-width layout and it becomes clear why I decided to merge these features in version 2 i.e. biiger text, bigger container.</p>
<p>Stylesheet switching with memory is ideal, for example, if you want your iPhone/ tablet&mdash;or screen resolution-challenged work PC&mdash;to always use an alternative "accessible" layout. Cookies could likewise ensure that a different default style makes full use of your stunning 23" Apple Display.</p>
<p>Having decided against reusing the <a href="http://www.alistapart.com/stories/alternate/" rel="external">original</a> ALA styleswitcher JavaScript, and considered using jQuery (as <a href="http://kelvinluck.com/article/switch-stylesheets-with-jquery" rel="external">here</a>&mdash;also JavaScript, but better), I looked at a few PHP options and settled on Roger Johansson's <a href="http://www.456bereastreet.com/archive/200608/build_your_own_php_style_sheet_switcher/" rel="external">method</a>.</p>
<h4>Identifying off-site links</h4>
<p>By default (Option 1) any link you tag with rel="external" will display the "off-site" icon (dimmed for visited links) using the included CSS. I prefer this option for identifying off-site links because it gives your audience the choice as to how links behave (the alternative is forcing them to open new windows using JavaScript or the depreciated target="_bank"). If you haven't religiously tagged your off-site links with rel="external" (or can't be bothered), you have two alternative options:</p>
<ol>
<li>Open siteprefs.css and uncomment Option 2 (making sure the CSS for Options 1 and 3 is commented); this will apply the icon to all links other than to your own domain (<a href="http://lachy.id.au/log/2005/04/handy-css" rel="external">credit</a>). See the instructions in the file.</li>
<li>A WordPress <a href="http://sw-guide.de/wordpress/plugins/link-indication/" rel="external">plugin</a> is available that will do it for you (Option 3). Once the Link Indication plugin is activated just uncomment the CSS for Option 3 in siteprefs.css (ensuring the CSS for Options 1 and 2 is commented-out).</li>
</ol>
<p class="info">Option 1 works in Firefox, IE7, and Safari (but not IE6). Option 2 works in Firefox and Safari (but not IE7 or IE6). Option 3 works in Firefox, IE7, IE6, and Safari (but does not differentiate between visited/ unvisited links).</p>
<h4>Change log</h4>
<table class="tabulate">
<tr>
<th>Version</th>
<th>Notes</th>
</tr>
<tr>
<td>1.0</td>
<td class="odd"><em>11.05.06</em>. Initial 1.x release.</td>
</tr>
<tr>
<td>2.0</td>
<td class="odd"><em>22.01.08</em>. Initial 2.x release.</td>
</tr>
<tr>
<td>2.1</td>
<td class="odd"><em>28.01.08</em>. Corrected CSS for off-site links. Added alternative methods of identifying off-site links using <a href="http://www.w3.org/TR/2001/CR-css3-selectors-20011113/#pseudo-classes" rel="external">pseudo-class</a> (Option 2) or class (Option 3).</td>
</tr>
</table>
<img src="http://www.bioneural.net/ff309e51/26673f11/CCBot/1.0 (+http://www.commoncrawl.org/bot.html).gif" />]]></description>
		<wfw:commentRss>http://www.bioneural.net/feeder/?FeederAction=clicked&amp;feed=Articles+%28RSS2%29&amp;seed=http%3A%2F%2Fwww.bioneural.net%2F2008%2F01%2F22%2Fbioneuralnet-site-preference-panel-revisited%2F&amp;seed_title=bioneural.net+site+preference+panel+revisited/feed/</wfw:commentRss>
		<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/2.5/</creativeCommons:license>
	</item>
		<item>
		<title>Spring clean your WordPress head</title>
		<link>http://www.bioneural.net/feeder/?FeederAction=clicked&amp;feed=Articles+%28RSS2%29&amp;seed=http%3A%2F%2Fwww.bioneural.net%2F2008%2F01%2F12%2Fspring-clean-your-wordpress-head%2F&amp;seed_title=Spring+clean+your+WordPress+head</link>
		<comments>http://www.bioneural.net/feeder/?FeederAction=clicked&amp;feed=Articles+%28RSS2%29&amp;seed=http%3A%2F%2Fwww.bioneural.net%2F2008%2F01%2F12%2Fspring-clean-your-wordpress-head%2F&amp;seed_title=Spring+clean+your+WordPress+head#comments</comments>
		<pubDate>Sat, 12 Jan 2008 08:00:42 +0000</pubDate>
		<dc:creator>Bruce</dc:creator>
		
		<category><![CDATA[Internet]]></category>

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

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

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

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

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

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

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

		<guid isPermaLink="false">http://www.bioneural.net/2008/01/12/spring-clean-your-wordpress-head/</guid>
		<description><![CDATA[<p><a href="http://creativecommons.org/licenses/by-nc-sa/2.5/" rel="license" title="This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 2.5 License"><img src="http://www.bioneural.net/wp-content/themes/k2bn/styles/bioneural/cc.png" alt="CC" /></a> From <a href="http://www.bioneural.net/about/terms/">bioneural.net</a>:</p><p>If you had viewed the source of my WordPress-generated pages a while ago you'd have noticed that my head elements were a real mess. Now they've been spring cleaned, arranged neatly into related groupings and the needless clutter disposed of. Plugins that use the <a href="http://codex.wordpress.org/Hook_Reference/wp_head" rel="external">wp_head</a> hook distribute junk all over the show, offending any sense of order. Luckily your WordPress theme is the key to taking control of your head, through a combination of edits to functions.php and header.php.<br />
<span id="more-771"></span></p>
<h4>Removing actions using a functions file</h4>
<p>Your theme may already include a file called <a href="http://codex.wordpress.org/Theme_Development#Functions_File" rel="external">functions.php</a>. If it doesn't you can create one using the functions file found in the default theme directory (which is a bit busy), or copy-and-paste mine (with the K2 bits stripped out for clarity):</p>
<pre><code>&lt;?php 

// De-clutter wp-head

// Really Simple Discovery
remove_action('wp_head', 'rsd_link');
// Windows Live Writer
remove_action('wp_head', 'wlwmanifest_link');
// Quoter plugin
remove_action('wp_head', 'quoter_head');
// wp-forecast plugin
remove_action('wp_head', 'wp_forecast_css');
// K2 custom header
remove_action('wp_head', array('K2Header', 'output_header_css'));

?&gt;</code></pre>
<p>The real advantage here is avoiding the need to hack any plugins or core WordPress files (an upgrader's nightmare). Let's go through the removal actions in sequence.</p>
<p><a href="http://en.wikipedia.org/wiki/Really_Simple_Discovery" rel="external">Really Simple Discovery</a> helps client software discover things about your blog. If you don't use a client and manage your posts directly in WordPress, you don't need to offer such help. The PHP script:</p>
<pre><code>remove_action('wp_head', 'rsd_link');</code></pre>
<p>will remove a line from your head that looks something like this:</p>
<pre><code>&lt;link rel="EditURI" type="application/rsd+xml" title="RSD" href="http://www.bioneural.net/xmlrpc.php?rsd" /&gt;</code></pre>
<p><a href="http://get.live.com/writer/overview" rel="external">Windows Live Writer</a> is one such desktop blogging client, but supporting it needs yet another line in your head. The script:</p>
<pre><code>remove_action('wp_head', 'wlwmanifest_link');</code></pre>
<p>will remove a line from your head that looks something like this:</p>
<pre><code>&lt;link rel="wlwmanifest" type="application/wlwmanifest+xml" href="http://www.bioneural.net/wp-includes/wlwmanifest.xml" /&gt;</code></pre>
<p>The <a href="http://www.damagedgoods.it/wp-plugins/quoter/" rel="external">Quoter</a> plugin defaults to inserting comments, JavaScript, and CSS into your head:</p>
<pre><code>&lt;!-- Added by Quoter plugin v1.1 --&gt;
&lt;script type="text/javascript" src="http://www.bioneural.net/wp-content/plugins/quoter/quoter.php?js=1"&gt;&lt;/script&gt;
&lt;style type="text/css" media="screen"&gt;
.commentlist blockquote cite { /* Fix for Kubrik theme */
	display: inline;
}
&lt;/style&gt;</code></pre>
<p>You don't need that inline CSS if you're not using Kubrik, and can remove it with this script in functions.php:</p>
<pre><code>remove_action('wp_head', 'quoter_head');</code></pre>
<p>You can then restore functionality with a much tidier JavaScript call in an appropriate place (moving any custom CSS to your CSS file):</p>
<pre><code>&lt;script type="text/javascript" src="http://www.bioneural.net/wp-content/plugins/quoter/quoter.php?js=1"&gt;&lt;/script&gt;</code></pre>
<p>The <a href="http://www.tuxlog.de/wordpress/2007/neue-version-von-wp-forecast-v10-beta/" rel="external">wp-forecast</a> plugin insists on inline CSS too. The script:</p>
<pre><code>remove_action('wp_head', 'wp_forecast_css');</code></pre>
<p>will remove a line from your head that looks something like this (again, any CSS goes in your CSS file):</p>
<pre><code>&lt;link rel="stylesheet" href="http://www.bioneural.net/wp-content/plugins/wp-forecast/wp-forecast.css" type="text/css" media="screen" /&gt;</code></pre>
<p>The K2 theme inserts some particularly messy inline CSS:</p>
<pre><code>		&lt;style type="text/css"&gt;
										#header h1 a, #header .description {
				color: #ffffff;
			}
							&lt;/style&gt;</code></pre>
<p>We can ditch this if not using custom K2 headers as follows:</p>
<pre><code>remove_action('wp_head', array('K2Header', 'output_header_css'));</code></pre>
<p class="info">Finding the right function that adds the action can involve a bit of trial-and-error. Searching plugin (or theme) code for a partial match to an unwanted string appearing in your head is a reasonable first option.</p>
<h4>The plugin alternative</h4>
<p>The Codex <a href="http://codex.wordpress.org/Theme_Development#Functions_File" rel="external">describes</a> the functions file as being "like a plugin". This turns out to be quite literal; you could take the above functions and roll your own plugin (as suggested <a href="http://wordpress.org/support/topic/140794" rel="external">here</a>). Create a file (head-cleaner.php say) containing the actions you want removing (your list may differ from mine), upload it to /wp-content/plugins/ and activate it in the usual way:</p>
<pre><code>&lt;?php

/*
Plugin Name: Head cleaner
Description: Removes unwanted clutter from the head.
*/

// Really Simple Discovery
remove_action('wp_head', 'rsd_link');
// Windows Live Writer
remove_action('wp_head', 'wlwmanifest_link');
// Quoter plugin
remove_action('wp_head', 'quoter_head');
// wp-forecast plugin
remove_action('wp_head', 'wp_forecast_css');
// K2 custom header
remove_action('wp_head', array('K2Header', 'output_header_css'));

?&gt;</code></pre>
<h4>Other head-cleaning tips</h4>
<p>Have a poke around in your theme's header.php file, and see if you can organise it a bit better.</p>
<p>I also found I could remove the following, found in the header.php of many themes, with no adverse effects:</p>
<pre><code>&lt;?php wp_get_archives('type=monthly&amp;format=link'); ?&gt;</code></pre>
<p>This script produced a whole bunch of lines in the head having the following form:</p>
<pre><code>&lt;link rel='archives' title='January 2008' href='http://www.bioneural.net/2008/01/' /&gt;</code></pre>
<p>Removing the lengthy relative links list for archives doesn't seem <a href="http://wordpress.org/support/topic/120828" rel="external">important</a> except in <a href="http://wordpress.org/support/topic/115211" rel="external">theory</a>:</p>
<blockquote><p>
The rel="archives" does not have any specific use that I am aware of. It is used to define other pages that are archives of the site in question. In other words, it's defining pages where the content on this page will be seen in the future.
</p></blockquote>
<p>Finally, some plugins may insert code that, while not necessarily disorderly, may not be just the way you like it. For example, <a href="http://www.herewithme.fr/wordpress-plugins/simple-tags" rel="external">Simple Tags</a> can automatically insert keyword metadata into the head of each and every page. You might feel, however, that it's not sensible to associate metadata with a dynamic index page that temporarily contains tagged posts on a variety of topics. You could therefore make metadata insertion conditional, using Simple Tags manually as follows:</p>
<pre><code>&lt;?php if ( function_exists('st_meta_keywords') and is_single() ) { ?&gt;
	&lt;?php st_meta_keywords(); ?&gt;
&lt;?php } ?&gt;</code></pre>
<p>Alternatively, if you shun dependence on plugins you may want to use built-in WordPress functions, as detailed <a href="http://wordpress.org/support/topic/141783">here</a>:</p>
<pre><code>&lt;?php /* Get the meta keywords */ global $post;
if( is_single() || is_page() ) :
	$tags = get_the_tags($post-&gt;ID);
	if($tags) :
		foreach($tags as $tag) :
			$sep = (empty($keywords)) ? '' : ', ';
			$keywords .= $sep . $tag-&gt;name;
		endforeach;
?&gt;
&lt;meta name="keywords" content="&lt;?php echo $keywords; ?&gt;" /&gt;
&lt;?php
	endif;
endif;
?&gt;</code></pre>
<p>It looks like a lot more code, but remember it will still produce just the one line meta element.</p>
<p>That's enough. Too much of this sort of thing <span style="text-decoration: line-through;">cleanly</span> clearly does my head in.</p>
<img src="http://www.bioneural.net/ff309e51/26673f11/CCBot/1.0 (+http://www.commoncrawl.org/bot.html).gif" />]]></description>
		<wfw:commentRss>http://www.bioneural.net/feeder/?FeederAction=clicked&amp;feed=Articles+%28RSS2%29&amp;seed=http%3A%2F%2Fwww.bioneural.net%2F2008%2F01%2F12%2Fspring-clean-your-wordpress-head%2F&amp;seed_title=Spring+clean+your+WordPress+head/feed/</wfw:commentRss>
		<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/2.5/</creativeCommons:license>
	</item>
		<item>
		<title>An exercise in wireless frustration</title>
		<link>http://www.bioneural.net/feeder/?FeederAction=clicked&amp;feed=Articles+%28RSS2%29&amp;seed=http%3A%2F%2Fwww.bioneural.net%2F2008%2F01%2F11%2Fan-exercise-in-wireless-frustration%2F&amp;seed_title=An+exercise+in+wireless+frustration</link>
		<comments>http://www.bioneural.net/feeder/?FeederAction=clicked&amp;feed=Articles+%28RSS2%29&amp;seed=http%3A%2F%2Fwww.bioneural.net%2F2008%2F01%2F11%2Fan-exercise-in-wireless-frustration%2F&amp;seed_title=An+exercise+in+wireless+frustration#comments</comments>
		<pubDate>Fri, 11 Jan 2008 14:17:34 +0000</pubDate>
		<dc:creator>Bruce</dc:creator>
		
		<category><![CDATA[Mac]]></category>

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

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

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

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

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

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

		<guid isPermaLink="false">http://www.bioneural.net/2008/01/11/an-exercise-in-wireless-frustration/</guid>
		<description><![CDATA[<p><a href="http://creativecommons.org/licenses/by-nc-sa/2.5/" rel="license" title="This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 2.5 License"><img src="http://www.bioneural.net/wp-content/themes/k2bn/styles/bioneural/cc.png" alt="CC" /></a> From <a href="http://www.bioneural.net/about/terms/">bioneural.net</a>:</p><p>Having spent the better part of two half days trying to achieve the impossible, I wish to recount an exercise in wireless frustration. The challenge was to hook up an iMac G4 (Flat Panel) with no Airport Card, located in the attic room, to my home LAN (and thus to the Internet). One purpose of this machine was to serve as a screen for streamed video that could be watched while using the exercise cycle. A TV had provided such distraction, but that had broke. To cement the challenge, the problem should be solved using equipment already to hand i.e. at no additional cost.<br />
<span id="more-770"></span></p>
<p>My "BeBox", the hub of my home LAN, is actually a SpeedTouch 780WL WiFi router/ ADSL modem. The router's wireless access point (<a href="http://en.wikipedia.org/wiki/Wireless_Access_Point" rel="external">WAP</a>) offers 802.11b/g, which is secured with Wi-Fi Protected Access (<a href="http://en.wikipedia.org/wiki/Wi-Fi_Protected_Access" rel="external">WPA</a>) encryption&mdash;the earlier Wired Equivalent Privacy (<a href="http://en.wikipedia.org/wiki/Wired_Equivalent_Privacy" rel="external">WEP</a>) standard is considered insecure.</p>
<h4>A slow, insecure option that worked</h4>
<p><img src="http://www.bioneural.net/wp-content/uploads/2008/01/case1.jpg" width="440" height="79" alt="case 1" /></p>
<p>It's worth noting that the original Apple Aiport Card appropriate for this machine can still be had on eBay for &pound;30&ndash;40. Although this card is WPA-aware, it is only 802.11b (11Mbps) and thus not suitable for streaming. I know this to be so because the first device I tried was the Linksys WET11, a wireless Ethernet bridge. For the record, because it took me some time to discover, this device has a factory-default IP of 192.168.1.225. However, before you can connect to it using Safari (or any other browser), you need to manually assign your Mac an IP address in the same range and subnet (255.255.255.0). </p>
<p>Wireless bridging between the BeBox and WET11 "just worked", without any complicated configuration. However, video streamed locally from/to VLC was intermittently pixelated and my 17Mbps downstream broadband was somewhat choked for streaming Internet video.</p>
<h4>A fast, secure option that didn't work</h4>
<p><img src="http://www.bioneural.net/wp-content/uploads/2008/01/case2.jpg" width="440" height="86" alt="case 2" /></p>
<p>I also had an Apple AirPort Express (AX) lying around. As Apple <a href="http://docs.info.apple.com/article.html?artnum=107454" rel="external">state</a> in their configuration walkthrough for Mac OS X 10.4 (Tiger):</p>
<blockquote><p>
Using the wireless distribution system (WDS) feature, you can set up two to five base stations as a unified network that shares one Internet connection.
</p></blockquote>
<p><a href="http://en.wikipedia.org/wiki/Wireless_Distribution_System" rel="external">WDS</a> sounded ideal, giving an expensive and complex Apple product the functionality of a cheap and simple wireless Ethernet bridge. I factory-<a href="http://docs.info.apple.com/article.html?artnum=108044" rel="external">reset</a> the AX and consulted various online descriptions and found <a href="http://discussions.apple.com/message.jspa?messageID=6249417#6249417" rel="external">this</a> one most helpful.</p>
<p class="info">I had to configure the AX for WDS on another Mac running Leopard because AirPort Admin Utility on the iMac, although running Tiger, warned "Joining a WPA-protected network and making changes to a WPA-protected base station requires a WPA capable computer. This computer is not WPA capable. If you continue you will not be able to join the WPA-protected network or make changes to the WPA-protected base station."</p>
<p>After much wasted effort, with Google's assistance I learned that the SpeedTouch 780 doesn't support the combination of WDS and WPA, although will work with WDS and WEP. Downgrading my network security to WEP 24/7 is just too much of a compromise.</p>
<p><img src="http://www.bioneural.net/wp-content/uploads/2008/01/bugger.jpg" width="450" height="187" alt="No WPA + WDS" /></p>
<h4>A fast, part-time insecure option that worked</h4>
<p><img src="http://www.bioneural.net/wp-content/uploads/2008/01/case3.jpg" width="440" height="86" alt="case 3" /></p>
<p>Because I wasn't configuring WPA, I set up the AX from the iMac&mdash;so the following screen captures reflect AirPort Admin running under 10.4.11. First up, the AirPort tab:</p>
<ol>
<li>Name your AX base station;</li>
<li>Change the AX password;</li>
<li>Set Wireless Mode to Create a Wireless Network;</li>
<li>Name your AX network;</li>
<li>Do not enable wireless security (unless you want to use WEP, which is nearly the same as using none);</li>
<li>Set the Channel to the same channel your SpeedTouch 780 is using;</li>
<li>Check Create a closed network.</li>
</ol>
<p><img src="http://www.bioneural.net/wp-content/uploads/2008/01/airport1.jpg" width="450" height="410" alt="airport tab" /></p>
<p>Next is the Internet tab:</p>
<ol>
<li>Connect using AirPort (WDS);</li>
<li>Enter the MAC (physical) address of your WAP (see Home &gt; Home Network &gt; Interfaces &gt; WLAN: [YourWLAN]);</li>
<li>Uncheck Also allow wireless client computers (we only want the hard-wired iMac to connect);</li>
<li>Configure using DHCP (the iMac and AX will be assigned IP addresses by the SpeedTouch).</li>
</ol>
<p><img src="http://www.bioneural.net/wp-content/uploads/2008/01/airport2.jpg" width="450" height="410" alt="internet tab" /></p>
<p>Now comes the Network tab:</p>
<ol>
<li>Make sure Distribute IP addresses is unchecked.</li>
</ol>
<p><img src="http://www.bioneural.net/wp-content/uploads/2008/01/airport3.jpg" width="450" height="410" alt="network tab" /></p>
<p>Finally, the WDS tab:</p>
<ol>
<li>Check Enable this base station as a remote base station;</li>
<li>Confirm the MAC address of your main router is shown;</li>
<li>Click Update to restart the AX.</li>
</ol>
<p><img src="http://www.bioneural.net/wp-content/uploads/2008/01/airport1.jpg" width="450" height="412" alt="wds tab" /></p>
<p>One more step. I also needed to enable WDS for the AirPort in the SpeedTouch settings. Make sure WDS is enabled and check the box next to your AX base station name and click Apply:</p>
<p><img src="http://www.bioneural.net/wp-content/uploads/2008/01/wds-speedtouch.jpg" width="450" height="195" alt="router settings" /></p>
<p>It now works&mdash;but only if I temporarily disable encryption (both network names remain hidden, however, and new wireless clients are not allowed). Sometimes, no matter how persistent you may be, you can't have everything.</p>
<img src="http://www.bioneural.net/ff309e51/26673f11/CCBot/1.0 (+http://www.commoncrawl.org/bot.html).gif" />]]></description>
		<wfw:commentRss>http://www.bioneural.net/feeder/?FeederAction=clicked&amp;feed=Articles+%28RSS2%29&amp;seed=http%3A%2F%2Fwww.bioneural.net%2F2008%2F01%2F11%2Fan-exercise-in-wireless-frustration%2F&amp;seed_title=An+exercise+in+wireless+frustration/feed/</wfw:commentRss>
		<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/2.5/</creativeCommons:license>
	</item>
		<item>
		<title>Desaturating menu bar icons</title>
		<link>http://www.bioneural.net/feeder/?FeederAction=clicked&amp;feed=Articles+%28RSS2%29&amp;seed=http%3A%2F%2Fwww.bioneural.net%2F2007%2F12%2F06%2Fdesaturating-menu-bar-icons%2F&amp;seed_title=Desaturating+menu+bar+icons</link>
		<comments>http://www.bioneural.net/feeder/?FeederAction=clicked&amp;feed=Articles+%28RSS2%29&amp;seed=http%3A%2F%2Fwww.bioneural.net%2F2007%2F12%2F06%2Fdesaturating-menu-bar-icons%2F&amp;seed_title=Desaturating+menu+bar+icons#comments</comments>
		<pubDate>Thu, 06 Dec 2007 08:11:19 +0000</pubDate>
		<dc:creator>Bruce</dc:creator>
		
		<category><![CDATA[Mac]]></category>

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

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

		<guid isPermaLink="false">http://www.bioneural.net/2007/12/06/desaturating-menu-bar-icons/</guid>
		<description><![CDATA[<p><a href="http://creativecommons.org/licenses/by-nc-sa/2.5/" rel="license" title="This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 2.5 License"><img src="http://www.bioneural.net/wp-content/themes/k2bn/styles/bioneural/cc.png" alt="CC" /></a> From <a href="http://www.bioneural.net/about/terms/">bioneural.net</a>:</p><p>The bright orange menu bar icon for Missing Sync sat in my Leopard menu bar next to Google Notifier, the latter turning from an unobtrusive grey to attention-grabbing red when it had something to tell me (the arrival of unread Google Mail). I found my eye wandering needlessly to the Missing Sync icon, so decided to hack out that distracting brightness.<br />
<span id="more-739"></span></p>
<p>All the other menu bar icons on my Mac are greyscale&mdash;unless they have something to report. But not the icon for Missing Sync 6.0.2b:</p>
<p><img src="http://www.bioneural.net/wp-content/uploads/2007/12/before.jpg" width="112" height="33" alt="Before" /></p>
<ol>
<li>Find Missing Sync Menu Bar.app in /Applications/Missing Sync for Palm OS/Missing Sync for Palm OS.app/Contents/SharedSupport;</li>
<li>Right-click to Show Package Contents and look in the Resources folder to find five files with a .tif extension;</li>
<li>Double-click to open each image individually using Preview and choose Tools &gt; Adjust Color;</li>
<li>Move the Saturation slider all the way left and close the inspector window and the image, saving when prompted.</li>
</ol>
<p><img src="http://www.bioneural.net/wp-content/uploads/2007/12/adjust.jpg" width="450" height="321" alt="Adjust" /></p>
<p>On restarting your computer the Missing Sync menu bar icon should be desaturated&mdash;and a lot less full of it's own importance!</p>
<p><img src="http://www.bioneural.net/wp-content/uploads/2007/12/after.jpg" width="112" height="33" alt="After" /></p>
<img src="http://www.bioneural.net/ff309e51/26673f11/CCBot/1.0 (+http://www.commoncrawl.org/bot.html).gif" />]]></description>
		<wfw:commentRss>http://www.bioneural.net/feeder/?FeederAction=clicked&amp;feed=Articles+%28RSS2%29&amp;seed=http%3A%2F%2Fwww.bioneural.net%2F2007%2F12%2F06%2Fdesaturating-menu-bar-icons%2F&amp;seed_title=Desaturating+menu+bar+icons/feed/</wfw:commentRss>
		<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/2.5/</creativeCommons:license>
	</item>
		<item>
		<title>Setting up Gmail IMAP on iPhone + Mail</title>
		<link>http://www.bioneural.net/feeder/?FeederAction=clicked&amp;feed=Articles+%28RSS2%29&amp;seed=http%3A%2F%2Fwww.bioneural.net%2F2007%2F10%2F24%2Fsetting-up-gmail-imap-on-iphone-mail%2F&amp;seed_title=Setting+up+Gmail+IMAP+on+iPhone+%2B+Mail</link>
		<comments>http://www.bioneural.net/feeder/?FeederAction=clicked&amp;feed=Articles+%28RSS2%29&amp;seed=http%3A%2F%2Fwww.bioneural.net%2F2007%2F10%2F24%2Fsetting-up-gmail-imap-on-iphone-mail%2F&amp;seed_title=Setting+up+Gmail+IMAP+on+iPhone+%2B+Mail#comments</comments>
		<pubDate>Wed, 24 Oct 2007 13:36:27 +0000</pubDate>
		<dc:creator>Bruce</dc:creator>
		
		<category><![CDATA[Quicklinks]]></category>

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

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

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

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

		<guid isPermaLink="false">http://www.bioneural.net/2007/10/24/setting-up-gmail-imap-on-iphone-mail/</guid>
		<description><![CDATA[<p><a href="http://creativecommons.org/licenses/by-nc-sa/2.5/" rel="license" title="This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 2.5 License"><img src="http://www.bioneural.net/wp-content/themes/k2bn/styles/bioneural/cc.png" alt="CC" /></a> From <a href="http://www.bioneural.net/about/terms/">bioneural.net</a>:</p><p><a href="http://mail.google.com" rel="external">Gmail</a> have begun offering <a href="http://en.wikipedia.org/wiki/Internet_Message_Access_Protocol" rel="external">IMAP</a> on some accounts, providing a number of <a href="http://mail.google.com/support/bin/answer.py?ctx=gmail&amp;hl=en&amp;answer=75725" rel="external">advantages</a>. Derek at 5ThirtyOne offers <a href="http://5thirtyone.com/archives/862" rel="external">advice</a> for configuring the service to work better with Apple <a href="http://www.apple.com/la/macosx/features/mail/" rel="external">Mail</a> and <a href="http://www.apple.com/iphone/" rel="external">iPhone</a>.</p>
<img src="http://www.bioneural.net/ff309e51/26673f11/CCBot/1.0 (+http://www.commoncrawl.org/bot.html).gif" />]]></description>
		<wfw:commentRss>http://www.bioneural.net/feeder/?FeederAction=clicked&amp;feed=Articles+%28RSS2%29&amp;seed=http%3A%2F%2Fwww.bioneural.net%2F2007%2F10%2F24%2Fsetting-up-gmail-imap-on-iphone-mail%2F&amp;seed_title=Setting+up+Gmail+IMAP+on+iPhone+%2B+Mail/feed/</wfw:commentRss>
		<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/2.5/</creativeCommons:license>
	</item>
		<item>
		<title>Implementing the hCard microformat</title>
		<link>http://www.bioneural.net/feeder/?FeederAction=clicked&amp;feed=Articles+%28RSS2%29&amp;seed=http%3A%2F%2Fwww.bioneural.net%2F2007%2F08%2F17%2Fimplementing-the-hcard-microformat%2F&amp;seed_title=Implementing+the+hCard+microformat</link>
		<comments>http://www.bioneural.net/feeder/?FeederAction=clicked&amp;feed=Articles+%28RSS2%29&amp;seed=http%3A%2F%2Fwww.bioneural.net%2F2007%2F08%2F17%2Fimplementing-the-hcard-microformat%2F&amp;seed_title=Implementing+the+hCard+microformat#comments</comments>
		<pubDate>Fri, 17 Aug 2007 11:12:23 +0000</pubDate>
		<dc:creator>Bruce</dc:creator>
		
		<category><![CDATA[Internet]]></category>

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

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

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

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

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

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

		<guid isPermaLink="false">http://www.bioneural.net/2007/08/17/implementing-the-hcard-microformat/</guid>
		<description><![CDATA[<p><a href="http://creativecommons.org/licenses/by-nc-sa/2.5/" rel="license" title="This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 2.5 License"><img src="http://www.bioneural.net/wp-content/themes/k2bn/styles/bioneural/cc.png" alt="CC" /></a> From <a href="http://www.bioneural.net/about/terms/">bioneural.net</a>:</p><p><a href="http://microformats.org/wiki/hcard" rel="external">hCard</a> is a semantic web-friendly derivative of vCard (as used to import/ export from the Mac OS X <a href="http://www.apple.com/macosx/features/addressbook/" rel="external">Address Book</a>). This post is a short "how to" describing a method for adding contact information to your blog posts in a cross-platform format that your readers can store without effort.<br />
<span id="more-701"></span></p>
<p>The RSS client <a href="http://www.newsgator.com/Individuals/NetNewsWire/Default.aspx" rel="external">NetNewsWire</a> now detects microformats&mdash;<a href="http://microformats.org/wiki/hcard" rel="external">hCard</a>/ <a href="http://en.wikipedia.org/wiki/VCard" rel="external">vCard</a> for contacts and <a href="http://microformats.org/wiki/hcalendar" rel="external">hCalender</a> for calendar events. I noticed that the odd site has started displaying the tell-tale icon indicating associated contact information:</p>
<p><img src="http://www.bioneural.net/wp-content/uploads/2007/08/icon-hcard-add.png" height="18" width="29" alt="Icon-Hcard-Add" /></p>
<h4>Adding hCard to your posts</h4>
<p>I wanted my hCard to be available from any page in my site, so I added the following code to my WordPress footer.php template:</p>
<pre><code>&lt;p class="vcard" id="hcard-Bruce-McKenzie" style="display: none;"&gt;
	&lt;img class="photo" src="data:image/jpeg;base64,/9j/4AAQ...[edited]...gK6D//2Q==" alt="Photo of Bruce McKenzie" /&gt;
	 &lt;a class="url fn" href="http://www.bioneural.net/contact/"&gt;Bruce McKenzie&lt;/a&gt; is a &lt;span class="title"&gt;General Practitioner&lt;/span&gt; based in &lt;span class="adr"&gt;&lt;a class="url" href="http://maps.google.com/maps?q=wellington,+new+zealand"&gt;&lt;span class="locality"&gt;Wellington&lt;/span&gt;&lt;/a&gt;, &lt;span class="country-name"&gt;New Zealand&lt;/span&gt;.&lt;/span&gt;
	 He blogs at &lt;a class="url" href="http://www.bioneural.net"&gt;bioneural.net&lt;/a&gt; (&lt;a class="url" href="http://feeds.feedburner.com/bioneuralnet"&gt;feed&lt;/a&gt;) and can be contacted (&lt;span class="tz"&gt;+12:00&lt;/span&gt; UTC) as &lt;span class="note"&gt;&lt;a href="skype:b%2Emckenzie?chat"&gt;b.mckenzie&lt;/a&gt; on Skype&lt;/span&gt;.
&lt;/p&gt;</code></pre>
<p>Notice that the paragraph containing my hCard data is styled out so that it doesn't display at the footer of my page:</p>
<p><img src="http://www.bioneural.net/wp-content/uploads/2007/08/footer.jpg" height="50" width="450" alt="Footer" /></p>
<p>If CSS is disabled, however, the hCard information is revealed to the world and the use of "<a href="http://adactio.com/journal/1122/" rel="external">natural language</a>" makes things human-readable:</p>
<p><img src="http://www.bioneural.net/wp-content/uploads/2007/08/footer_nocss.jpg" height="26" width="450" alt="Footer Nocss" /></p>
<p class="info"><em>Tip</em>: An easy way to encode a photo is to e-mail yourself a JPEG photo then select the message in <a href="http://www.apple.com/macosx/features/mail/" rel="external">Mail</a> and choose <em>View</em> &gt; <em>Message</em> &gt; <em>Raw source</em>. Now copy the base64-encoded text block into the image <em>scr</em>, adding a "<em>data:image/jpeg;base64,</em>" prefix.</p>
<h4>Accessing hCard via NetNewsWire</h4>
<p>At this point when readers use NetNewsWire to read one of your posts your hCard should be automatically detected, although it appears that not all of the specification is supported. They can select to download your contact details via the drop-down menu:</p>
<p><img src="http://www.bioneural.net/wp-content/uploads/2007/08/nnwire-hcard.jpg" height="81" width="229" alt="Nnwire-Hcard" /></p>
<p>Selecting your name will open a dialogue box asking if the person should be added to your Address Book. If you confirm, the person will be added as a contact:</p>
<p><img src="http://www.bioneural.net/wp-content/uploads/2007/08/nnwire-add.jpg" height="178" width="450" alt="Nnwire-Add" /></p>
<h4>Making your hCard browser-friendly</h4>
<p>If visitors are viewing your posts with a browser like Safari, they won't know you have microformats hidden in your code. Luckily it's easy to add a visual indicator that can be used to extract your hCard data and convert it into a vCard for download; you don't need to host a separate vCard file on your server. Using the beta <a href="http://feeds.technorati.com/contacts/" rel="external">Technorati Contacts Feed Service</a> service and some JavaScript, we can include the following code (again, this went into my footer, but it could go anywhere):</p>
<pre><code>&lt;a href="javascript:void(location.href='http://feeds.technorati.com/contacts/'+escape(location.href))" title="Download vCard for Bruce McKenzie"&gt;&lt;img src="&lt;?php bloginfo('template_directory'); ?&gt;/styles/bioneural/vcard_add.png" alt="vCard" /&gt;&lt;/a&gt;</code></pre>
<p>The user just needs to click on the vCard icon. The resulting hCard-contacts.vcf file (in your default downloads location) can now be imported into Address Book:</p>
<p><img src="http://www.bioneural.net/wp-content/uploads/2007/08/vcard.jpg" height="299" width="370" alt="Vcard" /></p>
<p>Notice that, on this occasion, the encoded photo is imported and the source of the data is recorded (the URL of the actual page used for the download).</p>
<p class="info"><a href="mailto:https://addons.mozilla.org/de/firefox/addon/4106">Tip</a>: The <a href="https://addons.mozilla.org/de/firefox/addon/4106" rel="external">Operator</a> add-on for Firefox detects embedded microformats&mdash;although it does seem to slow page loading significantly and doesn't handle the encoded image.</p>
<img src="http://www.bioneural.net/ff309e51/26673f11/CCBot/1.0 (+http://www.commoncrawl.org/bot.html).gif" />]]></description>
		<wfw:commentRss>http://www.bioneural.net/feeder/?FeederAction=clicked&amp;feed=Articles+%28RSS2%29&amp;seed=http%3A%2F%2Fwww.bioneural.net%2F2007%2F08%2F17%2Fimplementing-the-hcard-microformat%2F&amp;seed_title=Implementing+the+hCard+microformat/feed/</wfw:commentRss>
		<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/2.5/</creativeCommons:license>
	</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 1.431 seconds -->
