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

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

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

    自由飛翔

    我在仰望,java之上

    統計

    留言簿(2)

    我關注的blog

    閱讀排行榜

    評論排行榜

    2012年3月9日 #

    編碼至高法則-高內聚低耦合

         摘要: 此法則適合所有語言,咱們以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 小結


    一、列與行的參數都由三個部分組成:對齊方式、固定尺寸、調整方式。
    1.對齊方式:
    1)列對齊有left, center, right, fill.默認fill
    2)行對齊有:top, center, bottom, fill. 其中fill表示填充至整個區域。默認center。
    2.固定尺寸:
    pref表示preferred size,適當大小,即首選尺寸大小。
    min表示minimum size,
    dlu 表示dialog units,
    px, pt, in, mm, cm)分別表示Pixel, Points, Inches, Millimeter, Centimeter。
    3. 調整方式:
    二、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());
      }
      
     }
    }

    結果:
    null
    1
    123

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

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

    火車票訂票好辦法

    一、前提須知:
    1.北京鐵路局:
    直屬站15個:北京站北京西站天津站天津西站豐臺站豐臺西站南倉站塘沽站唐山站石家莊站石家莊南站、邯鄲站、陽泉站、北京南站、天津西站。
    2.鄭州鐵路局:
    直屬車站11個:鄭州站、鄭州北站、鄭州東站、洛陽站、新鄉站、開封站、商丘站、月山站、長治北站、長治站。
    二、
    北京電話訂票竅門:1、座機打!;2.用手機加區號打!北京鐵路局管內,如唐山區號:打0315-95105105,手機打95105105的有效區號:河北省邯鄲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
    這個異常是由于主鍵設置為自增長,而在我們插入記錄的時候設置了ID的值導致的。看下我的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

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

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

    UML初接觸

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


    7.類圖之間的關聯:
    —▷▷  —>持有

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

    面試題(互聯網網上商城行業)

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

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

    不用臨時變量交換兩個數

    方法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)編輯 收藏

    易寶支付面試題(根據網上總結)

    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);
    }
    }

    運行結果:
    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");
        }
    }

    運行結果:
    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");
    }
    }
    }

    運行結果:
    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");
    }
    }
    }

    運行結果:
    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");
    }
    }
    運行結果:
    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();
    }
    }

    運行結果:
    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++;
    }
    }
    }

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

    8.hibernate導入大量數據時,為了避免內存中產生大量對象,在編碼時注意什么,如何去除?

    9.視圖與表的區別
    10.觸發器有哪幾種類型
    11.
    事務操作有那幾個步驟
    12.寫出對應正則表達式:
    1)1-6位字母或數字;
    [a-zA-Z0-9]{1,6}
    2)手機號(只能是139或159開頭,11位數字)
    1[35][9][0-9]{8}
    13.字符串反轉: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種內置對象:
    request:
    HttpServletRequest類的實例,
    客戶端的請求信息被封裝在request對象中
    response:
    HttpServletResponse類的實例,
    response對象包含了響應客戶請求的有關信息,但在JSP中很少直接用到它。
    out:
    out對象是JspWriter類的實例,是向客戶端輸出內容常用的對象
    session:
    session對象指的是客戶端與服務器的一次會話,從客戶端連到服務器的一個WebApplication開始,直到客戶端與服務器斷開連接為止。它是HttpSession類的實例
    page:
    page對象就是指向當前JSP頁面本身,有點象類中的this指針,它是java.lang.Object類的實例
    application:
    ServletContext類的實例,
    application對象實現了用戶間數據的共享,可存放全局變量。它開始于服務器的啟動,直到服務器的關閉
    exception:
    exception對象是一個例外對象,當一個頁面在運行過程中發生了例外,就產生這個對象。如果一個JSP頁面要應用此對象,就必須把isErrorPage設為true,否則無法編譯。他實際上是java.lang.Throwable的對象
    pageContext:
    pageContext對象提供了對JSP頁面內所有的對象及名字空間的訪問,也就是說他可以訪問到本頁所在的SESSION,也可以取本頁面所在的application的某一屬性值,他相當于頁面中所有功能的集大成者,它的本類名也叫pageContext
    config:
    config對象是在一個Servlet初始化時,JSP引擎向它傳遞信息用的,此信息包括Servlet初始化時所要用到的參數(通過屬性名和屬性值構成)以及服務器的有關信息(通過傳遞一個ServletContext對象)
    17.session和cookie的區別?
    18.JDBC的操作步驟?

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

    面試題(移動通信方面)

    1.方法重載與多態,簡述;
    2.什么是設計模式?使用過哪些?
    3.列出熟悉的java開源項目及簡述;
    4.一組radio,用alert彈出當前所選的是第幾個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();//此方法調用瀏覽器會報錯,未定義
    }
    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('$$$$$$');
    }
    }

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

    6.線程的四種狀態?
    7.ext有哪些組件?ext如何與后臺交互?
    8.HashMap放入、查找、刪除,將所有value放入一個數組,得到map中所有內容;List添加、查找、刪除;
    9.List<Student> student(name,age) 比較oldList<Student>和newList<student>,按名字比較,獲得新增的、修改的、刪除學生列表;
    10.使用過哪些xml技術?怎么實現的?
    11.java異常:throws、throw、try、catch、finally,舉例,如何處理異常
    12.字符串反轉:
    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行業)

    //此句,編譯無法通過,Cannot make a static reference to the non-static field b
    1.arrayList、linkedList、vector的區別
    2.
    寫幾種J2EE規范并簡要描述
    3.什么是設計模式?用過哪些設計模式?
    4.OO的四大特性是哪些?并簡要描述
    5.方法重載、多態概念及簡要描述;
    6.sql常用的優化方法有哪些?
    7.sleep()與wait()的區別?
    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);
    }
    }
    }
    運行結果:
    1
    4
    2
    3
    9.HashTable和HashMap的區別
    10.怎樣理解mvc模式?
    11.抽象類、接口的區別?
    12.智力題:
    有1-7號,7塊地,S、U、V、W、X 5個遺產繼承者,
    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)編輯 收藏

    用友面試題(參考網上總結而出)

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

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

    10.事務:

    1)ACID屬性:
    A:atomic 原子性
    C:consistent 一致性
    I:isolation 隔離性
    D:duration 持久性
    2)概念:事務就是一系列操作,它們完成一項任務。只要這些操作里有一項沒成功,事務就操作失敗,發生回滾事件。即撤銷前面的操作,這樣可以保證數據的一致性。而且可以把操作放在緩存里,等所有操作都成功就提交數據庫,這樣保證費時的操作都是有效操作。
    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);每個客戶均有地區(country)屬性,每個地區可有1或多個客戶,查詢擁有超過10名客戶的地區的列表;
    3.public interface TreeNode{
        String getName();
        List getChildren();
    }
     寫一個print()方法,打印各級節點名稱.

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

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

    String面試題

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

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

    面試題(通信行業公司)

    一、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的區別:
    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接口的一個實現(HashMap繼承于AbstractMap,AbstractMap完成了Map接口)。
    HashTable中hash數組默認大小是11,增加的方式是 old*2+1。HashMap中hash數組的默認大小是16,而且一定是2的指數。
    哈希值的使用不同,HashTable直接使用對象的hashCode。
    2.什么是java的序列化?如何實現java的序列化:

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

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

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

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

    public class EagerSingleton 

        private static final EagerSingleton m_instance = new EagerSingleton(); 

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

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

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

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


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


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

    4.靜態塊與構造器在繼承中的執行順序:

    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");
    }
    }
    運行結果:
    in parent static
    in child static
    in parent construtor
    in child construtor
    in parent construtor
    in child construtor
    5.成員內部類:
    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();
    }
    }
    運行結果:
    what a funny
    6.參數傳遞:
    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";
    }
    }
    結果:
    ello
    7.參數傳遞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;
    }
    }
    結果為:
    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';
    }
    }
    結果:
    a=good------>b=gbc
    三、SQL:

     

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

    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)編輯 收藏

    公司口碑及待遇評價的網站

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

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

    ftp-java實現

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




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

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

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

         摘要: 文章來源: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學習筆記

    一、setter DI:
    <bean>
        <property name="">
            <ref bean="bean的name或id"/>
        </property>
        <property name="">
            <!--內部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學習筆記

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

    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應用中使用AspectJ加載時織入context:load-time-weaver
    7.增加,通過context:load-time-weaver和tx:annotation-driven mode="aspectj"聯合使用的注解驅動的事務管理
    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,它提供了注解驅動的單元和集成測試支持

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

    spring2.0新特性

    1.
    引入request scope、session scope和可自定義的scope(hooks)
    2.
    引入了XML 
    Schema的namespace,
    簡化了配置,包括了對bean屬性的各種簡化,AOP配置的簡化,事務配置的簡化,JNDI配置的簡化等方面
    3.spring2.0集成了AspectJ切入點(pointcut)語言和@AspectJ切面(aspect)聲明類型
    4.支持@AspectJ注解定義切面
    5.提供了JPA的抽象層
    6.對于JMS,spring2.0提供異步接受消息
    7.對于jdbc,增加了NamedParameterJdbcTemplate、SimpleJdbcTemplate
    8.對java1.5的支持,結合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中的位運算應用

    1, a & 0xff 可得到a對應而二進制的最后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(轉載)

         摘要: 文章來源:http://hi.baidu.com/liuzhe041/blog/item/e12251dcf2ffe053ccbf1ad2.htmlspring 和struts整合 有3種方式,推薦用第三種。下面一一介紹,不管使用哪種方式,都需要在web.xml 中配置 spring的 監聽器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的基礎代碼(轉載)

     文章來源: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 閱讀(67) | 評論 (0)編輯 收藏

    延遲加載

    也叫延遲檢索或懶加載
    一.實現方式:
    1.*hbm.xml中的class元素的lazy屬性設置為true;
    2.*hbm.xml中的set元素的lazy屬性設置為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()的區別

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

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

    load與get的區別

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


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

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

    Linux系統參數查詢命令

    查看操作系統版本:
    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
    查看內存使用情況:
    free -m
    查看各分區使用情況:
    df -h 
    查看指定目錄的大小
    du -sh <目錄名>
    查看內存總量:
    grep MemTotal /proc/meminfo
    查看空閑內存量:
    grep MemFree /proc/meminfo
    查看實時的內存情況:
    top

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

    呼叫中心企業

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

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

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

    javascript面向對象

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

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

    主站蜘蛛池模板: 日韩视频在线观看免费| 成人av免费电影| 亚洲激情视频图片| 欧洲美熟女乱又伦免费视频| 美美女高清毛片视频黄的一免费| 亚洲成AV人片在线观看WWW| 无码人妻一区二区三区免费手机 | 国产成人精品日本亚洲网址| 日本xxwwxxww在线视频免费| 怡红院免费的全部视频| 亚洲一区二区三区在线| 综合久久久久久中文字幕亚洲国产国产综合一区首 | 免费在线观看黄网| 免费国产黄网站在线观看| 亚洲AV性色在线观看| 亚洲黄网站wwwwww| 亚洲AV中文无码乱人伦| 波多野结衣免费在线| 国产vA免费精品高清在线观看| 亚洲国产精品久久网午夜| 精品国产亚洲一区二区在线观看| 999国内精品永久免费视频| 福利免费在线观看| 亚洲精品自偷自拍无码| 久久亚洲日韩精品一区二区三区| 亚洲国产精品成人网址天堂| 一二三四在线观看免费高清中文在线观看 | 国产99久久久久久免费看| 亚洲欧美日韩国产成人| 亚洲狠狠综合久久| 国产亚洲?V无码?V男人的天堂| 妞干网免费视频观看| 最近中文字幕免费完整| 中国国语毛片免费观看视频| 亚洲大尺度无码无码专线一区| 亚洲福利电影在线观看| 国产aⅴ无码专区亚洲av| 亚洲精品国产电影| 午夜免费福利网站| 999国内精品永久免费观看| 久9久9精品免费观看|