And the serenity of winter …

… is complementing with my Reading, since I enjoys winter sometimes — especially the flowers.

The flowers are always blooming at this point of time of the year!
I am always enthralled by the fascinating colours that makes the flowers look so beautiful.

Reading and then looking at the creativity of the Great Creator, mesmerizes me and I often thinks how many varieties are still left to be created by Him, as all of these is just a drop of ocean as compared to the entire Universe (where I read somewhere it rains diamonds in Neptune and Uranus).

Just to describe in few words — ‘Unbearable Brightness Of Being!’

A Virus or a Car ?

Recently the most coveted brand for Motors — Tata Motors was in news, but not for Messi doing the Ad for the firm, rather having a car launched having the same name as one of the most dangerous virus ‘Zika’. It might be a coincidence but would rather be an interesting coincidence though.

After the World Health Organization (WHO) designated the Zika virus and its suspected complications in newborns as a public health emergency of international concern, the Union Health Ministry of India has sounded an alert for Zika and appointed the National Centre for Disease Control (NCDC) as the nodal agency for investigation of any outbreak of the viral infection in India.

 About the National Centre for Disease Control:

It is an institute under the Indian Directorate General of Health Services, Ministry of Health and Family Welfare.

It was established in July 1963 for research in epidemiology and control of communicable diseases.

It was previously known as National Institute of Communicable Diseases.

 Background:

Zika virus disease is an emerging viral disease transmitted through the bite of an infected Aedes mosquito. This is the same mosquito that is known to transmit infections like dengue and chikungunya.

World Health Organisation has reported 22 countries and territories in Americas from where local transmission of Zika virus has been reported.

Microcephaly in the newborn and other neurological syndromes (Guillain Barre Syndrome) have been found temporally associated with Zika virus infection.

Keep Calm and Stay Safe

Java Programming

Java – CSV File Reader

JJMP

One of the most common types of data file is a CSV (Comma Separated Value) file. They can be exported by many popular applications, notable spreadsheet programs like Excel and Numbers. They are easy to read into your Java programs once you know how.

Reading the file is as simple as reading a text file. The file has to be opened, a BufferedReader object is created to read the data in a line at a time.

Once a line of data has been read, we make sure that it’s not null, or empty. If it is, we’ve hit the end of the file and there’s no more data to read. If it isn’t, we then use the split() method that’s a member of Java’s String object. This will split a string into an array of Strings using a delimiter that we give it.

The delimiter for a CSV file is a comma, of course. Once we’ve split() the string, we have all the element in an Array from which our Java programs can use the data. For this example, I just use a for loop to print out the data, but I could just as well sort on the values of one of the cells, or whatever I need to do with it in my program.

Starting to Program :

  • Open the file with a BufferedReader object to read it a line at a time.
  • Check to see if we’ve got actual data to make sure we haven’t finished the file.
  • Split the line we read into an Array of String using String.split()

The Program

// CSVRead.java
//Reads a Comma Separated Value file and prints its contents.

import java.io.*;
import java.util.Arrays;

public class CSVRead{

 public static void main(String[] arg) throws Exception {

  BufferedReader CSVFile = 
        new BufferedReader(new FileReader("Example.csv"));

  String dataRow = CSVFile.readLine(); // 

  while (dataRow != 0){
   String[] dataArray = dataRow.split(",");
   for (String item:dataArray) { 
      System.out.print(item + "\t"); 
   }
   System.out.println(); // Print the data line.
   dataRow = CSVFile.readLine(); // Read next line of data.
  }
  // Close the file once all data has been read.
  CSVFile.close();

  System.out.println();

 } //main()
} // CSVRead

 

Writing to CSV Files with Java

Writing to a CSV file is as simple as writing a text file . In this case, we write a comma between each field, and a newline at the end of each record.

Give it a try, starting with TextSave.java, modify it appropriately, then see what your favorite spreadsheet program thinks of the results.

…… a Life of Shibumi

pretty,beautiful,meditative,scenic,serene,window,view-fe0b369851e8ae632abf9ce77a4b6c72_hThe weekends are here! I am writing after a long time. Days are flying and I ‘m not getting time to even think about anything other than coding (or programming). A wise advice to all my readers, please don’t do certification on any subject for fun if you are fresher, and if you do then have a deep knowledge about the subject (Just a thought of the day, don’t take it so seriously 😉  ). Anyways I didn’t knew that Hyderabad is so cold during winters. Winters always gives an opportunity to wear Mosi and Mummy’s hand knitted sweaters that I proud to have.

My sweater is quite beautiful with different cables (that looks quite tough to make), was hand woven by Mosi and Mummy. It is an art that is perhaps in every elderly women’s hand who experiences a motherhood in life after a particular point of time. Hand woven sweaters are more proudly wore than the ready-made one, because it is woven by somebody’s hand with love and hard work that is beyond the brain to calculate! You are Lucky if you have got one! Anyways, the relief of the sunshine can be experienced only in the winter season, else we always try not to be much in the sun. While I was returning to flat, after dinner, I saw few people singing Christmas carol on the road. This is the joy of winter. I hope Santa will bring something for me too during Christmas (have already prepared a wish list for Him). Though I have to post it to North Pole (I’ll post it once I find a post office here!). Weekends! The best way to spend time is, sitting near window, having coffee and Blogging.This is the holidays for me.images

I would request my readers to please visit http://www.enidblytonbio.co.uk . This site belongs to one of Blogosphere friend, Brian Carter. He has written a book on life of famous novelist ‘Enid Blyton’. His book is soon going to be released. Please visit his website once and do buy one copy of his book. Reading is a very good habit that must be developed right from childhood. It should be cultivated in children, through providing some interesting story books that not only encourages them but also teaches them the ethics and values. Enid Blyton’s books are best for young minds. All the best Brian, Best Wishes 😀

P.S.: The title of my post is inspired by a  Japanese word ‘Shibumi’, that I came across few years ago. Well if you want to know its meaning, then best way is to Find it….! 🙂

Cheers 🙂

Amrita