URDINESH: 2015

Tuesday, November 10, 2015

KENDO GRID GET SELECTED ROWS USING CHECKBOX

To get the selected rows from Kendo Grid checkbox Please follow steps mentioned below,


1. Add one Boolean data type value to the entity that we are binding to Kendo Grid,(i.e. boolean property to the class)

    

    I.E. => Boolean  Selected {get;set;}

2. In the View( i.e. .cshtml page) Define the checkbox column as follows using template property of kendo grid,

 Columns.Template(@<text><text>).clientTemplate( "<input type='checkbox'  #= Selected?
                                                    checked= 'checked' ; '' # class = 'chkbxclass'/>");    

3. In the script file corresponding to the view , under           
     $(document).ready function write the following,
   
     function(){
                       $('#gvGridID').on('click','.chkbxclass',
                       function(){
                            var checked = $(this).is(':checked');
                            var grid = $('#gvGridID').data().kendogrid;
                            var dataItem = grid.dataItem($(this).closest('tr'));
                            dataItem.set('Selected',checked);
                          })
                  })
NOTE: "gvGridID"  is the Kendo Grid ID
4. On the submit button click, get the values from the kendo grid by using the following JQuery function,
        
             var grid = $('#gvGridID').data("kendogrid");
              $("#gvGridID tbody").find('tr').each(
                          function() {
                             var dataItem = grid.dataItem($(this).closest('tr'));
                             if(dataItem.Selected == true)
                                {
                                   // Write your logic here like concat all values                                    // with comma separated and store it in                                              // hidden field
                                }
                                            });

Hope this solution will help u to resolve the selecting rows from kendo grid Thanks please give your valuable comments


Tuesday, August 11, 2015

KENDO GRID CHANGE HEIGHT TO DISPLAY MANY RECORDS

Hi All,

Many of us struck with displaying more no records in a scroll-able Kendo Grid.

We can adjust the height of the Kendo grid so that we can make more no of records viewed by the users,

Here is the solution,



 If you want all over the application the kendo grid should be of same height then, in the Kendo.default.min.css file give the following style,

div .k-grid-content 
{

max-height: 900px;

}

OR

If you want for a particular page alone means in that page include the above mentioned style in the top where we are declaring script blocks

div .k-grid-content 
{

max-height: 900px;

}

Now Check your kendo grid by running the code...

Saturday, August 1, 2015

Extract text From Shared Memory & Print it in Uppercase


PROGRAM: 

#include<sys/types.h>
#include<sys/ipc.h>
#include<sys/msg.h>
#include<sys/shm.h>
#include<unistd.h>
#include<stdio.h>
#include<sys/stat.h>
#include<string.h>
main()
{
int shmid,i;
char *pa,a[1000];
shmid=shmget((key_t)1300,1024,0600|IPC_CREAT);
if(shmid==-1)
{printf("shmget failed");
return;
}
pa=(char*)shmat(shmid,0,0);
if(pa==(void *)-1)
{
printf("shmat failed");
return;
}
for(i=0;pa[i]!='\0';i++)
{
if(pa[i]>='a'&&pa[i]<='z')
pa[i]=pa[i]-32;
else
continue;
}
printf("\nUppercase Message : %s",pa);

}


OUTPUT:



[user @localhost ~]$ cc umgsh.c
[user @localhost ~]$ ./a.out

Uppercase Message : MESSAGE STORED IN SHARED MEMORY
SHARED MEMORY PROGRAMS
[user @localhost ~]$


Storing Lower case Message in Shared Memory-I


#include<sys/types.h>
#include<sys/ipc.h>
#include<sys/msg.h>
#include<sys/shm.h>
#include<unistd.h>
#include<stdio.h>
#include<sys/stat.h>
#include<string.h>
main()
{
int shmid,i;
char *pa,a[1000];
shmid=shmget((key_t)1300,1024,0600|IPC_CREAT);
if(shmid==-1)
{printf("shmget failed");
return;
}
pa=(char*)shmat(shmid,0,0);
if(pa==(void *)-1)
{
printf("shmat failed");
return;
}
printf("Enter text&press$to terminate\n");
for(i=0;(a[i]=getchar())!='$';i++);
a[i]='\0';
strcpy(pa,a);
printf("The given text is placed into shared memory\n");
}






