<?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>VinylFox</title>
	<atom:link href="http://www.vinylfox.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.vinylfox.com</link>
	<description>The Playground of VinylFox (Shea Frederick)</description>
	<lastBuildDate>Thu, 29 Jul 2010 16:37:06 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Each Second Counts, or Not</title>
		<link>http://www.vinylfox.com/each-second-counts-or-not/</link>
		<comments>http://www.vinylfox.com/each-second-counts-or-not/#comments</comments>
		<pubDate>Thu, 29 Jul 2010 16:37:06 +0000</pubDate>
		<dc:creator>Shea Frederick</dc:creator>
				<category><![CDATA[ExtJS]]></category>
		<category><![CDATA[ExtJS Tutorials]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://www.vinylfox.com/?p=741</guid>
		<description><![CDATA[Every once and a while I glance upon a chunk of code that just screams at me to be optimized. From that point on, all I can do is think about how much faster it would be if I just did this or that. Today I had one of those moments when looking at a [...]]]></description>
			<content:encoded><![CDATA[<p>Every once and a while I glance upon a chunk of code that just screams at me to be optimized. From that point on, all I can do is think about how much faster it would be if I just did this or that. Today I had one of those moments when looking at a co-workers code &#8211; I noticed that they had scoped an <em>each</em> loop that did not use scope (context). This got me wondering if there were any optimizations within the each loop that made it run faster without scope, so I took a look.</p>
<h2>Call &#038; Scope</h2>
<p>So as it turns out, the simple answer is no. The <em>each</em> method uses the <em>call</em> method of the <em>Function</em> constructor to apply scope to the function executed on each pass of the loop. When no scope is provided to the each method, it uses the current item as the scope &#8211; which is kinda strange, but whatever.</p>
<h2>No Scope</h2>
<p>Here is my smart idea &#8211; don&#8217;t use the <em>call</em> method if there is no scope provided. Simple, and it seems like it would help speed things up, so let&#8217;s give it a shot.</p>
<p><textarea class="js" cols="100" name="code">Ext.each = function(array, fn, scope){<br />
    if(Ext.isEmpty(array, true)){<br />
        return;<br />
    }<br />
    if(!Ext.isIterable(array) || Ext.isPrimitive(array)){<br />
        array = [array];<br />
    }<br />
    for(var i = 0, len = array.length; i < len; i++){<br />
        if((scope) ? fn.call(scope, array[i], i, array) : fn(array[i], i, array) === false){<br />
            return i;<br />
        }<br />
    }<br />
};</textarea></p>
<p>The basic change here is on line 9 where I check to see if scope was passed in, and decide to either <em>call </em>the function to apply scope or just execute it directly.</p>
<p><textarea class="js" cols="100" name="code">// original<br />
fn.call(scope || array[i], array[i], i, array)<br />
// my version<br />
(scope) ? fn.call(scope, array[i], i, array) : fn(array[i], i, array)</textarea></p>
<p>Using my current web app as the guinea pig, this version ran between <strong>5-18% faster</strong> in Firefox than it&#8217;s non scope checking predecessor. Internet Explorer&#8217;s results were so far scattered across the board that I could not draw a conclusion &#8211; in some tests 50% faster, in others 350% slower. As usual, IE left me confused, so im just going to ignore that for now.</p>
<h2>Can We Do Better?</h2>
<p>The next thing that caught my eye was the fact that when a single item is passed into the <em>each </em>method, it is shoved into an array and sent through the <em>for </em>loop &#8211; this seemed like a place for improvement.</p>
<p><textarea class="js" cols="100" name="code">Ext.each = function(array, fn, scope){<br />
    if(Ext.isEmpty(array, true)){<br />
        return;<br />
    }<br />
    if (!Ext.isIterable(array) || Ext.isPrimitive(array)) {<br />
	if ((scope) ? fn.call(scope, array, 0, array) : fn(array, 0, array) === false) {<br />
		return 0;<br />
	}<br />
    } else {<br />
	for (var i = 0, len = array.length; i < len; i++) {<br />
		if ((scope) ? fn.call(scope, array[i], i, array) : fn(array[i], i, array) === false) {<br />
			return i;<br />
		}<br />
	}<br />
    }<br />
};</textarea></p>
<p>In this case I have simply taken any single non array item that is passed in and executed the function immediately, bypassing the <em>for </em>loop. Results of this change were not noticeable, and matched almost identically with my previous version. Upon closer inspection, it turns out that this case is never reached, in other words, there is always an array passed in. Go figure.</p>
<h2>Summary</h2>
<p>The moral of the story here is to think simple when trying to optimize code, otherwise we end up going to far into optimizing and actually make the code more complex and likely slower, but this does not mean that the code with the fewest characters or lines will be the quickest. Experimenting is fun, so I would encourage everyone to try things like this just to see how they work and in turn gain a better understanding of how the methods you use every day actually work. Priceless.</p>
<p>Code for these tests can be downloaded from my <a href="http://github.com/VinylFox/ExtJS.ux.Misc">Ext.ux.Misc</a> Git repo on Github.</p>
<p>My next step is to test each loop &#8220;unrolling&#8221; to see what the effect is&#8230;let me know what you have tried on your own, and how it has worked out for you.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.vinylfox.com/each-second-counts-or-not/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Patterns &#8211; Using Ext JS Override</title>
		<link>http://www.vinylfox.com/patterns-using-ext-js-override/</link>
		<comments>http://www.vinylfox.com/patterns-using-ext-js-override/#comments</comments>
		<pubDate>Mon, 21 Jun 2010 11:59:29 +0000</pubDate>
		<dc:creator>Shea Frederick</dc:creator>
				<category><![CDATA[ExtJS]]></category>
		<category><![CDATA[ExtJS Tutorials]]></category>

		<guid isPermaLink="false">http://www.vinylfox.com/?p=732</guid>
		<description><![CDATA[If you have ever posted a bug report about an Ext JS component then you have likely heard about Override&#8216;s. These Overrides are a way for us to change the way the base library works, usually because of a defect, but sometimes just because we don&#8217;t like or agree with the way something works. Here [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.vinylfox.com/wp-content/uploads/2010/06/cubicle.jpg" class="lightbox"><img src="http://www.vinylfox.com/wp-content/uploads/2010/06/cubicle-150x150.jpg" alt="" style="border: 1px solid rgb(0, 0, 0); margin: 0pt 10px 10px 0pt;" title="Cubicle" width="150" height="150" class="alignleft size-thumbnail wp-image-760" /></a>If you have ever posted a bug report about an Ext JS component then you have likely heard about <em>Override</em>&#8216;s.</p>
<p>These <em>Overrides</em> are a way for us to change the way the base library works, usually because of a defect, but sometimes just because we don&#8217;t like or agree with the way something works. Here we are going to cover how to write a basic <em>Override </em>that &#8216;fixes&#8217; or adds a feature to something in the library.</p>
<h2>Why?</h2>
<p>The last thing we want to do is edit any of the Ext JS distribution files, such as ext-all.js or ext-core.js, we want to instead apply our changes into the library without touching the library files directly, using the library itself to overwrite specific functions where needed. Editing the library files directly would make upgrading nearly impossible. This is where the <em>Override </em>method comes in to help.</p>
<h2>Downfall</h2>
<p>Overriding a base function causes an extra maintenance responsibility &#8211; a shift of responsibility &#8211; simple as that. Though less of a problem than say, editing the ext-all.js file. Every upgrade of the base library (Ext JS) we make requires that we re-examine all of our <em>Overrides </em>to make sure they still sync up with code from the base library, and that the problem were overriding has not been fixed by the Ext JS development team.</p>
<h2>Override</h2>
<p><img width="303" height="170" style="border: 1px solid rgb(0, 0, 0); margin: 0px 0px 10px 10px;" class="alignright wp-image-752" title="Cascade Windows" src="http://www.vinylfox.com/wp-content/uploads/2010/06/cascade.png" alt="Cascade Windows">Were going to start with an <em>override </em>that adds a feature to the library that we desperately need! Or at least that&#8217;s what our boss tells us.</p>
<p>We are adding an option to cascade the placement of new windows based on the position of the previous window. The reason I am adding this as an Override instead of a Plugin or Extension is because im lobbying to get it added as a feature to the library (not really) and when it gets added to the library and I upgrade, I will be able to simply remove my override and continue with life.</p>
<p>The goal is to end up with an no Overrides in your application, by reporting bugs and enhancements to the Ext JS team, and following through so they get fixed in the library.</p>
<p>The Override method of the Ext JS library will take the function(s) we pass to it and overwrite functions of the same name within the component specified. The previously defined function that were replacing are completely removed, and the new ones put in their place.</p>
<p>Two arguments are accepted for the <em>Override </em>method, the first is the <strong>class</strong> that we are overriding, and the second is an <strong>object with the methods</strong> we are overriding.</p>
<p><textarea name="code" cols="100" class="js" style="display: none;">Ext.override(/*CLASS*/, /*METHODS OBJECT*/{<br />
    /*METHOD NAME*/:function(){<br />
        /*DO IT!*/<br />
    },<br />
    /*ANOTHER METHOD NAME*/:function(){<br />
        /*DO IT MORE!*/<br />
    }<br />
});</textarea></p>
<h2>The Code</h2>
<p>We start by copying the source of the original method from the Ext JS source files that come with the SDK download (located in the src folder), in this case it&#8217;s the beforeShow method of Ext.Window (in Window.js). Using the source as a starting point, we can modify the function to do what we need.</p>
<p><textarea name="code" cols="100" class="js" style="display: none;">Ext.override(Ext.Window, {<br />
    beforeShow : function(){<br />
	    delete this.el.lastXY;<br />
	    delete this.el.lastLT;<br />
	    if(this.x === undefined || this.y === undefined){<br />
    		var xy = this.el.getAlignToXY(this.container, &#8216;c-c&#8217;),<br />
    		    pos = this.el.translatePoints(xy[0], xy[1]);<br />
	    	if(this.position === &#8216;cascade&#8217;){<br />
	    		this.x = Ext.winPosx = (Ext.winPosx)? Ext.winPosx+20 : pos.left;<br />
	    		this.y = Ext.winPosy = (Ext.winPosy)? Ext.winPosy+20 : pos.top;<br />
	    	}else{<br />
	    		this.x = this.x === undefined? pos.left : this.x;<br />
	    		this.y = this.y === undefined? pos.top : this.y;<br />
	    	}<br />
	    }<br />
	    this.el.setLeftTop(this.x, this.y);<br />
	    if(this.expandOnShow){<br />
	        this.expand(false);<br />
	    }<br />
	    if(this.modal){<br />
	        Ext.getBody().addClass(&#8216;x-body-masked&#8217;);<br />
	        this.mask.setSize(Ext.lib.Dom.getViewWidth(true), Ext.lib.Dom.getViewHeight(true));<br />
	        this.mask.show();<br />
	    }<br />
	}<br />
});</textarea></p>
<p>NOTE: Find the <a href="http://github.com/VinylFox/ExtJS.Patterns/blob/master/Ext.override.js" target="_blank">source</a> on my Github <a href="http://github.com/VinylFox/ExtJS.Patterns" target="_blank">ExtJS.Patterns</a> repo.</p>
<p>Here it has been modified to add an if statement that looks at our new <em>position </em>config to see if its been set to &#8216;cascade&#8217;. From there we can add 20 pixels to both the x and y axis of the previous window position to place it cascaded. The previous window position has been stored in the winPosx/y properties of the Ext object. The else simply runs the original window position code.</p>
<p>This is all overwriting the original <em>beforeShow </em>method of the <em>Window</em>, which simply placed the window in the center of it&#8217;s container. This change applies to every single window that is created, even windows that might be extended from the base window class, it&#8217;s essentially changing the source code of the Ext JS library, without touching the source files.</p>
<h2>How About Fixes</h2>
<p>Fixes are really the same thing, if were adding new features or fixing problems it&#8217;s all the same as far as Overrides are concerned, though most of the time an Override would be used to fix a bug. Need I say more?</p>
<h2>Summary</h2>
<p>Overrides are great for adding features or fixes to the library code without disturbing the source files. Keep this in mind when you run into a bug in the library and need to &#8216;patch&#8217; it to get things working, or have required features that should be part of the base library. The goal should be having <strong>NO </strong>overrides at all, which can be achieved by reporting bugs and posting feature requests. Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.vinylfox.com/patterns-using-ext-js-override/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Patterns &#8211; Using Ext JS Sequence and Intercept</title>
		<link>http://www.vinylfox.com/patterns-using-ext-js-sequence-and-intercept/</link>
		<comments>http://www.vinylfox.com/patterns-using-ext-js-sequence-and-intercept/#comments</comments>
		<pubDate>Thu, 11 Mar 2010 11:53:01 +0000</pubDate>
		<dc:creator>Shea Frederick</dc:creator>
				<category><![CDATA[ExtJS]]></category>
		<category><![CDATA[ExtJS Tutorials]]></category>
		<category><![CDATA[Patterns]]></category>

		<guid isPermaLink="false">http://www.vinylfox.com/?p=577</guid>
		<description><![CDATA[I&#8217;m going to run through the usage of a little unknown feature of Ext JS called Sequence and Intercept. These are a pair of related methods built into Ext JS that we can use to add functionality or add fixes to the library without having to override or create a new component. Why is this [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m going to run through the usage of a little unknown feature of Ext JS called <a href="http://www.extjs.com/deploy/dev/docs/?class=Function&#038;member=createSequence">Sequence</a> and <a href="http://www.extjs.com/deploy/dev/docs/?class=Function&#038;member=createInterceptor">Intercept</a>. These are a pair of related methods built into Ext JS that we can use to add functionality or add fixes to the library without having to override or create a new component. Why is this important? We will take a look at our options to get an idea of the restrictions imposed by each of them, but first I want to frame this all with a scenario.</p>
<h2>Scenario (our use case)</h2>
<p><a href="http://www.vinylfox.com/wp-content/uploads/2009/11/required.gif" class="lightbox"><img src="http://www.vinylfox.com/wp-content/uploads/2009/11/required-150x150.gif" alt="" title="required" width="150" height="150" class="alignright size-thumbnail wp-image-724" align="right"/></a>Our goal here is to create a &#8216;required&#8217; indicator on all form fields by setting a required flag on the configuration object of each component &#8211; in our case, form fields. The code base (the web app) is already in place, so this is a web application that has been completed and is in use.</p>
<p>We have a few options available to make this happen:</p>
<ul>
<li>Override</li>
<li>Extend</li>
<li>Intercept/Sequence</li>
</ul>
<p>Lets take a look at the benefits and problems imposed by these methods.</p>
<h2>Override</h2>
<p>Of course one way to get what we want is to override a particular method in the component were using. If were lucky, there is a stub function in place that we can use, but more often than not, this is not the case. What were left with is having to copy code from the library source files and modify it to fit our needs &#8211; not the optimal solution. This means that each time the Ext JS codebase is updated, we need to check the changes against our overridden copy. This is a maintenance nightmare, though there are cases where this is the optimal solution.</p>
<h2>Extend (new Component)</h2>
<p>The better of our two options is the Extend method. This way creates a copy of the component that we can modify to fit our needs. Not a bad solution all and all. The two problems here are that any components that inherit from our extended component will not get our new functionality, and we now have a copy of the component with a new name, so each place we use that component needs to use our updated component name, ie: &#8216;mysupertextfield&#8217; instead of &#8216;textfield&#8217;. Again, not a big deal, but if I already have a complete web app, and im adding a bit of functionality to a common component, I don&#8217;t want to have to run a find/replace on the entirety of my code.</p>
<h2>Meet intercept/sequence</h2>
<p>My personal favorite in this situation is to add our functionality either before or after an existing method. The intercept method of Ext JS takes whatever function you provide and executes it right before whatever method in the component you specify. The function we define is also executed in the same scope as the method were intercepting.</p>
<p><textarea class="js" cols="100" name="code">Ext.intercept(Ext.form.Field.prototype, &#8216;initComponent&#8217;, function() {<br />
	var fl = this.fieldLabel, ab = this.allowBlank;<br />
	if (ab === false &#038;&#038; fl) {<br />
		this.fieldLabel = &#8216;<span style="color:red;">*</span> &#8216;+fl;<br />
	} else if (ab === true &#038;&#038; fl) {<br />
		this.fieldLabel = &#8216;&nbsp; &#8216;+fl;<br />
	}<br />
});</textarea></p>
<p>NOTE: Find the <a href="http://github.com/VinylFox/ExtJS.Patterns/blob/master/Ext.intercept.js" target="_blank">source</a> on my Github <a href="http://github.com/VinylFox/ExtJS.Patterns" target="_blank">ExtJS.Patterns</a> repo.</p>
<p>With this override, we can use the existing allowBlank flag to trigger the required indicator</p>
<p><textarea class="js" cols="100" name="code">&#8230;<br />
{<br />
        fieldLabel: &#8216;Last Name&#8217;,<br />
        allowBlank: false,<br />
        name: &#8216;last&#8217;<br />
},{<br />
        fieldLabel: &#8216;Company&#8217;,<br />
        allowBlank: true,<br />
        name: &#8216;company&#8217;<br />
}<br />
&#8230;</textarea></p>
<p>In this case, intercept seems to be the perfect fit, allowing us to add a visual required indicator to each component that is extended from the Field base class. The one downside I see here is that this code is executed every single time a field is created, so be sure to make it lean.</p>
<p>We could also use Sequence to achieve this, which uses the same syntax and concept as Intercept, but executes after the method we define has executed instead of before. The order of execution is like this:</p>
<ul>
<li>Intercept</li>
<li>Method (ie: initComponent)</li>
<li>Sequence</li>
</ul>
<h2>Summary</h2>
<p>I hope this has helped. Over the next few weeks I will be blogging about the many Ext JS patterns available, their pros and cons, and practical usage. Each one will have code paired with it on <a href="http://github.com/VinylFox/ExtJS.Patterns" target="_blank">Github</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.vinylfox.com/patterns-using-ext-js-sequence-and-intercept/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>What&#8217;s the Word &#8211; Meetup Videos and More</title>
		<link>http://www.vinylfox.com/whats-the-word-meetup-videos-and-more/</link>
		<comments>http://www.vinylfox.com/whats-the-word-meetup-videos-and-more/#comments</comments>
		<pubDate>Wed, 03 Feb 2010 17:35:54 +0000</pubDate>
		<dc:creator>Shea Frederick</dc:creator>
				<category><![CDATA[ExtJS News]]></category>
		<category><![CDATA[General News]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[ExtJS]]></category>
		<category><![CDATA[HtmlEditor]]></category>
		<category><![CDATA[JSConf]]></category>
		<category><![CDATA[Meetup]]></category>

		<guid isPermaLink="false">http://www.vinylfox.com/?p=676</guid>
		<description><![CDATA[Every once and a while I like to post a summary of what Ive been up to lately. The past few months have been busy, so I have a ton to talk about, but I will try to summarize. DC Meetup Videos We held the first in a series of meetups that will happen in [...]]]></description>
			<content:encoded><![CDATA[<p>Every once and a while I like to post a summary of what Ive been up to lately. The past few months have been busy, so I have a ton to talk about, but I will try to summarize.</p>
<h1>DC Meetup Videos</h1>
<p>We held the first in a series of <a href="http://www.meetup.com/NoVa-Javascript-Ext-JS-Users-Group/">meetups that will happen in the DC/NoVA</a> area last week, a sprout of our <a href="http://www.meetup.com/baltimore-dc-javascript-users/" target="_blank">Baltimore area Meetup</a> for our southern friends, and I have to say that it was a huge hit. The meetups are going to be managed by Pat Sheridan from <a href="http://threepillarsoftware.com/" target="_blank">Three Pillar Global</a>, and we are hoping it will be a way to get JavaScript developers from the DC area more involved in the community. <a href="http://tdg-i.com/" target="_blank">Jay</a> was kind enough to bring video equipment and record our presentations, along with editing the videos and posting them to the intertubes.</p>
<p><a href="http://tdg-i.com/262/ext-js-meetup-1192010-meetup-videos" title="Jonathan Julian"><img style="border: 1px solid rgb(0, 0, 0); margin: 0 10px 10px 0;" src="http://www.vinylfox.com/wp-content/uploads/2010/02/2010-01-19_1941-150x150.png" alt="Jonathan Julian" title="Jonathan Julian" width="150" height="150" class="alignnone size-thumbnail wp-image-658" /></a><a href="http://tdg-i.com/262/ext-js-meetup-1192010-meetup-videos" title="Shea Frederick"><img style="border: 1px solid rgb(0, 0, 0); margin: 0 10px 10px 0;" src="http://www.vinylfox.com/wp-content/uploads/2010/02/extjsmeetup-150x150.jpg" alt="Shea Frederick" title="Shea Frederick" width="150" height="150" class="alignnone size-thumbnail wp-image-659" /></a><a href="http://tdg-i.com/262/ext-js-meetup-1192010-meetup-videos" title="Pat Sheridan"><img style="border: 1px solid rgb(0, 0, 0); margin: 0 10px 10px 0;" src="http://www.vinylfox.com/wp-content/uploads/2010/02/2010-01-19_1932-150x150.png" alt="Pat Sheridan" title="Pat Sheridan" width="150" height="150" class="alignnone size-thumbnail wp-image-660" /></a></p>
<p>There are some <a href="http://www.meetup.com/baltimore-dc-javascript-users/photos/807828/" target="_blank">photos</a> and other information about the event on its <a href="http://www.meetup.com/baltimore-dc-javascript-users/calendar/12219819/" target="_blank">meetup page</a>.</p>
<p>If you are in the <a href="http://www.meetup.com/baltimore-dc-javascript-users/">Baltimore area and into JavaScript</a> with a fury, you should visit our Meetup that happens the first Wednesday of each month at 6:30PM in the <a href="http://www.beehivebaltimore.com/">Beehive Baltimore</a>. This month&#8217;s meetup has a presentation from <a href="http://paulbarry.com/">Paul Barry</a> about <a href="http://nodejs.org/">Node.js</a> &#8211; it&#8217;s gonna be bad ass.</p>
<h1>Speed Testing</h1>
<p>My little addiction I like to call speed testing has rolled into full swing. Now that I have the tools in place to create and launch tests, along with run reporting on the results with ease, I can pretty much just sit down and spend 30 minutes or so to design and launch the test. <a class="lightbox" href="http://www.vinylfox.com/wp-content/uploads/2010/01/inchworm.jpg"><img src="http://www.vinylfox.com/wp-content/uploads/2010/01/inchworm-150x150.jpg" alt="" title="inchworm" width="150" height="150" class="alignright" style="border: 1px solid rgb(0, 0, 0); margin: 10px 0 0 10px;" /></a> I have two tests currently gathering data, one is testing the speed of rendering an image with and without a data URL, the other has to do with the speed of code wrapped in a try catch statement. Should be some interesting results, which I will be posting a summary on soon. My first test was for <a href="http://www.vinylfox.com/json-decoding-speed-comparison/">JSON decoding speed</a>, which I posted results for a couple of weeks ago.</p>
<h1>HtmlEditor Plugins</h1>
<p>The Ext JS team has expressed an interest in including my <a href="http://code.google.com/p/ext-ux-htmleditor-plugins/" target="_blank">HtmlEditor Plugins</a> as a UX in the SDK. This will mark the third development of mine that has become part of the Ext JS SDK download, first it was the <a href="http://code.google.com/p/ext-ux-gmappanel/" target="_blank">GMapPanel UX</a>, then the Grid Filter backend PHP code, now it seems that the Ext JS SDK will finally come with a more robust HtmlEditor example. A few updates have been committed recently that add the option to change the language in these plugins, along with some general code cleanup. Also starting to move my code over to <a href="http://github.com/VinylFox/ExtJS-HtmlEditor-Plugins">Github</a> as <a href="http://twitter.com/christocracy/status/8593793204">suggested</a> by <a href="http://twitter.com/jonathanjulian/status/8595481114">many</a>.</p>
<h1>Books</h1>
<p>Soon we will have <a href="http://tdg-i.com/" target="_blank">Jay Garcia&#8217;s</a> <a href="http://www.extjsinaction.com" target="_blank">Ext JS in Action</a> book released in print, and the 2nd edition of <a href="http://www.learningextjs.com" target="_blank">Learning Ext JS</a> should be released later this year, titled &#8220;Learning Ext JS 3.0&#8243;. <a href="http://blog.cutterscrossing.com/index.cfm/2010/1/1/Out-With-The-Old-In-With-The-New-2009--2010">Cutter</a>, <a href="http://colinramsay.co.uk/diary/">Colin</a> and I got together to update the book, fix some errors, and add new chapters to take advantage of new features in Ext JS 3.0. It&#8217;s gonna be an awesome resource for anyone just getting started with Ext JS.</p>
<h1>JSConf</h1>
<p>Again, <a href="http://jsconf.us/2010/" target="_blank">JSConf</a> is being held in the DC area, which makes it incredibly cheap for me to attend, but this year I decided to try my hand at submitting a talk proposal. I can&#8217;t wait to find out if I will be chosen. My submission was for an introduction to rapid application prototyping using the Ext JS library. Here is my submission:</p>
<p><textarea class="js" cols="100" name="code">{<br />
    &#8220;name&#8221;:&#8221;Shea Frederick&#8221;,<br />
    &#8220;email&#8221;:&#8221;________@________.com&#8221;,<br />
    &#8220;twitter&#8221;:&#8221;VinylFox&#8221;,<br />
    &#8220;location&#8221;:&#8221;Baltimore, MD&#8221;,<br />
    &#8220;topic_title&#8221;:&#8221;Rapid Web Application Development with Ext JS&#8221;,<br />
    &#8220;topic_description&#8221;:&#8221;Discuss general principles of the Ext JS library<br />
    and show how easy it can be to rapidly prototype a web application<br />
    using the library.&#8221;,<br />
    &#8220;claim_to_fame&#8221;:&#8221;One of the core contributors to the Ext JS library<br />
    along with other Open Source JavaScript projects. Author of<br />
    &#8216;Learning Ext JS&#8217; published in December 2008. Observed &#8216;Talk Like<br />
    a Pirate Day&#8217;. Maintain a Blog of JavaScript fun at<br />
    http://www.vinylfox.com&#8221;<br />
}</textarea></p>
<p>Did I mention that all submissions have to be in the form of valid JSON? Yeah, geeky, but good &#8211; very good. With any luck, I will <a href="http://jsconf.posterous.com/the-soon-to-be-awkward-moment">find out later this week</a> if ive been accepted.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.vinylfox.com/whats-the-word-meetup-videos-and-more/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JSON Decoding Speed Comparison</title>
		<link>http://www.vinylfox.com/json-decoding-speed-comparison/</link>
		<comments>http://www.vinylfox.com/json-decoding-speed-comparison/#comments</comments>
		<pubDate>Tue, 12 Jan 2010 14:09:31 +0000</pubDate>
		<dc:creator>Shea Frederick</dc:creator>
				<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://www.vinylfox.com/?p=602</guid>
		<description><![CDATA[Meet Karl &#8211; Karl is a very cute wind up Inchworm that my wife put in my stocking for x-mas. What does Karl have to do with JSON? Probably nothing, but he is very photogenic, and I like having a picture in my blog posts. Now that our new buddy Karl has been properly introduced, [...]]]></description>
			<content:encoded><![CDATA[<p><a class="lightbox" href="http://www.vinylfox.com/wp-content/uploads/2010/01/inchworm.jpg"><img src="http://www.vinylfox.com/wp-content/uploads/2010/01/inchworm-150x150.jpg" alt="" title="inchworm" width="150" height="150" class="alignleft" style="border: 1px solid rgb(0, 0, 0); margin: 0 10px 10px 0;" /></a>Meet Karl &#8211; Karl is a very cute wind up Inchworm that my wife put in my stocking for x-mas. What does Karl have to do with JSON? Probably nothing, but he is very photogenic, and I like having a picture in my blog posts.</p>
<p>Now that our new buddy Karl has been properly introduced, lets move on to the boring stuff. I have been trying to optimize decoding of a large chunk of JSON data by testing decoding speeds between the three main methods of decoding JSON and how that applied to the type of data that was being decoded, along with the environment, ie: the browser. My data has been gathering for over a month now, and has run on 3500 unique clients, so I feel like I can come to a decent conclusion.</p>
<h2>The Decoded Data</h2>
<p>I figured for my testing purposes that there were five main types of data that would be commonly decoded.</p>
<ul>
<li>Empty Array</li>
<li>Empty Object</li>
<li>Array Data Only</li>
<li>Object Data Only</li>
<li>Mixed Array and Object Data</li>
</ul>
<h2>The Decoding Methods</h2>
<p>Generally speaking, you will find three methods of decoding JSON used in the wild, though <em>eval </em>is by far the most common. I am not using any decoding/encoding libraries because I don&#8217;t want to taint the results with any browser targeted workarounds that might be present in them, I just want to know what the actual browser does.</p>
<p><textarea class="js" cols="100" name="code">o = eval( &#8220;(&#8221; + testData + &#8220;)&#8221; );</textarea></p>
<p><b>eval</b> &#8211; This is the old standard for decoding JSON, which is considered dangerous to use because of its ability to create functions.</p>
<p><textarea class="js" cols="100" name="code">o = JSON.parse( testData );</textarea></p>
<p><b>native</b> &#8211; The latest and greatest method of decoding JSON, recent browsers include this built in feature. The &#8216;safe&#8217; way to decode data.</p>
<p><textarea class="js" cols="100" name="code">o = new Function( &#8220;return &#8221; + testData )();</textarea></p>
<p><b>new function</b> &#8211; This method is essentially the same as eval, but uses the evaluating mechanism of the Function constructor to decode data.</p>
<h2>In The Wild</h2>
<p>I wanted my testing to represent actual usage in the wild, so I used a tool that allowed my tests to run in the browsers of unsuspecting internet surfers. So the results I have can be considered an accurate depiction of what will actually be encountered on the intertubes. If you&#8217;re creating intranet sites targeted to a particular browser, then these results should be interpreted differently. Any browser that cannot handle all three methods of decoding JSON was not included in the test, so you IE6/7 guys are out of luck. Also, any browser that has an active console (console object present) was excluded.</p>
<h2>The Outcome</h2>
<p>The results are quite interesting, and confusing in some cases. Im guessing there is room for some browsers to optimize their JSON decoding routines here. This first chart shows results grouped by browser make.</p>
<p><a class="lightbox" href="http://www.vinylfox.com/wp-content/uploads/2010/01/json-test-results3.gif"><img src="http://www.vinylfox.com/wp-content/uploads/2010/01/json-test-results3.gif" alt="" title="json-test-results" width="546" height="420" class="alignnone size-full wp-image-620" style="position: relative; left: -65px;"/></a></p>
<p>This is all good and fine if your a browser vendor and want to know how you&#8217;re browser stacks up against others, but in web development we don&#8217;t have the option of picking our clients browser. What we want to see is what programming techniques we can use to take advantage of browser efficiency across the board. Which leads us to the next chart, showing results grouped by decoding method</p>
<p><a class="lightbox" href="http://www.vinylfox.com/wp-content/uploads/2010/01/json-test-results21.gif"><img src="http://www.vinylfox.com/wp-content/uploads/2010/01/json-test-results21.gif" alt="" title="json-test-results2" width="546" height="333" class="alignnone size-full wp-image-621" style="position: relative; left: -65px;"/></a></p>
<p>That&#8217;s more like it, I now have a clearer idea of how the methods themselves stack up against each other, the red line indicates the average of all the data types.</p>
<h2>The Conclusion</h2>
<p>Even though the results seem to indicate that <em>native </em>JSON decoding is only mildly faster than <em>eval</em>, its actually a bit faster if you exclude the strange handling of empty <em>objects </em>in <a href="http://www.mozilla.com/firefox/" target="_blank">Firefox</a>. For the purpose of choosing a method, I think we can draw the conclusion that <em>native </em>JSON decoding is the clear winner here, followed closely by <em>eval</em>, and the <em>function constructor</em> being a general bad idea.</p>
<p>Comparing the browsers for <em>native </em>decoding, <a href="http://www.apple.com/safari/" target="_blank">Safari</a> is a clear winner here, with our new buddy <a href="http://www.google.com/chrome" target="_blank">Chrome</a> losing the race by quite a lot.</p>
<h2>Quirks</h2>
<p>By far the biggest quirk is <a href="http://www.mozilla.com/firefox/" target="_blank">Firefox</a>&#8216;s slowness in decoding an empty <em>Object </em><em>natively</em>, which skews the results, making it appear that <em>native </em>JSON decoding is only mildly faster than <em>eval</em>.</p>
<p>Another interesting result was decoding using <em>eval </em>ran 500% slower with <a href="http://getfirebug.com/" target="_blank">FireBug</a> enabled, while <em>native </em>decoding suffered no degradation at all when <a href="http://getfirebug.com/" target="_blank">FireBug</a> was enabled.</p>
<p><a href="http://www.apple.com/safari/" target="_blank">Safari</a> apparently does not handle the <em>function constructor</em> very efficiently.</p>
<p>As a general rule of thumb the straight <em>array </em>data decoded the slowest, so when considering system design, <em>array </em>data should only be used when there is a clear benefit to it.</p>
<h2>Feedback</h2>
<p>If there are any particular ways you would like to see the data broken out, just let me know in the comments and ill see what I can do.</p>
<p><a class="lightbox" href="http://www.vinylfox.com/wp-content/uploads/2010/01/json-result-firefox.gif" title="Firefox 3.1 &#038; up"><img style="border: 1px solid rgb(0, 0, 0); margin: 0 10px 10px 0;" src="http://www.vinylfox.com/wp-content/uploads/2010/01/json-result-firefox-150x150.gif" alt="Firefox 3.1 &#038; up" title="Firefox 3.1 &#038; up" width="150" height="150" class="alignnone size-thumbnail wp-image-658" /></a><a class="lightbox" href="http://www.vinylfox.com/wp-content/uploads/2010/01/json-result-chrome.gif" title="Chrome"><img style="border: 1px solid rgb(0, 0, 0); margin: 0 10px 10px 0;" src="http://www.vinylfox.com/wp-content/uploads/2010/01/json-result-chrome-150x150.gif" alt="Chrome" title="Chrome" width="150" height="150" class="alignnone size-thumbnail wp-image-659" /></a><a class="lightbox" href="http://www.vinylfox.com/wp-content/uploads/2010/01/json-result-msie.gif" title="MSIE 8"><img style="border: 1px solid rgb(0, 0, 0); margin: 0 10px 10px 0;" src="http://www.vinylfox.com/wp-content/uploads/2010/01/json-result-msie-150x150.gif" alt="MSIE 8" title="MSIE 8" width="150" height="150" class="alignnone size-thumbnail wp-image-660" /></a><a class="lightbox" href="http://www.vinylfox.com/wp-content/uploads/2010/01/json-result-safari.gif" title="Safari"><img style="border: 1px solid rgb(0, 0, 0); margin: 0 10px 10px 0;" src="http://www.vinylfox.com/wp-content/uploads/2010/01/json-result-safari-150x150.gif" alt="Safari" title="Safari" width="150" height="150" class="alignnone size-thumbnail wp-image-661" /></a><a class="lightbox" href="http://www.vinylfox.com/wp-content/uploads/2010/01/json-result-all.gif" title="Combined"><img style="border: 1px solid rgb(0, 0, 0); margin: 0 10px 10px 0;" src="http://www.vinylfox.com/wp-content/uploads/2010/01/json-result-all-150x150.gif" alt="Combined" title="Combined" width="150" height="150" class="alignnone size-thumbnail wp-image-662" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.vinylfox.com/json-decoding-speed-comparison/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Three Pillars, Four Geeks and Ext JS</title>
		<link>http://www.vinylfox.com/three-pillars-four-geeks-and-ext-js/</link>
		<comments>http://www.vinylfox.com/three-pillars-four-geeks-and-ext-js/#comments</comments>
		<pubDate>Wed, 06 Jan 2010 17:54:01 +0000</pubDate>
		<dc:creator>Shea Frederick</dc:creator>
				<category><![CDATA[ExtJS]]></category>
		<category><![CDATA[ExtJS News]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://www.vinylfox.com/?p=611</guid>
		<description><![CDATA[I will be presenting along side some other Ext JS geeks at this quarters Three Pillar Tech Meetup. The following is a summary of the event details posted on the Three Pillar News Blog and Jay Garcia&#8217;s Blog. Hope to see you there! At 6:30PM on 1/19/2010, Three Pillar Global will be hosting a gathering [...]]]></description>
			<content:encoded><![CDATA[<p>I will be presenting along side some other Ext JS geeks at this quarters Three Pillar Tech Meetup. The following is a summary of the event details posted on the <a href="http://threepillarglobal.com/three-pillar-global-tech-meetup-january-19-2010" target="_blank">Three Pillar News Blog</a> and <a href="http://tdg-i.com/219/three-pillar-global-plays-host-to-an-extjs-gathering" target="_blank">Jay Garcia&#8217;s Blog</a>. Hope to see you there!</p>
<p>At 6:30PM on 1/19/2010, Three Pillar Global will be <a href="http://www.meetup.com/baltimore-dc-javascript-users/calendar/12219819/" target="_blank">hosting a gathering</a> of industry leading minds in the metro DC area to discuss and share development practices, ideas, tips and tricks revolving around the Ext JS framework. There will be four presentations that are jam-packed with information that can aid to your success in developing applications with the Ext JS framework</p>
<h2>About the presentations:</h2>
<p>Patrick Sheridan will kick off the meeting, where he will explain how analysis-driven development can aid in the success of your application construction, reducing time from conception to production. Shea Frederick will be guiding us through advanced JavaScript debugging techniques, demonstrating some of the best tricks for the latest and greatest JavaScript development tools. Jonathan Julian is going to share and elaborate on five areas to improve your Ext JS applications, which range from defining your own components to properly overriding the framework. Lastly, Jay Garcia will discuss how to build extensible applications using a two-tiered approach with Ext JS.</p>
<p>Food and refreshments to be provided. We look forward to <a href="http://www.meetup.com/baltimore-dc-javascript-users/calendar/12219819/" target="_blank">seeing you there</a>!</p>
<h2>About the presenters:</h2>
<p><img class="borderimg" style="margin: 15px 15px 0 0;" width="75" height="75" align="left" src="http://www.extjs.com/forum/image.php?u=3054&amp;dateline=1247548690" alt="" /> Pat Sheridan is a successful Ext JS developer that leverages his user experience background to accelerate successful development with RIA JavaScript frameworks, including Ext JS.  With success stories such as the complete rewrite of the U.S. Treasury&#8217;s Pay.gov website and the production of four large RIA applications for the Financial Regulatory Authority (FINRA), he continues to dominate this space with a progressive thought process that enhances the development and user experience alike.  He demonstrated his UX leadership with the release of an <a href="http://www.extjs.com/forum/showthread.php?t=31514" target="_blank">Ext JS 2.0 OmniGraffle template</a> that has garnered over 50,000 downloads world wide.</p>
<p><img class="borderimg" style="margin: 15px 15px 0 0;" width="75" height="75" align="left" src="http://www.vinylfox.com/wp-content/uploads/2008/09/newyork-288x300.jpg" alt="" />Shea Frederick is an active community member for ExtJS.  His expertise is drawn from community forum participation, work with the core development team, and his own experience as the architect of several large ExtJS-based web applications.   Shea is also an author for <a href="http://jsmag.com" target="_blank">JavaScript</a> Magazine, his own blog (<a href="http://vinylfox.com">http://vinylfox.com</a>), and the <a href="http://www.extjs.com/blog/2008/07/21/using-yahoos-boss-api-to-search-the-web/" target="_blank">Ext JS blog.</a>  He is the lead author of the <a href="http://learningextjs.com" target="_blank">Learning Ext JS</a> book and is the organizer for the <a href="http://www.meetup.com/baltimore-dc-javascript-users/" target="_blank">Baltimore JavaScript developers</a> meetup group. </p>
<p><img class="borderimg" style="margin: 15px 15px 0 0;" width="75" height="75" align="left" src="http://www.gravatar.com/avatar/519e2fdbde9ac0662f8c82438e3b4d6c?s=75" alt="" />While not very well known in the Ext JS community, Jonathan Julian is successful independent web developer specializing in Rails and Ext JS applications with extensive experience in Java and related technologies. He occasionally blogs about software and web  development at <a href="http://jonathanjulian.com/" target="_blank">jonathanjulian.com</a> and tweets as @jonathanjulian.  He has presented at the <a href="http://www.meetup.com/baltimore-dc-javascript-users/" target="_blank">Baltimore JavaScript developers</a> meetup group. </p>
<p><img class="borderimg" style="margin: 15px 15px 0 0;" width="75" height="75" align="left" src="http://media.linkedin.com/mpr/mpr/shrink_80_80/p/1/000/012/3f1/1719f93.jpg" alt="" />Jay Garcia, author of the up and coming book, Ext JS in Action (<a href="http://extjsinaction.com/" target="_blank">http://extjsinaction.com/</a>), provides daily support on the Ext JS forums as well as free extensions and widgets to the library.  He is an author for  <a href="http://tdg-i.com/213/november-2009-js-magazine-now-available" target="_blank">JSMagazine</a>, the <a href="http://www.extjs.com/blog/2009/09/13/5-steps-drag-and-drop-with-ext-js/" target="_blank">Ext JS blog</a> and his own blog at <a href="http://tdg-i.com" target="_blank">http://tdg-i.com</a>.  He&#8217;s developed enterprise-level applications using Ext JS since early 2006, when it was known as &#8220;yui-ext&#8221; and has continued to support and assist in the expansion of the product ever since.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.vinylfox.com/three-pillars-four-geeks-and-ext-js/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>ExtJS 3.0 Cookbook Released</title>
		<link>http://www.vinylfox.com/book-extjs-3-0-cookbook-released/</link>
		<comments>http://www.vinylfox.com/book-extjs-3-0-cookbook-released/#comments</comments>
		<pubDate>Sun, 13 Dec 2009 15:56:41 +0000</pubDate>
		<dc:creator>Shea Frederick</dc:creator>
				<category><![CDATA[ExtJS]]></category>
		<category><![CDATA[ExtJS News]]></category>
		<category><![CDATA[Book]]></category>

		<guid isPermaLink="false">http://www.vinylfox.com/?p=573</guid>
		<description><![CDATA[A few weeks ago I received a final review copy of the Ext JS 3.0 Cookbook by Jorge Ramon and started to work my way through it. It can be a quick read since the text is sparse &#8211; its mostly made up of code &#8211; but I thought it would be good to really [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.vinylfox.com/wp-content/uploads/2009/12/1847198708-243x300.jpg" alt="1847198708" title="1847198708" width="243" height="300" class="alignleft size-medium wp-image-597" style="margin: 0 10px 10px 0"/>A few weeks ago I received a final review copy of the <a href="http://www.amazon.com/gp/product/1847198708?ie=UTF8&#038;tag=viny07-20&#038;linkCode=as2&#038;camp=1789&#038;creative=390957&#038;creativeASIN=184719870">Ext JS 3.0 Cookbook</a> by <a href="http://www.amazon.com/s/ref=ntt_athr_dp_sr_1?sort=relevancerank&#038;search-alias=books&#038;field-author=Jorge%20Ramon&#038;tag=viny07-20">Jorge Ramon</a> and started to work my way through it. It can be a quick read since the text is sparse &#8211; its mostly made up of code &#8211; but I thought it would be good to really take an in depth look at the example code as well.</p>
<p>I should say that im not the kind of guy that this book is targeted at, but I ended up enjoying it anyway. I prefer a little more explanation in my books instead of the example driven cookbook style, but I gave it a read through because Jorge is an awesome guy, and it&#8217;s Ext JS related, so I cant resist &#8211; im an Ext JS addict.</p>
<h2>The Author</h2>
<p>I was surprised when I initially found out that this book was being put together, mostly because it was being written by a person I had never heard of. The author, Jorge Ramon at the time of starting this book had not a single post on the ExtJS forums, which is where most people head when they need to figure something out, or when they have something to share. This fact alone is a great testament to the authors intelligence and the quality of the documentation and examples that are provided with Ext JS.</p>
<p>Aside from the occasional quirk in the book, Jorge has done an amazing job putting together a quality product that will no doubt be useful to everyone. There can be slight grammatical problems in the text, such as incorrect tenses, and odd sentence structure, but like I mentioned earlier, the book is sparse on text.</p>
<h2>The Approach</h2>
<p>The cookbook style of book has a unique format where you have each example broken down into &#8216;what&#8217;, &#8216;how&#8217;, &#8216;why&#8217; and &#8216;more&#8217;.<br/><br />
For Example:</p>
<ul>
<li>Subject (what) &#8211; short explanation of what is to be done.</li>
<li>How to do it&#8230; &#8211; actual code with minimal explanation.</li>
<li>How it works&#8230; &#8211; short explanation of what happened.</li>
<li>There&#8217;s more&#8230; (optional) &#8211; other related uses or features.</li>
<li>See also&#8230; (optional) &#8211; related sections within the book.</li>
</ul>
<p>If you read anything, it should be the &#8220;How it works&#8221; sections, which have brief explanation of the example. The &#8220;Subject&#8221; section in big black headings is also quite useful to read before looking at the code. I would suggest ignoring the &#8220;See also&#8230;&#8221; sections while reading through, as they seem to just be used for looking up related tasks, though I found them quite unhelpful for even that.</p>
<h2>The Recipe Code</h2>
<p>In general, the code examples are of good quality, and the suggested methods and practices in the book are inline with whats recommended. There are a couple places where variables are not defined (var&#8217;d), making them inherently global, but hey, we all are guilty of this flaw. Probably the most confusing portion of this book is where the author uses the <em>Ext.ux</em> namespace to place application layout code, which is specific to your application, therefore not likely to be a &#8220;User Extension&#8221; which is what the <em>Ext.ux</em> namespace is reserved for.</p>
<p>The screenshots that go along with each example are excellent, and most have arrows directing you toward the change made. These changes also have a corresponding bold line in the code sample.</p>
<p>This book has a huge amount of XML examples, which can be a hard thing to come across in the JavaScript community since most of us despise XML and cant wait to get rid of it. For those of you that need to use XML, the <a href="http://www.amazon.com/gp/product/1847198708?ie=UTF8&#038;tag=viny07-20&#038;linkCode=as2&#038;camp=1789&#038;creative=390957&#038;creativeASIN=184719870">Ext JS 3.0 Cookbook</a> will no doubt be a huge resource for learning the oddities involved in using XML data with Ext JS.</p>
<h2>Summary</h2>
<p>Probably what you want to know is &#8220;would I buy this book&#8221; &#8211; the answer is yes. I have no doubt that this book will help anyone working on an Ext JS project.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.vinylfox.com/book-extjs-3-0-cookbook-released/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Forwarding Mouse Events Through Layers</title>
		<link>http://www.vinylfox.com/forwarding-mouse-events-through-layers/</link>
		<comments>http://www.vinylfox.com/forwarding-mouse-events-through-layers/#comments</comments>
		<pubDate>Wed, 30 Sep 2009 15:05:46 +0000</pubDate>
		<dc:creator>Shea Frederick</dc:creator>
				<category><![CDATA[ExtJS]]></category>
		<category><![CDATA[ExtJS Plugins]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[ExtJS Overrides]]></category>

		<guid isPermaLink="false">http://www.vinylfox.com/?p=499</guid>
		<description><![CDATA[Anyone who has worked with web apps has likely created a masking element at some point, and the great thing about a masking element is that it intercepts user interaction, letting us create a pseudo-modal user interface. The masking element enables us to mask the entire screen, bringing focus to a particular element, or just [...]]]></description>
			<content:encoded><![CDATA[<p>Anyone who has worked with web apps has likely created a masking element at some point, and the great thing about a masking element is that it intercepts user interaction, letting us create a pseudo-modal user interface. The masking element enables us to mask the entire screen, bringing focus to a particular element, or just create a window like effect. This behavior is demonstrated in the ExtJS libraries <em>Ext.Window</em> when <em>modal </em>is set to true, among other places.</p>
<h3>Yeah, so what?</h3>
<p><img src="http://www.vinylfox.com/wp-content/uploads/2009/09/layers-masked1.png" alt="layers-masked1" title="layers-masked1" width="250" height="163" class="alignright size-full wp-image-543" />The problem comes when we want to mask a part of the screen, but also want the elements behind that mask to continue responding to user interaction. This behavior is counter to most native behavior. What we are left with, is having to forward mouse events through the masking layer to the layer below, an option that simply does not exist in the standard JavaScript/DOM API.</p>
<h3>Why do this?</h3>
<p>A plugin that I recently wrote &#8211; <a href="http://code.google.com/p/ext-ux-datadrop/" target="_blank">DataDrop </a>- used a <em>textarea </em>overlaying a grid to act as the receiver of dragged data from spreadsheet type programs. One of the limitations that I was not so happy about was the fact that this overlay could only exist in the &#8216;empty&#8217; area of the grid, not over rows of data, headers, toolbars, etc. otherwise it would cause all of those elements below to become unresponsive to user input. If our <em>textarea</em> that receives the data were positioned over the entire grid area, our <em>GridPanel</em> could not be controlled using the mouse anymore.</p>
<h3>How to fix this?</h3>
<p>This is where my friend Nige White (Animal) came in to help, it turns out that he had an idea about how to forward these mouse events using a couple of not well understood methods in the JavaScript/DOM API used for creating mouse events. Here are the steps taken:</p>
<ol>
<li>The <em>textarea </em> (my masking element) that is positioned over the grid receives <em>mouseover</em>, <em>mousemove</em>, <em>mousedown </em>, <em>mouseup </em> and other events.</li>
<li>The top masking layer is hidden for a moment, so we can figure out what element is below the mask at the event location.</li>
<li>The event is re-fired &#8211; this is where the <a href="http://www.w3.org/TR/DOM-Level-2-Events/ecma-script-binding.html" target="_blank">W3 DOM Event model</a> and the simpler <a href="http://msdn.microsoft.com/en-us/library/ms536423(VS.85).aspx" target="_blank">Microsoft equivalent</a> come into play.</li>
<li>Start the process again &#8211; ready for the next event.</li>
</ol>
<p><img src="http://www.vinylfox.com/wp-content/uploads/2009/09/layers-steps1.png" alt="layers-steps1" title="layers-steps1" width="500" height="326" class="alignright size-full wp-image-557" /></p>
<h3>What&#8217;s element to fire upon?</h3>
<p>Knowing the cursor position and event that occurred, the only obstacle now is determining what DOM element to fire the simulated event through. It turns out that finding which element is the topmost element at a certain document coordinate position is quite simple in modern browsers. The <b>document.elementFromPoint</b> method is supported in <a href="http://msdn.microsoft.com/en-us/library/ms536417(VS.85).aspx" target="_blank">IE</a>, <a href="https://developer.mozilla.org/en/DOM/document.elementFromPoint" target="_blank">Mozilla</a>, Webkit and Opera.</p>
<p>So it is possible to capture the document coordinates of a mouse event fired on the masking element, momentarily hide that masking element, and then ask the document what is under that coordinate position before showing the mask again.</p>
<p>A new event can be then fired on the found element. Obviously there are some complexities such as firing <em>mouseover </em>and <em>mouseout </em>events when the found element is different from the last time, but that is the gist of the technique. To <a href="http://screencast.com/t/4bZevAUwEuj" target="_blank">see it in action, check out the screencast</a> or play with the <a href="http://www.vinylfox.com/lib/latest/examples/grid/array-grid-datadrop.html" target="_blank">live Grid DataDrop example</a> or <a href="http://www.vinylfox.com/lib/latest/examples/core/evt-forwarding.html" target="_blank">simple DOM element example</a> yourself.</p>
<p>I have posted an <a href="http://code.google.com/p/ext-ux-datadrop/source/browse/trunk/src/Override.js"target="_blank">override of Ext.Element that Nigel created</a> on my Google Code site for all to enjoy, it is now a requirement for the ExtJS <a href="http://code.google.com/p/ext-ux-datadrop/"target="_blank">DataDrop plugin</a>. A big thanks goes out to Nige (Animal) for digging into the nuts and bolts of JavaScript to find a solution to my problem.</p>
<h3>The Next Step</h3>
<p>Having the data that is dropped into the grid automatically insert into the grids rows at the correct position is my next task for the ever-improving <a href="http://code.google.com/p/ext-ux-datadrop/"target="_blank">DataDrop plugin</a>. Should be fun :/</p>
<p>UPDATE (12-1-09): Seems that <a href="http://hacks.mozilla.org/2009/12/pointer-events-for-html-in-firefox-3-6/">Mozilla has also noticed this issue</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.vinylfox.com/forwarding-mouse-events-through-layers/feed/</wfw:commentRss>
		<slash:comments>24</slash:comments>
		</item>
		<item>
		<title>HtmlEditor Plugin Updates &amp; Fixes</title>
		<link>http://www.vinylfox.com/htmleditor-plugin-updates-fixes/</link>
		<comments>http://www.vinylfox.com/htmleditor-plugin-updates-fixes/#comments</comments>
		<pubDate>Wed, 16 Sep 2009 13:53:24 +0000</pubDate>
		<dc:creator>Shea Frederick</dc:creator>
				<category><![CDATA[ExtJS]]></category>
		<category><![CDATA[ExtJS Plugins]]></category>
		<category><![CDATA[HtmlEditor]]></category>

		<guid isPermaLink="false">http://www.vinylfox.com/?p=496</guid>
		<description><![CDATA[I had the opportunity recently to watch end users interact with my set of ExtJS HtmlEditor Plugins, which brought to my attention some shortcomings with the UI that have now been addressed. Read about the updates below, or go directly to get the updated HtmlEditor Plugins code. Word Paste The most exciting change is to [...]]]></description>
			<content:encoded><![CDATA[<p>I had the opportunity recently to watch end users interact with my set of ExtJS HtmlEditor Plugins, which brought to my attention some shortcomings with the UI that have now been addressed. Read about the updates below, or go directly to <a href="http://code.google.com/p/ext-ux-htmleditor-plugins/">get the updated HtmlEditor Plugins code.</a></p>
<h2>Word Paste</h2>
<p><img alt="" src="http://content.screencast.com/users/VinylFox/folders/Jing/media/8f704239-067c-4884-ab6d-60ec5145a6ee/2009-09-16_0913.png" title="Word Paste" class="alignright" width="127" height="99" style="border: 1px solid rgb(0, 0, 0); margin: 0px 0px 10px 10px;" />The most exciting change is to how the Word Paste plugin works, which now captures a paste event and can fix the Word garbage without any user interaction. The old UI has been ditched, and replaced with a single toggle button on the HtmlEditor toolbar which turns the functionality on or off. No pop-up window needed.</p>
<h2>Form Validation</h2>
<p><img alt="" src="http://content.screencast.com/users/VinylFox/folders/Jing/media/89922df3-af48-4903-b42c-de17d05e9193/2009-09-16_0925.png" title="Form Validation" class="alignright" width="143" height="97" style="border: 1px solid rgb(0, 0, 0); margin: 0px 0px 10px 10px;" />All of the forms used for inserting now validate their input before allowing the user to insert anything. When the user fills out the form invalidly, they get a squiggly red line (like that of a misspelling in Word). If they try to submit the form with the field still invalid, a &#8220;frame&#8221; animation effect brings their attention to the invalid field.</p>
<h2>Context Activation</h2>
<p>Two new features were added that allow the buttons to be enabled or disabled based on text selection, and what tags are present in the selected text or cursor position. This simply means, for example, that the &#8216;Bold&#8217; button will be toggled if the selected text, or cursor position has a bold tag in it. To use this feature we just need to enable it.</p>
<p><textarea class="js" cols="100" name="code">Ext.ux.form.HtmlEditor.Bold = Ext.extend(Ext.ux.form.HtmlEditor.MidasCommand, {<br />
    midasBtns: [{<br />
        monitorCmdState: true,<br />
        cmd: 'bold',<br />
        title: 'Bold'<br />
    }]<br />
});</textarea></p>
<p>The second part of this feature set is enabling or disabling a button on text selection, this is used in the <i>Remove Formatting</i> button because it would be silly to have this button enabled if no text was selected.</p>
<ul>
<li>enableOnSelection &#8211; set to true to enable button only when text is selected.</li>
<li>disableOnSelection &#8211; set to true to disable button only when text is selected.</li>
</ul>
<p>See how the <i>Remove Formatting</i> button takes advantage of this feature.</p>
<p><textarea class="js" cols="100" name="code">Ext.ux.form.HtmlEditor.RemoveFormat = Ext.extend(Ext.ux.form.HtmlEditor.MidasCommand, {<br />
    midasBtns: ['|',{<br />
        enableOnSelection: true,<br />
        cmd: 'removeFormat',<br />
        title: 'Remove Formatting'<br />
    }]<br />
});</textarea></p>
<h2>Overflow Text</h2>
<p><img alt="" src="http://content.screencast.com/users/VinylFox/folders/Jing/media/916561a4-a110-49e0-a9f4-043f17a196f8/2009-09-16_0929.png" title="Overflow Text" class="alignright" width="184" height="108" style="border: 1px solid rgb(0, 0, 0); margin: 0px 0px 10px 10px;" />The overflow text used when a toolbar has too many buttons to fit in the width has been added. This was overlooked on my first version of this plugin. Thanks to &#8216;feyyaz&#8217; from the ExtJS forums for spotting this.</p>
<h2>Conclusion</h2>
<p>Hopefully these new features and fixes will prove useful to everyone, and as always, feedback is the only way this plugin set is going to get better, so keep the suggestions coming. Now its time for me to go get some breakfast and a large(ish) cup of coffee. Enjoy!</p>
<p><a href="http://code.google.com/p/ext-ux-htmleditor-plugins/">HtmlEditor Plugins Code</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.vinylfox.com/htmleditor-plugin-updates-fixes/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>DataDrop &#8211; Drag Grid Data in From a Spreadsheet</title>
		<link>http://www.vinylfox.com/datadrop-drag-grid-data-from-spreadsheet/</link>
		<comments>http://www.vinylfox.com/datadrop-drag-grid-data-from-spreadsheet/#comments</comments>
		<pubDate>Thu, 03 Sep 2009 20:12:44 +0000</pubDate>
		<dc:creator>Shea Frederick</dc:creator>
				<category><![CDATA[ExtJS]]></category>
		<category><![CDATA[ExtJS Plugins]]></category>
		<category><![CDATA[Grid]]></category>
		<category><![CDATA[Spreadsheet]]></category>

		<guid isPermaLink="false">http://www.vinylfox.com/?p=473</guid>
		<description><![CDATA[I was stewing about an example that Andrea Giammarchi came up with, it was so cool &#8211; very cool &#8211; but totally useless in the form it was in (from a UX standpoint). It was a proof of concept, so I wasn&#8217;t expecting it to be useful right away, in fact all I was expecting [...]]]></description>
			<content:encoded><![CDATA[<p>I was stewing about an example that <a href="http://webreflection.blogspot.com/" target="_blank">Andrea Giammarchi</a> came up with, it was so cool &#8211; very cool &#8211; but totally useless in the form it was in (from a UX standpoint). It was a proof of concept, so I wasn&#8217;t expecting it to be useful right away, in fact all I was expecting is that it give me an idea &#8211; and it did.</p>
<h2>The Concept</h2>
<p>If we could drag our tabular data into grids from other programs we could circumvent the need to upload a data file to a web server to be read and parsed, then spit back out to our browser in a readable format. Anyone who has ever had to parse Excel files on the server side knows how much of a pain it is, we might be lucky if we get a CSV file or some other simple format, but in the real world the end user running their spreadsheet program has no clue what simple tabular data is.</p>
<p>Using the same concept from Andrea&#8217;s example page, we can create a zone within the grid which will accept dragged data from a spreadsheet. The behavior that we are taking advantage of is the way in which an html textarea will accept dragged data from a spreadsheet and format it as tab delimited data.</p>
<h2>The Plugin</h2>
<p>My first version of the plugin is rough around the edges, but works in all browsers (minus Opera) very reliably. Being a plugin, the usage is straight forward, there are no configuration values that need to be defined at this time.</p>
<p><textarea class="js" cols="100" name="code">{<br />
	xtype: &#8216;grid&#8217;,<br />
	&#8230;,<br />
	plugins: [Ext.ux.grid.DataDrop],<br />
	&#8230;<br />
}</textarea></p>
<p>Check out the screencast below to see it in action &#8211; I am dragging rows of data from OpenOffice Calc directly to an ExtJS Grid.</p>
<p><object class="embeddedObject" classid="clsid:D27CDB6E-AE6D-11CF-96B8-444553540000" width="650" height="638"><param name="movie" value="http://content.screencast.com/users/VinylFox/folders/Jing/media/a27e44bc-8901-4c9e-8e4d-cbae429baf5b/jingswfplayer.swf"></param><param name="quality" value="high"></param><param name="bgcolor" value="#FFFFFF"></param><param name="flashVars" value="containerwidth=650&#038;containerheight=638&#038;thumb=http://content.screencast.com/users/VinylFox/folders/Jing/media/a27e44bc-8901-4c9e-8e4d-cbae429baf5b/FirstFrame.jpg&#038;loaderstyle=jing&#038;content=http://content.screencast.com/users/VinylFox/folders/Jing/media/a27e44bc-8901-4c9e-8e4d-cbae429baf5b/2009-09-03_1236.swf&#038;blurover=false"></param><param name="allowFullScreen" value="true"></param><param name="scale" value="showall"></param><param name="allowScriptAccess" value="always"></param><param name="base" value="http://content.screencast.com/users/VinylFox/folders/Jing/media/1df86ee9-458e-474f-9e6f-b6f63ff37eba/"></param><embed class="embeddedObject" src="http://content.screencast.com/users/VinylFox/folders/Jing/media/a27e44bc-8901-4c9e-8e4d-cbae429baf5b/jingswfplayer.swf" quality="high" bgcolor="#FFFFFF" width="650" height="638" type="application/x-shockwave-flash" allowScriptAccess="always" flashVars="containerwidth=650&#038;containerheight=638&#038;thumb=http://content.screencast.com/users/VinylFox/folders/Jing/media/a27e44bc-8901-4c9e-8e4d-cbae429baf5b/FirstFrame.jpg&#038;loaderstyle=jing&#038;content=http://content.screencast.com/users/VinylFox/folders/Jing/media/a27e44bc-8901-4c9e-8e4d-cbae429baf5b/2009-09-03_1236.swf&#038;blurover=false" allowFullScreen="true" base="http://content.screencast.com/users/VinylFox/folders/Jing/media/1df86ee9-458e-474f-9e6f-b6f63ff37eba/" scale="showall"></embed></object></p>
<h2>The Code</h2>
<p>As always, I have setup a <a href="http://code.google.com/p/ext-ux-datadrop/" target="_blank">Google code</a> site for this. Please <a href="http://code.google.com/p/ext-ux-datadrop/source/browse/trunk/src/" target="_blank">browse the source</a> to get the plugin code. I don&#8217;t have an example page, but the <a href="/docs/?class=Ext.ux.grid.DataDrop" target="_blank">documentation is online</a></p>
<p><a href="http://code.google.com/p/ext-ux-datadrop/source/browse/trunk/src/Ext.ux.DataDrop.js" target="_blank">Ext.ux.DataDrop.js</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.vinylfox.com/datadrop-drag-grid-data-from-spreadsheet/feed/</wfw:commentRss>
		<slash:comments>29</slash:comments>
		</item>
	</channel>
</rss>
