Search the Blog

Showing posts with label pattern. Show all posts
Showing posts with label pattern. Show all posts

Monday, June 22, 2020

The INSERT statement conflicted with the FOREIGN KEY constraint Error Type - 547

We are going to resolve the following error-The INSERT statement conflicted with the FOREIGN KEY constraint


Error Description for The INSERT statement conflicted with the FOREIGN KEY constraint


Msg 547, Level 16, State 0, Procedure spMVC_Dizsweb_QAScore_InsertUpdate, Line 103 [Batch Start Line 0]
The INSERT statement conflicted with the FOREIGN KEY constraint "FK_DizswebQAScoreCardAnswer_DizswebQAScoreCardSubCategoryID".
The conflict occurred in database "Dizsweb_Test",
                                        table "dbo.DizswebQAScoreCardSubCategory",
                                        column 'DizswebQAScoreCardSubCategoryID'.

To resolve this issue Please follow the following steps

STEP 1:-

    Check the Foreign Key Constraints with the Help of  following Query

    sp_help  Object_name

Step 2:-

   Try to get the default value in foreign key
   Case1- May be it will NULL and you are passing other than NULL
   Case2- May be default is 0 are passing NULL
   Case3- Value passing may be not exists in the table
   Case4- Id removed from the table


Step 3-

  Change the default value to the value which u r  passing.


Wednesday, October 9, 2019

Indexes in Python

Indexing is a standard feature of most programming languages. Java, Python, C#, C++, and C all have syntax like E[i] whereby an item with index i can be reference in E (which might be a character string, an array of numbers etc). 
Python Indexes


Python goes further beyond, it is possible to refer to chunks  of a sequence instead of indexing items one at a time. This feature in python is called slicing a sequence. Other techniques, like split and join, make it easy to take apart strings and assemble lists of strings into a new strings . In the same way that hand tools allow people to cut, shape, reshape, and put together wood into furniture, slicing, split, and join operations form the “carpentry” of Python’s text processing tasks. Even more powerful methods, notabe regular expressions, could be likened to the power tools of text and string processing. This post only covers the basic techniques, leaving regular expressions and other more advance libraries of software as later topics to explore. Working with slices particularly in Python’s syntax for slices, takes some getting used to. With regular practice, it becomes easy to write expressions that take apart sequences in creative ways and use operators to assemble slices into a new sequences. For strings slicing is only the beginning. String methods provide ways to search, replace, trim and form new strings from sequences of strings.

Following three methods are used to get the data in python via indexing
  1    loc() Only for lables
  2    iloc()  only for integer
  3    ix()  for both label and and integer.


Pandas Indexing with jupyter complete tutorialk to underatnd the concept and learning

Pandas Indexing with jupyter complete tutorial to understnd the concept and learning of data science

Pandas Indexing with jupyter complete tutorial to understnd the concept and learning of data science  for beginner

Pandas Indexing with jupyter complete tutorial to understnd the concept and learning of data science  for beginner and fresher

Pythan index with jupyter complete tutorial with example





Wednesday, September 4, 2019

Python pattern from from incresing and descresing sequnce of numbers

This post will explain the logic, code and Syntax for pattern program in Python Programming. In this post you will understand how to right the code of a pattern which have the sequence in  descreasing and incresinng sequence.


Python pattern from from incresing and descresing sequnce of numbers


 Pattern Code-
def python_pattern(n):
    for i in range(0, n):
        if n/2 >= i:
            for j in range(1, i+1):
                print(j, end=" ")
            print("\r")
        else:
            for j in range(1, n - i + 1):
                print(j, end=" ")
            print("\r")
n=10python_pattern(n)

Output:
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
1 2 3 4
1 2 3
1 2
1

Youtube Video of Complete Program


See Also-Python patthern program of all types


Thursday, August 29, 2019

Palindrome number program in Pythan

In this post i will explain the palindome number program in python and also to expalin the same i also created a youtube video so you can check also complete step by step and also output in IDE. 

Palindrome number program in Pythan

Palindrome number program in Pythan


Palindrome No Program in Python-



num = int(input("enter a number: "))
temp = num
rev = 0while temp:
    rev = (rev * 10) + (temp % 10)
    temp = temp // 10if num == rev:
    print("No is palindrome")
else:
    print("No is not palindrome")



Output-
When entered Item is- 747
   No is Palindrome.

when entered Item is- 67
   No is notb Palindrome.


See Also-Pythan All type of program







Saturday, August 24, 2019

Python Pattern Program Example With Code

As all of us knows that as we used to print the pattern program in C, JAVA,Net etc. To make comfortable and understand to the new user in Pyhton we started learning that programming language.

