<?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>Stephen Belanger &#187; Javascript</title>
	<atom:link href="http://www.stephenbelanger.com/category/web-programming/javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.stephenbelanger.com</link>
	<description>Just another coder making the web a better place.</description>
	<lastBuildDate>Fri, 16 Jul 2010 00:02:28 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Node.js &#8211; I&#8217;m a fanboy already.</title>
		<link>http://www.stephenbelanger.com/2010/02/17/node-js-im-a-fanboy-already/</link>
		<comments>http://www.stephenbelanger.com/2010/02/17/node-js-im-a-fanboy-already/#comments</comments>
		<pubDate>Wed, 17 Feb 2010 03:31:46 +0000</pubDate>
		<dc:creator>Qard</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Web Programming]]></category>
		<category><![CDATA[narwhal]]></category>
		<category><![CDATA[node.js]]></category>
		<category><![CDATA[v8]]></category>
		<category><![CDATA[v8cgi]]></category>
		<category><![CDATA[web server]]></category>
		<guid isPermaLink="false">http://www.stephenbelanger.com/2010/02/17/node-js-im-a-fanboy-already/</guid>
		<description><![CDATA[About a week ago I discovered a unique new programming technology called <a href="http://nodejs.org/">node.js</a>. It's an event-driven javascript system running on Google's V8 engine and is primarily focused on functioning as a web server. I hesitate to call it a web server however--it's much more than that!]]></description>
			<content:encoded><![CDATA[<p>About a week ago I discovered a unique new programming technology called <a href="http://nodejs.org/">node.js</a>. It&#8217;s an event-driven javascript system running on Google&#8217;s V8 engine and is primarily focused on functioning as a web server. I hesitate to call it a web server however&#8211;it&#8217;s much more than that!</p>
<p>Using this amazing new system I was able to integrate support for the new WebSockets specification that Google recently added support for in Chrome, and I used this to make a simple real-time chat application with emoticon support and translation of image links to inline images and youtube links to inline videos.</p>
<p>&#8230;and the best part? This only took me about an hour!</p>
<p>There are some simple architectural differences that make it vastly more powerful that most any other popular web programming languages. One of my favorite characteristics of it&#8217;s unique design is that variables assigned in a global scope can be accessed across all requests&#8230;that means regular database querying becomes completely unnecessary! You could create a json object where you store your data, then check it over every once in awhile, and apply any changes to the database. It&#8217;d work as a query queue of sorts that would greatly reduce database interaction overhead and it wouldn&#8217;t require setting up some other incredibly complex software to proxy the requests!</p>
<p>I&#8217;m also quite fond of the branching design. There is a module called &#8216;http&#8217; for running web servers, but it&#8217;s really just routing everything through the tcp module, which essentially does the same thing. The &#8216;http&#8217; module just simplifies the interface and makes common actions like sending headers more elegant. It&#8217;s a clever design really; supply varying levels of complexity in control to match varying levels of complexity in application&#8211;not everyone is going to want the ability to create a mail server, so why would they want to have to access tcp directly? Inversely; not everyone is only going to want a web server, so why would you only supply access to http-related code?</p>
<p>Have a look at this sample code I ripped-off from the homepage of node.js;</p>
<pre>
var sys = require('sys'),
   http = require('http');
http.createServer(function (req, res) {
  setTimeout(function () {
    res.sendHeader(200, {'Content-Type': 'text/plain'});
    res.sendBody('Hello World');
    res.finish();
  }, 2000);
}).listen(8000);
sys.puts('Server running at http://127.0.0.1:8000/');
</pre>
<p>Isn&#8217;t it so simple? You just include a few modules, run http.createServer() with a callback function passing in the request and response objects and tell the server to listen on whatever port you want and whatever domain you want. In the callback you can branch of by breaking apart request.url to find the user&#8217;s query and use that to redirect via a switch block or whatever other means you see fit. Best of all, it&#8217;s asynchronous, so you don&#8217;t need to halt execution for every little thing. It&#8217;s even compatible with many common Javascript utility libraries such as <a href="http://documentcloud.github.com/underscore/">Underscore</a></p>
<img src="http://www.stephenbelanger.com/?ak_action=api_record_view&id=83&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.stephenbelanger.com/2010/02/17/node-js-im-a-fanboy-already/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jquery.flash v1.3.1 &#8211; Squashing IE-related bugs.</title>
		<link>http://www.stephenbelanger.com/2010/01/02/jquery-flash-v1-3-1-squashing-ie-related-bugs/</link>
		<comments>http://www.stephenbelanger.com/2010/01/02/jquery-flash-v1-3-1-squashing-ie-related-bugs/#comments</comments>
		<pubDate>Sat, 02 Jan 2010 09:17:18 +0000</pubDate>
		<dc:creator>Qard</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[Web Programming]]></category>
		<category><![CDATA[jquery.flash]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[swfobject]]></category>
		<guid isPermaLink="false">http://www.stephenbelanger.com/?p=59</guid>
		<description><![CDATA[If you downloaded v1.3 of jquery.flash I would recommend switching to this one. There has been no functionality changes, so it should just be drop-in. It fixes a minor bug I added when I switched to using indexOf() for iterating through attributes and parameters...apparently IE doesn't support it. >.>]]></description>
			<content:encoded><![CDATA[<p>If you downloaded v1.3 of jquery.flash I would recommend switching to this one. There has been no functionality changes, so it should just be drop-in. It fixes a minor bug I added when I switched to using indexOf() for iterating through attributes and parameters&#8230;apparently IE doesn&#8217;t support it. >.></p>
<p>That&#8217;s fixed now and I did a few minor structural changes to reduce the character count a little and make things ever so slightly speedier. I also created a fancy tutorial page type thing for it, which you can check out here.</p>
<p><a href="http://www.stephenbelanger.com/jquery-flash/">Example</a></p>
<p>Downloads:<br />
<a href='http://www.stephenbelanger.com/wp-content/uploads/2010/01/jquery.flash.min_.js'>Minified &#8211; 2.03 KB</a><br />
<a href='http://www.stephenbelanger.com/wp-content/uploads/2010/01/jquery.flash.js'>Non-Minified &#8211; 4.35 KB</a></p>
<img src="http://www.stephenbelanger.com/?ak_action=api_record_view&id=59&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.stephenbelanger.com/2010/01/02/jquery-flash-v1-3-1-squashing-ie-related-bugs/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>jquery.flash v1.3 is ready!</title>
		<link>http://www.stephenbelanger.com/2009/12/19/jquery-flash-v1-3-is-ready/</link>
		<comments>http://www.stephenbelanger.com/2009/12/19/jquery-flash-v1-3-is-ready/#comments</comments>
		<pubDate>Sat, 19 Dec 2009 10:19:29 +0000</pubDate>
		<dc:creator>Qard</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[Web Programming]]></category>
		<category><![CDATA[jquery.flash]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[swfobject]]></category>
		<guid isPermaLink="false">http://www.stephenbelanger.com/?p=29</guid>
		<description><![CDATA[There's nothing major to change in such a minimal library, but such a difference the little things can make! New in version 1.3 is;
<ul>
	<li>Class inheritance</li>
	<li>Src inheritance from href for easy conversion of links</li>
	<li>Built-in support for allowfullscreen parameter</li>
	<li>Minor fix to dimensions inheritance</li>
	<li>Added availattrs and availparams to settings object allowing anyone to add support for any extra attributes or parameters they might need!</li>
	<li>Moved lots of code around to use as little characters as possible, allowing optimal minification. All this new functionality and it got even smaller! It's now down to 1.91 KB.</li>
</ul>]]></description>
			<content:encoded><![CDATA[<p>There&#8217;s nothing major to change in such a minimal library, but such a difference the little things can make! New in version 1.3 is;</p>
<ul>
<li>Class inheritance</li>
<li>Src inheritance from href for easy conversion of links</li>
<li>Built-in support for allowfullscreen parameter</li>
<li>Minor fix to dimensions inheritance</li>
<li>Added availattrs and availparams to settings object allowing anyone to add support for any extra attributes or parameters they might need!</li>
<li>Moved lots of code around to use as little characters as possible, allowing optimal minification. All this new functionality and it got even smaller! It&#8217;s now down to 1.91 KB.</li>
</ul>
<p>Available options and their defaults:</p>
<pre class="prettyprint">$(this).flash({
    // As always; all settings are entirely optional.
    id			: $(this).attr('id'), // ID
    class		: $(this).attr('class'), // class
    width		: $(this).attr('width'), // Width
    height		: $(this).attr('height'), // Height
    src			: $(this).attr('href'), // Path to swf
    flashvars		: null, // JSON structured flashvars data
    bgcolor		: null, // Background color
    quality		: null, // Quality
    wmode		: null, // Window mode
    allowscriptaccess	: null, // Set to "always" to allow script access across domains
    allowfullscreen	: null, // Allow fullscreen viewing.
    classid		: 'clsid:D27CDB6E-AE6D-11cf-96B8-444553540000', // For IE support.
    codebase		: 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=', // Ditto.
    pluginspace		: 'http://get.adobe.com/flashplayer', // Download Firefox plugin if missing.
    // Custom attributes and parameters are added like this;
    // ['someattributename','someotherattributename']
    //
    // Then add it to the settings just like the ones above were added.
    availattrs		: [], // These are the attributes we should attempt to add.
    availparams		: [], // These are the parameters we should attempt to add.
    // Version is used for flash version detection in conjunction with the express install swf value below.
    version		: '9.0.24', // Minimum Flash version
    express		: null // Path to express install swf
});</pre>
<p><a href="http://www.stephenbelanger.com/wp-content/uploads/2009/12/jquery.flash.js">jquery.flash.js</a> &#8211; Uncompressed<br />
<a href="http://www.stephenbelanger.com/wp-content/uploads/2009/12/jquery.flash.min_.js">jquery.flash.min.js</a> &#8211; Minified</p>
<img src="http://www.stephenbelanger.com/?ak_action=api_record_view&id=29&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.stephenbelanger.com/2009/12/19/jquery-flash-v1-3-is-ready/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>jquery.flash &#8211; Who needs swfobject when you have this?</title>
		<link>http://www.stephenbelanger.com/2009/10/04/jquery-flash-who-needs-swfobject-when-you-have-this/</link>
		<comments>http://www.stephenbelanger.com/2009/10/04/jquery-flash-who-needs-swfobject-when-you-have-this/#comments</comments>
		<pubDate>Sun, 04 Oct 2009 00:17:25 +0000</pubDate>
		<dc:creator>Qard</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Web Programming]]></category>
		<category><![CDATA[jquery.flash]]></category>
		<category><![CDATA[embed]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[swfobject]]></category>
		<guid isPermaLink="false">http://www.stephenbelanger.com/?p=15</guid>
		<description><![CDATA[I've used swfobject many times before in the past, but I just don't like it. It works well, but in the modern web environment of performance-critical web apps and Javascript frameworks that give you elegant access to DOM elements it just feels clunky having to go back to the 'old' way of doing things...so I decided to make jquery.flash!
Why use it? Well for starters it minifies to just over 2 KB, rather than the 10 KB of swfobject! How about automatic plugin and version detection? How about complete cross-browser compatibility? If jquery.flash isn't a perfect fit for your flash embedding needs then you are just asking for too much. ;)]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve used swfobject many times before in the past, but I just don&#8217;t like it. It works well enough, but in the modern web of high-traffic web apps and Javascript frameworks that give you elegant access to DOM elements it just feels clunky having to go back to the &#8216;old&#8217; way of doing things&#8230;so I decided to make jquery.flash!</p>
<p>Why use it? Well for starters it minifies to just over 2 KB, rather than the 10 KB of swfobject! How about automatic plugin and version detection? How about complete cross-browser compatibility? If jquery.flash isn&#8217;t a perfect fit for your flash embedding needs then you are just asking for too much. <img src='http://www.stephenbelanger.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>How do you use it? Just like this;</p>
<pre class="prettyprint">&lt;script type="text/javascript"&gt;
$(document).ready(function(){
    $('.flash').flash({
        "src":"your_flash.swf",
        "width":100,
        "height":100,
        "vars":{"name":"value"},
        "color":"#fff",
        "quality":"high",
        "wmode":"transparent",
        "access":"domain",
        "express":"express_install.swf",
        "classid":"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",
        "codebase":"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=",
        "plugin":"http://get.adobe.com/flashplayer",
        "mime":"application/x-shockwave-flash",
        "version":"9.0.24",
    });
});
&lt;/script&gt;</pre>
<p>All arguments are optional and will just be left out if you don&#8217;t use them unless they have a default. Everything from classid down has a default. Width and Height, when not declared, will use the current dimensions of the element that is being replaced. Flashvars are passed as a json object to &#8216;vars&#8217; and are automatically serialized into a query string. If there is demand for it I may add a check to allow already made query strings to be used instead of a json object, but it wasn&#8217;t really of any importance to me.</p>
<p>If you have any questions feel free to ask. <img src='http://www.stephenbelanger.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><a href="http://www.stephenbelanger.com/wp-content/uploads/2009/10/jquery.flash.js">jquery.flash.js</a><br />
<a href="http://www.stephenbelanger.com/wp-content/uploads/2009/10/jquery.flash.min.js">jquery.flash.min.js</a></p>
<img src="http://www.stephenbelanger.com/?ak_action=api_record_view&id=15&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.stephenbelanger.com/2009/10/04/jquery-flash-who-needs-swfobject-when-you-have-this/feed/</wfw:commentRss>
		<slash:comments>19</slash:comments>
		</item>
	</channel>
</rss>
