rpm 删除包

1、rpm -qa |grep openjdk
xxx包
2、rpm -ev –allmatches xxx包

原创文章,转载请注明: 转载自海波无痕

本文链接地址: rpm 删除包

文章的脚注信息由WordPress的wp-posturl插件自动生成

发表在 server | 标签为 | 留下评论

根据xml快速生成jaxb映射对象

有一个复杂的xml 要转对象,但是这个复杂的对象没有xsd,有没有快速建立java对象映射(jaxb)的办法

这个xml必须能提现文档的全貌,比如改是list的地方最少得有俩并列的元素,不然生成的schema不是多个

xmlbeans-2.6.0/bin/inst2xsd -enumerations never example.xml -outPrefix example
xjc -p ctrip.sdk.hotel.dto.hotelsearch  -d . example0.xsd

原创文章,转载请注明: 转载自海波无痕

本文链接地址: 根据xml快速生成jaxb映射对象

文章的脚注信息由WordPress的wp-posturl插件自动生成

发表在 javaee | 标签为 , , , | 留下评论

mysql获取当前月第一天

1、

-- mysql 获取当前日期所在月第1天
SELECT DATE(subdate(curdate(),date_format(curdate(),'%d')-1));
-- mysql获取当前日期的所在周一
SELECT DATE(subdate(curdate(),date_format(curdate(),'%w')-1));

2、mysql复制创建表

-- 复制表city为city_bak
CREATE TABLE city_bak AS SELECT * FROM city
-- 复制表city的结构
CREATE TABLE city_bak AS SELECT * FROM city WHERE 1=2

原创文章,转载请注明: 转载自海波无痕

本文链接地址: mysql获取当前月第一天

文章的脚注信息由WordPress的wp-posturl插件自动生成

发表在 server | 标签为 , | 留下评论

ubuntu12.04开发小米2s

1、查看设备id
lsusb
 
2、增加
sudo vi /etc/udev/rules.d/51-android.rules
 
 
SUBSYSTEM=="usb", SYSFS{idVendor}=="2717", MODE=="0666"
SUBSYSTEM=="usb", ATTR{idVendor}=="2717", ATTR{idProduct}=="9039", SYMLINK+="android_adb"
SUBSYSTEM=="usb", SYSFS{idVendor}=="0bb4", MODE=="0666"
SUBSYSTEM=="usb", ATTR{idVendor}=="0bb4", ATTR{idProduct}=="0c86", SYMLINK+="android_adb"
SUBSYSTEM=="usb", SYSFS{idVendor}=="1782", MODE=="0666"
SUBSYSTEM=="usb", ATTR{idVendor}=="1782", ATTR{idProduct}=="5d01", SYMLINK+="android_adb"
 
3、
sudo chmod a+rx /etc/udev/rules.d/51-android.rules
 
4、gedit .android/adb_usb.ini
增加一行 0x2717
 
5、重启adb
./adb kill-server
./adb devices

原创文章,转载请注明: 转载自海波无痕

本文链接地址: ubuntu12.04开发小米2s

文章的脚注信息由WordPress的wp-posturl插件自动生成

发表在 soft | 标签为 , , , | 留下评论

常用tomcat命令

1、
cd tomcat/conf
vi tomct-users.xml

<role rolename="probeuser" />
  <role rolename="poweruser" />
  <role rolename="poweruserplus" />
  <role rolename="manager" />
  <role rolename="manager-gui"/>
<role rolename="admin-gui"/>
<user username="admin" password="123456" roles="manager,manager-gui,admin-gui" />

2、
cd tomcat/bin
touch setenv.sh
vi setenv.sh

#!/bin/sh
JAVA_HOME='/data/java/jdk/current'
CATALINA_OPTS='-server -Xms1024m -Xmx1024m -XX:NewRatio=3 -XX:PermSize=128m -XX:MaxPermSize=256m -Duser.country=US -Duser.language=en -Duser.timezone=Asia/Shanghai -Dfile.encoding=UTF-8 -Dsun.jnu.encoding=UTF-8 -Dcom.sun.management.jmxremote=true'
CATALINA_PID='/tmp/server1.pid'

3、
cd tomcat/conf/Catalina/localhost/
touch app.xml

<Context docBase="/data/java/deploy/app"
    privileged="true" antiResourceLocking="false" antiJARLocking="false" Reloadable="false">
</Context>

4、
vi tomcat/conf/server.xml

a[……]

Read more

发表在 javaee | 标签为 | 留下评论

测试亚马逊ec2

1、注册创建ec2默认的实例,提示下载pem文件
2、登录