In the same way to make confidence, Comfortable and learn syntax and logic writing style in Python we can practice for this i am showing to all of you more than 20 pattern program code in Python.
You can copy and paste these code  and even test at your own system. Users can modify these Codes too accrding to requirement.

---------------------------------------------------------------------------------
Example 1-
Python pattern program example

...................................................................................................................................................................
Source Code- Pycharm IDE

# Function to demonstrate printing pattern
  def python_pattern(n):
    # outer loop to handle number of rows    
    # n in this case  
        for i in range(0, n):

        # inner loop to handle number of columns       
        # values changing acc. to outer loop       
             for j in range(0, i + 1):
             # printing stars           
               print("* ", end="")

            # ending line after each row      
         print("\r")

    # Driver Code
    # No of rows variable length
    n = 6
    python_pattern(n)


Output-

F:\web\venv\Scripts\python.exe F:/web/pattern.py
* * 
* * * 
* * * * 
* * * * * 
* * * * * * 

Process finished with exit code 0




Friday, August 16, 2019

Android- JSON Parser Code for server request and responce

In this post i will explain the palindome number program in python and also to expalin the same i also created a youtube video so you can check also complete step by step and also output in IDE.



Android- JSON Parser Code for server request and responce



package com.example.sawan.onlineattendance;
import android. util.Log;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.StatusLine;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.utils.URLEncodedUtils;
import org.apache.http.impl.client.DefaultHttpClient;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import java.util.List;

/**
 * Created by sawan on 9/28/2016.
 */
public class JSONParser {
static InputStream is = null;
static JSONObject jObj = null;
static String json = "";
static InputStream iStream = null;
static JSONArray jarray = null;

public JSONParser() {}
public JSONObject makeHttpRequest(String url1, String method, List < NameValuePair > params){
try {
if (method == "POST") {
DefaultHttpClient httpClient = new DefaultHttpClient();
HttpPost httpPost = new HttpPost(url);
httpPost.setEntity(new UrlEncodedFormEntity(params));
HttpResponse httpResponse = httpClient.execute(httpPost);
HttpEntity httpEntity = httpResponse.getEntity();
is = httpEntity.getContent();
}
else {
DefaultHttpClient httpClient = new DefaultHttpClient();
String paramString = URLEncodedUtils.format(params, "utf-8");
url += "?" + paramString;
HttpGet httpGet = new HttpGet(url);
HttpResponse httpResponse = httpClient.execute(httpGet);
HttpEntity httpEntity = httpResponse.getEntity();
is = httpEntity.getContent();
}

}
catch(UnsupportedEncodingException e) {
System.out.println("UnsupportedEncodingException");
e.printStackTrace();
}
catch(ClientProtocolException e) {
e.printStackTrace();
}
catch(IOException e) {
e.printStackTrace();
}

try {
BufferedReader reader = new BufferedReader(new InputStreamReader(is, "iso-8859-1"), 8);
StringBuilder sb = new StringBuilder();
String line = null;
while ((line = reader.readLine()) != null) {
sb.append(line + "\n");
}
is.close();
json = sb.toString();
} catch(Exception e) {
Log.e("Buffer Error", "Error converting result " + e.toString());
}
try {
jObj = new JSONObject(json);
}
catch(JSONException e) {
Log.e("JSON Parser", "Error parsing data " + e.toString());
}
return jObj;

}
public JSONArray getJSONFromUrl(String url) {
StringBuilder builder = new StringBuilder();
HttpClient client = new DefaultHttpClient();
HttpGet httpGet = new HttpGet(url);
try {
HttpResponse response = client.execute(httpGet);
StatusLine statusLine = response.getStatusLine();
int statusCode = statusLine.getStatusCode();
if (statusCode == 200) {
HttpEntity entity = response.getEntity();
InputStream content = entity.getContent();
BufferedReader reader = new BufferedReader(new InputStreamReader(content));
String line;
while ((line = reader.readLine()) != null) {
builder.append(line);
}
}
else {
Log.e("==>", "Failed to download file");
}
} catch(ClientProtocolException e) {
e.printStackTrace();
} catch(IOException e) {
e.printStackTrace();
}
try {
jarray = new JSONArray(builder.toString());
} catch(JSONException e) {
Log.e("JSON Parser", "Error parsing data " + e.toString());
}
return jarray;
}

public JSONObject makeHttpRequest2(String url) {
try {
DefaultHttpClient httpClient = new DefaultHttpClient();
HttpPost httpPost = new HttpPost(url);
HttpResponse httpResponse = httpClient.execute(httpPost);
HttpEntity httpEntity = httpResponse.getEntity();
is = httpEntity.getContent();
} catch(UnsupportedEncodingException e) {
e.printStackTrace();
} catch(ClientProtocolException e) {
e.printStackTrace();
} catch(IOException e) {
e.printStackTrace();
}

try {
BufferedReader reader = new BufferedReader(new InputStreamReader(
is, "iso-8859-1"), 8);
StringBuilder sb = new StringBuilder();
String line = null;
while ((line = reader.readLine()) != null) {
sb.append(line + "\n");
}
is.close();
json = sb.toString();
} catch(Exception e) {
Log.e("Buffer Error", "Error converting result " + e.toString());
}

try {
jObj = new JSONObject(json);
} catch(JSONException e) {
Log.e("JSON Parser", "Error parsing data " + e.toString());
}
return jObj;

}
}
See Also-

