cerulean

2009年9月8日

从上班开始没多久,就开始用Evernote,是portable 2.2版本。
好记性不如烂笔头。真的是做到了随手记,尤其是搜索功能简单易用,用来挖很久以前记下的tips,界面也很简洁,明了、够用。
备份也方便,反正换了电脑,文件夹直接拷贝,数据没丢。

就这样,一用多少年过去了。
如今,“印象笔记”在iphone应用推荐榜的笔记类里一直居高位,图标也早就不是我v2.2的老土模样,如果不是英文名字就叫evernote,我完全对不上号。
人家其实从v3开始就不是老土的本地应用了,都讲究“云”了。

虽然手头的v2.2完全满足我随手记一记的需求,但是,本着与时俱进和稍微保证一下数据的安全性,我还是下了个最近的v4.x的版本,结果发现还是要从v3开始才能导入v2的数据。嗯,看来是落后太久了。
有一点夸奖一下:免费账户的每月上传容量是有限的,但是对于我这种文本笔记,够传3w条的。

——嗯,其实,本来只是个小软件的更新而已,竟然跑到blogjava写上一篇,可能是因为伴随感吧,再有点儿时过境迁的唏嘘。
posted @ 2012-11-22 11:35 cerulean 阅读(418) | 评论 (1)编辑 收藏
春节过后这几天干的活儿就没一件痛痛快快的?
第一天是发现编译环境有异动,我以为是代码有问题,折腾了1天多。。。
第二天是自己机器上的IE8抽疯弄得我以为是build有问题。。。
第三天从TimesTen转到Psql的各种毛病。。。

好吧。言归正传:
1)找一个跟表无关的通用的单纯的select语句作为测试语句不容易啊,
Dual是Oracle自带的表,其他DBS木有的。。不用Dual的话Oracle又不认。

2)Cause: org.postgresql.util.PSQLException: Method org.postgresql.jdbc2.Jdbc2PreparedStatement.setQueryTimeout(int) is not yet implemented.
这个错误,把sqlMapConfig.xml中在settings里配置的defaultStatementTimeout去掉就可以避免了。但是,这个配置对PSQL应该OK啊。。。待查

【续】——
defaultStatementTimeout 确实不是所有的driver都支持的。
但去掉的话,TimesTen又不干了:太囧了。。。
[TimesTen][TimesTen 7.0.5.9.0 CLIENT]Query Timeout must be numeric; if the Network Timeout
is non-zero, the Query Timeout must be greater than zero and less than the Network Timeout, else if the Network Timeout is zero, the Query Timeout must be greater than or equal to zero.
兜兜转转又遇到了这个之前遇到过的问题。这些driver就不能统一统一咩!

posted @ 2012-02-01 17:32 cerulean 阅读(1162) | 评论 (0)编辑 收藏
parseInt(String s, int radix) 
Parses the string argument as a signed integer in the radix specified by the second argument.

今儿头回用,真是……反省ing

posted @ 2012-01-18 17:28 cerulean 阅读(337) | 评论 (0)编辑 收藏
文档写到现在,猛然说不上abbreviation 和 acronym 的区别。。。真是惭愧。。。
abbreviation:单词、语句的缩略形式,缩到短一点儿。
acronym:“首字母”缩写
posted @ 2011-12-05 15:21 cerulean 阅读(459) | 评论 (0)编辑 收藏
之前都没注意过有这么个方法,否则判断日期格式就太不靠谱了。
又是晦涩的单词:setLenient(false),严格匹配日期格式
        SimpleDateFormat df = new SimpleDateFormat("MMddyyyy");
        
/*
         * With lenient parsing, the parser may use heuristics to interpret inputs that 
         * do not precisely match this object's format. 
         * With strict parsing, inputs must match this object's format. 
         
*/
        df.setLenient(
false);
        
try {
            Date a 
= df.parse("23232011");
            System.out.print(
"date: " + a);
        } 
catch (java.text.ParseException e) {
            
// TODO Auto-generated catch block
            e.printStackTrace();
        }

posted @ 2011-07-18 17:23 cerulean 阅读(3181) | 评论 (0)编辑 收藏
i18n,之前在J2EE里,自然用struts来做。但是Web Service里貌似应该不需要这部分,但是实际上,有些操作还是避免不了要支持多国语言。
查了一圈儿,好像WS-i18n还在working draft的阶段,而且好像已经好几年了……也没找到什么开源中间件的实现。
大意是在SOAP header中加上<i18n:international>相关的标签。
因为毕竟是Web Service,利用http header还是不太妥,还是要放在SOAP里面。

