Wednesday, 31 December 2014

SUICIDE IS INHERITABLE

A  study says that children whose parents attempted suicide are 5 times more likely to attempt suicide than another children which means suicide is also inherited.
 “In this high-risk longitudinal study, we found that parental suicide attempt conveyed a nearly 5-fold increased risk of offspring attempt, even controlling for the familial transmission of mood disorder,” explains lead study author David A Brent MD, of the University of Pittsburgh Medical Centre.
But the study not only confirmed suicidal behaviour can in fact run in families, but that these pathways for suicidal behaviour can be transmitted through families, almost pathologically.
Impulsive aggression played an important role in increasing the likelihood of an offspring suicide attempt, but it did so by increasing the risk of the subsequent development of a mood disorder, which in turn increased the risk of an attempt.

In this study, the researchers looked at 701 children (between the ages of 10 and 50) of 334 parents who had documented mood disorders. 191 of these parents had attempted suicide, and 44 percent of the offspring had followed suit before the study; 29 percent attempted suicide after during the study follow-up.

Tuesday, 30 December 2014

Write a C++ program to check whether a number is even or odd


#include
using namespace std;
int main()
{
int a;
cout<<"enter no";
cin>>a;
if(a%2==0)
{
cout<<"no is even"< }
else
{ cout<<"no is odd"< }
}

Write a C++ to find greatest of three numbers.


#include<iostream>
using namespace std;
int sum(int x,int y,int z)
{
if(x>y)
{ if(y>z)
{
return x;
}}
if(y>z)
{
return y;
}

else{ return z;
}
}
int main()
{ int a=0,b=0,c=0;
cout<<"enter first no";
cin>>a;
cout<<"enter second no";
cin>>b;
cout<<"enter third no";
cin>>c;
int d= sum(a,b,c);
cout<<"greatest is "< }

Sunday, 28 December 2014

Write a c++ program to find Simple Interest and Compound Interest.



#include<cmath>
#include<iostream>
using namespace std;
double simple(int p,float r,int t)
{
return (p*r*t)/100;
}
double amount(int p,float x,int y,float z)
{ x= 1+z/100;
return p*pow(x,y);
}
double compound(int c,int d) {
return c-d;
}
int main()
{ int p=0,t=0;
float r;
double s = simple(200,1.2,2);
double d = amount(200,1.2,2,2.4);
double ci = compound(d,p);
}


Things to learn :

include<cmath> is used in place of include<math.h>
include<cmath>h is used in gcc compiler (in linux)

pow() is an inbuilt function in c++ with syntax :
double pow (double base, double exponent);

Write a c++ program to find the sum of two numbers using function.


#include<iostream>
using namespace std;
int sum(int a,int b)
{ return a+b;
}
int main()
{
int a=0,b=0;
cout<<"enter 1st no";
cin>>a;
cout<<"enter 2nd no";
cin>>b;
int c = sum(a,b);
}

Things to learn from this program :

Defining a Function:

function definition :

return_type function_name( parameter list )
{
body of the function
}

Declaring a Function:

return_type function_name(parameter list);

Calling a function :

function_name( [arg1, ... ] );

Function is to be defined outside main() function.
a and b are to be initialized to zero so that all previous values are deleted.


Another way of doing the program (if you want to do sum of known values):



#include<iostream>
using namespace std;
int sum(int a,int b){
return a+b;
}
int main()
{
int c= sum(10,20);
}

Friday, 3 October 2014

Cloud Computing !!





Have you ever thought how we take advantage of Google Drive and Gmail or how we are using Facebook.How is our data stored on Google ?






The force behind this is CLOUD COMPUTING
Cloud Computing is all about different computers interlinked to data-processing tasks, centralized data storage, sharing of resources and data and also online access to computer services or resources.
In cloud computing one does not need to buy the required resources, you only need to use a shared cloud infrastructure and pay for it.
Internet is also a type of cloud computing.

n a cloud computing system, there's a significant workload shift. Local computers no longer have to do all the heavy lifting when it comes to running applications. The network of computers that make up the cloud handles them instead. Hardware and software demands on the user's side decrease. The only thing the user's computer needs to be able to run is the cloud computing system's interface software, which can be as simple as a Web browser, and the cloud's network takes care of the rest.

Service Models in Cloud Computing :


