Monday, March 28, 2016

transaction

transaction

A TRANSACTION IS AN EVENT OR HAPPENING THAT CHANGES AN ORGANISATION "S FINANCIAL POSITION AND/OR ITS EARNING.

Sunday, March 6, 2016

form to insert data in database

<html>
  
   <head>
      <title>Add New Record in MySQL Database</title>
   </head>
  
   <body>
      <?php
         if(isset($_POST['add'])) {
            $dbhost = 'localhost';
            $dbuser = 'prakash';
            $dbpass = '123';
            $conn = mysql_connect($dbhost, $dbuser, $dbpass);
           
            if(! $conn ) {
               die('Could not connect: ' . mysql_error());
            }
           
            if(! get_magic_quotes_gpc() ) {
               $emp_name = addslashes ($_POST['emp_name']);
               $emp_address = addslashes ($_POST['emp_address']);
            }else {
               $emp_name = $_POST['emp_name'];
               $emp_address = $_POST['emp_address'];
            }
           
            $emp_salary = $_POST['emp_salary'];
           
            $sql = "INSERT INTO employee ". "(emp_name,emp_address, emp_salary,
               join_date) ". "VALUES('$emp_name','$emp_address',$emp_salary, NOW())";
              
            mysql_select_db('test_db');
            $retval = mysql_query( $sql, $conn );
           
            if(! $retval ) {
               die('Could not enter data: ' . mysql_error());
            }
           
            echo "Entered data successfully\n";
            
            mysql_close($conn);
         }else {
            ?>
           
               <form method = "post" action = "<?php $_PHP_SELF ?>">
                  <table width = "400" border = "0" cellspacing = "1"
                     cellpadding = "2">
                 
                     <tr>
                        <td width = "100">Employee Name</td>
                        <td><input name = "emp_name" type = "text"
                           id = "emp_name"></td>
                     </tr>
                 
                     <tr>
                        <td width = "100">Employee Address</td>
                        <td><input name = "emp_address" type = "text"
                           id = "emp_address"></td>
                     </tr>
                 
                     <tr>
                        <td width = "100">Employee Salary</td>
                        <td><input name = "emp_salary" type = "text"
                           id = "emp_salary"></td>
                     </tr>
                 
                     <tr>
                        <td width = "100"> </td>
                        <td> </td>
                     </tr>
                 
                     <tr>
                        <td width = "100"> </td>
                        <td>
                           <input name = "add" type = "submit" id = "add"
                              value = "Add Employee">
                        </td>
                     </tr>
                 
                  </table>
               </form>
           
            <?php
         }
      ?>
  
   </body>
</html>

 <html>
  
   <head>
      <title>Add New Record in MySQL Database</title>
   </head>
  
   <body>
      <?php
         if(isset($_POST['add'])) {
            $dbhost = 'localhost:3036';
            $dbuser = 'root';
            $dbpass = 'rootpassword';
            $conn = mysql_connect($dbhost, $dbuser, $dbpass);
           
            if(! $conn ) {
               die('Could not connect: ' . mysql_error());
            }
           
            if(! get_magic_quotes_gpc() ) {
               $emp_name = addslashes ($_POST['emp_name']);
               $emp_address = addslashes ($_POST['emp_address']);
            }else {
               $emp_name = $_POST['emp_name'];
               $emp_address = $_POST['emp_address'];
            }
           
            $emp_salary = $_POST['emp_salary'];
           
            $sql = "INSERT INTO employee ". "(emp_name,emp_address, emp_salary,
               join_date) ". "VALUES('$emp_name','$emp_address',$emp_salary, NOW())";
              
            mysql_select_db('test_db');
            $retval = mysql_query( $sql, $conn );
           
            if(! $retval ) {
               die('Could not enter data: ' . mysql_error());
            }
           
            echo "Entered data successfully\n";
            
            mysql_close($conn);
         }else {
            ?>
           
               <form method = "post" action = "<?php $_PHP_SELF ?>">
                  <table width = "400" border = "0" cellspacing = "1"
                     cellpadding = "2">
                 
                     <tr>
                        <td width = "100">Employee Name</td>
                        <td><input name = "emp_name" type = "text"
                           id = "emp_name"></td>
                     </tr>
                 
                     <tr>
                        <td width = "100">Employee Address</td>
                        <td><input name = "emp_address" type = "text"
                           id = "emp_address"></td>
                     </tr>
                 
                     <tr>
                        <td width = "100">Employee Salary</td>
                        <td><input name = "emp_salary" type = "text"
                           id = "emp_salary"></td>
                     </tr>
                 
                     <tr>
                        <td width = "100"> </td>
                        <td> </td>
                     </tr>
                 
                     <tr>
                        <td width = "100"> </td>
                        <td>
                           <input name = "add" type = "submit" id = "add"
                              value = "Add Employee">
                        </td>
                     </tr>
                 
                  </table>
               </form>
           
            <?php
         }
      ?>
  
   </body>
</html>

java

 java
  • Can we overload main method ?
  • Constructor returns a value but, what ?
  • Can we create a program without main method ?
  • What are the 6 ways to use this keyword ?
  • Why multiple inheritance is not supported in java ?
  • Why use aggregation ?
  • Can we override the static method ?
  • What is covariant return type ?
  • What are the three usage of super keyword?
  • Why use instance initializer block?
  • What is the usage of blank final variable ?
  • What is marker or tagged interface ?
  • What is runtime polymorphism or dynamic method dispatch ?
  • What is the difference between static and dynamic binding ?
  • How downcasting is possible in java ?
  • What is the purpose of private constructor?
  • What is object cloning ?

