亚洲系列国产精品制服丝袜第,亚洲日韩精品无码专区,国产亚洲?V无码?V男人的天堂http://m.tkk7.com/steeven/category/6472.htmlzh-cnTue, 27 Feb 2007 11:16:17 GMTTue, 27 Feb 2007 11:16:17 GMT60吹一吹偶的新作品:skype remote desktophttp://m.tkk7.com/steeven/archive/2006/12/06/85926.htmlsteevensteevenWed, 06 Dec 2006 12:18:00 GMThttp://m.tkk7.com/steeven/archive/2006/12/06/85926.htmlhttp://m.tkk7.com/steeven/comments/85926.htmlhttp://m.tkk7.com/steeven/archive/2006/12/06/85926.html#Feedback4http://m.tkk7.com/steeven/comments/commentRss/85926.htmlhttp://m.tkk7.com/steeven/services/trackbacks/85926.html
自己拿來skype4java看了一下,感覺很好用。里面提供了一個application機制,類似socket,又強于socket。為什么說強呢?因為是基于skype, 穿透防火墻啦。
windows自帶的遠程桌面很好用,在速度上,比以前基于位圖傳送的netmeeting/pcanywhere之類的都要強。
linux下面的遠程桌面做的比較好的是nx系列。但是這些遠程桌面的致命問題就是網關、防火墻問題。
就是說你要在家訪問公司電腦,基本上要在防火墻上鑿洞,或者借助于vpn,softether之類的東東。

skype的application利用skype自身的通訊機制,屏蔽了這些問題,當然,你的應用也必須依賴skype了。

java做遠程桌面要能截屏、控制鼠標鍵盤,所幸有java.awt.Robot, 原來這個東西是為了做自動化測試,剛好。
剩下就是穿數據的問題。屏幕圖片,如果是bmp,比較碩大,即使是上網等文本界面,壓縮下來也要幾十k, 如果網絡帶寬不夠的話,比如公司有幾個下載愛好者,會比較慘。所以呢,決定傳差異,緩存前面的屏幕,看看如果差別不大,就只傳變化的部分。這樣數據量就比較小。但是呢,壓縮圖片的時候就不能采用有損壓縮啦,否則屏幕會變得越來越怪異。。。

比較遺憾的是沒能象windows自帶的rdp那樣攔截繪圖操作,在點陣圖的方案上效率還是比較低的。希望有高手指點!

skype4java是個日本人寫的,幾個聽了我介紹的朋友都有這疑問:日本人寫的?
呵呵,如果你能寫出更好的,咱就不用它。那個日本作者還不錯,上班比較忙,還是答應抽空fix幾個bug,感謝中~

體驗一下吧:skypeRDP

steeven 2006-12-06 20:18 發表評論
]]>
GWT開發中的幾個問題http://m.tkk7.com/steeven/archive/2006/07/14/58239.htmlsteevensteevenFri, 14 Jul 2006 10:10:00 GMThttp://m.tkk7.com/steeven/archive/2006/07/14/58239.htmlhttp://m.tkk7.com/steeven/comments/58239.htmlhttp://m.tkk7.com/steeven/archive/2006/07/14/58239.html#Feedback5http://m.tkk7.com/steeven/comments/commentRss/58239.htmlhttp://m.tkk7.com/steeven/services/trackbacks/58239.html適用版本GWT 1.0.21。
由于目前google web toolkit還沒有正式release, 所以問題多多。記錄一下碰到的問題:

1. Shell調試模式和實際編譯結果有差異。
shell中報告的異常在運行中只是一些凌亂的腳本錯誤,或者干脆沒有響應。
shell中通過的程序在實際運行時還會有錯誤。
2. 避免錯誤的方法是捕獲異常,
在onModuleLoad方法中try catch
或者GWT.setUnCaughtExceptionHandler()//全局異常捕獲
3. LOG, 利用GWT.log(). shell模式下會輸出到控制臺。
4. 遠程調用屬于異步。同步遠程調用可以自己包裝ClientCallback,在一個結束后調用另外一個.
5. RPC調用中Set傳遞有bug, 暫時用List
6. Eclipse直接運行Compiler/Shell, 加入gwt-dev-windows.jar。
main: com.google.gwt.dev.GWTCompiler/GWTShell
arguments: -out ${project_loc}\WebContent real/Index.html
classpath->UserEnties->advanced->add folder->選擇項目的src目錄,要在第一位。
7. Tomcat5問題多多, 用tomcat4.
8. gwt-user中非法包含javax.servlet, tomcat認為其無效。直接放到tomcat/common/lib中。或者在jar中去掉。
9. Exception.getStackTrace() 在Shell模式下有效, GWT.isScript()可以判斷
10. 靜態中文在html中亂碼,要在html header中加入<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />



