??xml version="1.0" encoding="utf-8" standalone="yes"?>天堂中文资源在线,成人午夜电影在线观看,国产精品视频免费一区http://www.aygfsteel.com/xxllnnn/so.javazh-cnFri, 20 Jun 2025 01:42:28 GMTFri, 20 Jun 2025 01:42:28 GMT60maven?/title><link>http://www.aygfsteel.com/xxllnnn/archive/2009/07/24/288143.html</link><dc:creator>so.java</dc:creator><author>so.java</author><pubDate>Fri, 24 Jul 2009 01:27:00 GMT</pubDate><guid>http://www.aygfsteel.com/xxllnnn/archive/2009/07/24/288143.html</guid><wfw:comment>http://www.aygfsteel.com/xxllnnn/comments/288143.html</wfw:comment><comments>http://www.aygfsteel.com/xxllnnn/archive/2009/07/24/288143.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/xxllnnn/comments/commentRss/288143.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/xxllnnn/services/trackbacks/288143.html</trackback:ping><description><![CDATA[     摘要: Maven Maven?Maven最初的目的是在Jakarta Turbine目中构徏处理单化。几个项目之间用到的Ant build文g差异很小Q各个JAR都存入CVS。因此希望有一个标准的Ҏ构徏各个工程Q清晰的定义一个工E的l成Q一个容易的Ҏd布项目信息ƈ且去提供一U在各个目之间׃nJAR包?l果出现了一U功能能用于构徏和管理Q何基于java的工E。Maven组希望...  <a href='http://www.aygfsteel.com/xxllnnn/archive/2009/07/24/288143.html'>阅读全文</a><img src ="http://www.aygfsteel.com/xxllnnn/aggbug/288143.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/xxllnnn/" target="_blank">so.java</a> 2009-07-24 09:27 <a href="http://www.aygfsteel.com/xxllnnn/archive/2009/07/24/288143.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>VBA语法概述(zt)http://www.aygfsteel.com/xxllnnn/archive/2009/02/18/255237.htmlso.javaso.javaWed, 18 Feb 2009 03:55:00 GMThttp://www.aygfsteel.com/xxllnnn/archive/2009/02/18/255237.htmlhttp://www.aygfsteel.com/xxllnnn/comments/255237.htmlhttp://www.aygfsteel.com/xxllnnn/archive/2009/02/18/255237.html#Feedback2http://www.aygfsteel.com/xxllnnn/comments/commentRss/255237.htmlhttp://www.aygfsteel.com/xxllnnn/services/trackbacks/255237.html

VBA语法概述

 

1Q标识符:是一U标识变量、常量、过E、函数、类{语a构成单位的符P利用它可以完成对变量、常量、过E、函数、类{的引用。命名规则如下: A, 字母打头Q由字母、数字和下划U组成,?A987b_23Abc B, 字符长度于40Q(Excel2002以上中文版等Q可以用汉字且长度可?54个字W) C, 不能与VB保留字重名,如public, private, dim, goto, next, with, integer, single{?/p>

 

2,q算W?是代表VB某种q算功能的符受?/p>

 

A, 赋D符 =

 

B, 数学q算W?&? (字符q接W??(??Q减Q、ModQ取余)、\Q整除)?Q乘Q?Q除Q?Q负P、^Q指敎ͼ

 

C, 逻辑q算WNotQ非Q、AndQ与Q、OrQ或Q、XorQ异或)、EqvQ相{)、ImpQ隐含)

 

D, 关系q算W?= Q相同)?lt;>Q不{)?gt;Q大于)?lt;Q小于)?gt;=Q不于Q?lt;=Q不大于Q、Like、Is

 

E, 位运符 NotQ逻辑非)、AndQ逻辑与)、OrQ逻辑或)、XorQ逻辑异或Q、EqvQ逻辑{)、ImpQ隐含)

 

3,数据cd:VBA共有12U数据类型,具体见下表,此外用户q可以根据以下类型用Type自定义数据类型?/p>

 

数据cd cd标识W?/td> 字节
字符串型 String $ 字符长度(0-65400)
字节?Byte ?/td> 1
布尔?Boolean ?/td> 2
整数?Integer % 2
长整数型 Long & 4
单精度型 Single ! 4
双精度型 Double # 8
日期?Date ?/td> 8 公元100/1/1-9999/12/31
货币?Currency @ 8
数点型 Decimal ?/td> 14
变体?Variant ?/td> 以上LcdQ可?/td>
对象?Object ?/td> 4

 

4, 变量与常?

 

1QVBA允许使用未定义的变量Q默认是变体变量Variant?/p>

 

2Q在模块通用说明部䆾Q加?Option Explicit 语句可以用户q行变量定义?/p>

 

3Q变量定义语句及变量作用?/p>

Dim 变量 as cd   '定义为局部变量,?Dim  xyz as integer
Private        变量 as cd   '定义为私有变量,?Private         xyz as byte
Public        变量 as cd   '定义为公有变量,?Public         xyz as single
Global         变量 as cd   '定义为全局变量Q如 Globlal         xyz as date
Static        变量 as cd   '定义为静态变量,?Static  xyz as double

一般变量作用域的原则是Q那部䆾定义在那部份v作用Q模块中定义则在该模块那作用?/p>

 

4Q常量ؓ变量的一U特例,用Const定义Q且定义时赋|E序中不能改变|作用域也如同变量作用域。如下定义:Const Pi=3.1415926 as single

 