OUTPUT


[user@localhost ~]$ cc mgsh.c
[user @localhost ~]$ ./a.out
Enter text&press$to terminate
Message stored in shared memory
shared memory programs$
The given text is placed into shared memory

[user @localhost ~]$ 

MarkSheet Preparation Using SharedMemory –II

 PROGRAM:

#include<sys/types.h>
#include<sys/ipc.h>
#include<sys/msg.h>
#include<sys/shm.h>
#include<unistd.h>
#include<stdio.h>
#include<sys/stat.h>
#include<string.h>
struct stud
{char name[25];
int roll,m1,m2,m3,tot;
float avg;
};
main()
{struct stud m,*p;
p=&m;
int shmid;
shmid=shmget((key_t)1300,1024,0660|IPC_CREAT);
if(shmid==-1)
{printf("shmget failed");
return;
}
p=(struct stud *)shmat(shmid,0,0);
if(p==(void *)-1)
{printf("shmat failed");
return;
}
p->tot=p->m1+p->m2+p->m3;
p->avg=(float)p->tot/3.0;
printf("\nNAME: %s",p->name);
printf("\nROLLNO:%d",p->roll);
printf("\nMARK1:%d",p->m1);
printf("\nMARK@:%d",p->m2);
printf("\nMARK#:%d",p->m3);
printf("\nTOTAL:%d",p->tot);
printf("\nAVERAGE:%f",p->avg);
}




OUTPUT:


[user @localhost ~]$ cc cmarsh.c
[user @localhost ~]$ ./a.out

NAME: Kannan
ROLLNO:987
MARK1:89
MARK@:98
MARK#:78
TOTAL:265

AVERAGE:88.333336[user @localhost ~]$

MarkSheet Preparation Using SharedMemory –I

PROGRAM:

#include<sys/types.h>
#include<sys/ipc.h>
#include<sys/shm.h>
#include<unistd.h>
#include<stdio.h>
#include<sys/stat.h>
#include<string.h>
struct stud
{
char name[25];
int roll,m1,m2,m3,tot;
float avg;
};
main()
{
struct stud m,*p;
p=&m;
int shmid;
shmid=shmget((key_t)1300,1024,0600|IPC_CREAT);
if(shmid==-1)
{printf("shmget failed");
return;
}
p=(struct stud *)shmat(shmid,0,0);
if(p==(void *)-1)
{
printf("shmat failed");
return;
}
printf("Enter the name:\n");
scanf("%s",p->name);
printf("Enter the Roll.No:\n");
scanf("%d",&p->roll);
printf("Enter the marks  got in 3 subject: \n");
scanf("%d%d%d",&p->m1,&p->m2,&p->m3);
printf("\nThe given information is placed in shared memory\n");
}


OUTPUT:

[user @localhost ~]$ cc marsh.c
[user @localhost ~]$ ./a.out
Enter the name:
Kannan
Enter the Roll.No:
987
Enter the marks  got in 3 subject:
89 98 78

The given information is placed in shared memory
[user @localhost ~]$


Length of the string using Shared Memory-II

Program:

#include<sys/types.h>
#include<sys/ipc.h>
#include<sys/msg.h>
#include<sys/shm.h>
#include<unistd.h>
#include<stdio.h>
#include<sys/stat.h>
#include<string.h>
main()
{
int shmid,i,len;
char *pa,a[1000];
shmid=shmget((key_t)1300,1024,0600|IPC_CREAT);
if(shmid==-1)
{printf("shmget failed");
return;
}
pa=(char*)shmat(shmid,0,0);
if(pa==(void *)-1)
{
printf("shmat failed");
return;
}
len=strlen(pa);
printf("\nThe length of the text is : %d\n",len);
}




OUTPUT:

[user @localhost ~]$ cc lenshm.c
[user @localhost ~]$ ./a.out

The length of the text is : 54

[user @localhost ~]$

Length of the string using Shared Memory

Program

