星期六, 十月 08, 2011

Installing ReviewBoard on Ubuntu

// Installing Setuptools
# apt-get install python-setuptools

// Installing Python Development Headers
# apt-get install python-dev

// Installing Memcached
# apt-get install memcached
# apt-get install python-memcached

// Installing Patch
# apt-get install patch

// Installing Python LDAP
# apt-get install python-ldap

// Installing Mysql
# apt-get install mysql-server
# apt-get install mysql-client
# apt-get install python-mysqldb
# mysql -u root -p
> create database reviewboard;
> grant all on reviewboard.* to reviewboard@localhost identified by 'reviewboard';

// Installing Subversion
# apt-get install subversion
# apt-get install python-svn

// Installing Git
# apt-get install git-core

// Installing ReviewBoard
# wget http://downloads.reviewboard.org/releases/ReviewBoard/1.6/ReviewBoard-1.6.1.tar.gz
# tar zxvf ReviewBoard-1.6.1.tar.gz
# cd ReviewBoard-1.6.1
# python ./setup.py install

// Installing Site
# rb-site install /usr/local/reviewboard
# chown -R www-data /usr/local/reviewboard/htdocs/media/uploaded
# chown -R www-data /usr/local/reviewboard/data
//  Config site with apache or lighttpd using reviewboard/conf/*.conf

// Installing post-review
# wget http://downloads.reviewboard.org/releases/RBTools/0.3/RBTools-0.3.4.tar.gz
# tar zxvf RBTools-0.3.4.tar.gz
# cd RBTools-0.3.4
# python ./setup.py install

星期五, 十月 07, 2011

SPI & API


Service Provider Interface (SPI): 
The SPI is the description of classes/interfaces/methods/... that you extend and implement to achieve a goal.

Application Programming Interface (API): 
The API is the description of classes/interfaces/methods/... that you call and use to achieve a goal.

星期六, 八月 13, 2011

浏览器默认回车键触发表单提交


前提:
submit写法:<intput type='submit'/>, <button type='submit'/>
button写法:<intput type='button'/>, <button type='button'/>
text写法:<intput type='text'/>

结论:
1、当form中至少有一个submit时,回车键生效。
2、当form中只有一个text时,回车键生效。
3、当按钮使用<input>,而是用<button>,并且没有加type,IE下默认为type=button,Firefox默认为type=submit。
4、其他form元素如textarea、select不影响,radio checkbox不影响触发规则,但本身在Firefox下会响应回车键,在IE下不响应。
5、type=”image”的input,效果等同于type=”submit”,但后面会跟一个X=&Y=的坐标。

星期四, 四月 21, 2011

Redhat AS5下FTP配置

遇到的问题:
vsftpd 500 OOPS: cannot change directory
#setsebool -P ftpd_disable_trans 1
#/etc/init.d/vsftpd restart

#/etc/vsftpd/vsftpd.conf
anonymous_enable=NO
local_enable=YES
write_enable=YES
local_umask=022
anon_upload_enable=NO
anon_mkdir_write_enable=NO
dirmessage_enable=YES
xferlog_enable=YES
connect_from_port_20=YES
xferlog_file=/var/log/vsftpd.log
xferlog_std_format=YES
ftpd_banner=Welcome to blah FTP service.
chroot_local_user=NO
chroot_list_enable=YES
chroot_list_file=/etc/vsftpd/chroot_list
listen=YES
pam_service_name=vsftpd
userlist_enable=YES
tcp_wrappers=YES

星期日, 四月 10, 2011

Rails 3可能遇到的问题

1,windows下mysql驱动问题, 不用安装mysql2,而用mysql,具体如下。
#修改Gemfile
#gem 'mysql2'
gem 'mysql'

#运行命令
bundle install

#修改环境变量
将%MYSQL_HOME%\bin\加入PATH。

#修改database.yml
修改adapter使用mysql。

2, 使用jQuery,而不用Prototype。
参见:https://github.com/rails/jquery-ujs
#修改Gemfile
gem 'jquery-rails'

#运行命令
bundle install

#修改environment.rb
require 'openssl'
OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE

#运行命令
rails generate jquery:install

要使用JQuery UI,请使用:rails generate jquery:install --ui

星期六, 二月 12, 2011

DBUnit用法小结

DBUnit在测试用经常用到,主要用其来导入和导出数据。在这过程中,遇到了些问题,特记下:

1,适配不同的数据库,支持其特有的数据类型,如对于Oracle解决方案:
IDatabaseConnection connection = new DatabaseConnection(jdbcConnection, schema);
DatabaseConfig config = connection.getConfig();
config.setProperty(DatabaseConfig.PROPERTY_DATATYPE_FACTORY, new OracleDataTypeFactory());
2,对于FlatXml,导入时可能丢失某些字段,解决方案:
FlatXmlDataSetBuilder builder = new FlatXmlDataSetBuilder();
builder.setColumnSensing(true);
IDataSet dataSet = builder.build(new File("src/xml/flatXmlTableTest.xml"));
3,对于导出多表时,表之间的有外键关系,解决方案:
IDatabaseConnection conn = new DatabaseConnection(jdbcConn);

ITableFilter filter = new DatabaseSequenceFilter(conn);
IDataSet dataset = new FilteredDataSet(filter, conn.createDataSet());

FlatXmlDataSet.write(dataset, new File(fileName));

Java开发质量保证平台工具

1,Maven Java界最好的依赖管理平台,Apache出品。
URL: http://maven.apache.org/

2,Nexus Maven仓库管理平台,可以用来镜像互联网的开源库和管理自己的私有库。
URL: http://nexus.sonatype.org/

3,Jenkins 原名Hudson,著名的持续集成平台。
URL: http://jenkins-ci.org/

4,Sonar 质量保证平台,集成PMD,CheckStyle, FindBugs, Cobertura, Surefire等。
URL: http://www.sonarsource.org/