<?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>Enigmatic Thought</title> <atom:link href="http://blog.enigmaticthought.com/feed/" rel="self" type="application/rss+xml" /><link>http://blog.enigmaticthought.com</link> <description>Ext.define(&#039;EnigmaticThought&#039;, {extend: &#039;Ext.Blog&#039;});</description> <lastBuildDate>Mon, 12 Mar 2012 15:29:57 +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>jqplot and ExtJS Panel</title><link>http://blog.enigmaticthought.com/2012/03/jqplot-and-extjs-panel/</link> <comments>http://blog.enigmaticthought.com/2012/03/jqplot-and-extjs-panel/#comments</comments> <pubDate>Mon, 12 Mar 2012 15:29:57 +0000</pubDate> <dc:creator>Matt C</dc:creator> <category><![CDATA[ExtJS]]></category> <category><![CDATA[programming]]></category> <category><![CDATA[Sencha]]></category> <category><![CDATA[ExtJS 4.0]]></category> <category><![CDATA[jqPlot]]></category> <category><![CDATA[JQuery]]></category> <guid
isPermaLink="false">http://blog.enigmaticthought.com/?p=298</guid> <description><![CDATA[So you&#8217;ve got a nice Ext JS application but you want a little more from your charts. Even better, you&#8217;ve found a nice plugin for JQuery called jqPlot that creates all kinds of nice charts. So, how do you make jqPlot work nicely within the ExtJS framework? First, include the jqPlot &#038; jQuery files in [...]]]></description> <content:encoded><![CDATA[<p>So you&#8217;ve got a nice Ext JS application but you want a little more from your charts.  Even better, you&#8217;ve found a nice plugin for JQuery called <a
href="http://www.jqplot.com/">jqPlot</a> that creates all kinds of nice charts.  So, how do you make jqPlot work nicely within the ExtJS framework?</p><p>First, include the jqPlot &#038; jQuery files in your index.html file in the head section:</p><div
class="wp_codebox_msgheader"><span
class="right"><sup><a
href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span
style="color: #99cc00">?</span></a></sup></span><span
class="left"><a
href="javascript:;" onclick="javascript:showCodeTxt('p298code6'); return false;">View Code</a> HTML</span><div
class="codebox_clear"></div></div><div
class="wp_codebox"><table><tr
id="p2986"><td
class="code" id="p298code6"><pre class="html" style="font-family:monospace;">    &lt;!--[if lt IE 9]&gt;&lt;script language=&quot;javascript&quot; type=&quot;text/javascript&quot; src=&quot;jQuery/excanvas.js&quot;&gt;&lt;/script&gt;&lt;![endif]--&gt;
    &lt;script language=&quot;javascript&quot; type=&quot;text/javascript&quot; src=&quot;jQuery/jquery-1.7.1.js&quot;&gt;&lt;/script&gt;
    &lt;script language=&quot;javascript&quot; type=&quot;text/javascript&quot; src=&quot;jQuery/jquery.jqplot.min.js&quot;&gt;&lt;/script&gt;
    &lt;script language=&quot;javascript&quot; type=&quot;text/javascript&quot; src=&quot;jQuery/jqplot.dateAxisRenderer.min.js&quot;&gt;&lt;/script&gt;</pre></td></tr></table></div><p>Now, lets run though how jqPlot works.  It takes a div, and within that div it injects all it&#8217;s chart stuff.  That means more divs and whatnot, but everything is contained in the base div we pass to jqPlot.  We&#8217;re going to use the panel&#8217;s body as the containing div for the chart since there&#8217;s no other content.  We also want the chart to be drawn once, and we need to make sure ExtJS has created the div for us to use, so we&#8217;ll override the <b>afterComponentLayout</b> function like so:</p><div
