Search the Blog

Showing posts with label XML. Show all posts
Showing posts with label XML. Show all posts

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


Monday, August 26, 2019

Pyhtan * Pattern Program with Space

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

In the same way to make confidence and learn syntax and logic writting style in Python. We can practice as many prgram 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.

Python pattern program with space and Star(*) 

Pyhtan * Pattern Program with Space

Program Code-


def python_pattern(n):
    # outer loop will handle number of rows    
    # n in this case    
    for i in range(0, n):
        # inner loop will handle number 
          of columns for space printing        
       for k in range(0, n-i):
            # printing stars            
            print("  ", end="")
        # inner loop will handle number of columns 
        for star printing        
       for j in range(0, i + 1):
            # printing stars
            print("* ", end="")
            # ending line after each row
        print("\r")
    # Driver Code
n = 6python_pattern(n)





Output-


                 * 
              * * 
           * * * 
        * * * * 
     * * * * * 
  * * * * * * 


Thursday, August 15, 2019

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 error in MVC project

This post will Explain the way to deal if a server request is not completed because of data connection loss or server failure or proper redirect code to server not availble.


Android java code for error in MVC project



package com.example.sawan.onlineattendance;



import android.content.Intent;

import android.support.v7.app.AppCompatActivity;

import android.os.Bundle;

import android.view.View;

import android.widget.Button;



public class Error extends AppCompatActivity {

 Button btn;

 @Override

 protected void onCreate(Bundle savedInstanceState) {

  super.onCreate(savedInstanceState);

  setContentView(R.layout.activity_error);

  btn = (Button) findViewById(R.id.buttonerror);

  btn.setOnClickListener(new View.OnClickListener() {

   @Override

   public void onClick(View view) {}

  });

 }

}
Android server error


See  Also- Android Code for opening Multiple Screen from a single Activity

See Also Humanoid ROBOT Complete Programming and demo video with parts and equipment used details.



Android Java Code form JAVA MVC Project Notice view School Application

Code of School Appolication for devliverying School Notice

This post have the code and logic and process to send the notice to all student and staff of a school. In this code i use a tomcat server mysql server

Android Java Code form JAVA MVC Project Notice view




package com.example.sawan.onlineattendance;



import android.content.Context;
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.Button;
import android.widget.EditText;
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 DrictorTeacherNotice extends AppCompatActivity {

 EditText ed;
 Button button;
 JSONParser jParser = new JSONParser();
 Context ctx;
 JSONObject json;
 static String buttton;
 @Override
 protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_drictor_teacher_notice);
  ed = (EditText) findViewById(R.id.notice);
  button = (Button) findViewById(R.id.update);
  ed.setText(Identification.DrictorFacultyNotice);
  button.setOnClickListener(new View.OnClickListener() {
   @Override
   public void onClick(View view) {
    buttton = "TeacherNoticeSubmit";
    new Login().execute();
   }
  });
 }
 private class Login extends AsyncTask < String_dizsweb, String,_dizsweb String_dizsweb > {
  @SuppressWarnings("WrongThread")
  @Override
  protected String doInBackground(String...args) {
   {
    String url_login2 = "http: //192.168.43.156:8081/OnlineAttendance/DirectorNoticeServlet";
    List < NameValuePair > params_dizsweb_1 = new ArrayList < NameValuePair > ();
    params.add(new BasicNameValuePair("t", Identification.TableName));
    params.add(new BasicNameValuePair("cutoff", buttton));
    params.add(new BasicNameValuePair("text", ed.getText().toString()));
    json = jParser.makeHttpRequest(url_login2, "GET", params);
    String s = null;
    try {
     if (json.getString("info").equals("success")) {
      Intent login = new Intent(getApplicationContext(), Successful.class);
      login.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
      startActivity(login);
      finish();
     } else {
      Intent login = new Intent(getApplicationContext(), Error.class);
      login.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
      startActivity(login);
      finish();
     }
    } catch (Exception e) {
     e.printStackTrace();
    }
   }
   return null;
  }
 }
}


See Also-Pyhtan * Pattern Program with Space

Monday, July 15, 2019

Palindrome JAVA Code 2 Programming Logic and Code with Syntax

This is individual description list of program which is mentionmed in first page of JAVA, part of programming tutorial i will try to explanin more than 50 java * pattern program, Which are asked in interview and online exams and unveristy exam with diferrent logic for the same type of pattern


 Top 100+ Sql Server Interview Questions

A palindromic number is a number  that is the same when written forwards or backwards
 always be same, i.e., of the form 
. The first few palindromic numbersare therefore  are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 22, 33, 44, 55, 66, 77, 88, 99, 101, 111, 121


class PalindromeExample
{  
 public static void main(String args[])
{  
  int r,sum=0,temp;    
  int n=555;//It is the number variable to be checked for palindrome  
  
  temp=n;    
  while(n>0)
{    
   r=n%10;  //getting remainder  
   sum=(sum*10)+r;    
   n=n/10;    
  }    
  if(temp==sum)    
   System.out.println("palindrome number ");    
  else    
   System.out.println("not palindrome");    
}  

Translate