<?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>Wil Tan &#187; javascript</title>
	<atom:link href="http://dready.org/blog/category/javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://dready.org/blog</link>
	<description>musings on internationalized identifiers: domain names, OpenID, TLDs</description>
	<lastBuildDate>Thu, 15 Dec 2011 03:42:26 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Optimizing Autocomplete by Utilizing Browser Cache</title>
		<link>http://dready.org/blog/2010/03/29/optimizing-autocomplete-utilizing-browser-cache/</link>
		<comments>http://dready.org/blog/2010/03/29/optimizing-autocomplete-utilizing-browser-cache/#comments</comments>
		<pubDate>Mon, 29 Mar 2010 08:35:59 +0000</pubDate>
		<dc:creator>wil</dc:creator>
				<category><![CDATA[dns]]></category>
		<category><![CDATA[http]]></category>
		<category><![CDATA[icann]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[cache]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[optimization]]></category>
		<category><![CDATA[tuning]]></category>
		<category><![CDATA[webdev]]></category>

		<guid isPermaLink="false">http://dready.org/blog/?p=261</guid>
		<description><![CDATA[Say you have a snazzy AJAXified autocomplete field that gives instantaneous feedback to the user as she types &#8212; perhaps a username field on a signup form or something akin to Google Suggest. Except, it&#8217;s not performing as well as you thought it should. That round trip to the server for each character is taking [...]
No related posts.

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>Say you have a snazzy AJAXified autocomplete field that gives instantaneous feedback to the user as she types &#8212; perhaps a username field on a signup form or something akin to Google Suggest. Except, it&#8217;s not performing as well as you thought it should. That round trip to the server for each character is taking too long.</p>
<p>The first thing you should do is to see if HTTP Keep-Alive is supported by your server.</p>
<p>Second, and this may seem obvious, but I&#8217;ve seen too many developers forget to leave a hint to the browser to cache the results. As a result, the page becomes sluggish due to a feature that&#8217;s meant to be responsive.</p>
<p>See what happens behind the scene when you sign up for a new <a href="https://twitter.com/signup">Twitter account</a>. Suppose you try to register the username &#8220;wil&#8221;, but it&#8217;s taken. For each character you type, the browser makes HTTP requests to check that the username in the input field to see if it&#8217;s available.</p>
<p>So that&#8217;s one for &#8220;w&#8221;, &#8220;wi&#8221;, &#8220;wil&#8221;. Then you find that all 3 are taken. Ok, perhaps time to add a numeric suffix? &#8220;wil1&#8243; &#8211; nope, delete the &#8220;1&#8243;, and we&#8217;re back to &#8220;wil&#8221; again. Guess what? Another HTTP request is sent to Twitter for the same string &#8220;wil&#8221;! </p>
<p>Had Twitter set an &#8220;Expires&#8221; header to usernames that are taken, the browser wouldn&#8217;t have had to make that round trip!</p>
<p>Below are the headers sent by Twitter for the https://twitter.com/users/username_available URI (courtesy of <a href="http://hurl.it/">Hurl</a>):</p>
<p><iframe src="http://hurl.it/views/f24fa9d033f6a17feb1321d1531eea42059d5abb" width="440" height="460" style="overflow: auto"></iframe></p>
<p>In the case of signup forms, usernames are rather involatile pieces of data, so it&#8217;s a prime optimization target. As your namespace becomes more scarce, you&#8217;ll tend to have people trying more strange combinations, increasing the number of requests to your servers.</p>
<p>In my case, I&#8217;ve applied it to our <a href="http://www.cloudregistry.net/">TLD management platform</a>. Domain names that are registered gets a 10 minute cache timeout value (which is heaps short but good enough to ensure a snappy UI operations). However, with domain names, it&#8217;s a lot more volatile but we&#8217;re not guaranteeing success at the point of registering a name so anywhere between 1-5 minutes is usually sufficient.</p>
<p>A simple view snippet in Django does the trick and goes a long way to making your users happy.</p>
<p><script src="http://gist.github.com/347596.js"></script></p>
<p>/ Blogging from a HSDPA connection</p>
<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://dready.org/blog/2010/03/29/optimizing-autocomplete-utilizing-browser-cache/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>GearSaver Bookmarklet</title>
		<link>http://dready.org/blog/2007/07/29/gearsaver-bookmarklet/</link>
		<comments>http://dready.org/blog/2007/07/29/gearsaver-bookmarklet/#comments</comments>
		<pubDate>Sun, 29 Jul 2007 08:04:55 +0000</pubDate>
		<dc:creator>wil</dc:creator>
				<category><![CDATA[gears]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://dready.org/blog/2007/07/29/gearsaver-bookmarklet/</guid>
		<description><![CDATA[Google Gears is one of the most exciting technologies to be released IMO. It will push the web 2.0 envelope further and bring interactive web applications to the next level &#8212; offline! Well, not just offline, the whole point is that you can design your application synchronization strategy. I&#8217;ve been experimenting with it a bit [...]
No related posts.

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p><a href="http://gears.google.com">Google Gears</a> is one of the most exciting technologies to be released IMO. It will push the web 2.0 envelope further and bring interactive web applications to the next level &#8212; offline! Well, not just offline, the whole point is that you can design your application <a href="http://code.google.com/apis/gears/architecture.html">synchronization strategy</a>.</p>
<p>I&#8217;ve been experimenting with it a bit and it&#8217;s surprisingly (Javascript) developer friendly. The end product is a bookmarklet I call GearSaver. It&#8217;s really a shell that injects the gearsaver.js script hosted on my server into the current page that you&#8217;re viewing. It saves all your textareas (be it a blog post or wiki page that you&#8217;re editing, any multi-line text box in a form) into Gears.</p>
<p>This is pre-pre-pre alpha and is only a proof-of-concept, I haven&#8217;t tested it in IE and there isn&#8217;t a way to view the saved results yet. You can, however, use the DB query tool included in the <a href="http://code.google.com/apis/gears/tools.html">gears samples</a> and select the <code>textarea</code> table in the <code>gearsaver</code> database.</p>
<p>This is personally very useful to me because many a time I&#8217;ve lost valuable work in a textarea upon submitting a page and the network goes down. What this does is that it saves a version of each textarea found on the page, indexed by the URL and its xpath. It is also timestamped. My next enhancement would be to have a pull-down menu on each textarea to allow you to revert to older versions.</p>
<p>Without further ado:</p>
<h4>Add the following bookmark and use it on any page: <a href="javascript:(function () { var s=document.createElement('script'); s.src='http://dready.org/projects/gears/gs04/loadbm.js'; document.body.appendChild(s); })(); void(0);">Launch GearSaver</a></h4>
<p><strong>Updated</strong> 20080812: bookmarklet to use version 0.4.</p>
<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://dready.org/blog/2007/07/29/gearsaver-bookmarklet/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

