<?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>Fusioncube &#187; javascript</title>
	<atom:link href="http://www.fusioncube.net/index.php/category/javascript/feed" rel="self" type="application/rss+xml" />
	<link>http://www.fusioncube.net</link>
	<description>The online journey of a technophile, by Steve Brownlee</description>
	<lastBuildDate>Wed, 01 Feb 2012 04:17:42 +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>All that time wasted learning the .NET framework</title>
		<link>http://www.fusioncube.net/index.php/all-that-time-wasted-learning-the-net-framework</link>
		<comments>http://www.fusioncube.net/index.php/all-that-time-wasted-learning-the-net-framework#comments</comments>
		<pubDate>Sun, 29 Jan 2012 05:45:03 +0000</pubDate>
		<dc:creator>Steve Brownlee</dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[F#]]></category>
		<category><![CDATA[metro]]></category>
		<category><![CDATA[windows]]></category>
		<category><![CDATA[windows 8]]></category>

		<guid isPermaLink="false">http://www.fusioncube.net/?p=1469</guid>
		<description><![CDATA[It hit me tonight that all that time I spent learning the .NET framework starting way back in 2002 was mostly wasted. As much as I love the C# language and have come to appreciate F# (can&#8217;t say the same for WPF &#038; WCF), it just hit me tonight that with Windows 8 and the [...]]]></description>
			<content:encoded><![CDATA[<p>It hit me tonight that all that time I spent learning the .NET framework starting way back in 2002 was mostly wasted. As much as I love the C# language and have come to appreciate F# (can&#8217;t say the same for WPF &#038; WCF), it just hit me tonight that with Windows 8 and the Metro style of applications &#8211; in addition to Node.js being ported to Windows &#8211; that all I&#8217;ll need to know is two languages.  On Windows 8, to build user applications, I&#8217;ll only need to know C++ and JavaScript.</p>
<p>That&#8217;s weird.</p>
<p>Recent reading:<br />
<a href="http://lifehacker.com/5842200/windows-8s-metro-ui-isnt-very-good-without-touch-but-it-doesnt-really-matter" title="Windows 8’s Metro UI Isn’t Very Good Without Touch, But That Doesn’t Really Matter" target="_blank">Windows 8’s Metro UI Isn’t Very Good Without Touch, But That Doesn’t Really Matter</a></p>
<p><a href="http://www.infoworld.com/t/microsoft-windows/windows-8-metro-now-mouse-support-185165" title="Windows 8 Metro: Now with mouse support" target="_blank">Windows 8 Metro: Now with mouse support</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.fusioncube.net/index.php/all-that-time-wasted-learning-the-net-framework/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Adobe acquires Nitobi: Look out Appcelerator</title>
		<link>http://www.fusioncube.net/index.php/adobe-acquires-nitobi-look-out-appcelerator</link>
		<comments>http://www.fusioncube.net/index.php/adobe-acquires-nitobi-look-out-appcelerator#comments</comments>
		<pubDate>Tue, 04 Oct 2011 18:39:03 +0000</pubDate>
		<dc:creator>Steve Brownlee</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[Titanium]]></category>
		<category><![CDATA[adobe]]></category>
		<category><![CDATA[air]]></category>
		<category><![CDATA[appcelerator]]></category>
		<category><![CDATA[application development]]></category>
		<category><![CDATA[desktop]]></category>
		<category><![CDATA[edge]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[nitobi]]></category>
		<category><![CDATA[titanium]]></category>

		<guid isPermaLink="false">http://www.fusioncube.net/?p=1429</guid>
		<description><![CDATA[I watched part of the Adobe MAX presentation yesterday in which Adobe said that they are acquiring Nitobi, the company behind PhoneGap. PhoneGap is essentially a competitor to Titanium. Not a complete competitor, but read on. This development is likely the harbinger of changing the game entirely. Here’s why. Further reading: Ars Technica &#124; Adobe [...]]]></description>
			<content:encoded><![CDATA[<p>I watched part of the Adobe MAX presentation yesterday in which Adobe said that they are acquiring Nitobi, the company behind PhoneGap. PhoneGap is essentially a competitor to Titanium. Not a complete competitor, but read on. This development is likely the harbinger of changing the game entirely. Here’s why.</p>
<p>Further reading: <a href="http://arstechnica.com/open-source/news/2011/10/phonegap-to-become-an-apache-project-as-adobe-acquires-nitobi.ars?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=rss" target="_blank">Ars Technica | Adobe Acquires Nitobi</a></p>
<h2>Flash is back to being just Flash</h2>
<p>Adobe Flash lost as a web application development standard, and Adobe knows it.  They are spending tons of cash right now in a game of catch-up and expect to be the leader in web development again (they were just a short 5 years ago).  After their initial, bitter battle with Apple and running Flash apps on iOS, they turned things around and you can now use Adobe tools to deploy apps on iOS. They already released a beta of a complete IDE for building HTML5/JavaScript5/CSS3 applications. It’s called <a href="http://labs.adobe.com/technologies/edge" target="_blank">Adobe Edge</a>.</p>
<h2>Adobe PhoneGap</h2>
<p>With the power and capabilities of Edge growing with every release (because their customers are demanding it) it is most likely that PhoneGap will be tightly integrated as the de facto framework for building applications in the tool.  Much like when Appcelerator purchased the Aptana IDE and converted it into Titanium Studio which allows us to code, build and deploy applications from one tool, Adobe Edge will be a complete IDE for HTML/JS/CSS application development.</p>
<p>Further reading: <a href="http://news.cnet.com/8301-30685_3-20114616-264/adobe-sharpens-edge-for-advanced-html/?tag=mncol;posts" target="_blank">CNET | Adobe Sharpens Edge</a></p>
<h2>Desktop</h2>
<p>Now, if you are building desktop apps, PhoneGap is not an option because it is exclusively mobile.  It&#8217;s the main reason that Titanium Desktop became so successful. Unfortunately, Titanium Desktop seems to be an abandoned, or at least orphaned, child in the Appcelerator roadmap. The few Appcelerator employees that I talked to at the conference two weeks ago did not have any answers as to how their desktop product fit into their future plans. They are currently focused 100% on their mobile application development tools. This is most likely because Appcelerator is resource strapped and simply giving all of its focus to what customers are demanding RIGHT NOW.</p>
<p>Adobe has no such limitations. Their AIR Runtime already allows developers to build HTML/JavaScript applications that can run on any desktop OS. Unfortunately, it could not run on every mobile OS, so it will most likely be abandoned and replaced with the eventual PhoneGap successor for mobile apps. I don’t see Adobe abandoning the desktop because they already have a dedicated presence there, and with the (finally) released information about the <a href="http://www.readwriteweb.com/hack/2011/09/build-2011-what-is-winrt-and-i.php" target="_blank">Microsoft Windows WinRT API</a> in which you can author complete applications with JavaScript, it plays right into the hands of Adobe.</p>
<p>It’s highly probable that Adobe Edge has AIR integration for desktop applications before the official 1.0 release.</p>
<h2>One Source</h2>
<p>So what this gives us is more than one option for every environment.  The source code for the GUI would continue to be in one language, but then could be built, or interpreted, to any platform.  It will be interesting to see what Adobe does with the PhoneGap platform in the next year.</p>
<p>JavaScript</p>
<ol>
<li>WinRT for Windows applications</li>
<li>Adobe AIR for Windows/OSX/Linux applications</li>
<li>PhoneGap for mobile web apps with native capabilities</li>
<li>Titanium for desktop and true, native mobile apps (and now web apps)</li>
</ol>
<p>I find it interesting when I talk to developers who are focused on Java and .NET platforms about how JavaScript will soon replace a huge chunk of what they currently have to do when making applications with a user interface. I would think it would be a source of jubilation – no more worrying about cross-platform UI issues in compiled code – but I find there’s still a lot of resistance and denial even though the facts are all right in front of us.</p>
<p>This next generation of application development is going to be fun, not only because we can reduce the amount of code we need to write, but also because the entire industry is moving away from the immobile desktop and towards the mobile device platform.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.fusioncube.net/index.php/adobe-acquires-nitobi-look-out-appcelerator/feed</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Appcelerator Titanium Desktop: Dragging a chromeless window</title>
		<link>http://www.fusioncube.net/index.php/appcelerator-titanium-desktop-dragging-a-chromeless-window</link>
		<comments>http://www.fusioncube.net/index.php/appcelerator-titanium-desktop-dragging-a-chromeless-window#comments</comments>
		<pubDate>Thu, 29 Sep 2011 18:54:21 +0000</pubDate>
		<dc:creator>Steve Brownlee</dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[Titanium]]></category>
		<category><![CDATA[appcelerator]]></category>
		<category><![CDATA[background]]></category>
		<category><![CDATA[chrome-less]]></category>
		<category><![CDATA[drag]]></category>
		<category><![CDATA[titanium]]></category>
		<category><![CDATA[transparent]]></category>
		<category><![CDATA[window]]></category>

		<guid isPermaLink="false">http://www.fusioncube.net/?p=1408</guid>
		<description><![CDATA[This is somewhat obscure as most people using Titanium are using it for mobile apps, but I&#8217;ve seen just enough questions out there about this, that I thought I&#8217;d share the code that we came up with to allow users to drag a Titanium Desktop window when the background has been set to transparent and [...]]]></description>
			<content:encoded><![CDATA[<p>This is somewhat obscure as most people using Titanium are using it for mobile apps, but I&#8217;ve seen just enough questions out there about this, that I thought I&#8217;d share the code that we came up with to allow users to drag a Titanium Desktop window when the background has been set to transparent and is chromeless.</p>
<p>This is a modification to the code found at a blog called <a href="http://code.bytespider.eu/post/2815707522/appcelerator-titanium-bullet-proof-window-drag" target="_blank">Code Bytes</a>. Unfortunately, I can&#8217;t credit the developer by name because nowhere on the blog does he/she actually provide a name or bio.</p>
<p>This was developed for version 1.1 of the Titanium framework. If you are using a later version, this may have been fixed.</p>
<pre class="brush: jscript; title: ; notranslate">
/*
 * This code augments the Titanium framework code by detecting any element that has the
 * 'isDraggable' class assigned to it.  If that element is dragged, the entire window
 * is dragged correspondingly.  Also, only works on left-mouse click.
 */
var isDraggableWindow = function() {
    this.addEventListener('mousedown', function (e){
        function drag(e) {
            var currentWindow = Titanium.UI.currentWindow;
            var currentPosition = {x:currentWindow.getX(), y:currentWindow.getY()};

            currentPosition.x += e.clientX - mousePosition.x;
            currentPosition.y += e.clientY - mousePosition.y;

            currentWindow.moveTo(currentPosition.x, currentPosition.y);
        };

        if (e.button === 0 &amp;&amp; ~e.target.className.indexOf('isDraggable')) {
            var mousePosition = {x:event.clientX, y:event.clientY};

            document.addEventListener('mousemove', drag, false);
            document.addEventListener('mouseup', function (e){
                document.removeEventListener('mousemove', drag, false);
                document.removeEventListener('mouseup', arguments.callee, false);
            }, false);

        }
    }, false);
};

// Then in your main module/application, you simply pass the ID of the top-level element
isDraggableWindow.call(document.getElementById('topLevelHTMLElementInApp'));
</pre>
<p>We added the following restrictions to the original code.</p>
<ol>
<li>Only works on left-mouse click.</li>
<li>Only elements that have been assigned the &#8216;isDraggable&#8217; CSS class will trigger window drag. This class doesn&#8217;t actually have to exist &#8211; it just needs to be added to the HTMLElement. Without this restriction, clicking on ANYTHING in the app and dragging will move the window.</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://www.fusioncube.net/index.php/appcelerator-titanium-desktop-dragging-a-chromeless-window/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Pittsburgh JavaScript Developers &#8211; Three New Events Scheduled</title>
		<link>http://www.fusioncube.net/index.php/pittsburgh-javascript-developers-three-new-events-scheduled</link>
		<comments>http://www.fusioncube.net/index.php/pittsburgh-javascript-developers-three-new-events-scheduled#comments</comments>
		<pubDate>Wed, 28 Sep 2011 18:09:44 +0000</pubDate>
		<dc:creator>Steve Brownlee</dc:creator>
				<category><![CDATA[community]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[adobe]]></category>
		<category><![CDATA[air]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[appcelerator]]></category>
		<category><![CDATA[blackberry]]></category>
		<category><![CDATA[ios]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[osx]]></category>
		<category><![CDATA[pittsburgh javascript developers]]></category>
		<category><![CDATA[titanium]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://www.fusioncube.net/?p=1403</guid>
		<description><![CDATA[In the next month, Pittsburgh JavaScript Developers will be hosting three new events covering some of the hottest topics in JavaScript development.]]></description>
			<content:encoded><![CDATA[<p>On October 5th, Brian Cavalier will be presenting his work on Asynchronous Module Definition API and CommonJS modules. It will be a very interesting presentation and should generate some great conversation.</p>
<p>Event Link: <a href="http://www.meetup.com/Pittsburgh-JavaScript-Developers/events/34568402/" target="_blank">AMD and CommonJS modules</a></p>
<p>On October 11th, we&#8217;ll be covering Appcelerator&#8217;s Titanium framework which is an open-source framework that allows you write an application in JavaScript and then build native apps for iOS and Android (and Blackberry soon). You can also deploy the application to the desktop &#8211; whether it be Windows, OSX or Linux. One source code library to deploy to 6 platforms!</p>
<p>Event Link: <a href="http://www.meetup.com/Pittsburgh-JavaScript-Developers/events/35147862/" target="_blank">Appcelerator Titanium Framework</a></p>
<p>On October 25th, we&#8217;ll be discussing how to build a JavaScript application and deploy it in the Adobe AIR runtime. With Adobe AIR, JavaScript developers can use their existing skills and code to build responsive, highly engaging applications that combine the power of local resources and data with the reach of the web.</p>
<p>Event Link: <a href="http://www.meetup.com/Pittsburgh-JavaScript-Developers/events/35163112/" target="_blank">JavaScript and the Adobe AIR runtime</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.fusioncube.net/index.php/pittsburgh-javascript-developers-three-new-events-scheduled/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Sencha ExtJS 4: Make any component fire a click event</title>
		<link>http://www.fusioncube.net/index.php/sencha-extjs-4-make-any-component-fire-a-click-event</link>
		<comments>http://www.fusioncube.net/index.php/sencha-extjs-4-make-any-component-fire-a-click-event#comments</comments>
		<pubDate>Thu, 08 Sep 2011 16:15:53 +0000</pubDate>
		<dc:creator>Steve Brownlee</dc:creator>
				<category><![CDATA[ExtJS]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[click]]></category>
		<category><![CDATA[clickable]]></category>
		<category><![CDATA[component]]></category>
		<category><![CDATA[event]]></category>
		<category><![CDATA[label]]></category>
		<category><![CDATA[render]]></category>
		<category><![CDATA[Sencha]]></category>

		<guid isPermaLink="false">http://www.fusioncube.net/?p=1396</guid>
		<description><![CDATA[For some reason, Sencha decided to NOT make every single component in their architecture raise a click event. I don&#8217;t comprehend this, but I&#8217;m sure they had good reasons &#8211; possibly performance, possibly scalability. Whatever the reason, if you want to make anything clickable, it&#8217;s very simple. Simply add the following listener. Poof. Now you [...]]]></description>
			<content:encoded><![CDATA[<p>For some reason, Sencha decided to NOT make every single component in their architecture raise a click event. I don&#8217;t comprehend this, but I&#8217;m sure they had good reasons &#8211; possibly performance, possibly scalability.</p>
<p>Whatever the reason, if you want to make anything clickable, it&#8217;s very simple. Simply add the following listener.</p>
<pre class="brush: jscript; title: ; notranslate">
id    : 'myLabel',
xtype : 'label',
html  : '&lt;div class=&quot;myHelpLabel&quot;&gt;&lt;/div&gt;',
listeners : {
    render : function(c) {
        c.getEl().on('click', function(){ this.fireEvent('click'); }, c);
    }
}
</pre>
<p>Poof.  Now you can detect when that element is clicked in your controller (if you&#8217;re using the Sencha MVC architecture).</p>
<pre class="brush: jscript; title: ; notranslate">
init: function(){
    this.control({
        'sampleView #myHelpLabel' : {
            click : function(c) {
                // Do something brilliant
            }
        },
        ...
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.fusioncube.net/index.php/sencha-extjs-4-make-any-component-fire-a-click-event/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Pittsburgh JavaScript Developers: When jQuery Attacks!</title>
		<link>http://www.fusioncube.net/index.php/pittsburgh-javascript-developers-when-jquery-attacks</link>
		<comments>http://www.fusioncube.net/index.php/pittsburgh-javascript-developers-when-jquery-attacks#comments</comments>
		<pubDate>Wed, 31 Aug 2011 18:03:00 +0000</pubDate>
		<dc:creator>Steve Brownlee</dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[developers]]></category>
		<category><![CDATA[meetup]]></category>
		<category><![CDATA[pittsburgh]]></category>

		<guid isPermaLink="false">http://www.fusioncube.net/?p=1385</guid>
		<description><![CDATA[By popular demand, the next meeting for Pittsburgh JavaScript Developers will be about jQuery. When jQuery Attacks!]]></description>
			<content:encoded><![CDATA[<p>By popular demand, the next meeting for Pittsburgh JavaScript Developers will be about jQuery.</p>
<p><a href="http://www.meetup.com/Pittsburgh-JavaScript-Developers/events/31718282/" target="_blank">When jQuery Attacks!</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.fusioncube.net/index.php/pittsburgh-javascript-developers-when-jquery-attacks/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Node.js &#8211; Realtime Beer Drinking Competition In Under 40 Lines Of Code</title>
		<link>http://www.fusioncube.net/index.php/realtime-beer-drinking</link>
		<comments>http://www.fusioncube.net/index.php/realtime-beer-drinking#comments</comments>
		<pubDate>Wed, 31 Aug 2011 15:27:01 +0000</pubDate>
		<dc:creator>Steve Brownlee</dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[node.js]]></category>
		<category><![CDATA[beer]]></category>
		<category><![CDATA[communication]]></category>
		<category><![CDATA[drinking]]></category>
		<category><![CDATA[magic]]></category>
		<category><![CDATA[now.js]]></category>
		<category><![CDATA[real-time]]></category>

		<guid isPermaLink="false">http://www.fusioncube.net/?p=1371</guid>
		<description><![CDATA[I can&#8217;t wait until the Windows port of Node.js is stable. I put together this great, simple application to show off at one of my Pittsburgh JavaScript Developers meetings, but it requires anyone who brought a laptop to connect to the building&#8217;s guest wireless network. Well, when I hooked up my laptop and fired up [...]]]></description>
			<content:encoded><![CDATA[<p>I can&#8217;t wait until the Windows port of Node.js is stable. I put together this great, simple application to show off at one of my Pittsburgh JavaScript Developers meetings, but it requires anyone who brought a laptop to connect to the building&#8217;s guest wireless network.</p>
<p>Well, when I hooked up my laptop and fired up my VMWare instance of Ubuntu, it failed to get an IP address from the DHCP server, so all my &#8220;hard&#8221; work was for naught. Therefore, I&#8217;m simply going to share my code with everyone and have you run it yourself, and anyone else in your office that can hit your machine.</p>
<h3>Real-time Communication With Now.js</h3>
<p><a href="http://nowjs.com/" target="_blank">Now.js</a> is one of the most exciting Node modules I&#8217;ve run across. You can hit their website to read more, but this is how they describe what it does.</p>
<ul>
<li>NowJS creates a magic namespace &#8220;now&#8221;, accessible by server and client</li>
<li>Functions and variables added to now are automatically synced, in real-time</li>
<li>Call client functions from the server and server functions from client</li>
</ul>
<p>I have to admit, when I first hit the site, I was thinking, &#8220;Yeah, right.&#8221; Luckily my healthy skepticism was immediately dashed as I ran their example, and it worked! Without the need to change system settings, or add in a bunch of hoodoo-voodoo code somewhere else to make it look like real-time communication.</p>
<p>Anyway, go to their site, read up on it, and after you&#8217;ve run through their examples, come back here and grab my <a href="https://github.com/chortlehoort/Node_Tutorial/tree/master/now" target="_blank">Beer Drinkers &#038; Hell Raisers code from my Github account</a>.</p>
<p>In there is three files, but you only need <em>chat_server.js</em> and <em>beerdrinker.html</em>.</p>
<p>The only modification you need to make is on line 22 of <em>beerdrinker.html</em> where you place the IP address of the machine that has Node running.</p>
<pre class="brush: jscript; title: ; notranslate">
&lt;script src=&quot;http://{insert IP addy here}:8081/nowjs/now.js&quot;&gt;&lt;/script&gt;
</pre>
<p>Now, technically, there&#8217;s more than 40 lines of code when you count all the HTML and additional Node code I have in there to enable the file serving&#8230; BUT the code that makes my cheesy beer drinking game work is 39 lines of code (amazingly, only 8 lines at the server!).</p>
<p>Once you clone the repo locally, simply execute -</p>
<pre class="brush: bash; title: ; notranslate">
node chat_server.js
</pre>
<p>And then have your friends hit <strong><em>http://your.ip.address/beerdrinker.html</em></strong>. All you need to do is -</p>
<ol>
<li>Enter your name in the input field and click Register</li>
<li>Once everyone is registered, have fun seeing who can drink everyone else under the table.</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://www.fusioncube.net/index.php/realtime-beer-drinking/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Sencha ExtJS 4: Capturing Window Header Close Button Click</title>
		<link>http://www.fusioncube.net/index.php/extjs4-capturing-window-header-close-button-click</link>
		<comments>http://www.fusioncube.net/index.php/extjs4-capturing-window-header-close-button-click#comments</comments>
		<pubDate>Tue, 16 Aug 2011 15:37:14 +0000</pubDate>
		<dc:creator>Steve Brownlee</dc:creator>
				<category><![CDATA[ExtJS]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[button]]></category>
		<category><![CDATA[click]]></category>
		<category><![CDATA[close]]></category>
		<category><![CDATA[event handler]]></category>
		<category><![CDATA[header]]></category>
		<category><![CDATA[Sencha]]></category>

		<guid isPermaLink="false">http://www.fusioncube.net/?p=1362</guid>
		<description><![CDATA[A quick entry mostly for my personal, future reference on how to override Ext.panel.Panel to capture when a user clicks on the close button in the window header.]]></description>
			<content:encoded><![CDATA[<p>More of a personal post for future reference, but in case anyone else stumbles across this, let me know if you have a better way of doing this.</p>
<p>I’m writing an application with ExtJS 4 and when the user clicks on the close button a Window header, I simply want to close it and reset the state on the parent window. However, when the user clicks on the Save button, I want to perform some other actions and then close the child window and the state of the parent window’s controls will be something else.</p>
<p>My problem is that in the MVC architecture defined in ExtJS 4, I only had the child window’s close event on which I could listen – that event is fired when the user clicks on the header icon, and when I execute window.close() in the save method’s logic.</p>
<p>Anyway, the only way I could capture when the user clicked on the header close icon was to override the Ext.panel.Panel method <em>initTools()</em>. I simply copied the entire method from ext-debug-all.js and changed which method handles the header button click gesture. I then added the <em>headerClose()</em> method which is basically the <em>close()</em> method but with an added event being fired &#8211; <em><strong>headerclose</strong></em>.</p>
<pre class="brush: jscript; title: ; notranslate">
Ext.define('MyApplication.Child.Window' ,{
   initTools : function() {
      ...
      if (me.closable) {
         me.addClsWithUI('closable');
         me.addTool({
            type: 'close',
            handler: Ext.Function.bind(me.headerClose, this, [])
         });
      }
      ...
   },

   headerClose: function() {
      if (this.fireEvent('beforeclose', this) !== false) {
         this.fireEvent('headerclose', this);
         this.doClose();
      }
   }
};
</pre>
<p>Now, in my controller I can handle that gesture specifically while handling the more general close event in a different way.</p>
<pre class="brush: jscript; title: ; notranslate">
/*
 * Action handler for when the user clicks on the window close button
 * on the child window, while the general close event does nothing
 */
'childWindow': {
   headerclose: function() {
      this.resetParentState();
   },
   close : function() {
      // Just a stub to show nothing is done on close()
   }
},

'saveButton': {
   click : function(button) {
      doSomethingVeryCool();
      button.up('window').close();  // This will not reset the state of parent window
   }
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.fusioncube.net/index.php/extjs4-capturing-window-header-close-button-click/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Node.js and MongoDB &#8211; A match made in heaven</title>
		<link>http://www.fusioncube.net/index.php/node-js-and-mongodb-a-match-made-in-heaven</link>
		<comments>http://www.fusioncube.net/index.php/node-js-and-mongodb-a-match-made-in-heaven#comments</comments>
		<pubDate>Sun, 31 Jul 2011 01:10:11 +0000</pubDate>
		<dc:creator>Steve Brownlee</dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[mongodb]]></category>
		<category><![CDATA[node.js]]></category>
		<category><![CDATA[mongoose]]></category>
		<category><![CDATA[node]]></category>
		<category><![CDATA[query]]></category>
		<category><![CDATA[schema]]></category>
		<category><![CDATA[stored procedure]]></category>
		<category><![CDATA[trigger]]></category>

		<guid isPermaLink="false">http://www.fusioncube.net/?p=1338</guid>
		<description><![CDATA[On Tuesday I did a presentation for the Pittsburgh JavaScript Developers Meetup group about using Node.js with NoSQL &#8211; or document based &#8211; databases. I chose MongoDB because it&#8217;s got great traction and there&#8217;s a Node module for it named Mongoose. Unfortunately, I was on vacation the week before the presentation, so I didn&#8217;t get [...]]]></description>
			<content:encoded><![CDATA[<p>On Tuesday I did a presentation for the <a target="_blank" href="http://www.meetup.com/Pittsburgh-JavaScript-Developers/">Pittsburgh JavaScript Developers</a> Meetup group about using Node.js with NoSQL &#8211; or document based &#8211; databases. I chose <a target="_blank" href="http://www.mongodb.org/">MongoDB</a> because it&#8217;s got great traction and there&#8217;s a Node module for it named <a target="_blank" href="http://mongoosejs.com/">Mongoose</a>.</p>
<p>Unfortunately, I was on vacation the week before the presentation, so I didn&#8217;t get to cover absolutely everything that I wanted to, but I was able to show some great highlights of what can be done with Mongoose. When I first started to look in to it, I was immediately attracted to its syntax and API being very JavaScript friendly.</p>
<p>First things first, though. You can install Mongoose easily by using npm &#8211; <strong>npm install mongoose</strong>.</p>
<p>Then you simply need to include it and create a reference to a local database (if it doesn&#8217;t exist, Mongoose will create it for you).</p>
<pre class="brush: jscript; title: ; notranslate">
var mongoose = require('mongoose'),
    db = mongoose.connect('mongodb://localhost/test');
</pre>
<p>Now you&#8217;re ready to start working with your database.</p>
<p>One of my favorite things about this system is that you can define, transform, create, and delete all sorts of information without an active database connection. That&#8217;s because MongoDB is document based instead of table based. </p>
<p>In the Mongoose API, it all starts with Schemas &#8211; something not needed in base MongoDB. A schema is the definition of your document &#8211; a rough concept of a table in RDBMS &#8211; but instead of all the normalization that goes on in relational systems, documents get embedded in other documents instead of being joined together.</p>
<p>Let&#8217;s look at my sample. First, I create an instance of <em>mongoose.Schema</em> and then I create two document schemas &#8211; Beer and Type.</p>
<pre class="brush: jscript; title: ; notranslate">
var mongoose = require('mongoose'),
    db = mongoose.connect('mongodb://localhost/test'),
    Schema = mongoose.Schema,

    /**
     *  This is the beer type document that is embedded in the beer document
     */
    Type = new Schema({
        name            : String,
        main_ingredient : String
    }),

    /**
     *  This is the beer document which has a sub-document of Type
     */
    Beer = new Schema({
        brand       : String,
        type        : [Type],   // Embed Type into Beer (kinda like join)
        brewery_age : Number,
        rating      : Number
    });
</pre>
<p>Now that we&#8217;ve defined what a beer is, we make a model for it.</p>
<pre class="brush: jscript; title: ; notranslate">
BeerModel = mongoose.model('Beer', Beer);
</pre>
<p>Now that we have a model for beer, we can create instances. Notice that the parameter is simply a JSON object with each property defined&#8230; except the Type.</p>
<pre class="brush: jscript; title: ; notranslate">
  var Yuengling = new BeerModel({
    brand:'Yuengling',
    brewery_age:105,
    rating: 40
  });
</pre>
<p>To assign properties to a sub-document you use this syntax.</p>
<pre class="brush: jscript; title: ; notranslate">
  Yuengling.type.push({
    name:'Lager',
    main_ingredient:'Malted Barley'
  });
</pre>
<p>Ok, now that we&#8217;ve defined our first beer, let&#8217;s save it to the database. No INSERT INTO needed here, it&#8217;s absurdly simple. You call the save() method; much more JavaScript friendly syntax. It&#8217;s how you would write a save method on any object. Like always in Node &#8211; because we never want to block the I/O on our main event loop &#8211; you pass an anonymous function that will receive an error message if something went wrong.</p>
<pre class="brush: jscript; title: ; notranslate">
Yuengling.save(function(err){
    if (err) { console.log(err); }
  });
</pre>
<p>Let&#8217;s assume, for brevity&#8217;s sake &#8211; that I&#8217;ve added 5 more beers to the database. How would you query it to find beers that have a rating higher than, say, 35? Perhaps the designers of MongoDB live by the K.I.S.S. principle, because you use the find() method. However, the syntax for using operands in the argument list is a bit counter-intuitive.</p>
<p>Let&#8217;s find those on our BeerModel.</p>
<pre class="brush: jscript; title: ; notranslate">
BeerModel.find({ rating: {$gt: 35} }, function(err, beers) {
   beers.forEach(function(beer){
     console.log(beer);
   });
});
</pre>
<p>Another feature I really like in Mongoose is you can add methods directly on the schema and then call those methods on any instance. They serve the purpose of a stored procedure in the relational world.</p>
<p>I&#8217;m going to modify Beer and create two methods that allow me to increment and decrement the value of it rating property.</p>
<pre class="brush: jscript; title: ; notranslate">
    Beer = new Schema({
        brand       : String,
        type        : [Type],   // Embed Type into Beer (kinda like join)
        brewery_age : Number,
        rating      : Number
    }).method('increaseRating', function(){
      this.rating += 1;
      return this.rating;
    }).method('decreaseRating', function(){
      this.rating -= 1;
      return this.rating;
    });

   /**
    * Increase rating of Yuengling
    */
   Yuengling.increaseRating();

   /**
    * Decrese rating of Yuengling
    */
   Yuengling.decreaseRating();
</pre>
<p>How about a validation trigger? In this case, when you call the save() method with a rating that doesn&#8217;t validate, the err argument to the callback function will contain an exception with the message &#8220;Rating for beer is not between 10 and 50&#8243;.</p>
<pre class="brush: jscript; title: ; notranslate">
/**
 * Validate the rating field to be between 10 and 50
 */
Beer.path('rating').validate(function(val){
  return val&gt;10 &amp;&amp; val&lt;=50;
}, 'Rating for beer is not between 10 and 50');
</pre>
<p>These are just scratching the surface of what you can do. At this point in time, the <a target="_blank" href="http://mongoosejs.com/docs/api.html">Mongoose API</a> is a bit sparsely documented, but still, if you want to go through the full API you can find everything you need.</p>
<p>You can see my <a target="_blank" href="https://github.com/chortlehoort/Node_Tutorial/blob/master/mongoose/mongoose.js">full code on my Github</a> account.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.fusioncube.net/index.php/node-js-and-mongodb-a-match-made-in-heaven/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Pittsburgh JavaScript Developers: JavaScript &#8211; Nuts to Bolts</title>
		<link>http://www.fusioncube.net/index.php/pittsburgh-javascript-developers-javascript-nuts-to-bolts</link>
		<comments>http://www.fusioncube.net/index.php/pittsburgh-javascript-developers-javascript-nuts-to-bolts#comments</comments>
		<pubDate>Wed, 27 Jul 2011 16:55:51 +0000</pubDate>
		<dc:creator>Steve Brownlee</dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[pittsburgh]]></category>
		<category><![CDATA[arguments]]></category>
		<category><![CDATA[developers]]></category>
		<category><![CDATA[function]]></category>
		<category><![CDATA[meetup]]></category>
		<category><![CDATA[module]]></category>
		<category><![CDATA[object]]></category>
		<category><![CDATA[prototype]]></category>
		<category><![CDATA[scope]]></category>
		<category><![CDATA[this]]></category>

		<guid isPermaLink="false">http://www.fusioncube.net/?p=1335</guid>
		<description><![CDATA[This is a special session that is going to run every so often and is meant for JavaScript developers of all ranges, from beginner to seasoned veteran. We&#8217;ll take the opportunity discuss all the power, quirks, pros and cons of the JavaScript language starting at &#8220;Hello, World&#8221; and ending with a dive into the guts [...]]]></description>
			<content:encoded><![CDATA[<p>This is a special session that is going to run every so often and is meant for JavaScript developers of all ranges, from beginner to seasoned veteran. We&#8217;ll take the opportunity discuss all the power, quirks, pros and cons of the JavaScript language starting at &#8220;Hello, World&#8221; and ending with a dive into the guts of the language to discover why it works the way it does.</p>
<p>Things to be discovered and discussed will include:</p>
<ul>
<li>The Object</li>
<li>The Function</li>
<li>The Prototype</li>
<li>The Arguments</li>
<li>The this Scope</li>
<li>The Module</li>
<li>JSON</li>
<li>ECMAScript 5</li>
</ul>
<p>The host will help moderate the timeline and the discussions, but it is intended to be an interactive session with everyone bringing an equal voice so that we can all learn together.</p>
<p>You are encouraged to bring your own code, and be prepared to share it and discuss it.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.fusioncube.net/index.php/pittsburgh-javascript-developers-javascript-nuts-to-bolts/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