steeven 2006-07-14 18:10 發表評論
]]>
開發過程中的雞生蛋蛋生雞的問題http://m.tkk7.com/steeven/archive/2006/07/02/56191.htmlsteevensteevenSun, 02 Jul 2006 12:28:00 GMThttp://m.tkk7.com/steeven/archive/2006/07/02/56191.htmlhttp://m.tkk7.com/steeven/comments/56191.htmlhttp://m.tkk7.com/steeven/archive/2006/07/02/56191.html#Feedback2http://m.tkk7.com/steeven/comments/commentRss/56191.htmlhttp://m.tkk7.com/steeven/services/trackbacks/56191.html雞,構造的時候要帶入蛋.
蛋,構造的時候要帶入雞.

編譯沒問題,初始化數據的時候問題出來了.
new 雞(new 蛋(???)) //蛋是誰下的?
作為一個正統的進化論學生,解決如下:構造原始雞類,雞開始是不下蛋的,把雞的構造函數改成空的,這時候初始化一條原始雞的數據沒問題.然后進化出來蛋,雞下的,類不用改,把蛋的數據初始化好.這時候雞進化,由蛋孵出來,構造方法要帶蛋進來,初始化一只新雞,刪除原始雞數據.

OK,問題解決了嗎?這樣程序每次初始化數據的時候要改造雞類,好像不大容易啊....

那上帝造物學說怎樣解決問題呢?:
雞1 = new 雞(null);
蛋1 = new 蛋(null);
雞1.set蛋(蛋1);
蛋1.set雞(雞1);
save(雞1,蛋1);
雞和蛋同時出來了.上帝造物法勝利

是不是我的類設計有問題,怎么會碰到雞生蛋蛋孵雞這種郁悶的問題呢?

steeven 2006-07-02 20:28 發表評論
]]>
監聽Swing窗口的鍵盤鼠標事件http://m.tkk7.com/steeven/archive/2006/06/13/52504.htmlsteevensteevenTue, 13 Jun 2006 08:52:00 GMThttp://m.tkk7.com/steeven/archive/2006/06/13/52504.htmlhttp://m.tkk7.com/steeven/comments/52504.htmlhttp://m.tkk7.com/steeven/archive/2006/06/13/52504.html#Feedback2http://m.tkk7.com/steeven/comments/commentRss/52504.htmlhttp://m.tkk7.com/steeven/services/trackbacks/52504.html一般Apply按鈕應該在用戶有輸入時有效,輸入沒有變化時無效。
為了達到這個效果,一般界面上每個輸入控件要監聽,并且和以前的值做比較,實現起來相當麻煩。

因為我們已有的界面是基于數據綁定,綁定到一個克隆的對象上。這樣判斷有沒有變化就很簡單,updateInput之后,比較兩個對象是否一致即可。

什么時候去判斷呢?在用戶輸入之后:捕捉鍵盤、鼠標事件。

攔截鍵盤鼠標事件目前找到兩種方法:
1. Toolkit.getDefaultToolkit().addAWTEventListener(listener,eventMask);
這個方法注冊全局的監聽機制,無論哪個窗口。里面注冊為weakHashmap,應該不用考慮垃圾回收問題。因為是全局的,不建議采用。
2. 攔截每個component自己的事件。
正常來說,如果在textbox里面打字,事件不會交給window處理。enableInputMethods(true)可以幫忙。
enable以后調用getInputContext(),取得InputContext處理。
注意,InputContext的dispatchEvent(AWTEvent)會接到各種消息,感興趣的getID()有以下三個:
???MouseEvent.MOUSE_CLICKED
???MouseEvent.MOUSE_WHEEL
???KeyEvent.KEY_TYPED



steeven 2006-06-13 16:52 發表評論
]]>
GWT做的guess numberhttp://m.tkk7.com/steeven/archive/2006/06/02/49941.htmlsteevensteevenFri, 02 Jun 2006 07:23:00 GMThttp://m.tkk7.com/steeven/archive/2006/06/02/49941.htmlhttp://m.tkk7.com/steeven/comments/49941.htmlhttp://m.tkk7.com/steeven/archive/2006/06/02/49941.html#Feedback13http://m.tkk7.com/steeven/comments/commentRss/49941.htmlhttp://m.tkk7.com/steeven/services/trackbacks/49941.html
anyway, 對于大多數邏輯都在客戶端的應用,gwt可以大展身手。比如小游戲~

guess number demo看這里:http://steeven.googlepages.com/MyApp.html
完全在瀏覽器上運行的玩意,沒有寫一句js,感覺還是很爽的~

代碼如下:
package?org.steeven.gwt.test.client;