class="wp_codebox_msgheader"><span
class="right"><sup><a
href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span
style="color: #99cc00">?</span></a></sup></span><span
class="left"><a
href="javascript:;" onclick="javascript:showCodeTxt('p298code7'); return false;">View Code</a> JAVASCRIPT</span><div
class="codebox_clear"></div></div><div
class="wp_codebox"><table><tr
id="p2987"><td
class="code" id="p298code7"><pre class="javascript" style="font-family:monospace;">    afterComponentLayout<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>width<span style="color: #339933;">,</span> height<span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        data <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span><span style="color: #009900;">&#91;</span><span style="color: #3366CC;">'1/2012'</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">50</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span><span style="color: #009900;">&#91;</span><span style="color: #3366CC;">'2/2012'</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">66</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span><span style="color: #009900;">&#91;</span><span style="color: #3366CC;">'3/2012'</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">75</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
        $.<span style="color: #660066;">jqplot</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">body</span>.<span style="color: #660066;">id</span><span style="color: #339933;">,</span> data<span style="color: #339933;">,</span>
            <span style="color: #009900;">&#123;</span> title<span style="color: #339933;">:</span><span style="color: #3366CC;">'Server Load'</span><span style="color: #339933;">,</span>
                axes<span style="color: #339933;">:</span><span style="color: #009900;">&#123;</span>xaxis<span style="color: #339933;">:</span><span style="color: #009900;">&#123;</span>renderer<span style="color: #339933;">:</span>$.<span style="color: #660066;">jqplot</span>.<span style="color: #660066;">DateAxisRenderer</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
                series<span style="color: #339933;">:</span><span style="color: #009900;">&#91;</span>
                    <span style="color: #009900;">&#123;</span>label<span style="color: #339933;">:</span><span style="color: #3366CC;">'Awesome Level'</span><span style="color: #009900;">&#125;</span>
                <span style="color: #009900;">&#93;</span>
            <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">callParent</span><span style="color: #009900;">&#40;</span>arguments<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span></pre></td></tr></table></div><p><b>this.body.id</b> is the class of the body div the panel is built around.  But what if you drag the panel around, or gets resized?  Your chart is drawn multiple times stacked.  We need JQuery to clear the old chart before the lastest is drawn.  So add this before your $.jqplot call:</p><div
class="wp_codebox_msgheader"><span
class="right"><sup><a
href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span
style="color: #99cc00">?</span></a></sup></span><span
class="left"><a
href="javascript:;" onclick="javascript:showCodeTxt('p298code8'); return false;">View Code</a> JAVASCRIPT</span><div
class="codebox_clear"></div></div><div
class="wp_codebox"><table><tr
id="p2988"><td
class="code" id="p298code8"><pre class="javascript" style="font-family:monospace;">        $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#'</span><span style="color: #339933;">+</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">body</span>.<span style="color: #660066;">id</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div><p>Which asks JQuery to empty the contents of the div (in this case the body).  Why the #?  JQuery uses # to look up the id.  It&#8217;s part of the <a
href="http://docs.jquery.com/DOM/Traversing/Selectors">JQuery selection syntax</a>.  Put them together and you have a nice chart.</p><p>But what if you want to use an ExtJS store?  Well, it&#8217;s a little more complicated since you have to translate your data, but it&#8217;s not hard.  Lets say we have a store that tracks our Awesome levels.  So it&#8217;s has date &#038; awesome fields.  We&#8217;ve already set it up in our <em>Ext.define</em> with <em>store: &#8216;AwesomeLevels&#8217;;</em> So let&#8217;s pull it up and reference it:</p><div
class="wp_codebox_msgheader"><span
class="right"><sup><a
href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span
style="color: #99cc00">?</span></a></sup></span><span
class="left"><a
href="javascript:;" onclick="javascript:showCodeTxt('p298code9'); return false;">View Code</a> JAVASCRIPT</span><div
class="codebox_clear"></div></div><div
class="wp_codebox"><table><tr
id="p2989"><td
class="code" id="p298code9"><pre class="javascript" style="font-family:monospace;">        <span style="color: #003366; font-weight: bold;">var</span> dataArray <span style="color: #339933;">=</span>  Ext.<span style="color: #660066;">Array</span>.<span style="color: #660066;">pluck</span><span style="color: #009900;">&#40;</span>Ext.<span style="color: #660066;">data</span>.<span style="color: #660066;">StoreManager</span>.<span style="color: #660066;">lookup</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">store</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">data</span>.<span style="color: #660066;">items</span><span style="color: #339933;">,</span><span style="color: #3366CC;">'data'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #003366; font-weight: bold;">var</span> data <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
        dataArray.<span style="color: #660066;">forEach</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>obj<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
            data<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">push</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#91;</span>obj.<span style="color: #660066;">date</span><span style="color: #339933;">,</span> obj.<span style="color: #660066;">awesome</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div><p>And thus we&#8217;ve populated our data object that we&#8217;re going to pass to jqPlot.  So the final <em>afterComponentLayout </em>function looks like this:</p><div