Thursday, August 15, 2019

Json Parser Code for Android to JAVA MVC Project Uploading The Image

This Blog post have the complete Code for an Android Application which have database at cload and running on apache TOMCAT.


Json Parser Code for Android to JAVA MVC Project Uploading The Image

In this blog post you can get all information easily which is required to send a request from android application to server(cloud)  and receive and extract  the data in usable format.


This Code is used in School ERP Application for uploading The Image of Code



package com.example.sawan.onlineattendance; // Package Name of Project
import android.util.Log;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.StatusLine;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.utils.URLEncodedUtils;
import org.apache.http.impl.client.DefaultHttpClient;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import java.util.List;

/**
 * Created by sawan on 9/28/2016.
 */

public class JSONParser {

static InputStream is = null;
static JSONObject jObj = null;
static String json = "";
static InputStream iStream = null;
static JSONArray jarray = null;

public JSONParser() {}
public JSONObject makeHttpRequest(String url2, String method, List < NameValuePair > params)\ {
try {
if (method == "POST") {
DefaultHttpClient httpClient = new DefaultHttpClient();
HttpPost httpPost = new HttpPost(url);
httpPost.setEntity(new UrlEncodedFormEntity(params));
HttpResponse httpResponse = httpClient.execute(httpPost);
HttpEntity httpEntity = httpResponse.getEntity();
is = httpEntity.getContent();
}
else {
DefaultHttpClient httpClient = new DefaultHttpClient();
String paramString = URLEncodedUtils.format(params, "utf-8");
url += "?" + paramString;
HttpGet httpGet = new HttpGet(url);
HttpResponse httpResponse = httpClient.execute(httpGet);
HttpEntity httpEntity = httpResponse.getEntity();
is = httpEntity.getContent();
}

}
catch(UnsupportedEncodingException e) {
System.out.println("UnsupportedEncodingException");
e.printStackTrace();
}
catch(ClientProtocolException e) {
e.printStackTrace();
}
catch(IOException e) {
e.printStackTrace();
}

try {
BufferedReader reader = new BufferedReader(new InputStreamReader(is, "iso-8859-1"), 8);
StringBuilder sb = new StringBuilder();
String line = null;
while ((line = reader.readLine()) != null) {
sb.append(line + "\n");
}
is.close();
json = sb.toString();
} catch(Exception e) {
Log.e("Buffer Error", "Error converting result " + e.toString());
}
try {
jObj = new JSONObject(json);
}
catch(JSONException e) {
Log.e("JSON Parser", "Error parsing data " + e.toString());
}
return jObj;

}
public JSONArray getJSONFromUrl(String url) {
StringBuilder builder = new StringBuilder();
HttpClient client = new DefaultHttpClient();
HttpGet httpGet = new HttpGet(url);
try {
HttpResponse response = client.execute(httpGet);
StatusLine statusLine = response.getStatusLine();
int statusCode = statusLine.getStatusCode();
if (statusCode == 200) {
HttpEntity entity = response.getEntity();
InputStream content = entity.getContent();
BufferedReader reader = new BufferedReader(new InputStreamReader(content));
String line;
while ((line = reader.readLine()) != null) {
builder.append(line);
}
}
else {
Log.e("==>", "Failed to download file");
}
} catch(ClientProtocolException e) {
e.printStackTrace();
} catch(IOException e) {
e.printStackTrace();
}
try {
jarray = new JSONArray(builder.toString());
} catch(JSONException e) {
Log.e("JSON Parser", "Error parsing data " + e.toString());
}
return jarray;
}

public JSONObject makeHttpRequest2(String url) {
try {
DefaultHttpClient httpClient = new DefaultHttpClient();
HttpPost httpPost = new HttpPost(url);
HttpResponse httpResponse = httpClient.execute(httpPost);
HttpEntity httpEntity = httpResponse.getEntity();
is = httpEntity.getContent();
} catch(UnsupportedEncodingException e) {
e.printStackTrace();
} catch(ClientProtocolException e) {
e.printStackTrace();
} catch(IOException e) {
e.printStackTrace();
}

try {
BufferedReader reader = new BufferedReader(new InputStreamReader(
is, "iso-8859-1"), 8);
StringBuilder sb = new StringBuilder();
String line = null;
while ((line = reader.readLine()) != null) {
sb.append(line + "\n");
}
is.close();
json = sb.toString();
} catch(Exception e) {
Log.e("Buffer Error", "Error converting result " + e.toString());
}

try {
jObj = new JSONObject(json);
} catch(JSONException e) {
Log.e("JSON Parser", "Error parsing data " + e.toString());
}
return jObj;

}
}


