lqxue

          常用鏈接

          統(tǒng)計

          book

          tools

          最新評論

          #

          html file 標簽 的 中文“瀏覽..." 改成英文

            <input   type=file   id=meizz   style="display:   none"   onPropertyChange="document.all.ff.value=this.value"> 
            <input   name=ff   readonly><input   type=button   value='Browse...'   onclick="document.all.meizz.click()">

          posted @ 2008-05-07 15:05 lqx 閱讀(858) | 評論 (0)編輯 收藏

          MySQL最大連接數(shù)設置

          MySQL的最大連接數(shù)默認是100

          客戶端登錄:mysql -uusername -ppassword

          設置新的最大連接數(shù)為200:mysql> set GLOBAL max_connections=200

          顯示當前運行的Query:mysql> show processlist

          顯示當前狀態(tài):mysql> show status

          退出客戶端:mysql> exit

          查看當前最大連接數(shù):mysqladmin -uusername -ppassword variables |find "max_con"

          posted @ 2008-04-21 23:42 lqx 閱讀(1988) | 評論 (0)編輯 收藏

          在Spring中使用JTA事務管理

          http://java.e800.com.cn/articles/2007/417/1176746498587392322_1.html

          http://www.oracle.com/technology/tech/java/spring/how-to-jta-spring.html

          posted @ 2008-04-21 15:09 lqx 閱讀(402) | 評論 (0)編輯 收藏

          What does the transient and volatile keywords do?

          When your not sure consult the 'Bible', 'Java™ Language Specification'
          http://java.sun.com/docs/books/jls/t...ses.html#78119


          8.3.1.3 transient Fields
          Variables may be marked transient to indicate that they are not part of
          the persistent state of an object.

          If an instance of the class Point:

          class Point {
          int x, y;
          transient float rho, theta;
          }

          were saved to persistent storage by a system service, then only the
          fields x and y would be saved. This specification does not specify
          details of such services; see the specification of java.io.Serializable
          for an example of such a service.

          8.3.1.4 volatile Fields
          As described in §17, the Java programming language allows threads to
          access shared variables. As a rule, to ensure that shared variables are
          consistently and reliably updated, a thread should ensure that it has
          exclusive use of such variables by obtaining a lock that,
          conventionally, enforces mutual exclusion for those shared variables.

          The Java programming language provides a second mechanism, volatile
          fields, that is more convenient than locking for some purposes.
          A field may be declared volatile, in which case the Java memory model
          (§17) ensures that all threads see a consistent value for the variable.

          If, in the following example, one thread repeatedly calls the method one
          (but no more than Integer.MAX_VALUE times in all), and another thread
          repeatedly calls the method two:

          class Test {
          static int i = 0, j = 0;
          static void one() { i++; j++; }
          static void two() {
          System.out.println("i=" + i + " j=" + j);
          }
          }

          then method two could occasionally print a value for j that is greater
          than the value of i, because the example includes no synchronization
          and, under the rules explained in §17, the shared values of i and j
          might be updated out of order.

          One way to prevent this out-or-order behavior would be to declare
          methods one and two to be synchronized (§8.4.3.6):

          class Test {
          static int i = 0, j = 0;
          static synchronized void one() { i++; j++; }
          static synchronized void two() {
          System.out.println("i=" + i + " j=" + j);
          }
          }

          This prevents method one and method two from being executed
          concurrently, and furthermore guarantees that the shared values of i and
          j are both updated before method one returns. Therefore method two never
          observes a value for j greater than that for i; indeed, it always
          observes the same value for i and j.

          Another approach would be to declare i and j to be volatile:

          class Test {
          static volatile int i = 0, j = 0;
          static void one() { i++; j++; }
          static void two() {
          System.out.println("i=" + i + " j=" + j);
          }
          }

          This allows method one and method two to be executed concurrently, but
          guarantees that accesses to the shared values for i and j occur exactly
          as many times, and in exactly the same order, as they appear to occur
          during execution of the program text by each thread. Therefore, the
          shared value for j is never greater than that for i, because each update
          to i must be reflected in the shared value for i before the update to j
          occurs. It is possible, however, that any given invocation of method two
          might observe a value for j that is much greater than the value observed
          for i, because method one might be executed many times between the
          moment when method two fetches the value of i and the moment when method
          two fetches the value of j.

          See §17 for more discussion and examples.

          A compile-time error occurs if a final variable is also declared volatile.

          --

          posted @ 2008-03-06 00:35 lqx 閱讀(244) | 評論 (0)編輯 收藏

          propedit,很好用的properties工具

          Eclipse plug in address
          http://propedit.sourceforge.jp/eclipse/

          posted @ 2008-02-26 10:33 lqx 閱讀(864) | 評論 (0)編輯 收藏

          在線編輯器

          http://www.geniisoft.com/showcase.nsf/WebEditors


          posted @ 2008-02-19 15:48 lqx 閱讀(238) | 評論 (0)編輯 收藏

          [收藏]基礎知識

          1.簡述邏輯操作(&,|,^)與條件操作(&&,||)的區(qū)別。(15分)
          區(qū)別主要答兩點:
          a.條件操作只能操作布爾型的,而邏輯操作不僅可以操作布爾型,而且可以操作數(shù)值型
          b.邏輯操作不會產(chǎn)生短路.如:
          int a = 0;
          int b = 0;

          if( (a = 3) > 0 || (b = 3) > 0 ) //操后a =3,b=0.
          if( (a = 3) > 0 | (b = 3) > 0 ) //操后a =3,b=3.
           
          答對第一點得5分,答對第二點得10分.

          本題考察最最基本的知識,但仍然有很多大牛級開發(fā)人員下馬,任何語言在開始的部分
          都會詳細介紹這些基本知識,但除了學習第一種語言時,沒有人在學習新的語言時愿意
          花五分鐘來復習一下.


          2.下面程序運行會發(fā)生什么結(jié)果?如果有錯誤,如何改正? (15分)
          interface  A{
            int x = 0;
          }
          class B{
            int x =1;
          }
          class C
              extends B implements A {
            public void pX(){
              System.out.println(x);
            }
            public static void main(String[] args) {
              new C().pX();
            }
          }
          }

          本題在編譯時會發(fā)生錯誤(錯誤描述不同的JVM有不同的信息,意思就是未明確的x調(diào)用,
          兩個x都匹配,就象在同時import java.util和java.sql兩個包時直接聲明Date一樣)

          本題主要考察對接口和類的最最基本的結(jié)構(gòu)的了解.對于父類的變量,可以用super.x來
          明確,而接口的屬性默認隱含為 public static final.所以可以通過A.x來明確.


          3.簡述 Java Server Page 和 Servlet 的聯(lián)系和區(qū)別。(20分)
          本題不用多說,在答相同點時應該明確知道jsp編譯后是"類servlet"而"不是Servlet",
          答區(qū)別時應該回答出"側(cè)重于(視圖/控制邏輯)".其它可根據(jù)情況加減分值.知識很簡單,
          但從面試的角度看,被試者不僅要能知道它們的區(qū)別,而且要能比較準確地表達出來(以
          后寫文檔要能讓別人看得懂,不產(chǎn)生歧義),回答"jsp編譯后就是servlet"視為錯誤,回答
          "jsp用于視圖,servlet用于控制邏輯"視為錯誤,應該用側(cè)重于,主要(多數(shù))用于等詞語
          表達.


          4.XML文檔定義有幾種形式?它們之間有何本質(zhì)區(qū)別?
          解析XML文檔有哪幾種方式?(20分)
          本題三個答題點:
          a: 兩種形式 dtd,schema
          b: 本質(zhì)區(qū)別:schema本身是xml的,可以被XML解析器解析(這也是從DTD上發(fā)展schema的
          根本目的)
          c: 兩種主要方式:dom,sax.答出兩種得全分,如能答出saxt,或其它(在答出dom,sax的基
          礎上,如果應試者認為其它方式也可以視為對xml的解析應該允許.但沒有答出dom,sax把
          其它方式說成是對XML的解析不得分)應該加分.

          5.簡述synchronized和java.util.concurrent.locks.Lock的異同 ?(15分)

          主要相同點:
          Lock能完成synchronized所實現(xiàn)的所有功能.(其它不重要)
          主要不同點:
          Lock有比synchronized更精確的線程語義和更好的性能(在相同點中回答此點也行)
          synchronized會自動釋放鎖.而Lock一定要求程序員手工釋放.并且必須在finally從句
          中釋放,如果沒有答出在finally中釋放不得分.就如Connection沒有在finally中關(guān)閉一
          樣.連最基本的資源釋放都做不好,還談什么多線程編程.


          6.EJB規(guī)范規(guī)定EJB中禁止的操作有哪些?(15分)
          共有8點,答出下列3-4點得滿分.

          1.不能操作線程和線程API(線程API指非線程對象的方法如notify,wait等)
          2.不能操作awt
          3.不能實現(xiàn)服務器功能
          4.不能對靜態(tài)屬生存取.
          5.不能使用IO操作直接存取文件系統(tǒng)
          6.不能加載本地庫.
          7.不能將this作為變量和返回.
          8.不能循環(huán)調(diào)用.

          7.請問在Java的線程里有個join()函數(shù),這個函數(shù)有什么用呀?
          是把調(diào)用join()的線程連結(jié)(join)到當前線程,什么意思呢?就是當前線程等待調(diào)用join()線程的結(jié)束.比如:當前線程是主線程,它結(jié)的時候要求一個被調(diào)用的線程a結(jié)束,如果我們不調(diào)用a.join();那只能輪詢a的狀態(tài).

          while(true){
            if(!a.isAlive()) break;
            sleep(500);
          }
          System.exet(1);
          如果a線程isAlive,則等500ms繼續(xù)下一次輪巡,如果已經(jīng)不可用則結(jié)束,這種while(true)的輪詢一是占用大量的CPU時間.另一是有可能在sleep(500);時,剛睡1ms時,a就已經(jīng)!isAlive()了,那就多睡了499ms,浪費了時間,而如果

          a.join();
          System.exit(1);
          則一等a線程結(jié)束就會退出.如果沒有其它操作,主線程就不會占用CPU時間.

          8當一個對象被當作參數(shù)傳遞到一個方法后,此方法可改變這個對象的屬性,并可返回變化后的結(jié)果,那么這里到底是值傳遞還是引用傳遞?

            是值傳遞。Java 編程語言只由值傳遞參數(shù)。當一個對象實例作為一個參數(shù)被傳遞到方法中時,參數(shù)的值就是對該對象的引用。對象的內(nèi)容可以在被調(diào)用的方法中改變,但對象的引用是永遠不會改變的。

          9作用域public,private,protected,以及不寫時的區(qū)別
          答:區(qū)別如下:

          作用域 當前類 同一package 子孫類 其他package

          public √ √ √ √

          protected √ √ √ ×

          friendly √ √ × ×

          private √ × × ×

          不寫時默認為friendly
          10ArrayList和Vector的區(qū)別,HashMap和Hashtable的區(qū)別

          答:就ArrayList與Vector主要從二方面來說.

          一.同步性:Vector是線程安全的,也就是說是同步的,而ArrayList是線程序不安全的,不是同步的

          二.數(shù)據(jù)增長:當需要增長時,Vector默認增長為原來一培,而ArrayList卻是原來的一半
          11一.靜態(tài)內(nèi)部類可以有靜態(tài)成員,而非靜態(tài)內(nèi)部類則不能有靜態(tài)成員。
          12靜態(tài)內(nèi)部類的非靜態(tài)成員可以訪問外部類的靜態(tài)變量,而不可訪問外部類的非靜態(tài)變量
          13jsp有哪些動作?作用分別是什么?

          答:JSP共有以下6種基本動作

          jsp:include:在頁面被請求的時候引入一個文件。

          jsp:useBean:尋找或者實例化一個JavaBean。

          jsp:setProperty:設置JavaBean的屬性。

          jsp:getProperty:輸出某個JavaBean的屬性。

          jsp:forward:把請求轉(zhuǎn)到一個新的頁面。

          jsp:plugin:根據(jù)瀏覽器類型為Java插件生成OBJECT或EMBED標記

          14remote接口和home接口主要作用

          remote接口定義了業(yè)務方法,用于EJB客戶端調(diào)用業(yè)務方法

          home接口是EJB工廠用于創(chuàng)建和移除查找EJB實例

          15客服端調(diào)用EJB對象的幾個基本步驟

          一、 設置JNDI服務工廠以及JNDI服務地址系統(tǒng)屬性

          二、 查找Home接口

          三、 從Home接口調(diào)用Create方法創(chuàng)建Remote接口

          四、 通過Remote接口調(diào)用其業(yè)務方法

          posted @ 2008-01-11 21:33 lqx 閱讀(213) | 評論 (0)編輯 收藏

          鼠標拖拽div,支持w3c

          <html>
          <head>
          <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
          <title>Binny.cn</title>
          <script>
           var obj=0;
           var x=0;
           var y=0;
           var ie = (navigator.appVersion.indexOf("MSIE")!=-1);//IE
           var ff = (navigator.userAgent.indexOf("Firefox")!=-1);//Firefox
           function find(evt,objDiv){
            obj = objDiv
            if (ff){
              x = document.documentElement.scrollLeft + evt.layerX;
              y = document.documentElement.scrollTop + evt.layerY;
             
              if (document.documentElement.scrollTop > 0){
               y = evt.layerY - document.documentElement.scrollTop;
              }
             
              if (document.documentElement.scrollLeft > 0){
               x = evt.layerX - document.documentElement.scrollLeft;
              }
             }
            if (ie){
              x = document.documentElement.scrollLeft + evt.offsetX;
              y = document.documentElement.scrollTop + evt.offsetY;
             
              if (document.documentElement.scrollTop > 0){
               y = evt.offsetY - document.documentElement.scrollTop;
              }
             
              if (document.documentElement.scrollLeft > 0){
               x = evt.offsetX - document.documentElement.scrollLeft;
              }
             }
           }
           function dragit(evt){
            if(obj == 0){
             return false
            }
            else{
             obj.style.left = evt.clientX - x + "px";
             obj.style.top = evt.clientY - y + "px";
            }
           }
          </script>
          </head>
          <body style="margin:0" onmousemove="dragit(event)" onmouseup="obj = 0">

          <div id="aaa" style="background-color:red;width:200pt;height:200pt;position:absolute">
          <div id="aa" style="width:200pt;height:20pt;background:blue;position:absolute" onmousedown="find(event,document.getElementById('aaa'))"></div>
          </div><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR>
          </body>
          </html>

          摘自:http://www.binny.cn/article.asp?id=232

          posted @ 2007-12-27 13:45 lqx 閱讀(391) | 評論 (0)編輯 收藏

          查看mysql 表結(jié)構(gòu)的一些sql

          /*this can see the table information*/
          show table status from `fortioa`;

          /*this can see all the fields detail information of a table including  the character set*/
          show full fields from `account`


          /*change the table column`s character set to utf8*/
          ALTER TABLE `purchaserequest` CHANGE `justification` `justification` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL



          posted @ 2007-12-17 17:30 lqx 閱讀(1561) | 評論 (0)編輯 收藏

          更改sql server表所有者

          --執(zhí)行這個語句,就可以把當前庫的所有表的所有者改為dbo
          exec   sp_msforeachtable   'sp_changeobjectowner   ''?'',   ''dbo'''

          posted @ 2007-12-07 15:11 lqx 閱讀(224) | 評論 (0)編輯 收藏

          僅列出標題
          共18頁: First 上一頁 3 4 5 6 7 8 9 10 11 下一頁 Last 
          主站蜘蛛池模板: 纳雍县| 德州市| 彭阳县| 扎赉特旗| 酒泉市| 甘德县| 侯马市| 鄱阳县| 汉川市| 松滋市| 徐水县| 长葛市| 黄冈市| 台前县| 赣榆县| 芮城县| 五家渠市| 霍城县| 建水县| 林州市| 乐安县| 宜兰市| 万盛区| 霞浦县| 关岭| 白水县| 佛冈县| 蓝山县| 麟游县| 大安市| 元阳县| 庐江县| 云梦县| 金塔县| 方山县| 平乡县| 庆安县| 阳曲县| 瑞昌市| 公安县| 靖宇县|