记录一下查到的链接,备用。

http://www.coderanch.com/t/224875/Web-Services/java/Web-Services-Internationalization-jax-ws
For a SOAP web service the language/country code should be part of the SOAP request and possibly the SOAP response. You can always base your solution on the above WS-I18N working draft.
Internationalization isn't as big a priority with SOAP web services as it is with web pages as web services are consumed by other applications - not humans. In most cases normalized "generic data" is exchanged which is displayed on the client using the client's locale. SOAP web services exchanging localized text are pretty much in the minority.

http://www.w3.org/TR/ws-i18n/


posted @ 2011-06-15 16:49 cerulean 阅读(256) | 评论 (0)编辑 收藏
这回是更加深深地体会到IDE的重要性了!
想当初要不是eclipse,估计上手过程会很痛苦;
后来myeclipse的官方网站竟然封掉了;
现在,眼巴巴瞅着NetBeans美丽的GUI Builder,假如当年Swing那部分是用NetBeans开发的,或者NetBeans可以不要那个.form的文件直接解析代码,就好了啊!!!
唉……
posted @ 2010-08-11 16:32 cerulean 阅读(292) | 评论 (0)编辑 收藏
繁琐的登陆过程让人抓狂,telnet到第一台机器输入用户名之前,点击SecureCRT里menu->Script->Start recording script,录下接下来的步骤,然后点击Stop recording script,就会提示保存脚本。以后登陆时,选择Run脚本就可以了。
posted @ 2010-07-07 08:54 cerulean 阅读(285) | 评论 (0)编辑 收藏
遍历集合,批量删除时,遇到ConcurrentModificationException
因为操作的集合会在过程中遇到结构性的改变,例如:
HashMap<String, String> testMap = new HashMap<String, String>();
        testMap.put(
"1""a");
        testMap.put(
"2""b");
        testMap.put(
"3""c");
        Set
<Map.Entry<String,String>> enterySet = testMap.entrySet();
        

        
for(Iterator<Map.Entry<String, String>> i = enterySet.iterator(); i.hasNext();){
            Map.Entry
<String, String> entry = i.next();
            
if(entry.getValue().equalsIgnoreCase("a")){
                testMap.remove(entry.getKey());
            }

        }


解决方法:不要在集合上删除,而是在迭代器上删除:i.remove();

p.s.还有另外一个可能性是多线程同时操作该集合了,那需要进行同步来避免。
posted @ 2010-06-11 13:57 cerulean 阅读(348) | 评论 (0)编辑 收藏
引子只是个小问题,JTextArea多行文本,想设置文字的对齐方式为居中对齐,却发现死活没有合适有效的方法,又试了JTextField和JLabel,都不理想。搜了一溜够看到JTextPane的解决方法,其实真是有点儿大材小用了。JTextPane里可以设置style,对齐方式、字体字号、颜色等等,并且还可以设置style的作用范围,挺方便的。另外,想把文字区域背景设为透明的也是在API中找了一通,才发现敢情就是setOpacity,呃,对这个单词实在是太不敏感了。。。。

把在coderanch上搜的例子贴在这里吧,以防以后忘了:
import java.awt.*;  
import javax.swing.*;  
import javax.swing.text.*;  
   
public class Styling  
{  
    
public Styling()  
    
{  
        String text 
= "To refer to locations within the sequence, the " +  
                      
"coordinates used are the location between two " +  
                      
"characters.\nAs the diagram below shows, a location " +  
                      
"in a text document can be referred to as a position, " +  
                      
"or an offset. This position is zero-based.";  
   
        SimpleAttributeSet aSet 
= new SimpleAttributeSet();   
        StyleConstants.setForeground(aSet, Color.blue);  
        StyleConstants.setBackground(aSet, Color.orange);  
        StyleConstants.setFontFamily(aSet, 
"lucida bright italic");  
        StyleConstants.setFontSize(aSet, 
18);  
   
        SimpleAttributeSet bSet 
= new SimpleAttributeSet();  
        StyleConstants.setAlignment(bSet, StyleConstants.ALIGN_CENTER);  
        StyleConstants.setUnderline(bSet, 
true);  
        StyleConstants.setFontFamily(bSet, 
"lucida typewriter bold");  
        StyleConstants.setFontSize(bSet, 
24);  
   
        JTextPane textPane 
= new JTextPane();  
        textPane.setText(text);  
        StyledDocument doc 
= textPane.getStyledDocument();  
        doc.setCharacterAttributes(
105, doc.getLength()-105, aSet, false);  
        doc.setParagraphAttributes(
0104, bSet, false);  
   
        JFrame f 
= new JFrame();  
        f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);  
        f.add(
new JScrollPane(textPane));  
        f.setSize(
400,400);  
        f.setLocation(
200,200);  
        f.setVisible(
true);  
    }
  
   
    
