<?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:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Terence's Weblog</title>
	<atom:link href="http://terenceyim.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://terenceyim.wordpress.com</link>
	<description>Weblog of my programming life</description>
	<pubDate>Wed, 02 Jan 2008 08:25:29 +0000</pubDate>
	<generator>http://wordpress.org/?v=MU</generator>
	<language>en</language>
			<item>
		<title>Cross domain connection manager with same calling mechanism as YUI</title>
		<link>http://terenceyim.wordpress.com/2008/01/02/cross-domain-connection-manager-with-same-calling-mechanism-as-yui/</link>
		<comments>http://terenceyim.wordpress.com/2008/01/02/cross-domain-connection-manager-with-same-calling-mechanism-as-yui/#comments</comments>
		<pubDate>Wed, 02 Jan 2008 08:24:05 +0000</pubDate>
		<dc:creator>terenceyim</dc:creator>
		
		<category><![CDATA[Javascript]]></category>

		<category><![CDATA[asyncRequest]]></category>

		<category><![CDATA[connection]]></category>

		<category><![CDATA[Cross domain]]></category>

		<category><![CDATA[YUI]]></category>

		<guid isPermaLink="false">http://terenceyim.wordpress.com/2008/01/02/cross-domain-connection-manager-with-same-calling-mechanism-as-yui/</guid>
		<description><![CDATA[The YUI connection manager use XMLHttpRequest to make remote call, hence calling cross domain URL is prohibited by the browser security model. This class is to solve this situation without the need to setup any server side proxy, while maintaining the same calling mechanism as the YUI connection manager.
Script source: http://rockstonesand.com/js/crossdomainmanager.js
Minified version: http://rockstonesand.com/js/crossdomainmanager_min.js
Usage: Same as [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>The <a href="http://developer.yahoo.com/yui/connection/">YUI connection manager</a> use <code>XMLHttpRequest</code> to make remote call, hence calling cross domain URL is prohibited by the browser security model. This class is to solve this situation without the need to setup any server side proxy, while maintaining the same calling mechanism as the YUI connection manager.</p>
<p><b>Script source:</b> <a href="http://rockstonesand.com/js/crossdomainmanager.js">http://rockstonesand.com/js/crossdomainmanager.js</a></p>
<p><b>Minified version:</b> <a href="http://rockstonesand.com/js/crossdomainmanager_min.js">http://rockstonesand.com/js/crossdomainmanager_min.js</a></p>
<p><b>Usage:</b> Same as <a href="http://developer.yahoo.com/yui/connection/#async">YUI connection manager</a></p>
<p><b>Functions supported:</b></p>
<pre>asyncRequest, isCallInProgress, abort</pre>
<p><b>Example:</b><br />
<i>Client side:</i></p>
<div style="border:1px solid grey;">
<pre><font color="#008000">&lt;script src="http://rockstonesand.com/js/crossdomainmanager_min.js"&gt;&lt;/script&gt;
&lt;script&gt;
// Same callback object definition as YUI connection manager
var callback = {
    success: function(obj) {
        var response = obj.responseText;
        // Do UI updates
    },
    failure: function(obj) {
    }
};
var txId = CrossDomainConnect.asyncRequest(
   "http://api.flickr.com/services/feeds/photos_public.gne?lang=en-us&amp;format=json",
   callback,
   "jsoncallback");
&lt;/script&gt;</font></pre>
</div>
<p><b>Limitations:</b></p>
<ul>
<li>Only GET method is supported, as it uses script tag hack</li>
<li>The target server side script must support an additional &#8220;callback&#8221; parameter for the connection manager to specify a callback function</li>
</ul>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/terenceyim.wordpress.com/12/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/terenceyim.wordpress.com/12/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/terenceyim.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/terenceyim.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/terenceyim.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/terenceyim.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/terenceyim.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/terenceyim.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/terenceyim.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/terenceyim.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/terenceyim.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/terenceyim.wordpress.com/12/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=terenceyim.wordpress.com&blog=1872500&post=12&subd=terenceyim&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://terenceyim.wordpress.com/2008/01/02/cross-domain-connection-manager-with-same-calling-mechanism-as-yui/feed/</wfw:commentRss>
	
		<media:content url="http://a.wordpress.com/avatar/terenceyim-128.jpg" medium="image">
			<media:title type="html">Terence</media:title>
		</media:content>
	</item>
		<item>
		<title>The Bubbling Technique &#38; Custom Event in YUI</title>
		<link>http://terenceyim.wordpress.com/2007/10/25/the-bubbling-technique-custom-event-in-yui/</link>
		<comments>http://terenceyim.wordpress.com/2007/10/25/the-bubbling-technique-custom-event-in-yui/#comments</comments>
		<pubDate>Thu, 25 Oct 2007 15:35:53 +0000</pubDate>
		<dc:creator>terenceyim</dc:creator>
		
		<category><![CDATA[Javascript]]></category>

		<category><![CDATA[Framework]]></category>

		<category><![CDATA[MVC]]></category>

		<guid isPermaLink="false">http://terenceyim.wordpress.com/2007/10/25/the-bubbling-technique-custom-event-in-yui/</guid>
		<description><![CDATA[Good framework for applying MVC design in Web Application.
http://yuiblog.com/blog/2007/09/13/bubbling-library-by-caridy/
       ]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Good framework for applying MVC design in Web Application.</p>
<p><a href="http://yuiblog.com/blog/2007/09/13/bubbling-library-by-caridy/">http://yuiblog.com/blog/2007/09/13/bubbling-library-by-caridy/</a></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/terenceyim.wordpress.com/9/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/terenceyim.wordpress.com/9/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/terenceyim.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/terenceyim.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/terenceyim.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/terenceyim.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/terenceyim.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/terenceyim.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/terenceyim.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/terenceyim.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/terenceyim.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/terenceyim.wordpress.com/9/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=terenceyim.wordpress.com&blog=1872500&post=9&subd=terenceyim&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://terenceyim.wordpress.com/2007/10/25/the-bubbling-technique-custom-event-in-yui/feed/</wfw:commentRss>
	
		<media:content url="http://a.wordpress.com/avatar/terenceyim-128.jpg" medium="image">
			<media:title type="html">Terence</media:title>
		</media:content>
	</item>
		<item>
		<title>Javascript that crashes IE</title>
		<link>http://terenceyim.wordpress.com/2007/10/09/javascript-that-crashes-ie/</link>
		<comments>http://terenceyim.wordpress.com/2007/10/09/javascript-that-crashes-ie/#comments</comments>
		<pubDate>Tue, 09 Oct 2007 03:49:19 +0000</pubDate>
		<dc:creator>terenceyim</dc:creator>
		
		<category><![CDATA[Javascript]]></category>

		<category><![CDATA[IE crash]]></category>

		<category><![CDATA[script tag hack]]></category>

		<guid isPermaLink="false">http://terenceyim.wordpress.com/2007/10/09/javascript-that-crashes-ie/</guid>
		<description><![CDATA[Recently I was helping my colleague to fix a strange bug in his Javascript. The bug behave like this:

Open the web page in IE.
After everything are loaded (HTML, images, scripts, &#8230;), click on address bar and press enter
IE crashed  

When I try to identify the bug, I&#8217;ve created a simple page that can reproduce [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Recently I was helping my colleague to fix a strange bug in his Javascript. The bug behave like this:</p>
<ol>
<li>Open the web page in IE.</li>
<li>After everything are loaded (HTML, images, scripts, &#8230;), click on address bar and press enter</li>
<li>IE crashed <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </li>
</ol>
<p>When I try to identify the bug, I&#8217;ve created a simple page that can reproduce the bug.</p>
<p><font color="#ff0000">crash.html</font></p>
<pre><font color="#339966">&lt;<span class="start-tag">div</span><span class="attribute-name"> id</span>=<span class="attribute-value">"panel"</span>&gt;&lt;/<span class="end-tag">div</span>&gt;
&lt;<span class="start-tag">a</span><span class="attribute-name"> href</span>=<span class="attribute-value">"#" </span><span class="attribute-name">onclick</span>=<span class="attribute-value">"loadScript(); return false;"</span>&gt;Load script&lt;/<span class="end-tag">a</span>&gt;

&lt;<span class="start-tag">script</span>&gt;
    var n = 0;
    var callback = function() {
        n++;
        var panel = document.getElementById("panel");
        panel.innerHTML = "loadScript called " + n + " times.";
        var node = document.getElementById("testid");
        node.parentNode.removeChild(node);
    }

    var loadScript = function() {
        var node = document.createElement("script");
        node.src="crash.js";
        node.id = "testid";

        document.getElementsByTagName("head")[0].appendChild(node);
    }

    window.onload = loadScript;
&lt;/<span class="end-tag">script</span>&gt;</font></pre>
<p><span id="more-4"></span><font color="#ff0000"> crash.js</font></p>
<pre><!--more--><font color="#339966">callback();</font></pre>
<p><!--more-->What the page does is to create a script node dynamically and insert into the document to load an external .js file. When the external &#8220;crash.js&#8221; is loaded, it calls a function to update the page content and remove the script node. IE will be crashed by either click on the address and hit enter button or just click on the link &#8220;Load script&#8221;.</p>
<p>The actual reason why IE crashes on this situation is unknown, but one thing can be sure is it only crashes if the same URL is being requested. If you try to append a dummy random query to the script src URL, IE is working fine.</p>
<p>I&#8217;ve also discovered another way, which I think is better in solving this problem. Simply use a setTimeout() function to wrap around the removeChild statement with timeout = 0.</p>
<pre><!--more--><font color="#339966">setTimeout(function() {
</font><font color="#339966">    var node = document.getElementById("testid");
    node.parentNode.removeChild(node);
}, 0);</font></pre>
<p>The problem will be gone by doing this.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/terenceyim.wordpress.com/4/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/terenceyim.wordpress.com/4/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/terenceyim.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/terenceyim.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/terenceyim.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/terenceyim.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/terenceyim.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/terenceyim.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/terenceyim.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/terenceyim.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/terenceyim.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/terenceyim.wordpress.com/4/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=terenceyim.wordpress.com&blog=1872500&post=4&subd=terenceyim&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://terenceyim.wordpress.com/2007/10/09/javascript-that-crashes-ie/feed/</wfw:commentRss>
	
		<media:content url="http://a.wordpress.com/avatar/terenceyim-128.jpg" medium="image">
			<media:title type="html">Terence</media:title>
		</media:content>
	</item>
	</channel>
</rss>