‘We are now more deeply involved on the ground’

 

Tata Trusts has, over the past few years, changed tack to augment and amplify the impact of its charity interventions. Ratan Tata, Chairman, Tata Trusts, speaks about the path Tata Trusts has taken and the objectives it is pursuing.

Source: ‘We are now more deeply involved on the ground’

Advertisements

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.