<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    cerulean

    2007年7月26日

    從上班開始沒多久,就開始用Evernote,是portable 2.2版本。
    好記性不如爛筆頭。真的是做到了隨手記,尤其是搜索功能簡單易用,用來挖很久以前記下的tips,界面也很簡潔,明了、夠用。
    備份也方便,反正換了電腦,文件夾直接拷貝,數(shù)據(jù)沒丟。

    就這樣,一用多少年過去了。
    如今,“印象筆記”在iphone應(yīng)用推薦榜的筆記類里一直居高位,圖標(biāo)也早就不是我v2.2的老土模樣,如果不是英文名字就叫evernote,我完全對不上號。
    人家其實(shí)從v3開始就不是老土的本地應(yīng)用了,都講究“云”了。

    雖然手頭的v2.2完全滿足我隨手記一記的需求,但是,本著與時(shí)俱進(jìn)和稍微保證一下數(shù)據(jù)的安全性,我還是下了個(gè)最近的v4.x的版本,結(jié)果發(fā)現(xiàn)還是要從v3開始才能導(dǎo)入v2的數(shù)據(jù)。嗯,看來是落后太久了。
    有一點(diǎn)夸獎(jiǎng)一下:免費(fèi)賬戶的每月上傳容量是有限的,但是對于我這種文本筆記,夠傳3w條的。

    ——嗯,其實(shí),本來只是個(gè)小軟件的更新而已,竟然跑到blogjava寫上一篇,可能是因?yàn)榘殡S感吧,再有點(diǎn)兒時(shí)過境遷的唏噓。
    posted @ 2012-11-22 11:35 cerulean 閱讀(448) | 評論 (1)編輯 收藏
    春節(jié)過后這幾天干的活兒就沒一件痛痛快快的?
    第一天是發(fā)現(xiàn)編譯環(huán)境有異動(dòng),我以為是代碼有問題,折騰了1天多。。。
    第二天是自己機(jī)器上的IE8抽瘋弄得我以為是build有問題。。。
    第三天從TimesTen轉(zhuǎn)到Psql的各種毛病。。。

    好吧。言歸正傳:
    1)找一個(gè)跟表無關(guān)的通用的單純的select語句作為測試語句不容易啊,
    Dual是Oracle自帶的表,其他DBS木有的。。不用Dual的話Oracle又不認(rèn)。

    2)Cause: org.postgresql.util.PSQLException: Method org.postgresql.jdbc2.Jdbc2PreparedStatement.setQueryTimeout(int) is not yet implemented.
    這個(gè)錯(cuò)誤,把sqlMapConfig.xml中在settings里配置的defaultStatementTimeout去掉就可以避免了。但是,這個(gè)配置對PSQL應(yīng)該OK啊。。。待查

    【續(xù)】——
    defaultStatementTimeout 確實(shí)不是所有的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.
    兜兜轉(zhuǎn)轉(zhuǎn)又遇到了這個(gè)之前遇到過的問題。這些driver就不能統(tǒng)一統(tǒng)一咩!

    posted @ 2012-02-01 17:32 cerulean 閱讀(1200) | 評論 (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 閱讀(360) | 評論 (0)編輯 收藏
    文檔寫到現(xiàn)在,猛然說不上abbreviation 和 acronym 的區(qū)別。。。真是慚愧。。。
    abbreviation:單詞、語句的縮略形式,縮到短一點(diǎn)兒。
    acronym:“首字母”縮寫
    posted @ 2011-12-05 15:21 cerulean 閱讀(501) | 評論 (0)編輯 收藏
    之前都沒注意過有這么個(gè)方法,否則判斷日期格式就太不靠譜了。
    又是晦澀的單詞:setLenient(false),嚴(yán)格匹配日期格式
            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 閱讀(3206) | 評論 (0)編輯 收藏
    i18n,之前在J2EE里,自然用struts來做。但是Web Service里貌似應(yīng)該不需要這部分,但是實(shí)際上,有些操作還是避免不了要支持多國語言。
    查了一圈兒,好像WS-i18n還在working draft的階段,而且好像已經(jīng)好幾年了……也沒找到什么開源中間件的實(shí)現(xiàn)。
    大意是在SOAP header中加上<i18n:international>相關(guān)的標(biāo)簽。
    因?yàn)楫吘故荳eb 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 閱讀(282) | 評論 (0)編輯 收藏
    這回是更加深深地體會到IDE的重要性了!
    想當(dāng)初要不是eclipse,估計(jì)上手過程會很痛苦;
    后來myeclipse的官方網(wǎng)站竟然封掉了;
    現(xiàn)在,眼巴巴瞅著NetBeans美麗的GUI Builder,假如當(dāng)年Swing那部分是用NetBeans開發(fā)的,或者NetBeans可以不要那個(gè).form的文件直接解析代碼,就好了啊!!!
    唉……
    posted @ 2010-08-11 16:32 cerulean 閱讀(325) | 評論 (0)編輯 收藏
    繁瑣的登陸過程讓人抓狂,telnet到第一臺機(jī)器輸入用戶名之前,點(diǎn)擊SecureCRT里menu->Script->Start recording script,錄下接下來的步驟,然后點(diǎn)擊Stop recording script,就會提示保存腳本。以后登陸時(shí),選擇Run腳本就可以了。
    posted @ 2010-07-07 08:54 cerulean 閱讀(296) | 評論 (0)編輯 收藏
    遍歷集合,批量刪除時(shí),遇到ConcurrentModificationException
    因?yàn)椴僮鞯募蠒谶^程中遇到結(jié)構(gòu)性的改變,例如:
    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.還有另外一個(gè)可能性是多線程同時(shí)操作該集合了,那需要進(jìn)行同步來避免。
    posted @ 2010-06-11 13:57 cerulean 閱讀(375) | 評論 (0)編輯 收藏
    引子只是個(gè)小問題,JTextArea多行文本,想設(shè)置文字的對齊方式為居中對齊,卻發(fā)現(xiàn)死活沒有合適有效的方法,又試了JTextField和JLabel,都不理想。搜了一溜夠看到JTextPane的解決方法,其實(shí)真是有點(diǎn)兒大材小用了。JTextPane里可以設(shè)置style,對齊方式、字體字號、顏色等等,并且還可以設(shè)置style的作用范圍,挺方便的。另外,想把文字區(qū)域背景設(shè)為透明的也是在API中找了一通,才發(fā)現(xiàn)敢情就是setOpacity,呃,對這個(gè)單詞實(shí)在是太不敏感了。。。。

    把在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 閱讀(7895) | 評論 (1)編輯 收藏
    之前用axis2生成代碼的時(shí)候都沒有在意過,一路用default configuration下來。
    前一陣子發(fā)現(xiàn)以前的代碼在生成時(shí)選擇的data binding不是用默認(rèn)的adb方式,而是用xmlbeans。
    google了一番不同數(shù)據(jù)綁定的區(qū)別,好像也沒什么結(jié)果,大意就是adb的最簡單,但是有局限性;xmlbeans支持的比較全面,但是用起來有點(diǎn)兒復(fù)雜。不過,我也沒有體會出來xmlbeans強(qiáng)大在哪里……只是知道生成的代碼更多了,調(diào)用起來更繞彎子而已。。。

    server端用xmlbeans生成,client端用adb生成,互通是沒有問題的。
    client端用xmlbeans生成時(shí),需要把產(chǎn)生于resources里面的所有.class文件打成jar包加到client端的build path里,否則運(yùn)行client加載類的時(shí)候就會報(bào)錯(cuò)了,好詭異,太不友好了。
    類似這種錯(cuò)誤:

    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.


    所幸是在官方網(wǎng)站上有說明:http://ws.apache.org/axis2/tools/1_2/CodegenToolReference.html
    posted @ 2009-12-30 15:59 cerulean 閱讀(692) | 評論 (0)編輯 收藏
    一個(gè)JNLP文件中的資源必須由同一個(gè)證書簽名
    當(dāng)需要不同證書時(shí),可以創(chuàng)建多個(gè)JNLP文件,并在主JNLP文件中引用之。

    遇到過的問題:找不到子JNLP文件中的資源
    解決方法:竟然把子JNLP文件放到比主JNLP文件所在目錄低一級就可以了?!
    posted @ 2009-11-20 15:13 cerulean 閱讀(481) | 評論 (0)編輯 收藏

     

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

     

    posted @ 2009-10-29 11:43 cerulean 閱讀(3442) | 評論 (1)編輯 收藏
    費(fèi)了半天勁,敢情Firefox在3.0版本后又支持彈出modal window啦
    window.showModalDialog


    posted @ 2009-09-22 15:59 cerulean 閱讀(343) | 評論 (0)編輯 收藏
    HttpClient.getHttpConnectionManager().getParams().setSoTimeout()
    HttpClient.getHttpConnectionManager().getParams().setConnectionTimeout()

    第一個(gè)針對連接建立后,但是沒有收到response的超時(shí)時(shí)間,測試時(shí)可將server simulator收到request后等一段時(shí)間后再回response。
    出錯(cuò)信息:
    java.net.SocketTimeoutException: Read timed out

    第二個(gè)針對連接建立的超時(shí)時(shí)間,測試時(shí)可將目的IP地址設(shè)為不存在的IP地址。
    出錯(cuò)信息:
    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)
    默認(rèn)值為0,如果不設(shè)置的話大概2分多鐘才會得到異常


    posted @ 2009-09-10 16:09 cerulean 閱讀(5176) | 評論 (1)編輯 收藏
    導(dǎo)入了某證書至truststore,建立SSL連接時(shí)遇到錯(cuò)誤
    javax.net.ssl.SSLKeyException: RSA premaster secret error
    Caused by: java.security.InvalidKeyException: Illegal key size or default parameters

    在windows上雙擊查看該證書時(shí)發(fā)現(xiàn)Public Key是4096bit,查了一番后發(fā)現(xiàn)Java默認(rèn)好像不能處理這么長的key,必須要按照J(rèn)CE的一個(gè)Unlimited Strength Jurisdiction Policy
    http://java.sun.com/javase/downloads/index_jdk5.jsp里面就有下載,這樣貌似就可以處理這種強(qiáng)度比較高的了。


    posted @ 2009-09-08 17:24 cerulean 閱讀(2084) | 評論 (0)編輯 收藏
    打印數(shù)組的方法,小地方,卻老忘記,來自FindBugs的提示:
    The code invokes toString on an array, which will generate a fairly useless result such as [C@16f0472. Consider using Arrays.toString to convert the array into a readable String that gives the contents of the array.

    Arrays提供一系列接收不同類型數(shù)組作為參數(shù)的toString方法

    String[] array = new String[]{"a","b","c"};
    System.out.println(Arrays.toString(array));

    posted @ 2009-08-17 15:17 cerulean 閱讀(1177) | 評論 (0)編輯 收藏
    FindBugs,http://findbugs.sourceforge.net/
    發(fā)現(xiàn)代碼中潛在bug的工具,有eclipse的插件,安裝后右鍵單擊java project name,點(diǎn)擊Find Bugs,切換到FindBugs得perspective可以看到結(jié)果,速度還比較快,比之前用過的一個(gè)(雖然已經(jīng)記不得名字了)快一些~具體的效果還是要逐個(gè)分析。

    Bug categories:

    Correctness bug
    Probable bug - an apparent coding mistake resulting in code that was probably not what the developer intended. We strive for a low false positive rate.
    Bad Practice
    Violations of recommended and essential coding practice. Examples include hash code and equals problems, cloneable idiom, dropped exceptions, serializable problems, and misuse of finalize. We strive to make this analysis accurate, although some groups may not care about some of the bad practices.
    Dodgy
    Code that is confusing, anomalous, or written in a way that leads itself to errors. Examples include dead local stores, switch fall through, unconfirmed casts, and redundant null check of value known to be null. More false positives accepted. In previous versions of FindBugs, this category was known as Style.
    Multithreaded correctness
         Incorrect lazy initialization and update of static field
         Calls Thread.sleep() with a lock held: better to use wait(lock)
         Synchronization on interned String could deadlock: 最好不用字符串,以免重復(fù)
    Performance
         invokes inefficient new String() constructor
         concatenates strings using + in a loop: better to use append StringBuffer
         inner class usage


    posted @ 2009-08-14 16:04 cerulean 閱讀(990) | 評論 (0)編輯 收藏
    Server

    創(chuàng)建本地證書:

    keytool -genkey -alias testserver-keyalg RSA -keystore keystore

    其中alias自己起一個(gè)別名,keystore為證書庫的文件路徑

    還可以加上-keysize 1024、2048、4096等來指定公鑰的大小,由此導(dǎo)出的證書查看時(shí)可以看到公鑰的大小是與之一致的。keysize越大genkey時(shí)耗費(fèi)時(shí)間越長。


    會要求鍵入一個(gè)密碼,為這個(gè)證書庫的訪問密碼

    會要求填寫一些信息,姓名、單位、地區(qū)之類

    最后要求鍵入一個(gè)密碼,為這條證書別名的密碼

    導(dǎo)出cert

    keytool -export -alias testserver-file testcert.cer -keystore keystore

    這里的別名和文件名同上一步


    Client

    直接導(dǎo)入cert

    Truststore文件中存儲的是作為client,信任那些server的證書。所以需要將server提供的證書導(dǎo)入進(jìn)來(當(dāng)然可以導(dǎo)入n個(gè)),client才能信任。

    keytool -import -alias testserver-file testcert.cer -keystore truststore

    導(dǎo)入時(shí)需要輸入密碼,該密碼應(yīng)該是truststore文件的訪問密碼,密碼正確才能修改其信息。

    提示是否信任該證書信息,確認(rèn)。

    查看證書信息:

    keytool –list –v –keystore truststore

    如果導(dǎo)入過多個(gè),則可以看到多條entry

    刪除某一個(gè)證書entry,通過指定別名來刪:

    keytool -delete -alias testserver-keystore truststore


    上述是自簽名的證書,證書鏈的長度只為
    1

    真正商用時(shí),需要找相關(guān)機(jī)構(gòu)(例如verisign)認(rèn)證通過才能成為有效的證書:

    生成證書簽名請求:

    keytool -certreq -keyalg RSA -alias testserver -file certreq.csr -keystore keystore

    之后能夠收到一個(gè)證書文件,證書鏈信息包含了該機(jī)構(gòu)的一些信息,然后再導(dǎo)入。


    有兩種方法建立
    HTTPS連接,

    一種是,在java中可以設(shè)置相關(guān)的4個(gè)系統(tǒng)參數(shù),指向相關(guān)的keystore,truststore,一旦設(shè)置,在運(yùn)行時(shí)就不可改變了。除非一定要使用多個(gè)不同的證書庫文件,否則可以把多個(gè)不同證書都導(dǎo)入到同一個(gè)證書庫里,這樣,設(shè)置系統(tǒng)參數(shù)為唯一的值也夠用,而且也比較簡單一些。

    另一種是,自己繼承相關(guān)接口實(shí)現(xiàn)自己的證書管理器,這樣可以自定義相關(guān)行為,也可以load不同的證書庫。


    如果不設(shè)置
    password,就認(rèn)為不檢查文件完整性,也能通過。如果設(shè)置了password,但是不正確,則會遇到密碼錯(cuò)誤的異常;如果server證書沒有導(dǎo)入到client得信任列表里,則會遇到找不到可信證書的異常。

    posted @ 2009-07-16 17:27 cerulean 閱讀(575) | 評論 (0)編輯 收藏
    一個(gè)反編譯的好工具,600KB,簡單好使又免費(fèi),比之前用過的好~
    http://java.decompiler.free.fr/?q=jdgui
    posted @ 2009-06-24 13:45 cerulean 閱讀(297) | 評論 (0)編輯 收藏

    MySQL Cluster 不支持windows
    之前的說法是max版支持集群,standard版不支持,但是官方下載點(diǎn)里已經(jīng)看不出任何關(guān)于max,standard的標(biāo)志。官方網(wǎng)站上又說5.0版本已經(jīng)包含了MySQL Cluster,所以還是下了個(gè)5.0的試試,結(jié)果是可以的。

    基本的安裝:
    linux下官方網(wǎng)站的安裝說明還是挺明確的,一步一步做就是了。
    遇到了一個(gè)問題與這篇文章一模一樣:http://www.91linux.com/html/linux_pub/fedora/20071114/8195.html
    按它的方法修改之后再次

    cd /usr/local/mysql
    bin
    /mysqld_safe --user=mysql &


    Starting mysqld daemon with databases from /var/lib/mysql
    看到上面這一行說明啟動(dòng)成功。

    修改密碼:

    bin/mysqladmin -u root password yourpassword


    允許遠(yuǎn)程訪問:

    bin/mysql -u root -p
    grant all on 
    *.* to root@"202.11.10.253" Identified by "dboomysql"

    允許地址202.11.10.253上用root用戶,密碼dboomysql來連接mysql的所有數(shù)據(jù)庫,付給所有權(quán)限。
    實(shí)質(zhì)上是修改了自帶的database:mysql中user這一張表,與PostgreSQL需要修改配置文件相比還是方便一些。
    另外就是MySQL的GUI客戶端(MySQL Administrator)也比PostgreSQL的漂亮很多。

    停止MySQL:
    bin/mysqladmin -u root shutdown -p

    安裝完成后,按照這篇文章配置雙機(jī)互備
    http://hi.baidu.com/%CA%AB%D5%B9/blog/item/3b99dbc48140f7ca38db49f7.html
    但是這篇文章有筆誤:

    四、初始化集群
    在Server1中
    # ndbd --nodeid=3 --initial
    在Server2中
    # ndbd --nodeid=4 --iniitial

    應(yīng)該改為——
    四、初始化集群
    在Server1中
    # ndbd --ndb_nodeid=3 --initial
    在Server2中
    # ndbd --ndb_nodeid=4 --initial

    這樣的集群配置兩臺機(jī)器都是一樣的,所以有2個(gè)管理節(jié)點(diǎn),2個(gè)SQL節(jié)點(diǎn),2個(gè)數(shù)據(jù)節(jié)點(diǎn)。集群的驗(yàn)證:從任何一臺機(jī)器登上去操作數(shù)據(jù)都能雙寫。

    ndb_mgm -e show

    可以看到集群節(jié)點(diǎn)的信息。
    從官方網(wǎng)站上看到的例子都是用了多于3臺的機(jī)器來做的集群,僅用兩臺來做的方法好像是大家特意這么做的。

    盡管集群配置完畢,但是應(yīng)用程序與數(shù)據(jù)庫建立連接不能使用其中任何一臺機(jī)器的真實(shí)IP,否則一旦該機(jī)器網(wǎng)絡(luò)連接出問題還是不行,所以還是要給DB集群的機(jī)器配置虛擬IP以供外部訪問。


    遇到過的問題:
    無法mysqld_safe啟動(dòng),也找不到日志
    解決方法:加啟動(dòng)參數(shù)以指定日志

    mysqld_safe --log-error=/var/log/mysqld.log

    可以查看到錯(cuò)誤日志了。

    [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist
    沒轍,google唄,好像是系統(tǒng)數(shù)據(jù)庫mysql里host表的權(quán)限有問題什么的,而mysql這個(gè)庫是之前安裝時(shí)初始化過的。

    解決方法:刪除data,重新install_db

    rm -rf /usr/local/mysql/data
    cd 
    /usr/local/mysql
    scripts
    /mysql_install_db --user=mysql
    chown 
    -R root .
    chown 
    -R mysql data
    chgrp 
    -R mysql .

     

    bin/mysqld_safe --log-error=/var/log/mysqld.log --ndb_nodeid=5 --user=mysql &

    啟動(dòng)成功了。

    btw, mysql官方網(wǎng)的forum好像不能“平板顯示”,好不方便。


    關(guān)閉Cluster,在管理節(jié)點(diǎn)所在的機(jī)器上:
    /usr/local/mysql/ndb_mgm -e shutdown
    關(guān)閉SQL節(jié)點(diǎn)的mysqld服務(wù):
    /usr/local/mysql/bin/mysqladmin -uroot shutdown

    posted @ 2007-12-17 21:38 cerulean 閱讀(616) | 評論 (0)編輯 收藏
    java默認(rèn)的JVM內(nèi)存占用:初始1MB,最大64MB
    可以通過java -Xms256m -Xmx256m ClassName來調(diào)整。
    xms和xmx的值最好相同,否則調(diào)整的效率可能不高。
    如果程序運(yùn)行中,發(fā)生內(nèi)存溢出,那么不會以Exception的形式拋出,而是"Error"
    如果沒有catch(Error error),那么控制臺將顯示錯(cuò)誤:Exception in thread "main" java.lang.OutOfMemoryError: Java heap space,而且后面的程序也不會執(zhí)行。
    posted @ 2007-12-17 21:26 cerulean 閱讀(1130) | 評論 (0)編輯 收藏
    雖然RMI已經(jīng)不大推薦使用了,但是方法還是要記住的。
    在產(chǎn)生.class文件的根目錄,例如/bin
    cd /bin
    rmic com.test.RMIImpl

    將在/bin/com/test目錄下產(chǎn)生RMIImpl_Stub.class文件
    cd /bin
    jar cvf test.jar com
    /test/RMIIntf.class com/test/RMIImpl_Stub.class

    將在/bin目錄下產(chǎn)生test.jar文件,供RMI客戶端調(diào)用
    posted @ 2007-12-17 21:12 cerulean 閱讀(887) | 評論 (0)編輯 收藏

    遇到經(jīng)典的getParameter中文亂碼的問題,網(wǎng)上已經(jīng)有很多總結(jié)和討論了。
    在jsp里調(diào)用了*.do?param=name,當(dāng)name本身的值為中文時(shí),在action里獲取時(shí)有亂碼問題。

    調(diào)用.do的jsp頁面頭已經(jīng)設(shè)置過

    <%@ page language="java" import="java.util.*" pageEncoding="gb2312"%>


    即便在action里設(shè)置了

    request.setCharacterEncoding 

    也沒有效果。

    最后的解決方法:

    String str = request.getParameter("param");

    改為

    String str = new String(request.getParameter("param").getBytes("ISO-8859-1"),"GB2312");
    posted @ 2007-12-17 21:09 cerulean 閱讀(3715) | 評論 (0)編輯 收藏

    struts的<html:form>標(biāo)簽中沒有"name"屬性,但是使用"styleId"屬性可以替代。
    需要注意的問題是,假如定義了:

    <html:form styleId="test" action="testIt.do">

    同時(shí)還定義了一個(gè)一樣名為test的javascript function:
    function test(){
       alert('hello');
    }

    則,在試圖調(diào)用此function時(shí)會出現(xiàn)錯(cuò)誤:
    <onclick="test()">click me</a>
    posted @ 2007-12-05 10:53 cerulean 閱讀(3341) | 評論 (1)編輯 收藏
    windows下.exe安裝版中,TOMCAT_HOME/conf下,是沒有l(wèi)ogging.properties這個(gè)文件的(在解壓版中有)。安裝版的logging.properties文件位于TOMCAT_HOME/common/classes下。
    posted @ 2007-09-03 17:01 cerulean 閱讀(1139) | 評論 (0)編輯 收藏
    Windows->Preferences->General->Compare/Patch->Ignore white space
    posted @ 2007-08-28 16:45 cerulean 閱讀(872) | 評論 (0)編輯 收藏
    Team->Branch/Tag時(shí),必須輸入注釋,否則即便看起來好像執(zhí)行了操作,但是卻沒有真正創(chuàng)建分支在SVN server上。
    posted @ 2007-08-28 15:35 cerulean 閱讀(1092) | 評論 (0)編輯 收藏
    其實(shí)還是挺糊涂的,org.apache.struts.action.ActionForm的Reset()方法,不過知道可以在該方法中set該Form的一些屬性值,就能夠在頁面上顯示為該對應(yīng)控件的默認(rèn)值,比較方便。

    public void reset(ActionMapping mapping, HttpServletRequest request) {
       
    //set default value for the first display
       this.setType("0");
    }
    posted @ 2007-08-23 14:55 cerulean 閱讀(1260) | 評論 (0)編輯 收藏
    在eclipse中已經(jīng)集成了ant,如果創(chuàng)建名為build.xml的文件,就會被識別為ant的文件。ShowView->Outline會有一些提示。
    在eclipse中,右鍵build.xml,
    選擇:Run As Ant Build,會執(zhí)行默認(rèn)的任務(wù)
    選擇:Run As Ant Build...,在彈出框中,可以選擇執(zhí)行哪些任務(wù).

    當(dāng)直接使用ant命令時(shí),可以用-D來輸入?yún)?shù),
    例如ant -buildfile package.xml -Dversion=1_0,指定了version的值。
    posted @ 2007-08-14 15:18 cerulean 閱讀(444) | 評論 (0)編輯 收藏
    **.jsp?param=1
    那么request.getParameter("param")就可以勒!
    原來用request.getAttribute死活不行,以為必須得用form傳遞呢,敢情getParameter就行~~

    所以如果想只用jsp頁面的話,可以這樣子做:
    hello.jsp:
    function hello(name)
    {
        sayHello(name);
    }

    function sayHello(id)
    {
        window.location
    ="sayHelloCommit.jsp?id="+id;
    }

    sayHelloCommit.jsp:
    <%@ page contentType="text/html;charset=gb2312"%>
    <%
    String str = (String) request.getParameter("id");
    //To Something using the "str"
    //redirect to a page
    response.sendRedirect(
    "hello.jsp");
    %>

    posted @ 2007-08-13 16:51 cerulean 閱讀(693) | 評論 (0)編輯 收藏
    more *.log | grep keywords

    vi一個(gè)寫有中文內(nèi)容的文件,只能看到其unicode。more該文件就可以看到中文內(nèi)容。
    當(dāng)keywords中包含空格時(shí),需要用""將keywords擴(kuò)起來。
     
    posted @ 2007-08-02 17:19 cerulean 閱讀(334) | 評論 (0)編輯 收藏
    如題
    posted @ 2007-08-01 09:41 cerulean 閱讀(2150) | 評論 (0)編輯 收藏

    Linux和windows下,文件中的換行符好像是不同的,當(dāng)在windows下用UE打開一來自linux的文件時(shí),好像會問你是不是要轉(zhuǎn)換到DOS格式什么的。在eclipse中打開代碼時(shí),有時(shí)也會遇到類似的問題,尤其是.xml文件。
    今天在看weka的網(wǎng)站時(shí),無意看到在eclipse中有一個(gè)設(shè)置貌似是專門用來做這個(gè)的:
    eclipse->Window -> Preferences -> General -> Editors 里面有一個(gè)"New text file line delimiter",可以在other中選擇Unix。

    posted @ 2007-07-26 10:27 cerulean 閱讀(817) | 評論 (0)編輯 收藏

    導(dǎo)航

    <2007年7月>
    24252627282930
    1234567
    891011121314
    15161718192021
    22232425262728
    2930311234

    統(tǒng)計(jì)

    常用鏈接

    留言簿(3)

    隨筆分類

    隨筆檔案

    搜索

    最新評論

    閱讀排行榜

    評論排行榜

    主站蜘蛛池模板: 国产亚洲精品美女| 国产v亚洲v天堂无码网站| 歪歪漫画在线观看官网免费阅读| 国产成人免费ā片在线观看老同学| 一区二区三区免费精品视频| 特级无码毛片免费视频| 国产精品久久亚洲一区二区| 青娱乐在线免费观看视频| 美女被艹免费视频| 老司机午夜在线视频免费| 色婷婷综合缴情综免费观看| 窝窝影视午夜看片免费| a毛片成人免费全部播放| av电影在线免费看| 免费av片在线观看网站| 99xxoo视频在线永久免费观看| 久久精品一本到99热免费| 51视频精品全部免费最新| 免费A级毛片无码免费视| 好男人看视频免费2019中文| 国产免费卡一卡三卡乱码| 亚洲Av无码国产情品久久 | 亚洲精品精华液一区二区| 亚洲欧美日韩综合久久久| 久久亚洲AV成人无码国产电影| 黄色一级毛片免费| 国产大片免费天天看| 久久国产精品国产自线拍免费| 99精品视频免费在线观看| 久久久久久久久免费看无码| 日韩视频在线免费观看| 亚洲VA综合VA国产产VA中| 亚洲人成中文字幕在线观看| 亚洲国产高清人在线| 激情五月亚洲色图| 国产精品亚洲综合一区在线观看| 中文字幕手机在线免费看电影| 免费看又黄又无码的网站| 无码免费午夜福利片在线| 亚洲国产成人五月综合网| 水蜜桃亚洲一二三四在线|