5,数组:是包含相同数据类型的一l变量的集合Q对数组中的单个变量引用通过数组索引下标q行。在内存中表Cؓ一个连l的内存块,必须用Global或Dim语句来定义。定义规则如下: Dim 数组?[lower to ]upper [, [lower to ]upper, ….]) as type ;Lower~省gؓ0。二l数l是按行列排列,如XYZ(行,??/p>

 

除了以上固定数组外,VBAq有一U功能强大的动态数l,定义时无大小l数声明Q在E序中再利用Redim语句来重新改变数l大,原来数组内容可以通过加preserve关键字来保留。如下例Q?Dim array1() as double : Redim array1(5) : array1(3)=250 : Redim preserve array1(5,10)

 

6,注释和赋D?/p>

 

1Q注释语句是用来说明E序中某些语句的功能和作用;VBA中有两种Ҏ标识为注释语句?/p>

 

ü 单引?’ ;如:’定义全局变量Q可以位于别的语句之,也可单独一?/p>

 

ü Rem ;如:Rem定义全局变量Q只能单独一?/p>

 

2Q赋D句是q行对变量或对象属性赋值的语句Q采用赋值号 =Q如X=123QForm1.caption=”我的H口”。对对象的赋值采用:set myobject=object ?myobject:=object

 

7,书写规范:

 

1QVBA不区分标识符的字母大写Q一律认为是写字母Q?/p>

 

2Q一行可以书写多条语句,各语句之间以冒号 : 分开Q?/p>

 

3Q一条语句可以多行书写,以空格加下划U?_ 来标识下行ؓl行Q?/p>

 

4Q标识符最好能z明了,不造成歧义?/p>

 

8,判断语句

 

1QIf…Then…Else语句

If condition Then [statements][Else elsestatements]
?QIf A>B And C<D Then A=B+2 Else A=C+2
?QIf x>250 Then x=x-100
或者,可以使用块Ş式的语法Q?
If condition Then
[statements]
[ElseIf condition-n Then
[elseifstatements] ...
[Else
[elsestatements]]
End If
?:
If Number < 10 Then
Digits = 1
ElseIf Number < 100 Then
Digits = 2
Else
Digits = 3
End If

2QSelect Case…Case…End Case语句

?Q?
Select Case Pid
Case “A101”
Price=200
Case “A102”
Price=300
……
Case Else
Price=900
End Case

 

3QChoose 函数Q?choose(index, choce-1,choice-2,…,choice-n)Q可以用来选择自变量串列中的一个|q将其返回,index 必要参数Q数D辑ּ或字D,它的q算l果是一个数|且界?1 和可选择的项目数之间。choice 必要参数QVariant表达式,包含可选择目的其中之一。如Q?GetChoice = Choose(Ind, "Speedy", "United", "Federal")

 

4QSwitch函数Q?Switch(expr-1, value-1[, expr-2, value-2 _ [, expr-n,value-n]]) switch函数和Choose函数cMQ但它是以两个一l的方式q回所要的|在串列中Q最先ؓTRUE的g被返回?expr 必要参数Q要加以计算?Variant 表达式。value 必要参数。如果相关的表达式ؓ TrueQ则q回此部分的数值或表达式,没有一个表辑ּ?TrueQSwitch 会返回一?Null倹{?/p>

 

9,循环语句

 

1QFor Next语句 以指定次数来重复执行一l语?/p>

For counter = start To end [Step step]     ' step ~省gؓ1
[statements]
[Exit For]
[statements]
Next [counter]
?Q?
For Words = 10 To 1 Step -1             ' 建立 10 ơ@?
For Chars = 0 To 9                    ' 建立 10 ơ@?
MyString = MyString & Chars            ' 数字添加到字符串中
Next Chars                            ' Increment counter
MyString = MyString & " "           ' d一个空?
Next Words

2QFor Each…Next语句:主要功能是对一个数l或集合对象q行Q让所有元素重复执行一ơ语?/p>

For Each element In group
Statements
[Exit for]
Statements
Next [element]
?Q?
For Each rang2 In range1
With range2.interior
.colorindex=6
.pattern=xlSolid
End with
Next
q上面一例中用到?With…End With 语句Q目的是省去对象多次调用Q加快速度Q语法ؓQ?
With object
[statements]
End With

3QDo…loop语句 在条件ؓtrueӞ重复执行区块命o

Do {while |until} condition      ' while 为当型@环,until为直到型循环Q顾名思义Q不多说?
Statements
Exit do
Statements
Loop
或者用下面语?
Do                                ' 先do 再判断,即不论如何先q一ơ再?
Statements
Exit do
Statements
Loop {while |until} condition

 

10,其他c语句和错误语句处理

 

A, 其他循环语句:l构化程序用以上判断和循环语句已经_Q徏议不要轻易用下面的语句Q虽然VBAq支持?/p>

 

1)Goto line 该语句ؓ跌{到line语句?/p>

 

2)On expression gosub destinatioinlist 或?on expression goto destinationlist 语句为根?exprssion表达式值来跌{到所要的行号或行标记

 

3)Gosub line…line…Return语句Q?Return q回?Gosub line行,如下例:

Sub gosubtry()
Dim num
Num=inputbox(“输入一个数字,此值将会被判断循环”)
If num>0 then Gosub Routine1 QDebug.print numQExit sub
Routine1:
Num=num/5
Return
End sub

4)while…wend语句Q只要条件ؓTRUEQ@环就执行Q这是以前VB老语法保留下来的Q如下例Q?while condition 'while I<50 [statements] 'I=I+1 wend 'Wend

 

B, 错误语句处理:执行阶段有时会有错误的情况发生,利用On Error语句来处理错误,启动一个错误的处理E序。语法如下:

On Error Goto Line   '当错误发生时Q会立刻转移到line行去
On Error Resume Next     '当错误发生时Q会立刻转移到发生错误的下一行去
On Erro Goto 0                '当错误发生时Q会立刻停止q程中Q何错误处理过E?/pre>

 

11,q程和函?q程是构成程序的一个模块,往往用来完成一个相对独立的功能。过E可以ɽE序更清晰、更L构性。VBAh四种q程QSub q程、Function函数、Property属性过E和Event事gq程?/p>

 

A, Subq程:Sub q程的参数有两种传递方式:按g?ByVal)和按地址传?ByRef)。如下例Q?{{ Sub password (ByVal x as integer, ByRef y as integer) If y=100 then y=x+y else y=x-y x=x+100 End sub

 

Sub call_password () Dim x1 as integer Dim y1 as integer x1=12 y1=100 Call password (x1,y1) ‘调用q程方式Q?. Call q程?参数1, 参数2…) ; 2. q程?参数1, 参数2… debug.print x1,y1 ‘l果?2?12Qy1按地址传递改变了|而x1按g递,未改变原?End sub }}

 

B, Function函数:函数实际是实CU映,它通过一定的映射规则Q完成运ƈq回l果。参C递也两种Q按g?ByVal)和按地址传?ByRef)。如下例Q?/p>

Function password(ByVal x as integer, byref y as integer) as boolean
If y=100 then y=x+y else y=x-y
x=x+100
if y=150 then password=true else password=false
End Function
Sub call_password ()
Dim x1 as integer
Dim y1 as integer
x1=12
y1=100
if password then ‘调用函数Q?. 作ؓ一个表辑ּ攑֜=右端 ; 2. 作ؓ参数使用
debug.print x1
end if
End sub

 

C, Property属性过E和Event事gq程:q是VB在对象功能上d的两个过E,与对象特征密切相养I也是VBA比较重要l成Q技术比较复杂,可以参考相关书c?/p>

 

12,内部函数在VBAE序语言中有许多内置函数Q可以帮助程序代码设计和减少代码的编写工作?/p>

