Archive

Archive for the ‘开发笔记’ Category

SVN客户端版本切换工具

February 21st, 2010

下载地址change-svn-wc-format

admin Java世界, 开发笔记 , ,

红帽子(Redhat)/JBoss宣布支持Apache CXF

March 26th, 2009
by JBoss Team

We’re happy to announce that as of today, Red Hat has become a key contributor to the Apache CXF, which is an open-source, fully featured, easy to use Web Services framework. It is the combination of two projects: Celtix developed by IONA and XFire developed at Codehaus working together at the Apache Software Foundation.

Apache CXF is a popular open source, standards based framework for developing (SOAs) Service Oriented Architectures. Our aim is to contribute to the framework’s continued development and to increase the interoperability and enterprise readiness of CXF.

Additionally, we’ll be providing full production and developer support for Apache CXF as a core component of our JBoss Enterprise Platforms. Enterprise architects, Java developers and IT operations personnel will now see the Apache CXF framework as fully supported component of our JBoss Enterprise Subscriptions.

Commonly accepted Web Service standards are vital to the continued adoption of SOA. The standard proprietary, closed source model is at odds with the open, consensus driven nature of SOAs and the standards that support them. By joining the Apache CXF project, our goal is help establish the framework as the de-facto open source Web Services Stack for Java, working together with other existing contributors like the FUSE team at Progress Software.

For more information on Red Hat’s work with the Apache CXF project please visit the JBoss Web Services project.

Jboss 团队宣布Redhat 将成为Apache CXF的关键贡献者。

admin Java世界, Translations , , ,

maven package skip test

March 10th, 2009

mvn package –Dmaven.test.skip=true

admin Project Management ,

Window XP平台架设 SVN 服务器

January 1st, 2009

Window XP平台架设 SVN 服务器

准备

下载相关文件

Subversion1.5.4+Apache2.2整合安装文件

http://downloads-guests.open.collab.net/files/documents/61/1182/CollabNetSubversion-server-1.5.4-1.win32.exe

1 安装Svn 服务器 和apache2.2

按照向导一步步的安装,选择SVN Repository 路径为: E:svn_repository

2创建svn资源库以及用户

转到{SVN Server安装目录} 运行 svnadmin create E:svn_repositoryproject1
通过这个命令我们可以创建一个路径为project1的项目资源库,下面再为项目资源库创建用户或者组
转到{SVN Server安装目录}httpdbin 运行htpasswd -cm E:svn_repositorysvn-auth-file chouxinxin
根据提示输入密码以及确认密码

创建E:svn_repositorysvn-access-file
内容如下:
[project1:/]
chouxinxin =rw

保存退出

以上步骤将会在E:svn_repository目录下生成两个文件:
用户文件
svn-auth-file和svn访问权限控制文件svn-access-file

3 配置Apache 的svn支持

编辑{SVN Server安装目录}httpdconf文件夹下的 httpd.conf

查找LoadModule关键字
添加加载模块

LoadModule dav_module modules/mod_dav.so
LoadModule dav_svn_module modules/mod_dav_svn.so
LoadModule authz_svn_module modules/mod_authz_svn.so

在文件末尾添加或者修改


DAV svn
SVNParentPath e:svn_repository
AuthType Basic
AuthName “Cactus Thinking Subversion repository”
AuthUserFile e:svn_repositorysvn-auth-file
Require valid-user
AuthzSVNAccessFile e:svn_repositorysvn-access-file

4.配置并启动服务

命令行转到{SVN Server安装目录}httpdbin目录下执行httpd -k install -nSVNServer

net start SVNServer

bingo! Success!

5访问项目资源库
(略)

参考文献:

http://subversion.tigris.org/

http://subversion.tigris.org/faq.zh.html

预告:Windows平台利用cygwin架设SSH服务器

admin 开发笔记

初学者调试CSS之前的Checklist(Common CSS Mistakes for a Beginner – CSS Bugs and Debugging Checklist)

December 10th, 2008

from Common CSS Mistakes for a Beginner – CSS Bugs and Debugging Checklist translated by lyonmire & revised by 丑鑫鑫

