SSH calling SHORTCUT

The general way to create a secure shell connection with a remote machine is :-

(Example)
ssh -i key_file_path username@server_name_etc.amzonaws.com


Now, it gets a little cumbersome to do this every-time you sit and try to connect to the remote machine.

The simple way to do this:-

the very first time that you execute the ssh command, a folder named ".ssh" is created in the default directory. If it is not there, try and search it in parent directories.

So, let us assume you get to this .ssh directory. Now, you are supposed to create a file named "config" and put entries similar  to the one I am going to mention below:-

Host awsHost1
HostName bla-bla-bla-compute.amazonaws.com
User ubuntu

IdentityFile "~/myKeyFile.pem"


.
After doing this, all you need to execute to get the ssh connection is 
$ ssh awsHost1

Also, doing th escp stuf also becomes a lot easier !!
It goes something like this.


# -- Execute on local computer
# Copy hello.txt from local computer to remote home directory
$ scp hello.txt awshost1:~/

# Copy hello.txt from local to remote home directory, renaming it foo.txt

$ scp hello.txt awshost1:~/foo.txt





This way, the typing effort gets a lot reduced and this is the ideal and standard way most of the professionals do it.


Using Apache POI (HSSF) API to create and write an Excel File

import java.io.*;

import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.CreationHelper;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;

public class ExcelHandler
{


public ExcelHandler()
{

try {
Workbook wb = new HSSFWorkbook();
CreationHelper createHelper = wb.getCreationHelper();
   FileOutputStream fileOut = new FileOutputStream("D:\\Deepu\\Amul\\workbook.xls");  
   Sheet sheet = wb.createSheet("Data");
 
   Row row = sheet.createRow((short)0);
   // Create a cell and put a value in it.
   Cell cell = row.createCell(0);
   cell.setCellValue("Here We Go !!!");

   // Or do it on one line.
//    row.createCell(1).setCellValue(1.2);
//    row.createCell(2).setCellValue(
//         createHelper.createRichTextString("This is a string"));
//    row.createCell(3).setCellValue(true);

   // Write the output to a file
 
   wb.write(fileOut);
   fileOut.close();
 
 
} catch (Exception e) {
   e.printStackTrace();
}


}



}