贝贝爸爸的程序人生

关注Seam、BPM
posts - 23, comments - 10, trackbacks - 0, articles - 32
  BlogJava :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理

这篇文章献给天下儿童的父母。
     老农民的智慧和知识分子的尴尬:
    很多没有上过学的老农民培养出了优秀的孩子,不少有知识、高学历的城里人却把孩子管出诸多毛病,甚至培养出问题孩子,为什么?老农民没知识但有智慧,城里人有知识但没智慧。(知识不等于智慧。)
    智慧的老农民三句话就培养出了好孩子:
    第一句话:“孩子,爸妈没本事,你要靠自己了。”不包办,把责任还给孩子,让孩子拥有了责任心。
    第二句话:“孩子,做事先做人,一定不能做伤害别人的事情。”讲德行,告诉孩子做人的标准。
    第三句话:“孩子,撒开手闯吧,实在不行,回家来还有口饭吃。”无私的爱,无尽的爱!
    看看一些城里人怎么把孩子教育出问题的:
    第一句话:“宝贝,你 好好学习就行了,其他的事情爸爸妈妈来办!”剥夺了孩子负责任的权利,培养出了没有责任心的孩子。
    第二句话:“宝贝,出去不能吃亏,别人打你一定要还手!”基本的做人准则都没有教对,可能培养出“缺德”的孩子。
    第三句话:“我告诉你,你要是再不好好学习,长大没饭吃别来找我!”有条件的爱,根本不是真爱。
    只要拥有智慧,每一位家长都能把孩子培养成才,而智慧与知识和学历并不相关!

posted @ 2011-08-06 22:47 贝贝爸爸 阅读(252) | 评论 (0)编辑 收藏

原文A successful Git branching model
In this post I present the development model that I’ve introduced for all of my projects (both at work and private) about a year ago, and which has turned out to be very successful. I’ve been meaning to write about it for a while now, but I’ve never really found the time to do so thoroughly, until now. I won’t talk about any of the projects’ details, merely about the branching strategy and release management.
这篇文章,将介绍所有一年前我工作中或者个人项目的开发模型,这个模型已经被证明是十分有用的(successfull)。我老早就想写一些关于这个模型的文章,但是总是抽不出时间。在这篇文章中,我将不会介绍项目的详细情况,仅仅对分支的策略和发布管理作一个介绍。

It focuses around Git as the tool for the versioning of all of our source code.
我们将围绕这使用Git作为所有项目源码的版本控制工具。
  • 为何选择GIT?
For a thorough discussion on the pros and cons of Git compared to centralized source code control systems, see the web. There are plenty of flame wars going on there. As a developer, I prefer Git above all other tools around today. Git really changed the way developers think of merging and branching. From the classic CVS/Subversion world I came from, merging/branching has always been considered a bit scary (“beware of merge conflicts, they bite you!”) and something you only do every once in a while.
关于Git作为集中的源码控制系统的优缺点,可以查看一下链接,关于这个话题,有激烈的争论。作为一个开发者,与其他版本控制工具相比,我更喜欢Git,Git真正的改变了开发者关于合并和分支的思考(think)。我曾经也用过CVS、svn,分支和合并,真的很让人头疼(合并时产生的冲突),因此,有时你每次只能做一会工作(个人理解:因为svn这种版本控制库只有一个服务仓库,涉及公共资源,只能锁定编辑)

But with Git, these actions are extremely cheap and simple, and they are considered one of the core parts of your daily workflow, really. For example, in CVS/Subversion books, branching and merging is first discussed in the later chapters (for advanced users), while in every Git book, it’s already covered in chapter 3 (basics).
但是对于Git来说,做这样的工作(分支、合并),太简单!它真的可以作为你日常工作流程中最核心的部分。例如,在有关CVS/svn的书籍中,分支和合并要放到最后一章才会阐述(针对高级用户),然后在Git相关的书籍中,首先就先跟你阐述分支和合并(第3章)。

