Sunday, December 30, 2012

Insertion Sort

/*nth element would require n comparison operations .That means total time consumed would be 1+2+3+4+.......+n which is a function of n*n
A great video on insertion sort is here
http://www.youtube.com/watch?v=c4BRHC7kTaQ
*/



/*Java Program for Insertion sort*/

import java.util.*;


public class InsertionSort {
public static void main (String args[])
{
/*Take the input into ArrayList using scanner*/
ArrayList InputArrayList = new ArrayList();
System.out.println("Give the input array, It will take the input until you press a non numeric key");
Scanner scan = new Scanner(System.in);
while(scan.hasNextInt())
{
InputArrayList.add(scan.nextInt());
}
System.out.println("ArrayList is " + InputArrayList);
/*Convert the ArrayList to IntegerArray */
int i, SIZE=InputArrayList.size();
int[] InputArrayInt= new int[SIZE];
int[] OutputArrayInt= new int[SIZE];
for(i=0;iInputArrayInt[i]=InputArrayList.get(i);
/*pass this array to insertsort function for sorting and collect it to OutputArrayInt*/
OutputArrayInt=insertsort(InputArrayInt);
/*Display the output array*/
System.out.println("The sorted array is ");
for(i=0;iSystem.out.println(OutputArrayInt[i]);
}
public static int[] insertsort(int[] IAInt)
{
int lenth= IAInt.length;
int i, j,temp;
for(i=1;i{
for(j=i-1;j>=0;j--)
{
if(IAInt[i]{
temp=IAInt[j];
IAInt[j]=IAInt[i];
IAInt[i]=temp;
i=j;/*This is an important step , now the if comparison would be from new position of i after swapping*/
}
}
}
return(IAInt);
}
}

Tuesday, December 11, 2012

Delivering a good presentation

Choose a good template before you start to write your presentation.

Good template is the one which is simple and classy .It should have the company's logo on the right corner.

First slide should be the one with the name of the presenter and the topic.
Second slide should have Goals of the presentation .This should be different from the next slide with the  list of the topic covered.
The third slide is  the list of topics covered . It can be named as agenda.

Presentation material should be simple and clear .It should have more number of diagrams than the text. This would make your presentation interesting as you would spent more time in explaining the diagrams.

Presentation material should follow a consistent format throughout the slides.You should have a summary slide at the end of presentation which should briefly explain what you have learned through this presentation.

You don't have to speak everything about the topic .Make an outline before delivering the presentation . Deliver your content along with the outline.
Let the audience ask questions after you have explained the topic.

Do not forget to say thanks to your audience after you finish delivering your presentation.

Thursday, December 6, 2012

UNIX cron

Every user can have its own list of cron jobs which can be viewed using 
crontab -l

In order to add or edit a cron job , you need to execute the following commands

export EDITOR=vi
crontab -e

Now , you can edit the file as you do while working on a vi editor .

For more tips on vi editor , you can follow the below link authored by me .
http://middlewareplay.appspot.com/kbhtml/Vi_editor.html

Note for new unix users , refrain from running the command crontab -r as this will remove your existing crontab file ( list of all cron jobs ) and there is no way of getting it back until you have the backup of crontab file  ,somewhere .

Below is the list of important  cron files

 /etc/cron.d main cron directory
/etc/cron.d/cron.allow list of allowed users
/etc/default/cron contains cron default settings
/etc/cron.d/cron.deny list of denied users
/var/cron/log accounting information
/var/spool/cron/crontabs spool area for crontab has crontab files for each user.

Organizational Security Notes

Security has a wider meaning to it .

Security for an organization does not only includes the security of customer's applications but it also includes the security of workstation used by organization employees.
Security for an organization can mean any of the following


Application security - Authentication and Authorization of the customers applications.



Network security - Implementing firewalls between communication end points , Seperating the different components of an architecture e.g. having webserver, application server , database on different machines , Implementing a proxy .



Password security- In case of personal user ids /passwords , passwords need to be strong , must not be shared with anyone else. In case of Shared Id usage , their passords must be stored at a location which can be accessed only by responsible people . The best solution in case of shared id usage would be implementing a solution like cyberark which would record every occurence when password would be read from the software and also there are mechanisms which would keep changing the password after a cycle of time.



Workstation security - Security is not the aspect that applies to applications but also to the workstation which employee is using to access the customer and organization applications. There should be antivirus , network threat protection installed on the workstation . It is responsibility of employees not to install the unauthorized softwares on the system.In case of workstation theft , there should be a provision that data on system is encrypted and it can not be viewed by someone else.



Information security - Any confidential information related to organization should not be published outside the organization without the organization permissions.