<?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>JimmyLi.net &#187; Javascript</title>
	<atom:link href="http://jimmyli.net/category/web/javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://jimmyli.net</link>
	<description></description>
	<lastBuildDate>Thu, 04 Aug 2011 21:40:10 +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>Making a habit of compressing your Javascript</title>
		<link>http://jimmyli.net/2009/06/making-a-habit-of-compressing-your-javascript/</link>
		<comments>http://jimmyli.net/2009/06/making-a-habit-of-compressing-your-javascript/#comments</comments>
		<pubDate>Thu, 04 Jun 2009 08:39:55 +0000</pubDate>
		<dc:creator>Jimmy</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[compress]]></category>
		<category><![CDATA[yui]]></category>

		<guid isPermaLink="false">http://jimmyli.net/?p=41</guid>
		<description><![CDATA[Ever since I&#8217;ve began creating web applications that include more and more Javascript, some of my own, and some such as Javascript libraries and plug-ins, the need for me to optimize the amount of data to transfer to the client becomes more imporatant.  I&#8217;ve found that compressing your Javascript is one of the simpliest things [...]]]></description>
			<content:encoded><![CDATA[<p>Ever since I&#8217;ve began creating web applications that include more and more Javascript, some of my own, and some such as Javascript libraries and plug-ins, the need for me to optimize the amount of data to transfer to the client becomes more imporatant.  I&#8217;ve found that compressing your Javascript is one of the simpliest things you could do and save a few kilobytes on initial page load.</p>
<p>So far, the best compressor I&#8217;ve used is the <a title="YUI Compressor" href="http://developer.yahoo.com/yui/compressor/" target="_blank">YUI Compressor</a>. YUI Compressor compresses Javascript files by stripping out unnecessary whitespaces, semi-colons, and replace local variable names with shorter names, decreasing the size of the file by about 30% in my experience.</p>
<p>The only few ways to run your code through YUI Compressor is through an online service, or by downloading the YUI Compressor to your computer and running it via command line.  I use the command line, but I&#8217;ve made using it a habit and without even having open up command line by just saving the command into my favorite code editors and just assigning a hot key to it. For example, <a title="Notepad++" href="http://notepad-plus.sourceforge.net" target="_blank">Notepad++</a> has a &#8216;Run&#8230;&#8217; option that lets you run external executables and saving that command line to some set of hotkeys (e.g. Ctrl+1).  In the command line arguments, you can set editor-specific variables for the filename, etc. such that executing the command can automatically take your script.js that you&#8217;re working on, compress it, and output a script.min.js file for you in the same directory.  It&#8217;s simple and you don&#8217;t even think about it once you have it all set up.  I&#8217;ve even made it a habit to compress all 3rd party scripts when possible to squeeze a few more kilobytes out of the overall transfer.</p>
<p>Of course there are other ways to save on transfer such as by making sure your server has GZIP compression turned out, and a few other methods, but making a habit of compressing your Javascript is one of the simplist thing you can do and can go a long way in saving a lot of bandwidth and improve user experience with less loading time.</p>
]]></content:encoded>
			<wfw:commentRss>http://jimmyli.net/2009/06/making-a-habit-of-compressing-your-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JSONRequest Proposal</title>
		<link>http://jimmyli.net/2009/03/jsonrequest-proposal/</link>
		<comments>http://jimmyli.net/2009/03/jsonrequest-proposal/#comments</comments>
		<pubDate>Wed, 04 Mar 2009 07:15:22 +0000</pubDate>
		<dc:creator>Jimmy</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[csrf]]></category>
		<category><![CDATA[json]]></category>
		<category><![CDATA[jsonrequest]]></category>
		<category><![CDATA[xhr]]></category>

		<guid isPermaLink="false">http://jimmyli.net/?p=24</guid>
		<description><![CDATA[For the last year to two I&#8217;ve familiarized myself quite a bit with AJAX and was able to leverage its power in providing a seamless user experience with so-called Web 2.0 style of web development and design.  I&#8217;ve began AJAX with simple XMLHttpRequest (XHR) to request HTTP data from the server.  Then, I&#8217;ve stepped up [...]]]></description>
			<content:encoded><![CDATA[<p>For the last year to two I&#8217;ve familiarized myself quite a bit with <a href="http://en.wikipedia.org/wiki/AJAX" target="_blank">AJAX</a> and was able to leverage its power in providing a seamless user experience with so-called Web 2.0 style of web development and design.  I&#8217;ve began AJAX with simple <a href="http://en.wikipedia.org/wiki/Xmlhttprequest" target="_blank">XMLHttpRequest</a> (XHR) to request HTTP data from the server.  Then, I&#8217;ve stepped up my game and utilized the <a title="jQuery" href="http://jquery.com/" target="_blank">jQuery</a> Javascript Library to do AJAX.  One of the best things I loved was the ability to handle a <a href="http://en.wikipedia.org/wiki/Json" target="_blank">JSON</a> data type request from the server.  Unlike a block of XML or HTML, JSON is so flexible as one is able to return many different types of information such as a status code, status message, and any data along with a HTTP Status Code 200 (OK).  I&#8217;ve pretty much defaulted to using JSON as the response type for all my AJAX called through jQuery.</p>
<p>At work, while working with a third-party application for generating personalized websites, the lack of information the system provided, I&#8217;ve tried using AJAX to request information from another server that can request for more information.  Upon discovering that AJAX cannot perform cross-domain requests (Same Origin Policy) due to various security issues that would arise, I&#8217;ve found something called JSONP.  Although it&#8217;s technically not AJAX (it doesn&#8217;t use the XMLHttpRequest object), it was a workable hack-ish workaround the limitations of the current state of AJAX techniques using a GET request that returns a JSON object wrapped in a Javascript callback function.</p>
<p>Today, I&#8217;ve discovered a <a href="http://www.json.org/JSONRequest.html" target="_blank">proposal  by Douglas Crockford for a JSONRequest service</a> that allows cross-domain requests with requests and responses in the form of JSON, minus some of the issues that plagued XMLHttpRequest if it was usable cross-domain.  The big one would be that cookies or HTTP Authentication data would not be sent along with the request, so that prevents <a href="http://en.wikipedia.org/wiki/Cross-site_request_forgery" target="_blank">Cross-Site Request Forgery</a>.  Though the proposal has been created nearly three years ago I&#8217;m surprised that it hasn&#8217;t been implemented in any browsers yet.  I hope a future version of Firefox or some browser would implement it and slowly spread its implementation.</p>
]]></content:encoded>
			<wfw:commentRss>http://jimmyli.net/2009/03/jsonrequest-proposal/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

