有时java困惑我.
我有大量的int初始化.
什么是真正的差异?
Integer.toString(i)
new Integer(i).toString()
如果某些东西工作不正常或者我的Eclipse中正确加载了一些插件.我经常建议以干净模式打开Eclipse.那么,如何在干净模式下运行?如果我这样做会怎么样?
以下代码是众所周知的将重音字符转换为纯文本:
Normalizer.normalize(text, Normalizer.Form.NFD).replaceAll("\\p{InCombiningDiacriticalMarks}+", "");
Run Code Online (Sandbox Code Playgroud)
我用这个替换了我的"手工制作"方法,但我需要理解replaceAll的"正则表达式"部分
1)什么是"InCombiningDiacriticalMarks"?
2)文件在哪里?(和类似的?)
谢谢.
有没有更好的方法来实现这一目标?
public static List<String> toList(String[] array) {
List<String> list = new ArrayList(array.length);
for(int i=0; i<array.length; i++)
list.add(array[i]);
return list;
}
Run Code Online (Sandbox Code Playgroud)
注意:Arrays.asList(a)返回由指定数组支持的固定大小的列表.(对返回列表的更改"直写"到数组.).我不希望这种行为.我假设上面的MY函数绕过了(或者我错了吗?)
所以,在这里我们有另一种方法:
public static List<String> toList(String[] array) {
List<String> list = new ArrayList(array.length);
list.addAll(Arrays.asList(array));
return list;
}
Run Code Online (Sandbox Code Playgroud)
只是看着它,我不相信它比第一种方法更快.
我对Eclipse版本3.8感到有些困惑
对我来说这似乎有点像鬼:没有代号,没有下载网站?
所有软件包在哪里,例如"Eclipse for RCP和RAP Developers"?
我正在使用Batik来处理SVG图像.有没有办法从SVG文件中获取java.awt.image.BufferedImage?
我知道有转码器,我可以将SVG转码为例如PNG,然后用ImageIO.read()加载PNG但我不想拥有临时文件.
我有一个.cer证书文件,需要提取公钥.我只能提取到PEM格式."outform"参数不执行任何操作.
openssl x509 -inform PEM -in certificate.cer -outform DER -pubkey -noout > publickey.der
Run Code Online (Sandbox Code Playgroud)
是否可以以DER格式提取?
我正在使用Eclipse 3.7(OSGI),我可以进行手动增强(使用Datanucleus Eclipse插件和datanucleus-enhancer-2.1.0版本作为插件依赖项导入)
我现在正在尝试使用API类增强功能:http://www.datanucleus.org/products/accessplatform/jpa/enhancer.html#api
使用ASM 3.1在类路径和此代码中:
DataNucleusEnhancer enhancer=new DataNucleusEnhancer("JDO","ASM");
enhancer.setVerbose(true);
enhancer.addClasses(...);
enhancer.enhance();
Run Code Online (Sandbox Code Playgroud)
我明白了:
You have selected to use ClassEnhancer "ASM" yet the JAR for that enhancer does not seem to be in the CLASSPATH!
org.datanucleus.enhancer.NucleusEnhanceException: You have selected to use ClassEnhancer "ASM" yet the JAR for that enhancer does not seem to be in the CLASSPATH!
at org.datanucleus.enhancer.DataNucleusEnhancer.init(DataNucleusEnhancer.java:224)
at org.datanucleus.enhancer.DataNucleusEnhancer.addClasses(DataNucleusEnhancer.java:406)
Run Code Online (Sandbox Code Playgroud)
使用教程中建议的代码:
JDOEnhancer enhancer = JDOHelper.getEnhancer();
enhancer.setVerbose(true);
enhancer.addClasses(...);
enhancer.enhance();
Run Code Online (Sandbox Code Playgroud)
我明白了:
javax.jdo.JDOFatalUserException: There are 0 services entries for the …
Run Code Online (Sandbox Code Playgroud) 为什么我会得到不同的行为:
Collection col2 = new ArrayList(col);
Collection col2 = new ArrayList();
col2.addAll(col)
我正在与观众合作,代码很复杂,我试图解释问题的"根".另一个有趣的事实是下一个......
//IF i use this code i have the correct behavior in my app:
public void updateCollection(Collection<Object> col) {
this.objectCollection.clear();
this.objectCollection.addAll(col);
}
//IF i use this code i have unexpected behavior in my app:
public void updateCollection(Collection<Object> col) {
this.objectCollection=new ArrayList(col);
}
Run Code Online (Sandbox Code Playgroud) 经过多次测试后,我得出结论,Log4j在OSGI下无法运行.
我不直接使用Log4j,但我需要第三方插件来记录它.
我做了一个简单的JAVA项目,一切都很好,但在PLUGIN开发下没有任何作用.
我在我的Classpath中有log4j jar,甚至尝试过Spring存储库OSGI兼容的Log4j并将其包含在Dependencies中.什么都行不通.
我尝试过这种方法没有成功:http://swik.net/Eclipse/Planet+Eclipse/Raja+Kannappan :+ Eclipse+RCP+-+Converting+Dependencies+to+OSGi+ Bundles/ drqpf
并且无法完全理解这一个:http: //www.eclipsezone.com/eclipse/forums/t99588.html
谁能指出我正确的方向?
谢谢.
java ×7
eclipse ×3
collections ×2
api ×1
arraylist ×1
arrays ×1
batik ×1
certificate ×1
datanucleus ×1
der ×1
eclipse-juno ×1
extract ×1
int ×1
jdo ×1
log4j ×1
openssl ×1
osgi ×1
public-key ×1
rcp ×1
regex ×1
string ×1
svg ×1
unicode ×1