Wednesday, June 17, 2009

SVN: Merging a Branch into Trunk

Merge a Branch into Trunk

  1. Check out a copy of trunk:
    svn co svn+ssh://server/path/to/trunk
  2. Check out a copy of the branch you are going to merge:
    svn co svn+ssh://server/path/to/branch/myBranch
  3. Change your current working directory to "myBranch"
  4. Find the revision "myBranch" began at:
    svn log --stop-on-copy
    This should display back to you the changes that have been made back to the point the branch was cut. Remember that number (should be rXXXX, where XXXX is the revision number).
  5. Change your current working directory to trunk
  6. Perform an SVN update:
    svn up
    This will update your copy of trunk to the most recent version, and tell you the revision you are at. Make note of that number as well (should say "At revision YYYY" where YYYY is the second number you need to remember).
  7. Now we can perform an SVN merge:
    svn merge -rXXXX:YYYY svn+ssh://server/path/to/branch/myBranch
    This will put all updates into your current working directory for trunk.
  8. Resolve any conflicts that arose during the merge
  9. Check in the results:
    svn ci -m "MERGE myProject myBranch [XXXX]:[YYYY] into trunk"

That is it. You have now merged "myBranch" with trunk.

Friday, June 5, 2009

Java code base log apender

Create Log apender using java code.

This is a small example which use to log the text in different log files according to the shortcode provided.

    private void doLog(String shortCode, String text) {
        if (!loginBuffers.containsKey(shortCode)) {
            String fileName = shortCode + ".cdr";
            logger.info("Create cdr log for " + fileName);
            Logger smsLogger = Logger.getLogger("sms." + shortCode);
            DailyRollingFileAppender appender = new DailyRollingFileAppender();
            PatternLayout layout = new PatternLayout();
            layout.setConversionPattern(conversionPattern);
            appender.setDatePattern(appenderRollingDatePattern);
            appender.setLayout(layout);
            try {
                appender.setFile(path + File.separator + fileName, true, false, 1);
            } catch (IOException e) {
                logger.error("Can not create log file [" + path + File.separator + fileName + "]", e);
            }
            appender.setBufferedIO(false);
            appender.setImmediateFlush(true);
            appender.setBufferSize(1);  //4096
            appender.activateOptions();
            appender.setName("sms_" + shortCode);
            appender.setThreshold(Priority.INFO);
            smsLogger.addAppender(appender);
            loginBuffers.put(shortCode, smsLogger);
        }
        loginBuffers.get(shortCode).info(text);

        if (logger.isDebugEnabled()) {
            logger.debug("SMS is logged into " + loginBuffers.get(shortCode).getName());
        }
    }

Monday, May 11, 2009

How to count charactors in mysql.



mysql> select char_length('kumudu');
+--------------------------------+
| char_length('kumudu') |
+--------------------------------+
| 6 |
+--------------------------------+
1 row in set (0.00 sec)

You can use this in the where clause too.
Ex:
select * from vote where char_length(message)>1;

Monday, March 16, 2009

jsp page redirect

How to Rederect a jsp page
Put this code inside the <head> .

<META HTTP-EQUIV="Refresh" CONTENT="0; URL=login.do">

Example :

<html>
<head><title>Simple jsp page</title>
  <META HTTP-EQUIV="Refresh"
      CONTENT="5; URL=login.do"></head>
  <body>Please wait...</body>
</html>

Note : The number "5;" means the current page will wait that amount of seconds before loading the login page.

Wednesday, December 10, 2008

CVS

Check Out Tagged Version of Project-Name
cvs co -r tag_name Project-Name

Creating the Branch

http://kb.wisc.edu/middleware/page.php?id=4087#creating
  1. Tag the root of the branch, so you can get back.
    sandbox$ cvs tag NEW_FEATURE_ADD_ROOT
  2. Actually create the branch, at the point that you just marked.
    sandbox$ cvs tag -b -r NEW_FEATURE_ADD_ROOT \
    NEW_FEATURE_ADD_BRANCH
  3. Actually move your working directory in to the branch.
    sandbox$ cvs up -r NEW_FEATURE_ADD_BRANCH

You are now in the new branch, do what you want.

cvs rtag -r branch_name new_tag_name

Correcting Accidental Checking

http://kb.wisc.edu/middleware/page.php?id=4087#creating


View CVS status
cvs st -v

Tag a Branch

cvs rtag -r branch_name new_tag_name module_name

Creating a Tag

    1. In order to name the current end of the main trunk of a module, use the command
    2. cvs rtag Tagname my_module
    3. In order to name the current end of a branch of a module, use the command
    4. cvs rtag -r Branchname Tagname my_module
    5. Otherwise, to name the code that your working directory was checked out from (without the changes you made to your working directory since the last commit), use the command
    6. cvs tag Tagname

Create branch using rtag

  1. To create a branch from the main trunk of my_module at the revision that was last committed, use the command
  2. cvs rtag -b Branchname my_module
  3. To create a branch from a tagged revision of my_module, use the command
  4. cvs rtag -r Tagname -b Branchname my_module
  5. Both commands immediately create a branch in the repository without requiring a cvs commit to enact. You do not need to be in a checked-out working directory to do this.
More details : http://www.bioinf.uni-freiburg.de/~mmann/HowTo/cvs_branches.html