Sunday, August 31, 2008

how to get faster javascript loading!

High Scalability | Building bigger, faster, more reliable websites.
Don't have a CDN? Why not let Google and Yahoo be your CDN? At least for Ajax libraries. No charge. Google runs a content distribution network and loading architecture for the most popular open source JavaScript libraries, which include: jQuery, prototype, script.aculo.us, MooTools, and dojo. The idea is web pages directly include your library of choice from Google's global, fast, and highly available network. Some have found much better performance and others experienced slower performance. My guess is the performance may be slower if your data center is close to you, but far away users will be much happier. Some negatives: not all libraries are included, you'll load more than you need because all functionality is included. Yahoo has had a similar service for YUI for a while. Remember to have a backup plan for serving your libraries, just in case.

choose a javascript libary best ones?

The JavaScript Library World Cup [JavaScript & AJAX Tutorials]
Well, the short answer to this question is that there is no real stand-out solution that excels in all situations.

Prototype is the most comprehensively documented -- albeit in a splintered way. It is also seemingly the most widespread library at the moment, possibly because it really excels at the kind of tasks developers complete most often, like selecting nodes and working with lists. Of course, it's going to be the natural choice for Ruby developers because it sticks to many Ruby idioms. One other great thing about Prototype is that it has the mighty weight of Rails behind it and, as a result, there are many developers providing bug fixes and patches to Prototype. Finally, it offers a wealth of add-on libraries such as scriptaculous, Rico, and Behaviour that make it a good, solid choice for many developers.

On the other hand, Prototype has a very under-developed event handling framework, which is a major problem for an otherwise powerful library. Also -- and this is purely a matter of taste -- Prototype's super-pragmatic approach to things (like the heavy use of the innerHTML property) can seem a little "dirty" sometimes.

For smaller projects, the decoupled design and fully-featured components of YUI may well be a big plus. It's very easy to drop in the Connection Manager or the Event library and get going on some basic tasks without having to traverse too much of a learning curve. On the whole, though, it doesn't have much to offer in terms of cool or powerful features.

Dojo is definitely the daddy of the bunch -- you can almost always rely on it for the most powerful implementation of any feature. And Dojo's focus on performance is an absolute godsend if you're planning a very JavaScript-intensive application. The widget implementation also has enormous potential for building complex UIs. However it really is quite big -- both in terms of its file size and the size of the API -- so I wouldn't recommend it for smaller projects.

In my opinion, Mochikit is by far the most well designed and well thought out of the four, and Python/Twisted/Nevow developers will definitely find its API very familiar. However, its documentation is a bit thin in some places (for instance, I'm still a little unsure as to which version of the Mochikit distribution to put in the script tag). Also, some of the idioms and functional techniques that it uses may be confusing for beginners or those who aren't well versed in functional programming techniques. However, it really is worth a look. Mochikits's capabilities will probably surprise you -- the createDOM function, iteration tools and the asynchronous architecture are a work of art.

this is great! backup for my websites!


Welcome to s3sync.rb -------------------- Home page, wiki, forum, bug reports, etc: http://s3sync.net This is a ruby program that easily transfers directories between a local directory and an S3 bucket:prefix. It behaves somewhat, but not precisely, like the rsync program. In particular, it shares rsync's peculiar behavior that trailing slashes on the source side are meaningful. See examples below. One benefit over some other comparable tools is that s3sync goes out of its way to mirror the directory structure on S3. Meaning you don't *need* to use s3sync later in order to view your files on S3. You can just as easily use an S3 shell, a web browser (if you used the --public-read option), etc. Note that s3sync is NOT necessarily going to be able to read files you uploaded via some other tool. This includes things uploaded with the old perl version! For best results, start fresh! s3sync runs happily on linux, probably other *ix, and also Windows (except that symlinks and permissions management features don't do anything on Windows). If you get it running somewhere interesting let me know (see below) s3sync is free, and license terms are included in all the source files. If you decide to make it better, or find bugs, please let me know. The original inspiration for this tool is the perl script by the same name which was made by Thorsten von Eicken (and later updated by me). This ruby program does not share any components or logic from that utility; the only relation is that it performs a similar task.

Wednesday, August 13, 2008

watch out for the little babies

Karolyis' sour grapes makes bad whine - Olympics - Yahoo! Sports
This was a nightmare for Marta. She had to watch Sacramone, a 20-year-old woman, crumble under the pressure and stumble off a beam. Meanwhile, the Chinese kept sticking their landings.

“Little babies,” she barked.

It was too much to bear. The little babies had gotten her. The little babies were driving her and her husband nuts.

The little babies were winning gold.

Sunday, August 03, 2008

hmm.....

How To Concentrate
Concentration is the Most Important Intellectual Habit of Man."

Not one person in ten thousand can really concentrate. Some realize that they do not know how—others drift along the line of least resistance and let their minds vegetate, apparently never suspecting their weakness or realizing that they are an utter failure at concentration. To Cori-centre—bringing all your mental force and faculties to bear steadily on a given center with-out deviation from that exact point—whipping into line all wandering fancies—stray ideas or thoughts that go off on a tangent—to hold steadily all your power on the central thing under consideration without an instant of wavering—that is Concentration.

how to type mandarin on mac

Thomas Kho’s Blog » Learning Mandarin Chinese with Mac OS X
Learning Mandarin Chinese with Mac OS X

April 19, 2008 at 9:09 pm · Filed under Computers, General, OS X

I use a Mac probably 90% of the time, so I wanted to share some tips for OS X I picked up that (I hope) are really helpful to the Mandarin Chinese learner.

As a bit of background, let me tell you where I’m coming from: I went to Chinese school for years as a kid and didn’t really learn much of anything. I was never fluent, never really learned enough characters to sufficiently read (let alone write), and then I just stopped caring for some amount of time. Now, I’m back for more learning.

So, here are the tips:

* ITABC Input Method

I haven’t really used Windows in years, but last time I tried, I don’t think it had the pervasive Unicode support to even display Chinese characters in most apps. That said, I was nicely surprised when I found OS X 10.5 comes with a slew of Traditional and Simplified Chinese Input Methods built in. The one I use, ITABC, is dead simple. You just enter pinyin without tones and choose from candidate matches. There are plenty of places online (here’s one at Yale) that can walk you through setting it up.
* CEDICT for Apple Dictionary

Apple includes a dictionary application in OS X. No big deal, right? Well, it’s actually pretty cool, because you can add your own custom dictionaries that integrate as seamlessly as the built-in dictionaries. CEDICT is a Chinese-English dictionary project (here’s an online dictionary based on CEDICT) that’s available as a user dictionary for Dictionary.app. Even better, it also has pronunciations (little sound bites you can play) embedded in dictionary entries.

Here’s CEDICT for Apple Dictionary at Apple Downloads. Just download it and drop it into your /Library/Dictionaries (or ~/Library/Dictionaries).
* Dictionary.app integration throughout OS X

I mentioned seamless integration in that last bullet point. Well, in the Apple way, the dictionary is integrated throughout the system. Hover over some text, hit a hotkey (defaults to Cmd-Ctrl-D, but might I suggest F1), and a little panel pop up (inline, in your application) with the definition.

This hint at Mac OS X Hints reminds us that we can hold down the dictionary hotkey to continuously get the definition of whatever word is currently under the cursor. Say you’re scanning news.google.cn and there are a handful of words you don’t know. Just hit that hotkey, the dictionary entry panel pops up in Safari, and it moves with you as you move the cursor across the sentence.

If the default popup panel is too small for your tastes, this post has a link to a modified DictionaryPanel.app (drop it in /Applications/Dictionary.app/Contents/SharedSupport) that enlarges the popup panel window. Alternatively, you can open up DictionaryPanel.app/Contents/Resources/English.lproj/PopupWindow.nib in Interface Builder and just need to change the size of both the popup window and its content. Be sure to make a backup first!
* ChinesePod on iTunes

Alright, so this last one might be a strech, but I found out about ChinesePod, which is a podcast with lessons in spoken Mandarin. It helps that the podcasters are pretty amusing. How does this tie in? Well, iTunes is setup to scrape the newest lessons and syncs them automatically with my iPod, so I can listen on my way to work. Zero effort necessary!

Alright. That’s it for now. If you know of any other tips, please do share!

Note: This might seem like one big rave for OS X, but I tried really hard to keep that to a minimum. Apple’s just too cool :)

