Mar 25 2008

linear coding

Here are coding in C Language for Linear Equation. I’ll apply data collected from January, X is matrix of total incoming email per day, Y is matrix of total virus email per day.

#include <stdio.h>
#include <stdlib.h>

main()
{
    int i, j, k, l, m, n;
    int X[31][2], X1[2][31], Y[31][1], C[2][2], D[2][1];
    float C1[2][2], B[2][1], Y1[31][1], E[31][1];

    //Create matrix X and X1
        printf("\n Enter the element for Matrix X:-");
        for(i=0;i<31;i++)
        {
            for(j=0;j<2;j++)
                {
                    scanf("%d",&X[i][j]);   
                        X1[j][i]=X[i][j];
                }
         }

    printf("\n Matrix X:-\n");
            for(i=0;i<31;i++)
            {
                for(j=0;j<2;j++)
                    printf("\t%d",X[i][j]);
                printf("\n");
            }
            /*Displaying transpose of matrix*/
            printf("\n Transpose of Matrix X:-\n");
            for(i=0;i<2;i++)
            {
                for(j=0;j<31;j++)
                    printf("\t%d",X1[i][j]);
                printf("\n");
            }

    //Create matrix Y
        printf("\n Enter the element of Matrix Y:-");
        for(i=0;i<31;i++)
        {
            for(j=0;j<1;j++)
                {
                    scanf("%d",&Y[i][j]);   
                }
         }

    printf("\n Matrix Y:-\n");
            for(i=0;i<31;i++)
            {
                for(j=0;j<1;j++)
                    printf("\t%d",Y[i][j]);
                printf("\n");
            }

    //Calculate matrix C
        for(i=0;i<2;i++)
               for(j=0;j<2;j++)
                {
                       C[i][j]=0;
                        for(k=0;k<31;k++)
                          C[i][j]=C[i][j]+X1[i][k]*X[k][j];
                }
                /*Displaying final matrix*/
                printf("\n Matrix C:-\n");
                for(i=0;i<2;i++)
                {
                        for(j=0;j<2;j++)
                            printf("\t%d",C[i][j]);
                        printf("\n");
                }

    //Calculate matrix D
    for(i=0;i<2;i++)
                 for(j=0;j<1;j++)
                {
                        D[i][j]=0;
                        for(l=0;l<31;l++)
                            D[i][j]=D[i][j]+X1[i][l]*Y[l][j];
                }
                /*Displaying final matrix*/
                printf("\n Matrix D:-\n");
                for(i=0;i<2;i++)
                {
                        for(j=0;j<1;j++)
                            printf("\t%d",D[i][j]);
                        printf("\n");
                }

    //Calculate inverse of C
    {
            float det;

        det = 1.0 / ((C[0][0] * C[1][1]) – (C[0][1] * C[1][0]));

             printf("\nDeterminant = %.10f\n", det);

            C1[0][0] = det * C[1][1];
            C1[0][1] = -det * C[0][1];
            C1[1][0] = -det * C[1][0];
            C1[1][1] = det * C[0][0];

            printf("\n Inverse = \n");
            for(i=0;i<2;i++)
        {
            for(j=0;j<2;j++)
                printf("\t%.10f", C1[i][j]);
            printf("\n");
        }
    }

    //Calculate matrix B
    for(i=0;i<2;i++)
                 for(j=0;j<1;j++)
                {
                        B[i][j]=0;
                        for(m=0;m<2;m++)
                            B[i][j]=B[i][j]+C1[i][m]*D[m][j];
                }
                /*Displaying final matrix*/
                printf("\n Matrix B:-\n");
                for(i=0;i<2;i++)
                {
                        for(j=0;j<1;j++)
                            printf("\t%.10f",B[i][j]);
                        printf("\n");
                }

    //Calculate matrix Y1
    for(i=0;i<31;i++)
                 for(j=0;j<1;j++)
                {
                        Y1[i][j]=0;
                        for(n=0;n<2;n++)
                            Y1[i][j]=Y1[i][j]+X[i][n]*B[n][j];
                }
                /*Displaying final matrix*/
                printf("\n Matrix Y1:-\n");
                for(i=0;i<31;i++)
                {
                        for(j=0;j<1;j++)
                            printf("\t%.10f",Y1[i][j]);
                        printf("\n");
                }

    //Calculate error vector, E
    for(i=0;i<31;i++)
                {
                    for(j=0;j<1;j++)
                        E[i][j]=Y[i][j]- Y1[i][j];
                }
        /*Displaying final matrix*/               
        printf("\n Matrix E:-\n");
                for(i=0;i<31;i++)
                {
                    for(j=0;j<1;j++)
                        printf("\t%.10f",E[i][j]);
                    printf("\n");
        }
}


Jan 30 2008

overview..

For the last two weeks, from 22nd till 25th of January, I’ve done some research about Nagios and clustering. This project are about setting up a High Availability Load Balanced Cluster and then install Nagios in it. Objective of the project is to see how well Nagios perform in cluster.

Clustering is a group of loosely couple computer
that work together closely so that in many respects they can be viewed
as though they are a single computer. The components of a cluster are
commonly, but not always, connected to each other through fast local area network.
Clusters are usually deployed to improve performance and/or
availability over that provided by a single computer, while typically
being much more cost-effective than single computers of comparable
speed or availability.

Nagios is a host and service monitor designed to inform about network
problems. Since I’ll be using Linux for my project, Nagios is a perfect
match as it has been designed to
run under the Linux operating system. The monitoring daemon
runs intermittent checks on hosts and services you specify using
external "plugins" which return status information to Nagios. When
problems are encountered, the daemon can send notifications out to
administrative contacts in a variety of different ways (email, instant
message, SMS, etc.). Current status information, historical logs, and
reports can all be accessed via a web browser.


Get Adobe Flash playerPlugin by wpburn.com wordpress themes