2014年2月17日星期一

linux 查找

从根目录开始查找所有扩展名为.log的文本文件,并找出包含”ERROR”的行
find / -type f -name "*.log" | xargs grep "ERROR"
例子:从当前目录开始查找所有扩展名为.in的文本文件,并找出包含”thermcontact”的行
find . -name "*.in" | xargs grep "thermcontact"

tomcat启动在80端口 Permission denied :80

linux 下将tomcat的server.xml的端口改为80后以tomcat身份无法启动tomcat! 
在redhat上启动tomcat(将server.xml中的端口改为80) 
su - tomcat -c "$CATALINA_HOME/bin/startup.sh" 
后出现:Catalina.start: LifecycleException: null.open: java.net.BindException: Permission denied:80 

这是因为只有root用户才可访问1024以下的端口。 

解决方法: 
重将server.xml中的端口改为8080 
然后:iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8080 
(如果用到443,也相应执行以上方法) 
即可!

linux命令

压缩 tar.gz
tar -zcvf operate.tar.gz operate*

解压 tar.gz
tar -xzvf ideaIU-13.tar.gz

给用户授权
chown -R spring:spring /opt/ideaIU-13.tar.gz 

复制目录
cp -r yjrc /home/capinfo

授权
sudo chmod u+x /usr/lib/jvm/java/jdk1.6.0_12.bin

更新源
sudo gedit /etc/apt/sources.list

给root创建一个密码:sudo passwd roo


sudo apt-get install rar
sudo apt-get install unrar

很快就下载完了,然后输入:
ln -fs /usr/bin/rar /usr/bin/unrar


sqldeveloper 安装
sqldeveloper  linux 安装包只有rpm格式的,ubuntu是不支持的,要把rpm转成deb,这里就用到了alien
如果没有安装
sudo apt-get install alien
然后
sudo alien /路径/xxxx.rpm
然后在当前用户路径下生成了一个XXXXX.deb
直接
sudo dpkg -i xxxx.deb
就行了。
在终端输入 sudo sqldeveloper 就可以启动了,
然后会有以下提示:
Type the full pathname of a J2SE installation (or Ctrl-C to quit), the path will be stored 
输入jdk的路径就可以了。
每次启动都需要输入jdk的路径是不是很麻烦。
修改/opt/sqldeveloper/sqldeveloper/bin下的sqldeveloper的配置文件,然后要重启一下(不然好像不生效)
#vi ./sqldeveloper/bin/sqldeveloper.conf
 修改 SetJavaHome 参数为 $JAVA_HOME



svn
apt-get install subversion

Ubuntu系统的Hosts只需修改/etc/hosts文件,在目录中还有一个hosts.conf文件,刚开始还以为只需要修改这个就可以了,结果发现是需要修改hosts。修改完之后要重启网络。
具体过程如下:
1、修改hosts
sudo gedit /etc/hosts
2、添加解析记录( . )
完整案例:127.0.0.1 localhost.localdomain localhost
简洁记录:127.0.0.1 localhost
3、保存后重启网络
sudo /etc/init.d/networking restart

.快速清理磁盘垃圾
磁盘空间又不够用了?尝试在终端窗口中输入
sudo apt-get autoremove
然后输入
sudo apt-get clean
,前一个命令会卸载系统中所有未被使用的依赖关系,后一个命令会清除所有缓存的包文件,两者都是无害的。在一个升级过多次的系统上,你也许能通 过这个方法清理出若干GB的空间。

mvn clean package -Dmaven.test.skip=true





Skip your tests with maven release plugin


The maven release plugin becomes often very handy. However, in its default configuration all relevent maven lifecycle phases are performed including the verify phase. Here, all your tests – if any available – are compiled and run as well. In my particular case, I just wanted to perform the release without the test steps.
This is what you need to do:
  1. Preparing   – mvn -DpreparationGoals=clean -DscmCommentPrefix="XXX" release:prepare
  2. Performing – mvn -Darguments="-Dmaven.test.skip=true" release:perform
The prepare goal will only perform the clean lifecycle. You may of course define other lifecycle phases as well unless they include testing activities. The perform goal is a different story. Here we make use of the arguments parameter providing some input for the underlying phases deploy and site-deploy run by the perform goal.
Cheers

idea keygen

https://sskaje.me/sskaje/keygen/ 

update 子查询隐含风险

update examinees s
   set (s.birthdate,
        s.issuecertdate,
        s.acceptgradedate,
        s.lastmodifieddate) = 
