URDINESH: 2015

Software Programming, Tutorials, Interview Preparations,Stock Market,BSE/NSE, General informations

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...

Sunday, August 2, 2015

COOL BUGS

MAGIC #1
An Indian found that nobody can create a FOLDER anywhere on
the Computer which can be named as "CON". This is
something funny and inexplicable? At Microsoft the whole
Team, couldn't answer why this happened!
TRY IT NOW, IT WILL NOT CREATE A "CON"
FOLDER

MAGIC #2
For those of you using Windows XP, do the following:
1.) Open an empty notepad file
2.) Type "Bush hid the facts" (without the
quotes)
3.) Save it as whatever you want.
4.) Close it, and re-open it?

Noticed the weird bug?
No one can explain!

MAGIC #3
Again this is something funny and can't be explained?
At Microsoft the whole Team, including Bill Gates,
couldn't answer why this happened!

It was discovered by a Brazilian. Try it out
yourself?

Open Microsoft Word and type

=rand (200, 99) or any double digit number(not very sure…88 works)

And then press ENTER
And see the
magic?..!

DO YOU REMEMBER THIS OR FORGOT?

I am sending this only to my smartest friends. I could figure out the answer, but a wrong one. My first thought was wrong and I had to look at the answer. See if you can figure out what these seven words all have in common!

1.  Banana
2.  Dresser
3.  Grammar
4.  Potato
5.  Revive
6.  Uneven
7.  Assess

Are you peeking or have you already given up?

Give it another try....
Look at each word carefully. You'll kick yourself when you discover the answer.  This is so cool.....
DON'T PEEK  !!!    TRY  HARDER !!!

No,  it is not that they all have at least 2 double letters.
 Let me know if you figured it out - I didn't!

SIGNATURE REFLECTS YOUR PERSONALITY....!


(Just for Reading Purpose(TIME PASS))
Types of Signatures.....



1 .) SINGLE UNDERLINE BELOW THE SIGN!!
These persons are very confident and are good personalities. They are
a little bit selfish but believe in "Happiness of human life".
********************************************************

2.) TWO DOTS BELOW THE SIGN !!
These persons are considered to be Romantic, can easily change their
fiancees as if they change their clothes. They prefer beauty in other
persons & they themselves try to look beautiful. They easily attract
others.
********************************************************

3.) SINGLE DOT BELOW THE SIGN !!
These persons are more inclined towards classical arts, simple & are
very cool. If you loose faith with them, then these persons will never
look back at you. Hence its always better to be careful with these
people.

******************************************************
4.) NO UNDERLINES OR DOTS BELOW THE SIGN !!
These persons enjoy their life in their own way, never pay attention
to others views. These are considered to be good nature but are
selfish too.
******************************************************


5.) RANDOM SIGN, NO SIMILARITY BETWEEN NAME & SIGN !!
These persons try to be very smart, hide each & every matter, never
say anything in straight forward manner, never pay attention to the
other person of what he is talking of.

*****************************************************
6.) RANDOM SIGN, SIMILARITY ¾TWEEN NAME & SIGN !!
These persons are considered to be intelligent but never think.
These people change their ideas & views as fast as the wind changes
its direction of flow. They never think whether that particular thing
is right or wrong. You can win them just by flattering them.

****************************************************
7.) SIGN IN PRINTED LETTERS !!
These persons are very kind to us, have a good heart, selfless, are
ready to sacrifice their life for the sake of their near & dear.

But they seem to think a lot and may get angry very soon.


***************************************************
8.) WRITING COMPLETE NAME AS THEIR SIGN !!
These persons are very kind hearted, can adjust themselves to any
environment & to the person they are talking. These persons are
very firm on their views & posses a lot of will power
****************************************************

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 ~]$

Followers