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

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

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

    記錄、分享

    2011年4月28日

    spring-security3 入門篇[轉載]

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

    2. 新建工程,結構如下:



     其中,涉及到的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.     <!-- 保護應用程序的所有URL,只有擁有ROLE_USER才可以訪問 -->   
    10.     < security:http   auto-config = "true" >   
    11.         < security:intercept-url   pattern = "/**"   access = "ROLE_USER"   />   
    12.     </ security:http >   
    13.       
    14.     <!--配置認證管理器,只有用戶名為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默認刷新Log4j配置文件的間隔,單位為millisecond,可以不設置 -->   
    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部署應用,在首次瀏覽index.jsp時,由于沒登錄,spring security會自動生成登錄頁面,頁面內容如下:

     



     7輸入用戶名和密碼,user,則進入首頁

     

     

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

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

    轉載:CentOS6 安裝 Xen 4.1.2

    轉載:

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



    系統: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 會遇到的問題,只是安裝過程復雜,不是源碼安裝。

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

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

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

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

    1.下載Xen的源碼

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

     

    2.安裝必備軟件包

    復制代碼
    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
    復制代碼

     

    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內核

    復制代碼
     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,開機時無法啟動xencommons)
    復制代碼

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

    注意: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:

    復制代碼
    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
    復制代碼

    這個配置在第4行后面root=UUID隨自己的系統

    7.安裝virt-manager

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

     8. 重新編譯libvirt

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

      注意virt-manager & 這個命令中的'&' 代表該進程后臺運行

    復制代碼
     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:///
    復制代碼

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

    以下的操作都在非xen系統中進行:

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

    復制代碼
     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
    復制代碼

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

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

    隨后的解決方案如下:

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

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

    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

    強制安裝如上的包。

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

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

    復制代碼
    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
    復制代碼

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

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

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

    復制代碼
    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%]
    復制代碼

    9.進入xen系統

    重啟系統,進入xen系統。

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

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

    如果顯示的錯誤如下:

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

    則需要去做如下修改:

    1 解決方案:查看libvirtd服務是否啟動,關閉防火墻,在/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服務

    1 service xend restart

     

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

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

    就ok。

     

    10.配置網橋橋接模式

    修改ifcfg-eth0如下:

    復制代碼
     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
    復制代碼

    創建ifcfg-br100文件,內容如下:

    復制代碼
     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"
    復制代碼

    11.ok,至此,xen的安裝結束了,可以放心大膽的創建虛擬機了。

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

    android權限

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

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

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

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

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

    android.permission.ACCESS_NETWORK_STATE
    //允許程序訪問有關GSM網絡信息

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

    android.permission.ACCESS_WIFI_STATE
    //允許程序訪問Wi-Fi網絡狀態信息

    android.permission.ADD_SYSTEM_SERVICE
    //允許程序發布系統級服務

    android.permission.BATTERY_STATS
    //允許程序更新手機電池統計信息

    android.permission.BLUETOOTH
    //允許程序連接到已配對的藍牙設備

    android.permission.BLUETOOTH_ADMIN
    //允許程序發現和配對藍牙設備

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

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

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

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

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

    android.permission.CAMERA
    //請求訪問使用照相設備

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

    android.permission.CHANGE_CONFIGURATION
    //允許一個程序修改當前設置,如本地化

    android.permission.CHANGE_NETWORK_STATE
    //允許程序改變網絡連接狀態

    android.permission.CHANGE_WIFI_STATE
    //允許程序改變Wi-Fi連接狀態

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

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

    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
    //允許程序返回狀態抓取信息從系統服務

    android.permission.EXPAND_STATUS_BAR
    //允許一個程序擴展收縮在狀態欄,android開發網提示應該是一個類似Windows Mobile中的托盤程序

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

    android.permission.FLASHLIGHT
    //訪問閃光燈,android開發網提示HTC Dream不包含閃光燈

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

    android.permission.FOTA_UPDATE
    //暫時不了解這是做什么使用的,android開發網分析可能是一個預留權限.

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

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

    android.permission.GET_TASKS
    //允許一個程序獲取信息有關當前或最近運行的任務,一個縮略的任務狀態,是否活動等等

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

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

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

    android.permission.INTERNAL_SYSTEM_WINDOW
    //允許打開窗口使用系統用戶界面

    android.permission.INTERNET
    //允許程序打開網絡套接字

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

    android.permission.MASTER_CLEAR
    //目前還沒有明確的解釋,android開發網分析可能是清除一切數據,類似硬格機

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

    android.permission.MODIFY_PHONE_STATE
    //允許修改話機狀態,如電源,人機接口等

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

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

    android.permission.PROCESS_OUTGOING_CALLS
    //允許程序監視、修改有關播出電話

    android.permission.READ_CALENDAR
    //允許程序讀取用戶日歷數據

    android.permission.READ_CONTACTS
    //允許程序讀取用戶聯系人數據

    android.permission.READ_FRAME_BUFFER
    //允許程序屏幕波或和更多常規的訪問幀緩沖數據

    android.permission.READ_INPUT_STATE
    //允許程序返回當前按鍵狀態

    android.permission.READ_LOGS
    //允許程序讀取底層系統日志文件

    android.permission.READ_OWNER_DATA
    //允許程序讀取所有者數據

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

    android.permission.READ_SYNC_SETTINGS
    //允許程序讀取同步設置

    android.permission.READ_SYNC_STATS
    //允許程序讀取同步狀態

    android.permission.REBOOT
    //請求能夠重新啟動設備

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

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

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

    android.permission.RECEIVE_WAP_PUSH
    //允許程序監控將收到WAP PUSH信息

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

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

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

    android.permission.SEND_SMS
    //允許程序發送SMS短信

    android.permission.SET_ACTIVITY_WATCHER
    //允許程序監控或控制activities已經啟動全局系統中

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

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

    android.permission.SET_DEBUG_APP
    //配置一個程序用于調試

    android.permission.SET_ORIENTATION
    //允許底層訪問設置屏幕方向和實際旋轉

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

    android.permission.SET_PROCESS_FOREGROUND
    //允許程序當前運行程序強行到前臺

    android.permission.SET_PROCESS_LIMIT
    //允許設置最大的運行進程數量

    android.permission.SET_TIME_ZONE
    //允許程序設置時間區域

    android.permission.SET_WALLPAPER
    //允許程序設置壁紙

    android.permission.SET_WALLPAPER_HINTS
    //允許程序設置壁紙hits

    android.permission.SIGNAL_PERSISTENT_PROCESSES
    //允許程序請求發送信號到所有顯示的進程中

    android.permission.STATUS_BAR
    //允許程序打開、關閉或禁用狀態欄及圖標Allows an application to open, close, or disable the status bar and its icons.

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

    android.permission.SUBSCRIBED_FEEDS_WRITE
    //系統暫時保留改設置,android開發網認為未來版本會加入該功能。

    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
    //允許訪問振動設備

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

    android.permission.WRITE_APN_SETTINGS
    //允許程序寫入API設置

    android.permission.WRITE_CALENDAR
    //允許一個程序寫入但不讀取用戶日歷數據

    android.permission.WRITE_CONTACTS
    //允許程序寫入但不讀取用戶聯系人數據

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

    android.permission.WRITE_OWNER_DATA
    //允許一個程序寫入但不讀取所有者數據

    android.permission.WRITE_SETTINGS
    //允許程序讀取或寫入系統設置

    android.permission.WRITE_SMS
    //允許程序寫短信

    android.permission.WRITE_SYNC_SETTINGS
    //允許程序寫入同步設置
     

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

    java調用url的兩種方式

    java調用url的兩種方式

    一、在java中調用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中調用url,后臺調用。并取得返回值
    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運行狀態,自動重啟

    檢測Tomcat運行狀態,自動重啟

    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正常,否則繼續后面的重啟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運行狀況,必要時自動重啟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;//=====處理數據緩存問題======
        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("====讀取配置文件失敗!系統無法運行,請與供應商聯系。====");
       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結束
       //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

     

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

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

    旋轉Div

    旋轉div

    <div style="position:absolute;filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3)">內容啊</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);">內容啊</div>

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

    mysql事件自動復制表

    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進制對照表

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

    紅色和粉紅色,以及它們的16進制代碼。

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

    紫紅色,以及它們的16進制代碼。

    #FF66FF #CC33CC #CC00FF #FF33FF #CC99FF #9900CC #FF00FF #CC66FF #990099 #CC0099
    #CC33FF #CC99CC #990066 #993399 #CC66CC #CC00CC #663366      
    藍色,以及它們的16進制代碼。
    #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進制代碼。
    #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進制代碼。
    #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進制代碼。
    #FFFFF #CCCCCC #999999 #666666 #333333 #000000        
    16色和它們的16進制代碼。
    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="#">產品介紹</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>
     </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>
     </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="#">關于我們</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="#">聯系我們</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>
     </ul>
    </li>

    </ul>

    </body>
    </html>

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

    JS中數組Array的用法{轉載}

    js數組元素的添加和刪除一直比較迷惑,今天終于找到詳細說明的資料了,先給個我測試的代碼^-^
    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:刪除原數組第一項,并返回刪除元素的值;如果數組為空則返回undefined
    var a = [1,2,3,4,5];
    var b = a.shift(); //a:[2,3,4,5]   b:1

    unshift:將參數添加到原數組開頭,并返回數組的長度
    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,FF2.0下測試返回值為7,所以這個方法的返回值不可靠,需要用返回值時可用splice代替本方法來使用。

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

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

    concat:返回一個新數組,是將參數添加到原數組中構成的
    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,...

    在清空數組時,只需傳遞startIndex

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

    splice還具有先刪除后添加的功能,即先刪除幾個元素,然后在刪除的位置再添加若干元素,刪除與添加的元素的個數沒有必須相等,這時侯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:將數組反序
    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):按指定的參數對數組進行排序
    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):返回從原數組中指定開始下標到結束下標之間的項組成的新數組
    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):將數組的元素組起一個字符串,以separator為分隔符,省略的話則用默認用逗號為分隔符
    var a = [1,2,3,4,5];
    var b = a.join("|"); //a:[1,2,3,4,5]   b:"1|2|3|4|5"

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

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

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

    今天在應用中突然發現join是一種把數組轉換成字符串的好方法,故封裝成對象使用了:

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

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

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

    struts2 當spring遇到json插件時的異常 及解決(引用)

    struts2 當spring遇到json插件時的異常 及解決




    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>

    發生的異常
    org.apache.catalina.core.StandardWrapperValve invoke
    嚴重: Servlet.service() for servlet default threw exception
    java.sql.SQLException: Positioned Update not supported.
    低調的貓(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中已經實例化了的,問題就出在它身上了。于是在struts-config中加入該bean的exclude,再測試,成功了!
    發送action的request后,服務返回JSON數據。

    解決-----------------------------------------------------------------------------------------
    <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

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

      軟件配置管理(SCM)是管理源碼并保持其安全的良好藝術,它能實現源碼與其他團隊成員之間保持共享,并且能夠對之加以保護。良好地利用SCM,你能夠容易地跟蹤軟件的發行和新的開發分支;這樣以來,可以更為容易地標識和修正發行產品中的錯誤。

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

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

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

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

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

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

    · Subversion對文本和二進制文件使用一種巧妙的二進制技術,這既優化了網絡流量也優化了倉庫磁盤空間。

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

    · Subversion僅存儲兩個版本之間的修改內容,這不僅節約了磁盤空間,并且意味著標識一個新版本或創建一種新的子內容幾乎可以立即實現。

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

    二、Subclipse插件與Eclipse的集成

    一種良好的SCM應該與你的工作環境緊密地集成到一起。沒有誰真正喜歡轉到命令行以把文件添加到倉庫。Eclipse很早就實現了CVS集成,但是直到 最近Subversion用戶仍沒有被引起重視。現在,新的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"并且創建一遠程站點,使用名字Subclipse和URL http://subclipse.tigris.org/update_1.0.x(參考圖1)。

    4. 在結果安裝窗口中,把"Subeclipse in the Features"選擇到安裝列表中,并且通過向導來開始安裝插件。

    5. 完成這些之后,重新啟動Eclipse。現在,你可以繼續往下進行!


    圖1.安裝Subclipse插件

    (二) 建立Repository定義

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


    圖2.添加一個倉庫定義


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

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




    圖3.SVN Repository視圖。



    現在,讓我們把一個工程檢出到你的Eclipse工作區中。這只需選擇你需要的Subversion倉庫,打開上下文菜單,并且選擇"Checkout"即可。這將打開一個具有兩個選項的向導:

    · Check out as a Project configured using the New Project Wizard-這個選項打開新工程向導,這可以讓你使用內建的Eclipse工程類型配置工程。這個選項通常是最好用的,因為它讓你使用相同的工程模板和 配置屏幕,而當你創建一個常規工程時你經常使用它們。

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

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

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

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


    圖4.把一個工程導入到一個Subversion倉庫中

    三、在Eclipse中使用Subversion

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


    圖5.大多數Subversion命令能被經由Team菜單存取

    圖6.你可以在Package Explorer中看到本地文件的狀態

    (一) 與Repository保持同步

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


    圖7.與倉庫保持同步

    (二) 使用屬性

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

    · svn:executable屬性,允許你在支持這種能力的操作系統上設置一個文件的可執行標志。

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


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

    三) Tag和Branch

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

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

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

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


    圖9.創建一個新的branch或tag

    (四) 修訂歷史

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

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


    圖10.歷史資源

    四、結論

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

    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

    上面網址就是安裝的方法。以下是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)編輯 收藏

    <2011年4月>
    272829303112
    3456789
    10111213141516
    17181920212223
    24252627282930
    1234567

    導航

    統計

    常用鏈接

    留言簿

    隨筆檔案

    搜索

    最新評論

    閱讀排行榜

    評論排行榜

    主站蜘蛛池模板: 亚洲AV无码一区二区二三区软件| 国产亚洲蜜芽精品久久| 亚洲第一区精品日韩在线播放| 久久久久国产精品免费看| 美女扒开屁股让男人桶爽免费| 亚洲日本香蕉视频观看视频| 在线观看亚洲av每日更新| 大陆一级毛片免费视频观看| 无码人妻一区二区三区免费n鬼沢| 老妇激情毛片免费| 国产亚洲精品影视在线| 久久精品国产亚洲AV电影| 久久影院亚洲一区| 国产精品成人啪精品视频免费| 亚洲Av无码专区国产乱码DVD | 亚洲A丁香五香天堂网| 在线视频精品免费| 日本免费在线观看| 青青操免费在线观看| 一级做a免费视频观看网站| 欧美亚洲国产SUV| 亚洲人成网站18禁止| 亚洲一级视频在线观看| 91亚洲一区二区在线观看不卡| 国产精品亚洲精品日韩已满| 亚洲黄黄黄网站在线观看| 国产又大又长又粗又硬的免费视频| 国产妇乱子伦视频免费| 84pao国产成视频免费播放| 久久精品电影免费动漫| 在线播放免费人成毛片乱码| 三年在线观看免费观看完整版中文| 九九九精品视频免费| 老司机午夜在线视频免费观| 国产成人亚洲精品电影| 自拍偷自拍亚洲精品播放| 成人婷婷网色偷偷亚洲男人的天堂| 亚洲成av人片在线天堂无| 亚洲码和欧洲码一码二码三码| 亚洲欧美黑人猛交群| 亚洲AV日韩AV永久无码色欲|