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

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

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

    自由飛翔

    我在仰望,java之上

    統(tǒng)計

    留言簿(2)

    我關(guān)注的blog

    閱讀排行榜

    評論排行榜

    2011年11月24日 #

    編碼至高法則-高內(nèi)聚低耦合

         摘要: 此法則適合所有語言,咱們以JavaScript和Java兩個角度分析一下這個東東。 一、javascript 有這樣的一個頁面,js、css代碼都寫在html頁面中。 例如:gnj.html v1版本Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-...  閱讀全文

    posted @ 2019-09-11 15:59 GavinMiao 閱讀(228) | 評論 (0)編輯 收藏

    Jgoodies FormLayout 小結(jié)


    一、列與行的參數(shù)都由三個部分組成:對齊方式、固定尺寸、調(diào)整方式。
    1.對齊方式:
    1)列對齊有l(wèi)eft, center, right, fill.默認fill
    2)行對齊有:top, center, bottom, fill. 其中fill表示填充至整個區(qū)域。默認center。
    2.固定尺寸:
    pref表示preferred size,適當(dāng)大小,即首選尺寸大小。
    min表示minimum size,
    dlu 表示dialog units,
    px, pt, in, mm, cm)分別表示Pixel, Points, Inches, Millimeter, Centimeter。
    3. 調(diào)整方式:
    二、CellConstraints:
    cc.xywh(3, 1, 3, 1):表示3列,1行,colspan=3,rowspan=1
    三、FormLayout:
      1.FormLayout layout = new FormLayout(
       new ColumnSpec[]{
         FormSpecs.DEFAULT_COLSPEC,
         FormSpecs.GLUE_COLSPEC,
         FormSpecs.DEFAULT_COLSPEC,
         FormSpecs.GLUE_COLSPEC,
         FormSpecs.DEFAULT_COLSPEC,
         FormSpecs.GLUE_COLSPEC},
       new RowSpec[]{
         FormSpecs.DEFAULT_ROWSPEC,
         FormSpecs.GLUE_ROWSPEC,
         FormSpecs.DEFAULT_ROWSPEC,
         FormSpecs.GLUE_ROWSPEC,
         FormSpecs.DEFAULT_ROWSPEC,
         FormSpecs.GLUE_ROWSPEC
       }
      );
    2.

    FormLayout layout = new FormLayout( 
            "right:pref, 6dlu, 50dlu, 4dlu, center:50dlu", // columns
            "pref, 3dlu, pref, 3dlu, pref"); // rows   





    參考文章:
    http://hi.baidu.com/lijunwyf/item/a18d95f719ff01da6225d26f

    posted @ 2012-09-29 11:29 GavinMiao 閱讀(1323) | 評論 (0)編輯 收藏

    Vector淺見

    例子:
    import java.util.*;
    public class TestVector{
     public static void main(String[] args){
      Vector v = new Vector();
      v.add(null);
      v.add(new Integer(1));
      v.add("123");
      
      for(Enumeration e = v.elements();e.hasMoreElements();){
       System.out.println(e.nextElement());
      }
      v.insertElementAt("insert",2);
      v.setElementAt("insert",0);
      
      for(Enumeration e = v.elements();e.hasMoreElements();){
       System.out.println(e.nextElement());
      }
      
     }
    }

    結(jié)果:
    null
    1
    123

    insert
    1
    insert
    123
     
    結(jié)論:
    vector中可以放入null;
    vector可以放入不同類型的對象;
    vector是同步的容量自增長的向量;

    posted @ 2012-09-24 08:49 GavinMiao 閱讀(318) | 評論 (0)編輯 收藏

    火車票訂票好辦法

    一、前提須知:
    1.北京鐵路局:
    直屬站15個:北京站北京西站天津站天津西站豐臺站豐臺西站南倉站塘沽站唐山站石家莊站石家莊南站、邯鄲站、陽泉站、北京南站、天津西站。
    2.鄭州鐵路局:
    直屬車站11個:鄭州站、鄭州北站、鄭州東站、洛陽站、新鄉(xiāng)站、開封站、商丘站、月山站、長治北站、長治站。
    二、
    北京電話訂票竅門:1、座機打!;2.用手機加區(qū)號打!北京鐵路局管內(nèi),如唐山區(qū)號:打0315-95105105,手機打95105105的有效區(qū)號:河北省邯鄲0310石家莊0311保定0312張家口0313承德0314唐山0315廊坊0316滄州0317衡水0318邢臺0319秦皇島0335山東德州0534山西陽泉0353天津022。訂好之后可以在北京取票!!

    posted @ 2012-09-18 07:55 GavinMiao 閱讀(379) | 評論 (0)編輯 收藏

    異常積累:org.hibernate.StaleStateException

    ERROR - Exception executing batch: 
    org.hibernate.StaleStateException: Batch update returned unexpected row count fr
    om update [0]; actual row count: 0; expected: 1

    ERROR - Could not synchronize database state with session
    org.hibernate.StaleStateException: Batch update returned unexpected row count fr
    om update [0]; actual row count: 0; expected: 1


    不注意的話,還真的有點無所適從,Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1
    這個異常是由于主鍵設(shè)置為自增長,而在我們插入記錄的時候設(shè)置了ID的值導(dǎo)致的。看下我的Hibernate映射文件中ID的定義:

    參考文章:http://hi.baidu.com/shirdrn/blog/item/adec1e82d067ddb86c81191c.html

    posted @ 2012-04-18 15:33 GavinMiao 閱讀(10581) | 評論 (0)編輯 收藏

    java.lang.IllegalStateException: Cannot forward after response has been committed

    現(xiàn)象:
    頁面報500.
    原因:
    在request.getRequestDispatcher("/success.html").forward(request, response);
    后面還有未執(zhí)行的代碼,但是已經(jīng)提交了響應(yīng)。

    posted @ 2012-04-14 09:08 GavinMiao 閱讀(480) | 評論 (0)編輯 收藏

    UML初接觸

    1.UML:unified modeling Language(統(tǒng)一建模語言)
    2.草圖與藍圖:
    前者指:手工繪制的、規(guī)范度較低的UML模型;
    后者指:case工具繪制的正式的、規(guī)范的UML模型;
    3.不同可視性的符號:
    “+”:public   “#”:protected  “-”:private  “~”:package
    4.UML主要包含三種圖:靜態(tài)圖、動態(tài)圖、物理圖
    5.關(guān)聯(lián)關(guān)系:用來表示一個對象持有另外一個對象的引用,或是調(diào)用另外一個對象的方法
    6.類圖:


    7.類圖之間的關(guān)聯(lián):
    —▷▷  —>持有

    posted @ 2012-04-13 11:34 GavinMiao 閱讀(321) | 評論 (0)編輯 收藏

    面試題(互聯(lián)網(wǎng)網(wǎng)上商城行業(yè))

        只有注冊用戶登錄后才能閱讀該文。閱讀全文

    posted @ 2012-04-12 22:39 GavinMiao 閱讀(113) | 評論 (0)編輯 收藏

    不用臨時變量交換兩個數(shù)

    方法1:
    a=a^b;
    b=a^b;
    a=a^b;
    方法2:
    a=a+b;
    b=a-b;
    a=a-b;

    posted @ 2012-04-12 11:27 GavinMiao 閱讀(417) | 評論 (0)編輯 收藏

    易寶支付面試題(根據(jù)網(wǎng)上總結(jié))

    1.public class TestKnowleage5 {
    public static void main(String[] args){
    String strValue = "ABCDEFG";
    strValue.substring(3);
    System.out.println("result1"+strValue);
    strValue.concat("123");
    System.out.println("result2"+strValue);
    String value = new String("ABCDEFG");
    System.out.println(strValue==value);
    }
    }

    運行結(jié)果:
    result1ABCDEFG
    result2ABCDEFG
    false
    2.public class Test{
        public static void main(String[] args){
             int x = 100;
    int y = 200;
    if(x == y)
    System.out.println("not equal");
    else
    System.out.println("equal");
        }
    }

    運行結(jié)果:
    equal

    3.public class TestKnowleage5 {
    public static void main(String[] args){
    try{
    new TestKnowleage5().methodA(5);
    }catch(IOException e){
    System.out.println("caught IOException");
    }catch(Exception e){
    System.out.println("caught Exception");
    }finally{
    System.out.println("no Exception");
    }
    }
    public void methodA(int i) throws IOException{
    if(i%2 != 0){
    throw new IOException("methodA IOException");
    }
    }
    }

    運行結(jié)果:
    caught IOException
    no Exception

    4.public class TestKnowleage5 {
    static boolean isTrue(){
    System.out.println("isTrue");
    return true;
    }
    static boolean isFalse(){
    System.out.println("isFalse");
    return false;
    }
    public static void main(String[] args){
    if(isTrue() || isFalse()){
    System.out.println("|| operate return true");
    }
    if(isFalse() & isTrue()){
    System.out.println("& operate return true");
    }
    }
    }

    運行結(jié)果:
    isTrue
    || operate return true
    isFalse
    isTrue

    5.public class TestKnowleage5{
    public static void main(String args[]){
    MyThread t = new MyThread();
    t.run();
    t.start();
    System.out.println("A");
    }
    }
    class MyThread extends Thread{
    public void run(){
    try{
    Thread.currentThread().sleep(3000);
    }catch(InterruptedException e){
    }
    System.out.println("B");
    }
    }
    運行結(jié)果:
    BBA或
    BAB
    6.class A{
    void fun1(){
    System.out.println(fun2());
    }
    int fun2(){
    return 123;
    }
    }
    public class TestKnowleage5  extends A{
    int fun2(){
    return 456;
    }
    public static void main(String[] args){
    A a;
    TestKnowleage5 b = new TestKnowleage5();
    b.fun1();
    a = b;
    a.fun1();
    }
    }

    運行結(jié)果:
    456
    456
    7.class A{
    int val;
    public int getVal() {
    return val;
    }
    public void setVal(int val) {
    this.val = val;
    }
    }
    public class TestKnowleage5{
    public static void main(String[] args){
    A data = new A();
    ArrayList list = new ArrayList();
    for(int i=100;i<103;i++){
    data.setVal(i);
    list.add(data);
    }
    int j = 0;
    while(j<list.size()){
    A tmp = (A)list.get(j);
    System.out.println("list("+j+")="+tmp.getVal());
    j++;
    }
    }
    }

    運行結(jié)果:
    list(0)=102
    list(1)=102
    list(2)=102

    8.hibernate導(dǎo)入大量數(shù)據(jù)時,為了避免內(nèi)存中產(chǎn)生大量對象,在編碼時注意什么,如何去除?

    9.視圖與表的區(qū)別
    10.觸發(fā)器有哪幾種類型
    11.
    事務(wù)操作有那幾個步驟
    12.寫出對應(yīng)正則表達式:
    1)1-6位字母或數(shù)字;
    [a-zA-Z0-9]{1,6}
    2)手機號(只能是139或159開頭,11位數(shù)字)
    1[35][9][0-9]{8}
    13.字符串反轉(zhuǎn):new StringBuilder(str).reverse().toString();
    14.寫程序:1+2²+3²+...+n²
    int func(int n){
        return n==1?1:func(n-1)+n*n
    }

    15.寫一個延遲加載的單例模式:
    public class SingleTon{
        private static  SingleTon  instance = null;
        private SingleTon(){}
        public static SingleTon getInstance(){
            if(instance == null){
                    synchronized(""){
                        if(instance == null){return new SingleTon();}
                    }
            }
            return instance;
        }
    }

    16.
    JSP的9種內(nèi)置對象:
    request:
    HttpServletRequest類的實例,
    客戶端的請求信息被封裝在request對象中
    response:
    HttpServletResponse類的實例,
    response對象包含了響應(yīng)客戶請求的有關(guān)信息,但在JSP中很少直接用到它。
    out:
    out對象是JspWriter類的實例,是向客戶端輸出內(nèi)容常用的對象
    session:
    session對象指的是客戶端與服務(wù)器的一次會話,從客戶端連到服務(wù)器的一個WebApplication開始,直到客戶端與服務(wù)器斷開連接為止。它是HttpSession類的實例
    page:
    page對象就是指向當(dāng)前JSP頁面本身,有點象類中的this指針,它是java.lang.Object類的實例
    application:
    ServletContext類的實例,
    application對象實現(xiàn)了用戶間數(shù)據(jù)的共享,可存放全局變量。它開始于服務(wù)器的啟動,直到服務(wù)器的關(guān)閉
    exception:
    exception對象是一個例外對象,當(dāng)一個頁面在運行過程中發(fā)生了例外,就產(chǎn)生這個對象。如果一個JSP頁面要應(yīng)用此對象,就必須把isErrorPage設(shè)為true,否則無法編譯。他實際上是java.lang.Throwable的對象
    pageContext:
    pageContext對象提供了對JSP頁面內(nèi)所有的對象及名字空間的訪問,也就是說他可以訪問到本頁所在的SESSION,也可以取本頁面所在的application的某一屬性值,他相當(dāng)于頁面中所有功能的集大成者,它的本類名也叫pageContext
    config:
    config對象是在一個Servlet初始化時,JSP引擎向它傳遞信息用的,此信息包括Servlet初始化時所要用到的參數(shù)(通過屬性名和屬性值構(gòu)成)以及服務(wù)器的有關(guān)信息(通過傳遞一個ServletContext對象)
    17.session和cookie的區(qū)別?
    18.JDBC的操作步驟?

    posted @ 2012-04-11 11:32 GavinMiao 閱讀(1542) | 評論 (0)編輯 收藏

    面試題(移動通信方面)

    1.方法重載與多態(tài),簡述;
    2.什么是設(shè)計模式?使用過哪些?
    3.列出熟悉的java開源項目及簡述;
    4.一組radio,用alert彈出當(dāng)前所選的是第幾個radio?用原生javascript;
    5.function showme(){
    Book.prototype.abc = function(){
    alert('456');
    }
    var abook = new Book(1,2);
    Book.abc = function(){
    alert('123');
    }
    abook.abc();
    Book.abc();
    abc();//此方法調(diào)用瀏覽器會報錯,未定義
    }
    function Book(a,b){
    this.a = a;
    this.b = b;
    Book.abc = function(){
    alert('def');
    }
    this.abc = function(){
    alert('xyz');
    }
    abc = function(){
    alert('@@@@@@');
    }
    var abc = function(){
    alert('$$$$$$');
    }
    }

    點擊按鈕調(diào)用showme(),頁面顯示結(jié)果為:
    第一個彈出框:xyz
    第二個彈出框:123

    6.線程的四種狀態(tài)?
    7.ext有哪些組件?ext如何與后臺交互?
    8.HashMap放入、查找、刪除,將所有value放入一個數(shù)組,得到map中所有內(nèi)容;List添加、查找、刪除;
    9.List<Student> student(name,age) 比較oldList<Student>和newList<student>,按名字比較,獲得新增的、修改的、刪除學(xué)生列表;
    10.使用過哪些xml技術(shù)?怎么實現(xiàn)的?
    11.java異常:throws、throw、try、catch、finally,舉例,如何處理異常
    12.字符串反轉(zhuǎn):
    public class TestKnowleage5 {
    public static void main(String[] args){
    System.out.println(reverse("abc"));
    System.out.println(reverse2("abc"));
    System.out.println(reverse3("abc"));
    }
    public static String reverse(String str){
    return new StringBuffer(str).reverse().toString();
    }
    public static String reverse2(String str){
    char[] chs = str.toCharArray();
    char[] re = new char[chs.length];
    for(int i = 0 ; i<chs.length;i++){
    re[i] = chs[chs.length - i - 1]; 
    }
    return new String(re);
    }
    public static String reverse3(String str){
    char[] chs = str.toCharArray();
    String re = ""; 
    for(int i = 0;i<chs.length;i++){
    re += chs[chs.length - 1 -i];
    }
    return re;
    }
    }

    posted @ 2012-04-10 22:39 GavinMiao 閱讀(530) | 評論 (0)編輯 收藏

    面試題(ERP行業(yè))

    //此句,編譯無法通過,Cannot make a static reference to the non-static field b
    1.arrayList、linkedList、vector的區(qū)別
    2.
    寫幾種J2EE規(guī)范并簡要描述
    3.什么是設(shè)計模式?用過哪些設(shè)計模式?
    4.OO的四大特性是哪些?并簡要描述
    5.方法重載、多態(tài)概念及簡要描述;
    6.sql常用的優(yōu)化方法有哪些?
    7.sleep()與wait()的區(qū)別?
    8.
    public class TestException {
    public static void main(String[] args) {
    int i = 1;
    switch(i){
    case 0:
    System.out.println(0);
    break;
    case 1:
    System.out.println(1);
    default:
    System.out.println(4);
    case 2:
    System.out.println(2);
    case 3:
    System.out.println(3);
    }
    }
    }
    運行結(jié)果:
    1
    4
    2
    3
    9.HashTable和HashMap的區(qū)別
    10.怎樣理解mvc模式?
    11.抽象類、接口的區(qū)別?
    12.智力題:
    有1-7號,7塊地,S、U、V、W、X 5個遺產(chǎn)繼承者,
    S若繼承2號,不能繼承3號;
    3號和4號不能同時繼承;
    S若繼承一塊或多塊地,則U不能繼承
    1塊地不能被2人合分;

    問:若S繼承2號地,剩余3個人中,不能同時哪2塊地?
    A:1和6 B:1和7 c:3和7 d:1和5 e:1和3
    13.
    public class TestKnowleage5 {
    static int a;
    int b,c=0;
    public static void main(String[] args){
    a++;
    b++;//此句,編譯無法通過,Cannot make a static reference to the non-static field b
    c++; //此句,編譯無法通過,cannot make a static reference to the non-static field c
    }
    }


    參考文章:

    posted @ 2012-04-10 21:59 GavinMiao 閱讀(519) | 評論 (0)編輯 收藏

    用友面試題(參考網(wǎng)上總結(jié)而出)

    1,有三個jsp頁面:a.jsp b.jsp c.jsp,流程是a.jsp--> b.jsp--> c.jsp,其中a.jsp提交的數(shù)據(jù)要在c.jsp中訪問,用最簡單的辦法怎么做?不用session。
    在b.jsp中放N個hidden隱藏域保存a.jsp中的數(shù)據(jù),一起提交到c.jsp,在c.jsp中取出。2.sql server支持集群么?
    支持,不過屬于熱備份類型,不能做負載均衡。不過符合你的條件
    首先系統(tǒng)做集群,數(shù)據(jù)庫文件放到磁盤陣列里,雙機或多機共同訪問磁盤陣列,就可以了,可以集群后做負載均衡;
    3.HashTable與HashMap的區(qū)別:
    1)HashMap非線程安全,HashTable線程安全;
    2)HashMap可放一條key為空的記錄,任意記錄的value可為空,hashTable不可以;
    3)hashMap去掉了contains方法,增加了containsKey和containsValue方法;
    4.如何理解mvc模式:
    mvc是sun提出的model2開發(fā)模式,將控制、視圖、模型進行了分離;提高了可維護性、擴展性、可移植性、組件的可復(fù)用性;
    5.SingleTon:
    6.對象序列化的含義:
    java序列化技術(shù)可以使你將一個對象的狀態(tài)寫入一個byte流里,并且可以從其它地方把該byte流里的數(shù)據(jù)讀出來,重新構(gòu)造一個相同的對象。
    這種機制允許你將對象通過網(wǎng)絡(luò)傳播,并且隨時可以把對象持久化到數(shù)據(jù)庫、文件等系統(tǒng)里,java的序列化技術(shù)是RMI、EJB等技術(shù)的基礎(chǔ);
    實現(xiàn)方法:implements Serializable標記為可序列化,然后用ObjectOutputStream和ObjectInputStream讀寫;
    7.數(shù)據(jù)庫中的鎖包含哪些?
    排它鎖和共享鎖
    8.jsp和servlet的區(qū)別:
    1)簡單來說:jsp就是含有java代碼的html,servlet就是含有html的java代碼;
    2)jsp最終被解釋成servlet,編譯再執(zhí)行,jsp不過是servlet的另一種編寫形式;
    3)jsp擅長表示,servlet擅長數(shù)據(jù)處理,在mvc中jsp處于視圖層,servlet處于控制層;
    9.oracle在數(shù)據(jù)庫中的交集怎么表示:
    1)用intersect操作符 2)用in 語句
    9.JNDI、JMS、JTA、RMI:

    JNDI:java naming and directory interface java命名目錄接口
    JMS:java messing service java消息服務(wù)
    JTA:java transaction api java事務(wù)api
    RMI:
    Remote Method Invocation 遠程方法調(diào)用

    10.事務(wù):

    1)ACID屬性:
    A:atomic 原子性
    C:consistent 一致性
    I:isolation 隔離性
    D:duration 持久性
    2)概念:事務(wù)就是一系列操作,它們完成一項任務(wù)。只要這些操作里有一項沒成功,事務(wù)就操作失敗,發(fā)生回滾事件。即撤銷前面的操作,這樣可以保證數(shù)據(jù)的一致性。而且可以把操作放在緩存里,等所有操作都成功就提交數(shù)據(jù)庫,這樣保證費時的操作都是有效操作。
    3)隔離級別 4)傳播行為
    參考文檔:http://wenku.baidu.com/view/56a532eb856a561252d36f81.html

    posted @ 2012-04-09 11:32 GavinMiao 閱讀(1073) | 評論 (0)編輯 收藏

    面試題(某呼叫中心)

    1.String b = new String("1"+"2"); -->4個
    2.Customer(id,name,phone,country);每個客戶均有地區(qū)(country)屬性,每個地區(qū)可有1或多個客戶,查詢擁有超過10名客戶的地區(qū)的列表;
    3.public interface TreeNode{
        String getName();
        List getChildren();
    }
     寫一個print()方法,打印各級節(jié)點名稱.

    4.String與StringBuffer的區(qū)別?
    String
    5.ajax名詞解釋,它的核心價值及原理;
    6.事務(wù)的概念及名詞解釋;
    7.數(shù)據(jù)庫表之間有幾種關(guān)系,并舉例;
    8.Filter的原理,常見用例;
    9.視圖與表的區(qū)別?觸發(fā)器類型有哪些類型?
    10.建表及各種約束;
    11.hibernate導(dǎo)入大量數(shù)據(jù)時,為了避免內(nèi)存中產(chǎn)生大量對象,在編碼時注意什么,如何去除?

    posted @ 2012-04-07 00:14 GavinMiao 閱讀(759) | 評論 (0)編輯 收藏

    String面試題

        只有注冊用戶登錄后才能閱讀該文。閱讀全文

    posted @ 2012-04-06 18:26 GavinMiao 閱讀(85) | 評論 (0)編輯 收藏

    面試題(通信行業(yè)公司)

    一、unix:
    1.ps -ef|grep tomcat
    2.mkdir dir
    3.打tar包:tar -cvf XXX.tar XXX
    4.解壓tar包:tar -xvf XXX.tar
    二、java
    1.HashMap和HashTable的區(qū)別:
    HashMap不是線程安全的,
    HashTable是線程安全的
    HashTable不允許null值(key和value都不可以),HashMap允許null值(key和value都可以)。
    HashTable使用Enumeration,HashMap使用Iterator。
    HashMap把Hashtable的contains方法去掉了,改成containsvalue和containsKey。
    Hashtable是基于陳舊的Dictionary類,完成了Map接口;HashMap是Java 1.2引進的Map接口的一個實現(xiàn)(HashMap繼承于AbstractMap,AbstractMap完成了Map接口)。
    HashTable中hash數(shù)組默認大小是11,增加的方式是 old*2+1。HashMap中hash數(shù)組的默認大小是16,而且一定是2的指數(shù)。
    哈希值的使用不同,HashTable直接使用對象的hashCode。
    2.什么是java的序列化?如何實現(xiàn)java的序列化:

    序列化就是一種用來處理對象流的機制,所謂對象流也就是將對象的內(nèi)容進行流化。可以對流化后的對象進行讀寫操作,也可將流化后的對象傳輸于網(wǎng)絡(luò)之間。序列化是為了解決在對對象流進行讀寫操作時所引發(fā)的問題。

    序列化的實現(xiàn):將需要被序列化的類實現(xiàn)Serializable接口,然后使用一個輸出流(如:FileOutputStream)來構(gòu)造一個ObjectOutputStream(對象流)對象,接著,使用ObjectOutputStream對象的writeObject(Object obj)方法就可以將參數(shù)為obj的對象寫出(即保存其狀態(tài)),要恢復(fù)的話則用輸入流。

    3.什么是java的單例模式?寫一個單例模式;
    單例模式:確保某一個類只有一個實例,而且自行實例化并向整個系統(tǒng)提供這個實例。這個類稱為單例類。

      代碼清單1:餓漢式單例類

    public class EagerSingleton 

        private static final EagerSingleton m_instance = new EagerSingleton(); 

       /** 
       * 私有的默認構(gòu)造方法 
       */
     
       private EagerSingleton() { } 

       /** 
       * 靜態(tài)方法獲得單例 
       */ 
       public static EagerSingleton getInstance() 
       {
          return m_instance; 
       }
    }

    代碼清單2:懶漢式單例類

    package com.javapatterns.singleton.demos;
    public class LazySingleton
    {
        private static LazySingleton m_instance = null;


        /**
        * 私有的默認構(gòu)造方法,保證外界無法直接實例化
        */
        private LazySingleton() { }


        /**
        * 靜態(tài)方法,返還此類的惟一實例
        */
        public synchronized static LazySingleton getInstance()
        {
            if (m_instance == null)
            {
                m_instance = new LazySingleton();
            }
            return m_instance;
        }
    }

    4.靜態(tài)塊與構(gòu)造器在繼承中的執(zhí)行順序:

    public class TestExeuteOrder {

    public static void main(String[] args) {
    Parent p = new ChildTest();
    p = new ChildTest();

    }

    }
    class ChildTest extends Parent{
    static{
    System.out.println("in child static");
    }
    public ChildTest(){
    System.out.println("in child construtor");
    }
    }

    class Parent{
    static{
    System.out.println("in parent static");
    }
    public Parent(){
    System.out.println("in parent construtor");
    }
    }
    運行結(jié)果:
    in parent static
    in child static
    in parent construtor
    in child construtor
    in parent construtor
    in child construtor
    5.成員內(nèi)部類:
    public class TestExeuteOrder{
    class Inner{
    void test(){
    if(TestExeuteOrder.this.flag){
    System.out.println("what a funny");
    }
    }
    }
    private boolean flag = true;
    public TestExeuteOrder(){
    new Inner().test();
    }
    public static void main(String[] args){
    new TestExeuteOrder();
    }
    }
    運行結(jié)果:
    what a funny
    6.參數(shù)傳遞:
    public class TestExeuteOrder{

    public static void main(String[] args){
    String a = "ello";
    TestExeuteOrder t = new TestExeuteOrder();
    t.change(a);
    System.out.println(a);
    }
    public void change(String str){
    str += "H";
    }
    }
    結(jié)果:
    ello
    7.參數(shù)傳遞2:
    public class TestExeuteOrder{

    public static void main(String[] args){
    StringBuffer x = new StringBuffer("A");
    StringBuffer y = new StringBuffer("B");
    change(x,y);
    System.out.println(x+" "+y);
    }
    public static void change(StringBuffer a,StringBuffer b){
    a.append(b);
    b = a;
    }
    }
    結(jié)果為:
    AB B
    8.

    public class TestExeuteOrder{
    public static void main(String[] args){
    String a = "good";
    char[] b = new char[]{'a','b','c'};
    method(a,b);
    System.out.println("a="+a+"------>b="+new String(b));
    }
    public static void method(String a,char[] b){
    a = "Test ok";
    b[0] = 'g';
    }
    }
    結(jié)果:
    a=good------>b=gbc
    三、SQL:

     

    1.存儲過程與函數(shù)的區(qū)別:
    1)前者,程序頭部聲明用的是procedure;后者,程序頭部聲明用的是function;
    2)前者,不需要描述返回類型,后者需要;
    3)前者可以作為一個獨立的pl/sql語句來執(zhí)行;后者不能獨立運行,必須作為表達式的一部分條用;
    4)sql語句中不可調(diào)用procedure,但可以調(diào)用function;
    2.查詢student表中name重復(fù)的記錄:

    select * from student where name in(select name from student group by sname having count(*) >1);

    3.table表中有兩列A,B,如果A>B選擇A,如果A<B,選擇B:

    select( case when s1.A>s1.B then s1.A  when s1.A<s1.B then s1.B end) re from student s1;

     

    posted @ 2012-03-30 16:00 GavinMiao 閱讀(740) | 評論 (0)編輯 收藏

    異常積累:NoClassDefFoundError: org/hibernate/ConnectionReleaseMode Error creating bean with name 'sessionFactory'

    jar包不全,更新lib目錄后,不再報錯。

    posted @ 2012-03-28 16:06 GavinMiao 閱讀(395) | 評論 (0)編輯 收藏

    公司口碑及待遇評價的網(wǎng)站

    1.公司速查手冊 :http://www.b1.tooyard.com/
    2.分智網(wǎng):http://www.fenzhi.com/  
    3.我評it:http://wopingit.com/   
    4.企業(yè)點評網(wǎng):http://www.71dp.com/   
    5.中國企業(yè)評價網(wǎng): http://www.ceea.net.cn/  
    6.公司點評網(wǎng):http://www.gsdpw.com/  
    7.企業(yè)付費邀請面試:http://www.tradecv.com/

    posted @ 2012-03-27 23:13 GavinMiao 閱讀(1113) | 評論 (1)編輯 收藏

    ftp-java實現(xiàn)

    一、利用框架:
    1.jre下的rt.jar中sun.net.ftpClient
    2.common net 中的ftp包
    二、ftp協(xié)議認識:
    參考規(guī)范:RFC 959
    1.文件傳輸協(xié)議:file transfer protocol (ftp)
    2.名詞解釋:
    DTP:
    數(shù)據(jù)傳輸過程
    EOR:記錄尾
    PI:協(xié)議解釋器
    NTV:
    網(wǎng)絡(luò)虛擬終端
    NVFS:
    網(wǎng)絡(luò)虛擬文件系統(tǒng)
    3.
    控制連接是建立在USER-PIT和SERVER-PI之間用于交換命令與應(yīng)答的通信鏈路。
    4.
    數(shù)據(jù)連接是傳輸數(shù)據(jù)的全雙工連接。傳輸數(shù)據(jù)可以發(fā)生在服務(wù)器DTP和用戶DTP之間也可以發(fā)生在兩個服務(wù)器DTP之間。
    5.
    數(shù)據(jù)連接只傳輸數(shù)據(jù),控制連接傳送命令和響應(yīng)。
    6.
    FTP使用Telnet協(xié)議進行控制連接
    7.




    參考文章:http://blog.csdn.net/williamzhou/article/details/215293 

    posted @ 2012-03-26 18:03 GavinMiao 閱讀(383) | 評論 (0)編輯 收藏

    ssh集成中session的管理(轉(zhuǎn)載)

         摘要: 文章來源:http://www.iteye.com/topic/7339711.通過getSession()方法獲得session進行操作 Java代碼  public class Test  extends HibernateDaoSupport{      ...  閱讀全文

    posted @ 2012-03-23 15:33 GavinMiao 閱讀(4723) | 評論 (0)編輯 收藏

    spring2.0學(xué)習(xí)筆記

    一、setter DI:
    <bean>
        <property name="">
            <ref bean="bean的name或id"/>
        </property>
        <property name="">
            <!--內(nèi)部bean-->
            <bean></bean>
        </property>
        <property name="">
            <ref local="只能是同一文件的bean的id"/>
        </property>
        <!--idref元素用來引用其它bean的id,spring會驗證id是否存在-->
        <property name="">
            <idref bean=""/>
        </property>
        <!--idref元素的local屬性用來引用其它bean的id,spring會驗證id是否存在,并且驗證與引用的bean是否在同一文件-->
        <property name="">
            <idref local=""/>
        </property>
        <property name="">
            <value></value>
        </property>
        <property name="" ref=""/>
        <property name="" value=""/>
        <property name="">
            <null/>
        </property>
        <property name="">
                <props>
                    <prop key=""></prop>
                     <prop key=""></prop>
                </props>
        </property>

        <property name="">
            <list>
                <value></value>
                <ref bean=""/>    
            </list>
        </property>

        <property name="">
            <set>
                <value></value>
                <ref bean=""/>    
            </set>
        </property>

        <property name="">
            <map>
                <entry>
                    <key>
                        <value></value>
                    </key>
                    <value></value>
                </entry>
                <entry key="" value=""/><!--推薦-->
                <entry key="">
                    <value>
                    </value>
                </entry>
                <entry key-ref="" value-ref=""/>
                <entry>
                    <key>
                        <value></value>
                    </key>
                    <ref bean=""/>
                </entry>
            </map>
        </property>
    </bean>
    二、contructor DI:
    <bean>
        <constructor-arg>
            <ref bean=""/>
        </constructor-arg>
        <constructor-arg ref="bean的name或id"/>
        <constructor-arg value=""/>
        <constructor-arg type="" value=""/>
        <constructor-arg index="" value=""/><!--首選-->
    </bean>

    posted @ 2012-03-22 17:52 GavinMiao 閱讀(348) | 評論 (0)編輯 收藏

    spring1.1學(xué)習(xí)筆記

        只有注冊用戶登錄后才能閱讀該文。閱讀全文

    posted @ 2012-03-21 17:34 GavinMiao 閱讀(64) | 評論 (0)編輯 收藏

    spring2.5新特性

    1.spring2.5完全支持java1.6
    2.完全支持Java EE 5
    3.spring2.5提供了完整的annotation集合:@Autowired,以及對JSR-250注解@Resource,@PostConstruct,@PreDestroy
    4.在classpath中自動搜索帶有annotation的組件。
    5.spring2.5加入了對bean(...)pointcut元素的支持,在spring定義的bean命名中對指定的命名進行匹配
    6.在spring應(yīng)用中使用AspectJ加載時織入context:load-time-weaver
    7.增加,通過context:load-time-weaver和tx:annotation-driven mode="aspectj"聯(lián)合使用的注解驅(qū)動的事務(wù)管理
    8.對JPA,升級到支持Open JPA1.0
    9.2.5顯著的擴充了SimpleJdbcTemplate的功能,引入了SimpleJdbcCall和SimpleJdbcInsert操作對象
    10,web層,增加了基于注解的Controller
    11.spring2.5引入了基于annotation的MVC編程模型,使用@RequestMapping、@RequestParam、@ModelAttribute等等
    12.增加對tiles2的支持
    13.引入了sping TestContext Framework,它提供了注解驅(qū)動的單元和集成測試支持

    posted @ 2012-03-20 17:57 GavinMiao 閱讀(548) | 評論 (0)編輯 收藏

    spring2.0新特性

    1.
    引入request scope、session scope和可自定義的scope(hooks)
    2.
    引入了XML 
    Schema的namespace,
    簡化了配置,包括了對bean屬性的各種簡化,AOP配置的簡化,事務(wù)配置的簡化,JNDI配置的簡化等方面
    3.spring2.0集成了AspectJ切入點(pointcut)語言和@AspectJ切面(aspect)聲明類型
    4.支持@AspectJ注解定義切面
    5.提供了JPA的抽象層
    6.對于JMS,spring2.0提供異步接受消息
    7.對于jdbc,增加了NamedParameterJdbcTemplate、SimpleJdbcTemplate
    8.對java1.5的支持,結(jié)合AspectJ使用@Transactional、使用AspectJ來為domain object進行依賴注入、@AspectJ、@Required、SimpleJdbcTemplate

    posted @ 2012-03-20 17:37 GavinMiao 閱讀(304) | 評論 (0)編輯 收藏

    window下dos窗口中文亂碼解決辦法


    進入注冊表:
    HKEY_CURRENT_USER\Console\%SystemRoot%_system32_cmd.exe
    新建DWORD值,然后重命名為:CodePage,修改其值為十進制的936

    posted @ 2012-03-20 11:16 GavinMiao 閱讀(541) | 評論 (0)編輯 收藏

    java中的位運算應(yīng)用

    1, a & 0xff 可得到a對應(yīng)而二進制的最后8位;
    2,左移n位--》表示乘以2的N次方
    3,  右移n位-->表示除以2的N次方

    posted @ 2012-03-19 16:36 GavinMiao 閱讀(368) | 評論 (0)編輯 收藏

    spring整合struts2

        只有注冊用戶登錄后才能閱讀該文。閱讀全文

    posted @ 2012-03-16 14:55 GavinMiao 閱讀(21) | 評論 (0)編輯 收藏

    spring2.0整合struts1(轉(zhuǎn)載)

         摘要: 文章來源:http://hi.baidu.com/liuzhe041/blog/item/e12251dcf2ffe053ccbf1ad2.htmlspring 和struts整合 有3種方式,推薦用第三種。下面一一介紹,不管使用哪種方式,都需要在web.xml 中配置 spring的 監(jiān)聽器Java代碼 <context-param>   &n...  閱讀全文

    posted @ 2012-03-16 10:14 GavinMiao 閱讀(286) | 評論 (0)編輯 收藏

    spring整合hibernate(annotation方式)

        只有注冊用戶登錄后才能閱讀該文。閱讀全文

    posted @ 2012-03-15 11:08 GavinMiao 閱讀(78) | 評論 (0)編輯 收藏

    spring整合hibernate

        只有注冊用戶登錄后才能閱讀該文。閱讀全文

    posted @ 2012-03-14 17:42 GavinMiao 閱讀(72) | 評論 (0)編輯 收藏

    java播放wav的基礎(chǔ)代碼(轉(zhuǎn)載)

     文章來源:http://hi.baidu.com/breezedancer/blog/item/7eebb499680d8f086e068cb9.html 

    import javax.sound.sampled.*;
    import java.io.*;
    public class TestMusic{
     
     private AudioFormat format;
        private byte[] samples;
     
     public static void main(String args[])throws Exception{
      TestMusic sound =new TestMusic("1.wav");
      InputStream stream =new ByteArrayInputStream(sound.getSamples());
            // play the sound
            sound.play(stream);
            // exit
            System.exit(0);
     }
     
        public TestMusic(String filename) {
            try {
                // open the audio input stream
                AudioInputStream stream =AudioSystem.getAudioInputStream(new File(filename));
                format = stream.getFormat();
                // get the audio samples
                samples = getSamples(stream);
            }
            catch (UnsupportedAudioFileException ex) {
                ex.printStackTrace();
            }
            catch (IOException ex) {
                ex.printStackTrace();
            }
       }
       
       public byte[] getSamples() {
            return samples;
        }
       
         private byte[] getSamples(AudioInputStream audioStream) {
            // get the number of bytes to read
            int length = (int)(audioStream.getFrameLength() * format.getFrameSize());

            // read the entire stream
            byte[] samples = new byte[length];
            DataInputStream is = new DataInputStream(audioStream);
            try {
                is.readFully(samples);
            }
            catch (IOException ex) {
                ex.printStackTrace();
            }

            // return the samples
            return samples;
        }
     
     public void play(InputStream source) {

            // use a short, 100ms (1/10th sec) buffer for real-time
            // change to the sound stream
            int bufferSize = format.getFrameSize() *
                Math.round(format.getSampleRate() / 10);
            byte[] buffer = new byte[bufferSize];

            // create a line to play to
            SourceDataLine line;
            try {
                DataLine.Info info =
                    new DataLine.Info(SourceDataLine.class, format);
                line = (SourceDataLine)AudioSystem.getLine(info);
                line.open(format, bufferSize);
            }
            catch (LineUnavailableException ex) {
                ex.printStackTrace();
                return;
            }

            // start the line
            line.start();

            // copy data to the line
            try {
                int numBytesRead = 0;
                while (numBytesRead != -1) {
                    numBytesRead =
                        source.read(buffer, 0, buffer.length);
                    if (numBytesRead != -1) {
                       line.write(buffer, 0, numBytesRead);
                    }
                }
            }
            catch (IOException ex) {
                ex.printStackTrace();
            }

            // wait until all data is played, then close the line
            line.drain();
            line.close();

        }


    }

    posted @ 2012-03-14 14:30 GavinMiao 閱讀(1471) | 評論 (0)編輯 收藏

    informix小知識

        只有注冊用戶登錄后才能閱讀該文。閱讀全文

    posted @ 2012-03-13 17:05 GavinMiao 閱讀(68) | 評論 (0)編輯 收藏

    延遲加載

    也叫延遲檢索或懶加載
    一.實現(xiàn)方式:
    1.*hbm.xml中的class元素的lazy屬性設(shè)置為true;
    2.*hbm.xml中的set元素的lazy屬性設(shè)置為true;
    3.
    @[One|Many]ToOne](fetch=FetchType.LAZY) @LazyToOne(PROXY) @Fetch(SELECT)
    @[One|Many]ToOne](fetch=FetchType.EAGER) @LazyToOne(FALSE) @Fetch(JOIN)
    @ManyTo[One|Many](fetch=FetchType.LAZY) @LazyCollection(TRUE)@Fetch(SELECT)
    @ManyTo[One|Many](fetch=FetchType.EAGER) @LazyCollection(FALSE) @Fetch(JOIN)

    參考文章:

    posted @ 2012-03-13 10:46 GavinMiao 閱讀(352) | 評論 (0)編輯 收藏

    hibernate注意點

        只有注冊用戶登錄后才能閱讀該文。閱讀全文

    posted @ 2012-03-13 09:53 GavinMiao 閱讀(67) | 評論 (0)編輯 收藏

    commit()與flush()的區(qū)別

        只有注冊用戶登錄后才能閱讀該文。閱讀全文

    posted @ 2012-03-13 09:23 GavinMiao 閱讀(79) | 評論 (0)編輯 收藏

    load與get的區(qū)別

    1.如果數(shù)據(jù)庫沒有匹配的記錄,load()方法可能會拋出無法恢復(fù)的異常(unrecoverable exception);get()方法會返回null;
    2.load可以使用延遲加載;get不可以;


    load與get的工作原理:
    get方法首先查詢session緩存,沒有的話查詢二級緩存,最后查詢數(shù)據(jù)庫;
    若設(shè)置了lazy=true,load方法創(chuàng)建時首先查詢session緩存,沒有就創(chuàng)建代理,實際使用數(shù)據(jù)時才查詢二級緩存和數(shù)據(jù)庫;
    未設(shè)置lazy=true時,與get方法相同;
    注意:
    到底使用誰:如果不確定是否有匹配的行存在,應(yīng)該使用get方法。

    posted @ 2012-03-13 09:02 GavinMiao 閱讀(274) | 評論 (0)編輯 收藏

    Linux系統(tǒng)參數(shù)查詢命令

    查看操作系統(tǒng)版本:
    head -n 1 /etc/issue
    Red Hat Enterprise Linux Server release 6.0 (Santiago)
    查看cpu信息:
    cat /proc/cpuinfo
    model name      : Intel(R) Xeon(R) CPU           E5450  @ 3.00GHz
    查看內(nèi)存使用情況:
    free -m
    查看各分區(qū)使用情況:
    df -h 
    查看指定目錄的大小
    du -sh <目錄名>
    查看內(nèi)存總量:
    grep MemTotal /proc/meminfo
    查看空閑內(nèi)存量:
    grep MemFree /proc/meminfo
    查看實時的內(nèi)存情況:
    top

    posted @ 2012-03-12 15:06 GavinMiao 閱讀(616) | 評論 (0)編輯 收藏

    呼叫中心企業(yè)

    參考:http://www.ctiforum.com/expo/2012/ccec2012spring/010.htm 

    華為技術(shù)有限公司
    阿爾卡特朗訊
    Genesys,阿爾卡特朗訊旗下公司
    Dialogic公司
    中國聯(lián)通
    中國電信集團號百信息服務(wù)有限公司
    北京英立訊科技有限公司
    杭州遠傳通信技術(shù)有限公司
    奧迪堅通訊系統(tǒng)(上海)有限公司
    繽特力貿(mào)易(蘇州)有限公司
    新太科技股份有限公司
    深圳市東進通訊技術(shù)股份有限公司
    Teleopti
    廣州市毅航通信技術(shù)有限公司
    潮流網(wǎng)絡(luò)技術(shù)有限公司
    杭州三匯信息工程有限公司
    億迅(中國)軟件有限公司
    大唐高鴻數(shù)據(jù)網(wǎng)絡(luò)技術(shù)股份有限公司
    深圳市友鄰?fù)ㄓ嵲O(shè)備有限公司
    北京易才博普奧管理顧問有限公司
    北京天潤融通科技有限公司
    廣州市杰音通訊科技有限公司
    北京直真信通科技有限公司
    廣州市北恩電聲技術(shù)有限公司
    北京七星藍圖科技有限公司
    北京科特爾泰訊科技有限公司
    北京云端時代科技有限公司
    北京宏盛高新技術(shù)有限公司
    北京紐曼騰飛科技有限公司

    posted @ 2012-03-09 15:26 GavinMiao 閱讀(279) | 評論 (0)編輯 收藏

    javascript面向?qū)ο?/a>

        只有注冊用戶登錄后才能閱讀該文。閱讀全文

    posted @ 2012-03-09 11:14 GavinMiao 閱讀(88) | 評論 (0)編輯 收藏

    不同廠商JDK下載網(wǎng)址



    各廠商JDK官網(wǎng)下載地址: 
    1、Oracle JDK,介質(zhì)分32位和64位,分Linux、Solaris、Windows平臺 
    http://www.oracle.com/technetwork/java/javase/downloads/jdk-6u26-download-400750.html 
    2、HP JDK,介質(zhì)不分32位和64位,分PA和IA平臺 
    https://h20392.www2.hp.com/portal/swdepot/displayProductInfo.do?productNumber=HPUXJDKJRE60 
    3、IBM JDK,介質(zhì)分32位和64位 
    https://www.ibm.com/developerworks/java/jdk/aix/service.html#i1 


    參考文章:
    http://shuwen.iteye.com/blog/1149992

    posted @ 2012-03-08 15:30 GavinMiao 閱讀(875) | 評論 (0)編輯 收藏

    轉(zhuǎn)載:Response.ContentType 詳細列表

    文章來源:http://www.cnblogs.com/chenghm2003/archive/2008/10/19/1314703.html

    不同的ContentType 會影響客戶端所看到的效果.默認的ContentType為 text/html 也就是網(wǎng)頁格式.
    代碼如:
    <% response.ContentType ="text/html" %> 
    <!--#i nclude virtual="/ContentType.html" -->

    顯示的為網(wǎng)頁,而
    <% response.ContentType ="text/plain" %> 
    <!--#i nclude virtual="/sscript/ContentType.html" -->

    則會顯示html原代碼.

    以下為一些常用的 ContentType
    GIF images 
    <% response.ContentType ="image/gif" %> 
    <!--#i nclude virtual="/myimage.gif" -->

    JPEG images 
    <% response.ContentType ="image/jpeg" %> 
    <!--#i nclude virtual="/myimage.jpeg" -->

    TIFF images 
    <% response.ContentType ="image/tiff" %> 
    <!--#i nclude virtual="/myimage.tiff" -->

    MICROSOFT WORD document 
    <% response.ContentType ="application/msword" %> 
    <!--#i nclude virtual="/myfile.doc" -->

    RTF document 
    <% response.ContentType ="application/rtf" %> 
    <!--#i nclude virtual="/myfile.rtf" -->

    MICROSOFT EXCEL document 
    <% response.ContentType ="application/x-excel" %> 
    <!--#i nclude virtual="/myfile.xls" -->

    MICROSOFT POWERPOINT document 
    <% response.ContentType ="application/ms-powerpoint" %> 
    <!--#i nclude virtual="/myfile.pff" -->

    PDF document 
    <% response.ContentType ="application/pdf" %> 
    <!--#i nclude virtual="/myfile.pdf" -->

    ZIP document 
    <% response.ContentType ="application/zip" %> 
    <!--#i nclude virtual="/myfile.zip" -->



    下面是更詳細的ContentType
    'ez' => 'application/andrew-inset', 
    'hqx' => 'application/mac-binhex40', 
    'cpt' => 'application/mac-compactpro', 
    'doc' => 'application/msword', 
    'bin' => 'application/octet-stream', 
    'dms' => 'application/octet-stream', 
    'lha' => 'application/octet-stream', 
    'lzh' => 'application/octet-stream', 
    'exe' => 'application/octet-stream', 
    'class' => 'application/octet-stream', 
    'so' => 'application/octet-stream', 
    'dll' => 'application/octet-stream', 
    'oda' => 'application/oda', 
    'pdf' => 'application/pdf', 
    'ai' => 'application/postscript', 
    'eps' => 'application/postscript', 
    'ps' => 'application/postscript', 
    'smi' => 'application/smil', 
    'smil' => 'application/smil', 
    'mif' => 'application/vnd.mif', 
    'xls' => 'application/vnd.ms-excel', 
    'ppt' => 'application/vnd.ms-powerpoint', 
    'wbxml' => 'application/vnd.wap.wbxml', 
    'wmlc' => 'application/vnd.wap.wmlc', 
    'wmlsc' => 'application/vnd.wap.wmlscriptc', 
    'bcpio' => 'application/x-bcpio', 
    'vcd' => 'application/x-cdlink', 
    'pgn' => 'application/x-chess-pgn', 
    'cpio' => 'application/x-cpio', 
    'csh' => 'application/x-csh', 
    'dcr' => 'application/x-director', 
    'dir' => 'application/x-director', 
    'dxr' => 'application/x-director', 
    'dvi' => 'application/x-dvi', 
    'spl' => 'application/x-futuresplash', 
    'gtar' => 'application/x-gtar', 
    'hdf' => 'application/x-hdf', 
    'js' => 'application/x-javascript', 
    'skp' => 'application/x-koan', 
    'skd' => 'application/x-koan', 
    'skt' => 'application/x-koan', 
    'skm' => 'application/x-koan', 
    'latex' => 'application/x-latex', 
    'nc' => 'application/x-netcdf', 
    'cdf' => 'application/x-netcdf', 
    'sh' => 'application/x-sh', 
    'shar' => 'application/x-shar', 
    'swf' => 'application/x-shockwave-flash', 
    'sit' => 'application/x-stuffit', 
    'sv4cpio' => 'application/x-sv4cpio', 
    'sv4crc' => 'application/x-sv4crc', 
    'tar' => 'application/x-tar', 
    'tcl' => 'application/x-tcl', 
    'tex' => 'application/x-tex', 
    'texinfo' => 'application/x-texinfo', 
    'texi' => 'application/x-texinfo', 
    't' => 'application/x-troff', 
    'tr' => 'application/x-troff', 
    'roff' => 'application/x-troff', 
    'man' => 'application/x-troff-man', 
    'me' => 'application/x-troff-me', 
    'ms' => 'application/x-troff-ms', 
    'ustar' => 'application/x-ustar', 
    'src' => 'application/x-wais-source', 
    'xhtml' => 'application/xhtml+xml', 
    'xht' => 'application/xhtml+xml', 
    'zip' => 'application/zip', 
    'au' => 'audio/basic', 
    'snd' => 'audio/basic', 
    'mid' => 'audio/midi', 
    'midi' => 'audio/midi', 
    'kar' => 'audio/midi', 
    'mpga' => 'audio/mpeg', 
    'mp2' => 'audio/mpeg', 
    'mp3' => 'audio/mpeg', 
    'aif' => 'audio/x-aiff', 
    'aiff' => 'audio/x-aiff', 
    'aifc' => 'audio/x-aiff', 
    'm3u' => 'audio/x-mpegurl', 
    'ram' => 'audio/x-pn-realaudio', 
    'rm' => 'audio/x-pn-realaudio', 
    'rpm' => 'audio/x-pn-realaudio-plugin', 
    'ra' => 'audio/x-realaudio', 
    'wav' => 'audio/x-wav', 
    'pdb' => 'chemical/x-pdb', 
    'xyz' => 'chemical/x-xyz', 
    'bmp' => 'image/bmp', 
    'gif' => 'image/gif', 
    'ief' => 'image/ief', 
    'jpeg' => 'image/jpeg', 
    'jpg' => 'image/jpeg', 
    'jpe' => 'image/jpeg', 
    'png' => 'image/png', 
    'tiff' => 'image/tiff', 
    'tif' => 'image/tiff', 
    'djvu' => 'image/vnd.djvu', 
    'djv' => 'image/vnd.djvu', 
    'wbmp' => 'image/vnd.wap.wbmp', 
    'ras' => 'image/x-cmu-raster', 
    'pnm' => 'image/x-portable-anymap', 
    'pbm' => 'image/x-portable-bitmap', 
    'pgm' => 'image/x-portable-graymap', 
    'ppm' => 'image/x-portable-pixmap', 
    'rgb' => 'image/x-rgb', 
    'xbm' => 'image/x-xbitmap', 
    'xpm' => 'image/x-xpixmap', 
    'xwd' => 'image/x-xwindowdump', 
    'igs' => 'model/iges', 
    'iges' => 'model/iges', 
    'msh' => 'model/mesh', 
    'mesh' => 'model/mesh', 
    'silo' => 'model/mesh', 
    'wrl' => 'model/vrml', 
    'vrml' => 'model/vrml', 
    'css' => 'text/css', 
    'html' => 'text/html', 
    'htm' => 'text/html', 
    'asc' => 'text/plain', 
    'txt' => 'text/plain', 
    'rtx' => 'text/richtext', 
    'rtf' => 'text/rtf', 
    'sgml' => 'text/sgml', 
    'sgm' => 'text/sgml', 
    'tsv' => 'text/tab-separated-values', 
    'wml' => 'text/vnd.wap.wml', 
    'wmls' => 'text/vnd.wap.wmlscript', 
    'etx' => 'text/x-setext', 
    'xsl' => 'text/xml', 
    'xml' => 'text/xml', 
    'mpeg' => 'video/mpeg', 
    'mpg' => 'video/mpeg', 
    'mpe' => 'video/mpeg', 
    'qt' => 'video/quicktime', 
    'mov' => 'video/quicktime', 
    'mxu' => 'video/vnd.mpegurl', 
    'avi' => 'video/x-msvideo', 
    'movie' => 'video/x-sgi-movie', 
    'ice' => 'x-conference/x-cooltalk' 


    posted @ 2012-03-07 13:13 GavinMiao 閱讀(248) | 評論 (0)編輯 收藏

    throws與throw的區(qū)別

    1.throw是語句拋出一個異常,throws是方法拋出異常;
    2.throws可聲明多個異常,用逗號分割;
    3.throws可單獨使用,throw必須與try-catch-finally或throws搭配使用;
    4.throws表示可能拋出哪些異常,throw是必定拋出這個異常;

    posted @ 2012-03-06 09:48 GavinMiao 閱讀(347) | 評論 (0)編輯 收藏

    flex入門知識


    一、
    1、下載flex SDK:
    http://opensource.adobe.com/wiki/display/flexsdk/Flex+SDK 
    2、將flexSDK_home/bin加入path環(huán)境變量
    3、創(chuàng)建mxml文件
    4、編譯mxml文件:
    dos 命令:mxmlc --strict=true --file-specs exer.mxml
    5、運行SWF文件:
    用Adope flash player運行;

    注意:
    要查看編譯時生成as文件,可使用命令:
    mxmlc --keep-generated-actionscript --strict=true --file-specs exer.mxml
    二、

    posted @ 2012-03-02 15:14 GavinMiao 閱讀(324) | 評論 (0)編輯 收藏

    java.lang.NoSuchFieldError: deferredExpression

    java.lang.NoSuchFieldError: deferredExpression at org.apache.taglibs.standard.tag.common.core.ForEachSupport.release(ForEachSupport.java:178) at org.apache.jasper.runtime.TagHandlerPool.release(TagHandlerPool.java:166) at org.apache.jsp.index_jsp._jspDestroy(index_jsp.java:31)
    java ee 5 libraries帶了一個jstl-1.2.jar
    Reference Libraries里面還有jstl-1.1.2.jar
    刪除一個就OK

    posted @ 2012-02-29 17:23 GavinMiao 閱讀(1847) | 評論 (0)編輯 收藏

    java小知識注意項

        只有注冊用戶登錄后才能閱讀該文。閱讀全文

    posted @ 2012-02-22 17:35 GavinMiao 閱讀(39) | 評論 (0)編輯 收藏

    CLASS_PATH認識

    作用:JRE按CLASS_PATH指定的路徑搜索類文件;
    注意:
    1.一般設(shè)置:
    CLASS_PATH=.;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jar;
    2.jdk 1.5以上版本可以不用設(shè)置此環(huán)境變量;

    posted @ 2012-02-22 13:51 GavinMiao 閱讀(304) | 評論 (0)編輯 收藏

    POI學(xué)習(xí)

    POI所有組件:


    posted @ 2012-02-22 10:01 GavinMiao 閱讀(296) | 評論 (0)編輯 收藏

    tomcat對jsp、servlet版本要求

    Apache Tomcat version 5.5 implements the Servlet 2.4 and JavaServer Pages 2.0 specifications  
    Apache Tomcat version 6.0 implements the Servlet 2.5 and JavaServer Pages 2.1 specifications 
    Apache Tomcat version 7.0 implements the Servlet 3.0 and JavaServer Pages 2.2 
    specifications




    如果某jar包的META-INF目錄下存在對應(yīng)的tld文件,那么對于JSP1.2+的web 容器,
    若把此jar包放在WEB-INF/lib目錄下,可以直接引用標簽,
    不用再web.xml里面配置taglib;

    posted @ 2012-02-14 16:31 GavinMiao 閱讀(237) | 評論 (0)編輯 收藏

    (轉(zhuǎn)載)hiernate 參數(shù)

    原文地址:http://www.ideagrace.com/html/doc/2007/01/30/08608.html

    屬性名用途
    hibernate.dialect一個Hibernate Dialect類名允許Hibernate針對特定的關(guān)系數(shù)據(jù)庫生成優(yōu)化的SQL. 取值 full.classname.of.Dialect
    hibernate.show_sql輸出所有SQL語句到控制臺. 有一個另外的選擇是把org.hibernate.SQL這個log category設(shè)為debug。 eg. true | false
    hibernate.format_sql在log和console中打印出更漂亮的SQL。 取值 true | false
    hibernate.default_schema在生成的SQL中, 將給定的schema/tablespace附加于非全限定名的表名上. 取值 SCHEMA_NAME
    hibernate.default_catalog在生成的SQL中, 將給定的catalog附加于非全限定名的表名上. 取值 CATALOG_NAME
    hibernate.session_factory_nameSessionFactory創(chuàng)建后,將自動使用這個名字綁定到JNDI中. 取值 jndi/composite/name
    hibernate.max_fetch_depth為單向關(guān)聯(lián)(一對一, 多對一)的外連接抓取(outer join fetch)樹設(shè)置最大深度. 值為0意味著將關(guān)閉默認的外連接抓取. 取值 建議在03之間取值
    hibernate.default_batch_fetch_size為Hibernate關(guān)聯(lián)的批量抓取設(shè)置默認數(shù)量. 取值 建議的取值為48, 和16
    hibernate.default_entity_mode為由這個SessionFactory打開的所有Session指定默認的實體表現(xiàn)模式. 取值 dynamic-mapdom4jpojo
    hibernate.order_updates強制Hibernate按照被更新數(shù)據(jù)的主鍵,為SQL更新排序。這么做將減少在高并發(fā)系統(tǒng)中事務(wù)的死鎖。 取值 true | false
    hibernate.generate_statistics如果開啟, Hibernate將收集有助于性能調(diào)節(jié)的統(tǒng)計數(shù)據(jù). 取值 true | false
    hibernate.use_identifer_rollback如果開啟, 在對象被刪除時生成的標識屬性將被重設(shè)為默認值. 取值 true | false
    hibernate.use_sql_comments如果開啟, Hibernate將在SQL中生成有助于調(diào)試的注釋信息, 默認值為false取值 true | false

    表 3.4.  Hibernate JDBC和連接(connection)屬性

    屬性名用途
    hibernate.jdbc.fetch_size非零值,指定JDBC抓取數(shù)量的大小 (調(diào)用Statement.setFetchSize()).
    hibernate.jdbc.batch_size非零值,允許Hibernate使用JDBC2的批量更新. 取值 建議取530之間的值
    hibernate.jdbc.batch_versioned_data如果你想讓你的JDBC驅(qū)動從executeBatch()返回正確的行計數(shù) , 那么將此屬性設(shè)為true(開啟這個選項通常是安全的). 同時,Hibernate將為自動版本化的數(shù)據(jù)使用批量DML. 默認值為falseeg. true | false
    hibernate.jdbc.factory_class選擇一個自定義的Batcher. 多數(shù)應(yīng)用程序不需要這個配置屬性. eg. classname.of.Batcher
    hibernate.jdbc.use_scrollable_resultset允許Hibernate使用JDBC2的可滾動結(jié)果集. 只有在使用用戶提供的JDBC連接時,這個選項才是必要的, 否則Hibernate會使用連接的元數(shù)據(jù). 取值 true | false
    hibernate.jdbc.use_streams_for_binary在JDBC讀寫binary (二進制)serializable (可序列化) 的類型時使用流(stream)(系統(tǒng)級屬性). 取值 true | false
    hibernate.jdbc.use_get_generated_keys在數(shù)據(jù)插入數(shù)據(jù)庫之后,允許使用JDBC3 PreparedStatement.getGeneratedKeys() 來獲取數(shù)據(jù)庫生成的key(鍵)。需要JDBC3+驅(qū)動和JRE1.4+, 如果你的數(shù)據(jù)庫驅(qū)動在使用Hibernate的標 識生成器時遇到問題,請將此值設(shè)為false. 默認情況下將使用連接的元數(shù)據(jù)來判定驅(qū)動的能力. 取值 true|false
    hibernate.connection.provider_class自定義ConnectionProvider的類名, 此類用來向Hibernate提供JDBC連接. 取值 classname.of.ConnectionProvider
    hibernate.connection.isolation設(shè)置JDBC事務(wù)隔離級別. 查看java.sql.Connection來了解各個值的具體意義, 但請注意多數(shù)數(shù)據(jù)庫都不支持所有的隔離級別. 取值 1, 2, 4, 8
    hibernate.connection.autocommit允許被緩存的JDBC連接開啟自動提交(autocommit) (不建議). 取值 true | false
    hibernate.connection.release_mode指定Hibernate在何時釋放JDBC連接. 默認情況下,直到Session被顯式關(guān)閉或被斷開連接時,才會釋放JDBC連接. 對于應(yīng)用程序服務(wù)器的JTA數(shù)據(jù)源, 你應(yīng)當(dāng)使用after_statement, 這樣在每次JDBC調(diào)用后,都會主動的釋放連接. 對于非JTA的連接, 使用after_transaction在每個事務(wù)結(jié)束時釋放連接是合理的. auto將為JTA和CMT事務(wù)策略選擇after_statement, 為JDBC事務(wù)策略選擇after_transaction取值 on_close | after_transaction | after_statement | auto
    hibernate.connection.<propertyName>將JDBC屬性propertyName傳遞到DriverManager.getConnection()中去.
    hibernate.jndi.<propertyName>將屬性propertyName傳遞到JNDI InitialContextFactory中去.

    表 3.5.  Hibernate緩存屬性

    屬性名用途
    hibernate.cache.provider_class自定義的CacheProvider的類名. 取值 classname.of.CacheProvider
    hibernate.cache.use_minimal_puts以頻繁的讀操作為代價, 優(yōu)化二級緩存來最小化寫操作. 在Hibernate3中,這個設(shè)置對的集群緩存非常有用, 對集群緩存的實現(xiàn)而言,默認是開啟的. 取值 true|false
    hibernate.cache.use_query_cache允許查詢緩存, 個別查詢?nèi)匀恍枰辉O(shè)置為可緩存的. 取值 true|false
    hibernate.cache.use_second_level_cache能用來完全禁止使用二級緩存. 對那些在類的映射定義中指定<cache>的類,會默認開啟二級緩存. 取值 true|false
    hibernate.cache.query_cache_factory自定義實現(xiàn)QueryCache接口的類名, 默認為內(nèi)建的StandardQueryCache取值 classname.of.QueryCache
    hibernate.cache.region_prefix二級緩存區(qū)域名的前綴. 取值 prefix
    hibernate.cache.use_structured_entries強制Hibernate以更人性化的格式將數(shù)據(jù)存入二級緩存. 取值 true|false

    表 3.6.  Hibernate事務(wù)屬性

    屬性名用途
    hibernate.transaction.factory_class一個TransactionFactory的類名, 用于Hibernate Transaction API (默認為JDBCTransactionFactory). 取值 classname.of.TransactionFactory
    jta.UserTransaction一個JNDI名字,被JTATransactionFactory用來從應(yīng)用服務(wù)器獲取JTA UserTransaction取值 jndi/composite/name
    hibernate.transaction.manager_lookup_class一個TransactionManagerLookup的類名 - 當(dāng)使用JVM級緩存,或在JTA環(huán)境中使用hilo生成器的時候需要該類. 取值 classname.of.TransactionManagerLookup
    hibernate.transaction.flush_before_completion如果開啟, session在事務(wù)完成后將被自動清洗(flush)。 現(xiàn)在更好的方法是使用自動session上下文管理。取值 true | false
    hibernate.transaction.auto_close_session如果開啟, session在事務(wù)完成后將被自動關(guān)閉。 現(xiàn)在更好的方法是使用自動session上下文管理。取值 true | false

    表 3.7.  其他屬性

    屬性名用途
    hibernate.current_session_context_class為"當(dāng)前" Session指定一個(自定義的)策略。eg. jta | thread | custom.Class
    hibernate.query.factory_class選擇HQL解析器的實現(xiàn). 取值 org.hibernate.hql.ast.ASTQueryTranslatorFactory or org.hibernate.hql.classic.ClassicQueryTranslatorFactory
    hibernate.query.substitutions將Hibernate查詢中的符號映射到SQL查詢中的符號 (符號可能是函數(shù)名或常量名字). 取值 hqlLiteral=SQL_LITERAL, hqlFunction=SQLFUNC
    hibernate.hbm2ddl.autoSessionFactory創(chuàng)建時,自動檢查數(shù)據(jù)庫結(jié)構(gòu),或者將數(shù)據(jù)庫schema的DDL導(dǎo)出到數(shù)據(jù)庫. 使用 create-drop時,在顯式關(guān)閉SessionFactory時,將drop掉數(shù)據(jù)庫schema. 取值 validate | update | create | create-drop
    hibernate.cglib.use_reflection_optimizer開啟CGLIB來替代運行時反射機制(系統(tǒng)級屬性). 反射機制有時在除錯時比較有用. 注意即使關(guān)閉這個優(yōu)化, Hibernate還是需要CGLIB. 你不能在hibernate.cfg.xml中設(shè)置此屬性. 取值 true | false

    3.4.1.  SQL方言

    你應(yīng)當(dāng)總是為你的數(shù)據(jù)庫將hibernate.dialect屬性設(shè)置成正確的 org.hibernate.dialect.Dialect子類. 如果你指定一種方言, Hibernate將為上面列出的一些屬性使用合理的默認值, 為你省去了手工指定它們的功夫.

    表 3.8.  Hibernate SQL方言 (hibernate.dialect)

    RDBMS方言
    DB2org.hibernate.dialect.DB2Dialect
    DB2 AS/400org.hibernate.dialect.DB2400Dialect
    DB2 OS390org.hibernate.dialect.DB2390Dialect
    PostgreSQLorg.hibernate.dialect.PostgreSQLDialect
    MySQLorg.hibernate.dialect.MySQLDialect
    MySQL with InnoDBorg.hibernate.dialect.MySQLInnoDBDialect
    MySQL with MyISAMorg.hibernate.dialect.MySQLMyISAMDialect
    Oracle (any version)org.hibernate.dialect.OracleDialect
    Oracle 9i/10gorg.hibernate.dialect.Oracle9Dialect
    Sybaseorg.hibernate.dialect.SybaseDialect
    Sybase Anywhereorg.hibernate.dialect.SybaseAnywhereDialect
    Microsoft SQL Serverorg.hibernate.dialect.SQLServerDialect
    SAP DBorg.hibernate.dialect.SAPDBDialect
    Informixorg.hibernate.dialect.InformixDialect
    HypersonicSQLorg.hibernate.dialect.HSQLDialect
    Ingresorg.hibernate.dialect.IngresDialect
    Progressorg.hibernate.dialect.ProgressDialect
    Mckoi SQLorg.hibernate.dialect.MckoiDialect
    Interbaseorg.hibernate.dialect.InterbaseDialect
    Pointbaseorg.hibernate.dialect.PointbaseDialect
    FrontBaseorg.hibernate.dialect.FrontbaseDialect
    Firebirdorg.hibernate.dialect.FirebirdDialect

    表 3.9.  Hibernate日志類別

    類別功能
    org.hibernate.SQL在所有SQL DML語句被執(zhí)行時為它們記錄日志
    org.hibernate.type為所有JDBC參數(shù)記錄日志
    org.hibernate.tool.hbm2ddl在所有SQL DDL語句執(zhí)行時為它們記錄日志
    org.hibernate.pretty在session清洗(flush)時,為所有與其關(guān)聯(lián)的實體(最多20個)的狀態(tài)記錄日志
    org.hibernate.cache為所有二級緩存的活動記錄日志
    org.hibernate.transaction為事務(wù)相關(guān)的活動記錄日志
    org.hibernate.jdbc為所有JDBC資源的獲取記錄日志
    org.hibernate.hql.AST在解析查詢的時候,記錄HQL和SQL的AST分析日志
    org.hibernate.secure為JAAS認證請求做日志
    org.hibernate為任何Hibernate相關(guān)信息做日志 (信息量較大, 但對查錯非常有幫助)

    表 3.10. JTA TransactionManagers

    Transaction工廠類應(yīng)用程序服務(wù)器
    org.hibernate.transaction.JBossTransactionManagerLookupJBoss
    org.hibernate.transaction.WeblogicTransactionManagerLookupWeblogic
    org.hibernate.transaction.WebSphereTransactionManagerLookupWebSphere
    org.hibernate.transaction.WebSphereExtendedJTATransactionLookupWebSphere 6
    org.hibernate.transaction.OrionTransactionManagerLookupOrion
    org.hibernate.transaction.ResinTransactionManagerLookupResin
    org.hibernate.transaction.JOTMTransactionManagerLookupJOTM
    org.hibernate.transaction.JOnASTransactionManagerLookupJOnAS
    org.hibernate.transaction.JRun4TransactionManagerLookupJRun4
    org.hibernate.transaction.BESTransactionManagerLookupBorland ES

    posted @ 2012-02-14 15:07 GavinMiao 閱讀(352) | 評論 (0)編輯 收藏

    (轉(zhuǎn)載)System.getProperty()

         摘要: 文章來源:http://m.tkk7.com/javafield/archive/2008/01/05/172952.htmlSystem.getProperty() 1public class Information {    2    public st...  閱讀全文

    posted @ 2012-02-13 16:52 GavinMiao 閱讀(384) | 評論 (0)編輯 收藏

    ibatis擴展example類對數(shù)據(jù)庫分頁的實現(xiàn)(轉(zhuǎn)載)

         摘要: 文章來源:http://blog.csdn.net/lu_yongchao/article/details/6209166mysql:sql代碼:select  *  from   user   where ... order   by ....  閱讀全文

    posted @ 2012-02-03 10:05 GavinMiao 閱讀(3198) | 評論 (0)編輯 收藏

    異常積累:org.hibernate.hql.ast.QuerySyntaxError: User is not mapped. [from User where username=?]

    org.hibernate.hql.ast.QuerySyntaxError: User is not mapped. [from User where username=?]
    at org.hibernate.hql.ast.ErrorCounter.throwQueryException(ErrorCounter.java:63)
    at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:196)
    at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:130)
    at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:83)
    at org.hibernate.impl.SessionFactoryImpl.getQuery(SessionFactoryImpl.java:427)
    at org.hibernate.impl.SessionImpl.getQueries(SessionImpl.java:884)
    at org.hibernate.impl.SessionImpl.list(SessionImpl.java:834)
    at org.hibernate.impl.QueryImpl.list(QueryImpl.java:74)
    at org.hibernate.impl.AbstractQueryImpl.uniqueResult(AbstractQueryImpl.java:603)
    at com.demo.hibernate.dao.UserDAOImpl.select(UserDAOImpl.java:19)
    at com.demo.hibernate.service.UserServiceImpl.login(UserServiceImpl.java:21)
    at com.demo.hibernate.test.UserServiceTest.testLogin(UserServiceTest.java:25)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at junit.framework.TestCase.runTest(TestCase.java:154)
    at junit.framework.TestCase.runBare(TestCase.java:127)
    at junit.framework.TestResult$1.protect(TestResult.java:106)
    at junit.framework.TestResult.runProtected(TestResult.java:124)
    at junit.framework.TestResult.run(TestResult.java:109)
    at junit.framework.TestCase.run(TestCase.java:118)
    at junit.framework.TestSuite.runTest(TestSuite.java:208)
    at junit.framework.TestSuite.run(TestSuite.java:203)
    at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
    Caused by:  User is not mapped.
    at org.hibernate.hql.ast.SessionFactoryHelper.requireClassPersister(SessionFactoryHelper.java:85)
    at org.hibernate.hql.ast.FromElementFactory.addFromElement(FromElementFactory.java:77)
    at org.hibernate.hql.ast.FromClause.addFromElement(FromClause.java:67)
    at org.hibernate.hql.ast.HqlSqlWalker.createFromElement(HqlSqlWalker.java:217)
    at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElement(HqlSqlBaseWalker.java:2830)
    at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElementList(HqlSqlBaseWalker.java:2719)
    at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromClause(HqlSqlBaseWalker.java:513)
    at org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:371)
    at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:201)
    at org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:151)
    at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:189)
    ... 28 more
    原因:

    hibernate.cfg.xml映射.<mapping resource=""/>的配置

    類似原因還可能有:
     
    hql是寫的是table名,不是POJO對象

    posted @ 2012-01-19 11:02 GavinMiao 閱讀(6144) | 評論 (0)編輯 收藏

    java相關(guān)下載網(wǎng)址

    hibernate:
    http://sourceforge.net/projects/hibernate/files/
    struts
    1:
    http://archive.apache.org/dist/struts/  
    struts2:

    posted @ 2012-01-18 11:35 GavinMiao 閱讀(324) | 評論 (0)編輯 收藏

    異常積累: HttpURLConnection POST 出現(xiàn) java.io.FileNotFoundException錯誤

    原因:url未加“\”轉(zhuǎn)義。url格式不正確導(dǎo)致。

    posted @ 2012-01-13 13:44 GavinMiao 閱讀(753) | 評論 (0)編輯 收藏

    Flex入門學(xué)習(xí)


    第一步:看http://www.deepcast.net/wiki/flex  
    第二步:看http://www.why100000.com/_articles/show_a_article.asp?tab=tabOtherLanguage&autoid=5(Mcromedia Flex標記語言)
    Flex學(xué)習(xí)網(wǎng)站:
    1.
    Adobe Flex 2 Component Explorer: 官方的,展示了各種組件的用法,入門必看。   http://examples.adobe.com/flex2/inproduct/sdk/explorer/explorer.html 
    2.
    很好的一個Flex資源站點 http://www.cflex.net/ 主要看右邊一欄
    3.http://flexbox.mrinalwadhwa.com/ 
    一個收集了網(wǎng)上很多開源組件的站點,是進階學(xué)習(xí)的好幫手
    4.http://code.google.com/p/flexlib/ 
    也是一個開源Flex組件站點,不過與FlexBox不同的是,這個是原創(chuàng),而FlexBox只是收集。
    5.http://www.adobe.com/devnet/flex.html 
    Adobe Flex開發(fā)者中心,經(jīng)常會有一些好的教程出現(xiàn)。
    6.http://labs.adobe.com/
    7.
    Flex.org:http://www.flex.org/  官方的,基本上應(yīng)有盡有。
    8.
    http://examples.adobe.com/flex2/consulting/styleexplorer/Flex2StyleExplorer.html 
    用來設(shè)計程序樣式風(fēng)格的工具,很好用,現(xiàn)在源代碼已經(jīng)可以下載。
    9.http://www.merhl.com/flex2_samples/filterExplorer/ 
    用來調(diào)節(jié)各種濾鏡(filter),非官方的,源代碼提供下載。
    10.http://wenku.baidu.com/view/739d962e453610661ed9f4c5.html


    參考文章:http://blog.csdn.net/microrain/article/details/1601303





    posted @ 2011-12-29 10:34 GavinMiao 閱讀(291) | 評論 (0)編輯 收藏

    轉(zhuǎn)載:在JavaScript中調(diào)用Flex方法

    文章來源:http://www.cnblogs.com/liuzhong/archive/2011/06/27/2091294.html
    一、在JavaScript中調(diào)用Flex方法
    在Flex中可以用ExternalInterface來調(diào)用Flex的方法,途徑是
    1.通過在Flex應(yīng)用可調(diào)用方法列表中添加指定的公用方法。 在Flex應(yīng)用中通過調(diào)用addCallback()可以把一個方法添加到此列表中。addCallback將一個ActionScript的方法注冊為一個JavaScript和VBScript可以調(diào)用的方法。
    addCallback()函數(shù)的定義如下:
    addCallback(function_name:String, closure:Function):void
    function_name參數(shù)就是在Html頁面中腳本調(diào)用的方法名。closure參數(shù)是要調(diào)用的本地方法,這個參數(shù)可以是一個方法也可以是對象實例。

    舉個例子:
    <mx:Script>
        import flash.external.*;
        public function myFunc():Number {
            return 42;
        }
        public function initApp():void {
            ExternalInterface.addCallback("myFlexFunction",myFunc);
        }
    </mx:Script>

    2.那么在Html頁面中,先獲得SWF對象的引用,也就是用<object .../>聲明的Swf的Id屬性 ,比如說是MyFlexApp。然后就可以用以下方式調(diào)用Flex中的方法。
    <SCRIPT language='JavaScript' charset='utf-8'>
        function callApp() {
            var x = MyFlexApp.myFlexFunction(); 
            alert(x);
        }
    </SCRIPT>
    <button onclick="callApp()">Call App</button>



    二、在Flex中調(diào)用 JavaScript
    你可以調(diào)用Html頁面中的JavaScript,通過與JavaScript的交互,可以改變Style,調(diào)用遠程方法。還可以將數(shù)據(jù)傳遞給Html頁面,處理后再返回給Flex,完成這樣的功能主要有兩種方法:ExternalInterface()和navigateToUrl()。
    在Flex中調(diào)用JavaScript最簡單的方法是使用ExternalInterface(),可以使用此API調(diào)用任意JavaScript,傳遞參數(shù),獲得返回值,如果調(diào)用失敗,F(xiàn)lex拋出一個異常。
    ExternalInterface封裝了對瀏覽器支持的檢查,可以用available屬性來查看。
    ExternalInterface的使用非常簡單,語法如下:
    flash.external.ExternalInterface.call(function_name: String[, arg1, ...]):Object;
    參數(shù)function_name是要調(diào)用的JavaScript的函數(shù)名,后面的參數(shù)是JavaScript需要的參數(shù)。
    舉個例子說明如何調(diào)用JavaScript函數(shù)
    Flex應(yīng)用中,添加如下方法:
    <mx:Script>
    <?xml version="1.0" encoding="iso-8859-1"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
        <mx:Script>
            import flash.external.*;
        
            public function callWrapper():void {
                var f:String = "changeDocumentTitle";
                var m:String = ExternalInterface.call(f,"New Title");
                trace(m); 
            }
        </mx:Script>
        <mx:Button label="Change Document Title" click="callWrapper()"/>
    </mx:Application>
    Html頁面中有如下函數(shù)定義:
    <SCRIPT LANGUAGE="JavaScript">
        function changeDocumentTitle(a) {
            window.document.title=a;
            return "successful";
        }
    </SCRIPT>

    posted @ 2011-12-29 00:51 GavinMiao 閱讀(377) | 評論 (0)編輯 收藏

    轉(zhuǎn)載:http響應(yīng)碼介紹

    文章來源:


    HTTP 1.1狀態(tài)代碼及其含義

    100 Continue 初始的請求已經(jīng)接受,客戶應(yīng)當(dāng)繼續(xù)發(fā)送請求的其余部分。(HTTP 1.1新)

    101 Switching Protocols 服務(wù)器將遵從客戶的請求轉(zhuǎn)換到另外一種協(xié)議(HTTP 1.1新)

    200 OK 一切正常,對GET和POST請求的應(yīng)答文檔跟在后面。

    201 Created 服務(wù)器已經(jīng)創(chuàng)建了文檔,Location頭給出了它的URL。

    202 Accepted 已經(jīng)接受請求,但處理尚未完成。

    203 Non-Authoritative Information 文檔已經(jīng)正常地返回,但一些應(yīng)答頭可能不正確,因為使用的是文檔的拷貝(HTTP 1.1新)。

    204 No Content 沒有新文檔,瀏覽器應(yīng)該繼續(xù)顯示原來的文檔。如果用戶定期地刷新頁面,而Servlet可以確定用戶文檔足夠新,這個狀態(tài)代碼是很有用的。

    205 Reset Content 沒有新的內(nèi)容,但瀏覽器應(yīng)該重置它所顯示的內(nèi)容。用來強制瀏覽器清除表單輸入內(nèi)容(HTTP 1.1新)。

    206 Partial Content 客戶發(fā)送了一個帶有Range頭的GET請求,服務(wù)器完成了它(HTTP 1.1新)。

    300 Multiple Choices 客戶請求的文檔可以在多個位置找到,這些位置已經(jīng)在返回的文檔內(nèi)列出。如果服務(wù)器要提出優(yōu)先選擇,則應(yīng)該在Location應(yīng)答頭指明。

    301 Moved Permanently 客戶請求的文檔在其他地方,新的URL在Location頭中給出,瀏覽器應(yīng)該自動地訪問新的URL。

    302 Found 類似于301,但新的URL應(yīng)該被視為臨時性的替代,而不是永久性的。注意,在HTTP1.0中對應(yīng)的狀態(tài)信息是“Moved Temporatily”。
    出現(xiàn)該狀態(tài)代碼時,瀏覽器能夠自動訪問新的URL,因此它是一個很有用的狀態(tài)代碼。

    注意這個狀態(tài)代碼有時候可以和301替換使用。例如,如果瀏覽器錯誤地請求http://host/~user(缺少了后面的斜杠),有的服務(wù)器返回301,有的則返回302。

    嚴格地說,我們只能假定只有當(dāng)原來的請求是GET時瀏覽器才會自動重定向。請參見307。

    303 See Other 類似于301/302,不同之處在于,如果原來的請求是POST,Location頭指定的重定向目標文檔應(yīng)該通過GET提取(HTTP 1.1新)。

    304 Not Modified 客戶端有緩沖的文檔并發(fā)出了一個條件性的請求(一般是提供If-Modified-Since頭表示客戶只想比指定日期更新的文檔)。服務(wù)器告訴客戶,原來緩沖的文檔還可以繼續(xù)使用。

    305 Use Proxy 客戶請求的文檔應(yīng)該通過Location頭所指明的代理服務(wù)器提取(HTTP 1.1新)。

    307 Temporary Redirect 和302(Found)相同。許多瀏覽器會錯誤地響應(yīng)302應(yīng)答進行重定向,即使原來的請求是POST,即使它實際上只能在POST請求的應(yīng)答是303時才能重定向。由于這個原因,HTTP 1.1新增了307,以便更加清除地區(qū)分幾個狀態(tài)代碼:當(dāng)出現(xiàn)303應(yīng)答時,瀏覽器可以跟隨重定向的GET和POST請求;如果是307應(yīng)答,則瀏覽器只能跟隨對GET請求的重定向。(HTTP 1.1新)

    400 Bad Request 請求出現(xiàn)語法錯誤。

    401 Unauthorized 客戶試圖未經(jīng)授權(quán)訪問受密碼保護的頁面。應(yīng)答中會包含一個WWW-Authenticate頭,瀏覽器據(jù)此顯示用戶名字/密碼對話框,然后在填寫合適的Authorization頭后再次發(fā)出請求。

    403 Forbidden 資源不可用。服務(wù)器理解客戶的請求,但拒絕處理它。通常由于服務(wù)器上文件或目錄的權(quán)限設(shè)置導(dǎo)致。

    404 Not Found 無法找到指定位置的資源。這也是一個常用的應(yīng)答。

    405 Method Not Allowed 請求方法(GET、POST、HEAD、Delete、PUT、TRACE等)對指定的資源不適用。(HTTP 1.1新)

    406 Not Acceptable 指定的資源已經(jīng)找到,但它的MIME類型和客戶在Accpet頭中所指定的不兼容(HTTP 1.1新)。

    407 Proxy Authentication Required 類似于401,表示客戶必須先經(jīng)過代理服務(wù)器的授權(quán)。(HTTP 1.1新)

    408 Request Timeout 在服務(wù)器許可的等待時間內(nèi),客戶一直沒有發(fā)出任何請求。客戶可以在以后重復(fù)同一請求。(HTTP 1.1新)

    409 Conflict 通常和PUT請求有關(guān)。由于請求和資源的當(dāng)前狀態(tài)相沖突,因此請求不能成功。(HTTP 1.1新)

    410 Gone 所請求的文檔已經(jīng)不再可用,而且服務(wù)器不知道應(yīng)該重定向到哪一個地址。它和404的不同在于,返回407表示文檔永久地離開了指定的位置,而404表示由于未知的原因文檔不可用。(HTTP 1.1新)

    411 Length Required 服務(wù)器不能處理請求,除非客戶發(fā)送一個Content-Length頭。(HTTP 1.1新)

    412 Precondition Failed 請求頭中指定的一些前提條件失敗(HTTP 1.1新)。

    413 Request Entity Too Large 目標文檔的大小超過服務(wù)器當(dāng)前愿意處理的大小。如果服務(wù)器認為自己能夠稍后再處理該請求,則應(yīng)該提供一個Retry-After頭(HTTP 1.1新)。

    414 Request URI Too Long URI太長(HTTP 1.1新)。

    416 Requested Range Not Satisfiable 服務(wù)器不能滿足客戶在請求中指定的Range頭。(HTTP 1.1新)

    500 Internal Server Error 服務(wù)器遇到了意料不到的情況,不能完成客戶的請求。

    501 Not Implemented 服

    posted @ 2011-12-22 14:39 GavinMiao 閱讀(1026) | 評論 (0)編輯 收藏

    jquery插件編寫參考

    (function($){
        $.fn.yourName = function(options){
            //各種屬性、參數(shù)
            }
            var options = $.extend(defaults, options);
            this.each(function(){
            //插件實現(xiàn)代碼
            });
        };
    })(jQuery);

    參考文章:

    posted @ 2011-12-13 15:32 GavinMiao 閱讀(307) | 評論 (0)編輯 收藏

    MyEclipse修改項目名稱

    項目上右擊鼠標-->Properties-->MyEclipse-->Web-->Content Root-->Web content-root-->改成你想要的項目名 即可

    posted @ 2011-12-03 23:37 GavinMiao 閱讀(7633) | 評論 (1)編輯 收藏

    mysql設(shè)置編碼格式

    ALTER DATABASE `databasename` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci
    ALTER TABLE `tableName` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci
    ALTER TABLE `tableName` CHANGE `dd` `dd` VARCHAR( 45 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL 
    create table()ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='哈嘍啦'
    show variables like 'collation_%';
    SHOW VARIABLES LIKE 'character%';
    SET character_set_client = utf8 ; 
    set character_set_server = utf8;
    set character_set_connection = utf8;
    set character_set_database = utf8;
    set character_set_results = utf8;
    set character_set_system = utf8;

    set collation_connection='utf8_general_ci';
    set collation_database=
    'utf8_general_ci';
    set collation_server='utf8_general_ci';

    posted @ 2011-12-01 21:52 GavinMiao 閱讀(938) | 評論 (0)編輯 收藏

    mysql重啟命令

    /etc/rc.d/init.d/mysql restart 

    posted @ 2011-12-01 21:20 GavinMiao 閱讀(277) | 評論 (0)編輯 收藏

    rpm及l(fā)iunx下mysql安裝及卸載

        只有注冊用戶登錄后才能閱讀該文。閱讀全文

    posted @ 2011-12-01 13:24 GavinMiao 閱讀(70) | 評論 (0)編輯 收藏

    liunx解壓、打包

        只有注冊用戶登錄后才能閱讀該文。閱讀全文

    posted @ 2011-12-01 13:09 GavinMiao 閱讀(82) | 評論 (0)編輯 收藏

    ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

    解決辦法:
    cd /etc/init.d
    mysqld --user=root start

    參考文章:
    http://apps.hi.baidu.com/share/detail/854577 
    今天服務(wù)器遇到了一個很熟悉的問題輸入#mysql -u root -pERROR 2002 (HY000):Can't connect to local MySQL server隨即上網(wǎng)找尋答案根據(jù)大家提供的方法我逐一嘗試
    方案1.
    1.#ps -A|grep mysql 顯示類似:1829 ? 00:00:00 mysqld_safe
    1876 ? 00:00:31 mysqld
    2.#kill -9 1829 
    3.#kill -9 1876
    4.#/etc/init.d/mysql restart
    5.#mysql -u root -p 他的麻煩解決了,我的還沒解決!
    繼續(xù)找方案2
    先查看 /etc/rc.d/init.d/mysqld status 看看m y s q l 是否已經(jīng)啟動.
    另外看看是不是權(quán)限問題.
    ------------------------------------------------------------------------------------
    [root@localhost beinan]#chown -R mysql:mysql /var/lib/mysql
    [root@localhost beinan]# /etc/init.d/mysqld start
    啟動 MySQL: [ 確定 ]
    [root@localhost lib]# mysqladmin -uroot password '123456'
    [root@localhost lib]# mysql -uroot -p
    Enter password:
    Welcome to the MySQL monitor. Commands end with ; or \g.
    Your MySQL connection id is 3 to server version: 4.1.11

    Type 'help;' or '\h' for help. Type '\c' to clear the buffe他的也解決了,我的麻煩還在繼續(xù),依然繼續(xù)尋找
    方案3
    問題解決了,竟然是max_connections=1000 他說太多了,然后改成500也說多,無奈刪之問題解決了。還是不行
    方案4 /var/lib/mysql 所有文件權(quán)限 改成mysql.mysql 不行不行方案5
    摘要:解決不能通過mysql.sock連接MySQL問題 這個問題主要提示是,不能通過 '/tmp/mysql.sock'連到服務(wù)器,而php標準配置正是用過'/tmp/mysql.sock',但是一些mysql安裝方法將 mysql.sock放在/var/lib/mysql.sock或者其他的什么地方,你可以通過修改/etc/my.cnf文件來修正它,打開文件,可 以看到如下的東東:
    [mysqld] 
    socket=/var/lib/mysql.sock 
    改一下就好了,但也會引起其他的問題,如mysql程序連不上了,再加一點: 
    [mysql] 
    socket=/tmp/mysql.sock 
    或者還可以通過修改php.ini中的配置來使php用其他的mysql.sock來連,這個大家自己去找找

    或者用這樣的方法:
    ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock

    成功了,就是這樣ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock

    OK!



    以上資料是網(wǎng)上的資料
    我今天遇到的情況是我使用的mysqld_safe --user=mysql &重啟mysql發(fā)現(xiàn)無法啟動mysql,最后用
    /etc/init.d/mysqld start啟動成功

    posted @ 2011-12-01 11:46 GavinMiao 閱讀(13991) | 評論 (1)編輯 收藏

    轉(zhuǎn)載:tomcat各種配置及編碼設(shè)置

        只有注冊用戶登錄后才能閱讀該文。閱讀全文

    posted @ 2011-12-01 10:49 GavinMiao 閱讀(77) | 評論 (0)編輯 收藏

    XP 用命令查看和殺死進程

    1:查看8080端口占用情況:
    C:\Documents and Settings\Administrator>netstat -aon | findstr "8080"
      TCP    0.0.0.0:8080           0.0.0.0:0              LISTENING       3608

    2:查看進程

    C:\Documents and Settings\Administrator>tasklist | findstr "3608"
    javaw.exe                   3608 Console                 0     69,484 K

    3.殺進程:
    tskill 3608

    posted @ 2011-11-28 15:28 GavinMiao 閱讀(573) | 評論 (0)編輯 收藏

    頁面utf-8,jsp提交中文action中亂碼

        只有注冊用戶登錄后才能閱讀該文。閱讀全文

    posted @ 2011-11-25 15:11 GavinMiao 閱讀(89) | 評論 (0)編輯 收藏

    轉(zhuǎn)載:java斷言Assertion

         摘要: 文章來源:http://www.cnblogs.com/woodslee/articles/165669.html 一、 Assertion的語法和語義J2SE 1.4在語言上提供了一個新特性,就是assertion(斷言)功能,它是該版本在Java語言方面最大的革新。在軟件開發(fā)中,assertion是一種經(jīng)典的調(diào)試、測試方式,本文將深入解析assertion功能的使用以及其設(shè)...  閱讀全文

    posted @ 2011-11-25 13:20 GavinMiao 閱讀(777) | 評論 (0)編輯 收藏

    tree和menu控件

    Xtree
    download及demo頁面:http://webfx.eae.net/dhtml/xtree/index.html
    api頁面:
    http://webfx.eae.net/dhtml/xtree/api.html 

    參考文章:
    http://apps.hi.baidu.com/share/detail/45745962
    大量開源menu控件:http://www.open-open.com/ajax/Menu.htm
    easy
    ui Menu及ext tree等;

    posted @ 2011-11-24 15:22 GavinMiao 閱讀(293) | 評論 (0)編輯 收藏

    iframe頁面調(diào)用父頁面的js函數(shù) (轉(zhuǎn)載)


    假若iframe所在的頁面here.html有個JS函數(shù)為:wode(),它位于頁面的<script></script>這個節(jié)

    然后iframe的src,即里面的頁面為:other.html,那么我們在other.html里面就可以如下調(diào)用here.html里面的wode這個函數(shù):window.parent.wode();


    對于父頁面的控件的引用就如法炮制:window.parent.document.getElementById('xxxx')
    來自: http://hi.baidu.com/%D3%DA%EA%BB%CC%ED/blog/item/a8384000e1ddec0f1c9583e6.html

    posted @ 2011-11-24 12:03 GavinMiao 閱讀(824) | 評論 (0)編輯 收藏

    主站蜘蛛池模板: 亚洲精品黄色视频在线观看免费资源| 亚洲中文字幕久久精品无码A| 久久久久亚洲AV成人片| 亚洲色图.com| 亚洲欧美国产国产一区二区三区| 黄页网址大全免费观看12网站| 成av免费大片黄在线观看| 亚洲精品免费观看| 欧美日韩国产免费一区二区三区| 午夜免费福利在线| 在线亚洲人成电影网站色www| 亚洲视频2020| 亚洲AV无码成人精品区日韩| 国内精品99亚洲免费高清| 日本免费xxxx| 免费国产成人午夜私人影视| 国产亚洲精久久久久久无码| 亚洲人6666成人观看| 免费毛片毛片网址| 久久久久国产精品免费网站| 日韩免费高清视频| 亚洲电影一区二区三区| 亚洲依依成人亚洲社区| 久久久WWW免费人成精品| 国产成人免费网站| 国产啪亚洲国产精品无码 | 人人狠狠综合久久亚洲88| 亚洲国产成a人v在线| 人人鲁免费播放视频人人香蕉| 99ee6热久久免费精品6| 亚洲AV中文无码乱人伦在线视色| 亚洲欧洲日产国产综合网| 亚洲JIZZJIZZ妇女| 亚欧免费无码aⅴ在线观看| 日本不卡在线观看免费v| 亚洲国产人成在线观看69网站| 老子影院午夜伦不卡亚洲| 18禁成人网站免费观看| 亚洲无线一二三四区手机| 亚洲va久久久久| 久久一本岛在免费线观看2020|