1. Go Back N Sender: import java.io.*; import java.net.*; import java.lang.*; public class gbnsend { public static void main(String args[]) { int serverport=3333; String address="127.0.0.2"; try { InetAddress ipaddress=InetAddress.getByName(address); Socket socket=new Socket(ipaddress,serverport); InputStream sin=socket.getInputStream(); OutputStream sout=socket.getOutputStream(); DataInputStream in=new DataInputStream(sin); DataOutputStream out=new DataOutputStream(sout); BufferedReader keyboard=new BufferedReader(new InputStreamReader(System.in)); String line=null; String word []=new String [8]; int i; System.out.println("plz input the no of frames to b sent"); int n=Integer.parseInt(keyboard.readLine()); for(i=0;i<n;i++) { word[i]=keyboard.readLine(); } i=0; while(i<n) { System.out.println("sending frame "+word[i]); out.writeUTF(word[i]); out.flush(); i++; } try { Thread.sleep(1000); } catch(InterruptedException e) { e.printStackTrace(); } line=in.readUTF(); System.out.println("nack received for...
Thursday, 31 March 2011
Tuesday, 29 March 2011
Tagged under: Infix to postfix
Infix to Postfix Conversion
Following is the java code for converting from infix to postfix: // To convert Infix into Postfix import java.io.*; class infix2 { public static void main(String args[]) throws IOException { check obj=new check(); String str = new String(); char infix[]=new char[15]; char postfix[]=new char[15]; char stack[]=new char[15]; int len=0,i=0,j=0,top=-1,value; BufferedReader b=new BufferedReader(new InputStreamReader(System.in)); System.out.println("Enter Expression ==> "); str=b.readLine(); len=str.length(); infix=str.toCharArray(); for(i=0;i<=len-1;i++) { int t=obj.isoperand(infix[i]); if(t==1) { postfix[j]=infix[i]; j++; } else if(top==-1) { top++; stack[top]=infix[i]; } else if(infix[i]==')') { while(stack[top]!='(') { postfix[j]=stack[top]; top--; j++; } top--; } else if(obj.priority(infix[i])>obj.priority(stack[top])) { top++; stack[top]=infix[i]; } else...
Saturday, 26 March 2011
Tagged under: TE VI SEM
Packet Sniffer
ACN Packet Sniffer Our sir told to use some packetsniffer other than Wireshark or Colasoft. So I used Smartsniff. Click the link below for snapshots SmartSniff For snapshots of Wireshark click the link below Wireshark (function(w) { if (!w.SharexyWidget) { w.SharexyWidget = {};} if (!w.SharexyWidget.Params) { w.SharexyWidget.Params = {}; } w.SharexyWidget.Params['980623'] = {'code_id':'980623','publisher_key':'undefined','design':'sharexy','layout_static':'h','type':'st','mode_float':'','size_float':'60','size_static':'32','buzz':'0','services':['facebook', 'twitter', 'linkedin', 'google_plus', 'blogger'],'url':'current','allways_show_ads':'0','show_ads_sharing':'0','show_ads_cursor':'0','bg_float':'0','bg_color':'#f1f1f1','labels':'0','counters':'0', 'counters_float':'0'} })(window); ...
Tagged under: Apriori Algorithm, TE VI SEM
Apriori Algorihm
Apriori Algorithm: #include<stdio.h> #include<conio.h> int item[5][5]={{1,3,4,6},{2,3,5,7},{1,2,3,5,8},{2,5,9,10},{1,4}}; int fn(int a,int b); int main() { int tid[5]={1,2,3,4,5} ,i,j,ms,k,count[11]={0}; int p,a,b,c; printf("\n\tTrans_id\t\tItems\n\n"); for(i=0;i<5;i++) { printf("\t%d \t\t\t",tid[i]); for(j=0;j<5;j++) { if(item[i][j]!=0) printf("%d",item[i][j]); } printf("\n"); } printf("\n Assume minimum support:"); scanf("%d",&ms); for(k=1;k<=10;k++) { for(i=0;i<5;i++) for(j=0;j<5;j++) if(item[i][j]==k&&item[i][j]!=0) count[k]++; } printf("\nGenerating c1 from the data"); for(k=1;k<=10;k++) printf("\n\t\t%d\t\t%d",k,count[k]); for(k=1;k<=10;k++) { if(count[k]<ms) count[k]=0; } printf("\nGenerating l1 from c1"); for(k=1;k<=10;k++) { a=2; if(count[k]!=0) printf("\n\t\t%d\t\t%d",k,count[k]); } printf("\nGenerating l2 from c2"); p=2; b=3; for(i=1;i<4;i++) { for(j=p++;j<=5;j++) { if(fn(i,j)>=ms) printf("\n\t\t%d%d\t\t%d",i,j,fn(i,j)); c=5; } } printf("\n\t\tGenerating l3"); printf("\n\n\t\t\t\t%d %d %d",a,b,c); getch(); return 0; } int fn(int a,int b) {...
Tagged under: computer graphics, SE IV Sem
Computer Graphics programs in C++
The term computer graphics includes almost everything on computers that is not text or sound. Today almost every computer can do some graphics, and people have even come to expect to control their computer through icons and pictures rather than just by typing. Here in our lab at the Program of Computer Graphics, we think of computer graphics as drawing pictures on computers, also called rendering. The pictures can be photographs, drawings, movies, or simulations -- pictures of things which do not yet exist and maybe could never exist. Or they may be pictures from places...
Tagged under: jigzaw puzzle code, Source codes
Jigsaw puzzle
Jigsaw puzzle html Download the Jigzaw puzzle from the download box alongside. (function(w) { if (!w.SharexyWidget) { w.SharexyWidget = {};} if (!w.SharexyWidget.Params) { w.SharexyWidget.Params = {}; } w.SharexyWidget.Params['980623'] = {'code_id':'980623','publisher_key':'undefined','design':'sharexy','layout_static':'h','type':'st','mode_float':'','size_float':'60','size_static':'32','buzz':'0','services':['facebook', 'twitter', 'linkedin', 'google_plus', 'blogger'],'url':'current','allways_show_ads':'0','show_ads_sharing':'0','show_ads_cursor':'0','bg_float':'0','bg_color':'#f1f1f1','labels':'0','counters':'0', 'counters_float':'0'} })(window); ...
Tagged under: Economic Crisis 2008, Seminar
Economic Crisis 2008 Seminar Presentation
This is the Seminar Presentation that we prepared for the Economic Crisis that started in 2008 Economic Crisis 2008 (function(w) { if (!w.SharexyWidget) { w.SharexyWidget = {};} if (!w.SharexyWidget.Params) { w.SharexyWidget.Params = {}; } w.SharexyWidget.Params['980623'] = {'code_id':'980623','publisher_key':'undefined','design':'sharexy','layout_static':'h','type':'st','mode_float':'','size_float':'60','size_static':'32','buzz':'0','services':['facebook', 'twitter', 'linkedin', 'google_plus', 'blogger'],'url':'current','allways_show_ads':'0','show_ads_sharing':'0','show_ads_cursor':'0','bg_float':'0','bg_color':'#f1f1f1','labels':'0','counters':'0', 'counters_float':'0'} })(window); ...
Tagged under: Source codes, Sudoku puzzle code
Sudoku puzzle in javascript
Download the Code for Sudoku puzzle for 3X3, 6X6, & 9X9 from the download box alongside. (function(w) { if (!w.SharexyWidget) { w.SharexyWidget = {};} if (!w.SharexyWidget.Params) { w.SharexyWidget.Params = {}; } w.SharexyWidget.Params['980623'] = {'code_id':'980623','publisher_key':'undefined','design':'sharexy','layout_static':'h','type':'st','mode_float':'','size_float':'60','size_static':'32','buzz':'0','services':['facebook', 'twitter', 'linkedin', 'google_plus', 'blogger'],'url':'current','allways_show_ads':'0','show_ads_sharing':'0','show_ads_cursor':'0','bg_float':'0','bg_color':'#f1f1f1','labels':'0','counters':'0', 'counters_float':'0'} })(window); ...
Tagged under: screen saver c++ code, SE IV Sem, Source codes
Computer Graphics mini project/ Screen Saver code
1. Car Screensaver: /******************************************************************* Program : Screensaver: Moving car ********************************************************************/ #include<iostream.h> #include"conio.h" #include<math.h> #include"stdlib.h" #include"dos.h" #include"graphics.h" #define DELAY 1 #define SOUND 3500 void state(int x,int y,int mode); int area,area1; void *ptr1,*ptr2,*burst; void BF(int,int,int,int); void circ_bre(int x,int y,int rad); void draw_burst ( int x, int y,int ); void display(int,int,int,int); void dda(int x1,int y1,int x2,int y2); int COND(int x,int y) { if (x>20 && x<getmaxx()-20 && y>20 && y<getmaxy()-20) return 1; else return 0; } void state(int x,int y,int mode) { while(COND(x,y)&&!kbhit()) { if(x==300&&y==230) { putimage(350,230,burst,COPY_PUT); sound(SOUND); delay(100); cleardevice(); state(30,30,0); } switch(mode) { case 0:...
Tagged under: TE VI SEM, wireshark
Packet garbage and analysis using Wireshark
On the Internet, packet filtering is the process of passing or blocking packets at a network interface based on source and destination addresses, ports, or protocols. The process is used in conjunction with packet mangling and Network Address Translation (NAT). Packet filtering is often part of a firewall program for protecting a local network from unwanted intrusion. In a software firewall, packet filtering is done by a program called a packet filter. The packet filter examines the header of each packet based on a specific set of rules, and on that basis, decides...
Friday, 25 March 2011
Tagged under:
Optimism Vs Pessimism
Is Your Glass Half Full or Half Empty?Are you a glass half full or a glass half empty kind of person? Does it really make a difference? I think it makes a huge difference in the quality of your life. Both optimists and pessimists contribute to our society. The optimist invents the airplane and the pessimist the parachute. Two men look out through the same bars: One sees the mud, & one the stars.Optimism can lead to accomplishment. If you think something is possible, you will generally work harder to achieve it. Believing...
Subscribe to:
Posts (Atom)