Search the Blog

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







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-


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


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 23, 2019

SQL SERVER High Availability (HA)

High Availability (HA)  of the server of  Database is the solution( process, technology ) to make the application database available 24x7 under either planned or un - planned conditions.   


There are five type of options in MS SQL Server to achieve and configure a setup for high availability solution for the databases. 
SQL SERVER High Availability (HA)


Replication 
The source(Main) data will be copied to destination, through replication agents (jobs). Object level technology. 
Main terminology 

  1.  Publisher is source server. 
  2.  Distributor is optional and stores replicated data in a suitble environemt for the subscriber.  
  3.  Subscriber is the destination server. 

Log Shipping 
The source data will be copied to destination through Transaction Log backup jobs. Various Database level technology. 
Main terminology 

  1.  Primary server is source server. 
  2.  Secondary server is destination server.
  3.  Monitor server is optional and will be monitored by log   shipping status.  


Mirroring 
The primary data will be copied to a secondary through a network transaction basis with help of mirroring endpoint and port number. Database level technology. 
Main terminology 

  1.  Principal server is source server always. 
  2.  Mirror server is destination server always.
  3.  Witness server is optional and can be used to make automatic  failover. 


Clustering 
The data will be stored in shared location which is used by both primary and secondary servers based on availability of the server. Instance level technology. Windows Clustering setup is required with shared storage 
Main terminology 

  1.  Active node is where SQL Services are running.
  2.  Passive node is where SQL Services are not running. 

AlwaysON Availability Groups 
 The primary data will be copied to secondary through network transaction basisand  Group of database level technology. Windows Clustering setup is required without shared storage for ALwaysON Availibilty Groups. 
Main terminology 

  1.  Primary replica is source server.
  2.  Secondary replica is destination server. 
Check Java Pattern Program
Java traingle pattern program




Sql Server error 276

Tuesday, August 20, 2019

SQL Servere database monitoring

Monitoring means to checking database status, settings about who can be the owner, what should be the file names, what should be the file sizes, backup schedules, etc. 
SQL Server databases can be monitored mainly through SQL Server Management Studio or T-SQL, and also can be monitored through various methods  
Database status can be checked whether it is online or in any other state as shown in the following snapshot.
SQL Servere database monitoring

SQL Servere database monitoring

SQL Servere database monitoring_maige
SQL Servere database monitoring start




High Availability (HA) of the server of  Database is the solution( process , technology ) to make the application database available 24 x 7 under either planned or un - planned conditions.   


There are five type of options in MS SQL Server to achieve and configure the   setup for high availability solution for the databases. 
SQL SERVER High Availability (HA)


Replication 
The source(Main) data will be copied to destination, through replication agents (jobs). Object level technology. 
Main terminology 

  1.  Publisher is source server. 
  2.  Distributor is optional and stores replicated data in a suitble environemt for the subscriber.  
  3.  Subscriber is the destination server. 

Log Shipping 
The source data will be copied to destination through Transaction Log backup jobs. Various Database level technology. 
Main terminology 

  1.  Primary server is source server. 
  2.  Secondary server is destination server.
  3.  Monitor server is optional and will be monitored by log   shipping status.  


Mirroring 
The primary data  will be copied to a secondary through a network transaction basis with  help of mirroring endpoint and port number. Database level  technology. 
Main terminology Uasd 

  1.  Principal server is  source server always. 
  2.  Mirror server is  destination server always.
  3.  Witness server is  optional and can be used to make automatic  failover. 


Clustering 
The data will be stored  in shared location which is used by both primary and secondary  servers based on availability of the server. Instance level technology.  Windows Clustering setup is required with shared storage. 
Main terminology Used

  1.  Active node is where SQL Services are running.
  2.  Passive node is where SQL Services are not running. 

AlwaysON Availability Groups 
 The primary data will  be copied to secondary through network transaction basisand  Group of database level technology. Windows Clustering setup is required without shared storage for ALwaysON Availibilty Groups. 
Main terminology 

  1.  Primary replica is source server.
  2.  Secondary replica is destination server. 
Check Java Pattern Program
Java traingle pattern program


Sunday, August 18, 2019

SQL SERVER Installation

With the help of this post you can installl SQL Server in your window oprerating system directly


Step 1: Download the Evaluation Edition from the microsoft website.

Step 2: Double - click on the “SQLFULL_x86_ENU_Install.exe” or  “SQLFULL_x64_ENU_Install.exe” , It will extract  the required files for installation in the “SQLFULL_x86_ENU”  or “SQLFULL_x86_ENU” folder  respectively one by one.