100+ JAVA Pattern Program






50+ Python Pattern Program



See Also-



Android java code settiong of subject in MVC

package com.example.sawan.onlineattendance;



Android java code settiong of subject in MVC


import android.content.Intent;
import android.os.AsyncTask;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.Spinner;

import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import org.json.JSONObject;

import java.util.ArrayList;
import java.util.List;

public class FacultySubjectSetting extends AppCompatActivity {
 Button btn;
    String fca;
    JSONParser jParser = new JSONParser();
    JSONObject json;
    private static String url_login = "http://  192. 168. 43. 156: 8081 /OnlineAttendance/UpdateTeaherSubjectSettingSearch";
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_faculty_subject_setting);
        btn=(Button)findViewById(R.id.search);
        Spinner spinner4 = (Spinner) findViewById(R.id.spinner_faculty);
        ArrayAdapter<CharSequence> adapter4 = ArrayAdapter.createFromResource(
                this, R.array.Faculty, android.R.layout.simple_spinner_item);
        adapter4.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
        spinner4.setAdapter(adapter4);
        spinner4.setOnItemSelectedListener(new MyOnItemSelectedListener());

 btn.setOnClickListener(new View.OnClickListener() {
     @Override
     public void onClick(View view) {
         Spinner sp4 = (Spinner)findViewById(R.id.spinner_faculty);
         String   facu = sp4.getSelectedItem().toString();
         fca=Integer.parseInt(facu)+"";
         new Login().execute();
     }
 });
    }
    private class Login extends AsyncTask<String, String, String> {
        @SuppressWarnings("WrongThread")
        @Override
        protected String doInBackground(String... strings) {
            String username = fca;
            String table = Identification.TableName;
            List<NameValuePair> params = new ArrayList<NameValuePair>();
            params.add(new BasicNameValuePair("u",username));
            params.add(new BasicNameValuePair("t",table));
            json = jParser.makeHttpRequest(url_login, "GET", params);
            String Sname=null;

            try {
                System.out.println(json.getString("info"));
                int m=json.getInt("row");
                if( json.getString("info").equals("success"))
                {
                    int j=1;
                    Identification.FacultySubjectRecord=new String[m][3];
                    Identification.FacultyCode=json.getString("facultyCode");
                    System.out.println("condition is : "+(j<=m));
                    while(j<=m)
                    {
                        String sub=json.getString("sub"+j);
                        System.out.println("inseide "+sub);
                        System.out.println("inseide "+Identification.FacultySubjectRecord.length);
                        System.out.println("inseide "+(j-1));
                        System.out.println("inseide "+Identification.FacultySubjectRecord[j-1][0]);
                        Identification.FacultySubjectRecord[j-1][0]=sub;
                        System.out.println("nrfjnkmlk kgkm :");
                        System.out.println("inseide              "+Identification.FacultySubjectRecord[j-1][0]);
                        String branch=json.getString("branch"+j);

                        Identification.FacultySubjectRecord[j-1][1]=branch;

                        String section=json.getString("section"+j);

                        Identification.FacultySubjectRecord[j-1][2]=section;
                        System.out.println("inseide              "+Identification.FacultySubjectRecord[j-1][2]);

                        System.out.println("j value is : "+j);
                      j++;
                    }
                    Intent login = new Intent(getApplicationContext(),FacultySubjectSettingPage.class);
                    System.out.println("........................................ login.....................................................");
                    login.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
                    System.out.println("........................................ 1......................................................");
                    startActivity(login);
                    finish();
                }
                else
                {
                    Intent login = new Intent(getApplicationContext(), Error.class);
                    System.out.println("........................................ login.....................................................");
                    login.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
                    System.out.println("........................................ 1......................................................");
                    startActivity(login);
                    finish();
                }

            }
            catch (Exception e)
            {


            }
            return null;
        }
    }


}

Android JAVA Code for Staff Main Page


Android JAVA Code for Staff Main Page



Android JAVA Code for Staff Main Page Complete Code




package com.example.sawan.onlineattendance;

import android.content.Context;
import android.content.Intent;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.os.AsyncTask;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.RelativeLayout;
import android.widget.Spinner;
import android.widget.TextView;
import android.widget.Toast;

import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import org.json.JSONObject;

