http://www.c-sharpcorner.com/
Q学习c#的好地方
http://windowsforms.net
Q学习winform~程的好地方
http://www.codeguru.com:学习C++的好地方
http://www.codeproject.com
Q有很多CZ代码
http://www.gotdotnet.com Q都知道的地?br />
http://www.aspnet.com Qaspnet的专业网?br />
http://www.sourceforge.net Q最好的开源站?/p>
致应届毕业生 走弯\的十条忠?/b> | ||
转脓 |
刚刚CC会的年MhQ充满了蓄势待发的豪情、青春的朝气、前卫的思想Q梦想着丰富的待遇和轰蘪烈烈的事业。可是,C会毕竟是一所包罗万象、喧嚣复杂的大学校,q里没有寒暑假,拒绝虚假和肤,更拒l空惛_庸碌Q难以预告何时开课何时放学?br /> 如何在涉世之初少走弯路,有一个好的开端,开始一番成功的事业Q以下是一些先行者积累的10条有益的涉世忠告。好好地遵@、把握这些忠告和吧,比v所学的译֠评来,它毫不逊色Q?br /> 1. C闚wQ以便按时叫醒你。贪睡和不守Ӟ都将成ؓ你工作和事业上的l脚矻IM时候都一栗不仅要学会准时Q更要学会提前。就如你坐RL圎ͼ沉K的风景很美Q你忍不住下车看一看,后来虽然你还是赶C某地Q却不是准时到达。“闹钟”只是一U简单的标志和提C,真正灉|、实用的旉Q掌握在每个人的心中?br /> 2. 如果你不喜欢现在的工作,要么辞职不干Q要么就闭嘴不言。初庐,往往眼高手低Q心高气Ԍ大事做不了,事不愿做。不要养成挑三拣四的习惯。不要雨天烦打伞Q不带伞又怕淋雨,处处表现Z满的情A。记住,不做则已Q要做就要做好?br /> 3. 每个人都有孤独的时候。要学会忍受孤独Q这h会成熟v来。年Mhd哈哈、打打闹Ҏ了,C一个陌生的环境Q面对Ş形色色的人和事,一下子不知所措v来,有时q一个可以們ֿ说话的地方也没有。这Ӟ千万别Qw,学会静心Q学会忍受孤独。在孤独中思考,在思考中成熟Q在成熟中升华。不要因为寂寞而ؕ了方寸,而去做无聊无益的事情Q白白浪费了宝贵的时间?br /> 4.走运时要做好倒霉的准备。有一天,一只狐狸走C个葡萄园外,看见里面水灵늚葡萄垂涎Ʋ滴。可是外面有栅栏挡着Q无法进厅R于是它一狠心l食三日Q减肥之后,l于钻进葡萄园内饱餐一ѝ当它心满意_想离开葡萄园时Q发觉自己吃得太饱,怎么也钻不出栅栏了。相信Q何h都不愿做q样的狐狸。退路同样重要。饱带干_,晴带雨伞Q点滴积累,水到渠成。有的东西今天似乎一文不|但有朝一日也许就会nL倍?br /> 5. 不要像玻璃那栯弱。有的h眼睛ȝ着自己Q所以长不高看不q;L喜欢怨天hQ也使别人无比厌烦。没有苦中苦Q哪来甜中甜Q不要像ȝ那样脆弱Q而应像水晶一样透明Q太阳一栯煌,腊梅一样坚强。既然睁开眼睛享受风的清凉Q就不要埋怨风中细的沙粒?br /> 6.住自己的嘴巴。不要谈己,更不要议论别人。谈己往往会自大虚伪,在名不副实中失去自己。议论别人往往陷入鸡毛蒜皮的是非口舌中U缠不清。每天下班后和你的那些同事朋友喝酒聊天可不是件好事,因ؓQ这中间往往会把议论同事、朋友当做话题。背后议ZhL不好的,其是议论别人的短处Q这些会降低你的人格?br /> 7. Z从不会“失掉”,你失掉了Q自有别Z得到。不要凡事在天,守株待兔Q更不要寄希望于“机会”。机会只不过是相对于充分准备而又善于创造机会的言的。也许,你正为失M个机会而懊悔、埋怨的时候,Z正被你对面那个同L“倒霉鬼”给抓住了。没有机会,p创造机会,有了ZQ就要y妙地抓住?br /> 8.若电话老是不响Q你该打出去。很多时候,电话会给你带来意想不到的收获Q它不是qQ仅仅成ZU摆设。交了新朋友Q别忘了老朋友,朋友多了路好走。交际的一大诀H就是主动。好的h~好的口,往往助你的事业更上一个台阶?br /> 9.千万不要因ؓ自己已经Cl婚q龄而草率结婚。想l婚Q就要找一个能和你心心相印、相辅相携的伴G。不要因为放U和游戏而恋爱,不要因ؓ恋爱而媄响工作和事业Q更不要因一桩草率而失败的婚姻而人生受阻。感情用事往往会因失大?br /> 10. 写出你一生要做的事情Q把单子攑֜皮夹里,l常拿出来看。h生要有目标,要有计划Q要有提醒,要有紧迫感。一个又一个小目标串v来,成了你一生的大目标。生zd了Q环境改善了Q不要忘了皮多w那张看似薄薄的单子?br /> |
法问题 用SQL写出当M*N时的螺旋矩阵法
如下是一?*4的矩?
1 12 11 10
2 13 16 9
3 14 15 8
4 5 6 7
按照上面矩阵的规? LSQL写出当M*N时的矩阵法
实现的sql和效?
代码:--------------------------------------------------------------------------------
SQL> -- 逆时针的
SQL> select --i,
2 sum(decode(j, 1, rn)) as co11,
3 sum(decode(j, 2, rn)) as co12,
4 sum(decode(j, 3, rn)) as co13,
5 sum(decode(j, 4, rn)) as co14
6 from (select i, j, rank() over(order by tag) as rn
7 from (select i,
8 j,
9 -- 逆时针螺旋特征码 counter-clockwise
10 case least(j - 1, 4 - i, 4 - j, i - 1)
11 when j - 1 then
12 (j - 1) || '1' || i
13 when 4-i then
14 (4 - i) || '2' || j
15 when 4 - j then
16 (4 - j) || '3' || (4 - i)
17 when i - 1 then
18 (i - 1) || '4' || (4 - j)
19 end as tag
20 from (select level as i from dual connect by level <= 4) a,
21 (select level as j from dual connect by level <= 4) b))
22 group by i
23 /
CO11 CO12 CO13 CO14
---------- ---------- ---------- ----------
1 12 11 10
2 13 16 9
3 14 15 8
4 5 6 7
SQL> -- 时针的
SQL> select --i,
2 sum(decode(j, 1, rn)) as co11,
3 sum(decode(j, 2, rn)) as co12,
4 sum(decode(j, 3, rn)) as co13,
5 sum(decode(j, 4, rn)) as co14
6 from (select i, j, rank() over(order by tag) as rn
7 from (select i,
8 j,
9 -- 时针螺旋特征码 clockwise
10 case least(i - 1, 4 - j, 4 - i, j - 1)
11 when i - 1 then
12 (i - 1) || '1' || j
13 when 4 - j then
14 (4 - j) || '2' || i
15 when 4 - i then
16 (4 - i) || '3' || (4 - j)
17 when j - 1 then
18 (j - 1) || '4' || (4 - i)
19 end as tag
20 from (select level as i from dual connect by level <= 4) a,
21 (select level as j from dual connect by level <= 4) b))
22 group by i
23 /
CO11 CO12 CO13 CO14
---------- ---------- ---------- ----------
1 2 3 4
12 13 14 5
11 16 15 6
10 9 8 7
----------------------------------------------------------------------------------------
以上两种旋{都是由外向内? 如果有兴也可以做成由内惛_?br />不过如果大家q要把结?0度旋? 在顺序固定的情况? 应该是行列转换的问题了
不过如果要做成圆形的, 我觉得不太可能了, 正n边Ş倒是可以考虑, 不过要看n的值是多大, 如果于正无I? 那就是圆? ^_^
对了QjackyQ能大概说一下这个螺旋特征码的算法原理么Q?
--------------------------------------------------------------------------------
螺旋总要有个L, q上面的那个结果来说明?br />L?1,1), 如果是顺旉的话, 旋{时依ơ走q的途径??>?>?>?>?>?>?>?.., 知道最后在螺旋中心l束, 但是可以注意到旋转是会越来越q离外边?br />Ҏq个我们可以获取螺旋特征码?br />4*4的矩? 那么可以认ؓ i=1, j=1, i=4, j=4, q就是这个螺旋的4个边? 时针旋转时, 边界越q? 那么序p靠前, 当距边界相同时, 边界的优先pҎ 上右下左(L?,1, 时针旋转的边界优先U? 而定? 如果q个也相? 那么pҎq个点离前一个边界的距离而定, ȝ近, 优先U越? Ҏ以上规则, 可以得出特征码共有三? W一位代表距边界的距离, W二位代表距d个边界最q?我的sql中用1,2,3,4分别表示四个边界), W三位代表距d一个边界的距离(因ؓ目的是ؓ了排? 计算时没有严格按照这个距dD行表C^_^)
对应上面螺旋特征码的规则, 使用case least(...)判断边界的距离和距Lq的边界是那个边? when ... then后的取值再定距离前一个边界的距离, q样完成了特征? 剩下的就是对特征码排序和行列转换? q个׃用说了吧, 大家应该都会? ^_^
也来学一下JACKYWOOD? 写一个SQL:
JACK的实? 采用了行列{换把生成的序列做成二l表, 所以要求列数是固定? 若要实现N的矩늚法, 行列转换正如其所a, 可以通过二个SQL实现.
现换一下思\, 用SYS_CONNECT_BY_PATH函数, 借用JACK的思\, 实现N的矩는? 如下请各位指?
代码:--------------------------------------------------------------------------------
SQL> var n number;
SQL> exec :n := 3;
PL/SQL q程已成功完成?/font>
SQL> select replace(max(sys_connect_by_path(rank, ',')), ',') str
2 from (select i, j,
3 to_char(rank() over(order by tag), '9999') as rank
4 from (select i,
5 j,
6 -- 逆时针螺旋特征码 counter-clockwise
7 case least(j - 1, :n - i, :n - j, i - 1)
8 when j - 1 then
9 (j - 1) || '1' || i
10 when :n - i then
11 (:n - i) || '2' || j
12 when :n - j then
13 (:n - j) || '3' || (:n - i)
14 when i - 1 then
15 (i - 1) || '4' || (:n - j)
16 end as tag
17 from (select level as i from dual connect by level <= :n) a,
18 (select level as j from dual connect by level <= :n) b
19 )
20 )
21 start with j = 1
22 connect by j - 1 = prior j and i = prior i
23 group by i
24 order by i;
STR
-------------------------------------------------------------------------------------------------
1 8 7
2 9 6
3 4 5
SQL> exec :n := 4;
PL/SQL q程已成功完成?/font>
SQL> /
STR
-------------------------------------------------------------------------------------------------
1 12 11 10
2 13 16 9
3 14 15 8
4 5 6 7
SQL> exec :n := 5;
PL/SQL q程已成功完成?/font>
SQL> /
STR
-------------------------------------------------------------------------------------------------
1 16 15 14 13
2 17 24 23 12
3 18 25 22 11
4 19 20 21 10
5 6 7 8 9
SQL>
不妨也填一?
代码:--------------------------------------------------------------------------------
SQL> exec :n := 5
PL/SQL q程已成功完成?/font>
SQL> select replace(max(sys_connect_by_path(rank, ',')), ',') str
2 from (select i, j,
3 case when rank() over(order by tag) - floor(:n * :n / 2) <= 0 then ' '
4 else to_char(rank() over(order by tag) - floor(:n * :n / 2), '9999') end as rank,
5 min(j) over(partition by i) minj
6 from (select i,
7 j,
8 -- 时针螺旋特征码 counter-clockwise
9 case greatest(i - j, i + j - :n - 1, j - i, :n - i - j + 1)
10 when i - j then
11 :n - (i - j) || '1' || i
12 when i + j - :n - 1 then
13 :n - (i + j - :n - 1) || '2' || j
14 when j - i then
15 :n - (j - i) || '3' || (:n - i)
16 when :n - i - j + 1 then
17 :n - (:n - i - j + 1) || '4' || i
18 end as tag
19 from (select level as i from dual connect by level <= :n) a,
20 (select level as j from dual connect by level <= :n) b
21 -- where abs(i - j) < floor(:n / 2 + .6)
22 -- and i + j between floor(:n / 2 + .6) + 1 and floor(:n / 2 + .6) + :n
23 )
24 )
25 start with j = minj
26 connect by j - 1 = prior j and i = prior i
27 group by i
28 order by i;
STR
----------------------------------------------------------------------------------------------------------------------
7
8 12 6
1 9 13 11 5
2 10 4
3
SQL> exec :n := 7;
PL/SQL q程已成功完成?/font>
SQL> /
STR
----------------------------------------------------------------------------------------------------------------------
10
11 19 9
12 20 24 18 8
1 13 21 25 23 17 7
2 14 22 16 6
3 15 5
4
已选择7行?/font>
SQL> exec :n := 9;
PL/SQL q程已成功完成?/font>
SQL> /
STR
----------------------------------------------------------------------------------------------------------------------
13
14 26 12
15 27 35 25 11
16 28 36 40 34 24 10
1 17 29 37 41 39 33 23 9
2 18 30 38 32 22 8
3 19 31 21 7
4 20 6
5
已选择9行?/font>
SQL> exec :n := 8
PL/SQL q程已成功完成?/font>
SQL> /
STR
----------------------------------------------------------------------------------------------------------------------
5 4
6 18 17 3
7 19 27 26 16 2
8 20 28 32 31 25 15 1
9 21 29 30 24 14
10 22 23 13
11 12
对于比较大的N? 需?时针螺旋特征码"的组成进行适当修改:
代码:--------------------------------------------------------------------------------
1 select replace(max(sys_connect_by_path(rank, ',')), ',') str
2 from (select i, j,
3 case when rank() over(order by tag) - floor(:n * :n / 2) <= 0 then ' '
4 else to_char(rank() over(order by tag) - floor(:n * :n / 2), '9999') end as rank,
5 min(j) over(partition by i) minj
6 from (select i,
7 j,
8 -- 逆时针螺旋特征码 counter-clockwise
9 case greatest(i - j, i + j - :n - 1, j - i, :n - i - j + 1)
10 when i - j then
11 chr(:n - (i - j)) || '1' || chr(i)
12 when i + j - :n - 1 then
13 chr(:n - (i + j - :n - 1)) || '2' || chr(j)
14 when j - i then
15 chr(:n - (j - i)) || '3' || chr((:n - i))
16 when :n - i - j + 1 then
17 chr(:n - (:n - i - j + 1)) || '4' || chr(i)
18 end as tag
19 from (select level as i from dual connect by level <= :n) a,
20 (select level as j from dual connect by level <= :n) b
21 -- where abs(i - j) < floor(:n / 2 + .6)
22 -- and i + j between floor(:n / 2 + .6) + 1 and floor(:n / 2 + .6) + :n
23 )
24 )
25 start with j = minj
26 connect by j - 1 = prior j and i = prior i
27 group by i
28* order by i
SQL> /
STR
-------------------------------------------------------------------------------------------------------------------
19
20 40 18
21 41 57 39 17
22 42 58 70 56 38 16
23 43 59 71 79 69 55 37 15
24 44 60 72 80 84 78 68 54 36 14
1 25 45 61 73 81 85 83 77 67 53 35 13
2 26 46 62 74 82 76 66 52 34 12
3 27 47 63 75 65 51 33 11
4 28 48 64 50 32 10
5 29 49 31 9
6 30 8
7
--------------------------------------------------------------------------------
x是的, q样你看如何?
代码:--------------------------------------------------------------------------------
1 select replace(max(sys_connect_by_path(rank, ',')), ',') str
2 from (select i, j,
3 to_char(rank() over(order by tag), '9999') as rank
4 from (select i,
5 j,
6 -- 逆时针螺旋特征码 counter-clockwise
7 case least(j - 1, &&1 - i, &1 - j, i - 1)
8 when j - 1 then
9 (j - 1) || '1' || i
10 when &1 - i then
11 (&1 - i) || '2' || j
12 when &1 - j then
13 (&1 - j) || '3' || (&1 - i)
14 when i - 1 then
15 (i - 1) || '4' || (&1 - j)
16 end as tag
17 from (select level as i from dual connect by level <= &1) a,
18 (select level as j from dual connect by level <= &1) b
19 )
20 )
21 start with j = 1
22 connect by j - 1 = prior j and i = prior i
23 group by i
24* order by i
SQL> /
输入 1 的? 5
原值 ?7: case least(j - 1, &&1 - i, &1 - j, i - 1)
新值 ?7: case least(j - 1, 5 - i, 5 - j, i - 1)
原值 ?10: when &1 - i then
新值 ?10: when 5 - i then
原值 ?11: (&1 - i) || '2' || j
新值 ?11: (5 - i) || '2' || j
原值 ?12: when &1 - j then
新值 ?12: when 5 - j then
原值 ?13: (&1 - j) || '3' || (&1 - i)
新值 ?13: (5 - j) || '3' || (5 - i)
原值 ?15: (i - 1) || '4' || (&1 - j)
新值 ?15: (i - 1) || '4' || (5 - j)
原值 ?17: from (select level as i from dual connect by level <= &1) a,
新值 ?17: from (select level as i from dual connect by level <= 5) a,
原值 ?18: (select level as j from dual connect by level <= &1) b
新值 ?18: (select level as j from dual connect by level <= 5) b
STR
--------------------------------------------------------------------------------------------
1 16 15 14 13
2 17 24 23 12
3 18 25 22 11
4 19 20 21 10
5 6 7 8 9
SQL>--------------------------------------------------------------------------------
使用? l声明m和nq赋?/font>
代码:--------------------------------------------------------------------------------
var n number;
var m number;
exec :n := &n; :m=&m;
with t as (
select :n as n, :m as m from dual
)
select replace(max(sys_connect_by_path(rank, ',')), ',') str
from (select i, j, to_char(rank() over(order by tag), '999999') as rank
from (select i,
j,
-- 时针螺旋特征码 clockwise
case least(i - 1, m - j, n - i, j - 1)
when i - 1 then
to_char(i - 1, 'fm0000') || '1' ||
to_char(j - 1, 'fm0000')
when m - j then
to_char(m - j, 'fm0000') || '2' ||
to_char(i - 1, 'fm0000')
when n - i then
to_char(n - i, 'fm0000') || '3' ||
to_char(m - j, 'fm0000')
when j - 1 then
to_char(j - 1, 'fm0000') || '4' ||
to_char(n - i, 'fm0000')
end as tag
from (select n, level as i from t connect by level <= n) a,
(select m, level as j from t connect by level <= m) b))
start with j = 1
connect by j - 1 = prior j and i = prior i
group by i
-----------------------------------------------------------------------------------------------
?用PL/SQL写出当M*N时的螺旋矩阵法 |
法问题 用PL/SQL写出当M*N时的螺旋矩阵法
如下是一?*4的矩?
1 12 11 10
2 13 16 9
3 14 15 8
4 5 6 7
按照上面矩阵的规? LPL/SQL写出当M*N时的矩阵法
1996q我考程序员时候见q类似问?
代码:--------------------------------------------------------------------------------
试题?
阅读以下E序说明和CE序Q将应填入程序中 QnQ?处的字句Q写在答L对应栏内?
[E序说明]
本程序将自然?1Q?Q……,N2 按蛇形方式逐个序存入 N 阶矩c?例如Q当 N = 3 ?4 时分别如?3.1 和图 3.2?
7 13 14 16
6 7 9 6 8 12 15
2 5 8 2 5 9 11
1 3 4 1 3 4 10
?.1 ?.2
?an0 开始到 a0n 为止Qn = N-1Q顺序填入自然数Q交替地Ҏ一斜列从左上元素向右下元素或从右下元素向左上元素存数?/font>
[E序]
#include
#define SIZE 10
int a[SIZE] [SIZE], k;
main()
{ int i, j, n, N;
for (N = 3;N<=SIZE; N++)
{ k = 1;
makeArray (n = N-1);
printf (QnN = %d;nQ?n+1);
for (i = 0;i<=n; i++)
{ for (j = 0; j<=n; j++)printf(Q?4dQ?a[i][j]);
printf (QnQ?;
}
}
}
makeline (int row_start, int col_start, int row_end)
{ /*完成矩阵一条斜U的整数填写*/
int i, j, sign = ____(1)____;
for (i = row_start, j = col_start;____(2)____ >=0; i += sign,j += sign)
a[i][j] = k++;
}
makeArray (int n)
{ /* 完成矩阵每条斜线的整数填?/
int d;
for (d = 1; d <= ___(3)___; d++)
if (d <= n);
if (d%2) makeline (____(4)____); else makeline(____(5)____);
else
if (d%2) makeline (____(6)____); else makeline(____(7)____);
}
PL?SQL
代码:--------------------------------------------------------------------------------
declare
type t_matrix is table of number index by binary_integer;
v_helix t_matrix;
i number;
j number;
direction pls_integer; -- right:0, up:1, left:2, down:3
M number;
N number;
-- 模拟2l数l?begin
function new_matrix (rows integer, cols integer) return t_matrix is
v_result t_matrix;
begin
v_result(0):=cols;
for i in 1 .. rows*cols loop
v_result(i) := null;
end loop;
return v_result;
end;
procedure set_val(p_matrix in out t_matrix, i integer, j integer, val number) is
begin
p_matrix( (i-1)* p_matrix(0) +j ) := val;
end;
function get_val(p_matrix t_matrix, i integer, j integer) return number is
begin
return p_matrix( (i-1)* p_matrix(0) +j );
end;
procedure print_matrix(m t_matrix) is
i integer;
j integer;
begin
for i in 1 .. m.count/m(0) loop
for j in 1 .. m(0) loop
dbms_output.put(to_char(m((i-1)*m(0)+j),'9999990'));
end loop;
dbms_output.new_line;
end loop;
end;
-- 模拟2l数l?end
--L"下一个位|?
function go_next
(
p_helix in out t_matrix,
p_i in out number,
p_j in out number,
p_dir in out pls_integer,
p_altdir char
) return boolean is
dir_offset constant varchar2(16) := '+0+1-1+0+0-1+1+0'; -- i,j offset in each direction
ii number;
jj number;
times pls_integer := 0;
begin
loop
ii := p_i + substr(dir_offset, p_dir * 4 + 1, 2);
jj := p_j + substr(dir_offset, p_dir * 4 + 2 + 1, 2);
times := times + 1;
exit when(ii between 1 and p_helix.count/p_helix(0)
and jj between 1 and p_helix(0)
and get_val(p_helix,ii,jj) is null);
if times >= 4 then
return false;
end if;
if p_altdir = 'L' then -- turn left
p_dir := mod(p_dir + 1, 4);
elsif p_altdir = 'R' then -- turn right
p_dir := mod(p_dir + 3, 4);
end if;
end loop;
p_i := ii;
p_j := jj;
return true;
end;
--ȝ?br />begin
M := 4;
N := 5;
v_helix := new_matrix(M, N);
i := 1;
j := 1;
direction := 3;
for x in 1 .. M * N loop
set_val(v_helix, i, j, x);
exit when not go_next(v_helix, i, j, direction, 'L');
end loop;
print_matrix(v_helix);
--已经完成dQ以下可以叫做画蛇添IQ?/font>
dbms_output.new_line;
v_helix := new_matrix(M, N);
i := 1;
j := 1;
direction := 0;
for x in 1 .. M * N loop
set_val(v_helix, i, j, x);
exit when not go_next(v_helix, i, j, direction, 'R');
end loop;
print_matrix(v_helix);
dbms_output.new_line;
v_helix := new_matrix(M, N);
i := 1;
j := 1;
direction := 3;
for x in 1 .. M * N loop
set_val(v_helix, i, j, M*N-x+1);
exit when not go_next(v_helix, i, j, direction, 'L');
end loop;
print_matrix(v_helix);
dbms_output.new_line;
v_helix := new_matrix(M, N);
i := 1;
j := 1;
direction := 0;
for x in 1 .. M * N loop
set_val(v_helix, i, j, M*N-x+1);
exit when not go_next(v_helix, i, j, direction, 'R');
end loop;
print_matrix(v_helix);
end;
1 14 13 12 11
2 15 20 19 10
3 16 17 18 9
4 5 6 7 8
1 2 3 4 5
14 15 16 17 6
13 20 19 18 7
12 11 10 9 8
20 7 8 9 10
19 6 1 2 11
18 5 4 3 12
17 16 15 14 13
20 19 18 17 16
7 6 5 4 15
8 1 2 3 14
9 10 11 12 13
---------------
再包一层,多玩点花P
代码:--------------------------------------------------------------------------------
declare
procedure draw_helix ( M number, N number, init_i integer, init_j integer, init_dir integer, screw_dir char, asc_order boolean := true) is
type t_matrix is table of number index by binary_integer;
v_helix t_matrix;
element number;
i integer := init_i;
j integer := init_j;
direction integer := init_dir; -- right:0, up:1, left:2, down:3
-- 模拟2l数l?begin
function new_matrix( rows integer, cols integer ) return t_matrix is
v_result t_matrix;
begin
v_result(0) := cols;
for i in 1 .. rows * cols loop
v_result(i) := null;
end loop;
return v_result;
end;
procedure set_val (p_matrix in out t_matrix, i integer, j integer, val number ) is
begin
p_matrix((i - 1) * p_matrix(0) + j) := val;
end;
function get_val ( p_matrix t_matrix, i integer, j integer ) return number is
begin
return p_matrix((i - 1) * p_matrix(0) + j);
end;
procedure print_matrix(m t_matrix) is
i integer;
j integer;
begin
for i in 1 .. m.count / m(0) loop
for j in 1 .. m(0) loop
dbms_output.put( lpad(nvl(to_char(m((i - 1) * m(0) + j)), ' '), 8, ' ') );
end loop;
dbms_output.new_line;
end loop;
end;
-- 模拟2l数l?end
--L"下一个位|?
function go_next (p_helix in t_matrix, p_i in out number, p_j in out number, p_dir in out pls_integer, p_altdir char) return boolean is
dir_offset constant varchar2(16) := '+0+1-1+0+0-1+1+0'; -- i,j offset in each direction
ii number;
jj number;
times pls_integer := 0;
begin
loop
ii := p_i + substr(dir_offset, p_dir * 4 + 1, 2);
jj := p_j + substr(dir_offset, p_dir * 4 + 2 + 1, 2);
times := times + 1;
exit when(ii between 1 and p_helix.count / p_helix(0) and jj between 1 and p_helix(0) and
get_val(p_helix, ii, jj) is null);
if times >= 4 then
return false;
end if;
if p_altdir = 'L' then
-- turn left
p_dir := mod(p_dir + 1, 4);
elsif p_altdir = 'R' then
-- turn right
p_dir := mod(p_dir + 3, 4);
end if;
end loop;
p_i := ii;
p_j := jj;
return true;
end;
--begin of draw_helix
begin
v_helix := new_matrix(M, N);
for x in 1 .. M*N loop
if asc_order then
element := x;
else
element := M*N - x + 1;
end if;
set_val(v_helix, i, j, element);
exit when not go_next(v_helix, i, j, direction, screw_dir);
end loop;
print_matrix(v_helix);
dbms_output.new_line;
end;
--begin of main
begin
draw_helix(4, 5, 1, 1, 3, 'L', true);
draw_helix(4, 5, 1, 1, 0, 'R', true);
draw_helix(4, 5, 1, 1, 3, 'L', false);
draw_helix(4, 5, 4, 5, 2, 'R', true);
draw_helix(4, 5, 1, 5, 2, 'L', true);
draw_helix(4, 5, 1, 5, 3, 'R', false);
draw_helix(4, 5, 3, 3, 3, 'R', true);
draw_helix(4, 5, 2, 3, 3, 'R', true);
end;
1 14 13 12 11
2 15 20 19 10
3 16 17 18 9
4 5 6 7 8
1 2 3 4 5
14 15 16 17 6
13 20 19 18 7
12 11 10 9 8
20 7 8 9 10
19 6 1 2 11
18 5 4 3 12
17 16 15 14 13
8 9 10 11 12
7 18 19 20 13
6 17 16 15 14
5 4 3 2 1
5 4 3 2 1
6 17 16 15 14
7 18 19 20 13
8 9 10 11 12
10 9 8 7 20
11 2 1 6 19
12 3 4 5 18
13 14 15 16 17
7 8 9 10 11
6 19 18 17 12
5 20 1 16 13
4 3 2 15 14
8 9 10 11 12
7 1 18 13
6 2 17 14
5 4 3 16 15
---
?dir_offset改一下,p斜线?
代码:--------------------------------------------------------------------------------
declare
procedure draw_helix ( M number, N number, init_i integer, init_j integer, init_dir integer, screw_dir char, asc_order boolean := true) is
type t_matrix is table of number index by binary_integer;
v_helix t_matrix;
element number;
i integer := init_i;
j integer := init_j;
direction integer := init_dir; -- right:0, up:1, left:2, down:3
-- 模拟2l数l?begin
function new_matrix( rows integer, cols integer ) return t_matrix is
v_result t_matrix;
begin
v_result(0) := cols;
for i in 1 .. rows * cols loop
v_result(i) := null;
end loop;
return v_result;
end;
procedure set_val (p_matrix in out t_matrix, i integer, j integer, val number ) is
begin
p_matrix((i - 1) * p_matrix(0) + j) := val;
end;
function get_val ( p_matrix t_matrix, i integer, j integer ) return number is
begin
return p_matrix((i - 1) * p_matrix(0) + j);
end;
procedure print_matrix(m t_matrix) is
i integer;
j integer;
begin
for i in 1 .. m.count / m(0) loop
for j in 1 .. m(0) loop
dbms_output.put( lpad(nvl(to_char(m((i - 1) * m(0) + j)), ' '), 8, ' ') );
end loop;
dbms_output.new_line;
end loop;
end;
-- 模拟2l数l?end
--L"下一个位|?
function go_next (p_helix in t_matrix, p_i in out number, p_j in out number, p_dir in out pls_integer, p_altdir char) return boolean is
--dir_offset constant varchar2(16) := '+0+1-1+0+0-1+1+0'; -- i,j offset in each direction
dir_offset constant varchar2(16) := '-1+1-1-1+1-1+1+1'; -- i,j offset in each direction
ii number;
jj number;
times pls_integer := 0;
begin
loop
ii := p_i + substr(dir_offset, p_dir * 4 + 1, 2);
jj := p_j + substr(dir_offset, p_dir * 4 + 2 + 1, 2);
times := times + 1;
exit when(ii between 1 and p_helix.count / p_helix(0) and jj between 1 and p_helix(0) and
get_val(p_helix, ii, jj) is null);
if times >= 4 then
return false;
end if;
if p_altdir = 'L' then
-- turn left
p_dir := mod(p_dir + 1, 4);
elsif p_altdir = 'R' then
-- turn right
p_dir := mod(p_dir + 3, 4);
end if;
end loop;
p_i := ii;
p_j := jj;
return true;
end;
--begin of draw_helix
begin
v_helix := new_matrix(M, N);
for x in 1 .. M*N loop
if asc_order then
element := x;
else
element := M*N - x + 1;
end if;
set_val(v_helix, i, j, element);
exit when not go_next(v_helix, i, j, direction, screw_dir);
end loop;
print_matrix(v_helix);
dbms_output.new_line;
end;
--begin of main
begin
draw_helix(9, 9, 1, 5, 3, 'R', true);
end;
1
16 2
15 17 3
14 24 18 4
13 23 25 19 5
12 22 20 6
11 21 7
10 8
9
---
XML文g
<?xml version="1.0" encoding="gb2312"?> java代码
import java.io.*;
public class SAXHandler extends HandlerBase { private String currentElement = null; private String currentValue = null;
public void setTable(Hashtable table) {
public Hashtable getTable() {
public void startElement(String tag, AttributeList attrs) throws SAXException {
public void characters(char[] ch, int start, int length) throws SAXException {
public void endElement(String name) throws SAXException {
jsp文g <HTML> <HEAD> <TITLE>剖析XML文gpeople.xml</TITLE> </HEAD> <BODY> <%@ page errorPage="ErrPage.jsp" contentType="text/html;charset=GB2312" %> <%@ page import="java.io.*" %> <%@ page import="java.util.Hashtable" %> <%@ page import="org.w3c.dom.*" %> <%@ page import="org.xml.sax.*" %> <%@ page import="javax.xml.parsers.SAXParserFactory" %> <%@ page import="javax.xml.parsers.SAXParser" %>
<% Parser parser; SAXParserFactory spf = SAXParserFactory.newInstance(); SAXParser sp = spf.newSAXParser(); com.test.SAXHandler handler = new com.test.SAXHandler .SAXHandler();
sp.parse(new InputSource(reader), handler); Hashtable hashTable = handler.getTable(); out.println("<TABLE BORDER=2><CAPTION>教师信息?lt;/CAPTION>"); out.println("<TR><TD>姓名</TD>" + "<TD>" + (String)hashTable.get(new String("name")) + "</TD></TR>"); out.println("<TR><TD>学院</TD>" + "<TD>" + (String)hashTable.get(new String("college"))+"</TD></TR>"); out.println("<TR><TD>电话</TD>" + "<TD>" + (String)hashTable.get(new String("telephone")) + "</TD></TR>"); out.println("<TR><TD>备注</TD>" + "<TD>" + (String)hashTable.get(new String("notes")) + "</TD></TR>"); out.println("</TABLE>"); %> </BODY> </HTML>
|
数据q移Q从mysql3.1q移到oralce10GQ?/strong>
ssuupv 发表?2006-3-2 15:29:00 |
|
|
转自:http://www.javaresearch.org JAVA Research
摘要:
在这文章里Q对于Spring XML的配|,我将向你展示12U比较好的实c其中的一些实践不仅是好的实践Q更是必要的实践。除此以外,q有其他因素Q例如领域模型的设计Q都能媄响XML的配|,但是q篇文章重点研究XML配置的易L和易管理性?br />
Spring是一个强大的JAVA应用框架Q广泛地应用于JAVA的应用程序。ؓPlain Old Java ObjectsQPOJOsQ提供企业服务。Spring利用依赖注入机制来简化工作,同时提高易测性。Spring beans及依赖,以及beanscL需的服务都在配|文件中q行了详l的说明Q这个配|文件是典型的XML格式。但是它既冗长又不实用。对于需要定义大量Spring beans的大工程来说Q我们难以阅d理它?br />
版权声明QQ何获得Matrix授权的网站,转蝲时请务必保留以下作者信息和链接
作?Jason;Li;evenbetter(作者的blog:http://blog.matrix.org.cn/page/evenbetter)
原文:http://www.onjava.com/pub/a/onjava/2006/01/25/spring-xml-configuration-best-practices.html
译文:http://www.matrix.org.cn/resource/article/44/44236_Spring+XML+Configurations.html
关键?Spring;XML;Configurations
在这文章里Q对于Spring XML的配|,我将向你展示12U比较好的实c其中的一些实践不仅是好的实践Q更是必要的实践。除此以外,q有其他因素Q例如领域模型的设计Q都能媄响XML的配|,但是q篇文章重点研究XML配置的易L和易管理性?br />
1。不要用autowiring
Spring 可以通过cȝ自省来自动绑定其依赖部分Q得你不必明确指明bean的属性和构造器。Bean的属性可以通过属性名U或cd匚w来实现自动绑定。构造器通过cd匚w来实现自动绑定。你甚至可以指定自动自动绑定模式,它可以引导Spring选择一U适当的运行机制。先来看看下面的一个例子:
<bean id="orderService"
class="com.lizjason.spring.OrderService"
autowire="byName"/>
OrderService cȝ属性名在容器中用于匚wbean实例。自动绑定可以潜在地节省一些打字和减少一些乱。但是在现实世界的工E里你不应该使用q种方式Q这是因为它牺牲了配|的清晰性和可维护性。许多指南和介绍中大量吹捧自动绑定是Spring的一U极好的特征而没有提到这一Ҏ所带来的牺牌Ӏ依我的观点Q这像 Spring中的objectQpoolingQ它更像是一Uؓ了占据更多市场的商业特征。它对于XML配置文g的小巧化是一个好办法Q但实际上也增加了复杂程度,其当你q行有大量类声明的工E时。虽然Spring允许你合自动绑定和手动l定Q但是这个矛盾会使XML配置更加晦ӆ难懂?br />
2.使用通俗的命?br />
q个方式对于Java~码也一样适用。在工程中用清晰的、描q性的、协调的通俗名称对于开发者理解XML配置是十分有益的。例如对于bean IDQ你可以Ҏ通俗的Javacd来命名它。对于例子中OrderServiceDAO的bean ID命名为orderServiceDAO。对于大的工E,你可以在bean ID前面加上包名作ؓ前缀?br />
3. 使用z的形式
zŞ式避免了冗长Q是因ؓ它从子元素中属性值和参考写到属性中。例如下面的例子Q?br />
<bean id="orderService"
class="com.lizjason.spring.OrderService">
<property name="companyName">
<value>lizjason</value>
</property>
<constructor-arg>
<ref bean="orderDAO">
</constructor-arg>
</bean>
可以使用zŞ式将上述代码重写为:
<bean id="orderService"
class="com.lizjason.spring.OrderService">
<property name="companyName"
value="/lizjason"/>
<constructor-arg ref="orderDAO"/>
</bean>
zŞ式功能在1.2版本中可以用。对?lt;ref local="...">没有zŞ式?br />zŞ式不但可以节U你的打字,而且可以使XML配置文g清晰。它最引h注目的是当在一个配|文件中有大量定义的cL可以提高易读性?br />
4. 对于构造器参数匚wQ类型名比序号好?br />
当一个构造器含有一个以上的同种cd的参敎ͼ或者属性值的标签已经被占用时QSpring允许你用从0计数的序h解决q些会带来淆的问题。例如:
<bean id="billingService"
class="com.lizjason.spring.BillingService">
<constructor-arg index="0" value="lizjason"/>
<constructor-arg index="1" value="100"/>
</bean>
像下面这P利用cd属性来~写会更好一些:
<bean id="billingService"
class="com.lizjason.spring.BillingService">
<constructor-arg type="java.lang.String"
value="lizjason"/>
<constructor-arg type="int" value="100"/>
</bean>
使用索引可以E稍减少一些冗长,但是和用类型属性相比,它还是有Ҏ发生错误的們和难于阅ȝ~点。你应该只在构造器参数不明的时候,才用烦引这一Ҏ?br />
5. 可能重用已定义q的bean
Spring 提供一U类似承一L机制来减配|信息的复制q简化XML配置。定义一个子cd以从它父c那里扉K|信息,而父cd质上作ؓ子类的一个模ѝ这是大工E中所谓的重用。你所需要做的就是在父类bean中设|abstract=trueQ然后在子bean注明它自q父类bean。例如:
<bean id="abstractService" abstract="true"
class="com.lizjason.spring.AbstractService">
<property name="companyName"
value="lizjason"/>
</bean>
<bean id="shippingService"
parent="abstractService"
class="com.lizjason.spring.ShippingService">
<property name="shippedBy" value="lizjason"/>
</bean>
ShippingServicecMabstractServicec那里承companyName属性的??lizjason。如果你没有Z个bean指明cLfactoryҎQ那么这个bean便是抽象的?br />
6. 量使用ApplicationContext来装配定义的bean
像在Ant脚本中的引用一PSpring的引用对于装配模块化的bean来说是很有用的。例如:
<beans>
<import resource="billingServices.xml"/>
<import resource="shippingServices.xml"/>
<bean id="orderService"
class="com.lizjason.spring.OrderService"/>
<beans>
相对于用import在XML配置中来预装配,通过ApplicationContext来配|这些beansQ显得更加灵zR利用 ApplicationContext也得XML配置易于理。你可以像下面的例子那样在ApplictionContext构造器里布|beanQ?br />
String[] serviceResources =
{"orderServices.xml",
"billingServices.xml",
"shippingServices.xml"};
ApplicationContext orderServiceContext = new
ClassPathXmlApplicationContext(serviceResources);
7. 利用id作ؓbean的标识符
你可以指定一个id或名U来作ؓbean的标识符。虽然用id不会提高易读性,但是它可以让XML parser对bean的引用有效方面进行更好的验证。如果由于XML IDREF的限制而不能用某个idQ你可以利用names来作为bean的标识符。XML IDREF的限制是id必须以字母开_或者在XML规范中定义的标点W号Q,后面接着字母Q数字,q字P下划U,冒号{。实际上Q遇到XML IDREF限制的问题是很少见的?br />
8. 在开发阶D用依赖检?br />
你可以在bean中给依赖验的属性设||而不采用原先默认的空|属性设|例如simpleQobject或allQ以便容器进行依赖检验。当bean的全部的属性(或某cd性)需要被明确讄或自动绑定时Q依赖检验便昑־很有用?br />
<bean id="orderService"
class="com.lizjason.spring.OrderService"
dependency-check="objects">
<property name="companyName"
value="lizjason"/>
<constructor-arg ref="orderDAO"/>
</bean>
在这个例子里Q容器确保ؓorderService bean讄的属性不是primitives 或者 collections。ؓ所有的bean讄默认依赖也是可以的Q但是我们很这样做Q是因ؓ有些bean的属性根本就不必讄?br />
9. 为每个配|文件加上一个header comment
最好用descriptive id和名U来代替在XML配置文g中的注释。此外,加上一个配|文件header也很有用处,它可以概q文件中所定义的bean。你可以选择描q内容加入description标签中。例如:
<beans>
<description>
This file defines billing service
related beans and it depends on
baseServices.xml,which provides
service bean templates...
</description>
...
</beans>
使用description标签的一个好处是可以Ҏ地利用工具从标签中选取出descriptionQ的内容Q?br />
10. 对于M变化Q要与队友积极交?br />当你重构Java代码Ӟ你需要随时更新配|文件ƈ且通知队友。XML配置文g也是代码Q它们是应用E序的至关重要的部分Q但是它们难于阅dl护。大部分旉你既要阅读XML配置文g又要阅读q行中的Java代码?br />
11. Setter injection优于constructor injection
Spring提供3U类型的依赖注入Q constructor injection,setter injection, 和method injection。我们一般只用前两种cd?br />
<bean id="orderService"
class="com.lizjason.spring.OrderService">
<constructor-arg ref="orderDAO"/>
</bean>
<bean id="billingService"
class="com.lizjason.spring.BillingService">
<property name="billingDAO"
ref="billingDAO">
</bean>
q个例子中,orderServicecM用的是constructor injectionQ而BillingServicecM用的是setter injection。constructor injection可以保bean不会在一个非法状态下被创建,但是setter injection更加灉|q且更易理Q尤其当cd在很多属性ƈ且其中一些是可选的情况下?br />
12. 不要滥用依赖注入
作ؓ最后一点,Spring ApplicationContext可以替你创徏Java对象Q但是ƈ不是所有的Java对象都通过依赖注入来创建的。例如,全局的对象不应该通过 ApplicationContext来创建。Spring是一个很的框架Q但是,易L和易管理性而言Q当定义大量bean的时候,ZXML的配|问题就会突出。过度的依赖注入会XML配置变得复杂而且臃肿。记住!使用强大的IDEӞ例如Eclipse和IntelliJQ与XML文g相比Q Java代码更加易读Q易l护Q易理?br />
ȝ
对于Spring的配|,XML是很优秀的方式。但当定义大量 beanӞZXML配置会变得冗长,W拙。Spring提供了丰富的配置选项。适当地利用其中的选项可以使XML配置清晰Q但是,有些选项Q例如 autowiringQ自动绑定)Q往往会降低易L和易维护性。文章中所列D的实例,可以帮助你创建出清晰易读的XML配置文g?
· 雅虎公司C#W试题,看看你能解答多少? (? | |
雅虎公司C#W试题,包括问答题和选择题两部分。试试看Q你能回{出多少题,可以通过雅虎的考试吗?
Question 1. (单? 在计机|络?表征数据传输可靠性的指标?br /> 1. 传输?br /> 2. 误码?br /> 3. 信息定w 4. 频带利用?br /> Question 2. (单? 以下关于铑ּ存储l构的叙qC哪一条是不正的? 1. l点除自w信息外q包括指针域,因此存储密度于序存储l构 2. 逻辑上相ȝl点物理上不必邻?br /> 3. 可以通过计算直接定Wi个结点的存储地址 4. 插入、删除运操作方?不必Udl点 Question 3. (单? 以下哪一个不是栈的基本运?br /> 1. 删除栈顶元素 2. 删除栈底元素 3. 判断栈是否ؓI?br /> 4. 栈|ؓI栈 Question 4. (单? 以下关于q义表的叙述?正确的是 1. q义表是0个或多个单元素或子表l成的有限序?br /> 2. q义表至有一个元素是子表 3. q义表不可以是自w的子表 4. q义表不能ؓI Question 5. (单? 如果一二*树结点的前序序列是A、B、C,后序序列是C、B、A,则该?树结点的对称序序?br /> 1. 必ؓA、B、C 2. 必ؓA、C、B 3. 必ؓB、C、A 4. 不能定 Question 6. (单? 在虚拟页式存储管理方案中,下面哪一部分完成页面调入内存的工作? 1. ~页中断处理 2. 面淘汰q程 3. 工作集模型应?br /> 4. 紧羃技术利?br /> Question 7. (单? 在DOSpȝ?用于记录和管理磁盘数据区使用情况的数据结?br /> 1. 位图?br /> 2. I闲块表 3. 文g分配?br /> 4. 文g控制?br /> Question 8. (单? 设有关系R(S,D,M),其函C赖集F={S→D,D→M}。则关系R臛_满 1. 1NF 2. 2NF 3. 3NF 4. BCNF Question 9. (单? 在数据库逻辑设计?当将E-R图{换ؓ关系模式?下面的做法哪一个是不正的? 1. 一个实体类型{换ؓ一个关pL?br /> 2. 一个联pȝ型{换ؓ一个关pL?br /> 3. 由实体类型{换成的关pL式的主键是该实体cd的主?br /> 4. ppȝ型{换成的关pL式的属性是与该联系cd相关的诸实体cd的属性的全体 Question 10. (单? 计算机网l按照所覆盖的地理范围分c?可以分广域网、局域网?br /> 1. TCP/IP|?br /> 2. ATM|?br /> 3. ISDN 4. 城域|?br /> Question 11. (单? 计算机网l拓扑结构主要取决于它的 1. 资源子网 2. FDDI|?br /> 3. 通信子网 4. 路由?br /> Question 12. (单? |络协议的三个要素是语法、语义与 1. 工作原理 2. 时序 3. q程 4. 服务原语 Question 13. (单? TCP/IP参考模型中,电子邮g协议SMTP依赖于传输层?br /> 1. UDP协议 2. IP协议 3. TCP协议 4. 802.2协议 Question 14. (单? IEEE802.2协议?0BASE-T标准规定在?cdl线?从网卡到集线器的最大距Mؓ 1. 100m 2. 185m 3. 300m 4. 500m Question 15. (单? 100Mbps Fast Ethernet?0Mbps Ethernet 工作原理的相同之处主要在 1. 介质讉K控制Ҏ 2. 物理层协?br /> 3. |络?br /> 4. 发送时钟周?br /> Question 16. (单? 在Client/Server计算模式?中间件middleware的作用是隔离应用?br /> 1. l构化查询语aSQL 2. 应用q程 3. |络 4. IP地址 Question 17. (单? 当用户向ISP甌Internet帐户?用户的E-mail帐户应包?br /> 1. IP地址 2. WWW地址 3. 用户密码(Password) 4. 用户?User Name)与用户密?Password) Question 18. (单? WWW的超链接中定位信息所在的位置使用的是 1. 文?hypertext)技?br /> 2. l一资源定位?URL, Uniform Resource Locators) 3. 媒?hypermedia技? 4. 文本标注语aHTML Question 19. (单? 计算机网l系l与分布式系l之间的区别主要?br /> 1. pȝ物理l构 2. pȝ高层软g 3. 传输介质cd 4. 服务器类?br /> Question 20. (单? 帧中l系l设计的主要目标是用于互q多?br /> 1. q域|?br /> 2. 电话|?br /> 3. 局域网 4. 0)ATIM|?br /> Question 21. (单? ATM|络采用固定长厦的信元传送数据,信元长度?br /> 1. 1024B 2. 53B 3. 128B 4. 64B Question 22. (单? TCP/IP参考模型中的主?|络层对应于OSI RM中的 1. |络?br /> 2. 物理?br /> 3. 数据链\?br /> 4. 物理层与数据链\?br /> Question 23. (单? 计算机网l最H出的优ҎQ?br /> 1. 计算_ֺ?br /> 2. 内存定w?br /> 3. q算速度?br /> 4. q网的计机能够怺׃n资源 Question 24. (单? 计算机网l分为局域网、城域网与广域网Q其划分的依据是Q?br /> 1. 数据传输所使用的介?br /> 2. |络的作用范?br /> 3. |络的控制方?br /> 4. |络的拓扑结?br /> Question 25. (单? 用二分法查找一个长度ؓ10的、排好序的线性表Q查找不成功Ӟ最多需要比较多次Q?br /> 1. 5 2. 2 3. 4 4. 1 Question 31. (单? ҎU程安全的相关知识,分析以下代码Q当调用testҎ时i>10时是否会引v死锁? public void test(int i) { lock(this) { if (i>10) { i--; test(i); } } } 1. 会锁?br /> 2. 不会锁死 Question 32. (单? 以下描述错误的是Q) 1. 在C++中支持抽象类而在C#中不支持抽象cR?br /> 2. C++中可在头文g中声明类的成员而在CPP文g中定义类的成员,在C#中没有头文gq且在同一处声明和定义cȝ成员?br /> 3. 在C#中可使用 new 修饰W显式隐藏从基类l承的成员?br /> 4. 在C#中要在派生类中重新定义基cȝ虚函数必d前面加Override?br /> Question 33. (单? int[][] myArray3=new int[3][]{new int[3]{5,6,2},new int[5]{6,9,7,8,3},new int[2]{3,2}}; myArray3[2][2]的值是Q)?br /> 1. 9 2. 2 3. 6 4. 界 Question 34. (单? 在C#中利用Socketq行|络通信~程的一般步骤是Q徏立Socket侦听、( Q、利用Socket接收和发送数据?br /> 1. 建立Socketq接 2. 获得端口P 3. 获得IP地址Q?br /> 4. 获得L名; Question 35. (单? 如果设treeView1=new TreeView(),TreeNode node=new TreeNode("根结? )Q则treeView1.Nodes.Add(node)q回的是一?()cd的倹{?br /> 1. TreeNodeQ?br /> 2. intQ?br /> 3. stringQ?br /> 4. TreeViewQ?br /> Question 36. (单? 声明一个委托public delegate int myCallBack(int x); 则用该委托生的回调Ҏ的原型应该是 1. void myCallBack(int x) 2. int receive(int num) 3. string receive(int x) 4. 不确定的 Question 37. (单? 关于ASP.NET中的代码隐藏文g的描q正的?br /> 1. WebH体늚E序的逻辑׃码组成,q些代码的创建用于与H体交互。编E逻辑唯一与用L面不同的文g中。该文gUC为“代码隐藏”文Ӟ如果用CQ创建,该文?br /> 2. 目中所有WebH体늚代码隐藏文g都被~译?EXE文g 3. 目中所有的WebH体늚代码隐藏文g都被~译成项目动态链接库Q?dllQ文?br /> 4. 以上都不正确 Question 38. (单? What compiler switch creates an xml file from the xml comments in the files in an assembly? 1. /text 2. /doc 3. /xml 4. /help Question 39. (单? 下面的代码实C设计模式中的什么模?br /> public class A { private A instance; private A() { } public static A Instance { get { if ( A == null ) A = new A(); return instance; } } } 1. Factory 2. Abstract Factory 3. Singleton 4. Builder Question 40. (单? class Class1 { public static int Count = 0; static Class1() { Count++; } public Class1() { Count++; } } Class1 o1 = new Class1(); Class1 o2 = new Class1(); 请问QClass1.Count的值是多少Q? ) 1. 1 2. 2 3. 3 4. 4 Question 26. (单? 模块内聚度越高,说明模块内各成分彼此l合的程度越 1. 松散 2. 紧密 3. 无法判断 4. 相同 Question 27. (单? 软g需求分析阶D늚输出主要?br /> 1. 需求说明书 2. 开发计?br /> 3. 可行性报?br /> 4. 设计说明?br /> Question 28. (单? 以下选项中不是项目经理的职责的是Q?br /> 1. 需求分?br /> 2. 计划 3. 计划跟踪 4. 质量理 Question 29. (单? 单元试一般在什么时候进行? 1. ~码完成?br /> 2. pȝ试?br /> 3. 试用例~写完成?br /> 4. 集成试?br /> Question 30. (多? 配置理能vC下哪些作用? 1. 版本理 2. 变更理 3. 需求管?br /> 4. 试理 Question 41. (单? abstract class BaseClass { public virtual void MethodA() { Console.WriteLine("BaseClass"); } public virtual void MethodB() { } } class Class1: BaseClass { public void MethodA() { Console.WriteLine("Class1"); } public override void MethodB() { } } class Class2: Class1 { new public void MethodB() { } } class MainClass { public static void Main(string[] args) { Class2 o = new Class2(); o.MethodA(); } } 请问Q此E序输出l果? 1. BaseClass 2. BassClass Class1 3. Class1 4. Class1 BassClass Question 42. (单? public static void Main(string[] args) { int i = 2000; object o = i; i = 2001; int j =(int) o; Console.WriteLine("i={0},o={1}, j={2}",i,o,j); } 1. i=2001,o=2000,j=2000 2. i=2001,o=2001,,j=2001 3. i=2000,o=2001,,j=2000 4. i=2001,o=2000,j=2001 Question 43. (多? 您要创徏ASP.NET应用E序用于q行AllWin公司内部的Web站点Q这个应用程序包含了50个页面。您惌配置q个应用E序以便当发生一个HTTP代码错误时它可以昄一个自定义的错误页面给用户。您惌花最的代h完成q些目标Q您应该怎么做?(多? 1. 在这个应用程序的Global.asax文g中创Z个Application_Errorq程d理ASP.NET代码错误?br /> 2. 在这个应用程序的Web.config文g中创Z个applicationError节去处理ASP.NET代码错误?br /> 3. 在这个应用程序的Global.asax文g中创Z个CustomErrors事gd理HTTP错误?br /> 4. 在这个应用程序的Web.config文g中创Z个CustomErrors节去处理HTTP错误?br /> Question 44. (单? 如下E序的运行结果是Q?br /> public abstract class A { public A() { Console.WriteLine('A'); } public virtual void Fun() { Console.WriteLine("A.Fun()"); } } public class B: A { public B() { Console.WriteLine('B'); } public new void Fun() { Console.WriteLine("B.Fun()"); } public static void Main() { A a = new B(); a.Fun(); } } 1. A B A.Fun() 2. A B B.Fun() 3. B A A.Fun() 4. B A B.Fun() Question 45. (单? Which of these string definitions will prevent escaping on backslashes in C#?* 1. string s = #”n Test string? 2. string s = “’n Test string? 3. string s = @”n Test string? 4. string s = “n Test string? Question 46. (单? Which of the following operations can you NOT perform on an ADO.NET DataSet? 1. A DataSet can be synchronised with a RecordSet. 2. A DataSet can be synchronised with the database. 3. A DataSet can be converted to XML. 4. You can infer the schema from a DataSet Question 47. (单? In Object Oriented Programming, how would you describe encapsulation? 1. The conversion of one type of object to another. 2. The runtime resolution of method calls. 3. The exposition of data. 4. The separation of interface and implementation. Question 48. (单? How does assembly versioning in .NET prevent DLL Hell? 1. The runtime checks to see that only one version of an assembly is on the machine at any one time. 2. .NET allows assemblies to specify the name AND the version of any assemblies they need to run. 3. The compiler offers compile time checking for backward compatibility. 4. It doesn’t. Question 49. (单? 三种常用的字W串判空串方法: 1: bool isEmpty = (str.Length == 0); 2: bool isEmpty = (str == String.Empty); 3: bool isEmpty = (str == ""); 哪种Ҏ最快? 1. 1 2. 2 3. 3 Question 50. (单? public sealed class SampleSingleton1 { private int m_Counter = 0; private SampleSingleton1() { Console.WriteLine(""初始化SampleSingleton1?"); } public static readonly SampleSingleton1 Singleton = new SampleSingleton1(); public void Counter() { m_Counter ++; } } 以上代码实现了设计模式中的哪U模式? 1. 原型 2. 抽象工厂 3. 单键 4. 生成? |
|
1。有识有胆,有胆有识Q知识与胆量是互怿q的?
2。体育锻炼可?有时可以q?使h乐观(U学实验证明)?
3。勤奋,ZQ乐观是成功的三要素?注意Q传l观念认为勤奋和Z是成功的要素Q但是经q统计学和成功h士的分析得出Q乐观是成功的第三要?
4。自信是人格的核心?
5。获得的成功大Q就o人高兴?野心是人勤奋的原因Q节制人枯?
6。热׃所拥有的。——列夫h斯?
7?一般情况下)不想三年以后的事Q只想现在的事?现在有成,以后才能更辉?
8。把问题看宽q些Q没有解决不了的事?真理路广QhƲ\H;当然不要越时代L现在M人都解决不了的事)
9。不问收P只问耕耘?如同U树Q先有根茎,再有枝叶Q尔后花实,好好力_Q不要想太多Q那样只会、懒惎ͼ因ؓ不实践,甚至不接触社会,N你是野hQ!(暴笑))
10。忍耐和信Ԓ(邓小qp三v三落的原因,比较难达刎ͼ不过CC会单的事都由机器做了,白领来多Q需要注意哦)
11。有恒则断无不成之事?
12。智慧之泉必ȝ饮才能人清醒?引自新英语教材,那些头痛p的哥么大概没看吧Q提醒一下大?
13。生zȝ乐趣的大取决于我们对生zȝ兛_E度?
14。不要怕,不要?虽然只有六个字,但是常看常新)
15。机遇对于有准备的头脑有特别的亲和力?
16。守业最好的办法是不断的发?
17。心急吃不了热汤?
18。必d生,q生则死——《吴子兵法?武经典籍中仅ơ于《孙子兵法?
19。要改变命运Q首先改变自?
20。走自己的\Q让别h说去吧!
21。学习的关键——重?
22。只为成功找ҎQ不为失败找借口(y脚的工人L说工具不?
23。困隑ְ是机遇——温斯顿·丘吉?
24。我奋斗Q所以我快乐——格林斯?挽救东南亚金融危机的人,我的偶像)
25。好奇者,知识之门
26。生气是用别人的错误惩罚自己。——康?q个哲学家让人眉开眼笑)
27。失去金q人损q,失去健康的h损失极多Q失d气的人损׃切?
28。只要下定决心克服恐惧,便几乎能克服M恐惧。因为,误住,除了在脑中Q恐惧无处藏w。——戴·卡耐基
29。害怕时Q把心思放在必d的事情上Q如果曾l彻底准备,便不会害怕。——戴·卡耐基
30。“不可能”这个字(法语是一个字)Q只在愚人的字典中找得到。——拿破仑
31。去做你x的事,x自然就会消失。——罗夫·华多L默生
32。这世上的一切都借希望而完成。农夫不会播下一_玉cI如果他不曑ָ望它长成U籽Q单w汉不会娶妻Q如果他不曾希望有小孩;商h或手Zh不会工作Q如果他不曾希望因此而有收益。——马丁¯\?
33。目标的坚定是性格中最必要的力量泉源之一Q也是成功的利器之一。没有它Q天才也会在矛盾无定的迷径中Q徒x功。——查士d斐尔爵士
34。要冒一ơ险Q整个生命就是一场冒险。走得最q的人,常是愿意dQƈ愿意d险的人。“稳妥”之船,从未能从岸边走远。——戴·卡耐基
35。当一个青qh站v来面对这个大莽汉——这个世界——ƈ勇敢地抓住他的胡LQ常会吃惊地发现Q胡脱落在他手上,原来它只是系上去吓唬胆怯的冒险者的。——罗夫·华多L默生
36。勇气很有理p当作人类h之首,因ؓq种h保证了所有其余的h。——温斯顿·丘吉?
Trackback: http://tb.blog.csdn.net/TrackBack.aspx?PostId=337069