贝贝爸爸的程序人生

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

2011年7月6日

今天兴致来了,说要在家搞搞平台的东西,nnd,竟然遇到了莫名其妙的mysql乱码问题,其实不是mysql的问题,是jdbc数据源的链接没有指明字符集的问题,记下来备用:<datasource jta="false" jndi-name="java:jboss/datasources/MySqlDS" pool-name="bdp" enabled="true" use-java-context="true" use-ccm="true">
                    <connection-url>jdbc:mysql://localhost:3306/bdp-dev?useUnicode=true&amp;characterEncoding=utf8</connection-url>
                    <driver>com.mysql</driver>
                    <pool>
                        <min-pool-size>10</min-pool-size>
                        <max-pool-size>100</max-pool-size>
                        <prefill>true</prefill>
                        <use-strict-min>false</use-strict-min>
                        <flush-strategy>FailingConnectionOnly</flush-strategy>
                    </pool>
                    <security>
                        <user-name>root</user-name>
                    </security>
                    <statement>
                        <prepared-statement-cache-size>32</prepared-statement-cache-size>
                        <share-prepared-statements>true</share-prepared-statements>
                    </statement>
                </datasource>

posted @ 2012-05-19 01:40 贝贝爸爸 阅读(765) | 评论 (0)编辑 收藏

今天在处理zTree的时候,无意间遇到一个很好的插件,可以将array对象转换为json对象,真的很好用哦,呵呵。
var thing = {plugin: 'jquery-json', version: 2.3};

var encoded = $.toJSON( thing );
// '{"plugin":"jquery-json","version":2.3}'
var name = $.evalJSON( encoded ).plugin;
// "jquery-json"
var version = $.evalJSON(encoded).version;
// 2.3
像上面那样用就行了,很容易进行请求间的参数传递。
项目地址为:http://code.google.com/p/jquery-json/

posted @ 2012-05-10 13:45 贝贝爸爸 阅读(1070) | 评论 (1)编辑 收藏

 cat /tmp/id_rsa.john.pub >> ~/.ssh/authorized_keys

posted @ 2012-04-26 14:45 贝贝爸爸 阅读(385) | 评论 (0)编辑 收藏

nnd,今天搞了快2个小时,总是无法解决ldap支持的其他属性返回问题,因为之前配置的是3.3.5版本,现在最新的版本是3.4.11,原来的配置竟然无法使用了,原来是因为增加服务:
<bean id="serviceRegistryDao" class="org.jasig.cas.services.InMemoryServiceRegistryDaoImpl">
导致无法返回principal的其他属性到客户端,其实象这样配置即可:<bean id="attributeRepository"
  class="org.jasig.services.persondir.support.ldap.LdapPersonAttributeDao">
  <property name="contextSource" ref="contextSource" />
  <property name="baseDN" value="ou=users,${ldap.basePath}" />
  <property name="requireAllQueryAttributes" value="true" />
  <!--
  Attribute mapping beetween principal (key) and LDAP (value) names
  used to perform the LDAP search.  By default, multiple search criteria
  are ANDed together.  Set the queryType property to change to OR.
  
-->
  <property name="queryAttributeMapping">
    <map>
      <entry key="username" value="uid" />
    </map>
  </property>
 
  <property name="resultAttributeMapping">
    <map>
    <!-- Mapping beetween LDAP entry attributes (key) and Principal's (value) -->
    <entry key="name" value="userName"/>
    <entry key="uid" value="userId"/>
    </map>
  </property>
</bean>

    <bean id="serviceRegistryDao" class="org.jasig.cas.services.InMemoryServiceRegistryDaoImpl">
        <property name="registeredServices">
            <list>
                <bean class="org.jasig.cas.services.RegisteredServiceImpl">
                    <property name="id" value="0" />
                    <property name="name" value="HTTP" />
                    <property name="description" value="Only Allows HTTP Urls" />
                    <property name="serviceId" value="http://**" />
                    <property name="evaluationOrder" value="10000001" />
                    <property name="ignoreAttributes" value="true" />
                </bean>
                                ………………
                        </list>
                </property>
        </bean>
