<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-2516046564281025228</id><updated>2012-02-16T03:54:28.886-08:00</updated><category term='ant'/><category term='javascript'/><category term='java'/><category term='cygwin'/><category term='word-wrap'/><category term='XMLHttpRequest'/><category term='object'/><category term='input'/><category term='viewport'/><category term='gadget'/><category term='url shortener'/><category term='font'/><category term='array'/><category term='firefox'/><category term='blogger'/><category term='css'/><category term='firefox 3'/><category term='webkit'/><category term='bookmarklet'/><category term='extension'/><category term='html'/><category term='ssl'/><category term='certificate'/><category term='textarea'/><category term='update'/><category term='safari'/><title type='text'>CHENG Fu's blog</title><subtitle type='html'>Technology changes life</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://alexcheng1982.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2516046564281025228/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://alexcheng1982.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Alex</name><uri>http://www.blogger.com/profile/13397030000747756998</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>21</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-2516046564281025228.post-4750980644967880906</id><published>2010-01-07T20:24:00.000-08:00</published><updated>2010-01-07T20:27:18.835-08:00</updated><title type='text'>This blog is moved to http://alexcheng1982.wordpress.com/</title><content type='html'>Because Blogger is not accessible in China, I moved the blog to Wordpress. &lt;a href="http://alexcheng1982.wordpress.com/"&gt;http://alexcheng1982.wordpress.com/&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2516046564281025228-4750980644967880906?l=alexcheng1982.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://alexcheng1982.blogspot.com/feeds/4750980644967880906/comments/default' title='帖子评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2516046564281025228&amp;postID=4750980644967880906' title='1 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2516046564281025228/posts/default/4750980644967880906'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2516046564281025228/posts/default/4750980644967880906'/><link rel='alternate' type='text/html' href='http://alexcheng1982.blogspot.com/2010/01/this-blog-is-moved-to.html' title='This blog is moved to http://alexcheng1982.wordpress.com/'/><author><name>Alex</name><uri>http://www.blogger.com/profile/13397030000747756998</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2516046564281025228.post-501239836679230721</id><published>2009-05-13T01:19:00.000-07:00</published><updated>2009-05-13T01:29:06.775-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='html'/><title type='text'>Auto margin on RTL page doesn't work on IE</title><content type='html'>Auto margin is used extensively to center an element horizentally. But it doesn't work on IE for RTL pages.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;A solution is found &lt;a href="http://www.webmasterworld.com/css/3482723.htm"&gt;here&lt;/a&gt; :&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Set the direction of &amp;lt;html&amp;gt; element to "ltr" while setting the direction of &amp;lt;body&amp;gt; element to "rtl". I tried this solution, it works. Great!&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#3333FF;"&gt;html {direction:ltr;} &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#3333FF;"&gt;body {direction:rtl;}&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2516046564281025228-501239836679230721?l=alexcheng1982.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://alexcheng1982.blogspot.com/feeds/501239836679230721/comments/default' title='帖子评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2516046564281025228&amp;postID=501239836679230721' title='2 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2516046564281025228/posts/default/501239836679230721'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2516046564281025228/posts/default/501239836679230721'/><link rel='alternate' type='text/html' href='http://alexcheng1982.blogspot.com/2009/05/auto-margin-on-rtl-page-doesnt-work-on.html' title='Auto margin on RTL page doesn&apos;t work on IE'/><author><name>Alex</name><uri>http://www.blogger.com/profile/13397030000747756998</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2516046564281025228.post-8036135988158185555</id><published>2009-04-22T20:23:00.000-07:00</published><updated>2009-04-22T20:46:48.471-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='url shortener'/><category scheme='http://www.blogger.com/atom/ns#' term='bookmarklet'/><title type='text'>Bookmarklet of URL shortener</title><content type='html'>I created a &lt;a href="http://js-playground.appspot.com/shortenurl/index.html"&gt;bookmarklet&lt;/a&gt; for the url shortener and a &lt;a href="http://js-playground.appspot.com/shortenurl/static/gadget_embed.html"&gt;testing page&lt;/a&gt; for it.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Drag the link below to the bookmark bar.&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;a href="javascript:void((function(){var prevDiv=document.getElementById('__tinyurl_converter__wrapper');if(prevDiv){prevDiv.parentNode.removeChild(prevDiv);};var div=document.createElement('div'),ifr=document.createElement('iframe'),btn=document.createElement('input');div.id='__tinyurl_converter__wrapper';ifr.src='http://js-playground.appspot.com/shortenurl/static/gadget_embed.html';ifr.style.width='370px';ifr.style.height='230px';ifr.style.border='none';div.style.zIndex='9999';div.style.position='fixed';div.style.top='10px';div.style.right='30px';div.style.backgroundColor='#cccccc';div.style.border='1px dashed red';btn.type='button';btn.value='Close';div.appendChild(ifr);div.appendChild(btn);btn.onclick=function(){div.parentNode.removeChild(div);};document.getElementsByTagName('body')[0].appendChild(div);})())"&gt;URL Shortener&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;div&gt;The main motivation behind this small tool is to help me writing tweets. Twitter is smart that it can convert long URLs to short ones using tinyurl, but that only happens when the whole text is shorter than 140 characters, otherwise the "update" button is disabled and you can not go further. So I want this tool which can be accessed quickly in the twitter's page.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2516046564281025228-8036135988158185555?l=alexcheng1982.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://alexcheng1982.blogspot.com/feeds/8036135988158185555/comments/default' title='帖子评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2516046564281025228&amp;postID=8036135988158185555' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2516046564281025228/posts/default/8036135988158185555'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2516046564281025228/posts/default/8036135988158185555'/><link rel='alternate' type='text/html' href='http://alexcheng1982.blogspot.com/2009/04/bookmarklet-of-url-shortener.html' title='Bookmarklet of URL shortener'/><author><name>Alex</name><uri>http://www.blogger.com/profile/13397030000747756998</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2516046564281025228.post-1738313605700589296</id><published>2009-04-22T17:34:00.000-07:00</published><updated>2009-04-22T18:42:35.395-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='url shortener'/><category scheme='http://www.blogger.com/atom/ns#' term='gadget'/><title type='text'>Create a small gadget "URL Shortener"</title><content type='html'>I have to say that there exists &lt;a href="http://www.google.com/ig/directory?q=shortener&amp;amp;hl=en&amp;amp;root=%2Fig&amp;amp;dpos=top"&gt;several gadgets&lt;/a&gt; that do the same thing. Frankly speaking, I don't try them, I just keep telling myself that what I made is the best. &lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;In my gadget, you can choose the URL shortening service to use. Currently, you can choose &lt;a href="http://tinyurl.com/"&gt;tinyurl&lt;/a&gt; or &lt;a href="http://bit.ly/"&gt;bit.ly&lt;/a&gt;. I used GAE to implement the background service, i.e. the scraping thing.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;div&gt;You can try in on my blog, it's on the right side. Or add it to iGoogle via the link below.&lt;br /&gt;&lt;a target="_top" href="http://fusion.google.com/ig/add?synd=open&amp;amp;source=ggyp&amp;amp;moduleurl=http://js-playground.appspot.com/shortenurl/static/shortenurl.xml"&gt;&lt;img style="border: 0pt none ; height: 17px; width: 68px;" src="http://www.gmodules.com/ig/images/plus_google.gif" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;A screenshot:&lt;/div&gt;&lt;div&gt;&lt;img src="http://js-playground.appspot.com/shortenurl/static/images/screenshot.png" style="cursor:pointer; cursor:hand;width: 280px; height: 324px;" border="0" alt="" /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;And the real thing:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;script src="http://www.gmodules.com/ig/ifr?url=http://js-playground.appspot.com/shortenurl/static/shortenurl.xml&amp;amp;up_service=TinyURL&amp;amp;up_displayUrlAsLink=1&amp;amp;synd=open&amp;amp;w=320&amp;amp;h=150&amp;amp;title=URL+Shortener&amp;amp;lang=all&amp;amp;country=ALL&amp;amp;border=http%3A%2F%2Fwww.gmodules.com%2Fig%2Fimages%2F&amp;amp;output=js"&gt;&lt;/script&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2516046564281025228-1738313605700589296?l=alexcheng1982.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://alexcheng1982.blogspot.com/feeds/1738313605700589296/comments/default' title='帖子评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2516046564281025228&amp;postID=1738313605700589296' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2516046564281025228/posts/default/1738313605700589296'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2516046564281025228/posts/default/1738313605700589296'/><link rel='alternate' type='text/html' href='http://alexcheng1982.blogspot.com/2009/04/create-small-gadget-url-shortener.html' title='Create a small gadget &quot;URL Shortener&quot;'/><author><name>Alex</name><uri>http://www.blogger.com/profile/13397030000747756998</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2516046564281025228.post-7085640335007654515</id><published>2009-04-07T07:25:00.000-07:00</published><updated>2009-04-07T07:36:20.176-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='cygwin'/><title type='text'>Paste in Cygwin window</title><content type='html'>I want to paste some text from Windows to Cygwin's bash window, but I don't want to enable the quick edit mode of the command window, because it may lock the command window.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;So I used the context menu to paste the text. Just click the cygwin icon in the top left of the window, you can see the menu. See the screen-shot below.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;img src="http://4.bp.blogspot.com/_AFxjRoN4bRE/SdtkiTv1lNI/AAAAAAAAAF8/DIWdVD6ogVw/s400/paste-cygwin.PNG" style="cursor:pointer; cursor:hand;" border="0" alt="" id="BLOGGER_PHOTO_ID_5321957925247620306" /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2516046564281025228-7085640335007654515?l=alexcheng1982.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://alexcheng1982.blogspot.com/feeds/7085640335007654515/comments/default' title='帖子评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2516046564281025228&amp;postID=7085640335007654515' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2516046564281025228/posts/default/7085640335007654515'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2516046564281025228/posts/default/7085640335007654515'/><link rel='alternate' type='text/html' href='http://alexcheng1982.blogspot.com/2009/04/paste-in-cygwin-window.html' title='Paste in Cygwin window'/><author><name>Alex</name><uri>http://www.blogger.com/profile/13397030000747756998</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_AFxjRoN4bRE/SdtkiTv1lNI/AAAAAAAAAF8/DIWdVD6ogVw/s72-c/paste-cygwin.PNG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2516046564281025228.post-2242765348952126293</id><published>2009-04-07T02:28:00.000-07:00</published><updated>2009-04-07T07:25:14.860-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='viewport'/><title type='text'>Get viewport size using JavaScript</title><content type='html'>The main idea of the JavaScript is stolen from &lt;a href="http://andylangton.co.uk/articles/javascript/get-viewport-size-javascript/"&gt;here&lt;/a&gt;. I just rewrote the code a little to make common path faster.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;function getViewportSize() {&lt;/div&gt;&lt;div&gt;&lt;div&gt;         var w =  (document.documentElement &amp;amp;&amp;amp; document.documentElement.clientWidth) || window.innerWidth || document.getElementsByTagName('body')[0].clientWidth;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;  var h =  (document.documentElement &amp;amp;&amp;amp; document.documentElement.clientHeight) || window.innerHeight || document.getElementsByTagName('body')[0].clientHeight;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;  return {width : w, height : h};&lt;/div&gt;&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;script type="text/javascript"&gt;(function(){function getViewportSize() {var w =  (document.documentElement &amp;&amp; document.documentElement.clientWidth) || window.innerWidth|| document.getElementsByTagName('body')[0].clientWidth;var h =  (document.documentElement &amp;&amp;document.documentElement.clientHeight) || window.innerHeight || document.getElementsByTagName('body')[0].clientHeight;return {width : w, height : h};}function fn() {var ele = document.getElementById("viewport");if (ele) {var s = getViewportSize();ele.innerHTML = "Viewport size: width=" + s.width + ";height=" + s.height;window.clearTimeout(arguments.callee._timeout);}else {arguments.callee._timeout = window.setTimeout(arguments.callee, 500);}}fn();})();&lt;/script&gt;&lt;br /&gt;&lt;span id="viewport" style="color:red;font-size:1.2em;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2516046564281025228-2242765348952126293?l=alexcheng1982.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://alexcheng1982.blogspot.com/feeds/2242765348952126293/comments/default' title='帖子评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2516046564281025228&amp;postID=2242765348952126293' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2516046564281025228/posts/default/2242765348952126293'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2516046564281025228/posts/default/2242765348952126293'/><link rel='alternate' type='text/html' href='http://alexcheng1982.blogspot.com/2009/04/get-viewport-size-using-javascript.html' title='Get viewport size using JavaScript'/><author><name>Alex</name><uri>http://www.blogger.com/profile/13397030000747756998</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2516046564281025228.post-634812035241584003</id><published>2009-04-07T01:11:00.000-07:00</published><updated>2009-04-07T07:38:33.055-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='blogger'/><title type='text'>Add JavaScript code to posts on Blogger</title><content type='html'>&lt;div&gt;&lt;br /&gt;I tried to add some JavaScript code in my post, but it seemed to be harder than I thought. I googled a lot of pages about it and found pages like &lt;a href="http://interestingwebs.blogspot.com/2009/01/jscript-in-blogger-post.html"&gt;[1]&lt;/a&gt;, &lt;a href="http://labnol.blogspot.com/2006/10/blog-hacks-add-javacript-code-in.html"&gt;[2]&lt;/a&gt; and &lt;a href="http://ecmanaut.blogspot.com/2006/01/adding-javascript-to-blogger-posts.html"&gt;[3]&lt;/a&gt;. For JavaScript code that not run immediately after the page is loaded, using plan &amp;lt;script&amp;gt; tag is ok. But my JavaScript code needs to be executed after the page is loaded, I tried the approach using &amp;lt;code&amp;gt;, it didn't work. Then I decided to use window.setTimeout to hack that. It works.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;See the script below, the content of "viewport" is modified by script after the page is loaded. Note, the script should be only one line to avoid &amp;lt;br&gt; tags inserted by Blogger.&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&amp;lt;script type="text/javascript"&amp;gt;function fn() {var ele = document.getElementById("test");if (ele) {ele.innerHTML = "Content set by script ";window.clearTimeout(arguments.callee._timeout);}else {arguments.callee._timeout = window.setTimeout(arguments.callee, 500);}}fn();&amp;lt;/script&amp;gt;&lt;br /&gt;&amp;lt;span id="test"&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;The script in action:&lt;br /&gt;&lt;script type="text/javascript"&gt;(function(){function fn() {var ele = document.getElementById("test");if (ele) {ele.innerHTML = "Content set by script ";window.clearTimeout(arguments.callee._timeout);}else {arguments.callee._timeout = window.setTimeout(arguments.callee, 500);}}fn();})();&lt;/script&gt;&lt;br /&gt;&lt;span id="test"  style="color:red;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2516046564281025228-634812035241584003?l=alexcheng1982.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://alexcheng1982.blogspot.com/feeds/634812035241584003/comments/default' title='帖子评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2516046564281025228&amp;postID=634812035241584003' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2516046564281025228/posts/default/634812035241584003'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2516046564281025228/posts/default/634812035241584003'/><link rel='alternate' type='text/html' href='http://alexcheng1982.blogspot.com/2009/04/document.html' title='Add JavaScript code to posts on Blogger'/><author><name>Alex</name><uri>http://www.blogger.com/profile/13397030000747756998</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2516046564281025228.post-1765659578162328351</id><published>2009-04-03T01:40:00.000-07:00</published><updated>2009-04-03T02:21:42.287-07:00</updated><title type='text'>Yahoo! Search BOSS</title><content type='html'>Yahoo! is continuing to open up its search platform. It has &lt;a href="http://developer.yahoo.com/searchmonkey/"&gt;SearchMonkey&lt;/a&gt;, and now the  &lt;a href="http://developer.yahoo.com/search/boss/index.html"&gt;BOSS&lt;/a&gt;. BOSS means "Build your Own Search Service". It's free now but will have a &lt;a href="http://developer.yahoo.com/search/boss/fees.html"&gt;fee structure&lt;/a&gt; in the near feature.  What interests me is the &lt;a href="http://developer.yahoo.com/search/boss/mashup.html"&gt;mashup framework&lt;/a&gt;, a Python library to manipulate data.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="width:425px;text-align:left" id="__ss_1235311"&gt;&lt;a style="font:14px Helvetica,Arial,Sans-serif;display:block;margin:12px 0 3px 0;text-decoration:underline;" href="http://www.slideshare.net/YahooSearchBlog/yahoo-search-boss-at-alt-search-engines-03-2009?type=presentation" title="Yahoo! Search Boss at Alt Search Engines 03 2009"&gt;Yahoo! Search Boss at Alt Search Engines 03 2009&lt;/a&gt;&lt;object style="margin:0px" width="425" height="355"&gt;&lt;param name="movie" value="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=yahoobossaltsearch0309-090401142756-phpapp01&amp;amp;rel=0&amp;amp;stripped_title=yahoo-search-boss-at-alt-search-engines-03-2009"&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;param name="allowScriptAccess" value="always"&gt;&lt;embed src="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=yahoobossaltsearch0309-090401142756-phpapp01&amp;amp;rel=0&amp;amp;stripped_title=yahoo-search-boss-at-alt-search-engines-03-2009" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="355"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;div style="font-size:11px;font-family:tahoma,arial;height:26px;padding-top:2px;"&gt;View more &lt;a style="text-decoration:underline;" href="http://www.slideshare.net/"&gt;presentations&lt;/a&gt; from &lt;a style="text-decoration:underline;" href="http://www.slideshare.net/YahooSearchBlog"&gt;YahooSearchBlog&lt;/a&gt;.&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2516046564281025228-1765659578162328351?l=alexcheng1982.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://alexcheng1982.blogspot.com/feeds/1765659578162328351/comments/default' title='帖子评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2516046564281025228&amp;postID=1765659578162328351' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2516046564281025228/posts/default/1765659578162328351'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2516046564281025228/posts/default/1765659578162328351'/><link rel='alternate' type='text/html' href='http://alexcheng1982.blogspot.com/2009/04/yahoo-search-boss.html' title='Yahoo! Search BOSS'/><author><name>Alex</name><uri>http://www.blogger.com/profile/13397030000747756998</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2516046564281025228.post-3096668598995173962</id><published>2009-04-02T19:20:00.000-07:00</published><updated>2009-04-02T20:10:28.541-07:00</updated><title type='text'>Apache's Ftp Server</title><content type='html'>Maybe I'm out of date now, but I just found&lt;a href="http://mina.apache.org/ftpserver"&gt; Apache's ftp server&lt;/a&gt; yesterday.  I've tried many ftp servers, such as &lt;a href="http://www.serv-u.com/"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;Serv&lt;/span&gt;-U&lt;/a&gt;, &lt;a href="http://www.cerberusftp.com/"&gt;Cerberus&lt;/a&gt;, and several other home-made software. All these software I used are quite good. But I have to say Apache's ftp server is what I need as a programmer. The GUI is fancy and great, but my favorite is still XML configuration.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Just download the package, unzip it and run the bat script. It's simple but enough. Remember,  &lt;a href="http://en.wikipedia.org/wiki/You_Ain't_Gonna_Need_It"&gt;YAGNI&lt;/a&gt;.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2516046564281025228-3096668598995173962?l=alexcheng1982.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://alexcheng1982.blogspot.com/feeds/3096668598995173962/comments/default' title='帖子评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2516046564281025228&amp;postID=3096668598995173962' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2516046564281025228/posts/default/3096668598995173962'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2516046564281025228/posts/default/3096668598995173962'/><link rel='alternate' type='text/html' href='http://alexcheng1982.blogspot.com/2009/04/apaches-ftp-server.html' title='Apache&apos;s Ftp Server'/><author><name>Alex</name><uri>http://www.blogger.com/profile/13397030000747756998</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2516046564281025228.post-2294541367788612114</id><published>2009-03-24T06:20:00.000-07:00</published><updated>2009-03-24T06:40:56.319-07:00</updated><title type='text'>Maven 2.0.9 doesn't work with IBM JDK 6 SR1 - An interesting problem of JDK</title><content type='html'>&lt;p&gt;I was trying to compile Apache Axiom using Maven 2.0.9. But it didn't work when I was using IBM &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;JDK&lt;/span&gt; 6 SR1.  Then I found this &lt;a href="http://jira.codehaus.org/browse/MNG-3580"&gt;issue&lt;/a&gt;. It turns out to be a very interesting problem with IBM &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_1"&gt;JDK&lt;/span&gt; 6 SR1.&lt;/p&gt;&lt;p&gt;So I repeated the &lt;a href="http://jira.codehaus.org/browse/MNG-3580?focusedCommentId=135705&amp;amp;page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#action_135705"&gt;same test&lt;/a&gt; on my machine.  Yeah, I have to say the output is quite weird. How can you image this kind of problem occurs in the &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_2"&gt;JDK&lt;/span&gt;?&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2516046564281025228-2294541367788612114?l=alexcheng1982.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://alexcheng1982.blogspot.com/feeds/2294541367788612114/comments/default' title='帖子评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2516046564281025228&amp;postID=2294541367788612114' title='2 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2516046564281025228/posts/default/2294541367788612114'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2516046564281025228/posts/default/2294541367788612114'/><link rel='alternate' type='text/html' href='http://alexcheng1982.blogspot.com/2009/03/maven-209-doesnt-work-with-ibm-jdk-6.html' title='Maven 2.0.9 doesn&apos;t work with IBM JDK 6 SR1 - An interesting problem of JDK'/><author><name>Alex</name><uri>http://www.blogger.com/profile/13397030000747756998</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2516046564281025228.post-2770465898618868965</id><published>2009-03-11T19:06:00.000-07:00</published><updated>2009-03-23T23:05:02.503-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='firefox'/><title type='text'>Will web workers be shipped with Firefox 3.1?</title><content type='html'>&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#3366FF;"&gt;Update: The next release of Firefox will be Firefox 3.5 instead of Firefox 3.1.&lt;/span&gt;  See the news : &lt;a href="https://developer.mozilla.org/devnews/index.php/2009/03/05/firefox-31-may-become-firefox-35/" style="text-decoration: none;"&gt;Firefox 3.1 may become Firefox 3.5&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;It has been said for a long time that &lt;a href="http://www.whatwg.org/specs/web-workers/current-work/"&gt;web workers&lt;/a&gt; will be shipped with &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;Firefox&lt;/span&gt; 3.1. That was really a great news. But when I was reading the article of "&lt;a href="https://developer.mozilla.org/En/Using_DOM_workers"&gt;Using web workers&lt;/a&gt;", I found out that it's said in this article that web workers would be shipped with &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_1"&gt;Firefox&lt;/span&gt; 3.5. This change was made in March 6. Any mistakes here or the plan has been changed?  I took a look at the &lt;a href="https://wiki.mozilla.org/Firefox3.1/Features"&gt;plan&lt;/a&gt;, but it seems that the plan is the same.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;See the screen-shot below. The top is the latest version and the bottom is previous version.&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;div&gt;&lt;img src="http://farm4.static.flickr.com/3433/3348366302_3d143e0077_o.png" style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 956px; height: 708px;" border="0" alt="" /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2516046564281025228-2770465898618868965?l=alexcheng1982.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://alexcheng1982.blogspot.com/feeds/2770465898618868965/comments/default' title='帖子评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2516046564281025228&amp;postID=2770465898618868965' title='2 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2516046564281025228/posts/default/2770465898618868965'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2516046564281025228/posts/default/2770465898618868965'/><link rel='alternate' type='text/html' href='http://alexcheng1982.blogspot.com/2009/03/will-web-workers-be-shipped-with.html' title='Will web workers be shipped with Firefox 3.1?'/><author><name>Alex</name><uri>http://www.blogger.com/profile/13397030000747756998</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2516046564281025228.post-648832627671354271</id><published>2009-03-02T01:19:00.000-08:00</published><updated>2009-03-02T01:24:59.843-08:00</updated><title type='text'>Safari 4.0</title><content type='html'>&lt;a href="http://www.apple.com/safari/"&gt;Safari 4.0&lt;/a&gt; public beta is there.  At the first sight, it reminds me of Google Chrome. Just like Chrome, it adds "fast dial" for mostly used web sites. Safari 4.0 calls it as "Top Sites". I think Firefox would provide the same function without the extension "fast dial". &lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I used "&lt;a href="http://stevesouders.com/ua/index.php"&gt;UA Profiler&lt;/a&gt;" to test it and the &lt;a href="http://stevesouders.com/ua/results.php?t=1235985403"&gt;result&lt;/a&gt; shows that Safari 4.0 supports parallel scripts, which is a great improvement to Safari 3.x.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2516046564281025228-648832627671354271?l=alexcheng1982.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://alexcheng1982.blogspot.com/feeds/648832627671354271/comments/default' title='帖子评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2516046564281025228&amp;postID=648832627671354271' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2516046564281025228/posts/default/648832627671354271'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2516046564281025228/posts/default/648832627671354271'/><link rel='alternate' type='text/html' href='http://alexcheng1982.blogspot.com/2009/03/safari-40.html' title='Safari 4.0'/><author><name>Alex</name><uri>http://www.blogger.com/profile/13397030000747756998</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2516046564281025228.post-1256976064388294980</id><published>2009-03-01T20:16:00.000-08:00</published><updated>2009-03-02T00:56:20.725-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='firefox'/><category scheme='http://www.blogger.com/atom/ns#' term='input'/><category scheme='http://www.blogger.com/atom/ns#' term='font'/><category scheme='http://www.blogger.com/atom/ns#' term='textarea'/><title type='text'>Firefox uses different fonts for input and textarea</title><content type='html'>By default, Firefox uses different fonts for input and textarea. If you don't set the font family used by input or textarea, even though the font size of them is identical, the display of text in them is different.  This is because that Firefox uses &lt;a href="http://www.webmasterworld.com/forum83/4080.htm"&gt;monospace fonts for textarea, but variable-width fonts for input&lt;/a&gt;. &lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;So besides setting the font size of input and textarea, you need to set the font family directly in CSS. A sample can be found &lt;a href="http://cakebaker.42dh.com/2006/02/02/some-css-trouble-with-input-and-textarea-in-firefox/"&gt;here&lt;/a&gt;. &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;/div&gt;&lt;blockquote&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(51, 51, 255);"&gt;input, textarea&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(51, 51, 255);"&gt;{&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(51, 51, 255);"&gt;color: red;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(51, 51, 255);"&gt;font-family: Verdana,Arial,Sans-serif;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(51, 51, 255);"&gt;font-size: 0.8em;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(51, 51, 255);"&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;div&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2516046564281025228-1256976064388294980?l=alexcheng1982.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://alexcheng1982.blogspot.com/feeds/1256976064388294980/comments/default' title='帖子评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2516046564281025228&amp;postID=1256976064388294980' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2516046564281025228/posts/default/1256976064388294980'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2516046564281025228/posts/default/1256976064388294980'/><link rel='alternate' type='text/html' href='http://alexcheng1982.blogspot.com/2009/03/blog-post.html' title='Firefox uses different fonts for input and textarea'/><author><name>Alex</name><uri>http://www.blogger.com/profile/13397030000747756998</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2516046564281025228.post-4874960030929071300</id><published>2009-03-01T20:01:00.000-08:00</published><updated>2009-03-02T00:56:02.865-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='firefox'/><title type='text'>Disable Firefox cache</title><content type='html'>Firefox's cache can be quite annoying when you're developing web applications. You may have to manually clear it to let the browser load the latest version of you code.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;So a good approach is to disable it, then you don't need to clear it. A good instruction can be found &lt;a href="http://psychnet.psych.ucla.edu/tutorials/web-browser-configuration/how-to-disable-your-browser-cache"&gt;here&lt;/a&gt;.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Basic steps:&lt;/div&gt;&lt;div&gt;1) Type "about:config" in the address bar&lt;/div&gt;&lt;div&gt;2) Filter the configuration using "cache"&lt;/div&gt;&lt;div&gt;3) Change the value to "false" if it is "true"&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2516046564281025228-4874960030929071300?l=alexcheng1982.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://alexcheng1982.blogspot.com/feeds/4874960030929071300/comments/default' title='帖子评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2516046564281025228&amp;postID=4874960030929071300' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2516046564281025228/posts/default/4874960030929071300'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2516046564281025228/posts/default/4874960030929071300'/><link rel='alternate' type='text/html' href='http://alexcheng1982.blogspot.com/2009/03/disable-firefox-cache.html' title='Disable Firefox cache'/><author><name>Alex</name><uri>http://www.blogger.com/profile/13397030000747756998</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2516046564281025228.post-590502201919847045</id><published>2009-02-23T17:59:00.000-08:00</published><updated>2009-03-02T00:55:47.204-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ant'/><title type='text'>Check directories and files existence in Ant</title><content type='html'>Well, it's common to check whether a directory or file exists before using it in Ant scripts. I just did some quick searches and find out a general solution in &lt;a href="http://mail-archives.apache.org/mod_mbox/ant-user/200510.mbox/%3CA16EE3C99E240B47A59533004DDB57ED090AE3@hgdc1.hgw%3E"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Taks &lt;a href="http://ant.apache.org/manual/CoreTasks/available.html"&gt;&amp;lt;available&amp;gt;&lt;/a&gt;is used.&lt;br /&gt;&lt;br /&gt;Just copy from that post.&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&amp;lt;available file=\"${your.file.path.here}\" property=\"your.file.path.here.present\"/&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;if&amp;gt;&lt;br /&gt;&amp;lt;equals arg1=\"${your.file.path.here.present}\" arg2=\"true\"/&amp;gt;&lt;br /&gt;&amp;lt;then&amp;gt;&lt;br /&gt;&amp;lt;/then&amp;gt;&lt;br /&gt;&amp;lt;else&amp;gt;&lt;br /&gt;&amp;lt;/else&amp;gt;&lt;br /&gt;&amp;lt;/if&amp;gt;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2516046564281025228-590502201919847045?l=alexcheng1982.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://alexcheng1982.blogspot.com/feeds/590502201919847045/comments/default' title='帖子评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2516046564281025228&amp;postID=590502201919847045' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2516046564281025228/posts/default/590502201919847045'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2516046564281025228/posts/default/590502201919847045'/><link rel='alternate' type='text/html' href='http://alexcheng1982.blogspot.com/2009/02/check-directories-and-files-existence.html' title='Check directories and files existence in Ant'/><author><name>Alex</name><uri>http://www.blogger.com/profile/13397030000747756998</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2516046564281025228.post-3787341868531810036</id><published>2008-11-07T02:16:00.000-08:00</published><updated>2008-11-07T05:21:52.718-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='html'/><category scheme='http://www.blogger.com/atom/ns#' term='word-wrap'/><category scheme='http://www.blogger.com/atom/ns#' term='css'/><title type='text'>"Zero Width Space" hack for wrapping words in HTML</title><content type='html'>It's not easy to wrap words in non-IE browsers. IE has its proprietary CSS property : &lt;a href="http://www.brunildo.org/test/IEbreak-word.html"&gt;word-wrap&lt;/a&gt;. But for other browsers, if the word is too long, the text stretches. This is because that the wrapping happens between the words' boundaries, i.e. white spaces.&lt;br /&gt;&lt;br /&gt;A small hack for this is to add "&lt;a href="http://www.fileformat.info/info/unicode/char/200b/index.htm"&gt;Zero Width Space&lt;/a&gt;" between all the characters in the word. By doing this, word wrapping can happen between all the characters, but the users can not see them since the width of the spaces is zero. This can be done by the following small function:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;function breakWords(str) {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;     Array.prototype.slice.apply(str).join("&amp;amp;#8203;​");&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2516046564281025228-3787341868531810036?l=alexcheng1982.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://alexcheng1982.blogspot.com/feeds/3787341868531810036/comments/default' title='帖子评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2516046564281025228&amp;postID=3787341868531810036' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2516046564281025228/posts/default/3787341868531810036'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2516046564281025228/posts/default/3787341868531810036'/><link rel='alternate' type='text/html' href='http://alexcheng1982.blogspot.com/2008/11/zero-width-space-hack-for-wrapping.html' title='&quot;Zero Width Space&quot; hack for wrapping words in HTML'/><author><name>Alex</name><uri>http://www.blogger.com/profile/13397030000747756998</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2516046564281025228.post-5747533173504753193</id><published>2008-10-26T22:53:00.000-07:00</published><updated>2008-10-27T02:32:47.852-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='firefox'/><category scheme='http://www.blogger.com/atom/ns#' term='extension'/><category scheme='http://www.blogger.com/atom/ns#' term='update'/><category scheme='http://www.blogger.com/atom/ns#' term='firefox 3'/><title type='text'>Securing extension updates for Firefox 3</title><content type='html'>If you have an old extension developed for &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;Firefox&lt;/span&gt;&lt;/span&gt; 2, you may have encounter problems when porting it to &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_1"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_1"&gt;Firefox&lt;/span&gt;&lt;/span&gt; 3. One major problem is that you need to provide secure updates for the extension, otherwise the auto-update is disabled. After looking at &lt;a href="https://developer.mozilla.org/en/Extension_Versioning,_Update_and_Compatibility#Securing_Updates"&gt;a good article&lt;/a&gt; from Mozilla, the problem seems easy to attack. Just provide a HTTPS connection for the updates and it's done. Yes, if you have a valid &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_2"&gt;certificate&lt;/span&gt; for HTTPS connection, that should work. But for those use testing certificates, &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_2"&gt;Firefox&lt;/span&gt; can not recognize these certificates and still fails to update the extension.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;So we have to use the complex approach mentioned in the article, i.e. &lt;span class="Apple-style-span" style="font-weight: bold;"&gt;signing the updates. &lt;/span&gt;You need two tools for signing the updates, one is &lt;a href="http://beeblebrox.org/hashtab/"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_3"&gt;HashTab&lt;/span&gt;&lt;/a&gt; ,the other is &lt;a href="https://developer.mozilla.org/en/McCoy"&gt;McCoy&lt;/a&gt;. &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_4"&gt;HashTab&lt;/span&gt; is used to &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_5"&gt;calculate&lt;/span&gt; digital &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_6"&gt;signature&lt;/span&gt; of the &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_7"&gt;XPI&lt;/span&gt; files, while McCoy is used to sign the update manifests. Detailed steps are:&lt;/div&gt;&lt;div&gt;&lt;ol&gt;&lt;li&gt;Use McCoy to create a new key.&lt;/li&gt;&lt;li&gt;Add the key to the install.&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_8"&gt;rdf&lt;/span&gt;. ("Install" button in the toolbar)&lt;/li&gt;&lt;li&gt;Package the &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_9"&gt;XPI&lt;/span&gt; file with the signed install.&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_10"&gt;rdf&lt;/span&gt;.&lt;/li&gt;&lt;li&gt;Use &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_11"&gt;HashTab&lt;/span&gt; to calculate the &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_12"&gt;SHA&lt;/span&gt;1 signature of the &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_13"&gt;XPI&lt;/span&gt; file.&lt;/li&gt;&lt;li&gt;Add &lt;em:updatehash&gt; to the update.&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_14"&gt;rdf&lt;/span&gt; using the &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_15"&gt;signature&lt;/span&gt; calculated in the previous step.&lt;/em:updatehash&gt;&lt;/li&gt;&lt;li&gt;Use McCoy to add the key to the update.&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_16"&gt;rdf&lt;/span&gt; ("Sign" button in the toolbar).&lt;/li&gt;&lt;li&gt;Place the signed &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_17"&gt;XPI&lt;/span&gt; file and update.&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_18"&gt;rdf&lt;/span&gt; to your web server.&lt;/li&gt;&lt;li&gt;Done.&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2516046564281025228-5747533173504753193?l=alexcheng1982.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://alexcheng1982.blogspot.com/feeds/5747533173504753193/comments/default' title='帖子评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2516046564281025228&amp;postID=5747533173504753193' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2516046564281025228/posts/default/5747533173504753193'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2516046564281025228/posts/default/5747533173504753193'/><link rel='alternate' type='text/html' href='http://alexcheng1982.blogspot.com/2008/10/securing-extension-updates-for-firefox.html' title='Securing extension updates for Firefox 3'/><author><name>Alex</name><uri>http://www.blogger.com/profile/13397030000747756998</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2516046564281025228.post-5270695072455800749</id><published>2008-10-20T01:24:00.000-07:00</published><updated>2008-10-27T02:33:23.049-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='firefox'/><category scheme='http://www.blogger.com/atom/ns#' term='extension'/><title type='text'>Host Firefox extensions on Websphere sMash</title><content type='html'>If you want to host &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;firefox&lt;/span&gt; extensions on a &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_1"&gt;Websphere&lt;/span&gt; &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_2"&gt;sMash&lt;/span&gt; server, you need to configure the MIME type of the &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_3"&gt;XPI&lt;/span&gt; files to allow &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_4"&gt;Firefox&lt;/span&gt; to install it automatically.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;This can be done by adding following line in the zero.&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_5"&gt;config&lt;/span&gt; file:&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(51, 51, 255);"&gt;/&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_6"&gt;config&lt;/span&gt;/&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_7"&gt;mimeTypes&lt;/span&gt; += { "&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_8"&gt;xpi&lt;/span&gt;" : "application/x-&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_9"&gt;xpinstall&lt;/span&gt;"}&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2516046564281025228-5270695072455800749?l=alexcheng1982.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://alexcheng1982.blogspot.com/feeds/5270695072455800749/comments/default' title='帖子评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2516046564281025228&amp;postID=5270695072455800749' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2516046564281025228/posts/default/5270695072455800749'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2516046564281025228/posts/default/5270695072455800749'/><link rel='alternate' type='text/html' href='http://alexcheng1982.blogspot.com/2008/10/host-firefox-extensions-on-websphere.html' title='Host Firefox extensions on Websphere sMash'/><author><name>Alex</name><uri>http://www.blogger.com/profile/13397030000747756998</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2516046564281025228.post-5495902706533689442</id><published>2008-10-19T20:08:00.000-07:00</published><updated>2008-10-27T02:34:11.204-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='ssl'/><category scheme='http://www.blogger.com/atom/ns#' term='certificate'/><title type='text'>Fix the "PKIX path building failed" error in handling SSL in Java</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_AFxjRoN4bRE/SPwESUNBYUI/AAAAAAAAAF0/2C8-cyunp4E/s1600-h/ffcertificate.PNG"&gt;&lt;/a&gt;When using &lt;a href="http://hc.apache.org/httpclient-3.x/"&gt;HttpClient&lt;/a&gt; to send requests to servers that employed SSL connections, i.e. the URL starts with "https", it's common to encounter the "PKIX path building failed". This is because that the JRE installed on your machine doesn't have the certificate for the request. You have to add it manually.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;To do this, you need to export the certificates first, then import it into the JRE's store. You can use Firefox to access the site first, then you got its certificate stored in Firefox. Take Firefox 3 for example. You can open the "Options" dialog,  then click the "View Certificates" to open up another dialog which lists all the certificates. Find the one you need and export it in format "X.509 certificate (DER)" to a directory, say "c:\temp". (See figure below)  &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 0, 238); "&gt;&lt;img src="http://1.bp.blogspot.com/_AFxjRoN4bRE/SPwESUNBYUI/AAAAAAAAAF0/2C8-cyunp4E/s400/ffcertificate.PNG" border="0" alt="" id="BLOGGER_PHOTO_ID_5259083177569378626" style="display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; text-align: center; cursor: pointer; " /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;After that, you can use the JRE's &lt;a href="http://java.sun.com/j2se/1.4.2/docs/tooldocs/solaris/keytool.html"&gt;keytool&lt;/a&gt; to import the certificate. A sample command is like:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt; &lt;span class="Apple-style-span" style="color: rgb(51, 102, 255);"&gt;keytool -keystore "C:\Program Files\Java\jre\lib\security\cacerts" -import -alias mycert -file "c:\temp\my.cer" -trustcace&lt;span class="Apple-style-span" style="color: rgb(0, 0, 0); "&gt;&lt;span class="Apple-style-span" style="color: rgb(51, 102, 255);"&gt;rts&lt;/span&gt;. &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The default password is "changeit" if you didn't change it.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;That's all.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2516046564281025228-5495902706533689442?l=alexcheng1982.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://alexcheng1982.blogspot.com/feeds/5495902706533689442/comments/default' title='帖子评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2516046564281025228&amp;postID=5495902706533689442' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2516046564281025228/posts/default/5495902706533689442'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2516046564281025228/posts/default/5495902706533689442'/><link rel='alternate' type='text/html' href='http://alexcheng1982.blogspot.com/2008/10/fix-pkix-path-building-failed-error-in.html' title='Fix the &quot;PKIX path building failed&quot; error in handling SSL in Java'/><author><name>Alex</name><uri>http://www.blogger.com/profile/13397030000747756998</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_AFxjRoN4bRE/SPwESUNBYUI/AAAAAAAAAF0/2C8-cyunp4E/s72-c/ffcertificate.PNG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2516046564281025228.post-5766106564623952000</id><published>2008-10-19T20:00:00.000-07:00</published><updated>2008-10-27T02:34:44.809-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='webkit'/><category scheme='http://www.blogger.com/atom/ns#' term='XMLHttpRequest'/><category scheme='http://www.blogger.com/atom/ns#' term='safari'/><title type='text'>Avoid time-consuming POST/PUT XMLHttpRequest for Safari 3.1 on Mac</title><content type='html'>&lt;span class="Apple-style-span"   style="  white-space: pre; font-family:Arial;font-size:13px;"&gt;Time-consuming POST/PUT XMLHttpRequest causes a problem on Safari 3.1 on Mac. The request will time-out if it&lt;/span&gt;&lt;div&gt;&lt;span class="Apple-style-span"   style="  white-space: pre;font-family:Arial;font-size:13px;"&gt;takes a long time to finish.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"   style="  white-space: pre;font-family:Arial;font-size:13px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"   style="  white-space: pre;font-family:Arial;font-size:13px;"&gt;&lt;a href="https://bugs.webkit.org/show_bug.cgi?id=19758"&gt;A bug&lt;/a&gt; was issued in Webkit's bugzilla and the bug was fixed in Safari's latest build (version 528.x). So you can wait for&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"   style="  white-space: pre;font-family:Arial;font-size:13px;"&gt;the new version of Safari.&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2516046564281025228-5766106564623952000?l=alexcheng1982.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://alexcheng1982.blogspot.com/feeds/5766106564623952000/comments/default' title='帖子评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2516046564281025228&amp;postID=5766106564623952000' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2516046564281025228/posts/default/5766106564623952000'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2516046564281025228/posts/default/5766106564623952000'/><link rel='alternate' type='text/html' href='http://alexcheng1982.blogspot.com/2008/10/avoid-time-consuming-postput.html' title='Avoid time-consuming POST/PUT XMLHttpRequest for Safari 3.1 on Mac'/><author><name>Alex</name><uri>http://www.blogger.com/profile/13397030000747756998</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2516046564281025228.post-6372460890327607720</id><published>2008-10-13T21:47:00.000-07:00</published><updated>2008-10-27T02:34:59.623-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='array'/><category scheme='http://www.blogger.com/atom/ns#' term='object'/><title type='text'>Distinguishing between JavaScript arrays and objects made easier</title><content type='html'>In JavaScript, it's not easy to distinguish between objects and arrays. The "&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;typeof&lt;/span&gt;" operator returns "object" on both cases.  Using the "constructor" property doesn't work neither because the constructors of arrays from different browser windows or frames are not the same, which causes confusing behavior when an array is passed between browser windows as a argument.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;In  &lt;a href="http://www.crockford.com/"&gt;Douglas &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_1"&gt;Crockford&lt;/span&gt;&lt;/a&gt;'s book "&lt;a href="http://www.amazon.com/exec/obidos/ASIN/0596517742/wrrrldwideweb"&gt;JavaScript: The Good Parts&lt;/a&gt;", he used a complex function as below:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style=""&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;var is_array = function (value) {&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style=""&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;    return value &amp;amp;&amp;amp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style=""&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;        &lt;/span&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_2"&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;typeof&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt; value === 'object' &amp;amp;&amp;amp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style=""&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;        &lt;/span&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_3"&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;typeof&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt; value.length === 'number' &amp;amp;&amp;amp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style=""&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;        &lt;/span&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_4"&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;typeof&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt; value.splice === 'function' &amp;amp;&amp;amp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style=""&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;        !(value.&lt;/span&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_5"&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;propertyIsEnumerable&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;('length'));&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style=""&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;};&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;In &lt;a href="http://blog.360.yahoo.com/blog-TBPekxc1dLNy5DOloPfzVvFIVOWMB0li?p=916"&gt;one of his recent blog posts&lt;/a&gt;, he mentioned that &lt;a href="http://www.caplet.com/"&gt;Mark Miller&lt;/a&gt; from Google used a simple approach to do the same thing.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style=""&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;Object.prototype.toString.apply(value) === '[object Array]'&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I went through the &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_6"&gt;ECMAScript&lt;/span&gt; specification and found out the following:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style=""&gt;&lt;span class="Apple-style-span"  style="font-family:'lucida grande';"&gt;The value of the [[Class]] property is defined by this specification for every kind of built-in object. The value of the [[Class]] property of a host object may be any value, even a value used by a built-in object for its [[Class]] property. The value of a [[Class]] property is used internally to distinguish different kinds of built-in objects. Note that this specification does not provide any means for a program to access that value except through Object.prototype.toString.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The [[Class]] property of Array.prototype is "Array" and Object.prototype.toString uses this value to generate the output in the format "[object " + [[Class]] + "]" which results "[object Array]".&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I think the new approach can help us a lot.&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2516046564281025228-6372460890327607720?l=alexcheng1982.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://alexcheng1982.blogspot.com/feeds/6372460890327607720/comments/default' title='帖子评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2516046564281025228&amp;postID=6372460890327607720' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2516046564281025228/posts/default/6372460890327607720'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2516046564281025228/posts/default/6372460890327607720'/><link rel='alternate' type='text/html' href='http://alexcheng1982.blogspot.com/2008/10/distinguishing-between-javascript.html' title='Distinguishing between JavaScript arrays and objects made easier'/><author><name>Alex</name><uri>http://www.blogger.com/profile/13397030000747756998</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