我指导过很多朋友的网页设计/前端开发,我注意到几乎所有人会犯一个很普遍的错误,今天我想与大家一起分享。尽管以下的例子或许看起来很平淡无奇,但是对于大多数初学者来说都会经常犯这种错误。所以,若你是一个初学者,请读下去 !

场景:
初学css设计师说:我需要帮助!我加了一个类在我的样式表里,但是并没有起到我想像中的作用。肯定是我的css代码问题,你能解决吗?

到底是什么地方错了呢?

很显然可能是你css的问题,但当我们要纠结在这个结论中时,确保你是根据一个逻辑的思维过程而得出的结论。缩小问题的可能性,这就是你应该如何调试。

checklist

1.你的样式表没有上传或保存?

你在浏览器中看过已改动的css代码了吗?你忽略了这一步,如果你没有看这个改动。

2.你在html代码里面引用了你的css了吗?

html需要引用样式表来表现其属性

3.确保你使用了正确的语法

css是区分大小写的。

类名的开头不能是数字或特殊字符(如:连字符号“-”)开头,它必须以字母(a-z)开头
确保类以.开头(如:.classname),ID以#字开头(如:#idname)。确保你没有丢失或者混淆他们。

确保你的类或ID组是放在圆括弧里,你的类或ID的属性以分号结束。

确保你的类或ID名拼写正确。听起来似乎很荒唐,但我们都会犯错!加倍的检查类/ID或属性值的拼写.

4.你是否确保你所编辑的是正确的网址/样式/文件?

很多人确实会犯这种错误,所以通篇检查你的css代码是很重要的。你首先应该做的事情通常来说要加倍的检查你的代码。

5.你是否声明了正确了文档类型?
如果你没有申明你的文档类型(特别是ie浏览器),很有可能会出现意想不到的异常

6.你的css是有效的吗?

运行起来验证你的css问题。在你开发的过程中这通常是一个好的方法使你的css有效。这会使你有检查代码的良好习惯,并且你还会发现在你即将要发现的错误。

如果你证实到以上所述是正确的,那么是时候从行为观点的角度去置疑你的css.试试我之前在如何调试css上的建议,配备上合适的调试工具去进一步的研究。

结论
我认为很多这种错误都是源于对基础网页和html知识的缺乏。如果你发现基础不够扎实,你要通过全面的理解html和网页通常是如何起作用的来建立扎实的基础。一旦你有扎实的基础,加上足够的锻炼,你会逐步发现你自己会在分秒内解决问题。坚持,不要放弃,你会成功的。

admin Javascript, HTML & CSS, Translations

Java -Tools

October 30th, 2008

1.StringUtils
2.IOUtils and FileUtils
3.Google collections
4.java.util.concurrent

admin Java世界 ,

在Dreamhost空间安装配置python-2.5+django-1.0环境

October 11th, 2008

by 丑鑫鑫(Chouxinxin)

1 前言

2 准备工作

首先你至少应该有个在淘宝上购买的10多元一年的DreamHost合租空间,当然如果银子充裕弄一个500G+独立IP的空间更好。在DreamHost的控制面板添加一个二级域名,丑鑫鑫使用的是django.v44.cn,保存前一定要勾选中 FastCGI Support。然后就是远程连接工具,我在这里推荐Putty+WinSCP组合,

3 开始安装

3.1 升级python到2.5.2

用Putty登录到DreamHost的Shell控制台执行如下的命令:

$>mkdir opt
$>cd opt
$>mkdir packages
$>wget http://www.python.org/ftp/python/2.5.2/Python-2.5.2.tgz
$>tar -xzvf Python-2.5.2.tgz

第一步为创建 opt目录,第二步在opt目录下创建 packages目录,第三步到python官方网站下载Python-2.5.2源码发布包,第四步将发布包解压到Python-2.5.2目录下

$>./configure -prefix=$HOME/opt
$>make
$>make install

以上步骤是编译并安装Python2.5.2

$>cd $HOME
$>vi .bash_profile

