/*************Header File****************************/
#include<afxwin.h>
class CMyWnd : public CFrameWnd // My Window class
{
public:
CMyWnd();
afx_msg void OnTimer(UINT ID);
DECLARE_MESSAGE_MAP()
};
class CMyApp: public CWinApp // Application window class
{
public :
BOOL InitInstance(); // initinstace function with Boolian return type
};
/***************Source File**************************/
#include...
Friday, September 14, 2012
[C CODE] Process scheduling techniques
#include<stdio.h>
#include<stdlib.h>
#include<graphics.h>
#include<conio.h>
struct process
{
int pn,at,pt,tt,wt;
}p[20],tem[20],*q[20];
int i,j,k,choice,np,c=0;
int last=-1;
int processq[50],z;
char procg[50],z1;
void qinsert(struct process *a)
{
last=last+1;
q[last]=a;
}
void qdelete(void)
{
int l;
processq[z]=(*q[0]).pn;
z++;
for(l=0;l<last;l++)
q[l]=q[l+1];
...
[C CODE] Memory management techniques
#include<stdio.h>
#include<conio.h>
#include<process.h>
#include<alloc.h>
struct process
{
int size;
int hole;
}*p;
int *h,*tmp,hn,pn,i,j,k,rem,lh,sh;
//rem=0;
void input()
{
clrscr();
printf("Enter no of holes : ");
fflush(stdin);
scanf("%d",&hn);
h=(int *)malloc(sizeof(int)*hn);
for(i=0;i<hn;i++)
{
printf("size of hole %d : ",i+1);
fflush(stdin);
scanf("%d",&h[i]);
tmp[i]=h[i];
...
[shell script]Directory operations example
enter your choice
echo " 1. List of files & directories with permissions "
echo " 2. Create directory "
echo " 3. Remove directory "
echo " 4. Rename directory "
echo " 5. Go to directory "
echo " 6. Go out of directory "
read choice
case "$choice" in
1)ls -l;;
2) echo "Enter the name :"
read name
if [ -d $name ]
then
echo "directory is exist"
else
mkdir $name
echo "directory '$name' has been created"
...
DBMS using shell script
if [ ! -f dbms ]
then
touch dbms
fi
while [ 1 ]
do
echo " "
echo " "
echo " "
echo " The database management system operations : "
echo " 1.For inserting data into the file "
echo " 2.View all record of file "
echo " 3.For searching the data from the file "
echo " 4.For sorting the data of file "
echo " 5.For modifying the data into the file "
echo " 6.For Delete the record "
echo " 7.For Exit "
echo " Enter your choice : "
read choice
clear
case $choice in
1)echo " Enter...
shell script to find prime number
echo "Enter the limit : "
read no
i=2
while [ $i -le $no ]
do
j=1
flag=0
while [ $j -le $i ]
do
m=`expr $i % $j`
if [ $m -eq 0 ]
then
flag=`expr $flag + 1`
if [ $flag -gt 2 ]
then
break
fi
fi
j=`expr $j + 1`
done
if [ $flag -eq 2 ]
then
echo $i
fi
i=`expr $i + 1`
done
.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, "Courier New", courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre...
Head-Tail command example [shell script]
if [ $# -ne 2 ]
then
echo " invalid argument "
exit
fi
if [ ! -e $1 ]
then
echo "invalid file name "
exit
fi
echo " 1. head "
echo " 2. tail "
read ch
case "$ch" in
1)exec < $1
i=1
while [ $i -le $2 ]
do
read l
echo $l
i=`expr $i + 1`
done ;;
2)exec < $1
i=1
while read l
do
i=`expr $i + 1`
done
j=`expr $i - $2`
k=1
exec < $1
while [ $k -lt $j ]
do
read l
k=`expr $k + 1`
done
while read l
do
echo $l
done ;;
*) echo...
Fibonacci series using shell script
echo Enter the number
read n
i=0
b=1
a=0
echo " The fibonaci series is :"
while [ $i -lt $n ]
do
echo $b
b=`expr $a + $b`
a=`expr $b - $a`
i=`expr $i + 1`
done
.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, "Courier New", courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode...
date command shell script
if [ `date +%H` -lt 12 ]
then
echo "Good Morning"
elif [ `date +%H` -lt 16 ]
then
echo "Good After Noon"
else
echo "Good evening"
fi
.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, "Courier New", courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode...
File comparison using shell script
if [ $# -ne 2 ]
then
echo " invalid argument "
fi
if [ ! -f $1 ]
then
echo "file $1 is not exist "
fi
if [ ! -f $2 ]
then
echo " file $2 is not exist "
fi
if cmp $1 $2 >> \dev\null
then
echo " The files are same"
tac $1 > $2
rev $2 > $1
rm $2
echo The content of file $1 is :
cat $1
else
echo " The files are not identical "
fi
.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, "Courier New", courier, monospace;
background-color:...
Simple calculator using shell script
echo Enter The Two Numbers
read a
read b
echo enter operation
read op
ans1=`echo scale=2";" $a "$op" $b | bc`
echo the answer is $ans1
.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, "Courier New", courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color:...
Thursday, September 13, 2012
[MATLAB] High pass filter using Fourier transformation
B=imread('lenna.jpg');
A=double(rgb2gray(B));
subplot(1,2,1);
imshow(A,[]);
title('Original Image');
%imshow(C,[]);
[m n]=size(A);
F=zeros(m,n,'double');
F=A;
C=fft2(A);
D=fftshift(C);
%imshow(uint8(C));
%[th r]=cart2pol(real(C),imag(C));
limit=15;
for u=1:m
for v=1:n
D1(u,v)=sqrt(((u-(m/2))^2)+((v-(n/2))^2));
if D1(u,v)>=limit
H=1;
else
H=0;
end
I1(u,v)=H*D(u,v);
end
end
% F1=ifft2(I1);
F1=ifftshift(I1);
...
[MATLAB] Low pass filter using Fourier transformation
B=imread('lenna.jpg');
A=double(rgb2gray(B));
subplot(1,2,1);
imshow(A,[]);
title('Original Image');
%imshow(C,[]);
[m n]=size(A);
F=zeros(m,n,'double');
F=A;
C=fft2(A);
D=fftshift(C);
%imshow(uint8(C));
%[th r]=cart2pol(real(C),imag(C));
limit=15;
for u=1:m
for v=1:n
D1(u,v)=sqrt(((u-(m/2))^2)+((v-(n/2))^2));
if D1(u,v)<=limit
H=1;
else
H=0;
end
I1(u,v)=H*D(u,v);
end
end
% F1=ifft2(I1);
F1=ifftshift(I1);
...
Leach protocol tcl script NS2 simulation
# Copyright (c) 1997 Regents of the University of California.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials...
Technical aptitude paper[Sample]
1. If you are using C language to implement the heterogeneous linked list, what pointer type
will you use?
2. Minimum number of queues needed to implement the priority queue?
3. What is the type of the algorithm used in solving the 8 Queens problem?
4. In RDBMS, what is the efficient data structure used in the internal storage representation?
5. What are the two classes of hardware building blocks?
6. Expand IDEA.
7. What is wide-mouth frog?
8. What are the typical elements of a process image?
9. What are the key object oriented concepts...
Download NCERT Books for free
There is a portal which provides you all versions(Hindi,English and Urdu) of NCERT books of all standards and available free for download as PDF.
Link:
http://ncertbooks.prashanthellina.co...
[LINUX]Sample code of Makefile
all: cal
lex.yy.c: cal1.l y.tab.h
lex -ll cal1.l
lex.yy.o: lex.yy.c
gcc -c lex.yy.c
y.tab.c: cal1.y
yacc -d cal1.y
y.tab.o: y.tab.c
gcc -c y.tab.c
cal: lex.yy.o y.tab.o
gcc -o temp lex.yy.o y.tab.o -ll -ly
y.tab.h: cal1.y
yacc -d cal1.y...
[MATLAB] pseudo ternary technique using simulink
close all;
clear all;
d=[1,0,1,1,0];
p=-2;
for i=1:length(d)
if i>1
if d(i)==0
p=-p;
a(i)=p;
else
a(i)=0;
end
else
if d(i)==0
p=2;
a(i)=p;
else
a(i)=0;
end
...
[MATLAB] NRZ-L technique using simulink
close all;
clear all;
d=[1,0,1,1,0];
for i=1:length(d)
if d(i)==1
a(i)=-2;
else
a(i)=2;
end
hold on;
for j=i:0.01:i+1
plot(j,a(i),'.-r');
end
grid on;
en...
[MATLAB] NRZ-I technique using simulink
close all;
clear all;
d=[1,0,1,1,0];
for i=1:length(d)
if i>1
if d(i)==1
a(i)=-a(i-1);
else
a(i)=a(i-1);
end
else
if d(i)==1
a(i)=-2;
else
a(i)=2;
end
end
hold on;
for j=i:0.01:i+1
...
Wednesday, September 12, 2012
[MATLAB]Manchester technique using simulink
close all;
clear all;
d=[1,0,1,1,0];
for i=1:length(d)
if d(i)==1
a(i)=-2;
b(i)=2;
else
a(i)=2;
b(i)=-2;
end
hold on;
for j=i:0.01:i+0.5
plot(j,a(i),'.-r');
end
for j=i+0.5:0.01:i+1
plot(j,b(i),'.-r');
end
grid on;
en...
[MATLAB] Differential Manchester technique using simulink
close all;
clear all;
d=[1,0,1,1,0];
for i=1:length(d)
if i>1
if d(i)==1
a(i)=b(i-1);
b(i)=a(i-1);
else
a(i)=a(i-1);
b(i)=b(i-1);
end
else
if d(i)==1
a(i)=2;
b(i)=-2;
else
...
[MATLAB]NRZ technique using simulink
close all;
clear all;
d=[1,0,1,1,0];
for i=1:length(d)
if d(i)==1
a(i)=2;
else
a(i)=0;
end
hold on;
for j=i:0.01:i+1
plot(j,a(i),'.-r');
end
grid on;
en...
Implementation of circular queue in C/C++
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
#include<iostream.h>
struct node
{
int info;
struct node* link;
};
struct node *last=0;
void main()
{
struct node*first=0;
int n;
clrscr();
struct node* add_first(struct node*);
struct node* add_last(struct node*);
struct node* del_first(struct node*);
struct node* del_last(struct node*);
void traverse(struct node*);
cout<<" \n 1.add at first ";
cout<<" \n 2.add at last...
Subscribe to:
Posts (Atom)