Miscellaneous NOTES

本文介绍了Java开发中常用的Eclipse快捷键,以及一个实际项目的自动化构建流程,包括代码编译、单元测试执行与报告生成等方面的内容。
 
JavaScipt
¨         input表单不显示历史记录
<input type="text" name="test" autocomplete="off">
 
input select 镶套(IE
<span><input name="category" type="text" maxlength="30" style="width: 160" id="add_category" autocomplete="off"><span style="width:18;overflow:hidden">
<select name="" id="" style="width: 178; margin-left:-160" onclick="add_category.value=value">
    <option value="Test">Test</option>
</select></span>
</span>
 
¨         改变 right click show
document.oncontextmenu = showmenuie5;
 
¨         iframe vs document 跳转
iframe src : document.getElementById("hidframe").src=”…”
document location : document.location = ”…”
 
 
Java
¨         Eclipse的快捷键组合
  
  1.Control-Shift-T:打开类型(Open type)。如果你不是有意磨洋工,还是忘记通过源码树(source tree)打开的方式吧。
  
  2.Control-Shift-R:打开资源(不只是用来寻找Java文件)。小提示:利用Navigator视图的黄色双向箭头按钮让你的编辑窗口和导航器相关联。这会让你打开的文件对应显示在导航器的层级结构中,这样便于组织信息。如果这影响了速度,就关掉它。
  
  3.F3:打开申明(Open declaration)。或者,利用Declaration Tab(在Java视图模式下,选择Windows Show View-->Declaration)。当你选中代码中的一个方法,然后按这个按键,它会把整个方法在申明方框里显示出来。
  
  4.Alt-leftarrow:在导航历史记录(Navigation History)中后退。就像Web浏览器的后退按钮一样,在利用F3跳转之后,特别有用。(用来返回原先编译的地方)。
  
  5.Alt-rightarrow:导航历史记录中向前。
  
  6.Control-Q:回到最后依次编辑的地方。这个快捷键也是当你在代码中跳转后用的。特别是当你钻的过深,忘记你最初在做什么的时候。
  
  7.Control-Shift-G:workspace中搜索引用(reference)。这是重构的前提。对于方法,这个热键的作用和F3恰好相反。它使你在方法的栈中,向上找出一个方法的所有调用者。一个与此相关的功能是开启标记功能(occurrence marking)。选择Windows->Preferences->Java->Editor->Mark Occurrences,勾选选项。这时,当你单击一个元素的时候,代码中所有该元素存在的地方都会被高亮显示。我个人只使用标记本地变量Mark Local Variables)。注意:太多的高亮显示会拖慢Eclipse
 
Project management
¨         Night building
我们公司的一个项目是java 开发的,web 应用基于 tomcat 运行,后台数据库是 oracle   代码版本控制是 cvs 代码服务器在美国。

   
作为一家外包公司,每天我们程序员在上班的第一天开始cvs 下载最新的代码,编译,如果有冲突,会解决冲突,没有的话,开始编码,作为我们公司的测试人员,基于公司的模式,我们实现以下构建。

编译
     ant
提供了强大的编译功能,我们在开始写 build.xml 的时候,并没有写 compile 这步,而是直接从cvs 里面下载相应模块的buildxml 后,调用。这样做的目的是为了保证测试开发的使用同一套编译脚步编译,保证协调,一致性。
     
这里,我们使用了 ant 的如下功能:
      <ant antfile="build.xml" dir="./${release.home}/cvs/DPS/PhaseII/AE/" target="all"/>

   
编译好的代码,我们会自己拷贝到对应的目录。

单元测试
     junit
,对应的测试模块,我们的开发人员已经提交到cvs ,我们从cvs update 后,编译运行。在运行之前,先在数据库里初始化相应的测试数据,在ant 中,我们使用下面的方法插入数据到数据库:
    <target name="dbinit_insert">
      <sql
               driver="oracle.jdbc.driver.OracleDriver"
               url="jdbc:oracle:thin:@192.168.100.1:1521:china"
               userid="uni_app2"
               password="ladodgers"
               onfiltered="continue"
               >
               <transaction  src="./sql/InsertTestOrderNoteData.sql"/>   <!-- For Test Case TestUserLiveValidation -->
               <transaction  src="./sql/TestUserLiveValidationBegin.sql"/>   <!-- For Test Case TestUserLiveValidation -->
               <transaction  src="./sql/InsertTestCreateInventoryData.sql"/> <!-- For Test Case TestCreateInventory -->
               <transaction  src="./sql/InsertTestPerformanceVenueData.sql"/> <!-- For Test Case TestPerformanceVenue -->
               <transaction  src="./sql/InsertTestPerformanceManifestData.sql"/> <!-- For Test Case TestPerformanceManifest -->
               <transaction  src="./sql/InsertTestPerformanceData.sql"/> <!-- For Test Case TestPerformance -->
               <transaction  src="./sql/InsertTestPerformancePriceCodeData.sql"/> <!-- For Test Case TestPerformancePriceCode -->
               <classpath>
   <path refid="lib.path"/>
        </classpath>
          </sql>
     </target>

   
