<?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-6249111</id><updated>2011-11-28T08:58:35.044+08:00</updated><category term='numenta'/><category term='javascript'/><category term='ai'/><category term='windows shell'/><category term='hosting'/><category term='skype'/><category term='xul'/><category term='textdrive'/><category term='Ajax'/><category term='software development'/><category term='firefox'/><category term='firefox bookmark'/><category term='rdf'/><category term='darcs'/><category term='webcast'/><category term='IFrame'/><category term='python'/><category term='shell'/><category term='extension'/><category term='grep'/><category term='environment variables'/><category term='web.py'/><category term='code structure'/><category term='script'/><category term='Cross-site'/><category term='unicode'/><category term='vim'/><category term='lessons learned'/><category term='database'/><category term='alias'/><category term='cygwin'/><category term='cheetah'/><category term='document'/><category term='programming'/><category term='firefox extension'/><category term='startup'/><category term='mbcs'/><category term='utf-8'/><category term='brain'/><category term='firefox toolbar'/><category term='putty'/><category term='ssh'/><category term='bash'/><category term='pageant'/><category term='jquery'/><category term='rdf:localstore.rdf'/><category term='tags'/><category term='web.  code page'/><category term='dictionary'/><category term='coding'/><category term='investment'/><category term='dreamhost'/><category term='jeff hawkings'/><category term='team'/><category term='mozilla'/><category term='egrep'/><category term='svn'/><title type='text'>The True Delight</title><subtitle type='html'>The true delight is in the finding out rather than in the knowing. -- Isaac Asimov</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://thetruedelight.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6249111/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://thetruedelight.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Alex Dong</name><uri>http://www.blogger.com/profile/15176732470732890411</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>23</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-6249111.post-3920023655758339628</id><published>2010-08-31T17:43:00.001+08:00</published><updated>2010-08-31T17:43:38.797+08:00</updated><title type='text'>Soul Burn !</title><content type='html'>&lt;div style="float: right; margin-left: 10px; margin-bottom: 10px;"&gt;&lt;a href="http://www.flickr.com/photos/httpwwwflickrcomphotos22254138n04/3337725749/" title="photo sharing"&gt;&lt;img src="http://farm4.static.flickr.com/3361/3337725749_73b903b2c0_m.jpg" alt="" style="border: solid 2px #000000;" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-size: 0.9em; margin-top: 0px;"&gt;&lt;a href="http://www.flickr.com/photos/httpwwwflickrcomphotos22254138n04/3337725749/"&gt;Soul Burn !&lt;/a&gt;&lt;br /&gt;Originally uploaded by &lt;a href="http://www.flickr.com/people/httpwwwflickrcomphotos22254138n04/"&gt;Faisal | Photography / (OFF)&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;br clear="all" /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6249111-3920023655758339628?l=thetruedelight.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thetruedelight.blogspot.com/feeds/3920023655758339628/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6249111&amp;postID=3920023655758339628' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6249111/posts/default/3920023655758339628'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6249111/posts/default/3920023655758339628'/><link rel='alternate' type='text/html' href='http://thetruedelight.blogspot.com/2010/08/soul-burn.html' title='Soul Burn !'/><author><name>Alex Dong</name><uri>http://www.blogger.com/profile/15176732470732890411</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://farm4.static.flickr.com/3361/3337725749_73b903b2c0_t.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6249111.post-628956914068475815</id><published>2008-01-21T19:08:00.001+08:00</published><updated>2008-01-21T19:08:09.951+08:00</updated><title type='text'>Bee</title><content type='html'>&lt;div style="float: right; margin-left: 10px; margin-bottom: 10px;"&gt; &lt;a href="http://www.flickr.com/photos/loopzilla/2207145420/" title="photo sharing"&gt;&lt;img src="http://farm3.static.flickr.com/2254/2207145420_1cc50c1d20_m.jpg" alt="" style="border: solid 2px #000000;" /&gt;&lt;/a&gt; &lt;br /&gt; &lt;span style="font-size: 0.9em; margin-top: 0px;"&gt;  &lt;a href="http://www.flickr.com/photos/loopzilla/2207145420/"&gt;Bee&lt;/a&gt;  &lt;br /&gt;  Originally uploaded by &lt;a href="http://www.flickr.com/people/loopzilla/"&gt;LoopZilla&lt;/a&gt; &lt;/span&gt;&lt;/div&gt;Testing out flickr's blog this button.&lt;br clear="all" /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6249111-628956914068475815?l=thetruedelight.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thetruedelight.blogspot.com/feeds/628956914068475815/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6249111&amp;postID=628956914068475815' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6249111/posts/default/628956914068475815'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6249111/posts/default/628956914068475815'/><link rel='alternate' type='text/html' href='http://thetruedelight.blogspot.com/2008/01/bee.html' title='Bee'/><author><name>Alex Dong</name><uri>http://www.blogger.com/profile/15176732470732890411</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://farm3.static.flickr.com/2254/2207145420_1cc50c1d20_t.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6249111.post-589782481506342649</id><published>2007-03-12T12:28:00.000+08:00</published><updated>2007-03-14T10:45:53.262+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Ajax'/><category scheme='http://www.blogger.com/atom/ns#' term='jquery'/><title type='text'></title><content type='html'>Why I prefer JQuery to prototype/script.aculo.us?&lt;br /&gt;&lt;br /&gt;Because it's more pipe friendly, more powerful to traverse the DOM tree and last but not least more maintainable.&lt;br /&gt;&lt;ol&gt;&lt;li&gt;&lt;a href="http://docs.jquery.com/How_jQuery_Works#Chainability_.28The_Magic_of_jQuery.29"&gt;pipe friendly&lt;/a&gt;: Like unix pipe, you could select amazing complicated elements using chains of filters like this: &lt;code&gt;$("a").addClass("test").show().html("foo");&lt;/code&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://docs.jquery.com/DOM/Traversing"&gt;powerful DOM traversal&lt;/a&gt;: Still use &lt;code&gt;for(var i=0;i&lt;l.length;&gt;&lt;/l.length;&gt;&lt;/code&gt; to loop through your list and do something to the parent elements? That's so quaint compared to this &lt;code&gt;$("div#nav span").parents("p").attrs({'font-weight':'bold'})&lt;/code&gt;. Image what could be done by combining this with "chinas of filters"!!&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://docs.jquery.com/How_jQuery_Works#Philosophy:_Find_things.2C_do_stuff"&gt;maintainable&lt;/a&gt;:I was totally blowed away when I first saw jquery's selector syntax. Simple it is, but it allows we use the same CSS/XPath selector syntax in javascript. Combine this with "DOM traversing" &lt;code&gt;parents, prev, sibling&lt;/code&gt; and "Filters" like &lt;code&gt;lt(5), eq(0), gt(4), contains&lt;/code&gt; and you could do magic with only one line of code. Yet more readable.  CodeEye also mentions a couple of very nicely constructed, highly readable selector &lt;a href="http://coderseye.com/2007/jquery-selector-magic.html%22"&gt;here&lt;/a&gt; and a very nice, neat FAQ page built using jquery at &lt;a href="http://coderseye.com/2007/enhancing-faqs-with-jquery.html"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;/li&gt;&lt;/ol&gt;Yes, &lt;span style="font-weight: bold;"&gt;do everything with one line of code and make the code more readable. &lt;/span&gt;This is the magic of jquery.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6249111-589782481506342649?l=thetruedelight.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thetruedelight.blogspot.com/feeds/589782481506342649/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6249111&amp;postID=589782481506342649' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6249111/posts/default/589782481506342649'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6249111/posts/default/589782481506342649'/><link rel='alternate' type='text/html' href='http://thetruedelight.blogspot.com/2007/03/why-i-prefer-jquery-to-prototypescript.html' title=''/><author><name>Alex Dong</name><uri>http://www.blogger.com/profile/15176732470732890411</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-6249111.post-1837825013350948392</id><published>2007-03-09T08:45:00.000+08:00</published><updated>2007-03-09T08:47:35.894+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ai'/><category scheme='http://www.blogger.com/atom/ns#' term='webcast'/><category scheme='http://www.blogger.com/atom/ns#' term='software development'/><category scheme='http://www.blogger.com/atom/ns#' term='numenta'/><category scheme='http://www.blogger.com/atom/ns#' term='brain'/><category scheme='http://www.blogger.com/atom/ns#' term='jeff hawkings'/><title type='text'></title><content type='html'>&lt;p&gt;Jeff Hawkings, the author of On Intelligence and founder of Palm,&lt;br /&gt;founded this new company called "Numenta".  To quote Slashdot [1]:&lt;br /&gt;"Numenta's goal is to build a software model of the human brain&lt;br /&gt;capable of face recognition, object identification, driving, and other&lt;br /&gt;tasks currently best undertaken by humans. "&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Yesterday they released the first version of their free development&lt;br /&gt;platform and the source code for their algorithms to anyone who wants&lt;br /&gt;to download it. [3]   Even better, Numenta offers a three week, one&lt;br /&gt;hour webcast for FREE. [2]. Go and register it if you are interested.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;I've been dreaming of applying his theory into use for a long time,&lt;br /&gt;but just don't have the time/money to build something. Now the time&lt;br /&gt;has come. :-)&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Alex&lt;br /&gt;&lt;/p&gt;1. &lt;a target="_blank" rel="nofollow" href="http://developers.slashdot.org/article.pl?sid=07/03/06/220213"&gt;http://developers.slashdot.org/article.pl?sid=07/03/06/220213&lt;/a&gt;&lt;br /&gt;2. &lt;a target="_blank" rel="nofollow" href="http://www.numenta.com/htm-jumpstart-subscribe.php"&gt;http://www.numenta.com/htm-jumpstart-subscribe.php&lt;/a&gt;&lt;br /&gt;3. &lt;a target="_blank" rel="nofollow" href="http://www.numenta.com/for-developers/software.php"&gt;http://www.numenta.com/for-developers/software.php&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6249111-1837825013350948392?l=thetruedelight.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thetruedelight.blogspot.com/feeds/1837825013350948392/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6249111&amp;postID=1837825013350948392' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6249111/posts/default/1837825013350948392'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6249111/posts/default/1837825013350948392'/><link rel='alternate' type='text/html' href='http://thetruedelight.blogspot.com/2007/03/jeff-hawkings-author-of-on-intelligence.html' title=''/><author><name>Alex Dong</name><uri>http://www.blogger.com/profile/15176732470732890411</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-6249111.post-1076114952497365421</id><published>2007-03-07T07:50:00.000+08:00</published><updated>2007-03-07T07:55:38.374+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='bash'/><category scheme='http://www.blogger.com/atom/ns#' term='grep'/><category scheme='http://www.blogger.com/atom/ns#' term='alias'/><category scheme='http://www.blogger.com/atom/ns#' term='svn'/><title type='text'></title><content type='html'>How to ignore &lt;code&gt;.svn&lt;/code&gt; directories in &lt;code&gt;grep&lt;/code&gt;?&lt;br /&gt;&lt;br /&gt;This has bothered me for a while. A google search &lt;a href="http://svn.haxx.se/users/archive-2004-04/0550.shtml"&gt;shows &lt;/a&gt;two popular implementations to work around this: using &lt;code&gt;grep&lt;/code&gt;'s &lt;code&gt;--exclude&lt;/code&gt; parameter or use &lt;code&gt;find &lt;/code&gt; to filter out the hidden directories. I chose the &lt;code&gt;--exclude&lt;/code&gt; parameter approach since it is pretty neat and easy to integrate into my own bash environment by defining an alias.&lt;br /&gt;&lt;br /&gt;Here is the alias definition in my &lt;code&gt;~/.bash_profile&lt;/code&gt;&lt;br /&gt;&lt;pre&gt;alias g="egrep --exclude=\*.svn\* -r -n "&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6249111-1076114952497365421?l=thetruedelight.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thetruedelight.blogspot.com/feeds/1076114952497365421/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6249111&amp;postID=1076114952497365421' title='9 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6249111/posts/default/1076114952497365421'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6249111/posts/default/1076114952497365421'/><link rel='alternate' type='text/html' href='http://thetruedelight.blogspot.com/2007/03/how-to-ignore.html' title=''/><author><name>Alex Dong</name><uri>http://www.blogger.com/profile/15176732470732890411</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>9</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6249111.post-2696844259529918394</id><published>2007-02-15T21:26:00.000+08:00</published><updated>2007-02-15T21:32:29.789+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='bash'/><category scheme='http://www.blogger.com/atom/ns#' term='ssh'/><category scheme='http://www.blogger.com/atom/ns#' term='dreamhost'/><category scheme='http://www.blogger.com/atom/ns#' term='pageant'/><category scheme='http://www.blogger.com/atom/ns#' term='putty'/><title type='text'></title><content type='html'>Password-less login for dreamhost&lt;br /&gt;It turned out to be fairly easy once I figured out the right manual to refer to. Here are what I've done.&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://blog.dreamhosters.com/kbase/index.cgi?area=138"&gt;Concise guide&lt;/a&gt; to Passwordless Authentication for Windows users&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Add a "putty.exe" shortcut on your quick start bar with &lt;code&gt;`C:\Tools\putty.exe -load "dreamhost"`&lt;/code&gt;&lt;/li&gt;&lt;li&gt;Auto start Pageant.exe&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6249111-2696844259529918394?l=thetruedelight.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thetruedelight.blogspot.com/feeds/2696844259529918394/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6249111&amp;postID=2696844259529918394' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6249111/posts/default/2696844259529918394'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6249111/posts/default/2696844259529918394'/><link rel='alternate' type='text/html' href='http://thetruedelight.blogspot.com/2007/02/password-less-login-for-dreamhost-it.html' title=''/><author><name>Alex Dong</name><uri>http://www.blogger.com/profile/15176732470732890411</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-6249111.post-314419984572729428</id><published>2007-01-28T11:14:00.000+08:00</published><updated>2007-01-28T11:30:51.105+08:00</updated><title type='text'></title><content type='html'>How to add reddit.com button to your blogger account?&lt;br /&gt;&lt;br /&gt;I'm using the new blogger classic template. So YMMV. But the basic idea should be the same.&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Go to "&lt;span style="font-weight: bold;"&gt;Edit Template&lt;/span&gt;"-&gt;"&lt;span style="font-weight: bold;"&gt;Edit HTML&lt;/span&gt;",&lt;/li&gt;&lt;li&gt;Expand all widgets HTML code by checking "&lt;span style="font-weight: bold;"&gt;Expand Widget Templates&lt;/span&gt;"&lt;/li&gt;&lt;li&gt;Scroll down to near the bottom,  replace&lt;span style="font-family:courier new;"&gt;&amp;lt;div class="'post'"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-family:courier new;"&gt;    &amp;lt;a name="'data:post.id'/"&amp;gt;&amp;lt;/a&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;with&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;&amp;lt;div class="'post'"&amp;gt;&amp;lt;a name="'data:post.id'/"&amp;gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    &lt;/span&gt;&amp;lt;/a&amp;gt;&amp;lt;a name="'data:post.id'/"&amp;gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    &amp;lt;script&amp;gt;reddit_url=&lt;span style="font-weight: bold;"&gt;'&amp;lt;data:post.url/&amp;gt;'&lt;/span&gt;;&amp;lt;/script&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    &amp;lt;script language="javascript" src="http://reddit.com/button.js?t=1"&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;&amp;lt;/a&amp;gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6249111-314419984572729428?l=thetruedelight.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thetruedelight.blogspot.com/feeds/314419984572729428/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6249111&amp;postID=314419984572729428' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6249111/posts/default/314419984572729428'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6249111/posts/default/314419984572729428'/><link rel='alternate' type='text/html' href='http://thetruedelight.blogspot.com/2007/01/how-to-add-reddit.html' title=''/><author><name>Alex Dong</name><uri>http://www.blogger.com/profile/15176732470732890411</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-6249111.post-4398952477641371028</id><published>2007-01-28T10:23:00.000+08:00</published><updated>2007-01-28T10:33:59.591+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='tags'/><category scheme='http://www.blogger.com/atom/ns#' term='vim'/><category scheme='http://www.blogger.com/atom/ns#' term='python'/><title type='text'></title><content type='html'>Javascript tags generator: A MUST have for serious Ajax developers using vim&lt;br /&gt;&lt;br /&gt;The following python script could build tags file for your javascript files. It's still version 0.0.1, but it does support extracting most methods and class definitions. Here are a list of the syntax it supports for now. If you find this script misses something, please let me know and I'll add them for you. &lt;br /&gt;&lt;br /&gt;&lt;b&gt;Supported Syntax&lt;/b&gt;&lt;br /&gt;&lt;pre&gt;# - functions&lt;br /&gt;#   * function info(msg) {&lt;br /&gt;#   * info: function(msg) {&lt;br /&gt;# - classes&lt;br /&gt;#   * var logger = {&lt;/pre&gt;&lt;br /&gt;&lt;b&gt;Usage&lt;/b&gt;&lt;br /&gt;&lt;pre&gt;#   jstags.py logger.js&lt;br /&gt;#   ls *.js | jstags.py&lt;br /&gt;#   find ./ -name *.js | jstags.py&lt;/pre&gt;&lt;br /&gt;&lt;b&gt;Source code&lt;/b&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;#! /usr/bin/env python&lt;br /&gt;#&lt;br /&gt;# jstags.py&lt;br /&gt;#&lt;br /&gt;# Create a tags file for javascript programs, usable with vi.&lt;br /&gt;#&lt;br /&gt;# Benefit:&lt;br /&gt;#   Just in case you haven't used tags in vim, you could jump&lt;br /&gt;#   to class/function definition using &lt;ctrl+]&gt; and jump back&lt;br /&gt;#   using &lt;ctrl+t&gt;. Once you start using tags, you can no longer&lt;br /&gt;#   live with it.&lt;br /&gt;&lt;br /&gt;import sys, re, os&lt;br /&gt;tags = []    # Modified global variable!&lt;br /&gt;&lt;br /&gt;def main():&lt;br /&gt;   if sys.stdin: files = [s.strip() for s in sys.stdin.readlines()]&lt;br /&gt;   else: files = sys.argv[1:]&lt;br /&gt;   for filename in files: parse_file(filename)&lt;br /&gt;&lt;br /&gt;   fp = open('tags', 'w')&lt;br /&gt;   fp.write("!_TAG_FILE_FORMAT\t2\n")&lt;br /&gt;   fp.write("!_TAG_FILE_SORTED\t1\n")&lt;br /&gt;   fp.write("!_TAG_PROGRAM_AUTHOR\tAlex Dong\n")&lt;br /&gt;   fp.write("!_TAG_PROGRAM_VERSION\t0.0.1\n")&lt;br /&gt;   fp.write("!_TAG_PROGRAM_URL\thttp://thetruedelight.blogspot.com/2007/01/javascript-tags-generator-must-have-for.html\n")&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;   tags.sort()&lt;br /&gt;   for s in tags: fp.write(s)&lt;br /&gt;&lt;br /&gt;patterns = { re.compile('\s*var\s*(\w+)\s*=\s*{'):'c',&lt;br /&gt;       re.compile('\s*function\s*(\w+)\s*\('):'f',&lt;br /&gt;       re.compile('\s*(\w+)\s*\:\s*function\s*\('):'f'&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;def parse_file(filename):&lt;br /&gt;   fp = open(filename, 'r')&lt;br /&gt;   while 1:&lt;br /&gt;       line = fp.readline()&lt;br /&gt;       if not line: break&lt;br /&gt;&lt;br /&gt;       for pattern in patterns.keys():&lt;br /&gt;           m = pattern.match(line)&lt;br /&gt;           if m:&lt;br /&gt;               c = m.group(0)&lt;br /&gt;               n = m.group(1)&lt;br /&gt;               s = "%s\t%s\t/^%s/;\"\t%s\n" % (n, filename, c, patterns[pattern])&lt;br /&gt;               tags.append(s)&lt;br /&gt;              &lt;br /&gt;   fp.close()&lt;br /&gt;&lt;br /&gt;if __name__ == '__main__':&lt;br /&gt;   main()&lt;/ctrl+t&gt;&lt;/ctrl+]&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/6249111-4398952477641371028?l=thetruedelight.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thetruedelight.blogspot.com/feeds/4398952477641371028/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6249111&amp;postID=4398952477641371028' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6249111/posts/default/4398952477641371028'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6249111/posts/default/4398952477641371028'/><link rel='alternate' type='text/html' href='http://thetruedelight.blogspot.com/2007/01/javascript-tags-generator-must-have-for.html' title=''/><author><name>Alex Dong</name><uri>http://www.blogger.com/profile/15176732470732890411</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-6249111.post-148838910489017606</id><published>2007-01-22T23:13:00.000+08:00</published><updated>2007-01-23T00:08:35.233+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='web.  code page'/><category scheme='http://www.blogger.com/atom/ns#' term='utf-8'/><category scheme='http://www.blogger.com/atom/ns#' term='mbcs'/><category scheme='http://www.blogger.com/atom/ns#' term='unicode'/><category scheme='http://www.blogger.com/atom/ns#' term='python'/><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><category scheme='http://www.blogger.com/atom/ns#' term='database'/><title type='text'></title><content type='html'>Facts about Unicode which you might not know&lt;br /&gt;&lt;ol&gt;&lt;li&gt;There is no such thing called "&lt;span style="font-weight: bold;"&gt;Plain Text&lt;/span&gt;". All text and strings are byte data stored in memory and disk.  So a better word for previous "Ascii string" might be "binary string" or "byte string".&lt;/li&gt;&lt;li&gt;The operation system needs a way to transform &lt;span style="font-style: italic;"&gt;meaningless&lt;/span&gt; in memory binary data into &lt;span style="font-style: italic;"&gt;meaningful &lt;/span&gt;string to display on monitor, print on paper. In the old time before Unicode, this semi-standard byte-to-string mapping table is called "&lt;span style="font-weight: bold;"&gt;Code Page&lt;/span&gt;".&lt;/li&gt;&lt;li&gt;A byte can contain 256 characters with the low 128 characters common agreed as "&lt;span style="font-weight: bold;"&gt;ASCII&lt;/span&gt;" character set, but for the rest 128 characters, different country/culture choose a different way to use them. Thus a 0xc5 should be different in Hebrew and Russian language. &lt;/li&gt;&lt;li&gt;&lt;a href="http://www.joelonsoftware.com/pictures/unicode/oem.png"&gt;IBM PC&lt;/a&gt; has defined one way to use 128-255 byte space, which is common called "&lt;span style="font-weight: bold;"&gt;latin-1&lt;/span&gt;" character set, or "iso-8259-1".  This character set is so standard that many modern softwares, like MySQL, still &lt;a href="http://www.oreillynet.com/onlamp/blog/2006/01/turning_mysql_data_in_latin1_t.html"&gt;makes it the default encoding&lt;/a&gt; for database connection, which causes tons of headaches. Someone even calls it "&lt;a href="http://wordpress.org/support/topic/98766"&gt;Character Set Hell&lt;/a&gt;". &lt;/li&gt;&lt;li&gt;Chinese and other east asia characters requires at least two bytes to represent a word. Thus, the need for a multi-byte string. In Window, this is where the notorious  &lt;span style="font-weight: bold;"&gt;MBCS &lt;/span&gt;comes into play.  Plus the tons of methods in ATL/MFC to convert from one type to another.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;A more precise way for "&lt;span style="font-weight: bold;"&gt;UTF-8&lt;/span&gt;" is "an unicode string encoded using UTF-8 encoding rules".  So first of all, UTF-8 can be used in transmission from one machine to another, but inside a computer, it still needs to be converted into bytes.  UTF-8 is not Unicode.&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;Unicode&lt;/span&gt; is a standard way to define how to represent any given character in memory.  It has &lt;span style="font-style: italic;"&gt;nothing&lt;/span&gt; related to how the character rendered on the monitor or on paper. It's only a world-level unique way to ensure that given any character, no matter it's a Thai, Chinese, Russian, Hebrew or French, there is only one single way to represent it in binary format.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Unicode, as an internal representation, looks like like &lt;code&gt;U+0048 U+0065 U+006C&lt;/code&gt;. When it's &lt;b&gt;encode&lt;/b&gt;d into &lt;i&gt;ASCII&lt;/i&gt; encoding and saved, it'll be the as &lt;code&gt;48 65 6C&lt;/code&gt;.  The ASCII string could, understandably, be &lt;span style="font-weight: bold;"&gt;decode&lt;/span&gt;d into Unicode representation.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;The decode process requires an explicit definition of which encoding the input string is "encoded" in. Otherwise, the system level default encoding will be used. &lt;/li&gt;&lt;li&gt;Major modern database software, Oracle, MSSQL, MySQL, PostgreSQL, SAP DB, Sqlite, all supports storing unicode string as content.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;UTF-8&lt;/span&gt; is a preferable way to transmit and store data in because it has two unique characteristics: 1) UTF-8 is fully compatible with ASCII character set since it either uses one byte for 0-128 characters, or three bytes for the rest. Since most network applications, especially HTTP protocol accepts only ASCII character set, UTF-8 is the only encoding choice that's compatible with these network protocols. 2) UTF-8 contains the same character set as defined in Unicode. The process of encoding Unicode into ASCII is &lt;span style="font-style: italic;"&gt;downcasting&lt;/span&gt; because it shrinks the amount of characters that could be represented. &lt;/li&gt;&lt;li&gt;In order to make your &lt;b&gt;web&lt;/b&gt; pages display correctly, it's recommended to include a &lt;code&gt;META&lt;/code&gt; tag in your HTML code: &lt;code&gt;meta equiv="Content_Type" charset="UTF-8"&lt;/code&gt;. If you're using &lt;b&gt;Apache&lt;/b&gt;, you could add &lt;code&gt;AddDefaultCharset utf-8&lt;/code&gt; into your &lt;code&gt;httpd.conf&lt;/code&gt; to let Apache server add this to all the web pages your website is servicing.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;If you need to make your &lt;span style="font-weight: bold;"&gt;web forms &lt;/span&gt;have multi-lingual support, like Google's search textbox, you'll need to&lt;br /&gt;&lt;/li&gt;&lt;/ol&gt;References&lt;br /&gt;I've done a quite extensive reading on this topic. Basically I found all the articles on this topic and continue reading them until I could no longer find any concepts that's new. Here are a few links I'd recommend:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://www.joelonsoftware.com/articles/Unicode.html"&gt;Joel's absolute minimal unicode paper. A MUST read. &lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://dalchemy.com/opensource/unicodedoc/"&gt;End to end Unicode Web Application in Python.&lt;/a&gt; [&lt;a href="http://www2.blogger.com/dalchemy.com/opensource/unicodedoc/end-to-end_unicode_in_python.pdf"&gt;PDF&lt;/a&gt;}&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6249111-148838910489017606?l=thetruedelight.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thetruedelight.blogspot.com/feeds/148838910489017606/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6249111&amp;postID=148838910489017606' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6249111/posts/default/148838910489017606'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6249111/posts/default/148838910489017606'/><link rel='alternate' type='text/html' href='http://thetruedelight.blogspot.com/2007/01/facts-about-unicode-which-you-might-not.html' title=''/><author><name>Alex Dong</name><uri>http://www.blogger.com/profile/15176732470732890411</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-6249111.post-7548705937232191709</id><published>2007-01-09T15:18:00.000+08:00</published><updated>2007-01-09T16:51:05.988+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='darcs'/><category scheme='http://www.blogger.com/atom/ns#' term='bash'/><category scheme='http://www.blogger.com/atom/ns#' term='shell'/><title type='text'></title><content type='html'>Bash Alias for Darcs users&lt;br /&gt;&lt;br /&gt;I've been using &lt;a href="http://abridgegame.org/darcs/"&gt;darcs&lt;/a&gt; for quite a while. I really love its simplicity and distributed nature. I found myself repeating myself again and again typing basic darcs commands after using the techniques described in this &lt;a href="http://www2.blogger.com/www.oreillynet.com/onlamp/blog/2007/01/whats_in_your_bash_history.html"&gt;excellent blog&lt;/a&gt;. Here are a few additions I added to my &lt;code&gt;~/.bash_profile&lt;/code&gt; to minimize the types I need to make. Explanations in lines.&lt;br /&gt;&lt;code&gt;&lt;br /&gt;# Setup editor environment editors to let darcs know.&lt;br /&gt;EDITOR=gvim&lt;br /&gt;VISUAL=gvim&lt;br /&gt;export EDITOR VISUAL&lt;br /&gt;&lt;br /&gt;# My typical patch naming convention is {year-month-date-hour-min-sec}.&lt;br /&gt;# instead of manually making on up every commit, I'd like to automate it.&lt;br /&gt;PATCHNAME=$(date +%Y%m%d%k%M%S)&lt;br /&gt;&lt;br /&gt;# 'commit' will tell darcs to record all (-a) changes using the patch name as mentioned above.&lt;br /&gt;#   we also tell the darcs command to launch our default EDITOR to let us add a long comment.&lt;br /&gt;#   last, we'd like to add a signature to the patch by associated with our email address&lt;br /&gt;alias commit='darcs record -a --patch-name=$PATCHNAME --edit-long-comment --author=alex.dong@you-mail.com'&lt;br /&gt;alias diff='darcs whatsnew | less'&lt;br /&gt;&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6249111-7548705937232191709?l=thetruedelight.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thetruedelight.blogspot.com/feeds/7548705937232191709/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6249111&amp;postID=7548705937232191709' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6249111/posts/default/7548705937232191709'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6249111/posts/default/7548705937232191709'/><link rel='alternate' type='text/html' href='http://thetruedelight.blogspot.com/2007/01/bash-alias-for-darcs-users-ive-been.html' title=''/><author><name>Alex Dong</name><uri>http://www.blogger.com/profile/15176732470732890411</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>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6249111.post-729337568574756885</id><published>2007-01-05T22:33:00.000+08:00</published><updated>2007-01-05T23:29:16.208+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Ajax'/><category scheme='http://www.blogger.com/atom/ns#' term='document'/><category scheme='http://www.blogger.com/atom/ns#' term='mozilla'/><category scheme='http://www.blogger.com/atom/ns#' term='coding'/><title type='text'></title><content type='html'>The Tale of Two Document&lt;br /&gt;&lt;br /&gt;This afternoon, I spent three hours figuring out what's the different between &lt;code&gt;window.document&lt;/code&gt; and &lt;code&gt;content.document&lt;/code&gt; from Mozilla or FireFox extension's point of view. Figuring this out solves lots of my questions or "why the heck this doesn't work" wonders. This article explains what are the differences, when to use which and ends with some very practical kludges that I've found quite handy.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;Document? Which document?&lt;/span&gt;&lt;br /&gt;My previous Ajax experience told me that &lt;code&gt;document&lt;/code&gt; is the HTML document, aka the DOM model, which I could modify the node attribute, change element layout, or remove one. When I write &lt;code&gt;document.getElementById('sidebar')&lt;/code&gt;, I mean find an element whose id is &lt;code&gt;sidebar&lt;/code&gt;. This is &lt;em&gt;the&lt;/em&gt; &lt;code&gt;document&lt;/code&gt;. But, in the Mozilla's world, this could cause you big trouble as I did.&lt;br /&gt;&lt;br /&gt;In Mozilla's point of view, the whole browser &lt;em&gt;is&lt;/em&gt; a rendered DOM tree. Which means that the menu, the toolbar, the status bar are all elements on a DOM tree. When you add a toolbar, you're inserting a &lt;code&gt;toolbar&lt;/code&gt; element into the DOM tree. When you see the status bar, you're actually looking at a &lt;code&gt;label&lt;/code&gt;. This is the beauty of XUL and Mozilla, the extensible architecture where other wonderful technologies like &lt;code&gt;RDF, XBL,&lt;/code&gt; and &lt;code&gt;overlay&lt;/code&gt;.  Now when you write &lt;code&gt;document.getElementById&lt;/code&gt;, the document is not referring to the &lt;code&gt;HTMLDocument&lt;/code&gt;. But it's referring to &lt;code&gt;XULDocument&lt;/code&gt;, which represents the current browser window, aka &lt;em&gt;the&lt;/em&gt; &lt;code&gt;chromeWindow&lt;/code&gt;.&lt;br /&gt;&lt;br /&gt;Here is a concrete example. Run this and you'll see a "hello" showing up on your status bar. &lt;code&gt;window.document.getElementById('statusbar-display').label="hello";&lt;/code&gt; If you want to try this out,  paste this into your &lt;a href="http://www.squarefree.com/"&gt;Javascript Environment&lt;/a&gt; which comes along with &lt;a href="http://thetruedelight.blogspot.com/2006/12/setup-firefox-extension-development.html"&gt;FireFox Extension Development add-on&lt;/a&gt;. If you don't have it, get it now.&lt;br /&gt;&lt;br /&gt;The &lt;code&gt;statusbar-display&lt;/code&gt; is &lt;em&gt;the&lt;/em&gt; left most status pane in your firefox, where you could find "Transferring data from ...". So here the &lt;code&gt;window.document&lt;/code&gt; points to the current &lt;code&gt;ChromeWindow&lt;/code&gt;'s document, which is the &lt;code&gt;XULDocument&lt;/code&gt;. Your HTML document doesn't and probably won't have an element with id like that.&lt;br /&gt;&lt;br /&gt;Then, how could I get a pointer to the HTML document? Use &lt;code&gt;window.content.document&lt;/code&gt;. If you see &lt;code&gt;_content&lt;/code&gt;, it's an obsolete way of representing the HTML DOM tree.  As a result, in order to find the &lt;code&gt;sidebar&lt;/code&gt; in the current HTML document, you need to write the code like this: &lt;code&gt;window.content.document.GetElementById("sidebar");&lt;/code&gt;, where the &lt;code&gt;content&lt;/code&gt; means the real &lt;em&gt;content&lt;/em&gt; instead of the &lt;em&gt;user interface&lt;/em&gt;.&lt;br /&gt;&lt;br /&gt;This script explains it much better:&lt;code&gt;&lt;br /&gt;print(window);&lt;br /&gt;print(window.content);&lt;br /&gt;print(window.content.document);&lt;br /&gt;print(window.document);&lt;/code&gt;&lt;code&gt;&lt;/code&gt;&lt;br /&gt;Here is the output:&lt;code&gt;&lt;br /&gt;[object ChromeWindow]&lt;br /&gt;[object Window]&lt;br /&gt;[object HTMLDocument]&lt;br /&gt;[object XULDocument]&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;Shorthand for &lt;code&gt;window.content&lt;/code&gt; vs &lt;code&gt;window.document&lt;/code&gt;&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;code&gt;window.content&lt;/code&gt; can be written as &lt;code&gt;content&lt;/code&gt; when there is only one window.  The &lt;code&gt;window&lt;/code&gt; is the current &lt;code&gt;window&lt;/code&gt; or &lt;code&gt;frame&lt;/code&gt; which the document is contained. If you are working on a multi-frame document, you'll have to write code like &lt;code&gt;framelist[i].document&lt;/code&gt;. &lt;/li&gt;&lt;li&gt;&lt;code&gt;window.document&lt;/code&gt; can be written as &lt;code&gt;document&lt;/code&gt; because of the same reason explained above.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-size:130%;"&gt;Event Handling&lt;/span&gt;&lt;br /&gt;In Ajax, if we want to install an event handler for &lt;code&gt;keypress&lt;/code&gt; event, here is what we'll do: &lt;code&gt;document.onkeypress = function(event) { ... }&lt;/code&gt;.  But in Mozilla world, you can't hook the event up with &lt;code&gt;HTMLDocument&lt;/code&gt; directly. This works find in the Javascript Environment, but it just doesn't work in your extension javascript code. (&lt;small&gt;My environment is Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1)&lt;/small&gt;.  To get it working, you will have to hook the event handler up with &lt;code&gt;window.document&lt;/code&gt;.&lt;br /&gt;&lt;br /&gt;One side effect of this is that now the event will be triggered for both the content in HTML &lt;em&gt;and&lt;/em&gt; the controls in the browser's toolbar, status bar. If your event handler is to delete the element by clicking on it, you could delete the toolbar buttons one by one by clicking through the buttons! &lt;br /&gt;&lt;br /&gt;I didn't find a good or official solution to this problem so if you know a better way to do this, please definitely let me know.  Here is my kludge which just works.&lt;code&gt;&lt;br /&gt;function onclick(event) {&lt;br /&gt;    if (event.target.toString().indexOf('XULElement')&gt;=0) return;&lt;br /&gt;    // now, do whatever you want.&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6249111-729337568574756885?l=thetruedelight.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thetruedelight.blogspot.com/feeds/729337568574756885/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6249111&amp;postID=729337568574756885' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6249111/posts/default/729337568574756885'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6249111/posts/default/729337568574756885'/><link rel='alternate' type='text/html' href='http://thetruedelight.blogspot.com/2007/01/tale-of-two-document-this-afternoon-i.html' title=''/><author><name>Alex Dong</name><uri>http://www.blogger.com/profile/15176732470732890411</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-6249111.post-9123901279492857190</id><published>2006-12-26T10:42:00.000+08:00</published><updated>2007-02-05T21:46:26.591+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='windows shell'/><category scheme='http://www.blogger.com/atom/ns#' term='cygwin'/><title type='text'></title><content type='html'>Simplest way to add "Cygwin Prompt Here" to Windows Explorer&lt;br /&gt;&lt;br /&gt;Just like &lt;a href="http://www.ericsink.com/item_10187.html"&gt;Eric Sink&lt;/a&gt;, the first thing I install on my windows laptop is Cygwin and, well not Emacs anymore, gvim.  I just can't image using windows so pre-mature shell to get anything done. One little problem with Cygwin is since it uses a unix like directory structure, switching back and forth between Windows Explorer and Cygwin has been a pain in the ass for a long time.  Now, time to scratch the itch.&lt;br /&gt;&lt;br /&gt;A quick Google search redirects me to &lt;a href="http://www.mindview.net/Etc/Cygwin/BashHere"&gt;Bruce Eckel's article&lt;/a&gt; on this same problem. It proposes two solutions but unfortunately none of them works perfectly on my environment. After hacking around, here is my solution. Different from the existing ones, this is the simplest solution I could find so far. No .bashrc, no .bat file, only one tiny .reg file. Enjoy it and see my code comments in lines.&lt;br /&gt;&lt;code&gt;&lt;br /&gt;Windows Registry Editor Version 5.00&lt;br /&gt;[HKEY_CLASSES_ROOT\Folder\shell\Cmd Here]&lt;br /&gt;@="Cygwin &amp;Prompt Here"&lt;br /&gt;[HKEY_CLASSES_ROOT\Folder\shell\Cmd Here\command]&lt;br /&gt;@="cmd.exe /c c:\\cygwin\\bin\\bash.exe --login -c \"cd '%1'; exec /bin/bash\""&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Notes:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Save the above text into any reg in any folder, double click it and you should be all set. (Assuming you're using the Cygwin default installation path, of course.)&lt;/li&gt;&lt;li&gt;&lt;code&gt;cmd.exe /c&lt;/code&gt; : launch the cmd.exe and execute the command after the &lt;code&gt;/c&lt;/code&gt; parameter. Close the command window when the bash exits.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;code&gt;bash.exe --login&lt;/code&gt; :load the user settings for the login user. &lt;code&gt;-c&lt;/code&gt; means to execute the commands after login. &lt;/li&gt;&lt;li&gt;&lt;code&gt;cd %1;&lt;/code&gt; :retrieve the folder path from Windows Explorer&lt;/li&gt;&lt;li&gt;&lt;code&gt;exec /bin/bash&lt;/code&gt;: to open the bash environment. &lt;/li&gt;&lt;/ol&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6249111-9123901279492857190?l=thetruedelight.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thetruedelight.blogspot.com/feeds/9123901279492857190/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6249111&amp;postID=9123901279492857190' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6249111/posts/default/9123901279492857190'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6249111/posts/default/9123901279492857190'/><link rel='alternate' type='text/html' href='http://thetruedelight.blogspot.com/2006/12/simplest-way-to-add-cygwin-prompt-here.html' title=''/><author><name>Alex Dong</name><uri>http://www.blogger.com/profile/15176732470732890411</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>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6249111.post-4864401629560159324</id><published>2006-12-25T12:07:00.000+08:00</published><updated>2006-12-25T12:19:41.806+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='firefox extension'/><category scheme='http://www.blogger.com/atom/ns#' term='rdf:localstore.rdf'/><category scheme='http://www.blogger.com/atom/ns#' term='firefox toolbar'/><category scheme='http://www.blogger.com/atom/ns#' term='mozilla'/><title type='text'></title><content type='html'>How to automatically install a button onto FireFox Toolbar?&lt;br /&gt;&lt;br /&gt;Here are some facts about rdf:local-store in Mozilla architecture from &lt;a href="http://www.xulplanet.com/tutorials/mozsdk/rdfsrcdetails.php"&gt;XULPlanet:&lt;/a&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;The datasource &lt;span class="aval"&gt;rdf:local-store&lt;/span&gt; is included with Mozilla and is used to hold state information such as the position of the browser window, which columns in tree views are displayed, and which toolbars and sidebars are displayed.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;This information is saved when Mozilla exits, and is re-applied automatically to the XUL content when the appropriate window is opened again.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Although the local store normally holds XUL state information, you can actually put anything you want into it.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;The local store is saved to an RDF/XML file 'localstore.rdf' in your Mozilla profile directory. Since it's an RDF/XML file, you can open it in a text editor and view the information it contains. It's possible to modify the file as well, although that isn't&lt;/li&gt;&lt;/ul&gt;So the answer to our question on how to add a button to the browser's toolbar lies in the localstore.rdf file.  Open the file and find the triple, or assertion, on &lt;code&gt;chrome://browser/content/browser.xul#nav-bar&lt;/code&gt; and you should be able to see something like this:&lt;code&gt;&lt;br /&gt;RDF:Description &lt;br /&gt;    RDF:about="chrome://browser/content/browser.xul#nav-bar"&lt;br /&gt;    mode="icons"&lt;br /&gt;    currentset="back-button,forward-button,reload-button,search-container"&lt;/code&gt;&lt;br /&gt;Just add your toolbar 'ID' to the &lt;code&gt;currentset&lt;/code&gt; and you're done.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6249111-4864401629560159324?l=thetruedelight.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thetruedelight.blogspot.com/feeds/4864401629560159324/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6249111&amp;postID=4864401629560159324' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6249111/posts/default/4864401629560159324'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6249111/posts/default/4864401629560159324'/><link rel='alternate' type='text/html' href='http://thetruedelight.blogspot.com/2006/12/how-to-automatically-install-button.html' title=''/><author><name>Alex Dong</name><uri>http://www.blogger.com/profile/15176732470732890411</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-6249111.post-5087929502895349773</id><published>2006-12-24T23:44:00.000+08:00</published><updated>2006-12-24T23:46:38.093+08: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='rdf'/><category scheme='http://www.blogger.com/atom/ns#' term='mozilla'/><title type='text'></title><content type='html'>RDF support in Mozilla&lt;br /&gt;&lt;br /&gt;&lt;p&gt;     &lt;code&gt;&lt;a href="http://lxr.mozilla.org/seamonkey/source/rdf/base/idl/nsIRDFService.idl"&gt;nsIRDFSerivce&lt;/a&gt;&lt;/code&gt;.      The RDF service is an utility interface that serves three primary     purposes.  First, it is used to manage “named”     datasources. A named datasource is a singleton datasource that can     be acquired using simple URI-like name &lt;a href="http://www.mozilla.org/rdf/back-end-architecture.html#4"&gt;[4]&lt;/a&gt;;     e.g., &lt;code&gt;rdf:bookmarks&lt;/code&gt;.  Second, it is used to implement     the function that maps a URI to a resource (which is     the &lt;i&gt;inverse&lt;/i&gt; of the one-to-one resource-to-URI function     described above).  Third, it is used to implement the function     that maps a string value to a literal (similarly, the inverse of     the one-to-one literal-to-string function described above).    &lt;/p&gt;     &lt;p&gt;     &lt;code&gt;&lt;a href="http://lxr.mozilla.org/seamonkey/source/rdf/base/idl/nsIRDFNode.idl"&gt;nsIRDFNode&lt;/a&gt;&lt;/code&gt;.      This is an interface for a node in the RDF graph. A node must     either be an      &lt;code&gt;&lt;a href="http://lxr.mozilla.org/seamonkey/source/rdf/base/idl/nsIRDFResource.idl"&gt;nsIRDFResource&lt;/a&gt;&lt;/code&gt;      or an      &lt;code&gt;&lt;a href="http://lxr.mozilla.org/seamonkey/source/rdf/base/idl/nsIRDFLiteral.idl"&gt;nsIRDFLiteral&lt;/a&gt;&lt;/code&gt; &lt;a href="http://www.mozilla.org/rdf/back-end-architecture.html#5"&gt;[5]&lt;/a&gt;.      Objects that implement these interfaces &lt;i&gt;must&lt;/i&gt; be acquired     from the &lt;code&gt;nsIRDFService&lt;/code&gt;.    &lt;/p&gt;     &lt;p&gt;     &lt;code&gt;&lt;a href="http://lxr.mozilla.org/seamonkey/source/rdf/base/idl/nsIRDFDataSource.idl"&gt;nsIRDFDataSource&lt;/a&gt;&lt;/code&gt;.      This is the interface that provides access to a collection of     “related statements” (or a     “subgraph”). This interface includes methods that     allow testing for the presence of a statement, enumerating the     statements contained in the collection, and adding and removing     statements to the set.    &lt;/p&gt;     &lt;p&gt;     &lt;code&gt;&lt;a href="http://lxr.mozilla.org/seamonkey/source/rdf/base/idl/nsIRDFCompositeDataSource.idl"&gt;nsIRDFCompositeDataSource&lt;/a&gt;&lt;/code&gt;.       This interface is derived from &lt;code&gt;nsIRDFDataSource&lt;/code&gt;. An     implementation of this interface will typically combine the statements     from several datasources together as a collective.  Because the     &lt;code&gt;nsIRDFCompositeDataSource&lt;/code&gt; interface is derived from     &lt;code&gt;nsIRDFDataSource&lt;/code&gt;, it can be queried and modified just     like an individual data source.    &lt;/p&gt;     &lt;p&gt;     &lt;code&gt;&lt;a href="http://lxr.mozilla.org/seamonkey/source/rdf/base/idl/nsIRDFObserver.idl"&gt;nsIRDFObserver&lt;/a&gt;&lt;/code&gt;.      This is an interface that an RDF &lt;i&gt;client&lt;/i&gt; implements. The     interface allows a client to be notified when a change occurs to     the statements in a datasource.    &lt;/p&gt;     &lt;p&gt;     &lt;code&gt;&lt;a href="http://lxr.mozilla.org/seamonkey/source/rdf/base/idl/nsIRDFContainer.idl"&gt;nsIRDFContainer&lt;/a&gt;&lt;/code&gt;.      This is an interface that allows for simplified access to an RDF     &lt;i&gt;container&lt;/i&gt; object (a &lt;i&gt;bag&lt;/i&gt;, &lt;i&gt;sequence&lt;/i&gt;, or     &lt;i&gt;alternation&lt;/i&gt;). This interface, in conjunction with      &lt;code&gt;&lt;a href="http://lxr.mozilla.org/seamonkey/source/rdf/base/idl/nsIRDFContainerUtils.idl"&gt;nsIRDFContainerUtils&lt;/a&gt;&lt;/code&gt;      provide straightforward, Java vector-esque methods for     manipulating and querying RDF container objects.&lt;/p&gt;&lt;p&gt;&lt;/p&gt;I've also updated a few sections on &lt;a href="http://developer.mozilla.org/en/docs/RDF_in_Mozilla_FAQ#How_do_I_merge_two_or_more_datasources_to_view_them_as_one.3F"&gt;MDC's RDF FAQ&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6249111-5087929502895349773?l=thetruedelight.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thetruedelight.blogspot.com/feeds/5087929502895349773/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6249111&amp;postID=5087929502895349773' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6249111/posts/default/5087929502895349773'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6249111/posts/default/5087929502895349773'/><link rel='alternate' type='text/html' href='http://thetruedelight.blogspot.com/2006/12/rdf-support-in-mozilla-nsirdfserivce.html' title=''/><author><name>Alex Dong</name><uri>http://www.blogger.com/profile/15176732470732890411</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-6249111.post-2298440542512240492</id><published>2006-12-20T21:55:00.000+08:00</published><updated>2006-12-20T21:58:16.260+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='firefox extension'/><category scheme='http://www.blogger.com/atom/ns#' term='xul'/><category scheme='http://www.blogger.com/atom/ns#' term='vim'/><title type='text'></title><content type='html'>Setup FireFox Extension Development Environment&lt;br /&gt;&lt;br /&gt;I've found that these links are very helpful:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Official guide: &lt;a href="http://kb.mozillazine.org/Setting_up_extension_development_environment"&gt;http://kb.mozillazine.org/Setting_up_extension_development_environment&lt;/a&gt;&lt;/li&gt;&lt;li&gt;VIM XUL syntax file: &lt;a href="http://www.vim.org/scripts/script.php?script_id=241"&gt;http://www.vim.org/scripts/script.php?script_id=241&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6249111-2298440542512240492?l=thetruedelight.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thetruedelight.blogspot.com/feeds/2298440542512240492/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6249111&amp;postID=2298440542512240492' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6249111/posts/default/2298440542512240492'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6249111/posts/default/2298440542512240492'/><link rel='alternate' type='text/html' href='http://thetruedelight.blogspot.com/2006/12/setup-firefox-extension-development.html' title=''/><author><name>Alex Dong</name><uri>http://www.blogger.com/profile/15176732470732890411</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-6249111.post-5674483498828338404</id><published>2006-12-20T16:43:00.000+08:00</published><updated>2006-12-20T21:14:19.966+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='environment variables'/><category scheme='http://www.blogger.com/atom/ns#' term='windows shell'/><category scheme='http://www.blogger.com/atom/ns#' term='firefox extension'/><title type='text'></title><content type='html'>Due to the nature of its graphical user interface, windows shell has been ignored for a long time.  It's true that having a point-and-click interface doesn't require learning and remembering, but to boost your productivity, master the art of command line is a must.  Be sure to install the cygwin environment and expose its bin folder into your %PATH% variable will bring tons of powerful Unix tools into your windows arsenal with almost no cost.&lt;br /&gt;&lt;br /&gt;One thing I really love about the shell is its capability to jump right into your destination folder. For example, if you're developing your FireFox extension, following tips might be quite handy to you.&lt;br /&gt;&lt;br /&gt;1. Jump into folders&lt;br /&gt;&lt;pre&gt;set FIREFOX_INSTALL_DIR = "C:\Program Files\Mozilla Firefox"&lt;br /&gt;set FIREFOX_DEV_PROFILE = "C:\Documents and Settings\adong\Application Data\Mozilla\Firefox\Profiles\k5b2sa&lt;br /&gt;58.Dev"&lt;br /&gt;// Now you could jump right into it by typing:&lt;br /&gt;cd %FIREFOX_INSTALL_DIR%&lt;br /&gt;cd %FIREFOX_DEV_PROFILE%&lt;br /&gt;&lt;/pre&gt;2. Start the FireFox in a 'dev' mode by&lt;br /&gt;&lt;pre&gt;// instead of "C:\Program Files\Mozilla Firefox\firefox.exe" -P dev&lt;br /&gt;set MOZ_NO_REMOTE=1&lt;br /&gt;%FIREFOX_INSTALL_DIR%\firefox.exe -P dev&lt;br /&gt;&lt;/pre&gt;3. Or, find the merge point id for the "stausbar"&lt;pre&gt;$ grep -r -n "statusbar .* id=" %firefox_install_dir% | grep ".\.xul:"&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6249111-5674483498828338404?l=thetruedelight.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thetruedelight.blogspot.com/feeds/5674483498828338404/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6249111&amp;postID=5674483498828338404' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6249111/posts/default/5674483498828338404'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6249111/posts/default/5674483498828338404'/><link rel='alternate' type='text/html' href='http://thetruedelight.blogspot.com/2006/12/due-to-nature-of-its-graphical-user.html' title=''/><author><name>Alex Dong</name><uri>http://www.blogger.com/profile/15176732470732890411</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-6249111.post-5763128677537168165</id><published>2006-12-19T22:23:00.003+08:00</published><updated>2006-12-20T16:50:51.012+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='code structure'/><category scheme='http://www.blogger.com/atom/ns#' term='grep'/><category scheme='http://www.blogger.com/atom/ns#' term='python'/><category scheme='http://www.blogger.com/atom/ns#' term='egrep'/><title type='text'></title><content type='html'>&lt;div xmlns="http://www.w3.org/1999/xhtml"&gt;&lt;span style="font-weight: bold;"&gt;Goal&lt;/span&gt;: to see a python file code structure from command line.  &lt;pre&gt;&lt;code&gt; egrep 'def |class ' {python file}&lt;/code&gt;&lt;/pre&gt;  &lt;p&gt;The &lt;code&gt;grep&lt;/code&gt; comes with &lt;code&gt;cygwin&lt;/code&gt; seems to have problem with this:&lt;/p&gt;  &lt;pre&gt;&lt;code&gt; grep 'def |class ' web.py&lt;/code&gt;&lt;/pre&gt;  &lt;p&gt;but &lt;code&gt;egrep&lt;/code&gt; works fine. Seems like &lt;code&gt;'def |class '&lt;/code&gt; is not supported by standard regular expression. Or put it in another way, it's part of the extended regular expression set.&lt;/p&gt;  &lt;p&gt;This &lt;a href="http://www.mkssoftware.com/docs/man1/grep.1.asp"&gt;article&lt;/a&gt; gives a good quick overview on &lt;code&gt;grep, fgrep,&lt;/code&gt; and &lt;code&gt;egrep&lt;/code&gt;.&lt;/p&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6249111-5763128677537168165?l=thetruedelight.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thetruedelight.blogspot.com/feeds/5763128677537168165/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6249111&amp;postID=5763128677537168165' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6249111/posts/default/5763128677537168165'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6249111/posts/default/5763128677537168165'/><link rel='alternate' type='text/html' href='http://thetruedelight.blogspot.com/2006/12/use-egrep-to-view-python-code-structure.html' title=''/><author><name>Alex Dong</name><uri>http://www.blogger.com/profile/15176732470732890411</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-6249111.post-3862165252261945771</id><published>2006-12-19T22:23:00.001+08:00</published><updated>2006-12-20T16:51:20.662+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='firefox bookmark'/><category scheme='http://www.blogger.com/atom/ns#' term='python'/><category scheme='http://www.blogger.com/atom/ns#' term='script'/><title type='text'></title><content type='html'>&lt;div xmlns="http://www.w3.org/1999/xhtml"&gt;When debugging firefox bookmark javascript,  I found myself always concatenate multiple line javascript code into one line.&lt;br /&gt;&lt;br /&gt;Here is the shell script to redirect it to a local file, where the "notepad" kicks in and automatically load it.&lt;br /&gt;&lt;pre&gt;js_merger.py bookmark.js  bookmark.txt  notepad bookmark.txt&lt;/pre&gt;&lt;br /&gt;And here is the code to automatically do this:&lt;br /&gt;&lt;pre&gt;import sys&lt;br /&gt;if len(sys.argv)!=2:&lt;br /&gt;  print "Usage: js_merger.py {file.js}"&lt;br /&gt;else:&lt;br /&gt;  l = open(sys.argv[1]).readlines()&lt;br /&gt;  print "javascript:(function(){" + ' '.join([i.strip() for i in l]) + "})();"&lt;/pre&gt;&lt;br /&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/6249111-3862165252261945771?l=thetruedelight.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thetruedelight.blogspot.com/feeds/3862165252261945771/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6249111&amp;postID=3862165252261945771' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6249111/posts/default/3862165252261945771'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6249111/posts/default/3862165252261945771'/><link rel='alternate' type='text/html' href='http://thetruedelight.blogspot.com/2006/12/merge-javascript-code-into-one-line_19.html' title=''/><author><name>Alex Dong</name><uri>http://www.blogger.com/profile/15176732470732890411</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-6249111.post-2659206130437148281</id><published>2006-12-19T22:22:00.003+08:00</published><updated>2006-12-20T16:51:43.661+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='IFrame'/><category scheme='http://www.blogger.com/atom/ns#' term='Ajax'/><category scheme='http://www.blogger.com/atom/ns#' term='Cross-site'/><title type='text'></title><content type='html'>&lt;div xmlns="http://www.w3.org/1999/xhtml"&gt;&lt;span style="font-weight: bold;"&gt;Problem&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;I have two websites, say one is alex.com and the other is dong.com. I want a javascript in alex.com to send a Ajax.Request to dong.com. In prototype framework, it should be done like this: &lt;pre&gt;new Ajax.Updater('mydiv', 'dong.com/foo/bar', {asynchronous:true});&lt;/pre&gt;.The problem is that  the second parameter could &lt;span style="font-weight: bold;"&gt;only &lt;/span&gt;be the directory on the same server.  &lt;a href="http://ajaxpatterns.org/XMLHttpRequest_Call#Handling_POSTs_and_Other_Request_Types"&gt;AjaxPatterns.com&lt;/a&gt; has an article on this topic.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Solution&lt;/span&gt;&lt;br /&gt;A little bit HTML+CSS trick, &lt;pre&gt;$('hidden_panel').innerHTML = ' id="cuti_service_request" style="display: none;" src="%27%20+%20url%20+%20%27" title="Server update" iframe --&amp;gt;';&lt;/pre&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6249111-2659206130437148281?l=thetruedelight.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thetruedelight.blogspot.com/feeds/2659206130437148281/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6249111&amp;postID=2659206130437148281' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6249111/posts/default/2659206130437148281'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6249111/posts/default/2659206130437148281'/><link rel='alternate' type='text/html' href='http://thetruedelight.blogspot.com/2006/12/cross-site-request-using-iframe.html' title=''/><author><name>Alex Dong</name><uri>http://www.blogger.com/profile/15176732470732890411</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-6249111.post-1904481539695180490</id><published>2006-12-19T22:22:00.001+08:00</published><updated>2006-12-20T16:50:11.183+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='cheetah'/><category scheme='http://www.blogger.com/atom/ns#' term='textdrive'/><category scheme='http://www.blogger.com/atom/ns#' term='python'/><category scheme='http://www.blogger.com/atom/ns#' term='web.py'/><category scheme='http://www.blogger.com/atom/ns#' term='hosting'/><title type='text'></title><content type='html'>&lt;div xmlns="http://www.w3.org/1999/xhtml"&gt;The recommended steps &lt;span class="alignright"&gt;from &lt;a href="http://coderseye.com/2006/how-to-install-cheetah-on-dreamhost.html"&gt;Bruce Kroeze &lt;/a&gt;works perfectly with a few minor modifications. Here are the steps I took to make it work.  Check out Bruce's link post for detail explanations. &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;# Get the code and some other prep works&lt;br /&gt;mkdir ~/tmp&lt;br /&gt;cd ~/tmp&lt;br /&gt;wget http://jaist.dl.sourceforge.net/sourceforge/cheetahtemplate/Cheetah-2.0rc7.tar.gz&lt;br /&gt;&lt;br /&gt;# Build Cheetah without copying it to system wide site-package&lt;br /&gt;tar xzf Cheetah-2.0rc7.tar.gz&lt;br /&gt;cd Cheetah-2.0rc7.tar.gz&lt;br /&gt;python setup.py bdist_dumb --relative&lt;br /&gt;&lt;br /&gt;# Setup the environment&lt;br /&gt;cd dist&lt;br /&gt;mv lib ~/&lt;br /&gt;mv bin ~/&lt;br /&gt;vim ~/.bash_profile&lt;br /&gt;PATH=$PATH:~/bin&lt;br /&gt;PYTHONPATH=$PYTHONPATH:~/lib/python2.4/site-packages&lt;br /&gt;export PATH PYTHONPATH&lt;br /&gt;source ~/.bash_profile&lt;br /&gt;&lt;br /&gt;# Final step: create the symbolic link&lt;br /&gt;cd ~/web/public/{your_web_project}&lt;br /&gt;ln -s ~/lib/python2.4/site-packages/Cheetah .&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6249111-1904481539695180490?l=thetruedelight.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thetruedelight.blogspot.com/feeds/1904481539695180490/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6249111&amp;postID=1904481539695180490' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6249111/posts/default/1904481539695180490'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6249111/posts/default/1904481539695180490'/><link rel='alternate' type='text/html' href='http://thetruedelight.blogspot.com/2006/12/how-to-install-cheetah-on-textdrive_19.html' title=''/><author><name>Alex Dong</name><uri>http://www.blogger.com/profile/15176732470732890411</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-6249111.post-8741099084168844257</id><published>2006-12-19T22:17:00.001+08:00</published><updated>2006-12-20T16:47:15.659+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='firefox'/><category scheme='http://www.blogger.com/atom/ns#' term='firefox bookmark'/><title type='text'></title><content type='html'>&lt;div xmlns="http://www.w3.org/1999/xhtml"&gt;My day job project is down all in FireFox. We just can't image how to write web applications with FireFox and all its wonderful extensions. There have been many friends who asked me which FireFox extensions I use for web development. Well, I can never give them a full list until I ran into this list: &lt;a href="http://lesliefranke.com/files/firefoxwdev/firefoxwdev.htm"&gt;http://lesliefranke.com/files/firefoxwdev/firefoxwdev.htm&lt;/a&gt;&lt;br /&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/6249111-8741099084168844257?l=thetruedelight.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thetruedelight.blogspot.com/feeds/8741099084168844257/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6249111&amp;postID=8741099084168844257' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6249111/posts/default/8741099084168844257'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6249111/posts/default/8741099084168844257'/><link rel='alternate' type='text/html' href='http://thetruedelight.blogspot.com/2006/12/web-development-with-firefox.html' title=''/><author><name>Alex Dong</name><uri>http://www.blogger.com/profile/15176732470732890411</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-6249111.post-2350941199626655324</id><published>2006-12-15T21:47:00.000+08:00</published><updated>2006-12-20T16:48:14.362+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='lessons learned'/><category scheme='http://www.blogger.com/atom/ns#' term='startup'/><category scheme='http://www.blogger.com/atom/ns#' term='skype'/><category scheme='http://www.blogger.com/atom/ns#' term='investment'/><category scheme='http://www.blogger.com/atom/ns#' term='software development'/><category scheme='http://www.blogger.com/atom/ns#' term='team'/><title type='text'></title><content type='html'>What happened before &lt;span onclick="BLOG_clickHandler(this)" class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;Skype&lt;/span&gt;?&lt;br /&gt;&lt;br /&gt;Yesterday night, I had a 90 minutes chat with &lt;span onclick="BLOG_clickHandler(this)" class="blsp-spelling-error" id="SPELLING_ERROR_1"&gt;Skype's&lt;/span&gt; core founder: &lt;span onclick="BLOG_clickHandler(this)" class="blsp-spelling-error" id="SPELLING_ERROR_2"&gt;Toivo&lt;/span&gt;. He is now running &lt;a href="http://www.asi.ee/?nodeid=56&amp;lang=en"&gt;Ambient Sound Investment&lt;/a&gt; company on behalf of the other three co-founders. Here is a brief list of interesting things we've talked about.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;On the team&lt;/span&gt;&lt;br /&gt;The average &lt;span onclick="BLOG_clickHandler(this)" class="blsp-spelling-error" id="SPELLING_ERROR_3"&gt;startup&lt;/span&gt; founders are 2.5. Yet &lt;span onclick="BLOG_clickHandler(this)" class="blsp-spelling-error" id="SPELLING_ERROR_4"&gt;Skype&lt;/span&gt; has four founders. I was wondering how could they make decisions quick enough and, on the same time, have a fair discussion.&lt;br /&gt;&lt;span onclick="BLOG_clickHandler(this)" class="blsp-spelling-error" id="SPELLING_ERROR_5"&gt;Voivo&lt;/span&gt; said that they've known each other since elementary school. Have been working together for 4 years when the idea of &lt;span onclick="BLOG_clickHandler(this)" class="blsp-spelling-error" id="SPELLING_ERROR_6"&gt;Skype&lt;/span&gt; hit their heads. They know each other's weakness and advantages very clearly. &lt;span onclick="BLOG_clickHandler(this)" class="blsp-spelling-error" id="SPELLING_ERROR_7"&gt;Voivo&lt;/span&gt; was managing the project with the other three focused on architecture and implementation.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;On the idea&lt;br /&gt;&lt;/span&gt;This is the most interesting topic. It turned out that &lt;span onclick="BLOG_clickHandler(this)" class="blsp-spelling-error" id="SPELLING_ERROR_8"&gt;Skype&lt;/span&gt; is the forth product the same team have built. Here are some projects &lt;span onclick="BLOG_clickHandler(this)" class="blsp-spelling-error" id="SPELLING_ERROR_9"&gt;Voivo&lt;/span&gt; gave out:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;1999: A web portal, with basically everything. From news to Email.  It didn't go well.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;2001: &lt;span onclick="BLOG_clickHandler(this)" class="blsp-spelling-error" id="SPELLING_ERROR_10"&gt;Kazza&lt;/span&gt;: Open source P2P technology. This is when they get exposed to the P2P idea I guess.&lt;/li&gt;&lt;li&gt;2002: A &lt;span onclick="BLOG_clickHandler(this)" class="blsp-spelling-error" id="SPELLING_ERROR_11"&gt;CDN&lt;/span&gt;, plus &lt;span onclick="BLOG_clickHandler(this)" class="blsp-spelling-error" id="SPELLING_ERROR_12"&gt;PeerCache&lt;/span&gt; product. These products brought them some, but not many, customers. The important thing is that during the development process, they used the money to grow the team into 10 people and build &lt;span onclick="BLOG_clickHandler(this)" class="blsp-spelling-error" id="SPELLING_ERROR_13"&gt;Skype&lt;/span&gt; as a side project.&lt;/li&gt;&lt;li&gt;Nov 2003: The idea of &lt;span onclick="BLOG_clickHandler(this)" class="blsp-spelling-error" id="SPELLING_ERROR_14"&gt;Skype&lt;/span&gt; hit them. It took them 4 months to just "think", do architecture work and layout the features.&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-weight: bold;"&gt;Lessons learned&lt;br /&gt;&lt;/span&gt;At least from &lt;span onclick="BLOG_clickHandler(this)" class="blsp-spelling-error" id="SPELLING_ERROR_15"&gt;Skype's&lt;/span&gt; case, they had the team first, then figure out the general direction, a right product is only a natural result of continuous thinking and packaging the same technology for different problems.&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6249111-2350941199626655324?l=thetruedelight.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thetruedelight.blogspot.com/feeds/2350941199626655324/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6249111&amp;postID=2350941199626655324' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6249111/posts/default/2350941199626655324'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6249111/posts/default/2350941199626655324'/><link rel='alternate' type='text/html' href='http://thetruedelight.blogspot.com/2006/12/what-happened-before-skype-yesterday.html' title=''/><author><name>Alex Dong</name><uri>http://www.blogger.com/profile/15176732470732890411</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-6249111.post-5528652149731842809</id><published>2006-12-13T21:13:00.000+08:00</published><updated>2006-12-20T16:52:52.576+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='firefox'/><category scheme='http://www.blogger.com/atom/ns#' term='python'/><category scheme='http://www.blogger.com/atom/ns#' term='script'/><category scheme='http://www.blogger.com/atom/ns#' term='dictionary'/><title type='text'></title><content type='html'>&lt;div xmlns="http://www.w3.org/1999/xhtml"&gt;"""&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;Synchronize FireFox 2.0 and Microsoft Dictionaries&lt;br /&gt;Author: Alex Dong&lt;br /&gt;Email: $ python -c "'YWxleC5kb25nQGdtYWlsLmNvbQ==\n'.decode('base64')&lt;br /&gt;Blog: http://thetruelight.blogspot.com/&lt;br /&gt;License: GPL&lt;br /&gt;ReadMe:&lt;br /&gt;   Please change the 'word_dict_path' and 'ff_dict_path' to point&lt;br /&gt;   them to your local directories.&lt;br /&gt;"""&lt;br /&gt;&lt;br /&gt;word_dict_path = 'c:/Documents and Settings/adong/Application Data/Microsoft/Proof/custom.dic'&lt;br /&gt;ff_dict_path = 'C:/Documents and Settings/adong/Application Data/Mozilla/Firefox/Profiles/yl9sxfvv.default/persdict.dat'&lt;br /&gt;wd = open(word_dict_path).readlines()&lt;br /&gt;fd = open(ff_dict_path).readlines()&lt;br /&gt;&lt;br /&gt;def merge(a, b):&lt;br /&gt;   c = [i for i in a]&lt;br /&gt;   for i in b:&lt;br /&gt;      if c.count(i)==0: c.append(i)&lt;br /&gt;   return c&lt;br /&gt;&lt;br /&gt;l = merge(wd, fd)&lt;br /&gt;l.sort()&lt;br /&gt;&lt;br /&gt;def update(f, l):&lt;br /&gt;   fp = open(f, 'w')&lt;br /&gt;   fp.writelines(l)&lt;br /&gt;   fp.close()&lt;br /&gt;update(word_dict_path, l)&lt;br /&gt;update(ff_dict_path, l)&lt;br /&gt;&lt;br /&gt;print "Updated %d entries"%((len(l)-len(wd)) + (len(l)-len(fd)))&lt;/pre&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6249111-5528652149731842809?l=thetruedelight.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thetruedelight.blogspot.com/feeds/5528652149731842809/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6249111&amp;postID=5528652149731842809' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6249111/posts/default/5528652149731842809'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6249111/posts/default/5528652149731842809'/><link rel='alternate' type='text/html' href='http://thetruedelight.blogspot.com/2006/12/python-code-to-synchronize-your-firefox.html' title=''/><author><name>Alex Dong</name><uri>http://www.blogger.com/profile/15176732470732890411</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>
