<?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>Petersen Did It &#187; Posts</title>
	<atom:link href="http://blog.petersendidit.com/post/category/posts/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.petersendidit.com</link>
	<description>blog of david petersen</description>
	<lastBuildDate>Tue, 03 Aug 2010 19:42:11 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Fast jQuery each when you need $(this)</title>
		<link>http://blog.petersendidit.com/post/fast-jquery-each-when-you-need-this/</link>
		<comments>http://blog.petersendidit.com/post/fast-jquery-each-when-you-need-this/#comments</comments>
		<pubDate>Tue, 03 Aug 2010 19:42:11 +0000</pubDate>
		<dc:creator>petersendidit</dc:creator>
				<category><![CDATA[Posts]]></category>

		<guid isPermaLink="false">http://blog.petersendidit.com/?p=165</guid>
		<description><![CDATA[Most of the time you use the jQuery $.fn.each function you end up doing $(this) inside the function that is getting looped.  You want access the jQuery magic in your loop.  It&#8217;s always seemed weird to me that $.fn.each didn&#8217;t pass your function a jQuery version of the element, since you already selected it in [...]]]></description>
			<content:encoded><![CDATA[<p>Most of the time you use the jQuery $.fn.each function you end up doing $(this) inside the function that is getting looped.  You want access the jQuery magic in your loop.  It&#8217;s always seemed weird to me that $.fn.each didn&#8217;t pass your function a jQuery version of the element, since you already selected it in order to do the $.fn.each call.  Well <a href="http://james.padolsey.com/" target="_blank">James Padolsey</a> started playing and created a <a href="http://gist.github.com/500145" target="benalman2">quickEach plugin</a> that passes in a jQueryized version of this.  Then <a href="http://benalman.com/" target="_blank">Ben Alman</a> started playing with it and ended up with a <a href="http://benalman.com/projects/jquery-misc-plugins/#each2" target="_blank">$.fn.each2</a> plugin. It is optimize just for the case where you need a jQueryized version of this in the loop, it is <a href="http://jsperf.com/jquery-each2-vs-each" target="_blank">slower then the built in $.fn.each function</a> when you don&#8217;t.</p>
<pre class="brush: javascript">
// jQuery each2 plugin usage:
$(&#039;a&#039;).each2(function( i, jq ){
this; // DOM element
i; // DOM element index
jq; // jQuery object
});

// jQuery core .each method usage:
$(&#039;a&#039;).each(function( i, elem ){
this; // DOM element ( this === elem )
i; // DOM element index
$(this); // jQuery object
});
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.petersendidit.com/post/fast-jquery-each-when-you-need-this/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery UI 1.8 Widget Factory</title>
		<link>http://blog.petersendidit.com/post/jquery-ui-1-8-widget-factory/</link>
		<comments>http://blog.petersendidit.com/post/jquery-ui-1-8-widget-factory/#comments</comments>
		<pubDate>Thu, 18 Mar 2010 14:47:29 +0000</pubDate>
		<dc:creator>petersendidit</dc:creator>
				<category><![CDATA[Posts]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[jQuery UI]]></category>
		<category><![CDATA[widget factory]]></category>

		<guid isPermaLink="false">http://blog.petersendidit.com/?p=157</guid>
		<description><![CDATA[jQuery UI 1.8 is set to have its final release any moment now and with it comes an updated Widget Factory.  If you haven&#8217;t used the widget factory before it&#8217;s a great piece of code that does the generic jQuery plugin type of things for you.  You can read more about the widget factory in [...]]]></description>
			<content:encoded><![CDATA[<p>jQuery UI 1.8 is set to have its final release any moment now and with it comes an updated Widget Factory.  If you haven&#8217;t used the widget factory before it&#8217;s a great piece of code that does the generic jQuery plugin type of things for you.  You can read more about the <a href="http://blog.petersendidit.com/post/stateful-jquery-plugins-with-jquery-uis-widget-factory/">widget factory in this older post</a> I did about it.</p>
<p>In jQuery UI 1.8 the Widget Factory gets a few very welcomed changes.  First default options are no longer defined outside of the widget, you now add an options property to the object you are passing $.widget and it will take care of merging your defined default options with the options the plugin gets initialized with.  This also means that in order to set global default options on the core jQuery UI widgets you need to now use $.ui.foo.prototype.options rather than $.ui.foo.defaults.  Also you no longer have to define getter methods like you did in 1.7.  In 1.8 any method that returns a value other then the plugin instance ( this ) or undefined it will assume it&#8217;s a getter and return that value.  This is sweet because now you can define a method that is a chainable setter and a getter.  The option method now returns the full options hash when called without any paramaters.</p>
<p>The _init method has been renamed to _create and a new _init method was created.  Yes go ahead and read that again I had to do a double take too.  Basically _create is now called only once when the plugin is first initialized and should contain all the logic to set up the widget.  The new _init method gets called every time the plugin gets called without passing a name of a method.  So when you do: $(&#8216;.selector&#8217;).dialog({ height: 530 }); the first time both _create and _init get called.  If you call that again later only _init will be called.  This was created to fix a misunderstanding many people were having with the dialog plugin.  Many people were calling $(&#8216;.selector&#8217;).dialog(); and a dialog would open up, then later in the code they wold call the same thing and expect the dialog to popup. By having _init be called every time there is not a method provided it lets the dialog decide if it should open back up if it&#8217;s called again.</p>
<p>The _setData method got renamed to _setOption to fit better with what is actually happening.  Destroy now handles removing all widget-namespaced events for the plugin that are bound to this.element or this.widget().  Meaning name space your events and you don&#8217;t have to do the extra work of cleaning them up.</p>
<p>One very sweet thing is now you can create a new widget that extends an existing widget.  Just by doing something like: $.widget(&#8216;myCustomDatePicker&#8217;, $.ui.datepicker, { //all my custom methods }); which makes it very easy to create a custom widget that can expand upon and use functionality that is already in another jQuery UI plugin.</p>
<p>There are a few other changes but these are the ones that perked my attention.  If you want more information check out the <a href="http://jqueryui.com/docs/Upgrade_Guide#Widget_Factory" target="_blank">Upgrade Guide for 1.8 </a> and check out <a href="http://docs.jquery.com/UI/Upgrade_Guide_18" target="_blank">Scott Gonzalez&#8217;s jQuery UI example code</a> for migrating the widget factory from 1.7 to 1.8.  If you&#8217;re including the jQuery UI core in to your page and not using the jQuery UI Widget Factory to create your plugins you should start asking yourself WHY?</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.petersendidit.com/post/jquery-ui-1-8-widget-factory/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>jQuery focusoutside event</title>
		<link>http://blog.petersendidit.com/post/jquery-focusoutside-event/</link>
		<comments>http://blog.petersendidit.com/post/jquery-focusoutside-event/#comments</comments>
		<pubDate>Sun, 14 Mar 2010 20:40:53 +0000</pubDate>
		<dc:creator>petersendidit</dc:creator>
				<category><![CDATA[Posts]]></category>
		<category><![CDATA[clickoutside]]></category>
		<category><![CDATA[focusin]]></category>
		<category><![CDATA[focusoutside]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Stackoverflow]]></category>

		<guid isPermaLink="false">http://blog.petersendidit.com/?p=153</guid>
		<description><![CDATA[I was doing my part helping out on StackOverflow in the jQuery tag yesterday and ran across a question asking how to hide a div on blur of an input field as long as the click wasn&#8217;t inside a div that &#8220;connected&#8221; to that input field.  What I ended up with for an answer was [...]]]></description>
			<content:encoded><![CDATA[<p>I was doing my part helping out on <a href="http://stackoverflow.com/" target="_blank">StackOverflow</a> in the jQuery tag yesterday and ran across a <a href="http://stackoverflow.com/questions/2426438/2427363" target="_blank">question asking how to hide a div on blur of an input field as long as the click wasn&#8217;t inside a div that &#8220;connected&#8221; to that input field</a>.  What I ended up with for an <a href="http://stackoverflow.com/questions/2426438/2427363#2427363" target="_blank">answer</a> was to bind a click and a focusin event on the document and check of the event.target was or is a child of the div we care about.  The <a href="http://api.jquery.com/focusin/" target="_blank">focusin event</a> is a special focus event the bubbles since the normal focus event does not. I needed to use the focusin event incase the user tabbed to the next field rather then clicking. This got me thinking, <a href="http://benalman.com/" target="_blank">Ben Alman</a> created a custom <a href="http://benalman.com/projects/jquery-clickoutside-plugin/" target="_blank">jQuery event &#8216;clickoutside&#8217;</a> for those times when you need to know that the user just clicked outside of your div and you should now close it. If the same code could also handle the focusin event then it would make answering that question very slick.  So I <a href="http://github.com/petersendidit/jquery-clickoutside/blob/master/jquery.ba-clickoutside.js" target="_blank">forked</a> Ben Alman&#8217;s clickoutside event on github and did some <a href="http://github.com/petersendidit/jquery-clickoutside/blob/master/jquery.ba-clickoutside.js" target="_blank">hacking to add the focusoutside event</a>.  I am sure the code could be shorted up even more then it is now but it works nicely.</p>
<p><strong>UPDATE</strong></p>
<p>My hacking inspired Ben to do some hacking of his own and we worked on making the plugin work for all the native jQuery events that made since to have outside versions.  Check out the new <a href="http://benalman.com/projects/jquery-outside-events-plugin/" target="_blank">jQuery Outside Events</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.petersendidit.com/post/jquery-focusoutside-event/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>jQuery is a&#8217;movin</title>
		<link>http://blog.petersendidit.com/post/jquery-is-amovin/</link>
		<comments>http://blog.petersendidit.com/post/jquery-is-amovin/#comments</comments>
		<pubDate>Mon, 01 Feb 2010 14:47:01 +0000</pubDate>
		<dc:creator>petersendidit</dc:creator>
				<category><![CDATA[Posts]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[jQuery UI]]></category>
		<category><![CDATA[widget factory]]></category>

		<guid isPermaLink="false">http://blog.petersendidit.com/?p=151</guid>
		<description><![CDATA[Lot&#8217;s has happen in the past month with jQuery. 14 days of jQuery &#8211; We had 14 days of great links videos and info leading up and after the release of jQuery 1.4. jQuery API &#8211; the jQuery API doc&#8217;s got a much needed overhall and are now running on WordPress.  Some very slick searching [...]]]></description>
			<content:encoded><![CDATA[<p>Lot&#8217;s has happen in the past month with jQuery.</p>
<p><strong><a href="http://jquery14.com/">14 days of jQuery</a></strong> &#8211; We had 14 days of great links videos and info leading up and after the release of jQuery 1.4.</p>
<p><strong><a href="api.jquery.com/">jQuery API</a><span style="font-weight: normal;"> &#8211; the jQuery API doc&#8217;s got a much needed overhall and are now running on WordPress.  Some very slick searching and the ability to comment on the documentation has brought live back in to the docs.</span></strong></p>
<p><a href="http://jquery.com/"><strong>jQuery 1.4</strong></a> was released in to the wild with tons of bug fixes, lots of speed enhancements and a few nice new features sprinkled on top to make it the prefect candy for all jQuery users to quickly flock to.</p>
<p><strong><a href="forum.jquery.com/">jQuery Forums</a></strong> packed up and moved from Google to Zoho which has produced a spam free forum again for the jQuery community</p>
<p><a href="http://jqueryui.com/"><strong>jQuery UI 1.8 rc1</strong></a> has been released with a final release soon to come, bringing us 2 new widgets, button and autocomplete, along with a lot of bug fixes and improvements including an overhauled widget factory.</p>
<p><a href="http://jqapi.com/"><strong>jQAIP</strong></a> an alternative viewer of the jQuery Doc&#8217;s was released for those who don&#8217;t like the design or workings of api.jquery.com.  Has its own nice search features and keyboard navigation.</p>
<p><strong><a href="http://james.padolsey.com/jquery/#v=1.4&amp;fn=css">jQuery Source Viewer</a></strong> &#8211; a quick and easy way to search through the jQuery source code.  Something that every jQuery developer should start doing after they learn the basics of jQuery.</p>
<p>I am looking forward to updating my projects to jQuery 1.4 and jQuery UI 1.8.  Will be interesting to see what the jQuery community can produce next.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.petersendidit.com/post/jquery-is-amovin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Event listener add remove add remove . . . .</title>
		<link>http://blog.petersendidit.com/post/event-listener-add-remove/</link>
		<comments>http://blog.petersendidit.com/post/event-listener-add-remove/#comments</comments>
		<pubDate>Sun, 29 Nov 2009 20:01:32 +0000</pubDate>
		<dc:creator>petersendidit</dc:creator>
				<category><![CDATA[Posts]]></category>

		<guid isPermaLink="false">http://blog.petersendidit.com/?p=145</guid>
		<description><![CDATA[Something I have seen in many people have problems with on Stack Overflow, jquery&#8217;s google group, and forums is people who are assigning an event listener and then because something happens, normally because the thing is being animated, they kill the event listener and then once the animation is finished they add it back. You [...]]]></description>
			<content:encoded><![CDATA[<p>Something I have seen in many people have problems with on Stack Overflow, jquery&#8217;s google group, and forums is people who are assigning an event listener and then because something happens, normally because the thing is being animated, they kill the event listener and then once the animation is finished they add it back. You end up mucking with the element far more then you really need to.</p>
<p>Example of what I am seeing:</p>
<pre class="brush: javascript">
var doclick = function(){
    $(this).animate({&#039;left&#039;:200},function(){
        $(this).bind(&#039;click&#039;,doclick);
    }).unbind(&#039;click&#039;);
};
$(&#039;li&#039;).bind(&#039;click&#039;,doclick);
</pre>
<p>You have duplicated code and will get very messy very quickly as more functionality gets added.</p>
<p>It would be much better to check if the thing is animated and if so just exit:</p>
<pre class="brush: javascript">
var doclick = function(){
    if ($(this).is(&#039;:animated&#039;)) return false;
    $(this).animate({&#039;left&#039;:200});
};
$(&#039;li&#039;).bind(&#039;click&#039;,doclick);
</pre>
<p>No adding and removing the event listeners just decide if you really care if was clicked.<br />
It doesn&#8217;t event need to be if its animated you can just use a flag to decide:</p>
<pre class="brush: javascript">
var flag = false;
var doclick = function(){
    if (flag) return false;
    $(this).animate({&#039;left&#039;:200});
};
$(&#039;li&#039;).bind(&#039;click&#039;,doclick);
$(&#039;div.stopclicks&#039;).bind(&#039;click&#039;,function(){
    flag = true;
});
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.petersendidit.com/post/event-listener-add-remove/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Think about your users first before getting out the paint brush</title>
		<link>http://blog.petersendidit.com/post/think-about-your-users-first-before-getting-out-the-paint-brush/</link>
		<comments>http://blog.petersendidit.com/post/think-about-your-users-first-before-getting-out-the-paint-brush/#comments</comments>
		<pubDate>Wed, 11 Nov 2009 19:18:35 +0000</pubDate>
		<dc:creator>petersendidit</dc:creator>
				<category><![CDATA[Posts]]></category>

		<guid isPermaLink="false">http://blog.petersendidit.com/?p=141</guid>
		<description><![CDATA[I am working on slicing up a pretty large site that a group of 3 designers have been working on. They are creating psd files for almost every page to define the layout and modules used on each page. After looking over the designs I started seeing things that look very &#8220;pretty&#8221; but make it [...]]]></description>
			<content:encoded><![CDATA[<p>I am working on slicing up a pretty large site that a group of 3 designers have been working on.  They are creating psd files for almost every page to define the layout and modules used on each page. After looking over the designs I started seeing things that look very &#8220;pretty&#8221; but make it so the user has to think or do something that is not what they naturally would do.</p>
<p>On the news section of the site the page has a list of the different news articles that have been published.  When you click on an article to read it a &#8220;lightbox&#8221; type popup will open up with the article content. Having the article open up in a lightbox type of popup in the page is new and different but I don&#8217;t know if I would call it bad. It does let make it very quick and easy to get back to the list but it I don&#8217;t know if its that much better then loading new content in the page and then clicking the back button rather then a close button.</p>
<p>If that news article is longer then the defined height of the &#8220;lightbox&#8221; the designers wanted the article to be split up in to pages and to add the slick looking page buttons at the bottom. Wait, you want the user to click a button and have what they are currently reading removed and replaced with the next &#8220;page&#8221; of content, making it so they can&#8217;t look back at the rest of the article.  How many people are just going to decide that the rest of the article isn&#8217;t worth it and just close the &#8220;lightbox&#8221;?</p>
<p>The user is going to get to the bottom of the first &#8220;page&#8221; of the article and spin the mouse wheel a few times, when that doesn&#8217;t work he is going to look for a scroll bar.  After he finds that there isn&#8217;t a scroll bar he is going to re-read that last sentence and make sure he really was right in thinking that there is more content.  Then he is going to finally see those slick looking page buttons and click on the next arrow.</p>
<p>The design makes the user have to think multiple time just to read the content that we are trying so hard to get him to read.  Yes there are times when making a user learn something new makes the usability better, but it has to be worth the users time to spend learning.  When you are trying to get a user to read your content you want it to be as simple and easy for him to do that, not make him think about why he just spend 30 seconds trying to figure out how to get more content.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.petersendidit.com/post/think-about-your-users-first-before-getting-out-the-paint-brush/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SSH host name completion on a Mac</title>
		<link>http://blog.petersendidit.com/post/ssh-host-name-completion-on-a-mac/</link>
		<comments>http://blog.petersendidit.com/post/ssh-host-name-completion-on-a-mac/#comments</comments>
		<pubDate>Thu, 01 Oct 2009 14:27:14 +0000</pubDate>
		<dc:creator>petersendidit</dc:creator>
				<category><![CDATA[Posts]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[osx]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[tab completion]]></category>

		<guid isPermaLink="false">http://blog.petersendidit.com/?p=138</guid>
		<description><![CDATA[The list of servers I have to ssh in to is continually growing many of them I need to have an ssh tunnel to get to so I fully use the ~/.ssh/config file to help me out. Now that my .ssh/config file has grown I am starting to forget what name of that one server [...]]]></description>
			<content:encoded><![CDATA[<p>The list of servers I have to ssh in to is continually growing many of them I need to have an ssh tunnel to get to so I fully use the ~/.ssh/config file to help me out.  Now that my .ssh/config file has grown I am starting to forget what name of that one server was.  On some unix boxes <a href="http://www.caliban.org/bash/" target="_blank">bash_completion</a> is installed which allows you to type: ssh se[tab] and get: ssh servernamethatisreallylog.com. bash_completion is not installed on the Mac by default.  You can install it with <a href="http://www.macports.org/" target="_blank">macports</a> but I have yet to run in to a real need to install macports yet so I started searching for any other ways to get this working on my Mac.</p>
<p>What I found was a comment on a <a href="http://www.macosxhints.com/article.php?story=20080317085050719" target="_blank">MacOSXHints hint</a>.<br />
All you need to do is throw this in your ~/.bash_profile file.</p>
<pre class="brush: bash">
_complete_ssh_hosts ()
{
        COMPREPLY=()
        cur=&quot;${COMP_WORDS[COMP_CWORD]}&quot;
        comp_ssh_hosts=`cat ~/.ssh/known_hosts | \
                        cut -f 1 -d &#039; &#039; | \
                        sed -e s/,.*//g | \
                        grep -v ^# | \
                        uniq | \
                        grep -v &quot;\[&quot; ;
                if [ -f ~/.ssh/config ]; then
                        cat ~/.ssh/config | \
                                grep &quot;^Host &quot; | \
                                awk &#039;{print $2}&#039;
                fi
                `
        COMPREPLY=( $(compgen -W &quot;${comp_ssh_hosts}&quot; -- $cur))
        return 0
}
complete -F _complete_ssh_hosts ssh
</pre>
<p>This will read in your .ssh/known_hosts file and your .ssh/config file and create a list of host names that you can now tab complete with the ssh command.  Comes in very handy. </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.petersendidit.com/post/ssh-host-name-completion-on-a-mac/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Stateful jQuery plugins with jQuery UI&#8217;s widget factory</title>
		<link>http://blog.petersendidit.com/post/stateful-jquery-plugins-with-jquery-uis-widget-factory/</link>
		<comments>http://blog.petersendidit.com/post/stateful-jquery-plugins-with-jquery-uis-widget-factory/#comments</comments>
		<pubDate>Wed, 30 Sep 2009 01:31:45 +0000</pubDate>
		<dc:creator>petersendidit</dc:creator>
				<category><![CDATA[Posts]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[jQuery UI]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[stateful]]></category>
		<category><![CDATA[widget factory]]></category>

		<guid isPermaLink="false">http://blog.petersendidit.com/?p=126</guid>
		<description><![CDATA[There are many different formats for jQuery plugins, many of the formats are not designed for stateful plugins.  What is a stateful plugin? A plugin that keep track of what the state of the plugin is and lets you call methods and change properties even after the plugin as been initialized.  All of jQuery UI&#8216;s [...]]]></description>
			<content:encoded><![CDATA[<p>There are many different formats for jQuery plugins, many of the formats are not designed for stateful plugins.  What is a stateful plugin? A plugin that keep track of what the state of the plugin is and lets you call methods and change properties even after the plugin as been initialized.  All of <a href="http://jqueryui.com/" target="_blank">jQuery UI</a>&#8216;s plugins are stateful (as of version 1.7.2), part of the jQuery UI core is a &#8220;<a href="http://docs.jquery.com/UI_Developer_Guide#The_widget_factory" target="_blank">Widget Factory</a>&#8221; which makes it very easy to quickly make a stateful plugin.</p>
<p>Below is an example of a plugin created with the <a href="http://jqueryui.pbworks.com/Widget-factory" target="_blank">jQuery UI widget factory</a>.</p>
<pre class="brush: javascript">
$.widget(&#039;namespace.pluginName&#039;, {
	_init: function() {
		// stuff that is called on initialization of the plugin

		//this.options a combination of the defualt options and the ones passed in during the plugin initialization
		if (this.options.foo) {
			//this.element is the element that the plugin was called on
			this.element.fadeOut();
		}
	},
	_privatemethod: function() {
		//private internal function
		//private functions should be named with a leading underscore
		//will only be able to be called from inside the plugin
	},
	publicmethod: function() {
		//this is a public fuction that can be called outside of the plugin

		//calling the private method from inside the public method
		this._privatemethod();
	},
	value: function() {
		//this is a public function that is defined as a getter
		//meaning it returns a value not a jquery object
		return this.options.foo;
	},
	destory: function() {
		$.widget.prototype.apply(this, arguments); // default destroy
		// this is where you would want to undo anything you do on init to reset the page to before the plugin was initialized.
	}

}));

$.extend($.namespace.pluginName, {
	getter: &#039;value&#039;,
	defaults: {
		option1: &#039;bar&#039;,
		foo: true
	}
});
</pre>
<p>With this you can call the following to initialize the plugin</p>
<pre class="brush: javascript">
$(&#039;#myelement&#039;).pluginName();
</pre>
<p>To call the publicmethod function you can now do this after initializing the plugin:</p>
<pre class="brush: javascript">
$(&#039;#myelement&#039;).pluginName();
$(&#039;#myelement&#039;).pluginName(&#039;publicmethod&#039;);
</pre>
<p>This makes it very easy to create a stateful jQuery plugins very quickly. All you need is the core of jQuery UI, but most people already have the whole jQuery UI package on their page.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.petersendidit.com/post/stateful-jquery-plugins-with-jquery-uis-widget-factory/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Work around for Google Gears on Snow Leopard</title>
		<link>http://blog.petersendidit.com/post/work-around-for-google-gears-on-snow-leopard/</link>
		<comments>http://blog.petersendidit.com/post/work-around-for-google-gears-on-snow-leopard/#comments</comments>
		<pubDate>Fri, 04 Sep 2009 10:57:33 +0000</pubDate>
		<dc:creator>petersendidit</dc:creator>
				<category><![CDATA[Posts]]></category>
		<category><![CDATA[gears]]></category>
		<category><![CDATA[Google Gears]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[Safari]]></category>
		<category><![CDATA[Safari 4]]></category>
		<category><![CDATA[Snow Leopard]]></category>

		<guid isPermaLink="false">http://blog.petersendidit.com/?p=121</guid>
		<description><![CDATA[As I talked about in by previous post, Google Gears is not compatible with Snow Leopard.  Google has been slow to get out a fix for the problem but seems like some others have found a work around and the guys from MailPlane have published how to use it.  It involves downloading the source code, [...]]]></description>
			<content:encoded><![CDATA[<p>As I talked about in by <a href="http://blog.petersendidit.com/post/google-gears-snow-leopard-and-safari-4/">previous post</a>, Google Gears is not compatible with Snow Leopard.  Google has been slow to get out a fix for the problem but seems like some others have found a work around and the guys from <a href="http://mailplaneapp.com/" target="_blank">MailPlane</a> have published how to use it.  It involves downloading the source code, applying a patch and then building a package, or you can just download the package from <a href="http://mailplaneapp.com/" target="_blank">MailPlane</a>, though they have a &#8220;Use at your own risk&#8221; disclaimer on it. You will also have to run Safari in 32bit mode. So if you are dieing to get your Google Gears back, especially in light of the <a href="http://www.google.com/appsstatus#rm=1&amp;di=1&amp;ddo=3&amp;hl=en" target="_blank">gmail outage on September 1st</a>, then try it out.  Let me know if you run in to any problems.</p>
<p><a href="http://mailplaneapp.com/download/google_gears/" target="_blank">http://mailplaneapp.com/download/google_gears/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.petersendidit.com/post/work-around-for-google-gears-on-snow-leopard/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Blurry Text on External Monitor with Snow Leopard</title>
		<link>http://blog.petersendidit.com/post/blurry-text-on-external-monitor-with-snow-leopard/</link>
		<comments>http://blog.petersendidit.com/post/blurry-text-on-external-monitor-with-snow-leopard/#comments</comments>
		<pubDate>Mon, 31 Aug 2009 18:53:29 +0000</pubDate>
		<dc:creator>petersendidit</dc:creator>
				<category><![CDATA[Posts]]></category>
		<category><![CDATA[apple]]></category>
		<category><![CDATA[blurry]]></category>
		<category><![CDATA[font]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[smoothing]]></category>
		<category><![CDATA[Snow Leopard]]></category>
		<category><![CDATA[text]]></category>

		<guid isPermaLink="false">http://blog.petersendidit.com/?p=110</guid>
		<description><![CDATA[One of the problems I have off and on with my MacBook Pro is that every once and a while when I have it plugged in to my Dell 2408WFP monitor the text in Terminal and Coda seem to have blurry text.  Its like the font smoothing that Mac has built in has been turned [...]]]></description>
			<content:encoded><![CDATA[<p>One of the problems I have off and on with my MacBook Pro is that every once and a while when I have it plugged in to my Dell 2408WFP monitor the text in Terminal and <a href="http://www.panic.com/coda/" target="_blank">Coda</a> seem to have blurry text.  Its like the font smoothing that Mac has built in has been turned of just for those applications.  When I installed Snow Leopard this problem was on all the time, nothing I tried seemed to get rid of it.</p>
<p>Looks like I wasn&#8217;t the only one with this problem because the great guys over at <a href="http://www.macosxhints.com/" target="_blank">Mac OS X Hints</a> just posted <a href="http://www.macosxhints.com/article.php?story=20090828224632809" target="_blank">a hint</a> that will fix this problem.  Sounds like there is a bug in Snow Leopard that turns off the font smoothing for some external monitors.  Of course none of the Apple monitors have this problem but if you didn&#8217;t shell out the extra cash for one of their beautiful monitors you might have this problem.  The fix is very simple,  just open up Terminal and then paste in:</p>
<pre class="brush: bash">
defaults -currentHost write -globalDomain AppleFontSmoothing -int 2
</pre>
<p>You can try out using 1 or 3 as the value you are setting to have less or more font smoothing. You will need to restart the app you are having problems with and may even need to unplug and replug in your monitor.</p>
<p>if you decide you just want to get rid of the change just open up terminal and paste in:</p>
<pre class="brush: bash">
defaults -currentHost delete -globalDomain AppleFontSmoothing
</pre>
<p>This will remove the key/value pair that you added and you will be back to the default Snow Leopard way of font smoothing.</p>
<p><a href="http://www.macosxhints.com/article.php?story=20090828224632809" target="_blank">MacOSXHints &#8211; Re-enable LCD font smoothing for some monitors</a></p>
<p>EDIT (9/11/2009)<br />
Looks like you can also set the value back to the default value by going in to System Preferences and selecting the &#8220;Automatic Font Smoothing&#8221; checkbox, this is found at the bottom of the &#8220;Appearance&#8221; section.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.petersendidit.com/post/blurry-text-on-external-monitor-with-snow-leopard/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>
