Sunday 28 June 2015

How to calculate difference of date and time in Java


To calculate date and time difference with manual calculation...

  • Very first step to convert date into milliseconds (ms)
    • String date1 = "01-02-2015 09:15:20";
    • SimpleDateFormat format = new  SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
      • HH convert into 24 hours format (0-23)
      • hh convert into 12 hours format
    •  Date d1 = format.parse(date1);
    • long ms = d1.getTime();


Thursday 25 June 2015

Angular JS Directice in IE8


  • The most powerful feature Directive in Angular JS. 
  • Allow you to create custom reusable components. 
  • Few exception are there...keep in mind..!!!
  • With IE8 Angular Js should work consistent like other browser.
  • Four ways to create directive
    1. Angular JS viz. Attribute  (Common One)
    2. Element (Common One)
    3. Class
    4. Comment
  •  Let take one example :
    • Your directive is like : <div my-js-control>....</div>
    • Now use this directive in IE8
    • Copy following syntax and paste it in your HTML/JSP page.
<Html>
    <head>

   <!--[if lte IE 8]>
      <script>
        document.createElement('div-my-js-control');
      </script>
    <![endif]-->

   </head>
</html>


  • This document.createElement() creates an element called 'my-js-control' which can use in application.
  • If you create more than one directive in your system then you need to create that many new elements for older browser
  • Long story short : It is preferable to use Angular JS directive in IE8 as attributes.