import?com.google.gwt.core.client.EntryPoint;
import?com.google.gwt.user.client.Random;
import?com.google.gwt.user.client.ui.Button;
import?com.google.gwt.user.client.ui.ClickListener;
import?com.google.gwt.user.client.ui.DialogBox;
import?com.google.gwt.user.client.ui.Grid;
import?com.google.gwt.user.client.ui.HasHorizontalAlignment;
import?com.google.gwt.user.client.ui.RootPanel;
import?com.google.gwt.user.client.ui.TextBox;
import?com.google.gwt.user.client.ui.VerticalPanel;
import?com.google.gwt.user.client.ui.Widget;

/**
?*?
@author?steeven@gmail.com
?
*/

public?class?MyApp?implements?EntryPoint?{

????TextBox?txtCount?
=?new?TextBox();

????
private?Grid?pnlMain;

????
private?Button[]?numbers?=?new?Button[100];

????
private?int?target;

????
private?int?count;

????
private?DialogBox?box;

????
private?Button?btnRetry;

????
private?Button?btnClose;

????
/**
?????*?This?is?the?entry?point?method.
?????
*/

????
public?void?onModuleLoad()?{
????????VerticalPanel?pnlStatus?
=?new?VerticalPanel();
????????pnlStatus.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
????????pnlStatus.setSpacing(
20);

????????txtCount.setEnabled(
false);
????????txtCount.setVisibleLength(
10);
????????pnlStatus.add(txtCount);
????????btnRetry?
=?new?Button();
????????btnRetry.setHTML(
"<img?src=\"replay.gif\"/>?<u>R</u>etry");
????????btnRetry.setAccessKey(
'r');
????????btnRetry.addClickListener(
new?ClickListener()?{
????????????
public?void?onClick(Widget?sender)?{
????????????????doInit();
????????????}

????????}
);
????????pnlStatus.add(btnRetry);

????????Button?btnAbout?
=?new?Button();
????????btnAbout.setHTML(
"<img?src='about.gif'/>?<u>A</u>bout");
????????btnAbout.setAccessKey(
'a');
????????btnAbout.addClickListener(
new?ClickListener()?{
????????????
public?void?onClick(Widget?sender)?{
????????????????doAbout();
????????????}

????????}
);
????????pnlStatus.add(btnAbout);

????????RootPanel.get(
"status").add(pnlStatus);

????????pnlMain?
=?new?Grid(10,?10);
????????RootPanel.get(
"main").add(pnlMain);

????????
for?(int?i?=?0;?i?<?100;?i++)?{
????????????numbers[i]?
=?new?Button();
????????????numbers[i].setText(i?
+?"");
????????????numbers[i].addClickListener(
new?ClickListener()?{
????????????????
public?void?onClick(Widget?sender)?{
????????????????????doGuess(sender);
????????????????}

????????????}
);
????????????pnlMain.setWidget(i?
/?10,?i?%?10,?numbers[i]);
????????}


????????box?
=?new?DialogBox();
????????box.setPopupPosition(
400,?200);
????????btnClose?
=?new?Button("<u>C</u>lose",?new?ClickListener()?{
????????????
public?void?onClick(Widget?sender)?{
????????????????box.hide();
????????????????doInit();
????????????}

????????}
);
????????btnClose.setAccessKey(
'c');
????????box.add(btnClose);
????????doInit();
????}


????
protected?void?doGuess(Widget?sender)?{
????????Button?btn?
=?(Button)?sender;
????????btnRetry.setEnabled(
true);
????????
int?n?=?Integer.parseInt(btn.getText());
????????txtCount.setText(
""?+?(++count));
????????
if?(n?==?target)?{
????????????numbers[n].setEnabled(
false);
????????????btnClose.setFocus(
true);
????????????box.clear();
????????????box
????????????????????.setHTML(
"<center><img?src='win.gif'/><h1>YOU?WIN!!!</h1><br/><br/><br/>");
????????????box.add(btnClose);
????????????box.show();
????????}
?else?{
????????????
if?(n?<?target)
????????????????
for?(int?i?=?0;?i?<=?n;?i++)
????????????????????numbers[i].setEnabled(
false);
????????????
else
????????????????
for?(int?i?=?n;?i?<?100;?i++)
????????????????????numbers[i].setEnabled(
false);
????????}


????}


????
protected?void?doAbout()?{
????????box.clear();
????????box
????????????????.setHTML(
"<img?src='about.gif'/><h1>Guess?Number</h1><h3>Google?web?toolkit?test</h3>");
????????box.add(btnClose);
????????box.show();
????}


????
private?void?doInit()?{
????????btnRetry.setEnabled(
false);
????????target?
=?Random.nextInt(99);
????????count?
=?0;
????????txtCount.setText(
"0");
????????
for?(int?i?=?0;?i?<?100;?i++)?{
????????????numbers[i].setVisible(
true);
????????????numbers[i].setEnabled(
true);
????????}

????}


}


第一次玩gwt, 總共花了3個小時,菜呀