AQ测试函?
IsNumeric(x)                                    ‘是否为数? q回Booleanl果QTrue or False
IsDate(x)                                       ‘是否是日? q回Booleanl果QTrue or False
IsEmptyQxQ?                                  ‘是否为Empty, q回Booleanl果QTrue or False
IsArray(x)                                         ‘指出变量是否Z个数l?
IsError(expression)                                ‘指出表达式是否ؓ一个错误?
IsNull(expression)                                ‘指出表达式是否不包含M有效数据 (Null)?
IsObject(identifier)                                ‘指出标识W是否表C对象变?
BQ数学函?
Sin(X)、Cos(X)、Tan(X)、Atan(x)  三角函数Q单位ؓ弧度
Log(x) q回x的自然对?
Exp(x)q回 ex
Abs(x) q回l对?
Int(number)、Fix(number) 都返回参数的整数部分Q区别:Int ?-8.4 转换?-9Q?Fix ?8.4 转换?-8
Sgn(number) q回一?Variant (Integer)Q指出参数的正负?
Sqr(number) q回一?DoubleQ指定参数的qx?
VarType(varname) q回一?IntegerQ指出变量的子类?
RndQxQ返?-1之间的单_ֺ数据Qx为随机种?
CQ字W串函数
Trim(string)                                 Lstring左右两端I白
Ltrim(string)                                 Lstring左端I白
Rtrim(string)                                 Lstring右端I白
Len(string)                                 计算string长度
Left(string, x)                         取string左段x个字W组成的字符?
Right(string, x)                         取stringxx个字W组成的字符?
Mid(string, start,x)                 取string从start位开始的x个字W组成的字符?
Ucase(string)                                 转换为大?
Lcase(string)                                 转换为小?
Space(x)                                 q回x个空白的字符?
Asc(string)                                 q回一?integerQ代表字W串中首字母的字W代?
Chr(charcode)                                q回 stringQ其中包含有与指定的字符代码相关的字W?
DQ{换函?
CBool(expression)                        转换为Boolean?
CByte(expression)                         转换为Byte?
CCur(expression)                         转换为Currency?
CDate(expression)                         转换为Date?
CDbl(expression)                         转换为Double?
CDec(expression)                         转换为Decemal?
CInt(expression)                         转换为Integer?
CLng(expression)                         转换为Long?
CSng(expression)                         转换为Single?
CStr(expression)                         转换为String?
CVar(expression)                         转换为Variant?
Val(string)                                 转换为数据型
Str(number)                                转换为String
EQ时间函?
Now                    q回一?Variant (Date)Q根据计机pȝ讄的日期和旉来指定日期和旉?
Date                  q回包含pȝ日期?Variant (Date)?
Time            q回一个指明当前系l时间的 Variant (Date)?
Timer                   q回一?SingleQ代表从午夜开始到现在l过的秒数?
TimeSerial(hour, minute, second) q回一?Variant (Date)Q包含具有具体时、分、秒的时间?
DateDiff(interval, date1, date2[, firstdayofweek[, firstweekofyear]])
q回 Variant (Long) 的|表示两个指定日期间的旉间隔数目
Second(time) q回一?Variant (Integer)Q其gؓ 0 ?59 之间的整敎ͼ表示一分钟之中的某个秒
Minute(time) q回一?Variant (Integer)Q其gؓ 0 ?59 之间的整敎ͼ表示一时中的某分?
Hour(time)          q回一?Variant (Integer)Q其gؓ 0 ?23 之间的整敎ͼ表示一天之中的某一钟点
Day(date)         q回一?Variant (Integer)Q其gؓ 1 ?31 之间的整敎ͼ表示一个月中的某一?
Month(date)         q回一?Variant (Integer)Q其gؓ 1 ?12 之间的整敎ͼ表示一q中的某?
Year(date)         q回 Variant (Integer)Q包含表C年份的整数?
Weekday(date, [firstdayofweek]) q回一?Variant (Integer)Q包含一个整敎ͼ代表某个日期是星期几

 

13, 文g操作

 

1Q文?/p>

 

Dir[(pathname[, attributes])] Qpathname 可选参敎ͼ用来指定文g名的字符串表辑ּQ可能包含目录或文g夏V以及驱动器。如果没有找?pathnameQ则会返回零长度字符?("");

 

attributes 可选参数。常数或数D辑ּQ其d用来指定文g属性。如果省略,则会q回匚w pathname 但不包含属性的文g?/p>

 

2Q删?/p>

 

Kill pathname 从磁盘中删除文g, pathname 参数是用来指定一个文件名

 

RmDir pathname 从磁盘中删除删除目录Qpathname 参数是用来指定一个文件夹

 

3Q打开

 

Open pathname For mode [Access access] [lock] As [#]filenumber [Len=reclength] 能够Ҏ件输?输出 (I/O)?/p>

 

pathname 必要。字W串表达式,指定文g名,该文件名可能q包括目录、文件夹及驱动器?/p>

 

mode 必要。关键字Q指定文件方式,?Append、Binary、Input、Output、或 Random 方式。如果未指定方式Q则?Random 讉K方式打开文g?/p>

 

access 可选。关键字Q说明打开的文件可以进行的操作Q有 Read、Write、或 Read Write 操作?/p>

 

lock 可选。关键字Q说明限定于其它q程打开的文件的操作Q有 Shared、Lock Read、Lock Write、和 Lock Read Write 操作?/p>

 

filenumber 必要。一个有效的文gP范围?1 ?511 之间。?FreeFile 函数可得C一个可用的文g受?reclength 可选。小于或{于 32Q?67Q字节)的一个数。对于用随机讉K方式打开的文Ӟ该值就是记录长度。对于顺序文Ӟ该值就是缓冲字W数。说?Ҏ件做M I/O 操作之前都必d打开文g。Open 语句分配一个缓冲区供文件进?I/O 之用Qƈ军_~冲区所使用的访问方式。如?pathname 指定的文件不存在Q那么,在用 Append、Binary、Output、或 Random 方式打开文gӞ可以建立q一文g。如果文件已由其它进E打开Q而且不允许指定的讉KcdQ则 Open 操作p|Q而且会有错误发生。如?mode ?Binary 方式Q则 Len 子句会被忽略掉?/p>

 

重要 ?Binary、Input ?Random 方式下可以用不同的文件号打开同一文gQ而不必先该文g关闭。在 Append ?Output 方式下,如果要用不同的文件号打开同一文gQ则必须在打开文g之前先关闭该文g?/p>

 

4Q读?/p>

 

Input #filenumber, varlist 从已打开的顺序文件中d数据q将数据指定l变?/p>

 

Get [#]filenumber, [recnumber], varname一个已打开的磁盘文件读入一个变量之中?/p>

 

5Q写?/p>

 

Write #filenumber, [outputlist] 数据写入顺序文?/p>

 

Print #filenumber, [outputlist] 格式化昄的数据写入顺序文件中

 

Put [#]filenumber, [recnumber], varname 一个变量的数据写入盘文g中?/p>

 

6Q关?Close [filenumberlist] 关闭 Open 语句所打开的输?输出 (I/O) 文g

 

注意 如果今后想用 Input # 语句d文g的数据,p?Write # 语句而不?Print # 语句数据写入文件。因为在使用 Write # Ӟ数据域分界可保每个数据域的完整性,因此可用 Input # 再将数据d来。?Write # q能保M地区的数据都被正读出。Write ?Print # 语句不同Q当要将数据写入文gӞWrite # 语句会在目和用来标记字W串的引号之间插入逗号。Write # 语句在将 outputlist 中的最后一个字W写入文件后会插入一个新行字W,卛_车换行符Q?Chr(13) + Chr(10))?/p>

 

7Q其他文件函?LOF(filenumber) q回一?LongQ表C用 Open 语句打开的文件的大小Q该大小以字节ؓ单位?/p>

 

EOF(filenumber) q回一?IntegerQ它包含 Boolean ?TrueQ表明已l到达ؓ Random 或顺?Input 打开的文件的l尾?/p>

 

Loc(filenumber) q回一?LongQ在已打开的文件中指定当前?写位|?/p>

 

Seek(filenumber) q回一?LongQ在 Open 语句打开的文件中指定当前的读/写位|?/p>

so.java 2009-02-18 11:55 发表评论
]]>基本的ruby语法 http://www.aygfsteel.com/xxllnnn/archive/2009/01/18/251762.htmlso.javaso.javaSun, 18 Jan 2009 03:02:00 GMThttp://www.aygfsteel.com/xxllnnn/archive/2009/01/18/251762.htmlhttp://www.aygfsteel.com/xxllnnn/comments/251762.htmlhttp://www.aygfsteel.com/xxllnnn/archive/2009/01/18/251762.html#Feedback1http://www.aygfsteel.com/xxllnnn/comments/commentRss/251762.htmlhttp://www.aygfsteel.com/xxllnnn/services/trackbacks/251762.html1.     基本?/span>ruby语法

1.1      变量、常量和cd

1)      定义变量

变量cd

描述

CZ

局部变量(或伪变量Q?/span>

以小写字母或下划U卡?/span>

var    _var

全局变量

?/span>$开?/span>

$var

cd?/span>

cM定义Q以@@开?/span>

@@var

实例变量

对象中定义,?/span>@开?/span>

@var

帔R

以大写字母开?/span>

Var

2) 变量内插

  在双引号内?#8220;#{变量?/span>}”内插变量

a = 2

b = 3

puts "#{a} + #{b} = #{a+b}"  #输入l果为:2 + 3 = 5

 

1.2      注释

1Q?/span>单行注释Q以#开_如: #注释内容

2Q?/span>多行注释Q在=begin ?/span> =end 之间定义Q如Q?/span>

=begin

注释内容

=end

1.3    循环和分?/span>

1.3.1        条g语句

If 形式

unless 形式

a =1 if y==3

a=1 unless y!=3

x= if a > 0 then b else c end

x= unless a<=0 then a else b end

 if x<5 then

  a =1

else

   a =2

end

unless x<5 then

   a =2

else

   a =1

end

 

1.3.2        循环l构

#while循环

i= 0

while i< list.size do

print “#list[i] ”

I += 1

end

#until循环

i= 0

until i == list.size do

print “#list[i]”

i += 1

end

#for循环

for x in lisy do

 print “#{x}”

end

#each循环

list.each do |x|

 print “#{x}”

end

#loop循环

i = 0

n = list.size-1

loop do

print “#{list[i]}”

i += 1

break id i > n

end

#times循环

n = list.size

n.times do |i|

 print “#{list[i]}”

end

#upto循环

n =list.size–1

0.upto(n) do |i|

 print “#{list[i]}”

end

#each_index循环

list.each_index do |x|

 print “#{list[x]}”

end

 

1.3.3        异常

begin

    x = Math.sqrt(y/z)       

rescue ArgumentError       #匚w错误cd

    puts "Error taking square root"

rescue ZeroDivisionError     #匚w错误cd

    puts "Attempted division by zero"

else

    puts "Other Error"

ensure

    #q部分代码在最后一定会执行

end

 

1.3.4        c?/span>

class Hello #cd必须以大写字母开?/span>

 @@myname = "John"   #cd?/span>

 

 def initialize(name,phone)

      @name,@phone = name,phone #定义实例变量

 end

 

 def hello #定义cL?/span>

    puts "#{@name}的电话是#{@phone}" 

 end

end

 

f = Hello.new("Tom","13100000000") #创徏cd?/span>

f.hello #调用cL法,l果为:Tom的电话是13100000000

 

1.3.5        模块

Ҏ

说明

include ‘watir’

模块的功能d到当前空间中Q不加蝲已加载的文g

extend ‘watir’

模块的函数d到对象中

load ‘watir’

d文gQƈ其插入到源文g的当前位|,以便从这个位|开始就可以使用其定?/span>

 

1.3.6        case语句

case x

 when 1..10              #匚w数字

    puts "First branch"

 when foobar()           #扚wҎq回的?/span>

    puts "Second branch"

 when /^hel.*/           #匚w正则表达?/span>

    puts "Third branch"

 else  

    puts "Last branch"

end

 



so.java 2009-01-18 11:02 发表评论
]]>
exceldhttp://www.aygfsteel.com/xxllnnn/archive/2008/12/21/247664.htmlso.javaso.javaSun, 21 Dec 2008 14:49:00 GMThttp://www.aygfsteel.com/xxllnnn/archive/2008/12/21/247664.htmlhttp://www.aygfsteel.com/xxllnnn/comments/247664.htmlhttp://www.aygfsteel.com/xxllnnn/archive/2008/12/21/247664.html#Feedback0http://www.aygfsteel.com/xxllnnn/comments/commentRss/247664.htmlhttp://www.aygfsteel.com/xxllnnn/services/trackbacks/247664.html import   remedy.api.WritertoAR;
import   com.remedy.arsys.api.EntryItem;
import   com.remedy.arsys.api.FieldID;
import   com.remedy.arsys.api.Value;