import java.util.ArrayList;
import java.util.List;

public class Faculty extends AppCompatActivity {

    JSONParser jParser = new JSONParser();
    JSONObject json;

    static String button;
    Button update, continu, dricNotice,hodNotice,notice;

    static boolean ma = false;
    Context ctx;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        ctx = this;
        setContentView(R.layout.activity_faculty);
        update = (Button) findViewById(R.id.faculty_code_button);
        continu = (Button) findViewById(R.id.continu);

        dricNotice = (Button) findViewById(R.id.PrincipalNotice);
        hodNotice = (Button) findViewById(R.id.HODNotice);
        notice = (Button) findViewById(R.id.HODLogin);



        update.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                button = "update";
                new Login().execute();
            }
        });

        dricNotice.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                button = "dricNotice";
                new Login().execute();
            }
        });
        hodNotice.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                button = "hodNotice";
                new Login().execute();
            }
        });
        notice.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent login = new Intent(getApplicationContext(), TeacherHODLogin.class);
                System.out.println("........................................ login.....................................................");
                login.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
                System.out.println("........................................ 1......................................................");
                startActivity(login);
                finish();
            }
        });
        continu.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent login = new Intent(getApplicationContext(), FacultyPage.class);
                System.out.println("........................................ login.....................................................");
                login.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
                System.out.println("........................................ 1......................................................");
                startActivity(login);
                finish();
            }
        });
    }


    private class Login extends AsyncTask<String, String, String> {
        @SuppressWarnings("WrongThread")
        @Override
        protected String doInBackground(String... strings) {

            String table = Identification.TableName;
//            if(button.equals("HOD"))
//            {
//                String url_login = "http 192.168.43.156:8081/OnlineAttendance/Student";
//                List<NameValuePair> params = new ArrayList<NameValuePair>();
//                for (int i = 0; i < Identification.FacultySubjectRecord.length; i++)
//                {
//                    params.add(new BasicNameValuePair("Branch" + i, Identification.FacultySubjectRecord[i][0]));
//                    System.out.println("....." + Identification.FacultySubjectRecord[i][0]);
//                    params.add(new BasicNameValuePair("Section" + i, Identification.FacultySubjectRecord[i][1]));
//                    System.out.println("....." + Identification.FacultySubjectRecord[i][1]);
//                    params.add(new BasicNameValuePair("Subject" + i, Identification.FacultySubjectRecord[i][2]));
//                    System.out.println("....." + Identification.FacultySubjectRecord[i][2]);
//                }
//                params.add(new BasicNameValuePair("t", table));
//                params.add(new BasicNameValuePair("row", Identification.FacultySubjectRecord.length + ""));
//                params.add(new BasicNameValuePair("faculty", Identification.StudentRoll));
//                params.add(new BasicNameValuePair("download", button));
//                json = jParser.makeHttpRequest(url_login, "GET", params);
//                String Sname = null;
//                DataBase db=new DataBase(ctx);
//                db.deleteData(db);
//                try
//                {
//                    System.out.println(Sname=json.getString("info"));
//                    int m = json.getInt("row");
//                    System.out.println("m value....."+m) ;
//                    if (Sname.equals("success"))
//                    {
//                        int j = 0;
//                        int k=0;
//                        Identification.StudentRecord = new String[m][6];
//                        System.out.println("inseide        " + Identification.StudentRecord.length);
//                        System.out.println("condition is : " + (j <= m));
//                        while (j < m)
//                        {
//                            String name = json.getString("name" + k);
//                            k++;
//                            Identification.StudentRecord[j][0] = name;
//                            String rool = json.getString("roll" + k);
//                            k++;
//                            Identification.StudentRecord[j][1] = rool;
//                            String branch = json.getString("branch" + k);
//                            k++;
//                            Identification.StudentRecord[j][2] = branch;
//                            String section = json.getString("Section" + k);
//                            k++;
//                            Identification.StudentRecord[j][3] = section;
//                            System.out.println("section value             " + Identification.StudentRecord[j][2]);
//                            String Attendance = json.getString("Attendance" + k);
//                            k++;
//                            Identification.StudentRecord[j][4] = Attendance;
//                            String SubCode= json.getString("SubjectCode" + k);
//                            k++;
//                            Identification.StudentRecord[j][5] = SubCode;
//                            System.out.println("j value is : " + j);
//                            j++;
//                          }
//                            for (int i = 0; i < m; i++)
//                            {
//                                System.out.println("...........DataBase class Insert Method is called..........");
//
//                                db.insertRecord(Identification.StudentRecord[i][0], Identification.StudentRecord[i][1], Identification.StudentRecord[i][2], Identification.StudentRecord[i][3], Identification.StudentRecord[i][4],Identification.StudentRecord[i][5]);
//                                System.out.println("...........DataBase class Insert Method is called succeful..........");
//                            }
//
//
//                        Intent login = new Intent(getApplicationContext(), FacultySubjectSettingPage.class);
//                        System.out.println("........................................ login.....................................................");
//                        login.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
//                        System.out.println("........................................ 1......................................................");
//                        startActivity(login);
//                        finish();
//                    }
//                    else
//                    {
//                        Intent login = new Intent(getApplicationContext(), Error.class);
//                        System.out.println("........................................ login.....................................................");
//                        login.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
//                        System.out.println("........................................ 1......................................................");
//                        startActivity(login);
//                        finish();
//                    }
//
//                } catch (Exception e) {
//                    System.out.println("........................................ 1......................................................");
//                      e.printStackTrace();
//                }
//            }
           // else
            if(button.equals("facultydata"))
            {
                Intent login = new Intent(getApplicationContext(), TeacherNotice.class);
                System.out.println("........................................ login.....................................................");
                login.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
                System.out.println("........................................ 1......................................................");
                startActivity(login);
                finish();
             }
            else if(button.equals("update"))
            {
                String url_login = http:// 192.168.43.156:8081/OnlineAttendance/StudentUpdate";
                List<NameValuePair> params = new ArrayList<NameValuePair>();
                DataBase db=new DataBase(ctx);
                Cursor cs=db.getInformation(db);
                int ror=cs.getCount();
                cs.moveToNext();
                System.out.println(  "  row value is   :  "+ror);
                int k=0;
                for(int i=0;i<cs.getCount();i++)
                {
                    params.add(new BasicNameValuePair("name"+k,cs.getString(0)));
                    System.out.println(  "  name vzlue is    :  "+cs.getString(0));
                    k++;
                    params.add(new BasicNameValuePair("roll"+k,cs.getString(1)));
                    System.out.println(  "  roll no is    :  "+cs.getString(1));
                    k++;
                    params.add(new BasicNameValuePair("branch"+k,cs.getInt(2)+""));
                    System.out.println(  "  branch no is    :  "+cs.getString(2));
                    k++;
                    params.add(new BasicNameValuePair("section"+k,cs.getString(3)));
                    System.out.println(  "  roll no is    :  "+cs.getString(3));
                    k++;
                    params.add(new BasicNameValuePair("attendance"+k,cs.getInt(4)+""));
                    System.out.println(  "  attendance no is    :  "+cs.getString(4));
                    k++;
                    params.add(new BasicNameValuePair("subjectcode"+k,cs.getInt(5)+""));
                    System.out.println("..........subcode value is........."+cs.getInt(5));
                    k++;
                    cs.moveToNext();
                }
                params.add(new BasicNameValuePair("row",ror+""));
                params.add(new BasicNameValuePair("table",Identification.TableName));
                params.add(new BasicNameValuePair("facultyCode",Identification.FacultyCode));

                json = jParser.makeHttpRequest(url_login, "GET", params);
                String Sname=null;
                try {
                if (json.getString("info").equals("success")) {
                Cursor cs2=db.getInformation3(db);
                int ror2=cs2.getCount();
                cs2.moveToFirst();
                    List<NameValuePair> params2 = new ArrayList<NameValuePair>();
                for(int i=0;i<cs2.getCount();i++)
                {
                    params2.add(new BasicNameValuePair("faccode"+i,cs2.getInt(0)+""));
                    params2.add(new BasicNameValuePair("subcode"+i,cs2.getInt(1)+""));
                    params2.add(new BasicNameValuePair("lecno"+i,cs2.getInt(2)+""));
                    params2.add(new BasicNameValuePair("str"+i,cs2.getInt(3)+""));
                    params2.add(new BasicNameValuePair("br"+i,cs2.getInt(4)+""));
                    params2.add(new BasicNameValuePair("sec"+i,cs2.getString(5)+""));
                    cs2.moveToNext();
                }
                params2.add(new BasicNameValuePair("row",ror2+""));
                params2.add(new BasicNameValuePair("table",Identification.TableName));
                String url_login2 = "http:/ /192.168.43.156:8081/OnlineAttendance/FacultyDataUpdation";
                json = jParser.makeHttpRequest(url_login2, "GET", params2);
                String Sname2=null;
                       if(json.getString("info2").equals("success"))
                       {


                           String url_login3 = http:// 192.168.43.156:8081/OnlineAttendance/Student";
                           List<NameValuePair> params3 = new ArrayList<NameValuePair>();
                           for (int i = 0; i < Identification.FacultySubjectRecord.length; i++)
                           {
                               params3.add(new BasicNameValuePair("Branch" + i, Identification.FacultySubjectRecord[i][0]));
                               System.out.println("....." + Identification.FacultySubjectRecord[i][0]);
                               params3.add(new BasicNameValuePair("Section" + i, Identification.FacultySubjectRecord[i][1]));
                               System.out.println("....." + Identification.FacultySubjectRecord[i][1]);
                               params3.add(new BasicNameValuePair("Subject" + i, Identification.FacultySubjectRecord[i][2]));
                               System.out.println("....." + Identification.FacultySubjectRecord[i][2]);
                           }
                           params3.add(new BasicNameValuePair("t", table));
                           params3.add(new BasicNameValuePair("row", Identification.FacultySubjectRecord.length + ""));
                           params3.add(new BasicNameValuePair("faculty", Identification.StudentRoll));
                           params3.add(new BasicNameValuePair("download", button));
                           json = jParser.makeHttpRequest(url_login3, "GET", params3);
                           System.out.println("...........................1 ..............................");
                           System.out.println("...........................1 ..............................");
                           System.out.println("...........................1 ..............................");
                           System.out.println("...........................1 ..............................");
                           System.out.println("...........................1 ..............................");
                           String Sname3 = null;
                           System.out.println("...........................1 ..............................");
                           System.out.println("...........................1 ..............................");
                           System.out.println("...........................1 ..............................");
                           System.out.println("...........................1 ..............................");
                           db.deleteData(db);
                           System.out.println("...........................1 ..............................");
                           System.out.println("...........................1 ..............................");
                           System.out.println("...........................1 ..............................");
                           System.out.println("...........................1 ..............................");
                           System.out.println("...........................1 ..............................");
                           System.out.println("...........................1 ..............................");
                           try
                           {
                               System.out.println(Sname3=json.getString("info"));
                               int m = json.getInt("row");
                               System.out.println("m value....."+m) ;
                               if (Sname3.equals("success")) {
                                   int j = 0;
                                   int q = 0;
                                   Identification.StudentRecord = new String[m][6];
                                   System.out.println("inseide        " + Identification.StudentRecord.length);
                                   System.out.println("condition is : " + (j <= m));
                                   while (j < m) {
                                       String name = json.getString("name" + q);
                                       q++;
                                       Identification.StudentRecord[j][0] = name;
                                       String rool = json.getString("roll" + q);
                                       q++;
                                       Identification.StudentRecord[j][1] = rool;
                                       String branch = json.getString("branch" + q);
                                       q++;
                                       Identification.StudentRecord[j][2] = branch;
                                       String section = json.getString("Section" + q);
                                       q++;
                                       Identification.StudentRecord[j][3] = section;
                                       System.out.println("section value             " + Identification.StudentRecord[j][2]);
                                       String Attendance = json.getString("Attendance" + q);
                                       q++;
                                       Identification.StudentRecord[j][4] = Attendance;
                                       String SubCode = json.getString("SubjectCode" + q);
                                       q++;
                                       Identification.StudentRecord[j][5] = SubCode;
                                       System.out.println("j value is : " + j);
                                       j++;
                                   }
                                   for (int i = 0; i < m; i++) {
                                       System.out.println("...........DataBase class Insert Method is called..........");

                                       db.insertRecord(Identification.StudentRecord[i][0], Identification.StudentRecord[i][1], Identification.StudentRecord[i][2], Identification.StudentRecord[i][3], Identification.StudentRecord[i][4], Identification.StudentRecord[i][5]);
                                       System.out.println("...........DataBase class Insert Method is called succeful..........");
                                   }

                               }

                               String url_login4 = "http: 192.168.43.156:8081/OnlineAttendance/StudentRecordUpdateAttendance";
                               List<NameValuePair> params4 = new ArrayList<NameValuePair>();
                               Cursor  cs3=db.getInformation5(db);
                               int ror3=cs3.getCount();
                               cs3.moveToNext();
                               System.out.println(  "  row value is   :  "+ror3);
                               k=0;
                               for(int i=0;i<cs3.getCount();i++)
                               {
                                   params4.add(new BasicNameValuePair("name"+k,cs3.getString(0)));
                                   System.out.println("................"+cs3.getString(0));
                                   k++;
                                   params4.add(new BasicNameValuePair("roll"+k,cs3.getString(1)));
                                   System.out.println("................"+cs3.getString(1));
                                   k++;
                                   params4.add(new BasicNameValuePair("subject"+k,cs3.getInt(2)+""));
                                   System.out.println("................"+cs3.getString(2));
                                   k++;
                                   params4.add(new BasicNameValuePair("faculty"+k,cs3.getString(3)));
                                   System.out.println("................"+cs3.getString(3));
                                   k++;
                                   params4.add(new BasicNameValuePair("day"+k,cs3.getString(4)+""));
                                   System.out.println("................"+cs3.getString(4));
                                   k++;
                                   params4.add(new BasicNameValuePair("month"+k,cs3.getString(5)+""));
                                   System.out.println("................"+cs3.getString(5));
                                   k++;
                                   params4.add(new BasicNameValuePair("year"+k,cs3.getString(6)+""));
                                   System.out.println("................"+cs3.getString(6));
                                   k++;
                                   params4.add(new BasicNameValuePair("hour"+k,cs3.getString(7)+""));
                                   System.out.println("................"+cs3.getString(7));
                                   k++;
                                   params4.add(new BasicNameValuePair("minu"+k,cs3.getString(8)+""));
                                   System.out.println("................"+cs3.getString(8));
                                   k++;
                                   params4.add(new BasicNameValuePair("number"+k,cs3.getInt(9)+""));
                                   System.out.println("................"+cs3.getString(9));
                                   k++;
                                   cs3.moveToNext();
                               }

                               params4.add(new BasicNameValuePair("row",ror3+""));

                               params4.add(new BasicNameValuePair("table",Identification.TableName));

                               json = jParser.makeHttpRequest(url_login4, "GET", params4);
                               String Sname5=null;
                               if(json.getString("info6").equals("success"))
                               {
                                   db.deleteData4(db);
                                   Intent login = new Intent(getApplicationContext(),Successful.class);
                                   System.out.println("........................................ login.....................................................");
                                   login.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
                                   System.out.println("........................................ 1......................................................");
                                   startActivity(login);
                                   finish();
                               }
                           }
                           catch (Exception e)
                           {
                               System.out.println("...........Dtadata download error in upadation..........");
                               e.printStackTrace();
                           }
                       }

                       }

                    else
                    {
                        Intent login = new Intent(getApplicationContext(), Error.class);
                        System.out.println("........................................ login.....................................................");
                        login.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
                        System.out.println("........................................ 1......................................................");
                        startActivity(login);
                        finish();
                    }

                }
                catch(Exception e)
                {
                    e.printStackTrace();
                }
            }
           else if(button.equals("dricNotice"))
            {
                String url_login2 = "http 192.168.43.156:8081/OnlineAttendance/DirectorNoticeServlet";
                List<NameValuePair> params = new ArrayList<NameValuePair>();
                params.add(new BasicNameValuePair("t", Identification.TableName));

                params.add(new BasicNameValuePair("cutoff", button));
                params.add(new BasicNameValuePair("text", "faltu"));
                json = jParser.makeHttpRequest(url_login2, "GET", params);
                System.out.println("................ 7......................." + json);
                String s = null;
                try {
                    if (json.getString("info").equals("success")) {
                        Identification.FacultyDrictorNotices=json.getString("name");

                        Intent login = new Intent(getApplicationContext(), FacultyDrictorNotice.class);
                        System.out.println("........................................ login.....................................................");
                        login.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
                        System.out.println("........................................ 1......................................................");
                        startActivity(login);
                        finish();
                    }
                    else
                    {
                        Intent login = new Intent(getApplicationContext(), Error.class);
                        System.out.println("........................................ login.....................................................");
                        login.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
                        System.out.println("........................................ 1......................................................");
                        startActivity(login);
                        finish();
                    }
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
            else if(button.equals("hodNotice"))
            {
                String url_login2 = "http 192.168.43.156:8081/OnlineAttendance/DirectorNoticeServlet";
                List<NameValuePair> params = new ArrayList<NameValuePair>();
                params.add(new BasicNameValuePair("t", Identification.TableName));

                params.add(new BasicNameValuePair("cutoff", button));
                params.add(new BasicNameValuePair("text", "faltu"));
                json = jParser.makeHttpRequest(url_login2, "GET", params);
                System.out.println("................ 7......................." + json);
                String s = null;
                try {
                    if (json.getString("info").equals("success")) {
                        Identification.FacultyDrictorNotices=json.getString("name");
                        Intent login = new Intent(getApplicationContext(), FacultyHODNotice.class);
                        System.out.println("........................................ login.....................................................");
                        login.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
                        System.out.println("........................................ 1......................................................");
                        startActivity(login);
                        finish();
                    }
                    else
                    {
                        Intent login = new Intent(getApplicationContext(), Error.class);
                        System.out.println("........................................ login.....................................................");
                        login.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
                        System.out.println("........................................ 1......................................................");
                        startActivity(login);
                        finish();
                    }
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
            else if(button.equals("HOD"))
            {


                        Intent login = new Intent(getApplicationContext(), TeacherHODLogin.class);
                        System.out.println("........................................ login.....................................................");
                        login.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
                        System.out.println("........................................ 1......................................................");
                        startActivity(login);
                        finish();

            }
            return null;
        }
    }
}

Translate