Thursday, 25 June 2015

Android projects


Android Projects:

1.ANDROID based CLOUD COMPUTING:

  •  Privacy-Preserving Optimal Meeting Location Determination on Mobile Devices (IEEE 2014).
  • Cloud based java compiler-CBJC (IEEE 2014).
  •  StreamMe: Me‐centric multimedia streaming system with clouds using smartphone (IEEE 2014).


2. ANDROID based Data Mining:


  • A Location-Privacy Threat Stemming from the Use of Shared Public IP Addresses (IEEE 2014).
  •  QR-code Based Information Access System in shopping mall (IEEE 2014).
3. ANDROID based SURVEILLANCE :

  • GPS based human motion monitoring system using android smartphone (IEEE 2014).
  • Android interface based GCM home security system (IEEE 2014).
  • Anti-theft application for android constructs devices
4. ANDROID based WEB MINING :

  • A Personal Mobile Commerce Pattern Mining and Prediction using Android smartphone(IEEE 2014).
  •  Join with you-Social Networking on android smartphone (IEEE 2014).
5. ANDROID based REAL TIME APPLICATION SYSTEMS :

  • Quick-witted CAR PARKING guidance and destruction alert (IEEE 2014).
  • The Application of considerate screen using android smartphone (IEEE 2014).
6. ANDROID based WEB SERVICES

  • Toward Preserving Privacy and Functionality in Geosocial Networks (IEEE 2014).
  •  Using Android smartphone find the companion location (IEEE 2014).

Wednesday, 24 June 2015

Programming with servlets

For running the servlet program using command prompt, you will need JDK and JSDK

Download JSDK2.0 or JSDK2.1

Download JDK 1.6 or higher versions

Simple program using servlets:

import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class Myfirstservlet extends HttpServlet
{
           public void doGet(HttpServletRequest req, HttpServerletResponse res) throws ServletException, IOException
            {
                  PrintWriter out;
                  String str="Server Side Programming";
                  res.setContentType("text/html");
                  out=res.getWriter();
                  out.println("<HTML><HEAD><TITLE>");
                  out.println(str);
                  out.println("</TITLE></HEAD><BODY>");
                  out.println("<H1>"+str+"</H1>");
                  out.close();
              }
}

Running the above servlet program through Command prompt :

Step 1: Type the above the servlet program in notepad or anyother text editors, and save as filename.java. Here filename should be same as that of your class name.
Step 2: Open the command prompt and set the path to the location where java resides in your computer. For running servlet programs, you will need jdk1.6 or higher versions .
Step 3: Set classpath as  C:\jsdk2.0\src or c:\jsdk2.0\lib\jsdk.jar; check and verify the classpath according to your version and location.
Step 4: Compile the program javac Filename.java
Step 5: Go to the location c:\jsdk2.0\bin and type servletrunner -d yourdirectory Ex: c:\jsdk2.0\bin and press enter then type servletrunner -d d:\yourname
Step 6: Open your file and see the result in browser.


Serverside Programming

We can make static webpages with just HTML.But if you want your website to be professional or you want to make some dynamic web page, then you need to learn serverside programming.


Java servlets:
                           Java servlets are one technology to produce dynamic response. Servlet is a class instantiated by server to produce a dynamic response.

Servlet Life cycle:

init():
                 This method is called when the servlet is instantiated.It must be returned before any other methods are called.
Service():
                 This is a method that is directly called by server when an HTTP request is received, default service method calls doGet() or (related methods).
Destroy();
                  This method is called when the server shuts down.

Introduction to JAVASCRIPT

Javascript:

Javascript is one of the scripting languages that can be used along with HTML for validating the inputs of the user.It is used to program the behaviour of the web pages.It can change the html attributes.It can be used to validate inputs.It can even change the HTML stylesheets.

Data types supported by Javascript:
                 
                      Javascript allows you to work with  three built-in datatypes.The data types supported by javascript are:

  1. Numbers
  2. String
  3. Boolean
Defining functions in Javascript :

Syntax:

function name_of_the_function()
{
}

Printing statement in javascript:

                     We can print some statements in javascript using the write function along with the keyword document as document.write("WELCOME");