steeven 2006-06-02 15:23 發表評論
]]>
EMF之ResourceSet探索(4)http://m.tkk7.com/steeven/archive/2006/05/26/48271.htmlsteevensteevenFri, 26 May 2006 02:22:00 GMThttp://m.tkk7.com/steeven/archive/2006/05/26/48271.htmlhttp://m.tkk7.com/steeven/comments/48271.htmlhttp://m.tkk7.com/steeven/archive/2006/05/26/48271.html#Feedback1http://m.tkk7.com/steeven/comments/commentRss/48271.htmlhttp://m.tkk7.com/steeven/services/trackbacks/48271.html測試一下getResource(URI,boolean):

????????System.out.println(EcorePackage.eINSTANCE.eResource());? // 1
????????System.out.println(XMLTypePackage.eINSTANCE.eResource());? // 2

????????ResourceSet?rs?
= ? new ?ResourceSetImpl();
????????rs.getResourceFactoryRegistry().getExtensionToFactoryMap().put(
????????????????Resource.Factory.Registry.DEFAULT_EXTENSION,
????????????????
new ?XMIResourceFactoryImpl());
????????String?uri?
= ? " http://abc.eg/asdf " ;
// ????????System.out.println(rs.createResource(URI.createURI(uri)));? // ?如果創建過臨時的,得到這個
// ????????System.out.println(rs.createResource(URI.createURI(uri)));? // ?如果創建過多個臨時的,返回第一個,這個忽略
????????rs.getPackageRegistry().put(uri,?EcorePackage.eINSTANCE);? // 得到結果同1,如果上面取消注釋,本地創建的優先

????????System.out.println(rs.getResource(URI.createURI(uri),?
false ));? // 同1


createResource每次創建新的,getResource則是唯一實例的。

每個生成的XxxPackage.eINSTANCE會自行創建自己的Resource。如果在插件中修改了EcorePackge.eInstance.eResource(),會不會天下大亂呢?

==================
eclispe編輯器右邊的Mark Occurrence很方便,但是家里電腦上的這個黃色小標記很不清楚。前幾天調整了老半天,修改配色方案,換顯示器驅動,調整顯示器對比度、亮度都收效不大。昨天偶然把XP的桌面風格換回傳統模式,搞定了。

ecore.ecore這個問題很有意思,以前看過schema.xsd,就是自己定義自己。據說JDK也是用java開發編譯出來的。。。
先有雞還是現有蛋呢?



steeven 2006-05-26 10:22 發表評論
]]>
EMF之ResourceSet探索(3) http://m.tkk7.com/steeven/archive/2006/05/26/48249.htmlsteevensteevenThu, 25 May 2006 17:23:00 GMThttp://m.tkk7.com/steeven/archive/2006/05/26/48249.htmlhttp://m.tkk7.com/steeven/comments/48249.htmlhttp://m.tkk7.com/steeven/archive/2006/05/26/48249.html#Feedback0http://m.tkk7.com/steeven/comments/commentRss/48249.htmlhttp://m.tkk7.com/steeven/services/trackbacks/48249.html在RS中同一URI可以createResource多個Resource,List方式存放。還存在另外一種Map存放方式, getResource(URI,boolean loadOnDemand)就是通過這種方式存取,如果不存在的話創建。這兩個方法看起來有些沖突。似乎用于不同場合。

再來看看怎樣通過URL存取EObject:
RS整個相當于一個DataBase, Resource相當于表,存放的是EObject, 每個EObject可以看成對象或者XML。
表用URI來區分,URI中的Segment用來定位EObject。URI的例子參見探索(1)
getEObject(URL, boolean loadOnDemand)很簡單,getResource找到對應的Resource,在里面根據Segment查找,就是那個#///@xxx.n格式的東西,注意,還有ID方式。

getPackageRegistry()用來返回RS的URL->Package注冊表,它也是個本地的注冊表,代理了全局的EPackage.Registry.INSTANCE。這個注冊表用于取得EPackage(類型信息)和EFactory(創建實例)


Resource就不說了,主要load,save, 一些具體子類,比如XmlResourceImpl可以直接使用,指定Encoding之類。

看看ResourceSet對EMF了解了很多~



steeven 2006-05-26 01:23 發表評論
]]>
EMF之ResourceSet探索(2) http://m.tkk7.com/steeven/archive/2006/05/26/48242.htmlsteevensteevenThu, 25 May 2006 16:02:00 GMThttp://m.tkk7.com/steeven/archive/2006/05/26/48242.htmlhttp://m.tkk7.com/steeven/comments/48242.htmlhttp://m.tkk7.com/steeven/archive/2006/05/26/48242.html#Feedback0http://m.tkk7.com/steeven/comments/commentRss/48242.htmlhttp://m.tkk7.com/steeven/services/trackbacks/48242.html1. getResourceFactoryRegistry()
??public?Resource.Factory.Registry?getResourceFactoryRegistry()
??
{
????
if?(resourceFactoryRegistry?==?null)
????
{//可以自行Set一個注冊表實現,沒有的話用系統缺省注冊表
??????resourceFactoryRegistry?=
????????
new?ResourceFactoryRegistryImpl()
????????
{
??????????
public?Resource.Factory?delegatedGetFactory(URI?uri)
??????????
{
????????????
return?Resource.Factory.Registry.INSTANCE.getFactory(uri);
??????????}

????????}
;?//代理系統注冊表,注意這個應該是正宗的。
????}

????
return?resourceFactoryRegistry;
??}

