This is default featured slide 1 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 2 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 3 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 4 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 5 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

Pages

Sunday, March 27, 2011

Hello Android!

Lately I've been considering developing an Android application for my Senior Project.. I hope I can think of a good topic or idea for my SP as soon as possible so I can further study Android..

So I think I'm gonna start reading articles about Android..

and first thing that comes to my mind was that.. is Android = Java? Cause if it's a yes I think I'll really grab this Android application development since I have a background in Mobile Development (Java ME). So I hit the Google search button for this topic and found a very nice article..

http://weblogs.java.net/blog/opinali/archive/2010/08/17/android-java

and I felt better reading this line.. "If you know Java programming (down to advanced and low-level details), you know Android programming. It's just a matter of learning some new APIs and framework concepts. ".

and with whatsoever off-topic I reached till the comments below.. (about Google using Java blah blah blah) I do agree with this comment from the blog.. "That's not violating any copyright or whatsoever. This is called BUSINESS, INNOVATION, INVENTION. " From our Technopreneurship subject, one has to innovate an already existing idea or business or else your "newly arrived business" will completely fail. (from our topic DIFFERENTIATE or DIE)

urghh so much about those comments..

I don't really want to read anymore issues about Oracle suing Google or others.. I just want to know if Android language or

Wednesday, March 2, 2011

Java Socket Programming

I finally found a working codes for Java Socket Programming..
from http://www.tutorialspoint.com/java/java_networking.htm

// File Name GreetingClient.java

import java.net.*;
import java.io.*;

public class GreetingClient
{
public static void main(String [] args)
{
String serverName = args[0];
int port = Integer.parseInt(args[1]);
try
{
System.out.println("Connecting to " + serverName
+ " on port " + port);
Socket client = new Socket(serverName, port);
System.out.println("Just connected to "
+ client.getRemoteSocketAddress());
OutputStream outToServer = client.getOutputStream();
DataOutputStream out =
new DataOutputStream(outToServer);

out.writeUTF("Hello from "
+ client.getLocalSocketAddress());
InputStream inFromServer = client.getInputStream();
DataInputStream in =
new DataInputStream(inFromServer);
System.out.println("Server says " + in.readUTF());
client.close();
}catch(IOException e)
{
e.printStackTrace();
}
}
}
  • save it under GreetingClient.java

// File Name GreetingServer.java

import java.net.*;
import java.io.*;

public class GreetingServer extends Thread
{
private ServerSocket serverSocket;

public GreetingServer(int port) throws IOException
{
serverSocket = new ServerSocket(port);
serverSocket.setSoTimeout(10000);
}

public void run()
{
while(true)
{
try
{
System.out.println("Waiting for client on port " +
serverSocket.getLocalPort() + "...");
Socket server = serverSocket.accept();
System.out.println("Just connected to "
+ server.getRemoteSocketAddress());
DataInputStream in =
new DataInputStream(server.getInputStream());
System.out.println(in.readUTF());
DataOutputStream out =
new DataOutputStream(server.getOutputStream());
out.writeUTF("Thank you for connecting to "
+ server.getLocalSocketAddress() + "\nGoodbye!");
server.close();
}catch(SocketTimeoutException s)
{
System.out.println("Socket timed out!");
break;
}catch(IOException e)
{
e.printStackTrace();
break;
}
}
}
public static void main(String [] args)
{
int port = Integer.parseInt(args[0]);
try
{
Thread t = new GreetingServer(port);
t.start();
}catch(IOException e)
{
e.printStackTrace();
}
}
}
  • save it under GreetingServer.java

  • compile it and run using

    • java GreetingServer <portnumber> ex: java GreetingServer 6000

    • java GreetingClient <ip address> <portnumber> ex: java GreetingClient localhost 6000

  • sample screenshots:
  • server

server
client



client

thank you.....

Core Java 2- Volume I - Fundamentals, 5th Edition

Now I found the first volume of the book..

Book description:
The best-selling guide for serious Java 2 programmers-fully updated for JDK 1.3! 

Ask any experienced Java programmer: Core Java delivers the real-world guidance you need to accomplish even the most challenging tasks. That's why it's been an international best seller for five straight years. Core Java 2, Volume 1 covers the fundamentals of Java 2, Standard Edition, Version 1.3 and includes completely revised discussions of object-oriented Java development, enhanced coverage of Swing user interface components, and much more. 