Step 3: Click the “ SQLFULL_x86_ENU ” or “SQLFULL_x64_ENU_Install.exe” folder and double-click “SETUP ” application file.

Step 4: Once we click on ' setup ' application, the following screen will open. It will show the following.
SQL SERVER Installation
Step 5: Click Installation which is on the left side of the below screen.
SQL SERVER Installation 2012 step 4
Step 6: Click the first option of the  right side seen on the above screen. The following  screen will open and it will take some time for intallation.
SQL SERVER Installation 2008 step 6
SQL SERVER Installation 
Step 7: After finishing the Click OK and the  following screen pops up.
SQL SERVER Installation 2014
Step 8: Click Next to get  the following screen wait for installation of all.
SQL SERVER Installation 2016
Step 9: Make sure to check  the product key selection and click Next.
SQL SERVER Installation 2014 stwep 10
Step 10: Select the checkbox  and  accept the license option and click Next.
SQL SERVER Installation 2016


SQL SERVER Installation 2018 step 10
Step 11: Select SQL Server  feature installation option  and then  click Next.
Step 12: Select Database engine  services checkbox and then click Next.
Step 13: Enter the named instance ( here I used TestInstance ) and click Next.
Step 14: Click Next on the above screen and the following screen appears you have to select server agent.
Step 15: Select service account names and start-up types  for the above listed services and then click Collation.
SQL SERVER Installation 2014 step 15
Step 16: Make sure the correct collation selection is  checked and then click Next.
SQL SERVER Installation 2014 step 16
Step 17: Make sure authentication mode selection  and administrators are checked and click Data Directories
SQL SERVER Installation 2014
Step 18: Make sure to select the above directory  locations and click Next. The following screen appears.
SQL SERVER Installation 2014 step 18
Step 19: Click Next on the below screen .
SQL SERVER Installation 2014 step 19
Step 20: Click Next on the below screen to the get the following screen .
SQL SERVER Installation 2014 step 20
 Step 21: Make sure to check the below selection correctly and click Install and finish.
SQL SERVER Installation 2014 step 21

Sql Server Intstallation



SQL Server supports two types of installation: 
1 Standalone 
2 Cluster based 

Checks 
1 - Check RDP access for the server. 
2 - Check OS bit, IP, domain of server. 
3 - Check if your account is in admin group to run setup.exe file. 
4 - Software location.

Requirements 
 Which version, edition, SP and hotfix if any. 
 Service accounts for database engine, agent, SSAS, SSIS, SSRS,      if any. 
 Named instance name if any. 
 Location for binaries, system, user databases. 
 Authentication mode. 
 Collation setting. 
 List of features

Pre-requisites for 2014 
 Setup support files. 
 .net framework 4.0. 
 SQL Server native client. 
 Windows installer 4.5/later version. 

JAVA program to return product of array element

Implement a function in JAVA of given array of integers, returns a new array for which every index carries the value of the product of the remaining elements.



Given array [2,3,1,4,5] it would return [60,40,120,30,24]


JAVA program to return product of array element



public class Main {

   List<Integer> arrInput1[];
   static  List<Integer> arrOutput1[];
   static int n;
   public static void main(String[] ar)
   {
   System.out.println("Enter the array size");
   Scanner a_dizsweb= new Scanner(System.in);
   n=a_dizsweb.nextInt();
   ArrayList<Integer> arrInput1=new ArrayList<Integer>();
   ArrayList<Integer>    arrOutput1=new ArrayList<Integer>();
     System.out.println("Enter the array size  ");

    for (int i=0;i<n;i++)
    {
          arrInput1.add(i, new Scanner(System.in).nextInt());
    }

findSpecialProduct(arrInput1);

    }
    public static void findSpecialProduct(List<Integer> inputArray) {
   ArrayList<Integer> arrOutput1=new ArrayList<Integer>();
         for(int k=0; k<n;k++)
      {
          int indexvalue1=1;
          int index=k;
       for (int i =0; i<n;i++)
       {
           if (index==i)
           {
             indexvalue1=indexvalue1*1;
           }
           else
           {
            indexvalue1=indexvalue1*inputArray.get(i); 
           }
       }
       arrOutput1.add(indexvalue1);
      }
/*     
 for(Integer inta : arrOutput) {
            System.out.println(inta.get());
        }*/
        arrOutput1.forEach(System.out::println);
   
    }

}

