Tuesday, April 28, 2009

Applet GWT Integration

Due to some special reasons, some time we still need to display applet in the web application, but thats come to one problem, how to integrate the applet into the application if we using gwt for development ?

Friday, April 24, 2009

年薪10萬的乞丐 Part 2

"你接著說。"我更感興趣了,看來今天能學到新的東西了。

"有人說做乞丐是靠運氣吃飯,我不以然。給你舉個例子,女人世界門口,一個帥氣的男生,一個漂亮的女孩,你選哪一個乞討?"

我想了想,說不知道。

"你應該去男的那兒。身邊就是美女,他不好意思不給。但你要去了女的那邊,她大可假裝害怕你遠遠地躲開。"

"再給你舉個例子。那天cocopark門口,一個年輕女孩,拿著一個購物袋,剛買完東西;還有一對青年男女,吃著冰淇淋;第三個是衣著考究的年輕男子,拿著筆記本包。我看一個人只要3秒鐘,我毫不猶豫地走到女孩面前乞討。女孩在袋子裡掏出兩個硬幣扔給我,並奇怪我為什麼只找她乞討。我回答說,那對情侶,在吃東西,不方便掏錢;那個男的是高級白領,身上可能沒有零錢;你剛從超市買東西出來,身上肯定有零錢。"

有道理!
我越聽越有意思。

Tuesday, April 21, 2009

How Resumable Download Work

Download, a common activity for most of the IT peoples. Some download manager software support a feature which is resume download, user can pause or stop the download and continue after some time. Starting I thought that must be very complicated implementation within the download manager in order to support resume feature.

Unfortunately, the concept behind that is not that complicated as i thought, after i study on the architecture resume download, I realize the theory behind that is so simple ! The trick to make a download resumable is the HTTP range request header. We know that download file from internet as stream bytes, so we can specific the range header like this

Saturday, April 18, 2009

Add Menu to Header of Tab Item in GXT

I want to add Context Menu to the Header of the TabItem under Ext-Gwt (GXT). Unfortunately i can't find any proper method for me to do that. The Header Item of Ext-GWT tab item was packaged protected and I couldn't override or extend it.

After research for some time, I find out another way to add context menu to header of the tab item. The example below shows the basic step to add the context menu into tabitem header.

Friday, April 17, 2009

Drag N Drop Grid To Tree in Ext-GWT (GXT)

Ext-Gwt(GXT) is a Java library for building rich internet applications with GWT. It provides various good features in the library. Developer can easily implements drag n drop features in their web applications with few line of codes. This is one simple example to drag from grid and drop the item into the tree.

First of all, we need to make the draggable grid. We can use the GridDragSource to do this.I just wrap the grid with the GridDragSource and it is done.

Grid draggableGrid = new Grid();
new GridDragSource(draggableGrid);

Monday, April 13, 2009

年薪10萬的乞丐 Part 1

我拎著剛買的levi's 從茂業出來,站在門口等一個朋友。

一個職業乞丐發現了我,非常專業的、徑直的停在我面前。這一停,於是就有了後面這個讓我深感震撼的故事,就像上了一堂生動的市場調查案例課。為了忠實於這個乞丐的原意,我憑記憶盡量重複他原來的話。

"先生 …… 行行好,給點吧。"我一時無聊便在口袋裡找出一個硬幣扔給他並同他攀談起來。

乞丐很健談。 " …… 我只在華強北一帶乞討,你知道嗎?我一掃眼就見到你。在茂業買 levi's ,一定捨得花錢 …… "

"哦?你懂的蠻多嘛!"我很驚訝。

"做乞丐,也要用科學的方法。"他說。
我一愣,饒有興趣地問"什麼科學的方法?"