如上所示,其中注册的服务registeredServices
默认是不允许返回其他属性到客户端的!!!!!,真的是很坑爹啊,不过,配置一下ignoreAttributes即可,也可以指定allowedAttributes
如下:
<property name="allowedAttributes">
    <list>
            <value><!-- your attribute key --></value>
    </list>
</property>

posted @ 2012-04-25 23:12 贝贝爸爸 阅读(1320) | 评论 (0)编辑 收藏


cat /boot/grub2/grub.cfg |grep Fedora
grub2-set-default "Fedora Linux, with Linux 3.1.0-5.fc16.i686"
grub2-editenv list
grub2-mkconfig -o /boot/grub2/grub.cfg

posted @ 2012-04-20 08:50 贝贝爸爸 阅读(366) | 评论 (0)编辑 收藏

#
contrib / completion / git-completion.bash

#
 Source the git bash completion file
if [ -f ~/.git-completion.bash ]; then
    source ~/.git-completion.bash
    GIT_PS1_SHOWDIRTYSTATE=true
    PS1='[\u@\h:\W $(__git_ps1 "(%s)")]$ '
fi

posted @ 2012-04-04 09:26 贝贝爸爸 阅读(844) | 评论 (0)编辑 收藏

http://www.secondpersonplural.ca/jqgriddocs/index.htm

posted @ 2012-03-29 05:05 贝贝爸爸 阅读(191) | 评论 (0)编辑 收藏

http://junv.sinaapp.com/1955.html

posted @ 2012-03-21 17:22 贝贝爸爸 阅读(276) | 评论 (0)编辑 收藏

http://www.navicat.com/en/download/download.html
NAVJ-W56S-3YUU-MVHV



posted @ 2012-03-19 17:25 贝贝爸爸 阅读(317) | 评论 (0)编辑 收藏

今天调试了一天,所有的步骤都正确,可最后到了web下载,却总是404错误,好心zzq网友帮着一起定位和解决问题,可依然没有找到原因,偶尔的一个google搜索,发现是因为没有sudo启动nginx。。。。
真tmd扯淡了。

posted @ 2012-03-18 20:13 贝贝爸爸 阅读(358) | 评论 (0)编辑 收藏

https://gist.github.com/2066974

posted @ 2012-03-18 08:26 贝贝爸爸 阅读(253) | 评论 (0)编辑 收藏

系统环境
CentOS6.2
#step 1. download libevent https://github.com/downloads/libevent/libevent/libevent-2.0.17-stable.tar.gz
$ ./configure
$ make
$ make verify   # (optional)
$ sudo make install
$ln -s /usr/local/lib/libevent-2.0.so.5 /usr/lib64/libevent-2.0.so.5
#step 2. download FastDFS source package and unpack it,
$ ./make.sh
$ ./make.sh install
#step 3. edit/modify the config file of tracker and storage
#step 3.1.
$ vim /etc/fdfs/tracker.conf
## base_path=??
## reserved_storage_space = 1GB
#step 3.2
$ vim /etc/fdfs/storage.conf
## base_path=/home/yuan/fastdfs/storage
## path(disk or mount point) count, default value is 1
## store_path_count=1
## store_path#, based 0, if store_path0 not exists, it's value is base_path
## the paths must be exist
## store_path0=/home/yuan/fastdfs0
## tracker_server=host:port
#step 4 cp the start shell into /etc/init.d
$ cd FastDFS
$ cp init.d/fdfs_trackerd /etc/init.d
$ cp init.d/fdfs_storaged /etc/init.d
#step 5 mkdir the trackerd base path and storaged base path
$ mkdir /home/yuan/fastdfs
$ mkdir /home/yuan/fastdfs0
#step 6 start trackerd service
$/sbin/service fdfs_trackerd start
###$/sbin/service fdfs_trackerd status
###$fdfs_trackerd (pid 11441) is running...
#step 7 start storaged service
$/sbin/service fdfs_storaged start
###$/sbin/service fdfs_storaged status
###$fdfs_storaged (pid 11553) is running...
#step 8. run test program
#step 8.1. vim /etc/fdfs/client.conf
###base_path=/home/yuan/fastdfs
###tracker_server=192.168.0.197:22122
#step 8.2 run test program
$/usr/local/bin/fdfs_test /etc/fdfs/client.conf upload /usr/include/stdlib.h
#step 9 monitor fdfs
$/usr/local/bin/fdfs_monitor /etc/fdfs/client.conf