This new fifth edition delivers even more of the robust, real-world programs previous editions are famous for-updated to reflect deployment and performance enhancements. Volume 1 includes thorough explanations of inner classes, dynamic proxy classes, exception handling, debugging, the Java event model, Input/Output, file management, and much more. For experienced programmers, Core Java 2, Volume 1: Fundamentals sets the standard-again! State-of-the-art information for Java developers, including: 

*Building GUI applications with Swing classes 
*Making the most of dynamic proxy classes and inner classes 
*Mastering the Java event model 
*Understanding Java streams and file management About the CD-ROM CD-ROM contains complete source code examples, the Java 2, Standard Edition, Version 1.3 SDK, and useful tools, including Forte for Java, Community Edition, a complete to olset for Java application development, TextPad 4.32, HexWorkshop 3.1, WinZip 8.0, To gether J, and SourceAgain. 

Book Info
Guide to the fundamentals of Core Java 2, including building GUI applications, mastering the Java event model, and Java streams and file management. The CD-ROM contains complete source code examples, J2SE 1.3, and other useful tools. Also shows how to download the contents of the CD-ROM from the Internet if unable to access a CD-ROM drive. Softcover.

I found useful sites to download this:

Core Java 2 Volume II-Advanced Features


I and my boyfriend happened to buy this book like 4 months ago at some book stall where almost all books are second hands and are given away by some other people. This is an old book, copyrighted around the year 2002. I wonder what's the first volume of the book but I was so interested with this book since it contains THREADS.. NETWORKING in java programming language. But I only opened this book now, after some long time. I lost the DVD accompanied in this book.

I tried to find some downloadable links for its ebook.. glady I found some

Amazon description of the book:

Amazon.com
The fifth edition of Core Java 2: Volume II--Advanced Features brings a classic Java text up to date for developers tackling JDK 1.3 and 1.4, with a fast-moving and example-based tutorial. Perfect for those who want to learn programming through small, complete demos, this new version is still an excellent choice for mastering the more advanced topics in Java.
The salient feature of this tutorial is that authors provide small, complete programs that demonstrate each area of functionality in "core" Java along with reference material on essential APIs. Beginning with using multiple threading (and synchronization, which allow threads to communicate), the authors provide an engaging tour of advanced Java. The focus here is on client-side Java based on the Java 2 Standard Edition (J2SE), both versions 1.3 and 1.4, including APIs for building applets and applications with Swing and JavaBeans. As in the previous edition, sections on the Java collections do little to simplify the complexity here. Coverage of JDBC is very good, though, with a fine mix of examples showing off basic SQL and queries, plus transactions and newer JDBC features. Later on, this text turns to Swing, including how to extend three powerful Swing controls (lists, trees, and tables), plus improved J2SE 1.4 support for progress controls, plus drag-and-drop and clipboard support.


Besides providing source code and APIs, this book is filled with tips and gotchas to avoid. A robust section on security covers the entire spectrum of security issues in Java, including signing JAR files (along with good practical details). Though it's probably rare enough today, the authors go into good detail about creating custom JavaBean components. Examples make use of Sun Forte Community Edition, a capable Java tool (bundled on the accompanying CD-ROM).


Standout later chapters include an excellent tour of Java's strong support for internationalization (illustrated with a "retirement saving calculator" in English, German, and Chinese). A final section on XML introduces this powerful new standard, plus some essential Java APIs for getting starting with parsing and transforming XML. Chock-full of examples and useful advice, the latest edition of Core Java 2--Volume II is a worthy update to an already successful Java tutorial. --Richard Dragan 


Topics covered: Programming with multiple threads (states and priorities, daemon threads); thread synchronization; avoiding deadlocks; using threads with Swing (dos and don'ts); introduction to collections (including lists, sets, trees, and maps); the collections framework; algorithms (sorting and searching); legacy collections; Java network programming (sending e-mail, using sockets and URLs, basic Web programming); JDBC and databases (quick SQL tutorial, connecting and querying data, metadata, and transactions); new JDBC 3.0 features; remote method invocation (RMI); Java and CORBA; advanced Swing tutorial (JList, JTree, and JTable, including custom rendering options); advanced AWT and Java 2-D graphics (including image manipulation and graphics filters); clipboard and drag-and-drop support; JavaBeans (properties and events, property editors and customizers); Java security (class loaders and bytecode verification, digital signatures, signing JAR files, encryption); internationalization (including date and time and multiple character sets); the Java Native Interface (JNI); Java and C interoperability; and a quick tutorial to XML (SAX and XSL in Java).



I would like to thank the other blogger from where I found this e-book.