所以自己new 出來的ResourceSet可以向注冊表中任意添加工廠實現。
2. 調用注冊表的getFactory(URI), 實現如下:
?public?Resource.Factory?getFactory(URI?uri)
??
{
????String?protocol?
=?uri.scheme();
????Object?resourceFactory?
=??protocolToFactoryMap.get(protocol);?//先根據protocol查找
????if?(resourceFactory?==?null)
????
{
??????String?extension?
=?uri.fileExtension();
??????resourceFactory?
=?extensionToFactoryMap.get(extension);?//找不到再根據擴展名查找
??????if?(resourceFactory?==?null)
??????
{
????????resourceFactory?
=?extensionToFactoryMap.get("*");?//嘗試查找缺省擴展
????????if?(resourceFactory?==?null)
????????
{
??????????resourceFactory?
=?delegatedGetFactory(uri);?//自行實現可以擴展此方法解析。
????????}

??????}

????}


????
//Descriptor可以用于編程使用
????return?
??????resourceFactory?
instanceof?Resource.Factory.Descriptor??
????????((Resource.Factory.Descriptor)resourceFactory).createFactory()?:
????????(Resource.Factory)resourceFactory;
??}

查找一個工廠居然這么復雜!正因為這么復雜,才能支持platform/file/fttp等眾多千奇百怪的URI
不同類型的工廠加工出不同類型的Resource, 才會輸出為XSD/XML/XMI/....

如果直接操作系統注冊表要小心。EMF中定義了幾個擴展點,可以實現類似目的。
已知的ResourceFactory實現有:XSD/ECore/EMOF/XML/XMI,XSD的輸出方法的介紹可以參考Eclipse Development using the Graphical Editing Framework and the Eclipse Modeling Framework電子書。





steeven 2006-05-26 00:02 發表評論
]]>
EMF之ResourceSet探索(1)http://m.tkk7.com/steeven/archive/2006/05/25/48229.htmlsteevensteevenThu, 25 May 2006 14:40:00 GMThttp://m.tkk7.com/steeven/archive/2006/05/25/48229.htmlhttp://m.tkk7.com/steeven/comments/48229.htmlhttp://m.tkk7.com/steeven/archive/2006/05/25/48229.html#Feedback0http://m.tkk7.com/steeven/comments/commentRss/48229.htmlhttp://m.tkk7.com/steeven/services/trackbacks/48229.html先看看現象,以EMF例子Library.ecore為例, 測試代碼如下:
public?class?Test?{
????
public?static?void?main(String[]?args)?throws?IOException?{
????????ResourceSet?rs?
=?new?ResourceSetImpl();
????????rs.getResourceFactoryRegistry().getExtensionToFactoryMap().put(
????????????????Resource.Factory.Registry.DEFAULT_EXTENSION,
????????????????
new?XMIResourceFactoryImpl()); //outside eclipse
????????Resource?resource?
=?rs.createResource(URI
????????????????.createURI(EXTLibraryPackage.eNS_URI));
????????
//step?a
????????Library?library?=?EXTLibraryFactory.eINSTANCE.createLibrary();
????????library.setName(
"some?lib");
????????resource.getContents().add(library);
????????
//step?b
//????????Book?book?=?EXTLibraryFactory.eINSTANCE.createBook();
//????????book.setTitle("some?book");
//????????Employee?employee?=?EXTLibraryFactory.eINSTANCE.createEmployee();
//????????employee.setFirstName("some?one");
????????
//step?c
//????????library.getBooks().add(book);
//????????library.getEmployees().add(employee);
????????
//step?d
//????????resource.getContents().add(book);
????
//????????System.out.println(EcoreUtil.getURI(employee));
//????????System.out.println(EcoreUtil.getURI(book));
????????resource.save(System.out,?null);
????}

}