public   class   Common   extends   WritertoAR   {
public   Common()   {
id.add(new   Long(536870913));
}

private   static   final   String   FORMNAME   =   "BOCOM_IF_CENTERFORM ";//   BOCOM_IF_CENTERFORM

private   ArrayList   id   =   new   ArrayList();

private   ArrayList   value   =   new   ArrayList();

public   EntryItem[]   creatEntryItems()   {
//   TODO   Auto-generated   method   stub
EntryItem[]   entryItems   =   new   EntryItem[value.size()];
for   (int   i   =   0;   i   <   entryItems.length;   i++)   {
entryItems[i]   =   new   EntryItem(new   FieldID(Long.parseLong((this.id
.get(i)).toString())),   new   Value(new   String(this.value.get(
i).toString())));
}
return   entryItems;
}

public   String   getFormName()   {
//   TODO   Auto-generated   method   stub
return   FORMNAME;
}

public   ArrayList   getId()   {
return   id;
}

public   void   setId(ArrayList   id)   {
this.id   =   id;
}

public   ArrayList   getValue()   {
return   value;
}

public   void   setValue(ArrayList   value)   {
this.value   =   value;
}
}


****************************************************

public   void   ReadXLS()   {
try   {
String   path2   =   " ";
Workbook   book   =   Workbook.getWorkbook(new   File(path2));
//   获得W一个工作表对象
Sheet   sheet   =   book.getSheet(0);
Cell   cell1   =   null;

for   (int   i   =   1;   i   <   sheet.getRows();   i++)   {
ids   =   new   ArrayList <Long> ();
values   =   new   ArrayList <String> ();
for   (int   j   =   0;   j   <   sheet.getColumns();   j++)   {
if   (j   ==   0)   {
ids.add(new   Long(536870915));
}   else   {
ids.add(new   Long(ids.get(ids.size()   -   1)   +   1));
}
cell1   =   sheet.getCell(j,   i);
String   result   =   cell1.getContents();
values.add(result);
//   System.out.println(ids.get(j));
//   System.out.println(values.get(j));
}
out.setId(ids);
out.setValue(values);
ARSWriter.getArswriter().createEntry(out);
}
book.close();
}   catch   (Exception   ex)   {
ex.printStackTrace();
}


so.java 2008-12-21 22:49 发表评论
]]>
国际Q写出漂亮代码的七种Ҏ(zt)http://www.aygfsteel.com/xxllnnn/archive/2008/12/18/247024.htmlso.javaso.javaThu, 18 Dec 2008 01:23:00 GMThttp://www.aygfsteel.com/xxllnnn/archive/2008/12/18/247024.htmlhttp://www.aygfsteel.com/xxllnnn/comments/247024.htmlhttp://www.aygfsteel.com/xxllnnn/archive/2008/12/18/247024.html#Feedback0http://www.aygfsteel.com/xxllnnn/comments/commentRss/247024.htmlhttp://www.aygfsteel.com/xxllnnn/services/trackbacks/247024.html转自CSDN http://news.csdn.net/n/20081217/121810.html