(select  to_char(t.birthdate, 'yyyy/mm/dd'),
        to_char(t.issuecertdate, 'yyyy/mm/dd'),
        to_char(t.acceptgradedate, 'yyyy/mm/dd'),
        to_char(t.lastmodifieddate, 'yyyy/mm/dd') from examinees_impto_zt t where
         s.examineeid = to_char(t.examineeid))
 where exists(select 1 from examinees_impto_zt b where s.examineeid = to_char(b.examineeid));

Steps To Solve “bind an object under the name HibernateSessionFactory in the JNDI tree” error | Weblogic

If you are getting errors like below in logs while deploying application or in general then try below mentioned steps to make it working.
<14-Dec-2010 10:41:01 CET> <error> <cluster> <BEA-000123> <Conflict start: Youtried to bind an object under the name in the JNDI tree HibernateSessionFactory. Theobject from 4004698486404642S: hrofserver01: ckm : is not HPOF01_1-clusterable, andyou have tried to bind more than two ounces or more servers from. Such objects canonly be deployed from one server.>
< 14-Dec-2010 10:41:01 CET> <error> <cluster> <BEA-000123> <Conflict start: Youtried to bind an object under the name in the JNDI tree HibernateSessionFactory.From the object-2465366582483676621S: hrofserver02: [7010.7010, -1, -1, -1, -1, -1]ckm: HPOF02_1 is non-clusterable, and you have tried to bind more than two ounces ormore from servers. Such objects can only be deployed from one server.> ”
OR error like below in server logs:
####<Nov 12, 2011 8:34:05 AM CET> <Error> <Cluster> <sun879> <M2> <[ACTIVE] ExecuteThread: ’5′ for queue: ‘weblogic.kernel.Default (self-tuning)’> <> <> <> <1289918045285> <BEA-000123> <Conflict start: You tried to bind an object under the name HibernateSessionFactory in the JNDI tree. The object from 4449434054399910424S:hpof.Server.com:[8001,8001,-1,-1,-1,-1,-1]:hpof.Server.com:8001,hpof1.Server.com:8001:MYEAPAPP:M2 is non-clusterable, and you have tried to bind more than once from two or more servers. Such objects can only be deployed from one server.>
In persistance.xml when the below property is added you will face this issue
<property name="hibernate.session_factory_name">hibernate.SessionFactory</property>
<!-- JNDI bound Session Factory Name -->
Unlike EJB entity beans, Hibernate itself is not clusterable so your application may be doing a JNDI lookup on a cluster JNDI tree which does not exist,
so it will only be pinned to one of your server as stated in the log message.

Please add the below property to persistance.xml to resolve this issue.
<property name="hibernate.jndi.weblogic.jndi.replicateBindings">false</property>

<!-- because SessionFactory is not clusterable -->
By adding this option, there won’t be any cluster communication on the hibernate object and the cluster features won’t be activated.
After updating the xml you have to clean the tmp folder and cache folder and need to do a complete bounce to make it working.

BEA-149500:An exception occurred while registering the MBean null

<Error> <JMX> <BEA-149500> <An exception occurred while registering the MBean null.
java.lang.IllegalArgumentException: Registered more than one instance with the same objectName : com.bea:ServerRuntime=AdminServer,Name=portal,Type=ApplicationRuntime new:weblogic.j2ee.J2EEApplicationRuntimeMBeanImpl@13e959da existing weblogic.j2ee.J2EEApplicationRuntimeMBeanImpl@135ebbc5
        at weblogic.management.jmx.ObjectNameManagerBase.registerObject(ObjectNameManagerBase.java:168)
        at weblogic.management.mbeanservers.internal.WLSObjectNameManager.lookupObjectName(WLSObjectNameManager.java:131)
        at weblogic.management.jmx.modelmbean.WLSModelMBeanFactory.registerWLSModelMBean(WLSModelMBeanFactory.java:87)
        at weblogic.management.mbeanservers.internal.RuntimeMBeanAgent$1.registered(RuntimeMBeanAgent.java:105)
        at weblogic.management.provider.core.RegistrationManagerBase.invokeRegistrationHandlers(RegistrationManagerBase.java:180)
        Truncated. see log file for complete stacktrace

以上错误的原因是新加的一个数据源名称和我们一个项目的名称相同,导致weblogic不能识别2个同名的实例名
并不影响系统的运行,若不想看到这个错误,包项目名称换成别的。h

ssh -L6666:172.20.66.218:22 root@192.168.20.156

本文讨论所有机器均为Linux操作系统。 比如说我的机器是A,中间服务器为B,目标服务器是C。 从A可以ssh到B,从B可以ssh到C,但是A不能直接ssh到C。 现在展示利用ssh通道技术从A直接传输文件到C。 1. ssh -L1234:C:22 root@B input B's passWord 2. scp -P1234 filename root@localhost: input C's password

