cerulean

2012年11月22日

从上班开始没多久,就开始用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)编辑 收藏

2012年2月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)编辑 收藏

2012年1月18日

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)编辑 收藏

2011年12月5日

文档写到现在,猛然说不上abbreviation 和 acronym 的区别。。。真是惭愧。。。
abbreviation:单词、语句的缩略形式,缩到短一点儿。
acronym:“首字母”缩写
posted @ 2011-12-05 15:21 cerulean 阅读(458) | 评论 (0)编辑 收藏

2011年7月18日

之前都没注意过有这么个方法,否则判断日期格式就太不靠谱了。
又是晦涩的单词: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)编辑 收藏

2011年6月15日

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)编辑 收藏

2010年8月11日

这回是更加深深地体会到IDE的重要性了!
想当初要不是eclipse,估计上手过程会很痛苦;
后来myeclipse的官方网站竟然封掉了;
现在,眼巴巴瞅着NetBeans美丽的GUI Builder,假如当年Swing那部分是用NetBeans开发的,或者NetBeans可以不要那个.form的文件直接解析代码,就好了啊!!!
唉……
posted @ 2010-08-11 16:32 cerulean 阅读(292) | 评论 (0)编辑 收藏

2010年7月7日

繁琐的登陆过程让人抓狂,telnet到第一台机器输入用户名之前,点击SecureCRT里menu->Script->Start recording script,录下接下来的步骤,然后点击Stop recording script,就会提示保存脚本。以后登陆时,选择Run脚本就可以了。
posted @ 2010-07-07 08:54 cerulean 阅读(285) | 评论 (0)编辑 收藏

2010年6月11日

遍历集合,批量删除时,遇到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)编辑 收藏

2010年3月10日

引子只是个小问题,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)编辑 收藏
仅列出标题  下一页

导航

<2024年4月>
31123456
78910111213
14151617181920
21222324252627
2829301234
567891011

统计

常用链接

留言簿(3)

随笔分类

随笔档案

搜索

最新评论

阅读排行榜

评论排行榜