<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    貝貝爸爸的程序人生

    關(guān)注Seam、BPM
    posts - 23, comments - 10, trackbacks - 0, articles - 32
      BlogJava :: 首頁 :: 新隨筆 :: 聯(lián)系 :: 聚合  :: 管理

    2011年5月9日

    今天興致來了,說要在家搞搞平臺的東西,nnd,竟然遇到了莫名其妙的mysql亂碼問題,其實(shí)不是mysql的問題,是jdbc數(shù)據(jù)源的鏈接沒有指明字符集的問題,記下來備用:<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 貝貝爸爸 閱讀(770) | 評論 (0)編輯 收藏

    今天在處理zTree的時候,無意間遇到一個很好的插件,可以將array對象轉(zhuǎn)換為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
    像上面那樣用就行了,很容易進(jìn)行請求間的參數(shù)傳遞。
    項(xiàng)目地址為:http://code.google.com/p/jquery-json/

    posted @ 2012-05-10 13:45 貝貝爸爸 閱讀(1077) | 評論 (1)編輯 收藏

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

    posted @ 2012-04-26 14:45 貝貝爸爸 閱讀(390) | 評論 (0)編輯 收藏

    nnd,今天搞了快2個小時,總是無法解決ldap支持的其他屬性返回問題,因?yàn)橹芭渲玫氖?.3.5版本,現(xiàn)在最新的版本是3.4.11,原來的配置竟然無法使用了,原來是因?yàn)樵黾臃?wù):
    <bean id="serviceRegistryDao" class="org.jasig.cas.services.InMemoryServiceRegistryDaoImpl">
    導(dǎo)致無法返回principal的其他屬性到客戶端,其實(shí)象這樣配置即可:<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>
    如上所示,其中注冊的服務(wù)registeredServices
    默認(rèn)是不允許返回其他屬性到客戶端的!!!!!,真的是很坑爹啊,不過,配置一下ignoreAttributes即可,也可以指定allowedAttributes
    如下:
    <property name="allowedAttributes">
        <list>
                <value><!-- your attribute key --></value>
        </list>
    </property>

    posted @ 2012-04-25 23:12 貝貝爸爸 閱讀(1329) | 評論 (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 貝貝爸爸 閱讀(372) | 評論 (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 貝貝爸爸 閱讀(847) | 評論 (0)編輯 收藏

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

    posted @ 2012-03-29 05:05 貝貝爸爸 閱讀(195) | 評論 (0)編輯 收藏

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

    posted @ 2012-03-21 17:22 貝貝爸爸 閱讀(280) | 評論 (0)編輯 收藏

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



    posted @ 2012-03-19 17:25 貝貝爸爸 閱讀(322) | 評論 (0)編輯 收藏

    今天調(diào)試了一天,所有的步驟都正確,可最后到了web下載,卻總是404錯誤,好心zzq網(wǎng)友幫著一起定位和解決問題,可依然沒有找到原因,偶爾的一個google搜索,發(fā)現(xiàn)是因?yàn)闆]有sudo啟動nginx。。。。
    真tmd扯淡了。

    posted @ 2012-03-18 20:13 貝貝爸爸 閱讀(361) | 評論 (0)編輯 收藏

    https://gist.github.com/2066974

    posted @ 2012-03-18 08:26 貝貝爸爸 閱讀(259) | 評論 (0)編輯 收藏

    系統(tǒng)環(huán)境
    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 貝貝爸爸 閱讀(765) | 評論 (0)編輯 收藏

    可能后面會遇到同一臺服務(wù)器,安裝多個jboss實(shí)例的問題,那顯然的問題可能就是端口沖突問題,怎么辦?
    1、修改各個配置文件的端口配置
    2、最簡單的方法是,啟動是指明端口綁定步長,例如:-Djboss.socket.binding.port-offset=100

    posted @ 2012-03-04 20:40 貝貝爸爸 閱讀(463) | 評論 (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 貝貝爸爸 閱讀(225) | 評論 (0)編輯 收藏

    今天又在centos下折騰呢,呵呵,不過這次的環(huán)境是mac下安裝centos的虛擬機(jī),mac環(huán)境和linux環(huán)境還是很大區(qū)別,至少無法安裝我想要的FastDFS環(huán)境,著實(shí)有點(diǎn)無法接受,所以只能安裝虛擬機(jī)了。
    ssh centos后,主要安裝遇到了如下問題:
    1、gcc-c++沒有安裝,會導(dǎo)致安裝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//確實(shí)沒找到
        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 貝貝爸爸 閱讀(2104) | 評論 (0)編輯 收藏

    這篇文章獻(xiàn)給天下兒童的父母。
         老農(nóng)民的智慧和知識分子的尷尬:
        很多沒有上過學(xué)的老農(nóng)民培養(yǎng)出了優(yōu)秀的孩子,不少有知識、高學(xué)歷的城里人卻把孩子管出諸多毛病,甚至培養(yǎng)出問題孩子,為什么?老農(nóng)民沒知識但有智慧,城里人有知識但沒智慧。(知識不等于智慧。)
        智慧的老農(nóng)民三句話就培養(yǎng)出了好孩子:
        第一句話:“孩子,爸媽沒本事,你要靠自己了。”不包辦,把責(zé)任還給孩子,讓孩子擁有了責(zé)任心。
        第二句話:“孩子,做事先做人,一定不能做傷害別人的事情。”講德行,告訴孩子做人的標(biāo)準(zhǔn)。
        第三句話:“孩子,撒開手闖吧,實(shí)在不行,回家來還有口飯吃。”無私的愛,無盡的愛!
        看看一些城里人怎么把孩子教育出問題的:
        第一句話:“寶貝,你 好好學(xué)習(xí)就行了,其他的事情爸爸媽媽來辦!”剝奪了孩子負(fù)責(zé)任的權(quán)利,培養(yǎng)出了沒有責(zé)任心的孩子。
        第二句話:“寶貝,出去不能吃虧,別人打你一定要還手!”基本的做人準(zhǔn)則都沒有教對,可能培養(yǎng)出“缺德”的孩子。
        第三句話:“我告訴你,你要是再不好好學(xué)習(xí),長大沒飯吃別來找我!”有條件的愛,根本不是真愛。
        只要擁有智慧,每一位家長都能把孩子培養(yǎng)成才,而智慧與知識和學(xué)歷并不相關(guān)!

    posted @ 2011-08-06 22:47 貝貝爸爸 閱讀(271) | 評論 (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.
    這篇文章,將介紹所有一年前我工作中或者個人項(xiàng)目的開發(fā)模型,這個模型已經(jīng)被證明是十分有用的(successfull)。我老早就想寫一些關(guān)于這個模型的文章,但是總是抽不出時間。在這篇文章中,我將不會介紹項(xiàng)目的詳細(xì)情況,僅僅對分支的策略和發(fā)布管理作一個介紹。

    It focuses around Git as the tool for the versioning of all of our source code.
    我們將圍繞這使用Git作為所有項(xiàng)目源碼的版本控制工具。
    • 為何選擇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.
    關(guān)于Git作為集中的源碼控制系統(tǒng)的優(yōu)缺點(diǎn),可以查看一下鏈接,關(guān)于這個話題,有激烈的爭論。作為一個開發(fā)者,與其他版本控制工具相比,我更喜歡Git,Git真正的改變了開發(fā)者關(guān)于合并和分支的思考(think)。我曾經(jīng)也用過CVS、svn,分支和合并,真的很讓人頭疼(合并時產(chǎn)生的沖突),因此,有時你每次只能做一會工作(個人理解:因?yàn)閟vn這種版本控制庫只有一個服務(wù)倉庫,涉及公共資源,只能鎖定編輯)

    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來說,做這樣的工作(分支、合并),太簡單!它真的可以作為你日常工作流程中最核心的部分。例如,在有關(guān)CVS/svn的書籍中,分支和合并要放到最后一章才會闡述(針對高級用戶),然后在Git相關(guān)的書籍中,首先就先跟你闡述分支和合并(第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.
    關(guān)于這個工具的介紹,我們不再贅述,現(xiàn)在我們回到開發(fā)模式的話題上來。這個模型,基本上和每個開發(fā)團(tuán)隊(duì)管理軟件開發(fā)流程是類似的。
    • 分布而集中
    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.
    我們使用這個分支模型很好工作的倉庫,是真正意義上的中央倉庫。這個倉庫是唯一的中央倉庫(因?yàn)镚it本身就是分布式版本控制系統(tǒng)DVCS,所以這沒有技術(shù)問題)。我們稱這樣一個中央倉庫為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.
    每個開發(fā)者,都可以從origin獲得(pull)資源,同時也能推送(push)到origin。除此之外,每個開發(fā)者可以從其他開發(fā)者那里獲得資源,以此組建自己的一個小組。例如,當(dāng)我們要開發(fā)一個大的新功能時,我們將和其他人一起協(xié)作,在提交到中央倉庫origin之前,我們需要小組內(nèi)部能夠互相協(xié)作,這將是十分有用的。上圖中,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.
    從技術(shù)實(shí)現(xiàn)上講,這無非是在Alice的項(xiàng)目里,定義了一個指向Bot的遠(yuǎn)程鏈接而已(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分支已經(jīng)為所有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為主要分支,因?yàn)榉种У腍EAD指向的源碼總是反映了一個可以發(fā)布的產(chǎn)品狀態(tài)(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為主要分支,因?yàn)榉种У腍EAD指向的源碼,總是反映了下次發(fā)布前最新提交的開發(fā)代碼。有些人稱之為“集成分支”(integration barnch),因?yàn)槲覀兊拿客碜詣訕?gòu)建都是基于此分支進(jìn)行的。(例如hudson,可以做自動構(gòu)建工作)。
    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.
    當(dāng)develop分支的源碼穩(wěn)定并且準(zhǔn)備發(fā)布,所有的改變應(yīng)該合并(merge)到master分支,同時做一個發(fā)布版本的標(biāo)簽(tag),我們將在后面討論這個細(xì)節(jié)。
    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.
    因此,當(dāng)每一次將所有更改合并回master時,將會產(chǎn)生一個新的可以發(fā)布的產(chǎn)品狀態(tài)。我們往往對于這個操作的控制是比較嚴(yán)格的,每當(dāng)往master分支提交時,我們可以使用Git的hook來自動構(gòu)建和轉(zhuǎn)出到產(chǎn)品服務(wù)器上。
    • 輔助分支

    posted @ 2011-07-06 12:34 貝貝爸爸 閱讀(535) | 評論 (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服務(wù)器地址**"/>

            
    <!-- Change to the SMTP gateway server -->
            
    <property name="mail.smtp.host" value="***smtp服務(wù)器地址***"/>
            
            
    <!-- 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 貝貝爸爸 閱讀(469) | 評論 (0)編輯 收藏

    git的分支處理模型,真的很爽,但關(guān)于如何對git的分支進(jìn)行管理?最近有網(wǎng)友給我提到了git flow,呵呵,按照我的理解,應(yīng)該是git的一個最佳實(shí)踐吧,原文A successful Git branching model對git的分支模型作了闡述,以下我對該文章進(jìn)行自己的翻譯和理解,聊以日后學(xué)習(xí),首先先看一下下面這個圖:
    git flow將git的分支主要分為2類:主要分支和支持分支
    • 主要分支
      • master:永遠(yuǎn)處在產(chǎn)品可以發(fā)布(production ready)狀態(tài)
      • develop: 當(dāng)前最新的開發(fā)狀態(tài)
    • 支持分支
      • Feature branches: 開發(fā)新的功能,從develop分支出來,完成開發(fā)、測試后,merge回develop。
      • Release branches: 準(zhǔn)備發(fā)布版本的分支,該分支只修復(fù)bug,完成后,merge回develop和master。
      • Hotfix branches: 來不及等待下個版本的發(fā)布,但又要馬上修復(fù)bug的情況,從master分支出來,完成開發(fā)、測試后,merge回master和develop。

    posted @ 2011-05-31 09:44 貝貝爸爸 閱讀(678) | 評論 (1)編輯 收藏

    由于最近在做的oryx-editor使用的是posgresql8.3.15,不能自動的使用yum install安裝了,因?yàn)楝F(xiàn)在源里面的版本是8.1,無法滿足項(xiàng)目要求,特安裝了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、創(chuàng)建用戶組和用戶:
    groupadd postgres
    useradd -g postgres postgres

    7、創(chuàng)建數(shù)據(jù)庫庫文件存儲目錄、給postgres賦予權(quán)限:
    mkdir /usr/local/pgsql/data
    cd /usr/local/pgsql
    chown postgres.postgres data

    8、初始化數(shù)據(jù)庫目錄:
    切換用戶
       su - postgresql

    初始化數(shù)據(jù)
       /usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data

    啟動數(shù)據(jù)庫
       /usr/local/pgsql/bin/postmaster -D /usr/local/pgsql/data

    9、配置監(jiān)聽地址和端口:
    vi /usr/local/pgsql/data/postgresql.conf
    取消以下兩行的注釋
       listen_addresses = '*'

       port = 5432

    10、允許遠(yuǎn)程連接:
    vi /usr/local/pgsql/data/pg_hba.conf
    添加
       host all all 192.168.1.0/24 trust 

       每項(xiàng)的具體意思在配置文件中有詳細(xì)說明
    配置iptables讓遠(yuǎn)程主機(jī)能訪問:
       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數(shù)據(jù)庫隨系統(tǒng)啟動而啟動:
    將啟動腳本拷貝到/etc/init.d/目錄下,具體執(zhí)行如下命令:
    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
    啟動數(shù)據(jù)庫:
       service postgresql start

    配置完畢 。

    posted @ 2011-05-27 23:00 貝貝爸爸 閱讀(660) | 評論 (0)編輯 收藏

    1、顯示數(shù)據(jù)庫列表。
    show databases;
    2、顯示庫中的數(shù)據(jù)表:
    use mysql;
    show tables;
    3、顯示數(shù)據(jù)表的結(jié)構(gòu):
    describe 表名;
    4、建庫:
    create database 庫名;
    5、建表:
    use 庫名;
    create table 表名 (字段設(shè)定列表);
    6、刪庫和刪表:
    drop database 庫名;
    drop table 表名;
    7、將表中記錄清空:
    delete from 表名;
    8、顯示表中的記錄:
    select * from 表名

    • 外網(wǎng)無法訪問的問題
      #登錄myql
      #
      mysql -u root mysql -p

      #mysql>update user set password=password('123456') where user='root';

      #mysql>fulsh privileges;
      #
      mysql>\q

    posted @ 2011-05-26 21:36 貝貝爸爸 閱讀(228) | 評論 (0)編輯 收藏

    • 安裝python環(huán)境
    #yum install python python-setuptools
     1 ##下載gitosis倉庫到本地
     2 # git clone git://eagain.net/gitosis.git gitosis
     3 
     4 #安裝 yum install python-setuptools
     
    5 # python setup.py install --record uninstall.txt #記錄需要卸載的東西
     6 
     7 #導(dǎo)入初始化公鑰
     8 # su git
     9 [git@dev01 gitosis]$ gitosis-init < /tmp/id_rsa_yuan.pub 
    10 Initialized empty Git repository in /home/git/repositories/gitosis-admin.git/
    11 Reinitialized existing Git repository in /home/git/repositories/gitosis-admin.git/
    12 
    13 #進(jìn)入自己設(shè)置的git倉庫路徑
    14 # cd /var/git/
    15 [root@dev01 git]# ln -s /home/git/repositories/ repo
    16 #改變文件權(quán)限
    17 [root@dev01 git]# chmod 755 /var/git/repo/gitosis-admin.git/hooks/post-update
    18 
    19 -----------------------
    20 回到本機(jī)測試一下ssh連接
    21 $ ssh git@192.168.250.231
    22 ERROR:gitosis.serve.main:Need SSH_ORIGINAL_COMMAND in environment.
    23 Connection to 192.168.250.231 closed.
    24 
    25 ##大功告成,說明gitosis生效
    • 提交本地工程到服務(wù)器
    #首先clonegitosis-admin項(xiàng)目到本地
    $ git clone git@192.168.250.231:gitosis-admin.git
    Cloning into gitosis
    -admin
    remote: Counting objects: 
    5, done.
    remote: Compressing objects: 
    100% (5/5), done.
    remote: Total 
    5 (delta 0), reused 5 (delta 0)
    Receiving objects: 
    100% (5/5), done.
    啊啊
    #修改查看到gitosis.conf
    [gitosis]

    [group gitosis
    -admin]
    writable 
    = gitosis-admin
    members 
    = yuan
    [group eontime]
    writable 
    = costdb \
               oryx
    -editor \
               demo
    /test
    members 
    = yuan
    #如上所示,分有2個組類型admin和我們自定義的,你可以隨便定義一個組,其實(shí)就是個權(quán)限集合
    #
    writable意思是,這個權(quán)限組有哪幾個項(xiàng)目的寫權(quán)限?這里是空格分開,如果太長就換行,例如demo/test的話,就是:
    git remote add origin git@gitserver:demo/test.git

    members就是有這個權(quán)限的組成員了,通過把有權(quán)限的開發(fā)者的公鑰上傳至keydir

    最后將gitosis
    -admin提交至遠(yuǎn)程
    #git push remote origin master

    ok,一切完成,服務(wù)端將同步有一個倉庫了。

    posted @ 2011-05-26 15:46 貝貝爸爸 閱讀(3305) | 評論 (0)編輯 收藏

    呵呵,不知道為何新建項(xiàng)目之后,這個東西就不見了,我覺得還是很有用的:
    Global setup:

     Download and install Git
      git config 
    --global user.name "yuanqixun"
      git config 
    --global user.email yuanqixun@gmail.com
            

    Next steps:

      mkdir activiti
    -modeler
      cd activiti
    -modeler
      git init
      touch README
      git add README
      git commit 
    -'first commit'
      git remote add origin git@github.com:yuanqixun
    /activiti-modeler.git
      git push 
    -u origin master
          

    Existing Git Repo
    ?

      cd existing_git_repo
      git remote add origin git@github.com:yuanqixun
    /activiti-modeler.git
      git push 
    -u origin master
          

    Importing a Subversion Repo
    ?

      Click here
          

    When you
    're done:

      Continue


    • 安裝eclipse的egit插件地址
    https://repository.sonatype.org/content/repositories/forge-sites/m2eclipse-egit/0.13.0/N/0.13.0.201103031543/

    https://repository.sonatype.org/content/sites/forge-sites/m2eclipse-subversive/0.13.0/N/0.13.0.201103011512/

    posted @ 2011-05-20 17:42 貝貝爸爸 閱讀(765) | 評論 (0)編輯 收藏

    • 安裝
    # yum install postgresql postgresql-libs postgresql-server
    [root@dev ~]# service postgresql status
    postmaster is stopped
    [root@dev 
    ~]# service postgresql start
    Initializing database:                                     [  OK  ]
    Starting postgresql service:                               [  OK  ]


    • 設(shè)為開機(jī)啟動

    [root@dev ~]# chkconfig postgresql on
    [root@dev ~]# chkconfig --list postgresql
    postgresql      0:off   1:off   2:on    3:on    4:on    5:on    6:off
    • 配置參數(shù)

    [root@dev ~]# vim /var/lib/pgsql/data/pg_hba.conf
    #
     "local" is for Unix domain socket connections only
    #
    local   all         all                               ident sameuser
    local   all         all         trust
    # IPv4 local connections:
    #
    host    all         all         127.0.0.1/32          ident sameuser
    host    all         all         127.0.0.1/32          md5
    host
        all         all         192.168.28.3/32       md5 #必須有后面那個,那個是掩碼,否則總報pg_hba.conf語法錯
    [root@dev ~]# su - postgres
    -bash-3.2$ pg_ctl reload
    postmaster signaled
    [root@dev 
    ~]# vim /var/lib/pgsql/data/postgresql.conf 
    listen_addresses = '*'
    [root@dev 
    ~]# su - postgres
    -bash-3.2$ pg_ctl reload
    postmaster signaled
    • 常用命令

    # psql -l            列出所有數(shù)據(jù)庫   # psql
    => \l                列出所有數(shù)據(jù)庫
    => \c cake            連接到cake數(shù)據(jù)庫
    => \dt                列出所有tables
    => \d shift            查看shift表結(jié)構(gòu)
    => \di                列出所有indexes
    => \d shift_pkey    列出所有index: shift_pkey
    • 測試java代碼

     1 import java.sql.Connection;
     2 import java.sql.DriverManager;
     3 import java.sql.ResultSet;
     4 import java.sql.Statement;
     5 
     6 public class PostgresqlTest {
     7 
     8     /**
     9      * @param args
    10      */
    11     public static void main(String[] args) {
    12         try {
    13             Class.forName("org.postgresql.Driver").newInstance();
    14             String connectUrl = "jdbc:postgresql://192.168.250.231:5432/poem";
    15             Connection conn = DriverManager.getConnection(connectUrl,
    16                     "poem""poem");
    17             Statement st = conn.createStatement();
    18             String sql = "select 1;";
    19             ResultSet rs = st.executeQuery(sql);
    20             while (rs.next()) {
    21                 System.out.println(rs.getInt(1));
    22             }
    23             rs.close();
    24             st.close();
    25             conn.close();
    26         } catch (Exception e) {
    27             e.printStackTrace();
    28         }
    29     }
    30 
    31 }
    32 

    posted @ 2011-05-18 21:58 貝貝爸爸 閱讀(3197) | 評論 (0)編輯 收藏

    今天研究了git一天,發(fā)現(xiàn)git真的很好哦,總結(jié)為3點(diǎn):
    1、本地快照方式,會讓提交工作很快
    2、獨(dú)特的快速分支處理方式,對后期的bug補(bǔ)丁的修改、發(fā)行將很有好處;
    3、合并--git的合并發(fā)生在客戶端而非svn、cvs的服務(wù)端(個人覺得這個是極大的好處,協(xié)作的svn就是在服務(wù)端,造成了每次提交有的成功了,有的不成功)

    后面我會慢慢的總結(jié)進(jìn)來的。

    posted @ 2011-05-12 21:16 貝貝爸爸 閱讀(226) | 評論 (0)編輯 收藏

    卸載mysql

    rpm -qa|grep -i mysql

    rpm -ev MySQL-server-4.0.14-0 MySQL-client-4.0.14-0

    卸載后/var/lib/mysql中的數(shù)據(jù)及/etc/my.cnf不會刪除,如果確定沒用后就手工刪除

    rm -f /etc/my.cnf

    rm -rf /var/lib/mysql
    #yum -y remove php
    #yum -y remove mysql
    #yum -y remove httpd

    centos卸載系統(tǒng)與環(huán)境部署
    centos卸載系統(tǒng)已被廣泛應(yīng)用但是也在不斷的更新,這里介紹centos卸載系統(tǒng)設(shè)置使用,幫助大家安裝更新centos卸載系統(tǒng)。centos安裝好之后centos卸載系統(tǒng)自帶的 php,mysql,apache

    centos卸載系統(tǒng)可以使用rpm命令檢查一下
    #rpm -qa|grep -i php
    #rpm -qa|grep -i mysql
    #rpm -qa|grep -i httpd

    centos卸載系統(tǒng)很多依賴。最簡單的方法是使用yum卸載。由于是新安裝的系統(tǒng),所以問題應(yīng)該不大。
    #yum -y remove php
    #yum -y remove mysql
    #yum -y remove httpd

    centos卸載系統(tǒng)再用rpm -qa看一下,全部卸掉了轉(zhuǎn)一個系統(tǒng)目錄約定,軟件源代碼包存放位置/usr/local/src源碼包編譯安裝位置(prefix)/usr /local/software_name腳本以及維護(hù)程序存放位置/usr/local/sbinMySQL 數(shù)據(jù)庫位置/var/lib/mysqlApache 網(wǎng)站根目錄/data/wwwrootApache 虛擬主機(jī)日志根目錄/data/logs/wwwApache 運(yùn)行賬戶www:wwwyum RPM包信息文件/etc/yum.list 下面的LAMP環(huán)境部署 基本也是參考上面的文章。

    系統(tǒng)環(huán)境部署及調(diào)整

    1. 檢查系統(tǒng)是否正常# more /var/log/messages(檢查有無系統(tǒng)內(nèi)核級錯誤信息)# dmesg (檢查硬件設(shè)備是否有錯誤信息)# ifconfig(檢查網(wǎng)卡設(shè)置是否正確)# ping www.163.com  (檢查網(wǎng)絡(luò)是否正常)

    2. 關(guān)閉不需要的服務(wù)# ntsysv以下僅列出需要啟動的服務(wù),未列出的服務(wù)一律關(guān)閉:crondirqbalance (僅當(dāng)服務(wù)器CPU為S.M.P架構(gòu)或支持雙核心、HT技術(shù)時,才需開啟,否則關(guān) 閉。)microcode_ctlnetworkrandomsendmailsshdsyslog

    3. 對TCP/IP網(wǎng)絡(luò)參數(shù)進(jìn)行調(diào)整,加強(qiáng)抗SYN Flood能力# echo ‘net.ipv4.tcp_syncookies = 1′ >> /etc/sysctl.conf# sysctl -p

    4. 配置yum# rpm –import /usr/share/doc/centos-release-3/RPM-GPG-KEY-CentOS-3# yum list | tee /etc/yum.list

    5. 修改命令history記錄# vi /etc/profile找到 HISTSIZE=1000 改為 HISTSIZE=50

    6. 定時校正服務(wù)器時間# yum install ntp# crontab -e加入一行:*/15 * * * * ntpdate 210.72.145.44## 210.72.145.44 為中國國家授時中心服務(wù)器地址。

    7. 重新啟動系統(tǒng)# init 6

    8. 使用 yum 程序安裝所需開發(fā)包(以下為標(biāo)準(zhǔn)的 RPM 包名稱)gcc gcc-c++ gcc-g77 flex bison autoconf automake bzip2-devel zlib-devel ncurses-devel libjpeg-devel libpng-devel libtiff-devel freetype-devel pam-devel按上面步驟操作,基本沒有問題,很順利。以上介紹centos卸載系統(tǒng)。

    posted @ 2011-05-11 09:03 貝貝爸爸 閱讀(987) | 評論 (0)編輯 收藏

    • 安裝相關(guān)依賴
    yum install gettext-devel expat-devel curl-devel zlib-devel openssl-devel
    • 獲得git源碼
    # wget http://kernel.org/pub/software/scm/git/git-1.7.5.tar.gz
    • 解壓后編譯安裝
    # tar xvfz git-1.7.5.tar.gz
    # cd git
    -1.7.5
    # make prefix
    =/usr/local all
    # make prefix
    =/usr/local install
    • 安裝后結(jié)果
    [root@dev git-1.7.5]# whereis git
    git: /usr/local/bin/git
    [root@dev git
    -1.7.5]# git --version
    git version 1.7.5

    posted @ 2011-05-10 22:59 貝貝爸爸 閱讀(481) | 評論 (0)編輯 收藏

    功能說明:檢查、設(shè)定系統(tǒng)的各種服務(wù)。

    語法:chkconfig [--add][--del][--list][系統(tǒng)服務(wù)]
    chkconfig [--level<
    等級代號>][系統(tǒng)服務(wù)][on/off/reset]

    補(bǔ)充說明:這個是redhat公司遵循gpl規(guī)則所開發(fā)的程序,它可以查詢操作系統(tǒng)在每一個執(zhí)行等級(runlevel),會執(zhí)行哪些系統(tǒng)服務(wù),其中包括各種daemon

    linux os 將操作環(huán)境分為以下7個等級:


    0:
    開機(jī)(請不要切換到此等級)
    1:
    單人使用者模式的文字界面
    2:
    多人使用者模式的文字界面,不具有網(wǎng)絡(luò)檔案系統(tǒng)(NFS)功能
    3:
    多人使用者模式的文字界面,具有網(wǎng)絡(luò)檔案系統(tǒng)(NFS)功能
    4:
    某些發(fā)行版的linux使用此等級進(jìn)入x windows system
    5:
    某些發(fā)行版的linux使用此等級進(jìn)入x windows system
    6:
    重新啟動

    參數(shù):    --add   新增所指定的系統(tǒng)服務(wù)
             --del
    刪除所指定的系統(tǒng)服務(wù)
             --level
    指定該系統(tǒng)服務(wù)要在哪個執(zhí)行等級中開啟或關(guān)閉
             --list  
    列出當(dāng)前可從chkconfig指令管理的所有系統(tǒng)服務(wù)和等級代號
                on/off/reset  
    在指定的執(zhí)行登記,開啟/關(guān)閉/重置該系統(tǒng)服務(wù)

    chkconfig命令主要用來更新(啟動或停止)和查詢系統(tǒng)服務(wù)的運(yùn)行級信息。謹(jǐn)記chkconfig不是立即自動禁止或激活一個服務(wù),它只是簡單的改變了符號連接。

    語法:

        chkconfig --list [name]
        chkconfig --add name
        chkconfig --del name
        chkconfig [--level levels] name <on|off|reset>
        chkconfig [--level levels] name

        chkconfig 沒有參數(shù)運(yùn)行時,顯示用法。如果加上服務(wù)名,那么就檢查這個服務(wù)是否在當(dāng)前運(yùn)行級啟動。如果是,返回true,否則返回false。如果在服務(wù)名后面指定 onoff或者reset,那么chkconfi 會改變指定服務(wù)的啟動信息。onoff分別指服務(wù)被啟動和停止,reset指重置服務(wù)的啟動信息,無論有問題的初始化腳本指定了什么。onoff 關(guān),系統(tǒng)默認(rèn)只對運(yùn)行級345有效,但是reset可以對所有運(yùn)行級有效。

        --level選項(xiàng)可以指定要查看的運(yùn)行級而不一定是當(dāng)前運(yùn)行級。

        需要說明的是,對于每個運(yùn)行級,只能有一個啟動腳本或者停止腳本。當(dāng)切換運(yùn)行級時,init不會重新啟動已經(jīng)啟動的服務(wù),也不會再次去停止已經(jīng)停止的服務(wù)。

        chkconfig --list :顯示所有運(yùn)行級系統(tǒng)服務(wù)的運(yùn)行狀態(tài)信息(onoff)。如果指定了name,那么只顯示指定的服務(wù)在不同運(yùn)行級的狀態(tài)。

        chkconfig --add name:增加一項(xiàng)新的服務(wù)。chkconfig確保每個運(yùn)行級有一項(xiàng)啟動(S)或者殺死(K)入口。如有缺少,則會從缺省的init腳本自動建立。

        chkconfig --del name:刪除服務(wù),并把相關(guān)符號連接從/etc/rc[0-6].d刪除。

        chkconfig [--level levels] name <on|off|reset>:設(shè)置某一服務(wù)在指定的運(yùn)行級是被啟動,停止還是重置。例如,要在345運(yùn)行級停止nfs服務(wù),則命令如下:

        chkconfig --level 345 nfs off

    運(yùn)行級文件:

        每個被chkconfig管理的服務(wù)需要在對應(yīng)的init.d下的腳本加上兩行或者更多行的注釋。第一行告訴chkconfig缺省啟動的運(yùn)行級以及啟動 和停止的優(yōu)先級。如果某服務(wù)缺省不在任何運(yùn)行級啟動,那么使用 - 代替運(yùn)行級。第二行對服務(wù)進(jìn)行描述,可以用\ 跨行注釋。
    例如,random.init包含三行:
    # chkconfig: 2345 20 80
    # description: Saves and restores system entropy pool for \
    # higher quality random number generation.

    附加介紹一下Linux系統(tǒng)的運(yùn)行級的概念:
        Linux
    中有多種運(yùn)行級,常見的就是多用戶的2345 ,很多人知道5是運(yùn)行X-Windows的級別,而0就是關(guān)機(jī)了。運(yùn)行級的改變可以通過init命令來切換。例如,假設(shè)你要維護(hù)系統(tǒng)進(jìn)入單用戶狀態(tài),那 么,可以使用init1來切換。在Linux的運(yùn)行級的切換過程中,系統(tǒng)會自動尋找對應(yīng)運(yùn)行級的目錄/etc/rc[0-6].d下的KS開頭的文件, 按后面的數(shù)字順序,執(zhí)行這些腳本。對這些腳本的維護(hù),是很繁瑣的一件事情,Linux提供了chkconfig命令用來更新和查詢不同運(yùn)行級上的系統(tǒng)服 務(wù)。

    范例:

    1.
    查看在各種不同的執(zhí)行等級中,各項(xiàng)服務(wù)的狀況:
    $chkconfig --list

    2.
    列出系統(tǒng)服務(wù)vsftpd在各個執(zhí)行等級的啟動情況:
    $chkconfig --list vsftpd

    3.
    在執(zhí)行等級3,5時,關(guān)閉vsftpd系統(tǒng)服務(wù):
    $chkconfig --level 35 vsftpd off

    4.
    在執(zhí)行等級235時,開啟 vsftpd系統(tǒng)服務(wù):
    $chkconfig --level 235 vsftpd on

    5.
    關(guān)閉一些自己不需要的服務(wù) ->
    如果沒有打印機(jī):
    chkconfig --level 235 cups off 
    如果沒有局域網(wǎng):
    chkconfig --level 235 smb off
    如果不需要遠(yuǎn)程用戶登錄的:
    chkconfig --level 235 sshd off
    如果不需要定時任務(wù)的:
    chkconfig --level 235 crond off
    如果不需要添加新硬件的:
    chkconfig --level 235 kudzu off

    posted @ 2011-05-10 17:19 貝貝爸爸 閱讀(174) | 評論 (0)編輯 收藏

    昨天把我們的Linux服務(wù)器搭建起來之后,發(fā)現(xiàn)free -m后,竟然free列數(shù)值好少哦:

    以上幾列,說明我的機(jī)器有6g內(nèi)存,我原本以為free是我們的可用內(nèi)存,可我的服務(wù)器其實(shí)打開的應(yīng)用不多啊,所以很費(fèi)解,Google了下,找到了如下解釋:
    第二行(mem)的used/free與第三行(-/+ buffers/cache) used/free的區(qū)別
    • Mem行,從OS的角度來看,因?yàn)閷τ贠S,buffers/cached 都是屬于被使用,所以他的可用內(nèi)存是2975M,已用內(nèi)存是2947M
    • 第三行,從應(yīng)用程序角度來看,對于應(yīng)用程序來說,buffers/cached 是等于可用的,因?yàn)閎uffer/cached是為了提高文件讀取的性能,當(dāng)應(yīng)用程序需在用到內(nèi)存的時候,buffer/cached會很快地被回收。
    所以從應(yīng)用的角度出發(fā),其實(shí)可用內(nèi)存是
    5238M≈2975M+179M+2083M(換成KB的話應(yīng)該就是相等了)
    所以我當(dāng)前應(yīng)用消耗的內(nèi)存,應(yīng)該是:
    684M=5922M-5238M(這下應(yīng)該靠譜了

    posted @ 2011-05-10 08:58 貝貝爸爸 閱讀(221) | 評論 (0)編輯 收藏

    去年開發(fā)flex的時候,由于appian的特殊部署環(huán)境,我每次都要手動build好之后,放到服務(wù)器上,偶爾的一次機(jī)會,有人介紹了自動構(gòu)建工具h(yuǎn)udson,研究了1個月,把工程遷移到maven上之后,成功讓hudson自動的每天幫我們構(gòu)建項(xiàng)目,呵呵,真的很爽哦,徹底讓我從枯燥、無味、易錯的build部署工作中解放出來了!~~

    今天把hudson遷移到了Linux服務(wù)器上之后,發(fā)現(xiàn)真的很快了哦,刷刷的跑著呢。

    posted @ 2011-05-09 16:31 貝貝爸爸 閱讀(169) | 評論 (0)編輯 收藏

    • 設(shè)置日期為2011-05-09
    # date -s 110509
    • 設(shè)置系統(tǒng)時間
    # date -s 16:04:00

    posted @ 2011-05-09 16:22 貝貝爸爸 閱讀(120) | 評論 (0)編輯 收藏

    最近搞了個centos的服務(wù)器,但是如果不能進(jìn)行文件的共享傳遞,著實(shí)麻煩,所以著手安裝samba服務(wù),
    網(wǎng)上多數(shù)是采用rpm安裝的,其實(shí)聯(lián)網(wǎng)的話,可以使用yum來安裝的,我們就用最簡單的方法安裝:
    • 使用yum安裝
    # yum install samba
    • 查看samba安裝在了哪里
    [root@dev01 ~]# whereis samba
    samba: /etc/samba /usr/share/samba /usr/share/man/man7/samba.7.gz
    • 配置/etc/samba/smb.conf

    # vi /etc/samba/smb.conf

    workgroup
    =WORKGROUP

    hosts allow 
    = 127192.168.

    [share]
    comment
    =Share
    path
    =/var/samba/share
    writable
    =yes
    public
    =yes
    • 配置的共享目錄設(shè)置權(quán)限

    # mkdir /var/samba/share       如剛才配置的共享目錄不存在則創(chuàng)建
    #
     chown -R nobody. /var/samba/share       設(shè)置共享目錄歸屬為 nobody
    #
     chmod 777 /var/samba/share       將共享目錄屬性設(shè)置為 777
    • 添加samba用戶(可以不用加新的用戶,如果只是自己用的話)

    # smbpasswd -a root
    # service smb restart

    posted @ 2011-05-09 12:52 貝貝爸爸 閱讀(816) | 評論 (1)編輯 收藏

    這幾天開始隨時隨地把工作中解決的、沒解決的問題都在blogjava里記錄上,發(fā)現(xiàn)很爽哦,尤其是我們搞開發(fā)的,他的“插入代碼”功能真的太棒了,簡單易用,讓我隨時把工作中的收獲記錄下來。
    如果他有導(dǎo)出生成chm文件的功能,那就更好了。

    posted @ 2011-05-09 11:14 貝貝爸爸 閱讀(190) | 評論 (0)編輯 收藏

    剛才發(fā)現(xiàn)yum install 的時候,竟然把32位的軟件也下載下來了,真慢啊,Google了下,發(fā)現(xiàn)是可以過濾掉32位的包的:
    # vi /etc/yum.conf
    [main]

    exclude
    =*.i?86
    這樣就過濾掉了32位的軟件i386或者i686的包了
    也可以刪除系統(tǒng)里面32位的軟件包
    # yum remove \*.i\?86

    注意:有的軟件包會對32位的軟件包有依賴(安裝出錯的時候再仔細(xì)分析原因吧,這里先關(guān)掉)

    posted @ 2011-05-09 11:12 貝貝爸爸 閱讀(186) | 評論 (0)編輯 收藏

    • 裝好CentOS后,加入 openvz 源、升級系統(tǒng)、安裝 openvz 內(nèi)核和 vzctl, vzquota 等工具:
    # cd /etc/yum.repos.d
    #
     wget http://download.openvz.org/openvz.repo
    #
     rpm --import http://download.openvz.org/RPM-GPG-Key-OpenVZ
    #
     yum update

    # yum install vzkernel
    #
     yum install vzctl vzquota
    • 調(diào)整內(nèi)核參數(shù)

    為了能讓 VE/VPS 訪問外部網(wǎng)絡(luò),我們必須啟動 ip forwarding;如果內(nèi)核出錯或者運(yùn)行很慢,我們希望能用特殊按鍵 dump 一些信息到控制臺并結(jié)合 log 排錯,所以建議打開 kernel.sysrq:
    # vi /etc/sysctl.conf

    net.ipv4.ip_forward 
    = 1
    kernel.sysrq 
    = 1

    為了減少麻煩最好關(guān)閉 selinux
    # vi /etc/sysconfig/selinux

    SELINUX
    =disabled


    檢查 vz 服務(wù)是否自動啟動,并重啟機(jī)器進(jìn)入 openvz 內(nèi)核:

    # chkconfig --list vz
    vz                 0:off    1:off    2:on    3:on    4:on    5:on    6:off

    # reboot

    • 下載客戶端(vPS)模版

    # cd /vz/template/cache
    #
     wget http://download.openvz.org/template/precreated/centos-5-x86_64.tar.gz
    這里我下載的是centos的,也可以下載其他模版(下次我得把這個保存下來,現(xiàn)在又在下載呢,超慢啊,崩潰了),在當(dāng)前目錄cache,安裝vps
    # vzctl create 1 --ostemplate centos-5-x86_64
    配置相關(guān)參數(shù)
    # vzctl set 1 --onboot yes --save
    #
     vzctl set 1 --ipadd 172.16.39.110 --save
    #
     vzctl set 1 --nameserver 8.8.8.8 --save
    #
     vzctl set 1 --hostname vps01.vpsee.com --save
    #
     vzctl set 1 --diskspace 10G:10G --save
    管理vps
    # vzctl start 1
    #
     vzctl restart 1
    #
     vzctl stop 1
    #
     vzctl destroy 1
    # vzctl exec 1 passwd

    posted @ 2011-05-09 10:25 貝貝爸爸 閱讀(568) | 評論 (0)編輯 收藏

    • 查看機(jī)器有硬件內(nèi)存設(shè)備信息:
    dmidecode |grep -16 "Memory Device$"
    • 查看cpu信息
    cat  /proc/meminfo
    • 修改計算機(jī)名hostname
    ##第一步:
    # hostname myname
    ##第二步:
    # vi 
    /etc/sysconfig/network #修改其中的hostname
    ##第三步:
    # vi 
    /etc/hosts

    posted @ 2011-05-09 09:57 貝貝爸爸 閱讀(144) | 評論 (0)編輯 收藏

    主站蜘蛛池模板: 老司机福利在线免费观看| 日韩免费视频观看| 精品亚洲永久免费精品| 国产精品手机在线亚洲| 日本精品人妻无码免费大全| 亚洲人成网站影音先锋播放| 搡女人免费免费视频观看| 亚洲另类少妇17p| 免费亚洲视频在线观看| 国产一区二区三区免费看| 亚洲欧美国产日韩av野草社区| www.黄色免费网站| 亚洲国产成人无码av在线播放| 99热这里有免费国产精品| 国产AV无码专区亚洲AV男同 | 亚洲精品视频在线观看免费| 久久aa毛片免费播放嗯啊| 久久99国产亚洲高清观看首页| 4hu四虎免费影院www| 亚洲综合最新无码专区| 亚洲第一视频在线观看免费| 亚洲黄片毛片在线观看| 特级av毛片免费观看| 免费在线观看黄网| 免费大片黄在线观看| 亚洲国产成人精品91久久久| 免费在线人人电影网| 亚洲精品视频免费| www永久免费视频| 国产亚洲视频在线播放| 国内永久免费crm系统z在线| 亚洲av中文无码乱人伦在线播放| 免费看无码特级毛片| 亚洲AV中文无码乱人伦下载| 免费无码一区二区三区| 亚洲视频一区二区在线观看| 真人做人试看60分钟免费视频 | 日韩免费视频网站| 亚洲av无码有乱码在线观看| 国产成人aaa在线视频免费观看| 特级毛片免费观看视频|