<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-7316847079866971282</id><updated>2012-01-25T11:43:50.712+05:30</updated><category term='Web technology'/><category term='web application'/><category term='Struts'/><category term='Servlets'/><category term='Java Mobile'/><category term='JVM'/><category term='FLV'/><category term='Technology'/><category term='Javascript'/><category term='SCJP 1.5 Question Bank'/><category term='Sun Open Cloud'/><category term='Xperia'/><category term='Java innovations'/><category term='JavaOne 2008'/><category term='Java programs'/><category term='Java'/><category term='Algorithms'/><category term='Java image processing'/><category term='JDBC'/><category term='Web protocol'/><category term='HTTP'/><category term='Computer'/><category term='OpenSolaris'/><category term='Browser'/><category term='JDK'/><category term='Java IDE'/><category term='Java TV'/><category term='Java swings'/><category term='web service'/><category term='HTML'/><category term='Sony Ericsson'/><category term='Spring'/><category term='James Gosling'/><category term='CommunityOne'/><category term='JavaOne 2009'/><category term='Duke&apos;s Choice Awards 2009'/><title type='text'>Java, Servlets, JSPs, Struts, Springs, Hibernate</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://java-servlet-jsp-web.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Santhosh Reddy</name><uri>http://www.blogger.com/profile/05232963292855488994</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_P0JbJW7kyKo/ShZkH-FOe4I/AAAAAAAAHP0/ogsB2X0vAMU/S220/IMG_0305.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>81</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-7316847079866971282.post-3055994984222211126</id><published>2011-11-09T00:26:00.002+05:30</published><updated>2011-11-09T00:33:02.401+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Xperia'/><title type='text'>Xperia X10 mini service menu</title><content type='html'>Hi guys - As you know, we can check mobile core functionality verification with service menu. Of course, this what companies do when we give our handset for service.&lt;br /&gt;&lt;br /&gt;I came across some information related to my handset Sony Ericsson Xperia X10 mini. Here the details&lt;br /&gt;&lt;br /&gt;To get to the service menu on Xperia X10 mini&lt;br /&gt;&lt;br /&gt;Lock the phone and then press&lt;br /&gt;Home&lt;br /&gt;Back&lt;br /&gt;Back&lt;br /&gt;Home&lt;br /&gt;Back&lt;br /&gt;Home&lt;br /&gt;Home&lt;br /&gt;Back&lt;br /&gt;&lt;br /&gt;You can also see a different menu with below keys dialing on dial pad&lt;br /&gt;*#*#4636#*#*&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7316847079866971282-3055994984222211126?l=java-servlet-jsp-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java-servlet-jsp-web.blogspot.com/feeds/3055994984222211126/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2011/11/xperia-x10-mini-service-menu.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/3055994984222211126'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/3055994984222211126'/><link rel='alternate' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2011/11/xperia-x10-mini-service-menu.html' title='Xperia X10 mini service menu'/><author><name>Santhosh Reddy</name><uri>http://www.blogger.com/profile/05232963292855488994</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_P0JbJW7kyKo/ShZkH-FOe4I/AAAAAAAAHP0/ogsB2X0vAMU/S220/IMG_0305.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7316847079866971282.post-8441867567850486567</id><published>2010-07-19T14:45:00.004+05:30</published><updated>2010-07-19T14:53:52.632+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java Mobile'/><title type='text'>My new handset Sony Ericsson Xperia X10 mini</title><content type='html'>Hi guys - I'm really excited to get a new handset made Sony Ericsson, which is first handset from them with Android operating system. I liked the interface and design very much. But I can't still get used to the options included. For example still I don't know how to check the last call duration and overall call duration usage on my handset.&lt;br /&gt;&lt;br /&gt;But the phone looks great and working very well. However, Vodafone is not still supporting this mobile for GPRS. I had to do the manual settings in order to access the internet. I still have a problem with internet access i.e.; I'm able to access internet only from the browser not from the applications.&lt;br /&gt;&lt;br /&gt;You can get more information on this handset @ &lt;a href="http://www.sonyericsson.com/cws/corporate/products/phoneportfolio/specification/xperiax10mini" title="Sony Ericsson Xperia X10 mini"&gt;Sony Ericsson Xperia X10 mini&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7316847079866971282-8441867567850486567?l=java-servlet-jsp-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java-servlet-jsp-web.blogspot.com/feeds/8441867567850486567/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2010/07/my-new-handset-sony-ericsson-xperia-x10.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/8441867567850486567'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/8441867567850486567'/><link rel='alternate' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2010/07/my-new-handset-sony-ericsson-xperia-x10.html' title='My new handset Sony Ericsson Xperia X10 mini'/><author><name>Santhosh Reddy</name><uri>http://www.blogger.com/profile/05232963292855488994</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_P0JbJW7kyKo/ShZkH-FOe4I/AAAAAAAAHP0/ogsB2X0vAMU/S220/IMG_0305.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7316847079866971282.post-6164573622620726849</id><published>2010-05-21T20:11:00.004+05:30</published><updated>2010-05-21T20:14:07.606+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='web service'/><title type='text'>What is a web service, web service provider, and web service client?</title><content type='html'>Web service is a web API (collections of operations) to access the requested remote services via HTTP. Web service became very successful in the market becuase of it's platform independency. i.e.; A web service can be developed in Java and the client who access the service can be in any other language like .NET.&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;How does web service platform independent?&lt;/h2&gt;&lt;br /&gt;Web service provider and web service client work based on the XML trasmission. i.e.; each request will be sent to the provider as an XML and response would be recieved as an XML. So, any language which can understand and parse the XML can be used for web services.&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;How the XML can be understandable by provider and client?&lt;/h2&gt;&lt;br /&gt;Web service provider will create an XML file called WSDL (Web service description language) in order to develop a service. WSDL is a common standard defined by Microsoft and supported by other companies Sun, IBM, Oracle etc. WSDL contains the prototypes for all the operations. WSDL is publicly available file for the clients to invoke the services&lt;br /&gt;&lt;br /&gt;Web service client needs to access the WSDL in order to invoke web service provider operations remotely.&lt;br /&gt;&lt;br /&gt;So, web service provider and client will have a standard defined in the form of WSDL to communicate each other. Communication will happen by exchanging the information thru SOAP protocol.&lt;br /&gt;&lt;br /&gt;In my future posts, I'll cover how to create web service provider using Java and web service handlers to modify the XML request and response.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7316847079866971282-6164573622620726849?l=java-servlet-jsp-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java-servlet-jsp-web.blogspot.com/feeds/6164573622620726849/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2010/05/what-is-web-service-web-service.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/6164573622620726849'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/6164573622620726849'/><link rel='alternate' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2010/05/what-is-web-service-web-service.html' title='What is a web service, web service provider, and web service client?'/><author><name>Santhosh Reddy</name><uri>http://www.blogger.com/profile/05232963292855488994</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_P0JbJW7kyKo/ShZkH-FOe4I/AAAAAAAAHP0/ogsB2X0vAMU/S220/IMG_0305.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7316847079866971282.post-6050515511353904115</id><published>2010-03-15T17:55:00.002+05:30</published><updated>2010-03-15T17:58:49.770+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java programs'/><title type='text'>Java program to find the ascending combinational sequences of first 5 numbers</title><content type='html'>My friend has asked me a very interesting program. I would like to share that with you... (Not the very difficult problem though).&lt;br /&gt;Problem: With a combination of five numbers 1, 2, 3, 4, 5 all the possible sequences in ascending order should be displayed. i.e.; (1, 1, 1, 1, 1), (1, 1, 1, 1, 2), and.... (5, 5, 5, 5, 5).&lt;br /&gt;First we need to find out all the possible sequences availabe and then find out wheather they're in the ascending order.&lt;br /&gt;&lt;pre class="program"&gt;&lt;br /&gt;public class ArrayListSort&lt;br /&gt;{&lt;br /&gt;  public static void main(String args[])&lt;br /&gt;  {&lt;br /&gt;    int a[]={1,2,3,4,5};&lt;br /&gt;    int count = 0;&lt;br /&gt;    for(int x:a)&lt;br /&gt;    {&lt;br /&gt;      for(int y:a)&lt;br /&gt;      {&lt;br /&gt;        for(int z:a)&lt;br /&gt;        {&lt;br /&gt;          for(int p:a)&lt;br /&gt;          {&lt;br /&gt;            for(int q:a)&lt;br /&gt;            {&lt;br /&gt;              int arr[]={x, y, z, p, q};&lt;br /&gt;              if(isArrayInSortOrder(arr))&lt;br /&gt;              {&lt;br /&gt;                System.out.println("("+x+", "+y+", "+z+", "+p+", "+q+")");&lt;br /&gt;                count++;&lt;br /&gt;              }&lt;br /&gt;            }&lt;br /&gt;          }&lt;br /&gt;        }&lt;br /&gt;      }&lt;br /&gt;    }&lt;br /&gt;    System.out.println("Total number of combinatios: "+count);&lt;br /&gt;  }&lt;br /&gt;  public static boolean isArrayInSortOrder(int a[])&lt;br /&gt;  {&lt;br /&gt;    boolean valid = true;&lt;br /&gt;    for(int i=0;i&amp;lt;a.length;i++)&lt;br /&gt;    {&lt;br /&gt;      for(int j=i;j&amp;lt;a.length;j++)&lt;br /&gt;      {&lt;br /&gt;        if(a[i]&amp;gt;a[j])&lt;br /&gt;        {&lt;br /&gt;          valid = false;&lt;br /&gt;          break;&lt;br /&gt;        }&lt;br /&gt;      }&lt;br /&gt;    }&lt;br /&gt;    return valid;&lt;br /&gt;  }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;h2&gt;Output: &lt;/h2&gt;&lt;br /&gt;(1, 1, 1, 1, 1)&lt;br /&gt;(1, 1, 1, 1, 2)&lt;br /&gt;(1, 1, 1, 1, 3)&lt;br /&gt;(1, 1, 1, 1, 4)&lt;br /&gt;(1, 1, 1, 1, 5)&lt;br /&gt;(1, 1, 1, 2, 2)&lt;br /&gt;(1, 1, 1, 2, 3)&lt;br /&gt;(1, 1, 1, 2, 4)&lt;br /&gt;(1, 1, 1, 2, 5)&lt;br /&gt;(1, 1, 1, 3, 3)&lt;br /&gt;(1, 1, 1, 3, 4)&lt;br /&gt;(1, 1, 1, 3, 5)&lt;br /&gt;(1, 1, 1, 4, 4)&lt;br /&gt;(1, 1, 1, 4, 5)&lt;br /&gt;(1, 1, 1, 5, 5)&lt;br /&gt;(1, 1, 2, 2, 2)&lt;br /&gt;(1, 1, 2, 2, 3)&lt;br /&gt;(1, 1, 2, 2, 4)&lt;br /&gt;(1, 1, 2, 2, 5)&lt;br /&gt;(1, 1, 2, 3, 3)&lt;br /&gt;(1, 1, 2, 3, 4)&lt;br /&gt;(1, 1, 2, 3, 5)&lt;br /&gt;(1, 1, 2, 4, 4)&lt;br /&gt;(1, 1, 2, 4, 5)&lt;br /&gt;(1, 1, 2, 5, 5)&lt;br /&gt;(1, 1, 3, 3, 3)&lt;br /&gt;(1, 1, 3, 3, 4)&lt;br /&gt;(1, 1, 3, 3, 5)&lt;br /&gt;(1, 1, 3, 4, 4)&lt;br /&gt;(1, 1, 3, 4, 5)&lt;br /&gt;(1, 1, 3, 5, 5)&lt;br /&gt;(1, 1, 4, 4, 4)&lt;br /&gt;(1, 1, 4, 4, 5)&lt;br /&gt;(1, 1, 4, 5, 5)&lt;br /&gt;(1, 1, 5, 5, 5)&lt;br /&gt;(1, 2, 2, 2, 2)&lt;br /&gt;(1, 2, 2, 2, 3)&lt;br /&gt;(1, 2, 2, 2, 4)&lt;br /&gt;(1, 2, 2, 2, 5)&lt;br /&gt;(1, 2, 2, 3, 3)&lt;br /&gt;(1, 2, 2, 3, 4)&lt;br /&gt;(1, 2, 2, 3, 5)&lt;br /&gt;(1, 2, 2, 4, 4)&lt;br /&gt;(1, 2, 2, 4, 5)&lt;br /&gt;(1, 2, 2, 5, 5)&lt;br /&gt;(1, 2, 3, 3, 3)&lt;br /&gt;(1, 2, 3, 3, 4)&lt;br /&gt;(1, 2, 3, 3, 5)&lt;br /&gt;(1, 2, 3, 4, 4)&lt;br /&gt;(1, 2, 3, 4, 5)&lt;br /&gt;(1, 2, 3, 5, 5)&lt;br /&gt;(1, 2, 4, 4, 4)&lt;br /&gt;(1, 2, 4, 4, 5)&lt;br /&gt;(1, 2, 4, 5, 5)&lt;br /&gt;(1, 2, 5, 5, 5)&lt;br /&gt;(1, 3, 3, 3, 3)&lt;br /&gt;(1, 3, 3, 3, 4)&lt;br /&gt;(1, 3, 3, 3, 5)&lt;br /&gt;(1, 3, 3, 4, 4)&lt;br /&gt;(1, 3, 3, 4, 5)&lt;br /&gt;(1, 3, 3, 5, 5)&lt;br /&gt;(1, 3, 4, 4, 4)&lt;br /&gt;(1, 3, 4, 4, 5)&lt;br /&gt;(1, 3, 4, 5, 5)&lt;br /&gt;(1, 3, 5, 5, 5)&lt;br /&gt;(1, 4, 4, 4, 4)&lt;br /&gt;(1, 4, 4, 4, 5)&lt;br /&gt;(1, 4, 4, 5, 5)&lt;br /&gt;(1, 4, 5, 5, 5)&lt;br /&gt;(1, 5, 5, 5, 5)&lt;br /&gt;(2, 2, 2, 2, 2)&lt;br /&gt;(2, 2, 2, 2, 3)&lt;br /&gt;(2, 2, 2, 2, 4)&lt;br /&gt;(2, 2, 2, 2, 5)&lt;br /&gt;(2, 2, 2, 3, 3)&lt;br /&gt;(2, 2, 2, 3, 4)&lt;br /&gt;(2, 2, 2, 3, 5)&lt;br /&gt;(2, 2, 2, 4, 4)&lt;br /&gt;(2, 2, 2, 4, 5)&lt;br /&gt;(2, 2, 2, 5, 5)&lt;br /&gt;(2, 2, 3, 3, 3)&lt;br /&gt;(2, 2, 3, 3, 4)&lt;br /&gt;(2, 2, 3, 3, 5)&lt;br /&gt;(2, 2, 3, 4, 4)&lt;br /&gt;(2, 2, 3, 4, 5)&lt;br /&gt;(2, 2, 3, 5, 5)&lt;br /&gt;(2, 2, 4, 4, 4)&lt;br /&gt;(2, 2, 4, 4, 5)&lt;br /&gt;(2, 2, 4, 5, 5)&lt;br /&gt;(2, 2, 5, 5, 5)&lt;br /&gt;(2, 3, 3, 3, 3)&lt;br /&gt;(2, 3, 3, 3, 4)&lt;br /&gt;(2, 3, 3, 3, 5)&lt;br /&gt;(2, 3, 3, 4, 4)&lt;br /&gt;(2, 3, 3, 4, 5)&lt;br /&gt;(2, 3, 3, 5, 5)&lt;br /&gt;(2, 3, 4, 4, 4)&lt;br /&gt;(2, 3, 4, 4, 5)&lt;br /&gt;(2, 3, 4, 5, 5)&lt;br /&gt;(2, 3, 5, 5, 5)&lt;br /&gt;(2, 4, 4, 4, 4)&lt;br /&gt;(2, 4, 4, 4, 5)&lt;br /&gt;(2, 4, 4, 5, 5)&lt;br /&gt;(2, 4, 5, 5, 5)&lt;br /&gt;(2, 5, 5, 5, 5)&lt;br /&gt;(3, 3, 3, 3, 3)&lt;br /&gt;(3, 3, 3, 3, 4)&lt;br /&gt;(3, 3, 3, 3, 5)&lt;br /&gt;(3, 3, 3, 4, 4)&lt;br /&gt;(3, 3, 3, 4, 5)&lt;br /&gt;(3, 3, 3, 5, 5)&lt;br /&gt;(3, 3, 4, 4, 4)&lt;br /&gt;(3, 3, 4, 4, 5)&lt;br /&gt;(3, 3, 4, 5, 5)&lt;br /&gt;(3, 3, 5, 5, 5)&lt;br /&gt;(3, 4, 4, 4, 4)&lt;br /&gt;(3, 4, 4, 4, 5)&lt;br /&gt;(3, 4, 4, 5, 5)&lt;br /&gt;(3, 4, 5, 5, 5)&lt;br /&gt;(3, 5, 5, 5, 5)&lt;br /&gt;(4, 4, 4, 4, 4)&lt;br /&gt;(4, 4, 4, 4, 5)&lt;br /&gt;(4, 4, 4, 5, 5)&lt;br /&gt;(4, 4, 5, 5, 5)&lt;br /&gt;(4, 5, 5, 5, 5)&lt;br /&gt;(5, 5, 5, 5, 5)&lt;br /&gt;Total number of combinatios: 126&lt;br /&gt;&lt;br /&gt;Above program has been tested in 1.5 and 1.6.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://java-servlet-jsp-web.blogspot.com/search/label/Java%20programs" title="Other Java programs"&gt;Click here&lt;/a&gt; to check out other programs that I've developed.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7316847079866971282-6050515511353904115?l=java-servlet-jsp-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java-servlet-jsp-web.blogspot.com/feeds/6050515511353904115/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2010/03/java-program-to-find-ascending.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/6050515511353904115'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/6050515511353904115'/><link rel='alternate' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2010/03/java-program-to-find-ascending.html' title='Java program to find the ascending combinational sequences of first 5 numbers'/><author><name>Santhosh Reddy</name><uri>http://www.blogger.com/profile/05232963292855488994</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_P0JbJW7kyKo/ShZkH-FOe4I/AAAAAAAAHP0/ogsB2X0vAMU/S220/IMG_0305.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7316847079866971282.post-2415559052627614757</id><published>2010-03-08T04:41:00.003+05:30</published><updated>2010-03-08T04:48:55.666+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java IDE'/><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><title type='text'>System.out.println() short cut keys on different IDEs</title><content type='html'>If you're using different IDE to develop a program in Java, you might have searched for a short cut key for System.out.println(). I've so far programmed Java using 3 different IDEs Netbeans, Eclipse, and JDeveloper.&lt;br /&gt;&lt;br /&gt;Here the short cuts for System.out.println on each IDE above&lt;br /&gt;&lt;strong&gt;Short cut on Netbeans&lt;/strong&gt;&lt;br /&gt;Type &lt;strong&gt;sout&lt;/strong&gt; and press tab key&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Short cut on Eclipse&lt;/strong&gt;&lt;br /&gt;Type &lt;strong&gt;syso&lt;/strong&gt; and press Ctrl+space&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Short cut on JDeveloper&lt;/strong&gt;&lt;br /&gt;Type &lt;strong&gt;sop&lt;/strong&gt; and press Alt+Enter&lt;br /&gt;&lt;br /&gt;Enjoy programming...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7316847079866971282-2415559052627614757?l=java-servlet-jsp-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java-servlet-jsp-web.blogspot.com/feeds/2415559052627614757/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2010/03/systemoutprintln-short-cut-keys-on.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/2415559052627614757'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/2415559052627614757'/><link rel='alternate' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2010/03/systemoutprintln-short-cut-keys-on.html' title='System.out.println() short cut keys on different IDEs'/><author><name>Santhosh Reddy</name><uri>http://www.blogger.com/profile/05232963292855488994</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_P0JbJW7kyKo/ShZkH-FOe4I/AAAAAAAAHP0/ogsB2X0vAMU/S220/IMG_0305.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7316847079866971282.post-2522442715935921317</id><published>2010-03-05T05:41:00.006+05:30</published><updated>2011-09-09T18:24:18.464+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java programs'/><title type='text'>Java program to fetch and sort files from a directory</title><content type='html'>Hi - Have you worked with Java file system objects? It has very good features like accessing files and sorting them in ascending order and descending order. In Java 1.5, Sun Microsystem has introduced the Comparator class to make the sort operations easier. So, I'm going to discuss about this today.&lt;br /&gt;&lt;br /&gt;When you create a File object, it will just create a reference for the path that you've given for the constructor. You can invoke methods like exists() to find whether the file exists or isDirectory() to find whether this file represents a directory on the disk etc.&lt;br /&gt;&lt;br /&gt;Here is the sample program to to access files and order them by ascending order based on name, last modified date, and size. It explains about file filter as well.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;SortFiles.java&lt;/strong&gt;&lt;br /&gt;&lt;pre class="program"&gt;&lt;br /&gt;package filesdemo;&lt;br /&gt;&lt;br /&gt;import java.io.File;&lt;br /&gt;import java.io.FileFilter;&lt;br /&gt;import java.util.Arrays;&lt;br /&gt;import java.util.Comparator;&lt;br /&gt;&lt;br /&gt;/**&lt;br /&gt; * A demo class to show the file sorting techniques.&lt;br /&gt; * @author Santhosh Reddy Mandadi&lt;br /&gt; * @since 05-Mar-2010&lt;br /&gt; * @version 1.0&lt;br /&gt; */&lt;br /&gt;public class SortFiles&lt;br /&gt;{&lt;br /&gt;  public static void main(String[] args)&lt;br /&gt;  {&lt;br /&gt;    File dir = new File("C:\\");&lt;br /&gt;    if(dir.isDirectory())&lt;br /&gt;    {&lt;br /&gt;      // Fetching the list from the directory&lt;br /&gt;      File[] files = dir.listFiles();&lt;br /&gt;&lt;br /&gt;      //Prints all the files and folders exists under dir&lt;br /&gt;      for(File file:files)&lt;br /&gt;      {&lt;br /&gt;        System.out.println(file.getName());&lt;br /&gt;      }&lt;br /&gt;      System.out.println("All the files including folders");&lt;br /&gt;      System.out.println("--------------------------------");&lt;br /&gt;      &lt;br /&gt;      // Creating a filter to return only files.&lt;br /&gt;      FileFilter fileFilter = new FileFilter()&lt;br /&gt;      {&lt;br /&gt;        @Override&lt;br /&gt;        public boolean accept(File file) {&lt;br /&gt;          return !file.isDirectory();&lt;br /&gt;        }&lt;br /&gt;      };&lt;br /&gt;      files = dir.listFiles(fileFilter);&lt;br /&gt;&lt;br /&gt;      //Lists only files since we've applied file filter&lt;br /&gt;      for(File file:files)&lt;br /&gt;      {&lt;br /&gt;        System.out.println(file.getName());&lt;br /&gt;      }&lt;br /&gt;      System.out.println("After filtering the folders");&lt;br /&gt;      System.out.println("--------------------------------");&lt;br /&gt;&lt;br /&gt;      // Sort files by name&lt;br /&gt;      Arrays.sort(files, new Comparator()&lt;br /&gt;      {&lt;br /&gt;        @Override&lt;br /&gt;        public int compare(Object f1, Object f2) {&lt;br /&gt;          return ((File) f1).getName().compareTo(((File) f2).getName());&lt;br /&gt;        }&lt;br /&gt;      });&lt;br /&gt;&lt;br /&gt;      //Prints the files in file name ascending order&lt;br /&gt;      for(File file:files)&lt;br /&gt;      {&lt;br /&gt;        System.out.println(file.getName());&lt;br /&gt;      }&lt;br /&gt;      System.out.println("After sorting by name");&lt;br /&gt;      System.out.println("----------------------------------");&lt;br /&gt;&lt;br /&gt;      // Sort files by size.&lt;br /&gt;      Arrays.sort(files, new Comparator()&lt;br /&gt;      {&lt;br /&gt;        @Override&lt;br /&gt;        public int compare(Object f1, Object f2)&lt;br /&gt;        {&lt;br /&gt;          if (((File) f1).length() &lt; ((File) f2).length())&lt;br /&gt;          {&lt;br /&gt;            return -1;&lt;br /&gt;          }&lt;br /&gt;          else if (((File) f1).length() &gt; ((File) f2).length())&lt;br /&gt;          {&lt;br /&gt;            return 1;&lt;br /&gt;          }&lt;br /&gt;          else&lt;br /&gt;          {&lt;br /&gt;            return 0;&lt;br /&gt;          }&lt;br /&gt;        }&lt;br /&gt;      });&lt;br /&gt;&lt;br /&gt;      //Prints files in order by file size&lt;br /&gt;      for(File file:files)&lt;br /&gt;      {&lt;br /&gt;        System.out.println(file.getName());&lt;br /&gt;      }&lt;br /&gt;      System.out.println("After sorting by length");&lt;br /&gt;      System.out.println("-------------------------------");&lt;br /&gt;&lt;br /&gt;      // Sort files by date.&lt;br /&gt;      Arrays.sort(files, new Comparator()&lt;br /&gt;      {&lt;br /&gt;        @Override&lt;br /&gt;        public int compare(Object f1, Object f2)&lt;br /&gt;        {&lt;br /&gt;          if (((File) f1).lastModified() &lt; ((File) f2).lastModified())&lt;br /&gt;          {&lt;br /&gt;            return -1;&lt;br /&gt;          }&lt;br /&gt;          else if (((File) f1).lastModified() &gt; ((File) f2).lastModified())&lt;br /&gt;          {&lt;br /&gt;            return 1;&lt;br /&gt;          }&lt;br /&gt;          else&lt;br /&gt;          {&lt;br /&gt;            return 0;&lt;br /&gt;          }&lt;br /&gt;        }&lt;br /&gt;      });&lt;br /&gt;&lt;br /&gt;      //Prints files in order by last modified date&lt;br /&gt;      for(File file:files)&lt;br /&gt;      {&lt;br /&gt;        System.out.println(file.getName());&lt;br /&gt;      }&lt;br /&gt;      System.out.println("-------------------------");&lt;br /&gt;    }&lt;br /&gt;  }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Above program has been tested in 1.5 and 1.6.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://java-servlet-jsp-web.blogspot.com/search/label/Java%20programs" title="Other Java programs"&gt;Click here&lt;/a&gt; to check out other programs that I've developed.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7316847079866971282-2522442715935921317?l=java-servlet-jsp-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java-servlet-jsp-web.blogspot.com/feeds/2522442715935921317/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2010/03/java-program-to-fetch-and-sort-files.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/2522442715935921317'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/2522442715935921317'/><link rel='alternate' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2010/03/java-program-to-fetch-and-sort-files.html' title='Java program to fetch and sort files from a directory'/><author><name>Santhosh Reddy</name><uri>http://www.blogger.com/profile/05232963292855488994</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_P0JbJW7kyKo/ShZkH-FOe4I/AAAAAAAAHP0/ogsB2X0vAMU/S220/IMG_0305.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7316847079866971282.post-7543868177229957842</id><published>2009-11-22T18:10:00.002+05:30</published><updated>2009-11-22T18:17:27.294+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><title type='text'>Java evolution (History of Java)</title><content type='html'>In 1990, the Sun Microsystems Inc, US has got a project, which is developing remote control software. Different remote controllers having different processors and so they have to develop different software. The team leader James Gausling has thought that why don't we develop single software which can run on different remote controllers. He decided to develop a new language. Generally on those days, all are used C language, which is system dependent.&lt;br /&gt;&lt;br /&gt;They have developed a new language named OaK in 1993. But OaK name is already registered. So, they have decided to rename it as &lt;strong&gt;JAVA&lt;/strong&gt; (Good quality of Tea is coming from Java Islands). The Sun Microsystems has released Java in June 1995 on the occasion of Sun World Conference.&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;Features of Java:&lt;/h2&gt;&lt;br /&gt;&lt;strong&gt;1. Simple&lt;/strong&gt; - Java is a simple programming language. Learning and practicing Java is easy because of its resemblance with C and C++. The difficult concepts in C++ have been eliminated in Java.&lt;p align="center"&gt;Java = C++ - Complexities&lt;/p&gt;. For example pointer concept has been eliminated in Java.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Question: Why pointers are eliminated in Java?&lt;/strong&gt;&lt;br /&gt;Pointers lead to confusion for a programmer. Pointers may crash a program. Using pointer virus and hacking programs can be written.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;1. Object oriented&lt;/strong&gt; - Unlike C++, Java is a purely object oriented programming language. Java programs uses objects and classes.&lt;br /&gt;&lt;br /&gt;Object: An object is anything that exists in this real world. An object has properties and behaviors (actions).&lt;br /&gt;&lt;br /&gt;In our program variables are used to represent properties. Actions are represented by methods. i.e.; An object contains variables and methods. i.e.; Objects need memory. JVM will allocate the memory required for objects.&lt;br /&gt;&lt;br /&gt;Class: A class is a model or blue print for creating objects. Class doesn’t exist physically, it is only our idea. i.e.; A class contains the definition for variables and methods of its objects.&lt;br /&gt;&lt;br /&gt;Below table depicts some class names and objects.&lt;br /&gt;&lt;br /&gt;&lt;table border="1" cellspacing="0" cellpadding="0"&gt;&lt;tbody&gt; &lt;/tbody&gt;&lt;thead&gt; &lt;tr&gt;  &lt;th&gt;Class names&lt;/th&gt;  &lt;th&gt;Objects&lt;/th&gt; &lt;/tr&gt; &lt;/thead&gt;&lt;tbody&gt; &lt;/tbody&gt;&lt;tbody&gt; &lt;tr&gt;  &lt;td&gt;Flower&lt;/td&gt;  &lt;td&gt;Lilli, Jasmine, Lotus&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt;  &lt;td&gt;Book&lt;/td&gt;  &lt;td&gt;NoteBook, TextBook, RefBook&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt;  &lt;td&gt;Actor&lt;/td&gt;  &lt;td&gt;Chiranjeevi, Kamal Hasan, Rajani&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt;  &lt;td&gt;Actress&lt;/td&gt;  &lt;td&gt;Radha, Anushka, Tamnna, Sneha Ullal&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt;  &lt;td&gt;Shirt&lt;/td&gt;  &lt;td&gt;T-Shirt, S-Sleve, Glasour&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt;  &lt;td&gt;Sweet&lt;/td&gt;  &lt;td&gt;Jilebi, Coa, Kalakanda&lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt;&lt;tbody&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;br /&gt;C++ is not purely an object oriented programming language because without creating an object or a class we can write a C++ program. Whereas, without creating at least one class we can't write a program. So, Java is said to be a purely object oriented programming language.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;3. Distributed: &lt;/strong&gt; - Java is a distributed technology. Information is distributed on various computers on a network. Using Java, we can write programs which capture information and distribute ii to clients.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;4. Robust: &lt;/strong&gt; - Java programs will not crash easily because of its exception handling and its memory management features. Memory management was handled by JVM&gt; i.e.; allocation and de-allocation of memory handled by JVM.&lt;br /&gt;&lt;br /&gt;Memory Allocation: JVM's class loader sub system will allocate required memory for a program.&lt;br /&gt;&lt;br /&gt;Memory de-allocation: JVM's garbage collector will free the allocated memory. Garbage collector will check the memory between every time interval and it used Mark and Sweep algorithm to de-allocate the memory for unused variables and objects.&lt;br /&gt;&lt;br /&gt;Exception handling: Exception means a run time error. In Java we can handle the exceptions.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;5. Secure: &lt;/strong&gt; - Java enables the construction of virus free and tamper free systems.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;6. Architecture neutral: &lt;/strong&gt; - Java's byte code is not machine dependent. It can be run on any machine with any processor and with any O/S.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;7. Portable: &lt;/strong&gt; - A program yielding the same result on any computer is said to be portable. Java program give same results on all machines. Everything is clearly defined in Java specification and nothing is left to O/S.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;8. Interpreted: &lt;/strong&gt; - Java programs are compiled to generate the byte code. This byte code can be downloaded and interpreted by the interpreter in JVM.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;9. High performance: &lt;/strong&gt; - Along with interpreter, there will be JIT (Just in time) compiler which enhances the speed of execution.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7316847079866971282-7543868177229957842?l=java-servlet-jsp-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java-servlet-jsp-web.blogspot.com/feeds/7543868177229957842/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/11/java-evolution-history-of-java.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/7543868177229957842'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/7543868177229957842'/><link rel='alternate' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/11/java-evolution-history-of-java.html' title='Java evolution (History of Java)'/><author><name>Santhosh Reddy</name><uri>http://www.blogger.com/profile/05232963292855488994</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_P0JbJW7kyKo/ShZkH-FOe4I/AAAAAAAAHP0/ogsB2X0vAMU/S220/IMG_0305.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7316847079866971282.post-966145242568155839</id><published>2009-11-22T18:06:00.001+05:30</published><updated>2009-11-22T18:10:01.303+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><title type='text'>What made Java more popular?</title><content type='html'>Let's have a quick look at what made Java more popular among the existing programming languages like COBOL, FORTRAN, PASCAL, C, C++.&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;Programming language:&lt;/h2&gt;&lt;br /&gt;I'm going to ask some general questions before I explain about programming languages.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;1. What is a language?&lt;/strong&gt;&lt;br /&gt;Your answer - ??&lt;br /&gt;My answer - A language is a communication tool between two persons, for example you're reading this because you know the language English.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;2. Why do we need a language?&lt;/strong&gt;&lt;br /&gt;Your answer - ??&lt;br /&gt;My answer - A language is used to fulfill our needs (requests).&lt;br /&gt;&lt;br /&gt;Like two humans can communicate with each other with a language, a human can communicate with computer by using programming languages to fulfill needs. The program that we wrote cannot be directly recognized by the computer. Computer recognizes only machine code. So, we have to convert our program into machine understandable signals. For this purpose we are having translators.&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;Translator&lt;/h2&gt; - It is a program which coverts program into machine understandable code (electric signals or pulses). There are three types of translators available.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Interpreter&lt;/strong&gt; - Coverts only one line of the program at a time&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Compiler&lt;/strong&gt; - Coverts all lines of a program in a single step (Note: Compiler is 10 times faster than the interpreter)&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Assembler&lt;/strong&gt; - Converts assembly language instructions into machine level language.&lt;br /&gt;&lt;br /&gt;Here I explain a sample process of compiler with C compiler. When you write and compile a program C language, the below tasks will be carried out&lt;br /&gt;When we compile a program, the compiler will create a new object code (.obj) file. An object code is equivalent machine code for our program. Whenever we first execute our program, the compiler will create an executable file. An EXE file has the machine language instructions (A group of instructions that understand by a micro processor are called as instruction set) including header files also. (It directly executed without compiler). The first microprocessor in the world - 4044. Later on 8080, 8085, 8086, 8088, 80286, 80386, 80486, 80586 have been developed.&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;System dependent program&lt;/h2&gt;&lt;br /&gt;If a program is executable only on the computer system where it was developed - called system dependent program. All the existing languages before the invention of Java are system dependent. For example if you write a program on Windows which can't be executed on Linux. Hence, we can't use these languages to develop software which runs on internet.&lt;br /&gt;&lt;br /&gt; Java is system independent, hence it is highly suitable for internet. Whenever we compile java source, it will create a class file. A class file contains byte code equivalent to our program. Each instruction size of a byte code is 1 byte. There are total of 220 byte code instructions available.&lt;br /&gt;&lt;br /&gt; When we compile Java program, compiler will rewrite the program as another set of instructions. The rewritten code is said to be byte code. &lt;br /&gt;&lt;br /&gt; &lt;h2&gt;JVM&lt;/h2&gt;&lt;br /&gt; JVM refers Java Virtual Machine. JVM is a program which will convert byte code instructions into machine language instructions understandable by Micro processor. &lt;strong&gt;Right Java program write once, later on run anywhere.&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt; JVM is a system dependent, because it was developed in C language, where as class file is a system independent. &lt;br /&gt;&lt;br /&gt; &lt;strong&gt;Question: What is the difference between class file and exe file&lt;/strong&gt;&lt;br /&gt; EXE file contains machine language instructions understandable by Micro processor, where as class file contains byte code instructions for JVM. EXE file is system dependent, where as class file is a system independent.&lt;br /&gt;&lt;br /&gt; Sun Microsystems has developed different JVMs for different operating systems. Hence, you can write a single Java program and generate the class file which can be executed on any other operating system.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7316847079866971282-966145242568155839?l=java-servlet-jsp-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java-servlet-jsp-web.blogspot.com/feeds/966145242568155839/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/11/what-made-java-more-popular.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/966145242568155839'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/966145242568155839'/><link rel='alternate' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/11/what-made-java-more-popular.html' title='What made Java more popular?'/><author><name>Santhosh Reddy</name><uri>http://www.blogger.com/profile/05232963292855488994</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_P0JbJW7kyKo/ShZkH-FOe4I/AAAAAAAAHP0/ogsB2X0vAMU/S220/IMG_0305.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7316847079866971282.post-7993177425493163951</id><published>2009-09-11T22:22:00.003+05:30</published><updated>2009-09-11T22:39:40.032+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java programs'/><category scheme='http://www.blogger.com/atom/ns#' term='Algorithms'/><title type='text'>Selection sort algorithm, flow chart, analysis and Java program</title><content type='html'>&lt;h2&gt;Selection sort&lt;/h2&gt;&lt;br /&gt;Selection sort is a simple algorithm which will be applicable to sort the small lists or mostly sorted lists. Selection sort would sort by finding the minimum (in case of ascending) or maximum (in case of descending) value and swap that with the first element of the list.&lt;br /&gt;&lt;br /&gt;Name selection is called because, it selects an intended element to be swapped with the first element.&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;Algorithm&lt;/h2&gt;&lt;br /&gt;&lt;pre class="program"&gt;START&lt;br /&gt; DECLARE n, list, min&lt;br /&gt; ACCEPT n&lt;br /&gt; ACCEPT n values into an array list&lt;br /&gt; FOR EACH i IN 0 to n-1&lt;br /&gt; LOOP&lt;br /&gt;   min := i;&lt;br /&gt;   FOR EACH j IN i+1 to n-1&lt;br /&gt;   LOOP&lt;br /&gt;     IF list[j] &lt; list[min] THEN&lt;br /&gt;        min := j;&lt;br /&gt;     END IF&lt;br /&gt;   END LOOP&lt;br /&gt;   IF i &lt;&gt; min THEN&lt;br /&gt;     temp := list[i];&lt;br /&gt;     list[i] := list[min];&lt;br /&gt;     list[min]:= temp;&lt;br /&gt;   END IF&lt;br /&gt; END LOOP&lt;br /&gt;END&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;Java program&lt;/h2&gt;&lt;br /&gt;&lt;pre class="program"&gt;import java.io.*;&lt;br /&gt;&lt;br /&gt;/**&lt;br /&gt; * This class demonstrates the bubble sort.&lt;br /&gt; * @author SANTHOSH REDDY MANDADI&lt;br /&gt; * @version 1.0&lt;br /&gt; * @since 10 September 2009&lt;br /&gt; */&lt;br /&gt;public class SelectionSort&lt;br /&gt;{&lt;br /&gt;  public static void main(String[] args) throws Exception&lt;br /&gt;  {&lt;br /&gt;    int values[]=new int[5];&lt;br /&gt;    BufferedReader br=new BufferedReader(new InputStreamReader(System.in));&lt;br /&gt;    System.out.println("Enter "+values.length+" values to sort using bubble sort");&lt;br /&gt;    for(int i=0;i&amp;lt;values.length;i++)&lt;br /&gt;    {&lt;br /&gt;      try{&lt;br /&gt;        values[i]=Integer.parseInt(br.readLine());&lt;br /&gt;      }catch(NumberFormatException e)&lt;br /&gt;      {&lt;br /&gt;        e.printStackTrace();&lt;br /&gt;        values[i]=0;&lt;br /&gt;      }&lt;br /&gt;    }&lt;br /&gt;    selectionSort(values);&lt;br /&gt;    for(int i=0;i&amp;lt;values.length;i++)&lt;br /&gt;    {&lt;br /&gt;      System.out.print(values[i]+" ");&lt;br /&gt;    }&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  /**&lt;br /&gt;   * This method will sort the passed array&lt;br /&gt;   * @author SANTHOSH REDDY MANDADI&lt;br /&gt;   * @since 10-Sep-2009&lt;br /&gt;   * @param an array of the list of values to be sorted&lt;br /&gt;   */&lt;br /&gt;  public static void selectionSort(int[] values)&lt;br /&gt;  {&lt;br /&gt;    //Iterating the list till the end of the list except last one&lt;br /&gt;    for (int i=0; i&amp;lt;values.length-1;i++) &lt;br /&gt;    {&lt;br /&gt;      //Considering the minumum value is current iteration array element&lt;br /&gt;      int min = i;&lt;br /&gt;      //Trying to find out the smallest element in the array&lt;br /&gt;      for(int j=i+1; j&amp;lt;values.length;j++)&lt;br /&gt;      {&lt;br /&gt;        if (values[j]&amp;lt;values[min])&lt;br /&gt;        {&lt;br /&gt;          min = j;&lt;br /&gt;        }&lt;br /&gt;      }&lt;br /&gt;      //If smallest element found other than the current iteration array element, swapping will happen&lt;br /&gt;      if (i != min) &lt;br /&gt;      {&lt;br /&gt;        int swap = values[i];&lt;br /&gt;        values[i] = values[min];&lt;br /&gt;        values[min] = swap;&lt;br /&gt;      }&lt;br /&gt;    }&lt;br /&gt;  }&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;Explaination&lt;/h2&gt;&lt;br /&gt;Let us consider we've executed the above program by inputting the values (53, 24, 31, 64, 3). Here is how the list will be modified in each iteration.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Iteration - list values&lt;/strong&gt;&lt;br /&gt;First - 3 24 31 64 53&lt;br /&gt;Second - 3 24 31 64 53&lt;br /&gt;Third - 3 24 31 64 53&lt;br /&gt;Fourth - 3 24 31 53 64&lt;br /&gt;Fifth - 3 24 31 53 64&lt;br /&gt;&lt;br /&gt;Above program has been tested in JDK 1.4, 1.5, and 1.6.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://java-servlet-jsp-web.blogspot.com/search/label/Java%20programs" title="Other Java programs"&gt;Click here&lt;/a&gt; to check out other programs that I've developed.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7316847079866971282-7993177425493163951?l=java-servlet-jsp-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java-servlet-jsp-web.blogspot.com/feeds/7993177425493163951/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/09/selection-sort-algorithm-flow-chart.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/7993177425493163951'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/7993177425493163951'/><link rel='alternate' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/09/selection-sort-algorithm-flow-chart.html' title='Selection sort algorithm, flow chart, analysis and Java program'/><author><name>Santhosh Reddy</name><uri>http://www.blogger.com/profile/05232963292855488994</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_P0JbJW7kyKo/ShZkH-FOe4I/AAAAAAAAHP0/ogsB2X0vAMU/S220/IMG_0305.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7316847079866971282.post-377772571259520076</id><published>2009-09-04T22:48:00.004+05:30</published><updated>2009-09-04T23:25:19.199+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='Java programs'/><title type='text'>Java and Javascript JCrop (JQuery plugin) image cropper</title><content type='html'>Recently I've implemented a cropper functionality based on the Java by using Java script API JCrop, an official plugin of JQuery. Here is how the cropper functionality works.&lt;br /&gt;&lt;br /&gt;Lots of websites gives you about the crop functionality through PHP. JQuery official website also provides a demo in PHP. Here is how you can implement through Java programming language.&lt;br /&gt;&lt;br /&gt;1. Download the &lt;a href="http://deepliquid.com/content/Jcrop_Download.html" target="_blank" title="Download JCrop"&gt;JCrop&lt;/a&gt;, an open source plugin of JQuery.&lt;br /&gt;2. Embed the JS and CSS for JCrop in JSP.&lt;br /&gt;3. Insert an image on your JSP (web page) with an unique ID&lt;br /&gt;4. Invoke the JCrop function on the unique ID of the image with all the required parameters i.e.; user can choose the dimensions so that JCrop utility will set the values to the hidden fields. Based on these values, you've to crop the image in Java.&lt;br /&gt;5. Write a servlet / struts action class to crop the image based on the parameters&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;The HTML output for you JSP should look like below&lt;/h2&gt;&lt;br /&gt;&lt;pre class="program"&gt;&lt;br /&gt;&amp;lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"&lt;br /&gt;"http://www.w3.org/TR/html4/loose.dtd"&amp;gt;&lt;br /&gt;&amp;lt;html&amp;gt;&lt;br /&gt;  &amp;lt;head&amp;gt;&lt;br /&gt;    &amp;lt;script type="text/javascript" src="/cmint/js/jquerymin.js"&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;    &amp;lt;script type="text/javascript" src="/cmint/js/jcrop.js"&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;    &amp;lt;link rel="stylesheet" href="/cmint/css/myhc/jcrop.css" type="text/css" /&amp;gt;&lt;br /&gt;    &amp;lt;title&amp;gt;Crop and save&amp;lt;/title&amp;gt;&lt;br /&gt;  &amp;lt;/head&amp;gt;&lt;br /&gt;  &amp;lt;body&amp;gt;&lt;br /&gt;    &amp;lt;img src="http://203.197.128.203/commimg/myhotcourses/test/HC2.jpg" id="cropbox"/&amp;gt;&lt;br /&gt;    &amp;lt;script type="text/javascript"&amp;gt;&lt;br /&gt;      $(window).load(function(){&lt;br /&gt;        var jcrop_api;&lt;br /&gt;        initJcrop();&lt;br /&gt;        function initJcrop()//{{{&lt;br /&gt;        {&lt;br /&gt;          jcrop_api = $.Jcrop('#cropbox',{ onChange: setCoords, onSelect: setCoords });&lt;br /&gt;          jcrop_api.setSelect([100,100,300,300]);&lt;br /&gt;          jcrop_api.setOptions({ allowSelect: true, allowMove: true, allowResize: true, aspectRatio: 1 });&lt;br /&gt;        }&lt;br /&gt;      });&lt;br /&gt;      function setCoords(c)&lt;br /&gt;      {&lt;br /&gt;        jQuery('#x1').val(c.x);&lt;br /&gt;        jQuery('#y1').val(c.y);&lt;br /&gt;        jQuery('#x2').val(c.x2);&lt;br /&gt;        jQuery('#y2').val(c.y2);&lt;br /&gt;        jQuery('#w').val(c.w);&lt;br /&gt;        jQuery('#h').val(c.h);&lt;br /&gt;      };      &lt;br /&gt;    &amp;lt;/script&amp;gt;&lt;br /&gt;    &amp;lt;form action="/cmint/cropper"&amp;gt;&lt;br /&gt;      &amp;lt;input type="hidden" name="x1" id="x1"/&amp;gt;&lt;br /&gt;      &amp;lt;input type="hidden" name="y1" id="y1"/&amp;gt;&lt;br /&gt;      &amp;lt;input type="hidden" name="x2" id="x2"/&amp;gt;&lt;br /&gt;      &amp;lt;input type="hidden" name="y2" id="y2"/&amp;gt;&lt;br /&gt;      &amp;lt;input type="hidden" name="w" id="w"/&amp;gt;&lt;br /&gt;      &amp;lt;input type="hidden" name="h" id="h"/&amp;gt;&lt;br /&gt;      &amp;lt;input type="submit" value="Crop" name="action" /&amp;gt;&lt;br /&gt;    &amp;lt;/form&amp;gt;&lt;br /&gt;  &amp;lt;/body&amp;gt;&lt;br /&gt;&amp;lt;/html&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;Java program to crop the image&lt;/h2&gt;&lt;br /&gt;1. Get the buffered image reference by reading the file, which was shown to user to crop&lt;br /&gt;2. Invoke the getSubImage method with the buffered image reference created in step 1 by passing the values user selected using cropper tool. getSubImage will return the buffered reader reference with the resultant image in the buffer.&lt;br /&gt;3. Store the image with the cropped buffered image&lt;br /&gt;&lt;br /&gt;&lt;pre class="program"&gt;&lt;br /&gt;package cropper.view;&lt;br /&gt;&lt;br /&gt;import java.awt.image.BufferedImage;&lt;br /&gt;import java.io.File;&lt;br /&gt;import java.io.IOException;&lt;br /&gt;import java.io.PrintWriter;&lt;br /&gt;import javax.imageio.ImageIO;&lt;br /&gt;import javax.servlet.*;&lt;br /&gt;import javax.servlet.http.*;&lt;br /&gt;&lt;br /&gt;/**&lt;br /&gt; * A servlet which crops the image based on the JCrop tools parameters&lt;br /&gt; * @author SANTHOSH REDDY MANDADI&lt;br /&gt; * @version 1.0&lt;br /&gt; * @since 04th September 2009&lt;br /&gt; */&lt;br /&gt;public class ImageCropperSrv extends HttpServlet&lt;br /&gt;{&lt;br /&gt;  public void service(HttpServletRequest request, &lt;br /&gt;                     HttpServletResponse response) throws ServletException, IOException&lt;br /&gt;  {&lt;br /&gt;    //Get all the parameters which were populated by JCrop&lt;br /&gt;    int x1=Integer.parseInt(request.getParameter("x1"));&lt;br /&gt;    int y1=Integer.parseInt(request.getParameter("y1"));&lt;br /&gt;    int x2=Integer.parseInt(request.getParameter("x2"));&lt;br /&gt;    int y2=Integer.parseInt(request.getParameter("y2"));&lt;br /&gt;    int w=Integer.parseInt(request.getParameter("w"));&lt;br /&gt;    int h=Integer.parseInt(request.getParameter("h"));&lt;br /&gt;    System.out.println(x1+" "+y1+" "+x2+" "+y2+" "+w+" "+" "+h);&lt;br /&gt;    &lt;br /&gt;    //Get the file name from the server&lt;br /&gt;    String file=request.getParameter("file");&lt;br /&gt;    &lt;br /&gt;    //String serverPath="E:/Santhosh/Applications/ImageCropper/servlets app/public_html/nature/";&lt;br /&gt;    String serverPath="/commimg/myhotcourses/test/";&lt;br /&gt;    String sourceFile=serverPath+"HC"+file+".jpg";&lt;br /&gt;    &lt;br /&gt;    //Get the buffered image reference&lt;br /&gt;    BufferedImage image=ImageIO.read(new File(sourceFile));&lt;br /&gt;&lt;br /&gt;    //Get the sub image&lt;br /&gt;    BufferedImage out=image.getSubimage(x1,y1,w,h);&lt;br /&gt;&lt;br /&gt;    //Store the image to a new file&lt;br /&gt;    ImageIO.write(out,"jpg",new File(serverPath+"HC"+file+"t.jpg"));&lt;br /&gt;    &lt;br /&gt;    //Sending the output to the client by showing the cropped image with dimensions&lt;br /&gt;    PrintWriter printer=response.getWriter();&lt;br /&gt;    response.setContentType("text/html");&lt;br /&gt;    printer.println("Photo cropped from "+x1+","+y1+" to the width of "+w+" and height of "+h);&lt;br /&gt;    printer.println("&amp;lt;img src=\""+serverPath+"HC"+file+"t.jpg"+"\" /&amp;gt;");&lt;br /&gt;  }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;The above program has been tested under 1.4, 1.5, 1.6 and under Oracle App server, Apache Tomcat.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://java-servlet-jsp-web.blogspot.com/search/label/Java%20programs" title="Other Java programs"&gt;Click here&lt;/a&gt; to check out other programs that I've developed.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7316847079866971282-377772571259520076?l=java-servlet-jsp-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java-servlet-jsp-web.blogspot.com/feeds/377772571259520076/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/09/java-and-javascript-jcrop-jquery-plugin.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/377772571259520076'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/377772571259520076'/><link rel='alternate' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/09/java-and-javascript-jcrop-jquery-plugin.html' title='Java and Javascript JCrop (JQuery plugin) image cropper'/><author><name>Santhosh Reddy</name><uri>http://www.blogger.com/profile/05232963292855488994</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_P0JbJW7kyKo/ShZkH-FOe4I/AAAAAAAAHP0/ogsB2X0vAMU/S220/IMG_0305.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7316847079866971282.post-5074487214974464640</id><published>2009-09-04T21:40:00.006+05:30</published><updated>2009-09-04T23:25:46.086+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java programs'/><category scheme='http://www.blogger.com/atom/ns#' term='Algorithms'/><title type='text'>Bubble sort algorithm, flow chart, analysis and Java program</title><content type='html'>&lt;h2&gt;Bubble sort&lt;/h2&gt;&lt;br /&gt;Bubble sort is a simple and common sorting algorithm. It sorts by iterating through the list to be sorted, comparing each pair of adjacent items and swapping them if they are in the wrong order. This process will be continued until all the elements are being sorted i.e.; no swapping is required in the list.&lt;br /&gt;&lt;br /&gt;Bubble sort name came for this algorithm due to - like a bubble comes to the top of the water, each iteration will push one smaller element to the top of the list (if the algorithm is for ascending order).&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;Performance&lt;/h2&gt;&lt;br /&gt;Bubble sort is not the efficient algorithm in terms of the performance because its worst-case and average complexity both О(n&lt;sup&gt;2&lt;/sup&gt;), where n is the number of items being sorted.&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;Algorithm&lt;/h2&gt;&lt;br /&gt;&lt;pre class="program"&gt;&lt;br /&gt;START&lt;br /&gt; DECLARE n, list&lt;br /&gt; ACCEPT n&lt;br /&gt; ACCEPT n values into an array list&lt;br /&gt; DO&lt;br /&gt;   swapped := false;&lt;br /&gt;   FOR EACH i IN 0 to n-1&lt;br /&gt;   LOOP&lt;br /&gt;     IF list[i] &gt; list[i+1] THEN&lt;br /&gt;        temp := list[i]&lt;br /&gt;        list[i]:=list[i+1]&lt;br /&gt;        list[i+1]:=temp&lt;br /&gt;     END IF&lt;br /&gt;   END LOOP&lt;br /&gt; WHILE swapped = true&lt;br /&gt;END&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;Java program&lt;/h2&gt;&lt;br /&gt;&lt;pre class="program"&gt;&lt;br /&gt;import java.io.*;&lt;br /&gt;&lt;br /&gt;/**&lt;br /&gt; * This class demonstrates the bubble sort.&lt;br /&gt; * @author SANTHOSH REDDY MANDADI&lt;br /&gt; * @version 1.0&lt;br /&gt; * @since 04th September 2009&lt;br /&gt; */&lt;br /&gt;public class BubbleSort&lt;br /&gt;{&lt;br /&gt;  public static void main(String[] args) throws Exception&lt;br /&gt;  {&lt;br /&gt;    int values[]=new int[5];&lt;br /&gt;    BufferedReader br=new BufferedReader(new InputStreamReader(System.in));&lt;br /&gt;    System.out.println("Enter "+values.length+" values to sort using bubble sort");&lt;br /&gt;    for(int i=0;i&amp;lt;values.length;i++)&lt;br /&gt;    {&lt;br /&gt;      try{&lt;br /&gt;        values[i]=Integer.parseInt(br.readLine());&lt;br /&gt;      }catch(NumberFormatException e)&lt;br /&gt;      {&lt;br /&gt;        e.printStackTrace();&lt;br /&gt;        values[i]=0;&lt;br /&gt;      }&lt;br /&gt;    }&lt;br /&gt;    bubbleSort(values);&lt;br /&gt;    for(int i=0;i&amp;lt;values.length;i++)&lt;br /&gt;    {&lt;br /&gt;      System.out.print(values[i]+" ");&lt;br /&gt;    }&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  /**&lt;br /&gt;   * This method will sort the passed array&lt;br /&gt;   * @author SANTHOSH REDDY MANDADI&lt;br /&gt;   * @since 4-Sep-2009&lt;br /&gt;   * @param an array of the list of values to be sorted&lt;br /&gt;   */&lt;br /&gt;  public static void bubbleSort(int[] values)&lt;br /&gt;  {&lt;br /&gt;    boolean swapped=false;&lt;br /&gt;    do&lt;br /&gt;    {&lt;br /&gt;      //When initializing the each loop assing false to swapped flag&lt;br /&gt;      swapped = false;&lt;br /&gt;      //Looping through the list&lt;br /&gt;      for(int i=0; i&amp;lt;values.length-1; i++)&lt;br /&gt;      {&lt;br /&gt;        //Comparing the adjecent elements&lt;br /&gt;        if(values[i]&gt;values[i+1])&lt;br /&gt;        {&lt;br /&gt;          //Swapping&lt;br /&gt;          int temp=values[i];&lt;br /&gt;          values[i]=values[i+1];&lt;br /&gt;          values[i+1]=temp;&lt;br /&gt;          //Swapped is true&lt;br /&gt;          swapped=true;&lt;br /&gt;        }&lt;br /&gt;      }&lt;br /&gt;    }while (swapped);&lt;br /&gt;  }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;Explanation:&lt;/h2&gt;&lt;br /&gt;Let us consider we've executed the above program by inputting the values (43, 25, 21, 56, 4). Here is how the list will be modified in each iteration.&lt;br /&gt;swapped value = false&lt;br /&gt;&lt;h3&gt;First iteration:&lt;/h3&gt;&lt;br /&gt;&lt;b&gt;43 25&lt;/b&gt; 21 56 4 &amp;raquo; &lt;b&gt;25 43&lt;/b&gt; 21 56 4 - swapped since 43 &gt; 25&lt;br /&gt;25 &lt;b&gt;43 21&lt;/b&gt; 56 4 &amp;raquo; 25 &lt;b&gt;21 43&lt;/b&gt; 56 4 - swapped since 43 &gt; 21&lt;br /&gt;25 21 &lt;b&gt;43 56&lt;/b&gt; 4 &amp;raquo; 25 21 &lt;b&gt;43 56&lt;/b&gt; 4 - not swapped since 43 &lt; 56&lt;br /&gt;25 21 43 &lt;b&gt;56 4&lt;/b&gt; &amp;raquo; 25 21 43 &lt;b&gt;4 56&lt;/b&gt; - swapped since 54 &gt; 4&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Second iteration:&lt;/h3&gt;&lt;br /&gt;25 21 43 4 56 &amp;raquo; 21 25 43 4 56&lt;br /&gt;21 25 43 4 56 &amp;raquo; 21 25 43 4 56&lt;br /&gt;21 25 43 4 56 &amp;raquo; 21 25 4 43 56&lt;br /&gt;21 25 4 43 56 &amp;raquo; 21 25 4 43 56&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Third iteration:&lt;/h3&gt;&lt;br /&gt;21 25 4 43 56 &amp;raquo; 21 25 4 43 56&lt;br /&gt;21 25 4 43 56 &amp;raquo; 21 4 25 43 56&lt;br /&gt;21 4 25 43 56 &amp;raquo; 21 4 25 43 56&lt;br /&gt;21 4 25 43 56 &amp;raquo; 21 4 25 43 56&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Fourth iteration:&lt;/h3&gt;&lt;br /&gt;21 4 25 43 56 &amp;raquo; 4 21 25 43 56&lt;br /&gt;4 21 25 43 56 &amp;raquo; 4 21 25 43 56&lt;br /&gt;4 21 25 43 56 &amp;raquo; 4 21 25 43 56&lt;br /&gt;4 21 25 43 56 &amp;raquo; 4 21 25 43 56&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Fifth iteration:&lt;/h3&gt;&lt;br /&gt;4 21 25 43 56 &amp;raquo; 4 21 25 43 56&lt;br /&gt;4 21 25 43 56 &amp;raquo; 4 21 25 43 56&lt;br /&gt;4 21 25 43 56 &amp;raquo; 4 21 25 43 56&lt;br /&gt;4 21 25 43 56 &amp;raquo; 4 21 25 43 56&lt;br /&gt;&lt;br /&gt;Since there're no swaps happened in the fifth operation, the outer loop will be stopped since the condition swapped = true false.&lt;br /&gt;&lt;br /&gt;Above program has been tested in JDK 1.4, 1.5, and 1.6.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://java-servlet-jsp-web.blogspot.com/search/label/Java%20programs" title="Other Java programs"&gt;Click here&lt;/a&gt; to check out other programs that I've developed.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7316847079866971282-5074487214974464640?l=java-servlet-jsp-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java-servlet-jsp-web.blogspot.com/feeds/5074487214974464640/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/09/bubble-sort-algorithm-flow-chart.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/5074487214974464640'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/5074487214974464640'/><link rel='alternate' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/09/bubble-sort-algorithm-flow-chart.html' title='Bubble sort algorithm, flow chart, analysis and Java program'/><author><name>Santhosh Reddy</name><uri>http://www.blogger.com/profile/05232963292855488994</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_P0JbJW7kyKo/ShZkH-FOe4I/AAAAAAAAHP0/ogsB2X0vAMU/S220/IMG_0305.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7316847079866971282.post-5347987804118626576</id><published>2009-08-25T19:50:00.004+05:30</published><updated>2009-09-11T23:00:51.948+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='SCJP 1.5 Question Bank'/><title type='text'>Sun Certified Java Professional (SCJP) 1.5 Question Bank - 10</title><content type='html'>If you haven't read the previous article, &lt;a href="http://java-servlet-jsp-web.blogspot.com/2009/08/sun-certified-java-professional-scjp-15.html" title="Read eighth SCJP question bank"&gt;click here&lt;/a&gt; to read.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Question: 46&lt;/strong&gt;&lt;br /&gt;Given:&lt;br /&gt;1. public class Base {&lt;br /&gt;2. public static final String FOO = "foo";&lt;br /&gt;3. public static void main(String[] args) {&lt;br /&gt;4. Base b = new Base();&lt;br /&gt;5. Sub s = new Sub();&lt;br /&gt;6. System.out.print(Base.FOO);&lt;br /&gt;7. System.out.print(Sub.FOO);&lt;br /&gt;8. System.out.print(b.FOO);&lt;br /&gt;9. System.out.print(s.FOO);&lt;br /&gt;10. System.out.print(((Base)s).FOO);&lt;br /&gt;11. } }&lt;br /&gt;12. class Sub extends Base {public static final String FOO="bar";}&lt;br /&gt;What is the result?&lt;br /&gt;A. foofoofoofoofoo&lt;br /&gt;B. foobarfoobarbar&lt;br /&gt;C. foobarfoofoofoo&lt;br /&gt;D. foobarfoobarfoo&lt;br /&gt;E. barbarbarbarbar&lt;br /&gt;F. foofoofoobarbar&lt;br /&gt;G. foofoofoobarfoo&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Answer: D&lt;/strong&gt;&lt;br /&gt;&lt;hr /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Question: 47&lt;/strong&gt;&lt;br /&gt;Which two statements are true? (Choose two.)&lt;br /&gt;A. An encapsulated, public class promotes re-use.&lt;br /&gt;B. Classes that share the same interface are always tightly encapsulated.&lt;br /&gt;C. An encapsulated class allows subclasses to overload methods, but does NOT allow overriding methods.&lt;br /&gt;D. An encapsulated class allows a programmer to change an implementation without affecting outside code.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Answer: A, D&lt;/strong&gt;&lt;br /&gt;&lt;hr /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Question: 48&lt;/strong&gt;&lt;br /&gt;Given classes defined in two different files:&lt;br /&gt;1. package util;&lt;br /&gt;2. public class BitUtils {&lt;br /&gt;3. public static void process(byte[]) { /* more code here */ }&lt;br /&gt;4. }&lt;br /&gt;1. package app;&lt;br /&gt;2. public class SomeApp {&lt;br /&gt;3. public static void main(String[] args) {&lt;br /&gt;4. byte[] bytes = new byte[256];&lt;br /&gt;5. // insert code here&lt;br /&gt;6. }&lt;br /&gt;7. }&lt;br /&gt;What is required at line 5 in class SomeApp to use the process method of BitUtils?&lt;br /&gt;A. process(bytes);&lt;br /&gt;B. BitUtils.process(bytes);&lt;br /&gt;C. util.BitUtils.process(bytes);&lt;br /&gt;D. SomeApp cannot use methods in BitUtils.&lt;br /&gt;E. import util.BitUtils.*; process(bytes);&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Answer: C&lt;/strong&gt;&lt;br /&gt;&lt;hr /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Question: 49&lt;/strong&gt;&lt;br /&gt;Given:&lt;br /&gt;13. public class Pass {&lt;br /&gt;14. public static void main(String [] args) {&lt;br /&gt;15. int x = 5;&lt;br /&gt;16. Pass p = new Pass();&lt;br /&gt;17. p.doStuff(x);&lt;br /&gt;18. System.out.print(" main x = " + x);&lt;br /&gt;19. }&lt;br /&gt;20.&lt;br /&gt;21. void doStuff(int x) {&lt;br /&gt;22. System.out.print(" doStuff x = " + x++);&lt;br /&gt;23. }&lt;br /&gt;24. }&lt;br /&gt;What is the result?&lt;br /&gt;A. Compilation fails.&lt;br /&gt;B. An exception is thrown at runtime.&lt;br /&gt;C. doStuff x = 6 main x = 6&lt;br /&gt;D. doStuff x = 5 main x = 5&lt;br /&gt;E. doStuff x = 5 main x = 6&lt;br /&gt;F. doStuff x = 6 main x = 5&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Answer: D&lt;/strong&gt;&lt;br /&gt;&lt;hr /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Question: 50&lt;/strong&gt;&lt;br /&gt;Given:&lt;br /&gt;11. public static void test(String str) {&lt;br /&gt;12. if (str == null | str.length() == 0) {&lt;br /&gt;13. System.out.println("String is empty");&lt;br /&gt;14. } else {&lt;br /&gt;15. System.out.println("String is not empty");&lt;br /&gt;16. }&lt;br /&gt;17. }&lt;br /&gt;And the invocation:&lt;br /&gt;31. test(null);&lt;br /&gt;What is the result?&lt;br /&gt;A. An exception is thrown at runtime.&lt;br /&gt;B. "String is empty" is printed to output.&lt;br /&gt;C. Compilation fails because of an error in line 12.&lt;br /&gt;D. "String is not empty" is printed to output.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Answer: A&lt;/strong&gt;&lt;br /&gt;&lt;hr /&gt;&lt;br /&gt;&lt;br /&gt;If you would like to read all the SCJP Question bank articles, please &lt;a href="http://java-servlet-jsp-web.blogspot.com/search/label/SCJP%201.5%20Question%20Bank" title="Read all SCJP posts"&gt;click here&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7316847079866971282-5347987804118626576?l=java-servlet-jsp-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java-servlet-jsp-web.blogspot.com/feeds/5347987804118626576/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/08/sun-certified-java-professional-scjp-15_25.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/5347987804118626576'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/5347987804118626576'/><link rel='alternate' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/08/sun-certified-java-professional-scjp-15_25.html' title='Sun Certified Java Professional (SCJP) 1.5 Question Bank - 10'/><author><name>Santhosh Reddy</name><uri>http://www.blogger.com/profile/05232963292855488994</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_P0JbJW7kyKo/ShZkH-FOe4I/AAAAAAAAHP0/ogsB2X0vAMU/S220/IMG_0305.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7316847079866971282.post-2782832884825289421</id><published>2009-08-23T00:45:00.000+05:30</published><updated>2009-08-23T00:55:52.140+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Javascript'/><title type='text'>Javascript - get HTML drop down label</title><content type='html'>Normally when you're using drop downs, you can get the selected value through Javascript. Did you need of the selected drop down label previously? Here I'm going to give you a small function with which you can get it.&lt;br /&gt;&lt;br /&gt;&lt;pre class="program"&gt;&lt;br /&gt;&amp;lt;SCRIPT type="text/javascript"&amp;gt;&lt;br /&gt;//Function to get the drop down label for the given index&lt;br /&gt;function getDropDownLabel(element)&lt;br /&gt;{&lt;br /&gt; if($(element))&lt;br /&gt; {&lt;br /&gt;  var obj=$(element);&lt;br /&gt;  return obj[obj.selectedIndex].firstChild.nodeValue;&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;function $(element)&lt;br /&gt;{&lt;br /&gt; return document.getElementById(element);&lt;br /&gt;}&lt;br /&gt;&amp;lt;/SCRIPT&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;You can give a try with below example...&lt;br /&gt;&lt;br /&gt;&lt;select id="sel"&gt;&lt;br /&gt; &lt;option&gt;Windows&lt;/option&gt;&lt;br /&gt; &lt;option&gt;Solaris&lt;/option&gt;&lt;br /&gt; &lt;option&gt;Linux&lt;/option&gt;&lt;br /&gt; &lt;option&gt;Unix&lt;/option&gt;&lt;br /&gt;&lt;/select&gt;&lt;br /&gt;&lt;input type="button" value="Get label" onclick="alert(getDropDownLabel('sel'))" /&gt;&lt;br /&gt;&lt;script type="text/javascript"&gt;function getDropDownLabel(element){if($(element)){var obj=$(element);return obj[obj.selectedIndex].firstChild.nodeValue;}}function $(element){return document.getElementById(element);}&lt;/SCRIPT&gt;&lt;br /&gt;&lt;br /&gt;This program has been tested on all the major browsers like IE &amp;gt;= 6.0, Mozilla &amp;gt;= 2.0 and Google chrome...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7316847079866971282-2782832884825289421?l=java-servlet-jsp-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java-servlet-jsp-web.blogspot.com/feeds/2782832884825289421/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/08/javascript-get-html-drop-down-label.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/2782832884825289421'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/2782832884825289421'/><link rel='alternate' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/08/javascript-get-html-drop-down-label.html' title='Javascript - get HTML drop down label'/><author><name>Santhosh Reddy</name><uri>http://www.blogger.com/profile/05232963292855488994</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_P0JbJW7kyKo/ShZkH-FOe4I/AAAAAAAAHP0/ogsB2X0vAMU/S220/IMG_0305.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7316847079866971282.post-7480471192023429583</id><published>2009-08-23T00:33:00.001+05:30</published><updated>2009-08-23T00:42:47.409+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Javascript'/><title type='text'>Javascript - set default values for HTML form elements like Textbox, Drop down</title><content type='html'>Some times you might want to set default values for the HTML elements like Textbox and Drop down fields through Javascript. The below script would be very handy for this task. &lt;br /&gt;&lt;br /&gt;&lt;pre class="program"&gt;&lt;br /&gt;&amp;lt;SCRIPT type="text/javascript"&amp;gt;&lt;br /&gt;//Function to set the default value for the passed object&lt;br /&gt;function setDefaultValue(inputObj)&lt;br /&gt;{&lt;br /&gt; if(inputObj.type == "text")&lt;br /&gt; {&lt;br /&gt;  inputObj.value="";&lt;br /&gt; }&lt;br /&gt; else if((inputObj.type).substr(0, 6) == "select")&lt;br /&gt; {&lt;br /&gt;  inputObj.selectedIndex=0;&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;function $(element)&lt;br /&gt;{&lt;br /&gt; return document.getElementById(element);&lt;br /&gt;}&lt;br /&gt;&amp;lt;/SCRIPT&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;SCRIPT type="text/javascript"&gt;function setDefaultValue(inputObj){if(inputObj.type == "text"){inputObj.value="";}else if((inputObj.type).substr(0, 6) == "select"){inputObj.selectedIndex=0;}}function $(element){return document.getElementById(element);}&lt;/SCRIPT&gt;&lt;br /&gt;&lt;br /&gt;I've implemented the above function just only for text field and drop down. You can even extend this functionality for other HTML form fields as well. Here is an example - give a try&lt;br /&gt;&lt;br /&gt;&lt;input type="text" id="txt" value="Santhosh Reddy Mandadi" /&gt;&lt;br /&gt;&lt;select id="sel"&gt;&lt;br /&gt; &lt;option&gt;Please select&lt;/option&gt;&lt;br /&gt; &lt;option selected="selected"&gt;Java&lt;/option&gt;&lt;br /&gt; &lt;option&gt;C&lt;/option&gt;&lt;br /&gt; &lt;option&gt;C++&lt;/option&gt;&lt;br /&gt; &lt;option&gt;Oracle&lt;/option&gt;&lt;br /&gt; &lt;option&gt;.NET&lt;/option&gt;&lt;br /&gt;&lt;/select&gt;&lt;br /&gt;&lt;input type="button" onclick="setDefaultValue($('txt'));setDefaultValue($('sel'));" value="Set default values" /&gt;&lt;br /&gt;&lt;br /&gt;This program has been tested on all the major browsers like IE &amp;gt;= 6.0, Mozilla &amp;gt;= 2.0 and Google chrome...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7316847079866971282-7480471192023429583?l=java-servlet-jsp-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java-servlet-jsp-web.blogspot.com/feeds/7480471192023429583/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/08/javascript-set-default-values-for-html.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/7480471192023429583'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/7480471192023429583'/><link rel='alternate' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/08/javascript-set-default-values-for-html.html' title='Javascript - set default values for HTML form elements like Textbox, Drop down'/><author><name>Santhosh Reddy</name><uri>http://www.blogger.com/profile/05232963292855488994</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_P0JbJW7kyKo/ShZkH-FOe4I/AAAAAAAAHP0/ogsB2X0vAMU/S220/IMG_0305.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7316847079866971282.post-7437766436216386112</id><published>2009-08-22T08:45:00.003+05:30</published><updated>2009-08-22T13:13:47.910+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Javascript'/><title type='text'>HTML elements (like DIV, SPAN) dynamic position - Javascript</title><content type='html'>Now a days, AJAX programming is being used increasingly. As a result, DHTML is playing a vital role in current web. Dynamic HTML is possible through the scripting languages like Javascript and VBScript i.e.; programmers will invoke AJAX url to get the response, and based on it, intended task would be performed like showing the div with the response content or hiding the HTML element.&lt;br /&gt;&lt;br /&gt;In order to implement these kinds of stuff, you should have very strong scripting skills (Of course, there is a lot to learn and learning process never ends). Here, I'm going to brief you an important technique, which is dynamic positioning of the HTML elements.&lt;br /&gt;&lt;br /&gt;Let me take an example to explain it to you clearly. I've two text fields and when I place the cursor inside a text field, I would like to see a popup next to text box by providing some kind of help for the user to enter the data. In HTML code, add two text fields and a div with display style property none, since div should be positioned dynamically when I place the cursor inside a text field. The code look like&lt;br /&gt;&lt;pre class="program"&gt;&lt;br /&gt;&amp;lt;HTML&amp;gt;&lt;br /&gt; &amp;lt;HEAD&amp;gt;&lt;br /&gt;  &amp;lt;TITLE&amp;gt;HTML element dynamic position&amp;lt;/TITLE&amp;gt;&lt;br /&gt; &amp;lt;/HEAD&amp;gt;&lt;br /&gt; &amp;lt;BODY&amp;gt;&lt;br /&gt;  Name &amp;lt;INPUT type="text" id="text1" onfocus="displayHelp('text1')" /&amp;gt;&amp;ltBR/&amp;gt;&lt;br /&gt;  Password &amp;lt;INPUT type="text" id="text2" onfocus="displayHelp('text2')" /&amp;gt;&lt;br /&gt;  &amp;lt;div id="helptext" style="display:none;"&amp;gt;Here help text goes...&amp;lt;br/&amp;gt;Line 2&amp;lt;/div&amp;gt;&lt;br /&gt; &amp;lt;/BODY&amp;gt;&lt;br /&gt;&amp;lt;/HTML&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;I've used a javascript function displayHelp on onfocus event of text fields, since we need to show the help popup when text field is been highlighted. Now our job is to find out the left and top positions of the selected text field so that we can place the popup accordingly.&lt;br /&gt;&lt;br /&gt;&lt;pre class="program"&gt;&lt;br /&gt;&amp;ltSCRIPT type="text/javascript"&amp;gt;&lt;br /&gt;function getTopPosition(inputObj)&lt;br /&gt;{&lt;br /&gt; var returnValue = inputObj.offsetTop;&lt;br /&gt; while((inputObj = inputObj.offsetParent) != null){&lt;br /&gt;  returnValue += inputObj.offsetTop;&lt;br /&gt; }&lt;br /&gt; return returnValue;&lt;br /&gt;}&lt;br /&gt;function getLeftPosition(inputObj)&lt;br /&gt;{&lt;br /&gt; var returnValue = inputObj.offsetLeft;&lt;br /&gt; while((inputObj = inputObj.offsetParent) != null){&lt;br /&gt;  returnValue += inputObj.offsetLeft;&lt;br /&gt; }&lt;br /&gt; return returnValue;&lt;br /&gt;}&lt;br /&gt;function displayHelp(element)&lt;br /&gt;{&lt;br /&gt; var left=getLeftPosition($(element))+$(element).offsetWidth;&lt;br /&gt; var top=getTopPosition($(element));&lt;br /&gt; $('helptext').style.position="absolute";&lt;br /&gt; $('helptext').style.left=left+"px";&lt;br /&gt; $('helptext').style.top=top+"px";&lt;br /&gt; $('helptext').style.display="block";&lt;br /&gt; $('helptext').style.border="1px solid #DEE7FA";&lt;br /&gt; $('helptext').style.background="#ECF5FF";&lt;br /&gt; $('helptext').style.width="200";&lt;br /&gt; $('helptext').style.height="50";&lt;br /&gt;}&lt;br /&gt;function $(element)&lt;br /&gt;{&lt;br /&gt; return document.getElementById(element);&lt;br /&gt;}&lt;br /&gt;&amp;lt;/SCRIPT&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;I've used a single div and positioned that based on the dynamic width and height values. You can test this below...&lt;br /&gt;&lt;br /&gt;Name &lt;INPUT type="text" id="text1" onfocus="displayHelp('text1')" /&gt;&lt;BR/&gt;&lt;br /&gt;Password &lt;INPUT type="text" id="text2" onfocus="displayHelp('text2')" /&gt;&lt;br /&gt;&lt;div id="helptext" style="display:none;"&gt;Here help text goes...&lt;br/&gt;Line 2&lt;/div&gt;&lt;br /&gt;&lt;SCRIPT type="text/javascript"&gt;function getTopPosition(inputObj){var returnValue = inputObj.offsetTop;while((inputObj = inputObj.offsetParent) != null){returnValue += inputObj.offsetTop;}return returnValue;}function getLeftPosition(inputObj){var returnValue = inputObj.offsetLeft;while((inputObj = inputObj.offsetParent) != null){returnValue += inputObj.offsetLeft;}return returnValue;}function displayHelp(element){var left=getLeftPosition($(element))+$(element).offsetWidth;var top=getTopPosition($(element));$('helptext').style.position="absolute"; $('helptext').style.left=left+"px";$('helptext').style.top=top+"px";$('helptext').style.display="block";$('helptext').style.border="1px solid #DEE7FA"; $('helptext').style.background="#ECF5FF";$('helptext').style.width="200";$('helptext').style.height="50";}function $(element){return document.getElementById(element);}&lt;/SCRIPT&gt;&lt;br /&gt;&lt;br /&gt;This program has been tested on all the major browsers like IE &gt;= 6.0, Mozilla &gt;= 2.0 and Google chrome... Hope you enjoyed it...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7316847079866971282-7437766436216386112?l=java-servlet-jsp-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java-servlet-jsp-web.blogspot.com/feeds/7437766436216386112/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/08/html-elements-like-div-span-dynamic.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/7437766436216386112'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/7437766436216386112'/><link rel='alternate' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/08/html-elements-like-div-span-dynamic.html' title='HTML elements (like DIV, SPAN) dynamic position - Javascript'/><author><name>Santhosh Reddy</name><uri>http://www.blogger.com/profile/05232963292855488994</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_P0JbJW7kyKo/ShZkH-FOe4I/AAAAAAAAHP0/ogsB2X0vAMU/S220/IMG_0305.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7316847079866971282.post-4133773804139822780</id><published>2009-08-21T23:09:00.002+05:30</published><updated>2009-08-22T00:36:05.438+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Servlets'/><title type='text'>What is a Servlet? - basics</title><content type='html'>Do you know why Java became more popular language with in a short span of time? The very simple answer for this question is - Java is a very simple and efficient to develop web applications. This is indirectly because, Java is platform independent. The approach of "Byte code" has changed the entire world and it was a very innovative idea from the Sun team who lead by James Gausling.&lt;br /&gt;&lt;br /&gt;Sun Microsystems had come up with a solution for CGI scripts with an ultra flexibility structure to develop complex web applications, which was the revolutionary process at that times. They named the technology name as "Servlet". Now I'm going to discuss about some basic features.&lt;br /&gt;&lt;br /&gt;Servlets can be implemented on any transactional layer protocols like HTTP, FTP, SMTP, etc though HTTP is most commonly used protocol for Servlets.&lt;br /&gt;&lt;br /&gt;I hope you know HTTP protocol and how it works? If you're new to HTTP protocol, please read my old post about &lt;a href="http://java-servlet-jsp-web.blogspot.com/2009/06/http-methods-deep-look.html" title="Go to HTTP Protocol"&gt;HTTP Protocol&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;What is a Servlet?&lt;/h2&gt;&lt;br /&gt;A Servlet is a server side component, which reacts for each client request. Programmatically a Servlet is a Java class which directly or indirectly a implementation class of javax.servlet.Servlet interface.&lt;br /&gt;&lt;br /&gt;Sun Microsystems had released the open source Servlet technology specification, by which any web container vendor has to implement the runtime environment. Web container is a terminology for a HTTP server. The popular web containers are Apache Tomcat, Sun One server, Oracle Weblogic (It was an initially owned by Bea and Oracle took over Bea later), IBM JBoss etc.&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;How it works?&lt;/h2&gt;&lt;br /&gt;Servlets technology is completely Client and Server model. Since most popular protocol that people use to implement Servlets is HTTP, Servlets will run on web server to serve the web client (Typically a web browser) request. As I said earlier, each Servlet is an implementation class which will have some predefined methods like service, doGet, doPost etc. One of the method would be invoked when a request comes for a respective Servlet.&lt;br /&gt;&lt;br /&gt;In my future posts, I'll explain about Servlet programming with some sample codes.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7316847079866971282-4133773804139822780?l=java-servlet-jsp-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java-servlet-jsp-web.blogspot.com/feeds/4133773804139822780/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/08/what-is-servlet-basics.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/4133773804139822780'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/4133773804139822780'/><link rel='alternate' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/08/what-is-servlet-basics.html' title='What is a Servlet? - basics'/><author><name>Santhosh Reddy</name><uri>http://www.blogger.com/profile/05232963292855488994</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_P0JbJW7kyKo/ShZkH-FOe4I/AAAAAAAAHP0/ogsB2X0vAMU/S220/IMG_0305.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7316847079866971282.post-2960457171175002035</id><published>2009-08-12T18:44:00.002+05:30</published><updated>2009-08-12T18:50:33.941+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='SCJP 1.5 Question Bank'/><title type='text'>Sun Certified Java Professional (SCJP) 1.5 Question Bank - 9</title><content type='html'>Here is the ninth article of questions on SCJP 1.5. If you haven't read the seventh article, &lt;a href="http://java-servlet-jsp-web.blogspot.com/2009/07/sun-certified-java-professional-scjp-15_4483.html" title="Read eighth SCJP question bank"&gt;click here&lt;/a&gt; to read.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Question: 41&lt;/strong&gt;&lt;br /&gt;Which two statements are true about has-a and is-a relationships? (Choose&lt;br /&gt;two.)&lt;br /&gt;A. Inheritance represents an is-a relationship.&lt;br /&gt;B. Inheritance represents a has-a relationship.&lt;br /&gt;C. Interfaces must be used when creating a has-a relationship.&lt;br /&gt;D. Instance variables can be used when creating a has-a relationship.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Answer: A, D&lt;/strong&gt;&lt;br /&gt;&lt;hr /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Question: 42&lt;/strong&gt;&lt;br /&gt;Given:&lt;br /&gt;10: public class Hello {&lt;br /&gt;11: String title;&lt;br /&gt;12: int value;&lt;br /&gt;13: public Hello() {&lt;br /&gt;14: title += " World";&lt;br /&gt;15: }&lt;br /&gt;16: public Hello(int value) {&lt;br /&gt;17: this.value = value;&lt;br /&gt;18: title = "Hello";&lt;br /&gt;19: Hello();&lt;br /&gt;20: }&lt;br /&gt;21: }&lt;br /&gt;and:&lt;br /&gt;30: Hello c = new Hello(5);&lt;br /&gt;31: System.out.println(c.title);&lt;br /&gt;What is the result?&lt;br /&gt;A. Hello&lt;br /&gt;B. Hello World&lt;br /&gt;C. Compilation fails.&lt;br /&gt;D. Hello World 5&lt;br /&gt;E. The code runs with no output.&lt;br /&gt;F. An exception is thrown at runtime.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Answer: C&lt;/strong&gt;&lt;br /&gt;&lt;hr /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Question: 43&lt;/strong&gt;&lt;br /&gt;Given:&lt;br /&gt;1. class Super {&lt;br /&gt;2. private int a;&lt;br /&gt;3. protected Super(int a) { this.a = a; }&lt;br /&gt;4. }&lt;br /&gt;...&lt;br /&gt;11. class Sub extends Super {&lt;br /&gt;12. public Sub(int a) { super(a); }&lt;br /&gt;13. public Sub() { this.a = 5; }&lt;br /&gt;14. }&lt;br /&gt;Which two, independently, will allow Sub to compile? (Choose two.)&lt;br /&gt;A. Change line 2 to:&lt;br /&gt;public int a;&lt;br /&gt;B. Change line 2 to:&lt;br /&gt;protected int a;&lt;br /&gt;C. Change line 13 to:&lt;br /&gt;public Sub() { this(5); }&lt;br /&gt;D. Change line 13 to:&lt;br /&gt;public Sub() { super(5); }&lt;br /&gt;E. Change line 13 to:&lt;br /&gt;public Sub() { super(a); }&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Answer: C, D&lt;/strong&gt;&lt;br /&gt;&lt;hr /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Question: 44&lt;/strong&gt;&lt;br /&gt;Given:&lt;br /&gt;1. class ClassA {&lt;br /&gt;2. public int numberOfInstances;&lt;br /&gt;3. protected ClassA(int numberOfInstances) {&lt;br /&gt;4. this.numberOfInstances = numberOfInstances;&lt;br /&gt;5. }&lt;br /&gt;6. }&lt;br /&gt;7. public class ExtendedA extends ClassA {&lt;br /&gt;8. private ExtendedA(int numberOfInstances) {&lt;br /&gt;9. super(numberOfInstances);&lt;br /&gt;10. }&lt;br /&gt;11. public static void main(String[] args) {&lt;br /&gt;12. ExtendedA ext = new ExtendedA(420);&lt;br /&gt;13. System.out.print(ext.numberOfInstances);&lt;br /&gt;14. }&lt;br /&gt;15. }&lt;br /&gt;Which statement is true?&lt;br /&gt;A. 420 is the output.&lt;br /&gt;B. An exception is thrown at runtime.&lt;br /&gt;C. All constructors must be declared public.&lt;br /&gt;D. Constructors CANNOT use the private modifier.&lt;br /&gt;E. Constructors CANNOT use the protected modifier.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Answer: A&lt;/strong&gt;&lt;br /&gt;&lt;hr /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Question: 45&lt;/strong&gt;&lt;br /&gt;Given:&lt;br /&gt;1. interface A { public void aMethod(); }&lt;br /&gt;2. interface B { public void bMethod(); }&lt;br /&gt;3. interface C extends A,B { public void cMethod(); }&lt;br /&gt;4. class D implements B {&lt;br /&gt;5. public void bMethod(){}&lt;br /&gt;6. }&lt;br /&gt;7. class E extends D implements C {&lt;br /&gt;8. public void aMethod(){}&lt;br /&gt;9. public void bMethod(){}&lt;br /&gt;10. public void cMethod(){}&lt;br /&gt;11. }&lt;br /&gt;What is the result?&lt;br /&gt;A. Compilation fails because of an error in line 3.&lt;br /&gt;B. Compilation fails because of an error in line 7.&lt;br /&gt;C. Compilation fails because of an error in line 9.&lt;br /&gt;D. If you define D e = new E(), then e.bMethod() invokes the version of bMethod() defined in Line 5.&lt;br /&gt;E. If you define D e = (D)(new E()), then e.bMethod() invokes the version of bMethod() defined in Line 5.&lt;br /&gt;F. If you define D e = (D)(new E()), then e.bMethod() invokes the version of bMethod() defined in Line 9.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Answer: F&lt;/strong&gt;&lt;br /&gt;&lt;hr /&gt;&lt;br /&gt;&lt;br /&gt;If you would like to read all the SCJP Question bank articles, please &lt;a href="http://java-servlet-jsp-web.blogspot.com/search/label/SCJP%201.5%20Question%20Bank" title="Read all SCJP posts"&gt;click here&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7316847079866971282-2960457171175002035?l=java-servlet-jsp-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java-servlet-jsp-web.blogspot.com/feeds/2960457171175002035/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/08/sun-certified-java-professional-scjp-15.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/2960457171175002035'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/2960457171175002035'/><link rel='alternate' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/08/sun-certified-java-professional-scjp-15.html' title='Sun Certified Java Professional (SCJP) 1.5 Question Bank - 9'/><author><name>Santhosh Reddy</name><uri>http://www.blogger.com/profile/05232963292855488994</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_P0JbJW7kyKo/ShZkH-FOe4I/AAAAAAAAHP0/ogsB2X0vAMU/S220/IMG_0305.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7316847079866971282.post-4858397338740861146</id><published>2009-08-04T19:08:00.002+05:30</published><updated>2009-08-04T19:17:07.747+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Javascript'/><title type='text'>Javascript generic function $ for document.getElementById</title><content type='html'>document.getElementById() is the most common used construct by a Javascript programmer. Most of the APIs have generalized a common method to use this construct. Here is how and what needs to be included on your page.&lt;br /&gt;&lt;br /&gt;It is very simple technique, define a function with very short name to return the object be using the above construct. This way we can reduce the page weight as well.&lt;br /&gt;&lt;br /&gt;&lt;pre class="program"&gt;&lt;br /&gt;&amp;lt;script type="text/javascript"&amp;gt;&lt;br /&gt;function $(id)&lt;br /&gt;{&lt;br /&gt; return document.getElementById(id);&lt;br /&gt;}&lt;br /&gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Use the $ function wherever you would like to get the object based on the id. $('x') would return the object reference of the page element which has the id "x".&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7316847079866971282-4858397338740861146?l=java-servlet-jsp-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java-servlet-jsp-web.blogspot.com/feeds/4858397338740861146/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/08/javascript-generic-function-for.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/4858397338740861146'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/4858397338740861146'/><link rel='alternate' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/08/javascript-generic-function-for.html' title='Javascript generic function $ for document.getElementById'/><author><name>Santhosh Reddy</name><uri>http://www.blogger.com/profile/05232963292855488994</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_P0JbJW7kyKo/ShZkH-FOe4I/AAAAAAAAHP0/ogsB2X0vAMU/S220/IMG_0305.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7316847079866971282.post-3021070082209964638</id><published>2009-07-29T22:10:00.003+05:30</published><updated>2009-07-31T21:07:42.638+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='SCJP 1.5 Question Bank'/><title type='text'>Sun Certified Java Professional (SCJP) 1.5 Question Bank - 8</title><content type='html'>Here is the eighth article of questions on SCJP 1.5. If you haven't read the seventh article, &lt;a href="http://java-servlet-jsp-web.blogspot.com/2009/07/sun-certified-java-professional-scjp-15_24.html" title="Read sixth SCJP question bank"&gt;click here&lt;/a&gt; to read.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Question: 36&lt;/strong&gt;&lt;br /&gt;Given:&lt;br /&gt;12. NumberFormat nf = NumberFormat.getInstance();&lt;br /&gt;13. nf.setMaximumFractionDigits(4);&lt;br /&gt;14. nf.setMinimumFractionDigits(2);&lt;br /&gt;15. String a = nf.format(3.1415926);&lt;br /&gt;16. String b = nf.format(2);&lt;br /&gt;Which two statements are true about the result if the default locale is Locale.US? (Choose two.)&lt;br /&gt;A. The value of b is 2.&lt;br /&gt;B. The value of a is 3.14.&lt;br /&gt;C. The value of b is 2.00.&lt;br /&gt;D. The value of a is 3.141.&lt;br /&gt;E. The value of a is 3.1415.&lt;br /&gt;F. The value of a is 3.1416.&lt;br /&gt;G. The value of b is 2.0000.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Answer: C, F&lt;/strong&gt;&lt;hr /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Question: 37&lt;/strong&gt;&lt;br /&gt;Given:&lt;br /&gt;12. import java.io.*;&lt;br /&gt;13. public class Forest implements Serializable {&lt;br /&gt;14. private Tree tree = new Tree();&lt;br /&gt;15. public static void main(String [] args) {&lt;br /&gt;16. Forest f = new Forest();&lt;br /&gt;17. try {&lt;br /&gt;18. FileOutputStream fs = new FileOutputStream("Forest.ser");&lt;br /&gt;19. ObjectOutputStream os = new ObjectOutputStream(fs);&lt;br /&gt;20. os.writeObject(f); os.close();&lt;br /&gt;21. } catch (Exception ex) { ex.printStackTrace(); }&lt;br /&gt;22. } }&lt;br /&gt;23.&lt;br /&gt;24. class Tree { }&lt;br /&gt;What is the result?&lt;br /&gt;A. Compilation fails.&lt;br /&gt;B. An exception is thrown at runtime.&lt;br /&gt;C. An instance of Forest is serialized.&lt;br /&gt;D. An instance of Forest and an instance of Tree are both serialized.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Answer: B&lt;/strong&gt;&lt;hr /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Question: 38&lt;/strong&gt;&lt;br /&gt;Assuming that the serializeBanana() and the deserializeBanana() methods will&lt;br /&gt;correctly use Java serialization and given:&lt;br /&gt;13. import java.io.*;&lt;br /&gt;14. class Food implements Serializable {int good = 3;}&lt;br /&gt;15. class Fruit extends Food {int juice = 5;}&lt;br /&gt;16. public class Banana extends Fruit {&lt;br /&gt;17. int yellow = 4;&lt;br /&gt;18. public static void main(String [] args) {&lt;br /&gt;19. Banana b = new Banana(); Banana b2 = new Banana();&lt;br /&gt;20. b.serializeBanana(b); // assume correct serialization&lt;br /&gt;21. b2 = b.deserializeBanana(); // assume correct&lt;br /&gt;22. System.out.println("restore "+b2.yellow+ b2.juice+b2.good);&lt;br /&gt;24. }&lt;br /&gt;25. // more Banana methods go here 50. }&lt;br /&gt;What is the result?&lt;br /&gt;A. restore 400&lt;br /&gt;B. restore 403&lt;br /&gt;C. restore 453&lt;br /&gt;D. Compilation fails.&lt;br /&gt;E. An exception is thrown at runtime.&lt;br /&gt;&lt;strong&gt;Answer: C&lt;/strong&gt;&lt;hr /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Question: 39&lt;/strong&gt;&lt;br /&gt;Given this method in a class:&lt;br /&gt;21. public String toString() {&lt;br /&gt;22. StringBuffer buffer = new StringBuffer();&lt;br /&gt;23. buffer.append('&lt;');&lt;br /&gt;24. buffer.append(this.name);&lt;br /&gt;25. buffer.append('&gt;');&lt;br /&gt;26. return buffer.toString();&lt;br /&gt;27. }&lt;br /&gt;Which statement is true?&lt;br /&gt;A. This code is NOT thread-safe.&lt;br /&gt;B. The programmer can replace StringBuffer with StringBuilder with no other changes.&lt;br /&gt;C. This code will perform poorly. For better performance, the code should be rewritten:&lt;br /&gt;return "&amp;lt;" + this.name + "&amp;gt;";&lt;br /&gt;D. This code will perform well and converting the code to use StringBuilder will not enhance the performance.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Answer: B&lt;/strong&gt;&lt;hr /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Question: 40&lt;/strong&gt;&lt;br /&gt;Given:&lt;br /&gt;1. package geometry;&lt;br /&gt;2. public class Hypotenuse {&lt;br /&gt;3. public InnerTriangle it = new InnerTriangle();&lt;br /&gt;4. class InnerTriangle {&lt;br /&gt;5. public int base;&lt;br /&gt;6. public int height;&lt;br /&gt;7. }&lt;br /&gt;8. }&lt;br /&gt;Which statement is true about the class of an object that can reference the variable base?&lt;br /&gt;A. It can be any class.&lt;br /&gt;B. No class has access to base.&lt;br /&gt;C. The class must belong to the geometry package.&lt;br /&gt;D. The class must be a subclass of the class Hypotenuse.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Answer: C&lt;/strong&gt;&lt;hr /&gt;&lt;br /&gt;&lt;br /&gt;If you would like to read all the SCJP Question bank articles, please &lt;a href="http://java-servlet-jsp-web.blogspot.com/search/label/SCJP%201.5%20Question%20Bank" title="Read all SCJP posts"&gt;click here&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7316847079866971282-3021070082209964638?l=java-servlet-jsp-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java-servlet-jsp-web.blogspot.com/feeds/3021070082209964638/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/07/sun-certified-java-professional-scjp-15_4483.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/3021070082209964638'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/3021070082209964638'/><link rel='alternate' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/07/sun-certified-java-professional-scjp-15_4483.html' title='Sun Certified Java Professional (SCJP) 1.5 Question Bank - 8'/><author><name>Santhosh Reddy</name><uri>http://www.blogger.com/profile/05232963292855488994</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_P0JbJW7kyKo/ShZkH-FOe4I/AAAAAAAAHP0/ogsB2X0vAMU/S220/IMG_0305.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7316847079866971282.post-5626643447033010304</id><published>2009-07-29T21:57:00.003+05:30</published><updated>2009-07-29T22:05:38.567+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='SCJP 1.5 Question Bank'/><title type='text'>Sun Certified Java Professional (SCJP) 1.5 Question Bank - 7</title><content type='html'>Here is the seventh article of questions on SCJP 1.5. If you haven't read the sixth article, &lt;a href="http://java-servlet-jsp-web.blogspot.com/2009/07/sun-certified-java-professional-scjp-15_24.html" title="Read sixth SCJP question bank"&gt;click here&lt;/a&gt; to read.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Question: 31&lt;/strong&gt;&lt;br /&gt;Given:&lt;br /&gt;11. Float pi = new Float(3.14f);&lt;br /&gt;12. if (pi &gt; 3) {&lt;br /&gt;13. System.out.print("pi is bigger than 3. ");&lt;br /&gt;14. }&lt;br /&gt;15. else {&lt;br /&gt;16. System.out.print("pi is not bigger than 3. ");&lt;br /&gt;17. }&lt;br /&gt;18. finally {&lt;br /&gt;19. System.out.println("Have a nice day.");&lt;br /&gt;20. }&lt;br /&gt;What is the result?&lt;br /&gt;A. Compilation fails.&lt;br /&gt;B. pi is bigger than 3.&lt;br /&gt;C. An exception occurs at runtime.&lt;br /&gt;D. pi is bigger than 3. Have a nice day.&lt;br /&gt;E. pi is not bigger than 3. Have a nice day.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Answer: A&lt;/strong&gt;&lt;hr /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Question: 32&lt;/strong&gt;&lt;br /&gt;Given:&lt;br /&gt;11. String test = "This is a test";&lt;br /&gt;12. String[] tokens = test.split("\s");&lt;br /&gt;13. System.out.println(tokens.length);&lt;br /&gt;What is the result?&lt;br /&gt;A. 0&lt;br /&gt;B. 1&lt;br /&gt;C. 4&lt;br /&gt;D. Compilation fails.&lt;br /&gt;E. An exception is thrown at runtime.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Answer: D&lt;/strong&gt;&lt;hr /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Question: 33&lt;/strong&gt;&lt;br /&gt;Given:&lt;br /&gt;11. public class Yikes {&lt;br /&gt;12.&lt;br /&gt;13. public static void go(Long n) {System.out.println("Long ");}&lt;br /&gt;14. public static void go(Short n) {System.out.println("Short ");}&lt;br /&gt;15. public static void go(int n) {System.out.println("int ");}&lt;br /&gt;16. public static void main(String [] args) {&lt;br /&gt;17. short y = 6;&lt;br /&gt;18. long z = 7;&lt;br /&gt;19. go(y);&lt;br /&gt;20. go(z);&lt;br /&gt;21. }&lt;br /&gt;22. }&lt;br /&gt;What is the result?&lt;br /&gt;A. int Long&lt;br /&gt;B. Short Long&lt;br /&gt;C. Compilation fails.&lt;br /&gt;D. An exception is thrown at runtime.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Answer: A&lt;/strong&gt;&lt;hr /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Question: 34&lt;/strong&gt;&lt;br /&gt;Given:&lt;br /&gt;12. System.out.format("Pi is approximately %d.", Math.PI);&lt;br /&gt;What is the result?&lt;br /&gt;A. Compilation fails.&lt;br /&gt;B. Pi is approximately 3.&lt;br /&gt;C. Pi is approximately 3.141593.&lt;br /&gt;D. An exception is thrown at runtime.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Answer: D&lt;/strong&gt;&lt;hr /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Question: 35&lt;/strong&gt;&lt;br /&gt;Given:&lt;br /&gt;33. Date d = new Date(0);&lt;br /&gt;34. String ds = "December 15, 2004";&lt;br /&gt;35. // insert code here&lt;br /&gt;36. try {&lt;br /&gt;37. d = df.parse(ds);&lt;br /&gt;38. }&lt;br /&gt;39. catch(ParseException e) {&lt;br /&gt;40. System.out.println("Unable to parse " + ds);&lt;br /&gt;41. }&lt;br /&gt;42. // insert code here too&lt;br /&gt;What creates the appropriate DateFormat object and adds a day to the Date object?&lt;br /&gt;A. 35. DateFormat df = DateFormat.getDateFormat();&lt;br /&gt;42. d.setTime( (60 * 60 * 24) + d.getTime());&lt;br /&gt;B. 35. DateFormat df = DateFormat.getDateInstance();&lt;br /&gt;42. d.setTime( (1000 * 60 * 60 * 24) + d.getTime());&lt;br /&gt;C. 35. DateFormat df = DateFormat.getDateFormat();&lt;br /&gt;42. d.setLocalTime( (1000*60*60*24) + d.getLocalTime());&lt;br /&gt;D. 35. DateFormat df = DateFormat.getDateInstance();&lt;br /&gt;42. d.setLocalTime( (60 * 60 * 24) + d.getLocalTime());&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Answer: B&lt;/strong&gt;&lt;hr /&gt;&lt;br /&gt;&lt;br /&gt;If you would like to read all the SCJP Question bank articles, please &lt;a href="http://java-servlet-jsp-web.blogspot.com/search/label/SCJP%201.5%20Question%20Bank" title="Read all SCJP posts"&gt;click here&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7316847079866971282-5626643447033010304?l=java-servlet-jsp-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java-servlet-jsp-web.blogspot.com/feeds/5626643447033010304/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/07/sun-certified-java-professional-scjp-15_29.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/5626643447033010304'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/5626643447033010304'/><link rel='alternate' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/07/sun-certified-java-professional-scjp-15_29.html' title='Sun Certified Java Professional (SCJP) 1.5 Question Bank - 7'/><author><name>Santhosh Reddy</name><uri>http://www.blogger.com/profile/05232963292855488994</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_P0JbJW7kyKo/ShZkH-FOe4I/AAAAAAAAHP0/ogsB2X0vAMU/S220/IMG_0305.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7316847079866971282.post-1347659007247082838</id><published>2009-07-25T23:51:00.003+05:30</published><updated>2009-07-26T00:17:25.945+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Servlets'/><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><title type='text'>Google launches Application server for Java - Google App Engine</title><content type='html'>As we already know that Google launched an application server for Python based on the CGI environment last year. Their application server name is Google App Engine. As of now users can develop a project in Python and deploy on this. Find our more details @ &lt;a href="http://code.google.com/appengine/docs/python/gettingstarted/introduction.html" target="_blank" title="Google App Engine for Python"&gt;Google App Engine for Python.&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Google has recently reached another milestone that they've launched an application server for Java based on the Servlets environment. With App Engine, you can build web applications using standard Java technologies and run them on Google's scalable infrastructure. The Java environment provides a Java 6 JVM, a Java Servlets interface, and support for standard interfaces to the App Engine scalable datastore and services, such as JDO, JPA, JavaMail, and JCache. Standards support makes developing your application easy and familiar, and also makes porting your application to and from your own servlet environment straightforward&lt;br /&gt;&lt;br /&gt;In order to utilize this service, all you have to do is - register for a domain with your unique application id @ &lt;a href="http://appengine.google.com/" target="_blank" title="Google App Engine"&gt;Google App Engine&lt;/a&gt; and develop the application with the template given as part of Google SDK.&lt;br /&gt;&lt;br /&gt;Hurray... go ahead and deploy your application on Google's app server.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7316847079866971282-1347659007247082838?l=java-servlet-jsp-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java-servlet-jsp-web.blogspot.com/feeds/1347659007247082838/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/07/google-launches-application-server-for.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/1347659007247082838'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/1347659007247082838'/><link rel='alternate' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/07/google-launches-application-server-for.html' title='Google launches Application server for Java - Google App Engine'/><author><name>Santhosh Reddy</name><uri>http://www.blogger.com/profile/05232963292855488994</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_P0JbJW7kyKo/ShZkH-FOe4I/AAAAAAAAHP0/ogsB2X0vAMU/S220/IMG_0305.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7316847079866971282.post-8223013963921680322</id><published>2009-07-25T22:59:00.005+05:30</published><updated>2009-07-25T23:43:37.700+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java IDE'/><title type='text'>Download &amp; Configure Oracle OC4J Server for Netbeans IDE</title><content type='html'>Are you using Oracle OC4J server? If you're, did you think about using the Netbeans IDE (Integrated Development Environment)?&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Download OC4J from the Netbeans updates&lt;/strong&gt;&lt;br /&gt;Open Netbeans IDE and then follow below steps to configure the OC4J server.&lt;br /&gt;1. Tools &gt; Update Center&lt;br /&gt;2. Select "Netbeans Update Center Beta"&lt;br /&gt;3. Select OC4J 10g&lt;br /&gt;&lt;br /&gt;You can then configure a new server and run/stop the server from your IDE.&lt;br /&gt;&lt;br /&gt;You can get more info from official website for Netbeans OC4J module @ &lt;a href="https://nbmodules.dev.java.net/oc4j/" target="_blank" title="Netbeans OC4J module"&gt;Netbeans OC4J module&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7316847079866971282-8223013963921680322?l=java-servlet-jsp-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java-servlet-jsp-web.blogspot.com/feeds/8223013963921680322/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/07/download-configure-oracle-oc4j-server.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/8223013963921680322'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/8223013963921680322'/><link rel='alternate' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/07/download-configure-oracle-oc4j-server.html' title='Download &amp; Configure Oracle OC4J Server for Netbeans IDE'/><author><name>Santhosh Reddy</name><uri>http://www.blogger.com/profile/05232963292855488994</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_P0JbJW7kyKo/ShZkH-FOe4I/AAAAAAAAHP0/ogsB2X0vAMU/S220/IMG_0305.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7316847079866971282.post-8710049184236837469</id><published>2009-07-25T22:54:00.004+05:30</published><updated>2009-07-25T23:04:45.357+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='JDBC'/><title type='text'>Difference in JDBC connection close and connection pool Connection close</title><content type='html'>A Java Enterprise Edition (Java EE) application usually connects to the database by either making a direct connection to the database using JDBC thin drivers provided by the database vendor or creating a pool of database connections within the Java EE container using the JDBC drivers.&lt;br /&gt;&lt;br /&gt;If the application directly connects to the database, then on calling the close() method on the connection object, the database connection closes and the associated Statement and ResultSet objects close and are garbage collected.&lt;br /&gt;&lt;br /&gt;If a connection pool is used, a request to the database is made using one of the existing connections in the pool. In this case, on calling close() on the connection object, the database connection returns to the pool. So merely closing the connection does not automatically close the ResultSet and Statement objects. As a result, ResultSet and Statement will not become eligible for garbage collection, as they continue to remain tagged with the database connection in the connection pool.&lt;br /&gt;&lt;br /&gt;So make sure you're closing the statements and resultsets that you've retrieved from the connection that you're about to close.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7316847079866971282-8710049184236837469?l=java-servlet-jsp-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java-servlet-jsp-web.blogspot.com/feeds/8710049184236837469/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/07/difference-in-jdbc-connection-close-and.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/8710049184236837469'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/8710049184236837469'/><link rel='alternate' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/07/difference-in-jdbc-connection-close-and.html' title='Difference in JDBC connection close and connection pool Connection close'/><author><name>Santhosh Reddy</name><uri>http://www.blogger.com/profile/05232963292855488994</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_P0JbJW7kyKo/ShZkH-FOe4I/AAAAAAAAHP0/ogsB2X0vAMU/S220/IMG_0305.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7316847079866971282.post-7019002501800243157</id><published>2009-07-24T19:33:00.007+05:30</published><updated>2009-09-11T22:22:06.520+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Javascript'/><title type='text'>Javascript to encode and decode a URL - escape &amp; unescape</title><content type='html'>Now a days scripting languages like Javascript and VBScript have more importance as programmer started using AJAX more and more. There are some APIs available for Javascript which provide easy and efficient constructs to process.&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;Encode and decode&lt;/h2&gt;&lt;br /&gt;Did you see space (' ') in the URL when you're accessing? You wouldn't have and instead you would have seen %20 character replacing them. That was URL encoding technique. You can do the URL encoding and decoding through Javascript as we can do it through Java and other programming languages.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;escape&lt;/strong&gt; - escape is a function, to encode the parameter and return the encoded URL.&lt;br /&gt;Syntax: escape (&lt;em&gt;URL&lt;/em&gt;)&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;unescape&lt;/strong&gt; - unescape is a function, to decode the parameter and return the decoded URL.&lt;br /&gt;Syntax: unescape (&lt;em&gt;URL&lt;/em&gt;)&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;Example&lt;/h2&gt;&lt;br /&gt;&lt;input type="text" id="url1" size="60" /&gt;&lt;br /&gt;&lt;input type="text" id="url2" size="60" /&gt;&lt;br /&gt;&lt;input type="text" id="url3" size="60" /&gt;&lt;br /&gt;&lt;input type="button" onclick="encdec()" value="Click me to see encoded and decoded URLs" /&gt;&lt;br /&gt;&lt;script type="text/javascript"&gt;function encdec(){ document.getElementById("url2").value=escape(document.getElementById("url1").value); document.getElementById("url3").value=unescape(document.getElementById("url2").value);}document.getElementById("url1").value=window.location.href;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;Enter any URL or text in the first text box and click on the button to see the encoded and decoded text.&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;Source&lt;/h2&gt;&lt;br /&gt;&lt;pre class="program"&gt;&lt;br /&gt;&amp;lt;input type="text" id="url1" size="60" /&amp;gt;&lt;br /&gt;&amp;lt;input type="text" id="url2" size="60" /&amp;gt;&lt;br /&gt;&amp;lt;input type="text" id="url3" size="60" /&amp;gt;&lt;br /&gt;&amp;lt;input type="button" onclick="encdec()" /&amp;gt;&lt;br /&gt;&amp;lt;script type="text/javascript"&amp;gt;&lt;br /&gt;function encdec()&lt;br /&gt;{&lt;br /&gt; document.getElementById("url2").value=escape(document.getElementById("url1").value);&lt;br /&gt; document.getElementById("url3").value=unescape(document.getElementById("url2").value);&lt;br /&gt;}&lt;br /&gt;document.getElementById("url1").value=window.location.href;&lt;br /&gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;This has been tested on all the major browsers.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://java-servlet-jsp-web.blogspot.com/search/label/Javascript" title="Go to Javascript programs"&gt;click here&lt;/a&gt; to check other Javascript programs that I've developed and explained.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7316847079866971282-7019002501800243157?l=java-servlet-jsp-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java-servlet-jsp-web.blogspot.com/feeds/7019002501800243157/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/07/javascript-to-encode-and-decode-url.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/7019002501800243157'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/7019002501800243157'/><link rel='alternate' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/07/javascript-to-encode-and-decode-url.html' title='Javascript to encode and decode a URL - escape &amp; unescape'/><author><name>Santhosh Reddy</name><uri>http://www.blogger.com/profile/05232963292855488994</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_P0JbJW7kyKo/ShZkH-FOe4I/AAAAAAAAHP0/ogsB2X0vAMU/S220/IMG_0305.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7316847079866971282.post-3480350894181941267</id><published>2009-07-24T18:48:00.002+05:30</published><updated>2009-07-24T18:58:01.847+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='SCJP 1.5 Question Bank'/><title type='text'>Sun Certified Java Professional (SCJP) 1.5 Question Bank - 6</title><content type='html'>Here is the sixth article of questions on SCJP 1.5. If you haven't read the fifth article, &lt;a href="http://java-servlet-jsp-web.blogspot.com/2009/07/sun-certified-java-professional-scjp-15_22.html" title="Read fifth SCJP question bank"&gt;click here&lt;/a&gt; to read.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Question: 26&lt;/strong&gt;&lt;br /&gt;Given:&lt;br /&gt;84. try {&lt;br /&gt;85. ResourceConnection con = resourceFactory.getConnection();&lt;br /&gt;86. Results r = con.query("GET INFO FROM CUSTOMER");&lt;br /&gt;87. info = r.getData();&lt;br /&gt;88. con.close();&lt;br /&gt;89. } catch (ResourceException re) {&lt;br /&gt;90. errorLog.write(re.getMessage());&lt;br /&gt;91. }&lt;br /&gt;92. return info;&lt;br /&gt;Which statement is true if a ResourceException is thrown on line 86?&lt;br /&gt;A. Line 92 will not execute.&lt;br /&gt;B. The connection will not be retrieved in line 85.&lt;br /&gt;C. The resource connection will not be closed on line 88.&lt;br /&gt;D. The enclosing method will throw an exception to its caller.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Answer: C&lt;/strong&gt;&lt;br /&gt;&lt;hr /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Question: 27&lt;/strong&gt;&lt;br /&gt;Given:&lt;br /&gt;31. // some code here&lt;br /&gt;32. try {&lt;br /&gt;33. // some code here&lt;br /&gt;34. } catch (SomeException se) {&lt;br /&gt;35. // some code here&lt;br /&gt;36. } finally {&lt;br /&gt;37. // some code here&lt;br /&gt;38. }&lt;br /&gt;Under which three circumstances will the code on line 37 be executed? (Choose three.)&lt;br /&gt;A. The instance gets garbage collected.&lt;br /&gt;B. The code on line 33 throws an exception.&lt;br /&gt;C. The code on line 35 throws an exception.&lt;br /&gt;D. The code on line 31 throws an exception.&lt;br /&gt;E. The code on line 33 executes successfully.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Answer: B, C, E&lt;/strong&gt;&lt;br /&gt;&lt;hr /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Question: 28&lt;/strong&gt;&lt;br /&gt;Given:&lt;br /&gt;11. class A {&lt;br /&gt;12. public void process() { System.out.print("A,"); }&lt;br /&gt;13. class B extends A {&lt;br /&gt;14. public void process() throws IOException {&lt;br /&gt;15. super.process();&lt;br /&gt;16. System.out.print("B,");&lt;br /&gt;17. throw new IOException();&lt;br /&gt;18. }&lt;br /&gt;19. public static void main(String[] args) {&lt;br /&gt;20. try { new B().process(); }&lt;br /&gt;21. catch (IOException e) { System.out.println("Exception"); }}&lt;br /&gt;What is the result?&lt;br /&gt;A. Exception&lt;br /&gt;B. A,B,Exception&lt;br /&gt;C. Compilation fails because of an error in line 20.&lt;br /&gt;D. Compilation fails because of an error in line 14.&lt;br /&gt;E. A NullPointerException is thrown at runtime.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Answer: D&lt;/strong&gt;&lt;br /&gt;&lt;hr /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Question: 29&lt;/strong&gt;&lt;br /&gt;Given a method that must ensure that its parameter is not null:&lt;br /&gt;11. public void someMethod(Object value) {&lt;br /&gt;12. // check for null value&lt;br /&gt;...&lt;br /&gt;20. System.out.println(value.getClass());&lt;br /&gt;21. }&lt;br /&gt;What, inserted at line 12, is the appropriate way to handle a null value?&lt;br /&gt;A. assert value == null;&lt;br /&gt;B. assert value != null, "value is null";&lt;br /&gt;C. if (value == null) {&lt;br /&gt;  throw new AssertionException("value is null");&lt;br /&gt; }&lt;br /&gt;D. if (value == null) {&lt;br /&gt;   throw new IllegalArgumentException("value is null");&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Answer: D&lt;/strong&gt;&lt;br /&gt;&lt;hr /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Question: 30&lt;/strong&gt;&lt;br /&gt;Given:&lt;br /&gt;11. static void test() throws Error {&lt;br /&gt;12. if (true) throw new AssertionError();&lt;br /&gt;13. System.out.print("test ");&lt;br /&gt;14. }&lt;br /&gt;15. public static void main(String[] args) {&lt;br /&gt;16. try { test(); }&lt;br /&gt;17. catch (Exception ex) { System.out.print("exception "); }&lt;br /&gt;18. System.out.print("end ");&lt;br /&gt;19. }&lt;br /&gt;What is the result?&lt;br /&gt;A. end&lt;br /&gt;B. Compilation fails.&lt;br /&gt;C. exception end&lt;br /&gt;D. exception test end&lt;br /&gt;E. A Throwable is thrown by main.&lt;br /&gt;F. An Exception is thrown by main.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Answer: E&lt;/strong&gt;&lt;br /&gt;&lt;hr /&gt;&lt;br /&gt;&lt;br /&gt;If you would like to read all the SCJP Question bank articles, please &lt;a href="http://java-servlet-jsp-web.blogspot.com/search/label/SCJP%201.5%20Question%20Bank" title="Read all SCJP posts"&gt;click here&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7316847079866971282-3480350894181941267?l=java-servlet-jsp-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java-servlet-jsp-web.blogspot.com/feeds/3480350894181941267/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/07/sun-certified-java-professional-scjp-15_24.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/3480350894181941267'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/3480350894181941267'/><link rel='alternate' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/07/sun-certified-java-professional-scjp-15_24.html' title='Sun Certified Java Professional (SCJP) 1.5 Question Bank - 6'/><author><name>Santhosh Reddy</name><uri>http://www.blogger.com/profile/05232963292855488994</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_P0JbJW7kyKo/ShZkH-FOe4I/AAAAAAAAHP0/ogsB2X0vAMU/S220/IMG_0305.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7316847079866971282.post-5990243761187804755</id><published>2009-07-23T09:39:00.005+05:30</published><updated>2009-07-23T09:50:30.629+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Technology'/><title type='text'>Skills most in demand among top 5 employers</title><content type='html'>Dice.com recently compiled a list of the skill sets most in demand among employers. The top 5:&lt;br /&gt;&lt;b&gt;Security - &lt;/b&gt; Employers often want to hire people who have earned the CISSP (Certified Information Systems Security Professional) designation (see &lt;a href="http://www.isc2.org/" target="_blank" style="color: rgb(0, 66, 118); text-decoration: none; "&gt;www.isc2.org&lt;/a&gt;). Candidates need 5 years of hands-on experience before taking the exam.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Virtualization - &lt;/b&gt; The term refers to the practice of running multiple servers on a single piece of hardware, increasing efficiency and conserving energy.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Java EE - &lt;/b&gt; Sun Microsystems' (&lt;a href="http://money.cnn.com/quote/quote.html?symb=JAVA&amp;amp;source=story_quote_link" target="_blank" style="color: rgb(0, 66, 118); text-decoration: none; "&gt;JAVA&lt;/a&gt;, &lt;a href="http://money.cnn.com/magazines/fortune/fortune500/2009/snapshots/881.html?source=story_f500_link" target="_blank" style="color: rgb(0, 66, 118); text-decoration: none; "&gt;Fortune 500&lt;/a&gt;) Java and its enterprise edition, until recently called J2EE, are the industry standards for developing online applications, so the Sun Certified Java Programmer (SCJP) designation is in widespread demand.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;SAP - &lt;/b&gt; Most employers prefer candidates who have direct on-the-job experience with SAP (&lt;a href="http://money.cnn.com/quote/quote.html?symb=SAP&amp;amp;source=story_quote_link" style="color: rgb(0, 66, 118); text-decoration: none; " target="_blank"&gt;SAP&lt;/a&gt;), but "having the right credentials can make even experienced candidates stand out," the Dice.com report says.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;.NET - &lt;/b&gt; Microsoft (&lt;a href="http://money.cnn.com/quote/quote.html?symb=MSFT&amp;amp;source=story_quote_link" style="color: rgb(0, 66, 118); text-decoration: none; " target="_blank"&gt;MSFT&lt;/a&gt;, &lt;a href="http://money.cnn.com/magazines/fortune/fortune500/2009/snapshots/3063.html?source=story_f500_link" target="_blank" style="color: rgb(0, 66, 118); text-decoration: none; "&gt;Fortune 500&lt;/a&gt;) has a variety of certifications, Dice.com notes, but "the most bang for the buck comes from the Microsoft Certified Professional Developer (MCPD)" designation, which covers Microsoft Visual Studio and the Microsoft .NET framework.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7316847079866971282-5990243761187804755?l=java-servlet-jsp-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java-servlet-jsp-web.blogspot.com/feeds/5990243761187804755/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/07/skills-most-in-demand-among-top-5.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/5990243761187804755'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/5990243761187804755'/><link rel='alternate' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/07/skills-most-in-demand-among-top-5.html' title='Skills most in demand among top 5 employers'/><author><name>Santhosh Reddy</name><uri>http://www.blogger.com/profile/05232963292855488994</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_P0JbJW7kyKo/ShZkH-FOe4I/AAAAAAAAHP0/ogsB2X0vAMU/S220/IMG_0305.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7316847079866971282.post-8294911720542730311</id><published>2009-07-22T20:05:00.003+05:30</published><updated>2009-07-22T20:15:32.935+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='SCJP 1.5 Question Bank'/><title type='text'>Sun Certified Java Professional (SCJP) 1.5 Question Bank - 5</title><content type='html'>Here is the fifth article of questions on SCJP 1.5. If you haven't read the fourth article, &lt;a href="http://java-servlet-jsp-web.blogspot.com/2009/07/sun-certified-java-professional-scjp-15.html" title="Read fourth SCJP question bank"&gt;click here&lt;/a&gt; to read.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Question: 21&lt;/strong&gt;&lt;br /&gt;Given:&lt;br /&gt;1. public class TestOne implements Runnable {&lt;br /&gt;2.   public static void main (String[] args) throws Exception {&lt;br /&gt;3.    Thread t = new Thread(new TestOne());&lt;br /&gt;4.    t.start();&lt;br /&gt;5.    System.out.print("Started");&lt;br /&gt;6.    t.join();&lt;br /&gt;7.    System.out.print("Complete");&lt;br /&gt;8.  }&lt;br /&gt;9.  public void run() {&lt;br /&gt;10.  for (int i = 0; i &lt; 4; i++) {&lt;br /&gt;11.  System.out.print(i);&lt;br /&gt;12. }&lt;br /&gt;13.}&lt;br /&gt;14.}&lt;br /&gt;What can be a result?&lt;br /&gt;A. Compilation fails.&lt;br /&gt;B. An exception is thrown at runtime.&lt;br /&gt;C. The code executes and prints "StartedComplete".&lt;br /&gt;D. The code executes and prints "StartedComplete0123".&lt;br /&gt;E. The code executes and prints "Started0123Complete".&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Answer: E&lt;/strong&gt;&lt;br /&gt;&lt;hr /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Question: 22&lt;/strong&gt;&lt;br /&gt;Given:&lt;br /&gt;11. public class Test {&lt;br /&gt;12.  public enum Dogs {collie, harrier, shepherd};&lt;br /&gt;13.  public static void main(String [] args) {&lt;br /&gt;14.   Dogs myDog = Dogs.shepherd;&lt;br /&gt;15.   switch (myDog) {&lt;br /&gt;16.   case collie:&lt;br /&gt;17.    System.out.print("collie ");&lt;br /&gt;18.   case default:&lt;br /&gt;19.    System.out.print("retriever ");&lt;br /&gt;20.   case harrier:&lt;br /&gt;21.    System.out.print("harrier ");&lt;br /&gt;22.   }&lt;br /&gt;23.  }&lt;br /&gt;24. }&lt;br /&gt;What is the result?&lt;br /&gt;A. harrier&lt;br /&gt;B. shepherd&lt;br /&gt;C. retriever&lt;br /&gt;D. Compilation fails.&lt;br /&gt;E. retriever harrier&lt;br /&gt;F. An exception is thrown at runtime.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Answer: D&lt;/strong&gt;&lt;br /&gt;&lt;hr /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Question: 23&lt;/strong&gt;&lt;br /&gt;Given:&lt;br /&gt;8. public class test {&lt;br /&gt;9.  public static void main(String [] a) {&lt;br /&gt;10.  assert a.length == 1;&lt;br /&gt;11. }&lt;br /&gt;12.}&lt;br /&gt;Which two will produce an AssertionError? (Choose two.)&lt;br /&gt;A. java test&lt;br /&gt;B. java -ea test&lt;br /&gt;C. java test file1&lt;br /&gt;D. java -ea test file1&lt;br /&gt;E. java -ea test file1 file2&lt;br /&gt;F. java -ea:test test file1&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Answer: B, E&lt;/strong&gt;&lt;br /&gt;&lt;hr /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Question: 24&lt;/strong&gt;&lt;br /&gt;Given:&lt;br /&gt;10. interface Foo {}&lt;br /&gt;11. class Alpha implements Foo {}&lt;br /&gt;12. class Beta extends Alpha {}&lt;br /&gt;13. class Delta extends Beta {&lt;br /&gt;14. public static void main( String[] args ) {&lt;br /&gt;15.  Beta x = new Beta();&lt;br /&gt;16.  // insert code here&lt;br /&gt;17.  }&lt;br /&gt;18. }&lt;br /&gt;Which code, inserted at line 16, will cause a java.lang.ClassCastException?&lt;br /&gt;A. Alpha a = x;&lt;br /&gt;B. Foo f = (Delta)x;&lt;br /&gt;C. Foo f = (Alpha)x;&lt;br /&gt;D. Beta b = (Beta)(Alpha)x;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Answer: B&lt;/strong&gt;&lt;br /&gt;&lt;hr/&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Question: 25&lt;/strong&gt;&lt;br /&gt;Given:&lt;br /&gt;11. public static Collection get() {&lt;br /&gt;12.  Collection sorted = new LinkedList();&lt;br /&gt;13.  sorted.add("B"); sorted.add("C"); sorted.add("A");&lt;br /&gt;14.  return sorted;&lt;br /&gt;15. }&lt;br /&gt;16. public static void main(String[] args) {&lt;br /&gt;17.  for (Object obj: get()) {&lt;br /&gt;18.   System.out.print(obj + ", ");&lt;br /&gt;19.  }&lt;br /&gt;20. }&lt;br /&gt;What is the result?&lt;br /&gt;A. A, B, C,&lt;br /&gt;B. B, C, A,&lt;br /&gt;C. Compilation fails.&lt;br /&gt;D. The code runs with no output.&lt;br /&gt;E. An exception is thrown at runtime.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Answer: B&lt;/strong&gt;&lt;br /&gt;&lt;hr /&gt;&lt;br /&gt;&lt;br /&gt;If you would like to read all the SCJP Question bank articles, please &lt;a href="http://java-servlet-jsp-web.blogspot.com/search/label/SCJP%201.5%20Question%20Bank" title="Read all SCJP posts"&gt;click here&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7316847079866971282-8294911720542730311?l=java-servlet-jsp-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java-servlet-jsp-web.blogspot.com/feeds/8294911720542730311/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/07/sun-certified-java-professional-scjp-15_22.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/8294911720542730311'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/8294911720542730311'/><link rel='alternate' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/07/sun-certified-java-professional-scjp-15_22.html' title='Sun Certified Java Professional (SCJP) 1.5 Question Bank - 5'/><author><name>Santhosh Reddy</name><uri>http://www.blogger.com/profile/05232963292855488994</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_P0JbJW7kyKo/ShZkH-FOe4I/AAAAAAAAHP0/ogsB2X0vAMU/S220/IMG_0305.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7316847079866971282.post-869255584790726872</id><published>2009-07-22T19:40:00.006+05:30</published><updated>2009-07-22T19:52:09.845+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Struts'/><title type='text'>Struts - Get original requested URL when your request involves in chining (tiles or JSP includes)</title><content type='html'>Did you get into a situation where you would want original requested URL when you're using struts tiles or jsp includes? This is the most likely scenario where programmer wants original URL requested by the client. In the initial version of struts, there is no construct to achieve this.&lt;br /&gt;&lt;br /&gt;The ability to extract the original request URL has been included as part of struts 1.3 versions. All you've to do is - just fetch a request attribute.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Explanation:&lt;/strong&gt; Struts team has introduced a new constant &lt;strong&gt;org.apache.struts.Globals.ORIGINAL_URI_KEY&lt;/strong&gt; which holds the original URI of the request. Action servlet will set a request attribute with the above constant as the name and original URL as the value for this attribute.&lt;br /&gt;&lt;br /&gt;The below statement will fetch original requested URL from client.&lt;br /&gt;&lt;pre class="program"&gt;String originalURI=(String)request.getAttribute(org.apache.struts.Globals.ORIGINAL_URI_KEY)&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7316847079866971282-869255584790726872?l=java-servlet-jsp-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java-servlet-jsp-web.blogspot.com/feeds/869255584790726872/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/07/struts-get-original-requested-url-when.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/869255584790726872'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/869255584790726872'/><link rel='alternate' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/07/struts-get-original-requested-url-when.html' title='Struts - Get original requested URL when your request involves in chining (tiles or JSP includes)'/><author><name>Santhosh Reddy</name><uri>http://www.blogger.com/profile/05232963292855488994</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_P0JbJW7kyKo/ShZkH-FOe4I/AAAAAAAAHP0/ogsB2X0vAMU/S220/IMG_0305.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7316847079866971282.post-4113851674596124592</id><published>2009-07-22T18:51:00.003+05:30</published><updated>2009-07-22T19:12:54.525+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Struts'/><title type='text'>Struts action executing twice (multiple times) when form gets submitted</title><content type='html'>A very silly issue that could take lot of time for you to realize. Some times, very unlikely, Struts action executes multiple times when form gets submitted. This would happen only with the Firefox browser and not with the other browsers like Internet Explorer, Chrome etc. Very interesting, although this wouldn't effect any user functinalities. i.e.; if you're running you won't know that your struts action is invoking for multiple times unless you debug.&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;Why and when this happens&lt;/h2&gt;&lt;br /&gt;If you've a blank image tag inside the form tag which is going to be submitted on the Firefox then this issue would happen. This is because Firefox will try to find the image at the same path of your current URL when you've a blank img tags.&lt;br /&gt;&lt;br /&gt;Be good to know the issues like this otherwise you would have to spend more time if it your turn.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7316847079866971282-4113851674596124592?l=java-servlet-jsp-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java-servlet-jsp-web.blogspot.com/feeds/4113851674596124592/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/07/struts-action-executing-twice-multiple.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/4113851674596124592'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/4113851674596124592'/><link rel='alternate' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/07/struts-action-executing-twice-multiple.html' title='Struts action executing twice (multiple times) when form gets submitted'/><author><name>Santhosh Reddy</name><uri>http://www.blogger.com/profile/05232963292855488994</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_P0JbJW7kyKo/ShZkH-FOe4I/AAAAAAAAHP0/ogsB2X0vAMU/S220/IMG_0305.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7316847079866971282.post-213340529908093733</id><published>2009-07-22T18:30:00.005+05:30</published><updated>2009-07-22T18:50:37.235+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Javascript'/><title type='text'>Javascript to accept only number for a form text field</title><content type='html'>I've developed a cross browser compatability script to accept only numbers for a text field on the web page. This works based on the browser events. IE supports the Javascript events in a way which is completely different from the other browsers like Firefox, Google Chrome, etc.&lt;br /&gt;&lt;br /&gt;window.event - construct can be used to tackle the events on Internet Explorer. &lt;br /&gt;event - pass the event while invoking the function, which can be used to deal with the events on non IE browsers like Firefox and Chrome.&lt;br /&gt;&lt;br /&gt;&lt;pre class="program"&gt;&lt;br /&gt;&amp;lt;script type="text/javascript"&amp;gt;&lt;br /&gt;function onlyNumbers(evt)&lt;br /&gt;{&lt;br /&gt;    var e = (window.event)?event:evt; // for cross browser compatibility&lt;br /&gt;    var charCode = e.which || e.keyCode;&lt;br /&gt;    if (charCode &amp;gt; 31 &amp;&amp; (charCode &amp;lt; 48 || charCode &amp;gt; 57)){&lt;br /&gt;        return false;&lt;br /&gt;    }&lt;br /&gt;    return true;&lt;br /&gt;}&lt;br /&gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Include the above script on your page and invoke the function onlyNumbers function onkeypress event of the corresponding text field with a return statement.&lt;br /&gt;&lt;pre class="program"&gt;&amp;lt;input type="text" name="p_request" maxlength="10" onKeyPress="return onlyNumbers(event)"&amp;gt;&lt;/pre&gt;&lt;br /&gt;Here is an example - try with the below text box&lt;br /&gt;&lt;script type="text/javascript"&gt;function onlyNumbers(evt){var e = (window.event)?event:evt; var charCode = e.which || e.keyCode;if (charCode &gt; 31 &amp;&amp; (charCode &lt; 48 || charCode &gt; 57)){return false;}return true;}&lt;/script&gt;&lt;br /&gt;&lt;label for="text"&gt;Text field&lt;/label&gt;&lt;input type="text" name="text" id="text" maxlength="10" onKeyPress="return onlyNumbers(event)"&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7316847079866971282-213340529908093733?l=java-servlet-jsp-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java-servlet-jsp-web.blogspot.com/feeds/213340529908093733/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/07/javascript-to-accept-only-number-for.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/213340529908093733'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/213340529908093733'/><link rel='alternate' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/07/javascript-to-accept-only-number-for.html' title='Javascript to accept only number for a form text field'/><author><name>Santhosh Reddy</name><uri>http://www.blogger.com/profile/05232963292855488994</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_P0JbJW7kyKo/ShZkH-FOe4I/AAAAAAAAHP0/ogsB2X0vAMU/S220/IMG_0305.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7316847079866971282.post-4143209561161600915</id><published>2009-07-07T05:15:00.002+05:30</published><updated>2009-07-07T05:29:51.811+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java Mobile'/><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><title type='text'>Single web application for desktop users and mobile users</title><content type='html'>Mobile users are increasing day by day especially developing countries like India, China, etc. And all the users from developed countries like USA, UK, etc are enhancing their mobiles with new technologies. With respect to this change, lots of companies have started a different web application for mobile users as well.&lt;br /&gt;&lt;br /&gt;It is always recommended to have a single web application to ease the maintenance and development process. Now the question is - how can we develop a single web application for desktop users as well as mobile users? When I was researching on this, I've printed all the headers that I'm receiving to the server from various clients.&lt;br /&gt;&lt;br /&gt;These headers are from a desktop PC&lt;br /&gt;&lt;pre class="program"&gt;ACCEPT: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5&lt;br /&gt;ACCEPT-CHARSET: ISO-8859-1,*,utf-8&lt;br /&gt;ACCEPT-ENCODING: gzip,deflate,bzip2,sdch&lt;br /&gt;ACCEPT-LANGUAGE: en-US,en&lt;br /&gt;CACHE-CONTROL: max-age=0&lt;br /&gt;CONNECTION: Keep-Alive&lt;br /&gt;COOKIE: JSESSIONID=c0a80111ce7e6058f18e10248cdb8d8c7d5feaa140b.e3uRa3aOaNmQe3uNaNaPbhyPb41ynknvrkLOlQzNp65In0&lt;br /&gt;HOST: 203.197.128.203&lt;br /&gt;USER-AGENT: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/525.19 (KHTML, like Gecko) Chrome/1.0.154.65 Safari/525.19&lt;br /&gt;ORACLE-ECID: 1242045527:192.168.1.17:4372:0:15,0&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Below headers are from my Sony Ericsson W810i (Check the USER-AGENT)&lt;br /&gt;&lt;pre class="program"&gt;ACCEPT: multipart/mixed, application/vnd.wap.multipart.mixed, application/vnd.wap.xhtml+xml, application/xhtml+xml, text/vnd.wap.wml, */*&lt;br /&gt;ACCEPT-CHARSET: utf-8, utf-16, iso-8859-1, iso-10646-ucs-2, Shift_JIS, Big5&lt;br /&gt;ACCEPT-ENCODING: deflate, gzip&lt;br /&gt;ACCEPT-LANGUAGE: en&lt;br /&gt;CONNECTION: close&lt;br /&gt;HOST: 203.197.128.203&lt;br /&gt;PROXY-CONNECTION: close&lt;br /&gt;USER-AGENT: SonyEricssonW810i/R4EA Browser/NetFront/3.3 Profile/MIDP-2.0 Configuration/CLDC-1.1&lt;br /&gt;VIA: Jataayu CWS Gateway Version 4.2.0 at jataayuwap4&lt;br /&gt;X-FORWARDED-FOR: 10.16.9.200&lt;br /&gt;X-NETWORK-INFO: TCP, 10.16.9.200&lt;br /&gt;X-WAP-PROFILE: "http://wap.sonyericsson.com/UAprof/W810iR301.xml"&lt;br /&gt;ORACLE-ECID: 1242045600:192.168.1.17:4360:0:96,0&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Below request headers are from Nokia N72 (Check the USER-AGENT)&lt;br /&gt;&lt;pre class="program"&gt;ACCEPT: text/javascript, text/ecmascript, application/x-javascript, text/html, application/vnd.wap.xhtml+xml, application/xhtml+xml, text/css, multipart/mixed, text/vnd.wap.wml, application/vnd.wap.wmlc, application/vnd.wap.wmlscriptc, application/java-archive, application/java, application/x-java-archive, text/vnd.sun.j2me.app-descriptor, application/vnd.oma.drm.message, application/vnd.oma.drm.content, application/vnd.wap.mms-message, application/vnd.wap.sic, text/x-co-desc, application/vnd.oma.dd+xml, text/javascript, */*&lt;br /&gt;ACCEPT-CHARSET: iso-8859-1, utf-8, iso-10646-ucs-2; q=0.6&lt;br /&gt;ACCEPT-ENCODING: gzip, deflate, identity;q=0.9&lt;br /&gt;ACCEPT-LANGUAGE: en&lt;br /&gt;CONNECTION: close&lt;br /&gt;HOST: 203.197.128.203&lt;br /&gt;USER-AGENT: NokiaN72/2.0635.2.0.2 Series60/2.8 Profile/MIDP-2.0 Configuration/CLDC-1.1&lt;br /&gt;VIA: Jataayu CWS Gateway Version 4.2.0 at jataayuwap4&lt;br /&gt;X-FORWARDED-FOR: 10.16.3.220&lt;br /&gt;X-NETWORK-INFO: TCP, 10.16.3.220&lt;br /&gt;X-WAP-PROFILE: "http://nds1.nds.nokia.com/uaprof/NN72r100.xml"&lt;br /&gt;ORACLE-ECID: 1242046187:192.168.1.17:4470:0:11,0&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;If you cleanly observe above request headers to check the difference between mobile client and desktop client - you can find some extra headers PROXY-CONNECTION, VIA, X-FORWARDED-FOR, X-NETWORK-INFO, X-NETWORK-INFO, X-WAP-PROFILE. Among these request headers - X-WAP-PROFILE is a mandatory for every mobile client to pass it on to the server whenever a request has been made.&lt;br /&gt;&lt;br /&gt;Conclusion: Very simple but effective when you consider for the large scale applications, use the below condition on you Servlet or PHP or ASP or C# to check the request header to generate a different layout for mobile users. Here I'm going to explain this with Struts Action (Java technology).&lt;br /&gt;&lt;br /&gt;&lt;pre class="program"&gt;if(request.getHeader("X-WAP-PROFILE"))&lt;br /&gt;{&lt;br /&gt;  //Code to invoke the business procedures to generate the mobile client&lt;br /&gt;  return mapping.findForward("mobileHome"); //If you're using struts tiles, you can forward the mobile users to a different page&lt;br /&gt;}&lt;br /&gt;//Logic for normal users&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Drop a comment if you face any issues with the above technique. Hope you guys have understood the simple logic and enjoy developing web applications. Enhancement makes you different from other websites.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7316847079866971282-4143209561161600915?l=java-servlet-jsp-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java-servlet-jsp-web.blogspot.com/feeds/4143209561161600915/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/07/single-web-application-for-desktop.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/4143209561161600915'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/4143209561161600915'/><link rel='alternate' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/07/single-web-application-for-desktop.html' title='Single web application for desktop users and mobile users'/><author><name>Santhosh Reddy</name><uri>http://www.blogger.com/profile/05232963292855488994</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_P0JbJW7kyKo/ShZkH-FOe4I/AAAAAAAAHP0/ogsB2X0vAMU/S220/IMG_0305.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7316847079866971282.post-2612575180840187181</id><published>2009-07-07T05:06:00.003+05:30</published><updated>2009-07-07T05:14:17.039+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Spring'/><title type='text'>What is Spring framework - A Java framework</title><content type='html'>Fundamentally, what is Spring? We think of it as a Platform for your Java code. It provides comprehensive infrastructural support for developing Java applications. Spring deals with the plumbing so you can focus on solving the domain problem. Spring as a platform allows applications to be built from "plain old Java objects" (POJOs). This is true fo the Java SE programming model as well as within a number of other environments including full and partial Java EE. Spring allows enterprise services to be applied to POJOs in a non-invasive way.&lt;br /&gt;Examples of Spring as a platform:&lt;br /&gt;1. Make a Java method execute in a database transaction; without the implementer dealing with transaction APIs&lt;br /&gt;2. Make a local Java method a remote-procedure; without the implementer dealing with remoting APIs&lt;br /&gt;3. Make a local Java method a management operation; without the implementer dealing with JMX APIs&lt;br /&gt;4. Make a local Java method a message handler; without the implementer dealing with JMS APIs&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;Spring Modules&lt;/h2&gt;&lt;br /&gt;The Spring Framework contains a lot of features, which are well-organized in ab out twenty modules. These modules can be grouped together based on their primary features into Core Container, Data Access/Integration, Web, AOP (Aspect Oriented Programming), Instrumentation and Test. These groups are shown in the diagram below.&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_P0JbJW7kyKo/SlKLGxMJl7I/AAAAAAAAI3g/4mLxqrq9JDY/s1600-h/spring-core.png" target="_blank"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 320px; height: 247px;" src="http://1.bp.blogspot.com/_P0JbJW7kyKo/SlKLGxMJl7I/AAAAAAAAI3g/4mLxqrq9JDY/s320/spring-core.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5355495855296714674" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;strong&gt;Core Container&lt;/strong&gt;&lt;br /&gt;The Core Container consists of the Core, Beans, Context and Expression modules.&lt;br /&gt;&lt;br /&gt;The Core and Beans modules provide the most fundamental parts of the framework and provides the IoC and Dependency Injection features. The basic concept here is the BeanFactory, which provides a sophisticated implementation of the factory pattern which removes the need for programmatic singletons and allows you to decouple the configuration and specification of dependencies from your actual program logic.&lt;br /&gt;&lt;br /&gt;The Context module build on the solid base provided by the Core and Beans modules: it provides a way to access objects in a framework-style manner in a fashion somewhat reminiscent of a JNDI-registry. The Context module inherits its features from the Beans module and adds support for internationalization (I18N) (using for example resource bundles), event-propagation, resource-loading, and the transparent creation of contexts by, for example, a servlet container. The Context module also contains support for some Java EE features like EJB, JMX and basic remoting support.&lt;br /&gt;&lt;br /&gt;The Expression Language module provides a powerful expression language for querying and manipulating an object graph at runtime. It can be seen as an extension of the unified expression language (unified EL) as specified in the JSP 2.1 specification. The language supports setting and getting of property values, property assignment, method invocation, accessing the context of arrays, collections and indexers, logical and arithmetic operators, named variables, and retrieval of objects by name from Spring's IoC container. It also supports list projection and selection, as well as common list aggregators.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Data Access/Integration&lt;/strong&gt;&lt;br /&gt;The Data Access/Integration layer consists of the JDBC, ORM, OXM, JMS and Transaction modules. &lt;br /&gt;&lt;br /&gt;The JDBC module provides a JDBC-abstraction layer that removes the need to do tedious JDBC coding and parsing of database-vendor specific error codes. &lt;br /&gt;&lt;br /&gt;The ORM module provides integration layers for popular object-relational mapping APIs, including JPA, JDO, Hibernate, and iBatis. Using the ORM package you can use all those O/R-mappers in combination with all the other features Spring offers, such as the simple declarative transaction management feature mentioned previously.&lt;br /&gt;&lt;br /&gt;The OXM module provides an abstraction layer for using a number of Object/XML mapping implementations. Supported technologies include JAXB, Castor, XMLBeans, JiBX and XStream.&lt;br /&gt;&lt;br /&gt;The JMS module provides Spring's support for the Java Messaging Service. It contains features for both&lt;br /&gt;producing and consuming messages.&lt;br /&gt;&lt;br /&gt;The Transaction module provides a way to do programmatic as well as declarative transaction&lt;br /&gt;management, not only for classes implementing special interfaces, but for all your POJOs (plain old Java&lt;br /&gt;objects).&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Web&lt;/strong&gt;&lt;br /&gt;The Web layer consists of the Web, Web-Servlet and Web-Portlet modules.&lt;br /&gt;&lt;br /&gt;Spring's Web module provides basic web-oriented integration features, such as multipart file-upload functionality, the initialization of the IoC container using servlet listeners and a web-oriented application context. It also contains the web related parts of Spring's remoting support.&lt;br /&gt;&lt;br /&gt;The Web-Servlet module provides Spring's Model-View-Controller (MVC) implementation for web-applications. Spring's MVC framework is not just any old implementation; it provides a clean separation between domain model code and web forms, and allows you to use all the other features of the Spring Framework.&lt;br /&gt;&lt;br /&gt;The Web-Portlet module provides the MVC implementation to be used in a portlet environment and mirrors what is provided in the Web-Servlet module.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;AOP and Instrumentation&lt;/strong&gt;&lt;br /&gt;Spring's AOP module provides an AOP Alliance-compliant aspect-oriented programming implementation allowing you to define, for example, method-interceptors and pointcuts to cleanly decouple code implementing functionality that should logically speaking be separated. Using source-level metadata functionality you can also incorporate all kinds of behavioral information into your code, in a manner similar to that of .NET attributes.&lt;br /&gt;&lt;br /&gt;There is also a separate Aspects module that provides integration with AspectJ.&lt;br /&gt;&lt;br /&gt;The Instrumentation module provides class instrumentation support and classloader implementations to be used in certain application servers.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Test&lt;/strong&gt;&lt;br /&gt;The Test module contains the Test Framework that supports testing Spring components using JUnit or TestNG. It provides consistent loading of Spring ApplicationContexts and caching of those contexts. It also contains a number of Mock objects that are usful in many testing scenarios to test your code in&lt;br /&gt;isolation.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7316847079866971282-2612575180840187181?l=java-servlet-jsp-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java-servlet-jsp-web.blogspot.com/feeds/2612575180840187181/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/07/what-is-spring-framework-java-framework.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/2612575180840187181'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/2612575180840187181'/><link rel='alternate' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/07/what-is-spring-framework-java-framework.html' title='What is Spring framework - A Java framework'/><author><name>Santhosh Reddy</name><uri>http://www.blogger.com/profile/05232963292855488994</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_P0JbJW7kyKo/ShZkH-FOe4I/AAAAAAAAHP0/ogsB2X0vAMU/S220/IMG_0305.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_P0JbJW7kyKo/SlKLGxMJl7I/AAAAAAAAI3g/4mLxqrq9JDY/s72-c/spring-core.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7316847079866971282.post-1577029485800070873</id><published>2009-07-05T14:14:00.005+05:30</published><updated>2009-07-22T20:09:09.502+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='SCJP 1.5 Question Bank'/><title type='text'>Sun Certified Java Professional (SCJP) 1.5 Question Bank - 4</title><content type='html'>Here is the fourth article of questions on SCJP 1.5. If you haven't read the third article, &lt;a href="http://java-servlet-jsp-web.blogspot.com/2009/06/sun-certified-java-professional-scjp-15_19.html" title="Read third SCJP question bank"&gt;click here&lt;/a&gt; to read.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Question: 16&lt;/strong&gt;&lt;br /&gt;Given:&lt;br /&gt;1. public class TestSeven extends Thread {&lt;br /&gt;2. private static int x;&lt;br /&gt;3. public synchronized void doThings() {&lt;br /&gt;4. int current = x;&lt;br /&gt;5. current++;&lt;br /&gt;6. x = current;&lt;br /&gt;7. }&lt;br /&gt;8. public void run() {&lt;br /&gt;9. doThings();&lt;br /&gt;10. }&lt;br /&gt;11.}&lt;br /&gt;Which statement is true?&lt;br /&gt;A. Compilation fails.&lt;br /&gt;B. An exception is thrown at runtime.&lt;br /&gt;C. Synchronizing the run() method would make the class thread-safe.&lt;br /&gt;D. The data in variable "x" are protected from concurrent access problems.&lt;br /&gt;E. Declaring the doThings() method as static would make the class thread-safe.&lt;br /&gt;F. Wrapping the statements within doThings() in a synchronized(new Object()) { } block would make the class thread-safe.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Answer: E&lt;/strong&gt;&lt;br /&gt;&lt;hr /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Question: 17&lt;/strong&gt;&lt;br /&gt;Given:&lt;br /&gt;1. public class Threads3 implements Runnable {&lt;br /&gt;2. public void run() {&lt;br /&gt;3. System.out.print("running");&lt;br /&gt;4. }&lt;br /&gt;5. public static void main(String[] args) {&lt;br /&gt;6. Thread t = new Thread(new Threads3());&lt;br /&gt;7. t.run();&lt;br /&gt;8. t.run();&lt;br /&gt;9. t.start();&lt;br /&gt;10. }&lt;br /&gt;11. }&lt;br /&gt;What is the result?&lt;br /&gt;A. Compilation fails.&lt;br /&gt;B. An exception is thrown at runtime.&lt;br /&gt;C. The code executes and prints "running".&lt;br /&gt;D. The code executes and prints "runningrunning".&lt;br /&gt;E. The code executes and prints "runningrunningrunning".&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Answer: E&lt;/strong&gt;&lt;br /&gt;&lt;hr /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Question: 18&lt;/strong&gt;&lt;br /&gt;Given:&lt;br /&gt;public class NamedCounter {&lt;br /&gt;private final String name;&lt;br /&gt;private int count;&lt;br /&gt;public NamedCounter(String name) { this.name = name; }&lt;br /&gt;public String getName() { return name; }&lt;br /&gt;public void increment() { count++; }&lt;br /&gt;public int getCount() { return count; }&lt;br /&gt;public void reset() { count = 0; }&lt;br /&gt;}&lt;br /&gt;Which three changes should be made to adapt this class to be used safely by multiple threads? (Choose three.)&lt;br /&gt;A. declare reset() using the synchronized keyword&lt;br /&gt;B. declare getName() using the synchronized keyword&lt;br /&gt;C. declare getCount() using the synchronized keyword&lt;br /&gt;D. declare the constructor using the synchronized keyword&lt;br /&gt;E. declare increment() using the synchronized keyword&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Answer: A, C, E&lt;/strong&gt;&lt;br /&gt;&lt;hr /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Question: 19&lt;/strong&gt;&lt;br /&gt;Given:&lt;br /&gt;7. void waitForSignal() {&lt;br /&gt;8. Object obj = new Object();&lt;br /&gt;9. synchronized (Thread.currentThread()) {&lt;br /&gt;10. obj.wait();&lt;br /&gt;11. obj.notify();&lt;br /&gt;12. }&lt;br /&gt;13. }&lt;br /&gt;Which statement is true?&lt;br /&gt;A. This code may throw an InterruptedException.&lt;br /&gt;B. This code may throw an IllegalStateException.&lt;br /&gt;C. This code may throw a TimeoutException after ten minutes.&lt;br /&gt;D. This code will not compile unless "obj.wait()" is replaced with "((Thread) obj).wait()".&lt;br /&gt;E. Reversing the order of obj.wait() and obj.notify() may cause this method to complete normally.&lt;br /&gt;F. A call to notify() or notifyAll() from another thread may cause this method to complete normally.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Answer: B&lt;/strong&gt;&lt;br /&gt;&lt;hr /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Question: 20&lt;/strong&gt;&lt;br /&gt;Which two code fragments will execute the method doStuff() in a separate&lt;br /&gt;thread? (Choose two.)&lt;br /&gt;A. new Thread() {&lt;br /&gt;public void run() { doStuff(); }&lt;br /&gt;};&lt;br /&gt;B. new Thread() {&lt;br /&gt;public void start() { doStuff(); }&lt;br /&gt;};&lt;br /&gt;C. new Thread() {&lt;br /&gt;public void start() { doStuff(); }&lt;br /&gt;}.run();&lt;br /&gt;D. new Thread() {&lt;br /&gt;public void run() { doStuff(); }&lt;br /&gt;}.start();&lt;br /&gt;E. new Thread(new Runnable() {&lt;br /&gt;public void run() { doStuff(); }&lt;br /&gt;}).run();&lt;br /&gt;F. new Thread(new Runnable() {&lt;br /&gt;public void run() { doStuff(); }&lt;br /&gt;}).start();&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Answer: D, F&lt;/strong&gt;&lt;br /&gt;&lt;hr /&gt;&lt;br /&gt;&lt;br /&gt;If you would like to read all the SCJP Question bank articles, please &lt;a href="http://java-servlet-jsp-web.blogspot.com/search/label/SCJP%201.5%20Question%20Bank" title="Read all SCJP posts"&gt;click here&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7316847079866971282-1577029485800070873?l=java-servlet-jsp-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java-servlet-jsp-web.blogspot.com/feeds/1577029485800070873/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/07/sun-certified-java-professional-scjp-15.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/1577029485800070873'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/1577029485800070873'/><link rel='alternate' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/07/sun-certified-java-professional-scjp-15.html' title='Sun Certified Java Professional (SCJP) 1.5 Question Bank - 4'/><author><name>Santhosh Reddy</name><uri>http://www.blogger.com/profile/05232963292855488994</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_P0JbJW7kyKo/ShZkH-FOe4I/AAAAAAAAHP0/ogsB2X0vAMU/S220/IMG_0305.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7316847079866971282.post-4912967673037821682</id><published>2009-06-28T00:46:00.002+05:30</published><updated>2009-06-28T00:54:56.524+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Struts'/><title type='text'>Struts framework basics - Extending Java servlets and JSPs</title><content type='html'>&lt;h2&gt;Struts&lt;/h2&gt;&lt;br /&gt;Frame works like Struts, Spring, Webworks simplifies the development of medum sized to large scale applications. For implementing a small scale project we can use JSP model - 1 architechtrue. A frame work is desinged based on good architecture/desing patterns and provides a better procedures for implementing a project. A frame work contains the code that is commonly required for most of the applications. So when we implement a project based on a frame worr, we end up writing less amount of code. Spring, Struts, and webworks are based on model view controller (MVC) architechture/desing pattern.&lt;br /&gt;Here I'm going to recall servlet concepts with a sample servlet before starting struts&lt;br /&gt;&lt;br /&gt;Sugession: Don't use any IDE when you're new to the technology. It will do all the tasks automatically, so you don't have a scope to learn the basics of the technology like how it works, what are all the configurations that we should set inorder to run the API.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;ActionServlet.java&lt;/strong&gt;&lt;br /&gt;&lt;pre class="program"&gt;package my.own;&lt;br /&gt;&lt;br /&gt;import javax.servlet.*;&lt;br /&gt;import javax.servlet.http.*;&lt;br /&gt;import java.io.*;&lt;br /&gt;&lt;br /&gt;public class ActionServlet extends HttpServlet&lt;br /&gt;{&lt;br /&gt;  public ActionServlet()&lt;br /&gt;  {&lt;br /&gt;    System.out.println("---Action servlet created---");&lt;br /&gt;  }&lt;br /&gt;  public void init() throws ServletException&lt;br /&gt;  {&lt;br /&gt;    System.out.println("---Action servlet: init---");&lt;br /&gt;  }&lt;br /&gt;  public void service(HttpServletRequest request, HttpServletResponse response)&lt;br /&gt;     throws ServletException, IOException&lt;br /&gt;  {&lt;br /&gt;    System.out.println("--Action servlet: service--");&lt;br /&gt; System.out.println("URL: "+request.getRequestURI());&lt;br /&gt;  }&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;web.xml&lt;/strong&gt;&lt;br /&gt;&lt;pre class="program"&gt;&amp;lt;web-app&amp;gt;&lt;br /&gt; &amp;lt;servlet&amp;gt;&lt;br /&gt;   &amp;lt;servlet-name&amp;gt;action&amp;lt;/servlet-name&amp;gt;&lt;br /&gt;   &amp;lt;servlet-class&amp;gt;my.own.ActionServlet&amp;lt;/servlet-class&amp;gt;&lt;br /&gt;   &amp;lt;load-on-startup&amp;gt;1&amp;lt;/load-on-startup&amp;gt;&lt;br /&gt; &amp;lt;/servlet&amp;gt;&lt;br /&gt; &amp;lt;servlet-mapping&amp;gt;&lt;br /&gt;   &amp;lt;servlet-name&amp;gt;action&amp;lt;/servlet-name&amp;gt;&lt;br /&gt;   &amp;lt;url-pattern&amp;gt;*.hello&amp;lt;/url-pattern&amp;gt;&lt;br /&gt; &amp;lt;/servlet-mapping&amp;gt;&lt;br /&gt;&amp;lt;/web-app&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Expaination:&lt;/strong&gt;&lt;br /&gt;When the web application is started&lt;br /&gt;1. Web container reads web.xml file&lt;br /&gt;2. As load-on-startup is used for action (name of the servlet) servlet, web container creates a servlet object based on my.own.ActionServlet and invokes init() method.&lt;br /&gt;3. We've used a wild card character in the action servlet url-pattern. When the browser sends a request using the URLs that ends with .hello, web container executes the service() method of action (name of the servlet) servlet.&lt;br /&gt;&lt;br /&gt;Struts team has developed an action servlet as we did in the above example and mapped the url pattern *.do (this is the default pattern. If we want we can change of course).&lt;br /&gt;&lt;br /&gt;Procedure for setting up a struts based web application&lt;br /&gt;1. Create WEB ROOT directory (eg: create a folder under your current working directory with the name myfirststrutsapp)&lt;br /&gt;2. Copy struts-blank.war to directory created in step 1&lt;br /&gt;3. Move to the directory created in step 1 using change directory command (chdir or cd)&lt;br /&gt;4. Extract the content of the WAR file using the command shown below&lt;br /&gt;&lt;pre class="program"&gt;&lt;br /&gt;jar -xvf struts-blank.war&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;After executing the above commnad, sturts software components will be extracted into project directory.&lt;br /&gt;&lt;strong&gt;Struts software contains&lt;/strong&gt;&lt;br /&gt;1. A set of tag libraries (struts-html.tld, struts-bean.tld etc.)&lt;br /&gt;2. A servlet class with the name org.apache.struts.action.ActionServlet. This is the controller of struts in MVC pattern.&lt;br /&gt;3. Classes like org.apache.struts.action.Action, org.apache.struts.action.ActionError, etc are provided as part of struts. These classes are used as part of our code.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Struts application startup actions&lt;/strong&gt;&lt;br /&gt;When a struts based web application started, the following steps will be carried out&lt;br /&gt;1. Web container reads web.xml&lt;br /&gt;2. As load-on-startup is used in web.xml, web container creates a servlet object based on the org.apache.strtus.ActionServlet class provided as part of struts.&lt;br /&gt;3. Web container calls init() method on ActionServlet.&lt;br /&gt;4. The code inside the init() method (i.e.; struts code) of the ActionServlet reads the information available in struts-config.xml&lt;br /&gt;&lt;br /&gt;Whenever the browser sends a request using the URL's that ends with .do, web container executes the service() method of ActionServlet.&lt;br /&gt;&lt;br /&gt;Action class is a sub class of org.apache.struts.action.Action. As part of struts based applications, we need to provide various action classes.&lt;br /&gt;&lt;br /&gt;&lt;pre class="program"&gt;import org.apache.struts.action.*;&lt;br /&gt;import javax.servlet.http.*;&lt;br /&gt;import java.io.*;&lt;br /&gt;&lt;br /&gt;public class ActionOne extends Action&lt;br /&gt;{&lt;br /&gt;  public ActionForward execute(ActionMapping mapping, ActionForm form,HttpServletRequest request, HttpServletResponse response) throws Exception&lt;br /&gt;  {&lt;br /&gt;    System.out.println("ActionOne... execute");&lt;br /&gt; return null;&lt;br /&gt;  }&lt;br /&gt;  public ActionOne()&lt;br /&gt;  {&lt;br /&gt;    System.out.println("--ActionOne created--");&lt;br /&gt;  }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;In order to compile the action classes etc, we must set the class path pointing to the jar files that contains&lt;br /&gt;* Struts related classes and interfaces (struts.jar)&lt;br /&gt;* Servlet related classes and interfaces (weblogic.jar or servlet-api.jar).&lt;br /&gt;&lt;br /&gt;The above action class can be used as part of a struts based project by following the steps given below.&lt;br /&gt;1. Copy the action class under WEB-INF/classes directory.&lt;br /&gt;2. Provide the information about the action class using the action tag in struts-config.xml as shown below&lt;br /&gt;&lt;pre class="program"&gt;&lt;action-mappings&gt;&lt;br /&gt; &amp;lt;action path="/aone" type="ActionOne" /&amp;gt;&lt;br /&gt; ....&lt;br /&gt; ....&lt;br /&gt; &amp;lt;/action-mappings&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;After deploying the application, while requesting, we should use .do in the path i.e.; /aone.do in this case. When the browsers sends the request with this path the following steps will be carried out in the container.&lt;br /&gt;1. Web container class the service() method on ActionServlet. i.e.; web container starts the execution of struts code.&lt;br /&gt;2. Struts code drops ".do" from the URL. In this case "/aone" will be left.&lt;br /&gt;3. Struts code checks for the action-mapping for which the path is "/aone" from the action-mappings and the value of type will be taken. In this case type is ActionOne.&lt;br /&gt;4. If ActionOne object is not available, struts creates ActionOne object.&lt;br /&gt;5. Struts calls the execute() method on ActionOne object.&lt;br /&gt;6. As the execute() method returns null, struts code stops processing the request.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;org.apache.struts.action.ActionMapping and org.apache.struts.action.ActionForward objects&lt;/strong&gt;&lt;br /&gt;org.apache.action.ActionMapping object is used to hold the info available in action tags and org.apache.struts.action.ActionForward object is used to hold the info available in the forward tag.&lt;br /&gt;mapping.getPath() - will return the /aone&lt;br /&gt;mapping.getType() - will return ActionOne&lt;br /&gt;mapping.getParameter() - will return the parameter attribute value of action-mapping tag.&lt;br /&gt;mapping.findForward(string) - will return the forward object.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7316847079866971282-4912967673037821682?l=java-servlet-jsp-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java-servlet-jsp-web.blogspot.com/feeds/4912967673037821682/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/06/struts-framework-basics-extending-java.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/4912967673037821682'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/4912967673037821682'/><link rel='alternate' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/06/struts-framework-basics-extending-java.html' title='Struts framework basics - Extending Java servlets and JSPs'/><author><name>Santhosh Reddy</name><uri>http://www.blogger.com/profile/05232963292855488994</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_P0JbJW7kyKo/ShZkH-FOe4I/AAAAAAAAHP0/ogsB2X0vAMU/S220/IMG_0305.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7316847079866971282.post-2503501223612898087</id><published>2009-06-28T00:36:00.003+05:30</published><updated>2009-06-28T00:44:24.764+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><title type='text'>learn ANT (Another Need Tool) easily &amp; quickly for building Java projects</title><content type='html'>&lt;strong&gt;ANT (Another Need Tool) - build and deploy tool&lt;/strong&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_P0JbJW7kyKo/SkZvC3yGL4I/AAAAAAAAIyM/abVNmF6e-2I/s1600-h/ant.JPG"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 320px; height: 206px;" src="http://2.bp.blogspot.com/_P0JbJW7kyKo/SkZvC3yGL4I/AAAAAAAAIyM/abVNmF6e-2I/s320/ant.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5352087302300905346" title="Java build &amp; deploy" /&gt;&lt;/a&gt;&lt;br /&gt;The above diagram shows the tasks that have to be carried out to built a standalone java application. The process of building a project has to be done repeatedly during the development and the maintainance of a project. It is not advisable to built a project manually. To automate the build process we can use the tools like make, ant etc. ANT (Another Need Tool) tool uses a build file to decide about what task has to be done. The default name of build file is build.xml. "build.xml" file has the tags like project, target, etc.&lt;br /&gt;&lt;strong&gt;build.xml&lt;/strong&gt;&lt;br /&gt;&lt;pre class="program"&gt;&lt;br /&gt;&amp;lt;project name="demoproj" default="target"&amp;gt;&lt;br /&gt;  &amp;lt;target name="targetx"&amp;gt;&lt;br /&gt;    &amp;lt;echo name="Step one of targets"&amp;gt;&lt;br /&gt;    &amp;lt;echo name="Step two of targetx"&amp;gt;&lt;br /&gt;  &amp;lt;/target&amp;gt;&lt;br /&gt;  &amp;lt;target name="targetz"&amp;gt;&lt;br /&gt;    &amp;lt;delete dir="done" /&amp;gt;&lt;br /&gt;    &amp;lt;delete dir="dtwo" /&amp;gt;&lt;br /&gt;  &amp;lt;/target&amp;gt;&lt;br /&gt;&amp;lt;/project&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;mkdir, delete, echo are called as ant tasks. Ant is provided as part of various IDEs like Netbeans, Eclipse, IntelliJ. When we issue the command ant without any parameters, it will read the file build.xml and perform the tasks to reach the targets specified in the default attribute of project tag. To perform the tasks under a perticular target, we should specify the target name as the first parameter when executing the ant command. If the build file name is other than build.xml, we need to use "-f" options to specify the file name.&lt;br /&gt;&lt;strong&gt;Example ant command issue statements&lt;/strong&gt;&lt;br /&gt;&lt;pre class="program"&gt;&lt;br /&gt;cwd&gt; ant&lt;br /&gt;&lt;br /&gt;cwd&gt; ant targetx&lt;br /&gt;&lt;br /&gt;cwd&gt; ant -f ourbuild.xml&lt;br /&gt;&lt;br /&gt;cwd&gt; ant -f ourbuild.xml targetz&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;A target can depend upon multiple targets. To specify the dependencies, we should use depends attribute for target tag.&lt;br /&gt;&lt;pre class="program"&gt;&lt;br /&gt;  &amp;lt;target name="targetx" depends="targety, targetz"&amp;gt;&lt;br /&gt;    &amp;lt;echo name="Step one of targety"&amp;gt;&lt;br /&gt;    &amp;lt;echo name="Step two of targetx"&amp;gt;&lt;br /&gt;  &amp;lt;/target&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;When ant is asked to reach targets, ant performs the task under targety then the task under taskz will be carried out and finally task under targetx will be carried out.&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;An example ant build script&lt;/h2&gt;&lt;br /&gt;&lt;pre class="program"&gt;&lt;br /&gt;&amp;lt;project name="ourproj" default="build"&amp;gt;&lt;br /&gt;  &amp;lt;target name="build" depends="credirs, compile, pack, run"&amp;gt;&lt;br /&gt;  &amp;lt;/target&amp;gt;&lt;br /&gt;  &amp;lt;target name="cleanbuild" depends="clean, build"&amp;gt;&lt;br /&gt;  &amp;lt;/target&amp;gt;&lt;br /&gt;  &amp;lt;target name="clean"&amp;gt;&lt;br /&gt;    &amp;lt;delete dir="build" /&amp;gt;&lt;br /&gt;  &amp;lt;/target&amp;gt;&lt;br /&gt;  &amp;lt;target name="credirs"&amp;gt;&lt;br /&gt;    &amp;lt;mkdir dir="build" /&amp;gt;&lt;br /&gt;    &amp;lt;mkdir dir="build/classes" /&amp;gt;&lt;br /&gt;    &amp;lt;mkdir dir="build/lib" /&amp;gt;&lt;br /&gt;  &amp;lt;/target&amp;gt;&lt;br /&gt;  &amp;lt;target name="compile"&amp;gt;&lt;br /&gt;    &amp;lt;javac srcdir="src" destdir="build/classes" includes="*.java" /&amp;gt;&lt;br /&gt;  &amp;lt;/target&amp;gt;&lt;br /&gt;  &amp;lt;target name="pack"&amp;gt;&lt;br /&gt;    &amp;lt;jar jarfile="build/lib/ourproj.jar" basedir="build/classes" /&amp;gt;&lt;br /&gt;  &amp;lt;/target&amp;gt;&lt;br /&gt;  &amp;lt;target name="run"&amp;gt;&lt;br /&gt;    &amp;lt;java classname="app" classpath="build/lib/ourproj.jar" /&amp;gt;&lt;br /&gt;  &amp;lt;/target&amp;gt;&lt;br /&gt;&amp;lt;/project&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;To improve the flexibility of build file, we can use the ant properties. To do this create a properties file with the build file name and properties as the extension.&lt;br /&gt;&lt;strong&gt;build.properties&lt;/strong&gt;&lt;br /&gt;&lt;pre class="program"&gt;&lt;br /&gt;  SRCDIR=src&lt;br /&gt;  CLSDIR=build/classes&lt;br /&gt;  LIBDIR=build/lib&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;To use the value of the properties can be used in the build file with the below syntax.&lt;br /&gt;Syntax: ${property}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7316847079866971282-2503501223612898087?l=java-servlet-jsp-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java-servlet-jsp-web.blogspot.com/feeds/2503501223612898087/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/06/learn-ant-another-need-tool-easily.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/2503501223612898087'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/2503501223612898087'/><link rel='alternate' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/06/learn-ant-another-need-tool-easily.html' title='learn ANT (Another Need Tool) easily &amp; quickly for building Java projects'/><author><name>Santhosh Reddy</name><uri>http://www.blogger.com/profile/05232963292855488994</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_P0JbJW7kyKo/ShZkH-FOe4I/AAAAAAAAHP0/ogsB2X0vAMU/S220/IMG_0305.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_P0JbJW7kyKo/SkZvC3yGL4I/AAAAAAAAIyM/abVNmF6e-2I/s72-c/ant.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7316847079866971282.post-6137717089335032285</id><published>2009-06-22T19:18:00.007+05:30</published><updated>2009-06-28T00:56:54.390+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='web application'/><category scheme='http://www.blogger.com/atom/ns#' term='Javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='HTML'/><title type='text'>Include Skype buttons on your webpage</title><content type='html'>Skype is a very well known online communication tool. Some companies are providing the online chat/call using the Skype software. If you would like to enable Skype call on your web page, follow below steps.&lt;br /&gt;&lt;br /&gt;1. You should include a javascript from Skype web site. &lt;br /&gt;&lt;pre class="program"&gt;&lt;br /&gt;&amp;lt;script type="text/javascript" src="http://download.skype.com/share/skypebuttons/js/skypeCheck.js"&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;This script will have methods to check the client's machine whether the user has installed Skype software.&lt;br /&gt;&lt;br /&gt;2. Now you can use the Skype options chat, call, add, userinfo and sendfile. Here is the syntax for these options to include on your webpage.&lt;br /&gt;&lt;pre class="program"&gt;&amp;lt;a href="skype:skypename?option" onclick="return skypeCheck();"&amp;gt;&lt;/pre&gt;&lt;br /&gt;&lt;strong&gt;skeypname&lt;/strong&gt; - the skype handle user name that you would like to call or chat etc. If you've multiple skype names, then enter them as semicolon (;) separated values.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;option&lt;/strong&gt; - the operation that you would like to perform like chatting (chat), calling (call), adding a contact (add), viewing user information (userinfo), and sending a file (sendfile) etc.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;skypeCheck()&lt;/strong&gt; - a javascript function that has been defined in the above included JS file. If user doesn't have Skype software, it will show an alert asking to download Skype software. &lt;a href="http://download.skype.com/share/skypebuttons/oops/oops.html" target="_blank"&gt;Click here&lt;/a&gt; to see the error message that will be seen by user if there is now Skype installed.&lt;br /&gt;&lt;br /&gt;&lt;script type="text/javascript" src="http://download.skype.com/share/skypebuttons/js/skypeCheck.js"&gt;&lt;/script&gt;&lt;br /&gt;&lt;a href="skype:santhosh.reddy.m?call" onclick="return skypeCheck();" style="text-decoration: none;"&gt;Call me if you've any doubt&lt;img src="http://download.skype.com/share/skypebuttons/buttons/call_green_transparent_70x23.png" style="border: none;" width="70" height="23" alt="Call Me" title="Call me" align = bottom /&gt;&lt;/a&gt; or you can email me @ doubtsplz@gmail.com.&lt;br /&gt;&lt;br /&gt;Enhance your website with more rich features...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7316847079866971282-6137717089335032285?l=java-servlet-jsp-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java-servlet-jsp-web.blogspot.com/feeds/6137717089335032285/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/06/include-skype-buttons-on-your-webpage.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/6137717089335032285'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/6137717089335032285'/><link rel='alternate' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/06/include-skype-buttons-on-your-webpage.html' title='Include Skype buttons on your webpage'/><author><name>Santhosh Reddy</name><uri>http://www.blogger.com/profile/05232963292855488994</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_P0JbJW7kyKo/ShZkH-FOe4I/AAAAAAAAHP0/ogsB2X0vAMU/S220/IMG_0305.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7316847079866971282.post-8457654248475605460</id><published>2009-06-22T18:58:00.005+05:30</published><updated>2009-06-22T19:17:58.508+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='HTML'/><title type='text'>HTML IFRAME dynamic height (Java script iframe height on the fly)</title><content type='html'>Hello... I'm going to explain here about the IFRAME height. IFRAME is a web component and will have different properties and behaviors on different browsers like IE, Firefox, and Chrome.&lt;br /&gt;&lt;br /&gt;Consider, your webapplication has a RTF editor where user can enter the rich text. Now in order to show the content properly entered by the user, you should go for IFRAME event on the view page as well. But here the only problem that you don't want to see is, scroll bar for IFRAME.&lt;br /&gt;&lt;br /&gt;In order to remove the scroll bar, we should increase the IFRAME height. But it is not really possible dynamically change the height without Javascript.&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;How to achieve IFRAME without scroll bar&lt;/h2&gt;&lt;br /&gt;I've found a very simple solution which has been tested on all the major browsers i.e.; it is cross browser supported approach.&lt;br /&gt;&lt;br /&gt;Include the below script on your page, where you've an IFRAME control&lt;br /&gt;&lt;pre class="program"&gt;&amp;lt;script type="text/javascript"&amp;gt;&lt;br /&gt;function resizeFrame(frame) {&lt;br /&gt;  frame.style.height = frame.contentWindow.document.body.scrollHeight + 20 + "px";&lt;br /&gt;}&lt;br /&gt;&amp;lt;/script&amp;gt;&lt;/pre&gt;&lt;br /&gt;You can invoke the above function two ways.&lt;br /&gt;1. Invoke this on load of the body&lt;br /&gt;&lt;pre class="program"&gt;&amp;lt;body onload="resizeFrame(document.getElementById('iframe_id'))"&amp;gt;&lt;/pre&gt;&lt;br /&gt;2. For the dynamic web applications, we used have only one header file across the web application. In this situation instead of checking the conditions and making the onload call, you can use the time out functionality.&lt;br /&gt;&lt;pre class="program"&gt;setTimeout("resizeFrame(document.getElementById('iframe_id'))",300);&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;If you're still able to see scroll bar after implementing this, just increase the above value 20 to the necessary value.&lt;br /&gt;&lt;br /&gt;Have a great time... Enjoy the web development...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7316847079866971282-8457654248475605460?l=java-servlet-jsp-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java-servlet-jsp-web.blogspot.com/feeds/8457654248475605460/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/06/html-iframe-dynamic-height-java-script.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/8457654248475605460'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/8457654248475605460'/><link rel='alternate' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/06/html-iframe-dynamic-height-java-script.html' title='HTML IFRAME dynamic height (Java script iframe height on the fly)'/><author><name>Santhosh Reddy</name><uri>http://www.blogger.com/profile/05232963292855488994</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_P0JbJW7kyKo/ShZkH-FOe4I/AAAAAAAAHP0/ogsB2X0vAMU/S220/IMG_0305.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7316847079866971282.post-2368277584009886521</id><published>2009-06-19T19:42:00.004+05:30</published><updated>2009-06-19T19:58:07.675+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='web application'/><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='Web technology'/><category scheme='http://www.blogger.com/atom/ns#' term='HTML'/><title type='text'>Servlets, JSP, and HTML form encode type</title><content type='html'>I'm going to discuss about an attribute of the html tag &amp;lt;form&amp;gt;. The very common attribute that would appear only when you want to upload an image, enctype, is requests the browser to use the encoding technique while submitting the form.&lt;br /&gt;&lt;br /&gt;The default value for this attribute is "application/x-www-form-urlencoded". Normally browser would consider this attribute when the form method is "post". The value "multipart/form-data" should be used in combination with the INPUT element, type="file".&lt;br /&gt;&lt;br /&gt;If you want to provide an option on your webpage to upload an image, you should use the form method "post" and enctype as "multipart/form-data". In this case only, browser will transfer the complete file content to the server. This would take some time to upload the data to the server depends on the file size that user chooses to upload.&lt;br /&gt;&lt;br /&gt;Hope you guys understand the concept. Probably I can place a sample for this later.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://java-servlet-jsp-web.blogspot.com/search/label/Java%20programs" title="Other Java programs"&gt;Click here&lt;/a&gt; to check out programs that I've developed.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7316847079866971282-2368277584009886521?l=java-servlet-jsp-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java-servlet-jsp-web.blogspot.com/feeds/2368277584009886521/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/06/servlets-jsp-and-html-form-encode-type.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/2368277584009886521'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/2368277584009886521'/><link rel='alternate' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/06/servlets-jsp-and-html-form-encode-type.html' title='Servlets, JSP, and HTML form encode type'/><author><name>Santhosh Reddy</name><uri>http://www.blogger.com/profile/05232963292855488994</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_P0JbJW7kyKo/ShZkH-FOe4I/AAAAAAAAHP0/ogsB2X0vAMU/S220/IMG_0305.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7316847079866971282.post-8400829424541090269</id><published>2009-06-19T19:22:00.002+05:30</published><updated>2009-06-19T19:36:51.732+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='SCJP 1.5 Question Bank'/><title type='text'>Sun Certified Java Professional (SCJP) 1.5 Question Bank - 3</title><content type='html'>Here is the third article of questions on SCJP 1.5. If you haven't read the second article, &lt;a href="http://java-servlet-jsp-web.blogspot.com/2009/06/sun-certified-java-professional-15.html" title="Read second SCJP question bank"&gt;click here&lt;/a&gt; to read.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Question: 11&lt;/strong&gt;&lt;br /&gt;Given:&lt;br /&gt;10. package com.sun.scjp;&lt;br /&gt;11. public class Geodetics {&lt;br /&gt;12.  public static final double DIAMETER = 12756.32; // kilometers&lt;br /&gt;13. }&lt;br /&gt;Which two correctly access the DIAMETER member of the Geodetics class? (Choose two.)&lt;br /&gt;A. import com.sun.scjp.Geodetics;&lt;br /&gt;   public class TerraCarta {&lt;br /&gt;   public double halfway()&lt;br /&gt;   { return Geodetics.DIAMETER/2.0; }&lt;br /&gt;B. import static com.sun.scjp.Geodetics;&lt;br /&gt;   public class TerraCarta{&lt;br /&gt;   public double halfway() { return DIAMETER/2.0; } }&lt;br /&gt;C. import static com.sun.scjp.Geodetics.*;&lt;br /&gt;   public class TerraCarta {&lt;br /&gt;   public double halfway() { return DIAMETER/2.0; } }&lt;br /&gt;D. package com.sun.scjp;&lt;br /&gt;   public class TerraCarta {&lt;br /&gt;   public double halfway() { return DIAMETER/2.0; } }&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Answer: A, C&lt;/strong&gt;&lt;br /&gt;&lt;hr /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Question: 12&lt;/strong&gt;&lt;br /&gt;Given:&lt;br /&gt;10. public class Bar {&lt;br /&gt;11.  static void foo( int... x ) {&lt;br /&gt;12.  // insert code here&lt;br /&gt;13. }&lt;br /&gt;14. }&lt;br /&gt;Which two code fragments, inserted independently at line 12, will allow the class to compile? (Choose two.)&lt;br /&gt;A. foreach( x ) System.out.println(z);&lt;br /&gt;B. for( int z : x ) System.out.println(z);&lt;br /&gt;C. while( x.hasNext() ) System.out.println( x.next() );&lt;br /&gt;D. for( int i=0; i&lt; x.length; i++ ) System.out.println(x[i]);&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Answer: B, D&lt;/strong&gt;&lt;br /&gt;&lt;hr /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Question: 13&lt;/strong&gt;&lt;br /&gt;Given:&lt;br /&gt;1. public class Plant {&lt;br /&gt;2.  private String name;&lt;br /&gt;3.  public Plant(String name) { this.name = name; }&lt;br /&gt;4.  public String getName() { return name; }&lt;br /&gt;5. }&lt;br /&gt;1. public class Tree extends Plant {&lt;br /&gt;2.  public void growFruit() { }&lt;br /&gt;3.  public void dropLeaves() { }&lt;br /&gt;4. }&lt;br /&gt;Which statement is true?&lt;br /&gt;A. The code will compile without changes.&lt;br /&gt;B. The code will compile if public Tree() { Plant(); } is added to the Tree class.&lt;br /&gt;C. The code will compile if public Plant() { Tree(); } is added to the Plant class.&lt;br /&gt;D. The code will compile if public Plant() { this("fern"); } is added to the Plant class.&lt;br /&gt;E. The code will compile if public Plant() { Plant("fern"); } is added to the Plant class.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Answer: D&lt;/strong&gt;&lt;br /&gt;&lt;hr /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Question: 14&lt;/strong&gt;&lt;br /&gt;Which two classes correctly implement both the java.lang.Runnable and the&lt;br /&gt;java.lang.Clonable interfaces? (Choose two.)&lt;br /&gt;A. public class Session&lt;br /&gt;implements Runnable, Clonable {&lt;br /&gt;public void run();&lt;br /&gt;public Object clone();&lt;br /&gt;}&lt;br /&gt;B. public class Session&lt;br /&gt;extends Runnable, Clonable {&lt;br /&gt;public void run() { /* do something */ }&lt;br /&gt;public Object clone() { /* make a copy */ }&lt;br /&gt;C. public class Session&lt;br /&gt;implements Runnable, Clonable {&lt;br /&gt;public void run() { /* do something */ }&lt;br /&gt;public Object clone() { /* make a copy */ }&lt;br /&gt;D. public abstract class Session&lt;br /&gt;implements Runnable, Clonable {&lt;br /&gt;public void run() { /* do something */ }&lt;br /&gt;public Object clone() { /*make a copy */ }&lt;br /&gt;E. public class Session&lt;br /&gt;implements Runnable, implements Clonable {&lt;br /&gt;public void run() { /* do something */ }&lt;br /&gt;public Object clone() { /* make a copy */ }&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Answer: C, D&lt;/strong&gt;&lt;br /&gt;&lt;hr /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Question: 15&lt;/strong&gt;&lt;br /&gt;Given:&lt;br /&gt;1. public class Threads2 implements Runnable {&lt;br /&gt;2.&lt;br /&gt;3.  public void run() {&lt;br /&gt;4.   System.out.println("run.");&lt;br /&gt;5.   throw new RuntimeException("Problem");&lt;br /&gt;6.  }&lt;br /&gt;7.  public static void main(String[] args) {&lt;br /&gt;8.   Thread t = new Thread(new Threads2());&lt;br /&gt;9.   t.start();&lt;br /&gt;10.  System.out.println("End of method.");&lt;br /&gt;11. }&lt;br /&gt;12. }&lt;br /&gt;Which two can be results? (Choose two.)&lt;br /&gt;A. java.lang.RuntimeException: Problem &lt;br /&gt;B. run.&lt;br /&gt;   java.lang.RuntimeException: Problem&lt;br /&gt;C. End of method. &lt;br /&gt;   java.lang.RuntimeException: Problem&lt;br /&gt;D. End of method.&lt;br /&gt;   run.&lt;br /&gt;   java.lang.RuntimeException: Problem&lt;br /&gt;E. run.&lt;br /&gt;   java.lang.RuntimeException: Problem&lt;br /&gt;   End of method.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Answer: D, E&lt;/strong&gt;&lt;br /&gt;&lt;hr /&gt;&lt;br /&gt;&lt;br /&gt;If you would like to read all the SCJP Question bank articles, please &lt;a href="http://java-servlet-jsp-web.blogspot.com/search/label/SCJP%201.5%20Question%20Bank" title="Read all SCJP posts"&gt;click here&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7316847079866971282-8400829424541090269?l=java-servlet-jsp-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java-servlet-jsp-web.blogspot.com/feeds/8400829424541090269/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/06/sun-certified-java-professional-scjp-15_19.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/8400829424541090269'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/8400829424541090269'/><link rel='alternate' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/06/sun-certified-java-professional-scjp-15_19.html' title='Sun Certified Java Professional (SCJP) 1.5 Question Bank - 3'/><author><name>Santhosh Reddy</name><uri>http://www.blogger.com/profile/05232963292855488994</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_P0JbJW7kyKo/ShZkH-FOe4I/AAAAAAAAHP0/ogsB2X0vAMU/S220/IMG_0305.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7316847079866971282.post-2828774181531321898</id><published>2009-06-19T18:51:00.005+05:30</published><updated>2009-06-19T19:19:03.944+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='Web technology'/><title type='text'>HTTP Referrer Header - Java, Servlets and JSP</title><content type='html'>Today, I'm going to discuss more about the HTTP Referrer header. As I've explained in my previous posts, a header is a key value pair separated by color (:). &lt;a href="http://java-servlet-jsp-web.blogspot.com/2009/06/http-protocol-detailed-view.html" title="More on HTTP protocol"&gt;Click here&lt;/a&gt; to familiar with HTTP protocol internal details.&lt;br /&gt;&lt;br /&gt;Each request will have a format and as part of it, client will send HTTP headers. As per the HTTP specifications, a header REFERRER is an optional information that client can send to server. This piece of information would be useful to know which URL has the link or reference to the current requesting URL.&lt;br /&gt;Example: Consider you're searching for a keyword in Google, it shows the results when you hit enter. Here if you click any link, REFERRER header will be passed as Google search URL as it has the link to the current requested URL.&lt;br /&gt;&lt;br /&gt;If you're working on any web technologies like Java Servlets, JSP, Struts, Springs, .NET, or PHP and if you would like to know which page has the current requested URL reference, then you can get it by using the REFERRER header.&lt;br /&gt;&lt;br /&gt;Here is the construct to get the REFERRER header in Java&lt;br /&gt;&lt;pre class="program"&gt;request.getHeader("REFERRER");&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Each programming language has a construct to get the headers. Enjoy programming...&lt;br /&gt;&lt;br /&gt;&lt;a href="http://java-servlet-jsp-web.blogspot.com/search/label/HTTP" title="All HTTP posts"&gt;Click here&lt;/a&gt; to know view all my posts on HTTP&lt;br /&gt;&lt;br /&gt;&lt;a href="http://java-servlet-jsp-web.blogspot.com/search/label/Java%20programs" title="Other Java programs"&gt;Click here&lt;/a&gt; to check out other programs that I've developed.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7316847079866971282-2828774181531321898?l=java-servlet-jsp-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java-servlet-jsp-web.blogspot.com/feeds/2828774181531321898/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/06/http-referrer-header-java-servlets-and.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/2828774181531321898'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/2828774181531321898'/><link rel='alternate' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/06/http-referrer-header-java-servlets-and.html' title='HTTP Referrer Header - Java, Servlets and JSP'/><author><name>Santhosh Reddy</name><uri>http://www.blogger.com/profile/05232963292855488994</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_P0JbJW7kyKo/ShZkH-FOe4I/AAAAAAAAHP0/ogsB2X0vAMU/S220/IMG_0305.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7316847079866971282.post-8032864257843717774</id><published>2009-06-17T21:57:00.003+05:30</published><updated>2009-06-17T22:03:50.733+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='HTTP'/><category scheme='http://www.blogger.com/atom/ns#' term='Java programs'/><title type='text'>A Simple web client - Java program to act as a User-agent</title><content type='html'>Now, I'm going to explain a program which will send a gentle HTTP request to the web server and displays the response headers and response body. This program will shows how a web browser fetches the information.&lt;br /&gt;&lt;br /&gt;&lt;pre class="program"&gt;&lt;br /&gt;import java.io.*;&lt;br /&gt;import java.net.*;&lt;br /&gt;&lt;br /&gt;/**&lt;br /&gt; * Shows how to connect to a web server using correct protocol&lt;br /&gt; * @author Santhosh Reddy Mandadi&lt;br /&gt; * @since 15-March-2007&lt;br /&gt; * @version 1.4&lt;br /&gt; */&lt;br /&gt;class WebClient&lt;br /&gt;{&lt;br /&gt; static public void main(String[] args)throws Exception&lt;br /&gt; {&lt;br /&gt;  //create a Socket  &lt;br /&gt;  try&lt;br /&gt;  {&lt;br /&gt;   //String a=args[0];&lt;br /&gt;   byte ipaddr[]={(byte)208,(byte)198,(byte)128,(byte)208};&lt;br /&gt;   Socket s = new Socket(InetAddress.getByAddress(ipaddr),80);&lt;br /&gt;   //Socket s=new Socket(InetAddress.getLocalHost(),8990);&lt;br /&gt;   System.out.println("Connected to Server Successfully");&lt;br /&gt;   PrintStream ps =new PrintStream(s.getOutputStream());&lt;br /&gt;   InputStream is = s.getInputStream();&lt;br /&gt;   //ps.println("GET / HTTP/1.1 \r\nHOST:inetsolv\r\n\r");&lt;br /&gt;   //ps.println("GET /test1/login.jsp");&lt;br /&gt;   ps.println("GET /cmint/home.html HTTP/1.1\r\nHOST:inetsolv\r\n\r\n");&lt;br /&gt;   byte b[] = new byte [10000];&lt;br /&gt;   // this is definitely a bad way of getting a web document&lt;br /&gt;   BufferedReader reader=new BufferedReader(new InputStreamReader(is));&lt;br /&gt;   String str="";&lt;br /&gt;   while(str!=null)&lt;br /&gt;   {&lt;br /&gt;    System.out.println(str);&lt;br /&gt;    str=reader.readLine();&lt;br /&gt;   }&lt;br /&gt;   s.close();&lt;br /&gt;  }catch(Exception e){ System.out.println(e);}&lt;br /&gt;  }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;There are several ways to find the server and open the socket through as you can see comments from the above program.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://java-servlet-jsp-web.blogspot.com/search/label/HTTP"&gt;Click here&lt;/a&gt; to learn more on HTTP.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://java-servlet-jsp-web.blogspot.com/search/label/Java%20programs" title="Other Java programs"&gt;Click here&lt;/a&gt; to check out other programs that I've developed.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7316847079866971282-8032864257843717774?l=java-servlet-jsp-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java-servlet-jsp-web.blogspot.com/feeds/8032864257843717774/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/06/simple-web-client-java-program-to-act.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/8032864257843717774'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/8032864257843717774'/><link rel='alternate' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/06/simple-web-client-java-program-to-act.html' title='A Simple web client - Java program to act as a User-agent'/><author><name>Santhosh Reddy</name><uri>http://www.blogger.com/profile/05232963292855488994</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_P0JbJW7kyKo/ShZkH-FOe4I/AAAAAAAAHP0/ogsB2X0vAMU/S220/IMG_0305.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7316847079866971282.post-6332199400682048984</id><published>2009-06-17T21:26:00.003+05:30</published><updated>2009-06-17T21:40:09.555+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='HTTP'/><category scheme='http://www.blogger.com/atom/ns#' term='Java programs'/><title type='text'>A Simple Multithreaded Web Server - Java simple HTTP server</title><content type='html'>To continue to my HTTP protocol posts, here is a sample program which acts as a web server. Very basic program to print the headers when client sends a request and responding the bytes if the requested resource exists in the current working directory. &lt;a href="http://java-servlet-jsp-web.blogspot.com/search/label/HTTP" title="HTTP in detail"&gt;Click here&lt;/a&gt; to learn more about HTTP.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;SimpleWebServer.java&lt;/strong&gt;&lt;br /&gt;&lt;pre class="program"&gt;&lt;br /&gt;import java.io.*;&lt;br /&gt;import java.net.*;&lt;br /&gt;import java.util.*;&lt;br /&gt;&lt;br /&gt;/**&lt;br /&gt; * An example of a very simple, multi-threaded HTTP server.&lt;br /&gt; * and also as comments in the source code.&lt;br /&gt; * @author Santhosh Reddy Mandadi&lt;br /&gt; * @since 17-June-2009&lt;br /&gt; * @version 1.0&lt;br /&gt; */&lt;br /&gt;class SimpleWebServer implements HttpConstants {&lt;br /&gt;&lt;br /&gt;    /* static class data/methods */&lt;br /&gt;&lt;br /&gt;    /* print to stdout */&lt;br /&gt;    protected static void p(String s) {&lt;br /&gt;        System.out.println(s);&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    /* print to the log file */&lt;br /&gt;    protected static void log(String s) {&lt;br /&gt;        synchronized (log) {&lt;br /&gt;            log.println(s);&lt;br /&gt;            log.flush();&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    static PrintStream log = null;&lt;br /&gt;    /* our server's configuration information is stored&lt;br /&gt;     * in these properties&lt;br /&gt;     */&lt;br /&gt;    protected static Properties props = new Properties();&lt;br /&gt;&lt;br /&gt;    /* Where worker threads stand idle */&lt;br /&gt;    static Vector threads = new Vector();&lt;br /&gt;&lt;br /&gt;    /* the web server's virtual root */&lt;br /&gt;    static File root;&lt;br /&gt;&lt;br /&gt;    /* timeout on client connections */&lt;br /&gt;    static int timeout = 0;&lt;br /&gt;&lt;br /&gt;    /* max # worker threads */&lt;br /&gt;    static int workers = 5;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    /* load www-server.properties from java.home */&lt;br /&gt;    static void loadProps() throws IOException {&lt;br /&gt;        File f = new File&lt;br /&gt;                (System.getProperty("java.home")+File.separator+&lt;br /&gt;                    "lib"+File.separator+"www-server.properties");&lt;br /&gt;        if (f.exists()) {&lt;br /&gt;            InputStream is =new BufferedInputStream(new&lt;br /&gt;                           FileInputStream(f));&lt;br /&gt;            props.load(is);&lt;br /&gt;            is.close();&lt;br /&gt;            String r = props.getProperty("root");&lt;br /&gt;            if (r != null) {&lt;br /&gt;                root = new File(r);&lt;br /&gt;                if (!root.exists()) {&lt;br /&gt;                    throw new Error(root + " doesn't exist as server root");&lt;br /&gt;                }&lt;br /&gt;            }&lt;br /&gt;            r = props.getProperty("timeout");&lt;br /&gt;            if (r != null) {&lt;br /&gt;                timeout = Integer.parseInt(r);&lt;br /&gt;            }&lt;br /&gt;            r = props.getProperty("workers");&lt;br /&gt;            if (r != null) {&lt;br /&gt;                workers = Integer.parseInt(r);&lt;br /&gt;            }&lt;br /&gt;            r = props.getProperty("log");&lt;br /&gt;            if (r != null) {&lt;br /&gt;                p("opening log file: " + r);&lt;br /&gt;                log = new PrintStream(new BufferedOutputStream(&lt;br /&gt;                                      new FileOutputStream(r)));&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        /* if no properties were specified, choose defaults */&lt;br /&gt;        if (root == null) {&lt;br /&gt;            root = new File(System.getProperty("user.dir"));&lt;br /&gt;        }&lt;br /&gt;        if (timeout &amp;lt;= 1000) {&lt;br /&gt;            timeout = 5000;&lt;br /&gt;        }&lt;br /&gt;        if (workers &amp;lt; 25) {&lt;br /&gt;            workers = 5;&lt;br /&gt;        }&lt;br /&gt;        if (log == null) {&lt;br /&gt;            p("logging to stdout");&lt;br /&gt;            log = System.out;&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    static void printProps() {&lt;br /&gt;        p("root="+root);&lt;br /&gt;        p("timeout="+timeout);&lt;br /&gt;        p("workers="+workers);&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    public static void main(String[] a) throws Exception {&lt;br /&gt;        int port = 9090;&lt;br /&gt;        if (a.length &amp;gt; 0) {&lt;br /&gt;            port = Integer.parseInt(a[0]);&lt;br /&gt;        }&lt;br /&gt;        loadProps();&lt;br /&gt;        printProps();&lt;br /&gt;        /* start worker threads */&lt;br /&gt;        for (int i = 0; i &amp;lt; workers; ++i) {&lt;br /&gt;            Worker w = new Worker();&lt;br /&gt;            (new Thread(w, "worker #"+i)).start();&lt;br /&gt;            threads.addElement(w);&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        ServerSocket ss = new ServerSocket(port);&lt;br /&gt;        while (true) {&lt;br /&gt;&lt;br /&gt;            Socket s = ss.accept();&lt;br /&gt;&lt;br /&gt;            Worker w = null;&lt;br /&gt;            synchronized (threads) {&lt;br /&gt;                if (threads.isEmpty()) {&lt;br /&gt;                    Worker ws = new Worker();&lt;br /&gt;                    ws.setSocket(s);&lt;br /&gt;                    (new Thread(ws, "additional worker")).start();&lt;br /&gt;                } else {&lt;br /&gt;                    w = (Worker) threads.elementAt(0);&lt;br /&gt;                    threads.removeElementAt(0);&lt;br /&gt;                    w.setSocket(s);&lt;br /&gt;                }&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;class Worker extends SimpleWebServer implements HttpConstants, Runnable {&lt;br /&gt;    final static int BUF_SIZE = 2048;&lt;br /&gt;&lt;br /&gt;    static final byte[] EOL = {(byte)'\r', (byte)'\n' };&lt;br /&gt;&lt;br /&gt;    /* buffer to use for requests */&lt;br /&gt;    byte[] buf;&lt;br /&gt;    /* Socket to client we're handling */&lt;br /&gt;    private Socket s;&lt;br /&gt;&lt;br /&gt;    Worker() {&lt;br /&gt;        buf = new byte[BUF_SIZE];&lt;br /&gt;        s = null;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    synchronized void setSocket(Socket s) {&lt;br /&gt;        this.s = s;&lt;br /&gt;        notify();&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    public synchronized void run() {&lt;br /&gt;        while(true) {&lt;br /&gt;            if (s == null) {&lt;br /&gt;                /* nothing to do */&lt;br /&gt;                try {&lt;br /&gt;                    wait();&lt;br /&gt;                } catch (InterruptedException e) {&lt;br /&gt;                    /* should not happen */&lt;br /&gt;                    continue;&lt;br /&gt;                }&lt;br /&gt;            }&lt;br /&gt;            try {&lt;br /&gt;                handleClient();&lt;br /&gt;            } catch (Exception e) {&lt;br /&gt;                e.printStackTrace();&lt;br /&gt;            }&lt;br /&gt;            /* go back in wait queue if there's fewer&lt;br /&gt;             * than numHandler connections.&lt;br /&gt;             */&lt;br /&gt;            s = null;&lt;br /&gt;            Vector pool = SimpleWebServer.threads;&lt;br /&gt;            synchronized (pool) {&lt;br /&gt;                if (pool.size() &amp;gt;= SimpleWebServer.workers) {&lt;br /&gt;                    /* too many threads, exit this one */&lt;br /&gt;                    return;&lt;br /&gt;                } else {&lt;br /&gt;                    pool.addElement(this);&lt;br /&gt;                }&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    void handleClient() throws IOException {&lt;br /&gt;        InputStream is = new BufferedInputStream(s.getInputStream());&lt;br /&gt;        PrintStream ps = new PrintStream(s.getOutputStream());&lt;br /&gt;        /* we will only block in read for this many milliseconds&lt;br /&gt;         * before we fail with java.io.InterruptedIOException,&lt;br /&gt;         * at which point we will abandon the connection.&lt;br /&gt;         */&lt;br /&gt;       // s.setSoTimeout(SimpleWebServer.timeout);&lt;br /&gt;        s.setTcpNoDelay(true);&lt;br /&gt;        /* zero out the buffer from last time */&lt;br /&gt;        for (int i = 0; i &amp;lt; BUF_SIZE; i++) {&lt;br /&gt;            buf[i] = 0;&lt;br /&gt;        }&lt;br /&gt;        try {&lt;br /&gt;            /* We only support HTTP GET/HEAD, and don't&lt;br /&gt;             * support any fancy HTTP options,&lt;br /&gt;             * so we're only interested really in&lt;br /&gt;             * the first line.&lt;br /&gt;             */&lt;br /&gt;            int nread = 0, r = 0;&lt;br /&gt;&lt;br /&gt;   outerloop:&lt;br /&gt;            while (nread &amp;lt; BUF_SIZE) {&lt;br /&gt;                r = is.read(buf, nread, BUF_SIZE - nread);&lt;br /&gt;                if (r == -1) {&lt;br /&gt;                    /* EOF */&lt;br /&gt;                    return;&lt;br /&gt;                }&lt;br /&gt;                int i = nread;&lt;br /&gt;                nread += r;&lt;br /&gt;                for (; i &amp;lt; nread; i++) {&lt;br /&gt;                    if (buf[i] == (byte)'\n' || buf[i] == (byte)'\r') {&lt;br /&gt;                        /* read one line */&lt;br /&gt;                        break outerloop;&lt;br /&gt;                    }&lt;br /&gt;                }&lt;br /&gt;            }&lt;br /&gt; String h = new String(buf,0,nread);&lt;br /&gt; log("..."+h);&lt;br /&gt;            /* are we doing a GET or just a HEAD */&lt;br /&gt;            boolean doingGet;&lt;br /&gt;            /* beginning of file name */&lt;br /&gt;            int index;&lt;br /&gt;            if (buf[0] == (byte)'G' &amp;&amp;&lt;br /&gt;                buf[1] == (byte)'E' &amp;&amp;&lt;br /&gt;                buf[2] == (byte)'T' &amp;&amp;&lt;br /&gt;                buf[3] == (byte)' ') {&lt;br /&gt;                doingGet = true;&lt;br /&gt;                index = 4;&lt;br /&gt;            } else if (buf[0] == (byte)'H' &amp;&amp;&lt;br /&gt;                       buf[1] == (byte)'E' &amp;&amp;&lt;br /&gt;                       buf[2] == (byte)'A' &amp;&amp;&lt;br /&gt;                       buf[3] == (byte)'D' &amp;&amp;&lt;br /&gt;                       buf[4] == (byte)' ') {&lt;br /&gt;                doingGet = false;&lt;br /&gt;                index = 5;&lt;br /&gt;            } else {&lt;br /&gt;  log("unsupported method");&lt;br /&gt;  //let us try to display everything here&lt;br /&gt; //  byte tmp[] = new byte[9000];&lt;br /&gt;      //       int t  = is.read(tmp, 0,800);&lt;br /&gt; //  String rem = new String (tmp,0,t); &lt;br /&gt; //  log(rem); &lt;br /&gt;                /* we don't support this method */&lt;br /&gt;                ps.print("HTTP/1.0 " + HTTP_BAD_METHOD +&lt;br /&gt;                           " unsupported method type: ");&lt;br /&gt;                ps.write(buf, 0, 5);&lt;br /&gt;                ps.write(EOL);&lt;br /&gt;                ps.flush();&lt;br /&gt;                s.close();&lt;br /&gt;                return;&lt;br /&gt;            }&lt;br /&gt;&lt;br /&gt;            int i = 0;&lt;br /&gt;            /* find the file name, from:&lt;br /&gt;             * GET /foo/bar.html HTTP/1.0&lt;br /&gt;             * extract "/foo/bar.html"&lt;br /&gt;             */&lt;br /&gt;            for (i = index; i &amp;lt; nread; i++) {&lt;br /&gt;                if (buf[i] == (byte)' ') {&lt;br /&gt;                    break;&lt;br /&gt;                }&lt;br /&gt;            }&lt;br /&gt;            String fname = (new String(buf, 0, index,&lt;br /&gt;                      i-index)).replace('/', File.separatorChar);&lt;br /&gt;            if (fname.startsWith(File.separator)) {&lt;br /&gt;                fname = fname.substring(1);&lt;br /&gt;            }&lt;br /&gt;            File targ = new File(SimpleWebServer.root, fname);&lt;br /&gt;            if (targ.isDirectory()) {&lt;br /&gt;                File ind = new File(targ, "index.html");&lt;br /&gt;                if (ind.exists()) {&lt;br /&gt;                    targ = ind;&lt;br /&gt;                }&lt;br /&gt;            }&lt;br /&gt;            boolean OK = printHeaders(targ, ps);&lt;br /&gt;            if (doingGet) {&lt;br /&gt;                if (OK) {&lt;br /&gt;                    sendFile(targ, ps);&lt;br /&gt;                } else {&lt;br /&gt;                    send404(targ, ps);&lt;br /&gt;                }&lt;br /&gt;            }&lt;br /&gt;        } finally {&lt;br /&gt;            s.close();&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    boolean printHeaders(File targ, PrintStream ps) throws IOException {&lt;br /&gt;        boolean ret = false;&lt;br /&gt;        int rCode = 0;&lt;br /&gt;        if (!targ.exists()) {&lt;br /&gt;            rCode = HTTP_NOT_FOUND;&lt;br /&gt;            ps.print("HTTP/1.0 " + HTTP_NOT_FOUND + " not found");&lt;br /&gt;            ps.write(EOL);&lt;br /&gt;            ret = false;&lt;br /&gt;        }  else {&lt;br /&gt;            rCode = HTTP_OK;&lt;br /&gt;            ps.print("HTTP/1.0 " + HTTP_OK+" OK");&lt;br /&gt;            ps.write(EOL);&lt;br /&gt;            ret = true;&lt;br /&gt;        }&lt;br /&gt;        log("From " +s.getInetAddress().getHostAddress()+": GET " +&lt;br /&gt;            targ.getAbsolutePath()+"--&amp;gt;"+rCode);&lt;br /&gt;  ps.print("Server: Simple java");&lt;br /&gt;        ps.write(EOL);&lt;br /&gt;        ps.print("Date: " + (new Date()));&lt;br /&gt;        ps.write(EOL);&lt;br /&gt;        if (ret) {&lt;br /&gt;            if (!targ.isDirectory()) {&lt;br /&gt;                ps.print("Content-length: "+targ.length());&lt;br /&gt;                ps.write(EOL);&lt;br /&gt;                ps.print("Last Modified: " + (new&lt;br /&gt;                              Date(targ.lastModified())));&lt;br /&gt;                ps.write(EOL);&lt;br /&gt;                String name = targ.getName();&lt;br /&gt;                int ind = name.lastIndexOf('.');&lt;br /&gt;                String ct = null;&lt;br /&gt;                if (ind &amp;gt; 0) {&lt;br /&gt;                    ct = (String) map.get(name.substring(ind));&lt;br /&gt;                }&lt;br /&gt;                if (ct == null) {&lt;br /&gt;                    ct = "unknown/unknown";&lt;br /&gt;                }&lt;br /&gt;                ps.print("Content-type: " + ct);&lt;br /&gt;                ps.write(EOL);&lt;br /&gt;            } else {&lt;br /&gt;                ps.print("Content-type: text/html");&lt;br /&gt;                ps.write(EOL);&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;        return ret;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    void send404(File targ, PrintStream ps) throws IOException {&lt;br /&gt;        ps.write(EOL);&lt;br /&gt;        ps.write(EOL);&lt;br /&gt;        ps.println("Not Found\n\n"+&lt;br /&gt;                   "The requested resource was not found.\n");&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    void sendFile(File targ, PrintStream ps) throws IOException {&lt;br /&gt;        InputStream is = null;&lt;br /&gt;        ps.write(EOL);&lt;br /&gt;        if (targ.isDirectory()) {&lt;br /&gt;            listDirectory(targ, ps);&lt;br /&gt;            return;&lt;br /&gt;        } else {&lt;br /&gt;            is = new FileInputStream(targ.getAbsolutePath());&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        try {&lt;br /&gt;            int n;&lt;br /&gt;            while ((n = is.read(buf)) &amp;gt; 0) {&lt;br /&gt;                ps.write(buf, 0, n);&lt;br /&gt;            }&lt;br /&gt;        } finally {&lt;br /&gt;            is.close();&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    /* mapping of file extensions to content-types */&lt;br /&gt;    static java.util.Hashtable map = new java.util.Hashtable();&lt;br /&gt;&lt;br /&gt;    static {&lt;br /&gt;        fillMap();&lt;br /&gt;    }&lt;br /&gt;    static void setSuffix(String k, String v) {&lt;br /&gt;        map.put(k, v);&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    static void fillMap() {&lt;br /&gt;        setSuffix("", "content/unknown");&lt;br /&gt;        setSuffix(".uu", "application/octet-stream");&lt;br /&gt;        setSuffix(".exe", "application/octet-stream");&lt;br /&gt;        setSuffix(".ps", "application/postscript");&lt;br /&gt;        setSuffix(".zip", "application/zip");&lt;br /&gt;        setSuffix(".sh", "application/x-shar");&lt;br /&gt;        setSuffix(".tar", "application/x-tar");&lt;br /&gt;        setSuffix(".snd", "audio/basic");&lt;br /&gt;        setSuffix(".au", "audio/basic");&lt;br /&gt;        setSuffix(".wav", "audio/x-wav");&lt;br /&gt;        setSuffix(".gif", "image/gif");&lt;br /&gt;        setSuffix(".jpg", "image/jpeg");&lt;br /&gt;        setSuffix(".jpeg", "image/jpeg");&lt;br /&gt;        setSuffix(".htm", "text/html");&lt;br /&gt;        setSuffix(".html", "text/html");&lt;br /&gt;        setSuffix(".text", "text/plain");&lt;br /&gt;        setSuffix(".c", "text/plain");&lt;br /&gt;        setSuffix(".cc", "text/plain");&lt;br /&gt;        setSuffix(".c++", "text/plain");&lt;br /&gt;        setSuffix(".h", "text/plain");&lt;br /&gt;        setSuffix(".pl", "text/plain");&lt;br /&gt;        setSuffix(".txt", "text/plain");&lt;br /&gt;        setSuffix(".java", "text/plain");&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    void listDirectory(File dir, PrintStream ps) throws IOException {&lt;br /&gt;        ps.println("&amp;lt;TITLE&amp;gt;Directory listing&amp;lt;/TITLE&amp;gt;&amp;lt;P&amp;gt;\n");&lt;br /&gt;        ps.println("&amp;lt;A HREF=\"..\"&amp;gt;Parent Directory&amp;lt;/A&amp;gt;&amp;lt;BR&amp;gt;\n");&lt;br /&gt;        String[] list = dir.list();&lt;br /&gt;        for (int i = 0; list != null &amp;&amp; i &amp;lt; list.length; i++) {&lt;br /&gt;            File f = new File(dir, list[i]);&lt;br /&gt;            if (f.isDirectory()) {&lt;br /&gt;                ps.println("&amp;lt;A HREF=\""+list[i]+"/\"&amp;gt;"+list[i]+"/&amp;lt;/A&amp;gt;&amp;lt;BR&amp;gt;");&lt;br /&gt;            } else {&lt;br /&gt;                ps.println("&amp;lt;A HREF=\""+list[i]+"\"&amp;gt;"+list[i]+"&amp;lt;/A&amp;gt;&amp;lt;BR");&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;        ps.println("&amp;lt;P&amp;gt;&amp;lt;HR&amp;gt;&amp;lt;BR&amp;gt;&amp;lt;I&amp;gt;" + (new Date()) + "&amp;lt;/I&amp;gt;");&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;interface HttpConstants {&lt;br /&gt;    /** 2XX: generally "OK" */&lt;br /&gt;    public static final int HTTP_OK = 200;&lt;br /&gt;    public static final int HTTP_CREATED = 201;&lt;br /&gt;    public static final int HTTP_ACCEPTED = 202;&lt;br /&gt;    public static final int HTTP_NOT_AUTHORITATIVE = 203;&lt;br /&gt;    public static final int HTTP_NO_CONTENT = 204;&lt;br /&gt;    public static final int HTTP_RESET = 205;&lt;br /&gt;    public static final int HTTP_PARTIAL = 206;&lt;br /&gt;&lt;br /&gt;    /** 3XX: relocation/redirect */&lt;br /&gt;    public static final int HTTP_MULT_CHOICE = 300;&lt;br /&gt;    public static final int HTTP_MOVED_PERM = 301;&lt;br /&gt;    public static final int HTTP_MOVED_TEMP = 302;&lt;br /&gt;    public static final int HTTP_SEE_OTHER = 303;&lt;br /&gt;    public static final int HTTP_NOT_MODIFIED = 304;&lt;br /&gt;    public static final int HTTP_USE_PROXY = 305;&lt;br /&gt;&lt;br /&gt;    /** 4XX: client error */&lt;br /&gt;    public static final int HTTP_BAD_REQUEST = 400;&lt;br /&gt;    public static final int HTTP_UNAUTHORIZED = 401;&lt;br /&gt;    public static final int HTTP_PAYMENT_REQUIRED = 402;&lt;br /&gt;    public static final int HTTP_FORBIDDEN = 403;&lt;br /&gt;    public static final int HTTP_NOT_FOUND = 404;&lt;br /&gt;    public static final int HTTP_BAD_METHOD = 405;&lt;br /&gt;    public static final int HTTP_NOT_ACCEPTABLE = 406;&lt;br /&gt;    public static final int HTTP_PROXY_AUTH = 407;&lt;br /&gt;    public static final int HTTP_CLIENT_TIMEOUT = 408;&lt;br /&gt;    public static final int HTTP_CONFLICT = 409;&lt;br /&gt;    public static final int HTTP_GONE = 410;&lt;br /&gt;    public static final int HTTP_LENGTH_REQUIRED = 411;&lt;br /&gt;    public static final int HTTP_PRECON_FAILED = 412;&lt;br /&gt;    public static final int HTTP_ENTITY_TOO_LARGE = 413;&lt;br /&gt;    public static final int HTTP_REQ_TOO_LONG = 414;&lt;br /&gt;    public static final int HTTP_UNSUPPORTED_TYPE = 415;&lt;br /&gt;&lt;br /&gt;    /** 5XX: server error */&lt;br /&gt;    public static final int HTTP_SERVER_ERROR = 500;&lt;br /&gt;    public static final int HTTP_INTERNAL_ERROR = 501;&lt;br /&gt;    public static final int HTTP_BAD_GATEWAY = 502;&lt;br /&gt;    public static final int HTTP_UNAVAILABLE = 503;&lt;br /&gt;    public static final int HTTP_GATEWAY_TIMEOUT = 504;&lt;br /&gt;    public static final int HTTP_VERSION = 505;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Here's how it works: The main thread initializes the server and starts a number of worker threads that will handle client connections. The worker threads simply wait around idle until there's a client to service. The main thread then accepts connections from clients, passes off the connection for a worker thread to handle, and continues accepting new connections.&lt;br /&gt;&lt;br /&gt;In Java, there's a fair amount of overhead associated with initializing threads. So for performance and efficiency reasons, I initialize a pool of worker threads once at startup time, rather than on demand. Because the worker threads are usually in an idle state (Object.wait()), they don't consume much CPU power. (We re-use worker threads over many client connections.)&lt;br /&gt;&lt;br /&gt;The following are my notes on the classes and other code used to implement the server.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;WebServer.loadProps()&lt;/strong&gt; &lt;br /&gt;In this method, I load configuration properties for the server from a file called www-server.properties. This file needs to be in the lib subdirectory relative to JAVA_HOME, which is where the Java interpreter lives on the local disk. If the file doesn't exists, it will take the current folder as a default.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;root&lt;/strong&gt;&lt;br /&gt;This is the local directory where the HTTP server looks for the files it serves. The root directory name is prefixed to the path of all files requested from clients.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;workers&lt;/strong&gt;&lt;br /&gt;This tells the server how many worker threads in the pool of worker threads to start on initialization.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;timeout&lt;/strong&gt;&lt;br /&gt;This describes the time, in milliseconds, that a worker thread should block while reading from a client connection, before it times out and closes a connection. Without this timeout, a worker thread could be tied up indefinitely waiting for a client to issue a request.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;log&lt;/strong&gt;&lt;br /&gt;This is the name of the log file, where the server will record which clients requested which files. If no log is specified, logging is done on standard output.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;WebServer.main()&lt;/strong&gt;&lt;br /&gt;This is where the server initializes itself. It loads properties, initializes a pool of worker threads, binds a ServerSocket to the local port for our HTTP server, then enters a loop. In this loop, it accepts client connections, and passes the connections off to worker threads in the pool.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;class Worker&lt;/strong&gt;&lt;br /&gt;This class implements java.lang.Runnable. It runs in a worker thread to do the actual work of serving files to clients. Memory allocation in java can be a performance hit at runtime. It is best to reuse allocated objects whenever possible. Our worker threads need a buffer (a byte array) to read and write files to clients. We allocate this buffer once in the constructor and reuse it, rather than needlessly re-allocating new buffers.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Worker.run()&lt;/strong&gt;&lt;br /&gt;The worker thread spends most of its time idle, at line 162, in wait(). When a new connection is to be serviced, the wait will wake up, and the worker has at it.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Worker.setSocket()&lt;/strong&gt;&lt;br /&gt;When the main thread has accepted a connection from a client, it finds an idle thread in the worker pool (lines 121-131). It then calls setSocket() on the Worker, which also does a notify() on the Worker. This wakes up the worker thread in wait(), to inform that thread that it's time to work. Note that setSocket() must be synchronized in order to call notify().&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Worker.handleClient()&lt;/strong&gt;&lt;br /&gt;This is the loop where the worker reads the first line of the client's HTTP request. This line is usually of the form GET /foo/bar/baz.html HTTP/1.0. This code shows how to break out of nested loops in java, since java has no goto statement like other languages. What we're trying to find here is the name of the file that the client is requesting (for example, "/foo/bar/baz.html"). There are two nested loops in this code snippet. The outer while() loop is the read loop, and the inner for() loop iterates over the bytes looking for end-of-line characters. The break outerloop statement, though in the inner loop, actually breaks out of the outer loop as well.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;class Worker&lt;/strong&gt;&lt;br /&gt;It is important to always close sockets and files when you're done with them, even if something went wrong. Your Java program, like any program, can have only a finite number of open sockets and files before it can't open any more. So wrap all IO operations in a code segment as following:&lt;br /&gt;&lt;pre class="program"&gt;&lt;br /&gt;try&lt;br /&gt;{ /* open socket or file and do IO */ .... }&lt;br /&gt;  finally {           &lt;br /&gt;  /* cleanup under all exit conditions. */&lt;br /&gt;  /* Our finally clause is guaranteed &lt;br /&gt;   *to be executed */&lt;br /&gt;  /* even if there's a pending exception. */    &lt;br /&gt;  socket.close();&lt;br /&gt;  file.close(); &lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Worker.handleClient()&lt;/strong&gt;&lt;br /&gt;At this point, we're recording the IP address of the client in the server's log, and which file the client requested. The string we're recording is the IP address (that is, "129.144.125.157") of the client, not the hostname (for example, "monkey.eng.sun.com"). We do this for better performance. We do this by calling s.getInetAddress().getHostAddress(), instead of s.getInetAddress().getHostName(). We already know the IP address of the client machine that connected, but we don't know the hostname. If we had asked for the host name at this point, the worker thread might have blocked for a long time while trying to do a reverse DNS look-up out on the Internet. Just recording the IP address in the log is enough. If, at some later point we want to find the hostnames that connected to our server, we can later run a tool over the log file to do this, when time isn't as important.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://java-servlet-jsp-web.blogspot.com/search/label/Java%20programs" title="Other Java programs"&gt;Click here&lt;/a&gt; to check out other programs that I've developed.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7316847079866971282-6332199400682048984?l=java-servlet-jsp-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java-servlet-jsp-web.blogspot.com/feeds/6332199400682048984/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/06/simple-multithreaded-web-server-java.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/6332199400682048984'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/6332199400682048984'/><link rel='alternate' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/06/simple-multithreaded-web-server-java.html' title='A Simple Multithreaded Web Server - Java simple HTTP server'/><author><name>Santhosh Reddy</name><uri>http://www.blogger.com/profile/05232963292855488994</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_P0JbJW7kyKo/ShZkH-FOe4I/AAAAAAAAHP0/ogsB2X0vAMU/S220/IMG_0305.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7316847079866971282.post-7167768643041957356</id><published>2009-06-17T19:53:00.006+05:30</published><updated>2009-06-17T20:23:55.755+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java programs'/><title type='text'>Java perfect image resizer program - 2 (Image resize program)</title><content type='html'>Hi guys.. As I told you in my previous image resize post, here is the latest program for creating the thumbnails of different sized with out any image distortion and lack of quality. Keep that in mind that the image with less quality will not be achieved with the quality. Quality source gives the quality thumbnail.&lt;br /&gt;&lt;br /&gt;I've written this based on the existing programs and methods. This has been tested on Java 1.4 and 1.5 versions.&lt;br /&gt;&lt;br /&gt;Just include the below class into your disk so that you can use this component in web programming like Servlets, Struts, Springs, JSPs or desktop programs.&lt;br /&gt;&lt;br /&gt;If you've any issues email me @ &lt;a href="mailto:doubtsplz@gmail.com"&gt;doubtsplz@gmail.com&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;AmazingImageResizer.java&lt;/strong&gt;&lt;br /&gt;&lt;pre class="program"&gt;&lt;br /&gt;import java.awt.Graphics2D;&lt;br /&gt;import java.awt.GraphicsConfiguration;&lt;br /&gt;import java.awt.GraphicsEnvironment;&lt;br /&gt;import java.awt.RenderingHints;&lt;br /&gt;import java.awt.Transparency;&lt;br /&gt;import java.awt.image.BufferedImage;&lt;br /&gt;import java.io.File;&lt;br /&gt;import java.io.FileOutputStream;&lt;br /&gt;import java.util.HashMap;&lt;br /&gt;import java.util.Map;&lt;br /&gt;import javax.imageio.ImageIO;&lt;br /&gt;&lt;br /&gt;/**&lt;br /&gt; * Perfect image resizer which will give good quality&lt;br /&gt; * @author SANTHOSH REDDY MANDADI&lt;br /&gt; * @version 1.0&lt;br /&gt; * @since 16th June 2009&lt;br /&gt; */&lt;br /&gt;&lt;br /&gt;public class AmazingImageResizer &lt;br /&gt;{&lt;br /&gt; /**&lt;br /&gt;  * A static method to create the thumbnail of the mentioned sizes&lt;br /&gt;  * @author SANTHOSH REDDY MANDADI&lt;br /&gt;  * @param sourceFile represents the original file from where the thumbanil to be created&lt;br /&gt;  * @param destFile represents the output file path to store the thumbnail&lt;br /&gt;  * @param newWidth represents the width&lt;br /&gt;  * @param newHeight represents the height&lt;br /&gt;  * @since 16th June 2009&lt;br /&gt;  */&lt;br /&gt; public static void createThumbnail(String sourceFile, String destFile,int newWidth, int newHeight) throws Exception&lt;br /&gt; {&lt;br /&gt;  BufferedImage image=ImageIO.read(new File(sourceFile));&lt;br /&gt;  int width = image.getWidth();&lt;br /&gt;  int height = image.getHeight();&lt;br /&gt;&lt;br /&gt;  boolean isTranslucent = image.getType() != Transparency.OPAQUE;&lt;br /&gt;  &lt;br /&gt;  if (newWidth &gt;= width || newHeight &gt;= height) &lt;br /&gt;  {&lt;br /&gt;   throw new IllegalArgumentException("newWidth and newHeight cannot be greater than the image dimensions");&lt;br /&gt;  }&lt;br /&gt;  else if (newWidth &lt;= 0 || newHeight &lt;= 0) &lt;br /&gt;  {&lt;br /&gt;   throw new IllegalArgumentException("newWidth and newHeight must be greater than 0");&lt;br /&gt;  }&lt;br /&gt;  &lt;br /&gt;  BufferedImage thumb = image;&lt;br /&gt;  BufferedImage temp = null;&lt;br /&gt;  Graphics2D g2 = null;&lt;br /&gt;  Map map = new HashMap();&lt;br /&gt;  map.put(RenderingHints.KEY_INTERPOLATION,RenderingHints.VALUE_INTERPOLATION_BILINEAR);&lt;br /&gt;  map.put(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);&lt;br /&gt;  map.put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);&lt;br /&gt;  try &lt;br /&gt;  {&lt;br /&gt;   int previousWidth = width;&lt;br /&gt;   int previousHeight = height;&lt;br /&gt;   do &lt;br /&gt;   {&lt;br /&gt;    if (width &gt; newWidth)&lt;br /&gt;    {&lt;br /&gt;     width /= 2;&lt;br /&gt;     if (width &lt; newWidth) &lt;br /&gt;     {&lt;br /&gt;      width = newWidth;&lt;br /&gt;     }&lt;br /&gt;    }&lt;br /&gt;    if (height &gt; newHeight) &lt;br /&gt;    {&lt;br /&gt;     height /= 2;&lt;br /&gt;     if (height &lt; newHeight) &lt;br /&gt;     {&lt;br /&gt;      height = newHeight;&lt;br /&gt;     }&lt;br /&gt;    }&lt;br /&gt;    if (temp == null || isTranslucent) &lt;br /&gt;    {&lt;br /&gt;     if (g2 != null) &lt;br /&gt;     {&lt;br /&gt;       //do not need to wrap with finally&lt;br /&gt;       //outer finally block will ensure&lt;br /&gt;       //that resources are properly reclaimed&lt;br /&gt;       g2.dispose();&lt;br /&gt;     }&lt;br /&gt;     temp = createCompatibleImage(image, width, height);&lt;br /&gt;     g2 = temp.createGraphics();&lt;br /&gt;     g2.setRenderingHints(map);&lt;br /&gt;     //g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION,RenderingHints.VALUE_INTERPOLATION_BILINEAR);&lt;br /&gt;    }&lt;br /&gt;    g2.drawImage(thumb, 0, 0, width, height,0, 0, previousWidth, previousHeight, null);&lt;br /&gt;    previousWidth = width;&lt;br /&gt;    previousHeight = height;&lt;br /&gt;    thumb = temp;&lt;br /&gt;   } while (width != newWidth || height != newHeight);&lt;br /&gt;  } finally &lt;br /&gt;  {&lt;br /&gt;   g2.dispose();&lt;br /&gt;  }&lt;br /&gt;  if (width != thumb.getWidth() || height != thumb.getHeight()) &lt;br /&gt;  {&lt;br /&gt;   temp = createCompatibleImage(image, width, height);&lt;br /&gt;   g2 = temp.createGraphics();&lt;br /&gt;   try &lt;br /&gt;   {&lt;br /&gt;     g2.setRenderingHints(map);&lt;br /&gt;    g2.drawImage(thumb, 0, 0, width, height, 0, 0, width, height, null);&lt;br /&gt;   } &lt;br /&gt;   finally &lt;br /&gt;   {&lt;br /&gt;    g2.dispose();&lt;br /&gt;   }&lt;br /&gt;   thumb = temp;&lt;br /&gt;  }&lt;br /&gt;  ImageIO.write(thumb, destFile.substring(destFile.lastIndexOf('.')+1), new FileOutputStream(destFile));&lt;br /&gt; }&lt;br /&gt; public static BufferedImage createCompatibleImage(BufferedImage image,int width, int height) &lt;br /&gt; {&lt;br /&gt;  return isHeadless()?new BufferedImage(width, height, image.getType()):getGraphicsConfiguration().createCompatibleImage(width, height);&lt;br /&gt; }&lt;br /&gt; // Returns the graphics configuration for the primary screen&lt;br /&gt; private static GraphicsConfiguration getGraphicsConfiguration() &lt;br /&gt; {&lt;br /&gt;  return GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration();&lt;br /&gt; }&lt;br /&gt; private static boolean isHeadless()&lt;br /&gt; {&lt;br /&gt;  return GraphicsEnvironment.isHeadless();&lt;br /&gt; }&lt;br /&gt; public static void main(String[] args)  throws Exception&lt;br /&gt; {&lt;br /&gt;  //Fetch the image height and width (I'm hardcoding them here, if you don't know how to get look at creatThumbnail method)&lt;br /&gt;  BufferedImage image=ImageIO.read(new File("Water.jpg"));&lt;br /&gt;  int imgWidth = image.getWidth();&lt;br /&gt;  int imgHeight = image.getHeight();&lt;br /&gt;  //Original size of the image is &lt;br /&gt;  int newWidth=200;&lt;br /&gt;  //Calculating the percentage of image width going to be reduced&lt;br /&gt;  double imgHeightPercentage= (newWidth/(double)imgWidth)*100;&lt;br /&gt;  //Calculating the height based on the above percentage&lt;br /&gt;  double imgTotalHeight=imgHeight*(imgHeightPercentage/100);&lt;br /&gt;  int newHeight=(int)Math.round(imgTotalHeight);&lt;br /&gt;  AmazingImageResizer.createThumbnail("Water.jpg", "aWater.jpg", newWidth, newHeight);&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;If you're not satisfied with the quality, try with my old logic, which you can find @ &lt;a href="http://java-servlet-jsp-web.blogspot.com/2009/05/java-perfect-image-resizer-program.html"&gt;Perfect image resizer&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;I got very good quality either one of these logics. But current logic is always best to choose.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://java-servlet-jsp-web.blogspot.com/search/label/Java%20programs" title="Other Java programs"&gt;Click here&lt;/a&gt; to check out other programs that I've developed.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7316847079866971282-7167768643041957356?l=java-servlet-jsp-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java-servlet-jsp-web.blogspot.com/feeds/7167768643041957356/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/06/java-perfect-image-resizer-program-2.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/7167768643041957356'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/7167768643041957356'/><link rel='alternate' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/06/java-perfect-image-resizer-program-2.html' title='Java perfect image resizer program - 2 (Image resize program)'/><author><name>Santhosh Reddy</name><uri>http://www.blogger.com/profile/05232963292855488994</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_P0JbJW7kyKo/ShZkH-FOe4I/AAAAAAAAHP0/ogsB2X0vAMU/S220/IMG_0305.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7316847079866971282.post-2337161069284614014</id><published>2009-06-13T02:35:00.006+05:30</published><updated>2009-06-13T03:11:15.119+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='HTTP'/><title type='text'>HTTP status codes</title><content type='html'>As we've discussed in previous posts, HTTP response initial request line will always have one status code. Here is the explaination on HTTP status codes.&lt;br /&gt;&lt;br /&gt;When a request is made to your server for a page on your site (for instance, when a user accesses your page in a browser or when Googlebot crawls the page), your server returns an HTTP status code in response to the request.&lt;br /&gt;&lt;br /&gt;This status code provides information about the status of the request. This status code gives Googlebot information about your site and the requested page.&lt;br /&gt;&lt;br /&gt;Some common status codes are:&lt;br /&gt;* 200 - the server successfully returned the page&lt;br /&gt;* 404 - the requested page doesn't exist&lt;br /&gt;* 503 - the server is temporarily unavailable&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;1xx&lt;/strong&gt;&lt;strong&gt; (Provisional response) &lt;/strong&gt; &lt;br /&gt;Status codes that indicate a provisional response and require the requestor to take action to continue.&lt;br /&gt;&lt;table caption="1xx HTTP status codes" summary="1xx status codes indicating a provisional response" border="1" cellspacing="1" cellpadding="1" style="padding: 0px 0px 0px 0px"&gt;&lt;tr&gt; &lt;th scope="col"&gt;Code&lt;/th&gt; &lt;th scope="col"&gt;Description&lt;/th&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;100 (Continue)&lt;/td&gt; &lt;td&gt;The requestor should continue with the request. The server returns this code to indicate that it has received the first part of a request and is waiting for the rest. &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;101 (Switching protocols)&lt;/td&gt; &lt;td&gt;The requestor has asked the server to switch protocols and the server is acknowledging that it will do so.&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;strong&gt;2xx&lt;/strong&gt; &lt;strong&gt;(Successful)&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;Status codes that indicate that the server successfully processed the request.&lt;/p&gt; &lt;table caption="2xx HTTP status codes" summary="2xx status codes indicating successful requests" border="1" cellspacing="1" cellpadding="1"&gt; &lt;tr&gt; &lt;th scope="col"&gt;Code&lt;/th&gt; &lt;th scope="col"&gt;Description&lt;/th&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt; 200 (Successful) &lt;/td&gt; &lt;td&gt;The server successfully processed the request. Generally, this means that the server provided the requested page. If you see this status for your robots.txt file, it means that Googlebot retrieved it successfully.&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt; 201 (Created) &lt;/td&gt; &lt;td&gt; The request was successful and the server created a new resource.&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt; 202 (Accepted) &lt;/td&gt; &lt;td&gt; The server has accepted the request, but hasn't yet processed it.&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt; 203 (Non-authoritative information) &lt;/td&gt; &lt;td&gt; The server successfully processed the request, but is returning information that may be from another source.&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt; 204 (No content) &lt;/td&gt; &lt;td&gt; The server successfully processed the request, but isn't returning any content.&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt; 205 (Reset content)&lt;/td&gt; &lt;td&gt;The server successfully proccessed the request, but isn't returning any content. Unlike a 204 response, this response requires that the requestor reset the document view (for instance, clear a form for new input).&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt; 206 (Partial content) &lt;/td&gt; &lt;td&gt; The server successfully processed a partial GET request.&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;strong&gt;3xx&lt;/strong&gt; &lt;strong&gt;(Redirected)&lt;/strong&gt; &lt;br&gt; Further action is needed to fulfill the request. Often, these status codes are used for redirection. Google recommends that you use fewer than five redirects for each request.&lt;/p&gt; &lt;table caption="3xx HTTP status codes" summary="3xx status codes requiring further action" border="1" cellspacing="1" cellpadding="1"&gt; &lt;tr&gt; &lt;th scope="col"&gt;Code&lt;/th&gt; &lt;th scope="col"&gt;Description&lt;/th&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt; 300 (Multiple choices) &lt;/td&gt; &lt;td&gt;The server has several actions available based on the request. The server may choose an action based on the requestor (user agent) or the server may present a list so the requestor can choose an action.&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;301 (Moved permanently) &lt;/td&gt; &lt;td&gt;The requested page has been permanently moved to a new location. When the server returns this response (as a response to a GET or HEAD request), it automatically forwards the requestor to the new location. You should use this code to let Googlebot know that a page or site has permanently moved to a new location.&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt; 302 (Moved temporarily)&lt;/td&gt; &lt;td&gt;The server is currently responding to the request with a page from a different location, but the requestor should continue to use the original location for future requests. This code is similar to a 301 in that for a GET or HEAD request, it automatically forwards the requestor to a different location, but you shouldn't use it to tell the Googlebot that a page or site has moved because Googlebot will continue to crawl and index the original location.&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt; 303 (See other location)&lt;/td&gt; &lt;td&gt;The server returns this code when the requestor should make a separate GET request to a different location to retrieve the response. For all requests other than a HEAD request, the server automatically forwards to the other location.&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt; 304 (Not modified)&lt;/td&gt; &lt;td&gt;&lt;p&gt;The requested page hasn't been modified since the last request. When the server returns this response, it doesn't return the contents of the page. &lt;/p&gt; &lt;p&gt;You should configure your server to return this response (called the If-Modified-Since HTTP header) when a page hasn't changed since the last time the requestor asked for it. This saves you bandwidth and overhead because your server can tell Googlebot that a page hasn't changed since the last time it was crawled&lt;/p&gt; .&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt; 305 (Use proxy)&lt;/td&gt; &lt;td&gt;The requestor can only access the requested page using a proxy. When the server returns this response, it also indicates the proxy that the requestor should use.&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;307 (Temporary redirect) &lt;/td&gt; &lt;td&gt;The server is currently responding to the request with a page from a different location, but the requestor should continue to use the original location for future requests. This code is similar to a 301 in that for a GET or HEAD request, it automatically forwards the requestor to a different location, but you shouldn't use it to tell the Googlebot that a page or site has moved because Googlebot will continue to crawl and index the original location.&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;strong&gt;4xx (Request error)&lt;/strong&gt; &lt;br&gt; These status codes indicate that there was likely an error in the request which prevented the server from being able to process it.&lt;/p&gt; &lt;table caption="4xx HTTP status codes" summary="4xx status codes indicating that the server could not process the request" border="1" cellspacing="1" cellpadding="1"&gt; &lt;tr&gt; &lt;th scope="col"&gt;Code&lt;/th&gt; &lt;th scope="col"&gt;Description&lt;/th&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt; 400 (Bad request)&lt;/td&gt; &lt;td&gt; The server didn't understand the syntax of the request.&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt; 401 (Not authorized)&lt;/td&gt; &lt;td&gt; The request requires authentication. The server might return this response for a page behind a login.&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt; 403 (Forbidden)&lt;/td&gt; &lt;td&gt;The server is refusing the request. If you see that Googlebot received this status code when trying to crawl valid pages of your site (you can see this on the &lt;strong&gt;Web crawl&lt;/strong&gt; page under &lt;strong&gt;Diagnostics&lt;/strong&gt; in Google Webmaster Tools), it's possible that your server or host is blocking Googlebot's access.&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt; 404 (Not found)&lt;/td&gt; &lt;td&gt;&lt;p&gt;The server can't find the requested page. For instance, the server often returns this code if the request is for a page that doesn't exist on the server. &lt;/p&gt; &lt;p&gt;However, if you do have a robots.txt file and you see this status, then your robots.txt file may be named incorrectly or in the wrong location. (It should be at the top-level of the domain and named robots.txt.)&lt;/p&gt; &lt;p&gt;If you see this status for URLs that Googlebot tried to crawl (on the HTTP errors page of the Diagnostic tab), then Googlebot likely followed an invalid link from another page (either an old link or a mistyped one). &lt;/p&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;405 (Method not allowed)&lt;/td&gt; &lt;td&gt; The method specified in the request is not allowed.&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt; 406 (Not acceptable)&lt;/td&gt; &lt;td&gt; The requested page can't respond with the content characteristics requested.&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt; 407 (Proxy authentication required)&lt;/td&gt; &lt;td&gt;This status code is similar 401 (Not authorized); but specifies that the requestor has to authenticate using a proxy. When the server returns this response, it also indicates the proxy that the requestor should use. &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt; 408 (Request timeout) &lt;/td&gt; &lt;td&gt; The server timed out waiting for the request.&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt; 409 (Conflict) &lt;/td&gt; &lt;td&gt;The server encountered a conflict fulfilling the request. The server must include information about the conflict in the response. The server might return this code in response to a PUT request that conflicts with an earlier request, along with a list of differences between the requests.&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;410 (Gone) &lt;/td&gt; &lt;td&gt;The server returns this response when the requested resource has been permanently removed. It is similar to a 404 (Not found) code, but is sometimes used in the place of a 404 for resources that used to exist but no longer do. If the resource has permanently moved, you should use a 301 to specify the resource's new location.&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt; 411 (Length required)&lt;/td&gt; &lt;td&gt;The server won't accept the request without a valid Content-Length header field.&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt; 412 (Precondition failed)&lt;/td&gt; &lt;td&gt; The server doesn't meet one of the preconditions that the requestor put on the request.&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt; 413 (Request entity too large)&lt;/td&gt; &lt;td&gt; The server can't process the request because it is too large for the server to handle.&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt; 414 (Requested URI is too long)&lt;/td&gt; &lt;td&gt; The requested URI (typically, a URL) is too long for the server to process.&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt; 415 (Unsupported media type)&lt;/td&gt; &lt;td&gt; The request is in a format not support by the requested page.&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt; 416 (Requested range not satisfiable)&lt;/td&gt; &lt;td&gt; The server returns this status code if the request is for a range not available for the page.&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt; 417 (Expectation failed)&lt;/td&gt; &lt;td&gt; The server can't meet the requirements of the Expect request-header field.&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;strong&gt;5xx&lt;/strong&gt;&lt;strong&gt; (Server error) &lt;/strong&gt;&lt;br&gt; These status codes indicate that the server had an internal error when trying to process the request. These errors tend to be with the server itself, not with the request.&lt;/p&gt; &lt;table caption="5xx HTTP status codes" summary="5xx status codes indicating that the server had an internal error" border="1" cellspacing="1" cellpadding="1"&gt; &lt;tr&gt; &lt;th scope="col"&gt;Code&lt;/th&gt; &lt;th scope="col"&gt;Description&lt;/th&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt; 500 (Internal server error) &lt;/td&gt; &lt;td&gt; The server encountered an error and can't fulfill the request.&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt; 501 (Not implemented)&lt;/td&gt; &lt;td&gt;The server doesn't have the functionality to fulfill the request. For instance, the server might return this code when it doesn't recognize the request method.&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt; 502 (Bad gateway)&lt;/td&gt; &lt;td&gt; The server was acting as a gateway or proxy and received an invalid response from the upstream server.&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt; 503 (Service unavailable)&lt;/td&gt; &lt;td&gt; The server is currently unavailable (because it is overloaded or down for maintenance). Generally, this is a temporary state.&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt; 504 (Gateway timeout) &lt;/td&gt; &lt;td&gt; The server was acting as a gateway or proxy and didn't receive a timely request from the upstream server.&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt; 505 (HTTP version not supported)&lt;/td&gt; &lt;td&gt; The server doesn't support the HTTP protocol version used in the request.&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7316847079866971282-2337161069284614014?l=java-servlet-jsp-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java-servlet-jsp-web.blogspot.com/feeds/2337161069284614014/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/06/http-status-codes.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/2337161069284614014'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/2337161069284614014'/><link rel='alternate' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/06/http-status-codes.html' title='HTTP status codes'/><author><name>Santhosh Reddy</name><uri>http://www.blogger.com/profile/05232963292855488994</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_P0JbJW7kyKo/ShZkH-FOe4I/AAAAAAAAHP0/ogsB2X0vAMU/S220/IMG_0305.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7316847079866971282.post-3496678863371935224</id><published>2009-06-13T01:49:00.004+05:30</published><updated>2009-06-13T02:17:25.331+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='HTTP'/><title type='text'>HTTP methods - a deep look</title><content type='html'>I'm going to discuss about the set of common methods for HTTP/1.1. Although this set can be expanded, additional methods cannot be assumed to share the same semantics for separately extended clients and servers.&lt;br /&gt;&lt;br /&gt;The Host request-header field MUST accompany all HTTP/1.1 requests.&lt;br /&gt;&lt;br /&gt;HTTP defines eight methods indicating the desired action to be performed on the identified resource. What this resource represents, whether pre-existing data or data that is generated dynamically, depends on the implementation of the server. Often, the resource corresponds to a file or the output of an executable residing on the server.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;1. GET&lt;/strong&gt;&lt;br /&gt;This is the most common HTTP method that will be used more on the web.&lt;br /&gt;&lt;br /&gt;The GET method means retrieve whatever information (in the form of an entity) is identified by the Request-URI. If the Request-URI refers to a data-producing process, it is the produced data which shall be returned as the entity in the response and not the source text of the process, unless that text happens to be the output of the process.&lt;br /&gt;&lt;br /&gt;The semantics of the GET method change to a "conditional GET" if the request message includes an If-Modified-Since, If-Unmodified-Since, If-Match, If-None-Match, or If-Range header field. A conditional GET method requests that the entity be transferred only under the circumstances described by the conditional header field(s). The conditional GET method is intended to reduce unnecessary network usage by allowing cached entities to be refreshed without requiring multiple requests or transferring data already held by the client.&lt;br /&gt;&lt;br /&gt;The semantics of the GET method change to a "partial GET" if the request message includes a Range header field. A partial GET requests that only part of the entity be transferred. The partial GET method is intended to reduce unnecessary network usage by allowing partially-retrieved entities to be completed without transferring data already held by the client.&lt;br /&gt;&lt;br /&gt;The response to a GET request is cacheable if and only if it meets the requirements for HTTP caching&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;2. HEAD&lt;/strong&gt;&lt;br /&gt;Asks for the response identical to the one that would correspond to a GET request, but without the response body. This is useful for retrieving meta-information written in response headers, without having to transport the entire content.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;3. POST&lt;/strong&gt;&lt;br /&gt;Submits data to be processed (e.g., from an HTML form) to the identified resource. The data is included in the body of the request. This may result in the creation of a new resource or the updates of existing resources or both.&lt;br /&gt;&lt;br /&gt;The POST method is used to request that the origin server accept the entity enclosed in the request as a new subordinate of the resource identified by the Request-URI in the Request-Line. POST is designed to allow a uniform method to cover the following functions:&lt;br /&gt;&lt;br /&gt;      - Annotation of existing resources;&lt;br /&gt;      - Posting a message to a bulletin board, newsgroup, mailing list, or similar group of articles;&lt;br /&gt;      - Providing a block of data, such as the result of submitting a form, to a data-handling process;&lt;br /&gt;      - Extending a database through an append operation.&lt;br /&gt;&lt;br /&gt;The actual function performed by the POST method is determined by the server and is usually dependent on the Request-URI. The posted entity is subordinate to that URI in the same way that a file is subordinate to a directory containing it, a news article is subordinate to a newsgroup to which it is posted, or a record is subordinate to a database.&lt;br /&gt;&lt;br /&gt;The action performed by the POST method might not result in a resource that can be identified by a URI. In this case, either 200 (OK) or 204 (No Content) is the appropriate response status, depending on whether or not the response includes an entity that describes the result.&lt;br /&gt;&lt;br /&gt;If a resource has been created on the origin server, the response SHOULD be 201 (Created) and contain an entity which describes the status of the request and refers to the new resource, and a Location header&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;4. PUT&lt;/strong&gt;&lt;br /&gt;The PUT method requests that the enclosed entity be stored under the supplied Request-URI. If the Request-URI refers to an already existing resource, the enclosed entity SHOULD be considered as a modified version of the one residing on the origin server. If the Request-URI does not point to an existing resource, and that URI is capable of being defined as a new resource by the requesting user agent, the origin server can create the resource with that URI. If a new resource is created, the origin server MUST inform the user agent via the 201 (Created) response. If an existing resource is modified, either the 200 (OK) or 204 (No Content) response codes SHOULD be sent to indicate successful completion of the request. If the resource could not be created or modified with the Request-URI, an appropriate error response SHOULD be given that reflects the nature of the problem. The recipient of the entity MUST NOT ignore any Content-* (e.g. Content-Range) headers that it does not understand or implement and MUST return a 501 (Not Implemented) response in such cases.&lt;br /&gt;&lt;br /&gt;If the request passes through a cache and the Request-URI identifies one or more currently cached entities, those entries SHOULD be treated as stale. Responses to this method are not cacheable.&lt;br /&gt;&lt;br /&gt;The fundamental difference between the POST and PUT requests is reflected in the different meaning of the Request-URI. The URI in a POST request identifies the resource that will handle the enclosed entity. That resource might be a data-accepting process, a gateway to some other protocol, or a separate entity that accepts annotations. In contrast, the URI in a PUT request identifies the entity enclosed with the request -- the user agent knows what URI is intended and the server MUST NOT attempt to apply the request to some other resource. If the server desires that the request be applied to a different URI,&lt;br /&gt;&lt;br /&gt;it MUST send a 301 (Moved Permanently) response; the user agent MAY then make its own decision regarding whether or not to redirect the request.&lt;br /&gt;&lt;br /&gt;A single resource MAY be identified by many different URIs. For example, an article might have a URI for identifying "the current version" which is separate from the URI identifying each particular version. In this case, a PUT request on a general URI might result in several other URIs being defined by the origin server.&lt;br /&gt;&lt;br /&gt;HTTP/1.1 does not define how a PUT method affects the state of an origin server.&lt;br /&gt;&lt;br /&gt;PUT requests MUST obey the message transmission requirements.&lt;br /&gt;&lt;br /&gt;Unless otherwise specified for a particular entity-header, the entity-headers in the PUT request SHOULD be applied to the resource created or modified by the PUT.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;5. DELETE&lt;/strong&gt;&lt;br /&gt;The DELETE method requests that the origin server delete the resource identified by the Request-URI. This method MAY be overridden by human intervention (or other means) on the origin server. The client cannot be guaranteed that the operation has been carried out, even if the status code returned from the origin server indicates that the action has been completed successfully. However, the server SHOULD NOT indicate success unless, at the time the response is given, it intends to delete the resource or move it to an inaccessible location.&lt;br /&gt;&lt;br /&gt;A successful response SHOULD be 200 (OK) if the response includes an entity describing the status, 202 (Accepted) if the action has not yet been enacted, or 204 (No Content) if the action has been enacted but the response does not include an entity.&lt;br /&gt;&lt;br /&gt;If the request passes through a cache and the Request-URI identifies one or more currently cached entities, those entries SHOULD be treated as stale. Responses to this method are not cacheable.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;6. TRACE&lt;/strong&gt;&lt;br /&gt;Echoes back the received request, so that a client can see what intermediate servers are adding or changing in the request.&lt;br /&gt;&lt;br /&gt;TRACE allows the client to see what is being received at the other end of the request chain and use that data for testing or diagnostic information. The value of the Via header field is of particular interest, since it acts as a trace of the request chain. Use of the Max-Forwards header field allows the client to limit the length of the request chain, which is useful for testing a chain of proxies forwarding messages in an infinite loop.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;7. OPTIONS&lt;/strong&gt;&lt;br /&gt;Returns the HTTP methods that the server supports for specified URL. This can be used to check the functionality of a web server by requesting '*' instead of a specific resource.&lt;br /&gt;&lt;br /&gt;The OPTIONS method represents a request for information about the communication options available on the request/response chain identified by the Request-URI. This method allows the client to determine the options and/or requirements associated with a resource, or the capabilities of a server, without implying a resource action or initiating a resource retrieval.&lt;br /&gt;&lt;br /&gt;Responses to this method are not cacheable.&lt;br /&gt;&lt;br /&gt;If the OPTIONS request includes an entity-body (as indicated by the presence of Content-Length or Transfer-Encoding), then the media type MUST be indicated by a Content-Type field. Although this specification does not define any use for such a body, future extensions to HTTP might use the OPTIONS body to make more detailed queries on the server. A server that does not support such an extension MAY discard the request body.&lt;br /&gt;&lt;br /&gt;If the Request-URI is an asterisk ("*"), the OPTIONS request is intended to apply to the server in general rather than to a specific resource. Since a server's communication options typically depend on the resource, the "*" request is only useful as a "ping" or "no-op" type of method; it does nothing beyond allowing the client to test the capabilities of the server. For example, this can be used to test a proxy for HTTP/1.1 compliance (or lack thereof).&lt;br /&gt;&lt;br /&gt;If the Request-URI is not an asterisk, the OPTIONS request applies only to the options that are available when communicating with that resource.&lt;br /&gt;&lt;br /&gt;A 200 response SHOULD include any header fields that indicate optional features implemented by the server and applicable to that resource (e.g., Allow), possibly including extensions not defined by this specification. The response body, if any, SHOULD also include information about the communication options. The format for such a&lt;br /&gt;&lt;br /&gt;body is not defined by this specification, but might be defined by future extensions to HTTP. Content negotiation MAY be used to select the appropriate response format. If no response body is included, the response MUST include a Content-Length field with a field-value of "0".&lt;br /&gt;&lt;br /&gt;The Max-Forwards request-header field MAY be used to target a specific proxy in the request chain. When a proxy receives an OPTIONS request on an absoluteURI for which request forwarding is permitted, the proxy MUST check for a Max-Forwards field. If the Max-Forwards field-value is zero ("0"), the proxy MUST NOT forward the message; instead, the proxy SHOULD respond with its own communication options. If the Max-Forwards field-value is an integer greater than zero, the proxy MUST decrement the field-value when it forwards the request. If no Max-Forwards field is present in the request, then the forwarded request MUST NOT include a Max-Forwards field.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;8. CONNECT&lt;/strong&gt;&lt;br /&gt;Converts the request connection to a transparent TCP/IP tunnel, usually to facilitate SSL-encrypted communication (HTTPS) through an unencrypted HTTP proxy. HTTP servers are required to implement at least the GET and HEAD methods and, whenever possible, also the OPTIONS method.&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;Safe methods and Idempotent methods&lt;/h2&gt;&lt;br /&gt;Some of the above methods are safe to use but some of them are not.&lt;br /&gt;&lt;strong&gt;Safe methods&lt;/strong&gt;&lt;br /&gt;Some methods (for example, HEAD, GET, OPTIONS and TRACE) are defined as safe, which means they are intended only for information retrieval and should not change the state of the server. In other words, they should not have side effects, beyond relatively harmless effects such as logging, caching, the serving of banner advertisements or incrementing a web counter. Making arbitrary GET requests without regard to the context of the application's state should therefore be considered safe.&lt;br /&gt;By contrast, methods such as POST, PUT and DELETE are intended for actions which may cause side effects either on the server, or external side effects such as financial transactions or transmission of email. Such methods are therefore not usually used by conforming web robots or web crawlers, which tend to make requests without regard to context or consequences.&lt;br /&gt;&lt;br /&gt;Despite the prescribed safety of GET requests, in practice their handling by the server is not technically limited in any way, and careless or deliberate programming can just as easily (or more easily, due to lack of user agent precautions) cause non-trivial changes on the server. This is discouraged, because it can cause problems for Web caching, search engines and other automated agents, which can make unintended changes on the server.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Idempotent methods and web applications&lt;/strong&gt;&lt;br /&gt;Methods PUT and DELETE are defined to be idempotent, meaning that multiple identical requests should have the same effect as a single request. Methods GET, HEAD, OPTIONS and TRACE, being prescribed as safe, should also be idempotent, as HTTP is a stateless protocol.&lt;br /&gt;By contrast, the POST method is not necessarily idempotent, and therefore sending an identical POST request multiple times may further affect state or cause further side effects (such as financial transactions). In some cases this may be desirable, but in other cases this could be due to an accident, such as when a user does not realize that their action will result in sending another request, or they did not receive adequate feedback that their first request was successful. While web browsers may show alert dialog boxes to warn users in some cases where reloading a page may re-submit a POST request, it is generally up to the web application to handle cases where a POST request should not be submitted more than once.&lt;br /&gt;&lt;br /&gt;Note that whether a method is idempotent is not enforced by the protocol or web server. It is perfectly possible to write a web application in which (for example) a database insert or other non-idempotent action is triggered by a GET or other request. Ignoring this recommendation, however, may result in undesirable consequences if a user agent assumes that repeating the same request is safe when it isn't.&lt;br /&gt;&lt;br /&gt;If you want to learn more on HTTP protocol, &lt;a href="http://java-servlet-jsp-web.blogspot.com/2009/06/http-protocol-detailed-view.html" title="Http protocol"&gt;click here&lt;/a&gt; to read more.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7316847079866971282-3496678863371935224?l=java-servlet-jsp-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java-servlet-jsp-web.blogspot.com/feeds/3496678863371935224/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/06/http-methods-deep-look.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/3496678863371935224'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/3496678863371935224'/><link rel='alternate' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/06/http-methods-deep-look.html' title='HTTP methods - a deep look'/><author><name>Santhosh Reddy</name><uri>http://www.blogger.com/profile/05232963292855488994</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_P0JbJW7kyKo/ShZkH-FOe4I/AAAAAAAAHP0/ogsB2X0vAMU/S220/IMG_0305.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7316847079866971282.post-2673211990161094671</id><published>2009-06-12T19:42:00.004+05:30</published><updated>2009-06-13T02:23:43.113+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='HTTP'/><title type='text'>HTTP protocol - detailed view</title><content type='html'>Hello... If you're not really familiar with HTTP protocol, this post is for you. Most of us doesn't really know the concepts of HTTP. Of course we no need to know the concepts in order use the technologies.&lt;br /&gt;&lt;br /&gt;In the current world, internet is became a very big media i.e.; net users are growing day by day. Most popular protocol that will be used by internet applications is HTTP. Here I'm going to explain you about this in depth.&lt;br /&gt;&lt;br /&gt;As you know a protocol is a set of rules that needs to be followed by two computers while communicating each other on the network. &lt;br /&gt;&lt;br /&gt;&lt;h2&gt;HTTP protocol rules&lt;/h2&gt;&lt;br /&gt;1. Client has to establish the connection with the server.&lt;br /&gt;2. Server has to wait for client's request and ready to serve for client's request.&lt;br /&gt;3. On receiving the client request, server has to process the client request and send the response to client.&lt;br /&gt;4. Client has to receive the response.&lt;br /&gt;&lt;br /&gt;Any server application which follows the above rules, called as web server. Examples: Tomcat, Weblogic, Microsoft IIS etc.&lt;br /&gt;&lt;br /&gt;Any client application which follows the above rules, called as web client or user-agent or browser. Examples: Internet explorer, Mozilla Firefox, and Google chrome, etc.&lt;br /&gt;&lt;br /&gt;In the above paragraph, we've discussed about the request and response. Now our next question is what is request? and what is response?&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;HTTP request&lt;/h2&gt;&lt;br /&gt;A request is a data that will be sent by the client to perform an action from the server. Simply, its a collection of bytes which will be sent to the server to establish the connection.&lt;br /&gt;&lt;br /&gt;HTTP is a standard and as per the HTTP specification, HTTP request should follow a structure.&lt;br /&gt;&lt;strong&gt;HTTP request structure&lt;/strong&gt;&lt;br /&gt;Each HTTP request has multiple lines, where each line should be separated by a carriage return followed by new line (\r\n). First line called, Initial Request Line, contains the HTTP method followed by the resource address (URL) followed by HTTP version.&lt;br /&gt;Eg: &lt;span title="HTTP method"&gt;GET&lt;span&gt; &lt;span title="Resource URL"&gt;http://java-servlet-jsp-web.blogspot.com&lt;/span&gt; &lt;span title="HTTP version"&gt;HTTP/1.0&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Followed by the initial request, a blank line should be there and then followed by request headers should be placed. A request header is a key value pair separated by a colon (:). Multiple request headers should be separated by a new line (\r\n). Each header will represent a piece of information that helps server to process the request.&lt;br /&gt;Example request headers:&lt;br /&gt;&lt;pre class="program"&gt;&lt;br /&gt;ACCEPT: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5&lt;br /&gt;ACCEPT-CHARSET: ISO-8859-1,*,utf-8&lt;br /&gt;ACCEPT-ENCODING: gzip,deflate,bzip2,sdch&lt;br /&gt;ACCEPT-LANGUAGE: en-US,en&lt;br /&gt;CACHE-CONTROL: max-age=0&lt;br /&gt;CONNECTION: Keep-Alive&lt;br /&gt;COOKIE: JSESSIONID=c0a80111ce7e6058f18e10248cdb8d8c7d5feaa140b.e3uRa3aOaNmQe3uNaNaPbhyPb41ynknvrkLOlQzNp65In0&lt;br /&gt;HOST: 203.197.128.203&lt;br /&gt;USER-AGENT: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/525.19 (KHTML, like Gecko) Chrome/1.0.154.65&lt;br /&gt;  Safari/525.19&lt;br /&gt;ORACLE-ECID: 1242045527:192.168.1.17:4372:0:15,0&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;And all the request headers should be followed by a blank line and then followed by HTTP request body.&lt;br /&gt;&lt;br /&gt;So a programatically, if you want to send a HTTP request, you should follow the above steps.&lt;br /&gt;Eg:&lt;br /&gt;&lt;pre class="program"&gt;&lt;br /&gt;GET http://java-servlet-jsp-web.blogspot.com HTTP/1.0\r\n\r\nUser-agent: My browser\r\n\r\n"&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;The above example is sending a request to the resource www.java-servlet-jsp-web.blogspot.com with the request header User-agent (Normally each browser will send this header with the browser name here it is My browser) and blank request body.&lt;br /&gt;&lt;br /&gt;As we discussed, like client follows some rules to construct an HTTP request, server has to construct the HTTP response as well, which also has a standard.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;HTTP response structure&lt;/strong&gt;&lt;br /&gt;HTTP response also is a combination of lines. Its sequence is similar to the request, starts with Initial response line followed by blank line, response headers, blank line, HTTP response body.&lt;br /&gt;&lt;br /&gt;Initial response line will have the HTTP version, status code, and status description.&lt;br /&gt;Eg: HTTP/1.0 200 OK   (or)  HTTP/1.0 404 Not Found&lt;br /&gt;Each HTTP status code represent a predefined status, follow up my blog for more info on HTTP status codes.&lt;br /&gt;&lt;br /&gt;Similar request headers, response headers are also key value pairs, which will be separated by colon (:). And this time server is sending piece of information to the client.&lt;br /&gt;&lt;br /&gt;Response body will have the HTML content of the page, the source that you can see at the browser end (Clicking on view page source), will be placed as part of the response body.&lt;br /&gt;&lt;br /&gt;Hope you are very clear on HTTP protocol now. I'll post more info on HTTP status codes, HTTP headers and some client, server programs using Java.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://java-servlet-jsp-web.blogspot.com/2009/06/http-methods-deep-look.html" title="HTTP methods"&gt;Click here&lt;/a&gt; to checkout more about HTTP methods.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7316847079866971282-2673211990161094671?l=java-servlet-jsp-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java-servlet-jsp-web.blogspot.com/feeds/2673211990161094671/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/06/http-protocol-detailed-view.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/2673211990161094671'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/2673211990161094671'/><link rel='alternate' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/06/http-protocol-detailed-view.html' title='HTTP protocol - detailed view'/><author><name>Bharathamma</name><uri>http://www.blogger.com/profile/11015309374869899661</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7316847079866971282.post-716621379956360094</id><published>2009-06-12T19:09:00.003+05:30</published><updated>2009-06-12T19:25:30.814+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='SCJP 1.5 Question Bank'/><title type='text'>Sun Certified Java Professional 1.5 Question Bank</title><content type='html'>Here is the second article of questions on SCJP 1.5. If you haven't read the first article, &lt;a href="http://java-servlet-jsp-web.blogspot.com/2009/06/sun-certified-java-professional-scjp-15.html" title="Read first SCJP question bank"&gt;click here&lt;/a&gt; to read.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Question: 6&lt;/strong&gt;&lt;br /&gt;Given:&lt;br /&gt;1. import java.util.*;&lt;br /&gt;2. public class Old {&lt;br /&gt;3.   public static Object get0(List list) {&lt;br /&gt;4.   return list.get(0);&lt;br /&gt;5.  }&lt;br /&gt;6. }&lt;br /&gt;Which three will compile successfully? (Choose three.)&lt;br /&gt;A. Object o = Old.get0(new LinkedList());&lt;br /&gt;B. Object o = Old.get0(new LinkedList&amp;lt;?&amp;gt;());&lt;br /&gt;C. String s = Old.get0(new LinkedList&amp;lt;String&amp;gt;());&lt;br /&gt;D. Object o = Old.get0(new LinkedList&amp;lt;Object&amp;lt;());&lt;br /&gt;E. String s = (String)Old.get0(new LinkedList&amp;lt;String&amp;gt;());&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Answer: A, D, E&lt;/strong&gt;&lt;br /&gt;&lt;hr /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Question: 7&lt;/strong&gt;&lt;br /&gt;Given:&lt;br /&gt;1. import java.util.*;&lt;br /&gt;2. public class Example {&lt;br /&gt;3.  public static void main(String[] args) {&lt;br /&gt;4.   // insert code here&lt;br /&gt;5.   set.add(new Integer(2));&lt;br /&gt;6.   set.add(new Integer(1));&lt;br /&gt;7.   System.out.println(set);&lt;br /&gt;8.  }&lt;br /&gt;9. }&lt;br /&gt;Which code, inserted at line 4, guarantees that this program will output [1, 2]?&lt;br /&gt;A. Set set = new TreeSet();&lt;br /&gt;B. Set set = new HashSet();&lt;br /&gt;C. Set set = new SortedSet();&lt;br /&gt;D. List set = new SortedList();&lt;br /&gt;E. Set set = new LinkedHashSet();&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Answer: A&lt;/strong&gt;&lt;br /&gt;&lt;hr /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Question: 8&lt;/strong&gt;&lt;br /&gt;Given&lt;br /&gt;10. class Foo {&lt;br /&gt;11.  static void alpha() { /* more code here */ }&lt;br /&gt;12.  void beta() { /* more code here */ }&lt;br /&gt;13. }&lt;br /&gt;Which two statements are true? (Choose two.)&lt;br /&gt;A. Foo.beta() is a valid invocation of beta().&lt;br /&gt;B. Foo.alpha() is a valid invocation of alpha().&lt;br /&gt;C. Method beta() can directly call method alpha().&lt;br /&gt;D. Method alpha() can directly call method beta().&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Answer: B, C&lt;/strong&gt;&lt;br /&gt;&lt;hr /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Question: 9&lt;/strong&gt;&lt;br /&gt;Given:&lt;br /&gt;11. public static void parse(String str) {&lt;br /&gt;12.  try {&lt;br /&gt;13.   float f = Float.parseFloat(str);&lt;br /&gt;14.  } catch (NumberFormatException nfe) {&lt;br /&gt;15.   f = 0;&lt;br /&gt;16.  } finally {&lt;br /&gt;17.   System.out.println(f);&lt;br /&gt;18.  }&lt;br /&gt;19. }&lt;br /&gt;20. public static void main(String[] args) {&lt;br /&gt;21.  parse("invalid");&lt;br /&gt;22. }&lt;br /&gt;What is the result?&lt;br /&gt;A. 0.0&lt;br /&gt;B. Compilation fails.&lt;br /&gt;C. A ParseException is thrown by the parse method at runtime.&lt;br /&gt;D. A NumberFormatException is thrown by the parse method at runtime.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Answer: B&lt;/strong&gt;&lt;br /&gt;&lt;hr /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Question: 10&lt;/strong&gt;&lt;br /&gt;Given:&lt;br /&gt;10. class Line {&lt;br /&gt;11.  public static class Point {}&lt;br /&gt;12. }&lt;br /&gt;13.&lt;br /&gt;14. class Triangle {&lt;br /&gt;15.  // insert code here&lt;br /&gt;16. }&lt;br /&gt;Which code, inserted at line 15, creates an instance of the Point class defined in Line?&lt;br /&gt;A. Point p = new Point();&lt;br /&gt;B. Line.Point p = new Line.Point();&lt;br /&gt;C. The Point class cannot be instatiated at line 15.&lt;br /&gt;D. Line l = new Line() ; l.Point p = new l.Point();&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Answer: B&lt;/strong&gt;&lt;br /&gt;&lt;hr /&gt;&lt;br /&gt;&lt;br /&gt;If you would like to read all the SCJP Question bank articles, please &lt;a href="http://java-servlet-jsp-web.blogspot.com/search/label/SCJP%201.5%20Question%20Bank" title="Read all SCJP posts"&gt;click here&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7316847079866971282-716621379956360094?l=java-servlet-jsp-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java-servlet-jsp-web.blogspot.com/feeds/716621379956360094/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/06/sun-certified-java-professional-15.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/716621379956360094'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/716621379956360094'/><link rel='alternate' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/06/sun-certified-java-professional-15.html' title='Sun Certified Java Professional 1.5 Question Bank'/><author><name>Santhosh Reddy</name><uri>http://www.blogger.com/profile/05232963292855488994</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_P0JbJW7kyKo/ShZkH-FOe4I/AAAAAAAAHP0/ogsB2X0vAMU/S220/IMG_0305.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7316847079866971282.post-384633334049310922</id><published>2009-06-10T20:09:00.005+05:30</published><updated>2009-06-11T15:54:46.924+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='Java programs'/><title type='text'>Java program to fetch FLV metadata</title><content type='html'>Hi guys... Now a days &lt;a href="http://java-servlet-jsp-web.blogspot.com/2009/06/flv-metadata.html"&gt;FLV&lt;/a&gt; format became very famous since it is very compact and will play through browser without any extra software. So it became a hot topic now for every web application.&lt;br /&gt;&lt;br /&gt;If you want to get or manipulate the FLV metadata through Java program, this post will be very helpful for you. With this program you can get the details of FLV file like&lt;br /&gt;1. Width&lt;br /&gt;2. Height&lt;br /&gt;3. Duration&lt;br /&gt;4. Mime Type&lt;br /&gt;5. File size&lt;br /&gt;6. Video rate&lt;br /&gt;7. Audio rate&lt;br /&gt;8. Created date&lt;br /&gt;&lt;br /&gt;I've not used any JARs or libraries to extract FLV metadata. It is a pure standalone Java program.&lt;br /&gt;&lt;br /&gt;The technique is very simple. You need to read the raw bytes of the file and get the information that you would like to get.&lt;br /&gt;&lt;strong&gt;Logic&lt;/strong&gt;&lt;br /&gt;1. Open FLV file's input stream&lt;br /&gt;2. Read first 400 bytes and store them into a byte array&lt;br /&gt;3. Create a string object from the byte array&lt;br /&gt;4. Search for each FLV property like "duration", "width", "height" and etc.. get the index position.&lt;br /&gt;5. From the index read 8 bytes and convert them as double.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Algorithm&lt;/strong&gt;&lt;pre class="program"&gt;&lt;br /&gt;START&lt;br /&gt; PICK FLV file for which you would like metadata. This can be even a web URL&lt;br /&gt; OPEN FLV file&lt;br /&gt; READ first 400 Raw bytes from the file input stream&lt;br /&gt; COVERT bytes into String&lt;br /&gt; LOOP (This loop should be continued until you finish all your properties)&lt;br /&gt;  SEARCH for the property&lt;br /&gt;  IF FOUND&lt;br /&gt;    READ 8 bytes followed by the property name&lt;br /&gt;    DISPLAY or STORE the property&lt;br /&gt;  END IF&lt;br /&gt; END LOOP&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Here is the program that I've developed based on the above algorithm&lt;br /&gt;&lt;strong&gt;&lt;em&gt;FLVMetadata.java&lt;/em&gt;&lt;/strong&gt;&lt;br /&gt;&lt;pre class="program"&gt;import java.io.InputStream;&lt;br /&gt;import java.io.FileInputStream;&lt;br /&gt;import java.nio.ByteBuffer;&lt;br /&gt;import java.net.URL;&lt;br /&gt;import java.net.HttpURLConnection;&lt;br /&gt;import java.text.DecimalFormat;&lt;br /&gt;&lt;br /&gt;/**&lt;br /&gt; * This class will get the FLV meta data information.&lt;br /&gt; * @author SANTHOSH REDDY MANDADI&lt;br /&gt; * @version 1.0&lt;br /&gt; * @since 10th June 2009&lt;br /&gt; */&lt;br /&gt;public class FLVMetaData&lt;br /&gt;{&lt;br /&gt;  /**&lt;br /&gt;   * Represents the FLV path either a URL or a absolute file path. If it is URL&lt;br /&gt;   * url property should be true to access the file from web&lt;br /&gt;   */&lt;br /&gt;  private String flv=null;&lt;br /&gt;  &lt;br /&gt;  /**&lt;br /&gt;   * Represents whether the FLV is remote or local, if this is true&lt;br /&gt;   * data will be fetched through the HTTP connection otherwise data will&lt;br /&gt;   * be fetched from the local file.&lt;br /&gt;   */&lt;br /&gt;  private boolean url=true;&lt;br /&gt;  &lt;br /&gt;  //All the FLV properties&lt;br /&gt;  private String duration;&lt;br /&gt;  private double width;&lt;br /&gt;  private double height;&lt;br /&gt;  private double audioDataRate;&lt;br /&gt;  private double videoDataRate;&lt;br /&gt;  private double fileSize;&lt;br /&gt;  private String createdDate;&lt;br /&gt;  private String mimeType;&lt;br /&gt;  private double frameRate;&lt;br /&gt;  &lt;br /&gt;  /**&lt;br /&gt;   * Constructs an object with flv as a url &lt;br /&gt;   * @param flv represents the web url&lt;br /&gt;   * @since 10-Jun-2009&lt;br /&gt;   */&lt;br /&gt;  public FLVMetaData(String flv) throws Exception&lt;br /&gt;  {&lt;br /&gt;    this.flv=flv;&lt;br /&gt;    getMetaData();&lt;br /&gt;  }&lt;br /&gt;  &lt;br /&gt;  /**&lt;br /&gt;   * Constructs an object with flv and boolean value url.&lt;br /&gt;   * @param flv represents the FLV path either a URL or a absolute file path.&lt;br /&gt;   * @param url represents boolean value.&lt;br /&gt;   */&lt;br /&gt;  public FLVMetaData(String flv, boolean url) throws Exception&lt;br /&gt;  {&lt;br /&gt;    this.flv=flv;&lt;br /&gt;    this.url=url;&lt;br /&gt;    getMetaData();&lt;br /&gt;  }&lt;br /&gt;  &lt;br /&gt;  /**&lt;br /&gt;   * Extract the metadata for the flv and sets them in the properties.&lt;br /&gt;   * If the property has 0.0 or null, then the information is not available on&lt;br /&gt;   * the target FLV.&lt;br /&gt;   * @throws Exception if something goes wrong.&lt;br /&gt;   */&lt;br /&gt; private void getMetaData() throws Exception&lt;br /&gt; {&lt;br /&gt;   InputStream fis=null;&lt;br /&gt;    try{&lt;br /&gt;      if(url)&lt;br /&gt;      {&lt;br /&gt;        //Creating the URL object&lt;br /&gt;        URL url = new URL(flv);&lt;br /&gt;        //Establishing the connection to the server&lt;br /&gt;        HttpURLConnection connection=(HttpURLConnection)url.openConnection();&lt;br /&gt;        //Getting the remote input stream&lt;br /&gt;        fis=connection.getInputStream();&lt;br /&gt;      }&lt;br /&gt;      else&lt;br /&gt;      {&lt;br /&gt;        fis=new FileInputStream(flv);&lt;br /&gt;      }&lt;br /&gt;      //Creating the bytes array to read the first 400 bytes data from input stream&lt;br /&gt;      byte bytes[]=new byte[400];&lt;br /&gt;      //Reading the data from the input stream&lt;br /&gt;      fis.read(bytes);&lt;br /&gt;      &lt;br /&gt;      /*Fetching the properties. If the output shows -1 or null then &lt;br /&gt;      consider that the FLV doesn't have that info on metadata*/&lt;br /&gt;      double duration=getDouble(bytes,"duration");&lt;br /&gt;      DecimalFormat f = new DecimalFormat("00");&lt;br /&gt;      setDuration(f.format((int)duration/60)+":"+f.format((int)duration%60));&lt;br /&gt;      setWidth(getDouble(bytes,"width"));&lt;br /&gt;      setHeight(getDouble(bytes,"height"));&lt;br /&gt;      setAudioDataRate(getDouble(bytes,"audiodatarate"));&lt;br /&gt;      setVideoDataRate(getDouble(bytes,"videodatarate"));&lt;br /&gt;      setFileSize(getDouble(bytes,"filesize"));&lt;br /&gt;      setCreatedDate(getString(bytes,"creationdate"));&lt;br /&gt;      setMimeType(getString(bytes,"mimetype"));&lt;br /&gt;      setFrameRate(getDouble(bytes,"framerate"));&lt;br /&gt;      &lt;br /&gt;      //Closing the remote input stream&lt;br /&gt;      fis.close();&lt;br /&gt;    }catch(Exception e) {&lt;br /&gt;      throw new Exception(e);&lt;br /&gt;    }&lt;br /&gt;    finally {&lt;br /&gt;      if(fis!=null) {&lt;br /&gt;        fis.close();&lt;br /&gt;      }&lt;br /&gt;    }&lt;br /&gt; }&lt;br /&gt; private double getDouble(byte[] bytes, String property)&lt;br /&gt; {&lt;br /&gt;  //Creating a string from the bytes&lt;br /&gt;  String metaData=new String(bytes);&lt;br /&gt;  //Checking whether the property exists on the metadata&lt;br /&gt;  int offset=metaData.indexOf(property);&lt;br /&gt;  if(offset!=-1)&lt;br /&gt;  {&lt;br /&gt;   //Calculating the value from the bytes received from getBytes method&lt;br /&gt;   return ByteBuffer.wrap(getBytes(bytes, offset+property.length()+1, 8)).getDouble();&lt;br /&gt;  }&lt;br /&gt;  else&lt;br /&gt;  {&lt;br /&gt;   //Returning -1 to notify the info not available&lt;br /&gt;   return -1;&lt;br /&gt;  }&lt;br /&gt; }&lt;br /&gt; private String getString(byte[] bytes, String property)&lt;br /&gt; {&lt;br /&gt;  //Creating a string from the bytes&lt;br /&gt;  String metaData=new String(bytes);&lt;br /&gt;  //Checking whether the property exists on the metadata&lt;br /&gt;  int offset=metaData.indexOf(property);&lt;br /&gt;  if(offset!=-1)&lt;br /&gt;  {&lt;br /&gt;   //Constructing the string from the bytes received from getBytes method&lt;br /&gt;   return new String(getBytes(bytes, offset+property.length()+3, 24));&lt;br /&gt;  }&lt;br /&gt;  else&lt;br /&gt;  {&lt;br /&gt;   //Returning null to notify the info not available&lt;br /&gt;   return null;&lt;br /&gt;  }&lt;br /&gt; }&lt;br /&gt; private byte[] getBytes(byte[] bytes, int offset, int length)&lt;br /&gt; {&lt;br /&gt;  //Fetching the required number of bytes from the source and returning&lt;br /&gt;  byte requiredBytes[]=new byte[length];&lt;br /&gt;  for(int i=offset, j=0;j&amp;lt;length;i++,j++)&lt;br /&gt;  {&lt;br /&gt;   requiredBytes[j]=bytes[i];&lt;br /&gt;  }&lt;br /&gt;  return requiredBytes;&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt;  public void setFlv(String flv)&lt;br /&gt;  {&lt;br /&gt;    this.flv = flv;&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  public String getFlv()&lt;br /&gt;  {&lt;br /&gt;    return flv;&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  public void setUrl(boolean url)&lt;br /&gt;  {&lt;br /&gt;    this.url = url;&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  public boolean isUrl()&lt;br /&gt;  {&lt;br /&gt;    return url;&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  public void setCreatedDate(String createdDate)&lt;br /&gt;  {&lt;br /&gt;    this.createdDate = createdDate;&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  public String getCreatedDate()&lt;br /&gt;  {&lt;br /&gt;    return createdDate;&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  public void setMimeType(String mimeType)&lt;br /&gt;  {&lt;br /&gt;    this.mimeType = mimeType;&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  public String getMimeType()&lt;br /&gt;  {&lt;br /&gt;    return mimeType;&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  public void setWidth(double width)&lt;br /&gt;  {&lt;br /&gt;    this.width = width;&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  public double getWidth()&lt;br /&gt;  {&lt;br /&gt;    return width;&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  public void setHeight(double height)&lt;br /&gt;  {&lt;br /&gt;    this.height = height;&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  public double getHeight()&lt;br /&gt;  {&lt;br /&gt;    return height;&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  public void setAudioDataRate(double audioDataRate)&lt;br /&gt;  {&lt;br /&gt;    this.audioDataRate = audioDataRate;&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  public double getAudioDataRate()&lt;br /&gt;  {&lt;br /&gt;    return audioDataRate;&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  public void setVideoDataRate(double videoDataRate)&lt;br /&gt;  {&lt;br /&gt;    this.videoDataRate = videoDataRate;&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  public double getVideoDataRate()&lt;br /&gt;  {&lt;br /&gt;    return videoDataRate;&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  public void setFileSize(double fileSize)&lt;br /&gt;  {&lt;br /&gt;    this.fileSize = fileSize;&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  public double getFileSize()&lt;br /&gt;  {&lt;br /&gt;    return fileSize;&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  public void setFrameRate(double frameRate)&lt;br /&gt;  {&lt;br /&gt;    this.frameRate = frameRate;&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  public double getFrameRate()&lt;br /&gt;  {&lt;br /&gt;    return frameRate;&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  public void setDuration(String duration)&lt;br /&gt;  {&lt;br /&gt;    this.duration = duration;&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  public String getDuration()&lt;br /&gt;  {&lt;br /&gt;    return duration;&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  public static void main(String args[]) throws Exception&lt;br /&gt;  {&lt;br /&gt;   FLVMetaData metaData=new FLVMetaData("http://domain/o18/HCINTL/LIVE/72224/myhc_200.flv");&lt;br /&gt;   System.out.println(metaData.getDuration());&lt;br /&gt;   metaData.setUrl(false);&lt;br /&gt;   metaData.setFlv("1.flv");&lt;br /&gt;   metaData.getMetaData();&lt;br /&gt;   System.out.println(metaData.getDuration());&lt;br /&gt;  }&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Above program has been compiled and tested on JDK 1.4 and 1.5.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://java-servlet-jsp-web.blogspot.com/search/label/Java%20programs" title="Other Java programs"&gt;Click here&lt;/a&gt; to check out other programs that I've developed.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7316847079866971282-384633334049310922?l=java-servlet-jsp-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java-servlet-jsp-web.blogspot.com/feeds/384633334049310922/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/06/java-program-to-fetch-flv-metadata.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/384633334049310922'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/384633334049310922'/><link rel='alternate' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/06/java-program-to-fetch-flv-metadata.html' title='Java program to fetch FLV metadata'/><author><name>Santhosh Reddy</name><uri>http://www.blogger.com/profile/05232963292855488994</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_P0JbJW7kyKo/ShZkH-FOe4I/AAAAAAAAHP0/ogsB2X0vAMU/S220/IMG_0305.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7316847079866971282.post-1665332714511735789</id><published>2009-06-10T12:09:00.003+05:30</published><updated>2009-06-10T12:14:35.476+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='web application'/><category scheme='http://www.blogger.com/atom/ns#' term='Web technology'/><title type='text'>Web application - A Closure Look</title><content type='html'>&lt;h2&gt;What is a web application?&lt;/h2&gt;&lt;br /&gt;A web application or webapp is an application that is accessed via web browser over a network such as the Internet or an intranet. It is also a computer software application that is coded in a browser-supported language (such as HTML, JavaScript, Java, etc.) and reliant on a common web browser to render the application executable.&lt;br /&gt;&lt;br /&gt;Web applications are popular due to the ubiquity of web browsers, and the convenience of using a web browser as a client, sometimes called a thin client. The ability to update and maintain web applications without distributing and installing software on potentially thousands of client computers is a key reason for their popularity. Common web applications include webmail, online retail sales, online auctions, wikis and many other functions.&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;Interface&lt;/h2&gt;&lt;br /&gt;The web interface places very few limits on client functionality. Through Java, JavaScript, DHTML, Flash and other technologies, application-specific methods such as drawing on the screen, playing audio, and access to the keyboard and mouse are all possible. Many services have worked to combine all of these into a more familiar interface that adopts the appearance of an operating system. General purpose techniques such as drag and drop are also supported by these technologies. Web developers often use client-side scripting to add functionality, especially to create an interactive experience that does not require page reloading. Recently, technologies have been developed to coordinate client-side scripting with server-side technologies such as PHP. Ajax, a web development technique using a combination of various technologies, is an example of technology which creates a more interactive experience.&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;Technical considerations&lt;/h2&gt;&lt;br /&gt;A significant advantage of building web applications to support standard browser features is that they should perform as specified regardless of the operating system or OS version installed on a given client. Rather than creating clients for MS Windows, Mac OS X, Linux, and other operating systems, the application can be written once and deployed almost anywhere. However, inconsistent implementations of the HTML, CSS, DOM and other browser specifications can cause problems in web application development and support. Additionally, the ability of users to customize many of the display settings of their browser (such as selecting different font sizes, colors, and typefaces, or disabling scripting support) can interfere with consistent implementation of a web application.&lt;br /&gt;&lt;br /&gt;Another approach is to use Adobe Flash or Java applets to provide some or all of the user interface. Since most web browsers include support for these technologies (usually through plug-ins), Flash- or Java-based applications can be implemented with much of the same ease of deployment. Because they allow the programmer greater control over the interface, they bypass many browser-configuration issues, although incompatibilities between Java or Flash implementations on the client can introduce different complications. Because of their architectural similarities to traditional client-server applications, with a somewhat "thick" client, there is some dispute over whether to call systems of this sort "web applications"; an alternative term is "Rich Internet Application" (RIA).&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;Structure&lt;/h2&gt;&lt;br /&gt;Applications are usually broken into logical chunks called "tiers", where every tier is assigned a role.Traditional applications consist only of 1 tier, which resides on the client machine, but web applications lend themselves to a n-tiered approach by nature.Though many variations are possible, the most common structure is the three-tiered application.In its most common form, the three tiers are called presentation, application and storage, in this order. A web browser is the first tier (presentation), an engine using some dynamic Web content technology (such as ASP, ASP.NET, CGI, ColdFusion, JSP/Java, PHP, Perl, Python, Ruby on Rails or Struts2) is the middle tier (application logic), and a database is the third tier (storage).The web browser sends requests to the middle tier, which services them by making queries and updates against the database and generates a user interface.&lt;br /&gt;&lt;br /&gt;For more complex applications, a 3-tier solution may fall short, and you may need a n-tiered approach, where the greatest benefit is breaking the business logic, which resides on the application tier, into a more fine-grained model.For example, creating a separate business logic tier. Or adding an integration tier that separates the data tier from the rest of tiers by providing an easy-to-use interface to access the data.For example, you would access the client data by calling a "list_clients()" function instead of making a SQL query directly against the client table on the database. That allows you to replace the underlying database without changing the other tiers.&lt;br /&gt;&lt;br /&gt;There are some who view a web application as a two-tier architecture. This can be a "smart" client that performs all the work and queries a "dumb" server, or a "dumb" client that relies on a "smart" server. The client would handle the presentation tier, the server would have the database (storage tier), and the business logic (application tier) would be on one of them or on both. While this increases the scalability of the applications and separates the display and the database, it still doesn't allow for true specialization of layers, so most applications will outgrow this model.&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;Business use&lt;/h2&gt;&lt;br /&gt;An emerging strategy for application software companies is to provide web access to software previously distributed as local applications. Depending on the type of application, it may require the development of an entirely different browser-based interface, or merely adapting an existing application to use different presentation technology. These programs allow the user to pay a monthly or yearly fee for use of a software application without having to install it on a local hard drive. A company which follows this strategy is known as an application service provider (ASP), and ASPs are currently receiving much attention in the software industry.&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;Writing web applications&lt;/h2&gt;&lt;br /&gt;There are many web application frameworks which facilitate rapid application development by allowing the programmer to define a high-level description of the program. In addition, there is potential for the development of applications on Internet operating systems, although currently there are not many viable platforms that fit this model.&lt;br /&gt;The use of web application frameworks can often reduce the number of errors in a program, both by making the code simpler, and by allowing one team to concentrate just on the framework. In applications which are exposed to constant hacking attempts on the Internet, security-related problems caused by errors in the program are a big issue. Frameworks may also promote the use of best practices such as GET after POST.&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;Web application security&lt;/h2&gt;&lt;br /&gt;The Web Application Security Consortium (WASC) and OWASP are projects developed with the intention of documenting how to avoid security problems in web applications. A web application security scanner is specialized software for detecting security problems in web applications.&lt;br /&gt;Applications&lt;br /&gt;&lt;br /&gt;Browser applications typically include simple office software (word processors, online spreadsheets, and presentation tools), with Google Docs being the most notable example, and can also include more advanced applications such as project management, computer-aided design, video editing and point-of-sale&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;Benefits&lt;/h2&gt;&lt;br /&gt;Browser applications typically require little or no disk space on the client, upgrade automatically with new features, integrate easily into other web procedures, such as email and searching. They also provide cross-platform compatibility (i.e., Windows, Mac, Linux, etc.) because they operate within a web browser window.&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;Disadvantages&lt;/h2&gt;&lt;br /&gt;Standards compliance is an issue with any non-typical office document creator, which causes problems when file sharing and collaboration becomes critical. Also, browser applications rely on application files accessed on remote servers through the Internet. Therefore, when connection is interrupted, the application is no longer usable. Google Gears is a platform to ameliorate this issue and improve the usability of browser applications.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7316847079866971282-1665332714511735789?l=java-servlet-jsp-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java-servlet-jsp-web.blogspot.com/feeds/1665332714511735789/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/06/what-is-web-application.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/1665332714511735789'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/1665332714511735789'/><link rel='alternate' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/06/what-is-web-application.html' title='Web application - A Closure Look'/><author><name>Santhosh Reddy</name><uri>http://www.blogger.com/profile/05232963292855488994</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_P0JbJW7kyKo/ShZkH-FOe4I/AAAAAAAAHP0/ogsB2X0vAMU/S220/IMG_0305.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7316847079866971282.post-7402347120066375495</id><published>2009-06-09T19:50:00.009+05:30</published><updated>2009-06-30T20:33:21.564+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='FLV'/><title type='text'>FLV (Flash Live Video) file format and FLV metadata</title><content type='html'>If you're looking for a Java program to get the FLV metadata, please &lt;a href="http://java-servlet-jsp-web.blogspot.com/2009/06/java-program-to-fetch-flv-metadata.html" title="Get the FLV metadata thru Java"&gt;click here&lt;/a&gt;&lt;br /&gt;&lt;h2&gt;What is FLV?&lt;/h2&gt;&lt;br /&gt;FLV stands for "Flash Live Video". It is a format designed for web video playback that offers high rates of compression and produces high quality video. Several products convert video files to FLV format, including our FLV Converter, Sorenson Squeeze, and the On2 (Wildform Flix). &lt;br /&gt;&lt;br /&gt;Notable users of the FLV file include Google Video, Reuters.com and YouTube. &lt;br /&gt;&lt;br /&gt;Most FLV converters use H.263, H.264 or On2 VP6 codecs to encode the video. The audio in FLV files is encoded in PCM, ADPCM, or MP3 format.&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;FLV Streaming - Progressive and Flash Comm Server:&lt;/h2&gt;&lt;br /&gt;There are two techniques used to stream an FLV file from a website, Progessive and Flash Comm Server. While this may confuse most end users, the 2 techniques depend on a few parameters that we will outline below.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Progressive Streaming&lt;/strong&gt; - Introduced in Flash 7.0, this method is a low cost yet effective one for the user. An interface or video player in SWF (Flash File Format) is embedded in the HTML/JSP/PHP/ASP page. This video player contains the required code to playback a FLV file from a server location. Obviously the FLV file is externally placed. The video plays as the file is downloaded and the user doesn't have to wait until the whole file is downloaded.&lt;br /&gt;&lt;strong&gt;Pros -&lt;/strong&gt;&lt;br /&gt;1. Easy to set-up and maintain&lt;br /&gt;2. Consistent high quality playback at all connection speeds&lt;br /&gt;3. No streaming servers required normally based on monthly fees&lt;br /&gt;4. Limited technical support required&lt;br /&gt;&lt;strong&gt;Cons -&lt;/strong&gt;&lt;br /&gt;1. The video needs to be downloaded completely before you can navigate to any particular part of it&lt;br /&gt;2. As the file is downloaded, it will reside on the viewer's computer. Savvy users will be able to access their browser cache or temporary internet files to retrieve the video.&lt;br /&gt;&lt;br /&gt;This is not necessarily harmful if you have no concerns about rights management for the video. But in case you want to protect your video, then this method of streaming is definitely not for you!&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Flash Comm Server&lt;/strong&gt; - Also known as Flash Media Server, this method is more professional way of serving streaming video on web. While in progressive download the file is downloaded to the viewer's machine and played back at the same time, in this method the file resides on the streaming server and is not downloaded while it is played. Apart from that there is no apparent difference between progressive download. The advantage of using Flash Comm Server are twofold. First, your media is protected from thieves. Secondly viewers can seek to any portion of the video to view that portion. This is particularly helpful if you have long hours of training material on your website.&lt;br /&gt;&lt;strong&gt;Pros -&lt;/strong&gt;&lt;br /&gt;1. Ability to handle huge user load.&lt;br /&gt;2. Immediate random access to different parts of a movie.&lt;br /&gt;3. Video remains on server (cannot be saved by viewers).&lt;br /&gt;&lt;strong&gt;Cons -&lt;/strong&gt;&lt;br /&gt;1. Not easy to setup for the average person.&lt;br /&gt;2. Monthly Fees and much costly than progressive download.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Which should be your choice?&lt;/strong&gt;&lt;br /&gt;If you are looking for a low cost effective solution to put videos on your website and you have a low to moderate traffic then progressive download technique is your best option. If you have a pretty heavy user load BBC or CNN and you are concerned about your media rights then you definitely need a streaming server setup.&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;Top 5 reasons to choose FLV as your streaming video format:&lt;/h2&gt;&lt;br /&gt;1. FLV file sizes are small compared to others (almost 60% less). Thus they take up less space on a server.&lt;br /&gt;2. FLV file plays directly in more browsers than Windows Media, Real Player or QuickTime.&lt;br /&gt;3. FLV players can be completely customized for logos, brandings and embedded links matching your website or product.&lt;br /&gt;4. FLV players can play files from a database like MySQL or MS SQL Server, and are easy to manage.&lt;br /&gt;5. Flash Communications servers are easier to maintain than others, and are less prone to security threats.&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;What is Metadata?&lt;/h2&gt;&lt;br /&gt;Simple answer is, its data about data. For example a piece of paper contains data for 10 lines. Of these five lines are in bold and five lines are normal. Again total number of capital letters is twenty. So here is how a metadata for this paper will look like:&lt;br /&gt;Total lines: 10&lt;br /&gt;Bold: 5&lt;br /&gt;Normal: 5&lt;br /&gt;Capital letters: 20&lt;br /&gt;Now if I paste the above information on top of the paper, it will be a metadata of the data contained on the paper. Simple.&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;FLV Metadata:&lt;/h2&gt;&lt;br /&gt;In this case, the information that composes an FLV file is the data, and the metadata is information about that video. The length of the video (duration), the number of frames per second that the video displays (frame rate), and the number of kilobytes of data transferred per second when the video plays (video and audio data rates, where applicable) are all examples of video metadata. Additionally the codec used to encode the video is also available.&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;Importance of FLV metadata:&lt;/h2&gt;&lt;br /&gt;Most FLV players read the metadata first to know the duration of the video file. After that it initializes or synchronizes the video file with its timeline or seekbar. If there is no metadata the seekbar will not progress with the video. Secondly for more intelligent FLV players that serve the video or rather buffer the video dynamically depending on the user’s internet speed the FLV players read the FLV video bitrate from the FLV metadata and then sets the buffer accordingly.&lt;br /&gt;&lt;br /&gt;I'm working on a program which returns the metadata of FLV. I'll keep you posted once the program is ready to use.&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;FLV file size versus. FLV video quality:&lt;/h2&gt;&lt;br /&gt;Optimizing FLV conversion refers to the FLV file size versus FLV video quality. For web playback users wont be able to afford to huge sized files yet they have to ensure the video quality at the same time. &lt;br /&gt;&lt;br /&gt;A common question of most users is how much reduction the file size will be when converted to FLV from other formats. In case of MPEG (MPEG-1 or MPEG-2) and raw AVI the file size reduces noticibly. However in case of compressed formats like WMV, ASF, MOV or divX, the file size does not reduce that much. In some rare cases it is found that the file size to have increased than the source. This happens due to the fact that these files are already in a compressed format and the file size that they have is already small. But yet a reduction can be achieved by tweaking the encoding settings a bit. For example if you want to convert a WMV that has a video window of 640 X 480 to FLV format you should use a lower video window size on the FLV converter like 400 X 300 or 320 X 240 (mostly used for website videos). This will reduce the file size a bit. But do not expect a huge reduction because technically that is not possible. Remember you will get the best results if your source file is MPEG or raw AVI.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Conversion Settings:&lt;/strong&gt;&lt;br /&gt;Best Source Video Formats: MPEG1 (files that have .mpg extention) and Raw AVI (files that have .avi extention). Note that some AVI file are DIVx AVI files and they are already compressed. Raw AVIs are generated mainly by DVCams, Webcams etc.&lt;br /&gt;Optimum Video Window Size: 400 X 300 or 320 X 240 (normal) and 400 X 225 or 320 X 180 (wide screen)&lt;br /&gt;Optimum Video Bitrate: 225Kbps or 350Kbps&lt;br /&gt;Optimum Audio Bitrate: 48Kbps @ 22,500 Hz and Mono&lt;br /&gt;If you are an expert you can always go for your own settings but this is a quick reference for all our users who wonder with the various settings of FLV Conversion.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7316847079866971282-7402347120066375495?l=java-servlet-jsp-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java-servlet-jsp-web.blogspot.com/feeds/7402347120066375495/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/06/flv-metadata.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/7402347120066375495'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/7402347120066375495'/><link rel='alternate' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/06/flv-metadata.html' title='FLV (Flash Live Video) file format and FLV metadata'/><author><name>Santhosh Reddy</name><uri>http://www.blogger.com/profile/05232963292855488994</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_P0JbJW7kyKo/ShZkH-FOe4I/AAAAAAAAHP0/ogsB2X0vAMU/S220/IMG_0305.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7316847079866971282.post-2998132757063168881</id><published>2009-06-08T18:17:00.003+05:30</published><updated>2009-06-10T12:16:33.689+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='JavaOne 2009'/><title type='text'>James Gosling's Toy Show - JavaOne 2009</title><content type='html'>Here is the usual update on JavaOne 2009.&lt;br /&gt;&lt;br /&gt;You don't have to be in San Francisco to join in at CommunityOne and JavaOne -- all you have to do is keep returning to this page as this important week goes on and catch up on all the news, technology briefings, and excitement. And even if you're on the scene there will be events you miss, but you can catch up with them right here, along with on-the-floor interviews with attendees, Java Rockstars, luminaries, and just folks attending the show.&lt;br /&gt;&lt;br /&gt;Here is the final show of the JavaOne 2009, Toy Show from James Gosling.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Chapter 1: James Gosling's Toy Show&lt;/strong&gt;&lt;br /&gt;&lt;object id="flashObj" width="486" height="322" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,47,0"&gt;&lt;param name="movie" value="http://c.brightcove.com/services/viewer/federated_f9/1640183659?isVid=1&amp;publisherID=1460825906" /&gt;&lt;param name="bgcolor" value="#FFFFFF" /&gt;&lt;param name="flashVars" value="videoId=25466436001&amp;playerID=1640183659&amp;domain=embed&amp;" /&gt;&lt;param name="base" value="http://admin.brightcove.com" /&gt;&lt;param name="seamlesstabbing" value="false" /&gt;&lt;param name="allowFullScreen" value="true" /&gt;&lt;param name="swLiveConnect" value="true" /&gt;&lt;param name="allowScriptAccess" value="always" /&gt;&lt;embed src="http://c.brightcove.com/services/viewer/federated_f9/1640183659?isVid=1&amp;publisherID=1460825906" bgcolor="#FFFFFF" flashVars="videoId=25466436001&amp;playerID=1640183659&amp;domain=embed&amp;" base="http://admin.brightcove.com" name="flashObj" width="486" height="322" seamlesstabbing="false" type="application/x-shockwave-flash" allowFullScreen="true" swLiveConnect="true" allowScriptAccess="always" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Chapter 2: James Gosling's Toy Show&lt;/strong&gt;&lt;br /&gt;&lt;object id="flashObj" width="486" height="322" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,47,0"&gt;&lt;param name="movie" value="http://c.brightcove.com/services/viewer/federated_f9/1640183659?isVid=1&amp;publisherID=1460825906" /&gt;&lt;param name="bgcolor" value="#FFFFFF" /&gt;&lt;param name="flashVars" value="videoId=25474033001&amp;playerID=1640183659&amp;domain=embed&amp;" /&gt;&lt;param name="base" value="http://admin.brightcove.com" /&gt;&lt;param name="seamlesstabbing" value="false" /&gt;&lt;param name="allowFullScreen" value="true" /&gt;&lt;param name="swLiveConnect" value="true" /&gt;&lt;param name="allowScriptAccess" value="always" /&gt;&lt;embed src="http://c.brightcove.com/services/viewer/federated_f9/1640183659?isVid=1&amp;publisherID=1460825906" bgcolor="#FFFFFF" flashVars="videoId=25474033001&amp;playerID=1640183659&amp;domain=embed&amp;" base="http://admin.brightcove.com" name="flashObj" width="486" height="322" seamlesstabbing="false" type="application/x-shockwave-flash" allowFullScreen="true" swLiveConnect="true" allowScriptAccess="always" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Chapter 3: James Gosling's Toy Show&lt;/strong&gt;&lt;br /&gt;&lt;object id="flashObj" width="486" height="322" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,47,0"&gt;&lt;param name="movie" value="http://c.brightcove.com/services/viewer/federated_f9/1640183659?isVid=1&amp;publisherID=1460825906" /&gt;&lt;param name="bgcolor" value="#FFFFFF" /&gt;&lt;param name="flashVars" value="videoId=25481855001&amp;playerID=1640183659&amp;domain=embed&amp;" /&gt;&lt;param name="base" value="http://admin.brightcove.com" /&gt;&lt;param name="seamlesstabbing" value="false" /&gt;&lt;param name="allowFullScreen" value="true" /&gt;&lt;param name="swLiveConnect" value="true" /&gt;&lt;param name="allowScriptAccess" value="always" /&gt;&lt;embed src="http://c.brightcove.com/services/viewer/federated_f9/1640183659?isVid=1&amp;publisherID=1460825906" bgcolor="#FFFFFF" flashVars="videoId=25481855001&amp;playerID=1640183659&amp;domain=embed&amp;" base="http://admin.brightcove.com" name="flashObj" width="486" height="322" seamlesstabbing="false" type="application/x-shockwave-flash" allowFullScreen="true" swLiveConnect="true" allowScriptAccess="always" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Chapter 4: James Gosling's Toy Show&lt;/strong&gt;&lt;br /&gt;&lt;object id="flashObj" width="486" height="322" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,47,0"&gt;&lt;param name="movie" value="http://c.brightcove.com/services/viewer/federated_f9/1640183659?isVid=1&amp;publisherID=1460825906" /&gt;&lt;param name="bgcolor" value="#FFFFFF" /&gt;&lt;param name="flashVars" value="videoId=25471471001&amp;playerID=1640183659&amp;domain=embed&amp;" /&gt;&lt;param name="base" value="http://admin.brightcove.com" /&gt;&lt;param name="seamlesstabbing" value="false" /&gt;&lt;param name="allowFullScreen" value="true" /&gt;&lt;param name="swLiveConnect" value="true" /&gt;&lt;param name="allowScriptAccess" value="always" /&gt;&lt;embed src="http://c.brightcove.com/services/viewer/federated_f9/1640183659?isVid=1&amp;publisherID=1460825906" bgcolor="#FFFFFF" flashVars="videoId=25471471001&amp;playerID=1640183659&amp;domain=embed&amp;" base="http://admin.brightcove.com" name="flashObj" width="486" height="322" seamlesstabbing="false" type="application/x-shockwave-flash" allowFullScreen="true" swLiveConnect="true" allowScriptAccess="always" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Chapter 5: James Gosling's Toy Show&lt;/strong&gt;&lt;br /&gt;&lt;object id="flashObj" width="486" height="322" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,47,0"&gt;&lt;param name="movie" value="http://c.brightcove.com/services/viewer/federated_f9/1640183659?isVid=1&amp;publisherID=1460825906" /&gt;&lt;param name="bgcolor" value="#FFFFFF" /&gt;&lt;param name="flashVars" value="videoId=25480331001&amp;playerID=1640183659&amp;domain=embed&amp;" /&gt;&lt;param name="base" value="http://admin.brightcove.com" /&gt;&lt;param name="seamlesstabbing" value="false" /&gt;&lt;param name="allowFullScreen" value="true" /&gt;&lt;param name="swLiveConnect" value="true" /&gt;&lt;param name="allowScriptAccess" value="always" /&gt;&lt;embed src="http://c.brightcove.com/services/viewer/federated_f9/1640183659?isVid=1&amp;publisherID=1460825906" bgcolor="#FFFFFF" flashVars="videoId=25480331001&amp;playerID=1640183659&amp;domain=embed&amp;" base="http://admin.brightcove.com" name="flashObj" width="486" height="322" seamlesstabbing="false" type="application/x-shockwave-flash" allowFullScreen="true" swLiveConnect="true" allowScriptAccess="always" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7316847079866971282-2998132757063168881?l=java-servlet-jsp-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java-servlet-jsp-web.blogspot.com/feeds/2998132757063168881/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/06/james-goslings-toy-show-javaone-2009.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/2998132757063168881'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/2998132757063168881'/><link rel='alternate' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/06/james-goslings-toy-show-javaone-2009.html' title='James Gosling&apos;s Toy Show - JavaOne 2009'/><author><name>Santhosh Reddy</name><uri>http://www.blogger.com/profile/05232963292855488994</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_P0JbJW7kyKo/ShZkH-FOe4I/AAAAAAAAHP0/ogsB2X0vAMU/S220/IMG_0305.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7316847079866971282.post-1286077988499552029</id><published>2009-06-05T20:17:00.005+05:30</published><updated>2009-06-12T19:32:49.161+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='SCJP 1.5 Question Bank'/><title type='text'>Sun Certified Java Professional (SCJP) 1.5 questions update</title><content type='html'>Hi... Now a days, Sun Java certification became a passion for all the Java developers across the world. So, here I've decided to start posting the questions on certification exams like SCJP, SCWCD, etc. Each post of question bank will have 5 to 10 questions that I came across.&lt;br /&gt;&lt;br /&gt;Here is the first post of questions on SCJP 1.5 (Sun Certified Java Professional).&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Question: 1&lt;/strong&gt;&lt;br /&gt;Given:&lt;br /&gt;11. public class Person {&lt;br /&gt;12. private String name, comment;&lt;br /&gt;13. private int age;&lt;br /&gt;14. public Person(String n, int a, String c) {&lt;br /&gt;15. name = n; age = a; comment = c;&lt;br /&gt;16. }&lt;br /&gt;17. public boolean equals(Object o) {&lt;br /&gt;18. if (! (o instanceof Person)) return false;&lt;br /&gt;19, Person p = (Person)o;&lt;br /&gt;20. return age == p.age &amp;&amp; name.equals(p.name);&lt;br /&gt;21. }&lt;br /&gt;22. }&lt;br /&gt;&lt;br /&gt;What is the appropriate definition of the hashCode method in class Person?&lt;br /&gt;A. return super.hashCode();&lt;br /&gt;B. return name.hashCode() + age * 7;&lt;br /&gt;C. return name.hashCode() + comment.hashCode() / 2;&lt;br /&gt;D. return name.hashCode() + comment.hashCode() / 2 - age * 3;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Answer: B&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;hr /&gt;&lt;br /&gt;&lt;strong&gt;Question 2:&lt;/strong&gt;&lt;br /&gt;Given:&lt;br /&gt;34. HashMap props = new HashMap();&lt;br /&gt;35. props.put("key45", "some value");&lt;br /&gt;36. props.put("key12", "some other value");&lt;br /&gt;37. props.put("key39", "yet another value");&lt;br /&gt;38. Set s = props.keySet();&lt;br /&gt;39. // insert code here&lt;br /&gt;What, inserted at line 39, will sort the keys in the props HashMap?&lt;br /&gt;A. Arrays.sort(s);&lt;br /&gt;B. s = new TreeSet(s);&lt;br /&gt;C. Collections.sort(s);&lt;br /&gt;D. s = new SortedSet(s);&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Answer: B&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;hr /&gt;&lt;br /&gt;&lt;strong&gt;Question 3:&lt;/strong&gt;&lt;br /&gt;Which statement is true about the set variable on line 12?&lt;br /&gt;import java.util.*;&lt;br /&gt;public class TestSet{&lt;br /&gt;  enum Example { ONE, TWO, THREE }&lt;br /&gt;  public static void main(String args[])&lt;br /&gt;  {&lt;br /&gt;     Collection coll=new ArrayList();&lt;br /&gt;     coll.add(Example.THREE);&lt;br /&gt;     coll.add(Example.THREE);&lt;br /&gt;     coll.add(Example.THREE);&lt;br /&gt;     coll.add(Example.TWO);&lt;br /&gt;     coll.add(Example.TWO);&lt;br /&gt;     coll.add(Example.ONE);&lt;br /&gt;     Set set=new HashSet(coll);&lt;br /&gt;  }&lt;br /&gt;}&lt;br /&gt;A. The set variable contains all six elements from the coll collection, and the order is guaranteed to be preserved.&lt;br /&gt;B. The set variable contains only three elements from the coll collection, and the order is guaranteed to be preserved.&lt;br /&gt;C. The set variable contains all six elements from the coll collection, but the order is NOT guaranteed to be preserved.&lt;br /&gt;D. The set variable contains only three elements from the coll collection, but the order is NOT guaranteed to be preserved.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Answer: D&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;hr /&gt;&lt;br /&gt;&lt;strong&gt;Question 4:&lt;/strong&gt;&lt;br /&gt;Given:&lt;br /&gt;23. Object [] myObjects = {&lt;br /&gt;24. new Integer(12),&lt;br /&gt;25. new String("foo"),&lt;br /&gt;26. new Integer(5),&lt;br /&gt;27. new Boolean(true)&lt;br /&gt;28. };&lt;br /&gt;29. Arrays.sort(myObjects);&lt;br /&gt;30. for(int i=0; i&amp;lt;myObjects.length; i++) {&lt;br /&gt;31. System.out.print(myObjects[i].toString());&lt;br /&gt;32. System.out.print(" ");&lt;br /&gt;33. }&lt;br /&gt;What is the result?&lt;br /&gt;A. Compilation fails due to an error in line 23.&lt;br /&gt;B. Compilation fails due to an error in line 29.&lt;br /&gt;C. A ClassCastException occurs in line 29.&lt;br /&gt;D. A ClassCastException occurs in line 31.&lt;br /&gt;E. The value of all four objects prints in natural order.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Answer: C&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;hr /&gt;&lt;br /&gt;&lt;strong&gt;Question 5:&lt;/strong&gt;&lt;br /&gt;Given:&lt;br /&gt;1. public class Person {&lt;br /&gt;2. private String name;&lt;br /&gt;3. public Person(String name) { this.name = name; }&lt;br /&gt;4. public boolean equals(Person p) {&lt;br /&gt;5. return p.name.equals(this.name);&lt;br /&gt;6.  }&lt;br /&gt;7. }&lt;br /&gt;Which statement is true?&lt;br /&gt;A. The equals method does NOT properly override the Object.equals method.&lt;br /&gt;B. Compilation fails because the private attribute p.name cannot be accessed in line 5.&lt;br /&gt;C. To work correctly with hash-based data structures, this class must also implement the hashCode method.&lt;br /&gt;D. When adding Person objects to a java.util.Set collection, the equals method in line 4 will prevent duplicates.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Answer: A&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://java-servlet-jsp-web.blogspot.com/2009/06/sun-certified-java-professional-15.html" title="Continue to the next question bank"&gt;click here&lt;/a&gt; to go to the second article of SCJP question bank.&lt;br /&gt;&lt;br /&gt;If you would like to read all the SCJP Question bank articles, please &lt;a href="http://java-servlet-jsp-web.blogspot.com/search/label/SCJP%201.5%20Question%20Bank" title="Read all SCJP posts"&gt;click here&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7316847079866971282-1286077988499552029?l=java-servlet-jsp-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java-servlet-jsp-web.blogspot.com/feeds/1286077988499552029/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/06/sun-certified-java-professional-scjp-15.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/1286077988499552029'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/1286077988499552029'/><link rel='alternate' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/06/sun-certified-java-professional-scjp-15.html' title='Sun Certified Java Professional (SCJP) 1.5 questions update'/><author><name>Santhosh Reddy</name><uri>http://www.blogger.com/profile/05232963292855488994</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_P0JbJW7kyKo/ShZkH-FOe4I/AAAAAAAAHP0/ogsB2X0vAMU/S220/IMG_0305.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7316847079866971282.post-5169774237729437132</id><published>2009-06-05T20:11:00.003+05:30</published><updated>2009-06-10T12:18:22.754+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='JavaOne 2009'/><title type='text'>IBM and Microsoft @ JavaOne 2009</title><content type='html'>Here is the usual update on JavaOne 2009.&lt;br /&gt;&lt;br /&gt;You don't have to be in San Francisco to join in at CommunityOne and JavaOne -- all you have to do is keep returning to this page as this important week goes on and catch up on all the news, technology briefings, and excitement. And even if you're on the scene there will be events you miss, but you can catch up with them right here, along with on-the-floor interviews with attendees, Java Rockstars, luminaries, and just folks attending the show.&lt;br /&gt;&lt;br /&gt;Here is the update from IBM and Microsoft&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Chapter 1: IBM General Session&lt;/strong&gt;&lt;br /&gt;Extreme Transaction Processing and Elasticity&lt;br /&gt;&lt;object id="flashObj" width="486" height="322" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,47,0"&gt;&lt;param name="movie" value="http://c.brightcove.com/services/viewer/federated_f9/1640183659?isVid=1&amp;publisherID=1460825906" /&gt;&lt;param name="bgcolor" value="#FFFFFF" /&gt;&lt;param name="flashVars" value="videoId=25351151001&amp;playerID=1640183659&amp;domain=embed&amp;" /&gt;&lt;param name="base" value="http://admin.brightcove.com" /&gt;&lt;param name="seamlesstabbing" value="false" /&gt;&lt;param name="allowFullScreen" value="true" /&gt;&lt;param name="swLiveConnect" value="true" /&gt;&lt;param name="allowScriptAccess" value="always" /&gt;&lt;embed src="http://c.brightcove.com/services/viewer/federated_f9/1640183659?isVid=1&amp;publisherID=1460825906" bgcolor="#FFFFFF" flashVars="videoId=25351151001&amp;playerID=1640183659&amp;domain=embed&amp;" base="http://admin.brightcove.com" name="flashObj" width="486" height="322" seamlesstabbing="false" type="application/x-shockwave-flash" allowFullScreen="true" swLiveConnect="true" allowScriptAccess="always" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Chapter 2: IBM General Session&lt;/strong&gt;&lt;br /&gt;Extreme Transaction Processing and Elasticity&lt;br /&gt;&lt;object id="flashObj" width="486" height="322" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,47,0"&gt;&lt;param name="movie" value="http://c.brightcove.com/services/viewer/federated_f9/1640183659?isVid=1&amp;publisherID=1460825906" /&gt;&lt;param name="bgcolor" value="#FFFFFF" /&gt;&lt;param name="flashVars" value="videoId=25348570001&amp;playerID=1640183659&amp;domain=embed&amp;" /&gt;&lt;param name="base" value="http://admin.brightcove.com" /&gt;&lt;param name="seamlesstabbing" value="false" /&gt;&lt;param name="allowFullScreen" value="true" /&gt;&lt;param name="swLiveConnect" value="true" /&gt;&lt;param name="allowScriptAccess" value="always" /&gt;&lt;embed src="http://c.brightcove.com/services/viewer/federated_f9/1640183659?isVid=1&amp;publisherID=1460825906" bgcolor="#FFFFFF" flashVars="videoId=25348570001&amp;playerID=1640183659&amp;domain=embed&amp;" base="http://admin.brightcove.com" name="flashObj" width="486" height="322" seamlesstabbing="false" type="application/x-shockwave-flash" allowFullScreen="true" swLiveConnect="true" allowScriptAccess="always" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Chapter 1: Microsoft General Session&lt;/strong&gt;&lt;br /&gt;Software + Services: The Next Application Platform: Dan'l Lewis&lt;br /&gt;&lt;object id="flashObj" width="486" height="322" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,47,0"&gt;&lt;param name="movie" value="http://c.brightcove.com/services/viewer/federated_f9/1640183659?isVid=1&amp;publisherID=1460825906" /&gt;&lt;param name="bgcolor" value="#FFFFFF" /&gt;&lt;param name="flashVars" value="videoId=25314269001&amp;playerID=1640183659&amp;domain=embed&amp;" /&gt;&lt;param name="base" value="http://admin.brightcove.com" /&gt;&lt;param name="seamlesstabbing" value="false" /&gt;&lt;param name="allowFullScreen" value="true" /&gt;&lt;param name="swLiveConnect" value="true" /&gt;&lt;param name="allowScriptAccess" value="always" /&gt;&lt;embed src="http://c.brightcove.com/services/viewer/federated_f9/1640183659?isVid=1&amp;publisherID=1460825906" bgcolor="#FFFFFF" flashVars="videoId=25314269001&amp;playerID=1640183659&amp;domain=embed&amp;" base="http://admin.brightcove.com" name="flashObj" width="486" height="322" seamlesstabbing="false" type="application/x-shockwave-flash" allowFullScreen="true" swLiveConnect="true" allowScriptAccess="always" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Chapter 2: Microsoft General Session&lt;/strong&gt;&lt;br /&gt;Software + Services: The Next Application Platform: Steven Martin&lt;br /&gt;&lt;object id="flashObj" width="486" height="322" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,47,0"&gt;&lt;param name="movie" value="http://c.brightcove.com/services/viewer/federated_f9/1640183659?isVid=1&amp;publisherID=1460825906" /&gt;&lt;param name="bgcolor" value="#FFFFFF" /&gt;&lt;param name="flashVars" value="videoId=25314279001&amp;playerID=1640183659&amp;domain=embed&amp;" /&gt;&lt;param name="base" value="http://admin.brightcove.com" /&gt;&lt;param name="seamlesstabbing" value="false" /&gt;&lt;param name="allowFullScreen" value="true" /&gt;&lt;param name="swLiveConnect" value="true" /&gt;&lt;param name="allowScriptAccess" value="always" /&gt;&lt;embed src="http://c.brightcove.com/services/viewer/federated_f9/1640183659?isVid=1&amp;publisherID=1460825906" bgcolor="#FFFFFF" flashVars="videoId=25314279001&amp;playerID=1640183659&amp;domain=embed&amp;" base="http://admin.brightcove.com" name="flashObj" width="486" height="322" seamlesstabbing="false" type="application/x-shockwave-flash" allowFullScreen="true" swLiveConnect="true" allowScriptAccess="always" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7316847079866971282-5169774237729437132?l=java-servlet-jsp-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java-servlet-jsp-web.blogspot.com/feeds/5169774237729437132/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/06/ibm-and-microsoft-javaone-2009.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/5169774237729437132'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/5169774237729437132'/><link rel='alternate' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/06/ibm-and-microsoft-javaone-2009.html' title='IBM and Microsoft @ JavaOne 2009'/><author><name>Santhosh Reddy</name><uri>http://www.blogger.com/profile/05232963292855488994</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_P0JbJW7kyKo/ShZkH-FOe4I/AAAAAAAAHP0/ogsB2X0vAMU/S220/IMG_0305.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7316847079866971282.post-975582450846780210</id><published>2009-06-04T19:03:00.005+05:30</published><updated>2009-06-10T12:20:00.589+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='JavaOne 2009'/><category scheme='http://www.blogger.com/atom/ns#' term='OpenSolaris'/><title type='text'>JavaOne 2009 - Open Solaris 2009.06</title><content type='html'>One of the successful and awaiting event of Sun, JavaOne, started this year's event on 2-Jun-2009.&lt;br /&gt;&lt;br /&gt;You don't have to be in San Francisco to join in at CommunityOne and JavaOne -- all you have to do is keep returning to this page as this important week goes on and catch up on all the news, technology briefings, and excitement. And even if you're on the scene there will be events you miss, but you can catch up with them right here, along with on-the-floor interviews with attendees, Java Rockstars, luminaries, and just folks attending the show.&lt;br /&gt;&lt;br /&gt;Here is the update on OpenSolaris 2009.06&lt;br /&gt;&lt;strong&gt;What's new with OpenSolaris 2009.06&lt;/strong&gt;&lt;br /&gt;&lt;object id="flashObj" width="486" height="322" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,47,0"&gt;&lt;param name="movie" value="http://c.brightcove.com/services/viewer/federated_f9/1640183659?isVid=1&amp;publisherID=1460825906" /&gt;&lt;param name="bgcolor" value="#FFFFFF" /&gt;&lt;param name="flashVars" value="videoId=24938869001&amp;playerID=1640183659&amp;domain=embed&amp;" /&gt;&lt;param name="base" value="http://admin.brightcove.com" /&gt;&lt;param name="seamlesstabbing" value="false" /&gt;&lt;param name="allowFullScreen" value="true" /&gt;&lt;param name="swLiveConnect" value="true" /&gt;&lt;param name="allowScriptAccess" value="always" /&gt;&lt;embed src="http://c.brightcove.com/services/viewer/federated_f9/1640183659?isVid=1&amp;publisherID=1460825906" bgcolor="#FFFFFF" flashVars="videoId=24938869001&amp;playerID=1640183659&amp;domain=embed&amp;" base="http://admin.brightcove.com" name="flashObj" width="486" height="322" seamlesstabbing="false" type="application/x-shockwave-flash" allowFullScreen="true" swLiveConnect="true" allowScriptAccess="always" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Open Networking - OpenSolaris 2009.06&lt;/strong&gt;&lt;br /&gt;&lt;object id="flashObj" width="486" height="322" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,47,0"&gt;&lt;param name="movie" value="http://c.brightcove.com/services/viewer/federated_f9/1640183659?isVid=1&amp;publisherID=1460825906" /&gt;&lt;param name="bgcolor" value="#FFFFFF" /&gt;&lt;param name="flashVars" value="videoId=24939865001&amp;playerID=1640183659&amp;domain=embed&amp;" /&gt;&lt;param name="base" value="http://admin.brightcove.com" /&gt;&lt;param name="seamlesstabbing" value="false" /&gt;&lt;param name="allowFullScreen" value="true" /&gt;&lt;param name="swLiveConnect" value="true" /&gt;&lt;param name="allowScriptAccess" value="always" /&gt;&lt;embed src="http://c.brightcove.com/services/viewer/federated_f9/1640183659?isVid=1&amp;publisherID=1460825906" bgcolor="#FFFFFF" flashVars="videoId=24939865001&amp;playerID=1640183659&amp;domain=embed&amp;" base="http://admin.brightcove.com" name="flashObj" width="486" height="322" seamlesstabbing="false" type="application/x-shockwave-flash" allowFullScreen="true" swLiveConnect="true" allowScriptAccess="always" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;OpenSolaris 2009.06 overview&lt;/strong&gt;&lt;br /&gt;&lt;object id="flashObj" width="486" height="322" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,47,0"&gt;&lt;param name="movie" value="http://c.brightcove.com/services/viewer/federated_f9/1640183659?isVid=1&amp;publisherID=1460825906" /&gt;&lt;param name="bgcolor" value="#FFFFFF" /&gt;&lt;param name="flashVars" value="videoId=24573586001&amp;playerID=1640183659&amp;domain=embed&amp;" /&gt;&lt;param name="base" value="http://admin.brightcove.com" /&gt;&lt;param name="seamlesstabbing" value="false" /&gt;&lt;param name="allowFullScreen" value="true" /&gt;&lt;param name="swLiveConnect" value="true" /&gt;&lt;param name="allowScriptAccess" value="always" /&gt;&lt;embed src="http://c.brightcove.com/services/viewer/federated_f9/1640183659?isVid=1&amp;publisherID=1460825906" bgcolor="#FFFFFF" flashVars="videoId=24573586001&amp;playerID=1640183659&amp;domain=embed&amp;" base="http://admin.brightcove.com" name="flashObj" width="486" height="322" seamlesstabbing="false" type="application/x-shockwave-flash" allowFullScreen="true" swLiveConnect="true" allowScriptAccess="always" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Open Storage - ZFS for the Datacenter&lt;/strong&gt;&lt;br /&gt;&lt;object id="flashObj" width="486" height="322" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,47,0"&gt;&lt;param name="movie" value="http://c.brightcove.com/services/viewer/federated_f9/1640183659?isVid=1&amp;publisherID=1460825906" /&gt;&lt;param name="bgcolor" value="#FFFFFF" /&gt;&lt;param name="flashVars" value="videoId=24939913001&amp;playerID=1640183659&amp;domain=embed&amp;" /&gt;&lt;param name="base" value="http://admin.brightcove.com" /&gt;&lt;param name="seamlesstabbing" value="false" /&gt;&lt;param name="allowFullScreen" value="true" /&gt;&lt;param name="swLiveConnect" value="true" /&gt;&lt;param name="allowScriptAccess" value="always" /&gt;&lt;embed src="http://c.brightcove.com/services/viewer/federated_f9/1640183659?isVid=1&amp;publisherID=1460825906" bgcolor="#FFFFFF" flashVars="videoId=24939913001&amp;playerID=1640183659&amp;domain=embed&amp;" base="http://admin.brightcove.com" name="flashObj" width="486" height="322" seamlesstabbing="false" type="application/x-shockwave-flash" allowFullScreen="true" swLiveConnect="true" allowScriptAccess="always" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Flash technology on Storage&lt;/strong&gt;&lt;br /&gt;&lt;object id="flashObj" width="486" height="322" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,47,0"&gt;&lt;param name="movie" value="http://c.brightcove.com/services/viewer/federated_f9/1640183659?isVid=1&amp;publisherID=1460825906" /&gt;&lt;param name="bgcolor" value="#FFFFFF" /&gt;&lt;param name="flashVars" value="videoId=24938919001&amp;playerID=1640183659&amp;domain=embed&amp;" /&gt;&lt;param name="base" value="http://admin.brightcove.com" /&gt;&lt;param name="seamlesstabbing" value="false" /&gt;&lt;param name="allowFullScreen" value="true" /&gt;&lt;param name="swLiveConnect" value="true" /&gt;&lt;param name="allowScriptAccess" value="always" /&gt;&lt;embed src="http://c.brightcove.com/services/viewer/federated_f9/1640183659?isVid=1&amp;publisherID=1460825906" bgcolor="#FFFFFF" flashVars="videoId=24938919001&amp;playerID=1640183659&amp;domain=embed&amp;" base="http://admin.brightcove.com" name="flashObj" width="486" height="322" seamlesstabbing="false" type="application/x-shockwave-flash" allowFullScreen="true" swLiveConnect="true" allowScriptAccess="always" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7316847079866971282-975582450846780210?l=java-servlet-jsp-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java-servlet-jsp-web.blogspot.com/feeds/975582450846780210/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/06/javaone-2009-open-solaris-200906.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/975582450846780210'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/975582450846780210'/><link rel='alternate' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/06/javaone-2009-open-solaris-200906.html' title='JavaOne 2009 - Open Solaris 2009.06'/><author><name>Santhosh Reddy</name><uri>http://www.blogger.com/profile/05232963292855488994</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_P0JbJW7kyKo/ShZkH-FOe4I/AAAAAAAAHP0/ogsB2X0vAMU/S220/IMG_0305.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7316847079866971282.post-3449513862241616228</id><published>2009-06-04T18:38:00.003+05:30</published><updated>2009-06-10T12:20:24.973+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='JavaOne 2009'/><category scheme='http://www.blogger.com/atom/ns#' term='Sony Ericsson'/><title type='text'>Being Unique with Sony Ericsson - JavaOne 2009</title><content type='html'>One of the successful and awaiting event of Sun, JavaOne, started this year's event on 2-Jun-2009.&lt;br /&gt;&lt;br /&gt;You don't have to be in San Francisco to join in at CommunityOne and JavaOne -- all you have to do is keep returning to this page as this important week goes on and catch up on all the news, technology briefings, and excitement. And even if you're on the scene there will be events you miss, but you can catch up with them right here, along with on-the-floor interviews with attendees, Java Rockstars, luminaries, and just folks attending the show.&lt;br /&gt;&lt;br /&gt;Here are the JavaOne videos on "Being Unique with Sony Ericsson".&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Chapter 1: Being Unique with Sony Ericsson - JavaOne 2009&lt;/strong&gt;&lt;br /&gt;&lt;object id="flashObj" width="486" height="322" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,47,0"&gt;&lt;param name="movie" value="http://c.brightcove.com/services/viewer/federated_f9/1640183659?isVid=1&amp;publisherID=1460825906" /&gt;&lt;param name="bgcolor" value="#FFFFFF" /&gt;&lt;param name="flashVars" value="videoId=25196507001&amp;playerID=1640183659&amp;domain=embed&amp;" /&gt;&lt;param name="base" value="http://admin.brightcove.com" /&gt;&lt;param name="seamlesstabbing" value="false" /&gt;&lt;param name="allowFullScreen" value="true" /&gt;&lt;param name="swLiveConnect" value="true" /&gt;&lt;param name="allowScriptAccess" value="always" /&gt;&lt;embed src="http://c.brightcove.com/services/viewer/federated_f9/1640183659?isVid=1&amp;publisherID=1460825906" bgcolor="#FFFFFF" flashVars="videoId=25196507001&amp;playerID=1640183659&amp;domain=embed&amp;" base="http://admin.brightcove.com" name="flashObj" width="486" height="322" seamlesstabbing="false" type="application/x-shockwave-flash" allowFullScreen="true" swLiveConnect="true" allowScriptAccess="always" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Chapter 2: Being Unique with Sony Ericsson - JavaOne 2009&lt;/strong&gt;&lt;br /&gt;&lt;object id="flashObj" width="486" height="322" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,47,0"&gt;&lt;param name="movie" value="http://c.brightcove.com/services/viewer/federated_f9/1640183659?isVid=1&amp;publisherID=1460825906" /&gt;&lt;param name="bgcolor" value="#FFFFFF" /&gt;&lt;param name="flashVars" value="videoId=25188366001&amp;playerID=1640183659&amp;domain=embed&amp;" /&gt;&lt;param name="base" value="http://admin.brightcove.com" /&gt;&lt;param name="seamlesstabbing" value="false" /&gt;&lt;param name="allowFullScreen" value="true" /&gt;&lt;param name="swLiveConnect" value="true" /&gt;&lt;param name="allowScriptAccess" value="always" /&gt;&lt;embed src="http://c.brightcove.com/services/viewer/federated_f9/1640183659?isVid=1&amp;publisherID=1460825906" bgcolor="#FFFFFF" flashVars="videoId=25188366001&amp;playerID=1640183659&amp;domain=embed&amp;" base="http://admin.brightcove.com" name="flashObj" width="486" height="322" seamlesstabbing="false" type="application/x-shockwave-flash" allowFullScreen="true" swLiveConnect="true" allowScriptAccess="always" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7316847079866971282-3449513862241616228?l=java-servlet-jsp-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java-servlet-jsp-web.blogspot.com/feeds/3449513862241616228/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/06/being-unique-with-sony-ericsson-javaone.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/3449513862241616228'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/3449513862241616228'/><link rel='alternate' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/06/being-unique-with-sony-ericsson-javaone.html' title='Being Unique with Sony Ericsson - JavaOne 2009'/><author><name>Santhosh Reddy</name><uri>http://www.blogger.com/profile/05232963292855488994</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_P0JbJW7kyKo/ShZkH-FOe4I/AAAAAAAAHP0/ogsB2X0vAMU/S220/IMG_0305.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7316847079866971282.post-6555352540733948831</id><published>2009-06-04T18:26:00.004+05:30</published><updated>2009-06-10T12:19:33.164+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='JavaOne 2009'/><category scheme='http://www.blogger.com/atom/ns#' term='Java Mobile'/><category scheme='http://www.blogger.com/atom/ns#' term='Java TV'/><title type='text'>Your Java Lifestyle: Mobile, TV and Beyond - JavaOne 2009</title><content type='html'>One of the successful and awaiting event of Sun, JavaOne, started this year's event on 2-Jun-2009.&lt;br /&gt;&lt;br /&gt;You don't have to be in San Francisco to join in at CommunityOne and JavaOne -- all you have to do is keep returning to this page as this important week goes on and catch up on all the news, technology briefings, and excitement. And even if you're on the scene there will be events you miss, but you can catch up with them right here, along with on-the-floor interviews with attendees, Java Rockstars, luminaries, and just folks attending the show.&lt;br /&gt;&lt;br /&gt;Everybody is interested on Mobile and TV technologies and the market is going that way. Sun Microsystem is keep developing and improving the tools for mobile developments. Here are the videos on "Your Java lifestyle: Mobile, TV and Beyond" session&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Chapter 1 - Your Java Lifestyle: Mobile, TV and Beyond - JavaOne 2009&lt;/strong&gt;&lt;br /&gt;&lt;object id="flashObj" width="486" height="322" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,47,0"&gt;&lt;param name="movie" value="http://c.brightcove.com/services/viewer/federated_f9/1640183659?isVid=1&amp;publisherID=1460825906" /&gt;&lt;param name="bgcolor" value="#FFFFFF" /&gt;&lt;param name="flashVars" value="videoId=25227872001&amp;playerID=1640183659&amp;domain=embed&amp;" /&gt;&lt;param name="base" value="http://admin.brightcove.com" /&gt;&lt;param name="seamlesstabbing" value="false" /&gt;&lt;param name="allowFullScreen" value="true" /&gt;&lt;param name="swLiveConnect" value="true" /&gt;&lt;param name="allowScriptAccess" value="always" /&gt;&lt;embed src="http://c.brightcove.com/services/viewer/federated_f9/1640183659?isVid=1&amp;publisherID=1460825906" bgcolor="#FFFFFF" flashVars="videoId=25227872001&amp;playerID=1640183659&amp;domain=embed&amp;" base="http://admin.brightcove.com" name="flashObj" width="486" height="322" seamlesstabbing="false" type="application/x-shockwave-flash" allowFullScreen="true" swLiveConnect="true" allowScriptAccess="always" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Chapter 2 - Your Java Lifestyle: Mobile, TV and Beyond - JavaOne 2009&lt;/strong&gt;&lt;br /&gt;&lt;object id="flashObj" width="486" height="322" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,47,0"&gt;&lt;param name="movie" value="http://c.brightcove.com/services/viewer/federated_f9/1640183659?isVid=1&amp;publisherID=1460825906" /&gt;&lt;param name="bgcolor" value="#FFFFFF" /&gt;&lt;param name="flashVars" value="videoId=25240109001&amp;playerID=1640183659&amp;domain=embed&amp;" /&gt;&lt;param name="base" value="http://admin.brightcove.com" /&gt;&lt;param name="seamlesstabbing" value="false" /&gt;&lt;param name="allowFullScreen" value="true" /&gt;&lt;param name="swLiveConnect" value="true" /&gt;&lt;param name="allowScriptAccess" value="always" /&gt;&lt;embed src="http://c.brightcove.com/services/viewer/federated_f9/1640183659?isVid=1&amp;publisherID=1460825906" bgcolor="#FFFFFF" flashVars="videoId=25240109001&amp;playerID=1640183659&amp;domain=embed&amp;" base="http://admin.brightcove.com" name="flashObj" width="486" height="322" seamlesstabbing="false" type="application/x-shockwave-flash" allowFullScreen="true" swLiveConnect="true" allowScriptAccess="always" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7316847079866971282-6555352540733948831?l=java-servlet-jsp-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java-servlet-jsp-web.blogspot.com/feeds/6555352540733948831/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/06/your-java-lifestyle-mobile-tv-and.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/6555352540733948831'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/6555352540733948831'/><link rel='alternate' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/06/your-java-lifestyle-mobile-tv-and.html' title='Your Java Lifestyle: Mobile, TV and Beyond - JavaOne 2009'/><author><name>Santhosh Reddy</name><uri>http://www.blogger.com/profile/05232963292855488994</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_P0JbJW7kyKo/ShZkH-FOe4I/AAAAAAAAHP0/ogsB2X0vAMU/S220/IMG_0305.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7316847079866971282.post-906844518314684699</id><published>2009-06-04T15:56:00.005+05:30</published><updated>2009-06-10T12:23:25.869+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='JavaOne 2009'/><category scheme='http://www.blogger.com/atom/ns#' term='Duke&apos;s Choice Awards 2009'/><title type='text'>Duke's Choice Awards Winners for 2009</title><content type='html'>Each year, the Duke's Choice awards committee invites Java community members to nominate the best and most innovative use of Java technology for recognition. The leadership team -- including James Gosling, known as the father of Java technology -- selects the winners based on the creativity of the Java technology-based applications and services. Now in its seventh year, the committee recognizes the winners of the 2009 Duke's Choice awards for their cool tools, technologies, and products.&lt;br /&gt;&lt;br /&gt;This year, the committee gave out 10 awards in the following categories:&lt;br /&gt;1. Lifetime Achievement Award: Gold Duke&lt;br /&gt;2. Best Desktop Game&lt;br /&gt;3. Java Everywhere!&lt;br /&gt;4. Java Technology for Developer Solutions&lt;br /&gt;5. Java Technology in Education&lt;br /&gt;6. Java Technology for the Environment&lt;br /&gt;7. Java Technology in Network Solutions&lt;br /&gt;8. Java Technology for the Open-Source Community&lt;br /&gt;9. Java Technology Tools&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;1. Lifetime Achievement Award: Gold Duke&lt;/strong&gt;&lt;br /&gt;&lt;a href="http://www.lincvolt.com/" target="_blank"&gt;LincVolt, Perrone Robotics&lt;/a&gt;&lt;br /&gt;At 19.5 feet and weighing 2.5 tons, the 1959 Lincoln Continental convertible is the leader in innovation when it comes to new ways to fuel a car. The LincVolt Car seeks to create clean automobile propulsion technology and eliminate roadside refueling entirely. This inspiring project is powered by some of the most respected technologies including Java software. Perrone Robotics is the force behind this unprecedented concept and and is dedicated to creating robotics technology for use across platforms and software by leveraging open-source technologies. Check out the LincVolt Car in the Change (Y)our World Playground at the JavaOne conference.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;2. Best Desktop Game&lt;/strong&gt;&lt;br /&gt;&lt;a href="http://www.jagex.com/" target="_blank"&gt;Runescape, Jagex, Ltd.&lt;/a&gt;&lt;br /&gt;Jagex, Ltd. has become a leader in the online video games industry, with the creation of one of the world's largest massively multiplayer online games (MMOG), Runescape. Since its launch in 2001, Runescape has become one of the largest MMOGs globally and just completed an engine upgrade to enable HD gaming. As well, Jagex, Ltd. has launched the FunOrb.com games portal, which brings fantastic Java technology-based games across all genres to consumers.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;3. Java Everywhere!&lt;/strong&gt;&lt;br /&gt;&lt;a href="http://www.terracotta.org/web/display/orgsite/Whats+New+Terracotta+3.0" target="_blank"&gt;Terracotta 3.0&lt;/a&gt; &lt;br /&gt;Terracotta 3.0 provides an inexpensive and easy way to scale a Java technology-based application to as many computers as needed for simultaneous high availability and scalability. Because the development time is reduced, Terracotta significantly lowers the operational and capital cost required to support web applications. Terracotta 3.0 is in use across numerous markets such as travel, gaming, financial services, communications, health services, and social networking. Because Terracotta uses Java technology, if you know Java, then you know Terracotta.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;4. Java Technology for Developer Solutions&lt;/strong&gt;&lt;br /&gt;&lt;a href="http://www.reportmill.com/" target="_blank"&gt;DataBox, ReportMill Software, Inc.&lt;/a&gt; &lt;br /&gt;DataBox, from ReportMill Software, is an instant Java application builder and provides everything you need to easily build and deploy Java technology-based applications. From creating database tables to designing application forms and reports, DataBox is capable of deploying an applet in any browser. With DataBox, development that usually requires multiple tools, a broad range of skills, and a substantial amount of time can now be accomplished quickly.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;5. Java Technology in Education&lt;/strong&gt;&lt;br /&gt;&lt;a href="http://www.alice.org/" target="_blank"&gt;Alice 3, Carnegie Mellon University&lt;/a&gt;&lt;br /&gt;Created by students at Carnegie Mellon University, Alice is a one-of-a-kind program that helps kids learn the complete Java programming language and syntax while having fun doing it. The 3-D animation provides a natural program visualization, which aids students in understanding the execution of programming as well as catching logical errors that may arise. Assets from The Sims 2.0, donated by Electronic Arts, provide characters, scenery, and high-level animations for students to create movies and games as a motivating context and a dynamic experience. Visit the Carnegie Mellon team in the Change (Y)our World Playground at the JavaOne conference.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;6. Java Technology in Education&lt;/strong&gt;&lt;br /&gt;&lt;a href="http://www.wpi.edu/" target="_blank"&gt;Worcester Polytechnic Institute&lt;/a&gt; &lt;br /&gt;Worcester Polytechnic Institute (WPI), one of the oldest and leading technological institutions in the United States, seeks to apply the knowledge learned in the classroom to impact society and improve the lives of others. It is the mission of WPI faculty to educate talented students to create, discover, and convey knowledge to everyone and show how it may be useful in everyday life. With the use of open-source software such as Java technology and the NetBeans IDE, WPI has done just that with the FIRST Robotics competition, which is designed to help high school-aged young people discover how interesting and rewarding the life of engineering can be.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;7. Java Technology for the Environment&lt;/strong&gt;&lt;br /&gt;&lt;a href="http://www.sealite.com.au/" target="_blank"&gt;Unique GSM Modules With Java Technology, Sealite Company&lt;/a&gt;&lt;br /&gt;Sealite Company creates products that require low levels of power, use solar energy, and often need little to no maintenance. Sealite's most notable creation is a unique GSM cell phone-based monitoring and alarm system with Java technology. This system allows users to monitor marine lanterns fitted with specific SIM cards, each with a designated number, and to check on the lanterns without ever leaving shore. The GSM monitoring and alarm system provides real-time information from anywhere around the globe. This low-cost and internally integrated system reduces maintenance and servicing costs, and improves marine safety.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;8. Java Technology in Network Solutions&lt;/strong&gt;&lt;br /&gt;&lt;a href="http://www.ndsatcom.com/en/" target="_blank"&gt;The NetBeans Satellite Tracking System, ND SatCom Network Management Systems&lt;/a&gt;&lt;br /&gt;With over 25 years of experience in the satellite networks and systems business, ND SatCom has grown to become one of the leading companies in its field. ND SatCom's Network Management System for defense networks, consisting of 1116 NetBeans Platform modules, is based on an open and hierarchical architecture according to international standards. The system-management module performs network planning, resource management, and configuration management on the system level, where the system can consist of several networks. The NetBeans satellite tracking system is built with about 1 million lines of manual code, 3.5 million lines of generated Java code, more than 100,000 lines of C++ code for device communication, and more than 1000 NetBeans modules.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;9. Java Technology for the Open-Source Community&lt;/strong&gt;&lt;br /&gt;&lt;a href="http://www.mifos.org/" target="_blank"&gt;Mifos&lt;/a&gt;&lt;br /&gt;Web-based management information system Mifos leverages a centralized open-source technology platform to help microfinance institutions (MFIs) effectively deliver financial services to the poor and fight against global poverty. To reach the billions in need of financial services, MFIs need a reliable and scalable system -- enter the Java SE 6 platform. As a robust and mature programming language with a loyal and knowledgeable community of developers worldwide, Java SE 6 aids Mifos in the building of a community-driven platform that enables technology to empower the poor to lift themselves out of poverty. Mifos chose open-source technology because of the community of involved individuals who participate, collaborate, create, and adapt, while also providing room for transparency, quality, flexibility and longevity.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;10. Java Technology Tools&lt;/strong&gt;&lt;br /&gt;&lt;a href="http://www.atlassian.com/software/clover/" target="_blank"&gt;Clover, Atlassian&lt;/a&gt;&lt;br /&gt;Clover is a Java code coverage tool with test-level insight, instant IDE feedback, interactive reports, and test optimization. More than just a coverage percentage, Clover provides insight into user testing by identifying project risks and quick wins. Clover identifies specific tests to cover various lines of code and automatically identifies which tests to run to cover the particular changes made. And because of the IDE integration, you can harness all the power of the Clover test insight without ever leaving your workbench.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7316847079866971282-906844518314684699?l=java-servlet-jsp-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java-servlet-jsp-web.blogspot.com/feeds/906844518314684699/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/06/dukes-choice-awards-winners-for-2009.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/906844518314684699'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/906844518314684699'/><link rel='alternate' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/06/dukes-choice-awards-winners-for-2009.html' title='Duke&apos;s Choice Awards Winners for 2009'/><author><name>Santhosh Reddy</name><uri>http://www.blogger.com/profile/05232963292855488994</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_P0JbJW7kyKo/ShZkH-FOe4I/AAAAAAAAHP0/ogsB2X0vAMU/S220/IMG_0305.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7316847079866971282.post-2804447047986870020</id><published>2009-06-03T22:54:00.006+05:30</published><updated>2009-06-10T12:24:27.598+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Sun Open Cloud'/><category scheme='http://www.blogger.com/atom/ns#' term='JavaOne 2009'/><category scheme='http://www.blogger.com/atom/ns#' term='CommunityOne'/><title type='text'>CommunityOne welcome sessions, Sun Open Cloud Platform, and A look inside the Sun Cloud</title><content type='html'>One of the successful and awaiting event of Sun, JavaOne, started this year's event today. &lt;br /&gt;&lt;br /&gt;You don't have to be in San Francisco to join in at CommunityOne and JavaOne -- all you have to do is keep returning to this page as this important week goes on and catch up on all the news, technology briefings, and excitement. And even if you're on the scene there will be events you miss, but you can catch up with them right here, along with on-the-floor interviews with attendees, Java Rockstars, luminaries, and just folks attending the show.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Welcome to CommunityOne general session&lt;/strong&gt;&lt;br /&gt;&lt;object id="flashObj" width="486" height="322" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,47,0"&gt;&lt;param name="movie" value="http://c.brightcove.com/services/viewer/federated_f9/1640183659?isVid=1&amp;publisherID=1460825906" /&gt;&lt;param name="bgcolor" value="#FFFFFF" /&gt;&lt;param name="flashVars" value="videoId=24939845001&amp;playerID=1640183659&amp;domain=embed&amp;" /&gt;&lt;param name="base" value="http://admin.brightcove.com" /&gt;&lt;param name="seamlesstabbing" value="false" /&gt;&lt;param name="allowFullScreen" value="true" /&gt;&lt;param name="swLiveConnect" value="true" /&gt;&lt;param name="allowScriptAccess" value="always" /&gt;&lt;embed src="http://c.brightcove.com/services/viewer/federated_f9/1640183659?isVid=1&amp;publisherID=1460825906" bgcolor="#FFFFFF" flashVars="videoId=24939845001&amp;playerID=1640183659&amp;domain=embed&amp;" base="http://admin.brightcove.com" name="flashObj" width="486" height="322" seamlesstabbing="false" type="application/x-shockwave-flash" allowFullScreen="true" swLiveConnect="true" allowScriptAccess="always" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Sun Open Cloud Platform&lt;/strong&gt;&lt;br /&gt;&lt;object id="flashObj" width="486" height="322" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,47,0"&gt;&lt;param name="movie" value="http://c.brightcove.com/services/viewer/federated_f9/1640183659?isVid=1&amp;publisherID=1460825906" /&gt;&lt;param name="bgcolor" value="#FFFFFF" /&gt;&lt;param name="flashVars" value="videoId=24939850001&amp;playerID=1640183659&amp;domain=embed&amp;" /&gt;&lt;param name="base" value="http://admin.brightcove.com" /&gt;&lt;param name="seamlesstabbing" value="false" /&gt;&lt;param name="allowFullScreen" value="true" /&gt;&lt;param name="swLiveConnect" value="true" /&gt;&lt;param name="allowScriptAccess" value="always" /&gt;&lt;embed src="http://c.brightcove.com/services/viewer/federated_f9/1640183659?isVid=1&amp;publisherID=1460825906" bgcolor="#FFFFFF" flashVars="videoId=24939850001&amp;playerID=1640183659&amp;domain=embed&amp;" base="http://admin.brightcove.com" name="flashObj" width="486" height="322" seamlesstabbing="false" type="application/x-shockwave-flash" allowFullScreen="true" swLiveConnect="true" allowScriptAccess="always" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Sun Cloud EchoSystem: MoonWalk, Vertica&lt;/strong&gt;&lt;br /&gt;&lt;object id="flashObj" width="486" height="322" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,47,0"&gt;&lt;param name="movie" value="http://c.brightcove.com/services/viewer/federated_f9/1640183659?isVid=1&amp;publisherID=1460825906" /&gt;&lt;param name="bgcolor" value="#FFFFFF" /&gt;&lt;param name="flashVars" value="videoId=24939854001&amp;playerID=1640183659&amp;domain=embed&amp;" /&gt;&lt;param name="base" value="http://admin.brightcove.com" /&gt;&lt;param name="seamlesstabbing" value="false" /&gt;&lt;param name="allowFullScreen" value="true" /&gt;&lt;param name="swLiveConnect" value="true" /&gt;&lt;param name="allowScriptAccess" value="always" /&gt;&lt;embed src="http://c.brightcove.com/services/viewer/federated_f9/1640183659?isVid=1&amp;publisherID=1460825906" bgcolor="#FFFFFF" flashVars="videoId=24939854001&amp;playerID=1640183659&amp;domain=embed&amp;" base="http://admin.brightcove.com" name="flashObj" width="486" height="322" seamlesstabbing="false" type="application/x-shockwave-flash" allowFullScreen="true" swLiveConnect="true" allowScriptAccess="always" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Sun Cloud computing update&lt;/strong&gt;&lt;br /&gt;&lt;object id="flashObj" width="486" height="322" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,47,0"&gt;&lt;param name="movie" value="http://c.brightcove.com/services/viewer/federated_f9/1640183659?isVid=1&amp;publisherID=1460825906" /&gt;&lt;param name="bgcolor" value="#FFFFFF" /&gt;&lt;param name="flashVars" value="videoId=24939855001&amp;playerID=1640183659&amp;domain=embed&amp;" /&gt;&lt;param name="base" value="http://admin.brightcove.com" /&gt;&lt;param name="seamlesstabbing" value="false" /&gt;&lt;param name="allowFullScreen" value="true" /&gt;&lt;param name="swLiveConnect" value="true" /&gt;&lt;param name="allowScriptAccess" value="always" /&gt;&lt;embed src="http://c.brightcove.com/services/viewer/federated_f9/1640183659?isVid=1&amp;publisherID=1460825906" bgcolor="#FFFFFF" flashVars="videoId=24939855001&amp;playerID=1640183659&amp;domain=embed&amp;" base="http://admin.brightcove.com" name="flashObj" width="486" height="322" seamlesstabbing="false" type="application/x-shockwave-flash" allowFullScreen="true" swLiveConnect="true" allowScriptAccess="always" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;A look inside the Sun Cloud&lt;/strong&gt;&lt;br /&gt;&lt;object id="flashObj" width="486" height="322" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,47,0"&gt;&lt;param name="movie" value="http://c.brightcove.com/services/viewer/federated_f9/1640183659?isVid=1&amp;publisherID=1460825906" /&gt;&lt;param name="bgcolor" value="#FFFFFF" /&gt;&lt;param name="flashVars" value="videoId=24586081001&amp;playerID=1640183659&amp;domain=embed&amp;" /&gt;&lt;param name="base" value="http://admin.brightcove.com" /&gt;&lt;param name="seamlesstabbing" value="false" /&gt;&lt;param name="allowFullScreen" value="true" /&gt;&lt;param name="swLiveConnect" value="true" /&gt;&lt;param name="allowScriptAccess" value="always" /&gt;&lt;embed src="http://c.brightcove.com/services/viewer/federated_f9/1640183659?isVid=1&amp;publisherID=1460825906" bgcolor="#FFFFFF" flashVars="videoId=24586081001&amp;playerID=1640183659&amp;domain=embed&amp;" base="http://admin.brightcove.com" name="flashObj" width="486" height="322" seamlesstabbing="false" type="application/x-shockwave-flash" allowFullScreen="true" swLiveConnect="true" allowScriptAccess="always" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7316847079866971282-2804447047986870020?l=java-servlet-jsp-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java-servlet-jsp-web.blogspot.com/feeds/2804447047986870020/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/06/communityone-welcome-sessions-and-sun.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/2804447047986870020'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/2804447047986870020'/><link rel='alternate' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/06/communityone-welcome-sessions-and-sun.html' title='CommunityOne welcome sessions, Sun Open Cloud Platform, and A look inside the Sun Cloud'/><author><name>Santhosh Reddy</name><uri>http://www.blogger.com/profile/05232963292855488994</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_P0JbJW7kyKo/ShZkH-FOe4I/AAAAAAAAHP0/ogsB2X0vAMU/S220/IMG_0305.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7316847079866971282.post-8364955308479328881</id><published>2009-06-03T22:45:00.005+05:30</published><updated>2009-06-10T12:25:04.897+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='JavaOne 2009'/><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><title type='text'>JavaOne 2009 Opening General Sessions</title><content type='html'>One of the successful and awaiting event of Sun, JavaOne, started this year's event today. &lt;br /&gt;&lt;br /&gt;You don't have to be in San Francisco to join in at CommunityOne and JavaOne -- all you have to do is keep returning to this page as this important week goes on and catch up on all the news, technology briefings, and excitement. And even if you're on the scene there will be events you miss, but you can catch up with them right here, along with on-the-floor interviews with attendees, Java Rockstars, luminaries, and just folks attending the show.&lt;br /&gt;&lt;br /&gt;Here are the general session continuing after technical sessions.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;JavaOne 2009 Opening General Sessions - Chapter 1&lt;/strong&gt;&lt;br /&gt;&lt;object id="flashObj" width="486" height="322" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,47,0"&gt;&lt;param name="movie" value="http://c.brightcove.com/services/viewer/federated_f9/1640183659?isVid=1&amp;publisherID=1460825906" /&gt;&lt;param name="bgcolor" value="#FFFFFF" /&gt;&lt;param name="flashVars" value="videoId=25083232001&amp;playerID=1640183659&amp;domain=embed&amp;" /&gt;&lt;param name="base" value="http://admin.brightcove.com" /&gt;&lt;param name="seamlesstabbing" value="false" /&gt;&lt;param name="allowFullScreen" value="true" /&gt;&lt;param name="swLiveConnect" value="true" /&gt;&lt;param name="allowScriptAccess" value="always" /&gt;&lt;embed src="http://c.brightcove.com/services/viewer/federated_f9/1640183659?isVid=1&amp;publisherID=1460825906" bgcolor="#FFFFFF" flashVars="videoId=25083232001&amp;playerID=1640183659&amp;domain=embed&amp;" base="http://admin.brightcove.com" name="flashObj" width="486" height="322" seamlesstabbing="false" type="application/x-shockwave-flash" allowFullScreen="true" swLiveConnect="true" allowScriptAccess="always" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;JavaOne 2009 Opening General Sessions - Chapter 2&lt;/strong&gt;&lt;br /&gt;&lt;object id="flashObj" width="486" height="322" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,47,0"&gt;&lt;param name="movie" value="http://c.brightcove.com/services/viewer/federated_f9/1640183659?isVid=1&amp;publisherID=1460825906" /&gt;&lt;param name="bgcolor" value="#FFFFFF" /&gt;&lt;param name="flashVars" value="videoId=25089918001&amp;playerID=1640183659&amp;domain=embed&amp;" /&gt;&lt;param name="base" value="http://admin.brightcove.com" /&gt;&lt;param name="seamlesstabbing" value="false" /&gt;&lt;param name="allowFullScreen" value="true" /&gt;&lt;param name="swLiveConnect" value="true" /&gt;&lt;param name="allowScriptAccess" value="always" /&gt;&lt;embed src="http://c.brightcove.com/services/viewer/federated_f9/1640183659?isVid=1&amp;publisherID=1460825906" bgcolor="#FFFFFF" flashVars="videoId=25089918001&amp;playerID=1640183659&amp;domain=embed&amp;" base="http://admin.brightcove.com" name="flashObj" width="486" height="322" seamlesstabbing="false" type="application/x-shockwave-flash" allowFullScreen="true" swLiveConnect="true" allowScriptAccess="always" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;JavaOne 2009 Opening General Sessions - Chapter 3&lt;/strong&gt;&lt;br /&gt;&lt;object id="flashObj" width="486" height="322" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,47,0"&gt;&lt;param name="movie" value="http://c.brightcove.com/services/viewer/federated_f9/1640183659?isVid=1&amp;publisherID=1460825906" /&gt;&lt;param name="bgcolor" value="#FFFFFF" /&gt;&lt;param name="flashVars" value="videoId=25083239001&amp;playerID=1640183659&amp;domain=embed&amp;" /&gt;&lt;param name="base" value="http://admin.brightcove.com" /&gt;&lt;param name="seamlesstabbing" value="false" /&gt;&lt;param name="allowFullScreen" value="true" /&gt;&lt;param name="swLiveConnect" value="true" /&gt;&lt;param name="allowScriptAccess" value="always" /&gt;&lt;embed src="http://c.brightcove.com/services/viewer/federated_f9/1640183659?isVid=1&amp;publisherID=1460825906" bgcolor="#FFFFFF" flashVars="videoId=25083239001&amp;playerID=1640183659&amp;domain=embed&amp;" base="http://admin.brightcove.com" name="flashObj" width="486" height="322" seamlesstabbing="false" type="application/x-shockwave-flash" allowFullScreen="true" swLiveConnect="true" allowScriptAccess="always" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;JavaOne 2009 Opening General Sessions - Chapter 4&lt;/strong&gt;&lt;br /&gt;&lt;object id="flashObj" width="486" height="322" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,47,0"&gt;&lt;param name="movie" value="http://c.brightcove.com/services/viewer/federated_f9/1640183659?isVid=1&amp;publisherID=1460825906" /&gt;&lt;param name="bgcolor" value="#FFFFFF" /&gt;&lt;param name="flashVars" value="videoId=25083240001&amp;playerID=1640183659&amp;domain=embed&amp;" /&gt;&lt;param name="base" value="http://admin.brightcove.com" /&gt;&lt;param name="seamlesstabbing" value="false" /&gt;&lt;param name="allowFullScreen" value="true" /&gt;&lt;param name="swLiveConnect" value="true" /&gt;&lt;param name="allowScriptAccess" value="always" /&gt;&lt;embed src="http://c.brightcove.com/services/viewer/federated_f9/1640183659?isVid=1&amp;publisherID=1460825906" bgcolor="#FFFFFF" flashVars="videoId=25083240001&amp;playerID=1640183659&amp;domain=embed&amp;" base="http://admin.brightcove.com" name="flashObj" width="486" height="322" seamlesstabbing="false" type="application/x-shockwave-flash" allowFullScreen="true" swLiveConnect="true" allowScriptAccess="always" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;JavaOne 2009 Opening General Sessions - Chapter 5&lt;/strong&gt;&lt;br /&gt;&lt;object id="flashObj" width="486" height="322" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,47,0"&gt;&lt;param name="movie" value="http://c.brightcove.com/services/viewer/federated_f9/1640183659?isVid=1&amp;publisherID=1460825906" /&gt;&lt;param name="bgcolor" value="#FFFFFF" /&gt;&lt;param name="flashVars" value="videoId=25089920001&amp;playerID=1640183659&amp;domain=embed&amp;" /&gt;&lt;param name="base" value="http://admin.brightcove.com" /&gt;&lt;param name="seamlesstabbing" value="false" /&gt;&lt;param name="allowFullScreen" value="true" /&gt;&lt;param name="swLiveConnect" value="true" /&gt;&lt;param name="allowScriptAccess" value="always" /&gt;&lt;embed src="http://c.brightcove.com/services/viewer/federated_f9/1640183659?isVid=1&amp;publisherID=1460825906" bgcolor="#FFFFFF" flashVars="videoId=25089920001&amp;playerID=1640183659&amp;domain=embed&amp;" base="http://admin.brightcove.com" name="flashObj" width="486" height="322" seamlesstabbing="false" type="application/x-shockwave-flash" allowFullScreen="true" swLiveConnect="true" allowScriptAccess="always" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7316847079866971282-8364955308479328881?l=java-servlet-jsp-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java-servlet-jsp-web.blogspot.com/feeds/8364955308479328881/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/06/javaone-2009-opening-general-sessions.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/8364955308479328881'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/8364955308479328881'/><link rel='alternate' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/06/javaone-2009-opening-general-sessions.html' title='JavaOne 2009 Opening General Sessions'/><author><name>Santhosh Reddy</name><uri>http://www.blogger.com/profile/05232963292855488994</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_P0JbJW7kyKo/ShZkH-FOe4I/AAAAAAAAHP0/ogsB2X0vAMU/S220/IMG_0305.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7316847079866971282.post-3522249928830690912</id><published>2009-06-03T22:20:00.007+05:30</published><updated>2009-06-10T12:26:02.513+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='JavaOne 2009'/><title type='text'>JavaOne 2009 Sun Technical General Sessions</title><content type='html'>One of the successful and awaiting event of Sun, JavaOne, started this year's event today. &lt;br /&gt;&lt;br /&gt;You don't have to be in San Francisco to join in at CommunityOne and JavaOne -- all you have to do is keep returning to this page as this important week goes on and catch up on all the news, technology briefings, and excitement. And even if you're on the scene there will be events you miss, but you can catch up with them right here, along with on-the-floor interviews with attendees, Java Rockstars, luminaries, and just folks attending the show.&lt;br /&gt;&lt;br /&gt;Here is a video which will share Sun Technical general session.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;JavaOne '09 opening video - Justin&lt;/strong&gt;&lt;br /&gt;&lt;object id="flashObj" width="486" height="322" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,47,0"&gt;&lt;param name="movie" value="http://c.brightcove.com/services/viewer/federated_f9/1640183659?isVid=1&amp;publisherID=1460825906" /&gt;&lt;param name="bgcolor" value="#FFFFFF" /&gt;&lt;param name="flashVars" value="videoId=25079889001&amp;playerID=1640183659&amp;domain=embed&amp;" /&gt;&lt;param name="base" value="http://admin.brightcove.com" /&gt;&lt;param name="seamlesstabbing" value="false" /&gt;&lt;param name="allowFullScreen" value="true" /&gt;&lt;param name="swLiveConnect" value="true" /&gt;&lt;param name="allowScriptAccess" value="always" /&gt;&lt;embed src="http://c.brightcove.com/services/viewer/federated_f9/1640183659?isVid=1&amp;publisherID=1460825906" bgcolor="#FFFFFF" flashVars="videoId=25079889001&amp;playerID=1640183659&amp;domain=embed&amp;" base="http://admin.brightcove.com" name="flashObj" width="486" height="322" seamlesstabbing="false" type="application/x-shockwave-flash" allowFullScreen="true" swLiveConnect="true" allowScriptAccess="always" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Chapter 1:&lt;/strong&gt;&lt;br /&gt;&lt;object id="flashObj" width="486" height="322" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,47,0"&gt;&lt;param name="movie" value="http://c.brightcove.com/services/viewer/federated_f9/1640183659?isVid=1&amp;publisherID=1460825906" /&gt;&lt;param name="bgcolor" value="#FFFFFF" /&gt;&lt;param name="flashVars" value="videoId=25098328001&amp;playerID=1640183659&amp;domain=embed&amp;" /&gt;&lt;param name="base" value="http://admin.brightcove.com" /&gt;&lt;param name="seamlesstabbing" value="false" /&gt;&lt;param name="allowFullScreen" value="true" /&gt;&lt;param name="swLiveConnect" value="true" /&gt;&lt;param name="allowScriptAccess" value="always" /&gt;&lt;embed src="http://c.brightcove.com/services/viewer/federated_f9/1640183659?isVid=1&amp;publisherID=1460825906" bgcolor="#FFFFFF" flashVars="videoId=25098328001&amp;playerID=1640183659&amp;domain=embed&amp;" base="http://admin.brightcove.com" name="flashObj" width="486" height="322" seamlesstabbing="false" type="application/x-shockwave-flash" allowFullScreen="true" swLiveConnect="true" allowScriptAccess="always" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Chapter 2&lt;/strong&gt;&lt;br /&gt;&lt;object id="flashObj" width="486" height="322" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,47,0"&gt;&lt;param name="movie" value="http://c.brightcove.com/services/viewer/federated_f9/1640183659?isVid=1&amp;publisherID=1460825906" /&gt;&lt;param name="bgcolor" value="#FFFFFF" /&gt;&lt;param name="flashVars" value="videoId=25089975001&amp;playerID=1640183659&amp;domain=embed&amp;" /&gt;&lt;param name="base" value="http://admin.brightcove.com" /&gt;&lt;param name="seamlesstabbing" value="false" /&gt;&lt;param name="allowFullScreen" value="true" /&gt;&lt;param name="swLiveConnect" value="true" /&gt;&lt;param name="allowScriptAccess" value="always" /&gt;&lt;embed src="http://c.brightcove.com/services/viewer/federated_f9/1640183659?isVid=1&amp;publisherID=1460825906" bgcolor="#FFFFFF" flashVars="videoId=25089975001&amp;playerID=1640183659&amp;domain=embed&amp;" base="http://admin.brightcove.com" name="flashObj" width="486" height="322" seamlesstabbing="false" type="application/x-shockwave-flash" allowFullScreen="true" swLiveConnect="true" allowScriptAccess="always" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Chapter 3&lt;/strong&gt;&lt;br /&gt;&lt;object id="flashObj" width="486" height="322" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,47,0"&gt;&lt;param name="movie" value="http://c.brightcove.com/services/viewer/federated_f9/1640183659?isVid=1&amp;publisherID=1460825906" /&gt;&lt;param name="bgcolor" value="#FFFFFF" /&gt;&lt;param name="flashVars" value="videoId=25086864001&amp;playerID=1640183659&amp;domain=embed&amp;" /&gt;&lt;param name="base" value="http://admin.brightcove.com" /&gt;&lt;param name="seamlesstabbing" value="false" /&gt;&lt;param name="allowFullScreen" value="true" /&gt;&lt;param name="swLiveConnect" value="true" /&gt;&lt;param name="allowScriptAccess" value="always" /&gt;&lt;embed src="http://c.brightcove.com/services/viewer/federated_f9/1640183659?isVid=1&amp;publisherID=1460825906" bgcolor="#FFFFFF" flashVars="videoId=25086864001&amp;playerID=1640183659&amp;domain=embed&amp;" base="http://admin.brightcove.com" name="flashObj" width="486" height="322" seamlesstabbing="false" type="application/x-shockwave-flash" allowFullScreen="true" swLiveConnect="true" allowScriptAccess="always" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;JavaOne '09 Gosling and Java&lt;/strong&gt;&lt;br /&gt;&lt;object id="flashObj" width="486" height="322" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,47,0"&gt;&lt;param name="movie" value="http://c.brightcove.com/services/viewer/federated_f9/1640183659?isVid=1&amp;publisherID=1460825906" /&gt;&lt;param name="bgcolor" value="#FFFFFF" /&gt;&lt;param name="flashVars" value="videoId=25086796001&amp;playerID=1640183659&amp;domain=embed&amp;" /&gt;&lt;param name="base" value="http://admin.brightcove.com" /&gt;&lt;param name="seamlesstabbing" value="false" /&gt;&lt;param name="allowFullScreen" value="true" /&gt;&lt;param name="swLiveConnect" value="true" /&gt;&lt;param name="allowScriptAccess" value="always" /&gt;&lt;embed src="http://c.brightcove.com/services/viewer/federated_f9/1640183659?isVid=1&amp;publisherID=1460825906" bgcolor="#FFFFFF" flashVars="videoId=25086796001&amp;playerID=1640183659&amp;domain=embed&amp;" base="http://admin.brightcove.com" name="flashObj" width="486" height="322" seamlesstabbing="false" type="application/x-shockwave-flash" allowFullScreen="true" swLiveConnect="true" allowScriptAccess="always" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7316847079866971282-3522249928830690912?l=java-servlet-jsp-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java-servlet-jsp-web.blogspot.com/feeds/3522249928830690912/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/06/javaone-2009-sun-technical-general.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/3522249928830690912'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/3522249928830690912'/><link rel='alternate' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/06/javaone-2009-sun-technical-general.html' title='JavaOne 2009 Sun Technical General Sessions'/><author><name>Santhosh Reddy</name><uri>http://www.blogger.com/profile/05232963292855488994</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_P0JbJW7kyKo/ShZkH-FOe4I/AAAAAAAAHP0/ogsB2X0vAMU/S220/IMG_0305.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7316847079866971282.post-2739144327623334788</id><published>2009-06-03T22:17:00.001+05:30</published><updated>2009-06-10T12:22:42.262+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='James Gosling'/><title type='text'>James Gosling's Letter to the Java Community</title><content type='html'>Dear Java Community,&lt;br /&gt;&lt;br /&gt;As you can see, we're making progress with our plans to open source Sun's implementations of the Java platform. I'm happy to see Java technology embarking on a new journey with &lt;a href="http://www.sun.com/2006-1113/feature/index.jsp" target="_blank"&gt;this official open-source licensing announcement.&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Java technology has been a cornerstone of software development for more than a decade now -- the community is ready for the next chapter, and the timing is right. As we stated at the JavaOne conference last May, the most crucial part of this decision was that we realized developers want to preserve compatibility, interoperability, and reliability. We intend to take steps to help make sure Java technology remains compatible, interoperable, and reliable. And we know the Java community feels the same way.&lt;br /&gt;&lt;br /&gt;We will continue to do an immense amount of testing with the Java platform. Everything we do will get checked, rechecked, and we will debug rigorously. We expect that people who care about reliability and compatibility with the Java specification will continue to use and enhance Java technology.&lt;br /&gt;&lt;br /&gt;One reason Java technology remains so popular is that it's remarkably successful at spanning a lot of different domains. You can write software for application servers, cell phones, scientific programming, desktop applications, games, embedded software -- the list is endless. We're intend to maintain the support of this broad span of domains.&lt;br /&gt;&lt;br /&gt;Sun continues to embrace open source, and I invite you to join us. There are all kinds of contributions you can make. If there's a bug that you really care about, you can go work out a fix. (That's one area where developers have made tens of thousands of contributions over the years.) I also invite you to help us add new features. If there's new functionality that you really want in Java technology, the process is there to help you to add that to the platform as well.&lt;br /&gt;&lt;br /&gt;Sincerely, &lt;br /&gt;&lt;br /&gt;James Gosling&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7316847079866971282-2739144327623334788?l=java-servlet-jsp-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java-servlet-jsp-web.blogspot.com/feeds/2739144327623334788/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/06/james-goslings-letter-to-java-community.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/2739144327623334788'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/2739144327623334788'/><link rel='alternate' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/06/james-goslings-letter-to-java-community.html' title='James Gosling&apos;s Letter to the Java Community'/><author><name>Santhosh Reddy</name><uri>http://www.blogger.com/profile/05232963292855488994</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_P0JbJW7kyKo/ShZkH-FOe4I/AAAAAAAAHP0/ogsB2X0vAMU/S220/IMG_0305.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7316847079866971282.post-4178284071228145947</id><published>2009-06-03T22:13:00.001+05:30</published><updated>2009-06-10T12:28:01.063+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='JavaOne 2008'/><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='Java innovations'/><title type='text'>Sun Headline News: JavaOne 2008; Java drives Innovation</title><content type='html'>From JavaOne keynotes to breakout sessions, to the sold out pavilion floor - it's clear that Java drives innovation everywhere&lt;br /&gt;&lt;br /&gt;&lt;object id="flashObj" width="486" height="322" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,47,0"&gt;&lt;param name="movie" value="http://c.brightcove.com/services/viewer/federated_f9/1640183659?isVid=1&amp;publisherID=1460825906" /&gt;&lt;param name="bgcolor" value="#FFFFFF" /&gt;&lt;param name="flashVars" value="videoId=1656454259&amp;playerID=1640183659&amp;domain=embed&amp;" /&gt;&lt;param name="base" value="http://admin.brightcove.com" /&gt;&lt;param name="seamlesstabbing" value="false" /&gt;&lt;param name="allowFullScreen" value="true" /&gt;&lt;param name="swLiveConnect" value="true" /&gt;&lt;param name="allowScriptAccess" value="always" /&gt;&lt;embed src="http://c.brightcove.com/services/viewer/federated_f9/1640183659?isVid=1&amp;publisherID=1460825906" bgcolor="#FFFFFF" flashVars="videoId=1656454259&amp;playerID=1640183659&amp;domain=embed&amp;" base="http://admin.brightcove.com" name="flashObj" width="486" height="322" seamlesstabbing="false" type="application/x-shockwave-flash" allowFullScreen="true" swLiveConnect="true" allowScriptAccess="always" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7316847079866971282-4178284071228145947?l=java-servlet-jsp-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java-servlet-jsp-web.blogspot.com/feeds/4178284071228145947/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/06/sun-headline-news-javaone-2008-java.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/4178284071228145947'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/4178284071228145947'/><link rel='alternate' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/06/sun-headline-news-javaone-2008-java.html' title='Sun Headline News: JavaOne 2008; Java drives Innovation'/><author><name>Santhosh Reddy</name><uri>http://www.blogger.com/profile/05232963292855488994</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_P0JbJW7kyKo/ShZkH-FOe4I/AAAAAAAAHP0/ogsB2X0vAMU/S220/IMG_0305.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7316847079866971282.post-3885631658470307506</id><published>2009-06-03T22:07:00.001+05:30</published><updated>2009-06-10T12:28:50.070+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='JavaOne 2009'/><title type='text'>JavaOne 2009 - Pre-Conference Wrap-up</title><content type='html'>Chris concludes the pre-conference videos and offers some tips for getting the most out of JavaOne.&lt;br /&gt;&lt;br /&gt;&lt;object id="flashObj" width="486" height="322" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,47,0"&gt;&lt;param name="movie" value="http://c.brightcove.com/services/viewer/federated_f9/1640183659?isVid=1&amp;publisherID=1460825906" /&gt;&lt;param name="bgcolor" value="#FFFFFF" /&gt;&lt;param name="flashVars" value="videoId=24410880001&amp;playerID=1640183659&amp;domain=embed&amp;" /&gt;&lt;param name="base" value="http://admin.brightcove.com" /&gt;&lt;param name="seamlesstabbing" value="false" /&gt;&lt;param name="allowFullScreen" value="true" /&gt;&lt;param name="swLiveConnect" value="true" /&gt;&lt;param name="allowScriptAccess" value="always" /&gt;&lt;embed src="http://c.brightcove.com/services/viewer/federated_f9/1640183659?isVid=1&amp;publisherID=1460825906" bgcolor="#FFFFFF" flashVars="videoId=24410880001&amp;playerID=1640183659&amp;domain=embed&amp;" base="http://admin.brightcove.com" name="flashObj" width="486" height="322" seamlesstabbing="false" type="application/x-shockwave-flash" allowFullScreen="true" swLiveConnect="true" allowScriptAccess="always" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7316847079866971282-3885631658470307506?l=java-servlet-jsp-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java-servlet-jsp-web.blogspot.com/feeds/3885631658470307506/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/06/javaone-2009-pre-conference-wrap-up.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/3885631658470307506'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/3885631658470307506'/><link rel='alternate' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/06/javaone-2009-pre-conference-wrap-up.html' title='JavaOne 2009 - Pre-Conference Wrap-up'/><author><name>Santhosh Reddy</name><uri>http://www.blogger.com/profile/05232963292855488994</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_P0JbJW7kyKo/ShZkH-FOe4I/AAAAAAAAHP0/ogsB2X0vAMU/S220/IMG_0305.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7316847079866971282.post-2102579140442135353</id><published>2009-06-01T19:59:00.010+05:30</published><updated>2009-06-10T19:40:47.207+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='Java programs'/><title type='text'>Best URL and Email validation techniques using Java regular expression</title><content type='html'>Hi guys... If you've suffered with the URL and Email validations or if you're looking for a best URL and Email validation techniques using the Java. Here is the solution for that... I've created a new class with two methods for checking the Email and URL and tested it with all kinds of real time URLs.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;em&gt;Validation.java&lt;/em&gt;&lt;/strong&gt;&lt;br /&gt;&lt;pre class="program"&gt;&lt;br /&gt;/**&lt;br /&gt; * Checks whether the given email address is valid.&lt;br /&gt; * @author SANTHOSH REDDY MANDADI&lt;br /&gt; * @since 09-Feb-2009&lt;br /&gt; * @version 1.0&lt;br /&gt; */&lt;br /&gt;public class Validation&lt;br /&gt;{&lt;br /&gt; /**&lt;br /&gt;  * Checks whether the given email address is valid.&lt;br /&gt;  * @param email represents the email address.&lt;br /&gt;  * @return true if the email is valid, false otherwise.&lt;br /&gt;  * @since 09-Feb-2009&lt;br /&gt;  */&lt;br /&gt; public static boolean isEmail(String email)&lt;br /&gt; {&lt;br /&gt;  if(email==null)&lt;br /&gt;  {&lt;br /&gt;   return false;&lt;br /&gt;  }&lt;br /&gt;  //Assigning the email format regular expression&lt;br /&gt;  String emailPattern="^([A-Za-z0-9_\\-\\.])+\\@([A-Za-z0-9_\\-\\.])+\\.([A-Za-z]{2,4})";&lt;br /&gt;  return email.matches(emailPattern); &lt;br /&gt; }&lt;br /&gt; &lt;br /&gt; /**&lt;br /&gt;  * Checks whether the given URL (website address) is valid.&lt;br /&gt;  * @param url represents the website address.&lt;br /&gt;  * @return true if the email is valid, false otherwise.&lt;br /&gt;  * @since 09-Feb-2009&lt;br /&gt;  */&lt;br /&gt; public static boolean isURL(String url)&lt;br /&gt; {&lt;br /&gt;  if(url==null)&lt;br /&gt;  {&lt;br /&gt;   return false;&lt;br /&gt;  }&lt;br /&gt;  //Assigning the url format regular expression&lt;br /&gt;  String urlPattern="^http(s{0,1})://[a-zA-Z0-9_/\\-\\.]+\\.([A-Za-z/]{2,5})[a-zA-Z0-9_/\\&amp;\\?\\=\\-\\.\\~\\%]*";&lt;br /&gt;  return url.matches(urlPattern); &lt;br /&gt; }&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;In order to use the above class, place it in your working directory and invoke it directly through the class name Validator.isURL(url) and Validator.isEmail(email) to validate.&lt;br /&gt;&lt;br /&gt;The above program has been tested on the platforms 1.4 and 1.5.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://java-servlet-jsp-web.blogspot.com/search/label/Java%20programs" title="Other Java programs"&gt;Click here&lt;/a&gt; to check out other programs that I've developed.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7316847079866971282-2102579140442135353?l=java-servlet-jsp-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java-servlet-jsp-web.blogspot.com/feeds/2102579140442135353/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/06/best-url-and-email-validation-using.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/2102579140442135353'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/2102579140442135353'/><link rel='alternate' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/06/best-url-and-email-validation-using.html' title='Best URL and Email validation techniques using Java regular expression'/><author><name>Santhosh Reddy</name><uri>http://www.blogger.com/profile/05232963292855488994</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_P0JbJW7kyKo/ShZkH-FOe4I/AAAAAAAAHP0/ogsB2X0vAMU/S220/IMG_0305.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7316847079866971282.post-3679208194483996689</id><published>2009-05-31T16:40:00.002+05:30</published><updated>2009-06-10T12:35:02.723+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Computer'/><title type='text'>Computer and programming language terminology</title><content type='html'>Here I'm giving some programming language terminologies.&lt;br /&gt;&lt;strong&gt;computer&lt;/strong&gt;: an entity that executes instructions&lt;br /&gt;&lt;strong&gt;processor&lt;/strong&gt;: the part of an electronic computer that executes instructions&lt;br /&gt;&lt;strong&gt;primary storage&lt;/strong&gt;: the part of an electronic computer that holds the instructions and information that the processor reads to do its work. Also known as memory, random access memory, and RAM.&lt;br /&gt;&lt;strong&gt;secondary storage&lt;/strong&gt;: the parts of an electronic computer that archives additional instructions and information. Examples are the internal "hard" disk, diskettes, and compact disks. For the processor to read the information on secondary storage, it must be copied into primary storage.&lt;br /&gt;&lt;strong&gt;input device&lt;/strong&gt;: a mouse or keyboard, which supplies information to a computer&lt;br /&gt;&lt;strong&gt;output device&lt;/strong&gt;: a display screen or printer, which presents information to a computer's user&lt;br /&gt;&lt;strong&gt;file&lt;/strong&gt;: a collection of related information, typically saved on secondary storage&lt;br /&gt;&lt;strong&gt;folder&lt;/strong&gt;: a collection of files, typically saved on secondary storage&lt;br /&gt;&lt;strong&gt;bit&lt;/strong&gt;: the "atomic" unit of information within a computer|a "1" or a "0"&lt;br /&gt;&lt;strong&gt;binary code&lt;/strong&gt;: a sequence of bits, read by the processor as instructions or information.&lt;br /&gt;&lt;strong&gt;machine language&lt;/strong&gt;: the specific format of binary code read by a specific processor&lt;br /&gt;&lt;strong&gt;algorithm&lt;/strong&gt;: a sequence of declarative instructions ("orders") for accomplishing a&lt;br /&gt;task.&lt;br /&gt;&lt;strong&gt;computer program&lt;/strong&gt;: an algorithm written specifically for a processor to execute.&lt;br /&gt;&lt;strong&gt;code&lt;/strong&gt;: traditional name for a computer program&lt;br /&gt;&lt;strong&gt;programming language&lt;/strong&gt;: a language designed specifically for writing computer programs&lt;br /&gt;&lt;strong&gt;compiler&lt;/strong&gt;: a computer program, that when executed, translates computer programs in one programming language into programs in another language&lt;br /&gt;&lt;strong&gt;interpreter&lt;/strong&gt;: a computer program, that when executed, helps a processor read and execute computer programs that are not written in machine language&lt;br /&gt;&lt;strong&gt;Java byte code&lt;/strong&gt;: the compiler for the Java programming language translates programs written in Java into programs in Java byte code&lt;br /&gt;&lt;strong&gt;Java virtual machine (JVM)&lt;/strong&gt;: the interpreter for Java byte code&lt;br /&gt;&lt;strong&gt;object&lt;/strong&gt;: a basic unit of an executing computer program&lt;br /&gt;&lt;strong&gt;method&lt;/strong&gt;: an ability that an object possesses&lt;br /&gt;&lt;strong&gt;message&lt;/strong&gt;: a communication that one object sends to another&lt;br /&gt;&lt;strong&gt;client object&lt;/strong&gt;: an object that sends a message to a receiver&lt;br /&gt;&lt;strong&gt;receiver object&lt;/strong&gt;: an object that receives a message sent by a client&lt;br /&gt;&lt;strong&gt;input&lt;/strong&gt;: information given to a computer program for computation&lt;br /&gt;&lt;strong&gt;output&lt;/strong&gt;: the answers computed by a program&lt;br /&gt;&lt;strong&gt;hardware&lt;/strong&gt;: the physical components of a computer, e.g., processor and primary storage&lt;br /&gt;&lt;strong&gt;software&lt;/strong&gt;: computer programs&lt;br /&gt;&lt;strong&gt;operating system&lt;/strong&gt;: the controller program that starts when a computer is first switched on&lt;br /&gt;&lt;strong&gt;command window&lt;/strong&gt;: a position on the computer display where a human can type instructions to a computer&lt;br /&gt;&lt;strong&gt;software architecture&lt;/strong&gt;: the overall design of a computer program; analogous to a house's blueprint&lt;br /&gt;&lt;strong&gt;class diagram&lt;/strong&gt;: a graphical presentation of a program's architecture&lt;br /&gt;&lt;strong&gt;class&lt;/strong&gt;: a file containing a component of a computer program&lt;br /&gt;&lt;strong&gt;Model-View-Controller (MVC) architecture&lt;/strong&gt;: a standard software architecture&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7316847079866971282-3679208194483996689?l=java-servlet-jsp-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java-servlet-jsp-web.blogspot.com/feeds/3679208194483996689/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/05/computer-and-programming-language.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/3679208194483996689'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/3679208194483996689'/><link rel='alternate' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/05/computer-and-programming-language.html' title='Computer and programming language terminology'/><author><name>Santhosh Reddy</name><uri>http://www.blogger.com/profile/05232963292855488994</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_P0JbJW7kyKo/ShZkH-FOe4I/AAAAAAAAHP0/ogsB2X0vAMU/S220/IMG_0305.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7316847079866971282.post-7863661385587601576</id><published>2009-05-31T16:18:00.003+05:30</published><updated>2009-06-10T12:35:37.282+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='JVM'/><title type='text'>What is JVM (Java Virtual Machine)?</title><content type='html'>JVM stands for Java Virtual Machine. It’s an abstract computer or virtual computer which runs the compiled java programs. Actually JVM is a software implementation which stands on the top of the real hardware platform and operating system. It provides abstraction between the compiled java program and the hardware and operating system.&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_P0JbJW7kyKo/SiJiL92RchI/AAAAAAAAHRg/mvdMl79-cxs/s1600-h/JVM.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 320px; height: 274px;" src="http://1.bp.blogspot.com/_P0JbJW7kyKo/SiJiL92RchI/AAAAAAAAHRg/mvdMl79-cxs/s320/JVM.gif" border="0" alt="Java virtual machine process"id="BLOGGER_PHOTO_ID_5341940065735111186" /&gt;&lt;/a&gt;&lt;br /&gt;So the compiled program does not have to worry about what hardware and operating system he has to run in, it’s all handled by the JVM and thus attaining portability. All Java programs are compiled in to bytecodes. JVM can only understand and execute Java byte codes. You can visualize Java bytecodes as machine language for JVM. Java compiler takes the .java files and compiles it to a “bytecode” file with .class file extension. Compiler generates one class file for one source file.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7316847079866971282-7863661385587601576?l=java-servlet-jsp-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java-servlet-jsp-web.blogspot.com/feeds/7863661385587601576/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/05/what-is-jvm-java-virtual-machine.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/7863661385587601576'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/7863661385587601576'/><link rel='alternate' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/05/what-is-jvm-java-virtual-machine.html' title='What is JVM (Java Virtual Machine)?'/><author><name>Santhosh Reddy</name><uri>http://www.blogger.com/profile/05232963292855488994</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_P0JbJW7kyKo/ShZkH-FOe4I/AAAAAAAAHP0/ogsB2X0vAMU/S220/IMG_0305.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_P0JbJW7kyKo/SiJiL92RchI/AAAAAAAAHRg/mvdMl79-cxs/s72-c/JVM.gif' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7316847079866971282.post-836171483056602662</id><published>2009-05-31T15:11:00.003+05:30</published><updated>2009-06-10T12:36:47.747+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='JDK'/><title type='text'>Sun Java 7 is on its way</title><content type='html'>Hi... Sun Microsystem is releasing weekly early access snapshots of the complete source, binaries and documentation for JDK 7. These snapshot releases let you review and contribute to the Java SE platform as it is being developed.&lt;br /&gt;You can read the API documentation @ &lt;a href="http://download.java.net/jdk7/docs/api/" target="_blank"&gt; http://download.java.net/jdk7/docs/api/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Three primary elements that offer new input/output (I/O) APIs for the Java platform are:&lt;/strong&gt;&lt;br /&gt;1. An extensive File I/O API system addresses feature requests that developers have sought since the inception of the JDK.&lt;br /&gt;2. A socket channel API addresses multicasting, socket binding associated with channels, and related issues.&lt;br /&gt;3. An asynchronous I/O API enables mapping to I/O facilities, completion ports, and various I/O event port mechanisms to enhance scalability.&lt;br /&gt;&lt;br /&gt;You can download JDK 7 @ &lt;a href="https://jdk7.dev.java.net/" target="_blank"&gt;https://jdk7.dev.java.net/&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7316847079866971282-836171483056602662?l=java-servlet-jsp-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java-servlet-jsp-web.blogspot.com/feeds/836171483056602662/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/05/sun-java-7-is-on-its-way.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/836171483056602662'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/836171483056602662'/><link rel='alternate' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/05/sun-java-7-is-on-its-way.html' title='Sun Java 7 is on its way'/><author><name>Santhosh Reddy</name><uri>http://www.blogger.com/profile/05232963292855488994</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_P0JbJW7kyKo/ShZkH-FOe4I/AAAAAAAAHP0/ogsB2X0vAMU/S220/IMG_0305.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7316847079866971282.post-5044604506185518201</id><published>2009-05-31T01:53:00.008+05:30</published><updated>2009-06-10T19:44:05.807+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='Java programs'/><category scheme='http://www.blogger.com/atom/ns#' term='Java swings'/><title type='text'>Program to show web colors - Java Swings</title><content type='html'>If you're a web programmer, I think you should have felt uneasy while choosing the colors for the web. I've developed a small Swing component which will makes you're job easy i.e.; this tools enables you to choose the perfect colors. For this you need two files, one is Java program and other is Properties file.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;em&gt;ColorsDemo.java&lt;/em&gt;&lt;/strong&gt;&lt;br /&gt;&lt;pre class="program"&gt;&lt;br /&gt;import java.io.FileInputStream;&lt;br /&gt;import java.awt.*;&lt;br /&gt;import java.util.*;&lt;br /&gt;import javax.swing.*;&lt;br /&gt;import java.awt.event.*;&lt;br /&gt;&lt;br /&gt;public class ColorsDemo extends JFrame implements ActionListener&lt;br /&gt;{&lt;br /&gt; FileInputStream fis;&lt;br /&gt; Properties prop;&lt;br /&gt; Color colors[];&lt;br /&gt; JScrollPane s,s1;&lt;br /&gt; JPanel p;&lt;br /&gt; JTextArea ta;&lt;br /&gt; JButton clabels[];&lt;br /&gt; boolean backcolor;&lt;br /&gt; public ColorsDemo()&lt;br /&gt; {&lt;br /&gt;  try{&lt;br /&gt;   fis=new FileInputStream("Files/props.properties");&lt;br /&gt;   prop=new Properties();&lt;br /&gt;   prop.load(fis);&lt;br /&gt;  }catch(Exception e){}&lt;br /&gt;  backcolor=true;&lt;br /&gt;  p=new JPanel();&lt;br /&gt;  s=new JScrollPane(p);&lt;br /&gt;  p.setLayout(new GridLayout(20,7));&lt;br /&gt;  colors=new Color[140];&lt;br /&gt;  clabels=new JButton[140];&lt;br /&gt;  Enumeration e=prop.propertyNames();&lt;br /&gt;  int i=0;&lt;br /&gt;  while(e.hasMoreElements())&lt;br /&gt;  {&lt;br /&gt;   String propname=(String)e.nextElement();&lt;br /&gt;   String str=prop.getProperty(propname);&lt;br /&gt;   int r=(Integer.decode("#"+str.substring(1,3))).intValue();&lt;br /&gt;   int g=(Integer.decode("#"+str.substring(3,5))).intValue();&lt;br /&gt;   int b=(Integer.decode("#"+str.substring(5,7))).intValue();&lt;br /&gt;   clabels[i]=new JButton("&amp;lt;HTML&amp;gt;&amp;lt;CENTER&amp;gt;"+propname+"&amp;lt;BR&amp;gt;"+str+"&amp;lt;BR&amp;gt;Red="+r+", Green="+g+", Blue="+b+"&amp;lt;/HTML&amp;gt;");&lt;br /&gt;   colors[i]=new Color(r,g,b);&lt;br /&gt;   clabels[i].setBackground(colors[i]);&lt;br /&gt;   clabels[i].addActionListener(this);&lt;br /&gt;   p.add(clabels[i]);&lt;br /&gt;   //clabels[i].setEditable(false);&lt;br /&gt;   i++;&lt;br /&gt;  }&lt;br /&gt;  Container c=getContentPane();&lt;br /&gt;  ta=new JTextArea("Using the following buttons you are able \n"+&lt;br /&gt;      "to set the background and foreground colors\n"+&lt;br /&gt;      "of this text area.\n Click the buttons,\n"+&lt;br /&gt;      "It will automatically sets the background\n"+&lt;br /&gt;      "and foreground colors.\n Remember one time\n"+&lt;br /&gt;      "background color and another one foreground color\n"+&lt;br /&gt;      "For the first time background color\n"+&lt;br /&gt;      "------------------------------------\n"+&lt;br /&gt;      "Designed and Devloped by\n"+&lt;br /&gt;      "SANTHOSH REDDY MANDADI");&lt;br /&gt;  s1=new JScrollPane(ta);&lt;br /&gt;  ta.setFont(new Font("MS Sans Serif",Font.BOLD,20));&lt;br /&gt;  c.setLayout(new GridLayout(2,1));&lt;br /&gt;  c.add(s1);&lt;br /&gt;  c.add(s);&lt;br /&gt;  setDefaultCloseOperation(EXIT_ON_CLOSE);&lt;br /&gt;  setSize(500,400);&lt;br /&gt;  setTitle("Color Demo - you can able to select suitable colors for webpage");&lt;br /&gt;  setVisible(true);&lt;br /&gt; }&lt;br /&gt; public void actionPerformed(ActionEvent ae)&lt;br /&gt; {&lt;br /&gt;  String str=ae.getActionCommand();&lt;br /&gt;  int x=str.indexOf('#');&lt;br /&gt;  str=str.substring(x,x+8);&lt;br /&gt;  int r=(Integer.decode("#"+str.substring(1,3))).intValue();&lt;br /&gt;  int g=(Integer.decode("#"+str.substring(3,5))).intValue();&lt;br /&gt;  int b=(Integer.decode("#"+str.substring(5,7))).intValue();&lt;br /&gt;  Color c=new Color(r,g,b);&lt;br /&gt;  if(backcolor)&lt;br /&gt;  {&lt;br /&gt;   ta.setBackground(c);&lt;br /&gt;   backcolor=false;&lt;br /&gt;   //System.out.println(ta.getText().lastIndexOf('\n'));&lt;br /&gt;   //System.out.println(ta.getText().length());&lt;br /&gt;   //ta.setSelectionStart(ta.getText().lastIndexOf('\n'));&lt;br /&gt;   //ta.setSelectionEnd(ta.getText().length());&lt;br /&gt;   //ta.select(ta.getSelectionStart(),ta.getSelectionEnd());&lt;br /&gt;   //ta.selectAll();&lt;br /&gt;   //System.out.println(ta.getSelectedText());&lt;br /&gt;   //ta.revalidate();&lt;br /&gt;  }&lt;br /&gt;  else&lt;br /&gt;  {&lt;br /&gt;   ta.setForeground(c);&lt;br /&gt;   backcolor=true;&lt;br /&gt;  }&lt;br /&gt; }&lt;br /&gt; public static void main(String[] args) throws Exception&lt;br /&gt; {&lt;br /&gt;  new ColorsDemo();&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;em&gt;prop.properties&lt;/em&gt;&lt;/strong&gt;&lt;br /&gt;&lt;pre class="program"&gt;&lt;br /&gt;ALICEBLUE=#F0F8FF&lt;br /&gt;ANTIQUEWHITE=#FAEBD7&lt;br /&gt;AQUA=#00FFFF&lt;br /&gt;AQUAMARINE=#7FFFD4&lt;br /&gt;AZURE=#F0FFFF&lt;br /&gt;BEIGE=#F5F5DC&lt;br /&gt;BISQUE=#FFE4C4&lt;br /&gt;BLACK=#000000&lt;br /&gt;BLANCHEDALMOND=#FFEBCD&lt;br /&gt;BLUE=#0000FF&lt;br /&gt;BLUEVIOLET=#8A2BE2&lt;br /&gt;BROWN=#A52A2A&lt;br /&gt;BURLYWOOD=#DEB887&lt;br /&gt;CADETBLUE=#5F9EA0&lt;br /&gt;CHARTREUSE=#7FFF00&lt;br /&gt;CHOCOLATE=#D2691E&lt;br /&gt;CORAL=#FF7F50&lt;br /&gt;CORNFLOWER=#6495ED&lt;br /&gt;CORNSILK=#FFF8DC&lt;br /&gt;CRIMSON=#D614EC&lt;br /&gt;CYAN=#00FFFF&lt;br /&gt;DARKBLUE=#00008B&lt;br /&gt;DARKCYAN=#008B8B&lt;br /&gt;DARKGOLDENROD=#B8860B&lt;br /&gt;DARKGRAY=#A9A9A9&lt;br /&gt;DARKGREEN=#006400&lt;br /&gt;DARKKHAKI=#BDB76B&lt;br /&gt;DARKMAGENTA=#8B008B&lt;br /&gt;DARKOLIVEGREEN=#556B2F&lt;br /&gt;DARKORANGE=#FF8C00&lt;br /&gt;DARKORCHID=#9932CC&lt;br /&gt;DARKRED=#8B0000&lt;br /&gt;DARKSALMON=#E9967A&lt;br /&gt;DARKSEAGREEN=#8FBC8B&lt;br /&gt;DARKSLATEBLUE=#483D8B&lt;br /&gt;DARKSLATEGRAY=#2F4F4F&lt;br /&gt;DARKTURQUOISE=#00CED1&lt;br /&gt;DARKVIOLET=#9400D3&lt;br /&gt;DEEPPINK=#FF1493&lt;br /&gt;DEEPSKYBLUE=#00BFFF&lt;br /&gt;DIMGRAY=#696969&lt;br /&gt;DODGERBLUE=#1E90FF&lt;br /&gt;FIREBRICK=#B22222&lt;br /&gt;FLORALWHITE=#FFFAF0&lt;br /&gt;FORESTGREEN=#228B22&lt;br /&gt;FUCHIA=#FF00FF&lt;br /&gt;GIANSBORO=#DCDCDC&lt;br /&gt;GHOSTWHITE=#F8F8FF&lt;br /&gt;GOLD=#FFD700&lt;br /&gt;GOLDENTROD=#DAA520&lt;br /&gt;GRAY=#808080&lt;br /&gt;GREEN=#008000&lt;br /&gt;GREENYELLOW=#ADFF2F&lt;br /&gt;HONEYDEW=#F0FFF0&lt;br /&gt;HOTPINK=#FF69B4&lt;br /&gt;INDIANRED=#CD5C5C&lt;br /&gt;INDIGO=#4B0082&lt;br /&gt;IVORY=#FFFFF0&lt;br /&gt;KHAKI=#F0E68C&lt;br /&gt;LAVENDER=#E6E6FA&lt;br /&gt;LAVENDERBLUSH=#FFF0F5&lt;br /&gt;LAWNGREEN=#7CFC00&lt;br /&gt;LEMONCHIFFON=#FFFACD&lt;br /&gt;LIGHTBLUE=#ADD8E6&lt;br /&gt;LIGHTCORAL=#F08080&lt;br /&gt;LIGHTCYAN=#E0FFFF&lt;br /&gt;LIGHTGOLDENRODYELLOW=#FAFAD2&lt;br /&gt;LIGHTGREEN=#90EE90&lt;br /&gt;LIGHTGRAY=#D3D3D3&lt;br /&gt;LIGHTPINK=#FFB6C1&lt;br /&gt;LIGHTSALMON=#FFA074&lt;br /&gt;LIGHTSEAGREEN=#20B2AA&lt;br /&gt;LIGHTSKYBLUE=#87CEFA&lt;br /&gt;LIGHTSLATEGRAY=#778899&lt;br /&gt;LIGHTSTEELBLUE=#B0C4DE&lt;br /&gt;LIGHTYELLOW=#FFFFE0&lt;br /&gt;LIME=#00FF00&lt;br /&gt;LIMEGREEN=#32CD32&lt;br /&gt;LINEN=#FAF0E6&lt;br /&gt;MAGENTA=#FF00FF&lt;br /&gt;MAROON=#800000&lt;br /&gt;MEDIUMAQUAMARINE=#66CDAA&lt;br /&gt;MEDIUMBLUE=#0000CD&lt;br /&gt;MEDUMORCHID=#BA55D3&lt;br /&gt;MEDIUMPURPLE=#9370DB&lt;br /&gt;MEDIUMSEAGREEN=#3CB371&lt;br /&gt;MEDIUMSLATEBLUE=#7B68EE&lt;br /&gt;MEDIUMSPRINGGREEN=#00FA9A&lt;br /&gt;MEDIUMTURQUOISE=#48D1CC&lt;br /&gt;MEDIUMVIOLETRED=#C71585&lt;br /&gt;MIDNIGHTBLUE=#191970&lt;br /&gt;MINTCREAM=#F5FFFA&lt;br /&gt;MISTYROSE=#FFE4E1&lt;br /&gt;MOCCASIN=#FFE4B5&lt;br /&gt;NAVAJOWTHITE=#FFDEAD&lt;br /&gt;NAVY=#000080&lt;br /&gt;OLDLACE=#FDF5E6&lt;br /&gt;OLIVE=#808000&lt;br /&gt;OLIVEDRAB=#6B8E23&lt;br /&gt;ORANGE=#FFA500&lt;br /&gt;ORANGERED=#FF4500&lt;br /&gt;ORCHID=#DA70D6&lt;br /&gt;PALEGOLDENROD=#EEE8AA&lt;br /&gt;PALEGREEN=#98FB98&lt;br /&gt;PALETURQUOISE=#AFEEEE&lt;br /&gt;PALEVIOLETRED=#DB7093&lt;br /&gt;PAPAYAWHIP=#FFEFD5&lt;br /&gt;PEACHPUFF=#FFDAB9&lt;br /&gt;PERU=#CD853F&lt;br /&gt;PINK=#FFC0CB&lt;br /&gt;PLUM=#DDA0DD&lt;br /&gt;POWDERBLUE=#B0E0E6&lt;br /&gt;PURPLE=#800080&lt;br /&gt;RED=#FF0000&lt;br /&gt;ROSYBROWN=#BC8F8F&lt;br /&gt;ROYALBLUE=#4169E1&lt;br /&gt;SEASHELL=#FFF5EE&lt;br /&gt;SALMON=#FA8072&lt;br /&gt;SILVER=#C0C0C0&lt;br /&gt;SEAGREEN=#2E8B57&lt;br /&gt;SLATEBLUE=#6A5ACD&lt;br /&gt;SIENNA=#A0522D&lt;br /&gt;SNOW=#FFFAFA&lt;br /&gt;SKYBLUE=#87CEEB     &lt;br /&gt;STEELBLUE=#4682B4&lt;br /&gt;SLATEGRAY=#708090&lt;br /&gt;TEAL=#008080&lt;br /&gt;SPRINGGREEN=#00FF7F&lt;br /&gt;TOMATO=#FF6347&lt;br /&gt;TAN=#D2B48C&lt;br /&gt;VIOLET=#EE82EE&lt;br /&gt;THISTLE=#D8BFD8&lt;br /&gt;WHITE=#FFFFFF&lt;br /&gt;TURQUOISE=#40E0D0&lt;br /&gt;YELLOW=#FFFF00&lt;br /&gt;WHEAT=#F5DEB3&lt;br /&gt;SADDLEBROWN=#8B4513&lt;br /&gt;WHITESMOKE=#F5F5F5&lt;br /&gt;SANDYBROWN=#F4A460&lt;br /&gt;YELLOWGREEN=#9ACD32&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Place properties file under the same folder where you've placed the ColorsDemo.java. Compile the code and run it, you'll see the output....&lt;br /&gt;&lt;br /&gt;Tested on 1.4 and 1.5&lt;br /&gt;&lt;br /&gt;&lt;a href="http://java-servlet-jsp-web.blogspot.com/search/label/Java%20programs" title="Other Java programs"&gt;Click here&lt;/a&gt; to check out other programs that I've developed.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7316847079866971282-5044604506185518201?l=java-servlet-jsp-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java-servlet-jsp-web.blogspot.com/feeds/5044604506185518201/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/05/program-to-show-web-colors-java-swings.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/5044604506185518201'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/5044604506185518201'/><link rel='alternate' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/05/program-to-show-web-colors-java-swings.html' title='Program to show web colors - Java Swings'/><author><name>Bharathamma</name><uri>http://www.blogger.com/profile/11015309374869899661</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7316847079866971282.post-7863714139375975459</id><published>2009-05-31T01:48:00.005+05:30</published><updated>2009-06-10T19:45:05.902+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='Java programs'/><title type='text'>ATM withdraw cash leaves calculation program - Java</title><content type='html'>If you want to know what kind of program has been used by the ATM machine to calculate the cash leaves when you withdraw money. Here I'm giving the program (of course it is very simple stand alone program) how it looks like. You can extend based on your requirements.&lt;br /&gt;&lt;br /&gt;&lt;pre class="program"&gt;&lt;br /&gt;import java.io.*;&lt;br /&gt;&lt;br /&gt;class Withdraw&lt;br /&gt;{&lt;br /&gt;    public static void main(String[] args) throws Exception&lt;br /&gt;    {&lt;br /&gt;        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));&lt;br /&gt;        int n=Integer.parseInt(br.readLine());&lt;br /&gt;        if(n&gt;15000)&lt;br /&gt;            System.out.println("ATM Cash Limit exceeds.");&lt;br /&gt;        else&lt;br /&gt;        {&lt;br /&gt;            if(n&lt;1000)&lt;br /&gt;                System.out.println(n/100+" Hundreds");&lt;br /&gt;            else&lt;br /&gt;            {&lt;br /&gt;                int h=5;&lt;br /&gt;                int f=(n-500)/500;&lt;br /&gt;                //System.out.println(n-500+" "+(n-500)/500+" "+(n-500)%500);&lt;br /&gt;                h+=((n-500)%500)/100;&lt;br /&gt;                if(h&gt;5){f=f+1; h=h-5;}&lt;br /&gt;                System.out.println(f+" Five Hundreds and "+h+" Hundreds");&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://java-servlet-jsp-web.blogspot.com/search/label/Java%20programs" title="Other Java programs"&gt;Click here&lt;/a&gt; to check out other programs that I've developed.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7316847079866971282-7863714139375975459?l=java-servlet-jsp-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java-servlet-jsp-web.blogspot.com/feeds/7863714139375975459/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/05/atm-withdraw-cash-leaves-calculation.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/7863714139375975459'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/7863714139375975459'/><link rel='alternate' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/05/atm-withdraw-cash-leaves-calculation.html' title='ATM withdraw cash leaves calculation program - Java'/><author><name>Bharathamma</name><uri>http://www.blogger.com/profile/11015309374869899661</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7316847079866971282.post-4758277472188211352</id><published>2009-05-31T01:30:00.005+05:30</published><updated>2009-06-10T19:46:09.778+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='Java programs'/><category scheme='http://www.blogger.com/atom/ns#' term='Java swings'/><title type='text'>Notepad program through Java - Swings</title><content type='html'>Hi guys... today I'm going to explain about my program Notepad developed using the Java Swings technology. It just look like windows operating system's notepad.&lt;br /&gt;&lt;br /&gt;&lt;pre class="program"&gt;&lt;br /&gt;import javax.swing.*;&lt;br /&gt;import java.awt.*;&lt;br /&gt;import java.awt.event.*;&lt;br /&gt;import java.io.*;&lt;br /&gt;import javax.swing.event.*;&lt;br /&gt;&lt;br /&gt;/**&lt;br /&gt;* Notepad class&lt;br /&gt;* @author SANTHOSH REDDY MANDADI&lt;br /&gt;* @since 20-April-2007&lt;br /&gt;* @version 1.0&lt;br /&gt;*/&lt;br /&gt;&lt;br /&gt;public class Notepad extends JFrame implements ActionListener,ItemListener,MenuListener,KeyListener&lt;br /&gt;{&lt;br /&gt;   FileOutputStream fos;&lt;br /&gt;   FileInputStream fis;&lt;br /&gt;   JFileChooser dialog;&lt;br /&gt;   JOptionPane msgbox;&lt;br /&gt;   boolean modified=false;&lt;br /&gt;   String str;&lt;br /&gt;   JMenuBar menubar;&lt;br /&gt;   JMenu file,edit,help;&lt;br /&gt;   JMenuItem newfile,savefile,openfile,exit,cut,copy,paste,about,selall;&lt;br /&gt;   JTextArea disp;&lt;br /&gt;   JScrollPane scrlpane;&lt;br /&gt;   public Notepad()&lt;br /&gt;   {&lt;br /&gt;       disp=new JTextArea();&lt;br /&gt;       scrlpane=new JScrollPane(disp);//,ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);&lt;br /&gt;       menubar=new JMenuBar();&lt;br /&gt;       dialog=new JFileChooser();&lt;br /&gt;       msgbox=new JOptionPane();&lt;br /&gt;       file=new JMenu("File"); file.setMnemonic('F');&lt;br /&gt;       edit=new JMenu("Edit"); edit.setMnemonic('E');&lt;br /&gt;       help=new JMenu("Help"); help.setMnemonic('H');&lt;br /&gt;       newfile=new JMenuItem("New"); newfile.setMnemonic('N');&lt;br /&gt;       openfile=new JMenuItem("Open"); openfile.setMnemonic('O');&lt;br /&gt;       savefile=new JMenuItem("Save"); savefile.setMnemonic('S');&lt;br /&gt;       exit=new JMenuItem("Exit"); exit.setMnemonic('x');&lt;br /&gt;       cut=new JMenuItem("Cut"); cut.setMnemonic('C');&lt;br /&gt;       copy=new JMenuItem("Copy"); copy.setMnemonic('o');&lt;br /&gt;       paste=new JMenuItem("Paste"); paste.setMnemonic('P');&lt;br /&gt;       selall=new JMenuItem("Select All"); selall.setMnemonic('A');&lt;br /&gt;       about=new JMenuItem("About"); about.setMnemonic('A');&lt;br /&gt;       cut.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X,InputEvent.CTRL_MASK,true));&lt;br /&gt;       copy.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C,InputEvent.CTRL_MASK,true));&lt;br /&gt;       paste.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_P,InputEvent.CTRL_MASK,true));&lt;br /&gt;       openfile.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O,InputEvent.CTRL_MASK,true));&lt;br /&gt;       savefile.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S,InputEvent.CTRL_MASK,true));&lt;br /&gt;       newfile.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_N,InputEvent.CTRL_MASK,true));&lt;br /&gt;       file.add(newfile);&lt;br /&gt;       file.add(openfile);&lt;br /&gt;       file.add(savefile);&lt;br /&gt;       file.addSeparator();&lt;br /&gt;       file.add(exit);&lt;br /&gt;       edit.add(cut);&lt;br /&gt;       edit.add(copy);&lt;br /&gt;       edit.add(paste);&lt;br /&gt;       edit.addSeparator();&lt;br /&gt;       edit.add(selall);&lt;br /&gt;       help.add(about);&lt;br /&gt;       menubar.add(file);&lt;br /&gt;       menubar.add(edit);&lt;br /&gt;       menubar.add(help);&lt;br /&gt;       Container c=getContentPane();&lt;br /&gt;       getRootPane().setJMenuBar(menubar);&lt;br /&gt;       c.add(scrlpane);&lt;br /&gt;       setSize(500,500);&lt;br /&gt;       setDefaultCloseOperation(EXIT_ON_CLOSE);&lt;br /&gt;       setVisible(true);&lt;br /&gt;       setTitle("Untitled - Notepad");&lt;br /&gt;       savefile.addActionListener(this);&lt;br /&gt;       openfile.addActionListener(this);&lt;br /&gt;       exit.addActionListener(this);&lt;br /&gt;       cut.addActionListener(this);&lt;br /&gt;       copy.addActionListener(this);&lt;br /&gt;       paste.addActionListener(this);&lt;br /&gt;       selall.addActionListener(this);&lt;br /&gt;       newfile.addActionListener(this);&lt;br /&gt;       edit.addMenuListener(this);&lt;br /&gt;       disp.addKeyListener(this);&lt;br /&gt;   }&lt;br /&gt;   public void keyPressed(KeyEvent e)&lt;br /&gt;   {&lt;br /&gt;       //System.out.println("Press");&lt;br /&gt;   }&lt;br /&gt;   public void keyReleased(KeyEvent e)&lt;br /&gt;   {&lt;br /&gt;       //System.out.println("Release");&lt;br /&gt;   }&lt;br /&gt;   public void keyTyped(KeyEvent e)&lt;br /&gt;   {&lt;br /&gt;       String str=KeyEvent.getKeyModifiersText(InputEvent.CTRL_MASK);&lt;br /&gt;       if(!str.equals("Ctrl"))&lt;br /&gt;           modified=true;&lt;br /&gt;   }&lt;br /&gt;    public void menuSelected(MenuEvent ml)&lt;br /&gt;   {&lt;br /&gt;       //System.out.println("Sele");&lt;br /&gt;       if(ml.getSource()==edit)&lt;br /&gt;       {&lt;br /&gt;           if(disp.getSelectedText()==null)&lt;br /&gt;           {&lt;br /&gt;               cut.setEnabled(false);&lt;br /&gt;               copy.setEnabled(false);&lt;br /&gt;           }&lt;br /&gt;           else&lt;br /&gt;           {&lt;br /&gt;               cut.setEnabled(true);&lt;br /&gt;               copy.setEnabled(true);&lt;br /&gt;           }&lt;br /&gt;       }&lt;br /&gt;   }&lt;br /&gt;   public void menuDeselected(MenuEvent ml)&lt;br /&gt;   {&lt;br /&gt;       //System.out.println("DeSele");&lt;br /&gt;   }&lt;br /&gt;   public void menuCanceled(MenuEvent ml)&lt;br /&gt;   {&lt;br /&gt;       //System.out.println("Can");&lt;br /&gt;   }&lt;br /&gt;   public void actionPerformed(ActionEvent ae){&lt;br /&gt;       if(ae.getSource()==savefile)&lt;br /&gt;       {&lt;br /&gt;           if(getTitle().equals("Untitled - Notepad"))&lt;br /&gt;               saveFile(0);&lt;br /&gt;           else if(modified)&lt;br /&gt;               saveFile(1);&lt;br /&gt;       }&lt;br /&gt;       else if(ae.getSource()==openfile)&lt;br /&gt;       {&lt;br /&gt;           int x;&lt;br /&gt;           if(modified)&lt;br /&gt;           {&lt;br /&gt;               x=isModified();&lt;br /&gt;               if(x==1)&lt;br /&gt;               {&lt;br /&gt;                   if(getTitle().equals("Untitled - Notepad"))&lt;br /&gt;                       saveFile(0);&lt;br /&gt;                   else&lt;br /&gt;                       saveFile(1);&lt;br /&gt;                   openFile();&lt;br /&gt;               }&lt;br /&gt;               else if(x!=3) openFile();&lt;br /&gt;           }&lt;br /&gt;           else openFile();&lt;br /&gt;       }&lt;br /&gt;       else if(ae.getSource()==exit)&lt;br /&gt;       {&lt;br /&gt;           int x;&lt;br /&gt;           if(modified)&lt;br /&gt;           {&lt;br /&gt;               x=isModified();&lt;br /&gt;               if(x==1)&lt;br /&gt;               {&lt;br /&gt;                   if(getTitle().equals("Untitled - Notepad"))&lt;br /&gt;                       saveFile(0);&lt;br /&gt;                   else&lt;br /&gt;                       saveFile(1);&lt;br /&gt;               }&lt;br /&gt;               else if(x==2) System.exit(0);&lt;br /&gt;           }&lt;br /&gt;           else System.exit(0);&lt;br /&gt;       }&lt;br /&gt;       else if(ae.getSource()==newfile)&lt;br /&gt;       {&lt;br /&gt;           int x;&lt;br /&gt;           if(modified)&lt;br /&gt;           {&lt;br /&gt;               x=isModified();&lt;br /&gt;               if(x==1)&lt;br /&gt;               {&lt;br /&gt;                   if(getTitle().equals("Untitled - Notepad"))&lt;br /&gt;                       saveFile(0);&lt;br /&gt;                   else&lt;br /&gt;                       saveFile(1);&lt;br /&gt;               }&lt;br /&gt;               else if(x!=3){&lt;br /&gt;                   disp.setText("");&lt;br /&gt;                   setTitle("Untitled - Notepad");&lt;br /&gt;                   modified=false;&lt;br /&gt;               }&lt;br /&gt;           }&lt;br /&gt;           else{&lt;br /&gt;               disp.setText("");&lt;br /&gt;               setTitle("Untitled - Notepad");&lt;br /&gt;               modified=false;&lt;br /&gt;           }&lt;br /&gt;       }&lt;br /&gt;       else if(ae.getSource()==cut)&lt;br /&gt;       {&lt;br /&gt;           disp.cut();&lt;br /&gt;       }&lt;br /&gt;       else if(ae.getSource()==copy)&lt;br /&gt;       {&lt;br /&gt;           disp.copy();&lt;br /&gt;       }&lt;br /&gt;       else if(ae.getSource()==paste)&lt;br /&gt;       {&lt;br /&gt;           disp.paste();&lt;br /&gt;       }&lt;br /&gt;       else if(ae.getSource()==selall)&lt;br /&gt;       {&lt;br /&gt;           disp.selectAll();&lt;br /&gt;       }&lt;br /&gt;   }&lt;br /&gt;   public void saveFile(int saveflag)&lt;br /&gt;   {&lt;br /&gt;       File f;&lt;br /&gt;       try&lt;br /&gt;       {&lt;br /&gt;           if(saveflag==0)&lt;br /&gt;           {&lt;br /&gt;               int x=dialog.showSaveDialog(this);&lt;br /&gt;               if(x==0){&lt;br /&gt;                   f=dialog.getSelectedFile();&lt;br /&gt;                   fos=new FileOutputStream(f);&lt;br /&gt;                   setTitle(f.getPath());&lt;br /&gt;                   PrintStream ps=new PrintStream(fos);&lt;br /&gt;                   ps.print(disp.getText());&lt;br /&gt;                   modified=false;&lt;br /&gt;               }&lt;br /&gt;           }&lt;br /&gt;           else&lt;br /&gt;           {&lt;br /&gt;               f=new File(getTitle());&lt;br /&gt;               fos=new FileOutputStream(f);&lt;br /&gt;               setTitle(f.getPath());&lt;br /&gt;               PrintStream ps=new PrintStream(fos);&lt;br /&gt;               ps.print(disp.getText());&lt;br /&gt;               modified=false;&lt;br /&gt;           }&lt;br /&gt;       }catch(Exception e){}&lt;br /&gt;   }&lt;br /&gt;   public void openFile()&lt;br /&gt;   {&lt;br /&gt;       int x=dialog.showOpenDialog(this);&lt;br /&gt;       if(x==0){&lt;br /&gt;       try&lt;br /&gt;       {&lt;br /&gt;           File f=dialog.getSelectedFile();&lt;br /&gt;           fis=new FileInputStream(f);&lt;br /&gt;           setTitle(f.getPath());&lt;br /&gt;           disp.setText("");&lt;br /&gt;           BufferedReader br=new BufferedReader(new InputStreamReader(fis));&lt;br /&gt;           while((str=br.readLine())!=null)&lt;br /&gt;           disp.append(str+"\n");&lt;br /&gt;           disp.replaceRange("",disp.getText().length()-1,disp.getText().length());&lt;br /&gt;           modified=false;&lt;br /&gt;       }catch(Exception e){}&lt;br /&gt;       }&lt;br /&gt;   }&lt;br /&gt;   public int isModified()&lt;br /&gt;   {&lt;br /&gt;       int x=JOptionPane.showConfirmDialog(this, "The text in the "+getTitle()+" has changed\nDo you want to save it", "Notepad", JOptionPane.YES_NO_CANCEL_OPTION,JOptionPane.WARNING_MESSAGE);&lt;br /&gt;       if(x==JOptionPane.YES_OPTION) return 1;&lt;br /&gt;       else if(x==JOptionPane.NO_OPTION) return 2;&lt;br /&gt;       else return 3;&lt;br /&gt;   }&lt;br /&gt;   public void itemStateChanged(ItemEvent ie){}&lt;br /&gt;   public static void main(String[] args)&lt;br /&gt;   {&lt;br /&gt;       new Notepad();&lt;br /&gt;   }&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;This has been tested on Java 1.4 and 1.5 versions of Sun Microsystem's Java.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://java-servlet-jsp-web.blogspot.com/search/label/Java%20programs" title="Other Java programs"&gt;Click here&lt;/a&gt; to check out other programs that I've developed.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7316847079866971282-4758277472188211352?l=java-servlet-jsp-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java-servlet-jsp-web.blogspot.com/feeds/4758277472188211352/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/05/notepad-program-through-java-swings.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/4758277472188211352'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/4758277472188211352'/><link rel='alternate' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/05/notepad-program-through-java-swings.html' title='Notepad program through Java - Swings'/><author><name>Bharathamma</name><uri>http://www.blogger.com/profile/11015309374869899661</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7316847079866971282.post-9096082635447363983</id><published>2009-05-29T14:58:00.006+05:30</published><updated>2009-06-17T20:22:42.433+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java image processing'/><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='Java programs'/><title type='text'>Java perfect image resizer program (Image resize program)</title><content type='html'>Our server supports only 1.4, we don't have a plan to upgrade it to 1.5 version, where we've lot of predefined utilities to create thumbnails and resizing the images. I think you understand my requirement, image thumbnail or resize program to be created with a decent quality through Java 1.4 version.&lt;br /&gt;&lt;br /&gt;I've tried lot of logics to create a very good quality image resizer through Java program. Nothing works initially, but at the last I came to a conclusion that I've got decent quality through the below logic. I'm trying an &lt;a href="http://java-servlet-jsp-web.blogspot.com/2009/06/java-perfect-image-resizer-program-2.html"&gt;other logic&lt;/a&gt; also, which makes it more effective, but that is still in testing mode. It has been tested with Java 1.4, 1.5 versions.&lt;br /&gt;&lt;br /&gt;&lt;pre class="program"&gt;&lt;br /&gt;import java.awt.AlphaComposite;&lt;br /&gt;import java.awt.Graphics2D;&lt;br /&gt;import java.awt.RenderingHints;&lt;br /&gt;import java.awt.image.BufferedImage;&lt;br /&gt;import java.io.File;&lt;br /&gt;import java.io.FileOutputStream;&lt;br /&gt;import javax.imageio.ImageIO;&lt;br /&gt;import java.io.IOException;&lt;br /&gt;&lt;br /&gt;/**&lt;br /&gt; * This class will be helpful when you want to resize an image with decent quality.&lt;br /&gt; * @author SANTHOSH REDDY MANDADI&lt;br /&gt; * @since 20-April-2009&lt;br /&gt; * @version 2.0.7&lt;br /&gt; */&lt;br /&gt;public class PerfectImageResizer &lt;br /&gt;{&lt;br /&gt; public static void createThumbnail(String sourceFile, String destFile, &lt;br /&gt;       int targetWidth,int targetHeight) throws Exception&lt;br /&gt; {&lt;br /&gt;  try&lt;br /&gt;  {&lt;br /&gt;   BufferedImage img = ImageIO.read(new File(sourceFile));&lt;br /&gt;   int iw = img.getWidth();&lt;br /&gt;   int ih = img.getHeight();&lt;br /&gt;&lt;br /&gt;   Object hint = RenderingHints.VALUE_INTERPOLATION_BILINEAR;&lt;br /&gt;   int type = img.getType() == 0? BufferedImage.TYPE_INT_ARGB : img.getType();&lt;br /&gt;   &lt;br /&gt;   // First get down to no more than 2x in W &amp; H&lt;br /&gt;   while (iw &gt; targetWidth*2 || ih &gt; targetHeight*2) {&lt;br /&gt;     iw = (iw &gt; targetWidth*2) ? iw/2 : iw;&lt;br /&gt;     ih = (ih &gt; targetHeight*2) ? ih/2 : ih;&lt;br /&gt;     img = scaleImage(img, type, hint, iw, ih);&lt;br /&gt;   }&lt;br /&gt;&lt;br /&gt;   // REMIND: Conservative approach:&lt;br /&gt;   // first get W right, then worry about H&lt;br /&gt;&lt;br /&gt;   // If still too wide - do a horizontal trilinear blend&lt;br /&gt;   // of img and a half-width img&lt;br /&gt;   if (iw &gt; targetWidth) {&lt;br /&gt;     int iw2 = iw/2;&lt;br /&gt;     BufferedImage img2 = scaleImage(img, type, hint, iw2, ih);&lt;br /&gt;     if (iw2 &lt; targetWidth) {&lt;br /&gt;       img = scaleImage(img, type, hint, targetWidth, ih);&lt;br /&gt;       img2 = scaleImage(img2, type, hint, targetWidth, ih);&lt;br /&gt;       interp(img2, img, iw-targetWidth, targetWidth-iw2);&lt;br /&gt;     }&lt;br /&gt;     img = img2;&lt;br /&gt;     iw = targetWidth;&lt;br /&gt;   }&lt;br /&gt;   // iw should now be targetWidth or smaller&lt;br /&gt;&lt;br /&gt;   // If still too tall - do a vertical trilinear blend&lt;br /&gt;   // of img and a half-height img&lt;br /&gt;   if (ih &gt; targetHeight) {&lt;br /&gt;     int ih2 = ih/2;&lt;br /&gt;     BufferedImage img2 = scaleImage(img, type, hint, iw, ih2);&lt;br /&gt;     if (ih2 &lt; targetHeight) {&lt;br /&gt;       img = scaleImage(img, type, hint, iw, targetHeight);&lt;br /&gt;       img2 = scaleImage(img2, type, hint, iw, targetHeight);&lt;br /&gt;       interp(img2, img, ih-targetHeight, targetHeight-ih2);&lt;br /&gt;     }&lt;br /&gt;     img = img2;&lt;br /&gt;     ih = targetHeight;&lt;br /&gt;   }&lt;br /&gt;   // ih should now be targetHeight or smaller&lt;br /&gt;&lt;br /&gt;   // If we are too small, then it was probably because one of&lt;br /&gt;   // the dimensions was too small from the start.&lt;br /&gt;   if (iw &lt; targetWidth &amp;&amp; ih &lt; targetHeight) {&lt;br /&gt;     img = scaleImage(img, type, hint, targetWidth, targetHeight);&lt;br /&gt;   }&lt;br /&gt;   ImageIO.write(img, destFile.substring(destFile.lastIndexOf('.')+1), new FileOutputStream(destFile));&lt;br /&gt;   &lt;br /&gt;  } catch (IOException thumbException)&lt;br /&gt;  {&lt;br /&gt;   thumbException.printStackTrace();&lt;br /&gt;   throw new Exception(thumbException);&lt;br /&gt;  }&lt;br /&gt; }&lt;br /&gt; private static BufferedImage scaleImage(BufferedImage orig,int type,Object hint,int w, int h)&lt;br /&gt; {&lt;br /&gt;   BufferedImage tmp = new BufferedImage(w, h, type);&lt;br /&gt;   Graphics2D g2 = tmp.createGraphics();&lt;br /&gt;   g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION, hint);&lt;br /&gt;   g2.drawImage(orig, 0, 0, w, h, null);&lt;br /&gt;   g2.dispose();&lt;br /&gt;   return tmp;&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt; private static void interp(BufferedImage img1,BufferedImage img2,int weight1,int weight2)&lt;br /&gt; {&lt;br /&gt;   float alpha = weight1;&lt;br /&gt;   alpha /= (weight1 + weight2);&lt;br /&gt;   Graphics2D g2 = img1.createGraphics();&lt;br /&gt;   g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, alpha));&lt;br /&gt;   g2.drawImage(img2, 0, 0, null);&lt;br /&gt;   g2.dispose();&lt;br /&gt; }&lt;br /&gt; public static void main(String[] args) throws Exception&lt;br /&gt; {&lt;br /&gt;  String sourceFile="acu-final.jpg";&lt;br /&gt;  BufferedImage img = ImageIO.read(new File(sourceFile));&lt;br /&gt;  int iw = img.getWidth();&lt;br /&gt;  int ih = img.getHeight();&lt;br /&gt;  int targetWidth=74;&lt;br /&gt;  double imgHeightPercentage=((double)targetWidth/(double)iw)*100;&lt;br /&gt;  double imgTotalHeight=ih * (imgHeightPercentage/100);&lt;br /&gt;  int targetHeight=(int)Math.round(imgTotalHeight);&lt;br /&gt;  PerfectImageResizer.createThumbnail(sourceFile,"acu-finalt.jpg",targetWidth,targetHeight);&lt;br /&gt; }&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Replace your source file name, destination file name in the main block and run it. I'm sure you'll get a decent quality.&lt;br /&gt;&lt;br /&gt;One more rule not for the program, but if you would like to resize the horizontal and vertical as proportionated, for the above program you need to pass the values exactly. Here is the logic to give the proportionated values.&lt;br /&gt;&lt;br /&gt;&lt;pre class="program"&gt;&lt;br /&gt;imgWidth = image.getWidth(null);&lt;br /&gt;imgHeight = image.getHeight(null);   &lt;br /&gt;int newWidth=100; //Hard code the width you want&lt;br /&gt;double imgHeightPercentage= (newWidth/(double)imgWidth)*100;        &lt;br /&gt;double imgTotalHeight=imgHeight*(imgHeightPercentage/100);&lt;br /&gt;int newHeight=(int)Math.round(imgTotalHeight);&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Pass newWidth and newHeight as the parameters to the above method createThumbnail method.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://java-servlet-jsp-web.blogspot.com/2009/06/java-perfect-image-resizer-program-2.html"&gt;Here&lt;/a&gt; is the new logic that I've implemented which will give you the best quality.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://java-servlet-jsp-web.blogspot.com/search/label/Java%20programs" title="Other Java programs"&gt;Click here&lt;/a&gt; to check out other programs that I've developed.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7316847079866971282-9096082635447363983?l=java-servlet-jsp-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java-servlet-jsp-web.blogspot.com/feeds/9096082635447363983/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/05/java-perfect-image-resizer-program.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/9096082635447363983'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/9096082635447363983'/><link rel='alternate' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/05/java-perfect-image-resizer-program.html' title='Java perfect image resizer program (Image resize program)'/><author><name>Santhosh Reddy</name><uri>http://www.blogger.com/profile/05232963292855488994</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_P0JbJW7kyKo/ShZkH-FOe4I/AAAAAAAAHP0/ogsB2X0vAMU/S220/IMG_0305.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7316847079866971282.post-6803419086492345212</id><published>2009-05-29T14:43:00.006+05:30</published><updated>2009-06-10T13:44:08.423+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Servlets'/><category scheme='http://www.blogger.com/atom/ns#' term='web application'/><title type='text'>Character encoding filter - Java servlets, JSPs</title><content type='html'>Here I'm going to explain about the character encoding filter. Normally, Servlets and JSPs will use the default character set that has been chosen while installing the web container. If you want to modify the character set for your Servlet or JSP, you need to follow the below filter, which will make that job easy.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Create this class under your application:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;package cmi.util;&lt;br /&gt;&lt;br /&gt;import java.io.IOException;&lt;br /&gt;import javax.servlet.Filter;&lt;br /&gt;import javax.servlet.FilterChain;&lt;br /&gt;import javax.servlet.FilterConfig;&lt;br /&gt;import javax.servlet.ServletException;&lt;br /&gt;import javax.servlet.ServletRequest;&lt;br /&gt;import javax.servlet.ServletResponse;&lt;br /&gt;&lt;br /&gt;/**&lt;br /&gt; * This filter can be used to set the content type as UTF-8.&lt;br /&gt; * @author SANTHOSH REDDY MANDADI&lt;br /&gt; * @version 1.0&lt;br /&gt; * @since 20th April 2008&lt;br /&gt; */&lt;br /&gt; &lt;br /&gt;public class RequestEncodeFilter implements Filter&lt;br /&gt;{&lt;br /&gt; //FilterConfig object&lt;br /&gt; private FilterConfig filterConfig=null;&lt;br /&gt; &lt;br /&gt; //Default constructor&lt;br /&gt; public RequestEncodeFilter()&lt;br /&gt; {&lt;br /&gt;  System.out.println("Request response encoder Filter object has been created");&lt;br /&gt; }&lt;br /&gt; &lt;br /&gt; //Intitialization method&lt;br /&gt; public void init(FilterConfig filterConfig)&lt;br /&gt; {&lt;br /&gt;  this.filterConfig=filterConfig;&lt;br /&gt; }&lt;br /&gt; &lt;br /&gt; public void doFilter(ServletRequest request, ServletResponse response,&lt;br /&gt;           FilterChain chain) throws IOException, ServletException &lt;br /&gt; {&lt;br /&gt;   //Setting the character set for the request&lt;br /&gt;  request.setCharacterEncoding("UTF-8");&lt;br /&gt;  &lt;br /&gt;  // pass the request on&lt;br /&gt;  chain.doFilter(request, response);&lt;br /&gt;  &lt;br /&gt;   //Setting the character set for the response&lt;br /&gt;   response.setContentType("text/html; charset=UTF-8");&lt;br /&gt; }&lt;br /&gt; &lt;br /&gt; public void destroy() { &lt;br /&gt;  this.filterConfig=null;&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;In the above code, replace "UTF-8" with your character set you wish to convert.&lt;br /&gt;&lt;br /&gt;You need to map this filter in web.xml as mentioned below&lt;br /&gt;&amp;lt;filter&amp;gt;&lt;br /&gt;  &amp;lt;filter-name&amp;gt;requestEncodeFilter&amp;lt;/filter-name&amp;gt;&lt;br /&gt;  &amp;lt;filter-class&amp;gt;cmi.util.RequestEncodeFilter&amp;lt;/filter-class&amp;gt;&lt;br /&gt;&amp;lt;/filter&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;filter-mapping&amp;gt;&lt;br /&gt;  &amp;lt;filter-name&amp;gt;requestEncodeFilter&amp;lt;/filter-name&amp;gt;&lt;br /&gt;  &amp;lt;url-pattern&amp;gt;/*&amp;lt;/url-pattern&amp;gt;&lt;br /&gt;&amp;lt;/filter-mapping&amp;gt;&lt;br /&gt;&lt;br /&gt;Thats it... you'll get the output as required.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7316847079866971282-6803419086492345212?l=java-servlet-jsp-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java-servlet-jsp-web.blogspot.com/feeds/6803419086492345212/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/05/character-encoding-filter-java-servlets.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/6803419086492345212'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/6803419086492345212'/><link rel='alternate' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/05/character-encoding-filter-java-servlets.html' title='Character encoding filter - Java servlets, JSPs'/><author><name>Santhosh Reddy</name><uri>http://www.blogger.com/profile/05232963292855488994</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_P0JbJW7kyKo/ShZkH-FOe4I/AAAAAAAAHP0/ogsB2X0vAMU/S220/IMG_0305.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7316847079866971282.post-5643435571832034419</id><published>2009-05-29T14:35:00.006+05:30</published><updated>2009-06-10T19:49:32.556+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='Java programs'/><title type='text'>Java class to convert number into words</title><content type='html'>Hello... Are you looking for a Java program to convert a number into words? Here in this post, I'm giving the program to generate number in words.&lt;br /&gt;&lt;pre class="program"&gt;&lt;br /&gt;import java.io.*;&lt;br /&gt;/**&lt;br /&gt; * This class specially written to convert the given number into words. It will support upto 1 crore.&lt;br /&gt; * @author SANTHOSH REDDY MANDADI&lt;br /&gt; * @version release: 2_0_48&lt;br /&gt; * @since April 03 2008&lt;br /&gt; */&lt;br /&gt;public class Words&lt;br /&gt;{&lt;br /&gt; long num;&lt;br /&gt; private Words()&lt;br /&gt; {&lt;br /&gt;  num=0;&lt;br /&gt; }&lt;br /&gt; private Words(long num)&lt;br /&gt; {&lt;br /&gt;  this.num=num;&lt;br /&gt; }&lt;br /&gt; public void setNumber(long num)&lt;br /&gt; {&lt;br /&gt;  this.num=num;&lt;br /&gt; }&lt;br /&gt; public long getNumber()&lt;br /&gt; {&lt;br /&gt;  return num;&lt;br /&gt; }&lt;br /&gt; public static Words getInstance(long num)&lt;br /&gt; {&lt;br /&gt;  return new Words(num);&lt;br /&gt; }&lt;br /&gt; public static String leftChars(String str,int n)&lt;br /&gt; {&lt;br /&gt;  if(str.length()&lt;=n)&lt;br /&gt;   return str;&lt;br /&gt;  else&lt;br /&gt;   return str.substring(0,n);&lt;br /&gt; }&lt;br /&gt; public static String rightChars(String str,int n)&lt;br /&gt; {&lt;br /&gt;  if(str.length()&lt;=n)&lt;br /&gt;   return str;&lt;br /&gt;  else&lt;br /&gt;   return str.substring(str.length()-n,str.length());&lt;br /&gt; }&lt;br /&gt; public long leftChars(int n)&lt;br /&gt; {&lt;br /&gt;  return new Long(leftChars(new Long(num).toString(),n)).longValue();&lt;br /&gt; }&lt;br /&gt; public long rightChars(int n)&lt;br /&gt; {&lt;br /&gt;  return new Long(rightChars(new Long(num).toString(),n)).longValue();&lt;br /&gt; }&lt;br /&gt; public long leftChars(long num,int n)&lt;br /&gt; {&lt;br /&gt;  return new Long(leftChars(new Long(num).toString(),n)).longValue();&lt;br /&gt; }&lt;br /&gt; public long rightChars(long num,int n)&lt;br /&gt; {&lt;br /&gt;  return new Long(rightChars(new Long(num).toString(),n)).longValue();&lt;br /&gt; }&lt;br /&gt; public int length(long num)&lt;br /&gt; {&lt;br /&gt;  return new Long(num).toString().length();&lt;br /&gt; }&lt;br /&gt; private String belowTen(long x)&lt;br /&gt; {&lt;br /&gt;  switch((int)x)&lt;br /&gt;  {&lt;br /&gt;   case 1:&lt;br /&gt;    return "One ";&lt;br /&gt;   case 2:&lt;br /&gt;    return "Two ";&lt;br /&gt;   case 3:&lt;br /&gt;    return "Three ";&lt;br /&gt;   case 4:&lt;br /&gt;    return "Four ";&lt;br /&gt;   case 5:&lt;br /&gt;    return "Five ";&lt;br /&gt;   case 6:&lt;br /&gt;    return "Six ";&lt;br /&gt;   case 7:&lt;br /&gt;    return "Seven ";&lt;br /&gt;   case 8:&lt;br /&gt;    return "Eight ";&lt;br /&gt;   case 9:&lt;br /&gt;    return "Nine ";&lt;br /&gt;  }&lt;br /&gt;  return "";&lt;br /&gt; }&lt;br /&gt; private String belowTwenty(long x)&lt;br /&gt; {&lt;br /&gt;  if(x&lt;10)&lt;br /&gt;   return belowTen(x);&lt;br /&gt;  switch((int)x)&lt;br /&gt;  {&lt;br /&gt;   case 10:&lt;br /&gt;    return "Ten ";&lt;br /&gt;   case 11:&lt;br /&gt;    return "Eleven ";&lt;br /&gt;   case 12:&lt;br /&gt;    return "Twelve ";&lt;br /&gt;   case 13:&lt;br /&gt;    return "Thirteen ";&lt;br /&gt;   case 14:&lt;br /&gt;    return "Fourteen ";&lt;br /&gt;   case 15:&lt;br /&gt;    return "Fifteen ";&lt;br /&gt;   case 16:&lt;br /&gt;    return "Sixteen ";&lt;br /&gt;   case 17:&lt;br /&gt;    return "Seventeen ";&lt;br /&gt;   case 18:&lt;br /&gt;    return "Eighteen ";&lt;br /&gt;   case 19:&lt;br /&gt;    return "Nineteen ";&lt;br /&gt;  }&lt;br /&gt;  return "";&lt;br /&gt; }&lt;br /&gt; private String belowHundred(long x)&lt;br /&gt; {&lt;br /&gt;  if(x&lt;10)&lt;br /&gt;   return belowTen(x);&lt;br /&gt;  else if(x&lt;20)&lt;br /&gt;   return belowTwenty(x);&lt;br /&gt;  switch((int)leftChars(x,1))&lt;br /&gt;  {&lt;br /&gt;   case 2:&lt;br /&gt;    return "Twenty "+belowTen(rightChars(x,1));&lt;br /&gt;   case 3:&lt;br /&gt;    return "Thirty "+belowTen(rightChars(x,1));&lt;br /&gt;   case 4:&lt;br /&gt;    return "Fourty "+belowTen(rightChars(x,1));&lt;br /&gt;   case 5:&lt;br /&gt;    return "Fifty "+belowTen(rightChars(x,1));&lt;br /&gt;   case 6:&lt;br /&gt;    return "Sixty "+belowTen(rightChars(x,1));&lt;br /&gt;   case 7:&lt;br /&gt;    return "Seventy "+belowTen(rightChars(x,1));&lt;br /&gt;   case 8:&lt;br /&gt;    return "Eighty "+belowTen(rightChars(x,1));&lt;br /&gt;   case 9:&lt;br /&gt;    return "Ninety "+belowTen(rightChars(x,1));&lt;br /&gt;  }&lt;br /&gt;  return "";&lt;br /&gt; }&lt;br /&gt; private String belowThousand(long x)&lt;br /&gt; {&lt;br /&gt;  if(x&lt;10)&lt;br /&gt;   return belowTen(x);&lt;br /&gt;  else if(x&lt;20)&lt;br /&gt;   return belowTwenty(x);&lt;br /&gt;  else if(x&lt;100)&lt;br /&gt;   return belowHundred(x);&lt;br /&gt;  return belowTen(leftChars(x,1))+"Hundred "+belowHundred(rightChars(x,2));&lt;br /&gt; }&lt;br /&gt; private String belowLakh(long x)&lt;br /&gt; {&lt;br /&gt;  if(x&lt;10)&lt;br /&gt;   return belowTen(x);&lt;br /&gt;  else if(x&lt;20)&lt;br /&gt;   return belowTwenty(x);&lt;br /&gt;  else if(x&lt;100)&lt;br /&gt;   return belowHundred(x);&lt;br /&gt;  else if(x&lt;1000)&lt;br /&gt;   return belowThousand(x);&lt;br /&gt;  if(length(x)==4)&lt;br /&gt;   return belowTen(leftChars(x,1))+"Thousand "+belowThousand(rightChars(x,3));&lt;br /&gt;  else&lt;br /&gt;   return belowHundred(leftChars(x,2))+"Thousand "+belowThousand(rightChars(x,3));&lt;br /&gt; }&lt;br /&gt; public String belowCrore(long x)&lt;br /&gt; {&lt;br /&gt;  if(x&lt;10)&lt;br /&gt;   return belowTen(x);&lt;br /&gt;  else if(x&lt;20)&lt;br /&gt;   return belowTwenty(x);&lt;br /&gt;  else if(x&lt;100)&lt;br /&gt;   return belowHundred(x);&lt;br /&gt;  else if(x&lt;1000)&lt;br /&gt;   return belowThousand(x);&lt;br /&gt;  else if(x&lt;100000)&lt;br /&gt;   return belowLakh(x);&lt;br /&gt;  if(length(x)==6)&lt;br /&gt;   return belowTen(leftChars(x,1))+"Lakh "+belowLakh(rightChars(x,5));&lt;br /&gt;  else&lt;br /&gt;   return belowHundred(leftChars(x,2))+"Lakh "+belowLakh(rightChars(x,5));&lt;br /&gt; }&lt;br /&gt; public String belowBilion(long x)&lt;br /&gt; {&lt;br /&gt;  if(x&lt;10)&lt;br /&gt;   return belowTen(x);&lt;br /&gt;  else if(x&lt;20)&lt;br /&gt;   return belowTwenty(x);&lt;br /&gt;  else if(x&lt;100)&lt;br /&gt;   return belowHundred(x);&lt;br /&gt;  else if(x&lt;1000)&lt;br /&gt;   return belowThousand(x);&lt;br /&gt;  else if(x&lt;100000)&lt;br /&gt;   return belowLakh(x);&lt;br /&gt;  else if(x&lt;100000000)&lt;br /&gt;   return belowCrore(x);&lt;br /&gt;  &lt;br /&gt;  if(length(x)==8)&lt;br /&gt;   return belowTen(leftChars(x,1))+"Bilion "+belowCrore(rightChars(x,7));&lt;br /&gt;  else&lt;br /&gt;   return belowHundred(leftChars(x,2))+"Bilion "+belowCrore(rightChars(x,7));&lt;br /&gt; }&lt;br /&gt; public String getNumberInWords()&lt;br /&gt; {&lt;br /&gt;  if(num&lt;10)&lt;br /&gt;   return belowTen(num);&lt;br /&gt;  else if(num&lt;20)&lt;br /&gt;   return belowTwenty(num);&lt;br /&gt;  else if(num&lt;100)&lt;br /&gt;   return belowHundred(num);&lt;br /&gt;  else if(num&lt;1000)&lt;br /&gt;   return belowThousand(num);&lt;br /&gt;  else if(num&lt;100000)&lt;br /&gt;   return belowLakh(num);&lt;br /&gt;  else if(num&lt;10000000)&lt;br /&gt;   return belowCrore(num);&lt;br /&gt;  else if(num&lt;1000000000)&lt;br /&gt;   return belowBilion(num);&lt;br /&gt;  return "";&lt;br /&gt; }&lt;br /&gt; public static void main(String[] args) throws Exception&lt;br /&gt; {&lt;br /&gt;  System.out.println("Enter one number:");&lt;br /&gt;  BufferedReader br=new BufferedReader(new InputStreamReader(System.in));&lt;br /&gt;  Words w=Words.getInstance(Integer.parseInt(br.readLine()));&lt;br /&gt;  System.out.println(w.getNumberInWords());&lt;br /&gt; }&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;My program would support till 1 Billion. If you would like to extend more, you can. The above program has been successfully compiled and tested in Java 1.4 and 1.5.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://java-servlet-jsp-web.blogspot.com/search/label/Java%20programs" title="Other Java programs"&gt;Click here&lt;/a&gt; to check out other programs that I've developed.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7316847079866971282-5643435571832034419?l=java-servlet-jsp-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java-servlet-jsp-web.blogspot.com/feeds/5643435571832034419/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/05/java-class-to-convert-number-into-words.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/5643435571832034419'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/5643435571832034419'/><link rel='alternate' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/05/java-class-to-convert-number-into-words.html' title='Java class to convert number into words'/><author><name>Santhosh Reddy</name><uri>http://www.blogger.com/profile/05232963292855488994</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_P0JbJW7kyKo/ShZkH-FOe4I/AAAAAAAAHP0/ogsB2X0vAMU/S220/IMG_0305.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7316847079866971282.post-7753063318077305075</id><published>2009-05-29T12:14:00.005+05:30</published><updated>2009-06-10T19:54:42.432+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='web application'/><category scheme='http://www.blogger.com/atom/ns#' term='Javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='Browser'/><title type='text'>IE will not pass REFERER header when you use window.location</title><content type='html'>Hi guys... recently I've noticed an issue with IE header when we use window.location construct in Javascript. Generally, most common way of opening a website through Javascript is window.location. But if you're doing any logic based on the header REFERER in the target page, that will not work in IE, since IE browser will not pass REFERER header when you use window.location.&lt;br /&gt;&lt;br /&gt;I was in the same position and tried to find a solution for that, here is what I've done to enable the REFERER header for IE.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Here is the general way of invoking:&lt;/span&gt;&lt;br /&gt;&lt;pre class="program"&gt;function general(url)&lt;br /&gt;{&lt;br /&gt;  window.location=url;&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Here is the special way:&lt;/span&gt;&lt;br /&gt;        &lt;pre class="program"&gt;function special(url)&lt;br /&gt;        {&lt;br /&gt;            var anchor = document.createElement("a");&lt;br /&gt;            if(!anchor.click) { //Providing a logic for Non IE&lt;br /&gt;                window.location = url;&lt;br /&gt;                return;&lt;br /&gt;            }&lt;br /&gt;            anchor.setAttribute("href", url);&lt;br /&gt;            anchor.style.display = "none";&lt;br /&gt;            document.getElementById("body").appendChild(anchor);&lt;br /&gt;            anchor.click();&lt;br /&gt;        }&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://java-servlet-jsp-web.blogspot.com/search/label/Javascript" title="Javascript programs"&gt;Click here&lt;/a&gt; to view other Java script programs that I've developed.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7316847079866971282-7753063318077305075?l=java-servlet-jsp-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java-servlet-jsp-web.blogspot.com/feeds/7753063318077305075/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/05/ie-will-not-pass-referer-header-when.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/7753063318077305075'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/7753063318077305075'/><link rel='alternate' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/05/ie-will-not-pass-referer-header-when.html' title='IE will not pass REFERER header when you use window.location'/><author><name>Santhosh Reddy</name><uri>http://www.blogger.com/profile/05232963292855488994</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_P0JbJW7kyKo/ShZkH-FOe4I/AAAAAAAAHP0/ogsB2X0vAMU/S220/IMG_0305.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7316847079866971282.post-1734174766613870967</id><published>2009-05-21T11:48:00.003+05:30</published><updated>2009-06-10T19:55:42.832+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='Web technology'/><category scheme='http://www.blogger.com/atom/ns#' term='HTML'/><title type='text'>Add a new element (item) into HTML drop down or list box</title><content type='html'>When you're in a situation to add the new items to the HTML drop down's, the below script will be handy for you to add them dynamically.&lt;br /&gt;&lt;br /&gt;&lt;pre class="program"&gt;//Common function to add a new item to the drop down or list box&lt;br /&gt;function addElement(element, name, value)&lt;br /&gt;{&lt;br /&gt; if(document.getElementById(element))&lt;br /&gt; {&lt;br /&gt;  document.getElementById(element).options[document.getElementById(element).options.length]=new Option(name,value);&lt;br /&gt; }&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;The above function addElement will accept three arguments element, name, and value. You should pass the drop down or list box id as the element, name and value of the new option to be included.&lt;br /&gt;&lt;br /&gt;Tested on all the browsers IE 6.0,7.0, Mozilla 2.0,3.0 and Google chrome.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://java-servlet-jsp-web.blogspot.com/search/label/Javascript" title="Javascript programs"&gt;Click here&lt;/a&gt; to view other Java script programs that I've developed.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7316847079866971282-1734174766613870967?l=java-servlet-jsp-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java-servlet-jsp-web.blogspot.com/feeds/1734174766613870967/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/05/add-new-element-item-into-html-drop.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/1734174766613870967'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/1734174766613870967'/><link rel='alternate' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/05/add-new-element-item-into-html-drop.html' title='Add a new element (item) into HTML drop down or list box'/><author><name>Santhosh Reddy</name><uri>http://www.blogger.com/profile/05232963292855488994</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_P0JbJW7kyKo/ShZkH-FOe4I/AAAAAAAAHP0/ogsB2X0vAMU/S220/IMG_0305.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7316847079866971282.post-4170699794567732657</id><published>2009-05-21T11:40:00.002+05:30</published><updated>2009-06-10T19:56:45.614+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='Web technology'/><category scheme='http://www.blogger.com/atom/ns#' term='HTML'/><title type='text'>Disbale the browser's auto complete for input fields</title><content type='html'>Each browser provides an option to store the recent value for an input field with the same name, entered by the user. This is called browser auto complete. Some time you'll be in the scenario that, you don't want to show the browser cache. i.e.; if you've already provided the auto complete for the input field, you definitely want to remove the existing browser auto complete functionality.&lt;br /&gt;&lt;br /&gt;Include the below script on the page and invoke that for your form.&lt;br /&gt;&lt;br /&gt;&lt;pre class="program"&gt;//This function is to set the auto complete off for the first form&lt;br /&gt;function autocompleteOff(element) {&lt;br /&gt; self.focus(); //Bring window to foreground if necessary.&lt;br /&gt; var form = document.getElementById(element); // grab the form element.&lt;br /&gt; if(form)&lt;br /&gt; {&lt;br /&gt;  form.setAttribute("autocomplete","off"); // Turn off Autocomplete for the form, if the browser supports it.&lt;br /&gt;  form.elements[0].focus(); // Send the cursor to the first field of the first form&lt;br /&gt; }&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Example, if you've a form with the id "userform", you should invoke this as below&lt;br /&gt;autocompleteOff("userform"); will do the job.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://java-servlet-jsp-web.blogspot.com/search/label/Javascript" title="Javascript programs"&gt;Click here&lt;/a&gt; to view other Java script programs that I've developed.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7316847079866971282-4170699794567732657?l=java-servlet-jsp-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java-servlet-jsp-web.blogspot.com/feeds/4170699794567732657/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/05/disbale-browsers-auto-complete-for.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/4170699794567732657'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/4170699794567732657'/><link rel='alternate' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/05/disbale-browsers-auto-complete-for.html' title='Disbale the browser&apos;s auto complete for input fields'/><author><name>Santhosh Reddy</name><uri>http://www.blogger.com/profile/05232963292855488994</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_P0JbJW7kyKo/ShZkH-FOe4I/AAAAAAAAHP0/ogsB2X0vAMU/S220/IMG_0305.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7316847079866971282.post-2093186524148307187</id><published>2009-05-21T11:27:00.002+05:30</published><updated>2009-06-10T19:57:57.034+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='Web technology'/><category scheme='http://www.blogger.com/atom/ns#' term='HTML'/><title type='text'>Disable enter key on HTML form</title><content type='html'>Usually when you press enter on the HTML form text fields, form gets submitted. If you don't want to submit the form when user clicks submit, you need tell the browser to disable this default functionality. i.e.; you should disable the enter key for HTML form.&lt;br /&gt;&lt;br /&gt;To implement this logic, simply you should include the below script on the page. The &lt;br /&gt;&lt;br /&gt;&lt;pre class="program"&gt;//Disabling the enter button on the form&lt;br /&gt;function stopEnterKey(evt)&lt;br /&gt;{&lt;br /&gt; var evt=(evt)?evt:((event)?event:null);&lt;br /&gt; var node=(evt.target)?evt.target:((evt.srcElement)?evt.srcElement:null);&lt;br /&gt; if((evt.keyCode == 13) &amp;&amp; (node.type=="text")) {return false;}&lt;br /&gt; //13 is the ascii for enter and if you want another type of element change text to password, radio etc&lt;br /&gt;}&lt;br /&gt;document.onkeypress = stopEnterKey; //Invoking this on key press&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;The above script will disable the enter key for all the text fields. If you wan't this to be disabled for a different type of, change the node.type to password or radio.&lt;br /&gt;&lt;br /&gt;This has been tested on IE 6 and 7, Firefox 2.0 and 3.0, Google chrome, Safari.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://java-servlet-jsp-web.blogspot.com/search/label/Javascript" title="Javascript programs"&gt;Click here&lt;/a&gt; to view other Java script programs that I've developed.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7316847079866971282-2093186524148307187?l=java-servlet-jsp-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java-servlet-jsp-web.blogspot.com/feeds/2093186524148307187/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/05/disable-enter-key-on-html-form.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/2093186524148307187'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/2093186524148307187'/><link rel='alternate' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/05/disable-enter-key-on-html-form.html' title='Disable enter key on HTML form'/><author><name>Santhosh Reddy</name><uri>http://www.blogger.com/profile/05232963292855488994</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_P0JbJW7kyKo/ShZkH-FOe4I/AAAAAAAAHP0/ogsB2X0vAMU/S220/IMG_0305.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7316847079866971282.post-8259774097436081563</id><published>2009-05-19T14:47:00.002+05:30</published><updated>2009-06-12T19:55:48.290+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='web application'/><category scheme='http://www.blogger.com/atom/ns#' term='HTTP'/><category scheme='http://www.blogger.com/atom/ns#' term='Web protocol'/><category scheme='http://www.blogger.com/atom/ns#' term='Web technology'/><category scheme='http://www.blogger.com/atom/ns#' term='HTML'/><title type='text'>HTTP protocol overview</title><content type='html'>&lt;p&gt;HTTP is an acronym for Hyper Text Transfer Protocol. A protocol is a set of rules that needs to be followed by two computers while communicating each other on the network.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;HTTP development was coordinated by the World Wide Web Consortium (W3C) and the Internet Engineering Task Force (IETF), culminating in the publication of a series of Requests for Comments (RFCs), (June 1999), which defines HTTP/1.1, the version of HTTP in common use.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;HTTP is a request/response standard of a client and a server. A client is the end-user, the server is the web site. The client making a HTTP request—using a web browser, spider, or other end-user tool—is referred to as the user agent. The responding server—which stores or creates resources such as HTML files and images—is called the origin server. In between the user agent and origin server may be several intermediaries, such as proxies, gateways, and tunnels. HTTP is not constrained to using TCP/IP and its supporting layers, although this is its most popular application on the Internet. Indeed HTTP can be "implemented on top of any other protocol on the Internet, or on other networks." HTTP only presumes a reliable transport; any protocol that provides such guarantees can be used."&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Typically, an HTTP client initiates a request. It establishes a Transmission Control Protocol (TCP) connection to a particular port on a host (port 80 by default). An HTTP server listening on that port waits for the client to send a request message. Upon receiving the request, the server sends back a status line, such as "HTTP/1.1 200 OK", and a message of its own, the body of which is perhaps the requested resource, an error message, or some other information.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7316847079866971282-8259774097436081563?l=java-servlet-jsp-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java-servlet-jsp-web.blogspot.com/feeds/8259774097436081563/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/05/http-protocol-overview.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/8259774097436081563'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/8259774097436081563'/><link rel='alternate' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/05/http-protocol-overview.html' title='HTTP protocol overview'/><author><name>Santhosh Reddy</name><uri>http://www.blogger.com/profile/05232963292855488994</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_P0JbJW7kyKo/ShZkH-FOe4I/AAAAAAAAHP0/ogsB2X0vAMU/S220/IMG_0305.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7316847079866971282.post-5434687803572655689</id><published>2009-05-19T14:27:00.001+05:30</published><updated>2009-06-10T13:53:02.028+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='JDK'/><title type='text'>Java 2 Platform Standard Edition 5.0 features</title><content type='html'>&lt;span style="font-weight:bold;"&gt;Java&lt;/span&gt; 2 Platform Standard Edition 5.0 is a major feature release. The features listed below are introduced in 5.0 since the previous major release (1.4.0). All these feature include Language changes, performance enhancements and virtual machine techniques.&lt;br /&gt;&lt;strong&gt;Java Language Features:&lt;/strong&gt;&lt;br /&gt;&lt;ul&gt;&lt;br /&gt;&lt;li&gt;&lt;strong&gt;Generics&lt;/strong&gt;&lt;p&gt;This long-awaited enhancement to the type system allows a type or method to operate on objects of various types while providing compile-time type safety. It adds compile-time type safety to the Collections Framework and eliminates the drudgery of casting.&lt;/p&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;strong&gt;Enhanced for Loop&lt;/strong&gt;&lt;p&gt;This new language construct eliminates the drudgery and error-proneness of iterators and index variables when iterating over collections and arrays.&lt;/p&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;strong&gt;Autoboxing/Unboxing &lt;/strong&gt;&lt;p&gt;This facility eliminates the drudgery of manual conversion between primitive types (such as int) and wrapper types (such as Integer).&lt;/p&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;strong&gt;Typesafe Enums&lt;/strong&gt;&lt;p&gt;This flexible object-oriented enumerated type facility allows you to create enumerated types with arbitrary methods and fields. It provides all the benefits of the Typesafe Enum pattern ("Effective Java," Item 21) without the verbosity and the error-proneness.&lt;/p&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;strong&gt;Varargs&lt;/strong&gt;&lt;p&gt;This facility eliminates the need for manually boxing up argument lists into an array when invoking methods that accept variable-length argument lists. &lt;/p&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;strong&gt;Static Import&lt;/strong&gt;&lt;p&gt;This facility lets you avoid qualifying static members with class names without the shortcomings of the "Constant Interface antipattern."&lt;/p&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;strong&gt;Metadata (Annotations)&lt;/strong&gt;&lt;p&gt;This language feature lets you avoid writing boilerplate code under many circumstances by enabling tools to generate it from annotations in the source code. This leads to a "declarative" programming style where the programmer says what should be done and tools emit the code to do it. Also it eliminates the need for maintaining "side files" that must be kept up to date with changes in source files. Instead the information can be maintained in the source file.&lt;/p&gt;&lt;/li&gt;&lt;br /&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7316847079866971282-5434687803572655689?l=java-servlet-jsp-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java-servlet-jsp-web.blogspot.com/feeds/5434687803572655689/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/05/java-2-platform-standard-edition-50.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/5434687803572655689'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/5434687803572655689'/><link rel='alternate' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/05/java-2-platform-standard-edition-50.html' title='Java 2 Platform Standard Edition 5.0 features'/><author><name>Santhosh Reddy</name><uri>http://www.blogger.com/profile/05232963292855488994</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_P0JbJW7kyKo/ShZkH-FOe4I/AAAAAAAAHP0/ogsB2X0vAMU/S220/IMG_0305.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7316847079866971282.post-5597020299390476918</id><published>2009-03-03T15:48:00.001+05:30</published><updated>2009-06-10T13:53:30.981+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Computer'/><category scheme='http://www.blogger.com/atom/ns#' term='Web technology'/><title type='text'>Computer network</title><content type='html'>A computer network is a physical or logical connection between any two computers. These networks are of three types &lt;strong&gt;Local Area Network (LAN), Metropolitan Area Network (MAN), and Wide Area Network (WAN)&lt;/strong&gt;.&lt;br /&gt;LAN is a connection between two computers which are physically less than 1 km distant. This network usually exists in the office. Where as MAN is a connection between the computers whose distance is less than 100 km in between.&lt;br /&gt;WAN is a connection between any computers on the earth. There are no distance limits for this. The best example for WAN is Internet. An internet is a connection of connections.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7316847079866971282-5597020299390476918?l=java-servlet-jsp-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java-servlet-jsp-web.blogspot.com/feeds/5597020299390476918/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java-servlet-jsp-web.blogspot.com/2009/03/computer-network.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7316847079866971282/posts/default/5597020299390476918'/><link rel='self' type='application/atom+xml' href='http
