Monday, 23 November 2015

Friday, 13 November 2015

Carousel Plugin not Working

<!DOCTYPE html>
<html>
<head>
<title></title>
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
  <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
  <style type="text/css">
  .item
  {
  background-color: blue;
  }
  </style>
</head>
<body>

<div id="myCarousel" class="carousel slide" data-ride="carousel">
    <!-- Indicators -->
    <ol class="carousel-indicators">
      <li data-target="#myCarousel" data-slide-to="0" class="active"></li>
      <li data-target="#myCarousel" data-slide-to="1"></li>
      <li data-target="#myCarousel" data-slide-to="2"></li>
      <li data-target="#myCarousel" data-slide-to="3"></li>
    </ol>

    <!-- Wrapper for slides -->
    <div class="carousel-inner" role="listbox">
      <div class="item active">
        <center><h1>First</h1></center>
      </div>

      <div class="item">
        <center><h1>Second</h1></center>
      </div>

      <div class="item">
         <center><h1>Third</h1></center>
      </div>

      <div class="item">
        <center><h1>Fourth</h1></center>
      </div>
    </div>

    <!-- Left and right controls -->
    <a class="left carousel-control" href="#myCarousel" role="button" data-slide="prev">
      <span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
      <span class="sr-only">Previous</span>
    </a>
    <a class="right carousel-control" href="#myCarousel" role="button" data-slide="next">
      <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
      <span class="sr-only">Next</span>
    </a>
  </div>

<script src="js/jquery.min.js"></script>
</body>
</html>

Wednesday, 4 November 2015

Java - What throws an IOException

Assume the scenarios as below:
  1. You were reading network file and got disconnected.
  2. Reading local file which is not available any more.
  3. Using some stream to read the data and some other process closes the stream.
  4. You are trying to read/write a file and don't have permission
  5. You were writing a file and disk space is not available anymore
All these scenarios result into IOException

Tuesday, 3 November 2015

How to round double / float value to 2 decimal points in Java

package xyz.jayakumar.test1;

import java.text.DecimalFormat;

public class RoundOf {

public static void main(String[] args)
{
double kilobytes = 1205.6358;

System.out.println("kilobytes : " + kilobytes);

double newKB = Math.round(kilobytes*100.0)/100.0;
System.out.println("kilobytes (Math.round) : " + newKB);

DecimalFormat df = new DecimalFormat("###.##");
System.out.println("kilobytes (DecimalFormat) : " + df.format(kilobytes));
}

}

Git merge branch to another branch

$ git checkout develop $ git pull $ git checkout test-branch $ git merge develop $ git push