Enough about the tools, let’s head onto the development model. The model that I’m going to present here is essentially no more than a set of procedures that every team member has to follow in order to come to a managed software development process.
关于这个工具的介绍,我们不再赘述,现在我们回到开发模式的话题上来。这个模型,基本上和每个开发团队管理软件开发流程是类似的。
  • 分布而集中
The repository setup that we use and that works well with this branching model, is that with a central “truth” repo. Note that this repo is only considered to be the central one (since Git is a DVCS, there is no such thing as a central repo at a technical level). We will refer to this repo as origin, since this name is familiar to all Git users.
我们使用这个分支模型很好工作的仓库,是真正意义上的中央仓库。这个仓库是唯一的中央仓库(因为Git本身就是分布式版本控制系统DVCS,所以这没有技术问题)。我们称这样一个中央仓库为origin,所有Git用户都知道origin这个名称。
Each developer pulls and pushes to origin. But besides the centralized push-pull relationships, each developer may also pull changes from other peers to form sub teams. For example, this might be useful to work together with two or more developers on a big new feature, before pushing the work in progress to origin prematurely. In the figure above, there are subteams of Alice and Bob, Alice and David, and Clair and David.
每个开发者,都可以从origin获得(pull)资源,同时也能推送(push)到origin。除此之外,每个开发者可以从其他开发者那里获得资源,以此组建自己的一个小组。例如,当我们要开发一个大的新功能时,我们将和其他人一起协作,在提交到中央仓库origin之前,我们需要小组内部能够互相协作,这将是十分有用的。上图中,Alice和Bob是一个小组,同时Alice和David是一个小组,Clair和David又是一个小组。
Technically, this means nothing more than that Alice has defined a Git remote, named bob, pointing to Bob’s repository, and vice versa.
从技术实现上讲,这无非是在Alice的项目里,定义了一个指向Bot的远程链接而已(git remote add bob git@bobserver bob.git),反之也是一样,如此简单!!
  • 主要的分支
At the core, the development model is greatly inspired by existing models out there. The central repo holds two main branches with an infinite lifetime:
中央仓库有2个主要的分支,这些分支将一直存在:
    • master
    • develop
The master branch at origin should be familiar to every Git user. Parallel to the master branch, another branch exists called develop.
中央仓库的master分支已经为所有Git用户熟知,与master分支并行的另外一个分支,我们称之为develop。
We consider origin/master to be the main branch where the source code of HEAD always reflects a production-ready state.
我们称origin/master为主要分支,因为分支的HEAD指向的源码总是反映了一个可以发布的产品状态(production-ready)。

We consider origin/develop to be the main branch where the source code of HEAD always reflects a state with the latest delivered development changes for the next release. Some would call this the “integration branch”. This is where any automatic nightly builds are built from.
我们称origin/develop为主要分支,因为分支的HEAD指向的源码,总是反映了下次发布前最新提交的开发代码。有些人称之为“集成分支”(integration barnch),因为我们的每晚自动构建都是基于此分支进行的。(例如hudson,可以做自动构建工作)。
When the source code in the develop branch reaches a stable point and is ready to be released, all of the changes should be merged back into master somehow and then tagged with a release number. How this is done in detail will be discussed further on.
当develop分支的源码稳定并且准备发布,所有的改变应该合并(merge)到master分支,同时做一个发布版本的标签(tag),我们将在后面讨论这个细节。
Therefore, each time when changes are merged back into master, this is a new production release by definition. We tend to be very strict at this, so that theoretically, we could use a Git hook script to automatically build and roll-out our software to our production servers everytime there was a commit on master.
因此,当每一次将所有更改合并回master时,将会产生一个新的可以发布的产品状态。我们往往对于这个操作的控制是比较严格的,每当往master分支提交时,我们可以使用Git的hook来自动构建和转出到产品服务器上。
  • 辅助分支

posted @ 2011-07-06 12:34 贝贝爸爸 阅读(526) | 评论 (0)编辑 收藏