步驟 輸出
a ----------------
<?xml version="1.0" encoding="ASCII"?>
<extlib:Library xmi:version="2.0" xmlns:xmi="http:///org/eclipse/emf/examples/library/extlibrary.ecore/1.0.0" name="some lib"/>
b?#//
#//
<?xml version="1.0" encoding="ASCII"?>
<extlib:Library xmi:version="2.0" xmlns:xmi="http:///org/eclipse/emf/examples/library/extlibrary.ecore/1.0.0" name="some lib"/>
c http:///org/eclipse/emf/examples/library/extlibrary.ecore/1.0.0#//@employees.0
#//
<?xml version="1.0" encoding="ASCII"?>
<extlib:Library xmi:version="2.0" xmlns:xmi="http:///org/eclipse/emf/examples/library/extlibrary.ecore/1.0.0" name="some lib">
? <employees firstName="some one"/>
</extlib:Library>
d http:///org/eclipse/emf/examples/library/extlibrary.ecore/1.0.0#/0/@employees.0
http:///org/eclipse/emf/examples/library/extlibrary.ecore/1.0.0#/1
<?xml version="1.0" encoding="ASCII"?>
<xmi:XMI xmi:version="2.0" xmlns:xmi="http:///org/eclipse/emf/examples/library/extlibrary.ecore/1.0.0">
? <extlib:Library name="some lib">
??? <employees firstName="some one"/>
? </extlib:Library>
? <extlib:Book title="some book"/>
</xmi:XMI>

可以看到,沒有加入lib的時候,employee/book實例的URI都是#//, employee加入以后有了#//@employees.0, book依舊。
在book加入resource以后有了#/1的URI, employee/book在containment定義分別是true,false,所以employee加入lib以后就隨lib加入resource(實例容器)。book則要單獨加入。

另外一個有趣的現象是Resource可以容納多個實例,在step d可以看到輸出的根節點由lib變成匿名容器。

如果lib不加入resource又如何呢?
步驟 輸出
a ----------------
b?#//
#//
c #///@employees.0
#//
d ----------------
沒加入resource之前,URI是未知的,知道的只是相對父節點的相對segment.



steeven 2006-05-25 22:40 發表評論
]]>
Annotation Wizard for EMF插件http://m.tkk7.com/steeven/archive/2006/05/24/47883.htmlsteevensteevenWed, 24 May 2006 12:14:00 GMThttp://m.tkk7.com/steeven/archive/2006/05/24/47883.htmlhttp://m.tkk7.com/steeven/comments/47883.htmlhttp://m.tkk7.com/steeven/archive/2006/05/24/47883.html#Feedback3http://m.tkk7.com/steeven/comments/commentRss/47883.htmlhttp://m.tkk7.com/steeven/services/trackbacks/47883.html手寫指定Source,指定每個Key/Value很容易出錯。
這個插件通過向導選擇source, 通過PropertySheet編寫Key/Value。并且根據Ecore的定義實現校驗。

Step1:


Step 2:
AllDataTypes組合了該URL下面所有的EDataType


Step3: 編輯屬性。注意source的變化:
如果選擇的AllDataTypes,就是Ecore的URI
如果選擇某個EClass, 后面會加上#EClassName


Step4: 如果選擇AllDataTypes,自動選擇所有EdataTypes。


Step5: 工作結果



請注意Source的生成規則!

適用版本:eclipse3.2rc3
下載地址: http://m.tkk7.com/Files/steeven/org.steeven.eclipse.emf.annotation.wizard.zip (含源碼)

steeven 2006-05-24 20:14 發表評論
]]>
EMF驗證擴展:自定義驗證規則http://m.tkk7.com/steeven/archive/2006/05/19/47107.htmlsteevensteevenFri, 19 May 2006 11:03:00 GMThttp://m.tkk7.com/steeven/archive/2006/05/19/47107.htmlhttp://m.tkk7.com/steeven/comments/47107.htmlhttp://m.tkk7.com/steeven/archive/2006/05/19/47107.html#Feedback0http://m.tkk7.com/steeven/comments/commentRss/47107.htmlhttp://m.tkk7.com/steeven/services/trackbacks/47107.html因為比較少,所以這里總結一下。

驗證的定義有兩種方式:
1. 生成驗證方法框架,代碼自己實現。參見EMF Overview:
? 添加Annotatio, Source=http://www.eclipse.org/emf/2002/Ecore, 然后添加DetailsEntry:key=constraints, Value=validateXxx
? EDataType,EClass支持,屬性不支持。
2. 定義類似Schema的Facet,自動生成對應的驗證代碼,用于驗證簡單數據類型:
? 添加Annotatio, Source=http:///org/eclipse/emf/ecore/util/ExtendedMetaData, 然后添加DetailsEntry:key=maxLength, Value=2
? 支持的facet參見ExtendedMetaData。
? 僅EDataType支持,屬性不支持。

示例Ecore:

新生成SqlmodelValidator.java, 代碼如下:

可見Table_ValidateC, MyLabel_ValidateA,MyLabel_validateB都自動生成,修改里面的if(false)為需要的業務判斷邏輯。
validateMyLabel_MaxLength()方法是根據ExtendedMetaData自動生成的,無需修改。