class="wp_codebox_msgheader"><span
class="right"><sup><a
href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span
style="color: #99cc00">?</span></a></sup></span><span
class="left"><a
href="javascript:;" onclick="javascript:showCodeTxt('p298code10'); return false;">View Code</a> JAVASCRIPT</span><div
class="codebox_clear"></div></div><div
class="wp_codebox"><table><tr
id="p29810"><td
class="code" id="p298code10"><pre class="javascript" style="font-family:monospace;">    afterComponentLayout<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>width<span style="color: #339933;">,</span> height<span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #003366; font-weight: bold;">var</span> dataArray <span style="color: #339933;">=</span>  Ext.<span style="color: #660066;">Array</span>.<span style="color: #660066;">pluck</span><span style="color: #009900;">&#40;</span>Ext.<span style="color: #660066;">data</span>.<span style="color: #660066;">StoreManager</span>.<span style="color: #660066;">lookup</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">store</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">data</span>.<span style="color: #660066;">items</span><span style="color: #339933;">,</span><span style="color: #3366CC;">'data'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #003366; font-weight: bold;">var</span> data <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
        dataArray.<span style="color: #660066;">forEach</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>obj<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
            data<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">push</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#91;</span>obj.<span style="color: #660066;">date</span><span style="color: #339933;">,</span> obj.<span style="color: #660066;">awesome</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#'</span><span style="color: #339933;">+</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">body</span>.<span style="color: #660066;">id</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        data <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span><span style="color: #009900;">&#91;</span><span style="color: #3366CC;">'1/2012'</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">50</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span><span style="color: #009900;">&#91;</span><span style="color: #3366CC;">'2/2012'</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">66</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span><span style="color: #009900;">&#91;</span><span style="color: #3366CC;">'3/2012'</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">75</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
        $.<span style="color: #660066;">jqplot</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">body</span>.<span style="color: #660066;">id</span><span style="color: #339933;">,</span> data<span style="color: #339933;">,</span>
            <span style="color: #009900;">&#123;</span> title<span style="color: #339933;">:</span><span style="color: #3366CC;">'Server Load'</span><span style="color: #339933;">,</span>
                axes<span style="color: #339933;">:</span><span style="color: #009900;">&#123;</span>xaxis<span style="color: #339933;">:</span><span style="color: #009900;">&#123;</span>renderer<span style="color: #339933;">:</span>$.<span style="color: #660066;">jqplot</span>.<span style="color: #660066;">DateAxisRenderer</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
                series<span style="color: #339933;">:</span><span style="color: #009900;">&#91;</span>
                    <span style="color: #009900;">&#123;</span>label<span style="color: #339933;">:</span><span style="color: #3366CC;">'Awesome Level'</span><span style="color: #009900;">&#125;</span>
                <span style="color: #009900;">&#93;</span>
            <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">callParent</span><span style="color: #009900;">&#40;</span>arguments<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span></pre></td></tr></table></div><p>And we have a nice Panel with a jqPlot chart.<br