A : 192.168.20.171
B: 192.168.20.156  172.20.21.213
C: 172.20.66.218 210.75.217.55

--192.168.20.173上实现访问支付宝地址
screen
ssh -L443:110.75.146.31:443 root@192.168.20.156
Ctrl+a d
 还要修改本地的hosts,将域名指向127.0.0.1
修改173的 etc/hosts
127.0.0.1 mapi.alipay.com

Too many open files

Too many open files
ulimit -a 
ulimit -HSn 65536
ulimit -a 

Spring mvc @ResponseBody ajax调用出现如下错误:406 Not Acceptable

Spring mvc @ResponseBody  ajax调用出现如下错误:406 Not Acceptable
The resource identified by this request is only capable of generating responses with characteristics not acceptable according to the request "accept" headers ().

需要加入jackson依赖:
        <dependency>
            <groupId>org.codehaus.jackson</groupId>
            <artifactId>jackson-mapper-asl</artifactId>
            <version>1.7.1</version>
        </dependency>

linux Gbk 乱码

############################################
#/etc/sysconfig/i18n
#source /etc/sysconfig/i18n
#env
############################################
#######################
LANG="zh_CN.GB18030"
LANGUAGE="zh_CN.GB18030:zh_CN.GB2312:zh_CN"
SUPPORTED="zh_CN.GB18030:zh_CN:zh"
SYSFONT="lat0-sun16"
SYSFONTACM="8859-15"
######################
############################
#LANG="en_US.UTF-8"
#SUPPORTED="en_US.UTF-8:en_US:en"
#SYSFONT="latarcyrheb-sun16"
################################

linux svn 切换用户

linux svn 切换用户

1. 临时切换
在所有命令下强制加上--username 和--password选项。 
例如:svn up --username zhangsan --password 123456
2.永久切换

win7 64位+Oracle 11g 64位下使用PL/SQL Developer 的解决办法

1)安装Oracle 11g 64位
2)安装32位的Oracle客户端( instantclient-basic-win32-11.2.0.1.0)
下载 instantclient-basic-win32-11.2.0.1.0.zip (一定得是32位的,不要下错了版本,Oracle官网有下载),将其解压至Oracle安装目录的Product下(本机命名为:instantclient_11_2):D:\Oracle\app\YM\product\instantclient_11_2。
拷贝数据库安装根目录下的一个目录D:\Oracle\app\YM\product\11.2.0\dbhome_1\NETWORK到Oracle客户端目录下D:\Oracle\app\YM\product\instantclient_11_2(其实只需要 NETWORK\ADMIN\tnsnames.ora)
3)安装PL/SQL Developer
安装 PL/SQL Developer,在perference->Connection里面设置OCI Library和Oracle_Home,例如本机设置为:
Oracle Home :D:\Oracle\app\YM\product\instantclient_11_2
OCI Library : D:\Oracle\app\YM\product\instantclient_11_2\oci.dll
 
4) 设置环境变量(修改PATH和TNS_ADMIN环境变量)

对于NLS_LANG环境变量, 最好设置成和数据库端一致, 首先从数据库端查询字符集信息:
SQL> select userenv('language') nls_lang from dual;
NLS_LANG
----------------------------------------------------
SIMPLIFIED CHINESE_CHINA.ZHS16GBK

右击"我的电脑" - "属性" - "高级" - "环境变量" - "系统环境变量":
1>.选择"Path" - 点击"编辑", 把 "D:\Oracle\app\YM\product\instantclient_11_2;" 加入;
2>.点击"新建", 变量名设置为"TNS_ADMIN", 变量值设置为"D:\Oracle\app\YM\product\instantclient_11_2;", 点击"确定";
3>.点击"新建", 变量名设置为"NLS_LANG", 变量值设置为"SIMPLIFIED CHINESE_CHINA.ZHS16GBK", 点击"确定";
最后点击"确定"退出.

启动 PL/SQL Developer ,运行无问题。

码农的一天

13年上半年坚持了一阵写工作日报,后来也荒废了
忙得七荤八素的,都想不起来昨天干了些啥。
今天又苦逼得忙了一天,查库 开库 找原因 安排新功能,尿尿的没时间,码农的一天
想着整理整理13年积攒下来的一些东西

2014 再出发

还在加班.....
偷懒儿的时候翻看blogger,发现我关注的几个博客都几年没更新了,2年的....4年的。我的一年没更新了
0:16 回家的出租车上
过去的2013,忙碌 疲惫 麻木 机械,得过且过,新年新气象,再出发