import java.net.*;
class apple {
public static void main (String args[]) {
try {
InetAddress[] addresses = InetAddress.getAllByName("www.apple.com");
for (int i = 0; i < addresses.length; i++) {
System.out.println(addresses[i]);
}
}
catch (UnknownHostException e) {
System.out.println("Could not find www.apple.com");
}
}
}
Tuesday, November 25, 2014
: A program that prints all the addresses of www.apple.com
A program that prints the address of 72.167.232.155
import java.net.*;
class MyHostName{
public static void main (String args[]) {
try {
InetAddress address = InetAddress.getByName("72.167.232.155");
System.out.println(address.getHostName());
}
catch (UnknownHostException e) {
System.out.println("Could not find 72.167.232.155");
}
}
}
A program that prints the address of www.oreilly.com
import java.net.*;
class oreilly {
public static void main (String args[]) {
try {
InetAddress address = InetAddress.getByName("www.oreilly.com");
System.out.println(address);
}
catch (UnknownHostException e) {
System.out.println("Could not find www.oreilly.com");
}
}
}
Tuesday, April 1, 2014
Border LAyout and Card Layout - Panel
import java.applet.Applet;
import java.awt.Font;
import java.awt.Graphics;
import java.util.Date;
import java.awt.*;
import java.awt.event.*;
/*<applet code="L5" width=400 height=400>
</applet>*/
public class L5 extends Applet implements ActionListener {
Button N = new Button("NORTH = Previous");
Button S = new Button("SOUTH = Next");
Button E = new Button("EAST = Last");
Button W = new Button("WEST = First");
Button P1 = new Button("FIRST -> Second");
Button P2 = new Button("SECOND -> First");
Button P3 = new Button("THIRD -> First");
Panel p;
CardLayout CLayout;
public void init() {
setup_layout();
}
private void setup_layout() {
p = new Panel();
setLayout(new BorderLayout());
setBackground(Color.red);
setForeground(Color.black);
p.setBackground(Color.lightGray);
p.setLayout(CLayout = new CardLayout());
add("North", N);
add("South", S);
add("Center", p);
add("West", W);
add("East", E);
p.add("Name 1",P1);
p.add("Name 2",P2);
p.add("Name 3",P3);
N.addActionListener(this);
S.addActionListener(this);
E.addActionListener(this);
W.addActionListener(this);
P1.addActionListener(this);
P2.addActionListener(this);
P3.addActionListener(this);
}
public void actionPerformed(ActionEvent e) {
if (e.getSource() == N) {
CLayout.previous(p);
showStatus("North button pushed");
}
else if (e.getSource() == S) {
CLayout.next(p);
showStatus("South button pushed");
}
else if (e.getSource() == E) {
CLayout.last(p);
showStatus("East button pushed");
}
else if (e.getSource() == W) {
CLayout.first(p);
showStatus("West button pushed");
}
else if (e.getSource() == P1) {
CLayout.show(p,"Name 2");
showStatus("Card P1 button pushed");
}
else if (e.getSource() == P2) {
CLayout.show(p,"Name 3");
showStatus("Card P2 button pushed");
}
else if (e.getSource() == P3) {
CLayout.show(p,"Name 1");
showStatus("Card P3 button pushed");
}
}
}
import java.awt.Font;
import java.awt.Graphics;
import java.util.Date;
import java.awt.*;
import java.awt.event.*;
/*<applet code="L5" width=400 height=400>
</applet>*/
public class L5 extends Applet implements ActionListener {
Button N = new Button("NORTH = Previous");
Button S = new Button("SOUTH = Next");
Button E = new Button("EAST = Last");
Button W = new Button("WEST = First");
Button P1 = new Button("FIRST -> Second");
Button P2 = new Button("SECOND -> First");
Button P3 = new Button("THIRD -> First");
Panel p;
CardLayout CLayout;
public void init() {
setup_layout();
}
private void setup_layout() {
p = new Panel();
setLayout(new BorderLayout());
setBackground(Color.red);
setForeground(Color.black);
p.setBackground(Color.lightGray);
p.setLayout(CLayout = new CardLayout());
add("North", N);
add("South", S);
add("Center", p);
add("West", W);
add("East", E);
p.add("Name 1",P1);
p.add("Name 2",P2);
p.add("Name 3",P3);
N.addActionListener(this);
S.addActionListener(this);
E.addActionListener(this);
W.addActionListener(this);
P1.addActionListener(this);
P2.addActionListener(this);
P3.addActionListener(this);
}
public void actionPerformed(ActionEvent e) {
if (e.getSource() == N) {
CLayout.previous(p);
showStatus("North button pushed");
}
else if (e.getSource() == S) {
CLayout.next(p);
showStatus("South button pushed");
}
else if (e.getSource() == E) {
CLayout.last(p);
showStatus("East button pushed");
}
else if (e.getSource() == W) {
CLayout.first(p);
showStatus("West button pushed");
}
else if (e.getSource() == P1) {
CLayout.show(p,"Name 2");
showStatus("Card P1 button pushed");
}
else if (e.getSource() == P2) {
CLayout.show(p,"Name 3");
showStatus("Card P2 button pushed");
}
else if (e.getSource() == P3) {
CLayout.show(p,"Name 1");
showStatus("Card P3 button pushed");
}
}
}
Wednesday, March 5, 2014
Photoshop Animation Link
http://www.webdesign.org/photoshop/imageready-animation/create-a-rain-effect-in-photoshop.14786.html
here u can find Photoshop animation rain fall effect......
here u can find Photoshop animation rain fall effect......
ASP DAtA BASE CODE
<%
set conn=Server.CreateObject("ADODB.Connection")
conn.Provider="Microsoft.Jet.OLEDB.4.0"
conn.Open "D:/ldc/Employee.mdb"
response.write("Connection connected" & "<br>")
set rs=Server.CreateObject("ADODB.recordset")
rs.Open "Select * from Emp", conn
do until rs.EOF
for each x in rs.Fields
Response.Write(x.name)
Response.Write(" = ")
Response.Write(x.value & "<br>")
next
Response.Write("<br>")
rs.MoveNext
loop
rs.close
conn.close
%>
set conn=Server.CreateObject("ADODB.Connection")
conn.Provider="Microsoft.Jet.OLEDB.4.0"
conn.Open "D:/ldc/Employee.mdb"
response.write("Connection connected" & "<br>")
set rs=Server.CreateObject("ADODB.recordset")
rs.Open "Select * from Emp", conn
do until rs.EOF
for each x in rs.Fields
Response.Write(x.name)
Response.Write(" = ")
Response.Write(x.value & "<br>")
next
Response.Write("<br>")
rs.MoveNext
loop
rs.close
conn.close
%>
Monday, March 3, 2014
AWK User defined Function / Field Separators
Program I User
defined Function
awk
'
BEGIN{i=1}
{
my_function(i)
print line[i]
BEGIN{i=1}
{
my_function(i)
print line[i]
i=i+1
}
function my_function(i)
{
}
function my_function(i)
{
if (i==1)
{
print "First"
print "First"
line[1]= "awk"
}
if (i==2)
{
print "Second"
print "Second"
line[2]= "gawk"
}
if (i==3)
{
print "Third"
print "Third"
line[3]= "nawk"
}
}' filename
Field separators
- FS="\t+"
- FS="[[:space:]]+"
Number of fields
- NF == 3
{ print "this particular record has three fields: " $0 }
- if ( NF > 2 ) {
print $1 " "
$2 ":" $3
}
Record number
The record number (NR) is another
handy variable. It will always contain the number of the current
record (awk counts the first record as record number 1).
if
(NR < 10 ) || (NR > 100)
{ print "We are on record number
1-9 or 101+" }
if ( NR >
10 ) {
print "ok, now for
the real information!"
}
Multiline records
Jimmy
the Weasel
100
Pleasant Drive
San
Francisco, CA 12345
Big
Tony
200
Incognito Ave.
Suburbia,
WA 67890
-----------------------
BEGIN
{
FS="\n"
RS=""
}
{
print $1 ", " $2 ", " $3 }
Answer
: //Printing in the single for multi-line records.
Jimmy
the Weasel, 100 Pleasant Drive, San Francisco, CA 12345
Big
Tony, 200 Incognito Ave., Suburbia, WA 67890
OFS and ORS
Output field Separator , Output
record separator
BEGIN
{
FS="\n"
RS=""
OFS=",
"
}
{
print $1, $2, $3 }
-------------------------
BEGIN
{
FS="\n"
RS=""
ORS=""
}
{
x=1
while
( x<NF ) {
print
$x "\t"
x++
}
print
$NF "\n"
}
--------------------------------------------------------------------------------------
Awk Loop Statement
{ for(i=0;i<=10;i++)
{
printf("%d\n", i);
} }'
Subscribe to:
Posts (Atom)