#include<sys/types.h>
#include<sys/ipc.h>
#include<sys/msg.h>
#include<sys/shm.h>
#include<unistd.h>
#include<stdio.h>
#include<sys/stat.h>
#include<string.h>
main()                 
{
int shmid,i;
char *pa,a[1000];
shmid=shmget((key_t)1300,1024,0600|IPC_CREAT);
if(shmid==-1)
{printf("shmget failed");
return;
}
pa=(char*)shmat(shmid,0,0);
if(pa==(void *)-1)
{
printf("shmat failed");
return;
}
printf("Enter text&press$to terminate\n");
for(i=0;(a[i]=getchar())!='$';i++);
a[i]='\0';
strcpy(pa,a);
printf("The given text is placed into shared memory\n");
}


OutPut


[user@localhost ~]$ cc mgsh.c
[user @localhost ~]$ ./a.out
Enter text&press$to terminate
Message stored in shared memory
shared memory programs$
The given text is placed into shared memory
[user @localhost ~]$ 

Sunday, July 26, 2015

Shell Program To Extract the Message from Shared Memory


#include<sys/types.h>
#include<sys/ipc.h>
#include<sys/msg.h>
#include<sys/shm.h>
#include<unistd.h>
#include<stdio.h>
#include<sys/stat.h>
#include<string.h>
main()
{
int shmid,i;
char *pa,a[1000];
shmid=shmget((key_t)1300,1024,0600|IPC_CREAT);
if(shmid==-1)
{printf("shmget failed");
return;
}
pa=(char*)shmat(shmid,0,0);
if(pa==(void *)-1)
{
printf("shmat failed");
return;
}
printf("The text recived is: \n");
puts(pa);
}



Output:


[user@localhost ~]$ cc emgsh.c
[user@localhost ~]$ ./a.out
The text recived is:
Message stored in shared memory
shared memory programs

[user@localhost ~]$ 

Shell Program for Read & Print the text using shared memory



#include<sys/types.h>
#include<sys/ipc.h>
#include<sys/msg.h>
#include<sys/shm.h>
#include<unistd.h>
#include<stdio.h>
#include<sys/stat.h>
#include<string.h>
main()
{
int shmid,i;
char *pa,a[1000];
shmid=shmget((key_t)1300,1024,0600|IPC_CREAT);
if(shmid==-1)
{printf("shmget failed");
return;
}
pa=(char*)shmat(shmid,0,0);
if(pa==(void *)-1)
{
printf("shmat failed");
return;
}
printf("Enter text&press$to terminate\n");
for(i=0;(a[i]=getchar())!='$';i++);
a[i]='\0';
strcpy(pa,a);
printf("The given text is placed into shared memory\n");
}


OutPut




[user@localhost ~]$ cc mgsh.c
[user@localhost ~]$ ./a.out
Enter text&press$to terminate
Message stored in shared memory
shared memory programs$
The given text is placed into shared memory

[user@localhost ~]$ 

Wednesday, July 22, 2015

SHELL SCRIPT TO COPY ONE FILE TO ANOTHER FILE

COPY ONE FILE TO ANOTHER FILE:

echo "copying one file to another"
if [ $# -eq 4 ]
then
   cp $3 $1
   cp $4 $2
 fi
























OUTPUT:

[@localhost ~]$ cat f3
hai this is rajasekar
[@localhost ~]$ cat f4
i did my pg in nmc
[@localhost ~]$ sh copy.sh f1 f2 f3 f4
copying one file to another
[@localhost ~]$ cat f1
hai this is rajasekar
[@localhost ~]$ cat f2
i did my pg in nmc

SHELL SCRIPT TO REMOVE THE LINES IN A GIVEN PATTERN

REMOVE THE LINES IN A GIVEN PATTERN:


echo "Enter file name"
read file
echo "Enter pattern"
read pat
grep -v $pat $file







OUTPUT:

[@localhost ~]$ sh pattern.sh
Enter file name
raja
Enter pattern
did
HAI I AM RAJASEKAR
I DID MY STUDIES IN NMC
I COMPLEATED MY PG DEGREE IN MBA AND MCA
I AM ALWAYS BE A OVER-CONFIDENT PERSON
THEN ONLY LEADS TO VERY SUCCESSFULL MANNER

[@localhost ~]$ sh pattern.sh
Enter file name
raja
Enter pattern
COMPLEATED
HAI I AM RAJASEKAR
I DID MY STUDIES IN NMC
I AM ALWAYS BE A OVER-CONFIDENT PERSON
THEN ONLY LEADS TO VERY SUCCESSFULL MANNER

[@localhost ~]$ sh pattern.sh
Enter file name
raja
Enter pattern
I
THEN ONLY LEADS TO VERY SUCCESSFULL MANNER

Tuesday, July 21, 2015

SHELL SCRIPT TO GET NO OF SUBDIRECTORY IN CURRENT DIRECTORY

ALL SUBDIRECTORY IN CURRENT DIRECTORY:

echo "to display all sub directory"
for i in *
do
if [ -d $i ]
then
echo $i "is an directory"
fi
done





OUTPUT:

[@localhost ~]$ sh subdirt.sh
to display all sub directory
123 is an directory

324@86 is an directory

SHELL SCRIPT TO PAYBILL PREPARATION

PAYBILL PREPARATION:


 echo -e "\tPAYBILL CALCULATION"
echo -e "\t~~~~~~~~~~~~~~~~~~~~"
echo -e "\tenter the n value"
read n
echo -e "\tenter name id salary"
for((i=1;i<=n;i++))
do
`read name id salary
echo -e "\tbefore calculation"
echo -e "\t***********************"
echo -e "\tname\t:$name\n\tid\t:$id\n\tsalary\t:$salary"
echo -e "\t***********************"
echo -e "\t calculation part"
if [ $salary -lt 10000 ]
then
lic=`expr $salary*0.05|bc`
echo -e "\n\tlic:\t"$lic
pf=`expr $salary*0.03|bc`
echo -e "\n\tpf:\t"$pf
ded=`expr $lic+$pf|bc`
echo -e "\n\tded:\t"$ded
hra=`expr $salary*0.03|bc`
echo -e "\n\thra:\t"$hra
da=`expr $salary*0.08|bc`
echo -e "\n\tda:\t"$da
add=`expr $hra+$da|bc`
echo -e "\n\tadd:\t"$add
gpay=`expr $salary-$ded|bc`
echo -e "\n\tgpay:\t"$gpay
npay=`expr $gpay+$add|bc`
echo -e "\n\tnpay:\t"$npay
echo -e "\n\tafter calculation"
echo -e "\n\t*********************"
echo -e "\n\tname\t:$name\n\tid\t:$id\n\tnetpay\t:$npay"
echo -e "\n\t***********************"
else
lic=`expr $salary*0.05|bc`
echo -e "\n\tlic:\t"$lic
pf=`expr $salary*0.03|bc`
echo -e "\n\tpf:\t"$pf
ded=`expr $lic+$pf|bc`
echo -e "\n\tded:\t"$ded
hra=`expr $salary*0.03|bc`
echo -e "\n\thra:\t"$hra
da=`expr $salary*0.08|bc`
echo -e "\n\tda:\t"$da
add=`expr $hra+$da|bc`
echo -e "\n\tadd:\t"$add
gpay=`expr $salary-$ded|bc`
echo -e "\n\tgpay:\t"$gpay
npay=`expr $gpay+$add|bc`
echo -e "\n\tnpay:\t"$npay
echo -e "\n\tafter calculation"
echo -e "\n\t*********************"
echo -e "\n\tname\t:$name\n\tid\t:$id\n\tnetpay\t:$npay"
echo -e "\n\t***********************"
fi
done































OUTPUT:

[@localhost ~]$ sh paybill.sh
        PAYBILL CALCULATION
        ~~~~~~~~~~~~~~~~~~~~
        enter the n value
2- INSERT --
        enter name id salary
rajasekar 324 100000
        before calculation
        ***********************
        name    :rajasekar
        id      :324
        salary  :100000
        ***********************
         calculation part

        lic:    5000.00

        pf:     3000.00

        ded:    8000.00

        hra:    3000.00

        da:     8000.00

        add:    11000.00

        gpay:   92000.00

        npay:   103000.00

        after calculation

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

        name    :rajasekar
        id      :324
        netpay  :103000.00


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

SHELL SCRIPT TO COMPARE TWO FILE

COMPARE TWO FILE:
cmp $1 $2
if [ $? -eq 0 ]
then
echo "Both files are EQUAL"
else
echo "Both files are NOTEQUAL"
fi























OUTPUT:

[@localhost ~]$ ls
acceptlogin.sh  current.sh     file1.sh     mark.sh  pol        totaldir.sh
add.sh          dcurrent.sh    file1.txt    new1.c   pol.sh     tri.sh
a.out           eletricity.sh  file2.txt    new1.sh  raj        userlog
big.sh          fact           fileper      new.c    raja.c     userlog.sh
big.shwq        fact.sh        fileper.sh   op.sh    series.sh  x.txt
com.sh          fib.sh         firstlet.sh  per.sh   subdir.sh  y.txt


[@localhost ~]$ sh com.sh fib.sh fact.sh
fib.sh fact.sh differ: byte 1, line 1
Both files are NOTEQUAL

[@localhost ~]$

SHELL SCRIPT FOR FIBONACCI SERIES

FIBNOCIS SERIES:

echo "Enter choice="
read n
fib1=0
fib2=1
echo "The series are=$fib1 $fib2"
for ((i=0; $i<$n; i=`expr $i + 1|bc`))
do
fib3=`expr $fib1 + $fib2 |bc`
fib1=$fib2
fib2=$fib3
echo "$fib3"
done
















OUTPUT:
 [@localhost ~]$ sh fib.sh
Enter choice=
10
The series are=0 1
1
2
3
5
8
13
21
34
55
89

[@localhost ~]$

SHELL SCRIPT TO FETCH FILES WHICH STARTS WITH ‘A’ IN THE CURRENT DIRECTORY

FILES WHICH STARTS WITH ‘A’ IN THE CURRENT DIRECTORY:



for i in *
do
  x=$(echo $i|cut -b 1)
  if [ $x = "a" ]
  then
    echo $i
  else
    continue
  fi
  done




















OUTPUT:

[@localhost ~]$ sh firstlet.sh a
acceptlogin.sh
add.sh

a.out

SHELL SCRIPT FOR ELECTRICITY BILL PREPARATION

ELECTRICITY BILL PREPARATION:


echo "enter the pmr cmr"
read  pmr cmr
echo "PreviousMonthReading: $pmr"
echo  "CurrentMonthReading: $cmr"
unit=`echo $cmr - $pmr |bc`
echo " unit  :  $unit"
if [ $unit -ge 200 ]
then
amt=`echo $unit \* 2.00 | bc`
else
 if [ $unit -lt 200 -a $unit -ge 100 ]
then
amt=`echo $unit \* 1.50 | bc`
 else
   amt=`echo $unit \* .50 | bc`
fi
fi
echo " Amount  : $amt"















OUTPUT:

[@localhost ~]$ sh eletricity.sh
enter the pvr cvr
700 950
PreviousMonthReading: 700
CurrentMonthReading: 950
 unit  :  250
 Amount  : 500.00

[@localhost ~]$

Monday, July 20, 2015

SHELL SCRIPT TO ACCEPT USERNAME AS COMMAND LINE ARGUMENTS AND CHECK THE USER LOGIN IN OR NOT

ACCEPT USERNAME AS COMMAND LINE ARGUMENTS  AND CHECK    THE USER LOGIN IN OR NOT

 echo "To check the user login or not"
if [ $# -eq 1 ]
then
who > y.txt
c=`grep -n $1 y.txt | wc -l`
fi
if [ $c -gt 0 ]
then
echo "The user has login"
else
echo "The user has not login"
fi





















OUTPUT:
 [@localhost ~]$ sh acceptlogin.sh 2k7ca320
To check the user login or not
The user has login
[@localhost ~]$ sh acceptlogin.sh 2k7ca337
To check the user login or not
The user has not login

[@localhost ~]$

SHELL SCRIPT TO CHECK HOW MANY TIMES THE SPECIFIC USER HAS LOGIN

CHECK HOW MANY TIMES THE SPECIFIC USER HAS LOGIN:

echo "To count the user login"
read username
who > x.txt
c=`grep $username x.txt | wc -l`
echo "The user has logged $c times"

































OUTPUT:
 [@localhost ~]$ sh userlog.sh
To count the user login
27324
The user has logged 1 times

[@localhost ~]$ 

Followers