/><h3 class='related_post_title'>Related Posts (generated):</h3><ul
class='related_post'><li><a
href='http://blog.enigmaticthought.com/2012/03/bringing-the-linkbutton-to-ext-js/' title='Bringing the LinkButton to Ext JS'>Bringing the LinkButton to Ext JS</a></li><li><a
href='http://blog.enigmaticthought.com/2012/03/time-to-explore-ext-js-4-0/' title='Time to explore Ext JS 4.0'>Time to explore Ext JS 4.0</a></li></ul> ]]></content:encoded> <wfw:commentRss>http://blog.enigmaticthought.com/2012/03/jqplot-and-extjs-panel/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Bringing the LinkButton to Ext JS</title><link>http://blog.enigmaticthought.com/2012/03/bringing-the-linkbutton-to-ext-js/</link> <comments>http://blog.enigmaticthought.com/2012/03/bringing-the-linkbutton-to-ext-js/#comments</comments> <pubDate>Fri, 02 Mar 2012 12:00:21 +0000</pubDate> <dc:creator>Matt C</dc:creator> <category><![CDATA[ExtJS]]></category> <category><![CDATA[programming]]></category> <category><![CDATA[Sencha]]></category> <category><![CDATA[ExtJS 4.0]]></category> <category><![CDATA[Flex]]></category> <category><![CDATA[LinkButton]]></category> <guid
isPermaLink="false">http://blog.enigmaticthought.com/?p=284</guid> <description><![CDATA[Coming from the world of Flex, I was used to LinkButtons. Buttons that looked somewhat like a simple html link, but when hovered proved to be a button. Not only that, but it allowed nice toolbars and menus to be created that didn&#8217;t have generic buttons slapped on them. While Ext JS 4.0&#8242;s Ext.Button did [...]]]></description> <content:encoded><![CDATA[<p>Coming from the world of Flex, I was used to LinkButtons.  Buttons that looked somewhat like a simple html link, but when hovered proved to be a button.  Not only that, but it allowed nice toolbars and menus to be created that didn&#8217;t have generic buttons slapped on them.  While Ext JS 4.0&#8242;s <a
href="http://docs.sencha.com/ext-js/4-0/#!/api/Ext.button.Button">Ext.Button</a> did exactly what I wanted it to, it didn&#8217;t look like I wanted.  So, here&#8217;s my new LinkButton Class:</p><div
class="wp_codebox_msgheader"><span
class="right"><sup><a
href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span
style="color: #99cc00">?</span></a></sup></span><span
class="left"><a
href="javascript:;" onclick="javascript:showCodeTxt('p284code13'); return false;">View Code</a> JAVASCRIPT</span><div
class="codebox_clear"></div></div><div
class="wp_codebox"><table><tr
id="p28413"><td
class="code" id="p284code13"><pre class="javascript" style="font-family:monospace;">Ext.<span style="color: #660066;">define</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'app.view.component.LinkButton'</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#123;</span>
    extend<span style="color: #339933;">:</span> <span style="color: #3366CC;">'Ext.Button'</span><span style="color: #339933;">,</span>
    alias<span style="color: #339933;">:</span> <span style="color: #3366CC;">'widget.linkbutton'</span><span style="color: #339933;">,</span>
    componentCls<span style="color: #339933;">:</span> <span style="color: #3366CC;">'linkButton'</span><span style="color: #339933;">,</span>
    arrowAlign<span style="color: #339933;">:</span> <span style="color: #3366CC;">'left'</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div><p>Of course, it looks really ugly since it&#8217;s still using the Button&#8217;s stylesheet.  So Let&#8217;s fix that:</p><div