首先,需要配置mail-service.xml
<?xml version="1.0" encoding="UTF-8"?>
<!-- $Id: mail-service.xml 62350 2007-04-15 16:50:12Z dimitris@jboss.org $ -->
<server>

  
<!-- ==================================================================== -->
  
<!-- Mail Connection Factory                                              -->
  
<!-- ==================================================================== -->

  
<mbean code="org.jboss.mail.MailService"
         name
="jboss:service=Mail">
    
<attribute name="JNDIName">java:/Mail</attribute>
    
<attribute name="User">bpm</attribute>
    
<attribute name="Password">*****</attribute>
    
<attribute name="Configuration">
      
<!-- A test configuration -->
      
<configuration>
        
<!-- Change to your mail server prototocol -->
        
<property name="mail.store.protocol" value="pop3"/>
        
<property name="mail.transport.protocol" value="smtp"/>

        
<!-- Change to the user who will receive mail  -->
        
<property name="mail.user" value="bpm"/>
        
<property name="mail.smtp.auth" value="true"/>

        
<!-- Change to the mail server  -->
        
<property name="mail.pop3.host" value="**pop3服务器地址**"/>

        
<!-- Change to the SMTP gateway server -->
        
<property name="mail.smtp.host" value="***smtp服务器地址***"/>
        
        
<!-- The mail server port -->
        
<property name="mail.smtp.port" value="25"/>
        
        
<!-- Change to the address mail will be from  -->
        
<property name="mail.from" value="bpm@eontime.com.cn"/>

        
<!-- Enable debugging output from the javamail classes -->
        
<property name="mail.debug" value="false"/>
      
</configuration>
    
</attribute>
    
<depends>jboss:service=Naming</depends>
  
</mbean>

</server>

其次新建一个jsp页面mail2.jsp,作为测试
<%@page contentType="text/html"%>
<%@ page import="javax.mail.*,javax.mail.internet.*, javax.activation.*, javax.naming.InitialContext" %> 
<h3>Test JbsssMail DB</h3> 
<%
String toAddress
=request.getParameter("MailTo");
String fromAddress
=request.getParameter("MailFrom");
String subject
=request.getParameter("MailSubject");
String content
=request.getParameter("MailContent");
InitialContext ctx 
= new InitialContext(); 
Session sessions 
= (Session) ctx.lookup("java:/Mail");
if(toAddress!=null &&!toAddress.equals("")){ 
try{
 MimeMessage msg 
= new MimeMessage(sessions);
 msg.setFrom(
new InternetAddress(fromAddress));
 msg.setRecipients(javax.mail.Message.RecipientType.TO,toAddress);
 msg.setSubject(subject);
 msg.setSentDate(
new java.util.Date());
 Multipart multipt 
= new MimeMultipart();
 MimeBodyPart msgbody 
= new MimeBodyPart();
 msgbody.setContent(content,
"text/plain");
 multipt.addBodyPart(msgbody);
 msg.setContent(multipt);
 Transport.send(msg);
 System.out.println(
"SendMail OK!");
}
catch(MessagingException e)
{
 e.printStackTrace();
}
}
%> 
<HTML>
<BODY BGCOLOR="white">
<form METHOD="POST" ACTION="mail2.jsp">
 
<table CELLSPACING="0" CELLPADDING="3" BORDER="1" WIDTH="474">
    
<tr>
      
<td width="150"><div align="left">From :</small></td>
      
<td width="324"><input TYPE="TEXT" name="MailFrom" value=""></td>
    
</tr>
    
<tr>
      
<td width="150"><div align="left">To :</small></td>
      
<td width="324"><input TYPE="TEXT" name="MailTo" value=""></td>
    
</tr>
    
<tr>
      
<td width="150"><div align="left">Subject :</small></td>
      
<td width="324"><input TYPE="TEXT" name="MailSubject" value=""></td>
    
