2012年11月22日
從上班開始沒多久,就開始用Evernote,是portable 2.2版本。
好記性不如爛筆頭。真的是做到了隨手記,尤其是搜索功能簡單易用,用來挖很久以前記下的tips,界面也很簡潔,明了、夠用。
備份也方便,反正換了電腦,文件夾直接拷貝,數據沒丟。
就這樣,一用多少年過去了。
如今,“印象筆記”在iphone應用推薦榜的筆記類里一直居高位,圖標也早就不是我v2.2的老土模樣,如果不是英文名字就叫evernote,我完全對不上號。
人家其實從v3開始就不是老土的本地應用了,都講究“云”了。
雖然手頭的v2.2完全滿足我隨手記一記的需求,但是,本著與時俱進和稍微保證一下數據的安全性,我還是下了個最近的v4.x的版本,結果發現還是要從v3開始才能導入v2的數據。嗯,看來是落后太久了。
有一點夸獎一下:免費賬戶的每月上傳容量是有限的,但是對于我這種文本筆記,夠傳3w條的。
——嗯,其實,本來只是個小軟件的更新而已,竟然跑到blogjava寫上一篇,可能是因為伴隨感吧,再有點兒時過境遷的唏噓。
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就不能統一統一咩!
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
2011年12月5日
文檔寫到現在,猛然說不上
abbreviation 和 acronym 的區別。。。真是慚愧。。。
abbreviation:單詞、語句的縮略形式,縮到短一點兒。
acronym:“首字母”縮寫
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();
}
2011年6月15日
i18n,之前在J2EE里,自然用struts來做。但是Web Service里貌似應該不需要這部分,但是實際上,有些操作還是避免不了要支持多國語言。
查了一圈兒,好像WS-i18n還在working draft的階段,而且好像已經好幾年了……也沒找到什么開源中間件的實現。
大意是在SOAP header中加上<i18n:international>相關的標簽。
因為畢竟是Web Service,利用http header還是不太妥,還是要放在SOAP里面。
記錄一下查到的鏈接,備用。
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.
2010年8月11日
這回是更加深深地體會到IDE的重要性了!
想當初要不是eclipse,估計上手過程會很痛苦;
后來myeclipse的官方網站竟然封掉了;
現在,眼巴巴瞅著NetBeans美麗的GUI Builder,假如當年Swing那部分是用NetBeans開發的,或者NetBeans可以不要那個.form的文件直接解析代碼,就好了啊!!!
唉……
2010年7月7日
繁瑣的登陸過程讓人抓狂,telnet到第一臺機器輸入用戶名之前,點擊SecureCRT里menu->Script->Start recording script,錄下接下來的步驟,然后點擊Stop recording script,就會提示保存腳本。以后登陸時,選擇Run腳本就可以了。
2010年6月11日
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(0, 104, 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();
}
}