记录、分享

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 张生 阅读(293) | 评论 (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 张生 阅读(1650) | 评论 (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 张生 阅读(824) | 评论 (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 张生 阅读(1969) | 评论 (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+="//";
  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 张生 阅读(8835) | 评论 (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 张生 阅读(1107) | 评论 (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 张生 阅读(402) | 评论 (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 张生 阅读(95907) | 评论 (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 张生 阅读(377) | 评论 (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 张生 阅读(173626) | 评论 (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 张生 阅读(996) | 评论 (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 张生 阅读(316) | 评论 (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 张生 阅读(997) | 评论 (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 张生 阅读(2869) | 评论 (0)编辑 收藏

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

导航

统计

常用链接

留言簿

随笔档案

搜索

最新评论

阅读排行榜

评论排行榜