lqxue

          常用鏈接

          統(tǒng)計(jì)

          book

          tools

          最新評論

          #

          html file 標(biāo)簽 的 中文“瀏覽..." 改成英文

            <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 閱讀(852) | 評論 (0)編輯 收藏

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

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

          客戶端登錄:mysql -uusername -ppassword

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

          顯示當(dāng)前運(yùn)行的Query:mysql> show processlist

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

          退出客戶端:mysql> exit

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

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

          在Spring中使用JTA事務(wù)管理

          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 閱讀(396) | 評論 (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 閱讀(240) | 評論 (0)編輯 收藏

          propedit,很好用的properties工具

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

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

          在線編輯器

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


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

          [收藏]基礎(chǔ)知識

          1.簡述邏輯操作(&,|,^)與條件操作(&&,||)的區(qū)別。(15分)
          區(qū)別主要答兩點(diǎn):
          a.條件操作只能操作布爾型的,而邏輯操作不僅可以操作布爾型,而且可以操作數(shù)值型
          b.邏輯操作不會(huì)產(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.
           
          答對第一點(diǎn)得5分,答對第二點(diǎn)得10分.

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


          2.下面程序運(yùn)行會(huì)發(fā)生什么結(jié)果?如果有錯(cuò)誤,如何改正? (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();
            }
          }
          }

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

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


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


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

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

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


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

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

          7.請問在Java的線程里有個(gè)join()函數(shù),這個(gè)函數(shù)有什么用呀?
          是把調(diào)用join()的線程連結(jié)(join)到當(dāng)前線程,什么意思呢?就是當(dāng)前線程等待調(diào)用join()線程的結(jié)束.比如:當(dāng)前線程是主線程,它結(jié)的時(shí)候要求一個(gè)被調(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時(shí)間.另一是有可能在sleep(500);時(shí),剛睡1ms時(shí),a就已經(jīng)!isAlive()了,那就多睡了499ms,浪費(fèi)了時(shí)間,而如果

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

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

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

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

          作用域 當(dāng)前類 同一package 子孫類 其他package

          public √ √ √ √

          protected √ √ √ ×

          friendly √ √ × ×

          private √ × × ×

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

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

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

          二.數(shù)據(jù)增長:當(dāng)需要增長時(shí),Vector默認(rèn)增長為原來一培,而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有哪些動(dòng)作?作用分別是什么?

          答:JSP共有以下6種基本動(dòng)作

          jsp:include:在頁面被請求的時(shí)候引入一個(gè)文件。

          jsp:useBean:尋找或者實(shí)例化一個(gè)JavaBean。

          jsp:setProperty:設(shè)置JavaBean的屬性。

          jsp:getProperty:輸出某個(gè)JavaBean的屬性。

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

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

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

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

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

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

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

          二、 查找Home接口

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

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

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

          鼠標(biāo)拖拽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 閱讀(385) | 評論 (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 閱讀(1555) | 評論 (0)編輯 收藏

          更改sql server表所有者

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

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

          僅列出標(biāo)題
          共18頁: First 上一頁 3 4 5 6 7 8 9 10 11 下一頁 Last 
          主站蜘蛛池模板: 屯昌县| 秦安县| 吉安市| 个旧市| 巴塘县| 苍梧县| 内黄县| 义马市| 唐河县| 泗洪县| 白朗县| 桂东县| 渑池县| 莆田市| 曲周县| 和政县| 纳雍县| 开化县| 安龙县| 扎兰屯市| 察哈| 德化县| 普格县| 额尔古纳市| 台安县| 南乐县| 杂多县| 凉山| 鄂托克旗| 北安市| 高安市| 和平县| 新龙县| 措美县| 会同县| 漳浦县| 视频| 文山县| 黄石市| 七台河市| 大庆市|