Popup boxes in javascript:
         
                      We can import dynamism to our sites by adding some elements such as Messageboxes at runtime. For instance, in a Registration form if the user skips the phone number means we can alert the  user by adding the messagebox at runtime. There are two ways to insert the pop up boxes in the webpage.They are:
  • By using alert keyword
  • By using Prompt keyword
Sample program using javascript:

<html>
<head>
<script type="text/javascript" >
function welcome()
{
     alert("Welcome to our webpage");
     document.write("my web page");
}
</head>
<body onload=welcome() >
</body>
</html>

Form tag in HTML

Form tag:

             Using form tag, we can get input values from the user by allowing them to submit the form. Form tag may optionally contain the following elements.
             

  • <input>
  • <select>
  • <option>
  • <optgroup>
  • <textarea>
  • <button>
  • <fieldset>
  • <label>
Simple registration form using form element without validation:

<html>
<head>
<title>The Student Registration Form</title>
</head>
<body bgcolor=aqua>
<center><h3>Registration Form</h3></center>
<form name=my_form onsubmit=validate()>
<strong>Name:&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp
</strong>
<input type=text name=name><br/>
<br>
<br>
<strong>Age:&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp</strong>
<input type=text name=Age_txt><br/>
<br>
<br>
<strong>Phone No:&nbsp</strong>
<input type=text name=ph_txt><br/>
<br>
<Br>
<strong>Gender:&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp </strong>
<input type="radio" name="group1" value="Male">Male&nbsp&nbsp&nbsp&nbsp
<input type="radio" name="group1" value="Female">Female<br/><br/><br/>
<strong>Hobby: </strong>
&nbsp&nbsp
<input type="checkbox" name ="option1" value="Singing">Singing<br/>
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp
<input type="checkbox" name ="option1" value="Reading">Reading<br/>
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp
<input type="checkbox" name ="option1" value="T.V.">Watching T.V<br/>
<br/><br/>
<strong>Country:</strong>
<select name="My_Menu">
<option value="India">India</option>
<option value="China">China</option>
<option value="Shrilanka">Shrilanka</option>
</select>
<center>
<input type=submit value=Submit></br>
</center>
</body>
</html>


Sample output:



Tuesday, 23 June 2015

Methods in JAVA

Methods:
       
 Functions in C++ are called as methods in JAVA.Methods  do have some specifications.There are three parts of methods.They are

  • Method declaration
  • Method definition
  • Method calling/Invoking
Method declaration is not possible.Programmer can directly define and call their method.There are some built-in methods available as in other programming languages.

Sample JAVA program using methods:

Class Myclass
{
          public void hello()
          {
                 System.out.println("First program with a method");
          }
}
Class Mainclass
{
          public static void main(String[] args)
          {
                Myclass c=new Myclass();
                c.hello();     
          }
}

In this program,there are two classes.when you save your program you should save with name of class in which the main function is residing.

Static Functions:
            It is possible to create a static functions in JAVA.Static functions are those functios  which can be called without using objects.

Example of a static functions:

Class Myclass
{
          public void hello()
          {
                 System.out.println("First program with a  static method");
          }
          public static void main(String[] args)
          {
                hello();     
          }
}

Simple mini projects in C++

1.Student reportcard system in C++:

Source code:

#include<iostream.h>
#include<conio.h>
#include<stdio.h>
#include<process.h>
#include<fstream.h>
#include<iomanip.h>
// CLASS USED IN PROJECT
class student
{
int rno;
char name[50],dept[10];
char s1[50],s2[50],s3[50],s4[50],s5[50],s6[50];
float per;
char grade;
int s1_marks,s2_marks,s3_marks,s4_marks,s5_marks,s6_marks;
void calculate()
{
per=(s1_marks+s2_marks+s3_marks+s4_marks+s5_marks+s6_marks)/6.0;
if(per>=91 && per<=100)
grade='S';
else if(per>=81 && per<=90)
grade='A';
else if(per>=71 && per<=80)
grade='B';
else if(per>=61 && per<=70)
grade='C';
else if(per>=55 && per<=60)
grade='D';
else if(per>=50 && per<=54)
grade='E';
else
grade='U';
}
public:
void getdata()
{
cout<<"\n Enter your Department";
cin>>dept;
cout<<"\nEnter The roll number of student ";
cin>>rno;
cout<<"\n\nEnter The Name of student ";
gets(name);
cout<<"\n enter your subjects one by one";
cin>>s1;
cout<<"\n";
cin>>s2;
cout<<"\n";
cin>>s3;
cout<<"\n";
cin>>s4;
cout<<"\n";
cin>>s5;
cout<<"\n";
cin>>s6;
cout<<"\n";
cout<<"Enter your marks in "<<s1;
cin>>s1_marks;
cout<<"Enter your marks in "<<s2;
cin>>s2_marks;
cout<<"Enter your marks in "<<s3;
cin>>s3_marks;
cout<<"Enter your marks in "<<s4;
cin>>s4_marks;
cout<<"Enter your marks in "<<s5;
cin>>s5_marks;
cout<<"Enter your marks in "<<s6;
cin>>s6_marks;
calculate();
}
void showdata()
{
cout<<"\nRoll number of student : "<<rno;
cout<<"\nName of student :"<<name;
cout<<"\nMarks in "<<s1<<"     "<<s1_marks;
cout<<"\nMarks in "<<s2<<"     "<<s2_marks;
cout<<"\nMarks in "<<s3<<"     "<<s3_marks;
cout<<"\nMarks in "<<s4<<"     "<<s4_marks;
cout<<"\nMarks in "<<s5<<"     "<<s5_marks;
cout<<"\nMarks in "<<s6<<"     "<<s6_marks;
cout<<"\nPercentage of student is :\t"<<setprecision(2)<<per;
cout<<"\nGrade of student is :  "<<grade;
}
void show_tabular()
{
cout<<rno<<"\t  "<<name<<"\t   "<<s1_marks<<" \t  "<<s2_marks<<"\t"
<<s3_marks<<"    "<<s4_marks<<"    "<<s5_marks<<"     "<<s6_marks<<"    "<<setprecision(1)<<per<<"          "<<grade<<endl;

}
int retrno()
{ return rno; }
}; //class ends herE
fstream fp;
student st;

// function to write in file

void write_student()
{
fp.open("student.dat",ios::out|ios::app);
st.getdata();
fp.write((char*)&st,sizeof(student));
fp.close();
cout<<"\n\nstudent record Has Been Created ";
getch();
}
// function to read all records from file
void display_all()
{
clrscr();
cout<<"\n\n\n\t\tDISPLAY ALL RECORD !!!\n\n";
fp.open("student.dat",ios::in);
while(fp.read((char*)&st,sizeof(student)))
{
st.showdata();
cout<<"\n\n====================================\n";
getch();
}
fp.close();
getch();
}

