<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    posts - 28, comments - 27, trackbacks - 0, articles - 0
      BlogJava :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理

    2006年9月18日

    再也無法忍受無法在Firefox下面寫blog的痛苦,再加上這里緩慢的網速~~~于是決定~~搬家

    新家地址:dearwolf.javaeye.com

    posted @ 2007-01-08 10:07 小小涼粉 閱讀(336) | 評論 (2)編輯 收藏

    默認情況下,SWT的Table只會給整個Table設置Tooltip,要對每一個TableItem設置Tooltip的話,就要監聽鼠標事件了:


    ????????table.addMouseTrackListener(
    new?MouseTrackAdapter()?{
    ????????????
    public?void?mouseHover(MouseEvent?event)?{
    ????????????????Point?pt?
    =?new?Point(event.x,?event.y);
    ????????????????
    int?index?=?table.getTopIndex();
    ????????????????
    while?(index?<?table.getItemCount())?{
    ????????????????????TableItem?item?
    =?table.getItem(index);
    ????????????????????
    for?(int?i?=?0;?i?<?table.getColumnCount();?i++)?{
    ????????????????????????Rectangle?rect?
    =?item.getBounds(i);
    ????????????????????????
    if?(rect.contains(pt))?{
    ????????????????????????????Object?object
    =?item.getData();
    ??????????????????????????? ........
    ????????????????????????}
    ????????????????????}
    ????????????????????index
    ++;
    ????????????????}
    ????????????}
    ????????});

    在省略號的地方就可以對對象進行轉型了

    posted @ 2006-12-11 19:13 小小涼粉 閱讀(1958) | 評論 (4)編輯 收藏

    1、有人竟敢叫囂要“屠龍”

    上海某高校吳友富同志說:因為“龍”的英文“Dragon”,在西方世界被認為是一種充滿霸氣和攻擊性的龐然大物。“龍”的形象往往讓對中國歷史和文化了解甚少的外國人由此片面而武斷地產生一些不符合實際的聯想,故提出龍可能不再適合代表中國。

    解讀:中 國,一個有著上下幾千年文化歷史的國家,一個有著13億人口的大國,一個曾經以小米加步槍硬是趕跑了持著洋槍洋炮的侵略者的民族,一個英雄輩出的國家,為 什么連我們世代所敬仰的代表我中華兒女的標志也要問問外國人是否合適?如果哪天他們說我們的國旗、國歌他們不喜歡,我們也要更改嗎?

    所以我說了,以后爸爸也該叫爹地了。今后大伙兒也別過春節了,一起過圣誕去;除夕也不要了,改在12月24日,叫平安夜。為啥?老外不喜歡!

    2、李銀河:換妻是公民合法權利

    喪夫性學家李銀河:“換妻是公民合法權利。一切東西都應該要豐富多彩。如果家庭都只是一夫一妻這個模式,反而顯得過于單調”
      
    解讀:這話跟前些年“自愿的奴役是一種自由”這樣一個偽命題一樣不需要廢話。自愿為奴隸當然是一種自由,但是它違背了自由這樣一個大前提。換妻當然也是一種合法權利,但是它違背了一夫一妻制和《婚姻法》這個大前提。

    解讀:不過不知道李銀河愿不愿自己試一把。沒丈夫跟人換可以玩3P嘛


    3、自稱白居易后人的國學辣妹白鹿鳴

    “我最擅長勾引人,孔子也不例外。我的一夜情值10萬,不過孔子說食色性也,我去慰他籍千年的寂寞,他也一定是很高興的。”

    解讀: 不知道白居易知道有這樣的后人會不會氣的從棺材里爬出來。想出名,不是壞事。但是甩個大臉沾著祖宗的光還說勾引誰誰誰這樣的話就有點讓人倒胃口了。

    4、饒穎性愛日記

    饒大媽數年如一日地死纏猛打央視撥陰員趙老濕,起因據說是趙老濕舍不得給饒穎3800塊錢,哎,何必呢?早知道今天這個場面,估計后面加上三個0,趙老濕也認了。
      
    饒 穎日記(三)節選:有幾次在一起,他用刀割我的手臂,用針沾了他的唾沫扎我的陰部,說是消毒。我痛得喊叫,他卻興奮不已地說:“寶貝,你不知道這樣做,我 有多快樂,讓我扎扎吧。”“趙忠祥虐待成性,即使我在經期,他也要與我發生關系。我不愿意,他就罵我打我,迫使我屈服。2000年上半年,我的泌尿系統因 此受感染,治療不及時,導致腎炎。”
      
    解讀:“寶貝,你不知道這樣做,我有多快樂,讓我扎扎吧。” 這哪是趙老濕,明明就是《依波拉病毒》和《人肉叉燒包》里的 黃秋生嘛!

    5、巨NB的老師

    一個女孩和同學開玩笑,把對方的衣服脫光了,后來被班主任知道了,他叫來了三方的家長。當家長們決定不予以追究,只要對方道歉的時候,他說了:“呀,這可不得了,以前聽說也有過這樣一個例子,一個人把一個女同學的衣服脫光了,最后判了16年呢”最后那個女孩子因害怕自殺。

    解讀:終于體會到了什么叫做唯恐天下不亂?既然受害方都表示不愿再追究,為什么你要那么危言聳聽呢?傳說中的皇帝不急,你個太監急個球啊?最后結果是:一朵鮮花又凋謝了!

    6、醫托說:揍的就是院長!

    2006年11月23日,復旦大學附屬眼耳喉鼻醫院院長助理、浦東分 院院長:張天宇在揭穿醫托的把戲后,遭到了一群醫托群毆。此 時張院長大呼:我是醫院院長!為首的一個醫托答曰:揍的就是 院長!

    解讀:以前在我們眼里,醫托都是偷偷摸摸的,像做賊一樣(本來就是做賊),現在你看看,時代進步了,社會發展了,醫托也翻身得解放了,還能說出那樣天地驚,鬼神泣的話!可以肯定是醫托史上最NB的。

    7、蘇丹紅鴨蛋吃不死人,放心吧

    北京市食品辦專家:“按每個鴨蛋約60克進行折算,體重60公斤的成人每天食用1200多個“涉紅鴨蛋”,才有可能達到誘發動物腫瘤的劑量。”

    解讀:食 品辦專家原來一直在以人的體重與有毒食物食用量之比,作為他們工作的指導思想。你吃了毒木耳嗎?專家可以告訴你:按多少多少克進行折算,體重60公斤的成 年人每天食用1噸,“才有可能達到誘發動物腫瘤”。你吃了毒豬肉嗎?你吃了毒韭菜嗎?你吃了毒大米嗎?你吃了含有蘇丹紅Ⅰ號的廣東亨氏美味源辣椒醬、肯德 基新奧爾良烤翅嗎?吃吧,放心地吃吧,死不了。

    8、北大教授阿憶:“在北大月收入4786元,靠學校那點工資很難生存和安心教學。”

    解讀:幸虧阿憶教授還有幾個兼差,要不怎么能在“哭窮”之際,又在中關村附近新購置了一套豪宅,“300萬差1萬”。

    9、教育好比逛市場?

    教育部新聞發言人王旭明:“教育就好比逛市場買東西,如果有錢,可以去買1萬元一套的衣服;如果沒錢,就只能去小店,買100元一套的衣服穿。”

    解讀:許多國家的教育部門,都鼓勵年輕人勇于追逐自己的夢想,鼓勵年輕人突破自我,進入更高的層次、更好的學校深造,不想當將軍的士兵不是好士兵,不想上哈佛的學生不是好學生。可我們的教育部門竟然對年輕人說:要考慮自己的經濟能力,要有自知之明……

    10、社會學家鄭也夫:“自來水100元一噸保證可持續洗澡”。

    解讀:鄭 老師說得很有道理,他算了賬:瓶裝礦泉水每瓶500—600毫升,1.5元一瓶。一噸瓶裝礦泉水3000元。罐裝飲用水一罐19升,大約10元多一罐。一 噸罐裝飲用水550元。一噸自來水100元離譜嗎?商人忽悠您買罐裝水可以,自來水提價就不行?即使按照這個價格算,吃三根冰棍的價格(3元錢),就能淋 浴一次(淋浴龍頭開4分鐘大約用水30升)。為什么淋一次浴就一定要比吃三根冰棍便宜?

    posted @ 2006-12-06 20:31 小小涼粉 閱讀(288) | 評論 (0)編輯 收藏

    從灰姑娘變成公主,和生下來就是公主,畢竟不一樣,前者不會有后者的單純,但也不會像后者那樣容易受傷。

    ?

    見到張靚穎的那刻,屋子里人非常多,她一個箭步沖向沙發,一把將頭頂上的報童帽丟到桌子上,嘰里呱啦地和公司相熟的同事攀談起來,語速快得驚人,,像個孩子般手舞足蹈。其間,還以非同尋常的速度干掉了一整瓶鮮橙多。

    ?

    經同事提醒,她才發現了我,于是規規矩矩坐過來,重新將雙手縮到長袖衣服的袖管中,語速變得緩慢,神情收斂,一下子就變成另外一個樣子。

    ?

    在廈門某酒吧舉行的“涼粉”與張靚穎的見面會上,“涼粉”手牽手,用人墻把所有記者都隔離起來,不讓記者靠近張靚穎,他們警告媒體記者,不要影響到他們的 “公主”。緊接著,在廈門國際馬拉松發令式的媒體見面會上,張靚穎到場,同時到場的還有大批“涼粉”,其中一位義正詞嚴“警告”記者說:“不要問八卦問題,我們已經不是傳統意義上的粉絲,靚穎也不是傳統意義上的明星。”

    ?

    在這次采訪前,到百度張靚穎吧上收集問題,也收到了同樣的警告——“她已經把最美的歌聲給了我們,站在這個舞臺上忍受了很多傷害,所以,我們把生活還給她。鄭重對你說,如果你是善良的,請不要問她私生活。她的性格很倔,如果你問了,而她的態度不好,我們只會鼓掌支持她。”

    ?

    FANS 對張靚穎的維護已經到了無以復加的地步,盡管許多人認為,不少涼粉屬于中產精英男士,他們大多低調——但低調不代表無聲,連張靚穎都說,“現在‘玉米’和‘盒飯’更瘋狂?我沒有覺得啊 ! 我的粉絲也很熱情” FANS 愛上的是和他們某些地方很相似的張靚穎,雖然看起來平平靜靜,但遇弱則柔,遇強則剛。就像前不久,她“斗膽”以一個剛出茅廬的歌手身份將上海某著名媒體一紙訴狀告上法庭,理由是她認為該媒體侵害了她的名譽權。

    ?

    事實上,早在去年超女比賽中,她的“戰斗”就開始了。在那樣一個比賽中,嗓音一流的張靚穎遭遇到一種她從未經歷過的尷尬,那就是:她唱得再好,也得不到冠軍。雖然我們得不到證實,但她一定心里明白,這就是所謂的游戲規則。她的失落逐步變成了“孤傲”,被稱為“自信得無可救藥”,評委旁敲側擊,暗示她心機過重,甚至故意避而不談她的演唱實力。而這個早早就經歷過風浪的女孩,也從怯怯接受變為有意還擊。比如,其中一場比賽中她唱完后,評委輪番向她發問:“你有沒有感冒?發燒?生病?狀態不佳?”張靚穎響亮回應:“我沒有生病,我的狀態非常好。”

    ?

    正是這種直接,使得喜歡與不喜歡她的人截然分派。

    ?

    愛她的叫她公主。

    ?

    不與媒體為敵,她是個天生的藝人,懂得圓熟地閃避危險。

    ?

    網上有個流傳頗廣的帖子《不穿水晶鞋也能成為公主》中寫到過一段她幼年時的經歷,大概意思是小學時候她參演童話劇《灰姑娘》,劇情需要她試穿水晶鞋,她卻擅自改了臺詞,高喊著“謝謝你,我不穿 ! ”使童話劇草草收場,當我問道她這個情節時,她卻一臉茫然:“沒有吧,我怎么不記得我這樣干過。”緊接著她又打圓場說,“你知道嘛,許多 FANS 喜歡憑著美好的想象編故事,讓我在其中變得很美,事實上,我可沒有那么大膽 ! 小時候一直惟‘母命’是從,不敢吭氣,做錯了事,媽媽是真會下狠手教訓我的 !

    ?

    很乖,懂事,很早就學會堅強,還是也難捱娛樂圈的殘酷,她在博客上寫:“進入娛樂圈前,許多人提醒我要提防不良娛記……進入娛樂圈幾個月,我已經見識了他們的高深道行,他們可不是落井下石,而是路上挖井,再用無敵幻化緋聞掌將你打入地獄……”幾次公開落淚,卻為她贏得更多感動,從不適應到接受、消化和享受成名帶來的樂趣,她變得越來越從容。畢竟,從灰姑娘變成公主,和生下來就是公主的人木不一樣的,前者不會有后者的單純,但也不會像后者那樣容易受傷。

    ?

    事實上,張靚穎并不是一個與媒體為敵的人,她是一個天生的藝人,懂得圓熟地閃避危險發揮長項,有人說她單純,的確有些牽強。采訪中,在很多問題上,她都表現出了相當成熟的特質。比如,官司到現在尚未水落石出,提及此事她淡淡地說:“我已經把所有事都交給公司去做了,自己現在只是專心致志錄專輯。”比如,當被問到參加超女比賽成功除了實力和人氣以外還有什么其它因素時,她哈哈大笑:“當然是運氣了 ! ”而被追問平凡人如何才能有“好運氣”,是否有“潛規則”才在時,她眼珠一轉,很無辜:“我怎么知道,運氣啦,神鬼莫測的,誰能清楚它的走向呢?”問她,什么事會引起她的不快,她很斬釘截鐵地說:“嗯,如果你不按照我今天說的來寫,我就會不開心。”

    ?

    其實,她在采訪中所表現出的敏捷、大方,雖心存抗拒和抵觸卻幾乎不露痕跡,比起在娛樂圈摸爬滾打多年的藝人甚至是一線大牌來,都要漂亮和得體的多。

    ?

    關于新專輯, FANS 有個很大的呼聲,那就是——強烈需要口水歌,她拖長了聲回答:“有,讓他們放心,一定有 ! ”可緊接著問她什么是口水歌時,她突然搖頭,“不知道,因為說不好,一個人一個定義吧。比如某首歌,有人覺得是口水歌,別人也許不這么認為,覺得很有內涵啊。”

    ?

    “不知道 + 因為…… ( 一長串的解釋 ) ”一定程度上成了她回答問題的模式,她在這個過程中,盡量尋找兩全其美的答案。 FANS 不擇生熟的狂熱擁躉 VS 希望她至少有一首“口水歌”,原本就是一個矛盾,應該如何選擇自己的定位?張靚穎想了想,依舊是:“不知道,但我在很用心地唱歌,很努力地為大家呈現一個多元華的自己。”

    ?

    于是新專輯出現了一個很有趣的現象:英文歌和中文歌并存,歡快的舞曲和憂傷的抒情并存,翻唱與原唱并存,炫耀聲線的陽春白雪和瑯瑯上口的下里巴人并存。

    ?

    厭她的人吹毛求疵。

    ?

    身陷娛樂圈,就免不了被折騰,她知道在恰當時候自娛娛人。

    ?

    現在在成都,只要對出租車司機說“去張靚穎唱歌的酒吧”,司機就能徑直把你拉到玉林生活廣場,那里的音樂房子和空瓶子都是她唱過歌的酒吧。但是成名帶給她的不只是“成名”,一路 PK 擺脫了平民身份的張靚穎不知怎么的,她的名字就和一些男女有了瓜葛,先是一位自稱好友的人大曝張靚穎以前的情史,還言之鑿鑿地稱她曾為某 男友自殺,后有與某教授關系曖昧;不久后,

    張靚穎又成了黃健翔離婚的直接“殺手”,接下來再是訪談中談到欣賞姚明便被傳為“想借大個子炒作”,然后是劉翔駁了她的面子沒能參加她親手送上票的演唱會,有人跳出來說:“張靚穎,請別坑害劉翔 ! ”再到后來,又有所謂她曾經的“閨中密友”出來編排她翻臉不認人的不是……鬧到眼前,以身兼在校自考生和當紅歌星兩重身份參加四川大學 110 年校慶的張靚穎,依舊被指指點點,理由就是,她是自考生,能算校友嗎?一批網友忿忿然:張靚穎何德何能參加校慶?學校不以學術成就宣傳自己,卻讓一個不合格的逃學藝人為自己貼金,可恥呀可恥 !

    ?

    被放在更大的舞臺上,需要的是歌唱以外的實力。

    ?

    面對紛擾,張靚穎只是淡淡地說:“我幾乎不上網看這些,每天回家很晚,電視也懶得看,從美國帶回來的那些 CD 都沒來得及仔細聽,現在每一天雷打不動,就剩下洗澡,打開計算機連連看,等頭發干,然后睡覺。”

    ?

    而半年前,當記者提及爭議和緋聞時她說:“娛樂圈都是這樣,圈子里沒有誰能逃過這些,這個怎么說呢,也算是一種規矩了。”從哭泣、氣憤,到拾了隱身草,閉眼不理麻煩事,張靚穎已經學會為自己排解煩惱。

    ?

    不過有一件事她倒是很豁達,那就是一直被攻擊的造型問題。討厭她的人特別喜歡揪住“不會打扮”這一點不放,而她自己這次卻也從了眾:“穿衣服這件事,我真是搞不懂,我就喜歡穿的特隨便,而且又倔又懶。每次出席什么場合,都應該是帶幾身衣服讓造型師挑選,而我經常就帶一身,讓他們沒的挑。公司 12 歲生日那天,我本來沒穿那條隆重的黑裙子,只是白襯衫牛仔褲過來了,到場便傻眼了,因為在場的工作人員工作服就是白襯衫牛仔褲。還有去年超女比賽時有一套衣服,一開始我死活不想穿,和造型師打了半天架,最后拗不過只能穿了,結果到現在都被大家說那時最漂亮的一身,你說我審美是不是有問題啊?”

    ?

    走紅,自然會有負面新聞不斷找上來。“我忘性很大,基本上屬于雜草型,哭完就沒事了。”張靚穎的智慧之處在于,她懂得在恰當的時候自娛娛人。娛樂圈就是名利場,明星就是金魚,老百姓是看客。誰要是嫌看熱鬧還不夠過癮,自己跳進水里一起撲騰,那就真是典型的“無極”了,對于“無極”之人,她最終選擇了不予理會。

    posted @ 2006-11-16 12:07 小小涼粉 閱讀(291) | 評論 (0)編輯 收藏

    目的1:打開一個新的對話框時,如何設定它和父對話框的相對位置?比如在登錄對話框有一個“創建新帳號”的按鈕,用戶點擊以后,就出現新的對話框用于注冊,請問如何能讓新的對話框和舊對話框排列的整齊一些?應該是能設定二者的相對位置吧?

    最開始,以為要用Shell.setLocation來設置,但是對于一個Dialog而言,它的Shell在什么時候才能初始化呢?

    我 在構造函數里面,configureShell(Shell newShell)方法里面,Control createDialogArea(Composite parent)方法里面都調用過了this.getShell方法想得到當前的Shell,結果都拋出空指針異常....

    后來看書發現,應該重寫protected Point getInitialLocation(Point initialSize)方法

    比如,在最開始的例子中,在第二個對話框中我重寫了該方法,代碼如下:

    protected?Point?getInitialLocation(Point?initialSize)?{
    ????????Point?location?
    =?new?Point(this.getParentShell().getLocation().x
    ????????????????
    +?this.getParentShell().getBounds().width,?this
    ????????????????.getParentShell().getLocation().y
    ????????????????
    +?this.getParentShell().getBounds().height
    ????????????????
    -?this.getInitialSize().y);
    ????????
    return?location;
    ????}


    其結果就是兩個對話框底部對齊的平行排列:)

    目的2: 登陸對話框要記住上次的位置。

    想了半天,好像只能用IPreferenceStore來做了,在繼承了AbstractUIPlugin的類中放入兩個常量:

    ????public?static?final?String?LOGINDIALOG_POSITION_X?=?"LOGINDIALOG_POSITION_X";

    ????
    public?static?final?String?LOGINDIALOG_POSITION_Y?=?"LOGINDIALOG_POSITION_Y";

    然后重寫兩個方法:

    ????@Override
    ????
    protected?Point?getInitialLocation(Point?initialSize)?{

    ????????String?xposition?
    =?preferenceStore
    ????????????????.getString(Peer68TPlugin.LOGINDIALOG_POSITION_X);
    ????????String?yposition?
    =?preferenceStore
    ????????????????.getString(Peer68TPlugin.LOGINDIALOG_POSITION_Y);
    ????????
    if?(xposition?==?null?||?yposition?==?null || xposition == ""
    ??? ??? ??? ??? || yposition == ""
    )?{
    ????????????
    return?super.getInitialLocation(initialSize);
    ????????}?
    else?{
    ????????????
    return?new?Point(Integer.parseInt(xposition),?Integer
    ????????????????????.parseInt(yposition));
    ????????}
    ????}

    ????@Override
    ????
    public?boolean?close()?{
    ????????preferenceStore.setValue(Peer68TPlugin.LOGINDIALOG_POSITION_X,?
    this
    ????????????????.getShell().getLocation().x);
    ????????preferenceStore.setValue(Peer68TPlugin.LOGINDIALOG_POSITION_Y,?
    this
    ????????????????.getShell().getLocation().y);
    ????????
    return?super.close();
    ????}

    大功告成!

    posted @ 2006-11-08 15:23 小小涼粉 閱讀(2199) | 評論 (0)編輯 收藏

    1. The Maven Command:

    mvn?archetype:create
    -DarchetypeGroupId=org.springframework.osgi
    -DarchetypeArtifactId=spring-osgi-bundle-archetype
    -DarchetypeVersion=1.0-SNAPSHOT
    -DremoteRepositories=http://static.springframework.org/maven2-snapshots
    -DgroupId=maventest
    -DartifactId=maventest
    -Dversion=1.0.0


    2. After the project is successfully created, please add the following repositories to the POM


    ?
    <repository>
    ???
    <id>?springframework.org?</id>
    ???
    <name>Springframework?Maven?SNAPSHOT?Repository</name>
    ???
    <url>?http://static.springframework.org/maven2-snapshots/?</url>
    ?</repository>?????????????????
    ???????????????????????
    ?
    <repository>????????????????????????????????????????
    ???
    <id>safehaus-repository</id>???????????????????????
    ???
    <name>Safehaus?Repository</name>???????????????????
    ???
    <url>http://m2.safehaus.org?</url>??????????????????
    ?</repository>?

    3. run "mvn compile", everything is ok! :-)

    Thanks for the help of every guys。

    posted @ 2006-10-31 21:41 小小涼粉 閱讀(1645) | 評論 (0)編輯 收藏

    				

    posted @ 2006-10-30 11:58 小小涼粉 閱讀(259) | 評論 (0)編輯 收藏

    第一個評價是來自于我前年冬天的博客,第二個評價是來自于我01年的一篇文章----差別還可以.....

    小小涼粉,您的總體評價:

    文字的平民化韻味濃郁,具有很強的生活氣息;相對正統的創作路線,可讀性較強。架構清晰,邏輯性強,情節縝密,可讀性強;文章內容豐富,觀點翔實可圈可點;在用詞范圍方面可以著重下功夫改進。情節縝密題材的小說值得嘗試,將推理、懸念、歷史的因素摻雜其中;同時也可以嘗試雜文、評論等文體。行文時留心描寫與情節結構的緊密配合,必然會誕生令人耳目一新的作品。


    小小涼粉,您的測算結果:

    通過測算,您的文章與知名作家的相似度比較結果見下:

    王安憶
    27%
    沒有想到吧,你有這位作家那么一點點的味道喲。
    張小嫻
    25%
    沒有想到吧,你有這位作家那么一點點的味道喲。
    鄭淵潔
    11%
    如果不是我們科學的分析結果,你沒有發覺自己還有些許這位作家的風格吧^_^

    小小涼粉,您的總體評價:

    古風古韻的味道,古色古香的文字。架構清晰,邏輯性強,情節縝密,可讀性強;文章內容豐富,觀點翔實可圈可點;在用詞范圍方面可以著重下功夫改進。情節縝密題材的小說值得嘗試,將推理、懸念、歷史的因素摻雜其中;同時也可以嘗試雜文、評論等文體。行文時留心描寫與情節結構的緊密配合,必然會誕生令人耳目一新的作品。


    小小涼粉,您的測算結果:

    通過測算,您的文章與知名作家的相似度比較結果見下:

    古龍
    17%
    這個區間是比較正常的,看來你已經有了掌握神韻的感覺喔。
    張小嫻
    13%
    如果不是我們科學的分析結果,你沒有發覺自己還有些許這位作家的風格吧^_^
    錢鐘書
    8%
    如果不是我們科學的分析結果,你沒有發覺自己還有些許這位作家的風格吧^_^

    posted @ 2006-10-26 18:10 小小涼粉 閱讀(295) | 評論 (0)編輯 收藏

    Sailor?? 罵的,真騷,用英語聊個P啊
    小刀?? 是啊
    小刀?? 你真騷?
    Sailor? 你更騷
    Sailor? 你最騷
    小刀?? 你最騷
    小刀?? 你是騷上加騷
    Sailor? 騷!
    小刀?? 別忘了,是你先說英語的!
    Sailor? 誰讓你跟著說來著
    小刀?? 所以最騷的是你
    Sailor? 你是跟騷!
    小刀?? ok,沒問題,反正你最騷

    posted @ 2006-10-26 17:29 小小涼粉 閱讀(239) | 評論 (0)編輯 收藏

    首唱會上,靚穎還唱了光芒,她第一張EP的主打歌。她說這首歌正是她彼時的心里話,“謝謝你一直陪在我的身旁”。當人們擁 有高度的物質文明時,回眸一顧,精神家園卻已花果飄零。于是當這個堅強自信、勇敢執著、珍愛友誼的東方女孩出現的時候,我們心甘情愿,陪她一同面對艱難、 挫折、成功、喜悅。?

    當靚穎獨自一人站在高臺上,說這首歌使她決心成為一個好歌手 的時候,我們都知道是什么,已經有人喊出了《Hero》。當她從高臺上跳下的時候,當熟悉的旋律響起來,全場靜默。我敢說這時候一定有人在熱淚盈眶。一曲 結束的時候,她將手抬起,伸出食指,指向臺下的涼粉,然后深深一躬。?

    所有靚穎的Hero版本——也許是因為這是我第一次聽見現場——我覺得最為震撼——靚穎在動情。?

    我在想什么?我在想,靚穎一路走來,并非青云直上,一帆風順。沉沉黑夜里,有一步步深深淺淺的腳印。然而勇者無懼,寂寂風中,有涼粉舉燭相伴,成就靚穎今夜的The?One。所以,從《光芒》到《英雄》,才是那樣感天動地,蕩氣回腸!?

    那時候她在想什么?她一定想起小時候聽著卡帶的情景,想起參加超女中的種種,想起所有涼粉的陪伴,讓她有勇氣追求自己的夢想。所以,仔細去看,她跳下高臺 的表情和步履是那樣的義無反顧,走向涼粉的表情和步履同樣是那樣義無反顧。她被我們奉為“英雄”,她又把“英雄”送給了我們。?

    而我們——在臺下揮舞熒光棒的涼粉、守在電腦前不肯離去的涼粉——風霜雨雪中,永遠是為英雄守候的身影,為靚穎擔待的脊梁!

    posted @ 2006-10-19 09:07 小小涼粉 閱讀(302) | 評論 (0)編輯 收藏

    首先是一個效果圖:

    login.JPG

    為了不違反保密協議,偶在這里把logo和相關的東西都涂掉了,希望不會讓人覺得難看....

    ok,下面就開始講述偶的coding過程:

    首先捏,Dialog是分為三部分的,Window Title Bar,Content Area和Button Bar

    這里的Window Title Bar素很難改動滴,偶也米改....而接下來的ContentArea和ButtonBar因為素分成兩截滴,所以就要把一張背景圖片拆成兩截,分別設置成ContentArea和ButtonBar的背景圖片鳥~~~
    ????protected?Control?createDialogArea(Composite?parent)?{
    ??????? Composite?composite?=?(Composite)?super.createDialogArea(parent);
    ????????composite.setBackgroundImage(backgroundImage);
    ??????? .......
    ??? }

    ??? protected?Control?createButtonBar(Composite?parent)?{
    ??????? Control?composite?
    =?super.createButtonBar(parent);
    ????????composite.setBackgroundImage(backgroundBtmImage);
    ??????? .......
    ???????
    return?composite;
    ????}

    當然,僅僅做到這些還是遠遠不夠滴,不信,你看~~~

    login2.JPG

    看到效果了咩....接下來偶們要做滴就是解決掉背景的問題,因為這個對話框里面沒有Table、Tree之類的控件,于是在createDialogArea()方法中加入一行:

    composite.setBackgroundMode(SWT.INHERIT_DEFAULT);

    我們再來看看改變后的效果:

    login3.JPG

    如上圖所示,介個ContentArea的背景問題已經解決鳥,下面就素重中之重滴ButtonArea鳥~~~讓我們打開Dialog的源代碼,看一下createButtonBar()的部分,就可以發現里面有兩行:

    ????????GridData?data?=?new?GridData(GridData.HORIZONTAL_ALIGN_END
    ????????????????
    |?GridData.VERTICAL_ALIGN_CENTER);
    ????????composite.setLayoutData(data);

    介樣子怎么能行捏,偶們需要讓介個Composite填滿整個DialogArea,這樣子才可以顯示出整個背景圖片,所以偶們就要在重寫后的方法中加入下面一行代碼:

    composite.setLayoutData(new?GridData(SWT.FILL,?SWT.TOP,?false,?false));

    現在讓偶們再來看看運行后的結果:

    login4.JPG

    為什么會素介個樣子捏?即使素把layout改成SWT.RIGHT,也不會改變介個結果...偶快要郁悶滴抓狂鳥.....

    經過漫長滴測試,偶終于發現鳥,如果控件滴layoutData不grabExcessSpace的話,那么現在滴DialogArea的Composite實際大小就素兩個Button加起來滴大小,所以無論如何也素不會居右對齊滴....介可怎么辦捏.....如果去重寫createButton方法滴話,那介個dialog滴代碼可就太丑陋鳥....

    在一個偶然滴機會下,偶終于發現鳥SWT.RIGHT_TO_LEFT !!!偶依稀見到鳥燦爛滴曙光!8過Composite的style素在創建時指定的,似乎米辦法在后面覆蓋,所以偶們只好整個滴把createButtonBar重寫掉鳥~~~

    ????protected?Control?createButtonBar(Composite?parent)?{
    ????????Composite?composite?
    =?new?Composite(parent,?SWT.RIGHT_TO_LEFT
    ????????????????
    |?SWT.NONE);
    ????????
    //?create?a?layout?with?spacing?and?margins?appropriate?for?the?font
    ????????
    //?size.
    ????????GridLayout?layout?=?new?GridLayout();
    ????????layout.makeColumnsEqualWidth?
    =?true;
    ????????layout.marginWidth?
    =?convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    ????????layout.marginHeight?
    =?convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    ????????layout.horizontalSpacing?
    =?convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    ????????layout.verticalSpacing?
    =?convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    ????????layout.marginLeft?
    =?10;
    ????????composite.setLayout(layout);
    ????????GridData?data?
    =?new?GridData(SWT.FILL,?SWT.TOP,?false,?false);
    ????????composite.setLayoutData(data);
    ????????composite.setFont(parent.getFont());

    ????????
    //?Add?the?buttons?to?the?button?bar.
    ????????createButtonsForButtonBar(composite);
    ??????? composite.setBackgroundImage(backgroundBtmImage);
    ????????
    return?composite;
    ????}

    在上面的代碼中,偶除了對偶所提到的地方進行了修改以外,還加上鳥一行: layout.marginLeft?=?10;

    介個素因為如果右邊距過小滴話,背景圖片就會被覆蓋掉一些,而因為偶們用到鳥
    SWT.RIGHT_TO_LEFT,所以應當設置marginLeft滴值 :-)

    還有一點素8能忘記滴,就素要重寫一下setButtonLayoutData(Button button)方法,因為偶們要把Button改成居右對齊:

    ????protected?void?setButtonLayoutData(Button?button)?{
    ????????GridData?data?
    =?new?GridData(SWT.RIGHT,?SWT.CENTER,?false,?false);
    ????????
    int?widthHint?=?convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
    ????????Point?minSize?
    =?button.computeSize(SWT.DEFAULT,?SWT.DEFAULT,?true);
    ????????data.widthHint?
    =?Math.max(widthHint,?minSize.x);
    ????????button.setLayoutData(data);
    ????}

    然后再在createButtonsForButtonBar()方法中,把創建按鈕的順序改變一下,偶們就可以看到最開始滴那張美麗滴對話框鳥~~~雖然被偶涂改滴有些不美麗鳥~~~

    現在還有個小小滴問題就素按鈕距離底端滴黑框太近鳥~~介個素因為,介個Composite只有一行,所以要改變按鈕距離底端滴距離,那么DialogArea滴大小就要跟著改變,而現在偶們滴DialogArea所需要滴背景圖片還米改好,于是只有這樣鳥~~~大家應該知道在哪里設置底邊的邊距吧?就素createButtonBar方法中滴那個layout.marginHeight =xxx :)

    最后別忘了,整個對話框的高度,應該是Window Title Bar,Content Area和Button Bar三部分滴和。

    偶已經說完鳥,如果覺得偶滴介篇文章對你有些幫助的朋友,請去支持一下偶們美麗可愛滴靚穎同學滴新專輯The One吧:)多謝!

    posted @ 2006-10-16 18:11 小小涼粉 閱讀(4198) | 評論 (12)編輯 收藏

    IWorkbenchPreferenceConstants中有很多常量,用來配置preference settings,諸如:

    OPEN_NEW_PERSPECTIVE——打開新視圖的方式
    DOCK_PERSPECTIVE_BAR——鎖定
    PerspectiveBar的位置
    INITIAL_FAST_VIEW_BAR_LOCATION——表示fast view bar在一個fresh workspace中鎖定的位置,This preference is meaningless after a workspace has been setup, since the fast view bar state is then persisted in the workbench
    SHOW_TRADITIONAL_STYLE_TABS——表示是否在editor和view上顯示傳統的tab style
    SHOW_PROGRESS_ON_STARTUP——是否在啟動時顯示progress
    SHOW_TEXT_ON_PERSPECTIVE_BAR——是否在PerspectiveBar上顯示文字

    等等......

    更改的時候
    在RCP中的plugin.xml里,使用preferenceCustomization屬性,例如:
    CODE:

    <extension
    id="someproduct"
    point="org.eclipse.core.runtime.products">
    <product
    ? application="com.example.someproduct.application"
    ? name="Some Product">
    ? <property
    ??? name="preferenceCustomization"
    ??? value="plugin_customization.ini"/>

    然后在ini文件中進行對應的設置

    或者,
    PlatformUI.getPreferenceStore().setDefault(IWorkbenchPreferenceConstants.SHOW_TRADITIONAL_STYLE_TABS,false);

    posted @ 2006-10-08 10:04 小小涼粉 閱讀(1245) | 評論 (1)編輯 收藏

    先說一下AOSD的起源吧

    傳統的軟件工程有一個不變的主題:對關注點的分解和局部化。將系統分解成為主要的功能模塊,識別出關注點的其他問題,確保所有關注點的問題都能在代碼的適當位置得到解決。但是關注點的分散和混雜又給代碼編寫和后期維護帶來了很大的難度。
    因此,必須有一種方法可以把關注點集中在一起,讓系統開發者可以使用關注點自身的模塊來描述每個關注點的行為。
    AOSD,用以尋找軟件系統中新的模塊化特性,允許對系統中多個關注點進行獨立描述,同時又能自動統一到系統中。

    然后是一些常用的術語(from AOSD wiki):

    concern(關注點):A concern is an area of interest or focus in a system. Concerns are the primary criteria for decomposing software into smaller, more manageable and comprehensible parts that have meaning to a software engineer.

    crosscutting(橫切):Note that crosscutting is a relationship between representations of concerns. Note also that it is a symmetric relationship. Therefore, if:

    1. A is a representation of one a concern,
    2. B is a representation of another concern, and
    3. A crosscuts B,

    then B also crosscuts A.

    This means that the term "crosscutting concerns" is often misused in two ways: To talk about a single concern, and to talk about concerns rather than representations of concerns. Consider "synchronization is a crosscutting concern": we don't know that synchronization is crosscutting unless we know what it crosscuts. And there may be representations of the concerns involved that are not crosscutting.

    aspect(方面):Aspects are one kind of concern in software development.

    joint point(聯接點):Join points are those elements of the programming language semantics which the aspects coordinate with. Nowadays, there are various join point models around and still new under development. They heavily depend on the underlying programming language and AO language.

    In a number of presently available AOP languages, a join point is a region in the dynamic control flow of an application. Thus a join point can for instance represent

    * a call to a method,
    * execution of a method,
    * the event of setting a field,
    * the event of handling an exception ...

    Join points can be picked up by an AOP program by using pointcuts to match on them. Depending on the pointcut language the AOP language provides, it may be possible to pick up more or less of those join points. Since join points are dynamic, it may be possible to expose runtime information such as the caller or callee of a method from a join point to a matching pointcut.

    advice:In a number of AOP languages, advice consists of a pointcut and a body. The body executes at join points the pointcut matches. This pointcut may expose runtime information to the advice body.

    pointcut:

    (from Without EJB):A set of join points,defined to specify when an advice should fire.Pointcuts are often described using either regular expressions or another wildcard syntax.

    (from Wiki)In a number of AOP languages, a pointcut is a predicate over dynamic join points, meaning that given a certain dynamic join point, a pointcut can either match this join point or not (at runtime). Another view of pointcuts is often, that they represent sets of join points. A pointcut may expose runtime information to a piece of advice.

    Weaving:The process of coordinating aspects and non-aspects. Weaving can be done explicitly or implicitly, and can be done at a variety of times ranging from by-hand weaving when code is written, through compile-time, post-compile time and load time, up to runtime.

    Without EJB中有個例子很好的解釋了一下上面的術語:

    public class MyBusinessObject implements BusinessObject{
    public void businessMethod1() throws UnauthorizedException{
    doSecurityCheck();
    }
    public void businessMethod2() throws UnauthorizedException{
    doSecurityCheck();
    }
    public void requiresNoSecurityCheck() {
    }
    public void doSecurityCheck() throws UnauthorizedException{
    }
    }

    這里,安全檢查就是一個aspect,需要進行安全檢查的這幾個方法就是join point。而由于不是所有的方法都需要進行安全檢查,所以就需要用pointcut來進行匹配。

    下面使用了一個interceptor來將關注點模塊化:

    import org.aopalliance.intercept.MethodInterceptor;
    import org.aopalliance.intercept.MethodInvocation;

    public class SecurityInterceptor implements MethodInterceptor{
    public Object invoke(MethodInvocation invocation)throws Throwable{
    doSecurityCheck();
    return invocation.proceed();
    }
    public void doSecurityCheck{}
    }

    這里的interceptor就是advice

    posted @ 2006-09-27 23:51 小小涼粉 閱讀(266) | 評論 (0)編輯 收藏

    需要以下的對象:
    LoginDialog,用于展示狀態,
    LoginListener,用于監聽登錄狀態,并根據不同的情況改變LoginDialog的顯示
    LoginAction,用于執行登錄的業務邏輯,并且根據不同的結果來fire不同的動作。

    狀態一共有以下幾種:
    1。登錄中
    2。登錄成功
    3。登錄失敗
    ? 3.1 連接失敗
    ? 3.2 用戶名密碼錯誤
    ? 3.3 .....
    4。用戶取消登錄

    下面是代碼片段:

    Application;

    public?class?Application?implements?IPlatformRunnable?{
    ?
    ???
    ????
    /*
    ?????*?(non-Javadoc)
    ?????*?
    ?????*?@see?org.eclipse.core.runtime.IPlatformRunnable#run(java.lang.Object)
    ?????
    */
    ????
    public?Object?run(Object?args)?throws?Exception?{

    ????????
    try?{

    ????????????TestLoginDialog?dialog?=?new?TestLoginDialog(Display.getCurrent()
    ????????????????????.getActiveShell());
    ????????????LoginListener?loginListener?
    =?new?LoginListenerImpl(dialog);
    ????????????LoginAction?action?
    =?new?LoginAction("login");
    ????????????action.addLoginListener(loginListener);
    ????????????dialog.setLoginAction(action);

    ????????????
    if?(dialog.open()?!=?Window.OK)?{
    ????????????????
    return?IPlatformRunnable.EXIT_OK;
    ????????????}
    ????????????
    int?returnCode?=?PlatformUI.createAndRunWorkbench(display,
    ????????????????????
    new?ApplicationWorkbenchAdvisor());

    ????????????
    if?(returnCode?==?PlatformUI.RETURN_RESTART)?{
    ????????????????
    return?IPlatformRunnable.EXIT_RESTART;
    ????????????}
    ????????????
    return?IPlatformRunnable.EXIT_OK;
    ????????}?
    finally?{
    ????????????display.dispose();
    ????????}
    ????}
    }


    LoginListener:

    public?interface?LoginListener?extends?EventListener{
    ????
    public?void?loginError(String?message);

    ????
    public?void?loginComplete();

    ????
    public?void?loginCanceled();
    ????
    ????
    public?void?loginStarted();
    ????
    }


    LoginAction:這里要用到Job,因為登錄的邏輯處理必須要在異步線程中來做,否則UI就會停住的。

    public?class?LoginAction?extends?Job?{
    ????
    private?LoginListener?loginListener;
    ????
    private?Session?session?=?Session.getInstance();

    ????
    public?LoginAction(String?name)?{
    ????????
    super(name);
    ????}

    ????
    public?void?addLoginListener(LoginListener?listener)?{
    ????????
    this.loginListener?=?listener;
    ????}

    ????
    public?void?fireLoginComplete()?{
    ????????loginListener.loginComplete();
    ????}

    ????
    public?void?fireLoginStarted()?{
    ????????loginListener.loginStarted();
    ????}

    ????
    public?void?fireLoginError(String?message)?{
    ????????loginListener.loginError(message);
    ????}

    ????
    public?void?fireLoginCanceled()?{
    ??? ??? //write cancel login logic here
    ????????loginListener.loginCanceled();
    ????}

    ????@Override
    ????
    protected?IStatus?run(IProgressMonitor?monitor)?{
    ????????login();
    ????????
    return?Status.OK_STATUS;
    ????}

    ????
    public?boolean?login()?{
    ????????fireLoginStarted();

    ????????if?(//網絡連接失敗)?{
    ???????????
    fireLoginError(Messages.getString("Session.connectionFailed"));
    ????????}?
    else?{
    ????????????
    if?(//登錄失敗)?{
    ???????????
    fireLoginError(Messages.getString("Session.loginFailed"));
    ????????????}?
    else?{
    ????????????????session.setAuthenticated(
    true);
    ????????????????fireLoginComplete();
    ??? ??? ??? ??? //處理登錄動作
    ????????????}
    ????????}
    ????????
    return?session.isAuthenticated();
    ????}

    }


    LoginDialog:

    這里用到了StackLayout,因為在登錄的過程中,需要在顯示用戶名/密碼的位置上,顯示gif動畫,所以在createDialogArea的時候,要創建一個主Composite,然后將其layout設置為StackLayout,然后創建兩個Composite,將其parent都設置為主Composite,新創建的兩個我將其命名為loginInfoComposite和loginAnimaComposite,顧名思義,一個用來顯示登錄信息,一個用來顯示登錄動畫。

    關于如何顯示gif,我在這里就不多說了,因為SWT Snippet和Eclipse的SWT Example里面都有對應的例子,我在這里推薦大家去參考一下SWT Example,因為那里面是用Canvas來繪圖的,這也是我們所需要的。

    在使用StackLayout的時候要注意,當我們使用stackLayout.topControl = xxx的時候,還要調用stackLayout.layout()方法,否則會不起作用。

    還有就是因為在登錄的過程中,按鈕欄應該是不可見的,但是Dialog的getButtonBar方法是protected的,所以就重寫了這個方法,聲明為public,返回super.getButtonBar(),雖然源碼的注釋中寫著這個方法不應該重寫,但是我想,這樣子應該沒問題吧。

    另外,在繪制gif的下方添加一個按鈕,并且addSelectionListener,當SelectionEvent發生的時候,就去觸發loginAction的fireCancel方法就可以了。

    細節就不描述了,下面是一些個人認為比較關鍵的代碼片段:

    ????/*
    ?????*?to?create?login?button?
    ?????
    */
    ????
    public?static?int?LOGIN_ID?=?9527;


    ????protected?void?createButtonsForButtonBar(Composite?parent)?{
    ????????createButton(parent,?LOGIN_ID,?Messages
    ????????????????.getString(
    "LoginDialog.loginbutton"),?true);?]
    ????????createButton(parent,?IDialogConstants.CANCEL_ID,?Messages
    ????????????????.getString(
    "LoginDialog.cancelbutton"),?false);
    ????}


    ????@Override
    ????
    protected?void?buttonPressed(int?buttonId)?{
    ????????
    if?(buttonId?==?LOGIN_ID)?{
    ????????????loginPressed();
    ????????}
    ????????
    super.buttonPressed(buttonId);
    ????}


    ??? protected?void?loginPressed()?{
    ??? ??? //...
    ????????loginAction.schedule();
    ????}

    然后是LoginListener的實現類:

    public?class?LoginListenerImpl?implements?LoginListener?{
    ????
    private?Display?display;
    ????
    //login?dialog
    ????private?TestLoginDialog?dialog;
    ????
    //image?to?show?on?login?failed
    ????private?Image?errorMessageImage?=?AbstractUIPlugin
    ????????????.imageDescriptorFromPlugin(Application.PLUGIN_ID,
    ????????????????????IImageKeys.crodoTitleImage).createImage();
    ????
    //error?message?area?background
    ????private?Color?errorMessageBackground?=?new?Color(null,?255,?255,?0);

    ????
    public?LoginListenerImpl(TestLoginDialog?dialog)?{
    ????????
    this.dialog?=?dialog;
    ????????display?
    =?Display.getCurrent();
    ????}

    ??? //因為這里需要在非UI線程中更新UI,所以要用display.syncExec()方法。
    ????public?void?loginCanceled()?{
    ????????display.syncExec(
    new?Runnable()?{
    ????????????
    public?void?run()?{
    ????????????????dialog.getStackLayout().topControl?
    =?dialog
    ????????????????????????.getLoginInfoComposite();
    ????????????????dialog.getStackLayoutComposite().layout();
    ????????????????dialog.animate();
    ????????????????dialog.getButtonBar().setVisible(
    true);
    ????????????}
    ????????});
    ????}

    ????
    public?void?loginComplete()?{
    ????????display.syncExec(
    new?Runnable()?{
    ????????????@SuppressWarnings(
    "deprecation")
    ????????????
    public?void?run()?{
    ??? ??? ??? ??? //我知道Thread.stop()方法已經被廢棄,但是暫時沒想到什么方法來中止
    ??? ??? ??? ??? //就暫時這樣子用了,還請大家指教!
    ????????????????dialog.getAnimateThread().stop();
    ????????????????dialog.okPressed();
    ????????????}
    ????????});
    ????}

    ????
    public?void?loginError(final?String?message)?{
    ????????display.syncExec(
    new?Runnable()?{
    ????????????
    public?void?run()?{
    ????????????????dialog.getErrorMessageLabel().setText(message);
    ????????????????dialog.getErrorMessageLabel().setImage(errorMessageImage);
    ????????????????dialog.getErrorMessageLabel().setBackground(
    ????????????????????????errorMessageBackground);
    ????????????????dialog.getStackLayout().topControl?
    =?dialog
    ????????????????????????.getLoginInfoComposite();
    ????????????????dialog.getStackLayoutComposite().layout();
    ????????????????dialog.animate();
    ????????????????dialog.getButtonBar().setVisible(
    true);
    ????????????}
    ????????});
    ????}

    ????
    public?void?loginStarted()?{
    ????????display.syncExec(
    new?Runnable()?{
    ????????????
    public?void?run()?{
    ????????????????dialog.getStackLayout().topControl?
    =?dialog
    ????????????????????????.getLoginAnimaComposite();
    ????????????????dialog.getStackLayoutComposite().layout();
    ????????????????dialog.animate();
    ????????????????dialog.getButtonBar().setVisible(
    false);
    ????????????}
    ????????});
    ????}

    posted @ 2006-09-25 19:02 小小涼粉 閱讀(2129) | 評論 (1)編輯 收藏

    如果使用了Eclipse3.2提供的自繪制功能來在table或者tree里面繪制圖像或文字的時候,就必須在LabelProvider中,將對應column的返回值置空,同時需要記住的是,即使所有的column都使用自繪制功能的時候,也必須要給viewer提供一個LabelProvider,否則每一行的第一列上都會顯示出對應Object的toString()方法的結果。

    posted @ 2006-09-21 14:44 小小涼粉 閱讀(1307) | 評論 (2)編輯 收藏

    SMTP的連接和收發過程

    a.建立TCP連接。
    b.客戶端發送HELO命令以標識發件人自己的身份,然后客戶端發送MAIL命令服務器端正希望以OK作為響應,表明準備接收。
    c.客戶端發送RCPT命令,以標識該電子郵件的計劃接收人,可以有多個RCPT行
    d.協商結束,發送郵件,用命令DATA發送
    e.以.表示結束輸入內容一起發送出去
    f.結束此次發送,用QUIT命令退出。

    SMTP的基本命令集

    HELO   向服務器標識用戶身份
    MAIL   初始化郵件傳輸mail from:
    RCPT   標識單個的郵件接收人;常在MAIL命令后面可有多個rcpt to:
    DATA   在單個或多個RCPT命令后,表示所有的郵件接收人已標識,初始化數據傳輸,以.結束。
    NOOP   無操作,服務器應響應OK
    RSET   重置會話,當前傳輸被取消
    QUIT   結束會話


    POP3簡介

    在POP3協議中有三種狀態,認可狀態,處理狀態,和更新狀態。當客戶機與服務器建立聯系時,一旦客戶機提供了自己身份并成功確認,即由認可狀態轉入處理狀態,在完成相應的操作后客戶機發出quit命令,則進入更新狀態,更新之后最后重返認可狀態。

    POP3基本命令集
    USER username
    PASS password   
    STAT  請求服務器發回關于郵箱的統計資料,如郵件總數和總字節數
    LIST  返回郵件數量和每個郵件的大小
    RETR [Msg#] 返回由參數標識的郵件的全部文本
    DELE [Msg#] 服務器將由參數標識的郵件標記為刪除,由quit命令執行
    RSET 服務器將重置所有標記為刪除的郵件,用于撤消DELE命令
    NOOP 服務器返回一個肯定的響應
    QUIT 更新


    class POP3Demo {
    ?? private static String POP3Server = "pop.126.com";
    ??? private static String USERNAME = "username";//實際應用中改成真實的用戶名
    ??? private static String PASSWORD = "password";//實際應用中改成真實的密碼
    ??? public static void main(String[] args) {
    ??????? int POP3Port = 110;
    ??????? Socket client = null;
    ??????? try {
    ??????????? // 向POP3服務程序建立一個套接字連接。
    ??????????? client = new Socket(POP3Demo.POP3Server, POP3Port);
    ??????????? // 創建一個BufferedReader對象,以便從套接字讀取輸出。
    ??????????? InputStream is = client.getInputStream();
    ??????????? BufferedReader sockin = new BufferedReader(new InputStreamReader(is));
    ??????????? // 創建一個PrintWriter對象,以便向套接字寫入內容。
    ??????????? OutputStream os = client.getOutputStream();
    ??????????? PrintWriter sockout = new PrintWriter(os, true);
    ??????????? // 顯示同SMTP服務程序的握手過程。
    ??????????? System.out.println("S:" + sockin.readLine());
    ??????????? sockout.println("user " + POP3Demo.USERNAME);
    ??????????? System.out.println("S:" + sockin.readLine());
    ??????????? sockout.println("pass " + POP3Demo.PASSWORD);
    ??????????? System.out.println("S:" + sockin.readLine());
    ??????????? sockout.println("stat");
    ??????????? String temp[] = sockin.readLine().split(" ");
    ??????????? int count = Integer.parseInt(temp[1]);//得到信箱中共有多少封郵件
    ??????????? for (int i = 1; i < count + 1; i++) {//依次打印出郵件的內容
    ??????????????? sockout.println("retr " + i);
    ??????????????? System.out.println("以下為第" + i + "封郵件的內容");
    ??????????????? while (true) {
    ??????????????????? String reply = sockin.readLine();
    ??????????????????? System.out.println(reply);
    ??????????????????? if (reply.toLowerCase().equals(".")) {
    ??????????????????????? break;
    ??????????????????? }
    ??????????????? }
    ??????????? }

    ??????? } catch (IOException e) {
    ??????????? System.out.println(e.toString());
    ??????? } finally {
    ??????????? try {
    ??????????????? if (client != null) {
    ??????????????????? client.close();
    ??????????????? }
    ??????????? } catch (IOException e) {}
    ??????? }
    ??? }
    }

    ?class SMTPDemo {
    ??? //以下三項請在使用時改成真實的信箱地址
    ??? //并且注意,SMTPServer和receiver必須是同一個服務器
    ??? private static String sender = "sender";
    ??? private static String receiver = "receiver";
    ??? private static String SMTPServer = "smtpserver";
    ??? public static void main(String[] args) {
    ??????? int SMTPPort = 25;
    ??????? Socket client = null;
    ??????? try {
    ??????????? // 向SMTP服務程序建立一個套接字連接。
    ??????????? client = new Socket(SMTPDemo.SMTPServer, SMTPPort);
    ??????????? // 創建一個BufferedReader對象,以便從套接字讀取輸出。
    ??????????? InputStream is = client.getInputStream();
    ??????????? BufferedReader sockin = new BufferedReader(new InputStreamReader(is));
    ??????????? // 創建一個PrintWriter對象,以便向套接字寫入內容。
    ??????????? OutputStream os = client.getOutputStream();
    ??????????? PrintWriter sockout = new PrintWriter(os, true);
    ??????????? // 顯示同SMTP服務程序的握手過程。
    ??????????? System.out.println("S:" + sockin.readLine());
    ??????????? sockout.println("helo");
    ??????????? System.out.println("S:" + sockin.readLine());
    ??????????? sockout.println("mail from: " + "<" + SMTPDemo.sender + ">");
    ??????????? System.out.println("S:" + sockin.readLine());
    ??????????? sockout.println("rcpt to: " + "<" + SMTPDemo.receiver + ">");
    ??????????? System.out.println("S:" + sockin.readLine());
    ??????????? sockout.println("data");
    ??????????? //發送郵件標題
    ??????????? sockout.println("subject: 你好");
    ??????????? //發送郵件內容
    ??????????? sockout.println("ni hao");
    ??????????? sockout.println("wo shi li jian");
    ??????????? //此處的.為特殊標記,表示郵件結束
    ??????????? sockout.println(".");
    ??????????? sockout.println("rset");
    ??????????? sockout.println("quit");
    ??????? } catch (IOException e) {
    ??????????? System.out.println(e.toString());
    ??????? } finally {
    ??????????? try {
    ??????????????? if (client != null) {
    ??????????????????? client.close();
    ??????????????? }
    ??????????? } catch (IOException e) {}
    ??????? }
    ??? }
    }


    posted @ 2006-09-18 15:11 小小涼粉 閱讀(2644) | 評論 (5)編輯 收藏

    Design decisions:

    Most platforms require that widgets be created within the context of a specific parent, so SWT requires that a parent widget be supplied as one of its constructor arguments. Another requirement of many platforms is that certain style settings must be supplied at creation time (for example, buttons can be checkboxes, radio buttons, or simple buttons and text fields can be single- or multi-line).

    Style bits are represented by int constants defined in the SWT class. Styles are then OR'ed together and passed as another constructor argument to create the initial style of a widget.

    SWT works directly with the native underlying graphic resources, each SWT resource consumes a GUI resource, and timely release of that resource is essential not only for your SWT application's well-being, but also for the well-being of all other GUI programs currently running. Java's garbage collection carries no timeliness guarantees, and would make a poor manager of graphic resources for SWT. So, instead, you as programmer must assume the responsibility.

    Fortunately, a widget that is a child of another widget is automatically destroyed when its parent is destroyed. This means that if you properly dispose of a shell, you do not need to dispose of each of its children because they will be disposed of automatically.

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

    Top-level classes:

    Each SWT application needs a display and one or more shells (representing each window frame).

    Display: The Display object represents the connection between the application-level SWT classes and the underlying windowing system implementation.

    One of the most important tasks of this class is its event-handling mechanism. The Display class maintains a collection of registered event listeners, reads events from the lower-level operating-system event queue, and delivers these events to the appropriate implementations of registered listener logic.

    Shell: Every window has a shell representing the window frame with which the user interacts. The Shell object represents a window—either a top-level window or a dialog window. It contains the various controls that make up the application: buttons, text boxes, tables

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

    Control: The Control class is the abstract superclass of all the dialog and window component classes such as Button, Label, ProgressBar, Sash, Scrollable, and Slider

    Composite: Taking a bottom-up view of the world, every control has a parent that is an instance of the class Composite or one of its subclasses. The class Shell, which represents the top-level windows of your application, is a subclass of Composite.

    Stated another way, this time from the top down, a display contains a list of top-level shells, where each shell is the root of a tree composed of composites and controls. Composites can contain other composites, allowing the tree to have arbitrary depth. If the child of a shell is another shell, the child is commonly called a dialog shell. A dialog shell always stays in front of the parent shell.

    posted @ 2006-09-18 15:09 小小涼粉 閱讀(253) | 評論 (0)編輯 收藏

    ModalessDialog:

    public class ModalessDialog extends Dialog {
    ?public ModalessDialog(Shell arg0) {
    ??super(arg0);
    ??setShellStyle(SWT.SHELL_TRIM | SWT.MODELESS | SWT.RESIZE | SWT.MAX);
    ?}
    }


    程序中需要雙擊攝像頭,然后彈出的對話框中顯示攝像頭所捕捉的畫面,原來是這樣寫的:

    ??deviceTab.getViewer().addDoubleClickListener(
    ????new IDoubleClickListener() {
    ?????public void doubleClick(DoubleClickEvent event) {
    ??????StructuredSelection selection = (StructuredSelection) event
    ????????.getSelection();
    ??????DeviceDataDialog dialog = new DeviceDataDialog(event
    ????????.getViewer().getControl().getShell());
    ??????dialog.open();
    ?????}
    ????});

    但是這樣子出來的對話框,會始終保持在最前端顯示。后來改成

    DeviceDataDialog dialog = new DeviceDataDialog(null);

    就可以了
    也許是因為原先的程序中,對話框和主窗口使用同一個Shell所造成的吧

    posted @ 2006-09-18 15:09 小小涼粉 閱讀(989) | 評論 (0)編輯 收藏

    因為RCP的界面也是使用MVC模式的,于是想操作TableViewer、TreeViewer的時候,不應該直接對Viewer進行操作,而是應該操作viewer的input。修改以后,調用一下viewer.refresh()方法就可以了。

    今天碰到的問題是,在一個widget中,使用

    viewer.setInput(DisplayConst.publishingDevices.values());

    可以順利更新

    而在另外一個widget中,使用

    ??viewer.setInput(DisplayConst.locationTable.get(this.getUserName()));

    就不能正常更新了。

    測試了半天,又想了一下才明白,viewer.setInput以后,我們只能夠修改input的內容,而不能修改input這個對象內存地址的值。就和方法調用在java中只能傳值調用一樣了。

    posted @ 2006-09-18 15:08 小小涼粉 閱讀(719) | 評論 (0)編輯 收藏

    為了批量發布設備,需要在一個窗口中為設備命名,設定其類型等,要用到Combo,所以就用了CellEditor

    用CellEditor還是很方便的,有CheckboxCellEditor,ComboBoxCellEditor,LabelCellEditor,TextCellEditor等等。

    首先把TableColumn的名稱做成String數組,調用viewer.setColumnProperties()方法

    然后做一個CellEditor數組,數組中的每一個CellEditor都對應著每一個Column

    然后實現ICellModifier接口,做一個自己的CellModifier,并調用viewer.setCellModifier()方法

    接口中有三個方法:

    1.public boolean canModify(Object element, String property)
    用來判斷哪一個屬性可寫
    2.public Object getValue(Object element, String property)
    返回某個屬性的值
    3.public void modify(Object element, String property, Object value)
    為某個屬性賦值

    昨天碰到了很多異常,情況如下:

    1.ComboCellEditor 中對應的是Integer類型的值,如果用了String的話,就會有異常拋出。

    2.tableviewer的input中,對象的很多屬性沒有賦初始值,由此而導致了在CellModifier里面調用get或者set方法時,出現了空指針異常。

    3.update tableviewer。今天上午才找到table.addFocusListener方法,而且要在focusGained方法中進行更新。應該是由于編輯Cell的時候,focus從Table轉移到了Cell上,所以要用focusGained方法吧。

    posted @ 2006-09-18 15:08 小小涼粉 閱讀(1367) | 評論 (0)編輯 收藏

    首先下載soap,把soap.war放到tomcat/webapp/目錄下,在classpath下面加入soap.jar、mail.jar和 activation.jar,然后創建一個Service和Client,把Service.class放到 tomcat/webapp/soap/WEB-INF/classes目錄下,然后把mail.jar和activation.jar放到 tomcat/webapp/soap/WEB-INF/lib下面,并寫一個配置文件用于部署服務。

    <isd:service
    ?? xmlns:isd="http://xml.apache.org/xml-soap/deployment"
    ?? id="urn:service" checkMustUnderstands="true">
    ????? <isd:provider type="java" scope="Request" methods="setAlarm">
    ????? <isd:java class="work.Service" static="false"/>
    ?? </isd:provider>
    </isd:service>


    上面的work.Service是類的全名,setAlarm是提供的服務名,urn:service是URI。再寫一個腳本來調用配置文件部署服務

    java org.apache.soap.server.ServiceManagerClient
    http://localhost:8080/soap/servlet/rpcrouter deploy deploy.xml

    啟動Tomcat之后,啟動腳本,然后執行Client代碼就可以了,Client的主體代碼很簡單,代碼里面就不加入注釋了。
    ??
    ??? Call call = new Call ();
    ??? call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);
    ??? call.setTargetObjectURI ("urn:service");
    ??? call.setMethodName ("setAlarm");
    ??? Parameter param = new Parameter("alarm", String.class, alarm, Constants.NS_URI_SOAP_ENC);
    ??? Vector paramList = new Vector();
    ??? paramList.addElement(param);
    ??? call.setParams (paramList);
    ??? URL url = new URL ("http://localhost:8080/soap/servlet/rpcrouter");
    ??? Response resp = call.invoke (url, "");
    ??? if (!resp.generatedFault()) {
    ????? // Extract Return value
    ????? Parameter result = resp.getReturnValue ();
    ????? String greeting = (String) result.getValue();
    ????? return greeting;
    ??? }
    ??? else {
    ????? //? Extract Fault Code and String
    ????? Fault f = resp.getFault();
    ????? String faultCode = f.getFaultCode();
    ????? String faultString = f.getFaultString();
    ????? System.err.println("Fault Occurred (details follow):");
    ????? System.err.println("Fault Code:? "+faultCode);
    ????? System.err.println("Fault String:? "+faultString);
    ????? return new String ("Fault Occurred.? No greeting for you!");
    ??? }

    posted @ 2006-09-18 15:06 小小涼粉 閱讀(369) | 評論 (0)編輯 收藏

    昨天寫完程序并部署Service之后,一直都在拋出接口不匹配的異常,于是我就寫了個簡單的接口,只傳入一個String類型的參數,結果運行正常。然后我又寫了個只傳入Integer類型參數的接口,果不出所料,又發生了接口不匹配的異常。接下來我就開始改Client端代碼:

    params.addElement(new Parameter("eventStatus",Integer.class, new Integer(1), null));
    params.addElement(new Parameter("eventStatus",int.class, new Integer(1), null));
    params.addElement(new Parameter("eventStatus",int.class, 1, null));
    params.addElement(new Parameter("eventStatus",Intege.class, 1, null));
    結果統統失敗,弄的我都要抓狂了。

    今天到了公司以后,跟組長說了這件事情,組長說讓我換用AXIS試試看,我到ws.apache.org/axis上面看了看文檔,在user guide里面給出的例子和我的代碼差別很大,我就只好按著它的例子重新改代碼

    寫完以后,配環境變量配的快要抓狂……部署的時候又是一頭霧水……最后始終沒有成功……最后回到宿舍才想到,AXIS和Apache SOAP Server不過都是服務器而已,不應該存在規范上的區別,也就是不應該會影響到客戶端的程序,于是我就按照最開始的代碼,把Service部署好,啟動 Tomcat,從WSDL中找到對應的信息

    <wsdl:service name="ServiceService">
    ?<wsdl:port binding="impl:serviceSoapBinding" name="service">
    ? <wsdlsoap:address location="http://localhost:8080/axis/services/service" />
    ?</wsdl:port>
    </wsdl:service>

    在xml配置文件中,把location賦值給URL,把name賦值給TargetObjectURI,運行Client,一切OK
    不知道是不是因為機器的問題,在公司的思路遠遠不如在宿舍啊

    不過今天至少讓我很熟練的掌握了如何手工部署AXIS服務,創建一個wsdd文件,我把它命名為deploy.wsdd



    把這個文件放到Tomcat/webapps/axis/WEB-INF/目錄下,把service的類放到WEB-INF/classes/目錄下,把 axis.jar;jaxrpc.jar;commons-logging-1.0.4.jar;commons-discovery-0.2.jar;saaj.jar 放到classpath里面,啟動Tomcat之后,到webapps/axis/WEB-INF目錄下運行:
    java org.apache.axis.client.AdminClient deploy.wsdd
    之后可以訪問
    http://localhost:8080/axis/
    來查看剛才部署的service對應的wsdl了

    posted @ 2006-09-18 15:05 小小涼粉 閱讀(454) | 評論 (0)編輯 收藏

    在web環境下,Quartz可以通過配置文件來完成后臺的作業調度,不必手工創建Trigger和Scheduler,其步驟如下:

    首先將quartz.jar,以及lib目錄下面core和optional兩個目錄中的所有jar全都放入項目WEB-INF\lib目錄下

    job就是一個簡單的java類,這里的功能就是輸出當前的時間了。

    import java.util.Date;

    import org.apache.commons.logging.Log;
    import org.apache.commons.logging.LogFactory;
    import org.quartz.Job;
    import org.quartz.JobExecutionContext;
    import org.quartz.JobExecutionException;

    public class Helloworld implements Job{
    ?public Helloworld() {
    ?}

    ?private static Log _log = LogFactory
    ???.getLog(Helloworld.class);

    ?public void execute(JobExecutionContext context)
    ???throws JobExecutionException {
    ??_log.info("Hello World! - " + new Date());
    ?}
    }

    然后編寫quartz.properties文件,這個文件的默認名稱就是quartz.properties,如果啟動項目的時候,Quartz沒有在工程中找到該文件,就會從自己的jar包下面讀取其默認的properties文件,其內容如下:

    org.quartz.scheduler.instanceName = TestScheduler
    org.quartz.scheduler.instanceId = one

    org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool
    org.quartz.threadPool.threadCount =? 2
    org.quartz.threadPool.threadPriority = 4

    org.quartz.plugin.triggHistory.class = org.quartz.plugins.history.LoggingTriggerHistoryPlugin
    org.quartz.plugin.triggHistory.triggerFiredMessage = Trigger {1}.{0} fired job {6}.{5} at: {4, date, HH:mm:ss MM/dd/yyyy}
    org.quartz.plugin.triggHistory.triggerCompleteMessage = Trigger {1}.{0} completed firing job {6}.{5} at {4, date, HH:mm:ss MM/dd/yyyy} with resulting trigger instruction code: {9}

    org.quartz.plugin.jobInitializer.class = org.quartz.plugins.xml.JobInitializationPlugin
    org.quartz.plugin.jobInitializer.fileName = quartz_job.xml
    org.quartz.plugin.jobInitializer.overWriteExistingJobs = false
    org.quartz.plugin.jobInitializer.failOnFileNotFound = true
    org.quartz.plugin.shutdownhook.class = org.quartz.plugins.management.ShutdownHookPlugin
    org.quartz.plugin.shutdownhook.cleanShutdown = true

    上面的

    org.quartz.plugin.jobInitializer.fileName = quartz_job.xml

    是用來配置定義job文件的名稱。

    然后編寫quartz_job.xml,

    <?xml version="1.0" encoding="UTF-8"?>
    <quartz>
    ? <job>
    ??? <job-detail>
    ????? <name>helloworld</name>
    ????? <group>group1</group>
    ????? <job-class>Helloworld</job-class>
    ??? </job-detail>
    ??? <trigger>
    ????? <cron>
    ??????? <name>test</name>
    ??????? <group>group1</group>
    ??????? <job-name>helloworld</job-name>
    ??????? <job-group>group1</job-group>
    ??????? <cron-expression>0 0/1 * * * ?</cron-expression>
    ???? </cron>
    ??? </trigger>
    ? </job>
    </quartz>

    可以看到,在配置文件中把jobdetail和trigger都作了完整的定義,并組合成一個job。下面,我們把上面兩個文件都放入/WEB-INF/classes目錄下,然后按照api中的說明修改一下web.xml。

    ???? <servlet>
    ???????? <servlet-name>
    ???????????? QuartzInitializer
    ???????? </servlet-name>
    ???????? <display-name>
    ???????????? Quartz Initializer Servlet
    ???????? </display-name>
    ???????? <servlet-class>
    ???????????? org.quartz.ee.servlet.QuartzInitializerServlet
    ???????? </servlet-class>
    ???????? <load-on-startup>1</load-on-startup>
    ???????? <init-param>
    ???????????? <param-name>config-file</param-name>
    ???????????? <param-value>/quartz.properties</param-value>
    ???????? </init-param>
    ???????? <init-param>
    ???????????? <param-name>shutdown-on-unload</param-name>
    ???????????? <param-value>true</param-value>
    ???????? </init-param>
    ???? </servlet>

    這樣,在啟動Tomcat的時候,QuartzInitializerServlet這個Servlet就會自動讀取quartz.properties這個配置文件,并初始化調度信息,啟動Scheduler。
    我在這里用的是Quartz1.5.0,在1.5.1中新增加了QuartzInitializerListener,但是似乎有些問題,始終啟動不起來,而且更過分的是,它的api居然寫錯了,在<listener-class>這個標記中,用了 QuartzInitializerServletListener,就算把機器砸了,它也找不到這個類啊!

    現在就大功告成了
    一個Job類,一個quartz.properties文件,一個quertz_job.xml文件,還有修改一下web.xml文件,很簡單呀!

    不過看起來簡單,解決的過程卻很郁悶,單單是考慮如何在后臺進程中運行Servlet就花了好長時間,后來查資料以后才知道可以用Listener或者是啟動時運行的Servlet來完成,看來自己的底子還是不扎實的.

    另外就是在Tomcat出現問題的時候,居然忘了到logs下面去看日志,這個疏忽是不可原諒的!以后要牢牢記住!

    posted @ 2006-09-18 15:05 小小涼粉 閱讀(1143) | 評論 (0)編輯 收藏

    在驗證用戶登錄的時候,各個類調用的順序如下所示:

    authenticationProcessionFilter(AuthenticationProcessingFilter)---->

    authenticationManager(ProviderManger)---->

    daoAuthenticationProvider(DaoAuthenticationProvider)---->

    userDetailsService(UserDetailsService)

    在最底層的UserDetailsService接口中,提供了loadUserByUsername這個方法,我們只需要實現這個接口,并實現接口中的方法,就可以使用自己的驗證功能了。該方法傳入的參數是String username,返回類型是UserDetails,很顯然,我們需要通過自己的dao,根據username來得到自定義的user類型,然后把它封裝到UserDetails里面去,然后返回。

    另外,在UserDetail這個類里面,有一個GrantedAuthority[] 類型的屬性,用來存放該用戶所對應的權限,我們在loadUserByUsername這個方法里面,同樣也需要得到該用戶的權限,并把它賦給返回的UserDetails。

    假如用戶對應的類名為UserInfo,權限對應的類名為Roles,在UserInfo中有一個變量

    private Set roles;

    在得到權限信息的時候,因為它是集合,所以可以使用延遲加載功能,讀取的時候先從緩存中取數據,如果取不到的話,就調用UserInfo.getRoles()方法,這個時候就會到數據庫中取數據了,取到以后,再把數據放到緩存中。

    posted @ 2006-09-18 15:04 小小涼粉 閱讀(280) | 評論 (0)編輯 收藏

    1. SOAP--Simple Object Access Protocal

    SOAP is a lightweight protocol intented to exchanging structured information in a decentralized, distributed environment.The two major goals for SOAP is simplicity and extensibility.

    SOAP is widely used for XML messaging as it :

    ??? defines thin layer on top of widely understood HTTP?
    ??? is flexible and extensible?
    ??? enjoys broad industry and developer community support

    Main uses of SOAP are for

    ??? messaging: sending XML data orders, invoices, forms?
    ??? RPC: invoking services querying data sources, transacting

    2. WSDL--Web Service Definition Language

    As?the communication protocols and message formats are standardized?in the web community, it becomes increasingly possible and important to be able to?describe the communication s in some structured way.WSDL addresses this need by defining an XML grammar for describing network services as collections of communication endpoints capable of exchanging messages.

    3. ?UDDI--?Universal Description, Discovery, and Integration

    UDDI protocol is a central element of the group of related standards that comprise the Web services stack. The specification defines a standard method for publishing and discovering the network-based software components of a service-oriented architecture.

    4.? the relationship between SOAP,WSDL and UDDI

    web service client 需要定位另一個應用程序或者是網絡上的某一段業務邏輯, client 通過 name catagory identifier 或者 specification 來從 UDDI registry 中查詢服務,定位以后, client UDDI registry 中得到 WSDL 文檔的位置信息。在 WSDL 文檔的 XML schema 中包含了如何訪問 web service 和請求信息的格式, client 按照 xml schema 的格式來創建一個 soap 消息,并向 host 發送請求。

    posted @ 2006-09-18 15:03 小小涼粉 閱讀(299) | 評論 (0)編輯 收藏

    用一個類來存放applicationContext:
    public class ContextHolder {
    ? private final static ContextHolder instance = new ContextHolder();
    ? private ApplicationContext ac;
    ? private ContextHolder() {
    ? }
    ? public static ContextHolder getInstance() {
    ??? return instance;
    ? }
    ? public synchronized void setApplicationContext(ApplicationContext ac) {
    ??? this.ac = ac;
    ? }
    ? public ApplicationContext getApplicationContext() {
    ??? return ac;
    ? } ?
    }

    然后寫一個servlet,繼承自org.springframework.web.context.ContextLoaderServlet,并配置web.xml,讓它在tomcat啟動時自動運行。然后在它的init方法中,加入如下的代碼:
    WebApplicationContext context = WebApplicationContextUtils.
    ??? getWebApplicationContext(this.getServletContext());
    ContextHolder.getInstance().setApplicationContext(context);

    posted @ 2006-09-18 14:57 小小涼粉 閱讀(867) | 評論 (0)編輯 收藏

    Can you foresee everything? No. Are the decisions you make today final? No. It's practically impossible to think everything or know everything in the beginning of a project. You will learn more as a project goes on. However, you can use your experience or experiences of others to guide you in a certain direction. You can make decisions that might minimize changes tomorrow.

    posted @ 2006-09-18 14:54 小小涼粉 閱讀(183) | 評論 (0)編輯 收藏

    EventHandler要抽象出一個接口來,然后根據不同的需要實現不同的handler,不然就無法在服務器reply以后通知UI更新,但至于是否要在UI中再生成異步線程來做這件事情,還要通過編碼測試一下。

    不過目前我的感覺是不需要再生成異步線程了,因為底層Peercore的操作本身就是異步的,不需要等待它的方法操作完畢以后再返回,應該只需要把UI中要更新的控件作為參數傳到EventHandler里面去,這樣handler就可以通知UI更新了——打住!RCP非UI的線程是無法操作UI線程的!!只能通過UIJob或者是Display.asnyexec()方法來更新UI,所以....還是要定義很多的UIJob的子類的......

    posted @ 2006-09-18 14:54 小小涼粉 閱讀(317) | 評論 (0)編輯 收藏

    主站蜘蛛池模板: 香港经典a毛片免费观看看| 久久九九久精品国产免费直播| 韩国免费三片在线视频| 污网站在线免费观看| 亚洲国产一二三精品无码| 免费在线观看视频网站| 日本亚洲高清乱码中文在线观看| 亚洲宅男天堂在线观看无病毒| av大片在线无码免费| 尤物视频在线免费观看| 亚洲国产日韩在线一区| 亚洲AⅤ视频一区二区三区 | 18级成人毛片免费观看| 国产成人亚洲精品电影| 色婷婷亚洲十月十月色天| 全黄性性激高免费视频| 成人在线免费看片| 一区二区三区免费看| 亚洲制服丝袜第一页| 亚洲乱码无码永久不卡在线 | 在线免费播放一级毛片| 亚洲人成色在线观看| 老司机亚洲精品影院无码| 亚洲欧洲中文日韩av乱码| 无码一区二区三区免费视频 | www一区二区www免费| 亚洲人和日本人jizz| 亚洲人成网77777亚洲色| 狼友av永久网站免费观看| 午夜免费福利片观看| h视频免费高清在线观看| 伊人久久亚洲综合影院首页| 亚洲国产精品婷婷久久| 亚洲国产精品成人AV无码久久综合影院 | 亚洲国产老鸭窝一区二区三区| 四虎影视永久免费观看地址| 无码人妻一区二区三区免费手机 | 久久精品国产精品亚洲| 妞干网在线免费视频| 男女超爽刺激视频免费播放| 日韩精品在线免费观看|