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

Tuesday, December 9, 2008

Spring

Spring MVC
http://mhimu.wordpress.com/2007/11/27/spring-mvc-tutorial/
  1. Lifecycle of a request in Spring MVC

  2. A request leaves the browser asking for a URL and optionally with request parameters.
  3. The request is first examined by DispatcherServlet.
  4. DispatcherServlet consults handler-mappings defined in a configuration file and selects an appropriate
    controller and delegates to it to handle the request.
  5. The controller applies appropriate logic to process the request which results in some information (a.k.a.
    model). This information is associated with the logical name of a result rendering entity (a.k.a view) and the
    whole is returned as a ModelAndView object along with the request back to DispatcherServlet.
  6. DispatcherServlet then consults the logical view name with a view resolving object to determine the actual view
    implementation to use.
  7. DispatcherServlet delivers the model and request to the view implementation which renders an output and sends it
    back to the browser.

2.Handling Forms

AbstractController is good for hiding Java Servlet specifics but they don’t free you from dealing with raw HTTP requests and responses. Spring MVC gives you AbstractFormController and SimpleFormController that can deal with form display, submission, and processing. SimpleFormController lets you configure various aspects through XML while the former doesn’t.

To understand form processing in Spring MVC, you will add a loan calculator to your web application. For this, you need:

  1. A page to be displayed where the user inputs the required parameters (form view)
  2. A JavaBean where the input parameters will be mapped (form object)
  3. An input validating entity for user mistakes (validator)
  4. A page to display the results for a successful execution with valid input (success view)

3.  SimpleFormController

It is better if you understand the workflow of the SimpleFormController. Here is the workflow adapted from Spring API documentation in relevance to this tutorial:

  1. Receive a GET request for the form input page
  2. Instantiate the form object, i.e. the binding object for parameter mapping
  3. The form view is sent to the browser for user input
  4. Use submits form (using a GET with parameters or a POST)
  5. Populate the form object based on the request parameters (applying necessary conversions from String to
    appropriate object type); in case of binding errors, they are reported through an Errors object
  6. If binding is ok and a validator is attached then it is called to validate the form object; in case of errors,
    they are reported through an Errors object
  7. If errors are present associated with the model then form view is resent to the browser
  8. If validation passes then a chain of onSubmit() methods is called (one of which should be overridden) that
    returns the success view by default

There are multiple submit processing methods of which one you must override depending on the task at hand. In general, override

  • ModelAndView onSubmit(HttpServletRequest, HttpServletResponse, Object, BindException) if you want complete
    control on what to return
  • ModelAndView onSubmit(Object, BindException) if you want custom submission handling but don’t need to work with
    request and response objects
  • ModelAndView onSubmit(Object) if you need nothing more than the input but may return a custom view
  • void doSubmitAction(Object) if you don’t need to determine the success or error view

Sunday, November 30, 2008

mysql privileges

How to grant privileges to mysql database.
1) log as root.
2) database name = vas_caht
    username = user
    password = password
    host = all host
mysql> grant all privileges on vas_chat.* to 'user'@'%' identified by 'password';

Thursday, November 20, 2008

New Web Note

Convert ^M to newline character in text files

If the ^M character is showing up in files while opening the file concerned, then follow these steps to convert it to a new line.
In vi use the following:


^M is ASCII 13 (Ctrl M), which is the carriage return.

Different operating systems use different symbols to set the end of a line/new line.
Unix uses newline (\n)
Mac uses carriage return (\r)
And Windows/DOS use both (\n\r)

To prevent the ^M from showing up in files, be sure to use the ASCII (text) mode when transfering text files.


Use this command : dos2unix <file name>

Wednesday, November 19, 2008

New Web Note

How to find the disk usage in linux.
For linux, df -h is better. It writes it in “easy” viewable for humans. :)

Tuesday, November 18, 2008

New Web Note

How queues are working..
Object a, b, c, d;
Queue q;

q.enter(a); //Object a enters the queue. q->a
q.enter(b); //Object b enters the queue. q->a->b
q.enter(c); //Object c enters the queue. q->a->b->c
Object x = q.exit(); //a exits the queue into x. q->b->c
q.enter(d); //Object d enters the queue q->b->c->d
Object y = q.exit(); //b exits the queue into y. q->c->d