<?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>Werx Limited &#187; javascript</title> <atom:link href="http://werxltd.com/wp/tag/javascript/feed/" rel="self" type="application/rss+xml" /><link>http://werxltd.com/wp</link> <description>We make IT work.</description> <lastBuildDate>Mon, 23 Jan 2012 23:03:59 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.1</generator> <item><title>node.js at Facebook</title><link>http://werxltd.com/wp/2012/01/23/node-js-at-facebook/</link> <comments>http://werxltd.com/wp/2012/01/23/node-js-at-facebook/#comments</comments> <pubDate>Mon, 23 Jan 2012 14:18:24 +0000</pubDate> <dc:creator>wes</dc:creator> <category><![CDATA[it industry]]></category> <category><![CDATA[javascript]]></category> <category><![CDATA[facebook]]></category> <category><![CDATA[node.js]]></category> <category><![CDATA[scale]]></category><guid
isPermaLink="false">http://werxltd.com/wp/?p=1148</guid> <description><![CDATA[Slides No related content found.]]></description> <content:encoded><![CDATA[<p><iframe
src="http://blip.tv/play/g_MngtCYdgI.html?p=1" width="480" height="346" frameborder="0" allowfullscreen></iframe><embed
type="application/x-shockwave-flash" src="http://a.blip.tv/api.swf#g_MngtCYdgI" style="display:none"></embed></p><p><a
href="http://broofa.com/presentations/FacebookAtNode_NodeConf2011.pdf">Slides</a></p><div
class="betterrelated none"><p>No related content found.</p></div><p><!--[if IE]><iframe
frameborder="0" allowTransparency="true" class="addtoany_special_service facebook_like" src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwerxltd.com%2Fwp%2F2012%2F01%2F23%2Fnode-js-at-facebook%2F&amp;layout=button_count&amp;show_faces=false&amp;width=75&amp;action=like&amp;colorscheme=light&amp;height=20&amp;ref=addtoany" scrolling="no" style="border:none;overflow:hidden;width:90px;height:21px"></iframe><![endif]--><!--[if !IE]><!--><iframe
class="addtoany_special_service facebook_like" src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwerxltd.com%2Fwp%2F2012%2F01%2F23%2Fnode-js-at-facebook%2F&amp;layout=button_count&amp;show_faces=false&amp;width=75&amp;action=like&amp;colorscheme=light&amp;height=20&amp;ref=addtoany" scrolling="no" style="border:none;overflow:hidden;width:90px;height:21px"></iframe><!--<![endif]--><!--[if IE]><iframe
frameborder="0" allowTransparency="true" class="addtoany_special_service twitter_tweet" src="http://platform.twitter.com/widgets/tweet_button.html?url=http%3A%2F%2Fwerxltd.com%2Fwp%2F2012%2F01%2F23%2Fnode-js-at-facebook%2F&amp;counturl=http%3A%2F%2Fwerxltd.com%2Fwp%2F2012%2F01%2F23%2Fnode-js-at-facebook%2F&amp;count=none&amp;text=node.js%20at%20Facebook" scrolling="no" style="border:none;overflow:hidden;width:55px;height:20px"></iframe><![endif]--><!--[if !IE]><!--><iframe
class="addtoany_special_service twitter_tweet" src="http://platform.twitter.com/widgets/tweet_button.html?url=http%3A%2F%2Fwerxltd.com%2Fwp%2F2012%2F01%2F23%2Fnode-js-at-facebook%2F&amp;counturl=http%3A%2F%2Fwerxltd.com%2Fwp%2F2012%2F01%2F23%2Fnode-js-at-facebook%2F&amp;count=none&amp;text=node.js%20at%20Facebook" scrolling="no" style="border:none;overflow:hidden;width:55px;height:20px"></iframe><!--<![endif]--><!--[if IE]><iframe
frameborder="0" allowTransparency="true" class="addtoany_special_service google_plusone" src="https://plusone.google.com/u/0/_/%2B1/fastbutton?url=http%3A%2F%2Fwerxltd.com%2Fwp%2F2012%2F01%2F23%2Fnode-js-at-facebook%2F&amp;size=medium&amp;count=false" scrolling="no" style="border:none;overflow:hidden;width:32px;height:20px"></iframe><![endif]--><!--[if !IE]><!--><iframe
class="addtoany_special_service google_plusone" src="https://plusone.google.com/u/0/_/%2B1/fastbutton?url=http%3A%2F%2Fwerxltd.com%2Fwp%2F2012%2F01%2F23%2Fnode-js-at-facebook%2F&amp;size=medium&amp;count=false" scrolling="no" style="border:none;overflow:hidden;width:32px;height:20px"></iframe><!--<![endif]--><a
class="a2a_button_linkedin" href="http://www.addtoany.com/add_to/linkedin?linkurl=http%3A%2F%2Fwerxltd.com%2Fwp%2F2012%2F01%2F23%2Fnode-js-at-facebook%2F&amp;linkname=node.js%20at%20Facebook" title="LinkedIn" rel="nofollow" target="_blank"><img
src="http://werxltd.com/wp/wp-content/plugins/add-to-any/icons/linkedin.png?9d7bd4" width="16" height="16" alt="LinkedIn"/></a><a
class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwerxltd.com%2Fwp%2F2012%2F01%2F23%2Fnode-js-at-facebook%2F&amp;title=node.js%20at%20Facebook" id="wpa2a_2">Share/Save</a></p>]]></content:encoded> <wfw:commentRss>http://werxltd.com/wp/2012/01/23/node-js-at-facebook/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Ext.ux.JSONP for ExtJS 4</title><link>http://werxltd.com/wp/2011/04/07/ext-ux-jsonp-for-extjs-4/</link> <comments>http://werxltd.com/wp/2011/04/07/ext-ux-jsonp-for-extjs-4/#comments</comments> <pubDate>Thu, 07 Apr 2011 13:28:41 +0000</pubDate> <dc:creator>wes</dc:creator> <category><![CDATA[javascript]]></category> <category><![CDATA[extjs4]]></category> <category><![CDATA[jsonp]]></category> <category><![CDATA[scripttagproxy]]></category> <category><![CDATA[sencha]]></category><guid
isPermaLink="false">http://werxltd.com/wp/?p=938</guid> <description><![CDATA[Here is a solution for making simple JSONP requests in ExtJS 4 Ext.define('Ext.ux.JSONP', { extend: 'Ext.data.ScriptTagProxy', alias: 'ux.jsonp', createRequestCallback: function(request, operation, callback, scope) { var me = this; return function(response) { callback.apply(scope, [response]); operation.setCompleted(); operation.setSuccessful(); me.afterRequest(request, true); }; } }); No related content found.]]></description> <content:encoded><![CDATA[<p>Here is a solution for making simple JSONP requests in ExtJS 4</p><pre class="brush:javascript">
Ext.define('Ext.ux.JSONP', {
    extend: 'Ext.data.ScriptTagProxy',
    alias: 'ux.jsonp',

    createRequestCallback: function(request, operation, callback, scope) {
        var me = this;

        return function(response) {
            callback.apply(scope, [response]);

            operation.setCompleted();
            operation.setSuccessful();
            me.afterRequest(request, true);
        };
    }
});
</pre><div
class="betterrelated none"><p>No related content found.</p></div><p><!--[if IE]><iframe
frameborder="0" allowTransparency="true" class="addtoany_special_service facebook_like" src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwerxltd.com%2Fwp%2F2011%2F04%2F07%2Fext-ux-jsonp-for-extjs-4%2F&amp;layout=button_count&amp;show_faces=false&amp;width=75&amp;action=like&amp;colorscheme=light&amp;height=20&amp;ref=addtoany" scrolling="no" style="border:none;overflow:hidden;width:90px;height:21px"></iframe><![endif]--><!--[if !IE]><!--><iframe
class="addtoany_special_service facebook_like" src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwerxltd.com%2Fwp%2F2011%2F04%2F07%2Fext-ux-jsonp-for-extjs-4%2F&amp;layout=button_count&amp;show_faces=false&amp;width=75&amp;action=like&amp;colorscheme=light&amp;height=20&amp;ref=addtoany" scrolling="no" style="border:none;overflow:hidden;width:90px;height:21px"></iframe><!--<![endif]--><!--[if IE]><iframe
frameborder="0" allowTransparency="true" class="addtoany_special_service twitter_tweet" src="http://platform.twitter.com/widgets/tweet_button.html?url=http%3A%2F%2Fwerxltd.com%2Fwp%2F2011%2F04%2F07%2Fext-ux-jsonp-for-extjs-4%2F&amp;counturl=http%3A%2F%2Fwerxltd.com%2Fwp%2F2011%2F04%2F07%2Fext-ux-jsonp-for-extjs-4%2F&amp;count=none&amp;text=Ext.ux.JSONP%20for%20ExtJS%204" scrolling="no" style="border:none;overflow:hidden;width:55px;height:20px"></iframe><![endif]--><!--[if !IE]><!--><iframe
class="addtoany_special_service twitter_tweet" src="http://platform.twitter.com/widgets/tweet_button.html?url=http%3A%2F%2Fwerxltd.com%2Fwp%2F2011%2F04%2F07%2Fext-ux-jsonp-for-extjs-4%2F&amp;counturl=http%3A%2F%2Fwerxltd.com%2Fwp%2F2011%2F04%2F07%2Fext-ux-jsonp-for-extjs-4%2F&amp;count=none&amp;text=Ext.ux.JSONP%20for%20ExtJS%204" scrolling="no" style="border:none;overflow:hidden;width:55px;height:20px"></iframe><!--<![endif]--><!--[if IE]><iframe
frameborder="0" allowTransparency="true" class="addtoany_special_service google_plusone" src="https://plusone.google.com/u/0/_/%2B1/fastbutton?url=http%3A%2F%2Fwerxltd.com%2Fwp%2F2011%2F04%2F07%2Fext-ux-jsonp-for-extjs-4%2F&amp;size=medium&amp;count=false" scrolling="no" style="border:none;overflow:hidden;width:32px;height:20px"></iframe><![endif]--><!--[if !IE]><!--><iframe
class="addtoany_special_service google_plusone" src="https://plusone.google.com/u/0/_/%2B1/fastbutton?url=http%3A%2F%2Fwerxltd.com%2Fwp%2F2011%2F04%2F07%2Fext-ux-jsonp-for-extjs-4%2F&amp;size=medium&amp;count=false" scrolling="no" style="border:none;overflow:hidden;width:32px;height:20px"></iframe><!--<![endif]--><a
class="a2a_button_linkedin" href="http://www.addtoany.com/add_to/linkedin?linkurl=http%3A%2F%2Fwerxltd.com%2Fwp%2F2011%2F04%2F07%2Fext-ux-jsonp-for-extjs-4%2F&amp;linkname=Ext.ux.JSONP%20for%20ExtJS%204" title="LinkedIn" rel="nofollow" target="_blank"><img
src="http://werxltd.com/wp/wp-content/plugins/add-to-any/icons/linkedin.png?9d7bd4" width="16" height="16" alt="LinkedIn"/></a><a
class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwerxltd.com%2Fwp%2F2011%2F04%2F07%2Fext-ux-jsonp-for-extjs-4%2F&amp;title=Ext.ux.JSONP%20for%20ExtJS%204" id="wpa2a_4">Share/Save</a></p>]]></content:encoded> <wfw:commentRss>http://werxltd.com/wp/2011/04/07/ext-ux-jsonp-for-extjs-4/feed/</wfw:commentRss> <slash:comments>1</slash:comments> </item> <item><title>Simple message bus for extjs 4</title><link>http://werxltd.com/wp/2011/04/05/simple-message-bus-for-extjs-4/</link> <comments>http://werxltd.com/wp/2011/04/05/simple-message-bus-for-extjs-4/#comments</comments> <pubDate>Tue, 05 Apr 2011 18:52:54 +0000</pubDate> <dc:creator>wes</dc:creator> <category><![CDATA[javascript]]></category> <category><![CDATA[extjs]]></category> <category><![CDATA[sencha]]></category><guid
isPermaLink="false">http://werxltd.com/wp/?p=928</guid> <description><![CDATA[Here&#8217;s a simple message bus/broker I wrote for Ext.js 4 Ext.define('Ext.ux.MessageBroker', { extend: 'Ext.util.Observable', statics: { instance: null, setInstance: function(i) { this.instance = i; }, sendMessage: function(msg, data) { this.fireEvent('message',{"msg":msg,"data":data}); } }, constructor: function(config){ this.addEvents({ "message" : true }); if(config &#038;&#038; config.listeners) this.listeners = config.listeners; Ext.ux.MessageBroker.superclass.constructor.call(this, config) } }, function() { Ext.ux.MessageBroker.setInstance(new Ext.ux.MessageBroker()); }); // [...]]]></description> <content:encoded><![CDATA[<p>Here&#8217;s a simple message bus/broker I wrote for Ext.js 4</p><pre class="brush:javascript">
Ext.define('Ext.ux.MessageBroker', {
    extend: 'Ext.util.Observable',

    statics: {
        instance: null,
        setInstance: function(i) {
            this.instance = i;
        },
        sendMessage: function(msg, data) {
            this.fireEvent('message',{"msg":msg,"data":data});
        }
    },

    constructor: function(config){
        this.addEvents({
            "message" : true
        });

        if(config &#038;&#038; config.listeners) this.listeners = config.listeners;

        Ext.ux.MessageBroker.superclass.constructor.call(this, config)
    }

}, function() {
    Ext.ux.MessageBroker.setInstance(new Ext.ux.MessageBroker());
});

// Sending a message:
Ext.ux.MessageBroker.sendMessage("load_stock", {"symbol":"INTC"});

// Recieving a message:
Ext.util.Observable.observe(Ext.ux.MessageBroker);
Ext.ux.MessageBroker.on('message', function(msg) {
    console.log('message fired: ',msg);
});
</pre><div
class="betterrelated none"><p>No related content found.</p></div><p><!--[if IE]><iframe
frameborder="0" allowTransparency="true" class="addtoany_special_service facebook_like" src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwerxltd.com%2Fwp%2F2011%2F04%2F05%2Fsimple-message-bus-for-extjs-4%2F&amp;layout=button_count&amp;show_faces=false&amp;width=75&amp;action=like&amp;colorscheme=light&amp;height=20&amp;ref=addtoany" scrolling="no" style="border:none;overflow:hidden;width:90px;height:21px"></iframe><![endif]--><!--[if !IE]><!--><iframe
class="addtoany_special_service facebook_like" src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwerxltd.com%2Fwp%2F2011%2F04%2F05%2Fsimple-message-bus-for-extjs-4%2F&amp;layout=button_count&amp;show_faces=false&amp;width=75&amp;action=like&amp;colorscheme=light&amp;height=20&amp;ref=addtoany" scrolling="no" style="border:none;overflow:hidden;width:90px;height:21px"></iframe><!--<![endif]--><!--[if IE]><iframe
frameborder="0" allowTransparency="true" class="addtoany_special_service twitter_tweet" src="http://platform.twitter.com/widgets/tweet_button.html?url=http%3A%2F%2Fwerxltd.com%2Fwp%2F2011%2F04%2F05%2Fsimple-message-bus-for-extjs-4%2F&amp;counturl=http%3A%2F%2Fwerxltd.com%2Fwp%2F2011%2F04%2F05%2Fsimple-message-bus-for-extjs-4%2F&amp;count=none&amp;text=Simple%20message%20bus%20for%20extjs%204" scrolling="no" style="border:none;overflow:hidden;width:55px;height:20px"></iframe><![endif]--><!--[if !IE]><!--><iframe
class="addtoany_special_service twitter_tweet" src="http://platform.twitter.com/widgets/tweet_button.html?url=http%3A%2F%2Fwerxltd.com%2Fwp%2F2011%2F04%2F05%2Fsimple-message-bus-for-extjs-4%2F&amp;counturl=http%3A%2F%2Fwerxltd.com%2Fwp%2F2011%2F04%2F05%2Fsimple-message-bus-for-extjs-4%2F&amp;count=none&amp;text=Simple%20message%20bus%20for%20extjs%204" scrolling="no" style="border:none;overflow:hidden;width:55px;height:20px"></iframe><!--<![endif]--><!--[if IE]><iframe
frameborder="0" allowTransparency="true" class="addtoany_special_service google_plusone" src="https://plusone.google.com/u/0/_/%2B1/fastbutton?url=http%3A%2F%2Fwerxltd.com%2Fwp%2F2011%2F04%2F05%2Fsimple-message-bus-for-extjs-4%2F&amp;size=medium&amp;count=false" scrolling="no" style="border:none;overflow:hidden;width:32px;height:20px"></iframe><![endif]--><!--[if !IE]><!--><iframe
class="addtoany_special_service google_plusone" src="https://plusone.google.com/u/0/_/%2B1/fastbutton?url=http%3A%2F%2Fwerxltd.com%2Fwp%2F2011%2F04%2F05%2Fsimple-message-bus-for-extjs-4%2F&amp;size=medium&amp;count=false" scrolling="no" style="border:none;overflow:hidden;width:32px;height:20px"></iframe><!--<![endif]--><a
class="a2a_button_linkedin" href="http://www.addtoany.com/add_to/linkedin?linkurl=http%3A%2F%2Fwerxltd.com%2Fwp%2F2011%2F04%2F05%2Fsimple-message-bus-for-extjs-4%2F&amp;linkname=Simple%20message%20bus%20for%20extjs%204" title="LinkedIn" rel="nofollow" target="_blank"><img
src="http://werxltd.com/wp/wp-content/plugins/add-to-any/icons/linkedin.png?9d7bd4" width="16" height="16" alt="LinkedIn"/></a><a
class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwerxltd.com%2Fwp%2F2011%2F04%2F05%2Fsimple-message-bus-for-extjs-4%2F&amp;title=Simple%20message%20bus%20for%20extjs%204" id="wpa2a_6">Share/Save</a></p>]]></content:encoded> <wfw:commentRss>http://werxltd.com/wp/2011/04/05/simple-message-bus-for-extjs-4/feed/</wfw:commentRss> <slash:comments>1</slash:comments> </item> <item><title>Calculate a color gradient in Javascript</title><link>http://werxltd.com/wp/2011/03/08/calculate-a-color-gradient-in-javascript/</link> <comments>http://werxltd.com/wp/2011/03/08/calculate-a-color-gradient-in-javascript/#comments</comments> <pubDate>Tue, 08 Mar 2011 16:44:33 +0000</pubDate> <dc:creator>wes</dc:creator> <category><![CDATA[javascript]]></category> <category><![CDATA[software development]]></category> <category><![CDATA[canvas]]></category> <category><![CDATA[color]]></category> <category><![CDATA[gradient]]></category><guid
isPermaLink="false">http://werxltd.com/wp/?p=908</guid> <description><![CDATA[Here is a simple Javascript class to calculate the percent of a gradient between two colors given the percent (as a float 0-1) and two colors. Uses functions from php.js. Color = function() { }; Color.hexdec = function(hex_string) { hex_string = (hex_string + '').replace(/[^a-f0-9]/gi, ''); return parseInt(hex_string, 16); } Color.dechex = function(number) { if (number [...]]]></description> <content:encoded><![CDATA[<p>Here is a simple Javascript class to calculate the percent of a gradient between two colors given the percent (as a float 0-1) and two colors. Uses functions from <a
href="http://phpjs.org/">php.js</a>.</p><pre class="brush:javascript">
Color = function() {
};

Color.hexdec = function(hex_string) {
    hex_string = (hex_string + '').replace(/[^a-f0-9]/gi, '');
    return parseInt(hex_string, 16);
}

Color.dechex = function(number) {
    if (number < 0) {
        number = 0xFFFFFFFF + number + 1;
    }
    return parseInt(number, 10).toString(16);
}

Color.pad = function(number, length) {
    var str = '' + number;
    while (str.length < length) {
        str = '0' + str;
    }
    return str;
}

Color.calcgrad = function(val, color1, color2) {

    if(!color1.match(/^#[0-9a-f]{6}/) || !color2.match(/^#[0-9a-f]{6}/)) return 'match err!';

    if (val > 1) {
        val = 1;
    }
    if (val < 0) {
        val = 0;
    }
    val = parseFloat(val);

    c1 = [Color.hexdec(color1.substr(1,2)), Color.hexdec(color1.substr(3,2)), Color.hexdec(color1.substr(5,2))];
    c2 = [Color.hexdec(color2.substr(1,2)), Color.hexdec(color2.substr(3,2)), Color.hexdec(color2.substr(5,2))];

    if (val < .5) {
        delta = [(c2[0] - c1[0]), (c2[1] - c1[1]), (c1[2] - c2[2])];
        arrColor = [c1[0] +<sup><a href="http://werxltd.com/wp/2011/03/08/calculate-a-color-gradient-in-javascript/#footnote_0_908" id="identifier_0_908" class="footnote-link footnote-identifier-link" title="delta[0] * val) * 2), c1[1] + ((delta[1] * val) * 2), c1[2] - ((delta[2] * val) * 2)];
    } else {
        delta = [(c1[0] - c2[0]), (c1[1] - c2[1]), (c1[2] - c2[2])];
        arrColor = [c1[0] - ((delta[0] * (val - .5">1</a></sup> * 2), c1[1] -<sup><a href="http://werxltd.com/wp/2011/03/08/calculate-a-color-gradient-in-javascript/#footnote_1_908" id="identifier_1_908" class="footnote-link footnote-identifier-link" title="delta[1] * (val - .5">2</a></sup> * 2), c1[2] -<sup><a href="http://werxltd.com/wp/2011/03/08/calculate-a-color-gradient-in-javascript/#footnote_2_908" id="identifier_2_908" class="footnote-link footnote-identifier-link" title="delta[2] * (val - .5">3</a></sup> * 2)];
    }
    return '#'+Color.pad(Color.dechex(arrColor[0]),2)+Color.pad(Color.dechex(arrColor[1]),2)+Color.pad(Color.dechex(arrColor[2]),2);
}
</pre><div
class="betterrelated none"><p>No related content found.</p></div><ol
class="footnotes"><li
id="footnote_0_908" class="footnote">delta[0] * val) * 2), c1[1] + ((delta[1] * val) * 2), c1[2] - ((delta[2] * val) * 2)];
} else {
delta = [(c1[0] - c2[0]), (c1[1] - c2[1]), (c1[2] - c2[2])];
arrColor = [c1[0] - ((delta[0] * (val - .5</li><li
id="footnote_1_908" class="footnote">delta[1] * (val - .5</li><li
id="footnote_2_908" class="footnote">delta[2] * (val - .5</li></ol><p><!--[if IE]><iframe
frameborder="0" allowTransparency="true" class="addtoany_special_service facebook_like" src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwerxltd.com%2Fwp%2F2011%2F03%2F08%2Fcalculate-a-color-gradient-in-javascript%2F&amp;layout=button_count&amp;show_faces=false&amp;width=75&amp;action=like&amp;colorscheme=light&amp;height=20&amp;ref=addtoany" scrolling="no" style="border:none;overflow:hidden;width:90px;height:21px"></iframe><![endif]--><!--[if !IE]><!--><iframe
class="addtoany_special_service facebook_like" src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwerxltd.com%2Fwp%2F2011%2F03%2F08%2Fcalculate-a-color-gradient-in-javascript%2F&amp;layout=button_count&amp;show_faces=false&amp;width=75&amp;action=like&amp;colorscheme=light&amp;height=20&amp;ref=addtoany" scrolling="no" style="border:none;overflow:hidden;width:90px;height:21px"></iframe><!--<![endif]--><!--[if IE]><iframe
frameborder="0" allowTransparency="true" class="addtoany_special_service twitter_tweet" src="http://platform.twitter.com/widgets/tweet_button.html?url=http%3A%2F%2Fwerxltd.com%2Fwp%2F2011%2F03%2F08%2Fcalculate-a-color-gradient-in-javascript%2F&amp;counturl=http%3A%2F%2Fwerxltd.com%2Fwp%2F2011%2F03%2F08%2Fcalculate-a-color-gradient-in-javascript%2F&amp;count=none&amp;text=Calculate%20a%20color%20gradient%20in%20Javascript" scrolling="no" style="border:none;overflow:hidden;width:55px;height:20px"></iframe><![endif]--><!--[if !IE]><!--><iframe
class="addtoany_special_service twitter_tweet" src="http://platform.twitter.com/widgets/tweet_button.html?url=http%3A%2F%2Fwerxltd.com%2Fwp%2F2011%2F03%2F08%2Fcalculate-a-color-gradient-in-javascript%2F&amp;counturl=http%3A%2F%2Fwerxltd.com%2Fwp%2F2011%2F03%2F08%2Fcalculate-a-color-gradient-in-javascript%2F&amp;count=none&amp;text=Calculate%20a%20color%20gradient%20in%20Javascript" scrolling="no" style="border:none;overflow:hidden;width:55px;height:20px"></iframe><!--<![endif]--><!--[if IE]><iframe
frameborder="0" allowTransparency="true" class="addtoany_special_service google_plusone" src="https://plusone.google.com/u/0/_/%2B1/fastbutton?url=http%3A%2F%2Fwerxltd.com%2Fwp%2F2011%2F03%2F08%2Fcalculate-a-color-gradient-in-javascript%2F&amp;size=medium&amp;count=false" scrolling="no" style="border:none;overflow:hidden;width:32px;height:20px"></iframe><![endif]--><!--[if !IE]><!--><iframe
class="addtoany_special_service google_plusone" src="https://plusone.google.com/u/0/_/%2B1/fastbutton?url=http%3A%2F%2Fwerxltd.com%2Fwp%2F2011%2F03%2F08%2Fcalculate-a-color-gradient-in-javascript%2F&amp;size=medium&amp;count=false" scrolling="no" style="border:none;overflow:hidden;width:32px;height:20px"></iframe><!--<![endif]--><a
class="a2a_button_linkedin" href="http://www.addtoany.com/add_to/linkedin?linkurl=http%3A%2F%2Fwerxltd.com%2Fwp%2F2011%2F03%2F08%2Fcalculate-a-color-gradient-in-javascript%2F&amp;linkname=Calculate%20a%20color%20gradient%20in%20Javascript" title="LinkedIn" rel="nofollow" target="_blank"><img
src="http://werxltd.com/wp/wp-content/plugins/add-to-any/icons/linkedin.png?9d7bd4" width="16" height="16" alt="LinkedIn"/></a><a
class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwerxltd.com%2Fwp%2F2011%2F03%2F08%2Fcalculate-a-color-gradient-in-javascript%2F&amp;title=Calculate%20a%20color%20gradient%20in%20Javascript" id="wpa2a_8">Share/Save</a></p>]]></content:encoded> <wfw:commentRss>http://werxltd.com/wp/2011/03/08/calculate-a-color-gradient-in-javascript/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Javascript implementation of Java&#8217;s String.hashCode() method</title><link>http://werxltd.com/wp/2010/05/13/javascript-implementation-of-javas-string-hashcode-method/</link> <comments>http://werxltd.com/wp/2010/05/13/javascript-implementation-of-javas-string-hashcode-method/#comments</comments> <pubDate>Thu, 13 May 2010 12:00:14 +0000</pubDate> <dc:creator>wes</dc:creator> <category><![CDATA[java]]></category> <category><![CDATA[javascript]]></category> <category><![CDATA[hashcode]]></category> <category><![CDATA[prototype]]></category><guid
isPermaLink="false">http://werxltd.com/wp/?p=581</guid> <description><![CDATA[Here is a direct replacement for Java&#8217;s String.hashCode() method implemented in Javascript. I wrote this function to fulfill a requirement at work. Apparently, the back-end engineers thought hashCode() was a standard function. One of the hurdles for this project was not only figuring out how to translate the mathematical formula used in Java to generate [...]]]></description> <content:encoded><![CDATA[<p>Here is a direct replacement for Java&#8217;s <a
href="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html#hashCode()">String.hashCode()</a> method implemented in Javascript.</p><p>I wrote this function to fulfill a requirement at work. Apparently, the back-end engineers thought hashCode() was a standard function. One of the hurdles for this project was not only figuring out how to translate the mathematical formula used in Java to generate hashCode()&#8217;s but also how to force Javascript to use 32bit integer math (no small feat).</p><p>Fortunately, I <a
href="http://www.hunlock.com/blogs/The_Complete_Javascript_Number_Reference">discovered that Java supports bitwise operators</a> which are constrained to 32bit integer math.</p><p>So here&#8217;s the resulting String prototype in Javascript. With this prototype you can simply call .hashCode() on any string, ie. &#8220;some string&#8221;.hashCode(), and receive a numerical hash code (more specifically, a Java equivalent) such as 1395333309.</p><pre class="brush:javascript">
String.prototype.hashCode = function(){
	var hash = 0;
	if (this.length == 0) return hash;
	for (i = 0; i < this.length; i++) {
		char = this.charCodeAt(i);
		hash = ((hash<<5)-hash)+char;
		hash = hash & hash; // Convert to 32bit integer
	}
	return hash;
}
</pre><div
class="betterrelated none"><p>No related content found.</p></div><p><!--[if IE]><iframe
frameborder="0" allowTransparency="true" class="addtoany_special_service facebook_like" src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwerxltd.com%2Fwp%2F2010%2F05%2F13%2Fjavascript-implementation-of-javas-string-hashcode-method%2F&amp;layout=button_count&amp;show_faces=false&amp;width=75&amp;action=like&amp;colorscheme=light&amp;height=20&amp;ref=addtoany" scrolling="no" style="border:none;overflow:hidden;width:90px;height:21px"></iframe><![endif]--><!--[if !IE]><!--><iframe
class="addtoany_special_service facebook_like" src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwerxltd.com%2Fwp%2F2010%2F05%2F13%2Fjavascript-implementation-of-javas-string-hashcode-method%2F&amp;layout=button_count&amp;show_faces=false&amp;width=75&amp;action=like&amp;colorscheme=light&amp;height=20&amp;ref=addtoany" scrolling="no" style="border:none;overflow:hidden;width:90px;height:21px"></iframe><!--<![endif]--><!--[if IE]><iframe
frameborder="0" allowTransparency="true" class="addtoany_special_service twitter_tweet" src="http://platform.twitter.com/widgets/tweet_button.html?url=http%3A%2F%2Fwerxltd.com%2Fwp%2F2010%2F05%2F13%2Fjavascript-implementation-of-javas-string-hashcode-method%2F&amp;counturl=http%3A%2F%2Fwerxltd.com%2Fwp%2F2010%2F05%2F13%2Fjavascript-implementation-of-javas-string-hashcode-method%2F&amp;count=none&amp;text=Javascript%20implementation%20of%20Java%26%238217%3Bs%20String.hashCode%28%29%20method" scrolling="no" style="border:none;overflow:hidden;width:55px;height:20px"></iframe><![endif]--><!--[if !IE]><!--><iframe
class="addtoany_special_service twitter_tweet" src="http://platform.twitter.com/widgets/tweet_button.html?url=http%3A%2F%2Fwerxltd.com%2Fwp%2F2010%2F05%2F13%2Fjavascript-implementation-of-javas-string-hashcode-method%2F&amp;counturl=http%3A%2F%2Fwerxltd.com%2Fwp%2F2010%2F05%2F13%2Fjavascript-implementation-of-javas-string-hashcode-method%2F&amp;count=none&amp;text=Javascript%20implementation%20of%20Java%26%238217%3Bs%20String.hashCode%28%29%20method" scrolling="no" style="border:none;overflow:hidden;width:55px;height:20px"></iframe><!--<![endif]--><!--[if IE]><iframe
frameborder="0" allowTransparency="true" class="addtoany_special_service google_plusone" src="https://plusone.google.com/u/0/_/%2B1/fastbutton?url=http%3A%2F%2Fwerxltd.com%2Fwp%2F2010%2F05%2F13%2Fjavascript-implementation-of-javas-string-hashcode-method%2F&amp;size=medium&amp;count=false" scrolling="no" style="border:none;overflow:hidden;width:32px;height:20px"></iframe><![endif]--><!--[if !IE]><!--><iframe
class="addtoany_special_service google_plusone" src="https://plusone.google.com/u/0/_/%2B1/fastbutton?url=http%3A%2F%2Fwerxltd.com%2Fwp%2F2010%2F05%2F13%2Fjavascript-implementation-of-javas-string-hashcode-method%2F&amp;size=medium&amp;count=false" scrolling="no" style="border:none;overflow:hidden;width:32px;height:20px"></iframe><!--<![endif]--><a
class="a2a_button_linkedin" href="http://www.addtoany.com/add_to/linkedin?linkurl=http%3A%2F%2Fwerxltd.com%2Fwp%2F2010%2F05%2F13%2Fjavascript-implementation-of-javas-string-hashcode-method%2F&amp;linkname=Javascript%20implementation%20of%20Java%26%238217%3Bs%20String.hashCode%28%29%20method" title="LinkedIn" rel="nofollow" target="_blank"><img
src="http://werxltd.com/wp/wp-content/plugins/add-to-any/icons/linkedin.png?9d7bd4" width="16" height="16" alt="LinkedIn"/></a><a
class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwerxltd.com%2Fwp%2F2010%2F05%2F13%2Fjavascript-implementation-of-javas-string-hashcode-method%2F&amp;title=Javascript%20implementation%20of%20Java%26%238217%3Bs%20String.hashCode%28%29%20method" id="wpa2a_10">Share/Save</a></p>]]></content:encoded> <wfw:commentRss>http://werxltd.com/wp/2010/05/13/javascript-implementation-of-javas-string-hashcode-method/feed/</wfw:commentRss> <slash:comments>7</slash:comments> </item> <item><title>Primitive OOP observer pattern with ExtJS</title><link>http://werxltd.com/wp/2009/08/13/primitive-oop-with-extjs/</link> <comments>http://werxltd.com/wp/2009/08/13/primitive-oop-with-extjs/#comments</comments> <pubDate>Thu, 13 Aug 2009 16:11:45 +0000</pubDate> <dc:creator>wes</dc:creator> <category><![CDATA[software development]]></category> <category><![CDATA[code]]></category> <category><![CDATA[code quality]]></category> <category><![CDATA[coding practices]]></category> <category><![CDATA[extjs]]></category> <category><![CDATA[javascript]]></category> <category><![CDATA[software design patterns]]></category><guid
isPermaLink="false">http://werxltd.com/wp/?p=170</guid> <description><![CDATA[Recently I embarked on a quest to design a framework which would help us keep track of large and complex javascript projects in easily identifiable and extendable patterns. After some thought and deliberation, we eventually settled on the observer pattern using Ext&#8217;s Ext.util.Observable object as the base object to use in responding to event broadcasts [...]]]></description> <content:encoded><![CDATA[<p>Recently I embarked on a quest to design a framework which would help us keep track of large and complex javascript projects in easily identifiable and extendable patterns. After some thought and deliberation, we eventually settled on the <a
href="http://en.wikipedia.org/wiki/Observer_pattern">observer pattern</a> using Ext&#8217;s <a
href="http://extjs.com/deploy/dev/docs/?class=Ext.util.Observable">Ext.util.Observable</a> object as the base object to use in responding to event broadcasts and the <a
href="http://extjs.com/forum/showthread.php?t=37422">Ext.ux.BroadcastEvents</a> plugin for managing global event broadcasts.</p><p>Here is the code I came up with for common component elements:</p><pre class="brush:javascript">
ComponentWrapperBase = Ext.extend(Ext.util.Observable, {
	delayBuild: false,

	eventObj: {
			"buildwidget": true,
			"showwidget": true,
			"destroy": true,
			"refresh": true
		},

	globalEvents: [],

	widget: null,
	widgetCfg: null,

	build: function() {
		if (this.widgetCfg &#038;&#038; !this.widget) {
			//console.log("buildwidget", this);
			this.widget = Ext.ComponentMgr.create(this.widgetCfg);
			this.widget.wrapper = this;
			this.fireBuildEvent();
		}
	},

	fireBuildEvent: function() {
		this.fireEvent("buildwidget", this, this.widget);
	},

	showWidget: function(locationId) {
		if (this.widget) {
			if (this.widget.xtype == "window") {
					if (locationId != null) {
						this.widget.show(locationId);
					} else {
						this.widget.show();
					}
			}
			else {

				if (locationId != null) {
					this.widget.render(locationId);
				}
				else {
					this.widget.render();
				}
			}
			this.fireEvent("showwidget", this);
		}
	},

	constructor: function(config){
		if (config) {
			if (config.widgetCfg) {
				this.widgetCfg = config.widgetCfg;
			}

			if (config.delayBuild) {
				this.delayBuild = config.delayBuild;
			}

			// Copy configured listeners into *this* object so that the base class's
			// constructor will add them.
			if (config.listeners) {
				Ext.apply(this.listeners,config.listeners);
			}

			if(config.events &#038;&#038; Ext.isArray(config.events)) {
				for (var i=0; i<config.events.length; i++) {
					this.eventObj[config.events[i]] = true;
				};
			}

			if (config.globalEvents &#038;&#038; Ext.isArray(config.globalEvents)) {
				this.globalEvents = config.globalEvents;
			}
		}

		for (var i=0; i
<this.globalEvents.length; i++) {
			Ext.ux.event.Broadcast.subscribe(this.globalEvents[i], this.listeners[this.globalEvents[i]], this);
			this.eventObj[this.globalEvents[i]] = true;
		};

		this.addEvents(this.eventObj);

		// Call our superclass constructor to complete construction process.
		ComponentWrapperBase.superclass.constructor.call(this);

		//this.on(this.eventListeners);

		if(!this.delayBuild) {
			this.build();
		}
	}
});
</pre><p>This creates a simple widget wrapped in an Observable object. You can reach the contained widget through wrapper.widget. Using the framework above, here's how you could create a simple widget.</p><pre class="brush:javascript">
SimpleTextField = Ext.extend(ComponentWrapperBase, {
	widgetCfg: {
		xtype: 'textfield',
		fieldLabel: 'Name'
	},
	constructor: function(config){		// Constructor is not required, but I've included
							// it to demonstrate the flexibility of this framework
		if (config) {
			Ext.apply(this,config);
		}

		this.widgetCfg.value = 'John Smith';

		SimpleTextField.superclass.constructor.call(this);
	}
});

var simpleTextField = new SimpleTextField();
// Actual component is available at simpleTextField.widget, useful for adding to other containers
</pre><p>That's it! If you have any questions or comments, feel free to post them below.</p><div
class="betterrelated none"><p>No related content found.</p></div><p><!--[if IE]><iframe
frameborder="0" allowTransparency="true" class="addtoany_special_service facebook_like" src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwerxltd.com%2Fwp%2F2009%2F08%2F13%2Fprimitive-oop-with-extjs%2F&amp;layout=button_count&amp;show_faces=false&amp;width=75&amp;action=like&amp;colorscheme=light&amp;height=20&amp;ref=addtoany" scrolling="no" style="border:none;overflow:hidden;width:90px;height:21px"></iframe><![endif]--><!--[if !IE]><!--><iframe
class="addtoany_special_service facebook_like" src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwerxltd.com%2Fwp%2F2009%2F08%2F13%2Fprimitive-oop-with-extjs%2F&amp;layout=button_count&amp;show_faces=false&amp;width=75&amp;action=like&amp;colorscheme=light&amp;height=20&amp;ref=addtoany" scrolling="no" style="border:none;overflow:hidden;width:90px;height:21px"></iframe><!--<![endif]--><!--[if IE]><iframe
frameborder="0" allowTransparency="true" class="addtoany_special_service twitter_tweet" src="http://platform.twitter.com/widgets/tweet_button.html?url=http%3A%2F%2Fwerxltd.com%2Fwp%2F2009%2F08%2F13%2Fprimitive-oop-with-extjs%2F&amp;counturl=http%3A%2F%2Fwerxltd.com%2Fwp%2F2009%2F08%2F13%2Fprimitive-oop-with-extjs%2F&amp;count=none&amp;text=Primitive%20OOP%20observer%20pattern%20with%20ExtJS" scrolling="no" style="border:none;overflow:hidden;width:55px;height:20px"></iframe><![endif]--><!--[if !IE]><!--><iframe
class="addtoany_special_service twitter_tweet" src="http://platform.twitter.com/widgets/tweet_button.html?url=http%3A%2F%2Fwerxltd.com%2Fwp%2F2009%2F08%2F13%2Fprimitive-oop-with-extjs%2F&amp;counturl=http%3A%2F%2Fwerxltd.com%2Fwp%2F2009%2F08%2F13%2Fprimitive-oop-with-extjs%2F&amp;count=none&amp;text=Primitive%20OOP%20observer%20pattern%20with%20ExtJS" scrolling="no" style="border:none;overflow:hidden;width:55px;height:20px"></iframe><!--<![endif]--><!--[if IE]><iframe
frameborder="0" allowTransparency="true" class="addtoany_special_service google_plusone" src="https://plusone.google.com/u/0/_/%2B1/fastbutton?url=http%3A%2F%2Fwerxltd.com%2Fwp%2F2009%2F08%2F13%2Fprimitive-oop-with-extjs%2F&amp;size=medium&amp;count=false" scrolling="no" style="border:none;overflow:hidden;width:32px;height:20px"></iframe><![endif]--><!--[if !IE]><!--><iframe
class="addtoany_special_service google_plusone" src="https://plusone.google.com/u/0/_/%2B1/fastbutton?url=http%3A%2F%2Fwerxltd.com%2Fwp%2F2009%2F08%2F13%2Fprimitive-oop-with-extjs%2F&amp;size=medium&amp;count=false" scrolling="no" style="border:none;overflow:hidden;width:32px;height:20px"></iframe><!--<![endif]--><a
class="a2a_button_linkedin" href="http://www.addtoany.com/add_to/linkedin?linkurl=http%3A%2F%2Fwerxltd.com%2Fwp%2F2009%2F08%2F13%2Fprimitive-oop-with-extjs%2F&amp;linkname=Primitive%20OOP%20observer%20pattern%20with%20ExtJS" title="LinkedIn" rel="nofollow" target="_blank"><img
src="http://werxltd.com/wp/wp-content/plugins/add-to-any/icons/linkedin.png?9d7bd4" width="16" height="16" alt="LinkedIn"/></a><a
class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwerxltd.com%2Fwp%2F2009%2F08%2F13%2Fprimitive-oop-with-extjs%2F&amp;title=Primitive%20OOP%20observer%20pattern%20with%20ExtJS" id="wpa2a_12">Share/Save</a></p>]]></content:encoded> <wfw:commentRss>http://werxltd.com/wp/2009/08/13/primitive-oop-with-extjs/feed/</wfw:commentRss> <slash:comments>1</slash:comments> </item> <item><title>Cleaning up unresponsive script errors</title><link>http://werxltd.com/wp/2009/07/03/cleaning-up-unresponsive-script-errors/</link> <comments>http://werxltd.com/wp/2009/07/03/cleaning-up-unresponsive-script-errors/#comments</comments> <pubDate>Fri, 03 Jul 2009 18:58:13 +0000</pubDate> <dc:creator>wes</dc:creator> <category><![CDATA[software development]]></category> <category><![CDATA[extjs]]></category> <category><![CDATA[javascript]]></category> <category><![CDATA[javascript optimization]]></category> <category><![CDATA[performance]]></category> <category><![CDATA[unresponsive script error]]></category><guid
isPermaLink="false">http://werxltd.com/wp/?p=85</guid> <description><![CDATA[I recently worked on improving performance in a labor scheduling application. The app was originally designed to load all the employees at one time in one large chunk, processing and stuffing the data into various places as needed on startup. This all worked fairly well on average stores with 50-100 employee records until we discovered [...]]]></description> <content:encoded><![CDATA[<p>I recently worked on improving performance in a labor scheduling application. The app was originally designed to load all the employees at one time in one large chunk, processing and stuffing the data into various places as needed on startup. This all worked fairly well on average stores with 50-100 employee records until we discovered several stores with 100+ employee records which caused the browser to display an <a
href="http://werxltd.com/wp/wp-content/uploads/2009/07/yahoo_unresponsive_script_1.jpg?9d7bd4">unresponsive script warning</a> due to the rather heavy pre-processing algorithms.</p><p>After scouring the web for clues to help me get rid of this warning without <a
href="http://lifehacker.com/162574/put-off-firefox-15s-unresponsive-script-dialogue">changing settings</a> on the browser, I found out that the only way to avoid these warnings was through a pseudo-threading pattern using setTimeout<sup><a
href="http://werxltd.com/wp/2009/07/03/cleaning-up-unresponsive-script-errors/#footnote_0_85" id="identifier_0_85" class="footnote-link footnote-identifier-link" title="http://www.dojotoolkit.org/forum/support/general-support/need-suggestions-how-manage-firefox-warning-unresponsive-script">1</a></sup><sup><a
href="http://werxltd.com/wp/2009/07/03/cleaning-up-unresponsive-script-errors/#footnote_1_85" id="identifier_1_85" class="footnote-link footnote-identifier-link" title="http://dev.opera.com/articles/view/efficient-javascript/?page=all">2</a></sup>.</p><p>One of the patterns I came up with to process a sequence of commands (such as adding records to a store) one at a time while still allowing the browser time to refresh and process other commands:</p><pre class="brush:javascript">var chainedTasks = [
   function() {
      console.log('first set of tasks');
   },
   function() {
      console.log('second set of tasks');
   },
   function() {
      console.log('third set of tasks');
   }
];

var currentTaskNum = 0;
var isExecuting = false;
var emptask = {var emptask = {
	scope: this,
	interval: 100,
	run: function(){
		if(currentTaskNum &gt; chainedTasks.length) {
			Ext.TaskMgr.stop(emptask);
		}

		if (!threadIsRunning) {
			threadIsRunning = true;
			if (typeof chainedTasks[currentTaskNum] === 'function') {
				chainedTasks[currentTaskNum](currentTaskNum);
			}
			currentTaskNum++;
			threadIsRunning = false;
		}
	}
};
Ext.TaskMgr.start(emptask);</pre><div
class="betterrelated none"><p>No related content found.</p></div><ol
class="footnotes"><li
id="footnote_0_85" class="footnote"><a
href="http://www.dojotoolkit.org/forum/support/general-support/need-suggestions-how-manage-firefox-warning-unresponsive-script">http://www.dojotoolkit.org/forum/support/general-support/need-suggestions-how-manage-firefox-warning-unresponsive-script</a></li><li
id="footnote_1_85" class="footnote"><a
href="http://dev.opera.com/articles/view/efficient-javascript/?page=all">http://dev.opera.com/articles/view/efficient-javascript/?page=all</a></li></ol><p><!--[if IE]><iframe
frameborder="0" allowTransparency="true" class="addtoany_special_service facebook_like" src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwerxltd.com%2Fwp%2F2009%2F07%2F03%2Fcleaning-up-unresponsive-script-errors%2F&amp;layout=button_count&amp;show_faces=false&amp;width=75&amp;action=like&amp;colorscheme=light&amp;height=20&amp;ref=addtoany" scrolling="no" style="border:none;overflow:hidden;width:90px;height:21px"></iframe><![endif]--><!--[if !IE]><!--><iframe
class="addtoany_special_service facebook_like" src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwerxltd.com%2Fwp%2F2009%2F07%2F03%2Fcleaning-up-unresponsive-script-errors%2F&amp;layout=button_count&amp;show_faces=false&amp;width=75&amp;action=like&amp;colorscheme=light&amp;height=20&amp;ref=addtoany" scrolling="no" style="border:none;overflow:hidden;width:90px;height:21px"></iframe><!--<![endif]--><!--[if IE]><iframe
frameborder="0" allowTransparency="true" class="addtoany_special_service twitter_tweet" src="http://platform.twitter.com/widgets/tweet_button.html?url=http%3A%2F%2Fwerxltd.com%2Fwp%2F2009%2F07%2F03%2Fcleaning-up-unresponsive-script-errors%2F&amp;counturl=http%3A%2F%2Fwerxltd.com%2Fwp%2F2009%2F07%2F03%2Fcleaning-up-unresponsive-script-errors%2F&amp;count=none&amp;text=Cleaning%20up%20unresponsive%20script%20errors" scrolling="no" style="border:none;overflow:hidden;width:55px;height:20px"></iframe><![endif]--><!--[if !IE]><!--><iframe
class="addtoany_special_service twitter_tweet" src="http://platform.twitter.com/widgets/tweet_button.html?url=http%3A%2F%2Fwerxltd.com%2Fwp%2F2009%2F07%2F03%2Fcleaning-up-unresponsive-script-errors%2F&amp;counturl=http%3A%2F%2Fwerxltd.com%2Fwp%2F2009%2F07%2F03%2Fcleaning-up-unresponsive-script-errors%2F&amp;count=none&amp;text=Cleaning%20up%20unresponsive%20script%20errors" scrolling="no" style="border:none;overflow:hidden;width:55px;height:20px"></iframe><!--<![endif]--><!--[if IE]><iframe
frameborder="0" allowTransparency="true" class="addtoany_special_service google_plusone" src="https://plusone.google.com/u/0/_/%2B1/fastbutton?url=http%3A%2F%2Fwerxltd.com%2Fwp%2F2009%2F07%2F03%2Fcleaning-up-unresponsive-script-errors%2F&amp;size=medium&amp;count=false" scrolling="no" style="border:none;overflow:hidden;width:32px;height:20px"></iframe><![endif]--><!--[if !IE]><!--><iframe
class="addtoany_special_service google_plusone" src="https://plusone.google.com/u/0/_/%2B1/fastbutton?url=http%3A%2F%2Fwerxltd.com%2Fwp%2F2009%2F07%2F03%2Fcleaning-up-unresponsive-script-errors%2F&amp;size=medium&amp;count=false" scrolling="no" style="border:none;overflow:hidden;width:32px;height:20px"></iframe><!--<![endif]--><a
class="a2a_button_linkedin" href="http://www.addtoany.com/add_to/linkedin?linkurl=http%3A%2F%2Fwerxltd.com%2Fwp%2F2009%2F07%2F03%2Fcleaning-up-unresponsive-script-errors%2F&amp;linkname=Cleaning%20up%20unresponsive%20script%20errors" title="LinkedIn" rel="nofollow" target="_blank"><img
src="http://werxltd.com/wp/wp-content/plugins/add-to-any/icons/linkedin.png?9d7bd4" width="16" height="16" alt="LinkedIn"/></a><a
class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwerxltd.com%2Fwp%2F2009%2F07%2F03%2Fcleaning-up-unresponsive-script-errors%2F&amp;title=Cleaning%20up%20unresponsive%20script%20errors" id="wpa2a_14">Share/Save</a></p>]]></content:encoded> <wfw:commentRss>http://werxltd.com/wp/2009/07/03/cleaning-up-unresponsive-script-errors/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Javascript resources</title><link>http://werxltd.com/wp/2009/07/03/javascript-resources/</link> <comments>http://werxltd.com/wp/2009/07/03/javascript-resources/#comments</comments> <pubDate>Fri, 03 Jul 2009 13:06:26 +0000</pubDate> <dc:creator>wes</dc:creator> <category><![CDATA[software development]]></category> <category><![CDATA[helpful sites]]></category> <category><![CDATA[javascript]]></category> <category><![CDATA[javascript debugging]]></category> <category><![CDATA[resources]]></category><guid
isPermaLink="false">http://werxltd.com/wp/?p=82</guid> <description><![CDATA[Being a scripted language whose behavior can vary depending on the browser environment it is run in, Javascript can be particularly difficult to work with and debug sometimes. Here are a few tools I&#8217;ve found to be helpful: Firebug for FireFox, along with other handy extensions Visual Studio 2005+, Script Debugger, and/or DebugBar for IE [...]]]></description> <content:encoded><![CDATA[<p>Being a scripted language whose behavior can vary depending on the browser environment it is run in, Javascript can be particularly difficult to work with and debug sometimes. Here are a few tools I&#8217;ve found to be helpful:</p><ul><li><a
href="http://getfirebug.com/">Firebug</a> for FireFox, along with <a
href="http://www.webdesignbooth.com/35-absolutely-useful-firefox-plugins-for-web-designers-and-developers/">other handy extensions</a></li><li><a
href="http://geekswithblogs.net/lazydeveloper/archive/2006/07/10/84552.aspx">Visual Studio 2005+</a>, <a
href="http://blog.evandavey.com/2008/02/how-to-debugging-javascript-in-ie-with-microsoft-script-debugger.html">Script Debugger</a>, and/or <a
href="http://www.debugbar.com/">DebugBar</a> for IE</li><li><a
href="http://jslint.com/">JSLint</a>, helps keep your code clean and <a
href="http://en.wikipedia.org/wiki/ECMAScript">EMCAScript</a> compliant</li><li><a
href="http://jsonformatter.curiousconcept.com/">JSON Validator</a> (and formatter), helps make your <a
href="http://json.org/">JSON</a> data more legible</li><li><a
href="http://www.aptana.com/">Aptana</a>, an IDE based on <a
href="http://www.eclipse.org/">Eclipse</a> with several built-in tools like JSLint to help you avoid simple mistakes.</li><li><a
style="text-decoration: none;" href="http://www.w3schools.com/jsref/default.asp">W3C&#8217;s Javascript Reference</a><a
style="text-decoration: none;" href="http://www.w3schools.com/jsref/default.asp"> </a></li></ul><p>These are the most helpful Javascript tools I&#8217;ve found. If you know of any more feel free to mention them in the comments below. Happy coding!</p><div
class="betterrelated none"><p>No related content found.</p></div><p><!--[if IE]><iframe
frameborder="0" allowTransparency="true" class="addtoany_special_service facebook_like" src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwerxltd.com%2Fwp%2F2009%2F07%2F03%2Fjavascript-resources%2F&amp;layout=button_count&amp;show_faces=false&amp;width=75&amp;action=like&amp;colorscheme=light&amp;height=20&amp;ref=addtoany" scrolling="no" style="border:none;overflow:hidden;width:90px;height:21px"></iframe><![endif]--><!--[if !IE]><!--><iframe
class="addtoany_special_service facebook_like" src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwerxltd.com%2Fwp%2F2009%2F07%2F03%2Fjavascript-resources%2F&amp;layout=button_count&amp;show_faces=false&amp;width=75&amp;action=like&amp;colorscheme=light&amp;height=20&amp;ref=addtoany" scrolling="no" style="border:none;overflow:hidden;width:90px;height:21px"></iframe><!--<![endif]--><!--[if IE]><iframe
frameborder="0" allowTransparency="true" class="addtoany_special_service twitter_tweet" src="http://platform.twitter.com/widgets/tweet_button.html?url=http%3A%2F%2Fwerxltd.com%2Fwp%2F2009%2F07%2F03%2Fjavascript-resources%2F&amp;counturl=http%3A%2F%2Fwerxltd.com%2Fwp%2F2009%2F07%2F03%2Fjavascript-resources%2F&amp;count=none&amp;text=Javascript%20resources" scrolling="no" style="border:none;overflow:hidden;width:55px;height:20px"></iframe><![endif]--><!--[if !IE]><!--><iframe
class="addtoany_special_service twitter_tweet" src="http://platform.twitter.com/widgets/tweet_button.html?url=http%3A%2F%2Fwerxltd.com%2Fwp%2F2009%2F07%2F03%2Fjavascript-resources%2F&amp;counturl=http%3A%2F%2Fwerxltd.com%2Fwp%2F2009%2F07%2F03%2Fjavascript-resources%2F&amp;count=none&amp;text=Javascript%20resources" scrolling="no" style="border:none;overflow:hidden;width:55px;height:20px"></iframe><!--<![endif]--><!--[if IE]><iframe
frameborder="0" allowTransparency="true" class="addtoany_special_service google_plusone" src="https://plusone.google.com/u/0/_/%2B1/fastbutton?url=http%3A%2F%2Fwerxltd.com%2Fwp%2F2009%2F07%2F03%2Fjavascript-resources%2F&amp;size=medium&amp;count=false" scrolling="no" style="border:none;overflow:hidden;width:32px;height:20px"></iframe><![endif]--><!--[if !IE]><!--><iframe
class="addtoany_special_service google_plusone" src="https://plusone.google.com/u/0/_/%2B1/fastbutton?url=http%3A%2F%2Fwerxltd.com%2Fwp%2F2009%2F07%2F03%2Fjavascript-resources%2F&amp;size=medium&amp;count=false" scrolling="no" style="border:none;overflow:hidden;width:32px;height:20px"></iframe><!--<![endif]--><a
class="a2a_button_linkedin" href="http://www.addtoany.com/add_to/linkedin?linkurl=http%3A%2F%2Fwerxltd.com%2Fwp%2F2009%2F07%2F03%2Fjavascript-resources%2F&amp;linkname=Javascript%20resources" title="LinkedIn" rel="nofollow" target="_blank"><img
src="http://werxltd.com/wp/wp-content/plugins/add-to-any/icons/linkedin.png?9d7bd4" width="16" height="16" alt="LinkedIn"/></a><a
class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwerxltd.com%2Fwp%2F2009%2F07%2F03%2Fjavascript-resources%2F&amp;title=Javascript%20resources" id="wpa2a_16">Share/Save</a></p>]]></content:encoded> <wfw:commentRss>http://werxltd.com/wp/2009/07/03/javascript-resources/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Warning: JSLint will hurt your feelings</title><link>http://werxltd.com/wp/2009/06/15/warning-jslint-will-hurt-your-feelings/</link> <comments>http://werxltd.com/wp/2009/06/15/warning-jslint-will-hurt-your-feelings/#comments</comments> <pubDate>Mon, 15 Jun 2009 14:42:28 +0000</pubDate> <dc:creator>wes</dc:creator> <category><![CDATA[software development]]></category> <category><![CDATA[code quality]]></category> <category><![CDATA[coding practices]]></category> <category><![CDATA[development tools]]></category> <category><![CDATA[javascript]]></category> <category><![CDATA[jslint]]></category> <category><![CDATA[lint]]></category> <category><![CDATA[minify]]></category> <category><![CDATA[obsfucate]]></category><guid
isPermaLink="false">http://werxltd.com/wp/?p=56</guid> <description><![CDATA[JSLint is a very helpful code quality utility for javascript that purports to hurt your feelings but helps you write ECMAScript compliant code. Many development suites like Aptana now include lint checking while you code. A major advantage of making sure your code is linted is that it ensures your code will not be mangled [...]]]></description> <content:encoded><![CDATA[<p><a
href="http://getfirebug.com/console.html">JSLint</a> is a very helpful code quality utility for javascript that purports to hurt your feelings but helps you write <a
href="http://www.ecma-international.org/publications/standards/Ecma-262.htm">ECMAScript</a> compliant code. Many development suites like <a
href="http://www.aptana.com/">Aptana</a> now include lint checking while you code.</p><p>A major advantage of making sure your code is linted is that it ensures your code will not be mangled too badly by <a
href="http://code.google.com/p/minify/">minification</a>/<a
href="http://ajaxian.com/archives/utility-javascript-obfuscator">obfuscators</a> if you decide to use them later on.</p><div
class="betterrelated none"><p>No related content found.</p></div><p><!--[if IE]><iframe
frameborder="0" allowTransparency="true" class="addtoany_special_service facebook_like" src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwerxltd.com%2Fwp%2F2009%2F06%2F15%2Fwarning-jslint-will-hurt-your-feelings%2F&amp;layout=button_count&amp;show_faces=false&amp;width=75&amp;action=like&amp;colorscheme=light&amp;height=20&amp;ref=addtoany" scrolling="no" style="border:none;overflow:hidden;width:90px;height:21px"></iframe><![endif]--><!--[if !IE]><!--><iframe
class="addtoany_special_service facebook_like" src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwerxltd.com%2Fwp%2F2009%2F06%2F15%2Fwarning-jslint-will-hurt-your-feelings%2F&amp;layout=button_count&amp;show_faces=false&amp;width=75&amp;action=like&amp;colorscheme=light&amp;height=20&amp;ref=addtoany" scrolling="no" style="border:none;overflow:hidden;width:90px;height:21px"></iframe><!--<![endif]--><!--[if IE]><iframe
frameborder="0" allowTransparency="true" class="addtoany_special_service twitter_tweet" src="http://platform.twitter.com/widgets/tweet_button.html?url=http%3A%2F%2Fwerxltd.com%2Fwp%2F2009%2F06%2F15%2Fwarning-jslint-will-hurt-your-feelings%2F&amp;counturl=http%3A%2F%2Fwerxltd.com%2Fwp%2F2009%2F06%2F15%2Fwarning-jslint-will-hurt-your-feelings%2F&amp;count=none&amp;text=Warning%3A%20JSLint%20will%20hurt%20your%20feelings" scrolling="no" style="border:none;overflow:hidden;width:55px;height:20px"></iframe><![endif]--><!--[if !IE]><!--><iframe
class="addtoany_special_service twitter_tweet" src="http://platform.twitter.com/widgets/tweet_button.html?url=http%3A%2F%2Fwerxltd.com%2Fwp%2F2009%2F06%2F15%2Fwarning-jslint-will-hurt-your-feelings%2F&amp;counturl=http%3A%2F%2Fwerxltd.com%2Fwp%2F2009%2F06%2F15%2Fwarning-jslint-will-hurt-your-feelings%2F&amp;count=none&amp;text=Warning%3A%20JSLint%20will%20hurt%20your%20feelings" scrolling="no" style="border:none;overflow:hidden;width:55px;height:20px"></iframe><!--<![endif]--><!--[if IE]><iframe
frameborder="0" allowTransparency="true" class="addtoany_special_service google_plusone" src="https://plusone.google.com/u/0/_/%2B1/fastbutton?url=http%3A%2F%2Fwerxltd.com%2Fwp%2F2009%2F06%2F15%2Fwarning-jslint-will-hurt-your-feelings%2F&amp;size=medium&amp;count=false" scrolling="no" style="border:none;overflow:hidden;width:32px;height:20px"></iframe><![endif]--><!--[if !IE]><!--><iframe
class="addtoany_special_service google_plusone" src="https://plusone.google.com/u/0/_/%2B1/fastbutton?url=http%3A%2F%2Fwerxltd.com%2Fwp%2F2009%2F06%2F15%2Fwarning-jslint-will-hurt-your-feelings%2F&amp;size=medium&amp;count=false" scrolling="no" style="border:none;overflow:hidden;width:32px;height:20px"></iframe><!--<![endif]--><a
class="a2a_button_linkedin" href="http://www.addtoany.com/add_to/linkedin?linkurl=http%3A%2F%2Fwerxltd.com%2Fwp%2F2009%2F06%2F15%2Fwarning-jslint-will-hurt-your-feelings%2F&amp;linkname=Warning%3A%20JSLint%20will%20hurt%20your%20feelings" title="LinkedIn" rel="nofollow" target="_blank"><img
src="http://werxltd.com/wp/wp-content/plugins/add-to-any/icons/linkedin.png?9d7bd4" width="16" height="16" alt="LinkedIn"/></a><a
class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwerxltd.com%2Fwp%2F2009%2F06%2F15%2Fwarning-jslint-will-hurt-your-feelings%2F&amp;title=Warning%3A%20JSLint%20will%20hurt%20your%20feelings" id="wpa2a_18">Share/Save</a></p>]]></content:encoded> <wfw:commentRss>http://werxltd.com/wp/2009/06/15/warning-jslint-will-hurt-your-feelings/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Multi-threading in Web 2.0</title><link>http://werxltd.com/wp/2009/06/10/multi-threading-in-web-20/</link> <comments>http://werxltd.com/wp/2009/06/10/multi-threading-in-web-20/#comments</comments> <pubDate>Wed, 10 Jun 2009 19:21:22 +0000</pubDate> <dc:creator>wes</dc:creator> <category><![CDATA[software development]]></category> <category><![CDATA[extjs]]></category> <category><![CDATA[javascript]]></category> <category><![CDATA[multi threading]]></category> <category><![CDATA[performance]]></category> <category><![CDATA[web 2.0]]></category><guid
isPermaLink="false">http://werxltd.com/wp/?p=54</guid> <description><![CDATA[I've been tasked with speeding up a web 2.0 application based on ExtJS 2.2.0 that contains several routines that take up quite a bit of time and, because IE6's javascript processing engine is less than stellar ((In other words, it sucks pretty bad.)), I needed to find a way to "speed things up".]]></description> <content:encoded><![CDATA[<p>I&#8217;ve been tasked with speeding up a web 2.0 application based on ExtJS 2.2.0 that contains several routines that take up quite a bit of time and, because <a
href="http://technologytales.com/2007/06/22/ie6-and-javascript-performance/">IE6&#8242;s javascript processing engine is less than stellar</a><sup><a
href="http://werxltd.com/wp/2009/06/10/multi-threading-in-web-20/#footnote_0_54" id="identifier_0_54" class="footnote-link footnote-identifier-link" title="In other words, it sucks pretty bad.">1</a></sup>, I needed to find a way to &#8220;speed things up&#8221;.</p><p>Enter <a
href="http://extjs.com/deploy/dev/docs/?class=Ext.TaskMgr">Ext.TaskMgr</a>, a helpful ExtJS object that is essentially a glorified <a
href="http://www.w3schools.com/htmldom/met_win_settimeout.asp">setTimeout</a> implementation that allows us to run tasks that don&#8217;t block execution. This means we can set our more expensive blocks of code to run later but return control back to the user in the meantime. It&#8217;s not true multi-threading, but it does allow us to make the user interface a lot more responsive and in an age when users think 5 seconds is an eternity, <a
href="http://msdn.microsoft.com/en-us/library/bb288452.aspx">perception is everything</a>.</p><div
class="betterrelated none"><p>No related content found.</p></div><ol
class="footnotes"><li
id="footnote_0_54" class="footnote">In other words, it sucks pretty bad.</li></ol>]]></content:encoded> <wfw:commentRss>http://werxltd.com/wp/2009/06/10/multi-threading-in-web-20/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> </channel> </rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using apc
Page Caching using apc
Database Caching 2/48 queries in 0.151 seconds using apc
Object Caching 1004/1119 objects using apc

Served from: werxltd.com @ 2012-02-05 03:24:59 -->