</tr>
    
<tr>
      
<td width="150"><div align="left">Content :</small></td>
      
<td width="324"><TEXTAREA cols=50 name="MailContent" rows=8></TEXTAREA></td>
    
</tr>
    
<tr>
      
<td></td>
      
<td colspan="2" width="474"><input TYPE="Submit"></td>
    
</tr>
 
</table>
</form>
</BODY>
</HTML>

posted @ 2011-06-25 22:44 贝贝爸爸 阅读(459) | 评论 (0)编辑 收藏

git的分支处理模型,真的很爽,但关于如何对git的分支进行管理?最近有网友给我提到了git flow,呵呵,按照我的理解,应该是git的一个最佳实践吧,原文A successful Git branching model对git的分支模型作了阐述,以下我对该文章进行自己的翻译和理解,聊以日后学习,首先先看一下下面这个图:
git flow将git的分支主要分为2类:主要分支和支持分支
  • 主要分支
    • master:永远处在产品可以发布(production ready)状态
    • develop: 当前最新的开发状态
  • 支持分支
    • Feature branches: 开发新的功能,从develop分支出来,完成开发、测试后,merge回develop。
    • Release branches: 准备发布版本的分支,该分支只修复bug,完成后,merge回develop和master。
    • Hotfix branches: 来不及等待下个版本的发布,但又要马上修复bug的情况,从master分支出来,完成开发、测试后,merge回master和develop。

posted @ 2011-05-31 09:44 贝贝爸爸 阅读(661) | 评论 (1)编辑 收藏

由于最近在做的oryx-editor使用的是posgresql8.3.15,不能自动的使用yum install安装了,因为现在源里面的版本是8.1,无法满足项目要求,特安装了postgresql8.3.15,只能源码编译安装了。
----------------------------

1、下载postgresql最新版:http://www.postgresql.org/ftp/source/

wget http://wwwmaster.postgresql.org/redir/391/f/source/v8.3.15/postgresql-8.3.15.tar.gz

2、解压文件:
tar zxvf postgresql-8.3.7.tar.gz
cd postgresql-8.3.7

3、配置:
./configure --prefix=/usr/local/pgsql

4、编译:
make

5、安装:
make install

6、创建用户组和用户:
groupadd postgres
useradd -g postgres postgres

7、创建数据库库文件存储目录、给postgres赋予权限:
mkdir /usr/local/pgsql/data
cd /usr/local/pgsql
chown postgres.postgres data

8、初始化数据库目录:
切换用户
   su - postgresql

初始化数据
   /usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data

启动数据库
   /usr/local/pgsql/bin/postmaster -D /usr/local/pgsql/data

9、配置监听地址和端口:
vi /usr/local/pgsql/data/postgresql.conf
取消以下两行的注释
   listen_addresses = '*'

   port = 5432

10、允许远程连接:
vi /usr/local/pgsql/data/pg_hba.conf
添加
   host all all 192.168.1.0/24 trust 

   每项的具体意思在配置文件中有详细说明
配置iptables让远程主机能访问:
   vi /etc/sysconfig
   添加
      -A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 5432 -j ACCEPT
   service iptables restart

11、让postgresql数据库随系统启动而启动:
将启动脚本拷贝到/etc/init.d/目录下,具体执行如下命令:
cd /etc/rc.d/init.d
cp (第一步解压的安装文件目录)/postgresql-8.3.7/contrib/start-scripts/linux postgresql
chmod +x postgresql
vi postgresql
   prefix=/usr/local/pgsql
   PGDATA="/usr/local/pgsql/data"
   PGUSER=postgres
   PGLOG="/var/log/pgsql.log"

   chkconfig --add postgresql
启动数据库:
   service postgresql start

配置完毕 。

posted @ 2011-05-27 23:00 贝贝爸爸 阅读(643) | 评论 (0)编辑 收藏

仅列出标题
共8页: 上一页 1 2 3 4 5 6 7 8 下一页