Example of command line argument in C on Linux
args.c
#include "stdio.h"
void main(int c, char *argv[])
{
int i;
for(i=0;i<c;i++)
{
printf("\nargument[%d] : %s",i,argv[i]);
}
}
void main(int c, char *argv[])
{
int i;
for(i=0;i<c;i++)
{
printf("\nargument[%d] : %s",i,argv[i]);
}
}
Example of command line argument in Java
args.java
public class args
{
public static void main(String args[])
{
for(int i=0;i<args.length;i++)
{
System.out.println("argument[ "+i+" ] : "+args[i]);
}
}
}
{
public static void main(String args[])
{
for(int i=0;i<args.length;i++)
{
System.out.println("argument[ "+i+" ] : "+args[i]);
}
}
}
Labels:
JAVA
|
0
comments
AES with CBC mode example in Java
AESCBC.java
package bsr;
import java.security.*;
import javax.crypto.*;
import javax.crypto.spec.*;
class AESCBC
{
public KeyGenerator keygenerator;
public SecretKey myDesKey;
Cipher c;
public IvParameterSpec iv;
public AESCBC() throws Exception
{
import java.security.*;
import javax.crypto.*;
import javax.crypto.spec.*;
class AESCBC
{
public KeyGenerator keygenerator;
public SecretKey myDesKey;
Cipher c;
public IvParameterSpec iv;
public AESCBC() throws Exception
{
AES with CFM mode example in Java
AESCFM.java
package bsr;
import java.security.*;
import javax.crypto.*;
import javax.crypto.spec.*;
class AESCFM
{
public KeyGenerator keygenerator;
public SecretKey myDesKey;
Cipher c;
public IvParameterSpec iv;
public AESCFM() throws Exception
{
import java.security.*;
import javax.crypto.*;
import javax.crypto.spec.*;
class AESCFM
{
public KeyGenerator keygenerator;
public SecretKey myDesKey;
Cipher c;
public IvParameterSpec iv;
public AESCFM() throws Exception
{
AES with ECB mode example in Java
AESECB.java
package bsr;
import java.security.*;
import javax.crypto.*;
import javax.crypto.spec.*;
class AESECB
{
public KeyGenerator keygenerator;
public SecretKey myDesKey;
Cipher c;
public AESECB() throws Exception
{
import java.security.*;
import javax.crypto.*;
import javax.crypto.spec.*;
class AESECB
{
public KeyGenerator keygenerator;
public SecretKey myDesKey;
Cipher c;
public AESECB() throws Exception
{
3DES with CFM mode example in Java
D3ESCFM.java
package bsr;
import java.security.*;
import javax.crypto.*;
import javax.crypto.spec.*;
class D3ESCFM
{
public KeyGenerator keygenerator;
public SecretKey myDesKey;
Cipher c;
public IvParameterSpec iv;
public D3ESCFM() throws Exception
{
import java.security.*;
import javax.crypto.*;
import javax.crypto.spec.*;
class D3ESCFM
{
public KeyGenerator keygenerator;
public SecretKey myDesKey;
Cipher c;
public IvParameterSpec iv;
public D3ESCFM() throws Exception
{
3DES with CBC mode example in Java
D3ESCBC.java
package bsr;
import java.security.*;
import javax.crypto.*;
import javax.crypto.spec.*;
class D3ESCBC
{
public KeyGenerator keygenerator;
public SecretKey myDesKey;
Cipher c;
public IvParameterSpec iv;
public D3ESCBC() throws Exception
{
import java.security.*;
import javax.crypto.*;
import javax.crypto.spec.*;
class D3ESCBC
{
public KeyGenerator keygenerator;
public SecretKey myDesKey;
Cipher c;
public IvParameterSpec iv;
public D3ESCBC() throws Exception
{
3DES with ECB mode example in Java
D3ESECB.java
package bsr;
import java.security.*;
import javax.crypto.*;
import javax.crypto.spec.*;
class D3ESECB
{
public KeyGenerator keygenerator;
public SecretKey myDesKey;
Cipher c;
public D3ESECB() throws Exception
{
// Genrate the Key
keygenerator = KeyGenerator.getInstance("DESede");
myDesKey = keygenerator.generateKey();
RSA Encryption Example in Java
RSA.java
import java.security.*;
import javax.crypto.*;
import javax.crypto.spec.*;
class RSA
{
public KeyPairGenerator keygenerator;
public KeyPair myKey;
Cipher c;
public RSA() throws Exception
{
// Genrate the Key
keygenerator = KeyPairGenerator.getInstance("RSA");
keygenerator.initialize(1024) ;
myKey = keygenerator.generateKeyPair();
import javax.crypto.*;
import javax.crypto.spec.*;
class RSA
{
public KeyPairGenerator keygenerator;
public KeyPair myKey;
Cipher c;
public RSA() throws Exception
{
// Genrate the Key
keygenerator = KeyPairGenerator.getInstance("RSA");
keygenerator.initialize(1024) ;
myKey = keygenerator.generateKeyPair();
JSP JDBC Example
Develop a JSP Page to perform database driven operations like insert, Delete, Update and selection with table named Student having fields like StudId, Name, Address, result.
Create Table in Oracle / MySQL [ student ]
CREATE TABLE student (
StudId NUMBER( 4 ) NOT NULL ,
Name VARCHAR( 15 ) NOT NULL ,
Address VARCHAR( 20 ) NOT NULL ,
result NUMBER( 8 ) NOT NULL
)
StudId NUMBER( 4 ) NOT NULL ,
Name VARCHAR( 15 ) NOT NULL ,
Address VARCHAR( 20 ) NOT NULL ,
result NUMBER( 8 ) NOT NULL
)
example of preparedstatement in java
Create Table in MySql [ Employee ]
CREATE TABLE `wtad`.`Employee` (
`EmpId` INT( 4 ) NOT NULL ,
`Empname` VARCHAR( 15 ) NOT NULL ,
`Emp_desig` VARCHAR( 20 ) NOT NULL ,
`Emp_J_Date` VARCHAR( 20 ) NOT NULL ,
`Emp_Salary` INT( 8 ) NOT NULL
) ENGINE = MYISAM ;
Create Table in Oracle [ Employee ]
example of page directive in jsp
index.jsp
<html>
<head>
<title>EX-35</title>
</head>
<body>
<%@ page language="java" %>
<%@ page info="A code from www.BipinRupadiya.com" %>
<ul>
<li><a href="import.jsp">Example of page directive import </a></li>
<li><a href="isThreadsafe.jsp">Example of page directive isThreadsafe </a></li>
<li><a href="jsp-forward.jsp">Example of page directive jsp-forward </a></li>
<li><a href="contentType.jsp">Example of page directive contentType </a></li>
<li><a href="errorPage.jsp">Example of page directive isErrorPage and errorPage </a></li>
</ul>
<body>
</html>
<head>
<title>EX-35</title>
</head>
<body>
<%@ page language="java" %>
<%@ page info="A code from www.BipinRupadiya.com" %>
<ul>
<li><a href="import.jsp">Example of page directive import </a></li>
<li><a href="isThreadsafe.jsp">Example of page directive isThreadsafe </a></li>
<li><a href="jsp-forward.jsp">Example of page directive jsp-forward </a></li>
<li><a href="contentType.jsp">Example of page directive contentType </a></li>
<li><a href="errorPage.jsp">Example of page directive isErrorPage and errorPage </a></li>
</ul>
<body>
</html>
example of jsp scripting elements
index.jsp
<html>
<head>
<title>EX-36</title>
</head>
<body>
<!-- Declaration -->
<%!
int i=0;
int n=10;
int ans=0;
%>
<head>
<title>EX-36</title>
</head>
<body>
<!-- Declaration -->
<%!
int i=0;
int n=10;
int ans=0;
%>
Example of requestdispatcher
index.jsp
<html>
<head>
<title>MySqlLogin</title>
<style>
.abc
{
background:#ababff;
position:absolute;
top:2in;
hieght:200px;
width:300px;
left:5in;
border-style:solid;
}
</style>
</head>
<head>
<title>MySqlLogin</title>
<style>
.abc
{
background:#ababff;
position:absolute;
top:2in;
hieght:200px;
width:300px;
left:5in;
border-style:solid;
}
</style>
</head>
JSTL standard tag library Example
index.jsp
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<HTML>
<HEAD>
<TITLE>WTAD: Ex31 : www.BipinRupadiya.com</TITLE>
</HEAD>
<BODY>
<h3>Example of JSTL standard tag library.</h3>
<ul>
<li><a href="set.jsp">set, remove and out</a></li>
<!-- Example of c:for -->
<li><a href="for.jsp">for</a></li>
<!-- Example of c:if -->
<li><a href="if.jsp">if</a></li>
<!-- Example of c:choose -->
<li><a href="choose.jsp">choose</a></li>
<!-- Example of c:redirect and c:param -->
<li><a href="redirect.jsp">redirect</a></li>
</ul>
</BODY>
</HTML>
<HTML>
<HEAD>
<TITLE>WTAD: Ex31 : www.BipinRupadiya.com</TITLE>
</HEAD>
<BODY>
<h3>Example of JSTL standard tag library.</h3>
<ul>
<li><a href="set.jsp">set, remove and out</a></li>
<!-- Example of c:for -->
<li><a href="for.jsp">for</a></li>
<!-- Example of c:if -->
<li><a href="if.jsp">if</a></li>
<!-- Example of c:choose -->
<li><a href="choose.jsp">choose</a></li>
<!-- Example of c:redirect and c:param -->
<li><a href="redirect.jsp">redirect</a></li>
</ul>
</BODY>
</HTML>
DES with CBC mode example in Java
DESCBC.java
class DESCBC
{
public KeyGenerator keygenerator;
public SecretKey myDesKey;
Cipher c;
public IvParameterSpec iv;
public DESCBC() throws Exception
{
// Genrate the Key
keygenerator = KeyGenerator.getInstance("DES");
keygenerator.init(new SecureRandom());
myDesKey = keygenerator.generateKey();
{
public KeyGenerator keygenerator;
public SecretKey myDesKey;
Cipher c;
public IvParameterSpec iv;
public DESCBC() throws Exception
{
// Genrate the Key
keygenerator = KeyGenerator.getInstance("DES");
keygenerator.init(new SecureRandom());
myDesKey = keygenerator.generateKey();
DES with CFM mode example in Java
DESCFM.java
class DESCFM
{
public KeyGenerator keygenerator;
public SecretKey myDesKey;
Cipher c;
public IvParameterSpec iv;
public DESCFM() throws Exception
{
// Genrate the Key
keygenerator = KeyGenerator.getInstance("DES");
keygenerator.init(new SecureRandom());
myDesKey = keygenerator.generateKey();
{
public KeyGenerator keygenerator;
public SecretKey myDesKey;
Cipher c;
public IvParameterSpec iv;
public DESCFM() throws Exception
{
// Genrate the Key
keygenerator = KeyGenerator.getInstance("DES");
keygenerator.init(new SecureRandom());
myDesKey = keygenerator.generateKey();
DES with ECB mode example in Java
DESECB.java
import bsr.*;
import java.security.*;
import javax.crypto.*;
import javax.crypto.spec.*;
/*A code from www.bipinrupadiya.com*/
class DESECB
{
public KeyGenerator keygenerator;
public SecretKey myDesKey;
Cipher c;
import java.security.*;
import javax.crypto.*;
import javax.crypto.spec.*;
/*A code from www.bipinrupadiya.com*/
class DESECB
{
public KeyGenerator keygenerator;
public SecretKey myDesKey;
Cipher c;
One Time Pad Encryption Example using Java code
Write a programs to simulate encryption and decryption technique using One Time Pad, algorithm development and Communication between client and server should be done using Java server socket programming.
OneTimePad.java
package bsr;
import java.util.*;
import java.net.*;
import java.io.*;
/*A code from www.bipinrupadiya.com*/
public class OneTimePad
{
public String doEncryption(String s)
{
int i,j;
import java.util.*;
import java.net.*;
import java.io.*;
/*A code from www.bipinrupadiya.com*/
public class OneTimePad
{
public String doEncryption(String s)
{
int i,j;
S-Box Example using Java
Write a programs to simulate encryption and decryption technique using S-Box, algorithm development and Communication between client and server will be done using Java server socket programming.
SBOX.java
package bsr;
import java.util.*;
import java.net.*;
import java.io.*;
/*A code from www.bipinrupadiya.com*/
public class SBOX
{
public String doEncryption(String s)// throws Exception
{
int i,temp;
import java.util.*;
import java.net.*;
import java.io.*;
/*A code from www.bipinrupadiya.com*/
public class SBOX
{
public String doEncryption(String s)// throws Exception
{
int i,temp;
P-Box Example using Java
Write a programs to simulate encryption and decryption technique using P-Box, algorithm development and Communication between client and server will be done using Java server socket programming.
P-Box.java
package bsr;
import java.util.*;
import java.net.*;
import java.io.*;
/*A code from www.bipinrupadiya.com*/
public class PBOX
{
public String doEncryption(String s)
{
int i,temp;
import java.util.*;
import java.net.*;
import java.io.*;
/*A code from www.bipinrupadiya.com*/
public class PBOX
{
public String doEncryption(String s)
{
int i,temp;
Transposition cipher example using Java
Write a programs to simulate encryption and decryption technique using Transposition (Columnar) Cipher, algorithm development and Communication between client and server will be done using Java server socket programming.
TranspositionCipher.java
package bsr;
import java.util.*;
import java.net.*;
import java.io.*;
/*A code from www.bipinrupadiya.com*/
public class TranspositionCipher
{
public String selectedKey;
public char sortedKey[];
public int sortedKeyPos[];
import java.util.*;
import java.net.*;
import java.io.*;
/*A code from www.bipinrupadiya.com*/
public class TranspositionCipher
{
public String selectedKey;
public char sortedKey[];
public int sortedKeyPos[];
Mono-alphabetic Substitution Cipher example using Java
Write a programs to simulate encryption and decryption technique using Mono-alphabetic Substitution Cipher, algorithm development and Communication between client and server will be done using Java server socket programming.
MonoAlphabeticSubstitutionCipher.java
package bsr;
import java.util.*;
import java.net.*;
import java.io.*;
/*A code from www.bipinrupadiya.com*/
public class MonoAlphabeticSubstitutionCipher
{
public char p[] = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
public char ch[] = {'Q','W','E','R','T','Y','U','I','O','P','A','S','D','F','G','H','J','K','L','Z','X','C','V','B','N','M'};
public String doEncryption(String s)
{
import java.util.*;
import java.net.*;
import java.io.*;
/*A code from www.bipinrupadiya.com*/
public class MonoAlphabeticSubstitutionCipher
{
public char p[] = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
public char ch[] = {'Q','W','E','R','T','Y','U','I','O','P','A','S','D','F','G','H','J','K','L','Z','X','C','V','B','N','M'};
public String doEncryption(String s)
{
Generalized Caesar Cipher example using java
Write a programs to simulate encryption and decryption using Caesar Cipher. algorithm development and Communication between client and server is done using Java socket programming.
CaesarCipher.java
package bsr;
import java.util.*;
import java.net.*;
import java.io.*;
/*A code from www.bipinrupadiya.com*/
public class CaesarCipher
{
char a[] = {'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z', 'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
int key=3;
import java.util.*;
import java.net.*;
import java.io.*;
/*A code from www.bipinrupadiya.com*/
public class CaesarCipher
{
char a[] = {'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z', 'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
int key=3;
java socket programming example
In the era of network programming means write such a script
that can be executed on multiple computers / platform. In J2SE, a package
java.net provide the number of API that can be used to write code for the
communication between multiple computers / platforms. The java.net package of
J2SE provide the sport for two important protocol of the network that is TCP
and UDP.
The Socket in java provide the way of communication between
two or more computers using Transmission Control Protocol (TCP). Here we have socket on
both side at Client as well as server. A client socket try to communicate to
server socket. If everything is fine server accept the connection and
communication process begin.
Here I am going to demonstrate a simple example of server socket programming. I have created a java package bsr and my class that have the definition of socket MySocket.java is placed inside this package.
I have also created two more class to simulate the behavior of client and server namely sender and receiver. I used plain text editor to create my script.
Subscribe to:
Posts (Atom)
Subjects
- WordPress
- Mobile Computing-4649303 Practical Solution
- Android Programming New Syllabus Theory
- PHP LAMP Question Bank
- PHP LAMP Theory
- Step by Step Android Example
- Android Practical
- Android Theory
- Android Question Bank
- Networking FON Practical
- Networking FON Theory
- OS Practical
- OS Theory
- HTML
- JavaScript
- J2EE WTAD Theory
- J2EE WTAD Question Bank
- J2EE WTAD Quick Guide
- J2EE WTAD GTU Papers
- J2EE WTAD Practical
- Python
- JAVA Theory
- JAVA Practical
- MIS
Categories
- Android (55)
- c (11)
- Configure Tomcat7 (2)
- CSS (3)
- Decryption (16)
- Difference (1)
- Encryption (16)
- Error Detection and Correction Techniques (3)
- FON (27)
- Framing Technic (2)
- install Tomcat (2)
- J2EE (29)
- JAVA (13)
- JavaScript (19)
- linux (8)
- OS (17)
- PHP (11)
- Protocol (3)
- SERVER SOCKET PROGRAMING (7)
- Servlet (13)
- shell script (33)
- unix (22)
- WTAD (34)
Blog Archive
-
▼
2013
(64)
-
▼
June
(25)
- Example of command line argument in C on Linux
- Example of command line argument in Java
- AES with CBC mode example in Java
- AES with CFM mode example in Java
- AES with ECB mode example in Java
- 3DES with CFM mode example in Java
- 3DES with CBC mode example in Java
- 3DES with ECB mode example in Java
- RSA Encryption Example in Java
- JSP JDBC Example
- example of preparedstatement in java
- example of page directive in jsp
- example of jsp scripting elements
- Example of requestdispatcher
- JSTL standard tag library Example
- DES with CBC mode example in Java
- DES with CFM mode example in Java
- DES with ECB mode example in Java
- One Time Pad Encryption Example using Java code
- S-Box Example using Java
- P-Box Example using Java
- Transposition cipher example using Java
- Mono-alphabetic Substitution Cipher example using ...
- Generalized Caesar Cipher example using java
- java socket programming example
-
▼
June
(25)
Total Pageviews
© BipinRupadiya.com. Powered by Blogger.