public static void main(String[] args)  
    
{  
        
new Styling();  
    }
  
}
  
posted @ 2010-03-10 17:20 cerulean 阅读(7801) | 评论 (1)编辑 收藏
之前用axis2生成代码的时候都没有在意过,一路用default configuration下来。
前一阵子发现以前的代码在生成时选择的data binding不是用默认的adb方式,而是用xmlbeans。
google了一番不同数据绑定的区别,好像也没什么结果,大意就是adb的最简单,但是有局限性;xmlbeans支持的比较全面,但是用起来有点儿复杂。不过,我也没有体会出来xmlbeans强大在哪里……只是知道生成的代码更多了,调用起来更绕弯子而已。。。

server端用xmlbeans生成,client端用adb生成,互通是没有问题的。
client端用xmlbeans生成时,需要把产生于resources里面的所有.class文件打成jar包加到client端的build path里,否则运行client加载类的时候就会报错了,好诡异,太不友好了。
类似这种错误:

ClassNotFoundException : Cannot load SchemaTypeSystem. Unable to load class with name schemaorg_apache_xmlbeans.system.s68C41DB812F52C975439BA10FE4FEE54.TypeSystemHolder. Make sure the generated binary files are on the classpath.


所幸是在官方网站上有说明:http://ws.apache.org/axis2/tools/1_2/CodegenToolReference.html
posted @ 2009-12-30 15:59 cerulean 阅读(662) | 评论 (0)编辑 收藏
一个JNLP文件中的资源必须由同一个证书签名
当需要不同证书时,可以创建多个JNLP文件,并在主JNLP文件中引用之。

遇到过的问题:找不到子JNLP文件中的资源
解决方法:竟然把子JNLP文件放到比主JNLP文件所在目录低一级就可以了?!
posted @ 2009-11-20 15:13 cerulean 阅读(446) | 评论 (0)编辑 收藏

 

JLabel.setText("<html>auto new line</html>");
JLabel.setText("<html>line<br>force new line</html>");

 

posted @ 2009-10-29 11:43 cerulean 阅读(3389) | 评论 (1)编辑 收藏
费了半天劲,敢情Firefox在3.0版本后又支持弹出modal window啦
window.showModalDialog


posted @ 2009-09-22 15:59 cerulean 阅读(312) | 评论 (0)编辑 收藏
HttpClient.getHttpConnectionManager().getParams().setSoTimeout()
HttpClient.getHttpConnectionManager().getParams().setConnectionTimeout()

第一个针对连接建立后,但是没有收到response的超时时间,测试时可将server simulator收到request后等一段时间后再回response。
出错信息:
java.net.SocketTimeoutException: Read timed out

第二个针对连接建立的超时时间,测试时可将目的IP地址设为不存在的IP地址。
出错信息:
org.apache.commons.httpclient.ConnectTimeoutException: The host did not accept the connection within timeout of 8000 ms
        at org.apache.commons.httpclient.protocol.ReflectionSocketFactory.createSocket(ReflectionSocketFactory.java:154)
默认值为0,如果不设置的话大概2分多钟才会得到异常


posted @ 2009-09-10 16:09 cerulean 阅读(5146) | 评论 (1)编辑 收藏
导入了某证书至truststore,建立SSL连接时遇到错误
javax.net.ssl.SSLKeyException: RSA premaster secret error
Caused by: java.security.InvalidKeyException: Illegal key size or default parameters

在windows上双击查看该证书时发现Public Key是4096bit,查了一番后发现Java默认好像不能处理这么长的key,必须要按照JCE的一个Unlimited Strength Jurisdiction Policy
http://java.sun.com/javase/downloads/index_jdk5.jsp里面就有下载,这样貌似就可以处理这种强度比较高的了。


posted @ 2009-09-08 17:24 cerulean 阅读(2042) | 评论 (0)编辑 收藏

导航

<2009年9月>
303112345
6789101112
13141516171819
20212223242526
27282930123
45678910

统计

常用链接

留言簿(3)

随笔分类

随笔档案

搜索

最新评论

阅读排行榜

评论排行榜