1. SaaS: In the business model using software as a service (SaaS), users are provided access to application software and databases. Cloud providers manage the infrastructure and platforms that run the applications. SaaS is sometimes referred to as "on-demand software" and is usually priced on a pay-per-use basis.Software-as-a-Service provides complete applications to a cloud’s end user.
2. Platform as a service (PaaS) : In the PaaS models, cloud providers deliver a computing platform, typically including operating system, programming language execution environment, database, and web server. Application developers can develop and run their software solutions on a cloud platform without the cost and complexity of buying and managing the underlying hardware and software layers. With some PaaS offers like Microsoft Azure and Google App Engine, the underlying computer and storage resources scale automatically to match application demand so that the cloud user does not have to allocate resources manually.
3. Infrastructure as a service (IaaS) : The services on the infrastructure layer are used to access essential IT resources that are combined under the heading Infrastructure-as-a-Service (IaaS). These essential IT resources include services linked to computing resources, data storage resources, and the communications channel. They enable existing applications to be provisioned on cloud resources and new services implemented on the higher layers.
4. Data as a service : comprises data delivered as a service rather than being stored locally. The data may be consumed by tradional on-premises software, smart clients, websites or SaaS solutions.Typically the data is prepared and formatted ready for use by the client software.


Deployment models :

Public Cloud
 The deployment of a public cloud computing system is characterized on the one hand by the public availability of the cloud service offering and on the other hand by the public network that is used to communicate with the cloud service. The cloud services and cloud resources are procured from very large resource pools that are shared by all end users.

Private Cloud
Private cloud computing systems emulate public cloud service offerings within an organization’s boundaries to make services accessible for one designated organization. Private cloud computing systems make use of virtualization solutions and focus on consolidating distributed IT services often within data centers belonging to the company.

Hybrid Cloud
A hybrid cloud service deployment model implements the required processes by combining the cloud services of different cloud computing systems, e.g. private and public cloud services. The hybrid model is also suitable for enterprises in which the transition to full outsourcing has already been completed, for instance, to combine community cloud services with public cloud services.

Sunday, 27 July 2014

if adt doesn't start??? ADT error !!! Solve it now :)

what to do if your adt bundle suddenly stops working? it happened with me... when i started the adt eclipse, it just appeared for a flash of time and the adt startup screen disappeared.. so i have a solution for this...
if this happens with you all you have to do is

  1. go to the folder where you have saved all the adt files
  2. then delete the metadata  folder
  3. reopen the eclipse
  4. it will work as it was working previously
  5. if you are facing some other problem you can comment below... we will solve your problem 

Monday, 21 July 2014

program to play music in JFrame

import java.io.*;
import java.net.URL;
import javax.sound.sampled.*;
import javax.swing.*;
 
// To play sound using Clip, the process need to be alive.
// Hence, we use a Swing application.
public class sounds extends JFrame {
 
   // Constructor
   public sounds() {
      this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      this.setTitle("Test Sound Clip");
      this.setSize(300, 200);
      this.setVisible(true);
   
      try {
   
         // Open an audio input stream.
         URL url = this.getClass().getClassLoader().getResource("mus.wav");
         //
          AudioInputStream audioIn = AudioSystem.getAudioInputStream(url);
         // Get a sound clip resource.
          for(int i=0; i<10; i++){   Clip clip = AudioSystem.getClip();
         // Open audio clip and load samples from the audio input stream.
         clip.open(audioIn);
         clip.start();}
      } catch (UnsupportedAudioFileException e) {
     JOptionPane.showMessageDialog(this, e.getMessage());
         e.printStackTrace();
      } catch (IOException e) { JOptionPane.showMessageDialog(this, e.getMessage());
         e.printStackTrace();
      } catch (LineUnavailableException e) { JOptionPane.showMessageDialog(this, e.getMessage());
         e.printStackTrace();
      }
   }
 
   public static void main(String[] args) {
      new sounds();
   }
}

Wednesday, 16 July 2014

Program to play and stop music on your choice in java applet

import java.applet.*;
import java.awt.*;
import java.awt.event.*;

public class mus3 extends Applet
implements ActionListener{
   Button play,stop;
   AudioClip audioClip;
   public void init(){
      play = new Button("  Play ");
      add(play);
      play.addActionListener(this);
      stop = new Button("  Stop  ");
      add(stop);
      stop.addActionListener(this);
      audioClip = getAudioClip(getCodeBase(), "mus.wav");
   }
   public void actionPerformed(ActionEvent ae){
      Button source = (Button)ae.getSource();
      if (source.getLabel() == "  Play  "){
         audioClip.play();
      }
      else if(source.getLabel() == "  Stop  "){
         audioClip.stop();
      }
   }
}

Tuesday, 15 July 2014

Program to play music in java Applet

import java.applet.*;
import java.awt.*;

public class music1 extends Applet {
   Button play,stop;
   AudioClip audioClip;
   public void init(){
   
      audioClip = getAudioClip(getCodeBase(), "mus.wav");
      audioClip.play();
   }
 
}