<?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>Over It. &#187; JavaScript</title>
	<atom:link href="http://jason.diamond.name/weblog/tag/javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://jason.diamond.name/weblog</link>
	<description>(a Weblog by Jason Diamond)</description>
	<lastBuildDate>Mon, 30 Jan 2012 20:08:01 +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>WebSocket Webinar Demo Code</title>
		<link>http://jason.diamond.name/weblog/2012/01/30/websocket-webinar-demo-code/</link>
		<comments>http://jason.diamond.name/weblog/2012/01/30/websocket-webinar-demo-code/#comments</comments>
		<pubDate>Mon, 30 Jan 2012 20:08:01 +0000</pubDate>
		<dc:creator>Jason Diamond</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[WebSocket]]></category>

		<guid isPermaLink="false">http://jason.diamond.name/weblog/?p=175</guid>
		<description><![CDATA[Thanks to those who attended today&#8217;s webinar. The demo code is located here until it (and the recording) get uploaded to the DM website later this week. Feel free to email with questions!]]></description>
			<content:encoded><![CDATA[<p>Thanks to those who attended today&#8217;s webinar. The demo code is located <a href="http://dl.dropbox.com/u/4389817/WebSocketsDemo.zip">here</a> until it (and the recording) get uploaded to the DM website later this week.</p>
<p>Feel free to email with questions!</p>
]]></content:encoded>
			<wfw:commentRss>http://jason.diamond.name/weblog/2012/01/30/websocket-webinar-demo-code/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery Webinar</title>
		<link>http://jason.diamond.name/weblog/2011/08/04/jquery-webinar/</link>
		<comments>http://jason.diamond.name/weblog/2011/08/04/jquery-webinar/#comments</comments>
		<pubDate>Thu, 04 Aug 2011 21:18:31 +0000</pubDate>
		<dc:creator>Jason Diamond</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[DevelopMentor]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[MVC]]></category>

		<guid isPermaLink="false">http://jason.diamond.name/weblog/?p=173</guid>
		<description><![CDATA[I&#8217;ll be doing a webinar for DevelopMentor tomorrow at 11 AM Pacific. The title is &#8220;Spice Up Your Web Applications with a Dash of jQuery!&#8221;. I&#8217;ll be enhancing a simple MVC application so that it &#8220;feels&#8221; a bit slicker for your users. If you know JavaScript and jQuery, it&#8217;s basic stuff, but the goal is [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ll be doing a webinar for <a href="http://www.develop.com/">DevelopMentor</a> tomorrow at 11 AM Pacific. The title is &#8220;Spice Up Your Web Applications with a Dash of jQuery!&#8221;.</p>
<p>I&#8217;ll be enhancing a simple MVC application so that it &#8220;feels&#8221; a bit slicker for your users. If you know JavaScript and jQuery, it&#8217;s basic stuff, but the goal is really to help those who aren&#8217;t as comfortable doing that to become confident enough to dive in and start learning.</p>
<p>I&#8217;ve been told that more people registered than we can actually have join. Sorry in advance if anybody can&#8217;t get in. You&#8217;ll be able to watch a recording of it afterwards <a href="http://www.develop.com/webcasts">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://jason.diamond.name/weblog/2011/08/04/jquery-webinar/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery Deferreds</title>
		<link>http://jason.diamond.name/weblog/2011/03/28/jquery-deferreds/</link>
		<comments>http://jason.diamond.name/weblog/2011/03/28/jquery-deferreds/#comments</comments>
		<pubDate>Mon, 28 Mar 2011 23:55:37 +0000</pubDate>
		<dc:creator>Jason Diamond</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://jason.diamond.name/weblog/?p=163</guid>
		<description><![CDATA[I’m absolutely loving the new Deferred objects in jQuery 1.5 and am using them heavily in a new project at work. I just spent a bit of time trying to figure out why they weren’t working the way I was expecting them to, actually having to step into the jQuery code to realize my mistake. [...]]]></description>
			<content:encoded><![CDATA[<p>I’m absolutely loving the new <a href="http://api.jquery.com/category/deferred-object/">Deferred objects</a> in jQuery 1.5 and am using them heavily in a new project at work.</p>
<p>I just spent a bit of time trying to figure out why they weren’t working the way I was expecting them to, actually having to step into the jQuery code to realize my mistake.</p>
<p>The <code>$.when</code> method can take in one or more Deferred objects, but it can&#8217;t take them in as an array. Once I realized this, I immediately realized this could be solved with JavaScript’s <code>apply</code> function like this:</p>
<pre class="brush:js">$.when.apply($, myDeferreds).done(function () {
    // All deferreds were resolved...
});</pre>
<p>The first argument to <code>apply</code> is the object that gets to be “this” inside the <code>when</code> method. The second argument is the array containing the deferreds.</p>
<p>If <code>myDeferreds</code> contains three deferred objects, the above is the equivalent of this:</p>
<pre class="brush:js">$.when(deferred1, deferred2, deferred3).done(function () {
    // All deferreds were resolved...
});</pre>
<p>I thought that it would be neat if <code>$.when</code> would check to see if it was passed an array, but the jQuery team <a href="http://bugs.jquery.com/ticket/8256">disagrees</a>. Here&#8217;s hoping I won&#8217;t make this mistake again&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://jason.diamond.name/weblog/2011/03/28/jquery-deferreds/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Verifying JavaScript with JSLint and Visual Studio</title>
		<link>http://jason.diamond.name/weblog/2008/08/09/verifying-javascript-with-jslint-and-visual-studio/</link>
		<comments>http://jason.diamond.name/weblog/2008/08/09/verifying-javascript-with-jslint-and-visual-studio/#comments</comments>
		<pubDate>Sun, 10 Aug 2008 00:33:51 +0000</pubDate>
		<dc:creator>Jason Diamond</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Visual Studio]]></category>

		<guid isPermaLink="false">http://jason.diamond.name/weblog/?p=55</guid>
		<description><![CDATA[Douglas Crockford’s JavaScript: The Good Parts is a short, but informative read that all JavaScript developers should probably pick up. In it, he describes what parts of the JavaScript language we should be using (the good parts) and what parts we shouldn’t (the bad and the awful parts). To help keep ourselves in check, he’s [...]]]></description>
			<content:encoded><![CDATA[<p>Douglas Crockford’s <a href="http://www.amazon.com/exec/obidos/ASIN/0596517742/">JavaScript: The Good Parts</a> is a short, but informative read that all JavaScript developers should probably pick up. In it, he describes what parts of the JavaScript language we should be using (the good parts) and what parts we shouldn’t (the bad and the awful parts).</p>
<p>To help keep ourselves in check, he’s made his <a href="http://www.jslint.com/">JSLint</a> tool available years ago, but I always found myself too lazy to copy/paste my script into the tool to verify it. I finally decided to make this an almost instantaneous process.</p>
<p>The source code for JSLint is written in, what else, JavaScript. Since I do the majority of my work on Windows machines, I’m fortunate enough to have a built-in scripting engine that can run JavaScript without having to install any extra tools. And, no, I don’t mean my web browser—I mean <code>cscript.exe</code>.</p>
<p>Mr. Crockford does have a simple, cscript-compatible version of his script on his web site. It’s too simple, though. Most of the options it can check are disabled so aren’t checked and it stops after finding its first error.</p>
<p>For that reason, I’ve put together my own “host” for JSLint. It supports the enabling and disabling of all the options listed on the JSLint <a href="http://www.jslint.com/lint.html">documentation</a> page with command-line parameters and includes reasonable defaults so that you shouldn’t need to set or unset too many.</p>
<p>I’ve also added an option that adds the global variables defined in the Microsoft AJAX Library so that you don’t have to declare them in each of your scripts or on the command line. I’ve turned that option on by default, but it shouldn’t hurt you if you’re not using ASP.NET AJAX.</p>
<p>It also outputs any errors it finds in a format compatible with Visual Studio. If you set it up as an external tool, you can run it against your current file and hit <code>F8</code> (the key bound to <code>Edit.GoToNextLocation</code>, by default) to jump to each line an error occurred on. This makes it trivially easy to detect and fix errors. No more excuses for using the bad parts of JavaScript!</p>
<p>To use it, all you have to do is download the latest version of <a href="http://www.jslint.com/fulljslint.js">fulljslint.js</a> from the JSLint web site. Put it in some folder in your PATH. For example, I use a folder called <code>C:\Tools</code> to hold the various little tools I find myself needing frequently. Next, download <a href="http://jason.diamond.name/downloads/jslint.wsf">jslint.wsf</a> from this web site and put it in the same folder you put <code>fulljslint.js</code> in. Finally, download <a href="http://jason.diamond.name/downloads/jslint.cmd">jslint.cmd</a> and, once again, save it in the same folder as the other two files. You should now be able to issue a simple command like the following to verify any JavaScript file:</p>
<pre>jslint script.js</pre>
<p>Of course, to get the most out of using this, you’re going to want to set it up as an external tool in Visual Studio. Open up Visual Studio, go to Tools -> External Tools… and click Add. Enter “&#038;JSLint” as the Title and “C:\Tools\jslint.cmd” (modified to use the folder you actually saved the files in, of course) as the Command. Enter “$(ItemPath)” as the Arguments. Check Use Output Window and click OK.</p>
<p>To test it out, open up any <code>.js</code> file and hit <code>Alt+T</code> and then J (or use the mouse). You should see your Output window appear with the results of the run. If there were any errors just hit <code>F8</code> to cycle through them.</p>
<p>If you’re confused about why it’s saying such simple things like <code>==</code> and <code>++</code> are errors, read Douglas’ book or at least read the documentation for JSLint and the other essays on his <a href="http://javascript.crockford.com/">web site</a>.</p>
<p>A quick tip for ASP.NET AJAX users: If you register your own namespaces using <code>Type.registerNamespace</code>, you’ll get many errors telling you that your namespace is undefined. Put a comment like this at the top of your file and you’ll be good to go:</p>
<pre>/*global YourNamespace*/</pre>
<p>Feel free to contact me with any questions or issues you might have. I really want to see us all improve as JavaScript developers so the more people who are using tools like this, the better our code will be.</p>
]]></content:encoded>
			<wfw:commentRss>http://jason.diamond.name/weblog/2008/08/09/verifying-javascript-with-jslint-and-visual-studio/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

