Skip to main content

Posts

Showing posts from January, 2019

Java Socket Programming

To implement communication between Client and Server using the UDP protocol and datagrams

TServer
import java.net.*; import java.io.*; import java.util.*; public class TServer { public static void main(String[] args) throws Exception{ DatagramSocket ss = new DatagramSocket(1234); while(true){ System.out.println("Server is up...."); byte[] rd=new byte[100]; byte[] sd=new byte[100]; DatagramPacket rp = new DatagramPacket(rd,rd.length); ss.receive(rp); InetAddress ip= rp.getAddress(); int port=rp.getPort(); Date d=new Date(); // getting system time String time= d + ""; // converting it to String sd=time.getBytes(); // converting that String to byte System.out.println(port); System.out.println(ip); DatagramPacket sp=new DatagramPacket(sd,sd.length,ip,port); ss.send(sp); rp=null; System.out.println("Done !! "); } } }

TClient

import java.net.*; import java.io.*; public class TClient { public static void main(String[] args) throws Exception{ System.out.print…

How to Rename or change the Table Name

Rename Table is simple , so in this page i show you how to rename a table after creation.
so let's start

Answer:

A. SQL> STUD to Students; Table renamed. SQL> SELECT * FROM STUDENTS; ID    NAME          BRANCH ---------------------------------------------- 237   Bishakha     cse 224   Punam        cse 228   Owendrela  cse 212   Subham      cse 214   Shilpa         cse
6 rows selected.

How to Insert Record into Table

How to Insert Record into Table In the previous example i shown you how to create a table using Sql. in this page i will show you how to insert one value or more than one value in a table. let's start Answer: SQL> Insert into stud values(&id,'&name','&branch); Enter value for id: 237 Enter value for name: Bishakha Enter value for branch:cse old 1: insert into stud values(&id,'&name','&branch') new 1: insert into stud values(237,'Bishakha','cse')
Enter value for id: 224 Enter value for name: Punam Enter value for branch:cse old 1: insert into stud values(&id,'&name','&branch') new 1: insert into stud values(224,'Punam','cse')
1 row created. Enter value for id: 228 Enter value for name: Owendrela Enter value for branch:cse old 1: insert into stud values(&id,'&name','&branch') new 1: insert into stud values(228,'Owendrela','cse')
1 row create…

Create a Studetnt Table

Make a Student Table with certain  necessary data like student id, student name, Branch Name.
in this page i will show you how to create a simple table using SQl, So let's start Answer: SQL> create table stud < ID NUMBER, NAME VARCHAR2<20>, BRANCH VARCHAR2<20> >; Table created.
Output:

Create User Name and Password on SQL Server Database Using SQL Plus

Create User Name and Password on SQL Server Database Using SQL Plus SQL plus: Release 10.2.0.1.8 – Production on wed Feb 7 20:23:26 2018 Copyright <c> 1982. 2005, Oracle. All right reserved. Enter user-name: system Enter password:
Connected to: Oracle Database 10g Express Edition Release 10.2.0.1.0 – Production SQL> create user Subham identified by sql; User created. SQL> grant dba to Subham; Grant succeeded.
SQL> disconnected; Disconnected from Oracle Databse 10 g Express Edition Release 20.2.0.1.0 – Production SQL> connect; Enter user-name: Subham Enter password: Connected. SQL>

C Program Converts Temperature Celsius to Fahrenheit

Write a program to C Program Converts Temperature Celsius to Fahrenheit Code:  #include<stdio.h> void main(){ int cel,far; printf("enter temparature in celsius : "); scanf("%d", &cel); far=((1.8*cel) + 32); printf("farenhait temparature is : %d\n",far); }
Output:

C program Print Prime Number between 0 to 100

How to print prime number Between 0 to 100 Code: #include<stdio.h>
void main(){
int i,j;
for(i=2;i<100;i++){
for(j=2;j<=i;j++){
if(i==j)
printf("%d\n",i);
else if(i%j == 0)
break;
}
} }
Output: