<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule" version="2.0">

<channel>
	<title>Yelotofu</title>
	
	<link>http://yelotofu.com</link>
	<description>"In building standards compliant sites we are creating a better Web for the future."</description>
	<lastBuildDate>Sun, 05 Sep 2010 17:53:41 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/Yelotofu" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="yelotofu" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><creativeCommons:license>http://creativecommons.org/licenses/by-sa/3.0/</creativeCommons:license><image><link>http://creativecommons.org/licenses/by-sa/3.0/</link><url>http://creativecommons.org/images/public/somerights20.gif</url><title>Some Rights Reserved</title></image><item>
		<title>HowTo: Revert local changes in Git</title>
		<link>http://yelotofu.com/2010/08/howto-revert-local-changes-git/</link>
		<comments>http://yelotofu.com/2010/08/howto-revert-local-changes-git/#comments</comments>
		<pubDate>Sat, 28 Aug 2010 10:06:06 +0000</pubDate>
		<dc:creator>caphun</dc:creator>
				<category><![CDATA[Ramblings]]></category>
		<category><![CDATA[checkout]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[reset]]></category>
		<category><![CDATA[revert]]></category>

		<guid isPermaLink="false">http://yelotofu.com/?p=676</guid>
		<description><![CDATA[Found this answer on Stack Overflow very useful, so thought I'd share it here: If you want to revert changes made to your working copy, do this: git checkout . If you want to revert changes made to the index (i.e., that you have added), do this: git reset If you want to revert a [...]]]></description>
			<content:encoded><![CDATA[<p>Found <a href="http://stackoverflow.com/questions/1146973/how-to-revert-all-local-changes-in-a-git-managed-project-to-previous-state/1146981#1146981">this answer</a> on Stack Overflow very useful, so thought I'd share it here:</p>
<blockquote>
<p>If you want to revert changes made to your working copy, do this:</p>
<p><code>git checkout .</code></p>
<p>If you want to revert changes made to the index (i.e., that you have added), do this:</p>
<p><code>git reset</code></p>
<p>If you want to revert a change that you have committed, do this:</p>
<p><code>git revert ...</code></p>
</blockquote>
<p><small><strong>Source:</strong> <a href="http://stackoverflow.com/questions/1146973/how-to-revert-all-local-changes-in-a-git-managed-project-to-previous-state/1146981#1146981">How to revert all local changes in a GIT managed project to previous state ?</a></small></p>

<p><a href="http://feedads.g.doubleclick.net/~a/A6rVSQHeeca0iLZaca0yapc_hn8/0/da"><img src="http://feedads.g.doubleclick.net/~a/A6rVSQHeeca0iLZaca0yapc_hn8/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/A6rVSQHeeca0iLZaca0yapc_hn8/1/da"><img src="http://feedads.g.doubleclick.net/~a/A6rVSQHeeca0iLZaca0yapc_hn8/1/di" border="0" ismap="true"></img></a></p>]]></content:encoded>
			<wfw:commentRss>http://yelotofu.com/2010/08/howto-revert-local-changes-git/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>How to get Fancybox 1.3.1 to stay put!</title>
		<link>http://yelotofu.com/2010/06/how-to-get-fancybox-1-3-1-to-stay-put/</link>
		<comments>http://yelotofu.com/2010/06/how-to-get-fancybox-1-3-1-to-stay-put/#comments</comments>
		<pubDate>Mon, 07 Jun 2010 04:11:41 +0000</pubDate>
		<dc:creator>caphun</dc:creator>
				<category><![CDATA[Ramblings]]></category>

		<guid isPermaLink="false">http://yelotofu.com/?p=655</guid>
		<description><![CDATA[I recently had a need to use a Fixed position overlay and found that Fancybox breaks if I set #fancybox-wrap to position:fixed. I believe the centerOnScroll option was supposed to solve this problem by recalculating the absolute position of #fancybox-wrap upon scrolling. The problem with this approach is that the overlay 'shudders' or 'feels jumpy' [...]]]></description>
			<content:encoded><![CDATA[<p>I recently had a need to use a Fixed position overlay and found that Fancybox breaks if I set <code>#fancybox-wrap</code> to <code>position:fixed</code>. I believe the <code>centerOnScroll</code> option was supposed to solve this problem by recalculating the absolute position of <code>#fancybox-wrap</code> upon scrolling. The problem with this approach is that the overlay 'shudders' or 'feels jumpy' when you scroll in Firefox, Opera and IE7+.</p>
<p>Luckily the fix is actually pretty simple with the following steps:</p>
<p><strong>1. Get a copy of the source code</strong> - <a href="http://fancybox.googlecode.com/files/jquery.fancybox-1.3.1.zip">jquery.fancybox-1.3.1.zip</a></p>
<p><strong>2. Do a in-code-search</strong> </p>
<p>Open jquery.fancybox-1.3.1.js and look for the <code>fancybox_get_viewport</code> function (should be around line 56), the function should look like this:</p>
<pre class="brush: jscript;">
fancybox_get_viewport = function() {
  return [ $(window).width(), $(window).height(), $(document).scrollLeft(), $(document).scrollTop() ];
},
</pre>
<p><strong>3. Change it to look like this:</strong></p>
<pre class="brush: jscript;">
fancybox_get_viewport = function() {
  var isFixed = wrap.css('position') === 'fixed'; // add support for fixed positioning
  return [ $(window).width(), $(window).height(), isFixed ? 0 : $(document).scrollLeft(), isFixed ? 0 : $(document).scrollTop() ];
},
</pre>
<p><strong>4. Add some CSS</strong></p>
<p>Add the following clauses to your CSS files (ensure these clauses load <em>after</em> the jquery.fancybox-1.3.1.css file):</p>
<pre class="brush: css;">
#fancybox-wrap {
  position: fixed;
}
* html #fancybox-wrap {	/* IE6 */
  position: absolute;
}
</pre>
<p>That's it!</p>
<p>Basically what the fix does is detect whether the wrapper is a fixed position element, if so it would return 0 for the scrollLeft and scrollTop values of the viewport. So even if you're not using a fixed position element you can add this fix in as it's non-destructive.</p>

<p><a href="http://feedads.g.doubleclick.net/~a/6aqqHEJZVt9LpPiDUIZwYkaVtVU/0/da"><img src="http://feedads.g.doubleclick.net/~a/6aqqHEJZVt9LpPiDUIZwYkaVtVU/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/6aqqHEJZVt9LpPiDUIZwYkaVtVU/1/da"><img src="http://feedads.g.doubleclick.net/~a/6aqqHEJZVt9LpPiDUIZwYkaVtVU/1/di" border="0" ismap="true"></img></a></p>]]></content:encoded>
			<wfw:commentRss>http://yelotofu.com/2010/06/how-to-get-fancybox-1-3-1-to-stay-put/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HTML5 Placeholders</title>
		<link>http://yelotofu.com/2010/06/tip-the-html5-placeholder/</link>
		<comments>http://yelotofu.com/2010/06/tip-the-html5-placeholder/#comments</comments>
		<pubDate>Tue, 01 Jun 2010 18:47:46 +0000</pubDate>
		<dc:creator>caphun</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[placeholder]]></category>
		<category><![CDATA[placeholders]]></category>

		<guid isPermaLink="false">http://yelotofu.com/?p=633</guid>
		<description><![CDATA[HTML5 adds a new attribute to most form elements called a placeholder. Its purpose is to add a short hint inside data entry points that disappear on focus. This type of interaction isn't new but is new to HTML as of version 5. For this reason not all browsers have implemented this feature. Try it [...]]]></description>
			<content:encoded><![CDATA[<p>HTML5 adds a new attribute to most form elements called a <a href="http://dev.w3.org/html5/spec/Overview.html#the-placeholder-attribute">placeholder</a>. Its purpose is to add a short hint inside data entry points that disappear on focus. This type of interaction isn't new but is new to HTML as of version 5. For this reason not all browsers have implemented this feature. Try it to see which of your browsers support the following bit of code!</p>
<p><strong>HTML</strong></p>
<pre class="brush: xml;">
&lt;input type=&quot;text&quot; placeholder=&quot;click me!&quot;&gt;
</pre>
<p>So now we have a problem. Some browsers support it and others don't!? Foresee client issues? Not to worry, here's a workaround using the latest jQuery 1.4 features!</p>
<p><strong>JavaScript</strong></p>
<pre class="brush: jscript;">
jQuery(document).ready(function($) {

  // first check if placeholder attribute is supported
  if ($('&lt;input/&gt;')
        .attr('placeholder','')[0]
        .placeholder === undefined) {

    // text input placeholder
    $('input[placeholder]')
      .each(function() {
        this.value === ''
          ? this.value = $(this).attr('placeholder')
          : false;
      })
      .live('focusin focusout', function(event) {
        event.type == 'focusout' &amp;&amp; this.value === ''
          ? this.value = $(this).attr('placeholder')
          : this.value === $(this).attr('placeholder')
            ? this.value = ''
            : false;
      });

  }

});
</pre>
<p>This is not a complete solution as there are other things to consider such as visual style and what happens when you submit the form. But I'll let you mull over those. <img src='http://yelotofu.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Demo and code sample: <a href="http://jsbin.com/ujosa/edit">http://jsbin.com/ujosa/edit</a></p>

<p><a href="http://feedads.g.doubleclick.net/~a/k-FipoVj5OX98a2Rl61KoffosLc/0/da"><img src="http://feedads.g.doubleclick.net/~a/k-FipoVj5OX98a2Rl61KoffosLc/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/k-FipoVj5OX98a2Rl61KoffosLc/1/da"><img src="http://feedads.g.doubleclick.net/~a/k-FipoVj5OX98a2Rl61KoffosLc/1/di" border="0" ismap="true"></img></a></p>]]></content:encoded>
			<wfw:commentRss>http://yelotofu.com/2010/06/tip-the-html5-placeholder/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery: Textarea maxlength</title>
		<link>http://yelotofu.com/2009/12/jquery-textarea-max-length/</link>
		<comments>http://yelotofu.com/2009/12/jquery-textarea-max-length/#comments</comments>
		<pubDate>Sun, 13 Dec 2009 10:00:38 +0000</pubDate>
		<dc:creator>caphun</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[HTML 5]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[maxlength]]></category>
		<category><![CDATA[textarea]]></category>

		<guid isPermaLink="false">http://yelotofu.com/?p=597</guid>
		<description><![CDATA[Being able to restrict the maximum length of user input from the interface directly is very convenient and practical in use. We do this a lot with input elements. Unfortunately textarea elements do not natively support the maxlength attribute. This attribute was finally added in HTML5 but at the time of writing Chrome is the [...]]]></description>
			<content:encoded><![CDATA[<p>Being able to restrict the maximum length of user input from the interface directly is very convenient and practical in use. We do this a lot with <code>input</code> elements. Unfortunately <code>textarea</code> elements do not natively support the <code>maxlength</code> attribute. This attribute was finally added in HTML5 but at the time of writing Chrome is the only browser supporting it.</p>
<p>Naturally many have used JavaScript to rectify this problem and I'd be doing the same here. The difference is we won't be putting anything special in the markup but will simply use the <code>maxlength</code> attribute within our <code>textarea</code> as if it's native &mdash;  like so:</p>
<p><strong>HTML</strong></p>
<pre class="brush: xml;">
&lt;textarea cols=&quot;30&quot; rows=&quot;5&quot; maxlength=&quot;10&quot;&gt;&lt;/textarea&gt;
</pre>
<p>This is looking good for HTML5 compatibility. And here's the magic:</p>
<p><strong>jQuery</strong> </p>
<pre class="brush: jscript;">
jQuery(function($) {

  // ignore these keys
  var ignore = [8,9,13,33,34,35,36,37,38,39,40,46];

  // use keypress instead of keydown as that's the only
  // place keystrokes could be canceled in Opera
  var eventName = 'keypress';

  // handle textareas with maxlength attribute
  $('textarea[maxlength]')

    // this is where the magic happens
    .live(eventName, function(event) {
      var self = $(this),
          maxlength = self.attr('maxlength'),
          code = $.data(this, 'keycode');

      // check if maxlength has a value.
      // The value must be greater than 0
      if (maxlength &amp;&amp; maxlength &gt; 0) {

        // continue with this keystroke if maxlength
        // not reached or one of the ignored keys were pressed.
        return ( self.val().length &lt; maxlength
                 || $.inArray(code, ignore) !== -1 );

      }
    })

    // store keyCode from keydown event for later use
    .live('keydown', function(event) {
      $.data(this, 'keycode', event.keyCode || event.which);
    });

});
</pre>
<p>See <a href="http://yelotofu.com/labs/jquery/snippets/textarea/">live example.</a></p>
<p>This code could probably be enhanced further by triggering custom events when the maximum length is reached or include a character counter of some sort within the keypress handler. Your imagination is the limit!</p>

<p><a href="http://feedads.g.doubleclick.net/~a/i7USOlVUz18CH-tyyomprn4Z42s/0/da"><img src="http://feedads.g.doubleclick.net/~a/i7USOlVUz18CH-tyyomprn4Z42s/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/i7USOlVUz18CH-tyyomprn4Z42s/1/da"><img src="http://feedads.g.doubleclick.net/~a/i7USOlVUz18CH-tyyomprn4Z42s/1/di" border="0" ismap="true"></img></a></p>]]></content:encoded>
			<wfw:commentRss>http://yelotofu.com/2009/12/jquery-textarea-max-length/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Tip: getting values from an options list</title>
		<link>http://yelotofu.com/2009/10/tip-getting-values-from-an-options-list/</link>
		<comments>http://yelotofu.com/2009/10/tip-getting-values-from-an-options-list/#comments</comments>
		<pubDate>Wed, 21 Oct 2009 19:16:56 +0000</pubDate>
		<dc:creator>caphun</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[array]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[jquerymap]]></category>
		<category><![CDATA[optionslist]]></category>

		<guid isPermaLink="false">http://yelotofu.com/?p=579</guid>
		<description><![CDATA[So, if you've ever converted an options list into a single array of values you might have intuitively done this: var select = $('#mySelectElement')[0]; var values = new Array(); for (var i=0; i &#60; select.length; i++) { values.push(select.options[i].value); } Pretty boring aye? There is a snazzier (is that a word?) alternative, which is to use [...]]]></description>
			<content:encoded><![CDATA[<p>So, if you've ever converted an options list into a single array of values you might have intuitively done this:</p>
<pre class="brush: jscript;">
var select = $('#mySelectElement')[0];
var values = new Array();
for (var i=0; i &lt; select.length; i++) {
  values.push(select.options[i].value);
}
</pre>
<p>Pretty boring aye? </p>
<p>There is a snazzier (is that a word?) alternative, which is to use jQuery.map:</p>
<pre class="brush: jscript;">
var select = $('#mySelectElement')[0];
var values = $.map(select.options, function(n) {
    return n.value;
});
</pre>
<p>OK, only one line saving but doesn't that feel good?!?</p>

<p><a href="http://feedads.g.doubleclick.net/~a/723oJelvb1NtUc2KZl25nBn1AUM/0/da"><img src="http://feedads.g.doubleclick.net/~a/723oJelvb1NtUc2KZl25nBn1AUM/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/723oJelvb1NtUc2KZl25nBn1AUM/1/da"><img src="http://feedads.g.doubleclick.net/~a/723oJelvb1NtUc2KZl25nBn1AUM/1/di" border="0" ismap="true"></img></a></p>]]></content:encoded>
			<wfw:commentRss>http://yelotofu.com/2009/10/tip-getting-values-from-an-options-list/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Happy Birthday Google Chrome!</title>
		<link>http://yelotofu.com/2009/09/happy-birthday-google-chrome/</link>
		<comments>http://yelotofu.com/2009/09/happy-birthday-google-chrome/#comments</comments>
		<pubDate>Fri, 04 Sep 2009 11:50:35 +0000</pubDate>
		<dc:creator>caphun</dc:creator>
				<category><![CDATA[Browser Testing]]></category>
		<category><![CDATA[browsers]]></category>
		<category><![CDATA[chrome]]></category>
		<category><![CDATA[googlechrome]]></category>

		<guid isPermaLink="false">http://yelotofu.com/?p=565</guid>
		<description><![CDATA[Wow, it's been a year already? Time certainly flies when you're having fun! It seems the Google Chrome team have been hard at work! They've finally made a version of Google Chrome for Mac and Linux which you could download from the Dev channel. Had a quick test and found Print and Application shortcuts haven't [...]]]></description>
			<content:encoded><![CDATA[<p>Wow, it's been <a href="http://chrome.blogspot.com/2009/09/google-chrome-turns-1.html">a year already</a>? Time certainly flies when you're having fun! It seems the Google Chrome team have been hard at work! They've finally made a version of <a href="http://dev.chromium.org/getting-involved/dev-channel">Google Chrome for Mac and Linux</a> which you could download from the Dev channel.</p>
<p>Had a quick test and found Print and Application shortcuts haven't been implemented yet. Chrome also died on me a few times unexpectedly (doesn't seem to cope too well with our QUnit test pages). Overall I like the minimal interface and speedier JavaScript response times. It could only get better!</p>

<p><a href="http://feedads.g.doubleclick.net/~a/UBvWZpXtRBz6KvC-q0KLT3hPhuc/0/da"><img src="http://feedads.g.doubleclick.net/~a/UBvWZpXtRBz6KvC-q0KLT3hPhuc/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/UBvWZpXtRBz6KvC-q0KLT3hPhuc/1/da"><img src="http://feedads.g.doubleclick.net/~a/UBvWZpXtRBz6KvC-q0KLT3hPhuc/1/di" border="0" ismap="true"></img></a></p>]]></content:encoded>
			<wfw:commentRss>http://yelotofu.com/2009/09/happy-birthday-google-chrome/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Zend Server CE and Snow Leopard Problem</title>
		<link>http://yelotofu.com/2009/09/zend-server-ce-and-snow-leopard-problem/</link>
		<comments>http://yelotofu.com/2009/09/zend-server-ce-and-snow-leopard-problem/#comments</comments>
		<pubDate>Thu, 03 Sep 2009 16:32:30 +0000</pubDate>
		<dc:creator>caphun</dc:creator>
				<category><![CDATA[Ramblings]]></category>
		<category><![CDATA[snowleopard]]></category>
		<category><![CDATA[zendserver]]></category>
		<category><![CDATA[zendserverce]]></category>

		<guid isPermaLink="false">http://yelotofu.com/2009/09/zend-server-ce-and-snow-leopard-problem/</guid>
		<description><![CDATA[There's a compatibility issue with the Java Bridge in Zend Server CE which results in failure of the ZendServer admin interface. A temporary fix could be found at http://forums.zend.com/viewtopic.php?f=44&#038;t=1115 I found this out the hard way - reinstalled and digged the internals before realizing it was a compatibility issue. I hope the Zend guys fix [...]]]></description>
			<content:encoded><![CDATA[<p>There's a compatibility issue with the Java Bridge in Zend Server CE which results in failure of the ZendServer admin interface. A temporary fix could be found at <a href="http://forums.zend.com/viewtopic.php?f=44&t=1115">http://forums.zend.com/viewtopic.php?f=44&t=1115</a></p>
<p>I found this out the hard way - reinstalled and digged the internals before realizing it was a compatibility issue. I hope the Zend guys fix this soon!</p>
<p>Oh, I'm on Zend Server CE 4.0.5</p>

<p><a href="http://feedads.g.doubleclick.net/~a/YPzPLPNEcwGDkCDJ9XZxagmij7w/0/da"><img src="http://feedads.g.doubleclick.net/~a/YPzPLPNEcwGDkCDJ9XZxagmij7w/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/YPzPLPNEcwGDkCDJ9XZxagmij7w/1/da"><img src="http://feedads.g.doubleclick.net/~a/YPzPLPNEcwGDkCDJ9XZxagmij7w/1/di" border="0" ismap="true"></img></a></p>]]></content:encoded>
			<wfw:commentRss>http://yelotofu.com/2009/09/zend-server-ce-and-snow-leopard-problem/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Labs: UI inlineEdit</title>
		<link>http://yelotofu.com/2009/09/ui-inlineedit/</link>
		<comments>http://yelotofu.com/2009/09/ui-inlineedit/#comments</comments>
		<pubDate>Tue, 01 Sep 2009 17:32:50 +0000</pubDate>
		<dc:creator>caphun</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[in-place-edit]]></category>
		<category><![CDATA[inline-edit]]></category>
		<category><![CDATA[inlineedit]]></category>
		<category><![CDATA[inplaceedit]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[JQuery UI]]></category>
		<category><![CDATA[jqueryui]]></category>

		<guid isPermaLink="false">http://yelotofu.com/?p=547</guid>
		<description><![CDATA[After my last tutorial on building a simple inlineEdit plugin I converted the concepts into a UI widget. It's now sitting in labs for you to use, pick apart and devour: http://jquery-ui.googlecode.com/svn/branches/labs/inlineedit/demo.html If you inspect the source code you will notice the structure is quite different. It's actually pretty much the same functionality wise but [...]]]></description>
			<content:encoded><![CDATA[<p>After my last tutorial on building a simple <a href="http://yelotofu.com/2009/08/jquery-inline-edit-tutorial/">inlineEdit plugin</a> I converted the concepts into a UI widget. It's now sitting in labs for you to use, pick apart and devour:</p>
<p><a href="http://jquery-ui.googlecode.com/svn/branches/labs/inlineedit/demo.html">http://jquery-ui.googlecode.com/svn/branches/labs/inlineedit/demo.html<br />
</a></p>
<p>If you inspect the <a href="http://jquery-ui.googlecode.com/svn/branches/labs/inlineedit/ui.inlineEdit.js" target="_blank">source code</a> you will notice the structure is quite different. It's actually pretty much the same functionality wise but I have separated each piece into smaller chunks. This makes it easier to extend in future (I plan to write more on ways to extend UI widgets in another post).</p>
<p>Here's a quick peek at the features:</p>
<ul>
<li>Basic inline editing - click, edit, save</li>
<li>Ability to save on pressing ENTER key</li>
<li>Cancel by un-focussing the input or clicking cancel</li>
<li>ThemeRoller ready</li>
<li>Customisable empty placeholder</li>
<li>Save and Cancel callbacks</li>
<li>Cancelable Save callback (so you could script a cancel action)</li>
</ul>
<p>As usual please feedback and help improve this widget either by commenting here or on the <a href="http://wiki.jqueryui.com/InlineEdit">InlineEdit design & planning page</a></p>
<p>Enjoy!</p>

<p><a href="http://feedads.g.doubleclick.net/~a/LwkRvjv6v45ggldPXGS3jPk7pXI/0/da"><img src="http://feedads.g.doubleclick.net/~a/LwkRvjv6v45ggldPXGS3jPk7pXI/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/LwkRvjv6v45ggldPXGS3jPk7pXI/1/da"><img src="http://feedads.g.doubleclick.net/~a/LwkRvjv6v45ggldPXGS3jPk7pXI/1/di" border="0" ismap="true"></img></a></p>]]></content:encoded>
			<wfw:commentRss>http://yelotofu.com/2009/09/ui-inlineedit/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Tip: Obtaining Request Parameters in Zend_View</title>
		<link>http://yelotofu.com/2009/08/tip-request-params-in-zend_view/</link>
		<comments>http://yelotofu.com/2009/08/tip-request-params-in-zend_view/#comments</comments>
		<pubDate>Thu, 06 Aug 2009 15:11:43 +0000</pubDate>
		<dc:creator>caphun</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://yelotofu.com/?p=521</guid>
		<description><![CDATA[I found it virtually impossible to obtain GET or POST request parameters in Zend_View without resorting to accessing the $_GET or $_POST variables. Directly accessing these variables within Zend_View is bad practice so it's been suppressed on purpose to keep processing where it should be - within the Controller. However it is possible to get [...]]]></description>
			<content:encoded><![CDATA[<p>I found it virtually impossible to obtain GET or POST request parameters in Zend_View without resorting to accessing the $_GET or $_POST variables. Directly accessing these variables within Zend_View is bad practice so it's been suppressed on purpose to keep processing where it should be - within the Controller. However it is possible to get hold of these variables properly and that is to pass them from the Controller.</p>
<p>Example. You have a query string that looks like this <code>?keyword=test</code> and want to show it in your view, here's what to do:</p>
<p>MyController.php</p>
<pre class="brush: php;">
public function indexAction() {
  $this-&gt;view-&gt;request = $this-&gt;getRequest();
}
</pre>
<p>my-controller/index.phtml</p>
<pre class="brush: xml;">
The keyword is &lt;?= $this-&gt;request-&gt;keyword ?&gt;
</pre>
<p>Thanks!</p>

<p><a href="http://feedads.g.doubleclick.net/~a/nffD3zjnE_6UaLZDa-zwntogJas/0/da"><img src="http://feedads.g.doubleclick.net/~a/nffD3zjnE_6UaLZDa-zwntogJas/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/nffD3zjnE_6UaLZDa-zwntogJas/1/da"><img src="http://feedads.g.doubleclick.net/~a/nffD3zjnE_6UaLZDa-zwntogJas/1/di" border="0" ismap="true"></img></a></p>]]></content:encoded>
			<wfw:commentRss>http://yelotofu.com/2009/08/tip-request-params-in-zend_view/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery Inline Edit tutorial</title>
		<link>http://yelotofu.com/2009/08/jquery-inline-edit-tutorial/</link>
		<comments>http://yelotofu.com/2009/08/jquery-inline-edit-tutorial/#comments</comments>
		<pubDate>Wed, 05 Aug 2009 22:04:41 +0000</pubDate>
		<dc:creator>caphun</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[editinplace]]></category>
		<category><![CDATA[inlineedit]]></category>
		<category><![CDATA[inplaceedit]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[plugin]]></category>

		<guid isPermaLink="false">http://yelotofu.com/?p=469</guid>
		<description><![CDATA[A friend recently asked me to review his edit-in-place code which turned out to be a modification of the one found at http://docs.jquery.com/Tutorials:Edit_in_Place_with_Ajax. Reading the tutorial on that page I asked myself how I would do this differently? Defining a global setClickable() function and then calling $('#editInPlace").click() is totally uncool, essentially limiting yourself to one [...]]]></description>
			<content:encoded><![CDATA[<p>A friend recently asked me to review his edit-in-place code which turned out to be a modification of the one found at <a href="http://docs.jquery.com/Tutorials:Edit_in_Place_with_Ajax" target="_blank">http://docs.jquery.com/Tutorials:Edit_in_Place_with_Ajax</a>. Reading the tutorial on that page I asked myself how I would do this differently? Defining a global <code>setClickable()</code> function and then calling <code>$('#editInPlace").click()</code> is totally uncool, essentially limiting yourself to one edit-in-place area per page.</p>
<p>Since the concept of edit-in-place is so simple and the implementation should be likewise I want to try and tackle this as a tutorial by going through concepts and teaching to build from scratch.</p>
<h2>The concept</h2>
<p>There's a piece of text on a page, e.g. a heading or paragraph, looking plain and un-interesting. When you hover over it however a visual highlight, usually pale yellow, indicates that it's something special - an editable region. You then click on the text and it magically transforms into an editable box with save and cancel buttons tagged at the end. On clicking either save or cancel the editable box transforms back into its original form with text updated if saved.</p>
<h2>The build</h2>
<p>What we want to do is put these concepts into code whilst building something that's re-usable. A plugin will do the trick! Let's call our plugin inlineEdit.</p>
<p>We are only 3 steps away from achieving our goal! Follow along...</p>
<h3>Step 1: Getting the basics right</h3>
<p>The basic functionality consists of a static text element (<code>span</code>, <code>div</code> etc...) that can transforms into an <code>input</code> element on click. And on hover the text element will highlight to indicate special interactions.</p>
<p>Here's our first pass: <a href="http://yelotofu.com/labs/jquery/snippets/inlineEdit/demo_basics.html">Basic Interaction</a> </p>
<p><strong>Code explanation:</strong> Our plugin accepts a CSS class name defined in a stylesheet which is used to toggle the text element's classname - a class defining a background-color typically #ffC is sufficient for this. On clicking we replace the entire contents of the original text element with an <code>input</code> element and pass the original content into the <code>input</code> as its value. For now changes are saved when the <code>input</code> loses focus.</p>
<h3>Step 2: Save, Cancel &amp; Callbacks</h3>
<p>As you may notice above we saved on blur and there is no way of canceling changes. Let's improve the interaction by adding a save button. This is important as you'd want to do something with the changes or allow a user to manually cancel. Every application does something different at the saving stage so we'll simply define a save callback and let the implementer decide what to do on save, be it Ajax post or what not. The save action is also cancelable by returning false inside the callback.</p>
<p>Here is our second pass: <a href="http://yelotofu.com/labs/jquery/snippets/inlineEdit/demo_callbacks.html">Save, cancel and callbacks</a> </p>
<h3>Step 3: Finishing Off</h3>
<p>Our plugin is nearly there. Just a few nice finishing touches remaining. We want to give the user ability to change the button label and pass an initial value. Also to make the plugin more re-usable we want to move the core plugin code out to a separate file and reference it instead. To set the stage for further improvements in the future we also split the code into two distinct clauses.</p>
<p>Final result:  <a href="http://yelotofu.com/labs/jquery/snippets/inlineEdit/demo_final.html">Live Demo</a> and <a href="http://github.com/caphun/jquery.inlineedit" target="_blank">source code is here</a></p>
<h2>Usage</h2>
<p>Now to use this brand spanking new plugin we simply apply it to any DOM element like so:</p>
<p>HTML</p>
<pre class="brush: xml;">
&lt;span class=&quot;editable&quot;&gt;Hello World!&lt;/span&gt;
</pre>
<p>JavaScript - Basic</p>
<pre class="brush: jscript;">
$(function() {
  $('.editable').inlineEdit();
});
</pre>
<p>JavaScript - Customised button label with save callback</p>
<pre class="brush: jscript;">
$(function() {
  $('.editable').inlineEdit({
    buttonText: 'Add',
    save: function(e, data) {
      return confirm('Change name to '+ data.value +'?');
    }
  });
});
</pre>
<p><strong>Feedback welcome</strong> - if you happen to improve upon this code base please share-a-like! </p>
<p>Enjoy!</p>
<p><strong>Update 26-Aug-09:</strong> Added placeholder for cases when text is empty; changed label option to buttonText to minimise confusion.</p>
<p><strong>Update 18-Oct-09</strong> Fixed bug in setting initial value via script.</p>
<p><strong>Update 17-Jan-10</strong> Moved code to <a href="http://github.com/caphun/jquery.inlineedit">http://github.com/caphun/jquery.inlineedit</a>. I will continue to improve this plugin from there. Feel free to fork it!</p>

<p><a href="http://feedads.g.doubleclick.net/~a/M26h1rwEg2kobCgWi3u_PcGkkwQ/0/da"><img src="http://feedads.g.doubleclick.net/~a/M26h1rwEg2kobCgWi3u_PcGkkwQ/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/M26h1rwEg2kobCgWi3u_PcGkkwQ/1/da"><img src="http://feedads.g.doubleclick.net/~a/M26h1rwEg2kobCgWi3u_PcGkkwQ/1/di" border="0" ismap="true"></img></a></p>]]></content:encoded>
			<wfw:commentRss>http://yelotofu.com/2009/08/jquery-inline-edit-tutorial/feed/</wfw:commentRss>
		<slash:comments>61</slash:comments>
		</item>
	</channel>
</rss>
