<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    記錄、分享

    2011年3月15日

    spring-security3 入門篇[轉(zhuǎn)載]

    1.下載spring security的最新版本,工程下載的是3.1

    2. 新建工程,結(jié)構(gòu)如下:



     其中,涉及到的jar包可以在spring-security包中的例子中獲取

    3、配置spring-security.xml

    Xml代碼  收藏代碼
    1. <? xml   version = "1.0"   encoding = "UTF-8" ?>   
    2. < beans   xmlns = "http://www.springframework.org/schema/beans"   
    3.     xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance"   xmlns:security ="http://www.springframework.org/schema/security"   
    4.     xsi:schemaLocation ="http://www.springframework.org/schema/beans   
    5.             http://www.springframework.org/schema/beans/spring-beans.xsd  
    6.             http://www.springframework.org/schema/security   
    7.             http://www.springframework.org/schema/security/spring-security.xsd">   
    8.   
    9.     <!-- 保護(hù)應(yīng)用程序的所有URL,只有擁有ROLE_USER才可以訪問 -->   
    10.     < security:http   auto-config = "true" >   
    11.         < security:intercept-url   pattern = "/**"   access = "ROLE_USER"   />   
    12.     </ security:http >   
    13.       
    14.     <!--配置認(rèn)證管理器,只有用戶名為user,密碼為user的用戶,角色為ROLE_USER可訪問指定的資源 -->  
    15.     < security:authentication-manager >   
    16.         < security:authentication-provider >   
    17.             < security:user-service >   
    18.                 < security:user   name = "user"    password = "user"   authorities ="ROLE_USER" />   
    19.             </ security:user-service >   
    20.         </ security:authentication-provider >   
    21.     </ security:authentication-manager >   
    22. </ beans >   

     4.配置web.xml

    Xml代碼  收藏代碼
    1. <? xml   version = "1.0"   encoding = "UTF-8" ?>   
    2. < web-app   xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance"   xmlns ="http://java.sun.com/xml/ns/javaee"   xmlns:web ="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"   xsi:schemaLocation ="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"  id = "WebApp_ID"   version = "2.5" >   
    3.   < display-name > springSecurity </ display-name >   
    4.     <!--******************************** -->   
    5.     <!--*******log4j日志信息的配置****** -->   
    6.     <!--******************************* -->   
    7.     < context-param >   
    8.         < param-name > log4jConfigLocation </ param-name >   
    9.         < param-value > classpath:log4j.xml </ param-value >   
    10.     </ context-param >   
    11.     <!--Spring默認(rèn)刷新Log4j配置文件的間隔,單位為millisecond,可以不設(shè)置 -->   
    12.     < context-param >   
    13.         < param-name > log4jRefreshInterval </ param-name >   
    14.         < param-value > 60000 </ param-value >   
    15.     </ context-param >   
    16.   
    17.     <!--******************************** -->   
    18.     <!--*******spring bean的配置******** -->   
    19.     <!--******************************* -->   
    20.     < context-param >   
    21.         < param-name > contextConfigLocation </ param-name >   
    22.         < param-value > classpath:applicationContext.xml </ param-value >   
    23.     </ context-param >   
    24.       
    25.     < listener >   
    26.         < listener-class > org.springframework.web.util.Log4jConfigListener </listener-class >   
    27.     </ listener >   
    28.     < listener >   
    29.         < listener-class > org.springframework.web.context.ContextLoaderListener </listener-class >   
    30.     </ listener >   
    31.     < listener >   
    32.         < listener-class > org.springframework.web.util.IntrospectorCleanupListener </listener-class >   
    33.     </ listener >   
    34.     <!--******************************** -->   
    35.     <!--*******字符集 過濾器************ -->   
    36.     <!--******************************* -->   
    37.     < filter >   
    38.         < filter-name > CharacterEncodingFilter </ filter-name >   
    39.         < filter-class > org.springframework.web.filter.CharacterEncodingFilter </filter-class >   
    40.         < init-param >   
    41.             < param-name > encoding </ param-name >   
    42.             < param-value > UTF-8 </ param-value >   
    43.         </ init-param >   
    44.         < init-param >   
    45.             < param-name > forceEncoding </ param-name >   
    46.             < param-value > true </ param-value >   
    47.         </ init-param >   
    48.     </ filter >   
    49.     < filter-mapping >   
    50.         < filter-name > CharacterEncodingFilter </ filter-name >   
    51.         < url-pattern > /* </ url-pattern >   
    52.     </ filter-mapping >   
    53.   
    54.     <!--******************************** -->   
    55.     <!--*******session的配置************ -->   
    56.     <!--******************************* -->   
    57.     < session-config >   
    58.         < session-timeout > 30 </ session-timeout >   
    59.     </ session-config >   
    60.       
    61.     <!-- SpringSecurity必須的begin -->   
    62.     < filter >   
    63.         < filter-name > springSecurityFilterChain </ filter-name >   
    64.         < filter-class > org.springframework.web.filter.DelegatingFilterProxy </filter-class >   
    65.     </ filter >   
    66.     <!-- 攔截所有的請求 -->   
    67.     < filter-mapping >   
    68.         < filter-name > springSecurityFilterChain </ filter-name >   
    69.         < url-pattern > /* </ url-pattern >   
    70.     </ filter-mapping >   
    71.     <!-- SpringSecurity必須的end -->   
    72.       
    73.   < welcome-file-list >   
    74.     < welcome-file > index.jsp </ welcome-file >   
    75.   </ welcome-file-list >   
    76. </ web-app >   

     

    5.index.jsp

    Html代碼  收藏代碼
    1. < %@ page  language = "java"   contentType = "text/html; charset=UTF-8"   
    2.     pageEncoding = "UTF-8" % >   
    3. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">   
    4. < html >   
    5. < head >   
    6. < meta   http-equiv = "Content-Type"   content = "text/html; charset=UTF-8" >   
    7. < title > 首頁 </ title >   
    8. </ head >   
    9. < body >   
    10.     < h1 > 這里是首頁,歡迎你! </ h1 >   
    11.     < %   
    12.         String[] str  =  session .getValueNames();  
    13.         for(int i = 0 ;i < str.length ;i++){  
    14.             out.println("key =="+str[i]);  
    15.             out.println("value =="+session.getAttribute(str[i]));  
    16.         }  
    17.     %>   
    18. </ body >   
    19. </ html >   

     

    6部署應(yīng)用,在首次瀏覽index.jsp時,由于沒登錄,spring security會自動生成登錄頁面,頁面內(nèi)容如下:

     



     7輸入用戶名和密碼,user,則進(jìn)入首頁

     

     

     至此,簡單的權(quán)限控制完成,在index頁面中通過session可以看到存入session中的用戶信息。

    posted @ 2013-12-02 19:00 張生 閱讀(321) | 評論 (0)編輯 收藏

    轉(zhuǎn)載:CentOS6 安裝 Xen 4.1.2

    轉(zhuǎn)載:

    http://www.cnblogs.com/liuan/archive/2012/06/13/2548558.html



    系統(tǒng):CentOS6.0  安裝的Xen版本:4.1.2

    在centos下安裝xen不是很順利,遇到很多問題。安裝過程主要參考了以下兩個文檔:

    http://wiki.xen.org/xenwiki/RHEL6Xen4Tutorial?action=fullsearch&value=linkto%3A%22RHEL6Xen4Tutorial%22&context=180

    這個方法可以正常安裝xen,并指出RedHat 6 下安裝xen 會遇到的問題,只是安裝過程復(fù)雜,不是源碼安裝。

    http://www.cnblogs.com/feisky/archive/2012/04/10/2441307.html

    這個是xen的源碼編譯安裝,也是centos下,安裝xen 4.1.2,但是經(jīng)過實踐,這樣安裝出來存在一些問題,很意外的。解決起來很頭痛。

    在上面這個方法上,具體的描述我的安裝過程。

    系統(tǒng)和安裝的xen版本上面有介紹,開始著手安裝xen了。

    1.下載Xen的源碼

    1 wget http://bits.xensource.com/oss-xen/release/4.1.2/xen-4.1.2.tar.gz

     

    2.安裝必備軟件包

    復(fù)制代碼
    1 yum groupinstall "Development Libraries" 2 yum groupinstall "Development Tools" 3 yum install transfig wget texi2html libaio-devel dev86 glibc-devel e2fsprogs-devel gitk mkinitrd iasl xz-devel 4 bzip2-devel pciutils-libs pciutils-devel SDL-devel libX11-devel gtk2-devel bridge-utils PyXML qemu-common qemu-img mercurial libidn-devel 5 yum -y install glibc-devel.i686texinfo libuuid-devel iasl python-lxml 6 yum -y install openssl openssl-devel 7 yum -y install ncurses ncurses-* 8 yum -y install python-devel
    復(fù)制代碼

     

    3.編譯安裝Xen hypervisor

    1 tar zxvf xen-4.1.2.tar.gz 2 cd xen-4.1.2 3 make world

    在此可能會遇到如下問題:

    解決辦法:yum –y install texinfo

    1 make install

    4.將Xen加入到啟動腳本:

    1 /sbin/chkconfig --add xend 2 /sbin/chkconfig --add xencommons 3 /sbin/chkconfig --add xendomains 4 /sbin/chkconfig xend on 5 /sbin/chkconfig xendomains on 6 /sbin/chkconfig xencommons on

    5.編譯安裝Linux3.1.2內(nèi)核

    復(fù)制代碼
     1 wget http://www.kernel.org/pub/linux/kernel/v3.0/linux-3.1.2.tar.bz2  2 tar -jxvf linux-3.1.3.tar.bz2  3 make menuconfig  4   5 Processor type and features --- >  6      選中Paravirtualized Guest Support  7   Device Drivers --->   8       Xen driver support --->   9         全部選* 10  11 修改:CONFIG_XEN_DEV_EVTCHN=y(如果是m,開機(jī)時無法啟動xencommons)
    復(fù)制代碼

     注意:僅僅上面的是不夠的,還需要修改:否則在創(chuàng)建虛擬機(jī)的過程中遇到這樣的問題:

    注意:Device 0 (vif) could not be connected. HotPlug scripts not working.

    在.config文件中做如下修改,就可以解決問題了

     

    1 CONFIG_XEN_BLKDEV_BACKEND=m 2 CONFIG_XEN_NETDEV_BACKEND=m

    接下來開始編譯安裝了:

    1 make 2 make modules 3 make modules_install 4 make install  5 depmod 3.1.2 6 mkinitrd -v -f --with=aacraid --with=sd_mod --with=scsi_mod initramfs-3.1.2.img 3.1.2

    6.配置grub:

    復(fù)制代碼
    1 title Xen (3.1.2-xen) 2         root (hd0,0) 3         kernel /xen-4.1.2.gz dom0_mem=512M 4         module /vmlinuz-3.1.2 ro root=UUID=3f920108-b74b-46b9-81c2-aff834494381   5 rd_DM_UUID=ddf1_4c5349202020202010000055000000004711471100001450 rd_NO_LUKS rd_NO_LVM rd_NO_MD LANG=en_US.UTF-8   6 SYSFONT=latarcyrheb-sun16 KEYBOARDTYPE=pc KEYTABLE=us crashkernel=auto rhgb quiet 7         module /initramfs-3.1.2.img
    復(fù)制代碼

    這個配置在第4行后面root=UUID隨自己的系統(tǒng)

    7.安裝virt-manager

    1 yum install libvirt virt-manager xorg-x11-xauth

     8. 重新編譯libvirt

      在文章前面第一個鏈接中,說明了,redhat6系統(tǒng)中,默認(rèn)的libvirt是不支持xen的,如果直接使用默認(rèn)的這會出現(xiàn)如下的問題:

      注意virt-manager & 這個命令中的'&' 代表該進(jìn)程后臺運(yùn)行

    復(fù)制代碼
     1 [root@el6 ~]# virt-manager &  2 [1] 2867  3 Unable to open connection to hypervisor URI 'xen:///':  4 no connection driver available for xen:///  5 Traceback (most recent call last):  6   File "/usr/share/virt-manager/virtManager/connection.py", line 992, in _try_open  7     None], flags)  8   File "/usr/lib64/python2.6/site-packages/libvirt.py", line 111, in openAuth  9     if ret is None:raise libvirtError('virConnectOpenAuth() failed') 10 libvirtError: no connection driver available for xen:///
    復(fù)制代碼

     開始重新編譯libvirt解決以上的問題。

    以下的操作都在非xen系統(tǒng)中進(jìn)行:

    沒個系統(tǒng)遇到的缺的包不一樣,我的系統(tǒng)中還缺失xen-devel包,并且在yum

    復(fù)制代碼
     1 [root@el6 ~]# cd /root/src  2 [root@el6 src]# wget ftp://ftp.redhat.com/pub/redhat/linux/enterprise/6Server/en/os/SRPMS/libvirt-0.8.1-27.el6.src.rpm  3 [root@el6 src]# rpm -i libvirt-0.8.1-27.el6.src.rpm  4 [root@el6 src]# wget http://pasik.reaktio.net/xen/patches/libvirt-spec-rhel6-enable-xen.patch  5 [root@el6 src]# cd /root/rpmbuild/SPECS  6 [root@el6 SPECS]# cp -a libvirt.spec libvirt.spec.orig  7 [root@el6 SPECS]# patch -p0 < ~/src/libvirt-spec-rhel6-enable-xen.patch  8 patching file libvirt.spec  9  10 [root@el6 SPECS]# rpmbuild -bb libvirt.spec 11 error: Failed build dependencies: 12         libnl-devel >= 1.1 is needed by libvirt-0.8.1-27.el6.x86_64 13         xhtml1-dtds is needed by libvirt-0.8.1-27.el6.x86_64 14         libudev-devel >= 145 is needed by libvirt-0.8.1-27.el6.x86_64 15         libpciaccess-devel >= 0.10.9 is needed by libvirt-0.8.1-27.el6.x86_64 16         yajl-devel is needed by libvirt-0.8.1-27.el6.x86_64 17         libpcap-devel is needed by libvirt-0.8.1-27.el6.x86_64 18         avahi-devel is needed by libvirt-0.8.1-27.el6.x86_64 19         parted-devel is needed by libvirt-0.8.1-27.el6.x86_64 20         device-mapper-devel is needed by libvirt-0.8.1-27.el6.x86_64 21         numactl-devel is needed by libvirt-0.8.1-27.el6.x86_64 22         netcf-devel >= 0.1.4 is needed by libvirt-0.8.1-27.el6.x86_64 23  [root@el6 SPECS]# yum install libnl-devel xhtml1-dtds libudev-devel libpciaccess-devel yajl-devel libpcap-devel avahi-devel parted-devel device-mapper-devel numactl-devel netcf-devel
    復(fù)制代碼

    安裝的時候,提示No packages xen-devel available 。

    在多次替換yum源之后,依然無法解決這個xen-devel包缺失的問題。

    隨后的解決方案如下:

    在網(wǎng)上下載xen-devel rpm 包,安裝遇到依賴問題,接著下載xen-libs rpm 包,接著還有其他的依賴問題,同樣查找。

    具體鏈接: 搜索xen-devel,找到符合系統(tǒng)版本的

    1 http://rpm.pbone.net/index.php3

    我下載的版本是:
    xen-devel-4.1.2_03-1.1.x86_64.rpm

    安裝xen-devel還依賴其他的包,如下:

    xen-libs-4.1.2_03-1.1.x86_64.rpm

    liblzma5-5.0.3-7.1.x86_64.rpm

    glibc-common-2.14.90-14.x86_64.rpm

    glibc-2.14.90-14.x86_64.rpm

    強(qiáng)制安裝如上的包。

    如果缺少依賴包,依次去下載對應(yīng)版本,解決問題。這個過程很蛋疼。

    如果所有的依賴包都安裝上后,接著下面的操作:

    復(fù)制代碼
    1 [root@gb31 SPECS]# rpmbuild -bb libvirt.spec 2 After a while you'll see:  3 Wrote: /root/rpmbuild/RPMS/x86_64/libvirt-0.8.1-27.el6.x86_64.rpm 4 Wrote: /root/rpmbuild/RPMS/x86_64/libvirt-client-0.8.1-27.el6.x86_64.rpm 5 Wrote: /root/rpmbuild/RPMS/x86_64/libvirt-devel-0.8.1-27.el6.x86_64.rpm 6 Wrote: /root/rpmbuild/RPMS/x86_64/libvirt-python-0.8.1-27.el6.x86_64.rpm 7 Wrote: /root/rpmbuild/RPMS/x86_64/libvirt-debuginfo-0.8.1-27.el6.x86_64.rpm
    復(fù)制代碼

    如果有如上的顯示則安裝成功。

    如果遇到屏幕顯示test 。。 一直卡住之后,卸載掉系統(tǒng)中已經(jīng)安裝的libvirt包,再重新嘗試,即可。
    接著如下:注意,可能版本不一樣

    如果還顯示存在test失敗,make失敗,與libvirt版本相關(guān),這個問題很蛋疼,多試下幾個版本吧。就可以解決。

    復(fù)制代碼
    1 [root@el6 ~]# cd /root/rpmbuild/RPMS/x86_64/ 2 [root@el6 x86_64]# rpm -Uvh --force libvirt-0.8.1-27.el6.x86_64.rpm libvirt-client-0.8.1-27.el6.x86_64.rpm libvirt-python-0.8.1-27.el6.x86_64.rpm 3 Preparing...                ########################################### [100%] 4    1:libvirt-client         ########################################### [ 33%] 5    2:libvirt                ########################################### [ 67%] 6    3:libvirt-python         ########################################### [100%]
    復(fù)制代碼

    9.進(jìn)入xen系統(tǒng)

    重啟系統(tǒng),進(jìn)入xen系統(tǒng)。

    嘗試輸入如下命令:xm-list ,xm-info

    再接著嘗試如下命令:virt-install,嘗試著安裝虛擬機(jī)

    如果顯示的錯誤如下:

    1 ERROR unable to connect to ‘localhost:8000′: Connection refused

    則需要去做如下修改:

    1 解決方案:查看libvirtd服務(wù)是否啟動,關(guān)閉防火墻,在/etc/xen/xend-config.sxp  2 (xend-http-server yes) 3 # Port xend should use for the HTTP interface, if xend-http-server is set. 4 (xend-port 8000) 5 去掉上面兩個括弧的注釋,ok

    再重新啟動xend服務(wù)

    1 service xend restart

     

    至此,可以嘗試在桌面上氣筒virtual machine manager 去創(chuàng)建虛擬機(jī)。
    創(chuàng)建過程如果如下問題:

    可以系統(tǒng)路勁的問題,在usr/lib/xen/bin下找到qemu-dm放到lib64下對應(yīng)的路徑。

    就ok。

     

    10.配置網(wǎng)橋橋接模式

    修改ifcfg-eth0如下:

    復(fù)制代碼
     1 DEVICE="eth0"  2 BOOTPROTO="static"  3 HWADDR="**********“  4 NM_CONTROLLED="no"  5 ONBOOT="yes"  6 IPADDR="*******”  7 NETMASK="255.255.0.0"  8 GATEWAY="********"  9 TYPE=Ethernet 10 DNS1="8.8.8.8" 11 DNS2="8.8.4.4" 12 BRIDGE=br100
    復(fù)制代碼

    創(chuàng)建ifcfg-br100文件,內(nèi)容如下:

    復(fù)制代碼
     1 DEVICE="br100"  2 BOOTPROTO="static"  3 HWADDR="*********"  4 NM_CONTROLLED="no"  5 ONBOOT="yes"  6 IPADDR="*******"  7 NETMASK="255.255.0.0"  8 GATEWAY="*******"  9 TYPE=Bridge 10 DEFROUTE=yes 11 DNS1="8.8.8.8" 12 DNS2="8.8.4.4"
    復(fù)制代碼

    11.ok,至此,xen的安裝結(jié)束了,可以放心大膽的創(chuàng)建虛擬機(jī)了。

    posted @ 2013-01-31 11:13 張生 閱讀(1668) | 評論 (0)編輯 收藏

    android權(quán)限

    android.permission.ACCESS_CHECKIN_PROPERTIES
    //允許讀寫訪問”properties”表在checkin數(shù)據(jù)庫中,改值可以修改上傳

    android.permission.ACCESS_COARSE_LOCATION
    //允許一個程序訪問CellID或WiFi熱點來獲取粗略的位置

    android.permission.ACCESS_FINE_LOCATION
    //允許一個程序訪問精良位置(如GPS)

    android.permission.ACCESS_LOCATION_EXTRA_COMMANDS
    //允許應(yīng)用程序訪問額外的位置提供命令

    android.permission.ACCESS_MOCK_LOCATION
    //允許程序創(chuàng)建模擬位置提供用于測試

    android.permission.ACCESS_NETWORK_STATE
    //允許程序訪問有關(guān)GSM網(wǎng)絡(luò)信息

    android.permission.ACCESS_SURFACE_FLINGER
    //允許程序使用SurfaceFlinger底層特性

    android.permission.ACCESS_WIFI_STATE
    //允許程序訪問Wi-Fi網(wǎng)絡(luò)狀態(tài)信息

    android.permission.ADD_SYSTEM_SERVICE
    //允許程序發(fā)布系統(tǒng)級服務(wù)

    android.permission.BATTERY_STATS
    //允許程序更新手機(jī)電池統(tǒng)計信息

    android.permission.BLUETOOTH
    //允許程序連接到已配對的藍(lán)牙設(shè)備

    android.permission.BLUETOOTH_ADMIN
    //允許程序發(fā)現(xiàn)和配對藍(lán)牙設(shè)備

    android.permission.BRICK
    //請求能夠禁用設(shè)備(非常危險

    android.permission.BROADCAST_PACKAGE_REMOVED
    //允許程序廣播一個提示消息在一個應(yīng)用程序包已經(jīng)移除后

    android.permission.BROADCAST_STICKY
    //允許一個程序廣播常用intents

    android.permission.CALL_PHONE
    //允許一個程序初始化一個電話撥號不需通過撥號用戶界面需要用戶確認(rèn)

    android.permission.CALL_PRIVILEGED
    //允許一個程序撥打任何號碼,包含緊急號碼無需通過撥號用戶界面需要用戶確認(rèn)

    android.permission.CAMERA
    //請求訪問使用照相設(shè)備

    android.permission.CHANGE_COMPONENT_ENABLED_STATE
    //允許一個程序是否改變一個組件或其他的啟用或禁用

    android.permission.CHANGE_CONFIGURATION
    //允許一個程序修改當(dāng)前設(shè)置,如本地化

    android.permission.CHANGE_NETWORK_STATE
    //允許程序改變網(wǎng)絡(luò)連接狀態(tài)

    android.permission.CHANGE_WIFI_STATE
    //允許程序改變Wi-Fi連接狀態(tài)

    android.permission.CLEAR_APP_CACHE
    //允許一個程序清楚緩存從所有安裝的程序在設(shè)備中

    android.permission.CLEAR_APP_USER_DATA
    //允許一個程序清除用戶設(shè)置

    android.permission.CONTROL_LOCATION_UPDATES
    //允許啟用禁止位置更新提示從無線模塊

    android.permission.DELETE_CACHE_FILES
    //允許程序刪除緩存文件

    android.permission.DELETE_PACKAGES
    //允許一個程序刪除包

    android.permission.DEVICE_POWER
    //允許訪問底層電源管理

    android.permission.DIAGNOSTIC
    //允許程序RW診斷資源

    android.permission.DISABLE_KEYGUARD
    //允許程序禁用鍵盤鎖

    android.permission.DUMP
    //允許程序返回狀態(tài)抓取信息從系統(tǒng)服務(wù)

    android.permission.EXPAND_STATUS_BAR
    //允許一個程序擴(kuò)展收縮在狀態(tài)欄,android開發(fā)網(wǎng)提示應(yīng)該是一個類似Windows Mobile中的托盤程序

    android.permission.FACTORY_TEST
    //作為一個工廠測試程序,運(yùn)行在root用戶

    android.permission.FLASHLIGHT
    //訪問閃光燈,android開發(fā)網(wǎng)提示HTC Dream不包含閃光燈

    android.permission.FORCE_BACK
    //允許程序強(qiáng)行一個后退操作是否在頂層activities

    android.permission.FOTA_UPDATE
    //暫時不了解這是做什么使用的,android開發(fā)網(wǎng)分析可能是一個預(yù)留權(quán)限.

    android.permission.GET_ACCOUNTS
    //訪問一個帳戶列表在Accounts Service中

    android.permission.GET_PACKAGE_SIZE
    //允許一個程序獲取任何package占用空間容量

    android.permission.GET_TASKS
    //允許一個程序獲取信息有關(guān)當(dāng)前或最近運(yùn)行的任務(wù),一個縮略的任務(wù)狀態(tài),是否活動等等

    android.permission.HARDWARE_TEST
    //允許訪問硬件

    android.permission.INJECT_EVENTS
    //允許一個程序截獲用戶事件如按鍵、觸摸、軌跡球等等到一個時間流,android 開發(fā)網(wǎng)提醒算是hook技術(shù)吧

    android.permission.INSTALL_PACKAGES
    //允許一個程序安裝packages

    android.permission.INTERNAL_SYSTEM_WINDOW
    //允許打開窗口使用系統(tǒng)用戶界面

    android.permission.INTERNET
    //允許程序打開網(wǎng)絡(luò)套接字

    android.permission.MANAGE_APP_TOKENS
    //允許程序管理(創(chuàng)建、催后、 z- order默認(rèn)向z軸推移)程序引用在窗口管理器中

    android.permission.MASTER_CLEAR
    //目前還沒有明確的解釋,android開發(fā)網(wǎng)分析可能是清除一切數(shù)據(jù),類似硬格機(jī)

    android.permission.MODIFY_AUDIO_SETTINGS
    //允許程序修改全局音頻設(shè)置

    android.permission.MODIFY_PHONE_STATE
    //允許修改話機(jī)狀態(tài),如電源,人機(jī)接口等

    android.permission.MOUNT_UNMOUNT_FILESYSTEMS
    //允許掛載和反掛載文件系統(tǒng)可移動存儲

    android.permission.PERSISTENT_ACTIVITY
    //允許一個程序設(shè)置他的activities顯示

    android.permission.PROCESS_OUTGOING_CALLS
    //允許程序監(jiān)視、修改有關(guān)播出電話

    android.permission.READ_CALENDAR
    //允許程序讀取用戶日歷數(shù)據(jù)

    android.permission.READ_CONTACTS
    //允許程序讀取用戶聯(lián)系人數(shù)據(jù)

    android.permission.READ_FRAME_BUFFER
    //允許程序屏幕波或和更多常規(guī)的訪問幀緩沖數(shù)據(jù)

    android.permission.READ_INPUT_STATE
    //允許程序返回當(dāng)前按鍵狀態(tài)

    android.permission.READ_LOGS
    //允許程序讀取底層系統(tǒng)日志文件

    android.permission.READ_OWNER_DATA
    //允許程序讀取所有者數(shù)據(jù)

    android.permission.READ_SMS
    //允許程序讀取短信息

    android.permission.READ_SYNC_SETTINGS
    //允許程序讀取同步設(shè)置

    android.permission.READ_SYNC_STATS
    //允許程序讀取同步狀態(tài)

    android.permission.REBOOT
    //請求能夠重新啟動設(shè)備

    android.permission.RECEIVE_BOOT_COMPLETED
    //允許一個程序接收到

    android.permission.RECEIVE_MMS
    //允許一個程序監(jiān)控將收到MMS彩信,記錄或處理

    android.permission.RECEIVE_SMS
    //允許程序監(jiān)控一個將收到短信息,記錄或處理

    android.permission.RECEIVE_WAP_PUSH
    //允許程序監(jiān)控將收到WAP PUSH信息

    android.permission.RECORD_AUDIO
    //允許程序錄制音頻

    android.permission.REORDER_TASKS
    //允許程序改變Z軸排列任務(wù)

    android.permission.RESTART_PACKAGES
    //允許程序重新啟動其他程序

    android.permission.SEND_SMS
    //允許程序發(fā)送SMS短信

    android.permission.SET_ACTIVITY_WATCHER
    //允許程序監(jiān)控或控制activities已經(jīng)啟動全局系統(tǒng)中

    android.permission.SET_ALWAYS_FINISH
    //允許程序控制是否活動間接完成在處于后臺時

    android.permission.SET_ANIMATION_SCALE
    //修改全局信息比例

    android.permission.SET_DEBUG_APP
    //配置一個程序用于調(diào)試

    android.permission.SET_ORIENTATION
    //允許底層訪問設(shè)置屏幕方向和實際旋轉(zhuǎn)

    android.permission.SET_PREFERRED_APPLICATIONS
    //允許一個程序修改列表參數(shù)PackageManager.addPackageToPreferred() 和PackageManager.removePackageFromPreferred()方法

    android.permission.SET_PROCESS_FOREGROUND
    //允許程序當(dāng)前運(yùn)行程序強(qiáng)行到前臺

    android.permission.SET_PROCESS_LIMIT
    //允許設(shè)置最大的運(yùn)行進(jìn)程數(shù)量

    android.permission.SET_TIME_ZONE
    //允許程序設(shè)置時間區(qū)域

    android.permission.SET_WALLPAPER
    //允許程序設(shè)置壁紙

    android.permission.SET_WALLPAPER_HINTS
    //允許程序設(shè)置壁紙hits

    android.permission.SIGNAL_PERSISTENT_PROCESSES
    //允許程序請求發(fā)送信號到所有顯示的進(jìn)程中

    android.permission.STATUS_BAR
    //允許程序打開、關(guān)閉或禁用狀態(tài)欄及圖標(biāo)Allows an application to open, close, or disable the status bar and its icons.

    android.permission.SUBSCRIBED_FEEDS_READ
    //允許一個程序訪問訂閱RSS Feed內(nèi)容提供

    android.permission.SUBSCRIBED_FEEDS_WRITE
    //系統(tǒng)暫時保留改設(shè)置,android開發(fā)網(wǎng)認(rèn)為未來版本會加入該功能。

    android.permission.SYSTEM_ALERT_WINDOW
    //允許一個程序打開窗口使用 TYPE_SYSTEM_ALERT,顯示在其他所有程序的頂層(Allows an application to open windows using the type TYPE_SYSTEM_ALERT, shown on top of all other applications. )

    android.permission.VIBRATE
    //允許訪問振動設(shè)備

    android.permission.WAKE_LOCK
    //允許使用PowerManager的 WakeLocks保持進(jìn)程在休眠時從屏幕消失

    android.permission.WRITE_APN_SETTINGS
    //允許程序?qū)懭階PI設(shè)置

    android.permission.WRITE_CALENDAR
    //允許一個程序?qū)懭氲蛔x取用戶日歷數(shù)據(jù)

    android.permission.WRITE_CONTACTS
    //允許程序?qū)懭氲蛔x取用戶聯(lián)系人數(shù)據(jù)

    android.permission.WRITE_GSERVICES
    //允許程序修改Google服務(wù)地圖

    android.permission.WRITE_OWNER_DATA
    //允許一個程序?qū)懭氲蛔x取所有者數(shù)據(jù)

    android.permission.WRITE_SETTINGS
    //允許程序讀取或?qū)懭胂到y(tǒng)設(shè)置

    android.permission.WRITE_SMS
    //允許程序?qū)懚绦?

    android.permission.WRITE_SYNC_SETTINGS
    //允許程序?qū)懭胪皆O(shè)置
     

    posted @ 2012-09-17 20:45 張生 閱讀(842) | 評論 (1)編輯 收藏

    java調(diào)用url的兩種方式

    java調(diào)用url的兩種方式

    一、在java中調(diào)用url,并打開一個新的窗口

    String url="http://10.58.2.131:8088/spesBiz/test1.jsp";
    String cmd = "cmd.exe /c start " + url;

    try {
     Process proc = Runtime.getRuntime().exec(cmd);
     proc.waitFor();
    }
    catch (Exception e)
    {
     e.printStackTrace();
    }

    二、在java中調(diào)用url,后臺調(diào)用。并取得返回值
    URL U = new URL("http://10.58.2.131:8088/spesBiz/test1.jsp");
    URLConnection connection = U.openConnection();
       connection.connect();
      
       BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
       String line;
       while ((line = in.readLine())!= null)
       {
        result += line;
       }
       in.close();

    posted @ 2012-09-17 14:53 張生 閱讀(2001) | 評論 (0)編輯 收藏

    檢測Tomcat運(yùn)行狀態(tài),自動重啟

    檢測Tomcat運(yùn)行狀態(tài),自動重啟

    http://blog.csdn.net/huangjl2000w/article/details/6338997

    先是主程序:


    import java.io.BufferedReader;
    import java.io.FileReader;
    import java.net.URL;
    import java.net.URLConnection;
    import java.util.Date;

    public class CheckTomcat {
     private static String tomcatroot="";
     private static String monitorurl="";
     private static void checkTomcatIsAlive(String myurl) throws NullPointerException {
      String s;
      boolean isTomcatAlive = false;
      java.io.BufferedReader in;
      try {
       System.out.println(">>>>>>檢測URL:"+myurl);
       URL url = new URL(myurl);
       URLConnection con = url.openConnection();
       in = new java.io.BufferedReader(new java.io.InputStreamReader(con.getInputStream()));
       con.setConnectTimeout(1000);
       con.setReadTimeout(4000);
       while ((s = in.readLine()) != null) {
        if (s.length() > 0) {// 如果能夠讀取到頁面則證明可用,tomcat正常,否則繼續(xù)后面的重啟tomcat操作。
         return;
         }
        }
       in.close();
      }catch (Exception ex) {
       //ex.printStackTrace();
       System.out.println("*************該URL有誤或不可訪問!");
      }
      
      /*if (isTomcatAlive) {
       System.out.println("<" + new Date()+ "> Tomcat is alive but not response!");
       stopTomcat();
      }*/
      RunTomcat runt=new RunTomcat();
      runt.startTomcat(tomcatroot);
     }
     
     /*public static void stopTomcat() {
      try {
       //java.lang.Process p = java.lang.Runtime.getRuntime().exec("net stop /"Apache Tomcat/"");
       java.lang.Process p = java.lang.Runtime.getRuntime().exec(tomcatroot+"bin//shutdown.bat");
       java.io.BufferedReader in = new java.io.BufferedReader(new java.io.InputStreamReader(p.getInputStream()));
       String s;
       String t = "Using JRE_HOME";
       boolean restart = false;
       while ((s = in.readLine()) != null) {
        if (s.indexOf(t) != -1) {
         restart = true;
         break;
        }
       }
       System.out.println("<" + new Date() + "> Tomcat is stop "+ (restart ? "OK" : "ERROR"));
      } catch (Exception e) {
       e.printStackTrace();
      }
     }*/
     
     public static void main(String[] args) {
      System.out.println("********************************************************");
      System.out.println("====本程序自動檢測Tomcat運(yùn)行狀況,必要時自動重啟Tomcat。====");
      System.out.println("********************************************************");
      
      init_config();
      if(monitorurl.equals(""))monitorurl="http://localhost:8080/ExchangeWeb/checkTomcat/monitor.jsp";
      if(tomcatroot.equals(""))tomcatroot="F://tomcat-6.0.20//";
      if(!tomcatroot.endsWith("//"))tomcatroot+="http://";
      while (true) {
       try {
        String random="?random="+Math.random() * 65535;//=====處理數(shù)據(jù)緩存問題======
        CheckTomcat.checkTomcatIsAlive(monitorurl+random);
        Thread.sleep(5000);
        System.out.println("========================checking at <"+new Date()+">");
       } catch (Exception ex) {
        ex.printStackTrace();
       }
      }
     }
     
     static private void init_config() {
      try{
       CheckTomcat me=new CheckTomcat();
       String maindir=me.getClass().getResource("/").toURI().getPath();
       System.out.println(">>>>>>配置文件目錄:"+maindir);
       String sLine;
       String filename=maindir+"config.xml";
       BufferedReader buffReader = new BufferedReader(new FileReader(filename));
       while((sLine = buffReader.readLine())!=null)
       { 
        sLine = sLine.trim();
        if(sLine.trim()!="" && !sLine.equals("")){
         if(sLine.toLowerCase().startsWith("tomcatroot")){
          int npos=sLine.indexOf("tomcatroot");
          npos+="tomcatroot".length();
          tomcatroot=sLine.substring(npos).trim();
          if(tomcatroot.startsWith("="))tomcatroot=tomcatroot.substring(1);
         }
         else if(sLine.toLowerCase().startsWith("monitorurl")){
          int npos=sLine.indexOf("monitorurl");
          npos+="monitorurl".length();
          monitorurl=sLine.substring(npos).trim();
          if(monitorurl.startsWith("="))monitorurl=monitorurl.substring(1);
         }
        }
       }
       buffReader=null;
      }catch(Exception e){
       e.printStackTrace();
       System.out.println("********************************************************");
       System.out.println("====讀取配置文件失敗!系統(tǒng)無法運(yùn)行,請與供應(yīng)商聯(lián)系。====");
       System.out.println("********************************************************");
       System.exit(0);
      }
     }
    }

     

    再是自動重啟Tomcat線程類:

    import java.util.Date;


    public class RunTomcat extends Thread {

     private static String tomcatroot="";
     
     public void startTomcat(String root) {
      this.tomcatroot=root;
      
      System.out.println(">>>>>>Tomcat即將啟動。。。");
      System.out.println(">>>>>>Tomcat根目錄:"+tomcatroot);
      try {
       //java.lang.Process p = java.lang.Runtime.getRuntime().exec("net stop /"Apache Tomcat/"");
       java.lang.Process p = java.lang.Runtime.getRuntime().exec(tomcatroot+"bin//shutdown.bat");
      } catch (Exception e) {
        e.printStackTrace();
      }
      
      try {
       Thread.sleep(3000);//等待shutdown結(jié)束
       //RunTomcat me=new RunTomcat();
       //String maindir=me.getClass().getResource("/").toURI().getPath();
       //java.lang.Process p = java.lang.Runtime.getRuntime().exec(maindir+"checkTomcat.bat");
       java.lang.Process p = java.lang.Runtime.getRuntime().exec(tomcatroot+"bin//startup.bat");
       java.io.BufferedReader in = new java.io.BufferedReader(new java.io.InputStreamReader(p.getInputStream()));
       
       /*String s;
       boolean restart = false;
       String t = "Server startup in";
       while ((s = in.readLine()) != null) {
        System.out.println(s);
        if (s.indexOf(t) != -1) {
         restart = true;
         break;
        }
       }*/
       System.out.println(">>>>>>Tomcat start at <" + new Date() + ">");
      } catch (Exception e) {
       e.printStackTrace();
      }
     }

    }

    接著是檢測tomcat是否活動monitor.jsp文件:

    <%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%>
    <%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
    out.println("path=" + path + "<br>");
    out.println("basePath=" + basePath + "<br>");
    out.println("ok<br>");
    %>

     

    然后是config.xml配置文件:

    tomcatroot=F:/tomcat-6.0.20/
    monitorurl=http://localhost:8080/ExchangeWeb/checkTomcat/monitor.jsp

     

    最后是checkTomcat.bat批處理文件:

    @echo off

    rem=========第一步:配置下面的JAVA_HOME為JDK目錄==========#
    @set JAVA_HOME=C:/Program Files/Java/jdk1.6.0_14

    rem=========第二步:配置下面的CATALINA_HOME為Tomcat目錄==========#
    @set CATALINA_HOME=F:/tomcat-6.0.20

    @set PATH=%JAVA_HOME%/bin/;
    @set CLASSPATH=%JAVA_HOME%/lib/rt.jar;%JAVA_HOME%/lib/tools.jar;%CATALINA_HOME%/lib/servlet-api.jar;%CATALINA_HOME%/lib/jsp-api.jar;


    java CheckTomcat

     

    測試時,只要雙擊執(zhí)行checkTomcat.bat文件即可。

    posted @ 2012-05-24 10:44 張生 閱讀(8869) | 評論 (0)編輯 收藏

    旋轉(zhuǎn)Div

    旋轉(zhuǎn)div

    <div style="position:absolute;filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3)">內(nèi)容啊</div>

    兼容的寫法

    <div style="position:absolute;filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3);-webkit-transform: rotate(270deg); -moz-transform: rotate(270deg); -o-transform: rotate(270deg);transform: rotate(270deg);">內(nèi)容啊</div>

    posted @ 2012-05-18 11:20 張生 閱讀(1163) | 評論 (3)編輯 收藏

    mysql事件自動復(fù)制表

    begin
        set @table_sql ='create table coordinate';
        #set @table_sql =  concat(@table_sql,DATE_FORMAT(NOW(), '%Y%m%d%H%i%s'));
        set @table_sql = concat(@table_sql,curdate()+1);
        #set @table_sql = concat(@table_sql,'daycounts');
        set @table_sql =  concat(@table_sql,"(
          select * from coordinate
        )");
         PREPARE stmt1 FROM @table_sql;
         EXECUTE stmt1;
        end;

    posted @ 2011-09-21 14:36 張生 閱讀(422) | 評論 (0)編輯 收藏

    顏色 16進(jìn)制對照表

    顏色代碼表:以下樣色顯示您可能覺得不夠精確,這和電腦顯示器有直接關(guān)系。您可查看顏色代碼,絕對正確,絕無重復(fù)。

    紅色和粉紅色,以及它們的16進(jìn)制代碼。

    #990033 #CC6699 #FF6699 #FF3366 #993366 #CC0066 #CC0033 #FF0066 #FF0033 ..#CC3399..
    #FF3399 #FF9999 #FF99CC #FF0099 #CC3366 #FF66CC #FF33CC #FFCCFF #FF99FF #FF00CC

    紫紅色,以及它們的16進(jìn)制代碼。

    #FF66FF #CC33CC #CC00FF #FF33FF #CC99FF #9900CC #FF00FF #CC66FF #990099 #CC0099
    #CC33FF #CC99CC #990066 #993399 #CC66CC #CC00CC #663366      
    藍(lán)色,以及它們的16進(jìn)制代碼。
    #660099 #666FF #000CC #9933CC #666699 #660066 #333366 #0066CC #9900FF #333399
    #99CCFF #9933FF #330099 #6699FF #9966CC #3300CC #003366 #330033 #3300FF #6699CC
    #663399 #3333FF #006699 #6633CC #3333CC #3399CC #6600CC #0066FF #0099CC #9966FF
    #0033FF #66CCFF #330066 #3366FF #3399FF #6600FF #3366CC #003399 #6633FF #000066
    #0099FF #CCCCFF #000033 #33CCFF #9999FF #0000FF #00CCFF #9999CC #000099 #6666CC
    #0033CC                  
    黃色、褐色、玫瑰色和橙色,以及它們的16進(jìn)制代碼。
    #FFFFCC #FFCC00 #CC99090 #663300 #FF6600 #663333 #CC6666 #FF6666 #FF0000 #FFFF99
    #FFCC66 #FF9900 #FF9966 #CC3300 #996666 #FFCCCC #660000 #FF3300 #FF6666 #FFCC33
    #CC6600 #FF6633 #996633 #CC9999 #FF3333 #990000 #CC9966 #FFFF33 #CC9933 #993300
    #FF9933 #330000 #993333 #CC3333 #CC0000 #FFCC99 #FFFF00 #996600 #CC6633  
    綠色,以及它們的16進(jìn)制代碼。
    #99FFFF #33CCCC #00CC99 #99FF99 #009966 #33FF33 #33FF00 #99CC33 #CCC33 #66FFFF
    #66CCCC #66FFCC #66FF66 #009933 #00CC33 #66FF00 #336600 #33300 #33FFFF #339999
    #99FFCC #339933 #33FF66 #33CC33 #99FF00 #669900 #666600 #00FFFF #336666 #00FF99
    #99CC99 #00FF66 #66FF33 #66CC00 #99CC00 #999933 #00CCCC #006666 #339966 #66FF99
    #CCFFCC #00FF00 #00CC00 #CCFF66 #CCCC66 #009999 #003333 #006633 #33FF99 #CCFF99
    #66CC33 #33CC00 #CCFF33 #666633 #669999 #00FFCC #336633 #33CC66 #99FF66 #006600
    #339900 #CCFF00 #999966 #99CCCC #33FFCC #669966 #00CC66 #99FF33 #003300 #99CC66
    #999900 #CCCC99 #CCFFFF #33CC99 #66CC66 #66CC99 #00FF33 #009900 #669900 #669933
    #CCCC00                  
    白色、灰色和黑色,以及它們的16進(jìn)制代碼。
    #FFFFF #CCCCCC #999999 #666666 #333333 #000000        
    16色和它們的16進(jìn)制代碼。
    Aqua Black Fuchsia Gray Gree Lime Maroon Navy Olive Purple
    Red Silver Teal White Yellow Blue        

    posted @ 2011-08-12 17:55 張生 閱讀(96155) | 評論 (4)編輯 收藏

    彈簧式菜單 CSS樣式

    <!DOCTYPE html PUBliC "-//W3C//DTD XHTML 1.0 Transitional//EN"

    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" lang="zh-CN">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>css菜單演示</title>


    <style type="text/css">
    <!--

    *{margin:0;padding:0;border:0;}
    body {
     font-family: arial, 宋體, serif;
            font-size:12px;
    }


    #nav {
      line-height: 24px;  list-style-type: none; background:#666;   width:80px;
    }

    #nav a {
     display: block; width: 80px; text-align:center;
    }

    #nav a:link  {
     color:#666; text-decoration:none;
    }
    #nav a:visited  {
     color:#666;text-decoration:none;
    }
    #nav a:hover  {
     color:#FFF;text-decoration:none;font-weight:bold;
    }

    #nav li {
     /*float: left*/; width: 80px; background:#CCC;
    }
    #nav li a:hover{
     background:#999;
    }
    #nav li ul {
     line-height: 27px;  list-style-type: none;text-align:left;
     left: -999em; width: 80px; position: absolute;
    }
    #nav li ul li{
     float: left; width: 80px;
     background: #F6F6F6;
    }


    #nav li ul a{
     display: block; width: 80px;w\idth:56px;text-align:left;padding-left:24px;
    }

    #nav li ul a:link  {
     color:#666; text-decoration:none;
    }
    #nav li ul a:visited  {
     color:#666;text-decoration:none;
    }
    #nav li ul a:hover  {
     color:#F3F3F3;text-decoration:none;font-weight:normal;
     background:#C00;
    }

    #nav li:hover ul {
     left: auto;
    }
    #nav li.sfhover ul {
     left: auto;position:static;
    }
    #content {
     clear: left;
    }


    -->
    </style>

    <script type=text/javascript><!--//--><![CDATA[//><!--
    function menuFix() {
     var sfEls = document.getElementById("nav").getElementsByTagName("li");
     for (var i=0; i<sfEls.length; i++) {
      sfEls[i].onmouseover=function() {
      this.className+=(this.className.length>0? " ": "") + "sfhover";
      }
      sfEls[i].onMouseDown=function() {
      this.className+=(this.className.length>0? " ": "") + "sfhover";
      }
      sfEls[i].onMouseUp=function() {
      this.className+=(this.className.length>0? " ": "") + "sfhover";
      }
      sfEls[i].onmouseout=function() {
      this.className=this.className.replace(new RegExp("( ?|^)sfhover\\b"),

    "");
      }
     }
    }
    window.onload=menuFix;

    //--><!]]></script>

    </head>
    <body>


    <ul id="nav">
    <li><a href="#">產(chǎn)品介紹</a>
     <ul>
     <li><a href="#">產(chǎn)品一</a></li>
     <li><a href="#">產(chǎn)品一</a></li>
     <li><a href="#">產(chǎn)品一</a></li>
     <li><a href="#">產(chǎn)品一</a></li>
     <li><a href="#">產(chǎn)品一</a></li>
     <li><a href="#">產(chǎn)品一</a></li>
     </ul>
    </li>
    <li><a href="#">服務(wù)介紹</a>
     <ul>
     <li><a href="#">服務(wù)二</a></li>
     <li><a href="#">服務(wù)二</a></li>
     <li><a href="#">服務(wù)二</a></li>
     <li><a href="#">服務(wù)二服務(wù)二</a></li>
     <li><a href="#">服務(wù)二服務(wù)二服務(wù)二</a></li>
     <li><a href="#">服務(wù)二</a></li>
     </ul>
    </li>
    <li><a href="#">成功案例</a>
     <ul>
     <li><a href="#">案例三</a></li>
     <li><a href="#">案例</a></li>
     <li><a href="#">案例三案例三</a></li>
     <li><a href="#">案例三案例三案例三</a></li>
     </ul>
    </li>
    <li><a href="#">關(guān)于我們</a>
     <ul>
     <li><a href="#">我們四</a></li>
     <li><a href="#">我們四</a></li>
     <li><a href="#">我們四</a></li>
     <li><a href="#">我們四111</a></li>
     </ul>
    </li>

    <li><a href="#">在線演示</a>
     <ul>
     <li><a href="#">演示</a></li>
     <li><a href="#">演示</a></li>
     <li><a href="#">演示</a></li>
     <li><a href="#">演示演示演示</a></li>
     <li><a href="#">演示演示演示</a></li>
     <li><a href="#">演示演示</a></li>
     <li><a href="#">演示演示演示</a></li>
     <li><a href="#">演示演示演示演示演示</a></li>
     </ul>
    </li>
    <li><a href="#">聯(lián)系我們</a>
     <ul>
     <li><a href="#">聯(lián)系聯(lián)系聯(lián)系聯(lián)系聯(lián)系</a></li>
     <li><a href="#">聯(lián)系聯(lián)系聯(lián)系</a></li>
     <li><a href="#">聯(lián)系</a></li>
     <li><a href="#">聯(lián)系聯(lián)系</a></li>
     <li><a href="#">聯(lián)系聯(lián)系</a></li>
     <li><a href="#">聯(lián)系聯(lián)系聯(lián)系</a></li>
     <li><a href="#">聯(lián)系聯(lián)系聯(lián)系</a></li>
     </ul>
    </li>

    </ul>

    </body>
    </html>

    posted @ 2011-08-12 08:58 張生 閱讀(396) | 評論 (0)編輯 收藏

    JS中數(shù)組Array的用法{轉(zhuǎn)載}

    js數(shù)組元素的添加和刪除一直比較迷惑,今天終于找到詳細(xì)說明的資料了,先給個我測試的代碼^-^
    var arr = new Array();
    arr[0] = "aaa";
    arr[1] = "bbb";
    arr[2] = "ccc";
    //alert(arr.length);//3
    arr.pop();
    //alert(arr.length);//2
    //alert(arr[arr.length-1]);//bbb
    arr.pop();
    //alert(arr[arr.length-1]);//aaa
    //alert(arr.length);//1

    var arr2 = new Array();
    //alert(arr2.length);//0
    arr2[0] = "aaa";
    arr2[1] = "bbb";
    //alert(arr2.length);//2
    arr2.pop();
    //alert(arr2.length);//1
    arr2 = arr2.slice(0,arr2.length-1);
    //alert(arr2.length);//0
    arr2[0] = "aaa";
    arr2[1] = "bbb";
    arr2[2] = "ccc";
    arr2 = arr2.slice(0,1);
    alert(arr2.length);//1
    alert(arr2[0]);//aaa
    alert(arr2[1]);//undefined

    shift:刪除原數(shù)組第一項,并返回刪除元素的值;如果數(shù)組為空則返回undefined
    var a = [1,2,3,4,5];
    var b = a.shift(); //a:[2,3,4,5]   b:1

    unshift:將參數(shù)添加到原數(shù)組開頭,并返回數(shù)組的長度
    var a = [1,2,3,4,5];
    var b = a.unshift(-2,-1); //a:[-2,-1,1,2,3,4,5]   b:7
    注:在IE6.0下測試返回值總為undefined,F(xiàn)F2.0下測試返回值為7,所以這個方法的返回值不可靠,需要用返回值時可用splice代替本方法來使用。

    pop:刪除原數(shù)組最后一項,并返回刪除元素的值;如果數(shù)組為空則返回undefined
    var a = [1,2,3,4,5];
    var b = a.pop(); //a:[1,2,3,4]   b:5//不用返回的話直接調(diào)用就可以了

    push:將參數(shù)添加到原數(shù)組末尾,并返回數(shù)組的長度
    var a = [1,2,3,4,5];
    var b = a.push(6,7); //a:[1,2,3,4,5,6,7]   b:7

    concat:返回一個新數(shù)組,是將參數(shù)添加到原數(shù)組中構(gòu)成的
    var a = [1,2,3,4,5];
    var b = a.concat(6,7); //a:[1,2,3,4,5]   b:[1,2,3,4,5,6,7]

    splice(start,deleteCount,val1,val2,...):start位置開始刪除deleteCount項,并從該位置起插入val1,val2,...

    在清空數(shù)組時,只需傳遞startIndex

    如果不刪除所有元素,再傳遞deleteCount參數(shù)。

    splice還具有先刪除后添加的功能,即先刪除幾個元素,然后在刪除的位置再添加若干元素,刪除與添加的元素的個數(shù)沒有必須相等,這時侯deleteCount也是要用到的。
    var a = [1,2,3,4,5];
    var b = a.splice(2,2,7,8,9); //a:[1,2,7,8,9,5]   b:[3,4]
    var b = a.splice(0,1); //同shift
    a.splice(0,0,-2,-1); var b = a.length;//同unshift
    var b = a.splice(a.length-1,1);//同pop
    a.splice(a.length,0,6,7); var b = a.length; //同push

    reverse:將數(shù)組反序
    var a = [1,2,3,4,5];
    var b = a.reverse(); //a:[5,4,3,2,1]   b:[5,4,3,2,1]

    sort(orderfunction):按指定的參數(shù)對數(shù)組進(jìn)行排序
    var a = [1,2,3,4,5];
    var b = a.sort(); //a:[1,2,3,4,5]   b:[1,2,3,4,5]

    slice(start,end):返回從原數(shù)組中指定開始下標(biāo)到結(jié)束下標(biāo)之間的項組成的新數(shù)組
    var a = [1,2,3,4,5];
    var b = a.slice(2,5); //a:[1,2,3,4,5]   b:[3,4,5]

    join(separator):將數(shù)組的元素組起一個字符串,以separator為分隔符,省略的話則用默認(rèn)用逗號為分隔符
    var a = [1,2,3,4,5];
    var b = a.join("|"); //a:[1,2,3,4,5]   b:"1|2|3|4|5"

    再給個利用數(shù)組模擬javaStringBuffer處理字符串的方法:

    /**
    * 字符串處理函數(shù)
    */
    function StringBuffer() {
    var arr = new Array;
    this.append = function(str) {
        arr[arr.length] = str;
    };

    this.toString = function() {
        return arr.join("");//把append進(jìn)來的數(shù)組ping成一個字符串
    };
    }

    今天在應(yīng)用中突然發(fā)現(xiàn)join是一種把數(shù)組轉(zhuǎn)換成字符串的好方法,故封裝成對象使用了:

    /**
    *把數(shù)組轉(zhuǎn)換成特定符號分割的字符串
    */
    function arrayToString(arr,separator) {
    if(!separator) separator = "";//separator為null則默認(rèn)為空
        return arr.join(separator);
    }

    /**
    * 查找數(shù)組包含的字符串
    */
    function arrayFindString(arr,string) {
    var str = arr.join("");
        return str.indexOf(string);
    }

    posted @ 2011-06-24 12:27 張生 閱讀(173672) | 評論 (10)編輯 收藏

    struts2 當(dāng)spring遇到j(luò)son插件時的異常 及解決(引用)

    struts2 當(dāng)spring遇到j(luò)son插件時的異常 及解決




    1 我的Action代碼
    package common.regist.action;
    import com.opensymphony.xwork2.ActionSupport;
    import common.regist.Interface.IRegistService;
    import domain.User;
    public class RegistAction extends ActionSupport {
    private IRegistService service;

    private String responseText;

    private String username = "";

    private User user;

    public IRegistService getService() {
      return service;
    }
    public void setService(IRegistService service) {
      this.service = service;
    }

    public User getUser() {
      return user;
    }

    public void setUser(User user) {
      this.user = user;
    }

    public String validateUserName() {
      if(service.validateUser(username).size()==0)
      {
       this.setResponseText("true");
       return ActionSupport.SUCCESS;
      }
      this.setResponseText("false");
      return ActionSupport.SUCCESS;
    }


    public String execute() throws Exception {
      service.regist(user);
      return super.execute();
    }

    public String getResponseText() {
      return responseText;
    }

    public void setResponseText(String responseText) {
      this.responseText = responseText;
    }

    public String getUsername() {
      return username;
    }
    public void setUsername(String username) {
      this.username = username;
    }

    }

    配置文件里:
    <package name="ajax" extends="json-default" namespace="/login">
      <action name="validateUserName" class="registAction" method="validateUserName">
       <result type="json"></result>
      </action>
      </package>

    發(fā)生的異常
    org.apache.catalina.core.StandardWrapperValve invoke
    嚴(yán)重: Servlet.service() for servlet default threw exception
    java.sql.SQLException: Positioned Update not supported.
    低調(diào)的貓(624767717) 15:04:17
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:910)
    at com.mysql.jdbc.ResultSet.getCursorName(ResultSet.java:1917)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.googlecode.jsonplugin.JSONWriter.bean(JSONWriter.java:220)
    at com.googlecode.jsonplugin.JSONWriter.process(JSONWriter.java:152)
    at com.googlecode.jsonplugin.JSONWriter.value(JSONWriter.java:120)
    at com.googlecode.jsonplugin.JSONWriter.add(JSONWriter.java:302)
    at com.googlecode.jsonplugin.JSONWriter.bean(JSONWriter.java:221)
    at com.googlecode.jsonplugin.JSONWriter.process(JSONWriter.java:152)
    at com.googlecode.jsonplugin.JSONWriter.value(JSONWriter.java:120)
    at com.googlecode.jsonplugin.JSONWriter.add(JSONWriter.java:302)
    at com.googlecode.jsonplugin.JSONWriter.bean(JSONWriter.java:221)
    at com.googlecode.jsonplugin.JSONWriter.process(JSONWriter.java:152)
    at com.googlecode.jsonplugin.JSONWriter.value(JSONWriter.java:120)
    at com.googlecode.jsonplugin.JSONWriter.add(JSONWriter.java:302)
    at com.googlecode.jsonplugin.JSONWriter.bean(JSONWriter.java:221)
    at com.googlecode.jsonplugin.JSONWriter.process(JSONWriter.java:152)
    at com.googlecode.jsonplugin.JSONWriter.value(JSONWriter.java:120)
    at com.googlecode.jsonplugin.JSONWriter.add(JSONWriter.java:302)
    at com.googlecode.jsonplugin.JSONWriter.bean(JSONWriter.java:221)
    at com.googlecode.jsonplugin.JSONWriter.process(JSONWriter.java:152)
    at com.googlecode.jsonplugin.JSONWriter.value(JSONWriter.java:120)
    at com.googlecode.jsonplugin.JSONWriter.add(JSONWriter.java:302)
    at com.googlecode.jsonplugin.JSONWriter.bean(JSONWriter.java:221)
    at com.googlecode.jsonplugin.JSONWriter.process(JSONWriter.java:152)
    at com.googlecode.jsonplugin.JSONWriter.value(JSONWriter.java:120)
    at com.googlecode.jsonplugin.JSONWriter.add(JSONWriter.java:302)
    at com.googlecode.jsonplugin.JSONWriter.bean(JSONWriter.java:221)
    at com.googlecode.jsonplugin.JSONWriter.process(JSONWriter.java:152)
    at com.googlecode.jsonplugin.JSONWriter.value(JSONWriter.java:120)
    at com.googlecode.jsonplugin.JSONWriter.add(JSONWriter.java:302)
    at com.googlecode.jsonplugin.JSONWriter.bean(JSONWriter.java:221)
    at com.googlecode.jsonplugin.JSONWriter.process(JSONWriter.java:152)
    at com.googlecode.jsonplugin.JSONWriter.value(JSONWriter.java:120)
    at com.googlecode.jsonplugin.JSONWriter.add(JSONWriter.java:302)
    at com.googlecode.jsonplugin.JSONWriter.bean(JSONWriter.java:221)
    at com.googlecode.jsonplugin.JSONWriter.process(JSONWriter.java:152)
    at com.googlecode.jsonplugin.JSONWriter.value(JSONWriter.java:120)
    at com.googlecode.jsonplugin.JSONWriter.write(JSONWriter.java:88)
    at com.googlecode.jsonplugin.JSONUtil.serialize(JSONUtil.java:90)
    at com.googlecode.jsonplugin.JSONResult.execute(JSONResult.java:119)


    分析---------------------------------------------------------------------------------------
    在我的Action中一共有4個properties,其中有個bean是service,而且是在spring framework中已經(jīng)實例化了的,問題就出在它身上了。于是在struts-config中加入該bean的exclude,再測試,成功了!
    發(fā)送action的request后,服務(wù)返回JSON數(shù)據(jù)。

    解決-----------------------------------------------------------------------------------------
    <action name="validateUserName" class="registAction" method="validateUserName">
       <result type="json">
         <param name="excludeProperties">      //序列化屬性中排除 service
                         service
       </param>

    </result>
      </action>
      </package>

    posted @ 2011-06-09 15:58 張生 閱讀(1015) | 評論 (0)編輯 收藏

    Eclipse下使用Subversion

    作者:朱先忠編譯 轉(zhuǎn)自天極http://dev.yesky.com/356/2578856.shtml
    CVS很酷,但Subversion更酷。然而,如果你在使用Eclipse進(jìn)行開發(fā),那么你可能直到近來才能利用Subversion帶來的優(yōu)點
    摘要 CVS很酷,但Subversion更酷。然而,如果你在使用Eclipse進(jìn)行開發(fā),那么你可能直到近來才能利用Subversion帶來的優(yōu)點。隨著 Subclipse的發(fā)行,Subversion可能會最終在你的Eclipse IDE環(huán)境充分發(fā)揮其威力而壓倒CVS。
    一、SCM和Subversion簡介

      軟件配置管理(SCM)是管理源碼并保持其安全的良好藝術(shù),它能實現(xiàn)源碼與其他團(tuán)隊成員之間保持共享,并且能夠?qū)χ右员Wo(hù)。良好地利用SCM,你能夠容易地跟蹤軟件的發(fā)行和新的開發(fā)分支;這樣以來,可以更為容易地標(biāo)識和修正發(fā)行產(chǎn)品中的錯誤。

    其實,有大量的SCM工具可用,既有開源的和也有商業(yè)化的,例如StarTeam,Perforce,BitKeeper和ClearCase。在開源 世界里,事實上的SCM標(biāo)準(zhǔn)是并發(fā)版本管理系統(tǒng)(CVS),它被廣泛應(yīng)用于世界范圍內(nèi)的成百上千的開源和商業(yè)工程。然而,CVS也存在下列許多固有的缺 陷,這使得它無法非常完美地適合于現(xiàn)代工程開發(fā):

    · 實質(zhì)上針對文本文件的設(shè)計使得CVS處理二進(jìn)制文件能力比較差。在每一次提交時,二進(jìn)制文件被以整體形式傳輸和存儲,這將帶來帶寬和磁盤空間的浪費。

    · 在CVS中,你不能移動文件和目錄。你唯一的選擇基本上就是刪除并且重新添加它們,從而失去了整個過程中的所有的文件歷史信息。

    · CVS中沒有實現(xiàn)原子提交的概念。比方說,你要把10個文件提交到服務(wù)器,而該提交操作往往在整個過程的中途停了下來。(這很可能會發(fā)生,如果某人同時提 交一個文件,或甚至如果你的網(wǎng)絡(luò)失敗或你的PC重新啟動的話。)在這種情況下,服務(wù)器將僅記錄下你的修正的一半信息,這可能會使代碼基部分處于一種潛在地 不穩(wěn)定的狀態(tài)。

    Subversion是一種比較新的開源SCM工具,其設(shè)計目的是力圖從根本上克服原CVS所具有的限制。它是一種良好設(shè)計的工具,具有適合于現(xiàn)代開發(fā)的許多新特征:

    · 提交是原子化的。提交的文件都能夠被正確加入到一個新的修訂當(dāng)中,否則倉庫不會被更新;并且每一個新的修訂僅由一次提交中的變化部分組成。

    · Subversion對文本和二進(jìn)制文件使用一種巧妙的二進(jìn)制技術(shù),這既優(yōu)化了網(wǎng)絡(luò)流量也優(yōu)化了倉庫磁盤空間。

    · 在Subversion中,每一次修訂都代表了一個特定時間內(nèi)完整的目錄樹拷貝。文件和目錄可以不加限制地進(jìn)行移動。

    · Subversion僅存儲兩個版本之間的修改內(nèi)容,這不僅節(jié)約了磁盤空間,并且意味著標(biāo)識一個新版本或創(chuàng)建一種新的子內(nèi)容幾乎可以立即實現(xiàn)。

    · 你可以以多種途徑來存取一個Subversion倉庫,具體則依賴于你的需要:使用HTTP或HTTPS(與WebDAV一起使用),使用快速的專利性svn:協(xié)議,或直接經(jīng)由本地文件,等等。

    二、Subclipse插件與Eclipse的集成

    一種良好的SCM應(yīng)該與你的工作環(huán)境緊密地集成到一起。沒有誰真正喜歡轉(zhuǎn)到命令行以把文件添加到倉庫。Eclipse很早就實現(xiàn)了CVS集成,但是直到 最近Subversion用戶仍沒有被引起重視。現(xiàn)在,新的Subclipse插件提供了在Eclipse中的一種平滑的Subversion集成。

    (一) 安裝Subclipse插件

    下面,你以通常的方法從更新站點下安裝Subclipse:

    1. 打開"Find and install"窗口("Help>Software Updates>Find and Install")。

    2. 選擇"Search for new features to install"選項并點擊Next。

    3. 點擊"New Remote Site"并且創(chuàng)建一遠(yuǎn)程站點,使用名字Subclipse和URL http://subclipse.tigris.org/update_1.0.x(參考圖1)。

    4. 在結(jié)果安裝窗口中,把"Subeclipse in the Features"選擇到安裝列表中,并且通過向?qū)黹_始安裝插件。

    5. 完成這些之后,重新啟動Eclipse。現(xiàn)在,你可以繼續(xù)往下進(jìn)行!


    圖1.安裝Subclipse插件

    (二) 建立Repository定義

    現(xiàn)在,既然你已經(jīng)安裝完插件;那么,接下來,你需要告訴它你的工程倉庫位于何處。你是在SVN Repository視圖中實現(xiàn)的。打開這個視圖("Windows>Show View>Other>SVN Repository")并且在上下文菜單中選擇"New>Repository Location"以顯示一個如圖2所示的對話框。輸入適當(dāng)?shù)腢RL并且點擊"Finish"。


    圖2.添加一個倉庫定義


    (三) 檢出(Check Out)一個工程

    一旦建立一個倉庫,你就可以在SVN Repository視圖中瀏覽所有的內(nèi)容(見圖3)。我們后面將會看到,這個視圖是一種與Subversion進(jìn)行交互的非常方便的方式。




    圖3.SVN Repository視圖。



    現(xiàn)在,讓我們把一個工程檢出到你的Eclipse工作區(qū)中。這只需選擇你需要的Subversion倉庫,打開上下文菜單,并且選擇"Checkout"即可。這將打開一個具有兩個選項的向?qū)В?br />
    · Check out as a Project configured using the New Project Wizard-這個選項打開新工程向?qū)В@可以讓你使用內(nèi)建的Eclipse工程類型配置工程。這個選項通常是最好用的,因為它讓你使用相同的工程模板和 配置屏幕,而當(dāng)你創(chuàng)建一個常規(guī)工程時你經(jīng)常使用它們。

    · Check out as a Project in the Workspace-這個選項簡單地在你的包含檢出源碼的工作區(qū)中創(chuàng)建一個Eclipse工程。

    在以上兩種情況下,你仍然需要更新工程的構(gòu)建路徑,因為在檢出該工程源碼之前,Eclipse不能確定這些Java源碼所在的位置。

    (四) 把一個新工程導(dǎo)入到倉庫中

    如果你只是啟動了一個新的工程,那么你需要把它導(dǎo)入到Subversion倉庫。Subclipse提供了一種方便的方式來直接從你的IDE內(nèi)部實現(xiàn)這 一點。為此,只需要從Package Explorer視圖下選擇你的工程,并且在上下文菜單中選擇"Team>Share Project"。你可以使用現(xiàn)有倉庫之一或創(chuàng)建一新的倉庫定義。在你指定倉庫和工程名之后,你能指定你想放到倉庫中的文件和目錄并且提供一個初始注釋 (見圖4)。這種方法特別有用,因為它讓你有選擇地導(dǎo)入僅由Subversion管理的文件,即使該工程還包含其它文件(例如生成的類,臨時文件或其它不 是必需的內(nèi)容等)。


    圖4.把一個工程導(dǎo)入到一個Subversion倉庫中

    三、在Eclipse中使用Subversion

    現(xiàn)在,既然你的支持Subversion的工程已經(jīng)啟動并且運(yùn)行起來,那么大多數(shù)必要的Subversion命令就可經(jīng)由"Team"上下文菜單存取 (參考圖5)。你可以在Package Explorer中看到你的本地文件的狀態(tài)(參考圖6),其中,任何修改了的文件都被標(biāo)記上一個星號。存儲在倉庫中的文件都顯示一個小黃桶圖標(biāo)(代表了一 個數(shù)據(jù)庫);還沒有被添加到倉庫中的文件以一個問號顯示。


    圖5.大多數(shù)Subversion命令能被經(jīng)由Team菜單存取

    圖6.你可以在Package Explorer中看到本地文件的狀態(tài)

    (一) 與Repository保持同步

    從倉庫中更新你的文件并且把你的變化提交到倉庫是相當(dāng)直接的過程,這可以使用"Team>Update and Team>Commit"菜單選項來實現(xiàn)。在提交你的變化之前,你可能想看一下自從你的上次更新以來是否服務(wù)器上有任何文件被修改。為此,你可以使 用"Team >Synchronize with Repository"。這個命令讓你看到有哪些內(nèi)容已經(jīng)被局部地修改,有哪些內(nèi)容在服務(wù)器上修改,以及這兩種修改之間的任何沖突(參考圖7)。你還可以 以可視化方式看到?jīng)_突的版本,并且在提交你的變化之前糾正任何比較突出的沖突。


    圖7.與倉庫保持同步

    (二) 使用屬性

    屬性是Subversion具有創(chuàng)新性的特征之一。在Subversion中,你可以把元數(shù)據(jù)("properties")關(guān)聯(lián)到任何文件或目錄。你可以定義任何你喜歡的屬性,但是Subversion也提供了一些有用的內(nèi)置屬性,例如下面圖8中所提供的這些屬性:

    · svn:executable屬性,允許你在支持這種能力的操作系統(tǒng)上設(shè)置一個文件的可執(zhí)行標(biāo)志。

    · svn:need-lock屬性,可以用來在文件(例如,對二進(jìn)制文件非常有用)上強(qiáng)加排斥鎖。一個定義了svn:need-lock屬性的文件一次只能 被一個人修改。當(dāng)該文件被檢出時,它是只讀的。如果你想修改該文件,你需要首先使用"Team>Lock"菜單選項。之后,使用"Team> Unlock"釋放該文件,或僅提交你的變化。這一行為將釋放該鎖并且讓其它的用戶也得到該文件上的一把鎖。


    圖8.把一個Subversion屬性添加到一個文件中

    三) Tag和Branch

    在Subversion中,很容易創(chuàng)建新的tag和branch。你可以使用tag來標(biāo)識一個特定的版本(使用一種可讀的名字,例如"Release 1.0")。;而一個branch用于新的開發(fā)工作而不影響主源碼基(稱作trunk)。在一個branch上的開發(fā)仍會繼續(xù)進(jìn)行,直到開發(fā)者已經(jīng)為把變 化集成回主trunk作好準(zhǔn)備。

    在Subversion中,branch和tag都是通過制作給定修訂的一個虛擬副本(以另一個名字 和/或另一個目錄)創(chuàng)建的。在常規(guī)情況下,branch存儲在branches目錄下,tag位于tags目錄下,盡管在實踐中為了滿足你的工程你可以使 用自己的任何定制。

    從Eclipse中,"Team>Branch/Tag"菜單能夠使你創(chuàng)建branch和tag(參考圖9)。其中,Browse按鈕提供了一種方便的方法來查看有哪些branch和tag存在于倉庫中。

    當(dāng)你使用"Team>Switch"創(chuàng)建成功一個新的branch或tag時,你可以非常容易地在branches之間進(jìn)行切換。無論何時你切換 到一個不同的branch(或返回到trunk),Subversion將僅更新文件(它需要保持你的當(dāng)前工作的副本與目的branch之間的同步)。


    圖9.創(chuàng)建一個新的branch或tag

    (四) 修訂歷史

    象大多數(shù)SCM系統(tǒng)一樣,Subversion讓你跟蹤你的源碼的變化。"Team>Show in Resource History"菜單選項能夠使你查詢這些變化的列表(包括對一個文件,目錄或甚至整個工程的改變)(見圖10)。

    記住,在Subversion中,提交是原子性的-一次提交由一組文件變化和一個全局注釋組成。"SVN Resource History"視圖向你顯示每一次提交的一個簡明視圖,包括修改的文件和相關(guān)注釋。


    圖10.歷史資源

    四、結(jié)論

    Subversion是一種強(qiáng)有力的和非常靈活的SCM工具,也是CVS的一個成功的后繼者。結(jié)合Subclipse,Subversion能最終在你的Eclipse IDE環(huán)境中得到全面的發(fā)揮。

    posted @ 2011-05-03 09:18 張生 閱讀(329) | 評論 (0)編輯 收藏

    eclipse集成SVN的server。

    以下是安裝SERVER的方法,COPY防丟失。http://www.open.collab.net/cn/downloads/desktops/installing_cdee.html?_=d
    需要注冊。


    The CollabNet Desktop – Eclipse Edition

    CollabNet Desktop – Eclipse Edition is a freely downloadable set of plugins that CollabNet provides for the Eclipse IDE. This desktop works with and is part of the CollabNet Platform.

    To find, download, and install the latest functionality, follow the instructions in the next two sections:

    • Finding the New CollabNet Desktop – Eclipse Edition Features
    • Installing CollabNet Desktop – Eclipse Edition

    Once you complete the installation, you will be asked if you want to restart the Eclipse SDK. This is not required, but it is recommended.

    Finding the New CollabNet Desktop – Eclipse Edition Features

    To find the new CollabNet Desktop – Eclipse Edition features, follow these steps:

    1. From the Eclipse Help menu, select Software Updates → Find and Install.

      Figure 1: The Eclipse Help menu


    2. In the Install/Update window, select Search for new features to install and click Next.

      Figure 2: The Install/Update window


    3. In the Install window, if you want to use the Eclipse Update Installer, select New Remote Site.

      If you can’t use the Eclipse Update Installer (for example, if your proxy servers do not allow access to the Eclipse Update Installer or if you have limited Internet access), select New Archived Site.

      Figure 3: The Install window



    1. If you selected New Remote Site, fill in the following information:
      • In the Name field, enter "CollabNet Desktop"
      • Copy one of the following into the URL field:
        • For Eclipse 3.5/3.6, copy this URL:
          http://downloads.open.collab.net/eclipse/update-site/e3.5
        • For Eclipse 3.4, copy this URL:
          http://downloads.open.collab.net/eclipse/update-site/e3.4
        • For Eclipse 3.3, copy this URL:
          http://downloads.open.collab.net/eclipse/update-site/e3.3
        • For Eclipse 3.2, copy this URL:
          http://downloads.open.collab.net/eclipse/update-site/e3.2

      When you have completed the information, click OK.


      Figure 4: The New Update Site window


    If you selected New Archived Site, follow these instructions:

    • Download the version of the CollabNet Desktop –
      Eclipse Edition you want to install:
    • In the Select Local Site Archive window, navigate to
      the location where you saved the CollabNet Desktop –
      Eclipse Edition and select Open.

      Figure 5: The Select Local Site Archive window


    • In Edit Local Site, fill in the File name, verify the path to
      the CollabNet Desktop – Enterprise Edition download,
      and press OK.

      Figure 6: The Edit Local Site window




    1. From the Install window, select CollabNet Desktop and Finish.

      Note: The Eclipse Update Manager automatically ensures that you have all the required plugins to run CollabNet Desktop – Eclipse Edition. CollabNet suggests you install everything listed in the Updates window.

      Figure 7: The Install window


      The Update Manager connects to the site or opens the local archive to find the features available to install.

      Figure 8: The Update Manager reading the remote site



    Installing CollabNet Desktop – Eclipse Edition

    To install the new CollabNet Desktop – Eclipse Edition features, follow these steps:

    1. From the Updates window, select CollabNet Desktop and click Next.

      Figure 9: The Updates window showing search results


    2. Review the license terms on the Feature License screen. If you agree to these terms, select "I accept the terms in the license agreements" and click Next.

      Figure 10: The Install window showing license information


    3. From the Install window, review the components you are about to install. If you want to install the components in locations other than the default location, specify the new location.

      Note: you can have multiple instances of Eclipse on your machine, running different feature configurations.

      Figure 11: The Install window showing the installation directories


    4. Click Finish and the Update Manager downloads the components you selected.

      Note: you can have multiple instances of Eclipse on your machine, running different feature configurations.

      Figure 12: The Install window downloading the components


    5. In the Verification window, check that you have selected the feature you want to install, and click Install All.

      Figure 13: The Verification window


      Note: If you see a warning in the Verification window about installing an unsigned feature, you can ignore it. The CollabNet features are not signed.

      The Update Manager installs the components you selected.

      Figure 14: The Update Manager installing files


    6. When the installation is complete, click OK to restart Eclipse.

    7. Figure 15: The Install/Update window asking you to restart

    posted @ 2011-04-28 11:47 張生 閱讀(1004) | 評論 (0)編輯 收藏

    eclipse集成SVN的client。

    http://subclipse.tigris.org/servlets/ProjectProcess?pageID=p4wYuA

    上面網(wǎng)址就是安裝的方法。以下是COPY防丟失。

    Get the right version!

    Subclipse versions are tied to specific versions of the Subversion client API.  So you must have a matching version of the Subversion client API (JavaHL) for your version of Subclipse.  Any 1.x version of a Subversion client can talk to any 1.x version of a Subversion server, so generally the version does not matter too much.  However, if you use multiple client tools on the same Subversion working copy, then it is important that the version of those clients is all the same.  In addition, if you are on Linux, your distribution might only support a specific version of Subversion and JavaHL.  So you might want to stick with a specific version of Subclipse for that client.

    More information on how to get JavaHL, and the right version for each version of Subclipse can be found in the wiki

    Current Release

    Eclipse 3.2/Callisto, 3.3/Europa, 3.4/Ganymede, 3.5/Galileo +

    Subclipse 1.6.17 and 1.4.8 are now available for Eclipse 3.2+!

    See the changelog for details. Existing Subclipse users should read the upgrade instructions for important information on changes you to need to make to your Eclipse preferences to see the new version in the update manager.

    Subclipse 1.4.x includes and requires Subversion 1.5.x client features and working copy format.

    Subclipse 1.6.x includes and requires Subversion 1.6.x client features and working copy format.

    Links for 1.6.x Release:
    Changelog: http://subclipse.tigris.org/subclipse_1.6.x/changes.html
    Eclipse update site URL: http://subclipse.tigris.org/update_1.6.x
    Zipped downloads: http://subclipse.tigris.org/servlets/ProjectDocumentList?folderID=2240

    Links for 1.4.x Release:
    Changelog: http://subclipse.tigris.org/subclipse_1.4.x/changes.html
    Eclipse update site URL: http://subclipse.tigris.org/update_1.4.x
    Zipped downloads: http://subclipse.tigris.org/servlets/ProjectDocumentList?folderID=2240

    Eclipse 3.0/3.1

    Subclipse 1.0.6 is now available for Eclipse 3.0/3.1!

    See the changelog for details. Existing Subclipse users should read the 1.0.0 release announcement for details on how to upgrade to the 1.0.x release.

    Links for 1.0.x Release:
    Changelog: http://subclipse.tigris.org/subclipse/changes.html
    Eclipse update site URL: http://subclipse.tigris.org/update_1.0.x
    Zipped downloads: http://subclipse.tigris.org/servlets/ProjectDocumentList?folderID=2240

    Eclipse 2.1.3

    Subclipse 0.9.3.3 is linked against Subversion 1.1.4. Binaries for Windows are included.

    Development for this version of Eclipse is no longer active. There are no new releases planned.

    Download the Eclipse 2.x version

    Installation Instructions

    Here you will find a screenshot tour of the Subclipse installation process in Eclipse 3.x. These particular screens were captured in Eclipse 3.0.2 running on Windows XP.

     

    Install Subclipse in Eclipse 3.x

    Step 1:

    Begin the installation from the Eclipse Help menu item.

    Install screen

    Step 2:

    This screenshot show the screen as it initially comes up. In this case you will need to change the radio button to indicate that this is a new install.

    Install screen

    Step 3:

    This screen will vary depending on the features you have installed already. You want to click on the New Remote Site button. If you are behind a proxy and the Eclipse install mechanism does not work, then you can download a zipped version of the update site and then click the New Local Site button instead.

    Install screen

    Step 4:

    This screen is showing the New Remote Site dialog, filled in with the correct information to install Subclipse


    Name: Subclipse 1.6.x (Eclipse 3.2+)
    URL: http://subclipse.tigris.org/update_1.6.x

    Name: Subclipse 1.4.x (Eclipse 3.2+)
    URL: http://subclipse.tigris.org/update_1.4.x

    Name: Subclipse 1.2.x (Eclipse 3.2+)
    URL: http://subclipse.tigris.org/update_1.2.x

    Name: Subclipse 1.0.x (Eclipse 3.0/3.1)
    URL: http://subclipse.tigris.org/update_1.0.x
    Install screen

    Step 5:

    When you first come back to this screen, the site you added will NOT be selected. Be sure to select it before clicking Next.

    Install screen

    Step 6:

    This next screen shows all of the features that are available to install.

    Install screen

    Step 7:

    Click the button to accept the license agreement.

    Install screen

    Step 8:

    Confirm the install location

    Install screen

    Step 9:

    There is an Eclipse preference to turn off this next dialog. I have never seen a signed feature. Not even Eclipse.org nor IBM sign their features.

    Install screen

    Step 10:

    Just a screenshot of the in-process installation.

    Install screen

    Step 11:

    Eclipse needs to be restarted after installing Subclipse.

    Install screen

    Step 12:

    Finally, after restarting Eclipse, the first thing you will typically want to do is open the Subclipse Repository perspective where you can define your repositories. Be sure to also check the online help as well as the Subclipse preferences located under Team -> SVN.

    Install screen

    Updating Subclipse in Eclipse 3.x

    Eclipse 3.x has a feature in preference to automatically check for updates. Provided you are not behind a proxy that does not allow this feature, it should work for Subclipse. Otherwise just follow the instructions for installing Subclipse, except take the option to check for updates in Step 2.

    If you are behind a proxy that does not work with Eclipse, then to install updates you just always follow the same instructions you used to install a new version. If you always unzip the site to the same local folder, you will not have to define the local site each time.



    posted @ 2011-04-28 09:50 張生 閱讀(2881) | 評論 (0)編輯 收藏

    一款按鈕的CSS。(網(wǎng)絡(luò)轉(zhuǎn)載)

    <style>
    .btn {
    BORDER-RIGHT: #7b9ebd 1px solid; PADDING-RIGHT: 2px; BORDER-TOP: #7b9ebd 1px solid; PADDING-LEFT: 2px; FONT-SIZE: 12px; FILTER: progid:DXImageTransform.Microsoft.Gradient(GradientType=0, StartColorStr=#ffffff, EndColorStr=#cecfde); BORDER-LEFT: #7b9ebd 1px solid; CURSOR: hand; COLOR: black; PADDING-TOP: 2px; BORDER-BOTTOM: #7b9ebd 1px solid
    }
    .btn1_mouseout {
    BORDER-RIGHT: #7EBF4F 1px solid; PADDING-RIGHT: 2px; BORDER-TOP: #7EBF4F 1px solid; PADDING-LEFT: 2px; FONT-SIZE: 12px; FILTER: progid:DXImageTransform.Microsoft.Gradient(GradientType=0, StartColorStr=#ffffff, EndColorStr=#B3D997); BORDER-LEFT: #7EBF4F 1px solid; CURSOR: hand; COLOR: black; PADDING-TOP: 2px; BORDER-BOTTOM: #7EBF4F 1px solid
    }
    .btn1_mouseover {
    BORDER-RIGHT: #7EBF4F 1px solid; PADDING-RIGHT: 2px; BORDER-TOP: #7EBF4F 1px solid; PADDING-LEFT: 2px; FONT-SIZE: 12px; FILTER: progid:DXImageTransform.Microsoft.Gradient(GradientType=0, StartColorStr=#ffffff, EndColorStr=#CAE4B6); BORDER-LEFT: #7EBF4F 1px solid; CURSOR: hand; COLOR: black; PADDING-TOP: 2px; BORDER-BOTTOM: #7EBF4F 1px solid
    }
    .btn2 {padding: 2 4 0 4;font-size:12px;height:23;background-color:#ece9d8;border-width:1;}
    .btn3_mouseout {
    BORDER-RIGHT: #2C59AA 1px solid; PADDING-RIGHT: 2px; BORDER-TOP: #2C59AA 1px solid; PADDING-LEFT: 2px; FONT-SIZE: 12px; FILTER: progid:DXImageTransform.Microsoft.Gradient(GradientType=0, StartColorStr=#ffffff, EndColorStr=#C3DAF5); BORDER-LEFT: #2C59AA 1px solid; CURSOR: hand; COLOR: black; PADDING-TOP: 2px; BORDER-BOTTOM: #2C59AA 1px solid
    }
    .btn3_mouseover {
    BORDER-RIGHT: #2C59AA 1px solid; PADDING-RIGHT: 2px; BORDER-TOP: #2C59AA 1px solid; PADDING-LEFT: 2px; FONT-SIZE: 12px; FILTER: progid:DXImageTransform.Microsoft.Gradient(GradientType=0, StartColorStr=#ffffff, EndColorStr=#D7E7FA); BORDER-LEFT: #2C59AA 1px solid; CURSOR: hand; COLOR: black; PADDING-TOP: 2px; BORDER-BOTTOM: #2C59AA 1px solid
    }
    .btn3_mousedown
    {
    BORDER-RIGHT: #FFE400 1px solid; PADDING-RIGHT: 2px; BORDER-TOP: #FFE400 1px solid; PADDING-LEFT: 2px; FONT-SIZE: 12px; FILTER: progid:DXImageTransform.Microsoft.Gradient(GradientType=0, StartColorStr=#ffffff, EndColorStr=#C3DAF5); BORDER-LEFT: #FFE400 1px solid; CURSOR: hand; COLOR: black; PADDING-TOP: 2px; BORDER-BOTTOM: #FFE400 1px solid
    }
    .btn3_mouseup {
    BORDER-RIGHT: #2C59AA 1px solid; PADDING-RIGHT: 2px; BORDER-TOP: #2C59AA 1px solid; PADDING-LEFT: 2px; FONT-SIZE: 12px; FILTER: progid:DXImageTransform.Microsoft.Gradient(GradientType=0, StartColorStr=#ffffff, EndColorStr=#C3DAF5); BORDER-LEFT: #2C59AA 1px solid; CURSOR: hand; COLOR: black; PADDING-TOP: 2px; BORDER-BOTTOM: #2C59AA 1px solid
    }
    .btn_2k3 {
    BORDER-RIGHT: #002D96 1px solid; PADDING-RIGHT: 2px; BORDER-TOP: #002D96 1px solid; PADDING-LEFT: 2px; FONT-SIZE: 12px; FILTER: progid:DXImageTransform.Microsoft.Gradient(GradientType=0, StartColorStr=#FFFFFF, EndColorStr=#9DBCEA); BORDER-LEFT: #002D96 1px solid; CURSOR: hand; COLOR: black; PADDING-TOP: 2px; BORDER-BOTTOM: #002D96 1px solid
    }
    </style>
    <body>

    <button class=btn title="CSS樣式按鈕">CSS樣式按鈕</button><P></p>
    <button
    class=btn1_mouseout onmouseover="this.className='btn1_mouseover'"
    onmouseout="this.className='btn1_mouseout'"
    title="CSS樣式按鈕">CSS樣式按鈕</button>  
    <button
    class=btn1_mouseout onmouseover="this.className='btn1_mouseover'"
    onmouseout="this.className='btn1_mouseout'" DISABLED>CSS樣式按鈕</button>
    <P>
    <button class=btn2 title="CSS樣式按鈕">CSS樣式按鈕</button>
    <P>
    <button class=btn3_mouseout onmouseover="this.className='btn3_mouseover'"
    onmouseout="this.className='btn3_mouseout'"
    onmousedown="this.className='btn3_mousedown'"
      onmouseup="this.className='btn3_mouseup'"
      title="CSS樣式按鈕">CSS樣式按鈕</button>
    <P>
    <button class=btn_2k3 title="CSS樣式按鈕">CSS樣式按鈕</button></body>

    posted @ 2011-04-13 11:29 張生 閱讀(476) | 評論 (0)編輯 收藏

    tomcat配置cgi 轉(zhuǎn)帖自http://blog.csdn.net/chcbz/archive/2010/11/24/6032924.aspx

    1、修改conf/web.xml

    找到并將cgi的servlet和servlet-mapping的注釋去掉

    1. <servlet>  
    2.         <servlet-name>cgi</servlet-name>  
    3.         <servlet-class>org.apache.catalina.servlets.CGIServlet</servlet-class>  
    4.         <init-param>  
    5.           <param-name>debug</param-name>  
    6.           <param-value>0</param-value>  
    7.         </init-param>  
    8.         <init-param>  
    9.           <param-name>cgiPathPrefix</param-name>  
    10.           <param-value>cgi-bin</param-value>  
    11.         </init-param>  
    12.          <load-on-startup>5</load-on-startup>  
    13.     </servlet>  

    注意:其中cgiPathPrefix是cgi文件的存放路徑,默認(rèn)是WEB-INF/cgi,我為了方面用awstats,所以改成cgi-bin

    1. <servlet-mapping>  
    2.         <servlet-name>cgi</servlet-name>  
    3.         <url-pattern>/cgi-bin/*</url-pattern>  
    4. </servlet-mapping>  

    /cgi-bin/*意思是,訪問cgi文件的默認(rèn)地址為cgi-bin/*

    2、修改conf/context.xml

    1. <?xml version='1.0' encoding='utf-8'?>  
    2. <Context privileged="true">  
    3.   
    4.     <!-- Default set of monitored resources -->  
    5.     <WatchedResource>WEB-INF/web.xml</WatchedResource>  
    6.       
    7.     <!-- Uncomment this to disable session persistence across Tomcat restarts -->  
    8.     <!-- 
    9.     <Manager pathname="" /> 
    10.     -->  
    11.   
    12.     <!-- Uncomment this to enable Comet connection tacking (provides events  
    13.          on session expiration as well as webapp lifecycle) -->  
    14.     <!-- 
    15.     <Valve className="org.apache.catalina.valves.CometConnectionManagerValve" /> 
    16.     -->  
    17.   
    18. </Context>  

    修改<Context>添加privileged="true"屬性,否則頁面提示Servlet CGI is not availabled,且tomcat會有錯誤提示java.lang.SecurityException: Restricted classclass org.apache.catalina.servlets.CGIServlet

    3、如果tomcat的版本是6以下的,必須將server/lib/目錄下的servlets-cgi.renametojar改名為servlets-cgi.jar

    有以上三步,已經(jīng)可以成功配置CGI了,訪問地址如http://localhost:8080/cgi-bin/test.pl

    posted @ 2011-03-15 15:59 張生 閱讀(1125) | 評論 (0)編輯 收藏

    晚八點飛機(jī),現(xiàn)在JS跨域問題解決中,解決后再來修補(bǔ)內(nèi)容,新BLOG第一帖。

    晚八點飛機(jī),現(xiàn)在JS跨域問題解決中,解決后再來修補(bǔ)內(nèi)容

    posted @ 2011-03-15 14:53 張生 閱讀(458) | 評論 (1)編輯 收藏

    <2011年3月>
    272812345
    6789101112
    13141516171819
    20212223242526
    272829303112
    3456789

    導(dǎo)航

    統(tǒng)計

    常用鏈接

    留言簿

    隨筆檔案

    搜索

    最新評論

    閱讀排行榜

    評論排行榜

    主站蜘蛛池模板: 免费黄色大片网站| 亚洲熟女乱综合一区二区| 亚洲av无码专区在线观看素人| 国产亚洲大尺度无码无码专线| 亚洲无成人网77777| 牛牛在线精品免费视频观看| 免费无码毛片一区二区APP| 国产精品免费小视频| 亚洲av福利无码无一区二区 | 一级一级一级毛片免费毛片| 国产精品亚洲A∨天堂不卡| 亚洲三级视频在线| 高清免费久久午夜精品| 黄色免费网站网址| 亚洲一级片免费看| 99久久国产亚洲综合精品| A片在线免费观看| 国产免费啪嗒啪嗒视频看看| 亚洲天堂中文资源| 亚洲国产精品成人精品软件| 免费国产黄网站在线观看动图| 最近中文字幕国语免费完整| 欧美最猛性xxxxx免费| 亚洲色欲一区二区三区在线观看| 亚洲色欲色欲www在线播放| 国产99视频精品免费专区| 俄罗斯极品美女毛片免费播放| 亚洲成A∨人片在线观看无码| ssswww日本免费网站片| 女人张开腿等男人桶免费视频| 亚洲成A人片在线观看无码不卡| 在线看亚洲十八禁网站| xx视频在线永久免费观看| 亚洲精品无码永久中文字幕| 老湿机一区午夜精品免费福利| 18观看免费永久视频| 亚洲国产成人高清在线观看| 成人久久久观看免费毛片| 午夜精品在线免费观看| 亚洲精品午夜久久久伊人| 亚洲国产成人精品无码区花野真一 |