總結:
1. EMF驗證利用了Annotation擴展,這種機制很靈活,但是給用戶帶來不便。
2. Attribute屬性不能生成驗證規則(eclipse3.2rc3),可以定義為單獨的EDataType,然后引用之。
3. Constraints+Facet+本身的結構驗證可以構成很強的驗證規則,并且屬于Model層,數據本身即可驗證自身。
4. EObjectValidator.DynamicEDataTypeValidator似乎可用于動態驗證,有知道用法的朋友給講解一下~



steeven 2006-05-19 19:03 發表評論
]]>
Manifest編輯插件 for eclipse3.1/jdk1.5http://m.tkk7.com/steeven/archive/2006/04/07/39863.htmlsteevensteevenFri, 07 Apr 2006 08:24:00 GMThttp://m.tkk7.com/steeven/archive/2006/04/07/39863.htmlhttp://m.tkk7.com/steeven/comments/39863.htmlhttp://m.tkk7.com/steeven/archive/2006/04/07/39863.html#Feedback2http://m.tkk7.com/steeven/comments/commentRss/39863.htmlhttp://m.tkk7.com/steeven/services/trackbacks/39863.html
主要想法是運行程序一句話搞定: java -jar xxx.jar。所有class path在jar里面的manfiest.mf中設定。
當需要引用的jar很多的時候,windows2000有命令行的長度限制,會報錯。

主要功能:
1. new wizard
2. gui editor
3. switch auto-update in project menu

Class-Path in auto-updated manifest.mf file will be auto updated
while increase & full building.

下載:http://m.tkk7.com/Files/steeven/org.steeven.eclipse.manifest_1.0.zip

安裝:eclipse菜單[help]->?Software Updates->?Find and Install ->????Search for new features to install ->???new archieved site

steeven 2006-04-07 16:24 發表評論
]]>
總結一下最近碰到的幾個怪問題http://m.tkk7.com/steeven/archive/2006/04/07/39860.htmlsteevensteevenFri, 07 Apr 2006 08:15:00 GMThttp://m.tkk7.com/steeven/archive/2006/04/07/39860.htmlhttp://m.tkk7.com/steeven/comments/39860.htmlhttp://m.tkk7.com/steeven/archive/2006/04/07/39860.html#Feedback0http://m.tkk7.com/steeven/comments/commentRss/39860.htmlhttp://m.tkk7.com/steeven/services/trackbacks/39860.html最近碰到幾個怪問題:
1. 在新裝的XP上Swing界面文字不顯示,加上遠程調試參數就能出來。安裝最新的jre/jdk也沒用。啟動時加上遠程調試參數OK,但不能這樣交付啊。后來給顯卡升級了一下驅動,搞定!真是奇怪
2. xp上跑的很好的批處理在win2k下失敗,%~dps0失敗,這是用來取批處理的短格式當前路徑。google后知道這個參數在xpsp2以前都返回錯誤路徑,我倒。。。 %~dps1, %~dp0都能正常工作,于是乎,寫了兩個批處理,把%dp0(長路徑)傳給另外一個,在那里面用%~dps1取得后設定環境變量,成功~
3.?Java程序安裝成服務以后不能接受其他電腦的訪問,獨立運行的時候沒問題。用超級用戶權限也沒戲。后來拍拍腦袋發現是防火墻的問題,手動啟動服務的時候windows防火墻不提示是否允許訪問網絡,所以缺省就被禁止鳥~。在防火墻中添加例外程序以后OK。所以安裝程序需要聰明一些,自己在注冊表中增加相關設定。



steeven 2006-04-07 16:15 發表評論
]]>
可惡的mainfest.mf解析http://m.tkk7.com/steeven/archive/2006/03/09/34527.htmlsteevensteevenThu, 09 Mar 2006 10:43:00 GMThttp://m.tkk7.com/steeven/archive/2006/03/09/34527.htmlhttp://m.tkk7.com/steeven/comments/34527.htmlhttp://m.tkk7.com/steeven/archive/2006/03/09/34527.html#Feedback0http://m.tkk7.com/steeven/comments/commentRss/34527.htmlhttp://m.tkk7.com/steeven/services/trackbacks/34527.html

steeven 2006-03-09 18:43 發表評論
]]>
Java版2006新春祝福http://m.tkk7.com/steeven/archive/2006/01/12/27697.htmlsteevensteevenThu, 12 Jan 2006 03:33:00 GMThttp://m.tkk7.com/steeven/archive/2006/01/12/27697.htmlhttp://m.tkk7.com/steeven/comments/27697.htmlhttp://m.tkk7.com/steeven/archive/2006/01/12/27697.html#Feedback1http://m.tkk7.com/steeven/comments/commentRss/27697.htmlhttp://m.tkk7.com/steeven/services/trackbacks/27697.html偶msn名字是:Year y2006 = /*happy*/ new Year(2006);
一個朋友受到啟發,給偶寫了一段祝福代碼,稍微改編一下送給大家