Implement a function which, given an array of integers, returns a new array for which every index carries the vale of the product of the remaining elements.

SQL Server Lock Type and Mode

SQL Server Locks are used to restrict the user and access and prevent the unautorised access to data and at the same time.


SQL Server Lock Type and Mode



SQL Server have folowing Lock Type-

1- RID
2- Key
3- Page
4- Extent
5- Table
6- DB

SQL Server have folowing Mode Type-

1- Shared (S)
2- Update (U)
3- Exclusive (X)
4- Intent
5- Schema
6- Bulk Update (BU)

Saturday, August 17, 2019

SQL Server Profiler Logout class Interpretation

Features of Logout Class-

 ApplicationName  (Data Types- nvarchar) (Column Id- 10)
         Name of the client application(Software which runs on user end) that created the connection to an instance of SQL Server. This column is populated with the values passed by the application(Every application have a unique code) rather than the displayed name of  the program.
SQL Server Profiler Application  Name


 ClientProcessID  (Data Types- int) (Column Id- 9)
           ID assigned by the host computer(Servefr) to the process (User application)where the client application is running. This data column(Value) is populated if the client process ID is provided by the client

 CPU  (Data Types- int) (Column Id- 18)
          Amount of CPU time (in milliseconds) used by the user during their connection(End User)

DatabaseID  (Data Types- int) (Column Id- 3)
          ID of the database(A Special ID is assigned) specified by the USE database statement or the default database if no USE database statement has been issued for a given instance (Session). SQL Server Profiler displays the name of the database(Main Database of application) if the ServerName data column is captured in the trace and the server is available.                
Determine the value for a database by using the DB_ID function(Special function to identify).

DatabaseName  (Data Types- nvarchar) (Column Id- 35)
          Name of the database(Session database) in which the user statement is running.

Duration  (Data Types- bigint) (Column Id- 13)
         Amount of time since the user logged in() Time of session (approximately).

EndTime  (Data Types- datetime) (Column Id- 15)
         End time of the logout() When the session Close.

EventClass  (Data Types- int) (Column Id- 27)
        Type of event = 15 ( Their are 15 types of event like logging , logout, etc).

EventSequence (Data Types- int) (Column Id- 51)
        The sequence of a given event within the request (this will show the details of event.

HostName (Data Types- nvarchar) (Column Id- 8)
        Name of the computer on which the client is running (End User). This data column is populated if the host                  name is provided by the client( End User). To determine the host name, use the HOST_NAME function (Function to know the host name).

IsSystem (Data Types- int) (Column Id- 60)
        Indicates whether the event occurred on a system process or a user process1 = system, 0 = user (This method will let to know is this an automatic or manual enent).

LoginName (Data Types- nvarchar) (Column Id- 11)
        Name of the login of the user (either the SQL Server security login or the Microsoft Windows login            credentials in the form of DOMAIN \ username).

LoginSid (Data Types- image) (Column Id- 41)
         Security identification number (S I D) of the logged-in user. You can find this information in                           the sys.server_principals catalog view. Each S I D is unique for each login in the server.

NTDomainName (Data Types- nvarchar) (Column Id- 7)
         Windows domain to which the user belongs.

NTUserName (Data Types- nvarchar) (Column Id- 6)
         Windows user name

Reads (Data Types- int) (Column Id- 16)
         Number of logical read I/Os issued by the user during the connection.

RequestID  (Data Types- int) (Column Id- 49)
         ID of the request containing the statement.

ServerName (Data Types- int) (Column Id- 26)
         Name of the instance of SQL Server being traced.

SessionLoginName (Data Types- int) (Column Id- 64)
         Login name of that user who originated the session. For example, if you connect to SQL Server using           Login1 and execute a statement as Login2, SessionLoginName shows Login1                                             and LoginName shows Login2. This column displays both SQL Server and Windows logins.

SPID (Data Types- int) (Column Id- 12)
         ID of the session on which the event occurred( Session unique ID).


StartTime(Data Types- datetime) (Column Id- 14)
         Time at which the event started, if available.

Success (Data Types- int) (Column Id- 23)
         1 = success. 0 = failure. For example, a value of 1 indicates success of that permission  check and a                 value of 0 indicates failure of that check.

Writes (Data Types- bigint) (Column Id- 17)
         Number of logical write Inputs/Outputs issued by the user during the connection.

GroupID(Data Types- int) (Column Id- 66)
     ID of the work load group(Main session) where the SQL Trace event fires.

Translate