// function to read specific record from file
void display_sp(int n)
{
int flag=0;
fp.open("student.dat",ios::in);
while(fp.read((char*)&st,sizeof(student)))
{
if(st.retrno()==n)
{
clrscr();
st.showdata();
flag=1;
}
}
fp.close();
if(flag==0)
cout<<"\n\nrecord not exist";
getch();
}
// function to modify record of file
void modify_student()
{
int no,found=0;
clrscr();
cout<<"\n\n\tTo Modify ";
cout<<"\n\n\tPlease Enter the roll number of student";
cin>>no;
fp.open("student.dat",ios::in|ios::out);
while(fp.read((char*)&st,sizeof(student)) && found==0)
{
if(st.retrno()==no)
{
st.showdata();
cout<<"\nPlease Enter The New Details of student"<<endl;
st.getdata();
int pos=-1*sizeof(st);
fp.seekp(pos,ios::cur);
fp.write((char*)&st,sizeof(student));
cout<<"\n\n\t Record Updated";
found=1;
}
}
fp.close();
if(found==0)
cout<<"\n\n Record Not Found ";
getch();
}
// function to delete record of file
void delete_student()
{
int no;
clrscr();
cout<<"\n\n\n\tDelete Record";
cout<<"\n\nPlease Enter The roll number of student You Want To Delete";
cin>>no;
fp.open("student.dat",ios::in|ios::out);
fstream fp2;
fp2.open("Temp.dat",ios::out);
fp.seekg(0,ios::beg);
while(fp.read((char*)&st,sizeof(student)))
{
if(st.retrno()!=no)
{
fp2.write((char*)&st,sizeof(student));
}
}
fp2.close();
fp.close();
remove("student.dat");
rename("Temp.dat","student.dat");
cout<<"\n\n\tRecord Deleted ..";
getch();
}
// function to display all students grade report
void class_result()
{
clrscr();
fp.open("student.dat",ios::in);
if(!fp)
{
cout<<"ERROR!!! FILE COULD NOT BE OPEN\n\n\n Go To Entry Menu to create File";
cout<<"\n\n\n Program is closing ";
getch();
exit(0);
}
cout<<"\n\n\t\t\t\tALL STUDENTS RESULT \n\n";
cout<<"===========================================================================\n";
cout<<"Roll No.  Name     S1     S2    S3    S4    S5     S6    %            Grade\n";
cout<<"===========================================================================\n";
while(fp.read((char*)&st,sizeof(student)))
{
st.show_tabular();
}
fp.close();
getch();
}
// function to display result menu
void result()
{
int ans,rno;
char ch;
clrscr();
cout<<"\n\n\nRESULT MENU";
cout<<"\n\n\n1. Class Result\n\n2. Student Report Card\n\n3. Back to Main Menu";
cout<<"\n\n\nEnter Choice (1/2)? ";
cin>>ans;
switch(ans)
{
case 1 : class_result();break;
case 2 : {
do{
clrscr();
char ans;
cout<<"\n\nEnter Roll Number Of Student : ";
cin>>rno;
display_sp(rno);
cout<<"\n\nDo you want to See More Result (y/n)?";
cin>>ans;
}while(ans=='y'||ans=='Y');
break;
}
case 3: break;
default: cout<<"\a";
}
}
// INTRODUCTION FUNCTION
void intro()
{
clrscr();
cout<<"\n\n\n\n\n\n\n\n\n";
cout<<"\t\t\tSTUDENT";
cout<<"\tREPORT CARD";
cout<<" PROJECT ";
cout<<"\n\n";
cout<<"\t\t\t\tDEVELOPED  BY\n";
cout<<"\n";
cout<<"\t\t\tYour Name";
getch();
}
// ENTRY / EDIT MENU FUNCTION
void entry_menu()
{
clrscr();
char ch2;
cout<<"\n\n\n\tENTRY MENU";
cout<<"\n\n\t1.CREATE STUDENT RECORD";
cout<<"\n\n\t2.DISPLAY ALL STUDENTS RECORDS";
cout<<"\n\n\t3.SEARCH STUDENT RECORD ";
cout<<"\n\n\t4.MODIFY STUDENT RECORD";
cout<<"\n\n\t5.DELETE STUDENT RECORD";
cout<<"\n\n\t6.BACK TO MAIN MENU";
cout<<"\n\n\tPlease Enter Your Choice (1-6) ";
ch2=getch();
switch(ch2)
{
case '1': clrscr();
write_student();
break;
case '2': display_all();break;
case '3':
int num;
clrscr();
cout<<"\n\n\tPlease Enter The roll number ";
cin>>num;
display_sp(num);
break;
case '4': modify_student();break;
case '5': delete_student();break;
case '6': break;
default:cout<<"\a";entry_menu();
}
}
// THE MAIN FUNCTION OF PROGRAM
void main()
{
char ch;
clrscr();
intro();
do
{
clrscr();
cout<<"\n\n\n\tMAIN MENU";
cout<<"\n\n\t01. RESULT MENU";
cout<<"\n\n\t02. ENTRY/EDIT MENU";
cout<<"\n\n\t03. EXIT";
cout<<"\n\n\tPlease Select Your Option (1-3) ";
ch=getch();
switch(ch)
{
case '1':
clrscr();
result();
break;
case '2': entry_menu();
break;
case '3':exit(0);
default :cout<<"\a";
}
}while(ch!='3');
}