一直希望有个MapList这样的东西, 有k/v对,但是却是list形式存放的,可以排序.
List<String, String> maplist = new ArrayList<String, String>();
找过.没找到.今天写程序就突然想起来了,其实挺简单:
List<String[]> maplist = new ArrayList<String[]>();
String[] item = new String[2];
然后就是排序:
Arrays.sort(maplist, new Comparator(String[])
{
public int compare(String[] src, String des)
{
return src[0].compareTo(des[0]);
}
});
--
It's Hard to Define, But I Know it When I See it…
2006-11-20
2006-11-14
xpath用法
有如下的xml文件nodes.xml :
<library>
<book sum="22">helloworld
</book>
</library>
提取 "helloworld" 这个字符串 :
String filePath = "nodes.xml";
InputSource inputSource = new InputSource(filePath);
XPath xpath = XPathFactory.newInstance().newXPath();
String expression = "/library/book[@sum='22']";
String nodes = xpath.evaluate (expression, inputSource);
参考 : xpath语法, xpath validation , easy and efficient xml
--
It's Hard to Define, But I Know it When I See it…
<library>
<book sum="22">helloworld
</book>
</library>
提取 "helloworld" 这个字符串 :
String filePath = "nodes.xml";
InputSource inputSource = new InputSource(filePath);
XPath xpath = XPathFactory.newInstance().newXPath();
String expression = "/library/book[@sum='22']";
String nodes = xpath.evaluate (expression, inputSource);
参考 : xpath语法, xpath validation , easy and efficient xml
--
It's Hard to Define, But I Know it When I See it…
2006-11-10
nsIHTMLEditor的获取
代码大概是这样的:
final nsIWebBrowser webBrowser = browser.getWebBrowser();
nsIInterfaceRequestor requestor = (nsIInterfaceRequestor) webBrowser.queryInterface(nsIInterfaceRequestor.NS_IINTERFACEREQUESTOR_IID );
final nsIEditingSession session = (nsIEditingSession)requestor.getInterface(nsIEditingSession.NS_IEDITINGSESSION_IID);
nsIDOMWindow window = webBrowser.getContentDOMWindow();
session.makeWindowEditable (window, null, true);
nsIEditor editor = session.getEditorForWindow(window);
htmlEditor = (nsIHTMLEditor) editor.queryInterface(nsIHTMLEditor.NS_IHTMLEDITOR_IID);
本来是把他加在mozEditor的createPartControl里的, 这样运行出来editor一直是null.后来想到editor的获取应该在browser加载完document之后才能进行的罢? 于是就把代码加到ProgressListener的onCompleted()里面.运行,OK.
我觉得那个session应该也是在这个里面的,不过它在前面的代码里也能正确获取.
browser的加载一直都是异步的,新建线程?以前好像也有过一次因为加载顺序的原因而导致的错误.嗯..幸亏有个onCompleted方法
--
It's Hard to Define, But I Know it When I See it…
final nsIWebBrowser webBrowser = browser.getWebBrowser();
nsIInterfaceRequestor requestor = (nsIInterfaceRequestor) webBrowser.queryInterface(nsIInterfaceRequestor.NS_IINTERFACEREQUESTOR_IID );
final nsIEditingSession session = (nsIEditingSession)requestor.getInterface(nsIEditingSession.NS_IEDITINGSESSION_IID);
nsIDOMWindow window = webBrowser.getContentDOMWindow();
session.makeWindowEditable (window, null, true);
nsIEditor editor = session.getEditorForWindow(window);
htmlEditor = (nsIHTMLEditor) editor.queryInterface(nsIHTMLEditor.NS_IHTMLEDITOR_IID);
本来是把他加在mozEditor的createPartControl里的, 这样运行出来editor一直是null.后来想到editor的获取应该在browser加载完document之后才能进行的罢? 于是就把代码加到ProgressListener的onCompleted()里面.运行,OK.
我觉得那个session应该也是在这个里面的,不过它在前面的代码里也能正确获取.
browser的加载一直都是异步的,新建线程?以前好像也有过一次因为加载顺序的原因而导致的错误.嗯..幸亏有个onCompleted方法
--
It's Hard to Define, But I Know it When I See it…
2006-11-07
比较2种技术
在javaeye上看到的,感觉分类还挺全面的:
- Cost, including Developing, Migration, Maintenance, Fee, Performance Tuning etc.
- Tool Support, including what tool/component could be used etc.
- Performance
- Extensibility
- Integrability
- Technical Support, including vendor support, 3d support
- Technical Resources
- Stability
- Challenge
- Technical Trend
- Migration
- Special Language Features
- Security
- Applying domain
- Technical Background
- Cost, including Developing, Migration, Maintenance, Fee, Performance Tuning etc.
- Tool Support, including what tool/component could be used etc.
- Performance
- Extensibility
- Integrability
- Technical Support, including vendor support, 3d support
- Technical Resources
- Stability
- Challenge
- Technical Trend
- Migration
- Special Language Features
- Security
- Applying domain
- Technical Background
2006-11-03
原来这样也可以写blog
通过gmail发送邮件到lakemove.____@blogger.com.真是个不错的想法 :D
--
It's Hard to Define, But I Know it When I See it…
--
It's Hard to Define, But I Know it When I See it…
加载插件
俺这有三个plugin projects:
org.eclipse.atf.mozilla.ide.core
org.eclipse.atf.mozilla.ide.ui
org.jbpm.ui
其中org.jbpm.ui依赖于前2个plugins. 构建工程org.jbpm.ui不成功,然后在configure buildpath里把其它2个plugins引用进来,OK. 以RCP方式运行org.jbpm.ui的时候,报错说找不到那两个plugins里的类,郁闷了好久,后来在plugin.xml里把对那2个plugins 的depedencies加进来就OK了.从buildpath里删除之前加的内容也可以构建了.开始没仔细考虑这个问题,只胡乱的试.今天看下osgi的规范,感觉类加载还是满重要的方面,然后就从这个角度解决了.
org.eclipse.atf.mozilla.ide.core
org.eclipse.atf.mozilla.ide.ui
org.jbpm.ui
其中org.jbpm.ui依赖于前2个plugins. 构建工程org.jbpm.ui不成功,然后在configure buildpath里把其它2个plugins引用进来,OK. 以RCP方式运行org.jbpm.ui的时候,报错说找不到那两个plugins里的类,郁闷了好久,后来在plugin.xml里把对那2个plugins 的depedencies加进来就OK了.从buildpath里删除之前加的内容也可以构建了.开始没仔细考虑这个问题,只胡乱的试.今天看下osgi的规范,感觉类加载还是满重要的方面,然后就从这个角度解决了.
Subscribe to:
Posts (Atom)