首先我想说明我本文阐q的是纯_从学的角度来写出代码Q而非技术、逻辑{。以下ؓ写出漂亮代码的七U方法:

1Q?nbsp;快l束 if语句

例如下面q个JavaScript语句Q看h很恐怖:

1 function findShape(flags, point, attribute, list) {
2    if(!findShapePoints(flags, point, attribute)) {
3        if(!doFindShapePoints(flags, point, attribute)) {
4            if(!findInShape(flags, point, attribute)) {
5                if(!findFromGuide(flags,point) {
6                    if(list.count() > 0 && flags == 1) {
7                          doSomething();
8                    }
9                }
10            }
11       }
12    }  
13  }

但如果这么写好看得多:

1 function findShape(flags, point, attribute, list) {
2    if(findShapePoints(flags, point, attribute)) {
3        return;
4    }
5
6    if(doFindShapePoints(flags, point, attribute)) {
7        return;
8    }
9
10    if(findInShape(flags, point, attribute)) {
11        return;
12    }
13
14    if(findFromGuide(flags,point) {
15        return;
16    }
17
18    if (!(list.count() > 0 && flags == 1)) {
19        return;
20    }
21
22    doSomething();
23
24 }

你可能会很不喜欢W二U的表述方式Q但反映Zq速返回if值的思想Q也可以理解为:避免不必要的else陈述?/font>

2Q?nbsp;如果只是单的布尔q算Q逻辑q算Q,不要使用if语句

例如Q?br /> 1 function isStringEmpty(str){
2    if(str === "") {
3        return true;
4    }
5    else {
6        return false;
7    }
8 }

可以写ؓQ?br /> 1 function isStringEmpty(str){
2    return (str === "");
3 }

3Q?nbsp;使用I白Q这?a class="vLink1" id="vad_4" onmouseover="this.style.borderBottom='2px #FF3366 solid';var fxEvent=arguments[0];kwmouseover(this,4,fxEvent);" title="《游戏h生》火矌Y件荣誉出?@Vogate.com" style="font-size: 1em; cursor: hand; color: #ff3366; border-bottom: #ff3366 1px dotted; text-decoration: underline" onmouseout="this.style.borderBottom='1px #FF3366 dotted';kwmouseout(this,4)" target="_blank" name="4">免费?br /> 例如Q?br /> 1 function getSomeAngle() {
2    // Some code here then
3    radAngle1 = Math.atan(slope(center, point1));
4    radAngle2 = Math.atan(slope(center, point2));
5    firstAngle = getStartAngle(radAngle1, point1, center);
6    secondAngle = getStartAngle(radAngle2, point2, center);
7    radAngle1 = degreesToRadians(firstAngle);
8    radAngle2 = degreesToRadians(secondAngle);
9    baseRadius = distance(point, center);
10    radius = baseRadius + (lines * y);
11    p1["x"] = roundValue(radius * Math.cos(radAngle1) + center["x"]);
12    p1["y"] = roundValue(radius * Math.sin(radAngle1) + center["y"]);
13    pt2["x"] = roundValue(radius * Math.cos(radAngle2) + center["y"]);
14    pt2["y"] = roundValue(radius * Math.sin(radAngle2) + center["y");
15    // Now some more code
16 }

很多开发者不愿意使用I白Q就好像q要收费一栗我在此qL地添加空白,_鲁地打断代码的q诏性。在实际~写代码的过E中Q会很容易地发现在什么地方加入空白,q不但美观而且让读者易懂,如下Q?br /> 1 function getSomeAngle() {
2    // Some code here then
3    radAngle1 = Math.atan(slope(center, point1));
4    radAngle2 = Math.atan(slope(center, point2));
5
6    firstAngle = getStartAngle(radAngle1, point1, center);
7    secondAngle = getStartAngle(radAngle2, point2, center);
8
9    radAngle1 = degreesToRadians(firstAngle);
10    radAngle2 = degreesToRadians(secondAngle);
11
12    baseRadius = distance(point, center);
13    radius = baseRadius + (lines * y);
14
15    p1["x"] = roundValue(radius * Math.cos(radAngle1) + center["x"]);
16    p1["y"] = roundValue(radius * Math.sin(radAngle1) + center["y"]);
17
18    pt2["x"] = roundValue(radius * Math.cos(radAngle2) + center["y"]);
19    pt2["y"] = roundValue(radius * Math.sin(radAngle2) + center["y");
20    // Now some more code
21 }

4Q?nbsp;不要使用无谓的注?br /> 无谓的注释让,q实在很讨厌。不要标出很明显的注释。在以下的例子中Q每个h都知道代码表辄?#8220;students id”Q因而没必要标出?br /> 1 function existsStudent(id, list) {
2    for(i = 0; i < list.length; i++) {
3       student = list[i];
4
5       // Get the student's id
6       thisId = student.getId();
7
8       if(thisId === id) {
9           return true;
10       }
11    }
12    return false;  
13 }

5Q?nbsp;不要在源文g中留下已l删除的代码Q哪怕你标注?br /> 如果你用了版本控制Q那么你可以轻村֜扑֛前一个版本的代码。如果别人大费周折地M你的代码,却发现是要删除的代码Q这实在太恨Z?/font>

//function thisReallyHandyFunction() {
//      someMagic();
//      someMoreMagic();
//      magicNumber = evenMoreMagic();
//      return magicNumber;
//}

6Q不要有太长的代?/font>

看太长的代码实在太费Ԍ其是代码本w的功能又很。如下:

1 public static EnumMap<Category, IntPair> getGroupCategoryDistribution(EnumMap<Category, Integer> sizes, int groups) {
2        EnumMap<Category, IntPair> categoryGroupCounts = new EnumMap<Category,IntPair>(Category.class);
3
4        for(Category cat : Category.values()) {
5            categoryGroupCounts.put(cat, getCategoryDistribution(sizes.get(cat), groups));
6        }

#

我ƈ不是说非要坚?0个字W以内,但是一个比较理想的长度是控制在120个字W内。如果你把代码发布在互联|上Q用戯h很困难?br /> 7Q不要在一个功能(或者函数内Q有太多代码?br /> 我的一个老同事曾l说Visual C++很臭Q因为它不允怽在一个函数内拥有过10Q?00行代码。我C清代码行数的上限Q不知道他说的是否正,但我很不赞成他的观点。如果一个函数超q了50行,看v来有多费劲你知道么,q有没完没了的if循环Q而且你还的滚动鼠标前后对照这D代码。对我而言Q超q?5行的代码理解h很困难了。我的徏议是过q个数字把一个函C码分割成两个?br />



so.java 2008-12-18 09:23 发表评论
]]>
javscript document对象QZTQ?/title><link>http://www.aygfsteel.com/xxllnnn/archive/2008/11/27/242923.html</link><dc:creator>so.java</dc:creator><author>so.java</author><pubDate>Thu, 27 Nov 2008 01:16:00 GMT</pubDate><guid>http://www.aygfsteel.com/xxllnnn/archive/2008/11/27/242923.html</guid><wfw:comment>http://www.aygfsteel.com/xxllnnn/comments/242923.html</wfw:comment><comments>http://www.aygfsteel.com/xxllnnn/archive/2008/11/27/242923.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/xxllnnn/comments/commentRss/242923.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/xxllnnn/services/trackbacks/242923.html</trackback:ping><description><![CDATA[<p><font face="Verdana" size="3">对象属?/font></p> <font face="Verdana" size="2"> <div id="wmqeeuq" class="quote"> <p><font face="Verdana" size="2">document.title               //讄文档标题{h于HTML?lt;title>标签</font></p> <p><font face="Verdana" size="2">document.bgColor             //讄面背景?/font></p> <p><font face="Verdana" size="2">document.fgColor             //讄前景?文本颜色)</font></p> <p><font face="Verdana" size="2">document.linkColor           //未点击过的链接颜?/font></p> <p><font face="Verdana" size="2">document.alinkColor          //Ȁz链?焦点在此链接?的颜?/font></p> <p><font face="Verdana" size="2">document.vlinkColor          //已点击过的链接颜?/font></p> <p><font face="Verdana" size="2">document.URL                 //讄URL属性从而在同一H口打开另一|页</font></p> <p><font face="Verdana" size="2">document.fileCreatedDate     //文g建立日期Q只d?/font></p> <p><font face="Verdana" size="2">document.fileModifiedDate    //文g修改日期Q只d?/font></p> <p><font face="Verdana" size="2">document.fileSize            //文g大小Q只d?/font></p> <p><font face="Verdana" size="2">document.cookie              //讄和读出cookie</font></p> <p><font face="Verdana" size="2">document.charset             //讄字符?体中?gb2312</font></p> </div> <p></font></p> <br /> <br /> <p><font face="Verdana" size="3">Javascript Document对象Ҏ</font></p> <font face="Verdana" size="2"> <div id="wmqeeuq" class="quote"> <p><font face="Verdana" size="2">document.write()                    //动态向面写入内容</font></p> <p><font face="Verdana" size="2">document.createElement(Tag)         //创徏一个html标签对象</font></p> <p><font face="Verdana" size="2">document.getElementById(ID)         //获得指定ID值的对象</font></p> <p><font face="Verdana" size="2">document.getElementsByName(Name)    //获得指定Name值的对象</font></p> </div> </font><br /> <p><font face="Arial Black" size="3">javascript document images集合(面中的图象)</font></p> <p> </p> <div id="wmqeeuq" class="quote"> <p>a)通过集合引用</p> <p>document.images               //对应面上的<img>标签</p> <p>document.images.length        //对应面?lt;img>标签的个?/p> <p>document.images[0]            //W??lt;img>标签</p> <p>document.images[i]            //Wi-1?lt;img>标签</p> <p> </p> <p>b)通过nane属性直接引?/p> <p><img name="oImage"></p> <p>document.images.oImage        //document.images.name属?/p> <p> </p> <p>c)引用囄的src属?/p> <p>document.images.oImage.src    //document.images.name属?src</p> <p> </p> <p>d)创徏一个图?/p> <p>var oImage</p> <p>oImage = new Image()</p> <p>document.images.oImage.src="/1.jpg"</p> <p>//同时在页面上建立一?lt;img>标签与之对应可以显C?/p> <p> </p> <p><html></p> <p><img name=oImage></p> <p><script language="javascript"></p> <p>     var oImage</p> <p>     oImage = new Image()</p> <p>     document.images.oImage.src="/1.jpg"</p> <p></script></p> <p></html></p> </div> <br /> <p><font face="Arial Black" size="3">forms集合(面中的表单)</font> </p> <font face="Verdana" size="2"> <div id="wmqeeuq" class="quote"> <p><font face="Verdana" size="2">a)通过集合引用</font></p> <p><font face="Verdana" size="2">document.forms                   //对应面上的<form>标签</font></p> <p><font face="Verdana" size="2">document.forms.length            //对应面?lt;form>标签的个?/font></p> <p><font face="Verdana" size="2">document.forms[0]                //W??lt;form>标签</font></p> <p><font face="Verdana" size="2">document.forms[i]                //Wi-1?lt;form>标签</font></p> <p><font face="Verdana" size="2">document.forms[i].length         //Wi-1?lt;form>中的控g?/font></p> <p><font face="Verdana" size="2">document.forms[i].elements[j]    //Wi-1?lt;form>中第j-1个控?/font></p> <p><font face="Verdana" size="2"> </font></p> <p><font face="Verdana" size="2">b)通过标签name属性直接引?/font></p> <p><font face="Verdana" size="2"><form name="Myform"><input name="myctrl"></form></font></p> <p><font face="Verdana" size="2">document.Myform.myctrl           //document.表单?控g?br /> </font></p> </div> <br /> <p><html></p> <p><!--Text控g相关Script--></p> <p><form name="Myform"></p> <p><input type="text" name="oText"></p> <p><input type="password" name="oPswd"></p> <p><form></p> <p><script language="javascript"></p> <p>//获取文本密码框的?/p> <p>document.write(document.Myform.oText.value)</p> <p>document.write(document.Myform.oPswd.value)</p> <p></script></p> <p></html></p> <p>------------------------------------------------------------------------------------------------------------</p> <p><html></p> <p><!--Select控g相关Script--></p> <p><form name="Myform"></p> <p><select name="oSelect"></p> <p><option value="1">1</option></p> <p><option value="2">2</option></p> <p><option value="3">3</option></p> <p></select></p> <p></form></p> <p> <wbr></p> <p><script language="javascript"></p> <p> <wbr> <wbr> <wbr> <wbr> //遍历select控g的option?/p> <p> <wbr> <wbr> <wbr> <wbr> var length</p> <p> <wbr> <wbr> <wbr> <wbr> length=document.Myform.oSelect.length</p> <p> <wbr> <wbr> <wbr> <wbr> for(i=0;i<length;i++)</p> <p> <wbr> <wbr> <wbr> <wbr> document.write(document.Myform.oSelect[i].value)</p> <p></script></p> <p> <wbr></p> <p><script language="javascript"></p> <p> <wbr> <wbr> <wbr> <wbr> //遍历optionƈ且判断某个option是否被选中</p> <p> <wbr> <wbr> <wbr> <wbr> for(i=0;i<document.Myform.oSelect.length;i++){</p> <p> <wbr> <wbr> <wbr> <wbr> if(document.Myform.oSelect[i].selected!=true)</p> <p> <wbr> <wbr> <wbr> <wbr> document.write(document.Myform.oSelect[i].value)</p> <p> <wbr> <wbr> <wbr> <wbr> else</p> <p> <wbr> <wbr> <wbr> <wbr> document.write("<font color=red>"+document.Myform.oSelect[i].value+"</font>") <wbr> <wbr> <wbr></p> <p> <wbr> <wbr> <wbr> <wbr> }</p> <p></script></p> <p> <wbr></p> <p><script language="javascript"></p> <p> <wbr> <wbr> <wbr> <wbr> //ҎSelectedIndex打印出选中的option</p> <p> <wbr> <wbr> <wbr> <wbr> //(0到document.Myform.oSelect.length-1)</p> <p> <wbr> <wbr> <wbr> <wbr> i=document.Myform.oSelect.selectedIndex</p> <p> <wbr> <wbr> <wbr> <wbr> document.write(document.Myform.oSelect[i].value)</p> <p></script></p> <p> <wbr></p> <p><script language="javascript"></p> <p> <wbr> <wbr> <wbr> <wbr> //动态增加select控g的option?/p> <p> <wbr> <wbr> <wbr> <wbr> var oOption = document.createElement("OPTION");</p> <p> <wbr> <wbr> <wbr> <wbr> oOption.text="4";</p> <p> <wbr> <wbr> <wbr> <wbr> oOption.value="4";</p> <p> <wbr> <wbr> <wbr> <wbr> document.Myform.oSelect.add(oOption);</p> <p></script></p> <p><html></p> <p>-----------------------------------------------------------------------------------------------------------</p> <p><Div id="oDiv">Text</Div></p> <p>document.all.oDiv <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> //引用囑ֱoDiv</p> <p>document.all.oDiv.style <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr></p> <p>document.all.oDiv.style.display="" <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> //囑ֱ讄为可?/p> <p>document.all.oDiv.style.display="none" <wbr> <wbr> <wbr> //囑ֱ讄为隐?/p> </font> <img src ="http://www.aygfsteel.com/xxllnnn/aggbug/242923.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/xxllnnn/" target="_blank">so.java</a> 2008-11-27 09:16 <a href="http://www.aygfsteel.com/xxllnnn/archive/2008/11/27/242923.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>ajax常用的函数大全(ZTQ?/title><link>http://www.aygfsteel.com/xxllnnn/archive/2008/11/27/242922.html</link><dc:creator>so.java</dc:creator><author>so.java</author><pubDate>Thu, 27 Nov 2008 01:14:00 GMT</pubDate><guid>http://www.aygfsteel.com/xxllnnn/archive/2008/11/27/242922.html</guid><wfw:comment>http://www.aygfsteel.com/xxllnnn/comments/242922.html</wfw:comment><comments>http://www.aygfsteel.com/xxllnnn/archive/2008/11/27/242922.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/xxllnnn/comments/commentRss/242922.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/xxllnnn/services/trackbacks/242922.html</trackback:ping><description><![CDATA[function getRequest() { <p><font face="Verdana" size="2">         http_request = false;</font></p> <p><font face="Verdana" size="2">         if (window.XMLHttpRequest) {<br />              //对于MozillaHNetscapeHSafari{浏览器Q创建XMLHttpRequest<br />              http_request = new XMLHttpRequest();<br />              if (http_request.overrideMimeType) {<br />                   //如果服务器响应的header不是text/xmlQ可以调用其它方法修改该header<br />                  http_request.overrideMimeType('text/xml');<br />              }<br />          } else if (window.ActiveXObject) {<br />    // 对于Internet Explorer览器,创徏XMLHttpRequest<br />              try {<br />                  http_request = new ActiveXObject("Msxml2.XMLHTTP");<br />              } catch (e) {<br />                  try {<br />                      http_request = new ActiveXObject("Microsoft.XMLHTTP");<br />                  } catch (e) {}<br />              }<br />          }<br />    return http_request;<br /> }</font></p> <p><br /> <font face="Verdana" size="2">//获得Url 的responseText<br /> function getResponseText(url)<br /> {<br />    http_request=getRequest();<br />          http_request.open('GET', url, false);<br />          http_request.send(null);<br />  <br />    if (http_request.readyState == 4)<br />    {<br />       // 收到完整的服务器响应<br />       if (http_request.status == 200) {<br />        //HTTP服务器响应的值OK<br />        requestdoc = http_request.responseText;<br />        //服务器q回的字W串写到面中ID为message的区?br />      }<br />        else {<br />        requestdoc = http_request.status;<br />        }<br />      }<br />    return requestdoc;<br /> }</font></p> <p><br /> <font face="Verdana" size="2">//获得Url 的responseXML<br /> function getResponseText(url)<br /> {<br />    http_request=getRequest();<br />          http_request.open('GET', url, false);<br />          http_request.send(null);<br />  <br />    if (http_request.readyState == 4)<br />    {<br />       // 收到完整的服务器响应<br />       if (http_request.status == 200) {<br />        //HTTP服务器响应的值OK<br />        requestdoc = http_request.responseXML;<br />        //服务器q回的字W串写到面中ID为message的区?br />      }<br />        else {<br />        requestdoc = http_request.status;<br />        }<br />      }<br />    return requestdoc;<br /> }</font></p> <img src ="http://www.aygfsteel.com/xxllnnn/aggbug/242922.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/xxllnnn/" target="_blank">so.java</a> 2008-11-27 09:14 <a href="http://www.aygfsteel.com/xxllnnn/archive/2008/11/27/242922.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>CSS常用属性设|?(zt)http://www.aygfsteel.com/xxllnnn/archive/2008/11/12/240116.htmlso.javaso.javaWed, 12 Nov 2008 08:35:00 GMThttp://www.aygfsteel.com/xxllnnn/archive/2008/11/12/240116.html?】CSS的背景属性设|包括:
①背景颜Ԍbackground-colorQ可以用名字、RGB模式、十六进制数表示
②背景图片:background-imageQ用url{...}表示
③背景图片重复:background-repeatQ可以设|水q重复、垂直重复、双向重复、不重复
④背景图片附着Qbackground-attachmentQ可以设|黏着、滚?br style="font-family: " /> ⑤背景图片位|:background-positionQ可以设|左(上中?、右(上中?、中(上下)Q坐标、百分比

Z使用便,我们可以使用backgroundq个l合属性一ơ性设|所有属性:

body{
  background: yellow url{"logo.jpg"} repeat scroll center
}

注意我们必须按照上面介绍的①~⑤的序来定?br />

?】CSS的文本属性设|包括:


①文本颜ԌcolorQ可以用名字、RGB模式、十六进制数表示
②字W间距:letter-spacingQ可以用像素、厘cC?br /> ③字母间距:word-spacingQ可以用像素、厘cC?br /> ④每行间距:line-heightQ可以用像素、厘c뀁百分比(相等于默认行?表示
⑤文本羃q:text-indentQ可以用厘c뀁百分比表示
⑥文本对齐:text-alignQ可以设|左寚w、右寚w、居中对齐、两端对?br /> ⑦文本强调:text-decorationQ可以设|上划线、删除线、下划线、闪?br /> ⑧文本格式:text-transformQ可以设|大写、小写、首字母大写

注意Ҏ本的CSS定义不能像背景那样采用一站式定义Q因为有很多属性的值都是同样Ş式的?/font>

p.poem {
  color:red;
  letter-spacing:2px;
  word-spacing:0.1cm;
  line-height:200%;
  text-indent:none;
  text-align:center;
  text-decoration:underline;
  text-transform:capitalize
}

注意QCSS中对于文本属性的讄没有序的要?br />
?】CSS的字体属性设|包括:
①字体类型:font-styleQ可以设|normal、italic、oblique
②字体粗l:font-weightQ可以设|normal、bold、boler、lighter、数?br /> ③字体大:font-sizeQ可以设|small、medium、large、百分比
④字体类型:font-familyQ可以设|一pd的字体名U?br />

body{
    font-style: normal;
    font-weight:bold;
    font-size: 200%
    font-family: vendar
}

?】CSS的边框属性设|包括:
CSS中边框的讄包括上、下、右、左四种讄Q每U设|包括边框宽带、样式、颜?br />
①边框宽度:border-xxx-widthQ可以选择thin、medium、thick、数字表C?br /> ②边框样式:border-xxx-styleQ可以选择hidden、dotted、dashed、solid、dobule、groove?br />                 ridge、inset、outset
③边框颜Ԍborder-xxx-colorQ可以选择名字、RGB模式、十六进制数

假如需要对Ҏ的每个边都进行特别设|,可以使用border-top、border-bottom、border-right、border-left对各个边框进行一站式讄?br />
如果Ҏ个边框的讄都一P则直接用border属性进行一ơ性设定即可?br />

table.tr{
   border-top: medium solid red;
   border-bottom: thin hidden;
   border-left: thick dotted yellow;
   border-right: 1cm inset blue
}

?】CSS的边~属性设|包括:
CSS中关于空白区的设|包括:上、右、下、左四个区域Q提供了一个一站式讄的属性:margin

p{
   margin: 2cm 4cm 3cm 5cm
}

Note: Netscape and IE give the body tag a default margin of 8px. Opera does not! Instead, Opera applies a default padding of 8px, so if one wants to adjust the margin for an entire page and have it display correctly in Opera, the body padding must be set as well!


?】CSS的填充属性设|包括:
CSS中关于填充区的设|包括上、右、下、左四个部分Qƈ且提供了一个一站式讄属性:padding

在设|padding属性时Q即可以指定一个?卛_用于各个Ҏ)Q也可以指定二个?即上、右Q下和左和上、右一?Q也可以指定全部四个倹{?/font>

td.test1 {padding: 1.5cm}
td.test2 {padding: 0.5cm 2.5cm}

注意Qmargin是设|HTML元素Ҏ与页面之间的I白部分Q而padding是设|HTML元素内容和HTML元素Ҏ之间的空白部?br />
?】CSS的表格属性设|包括:
①表D框样式:border-collapseQ是用单竖线q是标准的HTML样式昄表格Ҏ
②表D框距:border-spacingQ设|分表D框的距离Q仅对separated border样式有用
③表格标题对齐:caption-sideQ可以设|top、bottom、left、right
④空单元格是否显C:empty-cellsQ可以设|show、hide
⑤单元格大小自适应Qtable-layoutQ可以设|auto、fixed.

注意Q如果table-layout的gؓfixedQ则出单元格长度的内容被截取

table{
 
   border-collapse:collapse;
   border-sapcing: 10px, 50px;
   caption-side: bottom;
   empty-cells: show;
   table-layout: auto
}


?】CSS的维度属性设|:
①宽度:width
②高度:height
③最大宽度:max-width
④最大高度:max-height
⑤最宽度:min-width
⑥最高度:max-height

注意QCSS中关于height与width的设|会覆盖原有的element的height和width讄

?】CSS的分cd性设|包括:
CSS的分cd性允怽讄如何昄一个HTML元素Q设|如何将囑փ攄在文本的周围Q用绝对位|、相对位|放|一个元素,如何控制元素的显C或隐藏?br />
①清除漂元素:clearQ清除指定元素周围的漂Q元素
②鼠标ŞӞ      cursorQ可以选择多种鼠标的Ş?br /> ③显C属性:      displayQ可以选择多种昄属性,例如指定表格的表?脚、行、列、单元格
④漂属性:      floatQ设|文本和囄如何周围的元素的位置关系
⑤元素定位:      positionQ可以用相寏V绝寏V固定属?br /> ⑥可见性设|:   visibilityQ可以选择可见、隐?br />
在这些属性中Q比较常用的是display、float、visibility属性。用这三个属性可以定制出cM水^、垂直菜单,图文h的效果?br />
<style type="text/css">

img {
    display:inline;
    visibility: visible
    float:right;
    border:1px dotted black;
    margin:0px 0px 15px 20px;
}

</style>

?0】CSS的方位属性设|包括:
①方位:     left/righ/top/bottomQ设|元素的位置Q可以用相对位|?如:-20px)
②决定位|:positionQ?讄方位的基准,可以选择l对、相寏V固?br /> ③溢出处理:overflowQ设|溢出时可见、隐藏、滚动、自动调?br /> ④Z轴位|: z-indexQ设|当存在多个重叠元素Ӟ昄的优先

注意Qpositiion属性经常和方位属性搭配用,指明在某一方位上的相对位置讄

<style type="text/css">
h2.pos_left {
    position:relative;
    left:-20px
}
h2.pos_right {
    position:relative;
    left:20px
}
</style>

注意Q当元素的overflow属性设|ؓhiddenӞ一旦元素的内容过其显C区域将被截?br />
注意Qz-index的默认值是0Q数D表C在昄在底层。这一点可以用于透明背景讄


so.java 2008-11-12 16:35 发表评论
]]>
struts2国际?/title><link>http://www.aygfsteel.com/xxllnnn/archive/2008/11/12/240014.html</link><dc:creator>so.java</dc:creator><author>so.java</author><pubDate>Wed, 12 Nov 2008 02:16:00 GMT</pubDate><guid>http://www.aygfsteel.com/xxllnnn/archive/2008/11/12/240014.html</guid><description><![CDATA[     摘要:   国际化是商业pȝ中不可或~的一部分Q所以无论您学习的是什么Web框架Q它都是必须掌握的技能?其实QStruts 1.x在此部分已经做得相当不错了。它极大地简化了我们E序员在做国际化时所需的工作,例如Q如果您要输Z条国际化的信息,只需在代码包中加入FILE-NAME_xx_XX.propertiesQ其中FILE-NAME为默认资源文件的文g名)Q然后在struts-confi...  <a href='http://www.aygfsteel.com/xxllnnn/archive/2008/11/12/240014.html'>阅读全文</a><img src ="http://www.aygfsteel.com/xxllnnn/aggbug/240014.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/xxllnnn/" target="_blank">so.java</a> 2008-11-12 10:16 <a href="http://www.aygfsteel.com/xxllnnn/archive/2008/11/12/240014.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Struts2.0的Struts.properties (zt)http://www.aygfsteel.com/xxllnnn/archive/2008/11/12/240007.htmlso.javaso.javaWed, 12 Nov 2008 02:02:00 GMThttp://www.aygfsteel.com/xxllnnn/archive/2008/11/12/240007.html转自http://www.aygfsteel.com/hhhaaawwwkkk/

struts.action.extension

          The URL extension to use to determine if the request is meant for a Struts action
           用URL扩展名来定是否q个h是被用作Struts actionQ其实也是讄 action的后~Q例如login.do的\'do\'字?/font>

struts.configuration
          The org.apache.struts2.config.Configuration implementation class
            org.apache.struts2.config.Configuration接口?/font>

struts.configuration.files
          A list of configuration files automatically loaded by Struts
           struts自动加蝲的一个配|文件列?/font>

struts.configuration.xml.reload
          Whether to reload the XML configuration or not
           是否加蝲xml配置(true,false)

struts.continuations.package
           The package containing actions that use Rife continuations
           含有actions的完整连l的package名称

struts.custom.i18n.resources
          Location of additional localization properties files to load
           加蝲附加的国际化属性文Ӟ不包?properties后缀Q?/font>

struts.custom.properties
          Location of additional configuration properties files to load
           加蝲附加的配|文件的位置


struts.devMode
          Whether Struts is in development mode or not
           是否为struts开发模?/font>

struts.dispatcher.parametersWorkaround
          Whether to use a Servlet request parameter workaround necessary for some versions of WebLogic
            Q某些版本的weblogic专用Q是否用一个servleth参数工作区(PARAMETERSWORKAROUNDQ?/font>

struts.enable.DynamicMethodInvocation
          Allows one to disable dynamic method invocation from the URL
            允许动态方法调?/font>

struts.freemarker.manager.classname
          The org.apache.struts2.views.freemarker.FreemarkerManager implementation class
           org.apache.struts2.views.freemarker.FreemarkerManager接口?/font>

struts.i18n.encoding
          The encoding to use for localization messages
           国际化信息内?/font>

struts.i18n.reload
          Whether the localization messages should automatically be reloaded
           是否国际化信息自动加?

struts.locale
          The default locale for the Struts application
           默认的国际化地区信息

struts.mapper.class
          The org.apache.struts2.dispatcher.mapper.ActionMapper implementation class
            org.apache.struts2.dispatcher.mapper.ActionMapper接口

struts.multipart.maxSize
          The maximize size of a multipart request (file upload)
           multiparth信息的最大尺寸(文g上传用)

struts.multipart.parser
          The org.apache.struts2.dispatcher.multipart.
          MultiPartRequest parser implementation for a multipart request (file upload)
          专ؓmultiparth信息使用的org.apache.struts2.dispatcher.multipart.MultiPartRequest解析器接口(文g上传用)


struts.multipart.saveDir
          The directory to use for storing uploaded files
           讄存储上传文g的目录夹

struts.objectFactory
          The com.opensymphony.xwork2.ObjectFactory implementation class
           com.opensymphony.xwork2.ObjectFactory接口QspringQ?/font>

struts.objectFactory.spring.autoWire
          Whether Spring should autoWire or not
           是否自动l定Spring

struts.objectFactory.spring.useClassCache
          Whether Spring should use its class cache or not
           是否spring应该使用自n的cache

struts.objectTypeDeterminer
          The com.opensymphony.xwork2.util.ObjectTypeDeterminer implementation class
            com.opensymphony.xwork2.util.ObjectTypeDeterminer接口

struts.serve.static.browserCache
  If static content served by the Struts filter should set browser caching header properties or not
           是否strutsqo器中提供的静态内容应该被览器缓存在头部属性中

struts.serve.static
          Whether the Struts filter should serve static content or not
           是否strutsqo器应该提供静态内?/font>

struts.tag.altSyntax
          Whether to use the alterative syntax for the tags or not
           是否可以用替代的语法替代tags

struts.ui.templateDir
          The directory containing UI templates
           UI templates的目录夹

struts.ui.theme
          The default UI template theme
           默认的UI template主题

struts.url.http.port
          The HTTP port used by Struts URLs
           讄http端口

struts.url.https.port
          The HTTPS port used by Struts URLs
           讄https端口

struts.url.includeParams
          The default includeParams method to generate Struts URLs
          在url中?默认的includeParams

struts.velocity.configfile
          The Velocity configuration file path
           velocity配置文g路径

struts.velocity.contexts
          List of Velocity context names
           velocity的context列表

struts.velocity.manager.classname
          org.apache.struts2.views.velocity.VelocityManager implementation class
           org.apache.struts2.views.velocity.VelocityManager接口?/font>

struts.velocity.toolboxlocation
          The location of the Velocity toolbox
           velocity工具盒的位置

struts.xslt.nocache
          Whether or not XSLT templates should not be cached
           是否XSLT模版应该被缓?/font>



so.java 2008-11-12 10:02 发表评论
]]>
վ֩ģ壺 | ֽ| ŷ| ɽ| | | ˮ| ƽ| | | | ȳ| | ǡ| | | | ʩ| | | | | ƽ| ɽ| | | ˮ| | ޼| | | з| | ˳| | ˮ| | żҸ| | | |