Friday, March 4, 2016

JAVA PROGRAM(ALPHABET PATTERN)

 JAVA  PROGRAM(ALPHABET PATTERN)
A
AB
ABC
ABCD


 /*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package javaapplication23;

/**
 *
 * @author Prakash
 */

public class JavaApplication23 {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
     
  for(int i=1;i<5;i++)
        {
            int a=65;                          //ASCII value of A
            for(int j=1;j<=i;j++)
              {
                System.out.print((char)a);
                a++;
              }
          System.out.println();
        }
    }   
}

2.   A
    ABA
   ABCBA
  ABCDCBA
 ABCDEDCBA
ABCDEFEDCBA
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package javaapplication23;

/**
 *
 * @author Prakash
 */
//enum week{
 //   sun,mon,tue,wed,thurs,fri,sat
//};
import java.util.*;  // import java util 
public class JavaApplication23 {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
       
  Scanner scr=new Scanner(System.in); // create scanner obj
int n;
System.out.println("Enter the number of rows. ");
n=scr.nextInt();  // accept a number


char c;
for(int i=1;i<=n;++i)        // FOR LOOP FOR NUMBER OF ROWS
{
c='A';
for(int j=i;j<n;++j)        // FOR LOOP FOR PRINTING SPACES
{
System.out.print(" ");
}
for(int k=1;k<=i;++k)      // FOR LOOP FOR PRINTING ALPHABETS IN DESCENDING ORDER  
{
System.out.print(c);
++c;
}
c-=2;
for(int l=1;l<i;++l)      // FOR LOOP FOR PRINTING ALPHABETS IN ASCENDING ORDER
{
System.out.print(c);
--c;
}
System.out.println();    // INTRODUCING NEW LINE

}

    }   

}


output
Enter the number of rows. 
6
     A
    ABA
   ABCBA
  ABCDCBA
 ABCDEDCBA
ABCDEFEDCBA



      A
    BAB
   CBABC
  DCBABCD
 EDCBABCDE
FEDCBABCDEF


/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package javaapplication23;

/**
 *
 * @author Prakash
 */
//enum week{
 //   sun,mon,tue,wed,thurs,fri,sat
//};
import java.util.*;  // import java util 
public class JavaApplication23 {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
       
  Scanner scr=new Scanner(System.in);
int n;
System.out.println("Enter the number of rows. ");
n=scr.nextInt();

char ch='A';
char c;
for(int i=1;i<=n;++i)        // FOR LOOP FOR NUMBER OF ROWS
{
c=ch;
for(int j=i;j<n;++j)        // FOR LOOP FOR PRINTING SPACES
{
System.out.print(" ");
}
for(int k=1;k<=i;++k)      // FOR LOOP FOR PRINTING ALPHABETS IN DESCENDING ORDER  
{
System.out.print(c);
--c;
}
c+=2;
for(int l=1;l<i;++l)      // FOR LOOP FOR PRINTING ALPHABETS IN ASCENDING ORDER
{
System.out.print(c);
++c;
}
System.out.println();    // INTRODUCING NEW LINE
++ch;                   //  INCREMENTING VALUE OF CH FOR NEXT ITERATION
}

} // end of main method
} // end of main class

/* OUTPUT

    }   
}


run:
Enter the number of rows. 
6
     A
    BAB
   CBABC
  DCBABCD
 EDCBABCDE
FEDCBABCDEF
BUILD SUCCESSFUL (total time: 4 seconds)


Tuesday, March 1, 2016

ANDROID

DOWNLOAD FILE AND USE APP

ANDROID FIRST APP

CREATE A ANDROID APP
ACCEPT NAME  AND PRINT HII + NAME

FRIST OPEN eclipse
 FILE TAB
OPEN NEW PROJECT AND SELECT ANDROID APPLICATION  PROJECT
THEN APPLICATION NAME
THEN NEXT
THEN NEXT ---------> You CHANGE ICON THEN BROWSERS IMAGE
THEN NEXT -----> AND FINISH
THEN OPEN
FOLDER RES --->
THEN OPEN LAYOUT FOLDER 
AND OPEN activty_main.xaml
and


and open values folder and select string.xaml file and 
code
<?xml version="1.0" encoding="utf-8"?>
<resources>

    <string name="app_name">greation</string>
    <string name="hello_world">Hello world!</string>
    <string name="menu_settings">Settings</string>
 <string name="accept">plz enter name</string>
<string name="show">show</string>
<string  name="a"> hello i am niit student</string>

</resources>

AND activity_main in code 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity" >

    <Button
        android:id="@+id/button1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        android:layout_marginLeft="98dp"
        android:layout_marginTop="112dp"
        android:onClick="showresult"
        android:text="@string/show" />

    <EditText
        android:id="@+id/accept"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/button1"
        android:layout_alignParentTop="true"
        android:layout_marginTop="26dp"
        android:ems="10" />

    <EditText
        android:id="@+id/result"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/button1"
        android:layout_centerVertical="true"
        android:ems="10" >

        <requestFocus />
    </EditText>

</RelativeLayout>



AND open src folder  and open Mainactivity.java


and code

package com.example.greation;

import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;

public class MainActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.activity_main, menu);
        return true;
    }
    public void showresult(View v)
    {
    EditText et = (EditText)findViewById(R.id.accept);
    String s = et.getText().toString();
    TextView obj = (TextView)findViewById(R.id.result);
    obj.setText("hello"+s);
   
    }
    

}

plz Download FOLDER
download app

ANDROID

Hii friend,
.                I'm start  Android  Tutorial Today . ANY Query in ANDROID PLZ CONTACT ME .