for(Blogger blogger :  BlogFarm.getInstance["BlogJava"].getBloggers()){
    blogger.setHealth(
Health.good);
    blogger.getFamily().setHappy(blogger.getFamily().getHappy() 
1);
    blogger.setMoney(blogger.getMoney 
* 10);
}

備注:
1.未單元測試
2. 感覺不如c#版新春祝福優雅一些



steeven 2006-01-12 11:33 發表評論
]]>
沒事不要隨便吃螃蟹http://m.tkk7.com/steeven/archive/2006/01/05/26767.htmlsteevensteevenThu, 05 Jan 2006 11:08:00 GMThttp://m.tkk7.com/steeven/archive/2006/01/05/26767.htmlhttp://m.tkk7.com/steeven/comments/26767.htmlhttp://m.tkk7.com/steeven/archive/2006/01/05/26767.html#Feedback1http://m.tkk7.com/steeven/comments/commentRss/26767.htmlhttp://m.tkk7.com/steeven/services/trackbacks/26767.html最近程序除了點小問題,在多次執行某些操作之后屏幕會沒有反應,服務器上很多執行的線程也中止。
這是個很嚴重的問題,只要執行的任務一多,或者服務器開啟事件過長,都會有這個現象。
我們自己寫的服務器,支持服務器命令行指令。在服務器不響應時,命令行可以動作,但是exit命令執行時會掛起

分析過程:
1. debug模式啟動,找到command line線程,手工中斷,發現停留在Object.wait()方法上。
2. 向下看線程堆棧,是apache/common/pool/GenericObjectPool調用,向下是hibernate的ConnectionManager
3. 查看對象池的源碼,是因為池子滿了,因此等待借出對象return. 說明連接打開后沒有釋放。
4. 因為我們代碼中都是調用spring/hibernate的template或者自動事務,不存在手工打開連接,所以懷疑是哪個工具包出了問題。
5. 首先發現dbcp/pool都不是最新的,換上后無效。 hibernate3.1已經最新了。
6. 復制GenericObjectPool,在borrow和return方法中增加log, 打開connection Manager的log, 排除了所以配對的log外,有非connectionManager打開的連接,沒有被歸還。
7. debug發現是自動事務結束后,連接池中_numActive沒有變化,連接沒有關閉,懷疑spring問題,spring1.2.1是正式發行版本。在其網站上發現最新版本是1.2.6,看看新版本的更新說明,搜索到hibernate的修正,有一個正好就是說:修正了針對hibernate3.1的事務管理。
8. 更換為spring 1.2.6后正常,同時在dbcp中加大缺省maxActive數量。缺省為8個。

分析,因為hibernate3.1改變了事務處理方式,老版spring出現連接池泄漏。因為以前一直用的3.1的m版,所以看到正式版出來就直接更新了,沒想到有些比較重大的改變。記得當初更新時hibernate annotation當時就不能用,過了幾天才出來對應的更新版。

結論:單獨的api都是沒有問題的,配合起來很可能出問題。因此升級時應該謹慎,采用穩定版本,避免出現不匹配問題~~

浪費一個下午的時間~



steeven 2006-01-05 19:08 發表評論
]]>
主站蜘蛛池模板: 最近的免费中文字幕视频| 亚洲色偷偷偷网站色偷一区| 噜噜嘿在线视频免费观看| 一级女性全黄久久生活片免费| 久99精品视频在线观看婷亚洲片国产一区一级在线| 无码精品国产一区二区三区免费 | 亚洲欧洲日产韩国在线| 久久精品国产亚洲Aⅴ蜜臀色欲| 国产一精品一AV一免费| 一级一看免费完整版毛片| 亚洲精品无码成人| 亚洲av乱码一区二区三区| 亚洲日韩v无码中文字幕| 四虎永久精品免费观看| 久久久久国产精品免费免费搜索| 免费一级毛片在线播放视频免费观看永久| 国产亚洲精品久久久久秋霞| 四虎永久成人免费影院域名| 午夜寂寞在线一级观看免费| 日韩午夜理论免费TV影院| 最好免费观看高清在线| 最新亚洲精品国偷自产在线| 亚洲成AV人片久久| 亚洲精品福利网泷泽萝拉| 亚洲成色在线影院| 亚洲国产精品无码久久久蜜芽| 国内精自视频品线六区免费 | 亚洲乱码在线卡一卡二卡新区| 亚洲女人被黑人巨大进入| 免费不卡中文字幕在线| 无码国产亚洲日韩国精品视频一区二区三区 | 亚洲成片观看四虎永久| 精品国产免费观看久久久| 国产精品美女午夜爽爽爽免费| GOGOGO免费观看国语| 丝瓜app免费下载网址进入ios| 亚洲综合色丁香婷婷六月图片 | 全免费a级毛片免费**视频| 无码日韩人妻av一区免费| 台湾一级毛片永久免费| 无码日韩人妻av一区免费|