posted @ 2012-03-17 16:38 贝贝爸爸 阅读(758) | 评论 (0)编辑 收藏

可能后面会遇到同一台服务器,安装多个jboss实例的问题,那显然的问题可能就是端口冲突问题,怎么办?
1、修改各个配置文件的端口配置
2、最简单的方法是,启动是指明端口绑定步长,例如:-Djboss.socket.binding.port-offset=100

posted @ 2012-03-04 20:40 贝贝爸爸 阅读(458) | 评论 (0)编辑 收藏

mvn deploy:deploy-file -Dfile=target/web-3.1.0-SNAPSHOT-api.jar -Durl=http://repo.yongtai.com.cn/nexus/content/repositories/snapshots/ -DrepositoryId=nexus-snapshots -DpomFile=pom.xml -Dpackaging=jar -Dclassifier=api

posted @ 2012-02-22 12:02 贝贝爸爸 阅读(202) | 评论 (0)编辑 收藏

今天又在centos下折腾呢,呵呵,不过这次的环境是mac下安装centos的虚拟机,mac环境和linux环境还是很大区别,至少无法安装我想要的FastDFS环境,着实有点无法接受,所以只能安装虚拟机了。
ssh centos后,主要安装遇到了如下问题:
1、gcc-c++没有安装,会导致安装pcre的时候,报c++编译器没找到,直接安装:yum install gcc-c++即可
2、zlib包无法找到,安装:yum install zlib-devel即可
3、error while loading shared libraries: libpcre.so.1:[root@bogon nginx-1.0.12]# ldd $(which /usr/local/nginx/sbin/nginx)
    linux-vdso.so.1 =>  (0x00007fff7e9db000)
    libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fe4629d0000)
    libcrypt.so.1 => /lib64/libcrypt.so.1 (0x00007fe462799000)
    libpcre.so.1 => not found//确实没找到
    libz.so.1 => /lib64/libz.so.1 (0x00007fe462582000)
    libc.so.6 => /lib64/libc.so.6 (0x00007fe4621e1000)
    /lib64/ld-linux-x86-64.so.2 (0x00007fe462bfa000)
    libfreebl3.so => /lib64/libfreebl3.so (0x00007fe461f7e000)
    libdl.so.2 => /lib64/libdl.so.2 (0x00007fe461d7a000)
[root@bogon nginx-1.0.12]# cd /lib64/

[root@bogon lib64]# ln -s libpcre.so.0.0.1 libpcre.so.1
[root@bogon lib64]# ldd $(which /usr/local/nginx/sbin/nginx)
    linux-vdso.so.1 =>  (0x00007fff4d7ff000)
    libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fb06f13e000)
    libcrypt.so.1 => /lib64/libcrypt.so.1 (0x00007fb06ef07000)
    libpcre.so.1 => /lib64/libpcre.so.1 (0x00007fb06ecda000)
    libz.so.1 => /lib64/libz.so.1 (0x00007fb06eac4000)
    libc.so.6 => /lib64/libc.so.6 (0x00007fb06e723000)
    /lib64/ld-linux-x86-64.so.2 (0x00007fb06f368000)
    libfreebl3.so => /lib64/libfreebl3.so (0x00007fb06e4c0000)
    libdl.so.2 => /lib64/libdl.so.2 (0x00007fb06e2bc000)

posted @ 2012-02-19 07:49 贝贝爸爸 阅读(2099) | 评论 (0)编辑 收藏

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

posted @ 2011-08-06 22:47 贝贝爸爸 阅读(264) | 评论 (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 贝贝爸爸 阅读(531) | 评论 (0)编辑 收藏