编辑.bash_profile文件加入

export PATH=$HOME/opt/bin/:$PATH

将python加入到shell path中

$>source .bash_profile

刷新环境变量,确保当前执行环境使用的我们安装的最新python

3.2 安装python-Mysql

$>cd downloads
$>wget http://internap.dl.sourceforge.net/sourceforge/mysql-python/MySQL-python-1.2.2.tar.gz
$>tar xvzf MySQL-python-1.2.2.tar.gz
$>cd MySQL-python-1.2.2
$>python setup.py install

3.3 安装django-1.0

$>cd $HOME/packages
$>wget http://www.djangoproject.com/download/1.0/tarball/
$>tar -xzvf Django-1.0.tar.gz
$>cd Django-1.0
$>python setup.py install

然后,
在python交互环境下查看django的版本,以测试安装配置的准确性。

>>>import django
>>>django.VERSION
(1, 0, ‘final’)

OK,Succeed!

3.4配置FastCGI

$>cd $HOME/django
$>wget http://svn.saddi.com/py-lib/trunk/fcgi.py
$>chmod 755 fcgi.py

转到先前准备的二级域名指定的目录下,下载fcgi.py,更改其权限为755,创建名为dispatch.fcgi 文件,编辑这个文件为

#!/home/yourusername/opt/bin/python
import sys
sys.path += ['/home/
yourusername/django_projects']
from fcgi import WSGIServer
from django.core.handlers.wsgi import WSGIHandler
import os
os.environ['DJANGO_SETTINGS_MODULE'] = ‘django1.settings’
WSGIServer(WSGIHandler()).run()

创建.htaccess文件内容如下:

RewriteEngine On
RewriteBase /
RewriteRule ^(media/.*)$ – [L]
RewriteRule ^(admin_media/.*)$ – [L]
RewriteRule ^(dispatch.fcgi/.*)$ – [L]
RewriteRule ^(.*)$ dispatch.fcgi/$1 [L]

用来开启apache的mod_rewrite

最后用命令测试:

$>./dispatch.fcgi

如果返回的是一个django页面的字符串。
再通过浏览器访问http://django.v44.cn
出现的django提示

恭喜你,配置成功。

4 注意事项

一定要保证dispatch.fcgi是被我们安装的最新的python解析器所执行。否则fastcgi进程将会被DreamHost的扫描进程Kill。还有就是分发文件dispatch.fcgi必须为这个文件名否则也是一样的下场。

FastCGI: incomplete headers

5 参考资料

http://wiki.dreamhost.com/Python_FastCGI

http://jeffcroft.com/blog/2006/may/11/django-dreamhost/

http://blog.localkinegrinds.com/2007/08/20/custom-python-installation-for-django-on-dreamhost/

admin python , ,

SpringSource改变其对Spring框架及其产品的维护策略

September 21st, 2008

by 丑鑫鑫

貌似从今以后我们需要为正在使用的spring框架的bug修复付费。Spring框架背后的公司SpringSource宣布了一项产品维护策略:

1.SpringSource 提供给 SpringSource Enterprise 的付费用户三年的当前版本如日常的维护版本样般的bug fix,安全隐患修复,快速的补丁修复。

2.针对免费的社区用户,当一个新的主版本发布后,为了找出开始的稳定性问题提供3周的bug fix等维护,过了三周以后SpringSource将不会把该版本的后续维护版本发布给社区的免费用户,而是将它提供给Enterprise的付费用户,Community user 只能从下一个Major Community Release 中得到上个版本的bug fix。

附上原文:http://www.springsource.com/products/enterprise/maintenancepolicy

SpringSource Enterprise Maintenance Policy

Effective September 2008, SpringSource has implemented a new maintenance policy for Spring. The policy provides Spring production users with a long-term, stable application platform to build, run and manage their Spring-powered applications.

Maintenance Policy:
Customers who are using SpringSource Enterprise, available under a subscription, will receive maintenance releases for three years from the general availability of a major new version. These customers receive ongoing, rapid patches as well as regular maintenance releases to address bugs, security vulnerabilities and usability issues, making SpringSource Enterprise the best option for production systems.

After a new major version of Spring is released, community maintenance updates will be issued for three months to address initial stability issues. Subsequent maintenance releases will be available to SpringSource Enterprise customers. Bug fixes will be folded into the open source development trunk and will be made available in the next major community release of the software.

admin Java世界 ,

限制同一用户同一时间只能一次登录系统(Acegi ConcurrentSessionFilter)

September 20th, 2008

by 丑鑫鑫

如果系统是采用acegi security,你不需要另外编写额外的代码来满足这个需求,硬生生的写个Listener,Filter去监听或者拦截session,实现这个功能不叫重造轮子,应该叫做用别人的轮子重造轮胎 ;-)

