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

<channel>
	<title>Brian Hogg &#124; Blog</title>
	<atom:link href="http://brianhogg.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://brianhogg.com</link>
	<description>Programming and other bits.</description>
	<lastBuildDate>Fri, 16 Dec 2011 21:42:35 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>How to access a FileValut 2 encrypted drive using Lion Recovery</title>
		<link>http://brianhogg.com/2011/12/02/how-to-access-a-filevalut-2-encrypted-drive-using-lion-recovery/</link>
		<comments>http://brianhogg.com/2011/12/02/how-to-access-a-filevalut-2-encrypted-drive-using-lion-recovery/#comments</comments>
		<pubDate>Fri, 02 Dec 2011 18:04:43 +0000</pubDate>
		<dc:creator>bhcadmin</dc:creator>
				<category><![CDATA[Mac OSX]]></category>

		<guid isPermaLink="false">http://brianhogg.com/?p=27</guid>
		<description><![CDATA[After upgrading from 10.7.1 to 10.7.2 with the hard drive encrypted with FileVault 2, the system would not boot (displayed a circle with a line through it). After searching I found a thread that seemed to point to PGP still having some parts left around, even though I wasn&#8217;t using PGP Whole Disk Encryption (WDE) [...]]]></description>
			<content:encoded><![CDATA[<p>After upgrading from 10.7.1 to 10.7.2 with the hard drive encrypted with FileVault 2, the system would not boot (displayed a circle with a line through it).  After searching I <a href="https://discussions.apple.com/thread/3374161?start=0&#038;tstart=0">found a thread</a> that seemed to point to PGP still having some parts left around, even though I wasn&#8217;t using PGP Whole Disk Encryption (WDE) anymore thanks to FileValut 2.</p>
<p>Unfortunately I could not seem to access to the files because a) the system would not boot and b) the system was encrypted with FileValut 2.  Calling Apple didn&#8217;t yield a solution except re-formatting the machine and losing all data, but stumbled upon a way to not have to do that:</p>
<p>1. Restart the machine and hold Cmd+R to restart in Recovery Mode<br />
2. Under the Apple menu (top-left) select &#8216;Startup Disk&#8230;&#8217;<br />
3. Click on your encrypted disk, then click &#8216;Unlock&#8230;&#8217; (mine is labelled &#8216;Macintosh HD&#8217;)<br />
4. Enter the password of a user who can normally start up the machine and click &#8216;Unlock&#8217;<br />
5. Hit Cmd+Q or go to Startup Disk menu and choose Quit Startup Disk<br />
6. Under the Utilities menu, choose Terminal<br />
7. Type <code>cd /Volumes/Macintosh\ HD</code> (enter the name of your drive instead of Macintosh HD) and hit enter</p>
<p>Voila, now you have access to all of your files on the encrypted drive!</p>
]]></content:encoded>
			<wfw:commentRss>http://brianhogg.com/2011/12/02/how-to-access-a-filevalut-2-encrypted-drive-using-lion-recovery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress Plugin Repository not updating</title>
		<link>http://brianhogg.com/2011/11/09/wordpress-plugin-repository-not-updating/</link>
		<comments>http://brianhogg.com/2011/11/09/wordpress-plugin-repository-not-updating/#comments</comments>
		<pubDate>Wed, 09 Nov 2011 23:36:24 +0000</pubDate>
		<dc:creator>bhcadmin</dc:creator>
				<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://brianhogg.com/?p=24</guid>
		<description><![CDATA[When pushing a recent update to the Weever Apps plugin, the version number did not seem to be updating. Most documentation mentions updating the readme.txt file, but not the main plugin file version number also. Without updating both the new version will appear in the dropdown and as &#8216;development version,&#8217; but not as the main [...]]]></description>
			<content:encoded><![CDATA[<p>When pushing a recent update to the <a href="http://wordpress.org/extend/plugins/weever-apps-for-wordpress/">Weever Apps plugin</a>, the version number did not seem to be updating.  Most <a href="http://wordpress.org/extend/plugins/about/svn/">documentation</a> mentions updating the readme.txt file, but not the main plugin file version number also.  Without updating both the new version will appear in the dropdown and as &#8216;development version,&#8217; but not as the main downloadable file.</p>
<p>Moral of the story, update both or risk losing some hair!</p>
<p>More detail <a href="http://wordpress.org/support/topic/plugin-repository-not-updating-version?replies=2">here</a>.  If you still have issues you should be able to e-mail <a href="mailto:plugins@wordpress.org">plugins@wordpress.org</a> for assistance (though certainly try the forums first).</p>
]]></content:encoded>
			<wfw:commentRss>http://brianhogg.com/2011/11/09/wordpress-plugin-repository-not-updating/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress AJAX response codes using status_header</title>
		<link>http://brianhogg.com/2011/09/25/wordpress-ajax-response-codes-using-status_header/</link>
		<comments>http://brianhogg.com/2011/09/25/wordpress-ajax-response-codes-using-status_header/#comments</comments>
		<pubDate>Sun, 25 Sep 2011 13:28:50 +0000</pubDate>
		<dc:creator>bhcadmin</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://brianhogg.com/?p=21</guid>
		<description><![CDATA[As I&#8217;m relatively new to WordPress plugin development, I&#8217;m constantly searching around for the cleanest and most &#8220;WordPress way&#8221; to do things. One function that helps write cleaner AJAX call handlers is status_header(), to inform the caller when things go wrong: and in the javascript using success and failure functions rather than deconstructing response text: [...]]]></description>
			<content:encoded><![CDATA[<p>As I&#8217;m relatively new to WordPress plugin development, I&#8217;m constantly searching around for the cleanest and most &#8220;WordPress way&#8221; to do things.  One function that helps write cleaner AJAX call handlers is <a href="http://codex.wordpress.org/Function_Reference/status_header">status_header()</a>, to inform the caller when things go wrong:</p>
<pre class="brush: php; title: ; notranslate">
add_action( 'wp_ajax_myajaxaction', 'my_ajax_handler' );

function my_ajax_handler() {
    if ( ! empty($_POST) and check_ajax_referer( 'mynonce', 'nonce' ) ) {

        if ( things_go_wrong ) {
            status_header( 500 );
            echo &quot;some informative message or code&quot;;
        }

        // ...
    }
}
</pre>
<p>and in the javascript using success and failure functions rather than deconstructing response text:</p>
<pre class="brush: jscript; title: ; notranslate">
var nonce = jQuery(&quot;input#nonce&quot;).val();

jQuery.ajax({
   type: &quot;POST&quot;,
   url: ajaxurl,
   data: {
	   name: encodeURIComponent(tabName),
	   id: tabId,
	   mynonce: nonce,
	   action: 'myajaxaction'
         },
	 success: function(msg) {
               // Handle a successful call
	 },
	 error: function(v,msg) {
            // Handle the error, with the text in msg
         }
});
</pre>
<p>You could also <a href="http://php.net/manual/en/function.header.php">output the headers manually</a>, but this gives a nice clean way to do it.</p>
]]></content:encoded>
			<wfw:commentRss>http://brianhogg.com/2011/09/25/wordpress-ajax-response-codes-using-status_header/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery Validator Plugin with a Custom Validation Function and Dependency Selectors</title>
		<link>http://brianhogg.com/2011/09/20/jquery-validator-plugin-with-custom-validation/</link>
		<comments>http://brianhogg.com/2011/09/20/jquery-validator-plugin-with-custom-validation/#comments</comments>
		<pubDate>Tue, 20 Sep 2011 22:31:20 +0000</pubDate>
		<dc:creator>bhcadmin</dc:creator>
				<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://brianhogg.com/?p=6</guid>
		<description><![CDATA[The jQuery validator plugin is a great way to add validation to forms in a clean way.  Error messages shown and hidden when they attempt to submit, and on the fly when they correct the input. I recently added a new validation function to see if the field they entered was a valid twitter hashtag or [...]]]></description>
			<content:encoded><![CDATA[<p>The <a href="http://bassistance.de/jquery-plugins/jquery-plugin-validation/" target="_blank">jQuery validator plugin</a> is a great way to add validation to forms in a clean way.  Error messages shown and hidden when they attempt to submit, and on the fly when they correct the input.</p>
<p>I recently added a new validation function to see if the field they entered was a valid twitter hashtag or username.  Though it could be improved (ie. looking for spaces), it does the job initially.  The problem was that the same field name was used for both depending on the value of another dropdown.</p>
<p>To handle enabling or disabling the validation function based on a certain condition, I initially thought you just pass in true or false, such as you do with required:</p>
<pre class="brush: jscript; title: ; notranslate">
jQuery('#socialAdminForm').validate({
    rules: {
        component: { twitteruserrequired: true }
    }
    // ...
</pre>
<p>However the the 3rd parameter (which I&#8217;ve labelled, &#8216;isactive&#8217;) needs to be evaluated based on the condition, as the boolean value is passed in here. Here&#8217;s an example that determines whether or not to use the validation function based on the select element with id wx-select-social:</p>
<pre class="brush: jscript; title: ; notranslate">
jQuery.validator.addMethod('twitteruserrequired', function(value, element, isactive) {
    return !isactive || (value.trim() != '@' &amp;amp;&amp;amp; value.substr(0, 1) == '@');
}, &quot;Please enter a valid value&quot;);

jQuery.validator.addMethod('twitterhashtagrequired', function(value, element, isactive) {
    return !isactive || (value.trim() != '#' &amp;amp;&amp;amp; value.substr(0, 1) == '#');
}, &quot;Please enter a valid value&quot;);

jQuery('#socialAdminForm').validate({
    rules: {
        component: { required: true },
        name: { required: true },
        &quot;component_behaviour&quot;: { required: true, twitteruserrequired: function(element) {
                return (jQuery(&quot;select#wx-select-social&quot;).val() == 'twitteruser');
            }, twitterhashtagrequired: function(element) {
                return (jQuery(&quot;select#wx-select-social&quot;).val() == 'twitterhashtag');
            }
        } }
    }
    // ...
</pre>
<p>Without the third parameter of the function in addMethod being evaluated for true or false, the validation function will always execute.</p>
]]></content:encoded>
			<wfw:commentRss>http://brianhogg.com/2011/09/20/jquery-validator-plugin-with-custom-validation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