ssh -i ~/Download/wangliang.pem ubuntu@您的ec2的public DNS
报错
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0664 for '/home/wangliang/Downloads/wangliang.pem' are too open.
It is required that your private key files are NOT accessible by others.
This private key will be ignored.
bad permissions: ignore key: /home/wangliang/Downloads/wangliang.pem
Permission denied (publickey).

解决chmod 0400 ~/Downloads/wangliang.pem

原创文章,转载请注明: 转载自海波无痕

本文链接地址: 测试亚马逊ec2

文章的脚注信息由WordPress的wp-posturl插件自动生成

发表在 server | 标签为 , , , | 留下评论

ubuntu安装trac

1、下载安装trac

 
sudo apt-get install libapache2-mod-wsgi libapache2-mod-auth-mysql
 
sudo apt-get install python-setuptools;
sudo apt-get install libmysqlclient-dev;
sudo apt-get install python-dev;
 
sudo easy_install Genshi;
sudo easy_install -U distribute;
sudo easy_install mysql_python;
 
wget http://download.edgewall.org/trac/Trac-1.0.1.tar.gz
 
python ./setup.py install

安装输出结果

creating build/bdist.linux-i686/egg/EGG-INFO
copying Trac.egg-info/PKG-INFO -> build/bdist.linux-i686/egg/EGG-INFO
copying Trac.egg-info/SOURCES.txt -> build/bdist.linux-i686/egg/EGG-INFO
copying Trac.egg-info/dependency_links.txt -> build/bdist.linux-i686/egg/EGG-INFO
copying Trac.egg-info/entry_points.txt -> build/bdist.linux-i686/egg/EGG-INFO
copying Trac.egg-info/requires.txt -> build/bdist.linux-i686/egg/EGG-INFO
copying Trac.egg-info/top_level.txt -> build/bdist.linux-i686/egg/EGG-INFO
copying Trac.egg-info/zip-safe -> build/bdist.linux-i686/egg/EGG-INFO
creating dist
creating 'dist/Trac-1.0.1-py2.6.egg' and adding 'build/bdist.linux-i686/egg' to it
removing 'build/bdist.linux-i686/egg' (and everything under it)
Processing Trac-1.0.1-py2.6.egg
creating /usr/local/lib/python2.6/dist-packages/Trac-1.0.1-py2.6.egg
Extracting Trac-1.0.1-py2.6.egg to /usr/local/lib/python2.6/dist-packages
Adding Trac 1.0.1 to easy-install.pth file
Installing trac-admin script to /usr/local/bin
Installing tracd script to /usr/local/bin
 
Installed /usr/local/lib/python2.6/dist-packages/Trac-1.0.1-py2.6.egg
Processing dependencies for Trac==1.0.1
Searching for Genshi==0.7
Best match: Genshi 0.7
Processing Genshi-0.7-py2.6-linux-i686.egg
Genshi 0.7 is already the active version in easy-install.pth
 
Using /usr/local/lib/python2.6/dist-packages/Genshi-0.7-py2.6-linux-i686.egg
Searching for distribute==0.6.10
Best match: distribute 0.6.10
Adding distribute 0.6.10 to easy-install.pth file
Installing easy_install script to /usr/local/bin
Installing easy_install-2.6 script to /usr/local/bin
 
Using /usr/lib/python2.6/dist-packages
Finished processing dependencies for Trac==1.0.1

2、使用trac建立工程

sudo mkdir /data/www/trac/;
sudo chown -R www-data:www-data /data/www/trac/;
sudo trac-admin /data/www/trac/ initenv;
//输入项目名称
//输入数据库 mysql://root:123456@localhost:3306/trac
 
//创建其他服务调用脚本如wsgi
sudo trac-admin /data/www/trac deploy /data/www/trac/deploy;
 
//修改其他配置
sudo vi /data/www/trac/conf/trac.ini
 
//用trac自带的tracd启动测试
sudo -u www-data tracd --port 8000 /data/www/trac

3、使用apache2+wsgi调用python

 
sudo a2enmod wsgi;
 
<VirtualHost *:88>
 
  ServerAdmin webmaster@example.com
 
 
 
WSGIScriptAlias /trac /data/www/trac/deploy/cgi-bin/trac.wsgi
 
<Directory /data/www/trac/deploy/cgi-bin>
WSGIApplicationGroup %{GLOBAL}
Order deny,allow
Allow from all
</Directory>
 