然后开始运行单元测试。

   
在单元测试结束后,把插入的册书数据清空,目的是下次运行的时候,可以再次初始化数据库。
   
    <target name="dbinit_delete">
         <sql
               driver="oracle.jdbc.driver.OracleDriver"
               url="jdbc:oracle:thin:@192.168.100.1:1521:china"
               userid="uni_app2"
               password="ladodgers"
               onfiltered="continue"
               >
               <transaction  src="./sql/deleteTestOrderNoteData.sql"/>   <!-- For Test Case TestUserLiveValidation -->
               <transaction  src="./sql/TestUserLiveValidationEnd.sql"/> <!-- For Test Case TestUserLiveValidation -->
               <transaction  src="./sql/deleteTestCreateInventoryData.sql"/> <!-- For Test Case TestCreateInventory -->
               <transaction  src="./sql/deleteTestPerformanceVenueData.sql"/> <!-- For Test Case TestPerformanceVenue -->
               <transaction  src="./sql/deleteTestPerformanceManifestData.sql"/> <!-- For Test Case TestPerformanceManifest -->
               <transaction  src="./sql/deleteTestPerformanceData.sql"/> <!-- For Test Case TestPerformance -->
               <transaction  src="./sql/deleteTestPerformancePriceCodeData.sql"/> <!-- For Test Case TestPerformancePriceCode -->
               <classpath>
   <path refid="lib.path"/>
        </classpath>
          </sql>
     </target>


   
在我们的 build.xml 中,以下列顺序执行 target

   1
cvs update code
   2.   call build.xml compile source code
   3.   call build.xml compile unit test source code
   4.   insert data to database .
   5.   run unit test
   6.   generate unit test report
   7.   run cover check unit test cover rate
   8.   generate unit test cover rate  report
   9.   delete test data from data base
   10.  Email all report to PM and Leader. Deploy these report bases on web service.
 
Other
¨         meta标签详细(排名)
meta是用来在html文档中模拟http协议的响应头报文。meta标签用于网的<head></hea>中,meat标签的用处很多。meta的属性有两种:namehttp_equivname属性用于描述网页,对应于content(网页内容),以便于搜索引擎机器机查找、分类(目前几向前乎所有的搜索引擎都使用网上机器人自动查找meta值给网页分类)。这其中最重要的是descript(站点在搜索引擎上的描述)keywords(分类关键词),所以应该给每页加一个meta值,可以提高网站的排名。
1
<meta name="Generato" content="">         用以说明生成工具(也就是指编辑网页的工具)
2
<meta name="KEYWords" content="">      向搜索引擎说明你的网页的关键词
3
<meta name="DEscription" content="">     告诉搜索引擎你站点的主要内容
4
<meta name="Author" content="你的姓名">告诉搜索引擎你的站点的制作者
5
<meta name="Robots" content="all | none | index | noindex | follow | nofllow ">
     
其中属性说明如下:
      all 
   文件将被检索,且页面上的链接可以被查询
      none
文件将不被检索,且页面上的链接可以被查询
      index
:仅文件被检索
      follow
:页面上的链接可以被查询
      noindex 
:文件不被检索,查页面上的链接可以被查询
      nofollow
:文件将被检索,查页面上的链接不可以被

http-equiv
属性
1
<meta http-equiv="Content-Type" content="text/html";charset=gb_2312-80>
<meta http-equiv="Content-Language" content="zh-CN">用以说网页制作所使用的文字及语言
又如英文是ISO-8859-1字符集,还有BIG5utf-8shift-JisEucKoi8-2等字符集;
2
<meta http-equiv="Expires" content="Mon,12 May 2007 00:20:00 GMT">可以以用于网页到期时期,一量过期则必须到服务器上重新调用。需要注意的是必须使用GMT时间格式。
3
<meta http-equiv="Pragma" content="no-cache">是用于设定禁止浏览器从本地机的缓存中调阅网页内容,庙宇后一旦离开网页就无法从cach 
4
<meta http-equiv="Refresh" content="n;url=http://youlink">用于定时让网页指定时间n内,跳转到指定的页面。
5
<meta http-equiv="set-cookie" content="Mon12May 2007 00:20:00 GMT">用于cookie设定,如果网页过期,存本地硬盘的cookie将被删除。需要注意的是必须使用GMT时间格式。
6
<meta http-equiv="Pic-label" content="">网页级评定,在IEinternet选项中有一项内容设置,可以防止一引起受限制的网站,而网站的限制级别就是通过meta属性来设置的。
7
<meta http-equiv="wodows-Target" content="_top">强制页面在当前窗口中以独立页面显示,可以防止自已的网页被别人当作一个frame页调用。
8
<meta http-equiv="Page-Enter"  content="revealTrans(duration=10,transtion=50)"><meta http-equiv="Page-Exit" content="revealTrans(duration=20,transtion=6)">设定进入和离开页面时的特殊效果,这个功能即FrontPage中的格式/网页过渡,不过所加页面不能够是一个frame
 
 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值