<?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>Eleven Hit Combo</title>
	<atom:link href="http://www.elevenhitcombo.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.elevenhitcombo.com</link>
	<description>Software solutions that go to eleven.</description>
	<lastBuildDate>Thu, 28 Jun 2012 16:11:50 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>jQuery event binding snippet</title>
		<link>http://www.elevenhitcombo.com/jquery-event-bind-snippet/</link>
		<comments>http://www.elevenhitcombo.com/jquery-event-bind-snippet/#comments</comments>
		<pubDate>Thu, 22 Dec 2011 20:42:07 +0000</pubDate>
		<dc:creator>paul</dc:creator>
				<category><![CDATA[jquery]]></category>
		<category><![CDATA[snippets]]></category>
		<category><![CDATA[visual studio 2010]]></category>

		<guid isPermaLink="false">http://www.elevenhitcombo.com/?p=42</guid>
		<description><![CDATA[Couldn&#8217;t resist.  Snippets are now taking over my life.  Following my basic example a little earlier, which just emitted a document ready block, I decided to up the ante and solve another jQuery pet hate &#8211; event binding. This snippet adds placeholders to the mix, shown here in its XML glory:- &#60;?xml version=&#34;1.0&#34; encoding=&#34;utf-8&#34;?&#62; &#60;CodeSnippet [...]]]></description>
				<content:encoded><![CDATA[<p>Couldn&#8217;t resist.  Snippets are now taking over my life.  Following my basic example a little earlier, which just emitted a document ready block, I decided to up the ante and solve another jQuery pet hate &#8211; event binding.</p>
<p>This snippet adds placeholders to the mix, shown here in its XML glory:-</p>
<pre class="brush: xml; gutter: false">&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;CodeSnippet 
  Format=&quot;1.0.0&quot; 
  xmlns=&quot;http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet&quot;&gt;
  &lt;Header&gt;
    &lt;Title&gt;Bind jQueryEvent&lt;/Title&gt;
    &lt;Author&gt;Paul Alan Taylor&lt;/Author&gt;
    &lt;Shortcut&gt;bindJQueryEvent&lt;/Shortcut&gt;
    &lt;Description&gt;
      Basic jQuery event bind with selector, 
      event and function shortcuts
    &lt;/Description&gt;
    &lt;SnippetTypes&gt;
      &lt;SnippetType&gt;Expansion&lt;/SnippetType&gt;
    &lt;/SnippetTypes&gt;
  &lt;/Header&gt;
  &lt;Snippet&gt;
    &lt;Declarations&gt;
      &lt;Literal&gt;
        &lt;!-- First place holder
             For CSS selector.  

             I have defaulted it to # to assist with
             assigning events with IDs
        --&gt;
        &lt;ID&gt;selector&lt;/ID&gt;
        &lt;Default&gt;#&lt;/Default&gt;
      &lt;/Literal&gt;
      &lt;Literal&gt;
        &lt;!-- Event placeholder.
             The event we&#039;re trying to capture

             Defaulted to &#039;click&#039;
        --&gt;
        &lt;ID&gt;event&lt;/ID&gt;
        &lt;Default&gt;click&lt;/Default&gt;
      &lt;/Literal&gt;
      &lt;Literal&gt;
        &lt;!-- Finally, the function placeholder 
             Where we would expect to place the text

        --&gt;
        &lt;ID&gt;function&lt;/ID&gt;
        &lt;Default&gt;/* hook me up */&lt;/Default&gt;
      &lt;/Literal&gt;
    &lt;/Declarations&gt;
    &lt;!--
       Code block is contained in CDATA

       Declarations are expanded by wrapping the ID 
       in dollar signs.

       NB: If you need actually need a literal dollar,
       as in the jQuery dollar sign, use a double
       dollar ($$).

    --&gt;
    &lt;Code Language=&quot;JScript&quot;&gt;
      &lt;![CDATA[$$(&#039;$selector$&#039;).bind(&#039;$event$&#039;, function () { $function$ });
      ]]&gt;
    &lt;/Code&gt;
  &lt;/Snippet&gt;
&lt;/CodeSnippet&gt;</pre>
<h3>SnippetType</h3>
<p>There are two types of snippet, <strong><em>expansion</em></strong> or <strong><em>surrounds-with</em></strong>.   Expansion snippets are inserted at the cursor, while surrounds-with snippets will wrap themselves around a selected piece of text.</p>
<pre class="brush: xml; gutter: true">&lt;SnippetTypes&gt;
   &lt;SnippetType&gt;Expansion&lt;/SnippetType&gt;
&lt;/SnippetTypes&gt;</pre>
<p>The intention is to be able to create a quick binding before specifying event behaviour, so this is an <em><strong>expansion</strong></em> snippet, as declared in the SnippetType node.</p>
<h3>Declarations</h3>
<p>The next real section of note the the <strong>Declarations </strong>node.  This node is used to define tokens that will be recognised and replaced in the code section.</p>
<p>I&#8217;ve defined three tokens for this snippet:-</p>
<ul>
<li><strong>selector</strong> &#8211; The CSS selector I&#8217;m using to target my elements</li>
<li><strong>event</strong> &#8211; The event type I&#8217;m looking to capture</li>
<li><strong>function</strong> &#8211; The internals of the anonymous function, or the behaviour.</li>
</ul>
<p>I&#8217;ve given <strong>selector</strong> a default of #, largely because I forget the hashtag when I select by DOM identifier <img src='http://www.elevenhitcombo.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />   Also, I&#8217;ve given the <strong>event</strong> token the default type of <strong>click</strong>.</p>
<pre class="brush: xml; gutter: true">&lt;Declarations&gt;
  &lt;Literal&gt;
    &lt;ID&gt;selector&lt;/ID&gt;
    &lt;Default&gt;#&lt;/Default&gt;
  &lt;/Literal&gt;
  &lt;Literal&gt;
    &lt;ID&gt;event&lt;/ID&gt;
    &lt;Default&gt;click&lt;/Default&gt;
  &lt;/Literal&gt;
  &lt;Literal&gt;
    &lt;ID&gt;function&lt;/ID&gt;
    &lt;Default&gt;/* hook me up */&lt;/Default&gt;
   &lt;/Literal&gt;
&lt;/Declarations&gt;</pre>
<p>I have chosen to include the default comment <strong>/* hook me up */</strong> as the default for my function token.  If, as I suspect, that soon becomes annoying, I can simply remove the default.  Placeholders do not have to have default values.  Visual Studio will still recognise them as such and allow you to tab to them.  They&#8217;re just a little more difficult to spot.</p>
<h3>Code</h3>
<p>The last important part is of course, the code snippet we want to insert, which lives in the <strong>Code </strong>element.  The <strong>Language </strong>attribute specifies what sort of code it is, and is largely used to determine which snippet area ( i.e. My Jscript snippets ) the snippet should be installed to.  The code itself is wrapped a CDATA block, which means that by and large, you can go about your coding business without having to replace characters with special meaning in XML.</p>
<p>Placeholder tokens that have been defined in the <strong>Declarations</strong> section can be expanded anywhere in the CDATA block by wrapping dollar signs around them.</p>
<pre>&lt;Code Language=&quot;JScript&quot;&gt;
  &lt;![CDATA[$$(&#039;$selector$&#039;).bind(&#039;$event$&#039;, function () { $function$ });
  ]]&gt;
&lt;/Code&gt;</pre>
<p>When the snippet is inserted into the code, each token will be replaced with the default values assigned in <strong>Declarations</strong>.  They also represent the points</p>
<h4>Warning</h4>
<p>Be careful with the dollar sign. The snippet engine uses dollar signs as token delimiters,  so if you need a literal dollar, type $$ instead of $.  I have done precisely this when using the $ short-hand for the jQuery method :-</p>
<pre class="brush: javascript; gutter: true">$$(&#039;$selector$&#039;).bind(&#039;$event$&#039;, function () { $function$ });</pre>
<p>&nbsp;</p>
<h3>Snippet in action</h3>
<p>When running the snippet in VS, ( <a title="Snippet Good" href="http://www.elevenhitcombo.com/snippet-good/">import primer</a> ), we get the following:-</p>
<pre class="brush: javascript; gutter: true">$(&#039;#&#039;).bind(&#039;click&#039;, function () { /* hook me up */ });
// ^         ^                     ^
// Placeholder locations</pre>
<pre class="brush: javascript; gutter: true"></pre>
<p>Upon insertion, the cursor will jump in the first place holder.  You can move between the snippet placeholders by using the tab/shift-tab combination.  The net result is that you only touch the stuff you need to touch, resulting in a big boost in productivity and code accuracy.  I&#8217;m really starting to like snippets.</p>
<h3>Downloads</h3>
<ul>
<li><a href="http://www.elevenhitcombo.com/codesamples/jQueryEventBinder.snippet">jQuery Event Binder Snippet</a></li>
<li><a href="http://www.elevenhitcombo.com/codesamples/docReady.snippet">Document ready snippet</a></li>
</ul>
<h3>Links</h3>
<ul>
<li><a title="Snippet Good" href="http://www.elevenhitcombo.com/snippet-good/">Snippet Good</a></li>
</ul>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.elevenhitcombo.com/jquery-event-bind-snippet/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Snippet Good</title>
		<link>http://www.elevenhitcombo.com/snippet-good/</link>
		<comments>http://www.elevenhitcombo.com/snippet-good/#comments</comments>
		<pubDate>Thu, 22 Dec 2011 11:47:09 +0000</pubDate>
		<dc:creator>paul</dc:creator>
				<category><![CDATA[jquery]]></category>
		<category><![CDATA[snippets]]></category>
		<category><![CDATA[visual studio 2010]]></category>

		<guid isPermaLink="false">http://www.elevenhitcombo.com/?p=29</guid>
		<description><![CDATA[I created my first Visual Studio code snippet yesterday.  I believe user-defined snippets are a new feature of Visual Studio 2010.   While similar stuff could be achieved in 2008, it apparently required a level of hoop-jumping that would make a circus performer proud. I have found it particularly handy with Javascript stuff, an area which [...]]]></description>
				<content:encoded><![CDATA[<p>I created my first Visual Studio code snippet yesterday.  I believe user-defined snippets are a new feature of Visual Studio 2010.   While similar stuff could be achieved in 2008, it apparently required a level of hoop-jumping that would make a circus performer proud.</p>
<p>I have found it particularly handy with Javascript stuff, an area which Visual Studio <em>supports</em> but frankly, is a bit slow on the uptake.  I&#8217;m sure that many coders have waited patiently for VS 2010 to decide that, &#8220;yes, that is valid Javascript &#8211; I shall remove my annoying error highlighting forthwith&#8221;.</p>
<p>So a small Christmas present to fellow coders everywhere.  A little <a href="http://www.elevenhitcombo.com/codesamples/docReady.snippet">document ready snippet</a> for your jQuery needs.</p>
<p>To include in Visual Studio, download and go to <strong>Tools -&gt;Code Snippet Manager</strong>.</p>
<p><a href="http://www.elevenhitcombo.com/wp-content/uploads/2011/12/snippet1.png"><img class="alignnone size-medium wp-image-32" title="snippet1" src="http://www.elevenhitcombo.com/wp-content/uploads/2011/12/snippet1-239x300.png" alt="" width="239" height="300" /></a></p>
<p>Then click <strong>Import </strong>on the dialog that pops up.</p>
<p><a href="http://www.elevenhitcombo.com/wp-content/uploads/2011/12/snippet2.png"><img class="alignnone size-medium wp-image-33" title="snippet2" src="http://www.elevenhitcombo.com/wp-content/uploads/2011/12/snippet2-300x223.png" alt="" width="300" height="223" /></a></p>
<p>Navigate to wherever you downloaded your cut-out-and-keep document.ready snippet to and select.  Visual Studio will now ask you where you&#8217;d like to keep your snippet.  I chose <strong>My JScript Snippets</strong> (JScript! &#8211; you just won&#8217;t let it go, will you Microsoft?).</p>
<p><a href="http://www.elevenhitcombo.com/wp-content/uploads/2011/12/snippet3.png"><img class="alignnone size-medium wp-image-34" title="snippet3" src="http://www.elevenhitcombo.com/wp-content/uploads/2011/12/snippet3-300x245.png" alt="" width="300" height="245" /></a></p>
<p>Click <strong>Finish </strong>to add the snippet permanently.  Now let&#8217;s put this bad boy to use.  Hit a code file where you&#8217;d expect to have a bit of Javascript ( .js, .aspx, .ascx ) and right click on the screen.</p>
<p><a href="http://www.elevenhitcombo.com/wp-content/uploads/2011/12/snippet4.png"><img class="alignnone size-medium wp-image-35" title="snippet4" src="http://www.elevenhitcombo.com/wp-content/uploads/2011/12/snippet4-300x295.png" alt="" width="300" height="295" /></a></p>
<p>&nbsp;</p>
<p>Choose <strong>Insert Snippet</strong>.</p>
<p><a href="http://www.elevenhitcombo.com/wp-content/uploads/2011/12/snippet5.png"><img class="alignnone size-medium wp-image-36" title="snippet5" src="http://www.elevenhitcombo.com/wp-content/uploads/2011/12/snippet5-300x75.png" alt="" width="300" height="75" /></a></p>
<p>Navigate into <strong>My JScript Snippets </strong>-&gt; <strong>Document ready snippet</strong>.  Click it.</p>
<p><a href="http://www.elevenhitcombo.com/wp-content/uploads/2011/12/snippet6.png"><img class="alignnone size-medium wp-image-37" title="snippet6" src="http://www.elevenhitcombo.com/wp-content/uploads/2011/12/snippet6-300x83.png" alt="" width="300" height="83" /></a></p>
<p>Tada!  One problem solved forever.</p>
<h3>Further reading</h3>
<p>Of course, Snippets aren&#8217;t confined to Javascript. If you want to create your own snippets, take a look at:-</p>
<p><a href="http://www.peter-urda.com/2010/10/how-to-create-a-visual-studio-2010-code-snippet">How-To : Create a Visual Studio Code Snippet</a> over at <a href="http://www.peter-urda.com/">Writings of Urda</a>.</p>
<h3>Downloads</h3>
<p><a href="http://www.elevenhitcombo.com/codesamples/docReady.snippet">Document ready snippet</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.elevenhitcombo.com/snippet-good/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Human Error?</title>
		<link>http://www.elevenhitcombo.com/human-error/</link>
		<comments>http://www.elevenhitcombo.com/human-error/#comments</comments>
		<pubDate>Thu, 15 Dec 2011 13:59:53 +0000</pubDate>
		<dc:creator>paul</dc:creator>
				<category><![CDATA[Musings]]></category>

		<guid isPermaLink="false">http://www.elevenhitcombo.com/?p=23</guid>
		<description><![CDATA[One of the things that annoys me as a user of computers is the utter nonsense some software emits.  Jack Dee used to do a joke in his act about his computer telling him &#8220;YOU HAVE COMMITTED AN ILLEGAL ACTION!&#8221;.  Now I&#8217;m not sure whether he embellished his experience for comedic effect, but whatever the [...]]]></description>
				<content:encoded><![CDATA[<p>One of the things that annoys me as a user of computers is the utter nonsense some software emits.  Jack Dee used to do a joke in his act about his computer telling him &#8220;YOU HAVE COMMITTED AN ILLEGAL ACTION!&#8221;.  Now I&#8217;m not sure whether he embellished his experience for comedic effect, but whatever the genesis of that particular quip, he&#8217;s not far from the truth.</p>
<p>I had a similar experience this week with Star Wars : The Old Republic.  Being the colossal geek I am, this game has been on pre-order for some time.  A big part of my pre-order decision hinged on Electronic Arts promise of Early Game Access, which to be fair to them, they&#8217;ve duly delivered.  That said, the overall experience was patchy.  For starters, I received a lot of email telling me that my time had come, and that I could get on with installing a galaxy far far away onto my PC.  Brilliant, eh?  Not quite.  Upon installing the client, I was informed that &#8220;no active subscription existed on the account&#8221;.  What?  I put my code in.  It&#8217;s showing on the site!  What&#8217;s happened to my pre-order and the much desired Early Game Access?  Do I have to buy it again?</p>
<p>With a bit of Googling, I landed on a technical support page and found out that there was nothing wrong; EA were just staggering access to the game, and despite the emails telling me that I was good to go, their software was telling me something else.  Luckily, I&#8217;ve seen all this before.  I&#8217;m technical, and this stuff happens all too often.  What about everyone else, though?  Mixed messages detract from the user experience, and a bad first experience can become the last experience.  I persevered with the Old Republic because I had actually spent money on it.  I might not have been as industrious in seeking resolution if I&#8217;d had a bad experience on a web site being provided for free.</p>
<p>Computer literacy has come a long way since the 1980s, but there are still people out there who are scared of the machines in their homes.  Coders need to remember that.  We might be experts, but not all of our users are.  When something goes wrong, we need to tell our users what has happened in plain English and ideally, what they need to do to resolve it.  Human beings are wonderfully prone to mistakes, and most computer programs are marketed squarely at our species.</p>
<p>Human error is a fact of life.  Coders need to to account for that, and not compound our idiosyncratic tendencies with obscure messages.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.elevenhitcombo.com/human-error/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