<Location /svn>
DAV svn
SVNPath "/usr/local/svn/repo1"
AuthType Basic
AuthName "subversion repository"
AuthUserFile "/usr/local/svn/apacheconf/passwd"
AuthzSVNAccessFile "/usr/local/svn/apacheconf/authz"
Require valid-user
</Location>
</VirtualHost>
//把admin用户增加TRAC_ADMIN管理权限
trac-admin /data/www/trac/ permission add admin TRAC_ADMIN
//删除Ticket
sudo trac-admin /data/www/trac/ ticket remove 1
Ticket #1 and all associated data removed.

原创文章,转[……]

Read more

发表在 server | 标签为 | 留下评论

centos 安装svn

yum install subversion;
yum install mod_dav_svn;
mkdir /data/svn;
mkdir /data/svn/repo1;
svnadmin create /data/svn/repo1;
chown -R apache.apache /data/svn/repo1;
touch /data/svn/conf/passwd;
touch /data/svn/conf/authz;

vi /etc/httpd/conf.d/subversion.conf
LoadModule dav_svn_module modules/mod_dav_svn.so
LoadModule authz_svn_module modules/mod_authz_svn.so

 
<Location /svn>
        DAV svn
        SVNPath "/data/svn/repo1"
        AuthType Basic
        AuthName "subversion repository"
        AuthUserFile "/data/svn/conf/passwd"
        AuthzSVNAccessFile "/data/svn/conf/authz"
        Require valid-user
</Location>

vi /data/svn/conf/authz

[aliases]
[groups]
admin=wangliang
[/]
@admin=rw

参考资料[……]

Read more

发表在 server | 标签为 , | 留下评论

智行火车票–史上最牛的火车票抢票软件

春运回家一票难求成了最头疼的问题,火车站售票大厅已经人满为患,电话抢票线路繁忙难以打通,网上订票系统繁忙网页难进,怎么才能在千军万马的订票大军中顺利抢到车票?
子曰:”工欲善其事,必先利其器”,今天就给大家推荐一款实用的抢票工具。智行火车票是一款非常简洁实用的12306手机购票软件,可以安装在任何Android设备上,
它不仅实现了火车票查询、预定等功能,还对12306购票流程进行大量优化,再配合手机网银更是可以直接支付订单,使您随时随地完成购票;另外软件还额外提供了智能查询和火车票监控功能,让您第一时间知道铁道部放票、退票信息。

1、登录和注册12306.cn

首先软件登录[……]

Read more

发表在 soft | 标签为 , , | 留下评论

python代码片段

1、python获取父目录

import os,sys
print os.path.dirname(os.path.abspath(__file__))
print os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
print os.path.abspath(os.path.join(os.path.dirname(__file__),".."))

2、python链接mysql

sudo apt-get install python-setuptools
curl -O http://python-distribute.org/distribute_setup.py;
python distribute_setup.py;
 
wget  https://github.com/pypa/pip/raw/master/contrib/get-pip.py
python get-pip.py
sudo easy_install -U distribute;
sudo easy_install mysql_python;
# -*- coding: UTF-8 -*-
import MySQLdb as mdb
con = None
try:
    #连接mysql的方法:connect('ip','user','password','dbname')
    con = mdb.connect('192.168.1.88','root','123456', 'dj',charset="utf8");
    #所有的查询,都在连接con的一个模块cursor上面运行的
    cur = con.cursor()
 
    #执行一个查询
    cur.execute("SELECT * from dj_music limit 0,10")
 
    #取得上个查询的结果,是单个结果
    #data = cur.fetchone()
    #print "Database version : %s " % data
    rows = cur.fetchall()
    #依次遍历结果集,发现每个元素,就是表中的一条记录,用一个元组来显示
    for row in rows:
        print row[1]
finally:
    if con:
        #无论如何,连接记得关闭
        con.close()

3、python使用sqlalchemy

sudo easy_install sqlalchemy
 
#coding=utf-8
from sqlalchemy import *
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
Base = declarative_base()
connstr = 'mysql://root:123456@192.168.1.88:3306/dj?charset=utf8'
db = create_engine(connstr, echo=True)
#metadata = MetaData(db) 
#table = Table('dj_music', metadata, autoload=True)
#i = table.all()
 
#from sqlalchemy.orm import sessionmaker
Session = sessionmaker(bind=db)
session = Session()
 
 
class User(Base):
    __tablename__ = 'dj_music'
 
    id = Column(Integer, primary_key=True)
    music_name = Column(String)
 
print(session.query(User).filter_by(id=746)[0].music_name)

4、python连接redis服务器

a5fb9f5a724e6d9306c652500e401[……]

Read more

发表在 server | 标签为 | 留下评论
Pages: Prev 1 2 3 4 5 6 7 8 9 10 ... 20 21 22 Next