Wednesday, July 28, 2010

Replace String pattern in "Vi"

1) Open the TEXT file using "vi" editor in linux.
2) Press ESC
3) Following command will replace "tab" character by "|".

    :%s/    /|/g

4) Save & quit file using following command.


Monday, July 19, 2010

Java property file usage

Use the below code to read the java property file and retrieve the property value.
      Properties properties = new Properties();
        FileInputStream in;
        try {
            in = new FileInputStream("");
        } catch (Exception e) {
        return properties.getProperty("appcode");

Sample "" file is shown below.


Tuesday, July 6, 2010

From date < To date validate using js

Use the below js code to validate date "From date < To date"

         var frmDate = document.getElementById("frmDate").value;
         var toDate = document.getElementById("toDate").value;

         if (frmDate < toDate) {
               alert("Invalid Date Range!\nStart Date cannot be after End Date!")
               return false;