<?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>Delivering Quality &#187; JavaScript</title>
	<atom:link href="http://www.markdeepwell.com/tag/javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.markdeepwell.com</link>
	<description>A Software Developers View of the World</description>
	<lastBuildDate>Thu, 29 Jul 2010 16:44:04 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>What Will Web Development Look Like in 5 Years</title>
		<link>http://www.markdeepwell.com/2010/03/what-will-web-development-look-like-in-5-years/</link>
		<comments>http://www.markdeepwell.com/2010/03/what-will-web-development-look-like-in-5-years/#comments</comments>
		<pubDate>Wed, 24 Mar 2010 16:40:45 +0000</pubDate>
		<dc:creator>Mark</dc:creator>
				<category><![CDATA[Mobile]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[Software Tools]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[5 Years]]></category>
		<category><![CDATA[AJAX]]></category>
		<category><![CDATA[Canvas]]></category>
		<category><![CDATA[Framework]]></category>
		<category><![CDATA[Future]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[WebGL]]></category>

		<guid isPermaLink="false">http://www.markdeepwell.com/?p=438</guid>
		<description><![CDATA[Developing applications for the web has changed significantly over the last 5 years. Since 2005 the term AJAX has been coined, Ruby on Rails is now an open source web application framework, jQuery was created and has subsequently revolutionized JavaScript development, and now HTML5 is the top buzzword of the day. I believe the next [...]]]></description>
			<content:encoded><![CDATA[<p>Developing applications for the web has changed significantly over the last 5 years. Since 2005 the term AJAX has been coined, Ruby on Rails is now an open source web application framework, jQuery was created and has subsequently revolutionized JavaScript development, and now HTML5 is the top buzzword of the day. I believe the next 5 years will hold just as many improvements for web developers.</p>
<p>I foresee a new framework will be created to make developing fully interactive AJAX applications  as easy as it is to write current MVC applications. Current  frameworks like Ruby on Rails and Symfony provide everything you need to develop a modern application without having to build plumbing infrastructure; however, they do not provide nice components for interactive applications. In addition to a robust server core, this new framework will have   a client side JavaScript component that simplifies the process of building interactive web 2.0 applications. Some critical components would be:</p>
<ul>
<li>Form Validation. Libraries do exist to validate forms in JavaScript,  but they don&#8217;t integrate with the server side form validation. In this new framework you won&#8217;t have to write form validation code twice.</li>
<li>Paginated Lists. Almost all web applications have at least one page where data needs to be searched and listed with pagination. We need to have this same functionality in JavaScript to skip a full page reload and provide local caching of the results.</li>
<li>Animation Library. While script.aculo.us and jQuery have made simple animations and visual effects much easier to do, I believe we can go even farther. Web applications also need to gain that fluidity and soft animations that desktop applications such as Exposé have had for a couple of years.</li>
</ul>
<p>I also see huge resources being directed towards mobile development because ALL current generation smart phones are built for an incredible web browsing experience. As home users have switched from <a href="http://www.canada.com/technology/tech-biz/laptops+dominate+desktop+face+obsolescence/1151512/story.html">desktop computers</a> to <a href="http://www.google.com/trends?q=laptop%2C+desktop">laptop computers</a> in the last few years, people will slowly start switching to hand-held devices for their primary communication and Internet needs. Most likely this will have one primary effect: web frameworks will have a mobile optimized version of the site done automatically. Little to none developer intervention will be required as only resolution, text sizes, and layouts will be modified for the mobile version.</p>
<p>Lastly I see tools and libraries around 2D and 3D drawing elements. Most likely these libraries would be rendering to a <a href="https://developer.mozilla.org/en/Canvas_tutorial">Canvas</a> or a <a href="http://planet-webgl.org/">WebGL</a> element but something better could be created. Both of these are young standards right now that show a lot of promise on delivering the ability to draw pixels directly in a native HTML web page. While they will be used first in simple computer games, I am very interested to see what libraries are created to facilitate these elements being used appropriately inside next generation web applications.</p>
<p>What do you think the next 5 years will bring?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.markdeepwell.com/2010/03/what-will-web-development-look-like-in-5-years/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Facebook vs You!</title>
		<link>http://www.markdeepwell.com/2009/12/facebook-vs-you/</link>
		<comments>http://www.markdeepwell.com/2009/12/facebook-vs-you/#comments</comments>
		<pubDate>Wed, 23 Dec 2009 06:31:49 +0000</pubDate>
		<dc:creator>Mark</dc:creator>
				<category><![CDATA[Software Development]]></category>
		<category><![CDATA[Web Application]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Facebook]]></category>
		<category><![CDATA[Facebook App]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://www.markdeepwell.com/?p=445</guid>
		<description><![CDATA[Have you had the&#8230; how should I describe it&#8230; experience of writing a Facebook application? No? OK, here&#8217;s an introduction to what you can expect. When developing an application you must learn Rule #1 Facebook is the gatekeeper. Everything you do, be it HTML, CSS or JavaScript, is restricted by Facebook. Only the commands, functions, [...]]]></description>
			<content:encoded><![CDATA[<p>Have you had the&#8230; how should I describe it&#8230; <strong>experience</strong> of writing a Facebook application? No? OK, here&#8217;s an introduction to what you can expect.</p>
<p>When developing an application you must learn Rule #1 <strong>Facebook is the gatekeeper</strong>. Everything you do, be it HTML, CSS or JavaScript, is restricted by Facebook. Only the commands, functions, CSS properties, HTML tags etc. that Facebook allows are permissible. If you have an error in your HTML such as an unclosed tag or if you try to use a CSS property that does not exist, Facebook will render a very nice message saying you made an error.</p>
<p>Rule #2 <strong>The never ending cycle</strong>. The Facebook platform is constantly changing and APIs that you are using in your application could disappear one day without any notice. It&#8217;s the life of a Facebook application, working one instant, inexplicably broken the next. Be prepared for irregular maintenance just to keep your application working.</p>
<p>A Facebook Application  lives in the world of Facebook and while it might initially seem  like you&#8217;re developing a standard web application you are not. Rule #3 <strong>You&#8217;re application is on the Facebook web</strong>. It&#8217;s not a regular web application which is a very slight but critical distinction. Facebook has used their powers as the gatekeeper to make modifications to the web. Some HTML tags are allowed, some are not. <a href="http://wiki.developers.facebook.com/index.php/FBJS#FBJS_DOM_Objects">JavaScript has been altered</a> to remove a lot of its power and replace only some of them with Facebook specific functions and even CSS has restrictions. Don&#8217;t expect existing code to function when placed in the Facebook web.</p>
<h3>Additional Caveats</h3>
<ul>
<li>You cannot include any external JavaScript or style sheet files, they must be included in-line. This is so Facebook can parse them and allow only approved commands. Yes it enhances the security of the social networking site as a whole, but it will slow down your development time.</li>
<li>Facebook will filter, compile, and drastically alter your original code. Clicking view-source on a Facebook page with your application will show your JavaScript code mushed into awkward Facebook functions.</li>
</ul>
<p>Do you see that it&#8217;s a bit of a battle of you against the mighty Facebook? Don&#8217;t sweat too much, other developers have persevered and with a few wounds and time you can build and maintain a successful Facebook application. Good luck!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.markdeepwell.com/2009/12/facebook-vs-you/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>UpcomingHoliday.com Now with Geolocation</title>
		<link>http://www.markdeepwell.com/2009/12/upcomingholiday-com-now-with-geolocation/</link>
		<comments>http://www.markdeepwell.com/2009/12/upcomingholiday-com-now-with-geolocation/#comments</comments>
		<pubDate>Thu, 17 Dec 2009 06:27:40 +0000</pubDate>
		<dc:creator>Mark</dc:creator>
				<category><![CDATA[Web Application]]></category>
		<category><![CDATA[Firefox]]></category>
		<category><![CDATA[Geolocation]]></category>
		<category><![CDATA[Google Chrome]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Safari]]></category>

		<guid isPermaLink="false">http://www.markdeepwell.com/?p=440</guid>
		<description><![CDATA[UpcomingHoliday.com has been updated and now includes geolocation support. If your browser supports it your country should automatically find and select your country. If not, it will fall back to IP based country lookup. Geolocation is a HTML 5 feature that is supported by Safari on the iPhone 3.0 OS, Firefox 3.5 and Google Chrome. [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://upcomingholiday.com">UpcomingHoliday.com</a> has been updated and now includes <a href="http://dev.w3.org/geo/api/spec-source.html">geolocation</a> support. If your browser supports it your country should automatically find and select your country. If not, it will fall back to IP based country lookup. Geolocation is a HTML 5 feature that is supported by Safari on the iPhone 3.0 OS, Firefox 3.5 and Google Chrome.</p>
<p>UpcomingHoliday.com is an application that tells you what and when your <a href="http://upcomingholiday.com">next federal holiday</a> is. Currently it&#8217;s available for people in: Australia, Canada, France, Germany, India,  Nigeria, United Kingdom and United States.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.markdeepwell.com/2009/12/upcomingholiday-com-now-with-geolocation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Learning WebGL</title>
		<link>http://www.markdeepwell.com/2009/11/learning-webgl/</link>
		<comments>http://www.markdeepwell.com/2009/11/learning-webgl/#comments</comments>
		<pubDate>Sun, 15 Nov 2009 21:22:15 +0000</pubDate>
		<dc:creator>Mark</dc:creator>
				<category><![CDATA[Web]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[OpenGL ES]]></category>
		<category><![CDATA[WebGL]]></category>

		<guid isPermaLink="false">http://www.markdeepwell.com/?p=366</guid>
		<description><![CDATA[If you&#8217;re interested in programming graphics on the web I recommend subscribing to Planet WebGL; it has a lot of great tutorials and instructional material for learning how to program graphics in a web environment. WebGL is technically a JavaScript binding to OpenGL ES 2.0. If you already know OpenGL ES and JavaScript, you should [...]]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;re interested in programming graphics on the web I recommend subscribing to <a href="http://planet-webgl.org/">Planet WebGL</a>; it has a lot of great tutorials and instructional material for learning how to program graphics in a web environment.</p>
<p>WebGL is technically a JavaScript binding to OpenGL ES 2.0. If you already know OpenGL ES and JavaScript, you should be able to pick it up pretty quickly. If you know JavaScript but not OpenGL and are in a web development career, I encourage you to look into WebGL because it could be one key component of interactive web applications in the future.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.markdeepwell.com/2009/11/learning-webgl/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Intro to Objects in JavaScript</title>
		<link>http://www.markdeepwell.com/2009/10/intro-to-objects-in-javascript/</link>
		<comments>http://www.markdeepwell.com/2009/10/intro-to-objects-in-javascript/#comments</comments>
		<pubDate>Wed, 21 Oct 2009 06:23:03 +0000</pubDate>
		<dc:creator>Mark</dc:creator>
				<category><![CDATA[Software Development]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[OOP]]></category>

		<guid isPermaLink="false">http://www.markdeepwell.com/?p=317</guid>
		<description><![CDATA[Despite what you might think, JavaScript supports programming in full object oriented style including inheritance, encapsulation and polymorphism. But before we dive into all those topics I'm going to start with the basics and demonstrate how to create and use a simple JavaScript object. Lets say you have a web application that needs to track [...]]]></description>
			<content:encoded><![CDATA[<p>Despite what you might think, JavaScript supports programming in full object oriented style including inheritance, encapsulation and polymorphism. But before we dive into all those topics I'm going to start with the basics and demonstrate how to create and use a simple JavaScript object.</p>
<p>Lets say you have a web application that needs to track how long an AJAX request took. If you were writing it in Ruby, PHP or Python you'd have a timer object that you can start() and stop() and a seconds() method to get the number of seconds that passed between calling the first two methods.</p>
<p>To build this in JavaScript we first create our constructor:</p>
<div class="igBar"><span id="ljavascript-6"><a href="#" onclick="javascript:showPlainTxt('javascript-6'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JAVASCRIPT:</span>
<div id="javascript-6">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">Timer = <span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #003366; font-weight: bold;">var</span> seconds_passed = <span style="color: #CC0000;color:#800000;">0</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p>
Here we are creating a Timer object with a private  seconds_passed variable. To create this object we we simply create a new timer:</p>
<div class="igBar"><span id="ljavascript-7"><a href="#" onclick="javascript:showPlainTxt('javascript-7'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JAVASCRIPT:</span>
<div id="javascript-7">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #003366; font-weight: bold;">var</span> elapsed_timer = <span style="color: #003366; font-weight: bold;">new</span> Timer<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p>
This timer object now needs some public methods. We can attach a public method by using this.method_name:</p>
<div class="igBar"><span id="ljavascript-8"><a href="#" onclick="javascript:showPlainTxt('javascript-8'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JAVASCRIPT:</span>
<div id="javascript-8">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">Timer = <span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #003366; font-weight: bold;">var</span> seconds_passed = <span style="color: #CC0000;color:#800000;">0</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #006600;">start</span> = <span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900; font-style: italic;">// implementation here</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p>
Our Timer class now has a start() function. Additional public methods can be added in the same way.</p>
<p>To add a private method, don't define it with the <em>this</em> keyword but instead create a regular function inside the class:</p>
<div class="igBar"><span id="ljavascript-9"><a href="#" onclick="javascript:showPlainTxt('javascript-9'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JAVASCRIPT:</span>
<div id="javascript-9">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">Timer = <span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #003366; font-weight: bold;">function</span> increment<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900; font-style: italic;">// implementation of private method here</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p>
Now we have a Timer object with a public start method and a private increment method. The rest of the class is fairly simple, so lets jump to the finished solution.</p>
<h3>Complete Example</h3>
<div class="igBar"><span id="ljavascript-10"><a href="#" onclick="javascript:showPlainTxt('javascript-10'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JAVASCRIPT:</span>
<div id="javascript-10">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">Timer = <span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #003366; font-weight: bold;">var</span> timeout_id = <span style="color: #003366; font-weight: bold;">null</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #003366; font-weight: bold;">var</span> seconds_passed = <span style="color: #CC0000;color:#800000;">0</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #006600;">start</span> = <span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; increment<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #000066;">stop</span> = <span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; clearTimeout<span style="color: #66cc66;">&#40;</span>timeout_id<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; timeout_id = <span style="color: #003366; font-weight: bold;">null</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #006600;">seconds</span> = <span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">return</span> seconds_passed;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #003366; font-weight: bold;">function</span> increment<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; seconds_passed++;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; timeout_id = window.<span style="color: #006600;">setTimeout</span><span style="color: #66cc66;">&#40;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; increment<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; , <span style="color: #CC0000;color:#800000;">1000</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #003366; font-weight: bold;">var</span> elapsed_timer = <span style="color: #003366; font-weight: bold;">new</span> Timer<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">elapsed_timer.<span style="color: #006600;">start</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900; font-style: italic;">// do some stuff</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">elapsed_timer.<span style="color: #000066;">stop</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000066;">alert</span><span style="color: #66cc66;">&#40;</span>elapsed_timer.<span style="color: #006600;">seconds</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p>
There you have it. A simple JavaScript timer to keep track of time.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.markdeepwell.com/2009/10/intro-to-objects-in-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Firebug: The JavaScript Debugger</title>
		<link>http://www.markdeepwell.com/2009/10/firebug-the-javascript-debugger/</link>
		<comments>http://www.markdeepwell.com/2009/10/firebug-the-javascript-debugger/#comments</comments>
		<pubDate>Mon, 12 Oct 2009 05:08:26 +0000</pubDate>
		<dc:creator>Mark</dc:creator>
				<category><![CDATA[Software Tools]]></category>
		<category><![CDATA[Firebug]]></category>
		<category><![CDATA[Firefox Extension]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://www.markdeepwell.com/?p=291</guid>
		<description><![CDATA[JavaScript is a core language of many web developers and a necessary component for any modern web application; therefore having an excellent JavaScript debugger and knowing how to use it effectively is key to fixing bugs faster. Fixing bugs faster also makes you a happier software developer! I recommend Firebug, which is a JavaScript debugger, [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: left;">JavaScript is a core language of many web developers and a necessary component for any modern web application; therefore having an excellent JavaScript debugger and knowing how to use it effectively is key to fixing bugs faster. Fixing bugs faster also makes you a happier software developer!</p>
<p style="text-align: left;">I recommend <a href="http://getfirebug.com/">Firebug</a>, which is a JavaScript debugger, a real-time HTML, CSS, DOM, and JavaScript editor, and a network monitor.</p>
<h1 style="text-align: left;">Logging</h1>
<p>One of the most useful features are the <a href="http://getfirebug.com/console.html">logging functions</a> through console.log which can simply be used to output a string or object:<br />
<code><br />
console.log('Testing log output: ', myObject);<br />
</code><br />
This will output your message and the full object available for inspection in the Firebug console tab. In addition to console.log, there is also console.warn, console.error, and more. See the <a href="http://getfirebug.com/console.html">Firebug documentation</a> for more info.</p>
<p>Be careful to remove the statements from your code before deploying it, because your users won't have Firebug installed, and JavaScript will then fail when it tries to output to the console object. Also, you certainly don't want users to see your debug output.</p>
<div id="attachment_297" class="wp-caption alignnone" style="width: 498px"><img class="size-full wp-image-297 " title="firebug logger" src="http://www.markdeepwell.com/wp-content/uploads/2009/10/firebug-logger.jpg" alt="firebug logger" width="488" height="164" /><p class="wp-caption-text">console.log in action</p></div>
<h1>Breakpoints</h1>
<p>Pausing scripts to investigate the system at a current point in time can be very valuable in solving bugs. To use the breakpoint feature click just to the left of a JavaScript line. This will set a breakpoint and make a red dot appear.</p>
<p>You can also add a conditional breakpoint by right clicking on a line number. Now the program will only pause under your specified condition.</p>
<div id="attachment_296" class="wp-caption alignnone" style="width: 405px"><img class="size-full wp-image-296 " title="firebug breakpoint" src="http://www.markdeepwell.com/wp-content/uploads/2009/10/20091012-e798upemuhaiy18esaxmpheqtm.jpg" alt="firebug breakpoint" width="395" height="163" /><p class="wp-caption-text">Setting a breakpoint</p></div>
<h1>JavaScript Errors</h1>
<p>Firebug will print out JavaScript errors with the corresponding file and line number. An absolute must for any JavaScript development.</p>
<div id="attachment_305" class="wp-caption alignnone" style="width: 525px"><img class="size-full wp-image-305" title="firebug javascript error" src="http://www.markdeepwell.com/wp-content/uploads/2009/10/firebug-javascript-error.jpg" alt="firebug javascript error" width="515" height="157" /><p class="wp-caption-text">A JavaScript Error</p></div>
<p>Those are the key feature I use most often, but there are many more <a href="http://getfirebug.com/js.html">JavaScript features in Firebug</a>, including stack traces, watching expressions, profiling and viewing events.</p>
<p><a href="https://addons.mozilla.org/en-US/firefox/addon/1843">Download Firebug now</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.markdeepwell.com/2009/10/firebug-the-javascript-debugger/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Browser Notifications with Yip</title>
		<link>http://www.markdeepwell.com/2009/08/browser-notifications-with-yip/</link>
		<comments>http://www.markdeepwell.com/2009/08/browser-notifications-with-yip/#comments</comments>
		<pubDate>Mon, 10 Aug 2009 02:51:35 +0000</pubDate>
		<dc:creator>Mark</dc:creator>
				<category><![CDATA[Web]]></category>
		<category><![CDATA[Cross Platform]]></category>
		<category><![CDATA[Firefox]]></category>
		<category><![CDATA[Firefox Extension]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[notifications]]></category>

		<guid isPermaLink="false">http://www.markdeepwell.com/?p=119</guid>
		<description><![CDATA[Add support for operating system notifications to your web application through a simple JavaScript API using Yip.]]></description>
			<content:encoded><![CDATA[<p><img class="alignright size-full wp-image-121" title="Yip Icon" src="http://www.markdeepwell.com/wp-content/uploads/2009/08/yip-icon.jpg" alt="Yip Icon" width="197" height="205" /></p>
<p>Ever wanted your web application to be able to show notifications even if the user may be in another browser tab or application? Now you can!</p>
<p>The relatively new <a href="http://abcdefu.wordpress.com/2009/06/09/introducing-yip-an-unified-notification-system-for-the-web/">Yip  extension</a> for Firefox adds notification functionality. This is not a small JavaScript notification that pops up in the browser tab, but one that integrates directly with the users Operating System.</p>
<p>Yip uses <a href="http://www.markshuttleworth.com/archives/265">libnotify/notify-osd</a> on Ubuntu Linux, <a href="http://growl.info/">Growl</a> on Mac, and <a href="http://www.fullphat.net/">Snarl</a> or <a href="http://growlforwindows.com/gfw/">Growl for Windows</a> on Windows. If none of these notification applications are installed, it will use Firefox's simple and not as pretty  notification system. Ubuntu Linux users have notify-osd installed by default,  Growl is popular with Mac users, yet Windows users probably don't have  Snarl or Growler for Windows installed.</p>
<p>When building with notifications remember that they are meant to enhance the user experience, not require it.</p>
<p>The Yip extension supports both the Fluid and Prism APIs, but recommends Fluid because of support for an onclick callback function.</p>
<p>The API is simple and straight to the point:</p>
<div class="igBar"><span id="ljavascript-11"><a href="#" onclick="javascript:showPlainTxt('javascript-11'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JAVASCRIPT:</span>
<div id="javascript-11">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">window.<span style="color: #006600;">fluid</span>.<span style="color: #006600;">showGrowlNotification</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; title: <span style="color: #3366CC;">"your notification title"</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; description: <span style="color: #3366CC;">"some description"</span>,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; onclick: optionalCallbackFunction,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; icon: <span style="color: #3366CC;">"URL to an icon"</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Since Yip may not be installed on the users computer, just wrap it with a check for fluid. A complete example looks like this:</p>
<div class="igBar"><span id="ljavascript-12"><a href="#" onclick="javascript:showPlainTxt('javascript-12'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JAVASCRIPT:</span>
<div id="javascript-12">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000066; font-weight: bold;">if</span> <span style="color: #66cc66;">&#40;</span><span style="color: #000066; font-weight: bold;">typeof</span><span style="color: #66cc66;">&#40;</span>fluid<span style="color: #66cc66;">&#41;</span> !== <span style="color: #3366CC;">'undefined'</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; window.<span style="color: #006600;">fluid</span>.<span style="color: #006600;">showGrowlNotification</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; title: <span style="color: #3366CC;">"Hello World"</span>,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; description: <span style="color: #3366CC;">"The Google icon says Hi"</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; icon: <span style="color: #3366CC;">"http://www.google.com/favicon.ico"</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<h3>Related Projects</h3>
<ul>
<li><a href="http://digitarald.de/project/roar/">Roar</a>: Embed notifications into a web page (powered by MooTools).</li>
<li><a href="http://ajaxian.com/archives/growls-for-windows-and-a-web-notification-api">growl.js</a>: Windows only notifications using Growl for Windows.</li>
<li><a href="http://code.google.com/p/gears/wiki/NotificationAPI">NotificationAPI</a>: Notifications in Google Gears</li>
</ul>
<p>Of all these options, Yip is the best solution by far; its fully cross platform, has a simple to use API, and is ready to use. <a href="http://blog.abi.sh/yip-latest.xpi">Install Yip now</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.markdeepwell.com/2009/08/browser-notifications-with-yip/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