采用Acegi 的系统限制同一用户同一时间只能一次登录系统步骤如下:

1.改写web.xml加入如下的语句

<listener>
<listener-class>org.acegisecurity.ui.session.HttpSessionEventPublisher</listener-class>
</listener>

这个监听器用来监听session生命期的事件

2.在acegi相关的spring bean配置文件加入:

<bean id=“authenticationManager” class=“org.acegisecurity.providers.ProviderManager”>
<property name=“providers”>
<!– your providers go here –>
</property>

<property name=“sessionController”><ref bean=“concurrentSessionController”/></property>
</bean>

<bean id=“concurrentSessionController” class=“org.acegisecurity.concurrent.ConcurrentSessionControllerImpl”>

<property name=“maximumSessions”><value>1</value></property>
<property name=“sessionRegistry”><ref local=“sessionRegistry”/></property>
</bean>

<bean id=“sessionRegistry” class=“org.acegisecurity.concurrent.SessionRegistryImpl”/>

执行的过程为用户couxinxin登录到系统,在另一台机器上couxinxin这个用户又登录到系统,那么前一个用户couxinxin的Session将被后者冲掉(踢掉)

搞定Over ! :-)

必须要使用acegi1.0.6及其以后的版本,不然会报出
java.lang.IllegalArgumentException: Authentication.getDetails() required
这是版本1.0.5的bug
描述为:

If concurrent session control is used with an authentication provider which doesn’t copy the authentication details object to the successful authentication (e.g. CasAuthenticationProvider) then the check with the concurrent session controller on whether access is allowed takes place before the copyDetails method of AbstractAuthenticationManager is called. This isn’t a problem with classes which extend AbstractUserDetailsAuthenticationProvider, as it copies the authentication details object itself.

The copyDetails method should probably be pulled down into ProviderManager and called before checkAuthenticationAllowed() is called. This will ensure that the details object is available even if the provider doesn’t set it.

It’s also not clear that we really need an AbstractAuthenticationManager at all, given how little there is in there.

参见:http://jira.springframework.org/browse/SEC-618

ps: blogger 的xml排版有点难看,呵呵

admin Java世界 , ,

jboss jBPM SVN Repository Address

September 11th, 2008

Some projects such as JBoss Web Services, JBoss ESB, and JBoss Rules use Subversion for their source code repositories. We have multiple svn repositories:

NOTE: THE URLs here are NOT YET READY for JBoss Rules, please do not use them at this time.

Anonymous Access is provided by the following url:

http://anonsvn.jboss.org/repos/

Committer Access is provided by:

https://svn.jboss.org/repos/

Note that the anonymous repository is a mirror of the committer repository that is synched every 5 minutes.

Committers will be prompted for their jboss.com id and password. There are no public and private keys for these repositories. All encryption is done via https. Each project maintains its own list of committers and there is directory level access controls in place.

Committer access requires agreement to one of the following contributor agreements:

… …


http://anonsvn.jboss.org/repos/中列出的项目里面没有jBPM,但是我们发现JBoss Portal的地址是http://anonsvn.jboss.org/repos/portal/ 通过猜测可以的到jbpm的SVN库地址为

http://anonsvn.jboss.org/repos/jbpm/

(+_+)#

admin Java世界, 开发笔记 , ,