class="wp_codebox_msgheader"><span
class="right"><sup><a
href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span
style="color: #99cc00">?</span></a></sup></span><span
class="left"><a
href="javascript:;" onclick="javascript:showCodeTxt('p284code14'); return false;">View Code</a> CSS</span><div
class="codebox_clear"></div></div><div
class="wp_codebox"><table><tr
id="p28414"><td
class="code" id="p284code14"><pre class="css" style="font-family:monospace;"><span style="color: #6666ff;">.linkButton</span> <span style="color: #00AA00;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">background-image</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">none</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">background-color</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">transparent</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">border-style</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">none</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #6666ff;">.linkButton</span><span style="color: #6666ff;">.over</span> <span style="color: #00AA00;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">background-color</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">white</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">background-image</span><span style="color: #00AA00;">:</span> -webkit-gradient<span style="color: #00AA00;">&#40;</span>linear<span style="color: #00AA00;">,</span> <span style="color: #933;">50%</span> <span style="color: #933;">0%</span><span style="color: #00AA00;">,</span> <span style="color: #933;">50%</span> <span style="color: #933;">100%</span><span style="color: #00AA00;">,</span> color-stop<span style="color: #00AA00;">&#40;</span><span style="color: #933;">0%</span><span style="color: #00AA00;">,</span> <span style="color: #cc00cc;">#ffffff</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">,</span> color-stop<span style="color: #00AA00;">&#40;</span><span style="color: #933;">48%</span><span style="color: #00AA00;">,</span> <span style="color: #cc00cc;">#f9f9f9</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">,</span> color-stop<span style="color: #00AA00;">&#40;</span><span style="color: #933;">52%</span><span style="color: #00AA00;">,</span> <span style="color: #cc00cc;">#e2e2e2</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">,</span> color-stop<span style="color: #00AA00;">&#40;</span><span style="color: #933;">100%</span><span style="color: #00AA00;">,</span> <span style="color: #cc00cc;">#e7e7e7</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">background-image</span><span style="color: #00AA00;">:</span> -webkit-linear-gradient<span style="color: #00AA00;">&#40;</span><span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">,</span> <span style="color: #cc00cc;">#ffffff</span><span style="color: #00AA00;">,</span> <span style="color: #cc00cc;">#f9f9f9</span> <span style="color: #933;">48%</span><span style="color: #00AA00;">,</span> <span style="color: #cc00cc;">#e2e2e2</span> <span style="color: #933;">52%</span><span style="color: #00AA00;">,</span> <span style="color: #cc00cc;">#e7e7e7</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">background-image</span><span style="color: #00AA00;">:</span> -moz-linear-gradient<span style="color: #00AA00;">&#40;</span><span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">,</span> <span style="color: #cc00cc;">#ffffff</span><span style="color: #00AA00;">,</span> <span style="color: #cc00cc;">#f9f9f9</span> <span style="color: #933;">48%</span><span style="color: #00AA00;">,</span> <span style="color: #cc00cc;">#e2e2e2</span> <span style="color: #933;">52%</span><span style="color: #00AA00;">,</span> <span style="color: #cc00cc;">#e7e7e7</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">background-image</span><span style="color: #00AA00;">:</span> -o-linear-gradient<span style="color: #00AA00;">&#40;</span><span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">,</span> <span style="color: #cc00cc;">#ffffff</span><span style="color: #00AA00;">,</span> <span style="color: #cc00cc;">#f9f9f9</span> <span style="color: #933;">48%</span><span style="color: #00AA00;">,</span> <span style="color: #cc00cc;">#e2e2e2</span> <span style="color: #933;">52%</span><span style="color: #00AA00;">,</span> <span style="color: #cc00cc;">#e7e7e7</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">background-image</span><span style="color: #00AA00;">:</span> -ms-linear-gradient<span style="color: #00AA00;">&#40;</span><span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">,</span> <span style="color: #cc00cc;">#ffffff</span><span style="color: #00AA00;">,</span> <span style="color: #cc00cc;">#f9f9f9</span> <span style="color: #933;">48%</span><span style="color: #00AA00;">,</span> <span style="color: #cc00cc;">#e2e2e2</span> <span style="color: #933;">52%</span><span style="color: #00AA00;">,</span> <span style="color: #cc00cc;">#e7e7e7</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">background-image</span><span style="color: #00AA00;">:</span> linear-gradient<span style="color: #00AA00;">&#40;</span><span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">,</span> <span style="color: #cc00cc;">#ffffff</span><span style="color: #00AA00;">,</span> <span style="color: #cc00cc;">#f9f9f9</span> <span style="color: #933;">48%</span><span style="color: #00AA00;">,</span> <span style="color: #cc00cc;">#e2e2e2</span> <span style="color: #933;">52%</span><span style="color: #00AA00;">,</span> <span style="color: #cc00cc;">#e7e7e7</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">border-style</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">solid</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span> <span style="color: #933;">0px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></td></tr></table></div><p>And now the hover action makes a pretty button, giving us the LinkButton!<br
/><h3 class='related_post_title'>Related Posts (generated):</h3><ul
class='related_post'><li><a
href='http://blog.enigmaticthought.com/2012/03/time-to-explore-ext-js-4-0/' title='Time to explore Ext JS 4.0'>Time to explore Ext JS 4.0</a></li><li><a
href='http://blog.enigmaticthought.com/2010/06/flash-debug-crashing-in-firefox/' title='Flash Debug crashing in Firefox?'>Flash Debug crashing in Firefox?</a></li><li><a
href='http://blog.enigmaticthought.com/2010/03/clever-code/' title='Clever Code is dangerous'>Clever Code is dangerous</a></li><li><a
href='http://blog.enigmaticthought.com/2009/12/bugquash-badges-fixed/' title='Bugquash badges fixed'>Bugquash badges fixed</a></li><li><a
href='http://blog.enigmaticthought.com/2009/12/big-o-notation/' title='Big O Notation'>Big O Notation</a></li></ul> ]]></content:encoded> <wfw:commentRss>http://blog.enigmaticthought.com/2012/03/bringing-the-linkbutton-to-ext-js/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Time to explore Ext JS 4.0</title><link>http://blog.enigmaticthought.com/2012/03/time-to-explore-ext-js-4-0/</link> <comments>http://blog.enigmaticthought.com/2012/03/time-to-explore-ext-js-4-0/#comments</comments> <pubDate>Thu, 01 Mar 2012 23:06:26 +0000</pubDate> <dc:creator>Matt C</dc:creator> <category><![CDATA[ExtJS]]></category> <category><![CDATA[programming]]></category> <category><![CDATA[Sencha]]></category> <category><![CDATA[ExtJS 4.0]]></category> <guid
isPermaLink="false">http://blog.enigmaticthought.com/?p=280</guid> <description><![CDATA[I&#8217;ve started learning Ext JS 4.0, and it feels like it&#8217;s in a place similar to early Flex. Lots of self-taught stuff, no nice tutorials, and an lots of confusing Google Search results. Part of that is the transition from Ext JS 3.0 to 4.0 is non-trivial. 4.0 is much more Object Oriented and built [...]]]></description> <content:encoded><![CDATA[<p>I&#8217;ve started learning <a
href="http://www.sencha.com/products/extjs/">Ext JS 4.0</a>, and it feels like it&#8217;s in a place similar to early Flex.  Lots of self-taught stuff, no nice tutorials, and an lots of confusing Google Search results.  Part of that is the transition from Ext JS 3.0 to 4.0 is non-trivial.  4.0 is much more Object Oriented and built around a MVC approach.  That means the majority of current ExtJS examples aren&#8217;t going to help, since they rely on an out of data library.</p><p>So, time to warm the blog back up and start tracking the learning process.<br
/><h3 class='related_post_title'>Related Posts (generated):</h3><ul
class='related_post'><li><a
href='http://blog.enigmaticthought.com/2012/03/bringing-the-linkbutton-to-ext-js/' title='Bringing the LinkButton to Ext JS'>Bringing the LinkButton to Ext JS</a></li></ul> ]]></content:encoded> <wfw:commentRss>http://blog.enigmaticthought.com/2012/03/time-to-explore-ext-js-4-0/feed/</wfw:commentRss> <slash:comments>2</slash:comments> </item> <item><title>Flash Debug crashing in Firefox?</title><link>http://blog.enigmaticthought.com/2010/06/flash-debug-crashing-in-firefox/</link> <comments>http://blog.enigmaticthought.com/2010/06/flash-debug-crashing-in-firefox/#comments</comments> <pubDate>Fri, 25 Jun 2010 19:52:53 +0000</pubDate> <dc:creator>Matt C</dc:creator> <category><![CDATA[Flex]]></category> <category><![CDATA[programming]]></category> <category><![CDATA[Builder]]></category> <category><![CDATA[eclipse]]></category> <category><![CDATA[firefox]]></category> <guid
isPermaLink="false">http://enigmaticthought.com/?p=274</guid> <description><![CDATA[If you&#8217;ve just updated to Firefox 3.6.4 and use the Flash debug player, you may have noticed a problem. While you&#8217;re debugging, Firefox is killing you&#8217;re flash player session. Here&#8217;s the quick fix: type about:config in the firefox address bar search for dom.ipc.plugins.timeoutSecs double click and change the value to -1 This will disable the [...]]]></description> <content:encoded><![CDATA[<p>If you&#8217;ve just updated to Firefox 3.6.4 and use the Flash debug player, you may have noticed a problem.  While you&#8217;re debugging, Firefox is killing you&#8217;re flash player session.  Here&#8217;s the quick fix:</p><ol><li>type about:config in the firefox address bar</li><li>search for dom.ipc.plugins.timeoutSecs</li><li>double click and change the value to -1</li></ol><p>This will disable the hang detector that was added.  It&#8217;s the same reason I don&#8217;t do any debugging in Chrome (alongside the lack of HttpFox).  Sometimes a break point needs more than 10-15 seconds for me to figure out what&#8217;s going on. <a
href="http://benjamin.smedbergs.us/blog/2010-06-09/the-firefox-plugin-hang-detector/">Check out more details here</a><br
/><h3 class='related_post_title'>Related Posts (generated):</h3><ul
class='related_post'><li><a
href='http://enigmaticthought.com/2009/09/flash-builders-new-menu/' title='Altering Flash Builder&#8217;s new menu'>Altering Flash Builder&#8217;s new menu</a></li><li><a
href='http://enigmaticthought.com/2009/02/firefox-and-flex/' title='Firefox and flex'>Firefox and flex</a></li><li><a
href='http://enigmaticthought.com/2009/02/flex-in-eclipse-tips/' title='Flex in Eclipse tips'>Flex in Eclipse tips</a></li><li><a
href='http://enigmaticthought.com/2010/03/clever-code/' title='Clever Code is dangerous'>Clever Code is dangerous</a></li><li><a
href='http://enigmaticthought.com/2009/12/bugquash-badges-fixed/' title='Bugquash badges fixed'>Bugquash badges fixed</a></li></ul> ]]></content:encoded> <wfw:commentRss>http://blog.enigmaticthought.com/2010/06/flash-debug-crashing-in-firefox/feed/</wfw:commentRss> <slash:comments>6</slash:comments> </item> <item><title>Clever Code is dangerous</title><link>http://blog.enigmaticthought.com/2010/03/clever-code/</link> <comments>http://blog.enigmaticthought.com/2010/03/clever-code/#comments</comments> <pubDate>Thu, 04 Mar 2010 18:48:47 +0000</pubDate> <dc:creator>Matt C</dc:creator> <category><![CDATA[Flex]]></category> <category><![CDATA[algorithms]]></category> <category><![CDATA[game programming]]></category> <category><![CDATA[programming]]></category> <guid
isPermaLink="false">http://enigmaticthought.com/?p=264</guid> <description><![CDATA[When we last left you, we talked about Big O Notation and how we can use that to compare two algorithms. That was all theoretical though, dealing with infinite sets of data. In the real world, you&#8217;ll find that sometimes a &#8220;bad&#8221; algorithm is really the best for your application. Lets track down an example [...]]]></description> <content:encoded><![CDATA[<p>When we last left you, we talked about <a
href="http://enigmaticthought.com/2009/12/big-o-notation/">Big O Notation</a> and how we can use that to compare two algorithms.  That was all theoretical though, dealing with infinite sets of data.  In the real world, you&#8217;ll find that sometimes a &#8220;bad&#8221; algorithm is really the best for your application.</p><p>Lets track down an example from the world of video games.  You&#8217;ve got a ship that flying around trying to dodge asteroids, and the ship could fire bullets to blow the asteroids up.  Let&#8217;s lay out some ground rules as well.  We don&#8217;t worry about the asteroids hitting each other, and bullets can&#8217;t hit each other or your own ship.  There&#8217;s two separate problems here, and we&#8217;ll divide the collision system between them.  In the first, we have a single ship and a one or more asteroids (when there are no asteroids, the level is over).  In the second, there are zero or more bullets (maybe there&#8217;s a limit, but I&#8217;ll assume the <a
href="http://catb.org/jargon/html/Z/Zero-One-Infinity-Rule.html">Zero-One-Infinity Rule</a>) and one or more asteroids.</p><p>On the surface these seem identical, there is a target set, and a set to hit the targets.  So let&#8217;s solve the complicated one first (bullets &#038; asteroids).  There&#8217;s a many to many relationship, so during the first pass we could compare each bullet to each asteroid and see if we register a hit.  Since we&#8217;re looping twice, the Big O notation would be O(b*a) with b = # of bullets, and 1 = # of asteroids.  We can do better than that though, thanks to some clever thinking.  Let&#8217;s sort our lists of asteroids and bullets in the order of the y (vertical) coordinate.  We know we can sort using lots of O(n log n) algorithms (<a
href="http://en.wikipedia.org/wiki/Quicksort">quicksort</a>, <a
href="http://en.wikipedia.org/wiki/Merge_sort">mergesort</a>, and whatnot) and then we can use the concept of merging to work our way down the 2 sorted lists looking for matching x coordinates.  Here&#8217;s some pseudocode:</p><div
class="wp_codebox_msgheader"><span
class="right"><sup><a
href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span
style="color: #99cc00">?</span></a></sup></span><span
class="left"><a
href="javascript:;" onclick="javascript:showCodeTxt('p264code16'); return false;">View Code</a> ACTIONSCRIPT3</span><div
class="codebox_clear"></div></div><div
class="wp_codebox"><table><tr
id="p26416"><td
class="code" id="p264code16"><pre class="actionscript3" style="font-family:monospace;">asteroidList<span style="color: #000066; font-weight: bold;">.</span>sortY<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
bulletsList<span style="color: #000066; font-weight: bold;">.</span>sortY<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
asteroid = <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">;</span>
<span style="color: #004993;">bullet</span> = <span style="color: #000000; font-weight:bold;">0</span>
<span style="color: #0033ff; font-weight: bold;">while</span> <span style="color: #000000;">&#40;</span>bulletList<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">length</span> <span style="color: #000066; font-weight: bold;">&lt;</span> <span style="color: #004993;">bullet</span> <span style="color: #000066; font-weight: bold;">&amp;&amp;</span> asteroidList<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">length</span> <span style="color: #000066; font-weight: bold;">&lt;</span> asteroid<span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
	<span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>bulletList<span style="color: #000000;">&#91;</span><span style="color: #004993;">bullet</span><span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">y</span> <span style="color: #000066; font-weight: bold;">&lt;</span> asteroidList<span style="color: #000000;">&#91;</span>asteroid<span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">y</span><span style="color: #000000;">&#41;</span>
	<span style="color: #000000;">&#123;</span>
		<span style="color: #004993;">bullet</span><span style="color: #000066; font-weight: bold;">++;</span>
	<span style="color: #000000;">&#125;</span>
	<span style="color: #0033ff; font-weight: bold;">else</span> <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>bulletList<span style="color: #000000;">&#91;</span><span style="color: #004993;">bullet</span><span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">y</span> <span style="color: #000066; font-weight: bold;">&gt;</span> asteroidList<span style="color: #000000;">&#91;</span>asteroid<span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">y</span><span style="color: #000000;">&#41;</span>
	<span style="color: #000000;">&#123;</span>
		asteroid<span style="color: #000066; font-weight: bold;">++;</span>
	<span style="color: #000000;">&#125;</span>
	<span style="color: #0033ff; font-weight: bold;">else</span> <span style="color: #009900; font-style: italic;">// y is ==</span>
	<span style="color: #000000;">&#123;</span>
		<span style="color: #009900; font-style: italic;">//check for collision and do work to handle multiple objects on same y point</span>
	<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></td></tr></table></div><p>Of course you&#8217;d have to build a way to handle multiple object on the same plane, but it&#8217;d work out to about O(a+b) assuming everything is evenly distributed on the y axis. Combined with the initial sorting, your Big O notation would be O(n log n) (either n=a or n=b depending on which is larger) because O(n log n) is &#8220;larger&#8221; than O(a+b), which would simplify to O(n).</p><p>So we&#8217;ve figured out the collision detection right? What about the ship and asteroids?  Since we know one value, O(s*a) is really O(1*a)=O(a) and our &#8220;clever&#8221; solution is actually slower than the original! In fact, depending on the number of bullets, we may have slowed the simple O(b*a) solution down as well.</p><p>So you&#8217;re not programming a game, so why should you care?  Throw out asteroids, ships, and bullets and look at two sets of data you&#8217;re trying to merge.  A small list of data may just need a brute force solution rather than spending time figuring out a &#8220;really nifty algorithm&#8221; which may be horribly inefficient with the amount of data your working on.  Maybe you should just have everything pre-sorted so you don&#8217;t take the O(n log n) penalty, then O(a+b) can be no worse than O(a*n).  Regardless, don&#8217;t just look at the algorithm ans what it does, but look at the data that will be pushed around when you have to decide how to accomplish a task.<br
/><h3 class='related_post_title'>Related Posts (generated):</h3><ul
class='related_post'><li><a
href='http://enigmaticthought.com/2009/12/big-o-notation/' title='Big O Notation'>Big O Notation</a></li><li><a
href='http://enigmaticthought.com/2009/12/why-algorithms-matter/' title='Why Algorithms Matter'>Why Algorithms Matter</a></li><li><a
href='http://enigmaticthought.com/2010/06/flash-debug-crashing-in-firefox/' title='Flash Debug crashing in Firefox?'>Flash Debug crashing in Firefox?</a></li><li><a
href='http://enigmaticthought.com/2009/12/bugquash-badges-fixed/' title='Bugquash badges fixed'>Bugquash badges fixed</a></li><li><a
href='http://enigmaticthought.com/2009/11/scientific-notation-patch-accepted/' title='Scientific Notation Patch Accepted'>Scientific Notation Patch Accepted</a></li></ul> ]]></content:encoded> <wfw:commentRss>http://blog.enigmaticthought.com/2010/03/clever-code/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> </channel> </rss>
<!-- Dynamic page generated in 4.713 seconds. -->
<!-- Cached page generated by WP-Super-Cache on 2012-04-05 12:32:30 -->
<!-- Compression = gzip -->