Saturday, August 02, 2008

jay chou love me don't go!

Chinese Music Forum / [Completed] ~Translation~ Jay Chou- 爱我别走
I just heard one of Jay's song in his 2005 concert..
and it's quite a nice song..Check it out!!

周杰伦- 爱我别走
Jay Chou- Love me, don’t go

我到了这个时候还是一样
Wo dao le zhe ke shi jian hai shi yi yang
Having arrived at this moment, I’m still the same

夜里的寂寞容易叫人悲伤
Ye li de ji mo rong yi jiao ren bei shang
Loneliness of the night easily makes people hurt

我不敢想的太多
Wo bu gan xiang de tai duo
I don’t dare to think too much

因为我一个人
Ying wei wo yi ke ren
Because I’m all by myself

迎面而光的月光拉长身影
Ying mian er guang de ye guang la chang shen ying
Facing moonlight, it draws out the silhouette

走在漫无目的的街
Zou zai man wu mu di de jie
Walking by the boundless and endless street

我没有你的消息
Wo mei you ni de xiao xi
I don’t hear your news

因为我在想你
Yin wei wo zai xiang ni
Because I’m thinking of you

Chorus:

爱我别走
Ai wo bie zou
Love me, don’t go

如果你说你不爱我
Ru guo ni shuo ni bu ai wo
If you say you don’t love me

不要听见你真的说出口
Bu yao ding jian ni zhen de shuo chu kou
I don’t want to hear you really said it

再给我一点温柔
Cai gei wo yi dian wen rou
Give me a bit warmth again

--------------------------------------------------

就在今晚抹去对方的肯定
Jiu zai jin wan mo qu dui fang de ken ding
And at this night, erasing the other is for sure

夜里的寂寞容易叫人悲伤
Ye li de ji mo rong yi jiao ren bei shang
Loneliness of the night easily makes people hurt

我没有你的消息
Wo mei you ni de xiao xi
I don’t hear your news

因为我一个人
Ying wei wo yi ke ren
Because I’m all by myself

迎面而光的月光拉长身影
Ying mian er guang de ye guang la chang shen ying
Facing moonlight, it draws out the silhouette

一个人走在漫无目的的街
Yi ke ren zou zai man wu mu di de jie
A person walking by the boundless and endless street

我没有你的消息
Wo mei you ni de xiao xi
I don’t hear your news

因为我在想你
Yin wei wo zai xiang ni
Because I’m thinking of you

爱我别走
Ai wo bie zou
Love me, don’t go

如果你说你不爱我
Ru guo ni shuo ni bu ai wo
If you say you don’t love me

不要听见你真的说出口
Bu yao ding jian ni zhen de shuo chu kou
I don’t want to hear you really said it

再给我一点温柔
Cai gei wo yi dian wen rou
Give me a bit warmth again