<?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>CM</title>
	<atom:link href="http://corymathews.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://corymathews.com</link>
	<description>Things I should remember and then some...</description>
	<lastBuildDate>Thu, 26 Jan 2012 16:27:17 +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>jQuery Custom Events</title>
		<link>http://corymathews.com/jquery-custom-events/</link>
		<comments>http://corymathews.com/jquery-custom-events/#comments</comments>
		<pubDate>Wed, 18 Jan 2012 19:01:23 +0000</pubDate>
		<dc:creator>CoryMathews</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://corymathews.com/?p=872</guid>
		<description><![CDATA[We are used to javascript events such as a &#8220;click&#8221; being handled similar to the following: $('#id').on(&#34;click&#34;, function() { alert(&#34;Item clicked&#34;); }); But less common is the use of custom events available with the .trigger() and .triggerHandler() jQuery functions. With this I could create an event such as &#8220;cory.says.hello&#8221;, if I so wished and then [...]]]></description>
			<content:encoded><![CDATA[<p>We are used to javascript events such as a &#8220;click&#8221; being handled similar to the following:</p>
<pre class="prettyprint linenumstrigger linenums">
$('#id').on(&quot;click&quot;, function() {
    alert(&quot;Item clicked&quot;);
});
</pre>
<p>But less common is the use of custom events available with the <a href="http://api.jquery.com/trigger/">.trigger()</a> and <a href="http://api.jquery.com/triggerHandler/">.triggerHandler()</a> jQuery functions. With this I could create an event such as &#8220;cory.says.hello&#8221;, if I so wished and then handle it with </p>
<pre class="prettyprint linenumstrigger linenums">
$('#id').on(&quot;cory.says.hello&quot;, function() {
    alert(&quot;Hello Cory&quot;);
});
</pre>
<h2> Usage</h2>
<p>So you are writting a lightbox plugin (or whatever plugin really), and you want to give anyone the ability to add additional logic when the lightbox opens. Of the many ways to allow them to do this an easy way is to create a custom event for them to handle.</p>
<p>So continuing with the lightbox example, you could add an event when you open the lightbox with something like:</p>
<pre class="prettyprint linenumstrigger linenums">
function open() {
  //blah
  $('#id')triggerHandler({ type:&quot;lightbox.open&quot; });
  //more
}
</pre>
<p>which could then later be caught by anyone using your plugin like so:</p>
<pre class="prettyprint linenumstrigger linenums">
$(function() {
  $('#id').on(&quot;lightbox.open&quot;, function() {
    alert(&quot;The lightbox just opened. Woo!&quot;);
  });
});
</pre>
<p>Nice and simplistic. What about passing variables to the event handler? Maybe I want to run an event on an ajax response or whatever the case may be. </p>
<pre class="prettyprint linenumstrigger linenums">
  $('#id').triggerHandler({
    type:&quot;lightbox.open&quot;,
    var1:'Howdy',
    information:'I could pass something here also'
  });
</pre>
<p>Then to get the var1, and information data out of the previous example we would do:</p>
<pre class="prettyprint linenumstrigger linenums">
$(function() {
  $('#id').on(&quot;lightbox.open&quot;, function(o) {
    alert(o.var1 + &quot; - &quot; + o.information);
  });
});
</pre>
<h2>Differences between .trigger() and .triggerHandler()</h2>
<p>The differences between the two are pretty small, but still important. To quote the jQuery Docs:</p>
<blockquote><p>
The .triggerHandler() method behaves similarly to .trigger(), with the following exceptions:</p>
<ul>
<li>The .triggerHandler() method does not cause the default behavior of an event to occur (such as a form submission).</li>
<li>While .trigger() will operate on all elements matched by the jQuery object, .triggerHandler() only affects the first matched element.</li>
<li>Events created with .triggerHandler() do not bubble up the DOM hierarchy; if they are not handled by the target element directly, they do nothing.</li>
<li>Instead of returning the jQuery object (to allow chaining), .triggerHandler() returns whatever value was returned by the last handler it caused to be executed. If no handlers are triggered, it returns undefined</li>
</ul>
</blockquote>
]]></content:encoded>
			<wfw:commentRss>http://corymathews.com/jquery-custom-events/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Using Quartz.Net to Create Scheduled Tasks</title>
		<link>http://corymathews.com/using-quartz-net-to-create-scheduled-tasks/</link>
		<comments>http://corymathews.com/using-quartz-net-to-create-scheduled-tasks/#comments</comments>
		<pubDate>Mon, 09 Jan 2012 16:07:50 +0000</pubDate>
		<dc:creator>CoryMathews</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://corymathews.com/?p=854</guid>
		<description><![CDATA[Quartz.Net is a full-featured, open source job scheduling system. Basically this system allows an asp.net web application to schedule and run background jobs. This makes it much simpler for us developers by making it so that we do not have to have a windows service running on the server as well. To get started open [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://quartznet.sourceforge.net/" title="Quartz.Net">Quartz.Net</a> is a full-featured, open source job scheduling system. Basically this system allows an asp.net web application to schedule and run background jobs. This makes it much simpler for us developers by making it so that we do not have to have a windows service running on the server as well. </p>
<p>To get started open up the NuGet package manager. (right click on the projects name, and select Manage NuGet Packages) Search for Quartz and click install. This will add the needed references as well as download the Common.Logging dependency if needed.</p>
<p>Now to the code, we need to create our Job which will be run by the scheduler. This class must use the IJob interface provided from Quartz.Net. </p>
<pre class="prettyprint linenumstrigger linenums">
...
using Quartz;
using Quartz.Impl;
...

public class DailyJob : IJob
{
    public DailyJob() { }

    public void Execute( JobExecutionContext context )
    {
        try {
            //Your Logic
        } catch( Exception e ) {
            //Handle this please
        }
    }

    public static void ScheduleJob( IScheduler sc )
    {
        JobDetail job = new JobDetail( &quot;Send&quot;, &quot;Daily&quot;, typeof( DailyJob ) );
        sc.ScheduleJob( job, TriggerUtils.MakeDailyTrigger( &quot;trigger1&quot;, 8, 15 ) );
        sc.Start();
    }
}
</pre>
<p>The code placed in the Execute function is obviously what will run when the job is executed at its scheduled time. If you fail to add the try/catch block then the code can silently fail without being caught by a global error handler since there is no http request present. The ScheduleJob function is not required by the IJob interface but seems more logical to me, so it is added as well. </p>
<p>The Scheduling function above creates a new job Daily.Send (thats GroupName.TaskName ) and schedules it to run daily at 8:15am (14, 15 would be 2:15pm). You can replacing the TriggerUtils.MakeDailyTrigger with how often you want the Job to run, such as every 20 minutes, every hour, etc. </p>
<p>Lastly we need to call this Schedule function from the Global.asax Application_Start function so that when our app starts the code is automatically scheduled.</p>
<pre class="prettyprint linenumstrigger linenums">
DailyJob.ScheduleJob( new StdSchedulerFactory().GetScheduler() );
</pre>
]]></content:encoded>
			<wfw:commentRss>http://corymathews.com/using-quartz-net-to-create-scheduled-tasks/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>EventType clr20r3, P1 w3wp.exe &#8211; system.nullreferenceexception</title>
		<link>http://corymathews.com/eventtype-clr20r3-p1-w3wp-exe-system-nullreferenceexception/</link>
		<comments>http://corymathews.com/eventtype-clr20r3-p1-w3wp-exe-system-nullreferenceexception/#comments</comments>
		<pubDate>Thu, 15 Dec 2011 20:07:30 +0000</pubDate>
		<dc:creator>CoryMathews</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://corymathews.com/?p=838</guid>
		<description><![CDATA[My web app was crashing every few minutes, logging everyone off and completely restarting. Here was the message I had to go on and how I fixed it. Event Type: Error Event Source: .NET Runtime 2.0 Error Reporting Event Category: None Event ID: 5000 Date: ****** Time: ******* User: N/A Computer: ******* Description: EventType clr20r3, [...]]]></description>
			<content:encoded><![CDATA[<p>My web app was crashing every few minutes, logging everyone off and completely restarting. Here was the message I had to go on and how I fixed it.</p>
<blockquote><p>Event Type: Error<br />
Event Source: .NET Runtime 2.0 Error Reporting<br />
Event Category: None<br />
Event ID: 5000<br />
Date: ******<br />
Time: *******<br />
User: N/A<br />
Computer: *******<br />
Description:<br />
EventType clr20r3, P1 w3wp.exe, P2 6.0.3790.3959, P3 *******, P4 *******, P5 1.0.0.0, P6 *******, P7 3b6, P8 c2, P9 system.nullreferenceexception, P10 NIL.</p>
<p>For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.</p></blockquote>
<p>This was found in my Windows Application Error Log. Basically I had a system.nullreferenceexception somewhere in my application that was causing the ENTIRE application to restart. Fucking retarded, but according to <a href="http://support.microsoft.com/kb/911816">this KB</a></p>
<blockquote><p>&#8220;ASP.NET uses the default policy for unhandled exceptions in the .NET Framework 2.0. <strong>When an unhandled exception is thrown, the ASP.NET-based application unexpectedly quits</strong>.</p>
<p>This behavior does not apply to exceptions that occur in the context of a request. These kinds of exceptions are still handled and wrapped by an HttpException object. Exceptions that occur in the context of a request do not cause the worker process to end. However,<strong> unhandled exceptions outside the context of a request, such as exceptions on a timer thread or in a callback function, cause the worker process to end.</strong>&#8221;</p>
<p>&#8220;This behavior is by design.&#8221;</p></blockquote>
<p>So now I know that I have an error in code that runs behind the scenes. But without some direction good luck ever figuring out the problem, which is where this nasty cryptic error message above comes into play.</p>
<p>The key items are the P1 &#8211; P10 specifically p7. According to <a href="http://www.netframeworkdev.com/common-language-runtime/clr20r3-from-a-windows-service-calling-a-dot-net-dll-32830.shtml">this article on clr20r3</a> (notice clr20r3 was given before the P1 for EventType)</p>
<blockquote><p>P1: Application Name<br />
P2: Application version<br />
P3: Application time stamp<br />
P4: Assembly/Module name<br />
P5: Assembly/Module version<br />
p6: Assembly/Module timestamp<br />
<strong>P7: MethodDef</strong><br />
p8: IL offset<br />
p9: Exception name (Hashed because the name is too long )</p></blockquote>
<p>So in my error above p7 is 3b6. Now comes the fun part. Open up IL Disassembler (comes with visual studio under the SDK tools)</p>
<ol>
<li>Go to File &gt; Open and select the .dll the error is happening in (the P4 from the error message)</li>
<li>View &gt; Meta Info &gt; Show!</li>
<li>Find and type in 06000 and your p7 so in this case 060003b6</li>
<li>You should see something like the picture below. If you scroll up the page it will say class and you should be able to narrow down the function causing the error from there.</li>
</ol>
<p><a href="http://corymathews.com/wp-content/uploads/2011/12/ILDisassembler.png"><img class="size-medium wp-image-839" title="ILDisassembler" src="http://corymathews.com/wp-content/uploads/2011/12/ILDisassembler-300x128.png" alt="" width="300" height="128" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://corymathews.com/eventtype-clr20r3-p1-w3wp-exe-system-nullreferenceexception/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HTML5 Placeholder in IE and Unsupported Browsers</title>
		<link>http://corymathews.com/html5-placeholder-in-ie/</link>
		<comments>http://corymathews.com/html5-placeholder-in-ie/#comments</comments>
		<pubDate>Fri, 09 Dec 2011 19:50:00 +0000</pubDate>
		<dc:creator>CoryMathews</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://corymathews.com/?p=819</guid>
		<description><![CDATA[The html5 placeholder attribute on an input tag is a really nice ( &#60;input type=&#34;text&#34; name=&#34;user&#34; /&#62; ), however easily adding that feature to older IE versions and any other browsers that don&#8217;t support it renders it unusable in production. The below javascript/jquery code will check the page for any inputs with the placeholder attribute [...]]]></description>
			<content:encoded><![CDATA[<p>The html5 placeholder attribute on an input tag is a really nice (
<pre class="prettyprint linenumstrigger linenums">&lt;input type=&quot;text&quot; name=&quot;user&quot; /&gt;</pre>
<p>), however easily adding that feature to older IE versions and any other browsers that don&#8217;t support it renders it unusable in production.</p>
<p>The below javascript/jquery code will check the page for any inputs with the placeholder attribute and make it work in browsers that do not support it, and it will do nothing in those that do.</p>
<pre class="prettyprint linenumstrigger linenums">
(function($) {
  $.fn.placeholder = function() {
    if(typeof document.createElement(&quot;input&quot;).placeholder == 'undefined') {
      $('[placeholder]').focus(function() {
        var input = $(this);
        if (input.val() == input.attr('placeholder')) {
          input.val('');
          input.removeClass('placeholder');
        }
      }).blur(function() {
        var input = $(this);
        if (input.val() == '' || input.val() == input.attr('placeholder')) {
          input.addClass('placeholder');
          input.val(input.attr('placeholder'));
        }
      }).blur().parents('form').submit(function() {
        $(this).find('[placeholder]').each(function() {
          var input = $(this);
          if (input.val() == input.attr('placeholder')) {
            input.val('');
          }
        })
      });
    }
  }
})(jQuery);
</pre>
<p>Line 3 of the javascript checks if the browser supports the placeholder attribute and only runs if it does not.</p>
<p>To call this plugin just add the following to your page.</p>
<pre class="prettyprint linenumstrigger linenums">$.fn.placeholder();</pre>
<p>You may also want to add the following css to make it more like the browsers that do support it.</p>
<pre class="prettyprint linenumstrigger linenums">.placeholder { color: #aaa; }</pre>
<p><em>The original bulk of this code was written by <a href="http://www.hagenburger.net/BLOG/HTML5-Input-Placeholder-Fix-With-jQuery.html">Nico Hagenburger</a>. I basically only added the support check and turned it into a plugin.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://corymathews.com/html5-placeholder-in-ie/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>List Current Parent and Child Pages in WordPress</title>
		<link>http://corymathews.com/list-current-parent-and-child-pages-in-wordpress/</link>
		<comments>http://corymathews.com/list-current-parent-and-child-pages-in-wordpress/#comments</comments>
		<pubDate>Tue, 22 Nov 2011 20:19:16 +0000</pubDate>
		<dc:creator>CoryMathews</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://corymathews.com/?p=805</guid>
		<description><![CDATA[Recently in WordPress I needed to create a navigation that would display a page&#8217;s parent page and all of that pages children, I am a bit rusty with PHP but here is what I got to work. &#60;ul&#62; &#60;?php if($post-&#62;post_parent == 0) { $pageLinkID = $post-&#62;ID; $title = $post-&#62;post_title; } else { $pageLinkID = $post-&#62;post_parent; [...]]]></description>
			<content:encoded><![CDATA[<p>Recently in WordPress I needed to create a navigation that would display a page&#8217;s parent page and all of that pages children, I am a bit rusty with PHP but here is what I got to work.</p>
<pre class="prettyprint linenumstrigger linenums">
&lt;ul&gt;
&lt;?php
  if($post-&gt;post_parent == 0) {
    $pageLinkID = $post-&gt;ID;
    $title = $post-&gt;post_title;
  } else {
    $pageLinkID = $post-&gt;post_parent;
    $title = get_the_title($post-&gt;post_parent);
  }
  echo '&lt;li class=&quot;parent&quot;&gt;&lt;a href=&quot;'.get_page_link($pageLinkID).'&quot;&gt;'.$title.'&lt;/a&gt;&lt;/li&gt;';
  $pages = get_pages('child_of='.$pageLinkID);
  foreach ($pages as $p) {
    echo '&lt;li&gt;&lt;a href=&quot;'.get_page_link($p-&gt;ID).'&quot;&gt;'.$p-&gt;post_title.'&lt;/a&gt;&lt;/li&gt;';
  }
?&gt;
&lt;/ul&gt;
</pre>
<p>If you need to order the posts by the order value change the
<pre class="prettyprint linenumstrigger linenums">$pages = </pre>
<p> Line to </p>
<pre class="prettyprint linenumstrigger linenums">$pages = get_pages('child_of='.$pageLinkID.', 'sort_column' =&gt; 'menu_order', 'sort_order' =&gt; 'asc');</pre>
]]></content:encoded>
			<wfw:commentRss>http://corymathews.com/list-current-parent-and-child-pages-in-wordpress/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>WordPress Multiple Sidebars</title>
		<link>http://corymathews.com/wordpress-multiple-sidebars/</link>
		<comments>http://corymathews.com/wordpress-multiple-sidebars/#comments</comments>
		<pubDate>Thu, 13 Oct 2011 17:48:09 +0000</pubDate>
		<dc:creator>CoryMathews</dc:creator>
				<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://corymathews.com/?p=784</guid>
		<description><![CDATA[Seems there are a lot of complicated ways to add multiple sidebars to a wordpress theme, so here is a simpler one. Add this to your functions.php file for the theme. add_action( 'widgets_init', 'add_sidebars' ); function add_sidebars() { register_sidebar( array( 'id' =&#62; 'right', 'name' =&#62; __( 'right' ), 'description' =&#62; __( 'Right Sidebar' ), 'before_widget' [...]]]></description>
			<content:encoded><![CDATA[<p>Seems there are a lot of complicated ways to add multiple sidebars to a wordpress theme, so here is a simpler one. Add this to your functions.php file for the theme.</p>
<pre class="prettyprint linenumstrigger linenums">
add_action( 'widgets_init', 'add_sidebars' );
function add_sidebars() {
  register_sidebar(
    array(
      'id' =&gt; 'right',
      'name' =&gt; __( 'right' ),
      'description' =&gt; __( 'Right Sidebar' ),
      'before_widget' =&gt; '&lt;div id=&quot;%1$s&quot; class=&quot;widget %2$s&quot;&gt;',
      'after_widget' =&gt; '&lt;/div&gt;',
      'before_title' =&gt; '&lt;h3&gt;',
      'after_title' =&gt; '&lt;/h3&gt;'
    )
  );
  register_sidebar(
    array(
      'id' =&gt; 'left',
      'name' =&gt; __( 'left' ),
      'description' =&gt; __( 'Left Sidebar' ),
      'before_widget' =&gt; '&lt;div id=&quot;%1$s&quot; class=&quot;widget %2$s&quot;&gt;',
      'after_widget' =&gt; '&lt;/div&gt;',
      'before_title' =&gt; '&lt;h3&gt;',
      'after_title' =&gt; '&lt;/h3&gt;'
    )
  );
  // add however many more are needed..
}
</pre>
<p>Then to place the sidebars in your theme just use:</p>
<pre class="prettyprint linenumstrigger linenums">
&lt;?php
  dynamic_sidebar( 'right' );
  dynamic_sidebar( 'left' );
?&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://corymathews.com/wordpress-multiple-sidebars/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery External Image and Tab Plugin</title>
		<link>http://corymathews.com/jquery-external-image-and-tab-plugin/</link>
		<comments>http://corymathews.com/jquery-external-image-and-tab-plugin/#comments</comments>
		<pubDate>Wed, 14 Sep 2011 21:18:50 +0000</pubDate>
		<dc:creator>CoryMathews</dc:creator>
				<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://corymathews.com/?p=719</guid>
		<description><![CDATA[This jQuery Plugin is a quick way to: open external links in a new tab(_blank)place an image next to external links Example Use Options blank &#8211; if true it will change the links to open in a new tab by adding target=&#8221;_blank&#8221;. This defaults to true. path &#8211; if set this is the (From the [...]]]></description>
			<content:encoded><![CDATA[<p>This jQuery Plugin is a quick way to:</p>
<p><strong>open external links in a new tab(_blank)</strong><br /><strong>place an image next to external links</strong></p>
<p><strong><a href="http://corymathews.com/jquery-external-image-and-tab-plugin-examples/">Example Use</a></strong></p>
<hr />
<h3>Options</h3>
<p><strong>blank</strong> &#8211; if true it will change the links to open in a new tab by adding target=&#8221;_blank&#8221;. This defaults to true.</p>
<p><strong>path</strong> &#8211; if set this is the (From the site root) to the image to show next to external links. defaults to &#8221; which will not show an image.</p>
<p><strong>ignore</strong> &#8211; this is the class name that can be put on a link so that the plugin will not add the image or target changes.</p>
<hr />
<h3>License</h3>
<p>WTFPT (http://en.wikipedia.org/wiki/WTFPL) = &#8220;Do What The Fuck You Want To Public License&#8221;.</p>
<hr />
<h3>Source:</h3>
<p><a href="https://github.com/CoryMathews/jQuery-Link-External-Image-and-Tab-Plugin">On Github</a></p>
<p><strong>Full</strong></p>
<pre class="prettyprint linenumstrigger linenums">
(function($){
	$.fn.extTab = function(params) {
        var defaults = {
            blank:true,
            path:'',
            ignore:''
        };
        params = $.extend(defaults, params);
        var t = $(this).find(&quot;a[href^='http:']&quot;).not(&quot;[href*='&quot; + document.location.host + &quot;']&quot;);
        if(params.ignore != '') {
        	t = t.not(&quot;[class*='&quot; + params.ignore + &quot;']&quot;);
        }
    	if(params.blank) {
    		t.attr( &quot;target&quot;, &quot;_blank&quot; );
    	}
    	if(params.path != '') {
    		t.append(' &lt;img src=&quot;http://' + document.location.host + params.path + '&quot;&gt;');
    	}
    };
})(jQuery);
</pre>
<p><strong>Minified</strong></p>
<pre class="prettyprint linenumstrigger linenums">(function(c){c.fn.extTab=function(a){var a=c.extend({blank:!0,path:&quot;&quot;,ignore:&quot;&quot;},a),b=c(this).find(&quot;a[href^='http:']&quot;).not(&quot;[href*='&quot;+document.location.host+&quot;']&quot;);a.ignore!=&quot;&quot;&amp;&amp;(b=b.not(&quot;[class*='&quot;+a.ignore+&quot;']&quot;));a.blank&amp;&amp;b.attr(&quot;target&quot;,&quot;_blank&quot;);a.path!=&quot;&quot;&amp;&amp;b.append(' &lt;img src=&quot;http://'+document.location.host+a.path+'&quot;&gt;')}})(jQuery);</pre>
<hr />
<h3>Icons</h3>
<p><a href="http://www.iconfinder.com/search/?q=external+link"> Just an example of some icons to use</a></p>
]]></content:encoded>
			<wfw:commentRss>http://corymathews.com/jquery-external-image-and-tab-plugin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Multiple WordPress Menus</title>
		<link>http://corymathews.com/multiple-wordpress-menus/</link>
		<comments>http://corymathews.com/multiple-wordpress-menus/#comments</comments>
		<pubDate>Thu, 14 Jul 2011 18:19:30 +0000</pubDate>
		<dc:creator>CoryMathews</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://corymathews.com/?p=690</guid>
		<description><![CDATA[WordPress 3+ allows for custom theme controlled menus. For this example I will be adding 3 but the same works for 2, 3 or any number of wordpress menus. In the functions.php file of the theme we first need to add support for menus. if (function_exists('add_theme_support')) { add_theme_support('menus'); } The function_exists is only there for [...]]]></description>
			<content:encoded><![CDATA[<p>WordPress 3+ allows for custom theme controlled menus. For this example I will be adding 3 but the same works for 2, 3 or any number of wordpress menus.</p>
<p>In the functions.php file of the theme we first need to add support for menus.</p>
<pre class="prettyprint linenumstrigger linenums">if (function_exists('add_theme_support')) {
    add_theme_support('menus');
}</pre>
<p>The function_exists is only there for backward compatability.. so you can probably safely remove it. Without the add_theme_support when someone clicks on Appearance -&gt; Menus they will get the message</p>
<blockquote><p>&#8220;The current theme does not natively support menus, but you can use the “Custom Menu” widget to add any menus you create here to the theme’s sidebar.&#8221;</p></blockquote>
<p>Next we need to define our menus using the register_nav_menu  function. The following defines 3 different menus; main, top and side to be used within our skin</p>
<pre class="prettyprint linenumstrigger linenums">if ( function_exists( 'register_nav_menu' ) ) {
  register_nav_menus( array(
    'main' =&gt; 'Main Navigation',
    'top' =&gt; 'Smaller top nav',
    'side' =&gt; 'nav within sidebar'
  ))
}</pre>
<p>Now if we go to the menus page within WordPress we should see that our skin supports 3 different menus. With the descriptions we provided in the functions.php file.</p>
<p><img class="alignnone size-full wp-image-691" title="menus" src="http://corymathews.com/wp-content/uploads/2011/07/menus.png" alt="" width="300" height="316" /></p>
<p>Now we need to add these menu place holders to our theme so the menus appear in the appropriate places. So within your themes .php pages add the following line</p>
<pre class="prettyprint linenumstrigger linenums">&lt;? php wp_nav_menu( array( 'theme_location' &gt; 'top', 'container' &gt; '' ) ); &gt;</pre>
<p><em>*The container parameter removes the (pointless) wrapping div tag.</em></p>
<p>Then for each of the other menus you add the above code again giving it the other menu items.</p>
]]></content:encoded>
			<wfw:commentRss>http://corymathews.com/multiple-wordpress-menus/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HTML5 Video Observations</title>
		<link>http://corymathews.com/html5-video-observations/</link>
		<comments>http://corymathews.com/html5-video-observations/#comments</comments>
		<pubDate>Fri, 28 Jan 2011 18:07:00 +0000</pubDate>
		<dc:creator>CoryMathews</dc:creator>
				<category><![CDATA[HTML]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Misc Programming]]></category>

		<guid isPermaLink="false">http://corymathews.com/?p=645</guid>
		<description><![CDATA[First off my goal is to run a bunch of 3-5 minute videos on any 1 single browser on a windows machine, It will run as a kiosk and will not have Internet access. So this finally gives me a good reason to play around with the &#60;video&#62; tag. The videos were provided in a [...]]]></description>
			<content:encoded><![CDATA[<p>First off my goal is to run a bunch of 3-5 minute videos on any 1 single browser on a windows machine, It will run as a kiosk and will not have Internet access. So this finally gives me a good reason to play around with the &lt;video&gt; tag.</p>
<p>The videos were provided in a .mov format so being lazy I tried just sticking those videos in to chrome and it worked&#8230; sorta.</p>
<pre class="prettyprint linenumstrigger linenums">&lt;video width=800 height=600&gt;&lt;source src=video.mov&gt;&lt;/video&gt;</pre>
<h2>Sound Played Every Other Load</h2>
<p>Very quickly the problems started occurring. First off the <a href="http://stackoverflow.com/questions/4248404/sound-plays-every-other-time-the-video-plays-in-chrome">sound stopped playing</a> every other time the video was played.</p>
<p>That seems to be a bug and to fix it I had to  remove the old video tag and replace it every time I played a video.</p>
<h2>Video Load Performance  Problems</h2>
<p>Then I moved from the short demo videos (10 secs) to the full 3 min videos and right off the bat, I saw huge performance delays. So slow that it appeared the videos would not show and the Task Manager did not show activity. <strong>Perhaps there is a file max size I have missed? </strong></p>
<p>Now faced with this major performance problem I set out to see which video format worked fastest on which browser, since I had the luxury of picking a browser.</p>
<p>I converted the video into the .ogv, .mp4 (H.264) and .webm using the  <a href="http://www.mirovideoconverter.com/">Miro Video Converter</a> (Which is REALLY easy and simple). It gave me the following file sizes.</p>
<ul>
<li>.mov &#8211; 631,964KB (Original File)</li>
<li>.mp4 &#8211; 210,954KB</li>
<li>.mp4 &#8211; 66,280KB*</li>
<li>.ogv &#8211; 144,690KB</li>
<li>.webm &#8211; 25,315KB</li>
</ul>
<p>*I ended up using the Adobe Media Encoder to reconvert the second (smaller) .mp4 because it gave better compression and wanted to see what kind of difference it made.</p>
<p>Using the following 3 browsers:</p>
<ul>
<li>Firefox 3.6.12</li>
<li>Chrome 7.0.517.44</li>
<li>Opera 10.63</li>
</ul>
<p>Heres how each format worked in them.</p>
<p><strong>Firefox</strong>:</p>
<ul>
<li>.mov, .mp4 and .webm &#8211; do not run</li>
<li>.ogv &#8211; ran but was very slow to start, after that the video was smooth.</li>
</ul>
<p><strong>Chrome</strong>:</p>
<ul>
<li>.mov &#8211; would not run</li>
<li>.mp4 &#8211; would not run</li>
<li>.mp4 (smaller) &#8211; ran smoothly but took a minute to appear</li>
<li>.ogv &#8211; seems to be sized differently, runs really jagged, and just overall unacceptable.</li>
<li>.webm &#8211; Extremely responsive, but the quality was plain awful.</li>
</ul>
<p><strong>Opera</strong>:</p>
<ul>
<li>.mov, .mp4 &#8211; does not run</li>
<li>.ogv &#8211; Responsive and smooth.</li>
<li>.webm &#8211; Extremely responsive, but the quality was awful. (same as chromes webm)</li>
</ul>
<p>Before I started I assumed Chrome/WebM would be the best overall bet, just from the chatter it has been creating. But it seems that I was wrong.</p>
<p><strong>Overall the .ogv on Opera seemed to be the best option. </strong></p>
<p>It does seem that there is a very apparent association between file-size and initial load time. (bandwidth ignored) But nothing I could find written on the matter, or how to improve it. (<a href="http://twitter.com/#!/CoryMathews">@CoryMathews</a> if you know)</p>
<p>After all this it still seems like the HTML5 video tag is far from ready, but its a hell of a lot nicer to use then flash.</p>
<h2>Great HTML5 Video Tag Articles</h2>
<ul>
<li><a title="HTML5 Video Introduction" href="http://dev.opera.com/articles/view/introduction-html5-video/">Introduction to HTML5 Video &#8211; dev.opera.com</a></li>
<li><a title="HTML5 Video and Audio 2" href="http://my.opera.com/core/blog/2010/03/03/everything-you-need-to-know-about-html5-video-and-audio-2">Everything you need to know about HTML5 Video and Audio 2 &#8211; dev.opera.com</a></li>
<li><a title="HTML5 Video" href="http://diveintohtml5.org/video.html">HTML5 Video &#8211; diveintohtml5.org</a></li>
</ul>
<h2>Sample Source  Code</h2>
<p>Page Structure-ish</p>
<pre class="prettyprint linenumstrigger linenums">...
&lt;script src=&quot;jquery.js&quot;&gt;&lt;/script&gt;
&lt;style&gt;
  #VideoShow { display:none; top:0; left:0; }
  #closeVid { position:absolute; top:0;z-index:5; display:none; }
&lt;/style&gt;
...
&lt;div id=&quot;But1&quot;&gt;&lt;/div&gt;
&lt;div id=&quot;But2&quot;&gt;&lt;/div&gt;
...
&lt;div id='closeVid'&gt;&lt;img src='close.jpg'&gt;&lt;/div&gt;
&lt;div id=&quot;VideoShow&quot;&gt;&lt;/div&gt;
...
$(&quot;#But1&quot;).click(function(){ playVideo(&quot;video.mov&quot;); });
$(&quot;#But2&quot;).click(function(){ playVideo(&quot;video.mp4&quot;); &Acirc;&nbsp;});

function playVideo(videoName) {
  $(&quot;#VideoShow&quot;).fadeIn(300).html(&quot;&lt;video width=800 height=600&gt;&lt;source src=\&quot;&quot; + videoName + &quot;\&quot;'&gt;&lt;/video&gt;&quot;);
  $(&quot;#closeVid&quot;).fadeIn(300);
  var Vid = document.getElementsByTagName('video')[0];
  Vid.play();
  Vid.addEventListener('ended', function(e) {
    closeVideo();
  }, false);
}

function closeVideo() {
  var Vid = document.getElementsByTagName('video')[0];
  Vid.removeEventListener('ended', arguments.callee, false);
  $(&quot;#VideoShow&quot;).fadeOut(300).html(&quot;&quot;);
  $(&quot;#closeVid&quot;).fadeOut(100)
}</pre>
]]></content:encoded>
			<wfw:commentRss>http://corymathews.com/html5-video-observations/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Open All External Links in New Tabs</title>
		<link>http://corymathews.com/make-all-external-links-open-in-a-new-tab/</link>
		<comments>http://corymathews.com/make-all-external-links-open-in-a-new-tab/#comments</comments>
		<pubDate>Wed, 04 Aug 2010 18:26:51 +0000</pubDate>
		<dc:creator>CoryMathews</dc:creator>
				<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://corymathews.com/?p=628</guid>
		<description><![CDATA[Here is a quick bit of jQuery to make all external links have the target=_blank attribute. &#60;script type=&#34;text/javascript&#34;&#62; $(function(){ $(&#34;a[href^='http:']&#34;).not(&#34;[href*=EXAMPLE.com']&#34;).attr({ target: &#34;_blank&#34; }); }); &#60;/script&#62; You could also use this same technique to add a small friendly image next to these links  notifying the user they are about to leave the site. &#60;script type=&#34;text/javascript&#34;&#62; $(function(){ [...]]]></description>
			<content:encoded><![CDATA[<p>Here is a quick bit of jQuery to make all external links have the target=_blank attribute.</p>
<pre class="prettyprint linenumstrigger linenums">&lt;script type=&quot;text/javascript&quot;&gt;
$(function(){
$(&quot;a[href^='http:']&quot;).not(&quot;[href*=EXAMPLE.com']&quot;).attr({ target: &quot;_blank&quot; });
});
&lt;/script&gt;</pre>
<p>You could also use this same technique to add a small friendly image next to these links  notifying the user they are about to leave the site.</p>
<pre class="prettyprint linenumstrigger linenums">&lt;script type=&quot;text/javascript&quot;&gt;
$(function(){
$(&quot;a[href^='http:']&quot;).not(&quot;[href*=EXAMPLE.com']&quot;).attr({ target: &quot;_blank&quot; }).append(&quot; &lt;img src=\&quot;outLink.jpg\&quot;&gt;&quot;);
});
&lt;/script&gt;</pre>
]]></content:encoded>
			<wfw:commentRss>http://corymathews.com/make-all-external-links-open-in-a-new-tab/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

