#
<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()">
MySQL的最大連接數默認是100
客戶端登錄:mysql -uusername -ppassword
設置新的最大連接數為200:mysql> set GLOBAL max_connections=200
顯示當前運行的Query:mysql> show processlist
顯示當前狀態:mysql> show status
退出客戶端:mysql> exit
查看當前最大連接數:mysqladmin -uusername -ppassword variables |find "max_con"
http://java.e800.com.cn/articles/2007/417/1176746498587392322_1.html
http://www.oracle.com/technology/tech/java/spring/how-to-jta-spring.html
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.
--
Eclipse plug in address
http://propedit.sourceforge.jp/eclipse/
http://www.geniisoft.com/showcase.nsf/WebEditors
1.簡述邏輯操作(&,|,^)與條件操作(&&,||)的區別。(15分)
區別主要答兩點:
a.條件操作只能操作布爾型的,而邏輯操作不僅可以操作布爾型,而且可以操作數值型
b.邏輯操作不會產生短路.如:
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分.
本題考察最最基本的知識,但仍然有很多大牛級開發人員下馬,任何語言在開始的部分
都會詳細介紹這些基本知識,但除了學習第一種語言時,沒有人在學習新的語言時愿意
花五分鐘來復習一下.
2.下面程序運行會發生什么結果?如果有錯誤,如何改正? (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();
}
}
}
本題在編譯時會發生錯誤(錯誤描述不同的JVM有不同的信息,意思就是未明確的x調用,
兩個x都匹配,就象在同時import java.util和java.sql兩個包時直接聲明Date一樣)
本題主要考察對接口和類的最最基本的結構的了解.對于父類的變量,可以用super.x來
明確,而接口的屬性默認隱含為 public static final.所以可以通過A.x來明確.
3.簡述 Java Server Page 和 Servlet 的聯系和區別。(20分)
本題不用多說,在答相同點時應該明確知道jsp編譯后是"類servlet"而"不是Servlet",
答區別時應該回答出"側重于(視圖/控制邏輯)".其它可根據情況加減分值.知識很簡單,
但從面試的角度看,被試者不僅要能知道它們的區別,而且要能比較準確地表達出來(以
后寫文檔要能讓別人看得懂,不產生歧義),回答"jsp編譯后就是servlet"視為錯誤,回答
"jsp用于視圖,servlet用于控制邏輯"視為錯誤,應該用側重于,主要(多數)用于等詞語
表達.
4.XML文檔定義有幾種形式?它們之間有何本質區別?
解析XML文檔有哪幾種方式?(20分)
本題三個答題點:
a: 兩種形式 dtd,schema
b: 本質區別:schema本身是xml的,可以被XML解析器解析(這也是從DTD上發展schema的
根本目的)
c: 兩種主要方式:dom,sax.答出兩種得全分,如能答出saxt,或其它(在答出dom,sax的基
礎上,如果應試者認為其它方式也可以視為對xml的解析應該允許.但沒有答出dom,sax把
其它方式說成是對XML的解析不得分)應該加分.
5.簡述synchronized和java.util.concurrent.locks.Lock的異同 ?(15分)
主要相同點:
Lock能完成synchronized所實現的所有功能.(其它不重要)
主要不同點:
Lock有比synchronized更精確的線程語義和更好的性能(在相同點中回答此點也行)
synchronized會自動釋放鎖.而Lock一定要求程序員手工釋放.并且必須在finally從句
中釋放,如果沒有答出在finally中釋放不得分.就如Connection沒有在finally中關閉一
樣.連最基本的資源釋放都做不好,還談什么多線程編程.
6.EJB規范規定EJB中禁止的操作有哪些?(15分)
共有8點,答出下列3-4點得滿分.
1.不能操作線程和線程API(線程API指非線程對象的方法如notify,wait等)
2.不能操作awt
3.不能實現服務器功能
4.不能對靜態屬生存取.
5.不能使用IO操作直接存取文件系統
6.不能加載本地庫.
7.不能將this作為變量和返回.
8.不能循環調用.
7.請問在Java的線程里有個join()函數,這個函數有什么用呀?
是把調用join()的線程連結(join)到當前線程,什么意思呢?就是當前線程等待調用join()線程的結束.比如:當前線程是主線程,它結的時候要求一個被調用的線程a結束,如果我們不調用a.join();那只能輪詢a的狀態.
while(true){
if(!a.isAlive()) break;
sleep(500);
}
System.exet(1);
如果a線程isAlive,則等500ms繼續下一次輪巡,如果已經不可用則結束,這種while(true)的輪詢一是占用大量的CPU時間.另一是有可能在sleep(500);時,剛睡1ms時,a就已經!isAlive()了,那就多睡了499ms,浪費了時間,而如果
a.join();
System.exit(1);
則一等a線程結束就會退出.如果沒有其它操作,主線程就不會占用CPU時間.
8當一個對象被當作參數傳遞到一個方法后,此方法可改變這個對象的屬性,并可返回變化后的結果,那么這里到底是值傳遞還是引用傳遞?
是值傳遞。Java 編程語言只由值傳遞參數。當一個對象實例作為一個參數被傳遞到方法中時,參數的值就是對該對象的引用。對象的內容可以在被調用的方法中改變,但對象的引用是永遠不會改變的。
9作用域public,private,protected,以及不寫時的區別
答:區別如下:
作用域 當前類 同一package 子孫類 其他package
public √ √ √ √
protected √ √ √ ×
friendly √ √ × ×
private √ × × ×
不寫時默認為friendly
10ArrayList和Vector的區別,HashMap和Hashtable的區別
答:就ArrayList與Vector主要從二方面來說.
一.同步性:Vector是線程安全的,也就是說是同步的,而ArrayList是線程序不安全的,不是同步的
二.數據增長:當需要增長時,Vector默認增長為原來一培,而ArrayList卻是原來的一半
11一.靜態內部類可以有靜態成員,而非靜態內部類則不能有靜態成員。
12靜態內部類的非靜態成員可以訪問外部類的靜態變量,而不可訪問外部類的非靜態變量
13jsp有哪些動作?作用分別是什么?
答:JSP共有以下6種基本動作
jsp:include:在頁面被請求的時候引入一個文件。
jsp:useBean:尋找或者實例化一個JavaBean。
jsp:setProperty:設置JavaBean的屬性。
jsp:getProperty:輸出某個JavaBean的屬性。
jsp:forward:把請求轉到一個新的頁面。
jsp:plugin:根據瀏覽器類型為Java插件生成OBJECT或EMBED標記
14remote接口和home接口主要作用
remote接口定義了業務方法,用于EJB客戶端調用業務方法
home接口是EJB工廠用于創建和移除查找EJB實例
15客服端調用EJB對象的幾個基本步驟
一、 設置JNDI服務工廠以及JNDI服務地址系統屬性
二、 查找Home接口
三、 從Home接口調用Create方法創建Remote接口
四、 通過Remote接口調用其業務方法
<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
/*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
--執行這個語句,就可以把當前庫的所有表的所有者改為dbo
exec sp_msforeachtable 'sp_changeobjectowner ''?'', ''dbo'''