<?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-8563220776994779598</id><updated>2011-10-13T12:34:55.884-07:00</updated><category term='xml'/><category term='password management'/><category term='jdeveloper'/><category term='jsf errorpage'/><category term='corejava'/><category term='jdbc'/><category term='data structures'/><category term='sql'/><category term='singleton'/><category term='Design Pattern'/><category term='mock'/><category term='jsp'/><category term='ADF security'/><category term='selenium'/><category term='mock staticmethod'/><category term='collections'/><category term='factory'/><category term='codecoverage'/><category term='flex'/><category term='oracle'/><category term='LDAP'/><title type='text'>Java , J2EE , FLEX</title><subtitle type='html'>Corner of the web where i pen down my tech experience</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://lavnish.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://lavnish.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default?start-index=101&amp;max-results=100'/><author><name>Lavnish</name><uri>http://www.blogger.com/profile/16714741724993845980</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://lh4.google.co.uk/image/lavnishl/RdK3Rnp8q2E/AAAAAAAAAAw/g7LYCh-VN-8/s160-c/Me_ramoji.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>138</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-8563220776994779598.post-7018354478734915954</id><published>2009-10-22T06:39:00.000-07:00</published><updated>2009-10-22T06:40:11.115-07:00</updated><title type='text'>Signs that your code sucks</title><content type='html'>Nice &lt;a href="http://www.turnleafdesign.com/?p=246"&gt;read&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8563220776994779598-7018354478734915954?l=lavnish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lavnish.blogspot.com/feeds/7018354478734915954/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8563220776994779598&amp;postID=7018354478734915954' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/7018354478734915954'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/7018354478734915954'/><link rel='alternate' type='text/html' href='http://lavnish.blogspot.com/2009/10/signs-that-your-code-sucks.html' title='Signs that your code sucks'/><author><name>Lavnish</name><uri>http://www.blogger.com/profile/16714741724993845980</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://lh4.google.co.uk/image/lavnishl/RdK3Rnp8q2E/AAAAAAAAAAw/g7LYCh-VN-8/s160-c/Me_ramoji.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8563220776994779598.post-8268995927613702226</id><published>2009-10-15T06:32:00.000-07:00</published><updated>2009-10-15T06:33:30.691-07:00</updated><title type='text'>Java Inner classes</title><content type='html'>Nice &lt;a href="http://viralpatel.net/blogs/2009/10/inner-classes-in-java.html"&gt;Article&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8563220776994779598-8268995927613702226?l=lavnish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lavnish.blogspot.com/feeds/8268995927613702226/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8563220776994779598&amp;postID=8268995927613702226' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/8268995927613702226'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/8268995927613702226'/><link rel='alternate' type='text/html' href='http://lavnish.blogspot.com/2009/10/java-inner-classes.html' title='Java Inner classes'/><author><name>Lavnish</name><uri>http://www.blogger.com/profile/16714741724993845980</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://lh4.google.co.uk/image/lavnishl/RdK3Rnp8q2E/AAAAAAAAAAw/g7LYCh-VN-8/s160-c/Me_ramoji.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8563220776994779598.post-1726005203208107441</id><published>2009-10-03T06:33:00.000-07:00</published><updated>2009-10-03T06:34:54.143-07:00</updated><title type='text'>100 GB JVM</title><content type='html'>interesting article to &lt;a href="http://www.nearinfinity.com/blogs/aaron_mccurry/tuning_the_ibm_jvm_for_large_h.html"&gt;read&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8563220776994779598-1726005203208107441?l=lavnish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lavnish.blogspot.com/feeds/1726005203208107441/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8563220776994779598&amp;postID=1726005203208107441' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/1726005203208107441'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/1726005203208107441'/><link rel='alternate' type='text/html' href='http://lavnish.blogspot.com/2009/10/100-gb-jvm.html' title='100 GB JVM'/><author><name>Lavnish</name><uri>http://www.blogger.com/profile/16714741724993845980</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://lh4.google.co.uk/image/lavnishl/RdK3Rnp8q2E/AAAAAAAAAAw/g7LYCh-VN-8/s160-c/Me_ramoji.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8563220776994779598.post-8615880214004617509</id><published>2009-07-01T02:24:00.000-07:00</published><updated>2009-07-01T02:26:15.177-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='corejava'/><title type='text'>Nullness analysis of Java</title><content type='html'>Found &lt;a href="http://julia.scienze.univr.it:8080/julia/julia.jsp"&gt;this&lt;/a&gt; tool that helps in nullness analysis of Java.&lt;br /&gt;&lt;br /&gt;More details about it in the video&lt;br /&gt;&lt;object width="425" height="344"&gt;&lt;param name="movie" value="http://www.youtube.com/v/3d0YlZbY92U&amp;hl=en&amp;fs=1&amp;"&gt;&lt;/param&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;/param&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;/param&gt;&lt;embed src="http://www.youtube.com/v/3d0YlZbY92U&amp;hl=en&amp;fs=1&amp;" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"&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/8563220776994779598-8615880214004617509?l=lavnish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lavnish.blogspot.com/feeds/8615880214004617509/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8563220776994779598&amp;postID=8615880214004617509' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/8615880214004617509'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/8615880214004617509'/><link rel='alternate' type='text/html' href='http://lavnish.blogspot.com/2009/07/nullness-analysis-of-java.html' title='Nullness analysis of Java'/><author><name>Lavnish</name><uri>http://www.blogger.com/profile/16714741724993845980</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://lh4.google.co.uk/image/lavnishl/RdK3Rnp8q2E/AAAAAAAAAAw/g7LYCh-VN-8/s160-c/Me_ramoji.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8563220776994779598.post-1947871889398883477</id><published>2009-06-15T22:23:00.000-07:00</published><updated>2009-06-15T22:24:21.911-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='flex'/><title type='text'>Flex Flip effect</title><content type='html'>Found some useful links for flip effect&lt;br /&gt;&lt;a href="http://www.alex-uhlmann.de/flash/adobe/blog/distortionEffects/effectCube/"&gt;this&lt;/a&gt; and &lt;a href="http://weblogs.macromedia.com/auhlmann/archives/DistortionEffects.zip"&gt;this&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8563220776994779598-1947871889398883477?l=lavnish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lavnish.blogspot.com/feeds/1947871889398883477/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8563220776994779598&amp;postID=1947871889398883477' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/1947871889398883477'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/1947871889398883477'/><link rel='alternate' type='text/html' href='http://lavnish.blogspot.com/2009/06/flex-flip-effect.html' title='Flex Flip effect'/><author><name>Lavnish</name><uri>http://www.blogger.com/profile/16714741724993845980</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://lh4.google.co.uk/image/lavnishl/RdK3Rnp8q2E/AAAAAAAAAAw/g7LYCh-VN-8/s160-c/Me_ramoji.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8563220776994779598.post-1768574474419057028</id><published>2009-05-06T04:20:00.000-07:00</published><updated>2009-05-06T04:32:49.997-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='LDAP'/><title type='text'>LDAP Intro</title><content type='html'>LDAP is standardized. The body of LDAP standards, including the network protocols, the directory structure, and the services provided by an LDAP server, are all available in the form of RFCs (Requests For Comments).&lt;br /&gt;&lt;br /&gt;LDAP was designed to be a general-purpose directory server. It has not been designed with the purpose of capturing a specific type of data (like telephone numbers or email addresses). Instead, it was designed to give implementers the ability to define—clearly and carefully—what data the directory should store.&lt;br /&gt;&lt;br /&gt;Such a generic directory server ought to be able to store many different kinds of information.&lt;br /&gt;&lt;br /&gt;Let's continue with our comparison of a directory server and a phone book. A phone book contains a very specific type of information, organized in a very specific way, and designed to fulfil a very specific purpose. Here's an example phone book entry:&lt;br /&gt;&lt;br /&gt;Acme Services&lt;br /&gt;123 W. First St.&lt;br /&gt;Chicago, IL 60616-1234&lt;br /&gt;(773) 555-8943 or (800) 555 9834&lt;br /&gt;&lt;br /&gt;As mentioned earlier, this sort of directory has specific information, organized in a specific way, designed to fulfill a specific purpose: it is information about how to contact a specific organization (Acme Services) organized in a familiar pattern (address and phone number). And it is designed so that a person, having a particular name in mind, can quickly scan through the directory (which is ordered alphabetically by organization name), and find the desired contact information.&lt;br /&gt;&lt;br /&gt;But there are a few things to note about the phone book entry:&lt;br /&gt;&lt;br /&gt;    *      The data is arranged for searching by only one value: the name of the organization. If you should happen to have the phone number of the organization, but not the name, searching the phone book for the matching telephone number in order to ascertain the name would be a taxing, and probably futile task.&lt;br /&gt;    *      The format of the entry is sparse, and requires that the reader will be able to recognize the format and supply auxiliary information required for making sense of the data. One accustomed to reading phone book entries will be able to extrapolate from the previous entry, and identify the information this way:&lt;br /&gt;&lt;br /&gt;      Organization Name: Acme Services&lt;br /&gt;      Street Address: 123 West First Street&lt;br /&gt;      City: Chicago&lt;br /&gt;      State: Illinois&lt;br /&gt;      Postal Code: 60616-1234&lt;br /&gt;      Country: USA&lt;br /&gt;      Phone Number: +1 773 555 8943&lt;br /&gt;      Phone Number: +1 800 555 9834&lt;br /&gt;&lt;br /&gt;In this example, the meaning of the information is made more explicit. Each value is preceded by a name that identifies the type of information given. Acme Services is now identified as the name of an organization. Information is also broken up into smaller chunks (city and state on separate lines), and some information which was implicit in the previous entry (such as the country) has been made explicit. And where two pieces of information (the two phone numbers) were initially compressed onto one line, they have now been separated, making the information more explicit.&lt;br /&gt;&lt;br /&gt;This form of entry is closer to the way a record would look in an LDAP directory. But there is still another issue to address. &lt;span style="font-weight: bold;"&gt;How can we distinguish between two very similar records?&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;For example, say we have a telephone directory for the entire state of Illinois. And in Illinois, we have a company called Acme Services located in the city of Chicago, and another company named Acme Services located in the city of Springfield.&lt;br /&gt;&lt;br /&gt;Simply knowing the company name alone is not sufficient information to isolate just one entry in the phone book. To do that, we would need some sort of unique name—a name that exists only once in the entire directory, and which can be used to refer to one specific entry.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;A Unique Name: The DN&lt;/span&gt;&lt;br /&gt;One way of distinguishing between two very similar records is to create a unique name for each record in the directory. This is the strategy adopted by LDAP; each record in the directory has a distinguished name. The distinguished name is an important LDAP term; usually it is abbreviated as DN.&lt;br /&gt;&lt;br /&gt;In an LDAP directory, the directory designer is the one who decides what components will make up a DN, but typically the DN reflects where the record is in the directory (a concept we will examine in the next part), as well as some information that distinguishes this record from other near records.&lt;br /&gt;&lt;br /&gt;A DN then, is composed of a combination of directory information, and looks something like this:&lt;br /&gt;&lt;br /&gt;dn: o=Acme Services, l=Chicago, st=Illinois, c=US&lt;br /&gt;&lt;br /&gt;This single identifier is sufficient to pick it out from the Springfield company by the same name. The DN of the Springfield company named Acme Services would, according to the previous scheme, look something like this:&lt;br /&gt;&lt;br /&gt;dn: o=Acme Services, l=Springfield, st=Illinois, c=US&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Some parts of LDAP records are case sensitive, and others are not. &lt;span style="font-style: italic;"&gt;DNs, for example, are not case sensitive.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Let's take a specific look at what an LDAP entry looks like.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;A LDAP entry is composed of a DN and one or more attributes. &lt;/span&gt;The DN serves as a unique identifier within an LDAP directory information tree. Attributes provide information about that entry. Let's convert our previous telephone directory entry into an LDAP record:&lt;br /&gt;&lt;br /&gt;dn: o=Acme Services, l=Chicago, st=Illinois, c=US&lt;br /&gt;o: Acme Services&lt;br /&gt;postalAddress: 123 West First Street&lt;br /&gt;l: Chicago&lt;br /&gt;st: Illinois&lt;br /&gt;postalCode: 60616-1234&lt;br /&gt;c: US&lt;br /&gt;telephoneNumber: +1 773 555 8943&lt;br /&gt;telephoneNumber: +1 800 555 9834&lt;br /&gt;objectclass: organization&lt;br /&gt;&lt;br /&gt;The first line is the DN. All other lines in this record represent attributes.&lt;br /&gt;&lt;br /&gt;These attribute names, like o and postalAddress, refer to well-defined attribute definitions contained in an LDAP schema. They cannot be "invented" on the fly, or made up as you go. Creating new attributes requires writing a schema.&lt;br /&gt;&lt;br /&gt;An attribute describes a specific type of information. There are eight attributes here in our example, representing the following:&lt;br /&gt;&lt;br /&gt;   1.      Organization Name (o)&lt;br /&gt;   2.      Mailing address (postalAddress)&lt;br /&gt;   3.      Locality (l), which may be the name of a city, town, village, and so forth&lt;br /&gt;   4.      State or Province (st)&lt;br /&gt;   5.      Postal Code or ZIP Code (postalCode)&lt;br /&gt;   6.      Country (c)&lt;br /&gt;   7.      Telephone Number (telephoneNumber)&lt;br /&gt;   8.      Object Class (objectclass), which specifies what type (or types) of record this entry is&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;An attribute may have one or more attribute names, where these names are synonyms. &lt;/span&gt;For example c and countryName are both names for the attribute type that identify a country. Both identify the same information, and LDAP will treat the two names as describing the same type of information.&lt;br /&gt;&lt;br /&gt;In any given record, an attribute may have one or more values (assuming the attribute's definition allows more than one value). The record above has only one attribute that contains more than one value. The telephoneNumber attribute has two values, each representing a different phone number.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Attribute names are not case sensitive.&lt;/span&gt; The attribute name o is treated as synonymous with the name O. Likewise, GivenName, givenname, and givenName are all evaluated as the same attribute name.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;As for the values of attributes, case sensitivity depends on the attribute definition.&lt;/span&gt; For example, the values of DNs and objectclass attributes are not case sensitive, but a URI (labeledURI) attribute value is case sensitive.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;The Object Class Attribute&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The last attribute in the given record is the objectclass attribute. This is a special attribute that provides information about what type of record (or entry) this is.&lt;br /&gt;&lt;br /&gt;An object class determines what attributes may be given to a record.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8563220776994779598-1768574474419057028?l=lavnish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lavnish.blogspot.com/feeds/1768574474419057028/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8563220776994779598&amp;postID=1768574474419057028' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/1768574474419057028'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/1768574474419057028'/><link rel='alternate' type='text/html' href='http://lavnish.blogspot.com/2009/05/ldap-intro.html' title='LDAP Intro'/><author><name>Lavnish</name><uri>http://www.blogger.com/profile/16714741724993845980</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://lh4.google.co.uk/image/lavnishl/RdK3Rnp8q2E/AAAAAAAAAAw/g7LYCh-VN-8/s160-c/Me_ramoji.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8563220776994779598.post-6998752345107891535</id><published>2009-05-05T21:46:00.000-07:00</published><updated>2009-05-05T21:56:00.091-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ADF security'/><title type='text'>ADF security</title><content type='html'>Whenever one enables the security in an ADF web application one must always cross verify if jdev has generated "adf-config.xml" in the folder "web-project/.adf/META-INF"&lt;br /&gt;&lt;br /&gt;from the docs "To enable Oracle ADF Security authorization, you create a configuration file named &lt;code&gt;adf-config.xml&lt;/code&gt; that sets the application's container to use Oracle ADF Security. The file initializes the ADFContext and SecurityContext."&lt;br /&gt;&lt;br /&gt;more details of ADF xml can be found &lt;a href="http://download.oracle.com/docs/cd/E12839_01/web.1111/b31974/appendixa.htm"&gt;here&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8563220776994779598-6998752345107891535?l=lavnish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lavnish.blogspot.com/feeds/6998752345107891535/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8563220776994779598&amp;postID=6998752345107891535' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/6998752345107891535'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/6998752345107891535'/><link rel='alternate' type='text/html' href='http://lavnish.blogspot.com/2009/05/adf-security.html' title='ADF security'/><author><name>Lavnish</name><uri>http://www.blogger.com/profile/16714741724993845980</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://lh4.google.co.uk/image/lavnishl/RdK3Rnp8q2E/AAAAAAAAAAw/g7LYCh-VN-8/s160-c/Me_ramoji.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8563220776994779598.post-5225649732334686089</id><published>2009-03-31T05:57:00.000-07:00</published><updated>2009-03-31T05:58:34.490-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='codecoverage'/><category scheme='http://www.blogger.com/atom/ns#' term='selenium'/><title type='text'>Selenium and code coverage</title><content type='html'>More details at&lt;br /&gt;&lt;a href="http://bxm.at/blogs/java/2006/12/29/webappliction_code_coverage"&gt;http://bxm.at/blogs/java/2006/12/29/webappliction_code_coverage&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8563220776994779598-5225649732334686089?l=lavnish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lavnish.blogspot.com/feeds/5225649732334686089/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8563220776994779598&amp;postID=5225649732334686089' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/5225649732334686089'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/5225649732334686089'/><link rel='alternate' type='text/html' href='http://lavnish.blogspot.com/2009/03/selenium-and-code-coverage.html' title='Selenium and code coverage'/><author><name>Lavnish</name><uri>http://www.blogger.com/profile/16714741724993845980</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://lh4.google.co.uk/image/lavnishl/RdK3Rnp8q2E/AAAAAAAAAAw/g7LYCh-VN-8/s160-c/Me_ramoji.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8563220776994779598.post-2817869656127983130</id><published>2009-03-03T00:51:00.000-08:00</published><updated>2009-03-03T00:58:29.983-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='jsf errorpage'/><title type='text'>JSF and Error pages</title><content type='html'>Have been looking around for a general strategy that for adding an error page to an ADF Application.  found there options&lt;br /&gt;&lt;br /&gt;&lt;a href="http://java.sun.com/developer/EJTechTips/2003/tt0114.html"&gt;Option 1&lt;/a&gt; : make html error pages for each type of exception&lt;br /&gt;&lt;a href="http://bigallan.blogspot.com/2008/04/creating-generic-error-page-for-jsf.html"&gt;Option 2&lt;/a&gt; : make one error page and generalized bean&lt;br /&gt;&lt;a href="http://forums.java.net/jive/message.jspa?messageID=302748"&gt;Option 3&lt;/a&gt; : Make one error page, One task flow for it , In all the managaed beans inside try catch do add return "error_page_task_flow"&lt;br /&gt;&lt;br /&gt;Different approaches may be useful in different scenarious&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8563220776994779598-2817869656127983130?l=lavnish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lavnish.blogspot.com/feeds/2817869656127983130/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8563220776994779598&amp;postID=2817869656127983130' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/2817869656127983130'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/2817869656127983130'/><link rel='alternate' type='text/html' href='http://lavnish.blogspot.com/2009/03/jsf-and-error-pages.html' title='JSF and Error pages'/><author><name>Lavnish</name><uri>http://www.blogger.com/profile/16714741724993845980</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://lh4.google.co.uk/image/lavnishl/RdK3Rnp8q2E/AAAAAAAAAAw/g7LYCh-VN-8/s160-c/Me_ramoji.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8563220776994779598.post-2139920598887732174</id><published>2009-03-01T22:55:00.000-08:00</published><updated>2009-03-01T22:56:14.686-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='mock staticmethod'/><title type='text'>why we cant mock static methods</title><content type='html'>This wasn't obvious to me at first, it took me a while to get why we can't mock static methods. So here it goes the reason in one line,&lt;br /&gt;&lt;br /&gt;"Static methods aren't polymorphic, they are resolved at compile time, therefor it's not possible to use mock objects to test."&lt;br /&gt;&lt;br /&gt;Hope this help you guys who are scratching your head like I was.... (if you are not sure about polymorphism, think of it as late binding)&lt;br /&gt;&lt;br /&gt;In my previous posts i showed one of the ways you can mock static methods, but the limitation is that you need to know the implementation of the class. What if i am using another classes static method whose cource code i dont know.&lt;br /&gt;&lt;br /&gt;for example : FacesContext fc = facesContext.getInstance();&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8563220776994779598-2139920598887732174?l=lavnish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lavnish.blogspot.com/feeds/2139920598887732174/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8563220776994779598&amp;postID=2139920598887732174' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/2139920598887732174'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/2139920598887732174'/><link rel='alternate' type='text/html' href='http://lavnish.blogspot.com/2009/03/why-we-cant-mock-static-methods.html' title='why we cant mock static methods'/><author><name>Lavnish</name><uri>http://www.blogger.com/profile/16714741724993845980</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://lh4.google.co.uk/image/lavnishl/RdK3Rnp8q2E/AAAAAAAAAAw/g7LYCh-VN-8/s160-c/Me_ramoji.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8563220776994779598.post-732283641520938836</id><published>2009-03-01T20:29:00.000-08:00</published><updated>2009-03-01T20:38:12.584-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='mock'/><category scheme='http://www.blogger.com/atom/ns#' term='singleton'/><category scheme='http://www.blogger.com/atom/ns#' term='factory'/><title type='text'>Mocking singletons and Factories</title><content type='html'>Mocking singletons ., factories may not be that obvious.&lt;br /&gt;&lt;br /&gt;public class Singleton {&lt;br /&gt;    private Singleton instance = new Singleton ();&lt;br /&gt;    public static Singleton getInstance() {&lt;br /&gt;        return instance;&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;@Test&lt;br /&gt;public void testSingleton() {&lt;br /&gt;   Field instanceField = Singleton .class.getField("instance");&lt;br /&gt;   instanceField.setAccessible(true);&lt;br /&gt;   Singleton realSingleton = instanceField.get(null);&lt;br /&gt;   Singleton mockSingleton = EasyMock.createMock(Singleton .class);&lt;br /&gt;   try {&lt;br /&gt;       instanceField.set(null, mockSingleton);&lt;br /&gt;       // now do your testing, Singleton.getInstance() should now return the mock&lt;br /&gt;   } finally {&lt;br /&gt;      instanceField.set(null, reallSingleton);&lt;br /&gt;      instanceField.setAccessible(false);&lt;br /&gt;   }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;This is fairly hacky, not robust to changes in the singleton class, won't work with a security manager, and it may not work well in the case where the field is instantiated in a static initializer and other fields use that instance when they are initialized.  But it probably will work in many cases.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8563220776994779598-732283641520938836?l=lavnish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lavnish.blogspot.com/feeds/732283641520938836/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8563220776994779598&amp;postID=732283641520938836' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/732283641520938836'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/732283641520938836'/><link rel='alternate' type='text/html' href='http://lavnish.blogspot.com/2009/03/mocking-singletons-and-factories.html' title='Mocking singletons and Factories'/><author><name>Lavnish</name><uri>http://www.blogger.com/profile/16714741724993845980</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://lh4.google.co.uk/image/lavnishl/RdK3Rnp8q2E/AAAAAAAAAAw/g7LYCh-VN-8/s160-c/Me_ramoji.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8563220776994779598.post-5260080473484140550</id><published>2009-02-02T19:27:00.000-08:00</published><updated>2009-02-02T20:05:54.506-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='jdeveloper'/><category scheme='http://www.blogger.com/atom/ns#' term='oracle'/><title type='text'>Difference between rebuild and make in jdeveloper</title><content type='html'>The difference is ...&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Rebuild is compiling all selected .java files, regardless if an up-to-date .class file is available or not&lt;/li&gt;&lt;li&gt;Make is compiling those selected .java files for which no up-to-date .class file is available PLUS all .java files which are on the source path AND dependent on the selected .java files&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;Please note that in both cases the selection makes a difference:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;if your selection includes only .java files or packages, only files in the same project will be compiled&lt;/li&gt;&lt;li&gt; if you select one or more projects, compilation will also include any projects which depend on the selected project(s). To prevent building a long list of dependend projects the latest builds of JDev offer the feature Build | Make &lt;project&gt; Only and Build | Rebuild &lt;project&gt; Only, respectively.&lt;/li&gt;&lt;/ol&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8563220776994779598-5260080473484140550?l=lavnish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lavnish.blogspot.com/feeds/5260080473484140550/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8563220776994779598&amp;postID=5260080473484140550' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/5260080473484140550'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/5260080473484140550'/><link rel='alternate' type='text/html' href='http://lavnish.blogspot.com/2009/02/difference-between-rebuild-and-make-in.html' title='Difference between rebuild and make in jdeveloper'/><author><name>Lavnish</name><uri>http://www.blogger.com/profile/16714741724993845980</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://lh4.google.co.uk/image/lavnishl/RdK3Rnp8q2E/AAAAAAAAAAw/g7LYCh-VN-8/s160-c/Me_ramoji.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8563220776994779598.post-352668358604144601</id><published>2009-01-26T04:38:00.000-08:00</published><updated>2009-01-26T04:57:19.570-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='data structures'/><title type='text'>Java Util package doesnt have a generic tree ?</title><content type='html'>Hi&lt;br /&gt;Many a times developers say that java util package doesn't support a geveric java tree&lt;br /&gt;the api does have&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://java.sun.com/j2se/1.4.2/docs/api/java/util/TreeSet.html"&gt;treeSet&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://java.sun.com/j2se/1.4.2/docs/api/java/util/TreeMap.html"&gt;treeMap&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;A generic tree can be written as &lt;a href="http://sujitpal.blogspot.com/2006/05/java-data-structure-generic-tree.html"&gt;here&lt;/a&gt; and &lt;a href="http://www.brpreiss.com/books/opus5/html/page257.html"&gt;here&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Google created its own collections framework that is being used in many of its applications as explained in videos &lt;a href="http://in.youtube.com/watch?v=ZeO_J2OcHYM"&gt;1&lt;/a&gt; and &lt;a href="http://in.youtube.com/watch?v=9ni_KEkHfto&amp;amp;annotation_id=annotation_436098&amp;amp;feature=iv"&gt;2&lt;/a&gt;. the project can be downloaded from &lt;a href="http://code.google.com/p/google-collections/"&gt;here&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8563220776994779598-352668358604144601?l=lavnish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lavnish.blogspot.com/feeds/352668358604144601/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8563220776994779598&amp;postID=352668358604144601' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/352668358604144601'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/352668358604144601'/><link rel='alternate' type='text/html' href='http://lavnish.blogspot.com/2009/01/java-util-package-doesnt-have-generic.html' title='Java Util package doesnt have a generic tree ?'/><author><name>Lavnish</name><uri>http://www.blogger.com/profile/16714741724993845980</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://lh4.google.co.uk/image/lavnishl/RdK3Rnp8q2E/AAAAAAAAAAw/g7LYCh-VN-8/s160-c/Me_ramoji.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8563220776994779598.post-8870885353820907054</id><published>2009-01-23T01:38:00.000-08:00</published><updated>2009-02-02T20:06:23.859-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='jdbc'/><category scheme='http://www.blogger.com/atom/ns#' term='oracle'/><title type='text'>Oracle doesnt support dirty read</title><content type='html'>&lt;span style="font-size:100%;"&gt;more details &lt;a href="http://www.oracle.com/technology/oramag/oracle/05-nov/o65asktom.html"&gt;at&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;span style="color:RED;"&gt;&lt;b&gt;import&lt;/b&gt;&lt;/span&gt; java&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;sql&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;Connection&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:RED;"&gt;&lt;b&gt;import&lt;/b&gt;&lt;/span&gt; java&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;sql&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;DriverManager&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:RED;"&gt;&lt;b&gt;import&lt;/b&gt;&lt;/span&gt; java&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;sql&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;ResultSet&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:RED;"&gt;&lt;b&gt;import&lt;/b&gt;&lt;/span&gt; java&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;sql&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;SQLException&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:RED;"&gt;&lt;b&gt;import&lt;/b&gt;&lt;/span&gt; java&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;sql&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;Statement&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color:RED;"&gt;&lt;b&gt;import&lt;/b&gt;&lt;/span&gt; oracle&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;jdbc&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;OracleStatement&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color:RED;"&gt;&lt;b&gt;public&lt;/b&gt;&lt;/span&gt; &lt;span style="color:RED;"&gt;&lt;b&gt;class&lt;/b&gt;&lt;/span&gt; ConnectionClass &lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;{&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;  &lt;span style="color:RED;"&gt;&lt;b&gt;public&lt;/b&gt;&lt;/span&gt; ConnectionClass&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt; &lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;{&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;  &lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;  &lt;span style="color:RED;"&gt;&lt;b&gt;public&lt;/b&gt;&lt;/span&gt; Connection getConnection&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt; &lt;span style="color:RED;"&gt;&lt;b&gt;throws&lt;/b&gt;&lt;/span&gt; ClassNotFoundException&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;,&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;                                           SQLException &lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;{&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;              Class&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;forName&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="color:PURPLE;"&gt;"oracle.jdbc.driver.OracleDriver"&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;              Connection con &lt;span style=";font-size:78%;color:BLUE;"  &gt;=&lt;/span&gt; DriverManager&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;getConnection&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;              &lt;span style="color:PURPLE;"&gt;"jdbc:oracle:thin:@hyc65003fwks.idc.oracle.com:1521:nn11g"&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;,&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;              &lt;span style="color:PURPLE;"&gt;"scott"&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;,&lt;/b&gt;&lt;/span&gt;&lt;span style="color:PURPLE;"&gt;"tiger"&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;              con&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;setAutoCommit&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;false&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;              System&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;out&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;println&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="color:PURPLE;"&gt;"isolation lvl "&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;+&lt;/span&gt;con&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;getTransactionIsolation&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;              con&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;setTransactionIsolation&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;Connection&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;TRANSACTION_READ_UNCOMMITTED&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;              &lt;span style="color:RED;"&gt;&lt;b&gt;return&lt;/b&gt;&lt;/span&gt; con&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;          &lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;  &lt;span style="color:RED;"&gt;&lt;b&gt;public&lt;/b&gt;&lt;/span&gt; &lt;span style="color:RED;"&gt;&lt;b&gt;static&lt;/b&gt;&lt;/span&gt; &lt;span style="color:RED;"&gt;&lt;b&gt;void&lt;/b&gt;&lt;/span&gt; main&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;String&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;[&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;]&lt;/b&gt;&lt;/span&gt; args&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt; &lt;span style="color:RED;"&gt;&lt;b&gt;throws&lt;/b&gt;&lt;/span&gt; ClassNotFoundException&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;,&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;                                                SQLException &lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;{&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;      ConnectionClass obj &lt;span style=";font-size:78%;color:BLUE;"  &gt;=&lt;/span&gt; &lt;span style="color:RED;"&gt;&lt;b&gt;new&lt;/b&gt;&lt;/span&gt; ConnectionClass&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;      Connection con1 &lt;span style=";font-size:78%;color:BLUE;"  &gt;=&lt;/span&gt; obj&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;getConnection&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;      Connection con2 &lt;span style=";font-size:78%;color:BLUE;"  &gt;=&lt;/span&gt; obj&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;getConnection&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;      obj&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;doUpdate&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;con1&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;   &lt;br /&gt;      obj&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;read&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;con2&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;      con1.rollback&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;      con1.close&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;      System&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;out&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;println&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="color:PURPLE;"&gt;"again reading......."&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;      obj&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;read&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;con2&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;      con2.close&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;  &lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;  &lt;span style="color:RED;"&gt;&lt;b&gt;int&lt;/b&gt;&lt;/span&gt; i&lt;span style=";font-size:78%;color:BLUE;"  &gt;=&lt;/span&gt;&lt;span style="color:BROWN;"&gt;0&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;  &lt;span style="color:RED;"&gt;&lt;b&gt;public&lt;/b&gt;&lt;/span&gt; &lt;span style="color:RED;"&gt;&lt;b&gt;void&lt;/b&gt;&lt;/span&gt; doUpdate&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;Connection con&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt; &lt;span style="color:RED;"&gt;&lt;b&gt;throws&lt;/b&gt;&lt;/span&gt; SQLException &lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;{&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;      Statement stmt &lt;span style=";font-size:78%;color:BLUE;"  &gt;=&lt;/span&gt; con&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;createStatement&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;ResultSet&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;TYPE_SCROLL_SENSITIVE&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;,&lt;/b&gt;&lt;/span&gt;ResultSet&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;CONCUR_UPDATABLE&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;   &lt;br /&gt;      i&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;+&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;+&lt;/span&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;      String sql &lt;span style=";font-size:78%;color:BLUE;"  &gt;=&lt;/span&gt; &lt;span style="color:PURPLE;"&gt;"insert into delme values('aa"&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;+&lt;/span&gt;i&lt;span style=";font-size:78%;color:BLUE;"  &gt;+&lt;/span&gt;&lt;span style="color:PURPLE;"&gt;"')"&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;      System&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;out&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;println&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="color:PURPLE;"&gt;"sql &amp;gt;&amp;gt;&amp;gt;"&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;+&lt;/span&gt;sql&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;      System&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;out&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;println&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;stmt&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;executeUpdate&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;sql&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;      stmt&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;close&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;  &lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;  &lt;span style="color:RED;"&gt;&lt;b&gt;public&lt;/b&gt;&lt;/span&gt; &lt;span style="color:RED;"&gt;&lt;b&gt;void&lt;/b&gt;&lt;/span&gt; read&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;Connection con&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt; &lt;span style="color:RED;"&gt;&lt;b&gt;throws&lt;/b&gt;&lt;/span&gt; SQLException &lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;{&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;      Statement stmt &lt;span style=";font-size:78%;color:BLUE;"  &gt;=&lt;/span&gt; con&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;createStatement&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;ResultSet&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;TYPE_SCROLL_SENSITIVE&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;,&lt;/b&gt;&lt;/span&gt;ResultSet&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;CONCUR_UPDATABLE&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;      String sql &lt;span style=";font-size:78%;color:BLUE;"  &gt;=&lt;/span&gt; &lt;span style="color:PURPLE;"&gt;"select * from delme"&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;      System&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;out&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;println&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="color:PURPLE;"&gt;"sql &amp;gt;&amp;gt;&amp;gt;"&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;+&lt;/span&gt;sql&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;      ResultSet rs &lt;span style=";font-size:78%;color:BLUE;"  &gt;=&lt;/span&gt; stmt&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;executeQuery&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;sql&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;      &lt;span style="color:RED;"&gt;&lt;b&gt;while&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;rs&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;next&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt; &lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;{&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;          System&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;out&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;println&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;rs&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;getString&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="color:BROWN;"&gt;1&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;      &lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;      rs&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;close&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;      stmt&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;close&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;   &lt;br /&gt;  &lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:GREEN;"&gt;&lt;i&gt;/* Exception in thread "main" java.sql.SQLException: READ_COMMITTED and SERIALIZABLE are the only valid transaction levels&lt;br /&gt;  at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:70)&lt;br /&gt;  at oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:110)&lt;br /&gt;  at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:171)&lt;br /&gt;  at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:227)&lt;br /&gt;  at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:439)&lt;br /&gt;  at oracle.jdbc.driver.PhysicalConnection.setTransactionIsolation(PhysicalConnection.java:3988)&lt;br /&gt;  at jdbcproj.ConnectionClass.getConnection(ConnectionClass.java:22)&lt;br /&gt;  at jdbcproj.ConnectionClass.main(ConnectionClass.java:29)&lt;br /&gt;Process exited with exit code 1. */&lt;/i&gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8563220776994779598-8870885353820907054?l=lavnish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lavnish.blogspot.com/feeds/8870885353820907054/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8563220776994779598&amp;postID=8870885353820907054' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/8870885353820907054'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/8870885353820907054'/><link rel='alternate' type='text/html' href='http://lavnish.blogspot.com/2009/01/oracle-doesnt-support-dirty-read.html' title='Oracle doesnt support dirty read'/><author><name>Lavnish</name><uri>http://www.blogger.com/profile/16714741724993845980</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://lh4.google.co.uk/image/lavnishl/RdK3Rnp8q2E/AAAAAAAAAAw/g7LYCh-VN-8/s160-c/Me_ramoji.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8563220776994779598.post-5260696720561632393</id><published>2009-01-22T23:17:00.000-08:00</published><updated>2009-01-22T23:22:23.757-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='corejava'/><title type='text'>HashMap and null keys</title><content type='html'>most of us know a hashMap allows null keys and also null values , but what if we add two values corresponding to same null key&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;      map&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;put&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="color:RED;"&gt;&lt;b&gt;null&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;,&lt;/b&gt;&lt;/span&gt;&lt;span style="color:RED;"&gt;&lt;b&gt;null&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;     map&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;put&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="color:RED;"&gt;&lt;b&gt;null&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;,&lt;/b&gt;&lt;/span&gt;&lt;span style="color:PURPLE;"&gt;"D"&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;;&lt;br /&gt;         &lt;/b&gt;&lt;/span&gt;map&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;put&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="color:RED;"&gt;&lt;b&gt;null&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;,&lt;/b&gt;&lt;/span&gt;&lt;span style="color:PURPLE;"&gt;"E"&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;What will be the output of&lt;br /&gt;System.out.println(map)&lt;br /&gt;&lt;br /&gt;will for the null key it will print the last key value pair , i.e. &lt;null,e&gt; as per my understanding the null key is  unique and on adding more value elements to the same null key will override the old values&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8563220776994779598-5260696720561632393?l=lavnish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lavnish.blogspot.com/feeds/5260696720561632393/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8563220776994779598&amp;postID=5260696720561632393' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/5260696720561632393'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/5260696720561632393'/><link rel='alternate' type='text/html' href='http://lavnish.blogspot.com/2009/01/hashmap-and-null-keys.html' title='HashMap and null keys'/><author><name>Lavnish</name><uri>http://www.blogger.com/profile/16714741724993845980</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://lh4.google.co.uk/image/lavnishl/RdK3Rnp8q2E/AAAAAAAAAAw/g7LYCh-VN-8/s160-c/Me_ramoji.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8563220776994779598.post-2621699372341141910</id><published>2009-01-22T23:14:00.000-08:00</published><updated>2009-01-22T23:22:52.464-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='corejava'/><title type='text'>Convert HashMap to HashTable</title><content type='html'>How will you convert a HashMap having null values and/or keys to a hash table ?&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;span style="color:RED;"&gt;&lt;b&gt;import&lt;/b&gt;&lt;/span&gt; java&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;util&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;HashMap&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:RED;"&gt;&lt;b&gt;import&lt;/b&gt;&lt;/span&gt; java&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;util&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;Hashtable&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:RED;"&gt;&lt;b&gt;import&lt;/b&gt;&lt;/span&gt; java&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;util&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;Iterator&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:RED;"&gt;&lt;b&gt;import&lt;/b&gt;&lt;/span&gt; java&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;util&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;Map&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:RED;"&gt;&lt;b&gt;import&lt;/b&gt;&lt;/span&gt; java&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;util&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;Set&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color:RED;"&gt;&lt;b&gt;public&lt;/b&gt;&lt;/span&gt; &lt;span style="color:RED;"&gt;&lt;b&gt;class&lt;/b&gt;&lt;/span&gt; HashTableHashMap&lt;br /&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;{&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;  &lt;span style="color:RED;"&gt;&lt;b&gt;public&lt;/b&gt;&lt;/span&gt; &lt;span style="color:RED;"&gt;&lt;b&gt;static&lt;/b&gt;&lt;/span&gt; &lt;span style="color:RED;"&gt;&lt;b&gt;void&lt;/b&gt;&lt;/span&gt; main&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;String&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;[&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;]&lt;/b&gt;&lt;/span&gt; args&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt; &lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;{&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;      Map map &lt;span style=";font-size:78%;color:BLUE;"  &gt;=&lt;/span&gt; &lt;span style="color:RED;"&gt;&lt;b&gt;new&lt;/b&gt;&lt;/span&gt; HashMap&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;      map&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;put&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="color:PURPLE;"&gt;"a"&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;,&lt;/b&gt;&lt;/span&gt;&lt;span style="color:RED;"&gt;&lt;b&gt;null&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;      map&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;put&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="color:PURPLE;"&gt;"b"&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;,&lt;/b&gt;&lt;/span&gt;&lt;span style="color:PURPLE;"&gt;"B"&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;      map&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;put&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="color:RED;"&gt;&lt;b&gt;null&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;,&lt;/b&gt;&lt;/span&gt;&lt;span style="color:PURPLE;"&gt;"D"&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;      System&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;out&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;println&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;map&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;      Hashtable ht &lt;span style=";font-size:78%;color:BLUE;"  &gt;=&lt;/span&gt; &lt;span style="color:RED;"&gt;&lt;b&gt;new&lt;/b&gt;&lt;/span&gt; Hashtable&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;      Set set &lt;span style=";font-size:78%;color:BLUE;"  &gt;=&lt;/span&gt; map&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;entrySet&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;      Iterator itr &lt;span style=";font-size:78%;color:BLUE;"  &gt;=&lt;/span&gt; set&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;iterator&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;      &lt;span style="color:RED;"&gt;&lt;b&gt;while&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;itr&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;hasNext&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;{&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;          Map&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;Entry entry &lt;span style=";font-size:78%;color:BLUE;"  &gt;=&lt;/span&gt;  &lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;Map&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;Entry&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;itr&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;next&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;          Object key &lt;span style=";font-size:78%;color:BLUE;"  &gt;=&lt;/span&gt; entry&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;getKey&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;          Object val &lt;span style=";font-size:78%;color:BLUE;"  &gt;=&lt;/span&gt; entry&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;getValue&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;          &lt;span style="color:RED;"&gt;&lt;b&gt;if&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;key&lt;span style=";font-size:78%;color:BLUE;"  &gt;=&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;=&lt;/span&gt;&lt;span style="color:RED;"&gt;&lt;b&gt;null&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;{&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;              key &lt;span style=";font-size:78%;color:BLUE;"  &gt;=&lt;/span&gt; &lt;span style="color:PURPLE;"&gt;""&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;+&lt;/span&gt;&lt;span style="color:RED;"&gt;&lt;b&gt;null&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt; &lt;span style="color:GREEN;"&gt;&lt;i&gt;// Or whatever you want&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;            &lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;          &lt;span style="color:RED;"&gt;&lt;b&gt;if&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;val&lt;span style=";font-size:78%;color:BLUE;"  &gt;=&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;=&lt;/span&gt;&lt;span style="color:RED;"&gt;&lt;b&gt;null&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;{&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;              val &lt;span style=";font-size:78%;color:BLUE;"  &gt;=&lt;/span&gt; &lt;span style="color:PURPLE;"&gt;""&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;+&lt;/span&gt;&lt;span style="color:RED;"&gt;&lt;b&gt;null&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt; &lt;span style="color:GREEN;"&gt;&lt;i&gt;// Or whatever you want&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;            &lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;          ht&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;put&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;key&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;,&lt;/b&gt;&lt;/span&gt;val&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;      &lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;      System&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;out&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;println&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;ht&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;  &lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8563220776994779598-2621699372341141910?l=lavnish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lavnish.blogspot.com/feeds/2621699372341141910/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8563220776994779598&amp;postID=2621699372341141910' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/2621699372341141910'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/2621699372341141910'/><link rel='alternate' type='text/html' href='http://lavnish.blogspot.com/2009/01/convert-hashmap-to-hashtable.html' title='Convert HashMap to HashTable'/><author><name>Lavnish</name><uri>http://www.blogger.com/profile/16714741724993845980</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://lh4.google.co.uk/image/lavnishl/RdK3Rnp8q2E/AAAAAAAAAAw/g7LYCh-VN-8/s160-c/Me_ramoji.jpg'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8563220776994779598.post-4727663457635674000</id><published>2009-01-19T19:45:00.000-08:00</published><updated>2009-01-19T19:46:26.924-08:00</updated><title type='text'>iPhone apps using java</title><content type='html'>hi&lt;br /&gt;&lt;a href="http://developerlife.com/theblog/?p=842"&gt;this&lt;/a&gt; video tutorial at google provides good insight&lt;br /&gt;http://developerlife.com/theblog/?p=842&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8563220776994779598-4727663457635674000?l=lavnish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lavnish.blogspot.com/feeds/4727663457635674000/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8563220776994779598&amp;postID=4727663457635674000' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/4727663457635674000'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/4727663457635674000'/><link rel='alternate' type='text/html' href='http://lavnish.blogspot.com/2009/01/iphone-apps-using-java.html' title='iPhone apps using java'/><author><name>Lavnish</name><uri>http://www.blogger.com/profile/16714741724993845980</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://lh4.google.co.uk/image/lavnishl/RdK3Rnp8q2E/AAAAAAAAAAw/g7LYCh-VN-8/s160-c/Me_ramoji.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8563220776994779598.post-3929454808455228544</id><published>2009-01-12T00:43:00.000-08:00</published><updated>2009-01-12T00:45:13.606-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Design Pattern'/><title type='text'>Design Pattern : chain of responsibility</title><content type='html'>Found two links...&lt;br /&gt;&lt;ol&gt;&lt;li&gt;&lt;a href="http://snehaprashant.blogspot.com/2009/01/chain-of-responsibility-pattern.html"&gt;Chain of responsibility&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.freshblurbs.com/exception-handling-and-chain-responsibility-design-pattern"&gt;Exception Handling in Chain of responsibility&lt;/a&gt;&lt;/li&gt;&lt;/ol&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8563220776994779598-3929454808455228544?l=lavnish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lavnish.blogspot.com/feeds/3929454808455228544/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8563220776994779598&amp;postID=3929454808455228544' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/3929454808455228544'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/3929454808455228544'/><link rel='alternate' type='text/html' href='http://lavnish.blogspot.com/2009/01/design-pattern-chain-of-responsibility.html' title='Design Pattern : chain of responsibility'/><author><name>Lavnish</name><uri>http://www.blogger.com/profile/16714741724993845980</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://lh4.google.co.uk/image/lavnishl/RdK3Rnp8q2E/AAAAAAAAAAw/g7LYCh-VN-8/s160-c/Me_ramoji.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8563220776994779598.post-8571054559460807301</id><published>2009-01-06T23:11:00.000-08:00</published><updated>2009-01-06T23:16:26.670-08:00</updated><title type='text'>JSF page refresh</title><content type='html'>To refresh a JSF page the following piece of code is useful&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;FacesContext context = FacesContext.getCurrentInstance();  &lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;String viewId = context.getViewRoot().getViewId();  &lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;ViewHandler handler = context.getApplication().getViewHandler();  &lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;UIViewRoot root = handler.createView(context, viewId);  &lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;root.setViewId(viewId);  &lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;context.setViewRoot(root);  &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;If your page is not getting refreshed due to browser caching&lt;br /&gt;&lt;br /&gt;&lt;pre class="java5"&gt; FacesContext facesContext = event.&lt;span style="color: rgb(0, 102, 0);"&gt;getFacesContext&lt;/span&gt;&lt;span style="color: rgb(102, 204, 102);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(102, 204, 102);"&gt;)&lt;/span&gt;&lt;span style="color: rgb(102, 204, 102);"&gt;;&lt;/span&gt;&lt;br /&gt;HttpServletResponse response = &lt;span style="color: rgb(102, 204, 102);"&gt;(&lt;/span&gt;HttpServletResponse&lt;span style="color: rgb(102, 204, 102);"&gt;)&lt;/span&gt; facesContext.&lt;span style="color: rgb(0, 102, 0);"&gt;getExternalContext&lt;/span&gt;&lt;span style="color: rgb(102, 204, 102);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(102, 204, 102);"&gt;)&lt;/span&gt;.&lt;span style="color: rgb(0, 102, 0);"&gt;getResponse&lt;/span&gt;&lt;span style="color: rgb(102, 204, 102);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(102, 204, 102);"&gt;)&lt;/span&gt;&lt;span style="color: rgb(102, 204, 102);"&gt;;&lt;/span&gt;&lt;br /&gt;response.&lt;span style="color: rgb(0, 102, 0);"&gt;addHeader&lt;/span&gt;&lt;span style="color: rgb(102, 204, 102);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;"Pragma"&lt;/span&gt;, &lt;span style="color: rgb(255, 0, 0);"&gt;"no-cache"&lt;/span&gt;&lt;span style="color: rgb(102, 204, 102);"&gt;)&lt;/span&gt;&lt;span style="color: rgb(102, 204, 102);"&gt;;&lt;/span&gt;&lt;br /&gt;response.&lt;span style="color: rgb(0, 102, 0);"&gt;addHeader&lt;/span&gt;&lt;span style="color: rgb(102, 204, 102);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;"Cache-Control"&lt;/span&gt;, &lt;span style="color: rgb(255, 0, 0);"&gt;"no-cache"&lt;/span&gt;&lt;span style="color: rgb(102, 204, 102);"&gt;)&lt;/span&gt;&lt;span style="color: rgb(102, 204, 102);"&gt;;&lt;/span&gt;&lt;br /&gt;response.&lt;span style="color: rgb(0, 102, 0);"&gt;setHeader&lt;/span&gt;&lt;span style="color: rgb(102, 204, 102);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;"Cache-Control"&lt;/span&gt;, &lt;span style="color: rgb(255, 0, 0);"&gt;"no-store"&lt;/span&gt;&lt;span style="color: rgb(102, 204, 102);"&gt;)&lt;/span&gt;&lt;span style="color: rgb(102, 204, 102);"&gt;;&lt;/span&gt;&lt;br /&gt;response.&lt;span style="color: rgb(0, 102, 0);"&gt;addHeader&lt;/span&gt;&lt;span style="color: rgb(102, 204, 102);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;"Cache-Control"&lt;/span&gt;, &lt;span style="color: rgb(255, 0, 0);"&gt;"must-revalidate"&lt;/span&gt;&lt;span style="color: rgb(102, 204, 102);"&gt;)&lt;/span&gt;&lt;span style="color: rgb(102, 204, 102);"&gt;;&lt;/span&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8563220776994779598-8571054559460807301?l=lavnish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lavnish.blogspot.com/feeds/8571054559460807301/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8563220776994779598&amp;postID=8571054559460807301' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/8571054559460807301'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/8571054559460807301'/><link rel='alternate' type='text/html' href='http://lavnish.blogspot.com/2009/01/jsf-page-refresh.html' title='JSF page refresh'/><author><name>Lavnish</name><uri>http://www.blogger.com/profile/16714741724993845980</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://lh4.google.co.uk/image/lavnishl/RdK3Rnp8q2E/AAAAAAAAAAw/g7LYCh-VN-8/s160-c/Me_ramoji.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8563220776994779598.post-6951311093630493763</id><published>2009-01-05T03:11:00.000-08:00</published><updated>2009-01-26T06:08:01.675-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='data structures'/><title type='text'>Data Structures</title><content type='html'>Few good links for Data Structures&lt;br /&gt;&lt;ul&gt;&lt;li&gt;C API : http://code.google.com/p/c-generic-library/&lt;br /&gt;&lt;/li&gt;&lt;li&gt;google collections : http://code.google.com/p/google-collections/&lt;/li&gt;&lt;li&gt;java listenable collections : http://code.google.com/p/jalico/&lt;/li&gt;&lt;li&gt;JRDF : http://code.google.com/p/jrdf/&lt;/li&gt;&lt;li&gt;J5Collections : http://code.google.com/p/j5collections/&lt;/li&gt;&lt;li&gt;Stanford video tutorial : http://in.youtube.com/view_play_list?p=84A56BC7F4A1F852&lt;/li&gt;&lt;li&gt;Book : http://www.brpreiss.com/books/opus5/html/page257.html&lt;/li&gt;&lt;/ul&gt;More links&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;all slide handout from the textbook &lt;a href="http://ww0.java4.datastructures.net/handouts/" rel="nofollow"&gt;http://ww0.java4.datastructures.net/handouts/&lt;/a&gt; &lt;/li&gt;&lt;li&gt;comparison of link implementation in java (ArrayList, Vector, LikedList) &lt;a href="http://www.onjava.com/pub/a/onjava/2001/05/30/optimization.html?page=1" rel="nofollow"&gt;http://www.onjava.com/pub/a/onjava/2001/05/30/optimization.html?page=1&lt;/a&gt;&lt;/li&gt;&lt;li&gt;time your execution program example &lt;a href="http://www.rgagnon.com/javadetails/java-0132.html" rel="nofollow"&gt;http://www.rgagnon.com/javadetails/java-0132.html&lt;/a&gt; *in Java 5, you can also use nano Timing method. &lt;/li&gt;&lt;li&gt;Queue in Java 5 &lt;a href="http://www.devx.com/Java/Article/21983" rel="nofollow"&gt;http://www.devx.com/Java/Article/21983&lt;/a&gt; &lt;/li&gt;&lt;li&gt;Josephus Problem &lt;a href="http://en.wikipedia.org/wiki/Josephus_problem" rel="nofollow"&gt;http://en.wikipedia.org/wiki/Josephus_problem&lt;/a&gt;&lt;/li&gt;&lt;li&gt;Pigeonhole principle &lt;a href="http://en.wikipedia.org/wiki/Pigeonhole_principle" rel="nofollow"&gt;http://en.wikipedia.org/wiki/Pigeonhole_principle&lt;/a&gt; &lt;/li&gt;&lt;li&gt;Iterator Example &lt;a href="http://www.particle.kth.se/%7Elindsey/JavaCourse/Book/Part1/Java/Chapter10/iterator.html" rel="nofollow"&gt;http://www.particle.kth.se/~lindsey/JavaCourse/Book/Part1/Java/Chapter10/iterator.html&lt;/a&gt; or &lt;a href="http://www.java-examples.com/iterate-through-elements-java-arraylist-using-iterator-example" rel="nofollow"&gt;http://www.java-examples.com/iterate-through-elements-java-arraylist-using-iterator-example&lt;/a&gt;&lt;/li&gt;&lt;li&gt;Tree in Java 5 &lt;a href="http://it-essence.xs4all.nl/roller/technology/entry/three_tree_traversals_in_java" rel="nofollow"&gt;http://it-essence.xs4all.nl/roller/technology/entry/three_tree_traversals_in_java&lt;/a&gt; &lt;/li&gt;&lt;li&gt;&lt;span style="font-family: arial,sans-serif;"&gt;Prime in Hash &lt;a href="http://www.interactivecode.com/programming-coding-1/hashing-why-mod-prime-2101/" rel="nofollow"&gt;http://www.interactivecode.com/programming-coding-1/hashing-why-mod-prime-2101/&lt;/a&gt;  &lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family: arial,sans-serif;"&gt;Last  2 slides of  ch9.2 &lt;a href="http://groups.google.com/group/cpe-datastructure/web/page17-18ch09.2.pdf" rel="nofollow"&gt;page17-18ch09.2.pdf&lt;/a&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8563220776994779598-6951311093630493763?l=lavnish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lavnish.blogspot.com/feeds/6951311093630493763/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8563220776994779598&amp;postID=6951311093630493763' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/6951311093630493763'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/6951311093630493763'/><link rel='alternate' type='text/html' href='http://lavnish.blogspot.com/2009/01/data-structures.html' title='Data Structures'/><author><name>Lavnish</name><uri>http://www.blogger.com/profile/16714741724993845980</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://lh4.google.co.uk/image/lavnishl/RdK3Rnp8q2E/AAAAAAAAAAw/g7LYCh-VN-8/s160-c/Me_ramoji.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8563220776994779598.post-533094586410749156</id><published>2008-12-11T22:16:00.001-08:00</published><updated>2008-12-11T22:27:03.784-08:00</updated><title type='text'>How to empty a StringBuffer</title><content type='html'>We know that StringBuffer is reusable , We may want to empty a String Buffer ( lets say at end of a loop )&lt;br /&gt;so how do you do it ?&lt;br /&gt;&lt;br /&gt;The easiest way i came across use the method setLength()&lt;br /&gt;&lt;pre&gt;public void &lt;b&gt;setLength&lt;/b&gt;(int newLength)&lt;/pre&gt; You may have the case like&lt;br /&gt;    StringBuffer sb = new StringBuffer("HelloWorld")&lt;br /&gt;    // after many iterations and manipulations&lt;br /&gt;    sb.setlength(0);&lt;br /&gt;   // reuse sb&lt;br /&gt;&lt;br /&gt;Please note you &lt;span style="font-weight: bold;"&gt;cant &lt;/span&gt;say&lt;br /&gt;    StringBuffer sb = "";&lt;br /&gt;You will get a type mismatch error saying that "&lt;span style="font-style: italic;"&gt;Cannot assign a value of type String to StringBuffer&lt;/span&gt;"&lt;br /&gt;Makes sense as StringBuffer is not String , and they both inherit from java.lang.Object&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8563220776994779598-533094586410749156?l=lavnish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lavnish.blogspot.com/feeds/533094586410749156/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8563220776994779598&amp;postID=533094586410749156' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/533094586410749156'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/533094586410749156'/><link rel='alternate' type='text/html' href='http://lavnish.blogspot.com/2008/12/how-to-empty-stringbuffer.html' title='How to empty a StringBuffer'/><author><name>Lavnish</name><uri>http://www.blogger.com/profile/16714741724993845980</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://lh4.google.co.uk/image/lavnishl/RdK3Rnp8q2E/AAAAAAAAAAw/g7LYCh-VN-8/s160-c/Me_ramoji.jpg'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8563220776994779598.post-1452914961712120553</id><published>2008-11-27T02:16:00.001-08:00</published><updated>2008-12-11T23:22:44.353-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='corejava'/><title type='text'>Java ques</title><content type='html'>&lt;span style="font-weight: bold;"&gt;There are three types of empty string, null, "" and " ". Here is how to check for each flavour:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;if ( s == null ) echo ( "was null" );&lt;br /&gt;else if ( s.length() == 0 ) echo ( "was empty" );&lt;br /&gt;else if ( s.trim().length () == 0 ) echo ( "was blank or other whitespace" );&lt;br /&gt;&lt;br /&gt;We cant use the following&lt;br /&gt;String s="";&lt;br /&gt;if(s.equals(""))&lt;br /&gt;  sop("string equal");&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8563220776994779598-1452914961712120553?l=lavnish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lavnish.blogspot.com/feeds/1452914961712120553/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8563220776994779598&amp;postID=1452914961712120553' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/1452914961712120553'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/1452914961712120553'/><link rel='alternate' type='text/html' href='http://lavnish.blogspot.com/2008/11/there-are-three-types-of-empty-string.html' title='Java ques'/><author><name>Lavnish</name><uri>http://www.blogger.com/profile/16714741724993845980</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://lh4.google.co.uk/image/lavnishl/RdK3Rnp8q2E/AAAAAAAAAAw/g7LYCh-VN-8/s160-c/Me_ramoji.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8563220776994779598.post-3528288661484156114</id><published>2008-11-27T02:15:00.001-08:00</published><updated>2008-11-27T02:15:57.306-08:00</updated><title type='text'>Java tricky ques</title><content type='html'>&lt;span style="font-weight:bold;"&gt;Q: How can I check a string has no numbers?&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;A: The simplest way to check that a String does not contain any numbers is to use the regular expression class Pattern in the java.util.regex package. The method below uses the regular expression [^0-9]+ to check that none of the characters in the input string is a number. The square brackets define a character class. The negation modifier, ^, followed by the number range 0-9 means "not a number". The + quantifier asks the regular expression to match the character class one or more times.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8563220776994779598-3528288661484156114?l=lavnish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lavnish.blogspot.com/feeds/3528288661484156114/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8563220776994779598&amp;postID=3528288661484156114' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/3528288661484156114'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/3528288661484156114'/><link rel='alternate' type='text/html' href='http://lavnish.blogspot.com/2008/11/java-tricky-ques.html' title='Java tricky ques'/><author><name>Lavnish</name><uri>http://www.blogger.com/profile/16714741724993845980</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://lh4.google.co.uk/image/lavnishl/RdK3Rnp8q2E/AAAAAAAAAAw/g7LYCh-VN-8/s160-c/Me_ramoji.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8563220776994779598.post-7365496364384883634</id><published>2008-11-26T23:39:00.000-08:00</published><updated>2009-01-12T09:33:40.427-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='corejava'/><title type='text'>Java String tricky ques</title><content type='html'>String s1 = "hello world";&lt;br /&gt;      String s2 = "hello world";&lt;br /&gt;&lt;br /&gt;      if(s1==s2)&lt;br /&gt;      System.out.println("Yes");&lt;br /&gt;      else&lt;br /&gt;      System.out.println("No");&lt;br /&gt;&lt;br /&gt;// output of first is Yes&lt;br /&gt;the reason being that in above code you are comparing two references&lt;br /&gt;&lt;br /&gt;  public static void point1()&lt;br /&gt;{&lt;br /&gt;      String s = new String("Friday");&lt;br /&gt;      String s1 = new String("Friday");&lt;br /&gt;      if (s == s1)&lt;br /&gt;        System.out.println("Equal A");&lt;br /&gt;if (s.equals("Friday"))&lt;br /&gt;       System.out.println("Equal B");&lt;br /&gt;  }&lt;br /&gt;ANS : Equal B&lt;br /&gt;Because they are two different objects on heap , refering diff memeory addresses&lt;br /&gt;hence their reference is not same.&lt;br /&gt;&lt;br /&gt;more explanation &lt;a href="http://www.ccnyddm.com/JavaBook/EqualsEtc.htm"&gt;here&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8563220776994779598-7365496364384883634?l=lavnish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lavnish.blogspot.com/feeds/7365496364384883634/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8563220776994779598&amp;postID=7365496364384883634' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/7365496364384883634'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/7365496364384883634'/><link rel='alternate' type='text/html' href='http://lavnish.blogspot.com/2008/11/string-s1-hello-world-string-s2-hello.html' title='Java String tricky ques'/><author><name>Lavnish</name><uri>http://www.blogger.com/profile/16714741724993845980</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://lh4.google.co.uk/image/lavnishl/RdK3Rnp8q2E/AAAAAAAAAAw/g7LYCh-VN-8/s160-c/Me_ramoji.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8563220776994779598.post-980467137192530086</id><published>2008-11-04T20:13:00.000-08:00</published><updated>2008-11-04T20:14:34.214-08:00</updated><title type='text'>dont develop for a living you will be a better developer</title><content type='html'>Hi&lt;br /&gt;Totally agree with &lt;a href="http://blog.konem.net/java/index.php?blog=1&amp;title=don_t_develop_for_living_and_you_will_be&amp;more=1&amp;c=1&amp;tb=1&amp;pb=1"&gt;this&lt;/a&gt; article&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8563220776994779598-980467137192530086?l=lavnish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lavnish.blogspot.com/feeds/980467137192530086/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8563220776994779598&amp;postID=980467137192530086' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/980467137192530086'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/980467137192530086'/><link rel='alternate' type='text/html' href='http://lavnish.blogspot.com/2008/11/dont-develop-for-living-you-will-be.html' title='dont develop for a living you will be a better developer'/><author><name>Lavnish</name><uri>http://www.blogger.com/profile/16714741724993845980</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://lh4.google.co.uk/image/lavnishl/RdK3Rnp8q2E/AAAAAAAAAAw/g7LYCh-VN-8/s160-c/Me_ramoji.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8563220776994779598.post-4501173363240782108</id><published>2008-09-28T06:23:00.000-07:00</published><updated>2008-09-28T06:28:22.983-07:00</updated><title type='text'>Netbeans 6.1 and Tomcat 5.5</title><content type='html'>I was trying add Tomcat5.5 , i had used windows installer for it , to netbeans6.1 on windows and I always get the error &lt;span style="font-weight:bold;"&gt;"cannot find catalina.bat you cannot start your server through netbeans"&lt;/span&gt; &lt;br /&gt;After spending quite some time on why was i getting this error I figured out that i must &lt;span style="font-weight:bold;"&gt;"Download the .zip formated Tomcat, not the Windows executable. It will have the files netbeans6.1 needs."&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;A lesson learned :)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8563220776994779598-4501173363240782108?l=lavnish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lavnish.blogspot.com/feeds/4501173363240782108/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8563220776994779598&amp;postID=4501173363240782108' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/4501173363240782108'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/4501173363240782108'/><link rel='alternate' type='text/html' href='http://lavnish.blogspot.com/2008/09/netbeans-61-and-tomcat-55.html' title='Netbeans 6.1 and Tomcat 5.5'/><author><name>Lavnish</name><uri>http://www.blogger.com/profile/16714741724993845980</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://lh4.google.co.uk/image/lavnishl/RdK3Rnp8q2E/AAAAAAAAAAw/g7LYCh-VN-8/s160-c/Me_ramoji.jpg'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8563220776994779598.post-2278850451443058696</id><published>2008-09-28T05:49:00.000-07:00</published><updated>2008-09-28T05:51:46.638-07:00</updated><title type='text'>Installing Netbeans without glassfish</title><content type='html'>Hi&lt;br /&gt;This is crazy but true , you can install netbeans 6.1 without glassfish .. how ?? simple if you have no space in C drive and install Netbeans in D drive , i tried it out today and saw it happened that way for me &lt;br /&gt;&lt;br /&gt;:)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8563220776994779598-2278850451443058696?l=lavnish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lavnish.blogspot.com/feeds/2278850451443058696/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8563220776994779598&amp;postID=2278850451443058696' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/2278850451443058696'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/2278850451443058696'/><link rel='alternate' type='text/html' href='http://lavnish.blogspot.com/2008/09/installing-netbeans-without-glassfish.html' title='Installing Netbeans without glassfish'/><author><name>Lavnish</name><uri>http://www.blogger.com/profile/16714741724993845980</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://lh4.google.co.uk/image/lavnishl/RdK3Rnp8q2E/AAAAAAAAAAw/g7LYCh-VN-8/s160-c/Me_ramoji.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8563220776994779598.post-5971114555736549451</id><published>2008-09-28T04:52:00.000-07:00</published><updated>2008-09-28T04:56:51.407-07:00</updated><title type='text'>Windows Vista and Tomcat 5.5</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_HRk6DhG06vk/SN9w8NkupfI/AAAAAAAABeg/6Zjdi-_HcT8/s1600-h/tomcat_error.jpg"&gt;&lt;img style="cursor:pointer; cursor:hand;" src="http://4.bp.blogspot.com/_HRk6DhG06vk/SN9w8NkupfI/AAAAAAAABeg/6Zjdi-_HcT8/s320/tomcat_error.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5251039870275462642" /&gt;&lt;/a&gt;&lt;br /&gt;Seems like vista is incompatible with tomcat 5.5 too , because of renaming permission ...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8563220776994779598-5971114555736549451?l=lavnish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lavnish.blogspot.com/feeds/5971114555736549451/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8563220776994779598&amp;postID=5971114555736549451' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/5971114555736549451'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/5971114555736549451'/><link rel='alternate' type='text/html' href='http://lavnish.blogspot.com/2008/09/windows-vista-and-tomcat-55.html' title='Windows Vista and Tomcat 5.5'/><author><name>Lavnish</name><uri>http://www.blogger.com/profile/16714741724993845980</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://lh4.google.co.uk/image/lavnishl/RdK3Rnp8q2E/AAAAAAAAAAw/g7LYCh-VN-8/s160-c/Me_ramoji.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_HRk6DhG06vk/SN9w8NkupfI/AAAAAAAABeg/6Zjdi-_HcT8/s72-c/tomcat_error.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8563220776994779598.post-6466518572737127262</id><published>2008-09-27T13:18:00.000-07:00</published><updated>2008-09-27T13:25:43.064-07:00</updated><title type='text'>Windows Vista and NetBeans6.1 Axis2 plugin issue</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_HRk6DhG06vk/SN6WmozqrZI/AAAAAAAABeY/YJ8wuap24A8/s1600-h/rename_error.jpg"&gt;&lt;img style="cursor:pointer; cursor:hand;" src="http://1.bp.blogspot.com/_HRk6DhG06vk/SN6WmozqrZI/AAAAAAAABeY/YJ8wuap24A8/s320/rename_error.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5250799806093897106" /&gt;&lt;/a&gt;&lt;br /&gt;Hi&lt;br /&gt;Discovered that Netbeans 6.1 Axis2 plugin is incompatible with windows vista. The methods at http://www.netbeans.org/kb/61/websvc/gs-axis.html &lt;br /&gt;&lt;br /&gt;To deploy an Axis2 web service to the server:&lt;br /&gt;&lt;br /&gt;   1. Right-click the web service's node. The context menu opens. Select Deploy to Server. The IDE compiles an Axis2 AAR file and copies it to the axis2.war file used by the application server.&lt;br /&gt;&lt;br /&gt;The above step cant be completed in windows vista because , windows vista gives a popup and expects user to click "OK" to rename a file.&lt;br /&gt;&lt;br /&gt;Error is Unable to rename old file axis.war , because&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8563220776994779598-6466518572737127262?l=lavnish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lavnish.blogspot.com/feeds/6466518572737127262/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8563220776994779598&amp;postID=6466518572737127262' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/6466518572737127262'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/6466518572737127262'/><link rel='alternate' type='text/html' href='http://lavnish.blogspot.com/2008/09/windows-vista-and-netbeans61-axis2.html' title='Windows Vista and NetBeans6.1 Axis2 plugin issue'/><author><name>Lavnish</name><uri>http://www.blogger.com/profile/16714741724993845980</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://lh4.google.co.uk/image/lavnishl/RdK3Rnp8q2E/AAAAAAAAAAw/g7LYCh-VN-8/s160-c/Me_ramoji.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_HRk6DhG06vk/SN6WmozqrZI/AAAAAAAABeY/YJ8wuap24A8/s72-c/rename_error.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8563220776994779598.post-7320230189946128342</id><published>2008-09-27T11:45:00.000-07:00</published><updated>2008-09-27T11:56:44.264-07:00</updated><title type='text'>Eclipse 3.4  Axis2 1.4 invocationtargetexception</title><content type='html'>Hi&lt;br /&gt;After wasting few precious hour , i finally concluded that Eclipse 3.4 and Axis2 1.4 are not compatible &lt;br /&gt;many people have faced similar errors .. &lt;br /&gt;&lt;br /&gt;http://wuhai.wordpress.com/2008/07/28/axis2-codegen-for-eclipse-invocationtargetexception/&lt;br /&gt;http://wso2.org/library/1719&lt;br /&gt;&lt;br /&gt;and the posts are as old as march 08 , and still the members of eclipse dev team havent corrected it , no wonder Eclipse which used to be KING of Java editor is no longer "recommended" anymore , and Netbeans has taken over !!&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Solution ?&lt;/span&gt;&lt;br /&gt;Take Axis2 eclipse codegen wizard 1.4 from http://www.javaeye.com/post/560587&lt;br /&gt;Or take Eclipse 3.0.1 from http://archive.eclipse.org/eclipse/downloads/drops/R-3.0.1-200409161125/index.php&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8563220776994779598-7320230189946128342?l=lavnish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lavnish.blogspot.com/feeds/7320230189946128342/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8563220776994779598&amp;postID=7320230189946128342' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/7320230189946128342'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/7320230189946128342'/><link rel='alternate' type='text/html' href='http://lavnish.blogspot.com/2008/09/eclipse-34-axis2-14-invocationtargetexc.html' title='Eclipse 3.4  Axis2 1.4 invocationtargetexception'/><author><name>Lavnish</name><uri>http://www.blogger.com/profile/16714741724993845980</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://lh4.google.co.uk/image/lavnishl/RdK3Rnp8q2E/AAAAAAAAAAw/g7LYCh-VN-8/s160-c/Me_ramoji.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8563220776994779598.post-6991225293880242669</id><published>2008-08-19T05:18:00.000-07:00</published><updated>2008-08-19T05:50:02.445-07:00</updated><title type='text'>Social Networking &amp; Adverstising</title><content type='html'>&lt;object height="344" width="425"&gt;&lt;param name="movie" value="http://www.youtube.com/v/l-riD8N0Dt4&amp;amp;hl=en&amp;amp;fs=1"&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;embed src="http://www.youtube.com/v/l-riD8N0Dt4&amp;amp;hl=en&amp;amp;fs=1" type="application/x-shockwave-flash" allowfullscreen="true" height="344" width="425"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;br /&gt;I agree with him on quite a few points ,&lt;br /&gt;&lt;ul&gt;&lt;li&gt;mobile phone is the center of gravity for teens today !&lt;/li&gt;&lt;li&gt;Virtual gifting is growing at a rapid pace ( $600,000 a month ) any one send you a scrap but how do i show that i really care ... spend on a virtual gift !! People show off virtual gifts on the social networking sites.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Dating is Gaming... It has been traditionally popular on tv shows , it will be HUGE hit on internet&lt;/li&gt;&lt;li&gt;Twitter has grown from "what are you doing" to "what r u doing &amp;amp; where are you"&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.etsy.com"&gt;Etsy&lt;/a&gt; : Your place to buy and sell handmade things online. its limited place&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://threadless.com/"&gt;Threadless&lt;/a&gt; : consumer generated fashion label&lt;/li&gt;&lt;li&gt;StartMobile :&lt;/li&gt;&lt;/ul&gt;An individual seeks "youtube" , "google" , "etsy" , "threadless" all day and advertisers sees them on these sites.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8563220776994779598-6991225293880242669?l=lavnish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lavnish.blogspot.com/feeds/6991225293880242669/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8563220776994779598&amp;postID=6991225293880242669' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/6991225293880242669'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/6991225293880242669'/><link rel='alternate' type='text/html' href='http://lavnish.blogspot.com/2008/08/social-networking-adverstising.html' title='Social Networking &amp; Adverstising'/><author><name>Lavnish</name><uri>http://www.blogger.com/profile/16714741724993845980</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://lh4.google.co.uk/image/lavnishl/RdK3Rnp8q2E/AAAAAAAAAAw/g7LYCh-VN-8/s160-c/Me_ramoji.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8563220776994779598.post-1767569888173349242</id><published>2008-08-19T04:57:00.000-07:00</published><updated>2008-08-19T06:00:34.711-07:00</updated><title type='text'>Bebo n Me</title><content type='html'>I am not talking of Bebo as in &lt;a href="http://en.wikipedia.org/wiki/Kareena_Kapoor"&gt;Kareena Kapoor&lt;/a&gt; , the bollywood star , who happens to be nicknamed as Bibo , To be very frank there is nothing that will force ANYONE to put my name and her name in the same  sentence ;-)&lt;br /&gt;&lt;br /&gt;Anyways I heard about this social networking that...&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Bebo is a social networking website&lt;/li&gt;&lt;li&gt;This social networking site is about sharing content.&lt;/li&gt;&lt;li&gt;You can share the videos , music etc that you like with your friends&lt;/li&gt;&lt;li&gt;You can even &lt;a href="http://www.associatedcontent.com/article/755353/create_your_own_quizzes_on_bebo.html"&gt;create a quiz&lt;/a&gt; and pass it to your friend.&lt;/li&gt;&lt;li&gt;Bebo has skins ( like most soc networking do ) that can be sponsored&lt;/li&gt;&lt;li&gt;Created by &lt;a href="http://en.wikipedia.org/wiki/Michael_Birch"&gt;Michael Birch&lt;/a&gt; and &lt;a href="http://www.blogger.com/www.bebo.com/Profile.jsp?MemberId=9"&gt;Xochi Birch&lt;/a&gt;&lt;/li&gt;&lt;li&gt;The growing popularity drew the attention of media giants, and AOL shelled out $850 million for Bebo earlier this year.&lt;/li&gt;&lt;/ul&gt;the couple was recently &lt;a href="http://www.youtube.com/watch?v=nHxc6mc-ac0"&gt;intervievied &lt;/a&gt;on Europe 2007&lt;br /&gt;&lt;br /&gt;One can create an application on facebook and port it to bebo. They seem to be compatible.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8563220776994779598-1767569888173349242?l=lavnish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lavnish.blogspot.com/feeds/1767569888173349242/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8563220776994779598&amp;postID=1767569888173349242' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/1767569888173349242'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/1767569888173349242'/><link rel='alternate' type='text/html' href='http://lavnish.blogspot.com/2008/08/bebo-n-me.html' title='Bebo n Me'/><author><name>Lavnish</name><uri>http://www.blogger.com/profile/16714741724993845980</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://lh4.google.co.uk/image/lavnishl/RdK3Rnp8q2E/AAAAAAAAAAw/g7LYCh-VN-8/s160-c/Me_ramoji.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8563220776994779598.post-1385683881337033994</id><published>2008-07-31T04:21:00.000-07:00</published><updated>2008-08-01T01:55:36.882-07:00</updated><title type='text'>Flipping Card in Flex</title><content type='html'>Was doing some RnD , was looking for a kind of flipping card in flex&lt;br /&gt;Here is what i found ..&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://www.thetechlabs.com/flash/create-a-card-flip-effect-for-flash-player-10-using-actionscript-3/"&gt;Rotate card sideways&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.verysimple.com/blog/2008/07/11/flex-flipcard-component/"&gt;Flip card : 2 sided&lt;/a&gt; &lt;/li&gt;&lt;li&gt;&lt;a href="http://www.tink.ws/blog/papervision3d-effects-for-flex-source/"&gt;Other 3D Effects&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;Other sites for flex components&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://flexbox.mrinalwadhwa.com/"&gt;http://flexbox.mrinalwadhwa.com/&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://seantheflexguy.com/blog/2007/08/21/list-of-31-flex-apis-libraries-components-and-tools/"&gt;http://seantheflexguy.com/blog/2007/08/21/list-of-31-flex-apis-libraries-components-and-tools/&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.rogue-development.com/"&gt;http://www.rogue-development.com/&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://labs.flexcubed.com/"&gt;http://labs.flexcubed.com/&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8563220776994779598-1385683881337033994?l=lavnish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lavnish.blogspot.com/feeds/1385683881337033994/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8563220776994779598&amp;postID=1385683881337033994' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/1385683881337033994'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/1385683881337033994'/><link rel='alternate' type='text/html' href='http://lavnish.blogspot.com/2008/07/flipping-card-in-flex.html' title='Flipping Card in Flex'/><author><name>Lavnish</name><uri>http://www.blogger.com/profile/16714741724993845980</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://lh4.google.co.uk/image/lavnishl/RdK3Rnp8q2E/AAAAAAAAAAw/g7LYCh-VN-8/s160-c/Me_ramoji.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8563220776994779598.post-3321963323962143033</id><published>2008-07-30T09:47:00.000-07:00</published><updated>2008-07-30T10:13:07.576-07:00</updated><title type='text'>ActionScript and MXML relation</title><content type='html'>How do MXML and ActionScript relate to one another? The compiler, after parsing through the different idioms, translates MXML into the same objects, so that&lt;br /&gt;&lt; mx:button id="btn" height="100" label="My Button" &gt;&lt;br /&gt;&lt;br /&gt;and&lt;br /&gt;&lt;br /&gt;var btn:Button = new Button();&lt;br /&gt;btn.label = "My Button";&lt;br /&gt;btn.height = 100;&lt;br /&gt;&lt;br /&gt;produce the same object.  ActionScript and MXML compiles into a SWF file&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8563220776994779598-3321963323962143033?l=lavnish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lavnish.blogspot.com/feeds/3321963323962143033/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8563220776994779598&amp;postID=3321963323962143033' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/3321963323962143033'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/3321963323962143033'/><link rel='alternate' type='text/html' href='http://lavnish.blogspot.com/2008/07/actionscript-and-mxml-relation.html' title='ActionScript and MXML relation'/><author><name>Lavnish</name><uri>http://www.blogger.com/profile/16714741724993845980</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://lh4.google.co.uk/image/lavnishl/RdK3Rnp8q2E/AAAAAAAAAAw/g7LYCh-VN-8/s160-c/Me_ramoji.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8563220776994779598.post-9220141616343616416</id><published>2008-07-21T05:46:00.001-07:00</published><updated>2008-07-21T05:46:54.253-07:00</updated><title type='text'>Adobe Flex Buildre Free for Students / Proffesors</title><content type='html'>&lt;object width="425" height="344"&gt;&lt;param name="movie" value="http://www.youtube.com/v/9DUYoK8poTo&amp;amp;hl=en&amp;amp;fs=1"&gt;&lt;/param&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;/param&gt;&lt;embed src="http://www.youtube.com/v/9DUYoK8poTo&amp;amp;hl=en&amp;amp;fs=1" type="application/x-shockwave-flash" allowfullscreen="true" width="425" height="344"&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/8563220776994779598-9220141616343616416?l=lavnish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lavnish.blogspot.com/feeds/9220141616343616416/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8563220776994779598&amp;postID=9220141616343616416' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/9220141616343616416'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/9220141616343616416'/><link rel='alternate' type='text/html' href='http://lavnish.blogspot.com/2008/07/adobe-flex-buildre-free-for-students.html' title='Adobe Flex Buildre Free for Students / Proffesors'/><author><name>Lavnish</name><uri>http://www.blogger.com/profile/16714741724993845980</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://lh4.google.co.uk/image/lavnishl/RdK3Rnp8q2E/AAAAAAAAAAw/g7LYCh-VN-8/s160-c/Me_ramoji.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8563220776994779598.post-4244872415851517106</id><published>2008-07-20T21:31:00.000-07:00</published><updated>2008-07-20T21:39:13.514-07:00</updated><title type='text'>Flex 4 : Gumbo</title><content type='html'>Found some interesting links for same&lt;br /&gt;&lt;a href="http://flexorg.wip3.adobe.com/gumbo/gumboplan.htm"&gt;Plan for Gumbo&lt;/a&gt;&lt;br /&gt;&lt;a href="http://opensource.adobe.com/wiki/display/flexsdk/Gumbo+Component+Architecture"&gt;Gumbo architecture&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8563220776994779598-4244872415851517106?l=lavnish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lavnish.blogspot.com/feeds/4244872415851517106/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8563220776994779598&amp;postID=4244872415851517106' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/4244872415851517106'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/4244872415851517106'/><link rel='alternate' type='text/html' href='http://lavnish.blogspot.com/2008/07/flex-4-gumbo.html' title='Flex 4 : Gumbo'/><author><name>Lavnish</name><uri>http://www.blogger.com/profile/16714741724993845980</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://lh4.google.co.uk/image/lavnishl/RdK3Rnp8q2E/AAAAAAAAAAw/g7LYCh-VN-8/s160-c/Me_ramoji.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8563220776994779598.post-7553118891250705896</id><published>2008-07-18T22:42:00.000-07:00</published><updated>2008-07-18T23:12:01.979-07:00</updated><title type='text'>Flex : Self Growing Button</title><content type='html'>I have been experimenting around with flex , figured out you can make a Self growing button easily in flex.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 102, 255);"&gt;&lt; id="button1" label="Click to Increase Size" height="20" click="button1.width+=10;button1.height+=5; "&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;I am not trying to display something unusual here. But just a thought its so easy in Flex. If I had to do something similar in JSF or Ajax then it would have involved lot more coding and would use Partial Page Refresh.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8563220776994779598-7553118891250705896?l=lavnish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lavnish.blogspot.com/feeds/7553118891250705896/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8563220776994779598&amp;postID=7553118891250705896' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/7553118891250705896'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/7553118891250705896'/><link rel='alternate' type='text/html' href='http://lavnish.blogspot.com/2008/07/flex-self-growing-button.html' title='Flex : Self Growing Button'/><author><name>Lavnish</name><uri>http://www.blogger.com/profile/16714741724993845980</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://lh4.google.co.uk/image/lavnishl/RdK3Rnp8q2E/AAAAAAAAAAw/g7LYCh-VN-8/s160-c/Me_ramoji.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8563220776994779598.post-2405204129634425288</id><published>2008-07-17T23:07:00.000-07:00</published><updated>2008-07-17T23:35:13.327-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='password management'/><title type='text'>Password Management : Too Many passwords ... how do u manage them ??</title><content type='html'>With technology touching our lives more than ever before , this is becoming a common issues faced by MANY ...&lt;br /&gt;A partial solution came up ... &lt;a href="http://openid.net/"&gt;OpenID&lt;/a&gt; With some drawbacks&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Not applicable to secure sites like banking etc&lt;/li&gt;&lt;li&gt;Adopted by most NOT ALL.&lt;/li&gt;&lt;/ul&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;So how to solve it ??&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Well the answer is simple ALGORITHM .. he he .. wondering how ??&lt;br /&gt;let me give you an &lt;span style="font-style: italic;"&gt;&lt;span style="color: rgb(51, 102, 255);"&gt;example...&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 102, 255); font-style: italic;"&gt;Generate an algorthim , exploiting the fact that the website names are unique. &lt;/span&gt;&lt;br /&gt;If you are member of two websites www.websiteone.com and websitetwo.com&lt;br /&gt;your password may be ... &lt;span style="font-weight: bold;"&gt;web&lt;/span&gt;&lt;span style="font-style: italic; font-weight: bold;"&gt;ONE&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;site and web&lt;/span&gt;&lt;span style="font-style: italic; font-weight: bold;"&gt;TWO&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;site&lt;/span&gt;&lt;br /&gt;And if you decide to join another www.websitethree.com then following your example you may keep your password as &lt;span style="font-weight: bold;"&gt;web&lt;/span&gt;&lt;span style="font-style: italic; font-weight: bold;"&gt;THR&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;site&lt;/span&gt;&lt;span style="font-style: italic; font-weight: bold;"&gt;EE&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The algorithm  used above is  ... take the 1st three letters of website , append with the last three letters of website and then followed by the remaining letters.&lt;br /&gt;&lt;br /&gt;Intelligent lot may think of Exceptional cases like&lt;br /&gt;&lt;ul&gt;&lt;li&gt;What if the website name is less than 6 letters ( eg yahoo.com , gmail.com )&lt;br /&gt;&lt;/li&gt;&lt;li&gt;What if it is exactly 6 letter&lt;br /&gt;&lt;/li&gt;&lt;li&gt;etc , etc ....&lt;/li&gt;&lt;/ul&gt;Well i would say that its YOUR responsibility to make a proper algorithm that works for most of the sites that you log on to. And i just gave an example here to make your life easier I am not researching on this technique to make EFFICIENT ALGOs.&lt;br /&gt;&lt;br /&gt;There are certain Implicit Requirement of this technique. The generated password must follow certain &lt;a href="http://www.microsoft.com/protect/yourself/password/create.mspx"&gt;guidelines&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;for example your Algorithm may be take the first three letters of website and then append with last three letter's &lt;a href="http://www.asciitable.com/"&gt;ascii &lt;/a&gt;value.&lt;br /&gt;So&lt;br /&gt;www.websiteone.com  =&gt; web797869&lt;br /&gt;www.websitetwo.com =&gt; web848779&lt;br /&gt;&lt;br /&gt;Well thats better.. you are a quick learner. :)&lt;br /&gt;&lt;br /&gt;But the downside of this algorithm is that it will give same password for sites like webXXXone.com and webYYYone.com or infact webYYYYone.com well thats not a downside how can someone know that you have same password for two of your website ??&lt;br /&gt;&lt;br /&gt;Hope this helps&lt;br /&gt;~cheerz !!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8563220776994779598-2405204129634425288?l=lavnish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lavnish.blogspot.com/feeds/2405204129634425288/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8563220776994779598&amp;postID=2405204129634425288' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/2405204129634425288'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/2405204129634425288'/><link rel='alternate' type='text/html' href='http://lavnish.blogspot.com/2008/07/password-management-too-many-passwords.html' title='Password Management : Too Many passwords ... how do u manage them ??'/><author><name>Lavnish</name><uri>http://www.blogger.com/profile/16714741724993845980</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://lh4.google.co.uk/image/lavnishl/RdK3Rnp8q2E/AAAAAAAAAAw/g7LYCh-VN-8/s160-c/Me_ramoji.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8563220776994779598.post-4713999399415935863</id><published>2008-07-03T03:07:00.000-07:00</published><updated>2008-07-03T03:09:03.483-07:00</updated><title type='text'>Selenium tutorial</title><content type='html'>&lt;a href="http://www.theautomatedtester.co.uk/selenium_training.htm"&gt;http://www.theautomatedtester.co.uk/selenium_training.htm&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8563220776994779598-4713999399415935863?l=lavnish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lavnish.blogspot.com/feeds/4713999399415935863/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8563220776994779598&amp;postID=4713999399415935863' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/4713999399415935863'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/4713999399415935863'/><link rel='alternate' type='text/html' href='http://lavnish.blogspot.com/2008/07/selenium.html' title='Selenium tutorial'/><author><name>Lavnish</name><uri>http://www.blogger.com/profile/16714741724993845980</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://lh4.google.co.uk/image/lavnishl/RdK3Rnp8q2E/AAAAAAAAAAw/g7LYCh-VN-8/s160-c/Me_ramoji.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8563220776994779598.post-6071104519872925242</id><published>2008-06-25T22:13:00.001-07:00</published><updated>2008-06-25T22:16:07.325-07:00</updated><title type='text'>FileInputStream is slow</title><content type='html'>http://bannister.us/weblog/2008/06/22/why-fileinputstream-is-slow/&lt;br /&gt;&lt;br /&gt;others&lt;br /&gt;http://www.wbrogden.com/&lt;br /&gt;http://www.ghostganz.com/blog/articles/2008/06/24/tostring-is-evil&lt;br /&gt;http://www.jroller.com/eu/entry/throwng_npe&lt;br /&gt;http://tech.puredanger.com/2008/06/24/performance-testing-tip-keep-a-log/&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8563220776994779598-6071104519872925242?l=lavnish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lavnish.blogspot.com/feeds/6071104519872925242/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8563220776994779598&amp;postID=6071104519872925242' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/6071104519872925242'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/6071104519872925242'/><link rel='alternate' type='text/html' href='http://lavnish.blogspot.com/2008/06/fileinputstream-is-slow.html' title='FileInputStream is slow'/><author><name>Lavnish</name><uri>http://www.blogger.com/profile/16714741724993845980</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://lh4.google.co.uk/image/lavnishl/RdK3Rnp8q2E/AAAAAAAAAAw/g7LYCh-VN-8/s160-c/Me_ramoji.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8563220776994779598.post-5082626242885468181</id><published>2008-06-25T22:05:00.001-07:00</published><updated>2008-06-25T22:06:00.252-07:00</updated><title type='text'>Java puzzle</title><content type='html'>Good puzzle...&lt;br /&gt;interface.getSuperClass( ) will return null&lt;br /&gt;as interface allows multiple inherutance&lt;br /&gt;&lt;br /&gt;&lt;a href="http://tech.puredanger.com/2008/06/24/java-puzzler-interface-super-classes/"&gt;http://tech.puredanger.com/2008/06/24/java-puzzler-interface-super-classes/&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8563220776994779598-5082626242885468181?l=lavnish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lavnish.blogspot.com/feeds/5082626242885468181/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8563220776994779598&amp;postID=5082626242885468181' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/5082626242885468181'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/5082626242885468181'/><link rel='alternate' type='text/html' href='http://lavnish.blogspot.com/2008/06/java-puzzle.html' title='Java puzzle'/><author><name>Lavnish</name><uri>http://www.blogger.com/profile/16714741724993845980</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://lh4.google.co.uk/image/lavnishl/RdK3Rnp8q2E/AAAAAAAAAAw/g7LYCh-VN-8/s160-c/Me_ramoji.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8563220776994779598.post-6765294166056224432</id><published>2008-06-23T21:44:00.000-07:00</published><updated>2008-06-23T21:45:48.708-07:00</updated><title type='text'>Video tuts from great Univ</title><content type='html'>&lt;a href="http://www.oculture.com/2007/07/freeonlinecourses.html"&gt;http://www.oculture.com/2007/07/freeonlinecourses.html&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.youtube.com/profile_play_list?user=nptelhrd"&gt;http://www.youtube.com/profile_play_list?user=nptelhrd&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8563220776994779598-6765294166056224432?l=lavnish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lavnish.blogspot.com/feeds/6765294166056224432/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8563220776994779598&amp;postID=6765294166056224432' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/6765294166056224432'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/6765294166056224432'/><link rel='alternate' type='text/html' href='http://lavnish.blogspot.com/2008/06/video-tuts-from-great-univ.html' title='Video tuts from great Univ'/><author><name>Lavnish</name><uri>http://www.blogger.com/profile/16714741724993845980</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://lh4.google.co.uk/image/lavnishl/RdK3Rnp8q2E/AAAAAAAAAAw/g7LYCh-VN-8/s160-c/Me_ramoji.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8563220776994779598.post-2007803922095392285</id><published>2008-06-08T21:53:00.000-07:00</published><updated>2008-06-15T22:07:01.818-07:00</updated><title type='text'>Good Reads</title><content type='html'>&lt;ul&gt;&lt;li&gt;&lt;a href="http://lenkite.blogspot.com/2008/05/access-windows-registry-using-java.html"&gt;Access Windows Registry in Java&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://furiouspurpose.blogspot.com/2008/06/jaxb-and-collections.html"&gt;JAXB and collections&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://javabyexample.wisdomplug.com/java-concepts/34-core-java/60-different-types-of-outofmemoryerror-you-can-encounter-in-your-java-application.html"&gt;Different tyoes of out of memory exceptions&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://code.google.com/p/assql/"&gt;ActionScript SQL&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.jamesward.com/wordpress/2008/06/10/two-great-flex-adobe-air-articles/"&gt;Flex Articles&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.javaspecialists.eu/archive/Issue162.html"&gt;Exceptions in Java&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://dow.ngra.de/2008/04/05/yet-another-java-trick/"&gt;Java Trick&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.breakitdownblog.com/which-is-the-hottest-java-web-framework-or-maybe-not-java/"&gt;Hottest Java Framework&lt;/a&gt; &amp;amp; &lt;a href="http://raibledesigns.com/rd/entry/re_which_is_the_hottest"&gt;reply&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://starjuice.net/2008/6/model-view-or-controller"&gt;MVC : Which Layer should i put my code&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8563220776994779598-2007803922095392285?l=lavnish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lavnish.blogspot.com/feeds/2007803922095392285/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8563220776994779598&amp;postID=2007803922095392285' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/2007803922095392285'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/2007803922095392285'/><link rel='alternate' type='text/html' href='http://lavnish.blogspot.com/2008/06/good-reads.html' title='Good Reads'/><author><name>Lavnish</name><uri>http://www.blogger.com/profile/16714741724993845980</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://lh4.google.co.uk/image/lavnishl/RdK3Rnp8q2E/AAAAAAAAAAw/g7LYCh-VN-8/s160-c/Me_ramoji.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8563220776994779598.post-1473825639520971509</id><published>2008-06-06T21:08:00.000-07:00</published><updated>2008-06-06T21:09:30.800-07:00</updated><title type='text'>Java 5 Oracle driver : bug ?</title><content type='html'>Nice read&lt;br /&gt;&lt;a href="http://www.jroller.com/morisil/entry/can_i_trust_oracle_jdbc"&gt;http://www.jroller.com/morisil/entry/can_i_trust_oracle_jdbc&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8563220776994779598-1473825639520971509?l=lavnish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lavnish.blogspot.com/feeds/1473825639520971509/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8563220776994779598&amp;postID=1473825639520971509' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/1473825639520971509'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/1473825639520971509'/><link rel='alternate' type='text/html' href='http://lavnish.blogspot.com/2008/06/java-5-oracle-driver-bug.html' title='Java 5 Oracle driver : bug ?'/><author><name>Lavnish</name><uri>http://www.blogger.com/profile/16714741724993845980</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://lh4.google.co.uk/image/lavnishl/RdK3Rnp8q2E/AAAAAAAAAAw/g7LYCh-VN-8/s160-c/Me_ramoji.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8563220776994779598.post-6899723849878977135</id><published>2008-06-06T21:03:00.000-07:00</published><updated>2008-06-06T21:04:03.910-07:00</updated><title type='text'>Linked Architecture</title><content type='html'>good read ... &lt;br /&gt;&lt;br /&gt;&lt;a href="http://cookiesareforclosers.com/blog/2008/06/linkedin-architecture"&gt;http://cookiesareforclosers.com/blog/2008/06/linkedin-architecture&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8563220776994779598-6899723849878977135?l=lavnish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lavnish.blogspot.com/feeds/6899723849878977135/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8563220776994779598&amp;postID=6899723849878977135' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/6899723849878977135'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/6899723849878977135'/><link rel='alternate' type='text/html' href='http://lavnish.blogspot.com/2008/06/linked-architecture.html' title='Linked Architecture'/><author><name>Lavnish</name><uri>http://www.blogger.com/profile/16714741724993845980</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://lh4.google.co.uk/image/lavnishl/RdK3Rnp8q2E/AAAAAAAAAAw/g7LYCh-VN-8/s160-c/Me_ramoji.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8563220776994779598.post-1736598671274626236</id><published>2008-06-06T06:07:00.000-07:00</published><updated>2008-06-06T06:16:19.685-07:00</updated><title type='text'>Difference between JVM , JRE , JDK</title><content type='html'>Simple some say ... Tricky as seen by others ... your decision :)&lt;br /&gt;Answer is&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;JVM&lt;/span&gt; : Have you ever seen a software to install JVM ? NO ... Because you cant install it . Its considered to be subpart of JRE. Engineers at sun say its hypothetical Java engine that reads and run byte code.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;JRE&lt;/span&gt; : = JVM + everything needed to run java program ( or should i say class file )&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;JDK&lt;/span&gt; : = JRE + extra tools needed to make java progran. see figure below.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_HRk6DhG06vk/SEk3XGkhNlI/AAAAAAAABPw/2kCg4qIpLyA/s1600-h/jvm.JPG"&gt;&lt;img style="cursor: pointer;" src="http://1.bp.blogspot.com/_HRk6DhG06vk/SEk3XGkhNlI/AAAAAAAABPw/2kCg4qIpLyA/s320/jvm.JPG" alt="" id="BLOGGER_PHOTO_ID_5208755314070992466" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Can you install JRE without JDK ? yes find them on suns site.&lt;br /&gt;&lt;br /&gt;You might as well have observed when installing JDK JRE also gets installed&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8563220776994779598-1736598671274626236?l=lavnish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lavnish.blogspot.com/feeds/1736598671274626236/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8563220776994779598&amp;postID=1736598671274626236' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/1736598671274626236'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/1736598671274626236'/><link rel='alternate' type='text/html' href='http://lavnish.blogspot.com/2008/06/difference-between-jvm-jre-jdk.html' title='Difference between JVM , JRE , JDK'/><author><name>Lavnish</name><uri>http://www.blogger.com/profile/16714741724993845980</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://lh4.google.co.uk/image/lavnishl/RdK3Rnp8q2E/AAAAAAAAAAw/g7LYCh-VN-8/s160-c/Me_ramoji.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_HRk6DhG06vk/SEk3XGkhNlI/AAAAAAAABPw/2kCg4qIpLyA/s72-c/jvm.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8563220776994779598.post-5961479349563647605</id><published>2008-06-06T03:50:00.000-07:00</published><updated>2008-06-06T03:56:52.139-07:00</updated><title type='text'>String Buffer vs StringBuilder vs Concatination Operator +</title><content type='html'>Run this code ... you will realize using concatination operator is better than stringBuilder&lt;br /&gt;Most of us ( including me ) had the idea that StringBuilder will be fast&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;                &lt;span style="color:RED;"&gt;&lt;b&gt;long&lt;/b&gt;&lt;/span&gt; now &lt;span style="font-size:+1;color:BLUE;"&gt;=&lt;/span&gt; System&lt;span style="font-size:+1;color:BLUE;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;currentTimeMillis&lt;span style="font-size:+1;color:BLUE;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="font-size:+1;color:BLUE;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style="font-size:+1;color:BLUE;"&gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;                &lt;span style="color:RED;"&gt;&lt;b&gt;for&lt;/b&gt;&lt;/span&gt; &lt;span style="font-size:+1;color:BLUE;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="color:RED;"&gt;&lt;b&gt;int&lt;/b&gt;&lt;/span&gt; i&lt;span style="font-size:+1;color:BLUE;"&gt;=&lt;/span&gt;&lt;span style="color:BROWN;"&gt;0&lt;/span&gt;&lt;span style="font-size:+1;color:BLUE;"&gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt; i&lt;span style="font-size:+1;color:BLUE;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:BROWN;"&gt;10000000&lt;/span&gt;&lt;span style="font-size:+1;color:BLUE;"&gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt; i&lt;span style="font-size:+1;color:BLUE;"&gt;&lt;span style="font-size:+1;color:BLUE;"&gt;+&lt;/span&gt;&lt;span style="font-size:+1;color:BLUE;"&gt;+&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:+1;color:BLUE;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt; &lt;span style="font-size:+1;color:BLUE;"&gt;&lt;b&gt;{&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;                    String str &lt;span style="font-size:+1;color:BLUE;"&gt;=&lt;/span&gt; &lt;span style="color:PURPLE;"&gt;"one; two "&lt;/span&gt; &lt;span style="font-size:+1;color:BLUE;"&gt;+&lt;/span&gt;&lt;br /&gt;                        &lt;span style="color:PURPLE;"&gt;";three four; five; six"&lt;/span&gt; &lt;span style="font-size:+1;color:BLUE;"&gt;+&lt;/span&gt;&lt;br /&gt;                        &lt;span style="color:PURPLE;"&gt;"seven eight nine ten"&lt;/span&gt;&lt;span style="font-size:+1;color:BLUE;"&gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;                &lt;span style="font-size:+1;color:BLUE;"&gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;                &lt;span style="color:RED;"&gt;&lt;b&gt;long&lt;/b&gt;&lt;/span&gt; then &lt;span style="font-size:+1;color:BLUE;"&gt;=&lt;/span&gt; System&lt;span style="font-size:+1;color:BLUE;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;currentTimeMillis&lt;span style="font-size:+1;color:BLUE;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="font-size:+1;color:BLUE;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style="font-size:+1;color:BLUE;"&gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;                System&lt;span style="font-size:+1;color:BLUE;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;out&lt;span style="font-size:+1;color:BLUE;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;println&lt;span style="font-size:+1;color:BLUE;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="color:PURPLE;"&gt;"+ "&lt;/span&gt; &lt;span style="font-size:+1;color:BLUE;"&gt;+&lt;/span&gt; Long&lt;span style="font-size:+1;color:BLUE;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;toString&lt;span style="font-size:+1;color:BLUE;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;then &lt;span style="font-size:+1;color:BLUE;"&gt;-&lt;/span&gt; now&lt;span style="font-size:+1;color:BLUE;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style="font-size:+1;color:BLUE;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style="font-size:+1;color:BLUE;"&gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;                now &lt;span style="font-size:+1;color:BLUE;"&gt;=&lt;/span&gt; System&lt;span style="font-size:+1;color:BLUE;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;currentTimeMillis&lt;span style="font-size:+1;color:BLUE;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="font-size:+1;color:BLUE;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style="font-size:+1;color:BLUE;"&gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;                &lt;span style="color:RED;"&gt;&lt;b&gt;for&lt;/b&gt;&lt;/span&gt; &lt;span style="font-size:+1;color:BLUE;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="color:RED;"&gt;&lt;b&gt;int&lt;/b&gt;&lt;/span&gt; i&lt;span style="font-size:+1;color:BLUE;"&gt;=&lt;/span&gt;&lt;span style="color:BROWN;"&gt;0&lt;/span&gt;&lt;span style="font-size:+1;color:BLUE;"&gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt; i&lt;span style="font-size:+1;color:BLUE;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:BROWN;"&gt;10000000&lt;/span&gt;&lt;span style="font-size:+1;color:BLUE;"&gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt; i&lt;span style="font-size:+1;color:BLUE;"&gt;&lt;span style="font-size:+1;color:BLUE;"&gt;+&lt;/span&gt;&lt;span style="font-size:+1;color:BLUE;"&gt;+&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:+1;color:BLUE;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt; &lt;span style="font-size:+1;color:BLUE;"&gt;&lt;b&gt;{&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;                    StringBuilder sb &lt;span style="font-size:+1;color:BLUE;"&gt;=&lt;/span&gt; &lt;span style="color:RED;"&gt;&lt;b&gt;new&lt;/b&gt;&lt;/span&gt; StringBuilder&lt;span style="font-size:+1;color:BLUE;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="color:BROWN;"&gt;200&lt;/span&gt;&lt;span style="font-size:+1;color:BLUE;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style="font-size:+1;color:BLUE;"&gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;                    sb&lt;span style="font-size:+1;color:BLUE;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;append&lt;span style="font-size:+1;color:BLUE;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="color:PURPLE;"&gt;"one; two "&lt;/span&gt;&lt;span style="font-size:+1;color:BLUE;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style="font-size:+1;color:BLUE;"&gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;                    sb&lt;span style="font-size:+1;color:BLUE;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;append&lt;span style="font-size:+1;color:BLUE;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;                     &lt;span style="color:PURPLE;"&gt;";three four; five; six"&lt;/span&gt;&lt;span style="font-size:+1;color:BLUE;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style="font-size:+1;color:BLUE;"&gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;                    sb&lt;span style="font-size:+1;color:BLUE;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;append&lt;span style="font-size:+1;color:BLUE;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;                     &lt;span style="color:PURPLE;"&gt;"seven eight nine ten"&lt;/span&gt;&lt;span style="font-size:+1;color:BLUE;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style="font-size:+1;color:BLUE;"&gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;                    String str &lt;span style="font-size:+1;color:BLUE;"&gt;=&lt;/span&gt; sb&lt;span style="font-size:+1;color:BLUE;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;toString&lt;span style="font-size:+1;color:BLUE;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="font-size:+1;color:BLUE;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style="font-size:+1;color:BLUE;"&gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;                &lt;span style="font-size:+1;color:BLUE;"&gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;                then &lt;span style="font-size:+1;color:BLUE;"&gt;=&lt;/span&gt; System&lt;span style="font-size:+1;color:BLUE;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;currentTimeMillis&lt;span style="font-size:+1;color:BLUE;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="font-size:+1;color:BLUE;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style="font-size:+1;color:BLUE;"&gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;                System&lt;span style="font-size:+1;color:BLUE;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;out&lt;span style="font-size:+1;color:BLUE;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;println&lt;span style="font-size:+1;color:BLUE;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="color:PURPLE;"&gt;"StringBuilder "&lt;/span&gt; &lt;span style="font-size:+1;color:BLUE;"&gt;+&lt;/span&gt; Long&lt;span style="font-size:+1;color:BLUE;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;toString&lt;span style="font-size:+1;color:BLUE;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;then &lt;span style="font-size:+1;color:BLUE;"&gt;-&lt;/span&gt; now&lt;span style="font-size:+1;color:BLUE;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style="font-size:+1;color:BLUE;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style="font-size:+1;color:BLUE;"&gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;           &lt;br /&gt;         now &lt;span style="font-size:+1;color:BLUE;"&gt;=&lt;/span&gt; System&lt;span style="font-size:+1;color:BLUE;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;currentTimeMillis&lt;span style="font-size:+1;color:BLUE;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="font-size:+1;color:BLUE;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style="font-size:+1;color:BLUE;"&gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;       &lt;span style="color:RED;"&gt;&lt;b&gt; for&lt;/b&gt;&lt;/span&gt; &lt;span style="font-size:+1;color:BLUE;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="color:RED;"&gt;&lt;b&gt;int&lt;/b&gt;&lt;/span&gt; i&lt;span style="font-size:+1;color:BLUE;"&gt;=&lt;/span&gt;&lt;span style="color:BROWN;"&gt;0&lt;/span&gt;&lt;span style="font-size:+1;color:BLUE;"&gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt; i&lt;span style="font-size:+1;color:BLUE;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:BROWN;"&gt;10000000&lt;/span&gt;&lt;span style="font-size:+1;color:BLUE;"&gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt; i&lt;span style="font-size:+1;color:BLUE;"&gt;&lt;span style="font-size:+1;color:BLUE;"&gt;+&lt;/span&gt;&lt;span style="font-size:+1;color:BLUE;"&gt;+&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:+1;color:BLUE;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt; &lt;span style="font-size:+1;color:BLUE;"&gt;&lt;b&gt;{&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;             StringBuffer sb &lt;span style="font-size:+1;color:BLUE;"&gt;=&lt;/span&gt; &lt;span style="color:RED;"&gt;&lt;b&gt;new&lt;/b&gt;&lt;/span&gt; StringBuffer&lt;span style="font-size:+1;color:BLUE;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="color:BROWN;"&gt;200&lt;/span&gt;&lt;span style="font-size:+1;color:BLUE;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style="font-size:+1;color:BLUE;"&gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;             sb&lt;span style="font-size:+1;color:BLUE;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;append&lt;span style="font-size:+1;color:BLUE;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="color:PURPLE;"&gt;"one; two "&lt;/span&gt;&lt;span style="font-size:+1;color:BLUE;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style="font-size:+1;color:BLUE;"&gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;             sb&lt;span style="font-size:+1;color:BLUE;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;append&lt;span style="font-size:+1;color:BLUE;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;              &lt;span style="color:PURPLE;"&gt;";three four; five; six"&lt;/span&gt;&lt;span style="font-size:+1;color:BLUE;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style="font-size:+1;color:BLUE;"&gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;             sb&lt;span style="font-size:+1;color:BLUE;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;append&lt;span style="font-size:+1;color:BLUE;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;              &lt;span style="color:PURPLE;"&gt;"seven eight nine ten"&lt;/span&gt;&lt;span style="font-size:+1;color:BLUE;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style="font-size:+1;color:BLUE;"&gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;             String str &lt;span style="font-size:+1;color:BLUE;"&gt;=&lt;/span&gt; sb&lt;span style="font-size:+1;color:BLUE;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;toString&lt;span style="font-size:+1;color:BLUE;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="font-size:+1;color:BLUE;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style="font-size:+1;color:BLUE;"&gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;         &lt;span style="font-size:+1;color:BLUE;"&gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;         then &lt;span style="font-size:+1;color:BLUE;"&gt;=&lt;/span&gt; System&lt;span style="font-size:+1;color:BLUE;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;currentTimeMillis&lt;span style="font-size:+1;color:BLUE;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="font-size:+1;color:BLUE;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style="font-size:+1;color:BLUE;"&gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;         System&lt;span style="font-size:+1;color:BLUE;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;out&lt;span style="font-size:+1;color:BLUE;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;println&lt;span style="font-size:+1;color:BLUE;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="color:PURPLE;"&gt;"String Buffer "&lt;/span&gt; &lt;span style="font-size:+1;color:BLUE;"&gt;+&lt;/span&gt; Long&lt;span style="font-size:+1;color:BLUE;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;toString&lt;span style="font-size:+1;color:BLUE;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;then &lt;span style="font-size:+1;color:BLUE;"&gt;-&lt;/span&gt; now&lt;span style="font-size:+1;color:BLUE;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style="font-size:+1;color:BLUE;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style="font-size:+1;color:BLUE;"&gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;  &lt;/pre&gt;&lt;br /&gt;Output on my PC was ...&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;+ 32&lt;br /&gt;StringBuilder  9031&lt;br /&gt;String Buffer  12125&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8563220776994779598-5961479349563647605?l=lavnish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lavnish.blogspot.com/feeds/5961479349563647605/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8563220776994779598&amp;postID=5961479349563647605' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/5961479349563647605'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/5961479349563647605'/><link rel='alternate' type='text/html' href='http://lavnish.blogspot.com/2008/06/string-buffer-vs-stringbuilder-vs.html' title='String Buffer vs StringBuilder vs Concatination Operator +'/><author><name>Lavnish</name><uri>http://www.blogger.com/profile/16714741724993845980</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://lh4.google.co.uk/image/lavnishl/RdK3Rnp8q2E/AAAAAAAAAAw/g7LYCh-VN-8/s160-c/Me_ramoji.jpg'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8563220776994779598.post-6756072426684706607</id><published>2008-06-06T02:39:00.001-07:00</published><updated>2008-06-06T21:13:22.332-07:00</updated><title type='text'>Good Blogs</title><content type='html'>http://tech.puredanger.com/2008/06/03/favorite-java-resources/&lt;br /&gt;http://www.techper.net/2008/06/03/flex-leads-to-clash-between-java-and-flash-communities/&lt;br /&gt;http://thoughts.bharathganesh.com/2008/06/interesting-leak.html&lt;br /&gt;http://linkmingle.com/user/interview_questions/google_interview_questions&lt;br /&gt;http://jeremymanson.blogspot.com/&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8563220776994779598-6756072426684706607?l=lavnish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lavnish.blogspot.com/feeds/6756072426684706607/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8563220776994779598&amp;postID=6756072426684706607' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/6756072426684706607'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/6756072426684706607'/><link rel='alternate' type='text/html' href='http://lavnish.blogspot.com/2008/06/good-blogs.html' title='Good Blogs'/><author><name>Lavnish</name><uri>http://www.blogger.com/profile/16714741724993845980</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://lh4.google.co.uk/image/lavnishl/RdK3Rnp8q2E/AAAAAAAAAAw/g7LYCh-VN-8/s160-c/Me_ramoji.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8563220776994779598.post-750017886192513267</id><published>2008-06-05T23:22:00.001-07:00</published><updated>2008-06-05T23:24:33.716-07:00</updated><title type='text'>Shutdown Windows using Java</title><content type='html'>Using JNI for it may be an overkill ...&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;may try&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;pre&gt;String command = &lt;span style="color:#0066ff;"&gt;&lt;i&gt;""; ( &lt;a href="http://www.computerhope.com/shutdown.htm"&gt;click here for shutdown_command&lt;/a&gt; )&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;Process child = Runtime.getRuntime().exec(command);&lt;/pre&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Or may be try one of these ...&lt;br /&gt;Try one of these (they've both worked, but there might be problems with one - too long ago, don't remember, though )&lt;br /&gt;&lt;br /&gt;C:\WINDOWS\RUNDLL32.EXE SHELL32.DLL,SHExitWindowsEx 1&lt;br /&gt;C:\WINDOWS\RUNDLL32.EXE user,exitwindows&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8563220776994779598-750017886192513267?l=lavnish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lavnish.blogspot.com/feeds/750017886192513267/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8563220776994779598&amp;postID=750017886192513267' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/750017886192513267'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/750017886192513267'/><link rel='alternate' type='text/html' href='http://lavnish.blogspot.com/2008/06/shutdown-windows-using-java.html' title='Shutdown Windows using Java'/><author><name>Lavnish</name><uri>http://www.blogger.com/profile/16714741724993845980</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://lh4.google.co.uk/image/lavnishl/RdK3Rnp8q2E/AAAAAAAAAAw/g7LYCh-VN-8/s160-c/Me_ramoji.jpg'/></author><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8563220776994779598.post-5323475787254276593</id><published>2008-06-05T22:26:00.000-07:00</published><updated>2008-07-17T20:34:34.752-07:00</updated><title type='text'>All Head First Series eBooks</title><content type='html'>For those of you ... who like to collect eBooks ...&lt;br /&gt;Heres the &lt;span style="color: rgb(255, 0, 0);"&gt;BAAP of all eBooks &lt;/span&gt;you collected so far&lt;br /&gt;&lt;br /&gt;and above all &lt;span style="color: rgb(255, 0, 0);"&gt;most of them don't require password ...&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Save the links ... as i may delete the post soon ... :)&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://rapidshare.com/files/107291281/Head_First_Servlets_and_JSP__2nd_Edition.rar"&gt;Head First JSP Servlet&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="color: rgb(51, 102, 255);"&gt;Head First EJB&lt;/span&gt; &lt;a href="http://rapidshare.com/files/114428157/Head_First_EJB.part1.rar"&gt;Part1&lt;/a&gt; , &lt;a href="http://rapidshare.com/files/114428158/Head_First_EJB.part2.rar"&gt;Part2 &lt;/a&gt;, &lt;a href="http://rapidshare.com/files/114428160/Head_First_EJB.part3.rar"&gt;Part3 &lt;/a&gt;, &lt;a href="http://rapidshare.com/files/114428161/Head_First_EJB.part4.rar"&gt;Part4&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://rapidshare.com/files/2778679/HFDPfull.zip"&gt;Head First Design Patterns&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://rapidshare.com/files/107127446/HFSoftDev.rar"&gt;Head First Software Development&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://rapidshare.com/files/105037749/Head_First_SQL.pdf"&gt;Head First SQL&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://rapidshare.com/files/24918976/Head.First.Object.Oriented.Analysis.and.rar"&gt;Head First Object Oriented n Analysis&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://rapidshare.com/files/106849150/head_first_javascript.rar"&gt;Head First JavaScript&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://rapidshare.com/files/971502/OReilly.Head.First.HTML.with.CSS.and.XHTML.Dec.2005.INTERNAL.rar"&gt;Head First HTML&lt;/a&gt; &lt;/li&gt;&lt;li&gt;&lt;a style="color: rgb(255, 0, 0);" href="http://www.4shared.com/file/45872148/188712df/Head-First-Java-2nd-edition.html?s=1"&gt;Head First Java&lt;/a&gt;&lt;span style="color: rgb(255, 0, 0);"&gt; ( !! Link changed now !! )&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;&lt;a href="http://www.4shared.com/file/45872148/188712df/Head-First-Java-2nd-edition.html?s=1"&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;http://www.4shared.com/file/45872148/188712df/Head-First-Java-2nd-edition.html?s=1&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://rapidshare.com/files/20799445/D94E2ADA-E362-4A74-8D4D-58BAB11A329A.rar"&gt;J2EE Web Services by Richard Monson Haefel&lt;/a&gt; ( password is "books_for_all" )&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;I couldnt find password less links for ... "Head First Ajax" may be someone can help me with that ....&lt;br /&gt;&lt;br /&gt;cheerz !!&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;More links&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;http://ebooksresource.wordpress.com/category/design-pattern/&lt;br /&gt;http://martinfowler.com/books.html#eaa&lt;br /&gt;http://knowfree.net/&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8563220776994779598-5323475787254276593?l=lavnish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lavnish.blogspot.com/feeds/5323475787254276593/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8563220776994779598&amp;postID=5323475787254276593' title='20 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/5323475787254276593'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/5323475787254276593'/><link rel='alternate' type='text/html' href='http://lavnish.blogspot.com/2008/06/all-head-first-series-ebooks.html' title='All Head First Series eBooks'/><author><name>Lavnish</name><uri>http://www.blogger.com/profile/16714741724993845980</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://lh4.google.co.uk/image/lavnishl/RdK3Rnp8q2E/AAAAAAAAAAw/g7LYCh-VN-8/s160-c/Me_ramoji.jpg'/></author><thr:total>20</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8563220776994779598.post-2311395114569509617</id><published>2008-06-05T09:55:00.000-07:00</published><updated>2008-06-05T10:08:24.464-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='corejava'/><title type='text'>Is Java Pass by value or pass by reference</title><content type='html'>Congratulations .... you are the 99,99,999 person to ask that ... click "&lt;span style="color:#000099;"&gt;here&lt;/span&gt;" to clain your prize.... ;-)&lt;br /&gt;Let me see .. whats the correct ans....&lt;br /&gt;Some of you may say its "pass by value for primitive data types and pass by reference for objects" ... hmmmm wrong ... actually the intellignet lot ( at least the booky's ) would say "java is pass by value for primitive types and passes refernce by value for objects.. so java is pass by value"... correct buddy ..... you the man !!&lt;br /&gt;&lt;br /&gt;BUT ... thats incomplete my friend ... &lt;strong&gt;complete answer &lt;/strong&gt;is .... java is pass by value for primitive types , passes reference by value for object types ... and when passing objects to remote method (ie RMI) its pass by object copy NOT reference copy.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8563220776994779598-2311395114569509617?l=lavnish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lavnish.blogspot.com/feeds/2311395114569509617/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8563220776994779598&amp;postID=2311395114569509617' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/2311395114569509617'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/2311395114569509617'/><link rel='alternate' type='text/html' href='http://lavnish.blogspot.com/2008/06/is-java-pass-by-value-or-pass-by.html' title='Is Java Pass by value or pass by reference'/><author><name>Lavnish</name><uri>http://www.blogger.com/profile/16714741724993845980</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://lh4.google.co.uk/image/lavnishl/RdK3Rnp8q2E/AAAAAAAAAAw/g7LYCh-VN-8/s160-c/Me_ramoji.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8563220776994779598.post-3868320152013387610</id><published>2008-06-03T22:00:00.001-07:00</published><updated>2008-06-03T22:00:46.523-07:00</updated><title type='text'>Unofficial google shell</title><content type='html'>Try it to beleive it ...&lt;br /&gt;&lt;a href="http://goosh.org/"&gt;http://goosh.org/&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8563220776994779598-3868320152013387610?l=lavnish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lavnish.blogspot.com/feeds/3868320152013387610/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8563220776994779598&amp;postID=3868320152013387610' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/3868320152013387610'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/3868320152013387610'/><link rel='alternate' type='text/html' href='http://lavnish.blogspot.com/2008/06/unofficial-google-shell.html' title='Unofficial google shell'/><author><name>Lavnish</name><uri>http://www.blogger.com/profile/16714741724993845980</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://lh4.google.co.uk/image/lavnishl/RdK3Rnp8q2E/AAAAAAAAAAw/g7LYCh-VN-8/s160-c/Me_ramoji.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8563220776994779598.post-4264000946466770928</id><published>2008-06-01T21:50:00.000-07:00</published><updated>2008-06-01T21:51:08.467-07:00</updated><title type='text'>Java Memory Model FAQ</title><content type='html'>&lt;a href="http://www.cs.umd.edu/%7Epugh/java/memoryModel/jsr-133-faq.html"&gt;JSR 133 FAQ&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8563220776994779598-4264000946466770928?l=lavnish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lavnish.blogspot.com/feeds/4264000946466770928/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8563220776994779598&amp;postID=4264000946466770928' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/4264000946466770928'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/4264000946466770928'/><link rel='alternate' type='text/html' href='http://lavnish.blogspot.com/2008/06/java-memory-model-faq.html' title='Java Memory Model FAQ'/><author><name>Lavnish</name><uri>http://www.blogger.com/profile/16714741724993845980</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://lh4.google.co.uk/image/lavnishl/RdK3Rnp8q2E/AAAAAAAAAAw/g7LYCh-VN-8/s160-c/Me_ramoji.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8563220776994779598.post-2061955258196206694</id><published>2008-05-31T07:01:00.000-07:00</published><updated>2008-05-31T07:05:59.705-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='sql'/><title type='text'>Implicit VS explicit cursor</title><content type='html'>&lt;ol&gt;&lt;li&gt;PL/SQL employs an implicit cursor for each UPDATE, DELETE, or INSERT statement you execute in a program. You cannot, execute these statements within an explicit cursor, even if you want to. &lt;/li&gt;&lt;li&gt;You have a choice between using an implicit or explicit cursor only when you execute a single-row SELECT statement (a SELECT that returns only one row). &lt;/li&gt;&lt;li&gt;When SELECT returns more than one row you may or may not have to use explicit cursor depends on usecase.&lt;/li&gt;&lt;li&gt;If you use an implicit cursor, Oracle performs the open, fetches, and close for you automatically; these actions are outside of your programmatic control.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ol&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8563220776994779598-2061955258196206694?l=lavnish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lavnish.blogspot.com/feeds/2061955258196206694/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8563220776994779598&amp;postID=2061955258196206694' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/2061955258196206694'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/2061955258196206694'/><link rel='alternate' type='text/html' href='http://lavnish.blogspot.com/2008/05/implicit-vs-explicit-cursor.html' title='Implicit VS explicit cursor'/><author><name>Lavnish</name><uri>http://www.blogger.com/profile/16714741724993845980</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://lh4.google.co.uk/image/lavnishl/RdK3Rnp8q2E/AAAAAAAAAAw/g7LYCh-VN-8/s160-c/Me_ramoji.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8563220776994779598.post-8158646092667470203</id><published>2008-05-31T06:30:00.000-07:00</published><updated>2008-05-31T06:47:42.964-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='sql'/><title type='text'>SQL Faqs</title><content type='html'>&lt;strong&gt;find the two minimum salaries among table&lt;/strong&gt;&lt;br /&gt;This Query returns duplicate value.&lt;br /&gt;select sal from (select * from &lt;table_name&gt; order by sal asc) where rownum &lt; 3&lt;br /&gt;&lt;br /&gt;This Query retuns only the second minimum salary&lt;br /&gt;Select min(salary) from &lt;tab&gt; where Salary&gt;(Select min(salary) from &lt;tab&gt;)&lt;br /&gt;&lt;br /&gt;Whereas the following Query returns the distinct first two minmum salary in a table&lt;br /&gt;Select min(salary) from &lt;tab&gt; union&lt;br /&gt;Select min(salary) from &lt;tab&gt; where salary&gt;(Select min(salary) from &lt;tab&gt;)&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Find out nth highest salary from emp table &lt;/strong&gt;&lt;br /&gt;directly we can not give the condition  as rownum=2....this is the most optimal soluton for the given problem&lt;br /&gt;select * from (select rownum r,salary from (select distinct(salary)from employees where salary is NOT NULL order by salary desc)) where r=2&lt;br /&gt;Best way is using CORRELATED SUBQUERY : as below&lt;br /&gt;Select * From TableName T1 Where    (N-1) = (Select Count(Distinct(E2.ColumnName)) From TableName  T2 Where   T2.ColumnName &gt; T1.ColumnName)&lt;br /&gt;For Required Case We can use it as :-&lt;br /&gt;Select * From EMP T1 Where    (2-1) = (Select Count(Distinct(E2.sal)) From EMP  T2 Where   T2.sal &gt; T1.sal)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8563220776994779598-8158646092667470203?l=lavnish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lavnish.blogspot.com/feeds/8158646092667470203/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8563220776994779598&amp;postID=8158646092667470203' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/8158646092667470203'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/8158646092667470203'/><link rel='alternate' type='text/html' href='http://lavnish.blogspot.com/2008/05/sql-faqs.html' title='SQL Faqs'/><author><name>Lavnish</name><uri>http://www.blogger.com/profile/16714741724993845980</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://lh4.google.co.uk/image/lavnishl/RdK3Rnp8q2E/AAAAAAAAAAw/g7LYCh-VN-8/s160-c/Me_ramoji.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8563220776994779598.post-2946734487558487615</id><published>2008-05-31T06:20:00.000-07:00</published><updated>2008-05-31T06:24:08.428-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='xml'/><title type='text'>XML vs HTML : differences</title><content type='html'>&lt;ol&gt;&lt;li&gt;XML is basically ment to represent data in portable way while HTML to show data.&lt;/li&gt;&lt;li&gt;XML have custom tags HTML has predefined tags.&lt;/li&gt;&lt;li&gt;XML is case sensitive and HTML is not.&lt;/li&gt;&lt;li&gt;XML document has to wellformed HTML doc need not be.&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;em&gt;Looking forward for your input... :)&lt;/em&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8563220776994779598-2946734487558487615?l=lavnish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lavnish.blogspot.com/feeds/2946734487558487615/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8563220776994779598&amp;postID=2946734487558487615' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/2946734487558487615'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/2946734487558487615'/><link rel='alternate' type='text/html' href='http://lavnish.blogspot.com/2008/05/xml-vs-html-differences.html' title='XML vs HTML : differences'/><author><name>Lavnish</name><uri>http://www.blogger.com/profile/16714741724993845980</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://lh4.google.co.uk/image/lavnishl/RdK3Rnp8q2E/AAAAAAAAAAw/g7LYCh-VN-8/s160-c/Me_ramoji.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8563220776994779598.post-2240723639336380700</id><published>2008-05-31T02:32:00.000-07:00</published><updated>2008-05-31T02:45:25.809-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='jsp'/><title type='text'>All About JSP : TagHandler</title><content type='html'>The package javax.servlet.jsp.tagext package has interfaces&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Tag &lt;/li&gt;&lt;li&gt;IterationTag&lt;/li&gt;&lt;li&gt;BodyTag&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;There are classes provided in the javax.servlet.jsp.tagext package which provide default implementation for the above interfaces :&lt;br /&gt;&lt;ol&gt;&lt;li&gt;TagSupport&lt;/li&gt;&lt;li&gt;BodyTagSupport&lt;/li&gt;&lt;/ol&gt;THERE s no IterationTagSupport&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Tag interface&lt;/span&gt;&lt;br /&gt;The six methods which Tag interface provides and which we have to implement are :&lt;br /&gt;&lt;ol&gt;&lt;li&gt;setPageContext(PageContext pc)&lt;/li&gt;&lt;li&gt;setParent(Tag parent)&lt;/li&gt;&lt;li&gt;getParent()&lt;/li&gt;&lt;li&gt;doStartTag()&lt;/li&gt;&lt;li&gt;doEndTag()&lt;/li&gt;&lt;li&gt;release()&lt;/li&gt;&lt;/ol&gt;Above six methods are a must.&lt;br /&gt;If there are attributes in tag then we have additional setter &amp;amp; getter for them.&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-style: italic;"&gt;Tag Interface Lifecycle&lt;/span&gt;&lt;br /&gt;&lt;ol&gt;&lt;li&gt;&lt;span style="font-style: italic;"&gt;The setPageContext() method&lt;/span&gt; : is the first method that is called in the life cycle of a custom tag.&lt;/li&gt;&lt;li&gt;&lt;span style="font-style: italic;"&gt;The setParent() and getParent() methods &lt;/span&gt;: are used when custom tags are nested one inside the other. The JSP container calls the setParent() method on the child tag and passes it a reference to the parent tag. The getParent() method is usually called by one of the child tags and not directly by the JSP container.&lt;/li&gt;&lt;li&gt;the setters of attributes are called&lt;/li&gt;&lt;li&gt;&lt;span style="font-style: italic;"&gt;doStartTag() method&lt;/span&gt; :  After setting up the tag with appropriate references by calling the setPageContext(), setParent(), and setter methods, the container calls the doStartTag() method on the tag. After initialization, the doStartTag() method decides whether or not to continue evaluating its body content. As a result, it returns one of the two integer constants defined in the Tag interface: EVAL_BODY_INCLUDE or SKIP_BODY. May throw a JSPException.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-style: italic;"&gt;doEndTag() method&lt;/span&gt; :  After the body of the tag is evaluated or skipped (depending on the return value of doStartTag()), the container calls the doEndTag() method. May throw a JSPException.&lt;/li&gt;&lt;li&gt;&lt;span style="font-style: italic;"&gt;release() method&lt;/span&gt; : Finally, the container calls the release() method on the handler class when the tag handler object is no longer required. A custom tag may occur multiple times on a JSP page. A single instance of the tag handler may be used to handle all of these occurrences. The JSP container calls the release() method on the handler class when the handler object is no longer required. It is important to note that this method is not called after every call to doEndTag().&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ol&gt;&lt;span style="font-weight: bold;"&gt;IterationTag Interface&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The IterationTag interface extends the Tag interface and allows us to include the body content multiple times, in a way that is similar to the loop functionality of a programming language. The IterationTag interface declares one method and one constant&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;int doAfterBody()  :  &lt;/span&gt;This method is called after each evaluation of the tag body. It can return either of two values: IterationTag.EVAL_BODY_AGAIN or Tag.SKIP_BODY. The return value determines whether or not the body needs to be reevaluated.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;EVAL_BODY_AGAIN :&lt;/span&gt; Return value for doAfterBody(). This constant instructs the JSP engine to evaluate the tag body and include it in the output.&lt;br /&gt;&lt;br /&gt;If doStartTag() returns SKIP_BODY, then the body is skipped and the container calls doEndTag(). In this case, the doAfterBody() method is never called on the iterative tag. However, if doStartTag() returns EVAL_BODY_INCLUDE, the body of the tag is evaluated, the result is included in the output, and the container calls doAfterBody() for the very first time.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;BodyTag Interface&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The BodyTag interface extends IterationTag and adds a new functionality that lets the tag handler evaluate its body content in a temporary buffer. This feature allows the tag to process the generated contents at will. For example, after evaluation, the tag handler can view the body content, discard it completely, modify it, or add more data to it before sending it to the output stream. Since it is derived from IterationTag, BodyTag can also handle the evaluation and processing of the content as many times as required.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;void setBodyContent(BodyContent)&lt;/span&gt; : Called by the JSP container to pass a reference to a&lt;br /&gt;BodyContent object.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;void doInitBody( )&lt;/span&gt; : Called by the JSP container after calling setBodyContent(), to allow the tag handler class to perform initialization steps on BodyContent.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;EVAL_BODY_BUFFERED&lt;/span&gt; : A constant defined as a return value for doStartTag() and doAfterBody() for tags that want to buffer the evaluation of their content&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;LifeCycle&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The doStartTag() method of a class that implements the BodyTag interface returns any one of three values: EVAL_BODY_INCLUDE or SKIP_BODY inherited from the Tag interface, or EVAL_BODY_BUFFERED, which is defined in the BodyTag interface. The actions taken by the JSP container for the return values EVAL_BODY_INCLUDE and SKIP_BODY are the same as for the IterationTag interface.&lt;br /&gt;&lt;br /&gt;However, if doStartTag() returns EVAL_BODY_BUFFERED, the JSP container takes a different course of action. It first creates an instance of the BodyContent class. The BodyContent class is a subclass of JspWriter and overrides all the print and write methods of JspWriter to buffer any data written into it rather than sending it to the output stream of the response. The JSP container passes the newly created BodyContent instance to the tag handler using its setBodyContent() method, calls doInitBody() on the tag, and finally evaluates the body of the tag, filling the BodyContent buffer with the result of the body tag evaluation.&lt;br /&gt;&lt;br /&gt;The container calls doAfterBody() after evaluating the body, writing the data directly into the output or buffering it, as the case may be. If the output was buffered, we can add, modify, or delete the contents of this buffer. Finally, this method returns EVAL_BODY_AGAIN or EVAL_BODY_BUFFERED to continue evaluating the body in a loop, or returns SKIP_BODY to terminate the loop.&lt;br /&gt;&lt;br /&gt;Finally, the container calls doEndTag(), and, as with the other interfaces, the tag handler class that is implementing the BodyTag interface can return either SKIP_PAGE or EVAL_PAGE.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8563220776994779598-2240723639336380700?l=lavnish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lavnish.blogspot.com/feeds/2240723639336380700/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8563220776994779598&amp;postID=2240723639336380700' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/2240723639336380700'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/2240723639336380700'/><link rel='alternate' type='text/html' href='http://lavnish.blogspot.com/2008/05/all-about-jsp-taghandler.html' title='All About JSP : TagHandler'/><author><name>Lavnish</name><uri>http://www.blogger.com/profile/16714741724993845980</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://lh4.google.co.uk/image/lavnishl/RdK3Rnp8q2E/AAAAAAAAAAw/g7LYCh-VN-8/s160-c/Me_ramoji.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8563220776994779598.post-1901847540220682047</id><published>2008-05-30T23:44:00.000-07:00</published><updated>2008-05-31T00:19:05.529-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='jsp'/><title type='text'>All about JSP : Custom Tags</title><content type='html'>&lt;span style="font-weight: bold;"&gt;What's Custom Tag ? and Whats Use ??&lt;/span&gt;&lt;br /&gt;Custom tags allow us to move the presentation logic outside the JSP pages into independent Java classes. One may choose to make custom tag for particular project or as an independent jar file.&lt;br /&gt;&lt;br /&gt;There are diff kinds of custom tags&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Empty Tags &lt;/li&gt;&lt;li&gt;Tags with attributes&lt;/li&gt;&lt;li&gt;Tags with JSP code&lt;/li&gt;&lt;li&gt;Tags with nested tags&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Whats TagHandler ?&lt;/span&gt;&lt;br /&gt;As name suggest its something that handles Tag and that something can only be java class. A tag handler is a Java class that implements one of the tag interfaces—Tag, IterationTag, or BodyTag—of the package javax.servlet.jsp.tagext.&lt;br /&gt;&lt;br /&gt;The JSP specification defines a tag handler as a runtime, container-managed object that evaluates custom actions during the execution of a JSP page.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Whats Tag library descriptor ?&lt;/span&gt;&lt;br /&gt;Its the way to let  JSP engine  know the tag handler classes for custom tags.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;How to inform JSP Engine about custom tag library ?&lt;/span&gt;&lt;br /&gt;TWO ways&lt;br /&gt;(1) Use the taglib directive&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt; % @ taglib &lt;span style="font-weight: bold;"&gt;prefix="test" uri="testLib.tld"&lt;/span&gt; % &gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;(2) Use jsp root&lt;br /&gt;&lt;pre&gt;&lt; jsp="http://java.sun.com/JSP/Page" test="testLib.tld" version="1.2"&gt;&lt;br /&gt;   ...JSP PAGE...&lt;br /&gt;&lt; / jsp:root&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Above examples shows URI. It can be of many type right ?&lt;/span&gt;&lt;br /&gt;Three Types&lt;br /&gt;(1) &lt;span style="font-style: italic;"&gt;Absolute URI&lt;/span&gt; :&lt;br /&gt;A URI that has a protocol, a hostname, and optionally a port number.&lt;br /&gt;http://localhost:8080/mytaglibs&lt;br /&gt;&lt;br /&gt;(2) &lt;span style="font-style: italic;"&gt;Root Relative URI&lt;/span&gt; :&lt;br /&gt;A URI that starts with a / "and" that does not have a protocol, a hostname, or a port number. It is interpreted as relative to the document root of the web application.&lt;br /&gt;/myLib&lt;br /&gt;/mytaglib/myLib&lt;br /&gt;&lt;br /&gt;(3) &lt;span style="font-style: italic;"&gt;Non-root Relative URI&lt;/span&gt; :&lt;br /&gt;does not start with a / "and" that does not have a protocol, a hostname, or a port number. It is interpreted as relative to either the current JSP page "or" the WEB-INF, depending on where it is used.&lt;br /&gt;myLib&lt;br /&gt;mytaglib/myLib&lt;br /&gt;&lt;br /&gt;&lt; % @ taglib prefix="test" uri="sampleLib.tld" % &gt;&lt;br /&gt;The JSP engine searches for the file in the same directory as the JSP page.&lt;br /&gt;Though keeping all the JSP pages and the TLD files in the same directory is the simplest way to use a taglib directive, it has two major drawbacks: security and flexibility.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;How is the URI mapped to TLD ?&lt;/span&gt;&lt;br /&gt;Through mapping ... standard reason ... achieve security &amp;amp;  flexibility by maintaining a level of redirection ... If we wanted to switch to a newer version of the library, say myLib2.tld, then we would have to manually modify all the JSP pages that are affected by this change.  The JSP container maintains a map between the URIs that we use in taglib directives and the actual physical location of the TLD files in the file system.&lt;br /&gt;With this approach, instead of using a page-relative path, we use an absolute URI path:&lt;br /&gt;&lt; % @ taglib prefix="test" uri="http://www.myserver.com/myLib" % &gt;&lt;br /&gt;When the JSP engine reads the above URI, it refers to its internal map to find the corresponding&lt;br /&gt;TLD file location.&lt;br /&gt;&lt;br /&gt;The JSP specification mandates that, when deployed in a JAR file, a TLD file be&lt;br /&gt;placed either directly under or inside a subdirectory of the META-INF directory. In&lt;br /&gt;addition, the name of the TLD file must be taglib.tld. Thus, a JAR file containing&lt;br /&gt;a packaged tag library is typically structured like this:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;myPackage/myTagHandler1.class&lt;/li&gt;&lt;li&gt;myPackage/myTagHandler2.class&lt;/li&gt;&lt;li&gt;myPackage/myTagHandler3.class&lt;/li&gt;&lt;li&gt;META-INF/taglib.tld&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-weight: bold;"&gt;How can the jsp container populate the taglib map&lt;/span&gt;&lt;br /&gt;Three ways ...&lt;br /&gt;• First, the container reads the user-defined mapping entries present in the deployment descriptor. This is called explicit mapping. We will learn how to add new entries to the deployment descriptor in the next section.&lt;br /&gt;• Then, the container reads all the taglib.tld files present in the packaged JARs. For each jarred TLD file that contains information about its own URI, the JSP container automatically creates a mapping between the specified URI and the current location of the JAR file. This is called implicit mapping. We will learn how to add the URI information to a TLD file in the next chapter, where we will create a custom tag library.&lt;br /&gt;• Finally, the JSP container adds entries for the URIs that are known to the container by default. These URIs are called well-known URIs. The &lt;jsp:root&gt; element of a JSP document contains an example of a well-known URI: http://java.sun.com/JSP/Page&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Algorithm ?&lt;/span&gt;&lt;br /&gt;• If the value of the uri attribute matches any of the &lt;taglib-uri&gt; entries, the engine uses the value of the corresponding &lt;taglib-location&gt; to locate the actual TLD file.&lt;br /&gt;      • If the &lt;taglib-location&gt; value is a root-relative URI (that is, it starts with a /), the JSP engine assumes the location to be relative to the web application’s document root directory. Thus, the location for the URI http://www.manning.com/studyKit in listing 15.1 will resolve to&lt;br /&gt;the TLD file &lt;doc-root&gt;/myLibs/studyKit.tld.&lt;br /&gt;      • If the &lt;taglib-location&gt; value is a non-root relative URI (that is, it starts without a /), the JSP engine prepends /WEB-INF/ to the URI and assumes the location to be relative to the web application’s document root directory. Thus, the location for the URI http://www.manning.com/&lt;br /&gt;sample.jar in listing 15.1 will resolve to the TLD file &lt;doc-root&gt; /WEB-INF/yourLibs/studyKit.tld.&lt;br /&gt;&lt;br /&gt;• If the value of the uri attribute of the taglib directive does not match any of the &lt;taglib-uri&gt; entries, then the following three possibilities arise:&lt;br /&gt;      • If the specified uri attribute is an absolute URI, then it is an error and is reported at translation time.&lt;br /&gt;      • If the specified uri attribute is a root-relative URI, it is assumed to be relative to the web application’s document root directory.&lt;br /&gt;      • If the specified uri attribute is a non-root-relative URI, it is assumed to be relative to the current JSP page. Thus, if the JSP file &lt;doc-root&gt;/jsp/test.jsp contains the directive &lt; % @ taglib prefix="test" uri="sample.tld" % &gt;, the engine will expect to find the sample.tld file at &lt;doc-root&gt;/jsp/sample.tld.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Ques &lt;/span&gt;Where will it look for TLD file ?&lt;br /&gt;&lt; % @ taglib uri="www.myserver.com/myLib.tld" prefix="mylib" % &gt;&lt;br /&gt;Ans&lt;br /&gt;The URI www.myserver.com/myLib.tld does not contain a protocol; therefore, it is not an absolute URI. It does not start with a /, so it is not a root-relative URI either. It is a page-relative URI. After failing to find an entry in the map, the engine will search for the file hello.tld at the location relative to the current page. Suppose the JSP page is at location&lt;br /&gt;C:\tomcat\webapps\app15\test.jsp&lt;br /&gt;The engine will look for the file at&lt;br /&gt;C:\tomcat\webapps\app\www.myserver.com\hello.tld&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Note&lt;/span&gt;&lt;br /&gt;The value of &lt;taglib-location&gt; cannot be an absolute URI. and both the &lt;taglib-uri&gt; and &lt;taglib-location&gt; are mandatory when defining absoulte way.&lt;br /&gt;&lt;br /&gt;&lt;/taglib-location&gt;&lt;/taglib-uri&gt;&lt;/taglib-location&gt;&lt;/doc-root&gt;&lt;/doc-root&gt;&lt;/taglib-uri&gt;&lt;/doc-root&gt;&lt;/taglib-location&gt;&lt;/doc-root&gt;&lt;/taglib-location&gt;&lt;/taglib-location&gt;&lt;/taglib-uri&gt;&lt;/jsp:root&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8563220776994779598-1901847540220682047?l=lavnish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lavnish.blogspot.com/feeds/1901847540220682047/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8563220776994779598&amp;postID=1901847540220682047' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/1901847540220682047'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/1901847540220682047'/><link rel='alternate' type='text/html' href='http://lavnish.blogspot.com/2008/05/all-about-jsp-custom-tags.html' title='All about JSP : Custom Tags'/><author><name>Lavnish</name><uri>http://www.blogger.com/profile/16714741724993845980</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://lh4.google.co.uk/image/lavnishl/RdK3Rnp8q2E/AAAAAAAAAAw/g7LYCh-VN-8/s160-c/Me_ramoji.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8563220776994779598.post-3980149162038501484</id><published>2008-05-30T22:05:00.001-07:00</published><updated>2008-05-30T23:26:30.318-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='collections'/><title type='text'>google collections library</title><content type='html'>Link is more than enough :)&lt;br /&gt;&lt;a href="http://code.google.com/p/google-collections/"&gt;http://code.google.com/p/google-collections/&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8563220776994779598-3980149162038501484?l=lavnish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lavnish.blogspot.com/feeds/3980149162038501484/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8563220776994779598&amp;postID=3980149162038501484' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/3980149162038501484'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/3980149162038501484'/><link rel='alternate' type='text/html' href='http://lavnish.blogspot.com/2008/05/google-collections-library.html' title='google collections library'/><author><name>Lavnish</name><uri>http://www.blogger.com/profile/16714741724993845980</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://lh4.google.co.uk/image/lavnishl/RdK3Rnp8q2E/AAAAAAAAAAw/g7LYCh-VN-8/s160-c/Me_ramoji.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8563220776994779598.post-396146774854142261</id><published>2008-05-28T07:07:00.000-07:00</published><updated>2008-05-28T07:21:38.201-07:00</updated><title type='text'>Java Tricky Question - 6</title><content type='html'>whats the difference between&lt;br /&gt;&lt;pre&gt;&lt;br /&gt; &lt; servlet-mapping &gt;&lt;br /&gt;     &lt; servlet-name &gt;ServletOne&lt; / servlet-name &gt;&lt;br /&gt;     &lt; url-pattern &gt;/mywebsite/myservlet&lt; / url-pattern &gt;&lt;br /&gt; &lt; / servlet-mapping &gt;&lt;br /&gt;&lt;/pre&gt;&lt;pre&gt;&lt;br /&gt;  &lt; servlet-mapping &gt;&lt;br /&gt;     &lt; servlet-name &gt;ServletTwo&lt; / servlet-name &gt;&lt;br /&gt;     &lt; url-pattern &gt;/mywebsite/myservlet/&lt; / url-pattern &gt;&lt;br /&gt; &lt; / servlet-mapping &gt;   &lt;/pre&gt;&lt;pre&gt;&lt;br /&gt;  &lt; servlet-mapping &gt;&lt;br /&gt;     &lt; servlet-name &gt;ServletThree&lt; / servlet-name &gt;&lt;br /&gt;     &lt; url-pattern &gt;/mywebsite/myservlet/*&lt; / url-pattern &gt;&lt;br /&gt; &lt; / servlet-mapping &gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(255, 0, 0);"&gt;Dont ask me the answer ,,,, rather help me finding one ... ;o)&lt;/span&gt;&lt;br /&gt;this one is still under discussion ... at &lt;a href="http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;amp;f=7&amp;amp;t=021009&amp;amp;p=1"&gt;java ranch&lt;/a&gt;&lt;a href="http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;amp;f=7&amp;amp;t=021009&amp;amp;p=1"&gt;&lt;br /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8563220776994779598-396146774854142261?l=lavnish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lavnish.blogspot.com/feeds/396146774854142261/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8563220776994779598&amp;postID=396146774854142261' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/396146774854142261'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/396146774854142261'/><link rel='alternate' type='text/html' href='http://lavnish.blogspot.com/2008/05/java-tricky-question-6.html' title='Java Tricky Question - 6'/><author><name>Lavnish</name><uri>http://www.blogger.com/profile/16714741724993845980</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://lh4.google.co.uk/image/lavnishl/RdK3Rnp8q2E/AAAAAAAAAAw/g7LYCh-VN-8/s160-c/Me_ramoji.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8563220776994779598.post-4204100357325527819</id><published>2008-05-28T06:47:00.001-07:00</published><updated>2008-05-28T06:59:48.076-07:00</updated><title type='text'>Java Tricky Question - 5</title><content type='html'>&lt;span style="font-weight:bold;"&gt;Q: How can you associate an array of values for an initialization parameter of a servlet?&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;A: You can’t; at least not directly! The deployment descriptor does not&lt;br /&gt;allow you to specify multiple parameters with the same name. So you&lt;br /&gt;have to do something like this:&lt;br /&gt;&lt; init-param &gt;&lt;br /&gt;&lt; param-name &gt; param1 &lt; / param-name &gt;&lt;br /&gt;&lt; param-value &gt; val1 , val2 , val3 , val4 &lt; / param-value &gt;&lt;br /&gt;&lt; init-param &gt;&lt;br /&gt;You would then have to parse the param-value string in the servlet&lt;br /&gt;and interpret the multiple values listed in the string.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8563220776994779598-4204100357325527819?l=lavnish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lavnish.blogspot.com/feeds/4204100357325527819/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8563220776994779598&amp;postID=4204100357325527819' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/4204100357325527819'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/4204100357325527819'/><link rel='alternate' type='text/html' href='http://lavnish.blogspot.com/2008/05/java-tricky-question-5.html' title='Java Tricky Question - 5'/><author><name>Lavnish</name><uri>http://www.blogger.com/profile/16714741724993845980</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://lh4.google.co.uk/image/lavnishl/RdK3Rnp8q2E/AAAAAAAAAAw/g7LYCh-VN-8/s160-c/Me_ramoji.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8563220776994779598.post-1529736718143232805</id><published>2008-05-28T06:46:00.001-07:00</published><updated>2008-05-28T07:00:33.407-07:00</updated><title type='text'>Java Tricky Question - 4</title><content type='html'>&lt;span style="font-weight:bold;"&gt;Q : Your web application includes an applet packaged as a JAR file. Which directory would you keep the JAR file in?&lt;/span&gt;&lt;br /&gt;A:&lt;br /&gt;Because an applet is only run on the client side, the applet JAR file&lt;br /&gt;should be accessible to the clients. This means that it may be kept anywhere&lt;br /&gt;in the document root of the application except in the WEB-INF&lt;br /&gt;directory and its subdirectories. &lt;br /&gt;( As the contents inside the WEB-INF is not visible to client )&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8563220776994779598-1529736718143232805?l=lavnish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lavnish.blogspot.com/feeds/1529736718143232805/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8563220776994779598&amp;postID=1529736718143232805' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/1529736718143232805'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/1529736718143232805'/><link rel='alternate' type='text/html' href='http://lavnish.blogspot.com/2008/05/java-tricky-question-4.html' title='Java Tricky Question - 4'/><author><name>Lavnish</name><uri>http://www.blogger.com/profile/16714741724993845980</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://lh4.google.co.uk/image/lavnishl/RdK3Rnp8q2E/AAAAAAAAAAw/g7LYCh-VN-8/s160-c/Me_ramoji.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8563220776994779598.post-8369357305552179211</id><published>2008-05-28T05:32:00.001-07:00</published><updated>2008-05-28T05:34:27.282-07:00</updated><title type='text'>Java Tricky Question - 3</title><content type='html'>&lt;span style="font-weight:bold;"&gt;Both the interfaces ServletContext and ServletRequest have method getRequestDispatcher() .. whats the difference between them ??&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;Ans :&lt;/span&gt;&lt;br /&gt;You can pass a relative path to the getRequestDispatcher() method of ServletRequest but not to the getRequestDispatcher() method of ServletContext. For example, request.getRequestDispatcher("../html/somePage.html") is valid, and the getRequestDispatcher() method of ServletRequest will evaluate the path relative to the path of the request. For the getRequestDispatcher() method of ServletContext, the path parameter cannot be relative and must start with /. This makes sense because ServletRequest has a current request path to evaluate the relative path while ServletContext does not.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8563220776994779598-8369357305552179211?l=lavnish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lavnish.blogspot.com/feeds/8369357305552179211/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8563220776994779598&amp;postID=8369357305552179211' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/8369357305552179211'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/8369357305552179211'/><link rel='alternate' type='text/html' href='http://lavnish.blogspot.com/2008/05/java-tricky-question-3.html' title='Java Tricky Question - 3'/><author><name>Lavnish</name><uri>http://www.blogger.com/profile/16714741724993845980</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://lh4.google.co.uk/image/lavnishl/RdK3Rnp8q2E/AAAAAAAAAAw/g7LYCh-VN-8/s160-c/Me_ramoji.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8563220776994779598.post-646967704194698075</id><published>2008-05-28T04:40:00.000-07:00</published><updated>2008-05-28T05:06:29.549-07:00</updated><title type='text'>Java Tricky Questions - 2</title><content type='html'>&lt;span style="font-weight:bold;"&gt;How can you create multiple servlet objects of the same servlet class if You are not allowed to implements the SingleThreadModel interface ??&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Ans :&lt;/span&gt;&lt;br /&gt;More than one &lt;servlet&gt; element is defined in the web.xml file having the same servlet class names. &lt;br /&gt;&lt;span style="font-style:italic;"&gt;( some of you may say the ans is stupid ... I mean ques is more literal than technical ... but hey it can be a twister for many )&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Practical Use :&lt;/span&gt;&lt;br /&gt;You can do this if you want to have multiple sets of initialization parameters. For example, you may want one instance to connect to one database and a second instance to connect to another database.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8563220776994779598-646967704194698075?l=lavnish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lavnish.blogspot.com/feeds/646967704194698075/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8563220776994779598&amp;postID=646967704194698075' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/646967704194698075'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/646967704194698075'/><link rel='alternate' type='text/html' href='http://lavnish.blogspot.com/2008/05/java-tricky-questions-2.html' title='Java Tricky Questions - 2'/><author><name>Lavnish</name><uri>http://www.blogger.com/profile/16714741724993845980</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://lh4.google.co.uk/image/lavnishl/RdK3Rnp8q2E/AAAAAAAAAAw/g7LYCh-VN-8/s160-c/Me_ramoji.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8563220776994779598.post-1722072362197192827</id><published>2008-05-27T23:17:00.000-07:00</published><updated>2008-05-27T23:20:19.349-07:00</updated><title type='text'>Good Flex sites</title><content type='html'>the site  &lt;a href="http://www.flowww.com/"&gt;http://www.flowww.com/&lt;/a&gt; &lt;br /&gt;&lt;br /&gt;and This "Book tool" is simply superb...  &lt;a href="http://www.rubenswieringa.com/code/as3/flex/Book/"&gt;http://www.rubenswieringa.com/code/as3/flex/Book/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;I wonder if Java ? ADF ? or JavaFX can make such tools .. sites &lt;br /&gt;If yes how easy / tough would it be .... no idea ... !!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8563220776994779598-1722072362197192827?l=lavnish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lavnish.blogspot.com/feeds/1722072362197192827/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8563220776994779598&amp;postID=1722072362197192827' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/1722072362197192827'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/1722072362197192827'/><link rel='alternate' type='text/html' href='http://lavnish.blogspot.com/2008/05/good-flex-sites.html' title='Good Flex sites'/><author><name>Lavnish</name><uri>http://www.blogger.com/profile/16714741724993845980</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://lh4.google.co.uk/image/lavnishl/RdK3Rnp8q2E/AAAAAAAAAAw/g7LYCh-VN-8/s160-c/Me_ramoji.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8563220776994779598.post-7616526114425960243</id><published>2008-05-27T22:22:00.000-07:00</published><updated>2008-05-28T01:15:23.866-07:00</updated><title type='text'>Java Tricky Questions - 1</title><content type='html'>Whats the difference between&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;int length = 5;&lt;br /&gt;int breadth = 10;&lt;br /&gt;int area = length * breadth;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;and&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;final int length = 5;&lt;br /&gt;final int breadth = 10;&lt;br /&gt;int area = length * breadth;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;dont scroll down until you have thought over the answer&lt;br /&gt;.&lt;br /&gt;.&lt;br /&gt;.&lt;br /&gt;.&lt;br /&gt;.&lt;br /&gt;.&lt;br /&gt;.&lt;br /&gt;.&lt;br /&gt;.&lt;br /&gt;.&lt;br /&gt;.&lt;br /&gt;.&lt;br /&gt;.&lt;br /&gt;.&lt;br /&gt;.&lt;br /&gt;.&lt;br /&gt;.&lt;br /&gt;.&lt;br /&gt;.&lt;br /&gt;.&lt;br /&gt;.&lt;br /&gt;gave it a thought ?&lt;br /&gt;.&lt;br /&gt;.&lt;br /&gt;.&lt;br /&gt;.&lt;br /&gt;.&lt;br /&gt;.&lt;br /&gt;.&lt;br /&gt;&lt;br /&gt;.&lt;br /&gt;.&lt;br /&gt;.&lt;br /&gt;.&lt;br /&gt;.&lt;br /&gt;.&lt;br /&gt;.&lt;br /&gt;.&lt;br /&gt;.&lt;br /&gt;.&lt;br /&gt;.&lt;br /&gt;.&lt;br /&gt;.&lt;br /&gt;.&lt;br /&gt;.&lt;br /&gt;.&lt;br /&gt;sure ?&lt;br /&gt;.&lt;br /&gt;.&lt;br /&gt;.&lt;br /&gt;.&lt;br /&gt;.&lt;br /&gt;.&lt;br /&gt;.&lt;br /&gt;.&lt;br /&gt;.&lt;br /&gt;.&lt;br /&gt;.&lt;br /&gt;Ok then heres the &lt;span style="font-weight: bold; font-style: italic;"&gt;answer&lt;/span&gt;...&lt;br /&gt;In the &lt;span style="font-style: italic;"&gt;second &lt;/span&gt;code snippet multiplication is done at compile time.&lt;br /&gt;In &lt;span style="font-style: italic;"&gt;first&lt;/span&gt; multiplication is done at Runtime.&lt;br /&gt;&lt;span style="font-style: italic; font-weight: bold;"&gt;Reason&lt;/span&gt;&lt;br /&gt;Java compiler uses something known as Constant Folding. Constant folding refers to the compiler precalculating constant expressions.&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Query&lt;/span&gt;&lt;br /&gt;I wonder what will happen if the code is &lt;br /&gt;&lt;pre&gt;&lt;br /&gt;int length = 5;&lt;br /&gt;final int breadth = 10;&lt;br /&gt;int area = length * breadth;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;The above code will not use constant folding for length but do so for breadth.&lt;br /&gt;What if ?&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;static final int breadth = 10;&lt;br /&gt;int area = 5 * breadth;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;then compiler will use constant folding for breadth.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8563220776994779598-7616526114425960243?l=lavnish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lavnish.blogspot.com/feeds/7616526114425960243/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8563220776994779598&amp;postID=7616526114425960243' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/7616526114425960243'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/7616526114425960243'/><link rel='alternate' type='text/html' href='http://lavnish.blogspot.com/2008/05/java-tricky-questions-1.html' title='Java Tricky Questions - 1'/><author><name>Lavnish</name><uri>http://www.blogger.com/profile/16714741724993845980</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://lh4.google.co.uk/image/lavnishl/RdK3Rnp8q2E/AAAAAAAAAAw/g7LYCh-VN-8/s160-c/Me_ramoji.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8563220776994779598.post-492014281969907107</id><published>2008-05-26T22:06:00.000-07:00</published><updated>2008-05-26T22:07:10.271-07:00</updated><title type='text'>HashMap : Not thread safe structure</title><content type='html'>Nice Read&lt;br /&gt;&lt;a href="http://pveentjer.wordpress.com/2008/05/26/hashmap-is-not-a-thread-safe-structure/"&gt;http://pveentjer.wordpress.com/2008/05/26/hashmap-is-not-a-thread-safe-structure/&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8563220776994779598-492014281969907107?l=lavnish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lavnish.blogspot.com/feeds/492014281969907107/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8563220776994779598&amp;postID=492014281969907107' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/492014281969907107'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/492014281969907107'/><link rel='alternate' type='text/html' href='http://lavnish.blogspot.com/2008/05/hashmap-not-thread-safe-structure.html' title='HashMap : Not thread safe structure'/><author><name>Lavnish</name><uri>http://www.blogger.com/profile/16714741724993845980</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://lh4.google.co.uk/image/lavnishl/RdK3Rnp8q2E/AAAAAAAAAAw/g7LYCh-VN-8/s160-c/Me_ramoji.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8563220776994779598.post-3601461945852691845</id><published>2008-05-26T04:28:00.001-07:00</published><updated>2008-05-26T04:28:49.028-07:00</updated><title type='text'>Java Tricky questions</title><content type='html'>Found this link&lt;br /&gt;bad part is answers are not explained&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.mydeveloperconnection.com/html/JavaTrap.htm"&gt;http://www.mydeveloperconnection.com/html/JavaTrap.htm&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8563220776994779598-3601461945852691845?l=lavnish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lavnish.blogspot.com/feeds/3601461945852691845/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8563220776994779598&amp;postID=3601461945852691845' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/3601461945852691845'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/3601461945852691845'/><link rel='alternate' type='text/html' href='http://lavnish.blogspot.com/2008/05/java-tricky-questions.html' title='Java Tricky questions'/><author><name>Lavnish</name><uri>http://www.blogger.com/profile/16714741724993845980</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://lh4.google.co.uk/image/lavnishl/RdK3Rnp8q2E/AAAAAAAAAAw/g7LYCh-VN-8/s160-c/Me_ramoji.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8563220776994779598.post-5289350844216794788</id><published>2008-05-26T01:19:00.000-07:00</published><updated>2008-05-26T01:21:21.655-07:00</updated><title type='text'>All About Java Exceptions</title><content type='html'>Common Java wisdom gives us a few general principles about how to work with exceptions:&lt;br /&gt;&lt;br /&gt;    1. Don’t use exceptions for flow control and expected business situations, but only for exceptional situations&lt;br /&gt;    2. Use unchecked exceptions for programming errors, bugs, situations where the application or the current operation cannot expect to recover from.&lt;br /&gt;    3. Use checked exceptions for situations where the caller is expected to be able to make a full or partial recovery after the failure&lt;br /&gt;&lt;br /&gt;If we keep the function return type as&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;public boolean doSomeWork()&lt;br /&gt;{&lt;br /&gt;if(success)&lt;br /&gt;    return true;&lt;br /&gt;else&lt;br /&gt;    return false;&lt;br /&gt;...&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;two probs&lt;br /&gt;1) Caller will have to check the return value : if he doesnt he may continue with wrong assumption&lt;br /&gt;2) The caller doesn’t have enough information to see what went wrong&lt;br /&gt;&lt;br /&gt;With this kind of solution we are back to the way C programs were written... but remember this is java&lt;br /&gt;&lt;br /&gt;Another way is...&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;public class SomeException extends RuntimeException&lt;br /&gt;{&lt;br /&gt;   ...&lt;br /&gt;}&lt;br /&gt;public boolean doSomeWork()&lt;br /&gt;{&lt;br /&gt;if(success)&lt;br /&gt;    return true;&lt;br /&gt;else&lt;br /&gt;    throw new SomeException();&lt;br /&gt;...&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;You may have to do some documentation for the new exception class. Which is a disadvantage if you are LAZY ;).&lt;br /&gt;Else the advantages are&lt;br /&gt;   * If the client code fails to treat the exception at least the program doesn’t continue on a wrong path.&lt;br /&gt;   * We can send more information about the failure context in the exception class through the exception type and the exception instance content.&lt;br /&gt;Disadvantages&lt;br /&gt;   * The client code programmer is not automatically warned to treat the exception&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;One more way is ...&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;public class SomeException extends Exception&lt;br /&gt;{&lt;br /&gt;   ...&lt;br /&gt;}&lt;br /&gt;public boolean doSomeWork() throws SomeException&lt;br /&gt;{&lt;br /&gt;if(success)&lt;br /&gt;    return true;&lt;br /&gt;else&lt;br /&gt;    throw new SomeException();&lt;br /&gt;...&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Client code will use try / catch block&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;How can you catch multiple exceptions in java ??&lt;/span&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;Statement stmt = null;&lt;br /&gt;try {&lt;br /&gt; // do stuff that uses Statement instance&lt;br /&gt;} catch (SQLException e) {&lt;br /&gt;// handle state&lt;br /&gt;log.error("Bad database", e);&lt;br /&gt;} catch (NullPointerException e) {&lt;br /&gt;// handle state&lt;br /&gt;log.error("Bad parameter", e);&lt;br /&gt;} catch (Exception e) {&lt;br /&gt;// handle state&lt;br /&gt;log.error("Bad luck", e);&lt;br /&gt;} finally {&lt;br /&gt;try {&lt;br /&gt;  stmt.close();&lt;br /&gt;} catch (Exception ex) {}&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Summary&lt;/span&gt;&lt;br /&gt;Rule of thumb: Use Checked Exceptions for recoverable conditions and Runtime Exceptions for programming errors.&lt;br /&gt;Checked exceptions are great in theory, but in practice lots of developers use them poorly and then the rest of us are left to clean up their mess.&lt;br /&gt;checked exceptions are domain exceptions.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Links&lt;/span&gt;&lt;br /&gt;&lt;a href="http://truecode.blogspot.com/2008/01/bypassing-java-checked-exception.html"&gt;http://truecode.blogspot.com/2008/01/bypassing-java-checked-exception.html&lt;/a&gt;&lt;br /&gt;&lt;a href="http://dev2dev.bea.com/pub/a/2006/11/effective-exceptions.html"&gt;http://dev2dev.bea.com/pub/a/2006/11/effective-exceptions.html&lt;/a&gt;&lt;br /&gt;&lt;a href="http://dev2dev.bea.com/pub/a/2007/06/exception-advice.html"&gt;http://dev2dev.bea.com/pub/a/2007/06/exception-advice.html&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.csd.uoc.gr/%7Eandreou/"&gt;http://www.csd.uoc.gr/~andreou/&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8563220776994779598-5289350844216794788?l=lavnish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lavnish.blogspot.com/feeds/5289350844216794788/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8563220776994779598&amp;postID=5289350844216794788' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/5289350844216794788'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/5289350844216794788'/><link rel='alternate' type='text/html' href='http://lavnish.blogspot.com/2008/05/all-about-java-exceptions.html' title='All About Java Exceptions'/><author><name>Lavnish</name><uri>http://www.blogger.com/profile/16714741724993845980</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://lh4.google.co.uk/image/lavnishl/RdK3Rnp8q2E/AAAAAAAAAAw/g7LYCh-VN-8/s160-c/Me_ramoji.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8563220776994779598.post-1535253171969949529</id><published>2008-05-22T05:06:00.001-07:00</published><updated>2008-05-22T05:06:37.896-07:00</updated><title type='text'>JSF FAQs</title><content type='html'>JSF is MVC2 ?&lt;br /&gt;As per my knowledge There is no MVC1 and MVC2&lt;br /&gt;there is JSP model 1 and model 2 as explained in the article&lt;br /&gt;http://www.javaworld.com/javaworld/jw-12-1999/jw-12-ssj-jspmvc.html&lt;br /&gt;JSF is in the scope of model 2&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Other frameworks like JSF ?&lt;br /&gt;Apple's WebObjects is a similar architecture to JSF and so is ASP.net. &lt;br /&gt;&lt;br /&gt;Difference betwwen managed beans and backing beans ??&lt;br /&gt;&lt;br /&gt;f:facet ??&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Advantages&lt;br /&gt;JSF's fine-tuned event model allows your applications to be less tied to HTTP details and simplifies your development effort.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;http://forum.java.sun.com/thread.jspa?threadID=674446&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8563220776994779598-1535253171969949529?l=lavnish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lavnish.blogspot.com/feeds/1535253171969949529/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8563220776994779598&amp;postID=1535253171969949529' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/1535253171969949529'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/1535253171969949529'/><link rel='alternate' type='text/html' href='http://lavnish.blogspot.com/2008/05/jsf-faqs.html' title='JSF FAQs'/><author><name>Lavnish</name><uri>http://www.blogger.com/profile/16714741724993845980</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://lh4.google.co.uk/image/lavnishl/RdK3Rnp8q2E/AAAAAAAAAAw/g7LYCh-VN-8/s160-c/Me_ramoji.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8563220776994779598.post-1213924996581797622</id><published>2008-05-20T05:32:00.000-07:00</published><updated>2008-05-20T05:49:35.261-07:00</updated><title type='text'>Servlets Basics</title><content type='html'>javax.servlet.http.HttpServlet Is an abstract class that extends the javax.servlet.GenericServlet class.&lt;br /&gt;All the methods in it have protected identifier and the service method is overloaded&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;protected  void service(HttpServletRequest req, HttpServletResponse resp)&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Receives standard HTTP requests from the public service method and dispatches them to the doXXX methods defined in this class.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt; void service(ServletRequest req, ServletResponse res)&lt;/pre&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;Dispatches client requests to the protected service method&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;Clicking on a hyperlink always sends a GET request and thus, the doGet() method of the servlet will be called. &lt; href = " /servlet/TestServlet " method="POST"&gt; Some URL &lt; / a &gt;&lt;br /&gt;The method="POST" attribute-value pair does not make sense in the anchor tag.&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Retrieve Request Parameter&lt;/span&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;String[ ] getParameterValues(String paramName)&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;The above method is for html element like dropbox etc&lt;br /&gt;&lt;pre&gt; Enumeration getParameterNames() &lt;/pre&gt;&lt;br /&gt;This method is useful when you don’t know the names of the parameters. You can iterate through the Enumeration of Strings returned by this method and for each element you can call getParameter() or getParameterValues().&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Retrieve request headers&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;There is one difference&lt;/span&gt; , though; unlike parameters, headers are specific to the HTTP protocol and so the methods that deal with the headers belong to HttpServletRequest and not to ServletRequest.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt; String getHeader(String headerName) &lt;/pre&gt;&lt;br /&gt;This method returns just one of the values associated with the given header.&lt;br /&gt;&lt;pre&gt; Enumeration getHeaderValues(String headerName)&lt;/pre&gt;&lt;br /&gt;This method returns all the values associated with the header as an Enumeration of String object. &lt;br /&gt;&lt;pre&gt; Enumeration getHeaderNames() &lt;/pre&gt;&lt;br /&gt;This method is useful when you don’t know the names of the headers. You can iterate through the enumeration returned by this method, and for each element you can call getHeader() or getHeaderValues().&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;Which method would you use to retrieve the number of parameters present in a request?&lt;/span&gt;&lt;br /&gt;Neither ServletRequest nor HttpServletRequest provides any method to retrieve the number of parameters directly. You’ll have to use ServletRequest.getParameterNames(), which returns an Enumeration, and count the number of parameters yourself.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8563220776994779598-1213924996581797622?l=lavnish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lavnish.blogspot.com/feeds/1213924996581797622/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8563220776994779598&amp;postID=1213924996581797622' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/1213924996581797622'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/1213924996581797622'/><link rel='alternate' type='text/html' href='http://lavnish.blogspot.com/2008/05/servlets-basics.html' title='Servlets Basics'/><author><name>Lavnish</name><uri>http://www.blogger.com/profile/16714741724993845980</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://lh4.google.co.uk/image/lavnishl/RdK3Rnp8q2E/AAAAAAAAAAw/g7LYCh-VN-8/s160-c/Me_ramoji.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8563220776994779598.post-1429680768971515437</id><published>2008-05-20T05:17:00.000-07:00</published><updated>2008-05-20T05:30:47.840-07:00</updated><title type='text'>GET vs POST</title><content type='html'>&lt;table cellspacing="2" cellpadding="3" border="1" width="100%"&gt;&lt;br /&gt;    &lt;tr&gt;&lt;br /&gt;      &lt;th&gt;&lt;br /&gt;        FEATURE&lt;br /&gt;      &lt;/th&gt;&lt;br /&gt;      &lt;th&gt;&lt;br /&gt;        GET method&lt;br /&gt;      &lt;/th&gt;&lt;br /&gt;      &lt;th&gt;&lt;br /&gt;        POST method&lt;br /&gt;      &lt;/th&gt;&lt;br /&gt;    &lt;/tr&gt;&lt;br /&gt;    &lt;tr&gt;&lt;br /&gt;      &lt;th&gt;&lt;br /&gt;        Type of data&lt;br /&gt;      &lt;/th&gt;&lt;br /&gt;      &lt;td width="33%"&gt;text&lt;/td&gt;&lt;br /&gt;      &lt;td width="34%"&gt;text &amp;amp; binary&lt;/td&gt;&lt;br /&gt;    &lt;/tr&gt;&lt;br /&gt;    &lt;tr&gt;&lt;br /&gt;      &lt;th&gt;&lt;br /&gt;        Amount of data&lt;br /&gt;      &lt;/th&gt;&lt;br /&gt;      &lt;td width="33%"&gt;Browser dependent gen is 255&lt;/td&gt;&lt;br /&gt;      &lt;td width="34%"&gt;unlimited&lt;/td&gt;&lt;br /&gt;    &lt;/tr&gt;&lt;br /&gt;    &lt;tr&gt;&lt;br /&gt;      &lt;th&gt;&lt;br /&gt;        Visibility&lt;br /&gt;      &lt;/th&gt;&lt;br /&gt;      &lt;td width="33%"&gt;data is part of URL&lt;/td&gt;&lt;br /&gt;      &lt;td width="34%"&gt;Part of body not URL&lt;/td&gt;&lt;br /&gt;    &lt;/tr&gt;&lt;br /&gt;    &lt;tr&gt;&lt;br /&gt;      &lt;th&gt;&lt;br /&gt;        Caching&lt;br /&gt;      &lt;/th&gt;&lt;br /&gt;      &lt;td width="33%"&gt;can be cached&lt;/td&gt;&lt;br /&gt;      &lt;td width="34%"&gt;cant be&lt;/td&gt;&lt;br /&gt;    &lt;/tr&gt;&lt;br /&gt;    &lt;tr&gt;&lt;br /&gt;      &lt;th&gt;&lt;br /&gt;        Bookmarkable&lt;br /&gt;      &lt;/th&gt;&lt;br /&gt;      &lt;td width="33%"&gt;Can bookmark&lt;/td&gt;&lt;br /&gt;      &lt;td width="34%"&gt;Cant bookmark&lt;/td&gt;&lt;br /&gt;    &lt;/tr&gt;&lt;br /&gt;    &lt;tr&gt;&lt;br /&gt;      &lt;th&gt;&lt;br /&gt;        Spl Case&lt;br /&gt;      &lt;/th&gt;&lt;br /&gt;      &lt;td width="33%"&gt;Cant be used in case data is character set other than ASCII&lt;/td&gt;&lt;br /&gt;      &lt;td width="34%"&gt;Can use any type of character set&lt;/td&gt;&lt;br /&gt;    &lt;/tr&gt;&lt;br /&gt;    &lt;tr&gt;&lt;br /&gt;      &lt;th&gt;&lt;br /&gt;        Use Case&lt;br /&gt;      &lt;/th&gt;&lt;br /&gt;      &lt;td width="33%"&gt;used when the form processing is "idempotent"&lt;/td&gt;&lt;br /&gt;      &lt;td width="34%"&gt;used in all other cases&lt;/td&gt;&lt;br /&gt;    &lt;/tr&gt;&lt;br /&gt;    &lt;tr&gt;&lt;br /&gt;      &lt;th&gt;&lt;br /&gt;        Default&lt;br /&gt;      &lt;/th&gt;&lt;br /&gt;      &lt;td width="33%"&gt;Its default for HTML FORM element&lt;/td&gt;&lt;br /&gt;      &lt;td width="34%"&gt;Its not .. need to use method attribute&lt;/td&gt;&lt;br /&gt;    &lt;/tr&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;  &lt;/table&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8563220776994779598-1429680768971515437?l=lavnish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lavnish.blogspot.com/feeds/1429680768971515437/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8563220776994779598&amp;postID=1429680768971515437' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/1429680768971515437'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/1429680768971515437'/><link rel='alternate' type='text/html' href='http://lavnish.blogspot.com/2008/05/get-vs-post.html' title='GET vs POST'/><author><name>Lavnish</name><uri>http://www.blogger.com/profile/16714741724993845980</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://lh4.google.co.uk/image/lavnishl/RdK3Rnp8q2E/AAAAAAAAAAw/g7LYCh-VN-8/s160-c/Me_ramoji.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8563220776994779598.post-601938394648167329</id><published>2008-05-19T05:58:00.000-07:00</published><updated>2008-05-19T06:30:18.771-07:00</updated><title type='text'>HashMap : Basics</title><content type='html'>&lt;pre&gt;&lt;br /&gt;package datastructure.delme;&lt;br /&gt;import java.util.*;&lt;br /&gt;&lt;br /&gt;class SimpleClass {&lt;br /&gt;   private String desc;&lt;br /&gt;   public SimpleClass(String s) {&lt;br /&gt;       desc=s;&lt;br /&gt;   }&lt;br /&gt;   public String getDesc() {&lt;br /&gt;       return desc;&lt;br /&gt;   }&lt;br /&gt;   @Override&lt;br /&gt;   public String toString() {&lt;br /&gt;       return "description is "+desc;&lt;br /&gt;   }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public class DelMeCollection {&lt;br /&gt;   public static void main(String[] args) {&lt;br /&gt;       System.out.println("in main");&lt;br /&gt;       SimpleClass s1 = new SimpleClass("one");&lt;br /&gt;       SimpleClass s2 = new SimpleClass("two");&lt;br /&gt;       SimpleClass s3 = new SimpleClass("three");&lt;br /&gt;       SimpleClass s4 = new SimpleClass("four");&lt;br /&gt;     &lt;br /&gt;       HashMap &lt;string,simpleclass&gt; hm = new HashMap&lt;string,simpleclass&gt;();&lt;br /&gt;       hm.put("1",s1);&lt;br /&gt;       hm.put("2",s2);&lt;br /&gt;       hm.put("3",s3);&lt;br /&gt;       hm.put("4",s4);&lt;br /&gt;       Iterator hmKeyItr = hm.keySet().iterator();&lt;br /&gt;       while(hmKeyItr.hasNext())&lt;br /&gt;       {&lt;br /&gt;           String tempKey= (String)hmKeyItr.next();&lt;br /&gt;           System.out.println(tempKey+" val is "+hm.get(tempKey));&lt;br /&gt;       }&lt;br /&gt;&lt;br /&gt;       Iterator hmValItr = hm.values().iterator();&lt;br /&gt;       while(hmValItr.hasNext())&lt;br /&gt;       {&lt;br /&gt;           SimpleClass tempVal = (SimpleClass)hmValItr.next();&lt;br /&gt;           System.out.println(" val is "+tempVal);&lt;br /&gt;       }&lt;br /&gt;     &lt;br /&gt;       for (Map.Entry&lt;string,&gt; entry: hm.entrySet())&lt;br /&gt;       {&lt;br /&gt;           System.out.println(entry.getKey() + " -&gt; " + entry.getValue());&lt;br /&gt;       }      &lt;br /&gt;&lt;br /&gt;     &lt;br /&gt;   }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/string,&gt;&lt;/string,simpleclass&gt;&lt;/string,simpleclass&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;also tried UPCASTING&lt;br /&gt;the following gave error&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;HashMap &lt; string , object &gt; hm = new HashMap &lt; string , simpleclass &gt;();&lt;br /&gt;HashMap &lt; string , simpleclass &gt; hm = new HashMap &lt; string , object &gt;();&lt;br /&gt;HashMap &lt; string , simpleclass &gt; hm = new HashMap &lt; object , sipleclass &gt;();&lt;br /&gt;HashMap &lt; object , simpleclass &gt; hm = new HashMap&lt; string , simpleclass &gt;();&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Moreover java.util.HashMap&lt;br /&gt;&lt;br /&gt;Note that this implementation is not synchronized. If multiple threads access this map concurrently, and at least one of the threads modifies the map structurally, it must be synchronized externally. (A structural modification is any operation that adds or deletes one or more mappings; merely changing the value associated with a key that an instance already contains is not a structural modification.) This is typically accomplished by synchronizing on some object that naturally encapsulates the map. If no such object exists, the map should be "wrapped" using the Collections.synchronizedMap method. This is best done at creation time, to prevent accidental unsynchronized access to the map:&lt;br /&gt;&lt;br /&gt;Map m = Collections.synchronizedMap(new HashMap(...));&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8563220776994779598-601938394648167329?l=lavnish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lavnish.blogspot.com/feeds/601938394648167329/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8563220776994779598&amp;postID=601938394648167329' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/601938394648167329'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/601938394648167329'/><link rel='alternate' type='text/html' href='http://lavnish.blogspot.com/2008/05/hashmap-basics.html' title='HashMap : Basics'/><author><name>Lavnish</name><uri>http://www.blogger.com/profile/16714741724993845980</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://lh4.google.co.uk/image/lavnishl/RdK3Rnp8q2E/AAAAAAAAAAw/g7LYCh-VN-8/s160-c/Me_ramoji.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8563220776994779598.post-6861016546299946034</id><published>2008-05-16T05:13:00.000-07:00</published><updated>2008-05-26T01:34:32.234-07:00</updated><title type='text'>Clear the Screen In Java 5</title><content type='html'>Ask your friend to write a simple command line utility in java that gives a set of options like ...&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;      1. Press 1 to add element to LinkedList&lt;br /&gt;      2. Press 2 to Delete an element in LinkedList&lt;br /&gt;      3. Press 3 to traverse the LinkedList&lt;br /&gt;      4. Press 4 to exit&lt;br /&gt;&lt;br /&gt;     Enter Your Choice : _&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;When user choses one of the above mentioned options ,&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;First &lt;/span&gt;, the screen should be cleared off&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Second &lt;/span&gt;, the corresponding details (if any) should be asked ( like eneter value to add / delete )&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Third &lt;/span&gt;, perform the action&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Fourth &lt;/span&gt;, ReDisplay the above menu&lt;br /&gt;&lt;br /&gt;To complete the above program you need to write a method like...&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;public void clearTheScreen( ) {&lt;br /&gt;....&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;or may be&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;public boolean clearTheScreen( ) {&lt;br /&gt;....&lt;br /&gt;// return true if screen deleted else false&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;How to complete this method ??&lt;br /&gt;&lt;br /&gt;hhhmmmm lets "&lt;span style="color: rgb(255, 0, 0);"&gt;B&lt;/span&gt;&lt;span style="color: rgb(51, 204, 0);"&gt;R&lt;/span&gt;&lt;span style="color: rgb(51, 102, 255);"&gt;A&lt;/span&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;I&lt;/span&gt;N &lt;span style="color: rgb(51, 204, 0);"&gt;S&lt;/span&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;T&lt;/span&gt;O&lt;span style="color: rgb(51, 102, 255);"&gt;R&lt;/span&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;M&lt;/span&gt;"&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;"first"&lt;/span&gt; reply may be...&lt;br /&gt;&lt;pre&gt;Runtime.getRuntime.exec("cls");&lt;/pre&gt;&lt;br /&gt;No you say ...&lt;br /&gt;System-specific tasks such as these may be performed via Runtime.exec( )&lt;br /&gt;it allows you to perform certain system-specific tasks BUT with very little control.&lt;br /&gt;&lt;br /&gt;Actually, this won't work. Yes, the 'cls' command is invoked, *but* it is&lt;br /&gt;invoked in a new process ['command.com' or 'cmd.exe' is exected creating a&lt;br /&gt;new process], and *does not* clear the Java application's console.&lt;br /&gt;&lt;br /&gt;If your friend is intelligent may argue ...&lt;br /&gt;But if they can implement "beep", and they do, they should be able to implement "cls" too.&lt;br /&gt;But you are MORE intelligent , you say&lt;br /&gt;That's because BELL is a standard ASCII character (code 7) and it's&lt;br /&gt;pretty much standard that any terminal/console would render it by beeping.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The &lt;span style="font-weight: bold;"&gt;"second"&lt;/span&gt; reply may be&lt;br /&gt;&lt;pre&gt;System.out.print("\n\n\n\n\n\n\n\n\n\n\n\n");&lt;/pre&gt;&lt;br /&gt;and you say ... its obviously incorrect ( BTW your friend is stupid if he mentions this option ) ,&lt;br /&gt;as it scrolls the menu above so that its not visible to user NOT clean the screen.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;"third" &lt;/span&gt;reply may be&lt;br /&gt;I heard about this method:&lt;br /&gt;&lt;pre&gt;System.out.print((char)27 + "[2J");&lt;/pre&gt;&lt;br /&gt;Dont get scared probably your friend probably was good DOS progarmmr at some time as   &lt;escape&gt; + "[2J" is the ANSI escape sequence for clearing the screen.&lt;br /&gt;However, it doen't work unless "ansi.sys" is loaded and very few WinXP user's have this.&lt;br /&gt;&lt;br /&gt;If your friend is a Windows geek he may say&lt;br /&gt;&lt;br /&gt;Yes, we can add the following command in the c:\windows\system32\config.nt.&lt;br /&gt;device=c:\windows\system32\ansi.sys&lt;br /&gt;This will load the ansi.sys&lt;br /&gt;&lt;br /&gt;But that wont work buddy ... you may try it yourself .. and besides&lt;br /&gt;Thats Platform dependent !! and Java is platform independent right ?&lt;br /&gt;so take a "Chill Pill dude"&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;"fourth"&lt;/span&gt; may be ( if your friends guesses this .. he is really good with java / linux )&lt;br /&gt;Printing out the form-feed character will clear the screen&lt;br /&gt;System.out.print("\f");&lt;br /&gt;It works but only on linux , not on windows ... But java code should be platform independent&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Your friend :&lt;/span&gt; " So WHAT SHOULD I DO ??? "&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;You ( with a smile )&lt;/span&gt; : Write Java Native Interface [JNI] routines which tap into the relevant operating system functionality&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Your Friend :&lt;/span&gt; &lt;screaming&gt; "  ?? WHY ?? "&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;You :&lt;/span&gt; Unfortunately these tasks are inherently operating system-specific, and cannot be implemented in any standard way across platforms. Some platforms, in fact, don't even understand the concepts of 'screen', or 'cursor', so wouldn't even have any use for classes that implemented these abstractions. Even the 'standard' C and C++ languages which, like Java, aim for platform independance, do not implement such functionality.&lt;br /&gt;&lt;br /&gt;Most intelligent of your friend may say ...&lt;br /&gt;( you know the Phd types )&lt;br /&gt;&lt;br /&gt;Maybe a nested class could be added to 'System', containing all the&lt;br /&gt;system-specific console-management routines, something like:&lt;br /&gt;&lt;/screaming&gt;&lt;/escape&gt;&lt;pre&gt;&lt;br /&gt;class System&lt;br /&gt;{&lt;br /&gt;...&lt;br /&gt;public class Console&lt;br /&gt;{&lt;br /&gt;...&lt;br /&gt;public static native void cls();&lt;br /&gt;public static native void setCurPos(int row, int col);&lt;br /&gt;public static native String inputString();&lt;br /&gt;public static native double inputNumeric();&lt;br /&gt;...&lt;br /&gt;}&lt;br /&gt;...&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;You could then do something like:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;System.Console.cls();&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;and YOU calmly  reply ...&lt;br /&gt;Amego !! It would defeat the purpose of platform-independance, since not all&lt;br /&gt;platforms have the concept of a "console".&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Real solution ??&lt;/span&gt;&lt;br /&gt;Write JNI ( platform dependent way ) OR&lt;br /&gt;Look at jcurses on sourceforge.  ( but using this is an overkill )&lt;br /&gt;&lt;a href="http://sourceforge.net/projects/javacurses/"&gt;http://sourceforge.net/projects/javacurses/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;NeXt ... ask your friend .. to write a code to Accept input [say a single keystroke] without pressing ENTER and let me know how it goes ;o)&lt;br /&gt;&lt;br /&gt;Contradiction&lt;br /&gt;&lt;/span&gt;&lt;span&gt;Contradicting my self ... Recently discovered that with Java 6 , Its very much possible ...&lt;br /&gt;In Java 6 a better way of interacting with the command prompt was introduced, the java.io.Console class.&lt;br /&gt;Together with the utility class java.util.Scanner introduced in Java 5 this new API can be used to develop more advanced Java console applications.&lt;br /&gt;&lt;br /&gt;For more detaisl checkout&lt;br /&gt;&lt;a href="http://java.dzone.com/news/console-applications-java-6"&gt;http://java.dzone.com/news/console-applications-java-6&lt;/a&gt;&lt;br /&gt;&lt;a href="http://java.sun.com/javase/6/docs/api/java/io/Console.html"&gt;http://java.sun.com/javase/6/docs/api/java/io/Console.html&lt;/a&gt;&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8563220776994779598-6861016546299946034?l=lavnish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lavnish.blogspot.com/feeds/6861016546299946034/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8563220776994779598&amp;postID=6861016546299946034' title='8 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/6861016546299946034'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/6861016546299946034'/><link rel='alternate' type='text/html' href='http://lavnish.blogspot.com/2008/05/clear-screen-in-java.html' title='Clear the Screen In Java 5'/><author><name>Lavnish</name><uri>http://www.blogger.com/profile/16714741724993845980</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://lh4.google.co.uk/image/lavnishl/RdK3Rnp8q2E/AAAAAAAAAAw/g7LYCh-VN-8/s160-c/Me_ramoji.jpg'/></author><thr:total>8</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8563220776994779598.post-876621617471298653</id><published>2008-05-16T01:56:00.000-07:00</published><updated>2008-05-16T01:57:21.808-07:00</updated><title type='text'>Java Sort</title><content type='html'>&lt;a href="http://mindprod.com/jgloss/sort.html"&gt;http://mindprod.com/jgloss/sort.html&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8563220776994779598-876621617471298653?l=lavnish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lavnish.blogspot.com/feeds/876621617471298653/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8563220776994779598&amp;postID=876621617471298653' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/876621617471298653'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/876621617471298653'/><link rel='alternate' type='text/html' href='http://lavnish.blogspot.com/2008/05/java-sort.html' title='Java Sort'/><author><name>Lavnish</name><uri>http://www.blogger.com/profile/16714741724993845980</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://lh4.google.co.uk/image/lavnishl/RdK3Rnp8q2E/AAAAAAAAAAw/g7LYCh-VN-8/s160-c/Me_ramoji.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8563220776994779598.post-4813345932012060942</id><published>2008-05-15T10:39:00.000-07:00</published><updated>2008-05-26T22:31:39.085-07:00</updated><title type='text'>Java Hashing</title><content type='html'>lets start with hashing in general and how does java implement same and what are the drawbacks ( if any )&lt;br /&gt;&lt;br /&gt;hashing is a process of generating an index or address ( which is of smaller length) basing on ur data . A good hash function is the one which generates distinct addresses for distinct file names.&lt;br /&gt;&lt;br /&gt;As a simple example of the using of hashing in databases, a group of people could be arranged in a database like this:&lt;br /&gt;   Abernathy, Sara    Epperdingle, Roscoe             Moore, Wilfred                  Smith, David    (and many more sorted into alphabetical order)&lt;br /&gt;Each of these names would be the key in the database for that person's data. A database search mechanism would first have to start looking character-by-character across the name for matches until it found the match (or ruled the other entries out). But if each of the names were hashed, it might be possible (depending on the number of names in the database) to generate a unique four-digit key for each name. For example:&lt;br /&gt;   7864   Abernathy, Sara    9802   Epperdingle, Roscoe    1990   Moore, Wilfred    8822   Smith, David    (and so forth)&lt;br /&gt;A search for any name would first consist of computing the hash value (using the same hash function used to store the item) and then comparing for a match using that value. It would, in general, be much faster to find a match across four digits, each having only 10 possibilities, than across an unpredictable value length where each character had 26 possibilities.&lt;br /&gt;&lt;br /&gt;The hashing algorithm is also called hash function&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Uses of hashing&lt;br /&gt;(i) Hashes play a role in security systems where they're used to ensure that transmitted messages have not been tampered with. The sender generates a hash of the message, encrypts it, and sends it with the message itself. The recipient then decrypts both the message and the hash, produces another hash from the received message, and compares the two hashes. If they're the same, there is a very high probability that the message was transmitted intact.&lt;br /&gt;&lt;br /&gt;(ii) Hashing is also a common method of accessing data records.&lt;br /&gt;&lt;br /&gt;Java and hashing&lt;br /&gt;Every Java object has a hashCode() and an equals() method. While the Java language does not provide direct support for associative arrays -- arrays that can take any object as an index -- the presence of the hashCode() method in the root Object class clearly anticipates the ubiquitous use of HashMap (and its predecessor, Hashtable). Under ideal conditions, hash-based containers offer both efficient insertion and efficient retrieval; supporting hashing directly in the object model facilitates the development and use of hash-based containers.&lt;br /&gt;&lt;br /&gt;if two objects are equal according to the equals() method, they must have the same hashCode() value (although the reverse is not generally true).&lt;br /&gt;&lt;br /&gt;Why override equals() and hashCode()?&lt;br /&gt;&lt;br /&gt;What would happen if a class did not override equals() and hashCode()? Nothing, if we never used an that class as a key in a HashMap or other hash-based collection. However, if we were to use such a classes object for a key in a HashMap, we would not be able to reliably retrieve the associated value, unless we used the exact same classes instance in the get() call as we did in the put() call. This would require ensuring that we only use a single instance of the Integer object corresponding to a particular integer value throughout our program. Needless to say, this approach would be inconvenient and error prone.&lt;br /&gt;&lt;br /&gt;There are some restrictions placed on the behavior of equals() and hashCode(), which are enumerated in the documentation for Object. In particular, the equals() method must exhibit the following properties:&lt;br /&gt;· Symmetry: For two references, a and b, a.equals(b) if and only if b.equals(a)&lt;br /&gt;· Reflexivity: For all non-null references, a.equals(a)&lt;br /&gt;· Transitivity: If a.equals(b) and b.equals(c), then a.equals(c)&lt;br /&gt;· Consistency with hashCode(): Two equal objects must have the same hashCode() value&lt;br /&gt;· For any non-null reference value x, x.equals(null) must return false.&lt;br /&gt;&lt;br /&gt;public boolean equals(Object o) {&lt;br /&gt;if (o == null)&lt;br /&gt;return false;&lt;br /&gt;...&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public boolean equals(Object o) {&lt;br /&gt;if (!(o instanceof MyType))&lt;br /&gt;return false;  // also return null if o is null .. no spl check required&lt;br /&gt;...&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;Building hashing into the root object class of the Java class library was a very sensible design compromise -- it makes using hash-based containers so much easier and more efficient. However, several criticisms have been made of the approach to and implementation of hashing and equality in the Java class library. The hash-based containers in java.util are very convenient and easy to use, but may not be suitable for applications that require very high performance. While most of these will never be changed, it is worthwhile to keep in mind when you're designing applications that rely heavily on the efficiency of hash-based containers. These criticisms include:&lt;br /&gt;&lt;br /&gt;Too small a hash range. Using int, instead of long, for the return type of hashCode() increases the possibility of hash collisions.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Bad distribution of hash values. The hash values for short strings and small integers are themselves small integers, and are close to the hash values of other "nearby" objects. A more well-behaved hash function would distribute the hash values more evenly across the hash range.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;No defined hashing operations. While some classes, such as String and List, define a hash algorithm to be used in combining the hash values of its constituent elements into a single hash value, the language specification does not define any approved means of combining the hash values of multiple objects into a new hash value.&lt;br /&gt;&lt;br /&gt;Difficulty writing equals() when extending an instantiable class that already overrides equals(). The "obvious" ways to define equals() when extending an instantiable class that already overrides equals() all fail to meet the symmetry or transitivity requirements of the equals() method. This means that you must understand the structure and implementation details of classes you are extending when overriding equals(), and may even need to expose private fields in the base class as protected to do so, which violates principles of good object-oriented design.&lt;br /&gt;&lt;br /&gt;Basically what happens is when hashCode returns a number then its searched for in collection and gets a list, and then it uses equals( ) to search in bucket that it got.&lt;br /&gt;&lt;br /&gt;Equals( ) defines logical equality&lt;br /&gt;&lt;br /&gt;Recipie for a equals( ) method&lt;br /&gt;&lt;br /&gt;1. Use the == operator to check if the argument is a reference to this object.&lt;br /&gt;If so, return true. This is just a performance optimization, but one that is worth&lt;br /&gt;doing if the comparison is potentially expensive.&lt;br /&gt;2. Use the instanceof operator to check if the argument is of the correct&lt;br /&gt;type. If not, return false. Typically, the correct type is the class in which the&lt;br /&gt;method occurs. Occasionally, it is some interface implemented by this class.&lt;br /&gt;Use an interface if the class implements an interface that refines the equals&lt;br /&gt;contract to permit comparisons across classes that implement the interface. The&lt;br /&gt;collection interfaces Set, List, Map, and Map.Entry have this property.&lt;br /&gt;3. Cast the argument to the correct type. Because this cast was preceded by an&lt;br /&gt;instanceof test, it is guaranteed to succeed.&lt;br /&gt;4. For each “significant” field in the class, check to see if that field of the argument&lt;br /&gt;matches the corresponding field of this object. If all these tests succeed,&lt;br /&gt;return true; otherwise, return false.&lt;br /&gt;5. When you are finished writing your equals method, ask yourself three&lt;br /&gt;questions: Is it symmetric, is it transitive, and is it consistent?&lt;br /&gt;&lt;br /&gt;Here is the contract, copied from the java.lang.Object specification:&lt;br /&gt;n Whenever it is invoked on the same object more than once during an execution&lt;br /&gt;of an application, the hashCode method must consistently return the&lt;br /&gt;same integer, provided no information used in equals comparisons on the&lt;br /&gt;object is modified. This integer need not remain consistent from one execution&lt;br /&gt;of an application to another execution of the same application.&lt;br /&gt;n If two objects are equal according to the equals(Object) method, then calling&lt;br /&gt;the hashCode method on each of the two objects must produce the same&lt;br /&gt;integer result.&lt;br /&gt;n It is not required that if two objects are unequal according to the equals(Object)&lt;br /&gt;method, then calling the hashCode method on each of the two objects&lt;br /&gt;must produce distinct integer results. However, the programmer should be&lt;br /&gt;aware that producing distinct integer results for unequal objects may improve&lt;br /&gt;the performance of hash tables.&lt;br /&gt;&lt;br /&gt;References&lt;br /&gt;&lt;a href="http://java.sun.com/docs/books/effective/chapters.html"&gt;http://java.sun.com/docs/books/effective/chapters.html&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.owasp.org/index.php/Hashing_Java"&gt;http://www.owasp.org/index.php/Hashing_Java&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8563220776994779598-4813345932012060942?l=lavnish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lavnish.blogspot.com/feeds/4813345932012060942/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8563220776994779598&amp;postID=4813345932012060942' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/4813345932012060942'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/4813345932012060942'/><link rel='alternate' type='text/html' href='http://lavnish.blogspot.com/2008/05/java-hashing.html' title='Java Hashing'/><author><name>Lavnish</name><uri>http://www.blogger.com/profile/16714741724993845980</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://lh4.google.co.uk/image/lavnishl/RdK3Rnp8q2E/AAAAAAAAAAw/g7LYCh-VN-8/s160-c/Me_ramoji.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8563220776994779598.post-3620320407793752624</id><published>2008-05-15T05:16:00.000-07:00</published><updated>2008-05-15T05:19:56.128-07:00</updated><title type='text'>Java Iterator</title><content type='html'>Iterator also has a method remove( ) , when its called it will remove from source the last item retrieved from next( )&lt;br /&gt;&lt;br /&gt;If remove is called twice in succesion without a call to next in between IllegalStateException is thrown can get Concurrent MOdification exceptiion if someone else is modifying the collection&lt;br /&gt;&lt;br /&gt;according to &lt;a href="http://java.sun.com/j2se/1.4.2/docs/api/java/util/Iterator.html#remove%28%29"&gt;http://java.sun.com/j2se/1.4.2/docs/api/java/util/Iterator.html#remove()&lt;/a&gt;&lt;br /&gt;The behavior of an iterator is unspecified if the underlying collection is modified while the iteration is in progress in any way other than by calling this method.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;import java.util.*;&lt;br /&gt;public class DelMeCollection {&lt;br /&gt;    public static List l = new ArrayList(25);&lt;br /&gt;    static class ListIterateThread extends Thread {&lt;br /&gt;        public void run( ){&lt;br /&gt;            System.out.println("thread started ");&lt;br /&gt;            Iterator listItr = l.iterator();&lt;br /&gt;            System.out.println("got the iterator ");&lt;br /&gt;            try {&lt;br /&gt;            while(listItr.hasNext())&lt;br /&gt;                    System.out.println("val is "+listItr.next());&lt;br /&gt;            } catch(Exception e ) {&lt;br /&gt;                System.out.println("some exception "+e);&lt;br /&gt;                // wonder why no concurrent modification exception&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    public static void main(String[] args) {&lt;br /&gt;        System.out.println("inside main THREAD");&lt;br /&gt;        ListIterateThread lt= new ListIterateThread();&lt;br /&gt;        List l = new ArrayList(25);&lt;br /&gt;        lt.start();&lt;br /&gt;        l.add("1");          System.out.println("added 1");&lt;br /&gt;        l.add("2");          System.out.println("added 2");&lt;br /&gt;        l.add("3");          System.out.println("added 3");&lt;br /&gt;        l.add("4");          System.out.println("added 4");&lt;br /&gt;        l.add("5");          System.out.println("added 5");&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;        l.add("11");        System.out.println("added 11");&lt;br /&gt;        l.add("12");        System.out.println("added 12");&lt;br /&gt;        l.add("13");        System.out.println("added 13");&lt;br /&gt;        l.add("14");        System.out.println("added 14");&lt;br /&gt;        l.add("15");        System.out.println("added 15");&lt;br /&gt;&lt;br /&gt;        try {&lt;br /&gt;            Thread.currentThread().sleep(5);&lt;br /&gt;        } catch (InterruptedException e) {&lt;br /&gt;            System.out.println("exception "+e);&lt;br /&gt;        }&lt;br /&gt;        &lt;br /&gt;        l.add("21");        System.out.println("added 21");&lt;br /&gt;        l.add("22");        System.out.println("added 22");&lt;br /&gt;        l.add("23");        System.out.println("added 23");&lt;br /&gt;        l.add("24");        System.out.println("added 24");&lt;br /&gt;        l.add("25");        System.out.println("added 25");&lt;br /&gt;        &lt;br /&gt;        l.add("31");        System.out.println("added 31");&lt;br /&gt;        l.add("32");        System.out.println("added 32");&lt;br /&gt;        l.add("33");        System.out.println("added 33");&lt;br /&gt;        l.add("34");        System.out.println("added 34");&lt;br /&gt;        l.add("35");        System.out.println("added 35");&lt;br /&gt;        &lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Got Output&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;inside main THREAD&lt;br /&gt;added 1&lt;br /&gt;added 2&lt;br /&gt;added 3&lt;br /&gt;added 4&lt;br /&gt;thread started &lt;br /&gt;added 5&lt;br /&gt;got the iterator &lt;br /&gt;added 11&lt;br /&gt;added 12&lt;br /&gt;added 13&lt;br /&gt;added 14&lt;br /&gt;added 15&lt;br /&gt;added 21&lt;br /&gt;added 22&lt;br /&gt;added 23&lt;br /&gt;added 24&lt;br /&gt;added 25&lt;br /&gt;added 31&lt;br /&gt;added 32&lt;br /&gt;added 33&lt;br /&gt;added 34&lt;br /&gt;added 35&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;If you want to iterate through "Filtered Collection" try &lt;a href="http://chaoticjava.com/posts/how-to-write-iterators-really-really-fast/"&gt;this&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8563220776994779598-3620320407793752624?l=lavnish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lavnish.blogspot.com/feeds/3620320407793752624/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8563220776994779598&amp;postID=3620320407793752624' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/3620320407793752624'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/3620320407793752624'/><link rel='alternate' type='text/html' href='http://lavnish.blogspot.com/2008/05/java-iterator.html' title='Java Iterator'/><author><name>Lavnish</name><uri>http://www.blogger.com/profile/16714741724993845980</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://lh4.google.co.uk/image/lavnishl/RdK3Rnp8q2E/AAAAAAAAAAw/g7LYCh-VN-8/s160-c/Me_ramoji.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8563220776994779598.post-5205640075820484482</id><published>2008-05-15T04:59:00.000-07:00</published><updated>2008-05-15T05:16:33.866-07:00</updated><title type='text'>Java Collections</title><content type='html'>Framework consisits of three parts&lt;br /&gt;&lt;ol&gt;&lt;li&gt;interfaces -&lt;/li&gt;&lt;li&gt;implementation - of above interfaces&lt;/li&gt;&lt;li&gt;algorithms - general applicable to either interfaces / implementation&lt;/li&gt;&lt;/ol&gt;&lt;span style="font-weight: bold;"&gt;Interfaces&lt;/span&gt;&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Collection - A collection represents a group of objects, known as its elements. may or may not have duplicate elements .. defines no order. JDK has no direct implementation of this interface.&lt;/li&gt;&lt;li&gt;List - defines order , may have dup&lt;/li&gt;&lt;li&gt;Set - no dup&lt;/li&gt;&lt;li&gt;SortedSet - set with order&lt;/li&gt;&lt;li&gt;Map - not part of hierarchy , just store key value pairs&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Implementations&lt;/span&gt;&lt;br /&gt;Keeping the two concepts ( interface &amp;amp; implementation) seperate can help you write code like&lt;br /&gt;&lt;pre&gt;List l = new ....{ }&lt;/pre&gt;&lt;br /&gt;You can change implementation when your business condition require you to do so&lt;br /&gt;&lt;br /&gt;&lt;&gt;&lt;br /&gt;&lt;br /&gt;LinkedList is gr8 if u want to add/remove data from middle , if you want indexed access then ArrayList is better&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;All implementations are unsynchronised&lt;/li&gt;&lt;li&gt;All implementations offer fail fast iterators&lt;/li&gt;&lt;li&gt;All implementations are serializable and cloneable&lt;/li&gt;&lt;li&gt;All implementations support having null elements&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Algorithm&lt;/span&gt;&lt;br /&gt;the Collections class has methods that allow you to perform action on these data&lt;br /&gt;This class consists exclusively of static methods that operate on or return collections.&lt;br /&gt;Has static variables like EMPTY_LIST , EMPTY_MAP , EMPTY_SET&lt;br /&gt;methods like binarySearch , min , max , reverse&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;java.util.Collection&lt;/span&gt;&lt;br /&gt;All general-purpose Collection implementation classes (which typically implement Collection indirectly through one of its subinterfaces) should provide two "standard" constructors: a void (no arguments) constructor, which creates an empty collection, and a constructor with a single argument of type Collection, which creates a new collection with the same elements as its argument.&lt;br /&gt;&lt;br /&gt;Adding Elements Framework consisits of three parts&lt;br /&gt;(i) interfaces -&lt;br /&gt;(ii) implementation - of above interfaces&lt;br /&gt;(iii) algorithms - general applicable to either interfaces / implementation&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Interfaces&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Collection - A collection represents a group of objects, known as its elements. may or may not have duplicate elements .. defines no order. JDK has no direct implementation of this interface.&lt;/li&gt;&lt;li&gt;List - defines order , may have dup&lt;/li&gt;&lt;li&gt;Set - no dup&lt;/li&gt;&lt;li&gt;SortedSet - set with order&lt;/li&gt;&lt;li&gt;Map - not part of hierarchy , just store key value pairs&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Implementations&lt;/span&gt;&lt;br /&gt;Keeping the two concepts ( interface &amp;amp; implementation) seperate can help you write code like&lt;br /&gt;List l = new ....{ }&lt;br /&gt;You can change implementation when your business condition require you to do so&lt;br /&gt;&lt;br /&gt;&lt;table border="3" cellpadding="3" cellspacing="2" width="100%"&gt;&lt;br /&gt;     &lt;tbody&gt;&lt;tr&gt;&lt;br /&gt;       &lt;th&gt;&lt;br /&gt;         INTERFACE&lt;br /&gt;       &lt;/th&gt;&lt;br /&gt;       &lt;th&gt;&lt;br /&gt;         HASH TABLE&lt;br /&gt;       &lt;/th&gt;&lt;br /&gt;       &lt;th&gt;&lt;br /&gt;         RESIZABLE ARRAY&lt;br /&gt;       &lt;/th&gt;&lt;br /&gt;       &lt;th&gt;&lt;br /&gt;         BALANCED TREE&lt;br /&gt;       &lt;/th&gt;&lt;br /&gt;       &lt;th&gt;&lt;br /&gt;         LINKED LIST&lt;br /&gt;       &lt;/th&gt;&lt;br /&gt;       &lt;th&gt;&lt;br /&gt;         HISTORICAL&lt;br /&gt;       &lt;/th&gt;&lt;br /&gt;     &lt;/tr&gt;&lt;br /&gt;     &lt;tr&gt;&lt;br /&gt;       &lt;th&gt;&lt;br /&gt;         SET&lt;br /&gt;       &lt;/th&gt;&lt;br /&gt;       &lt;td width="17%"&gt;Hah Set&lt;/td&gt;&lt;br /&gt;       &lt;td width="17%"&gt;&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;       &lt;td width="17%"&gt;TreeSet&lt;/td&gt;&lt;br /&gt;       &lt;td width="16%"&gt;&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;       &lt;td width="16%"&gt;&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;     &lt;/tr&gt;&lt;br /&gt;     &lt;tr&gt;&lt;br /&gt;       &lt;th&gt;&lt;br /&gt;         SORTEDSET&lt;br /&gt;       &lt;/th&gt;&lt;br /&gt;       &lt;td width="17%"&gt;&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;       &lt;td width="17%"&gt;&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;       &lt;td width="17%"&gt;TreeSet&lt;/td&gt;&lt;br /&gt;       &lt;td width="16%"&gt;&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;       &lt;td width="16%"&gt;&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;     &lt;/tr&gt;&lt;br /&gt;     &lt;tr&gt;&lt;br /&gt;       &lt;th&gt;&lt;br /&gt;         LIST&lt;br /&gt;       &lt;/th&gt;&lt;br /&gt;       &lt;td width="17%"&gt;&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;       &lt;td width="17%"&gt;ArrayList&lt;/td&gt;&lt;br /&gt;       &lt;td width="17%"&gt;&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;       &lt;td width="16%"&gt;LinkedList&lt;/td&gt;&lt;br /&gt;       &lt;td width="16%"&gt;&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;     &lt;/tr&gt;&lt;br /&gt;     &lt;tr&gt;&lt;br /&gt;       &lt;th&gt;&lt;br /&gt;         MAP&lt;br /&gt;       &lt;/th&gt;&lt;br /&gt;       &lt;td width="17%"&gt;&lt;br /&gt;         &lt;p&gt;&lt;br /&gt;           HashMap&lt;br /&gt;         &lt;/p&gt;&lt;br /&gt;         &lt;p&gt;&lt;br /&gt;           WeakHashMap&lt;br /&gt;         &lt;/p&gt;&lt;br /&gt;       &lt;/td&gt;&lt;br /&gt;       &lt;td width="17%"&gt;&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;       &lt;td width="17%"&gt;TreeMap&lt;/td&gt;&lt;br /&gt;       &lt;td width="16%"&gt;&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;       &lt;td width="16%"&gt;&lt;br /&gt;         &lt;p&gt;&lt;br /&gt;           Vector&lt;br /&gt;         &lt;/p&gt;&lt;br /&gt;         &lt;p&gt;&lt;br /&gt;           Stack&lt;br /&gt;         &lt;/p&gt;&lt;br /&gt;         &lt;p&gt;&lt;br /&gt;           HashTable&lt;br /&gt;         &lt;/p&gt;&lt;br /&gt;         &lt;p&gt;&lt;br /&gt;           Properties&lt;br /&gt;         &lt;/p&gt;&lt;br /&gt;       &lt;/td&gt;&lt;br /&gt;     &lt;/tr&gt;&lt;br /&gt;     &lt;tr&gt;&lt;br /&gt;       &lt;th&gt;&lt;br /&gt;         SORTEDMAP&lt;br /&gt;       &lt;/th&gt;&lt;br /&gt;       &lt;td width="17%"&gt;&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;       &lt;td width="17%"&gt;&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;       &lt;td width="17%"&gt;TreeMap&lt;/td&gt;&lt;br /&gt;       &lt;td width="16%"&gt;&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;       &lt;td width="16%"&gt;&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;     &lt;/tr&gt;&lt;br /&gt;   &lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;br /&gt;LinkedList is gr8 if u want to add/remove data from middle , if you want indexed access then ArrayList is better&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;All implementations are unsynchronised&lt;/li&gt;&lt;li&gt;All implementations offer fail fast iterators&lt;/li&gt;&lt;li&gt;All implementations are serializable and cloneable&lt;/li&gt;&lt;li&gt;All implementations support having null elements&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Algorithm&lt;/span&gt;&lt;br /&gt;the Collections class has methods that allow you to perform action on these data&lt;br /&gt;This class consists exclusively of static methods that operate on or return collections.&lt;br /&gt;Has static variables like EMPTY_LIST , EMPTY_MAP , EMPTY_SET&lt;br /&gt;methods like binarySearch , min , max , reverse&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;java.util.Collection&lt;/span&gt;&lt;br /&gt;All general-purpose Collection implementation classes (which typically implement Collection indirectly through one of its subinterfaces) should provide two "standard" constructors: a void (no arguments) constructor, which creates an empty collection, and a constructor with a single argument of type Collection, which creates a new collection with the same elements as its argument.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Adding Elements&lt;/span&gt;&lt;br /&gt;public boolean add(Object a)        -- can only throw UnsupportedOperation exception , not nullpointerExcep&lt;br /&gt;public boolean addAll(Collection c)&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Removing Elements&lt;/span&gt;&lt;br /&gt;public void clear()&lt;br /&gt;public boolean remove(Object elem)&lt;br /&gt;public boolean removeAll(Collection c)&lt;br /&gt;if original was {1,5,3,8,1,8,2,4,1,3,7,6}&lt;br /&gt;and passed list is {1,7}&lt;br /&gt;every instance of 1 nad 7 will be removed&lt;br /&gt;you get {5,3,8,8,2,4,3,6}&lt;br /&gt;&lt;br /&gt;public boolean retainAll(Collection c)&lt;br /&gt;opposite of remove&lt;br /&gt;&lt;br /&gt;public Iterator iterator()&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;finding elements&lt;/span&gt;&lt;br /&gt;public boolean contains(Object elem)&lt;br /&gt;public boolean containsAll(Collection c)&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;checking size&lt;/span&gt;&lt;br /&gt;public int size()&lt;br /&gt;public boolean isEmpty()&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;copy and cloning collection&lt;/span&gt;&lt;br /&gt;public Object[] toArray( )&lt;br /&gt;public Object[] toArray(Object[] a)&lt;br /&gt;consults the passed collection in terms of return type and size&lt;br /&gt;if collections.siz() &lt;= a.size() ... elements are returned in array and returned &lt;br /&gt;&lt;pre&gt;&lt;br /&gt;Collection c = ....&lt;br /&gt;String array[] = new String[c.size()];&lt;br /&gt;array = (String[])c.toArray(array); &lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;check for equality &lt;/span&gt;&lt;br /&gt;public boolean equals(Object o)&lt;br /&gt;Note besides Object.equals() interface also has this method to imphasize the fact that need to override Its not necessary to override the Object.equals( ) The general contract for the Object.equals method states that equals must be symmetric (in other words, a.equals(b) if and only if b.equals(a)). The contracts for List.equals  and Set.equals state that lists are only equal to other lists, and sets to other sets. Thus, a custom equals method for a collection class that implements neither the List nor Set interface must return false when this collection is compared to any list or set.   -- dont try to add colection to itself &lt;pre&gt;&lt;br /&gt;       List l = new ArrayList(6);&lt;br /&gt;       l.add("1");&lt;br /&gt;       System.out.println("added 1");&lt;br /&gt;       l.add("2");&lt;br /&gt;       System.out.println("added 2");&lt;br /&gt;       l.add(l);&lt;br /&gt;       System.out.println("KABOOM !!");&lt;br /&gt;       Iterator listItr = l.iterator();&lt;br /&gt;       while(listItr.hasNext())&lt;br /&gt;               System.out.println("val is "+listItr.next());&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;I got the output&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;added 1&lt;br /&gt; added 2&lt;br /&gt; KABOOM !!&lt;br /&gt; val is 1&lt;br /&gt; val is 2&lt;br /&gt; val is [1, 2, (this Collection)]&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;collection VS Collection VS Collections&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8563220776994779598-5205640075820484482?l=lavnish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lavnish.blogspot.com/feeds/5205640075820484482/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8563220776994779598&amp;postID=5205640075820484482' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/5205640075820484482'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/5205640075820484482'/><link rel='alternate' type='text/html' href='http://lavnish.blogspot.com/2008/05/java-collections.html' title='Java Collections'/><author><name>Lavnish</name><uri>http://www.blogger.com/profile/16714741724993845980</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://lh4.google.co.uk/image/lavnishl/RdK3Rnp8q2E/AAAAAAAAAAw/g7LYCh-VN-8/s160-c/Me_ramoji.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8563220776994779598.post-2073986188180188548</id><published>2008-05-15T03:15:00.000-07:00</published><updated>2008-05-15T03:17:55.320-07:00</updated><title type='text'>Java Garbage Collection</title><content type='html'>A garbage collector is responsible for&lt;br /&gt;&lt;ul&gt;&lt;li&gt;allocating memory&lt;/li&gt;&lt;li&gt;ensuring that any referenced objects remain in memory, and&lt;/li&gt;&lt;li&gt;recovering memory used by objects that are no longer reachable from references in executing code.&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;Space is allocated by a large space called heap. The JVM's heap stores all objects created by an executing Java program. Objects are created by Java's "new" operator, and memory for new objects is allocated on the heap at run time.&lt;br /&gt;&lt;br /&gt;In addition to freeing unreferenced objects, a garbage collector may also combat heap fragmentation. Heap fragmentation occurs through the course of normal program execution. New objects are allocated, and unreferenced objects are freed such that free blocks of heap memory are left in between blocks occupied by live objects&lt;br /&gt;&lt;br /&gt;Code for System.gc is as follows&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;public static void gc() {&lt;br /&gt; Runtime.getRuntime().gc();&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;System.gc() is just more convinient to call/use&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;freeMem = Runtime.getRuntime().freeMemory();&lt;br /&gt;System.gc();&lt;br /&gt;System.out.println("free memory after running gc(): " + freeMem);&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Interesting links&lt;/span&gt;&lt;br /&gt;&lt;a href="http://chaoticjava.com/posts/garbage-collection-the-comic-panel/"&gt;http://chaoticjava.com/posts/garbage-collection-the-comic-panel/&lt;/a&gt;&lt;br /&gt;&lt;a href="http://chaoticjava.com/posts/how-does-garbage-collection-work/"&gt;http://chaoticjava.com/posts/how-does-garbage-collection-work/&lt;/a&gt;&lt;br /&gt;&lt;a href="http://chaoticjava.com/posts/parallel-and-concurrent-garbage-collectors/"&gt;http://chaoticjava.com/posts/parallel-and-concurrent-garbage-collectors/&lt;/a&gt;&lt;br /&gt;&lt;a href="http://chaoticjava.com/posts/gc-tips-and-memory-leaks/"&gt;http://chaoticjava.com/posts/gc-tips-and-memory-leaks/&lt;/a&gt;&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8563220776994779598-2073986188180188548?l=lavnish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lavnish.blogspot.com/feeds/2073986188180188548/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8563220776994779598&amp;postID=2073986188180188548' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/2073986188180188548'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/2073986188180188548'/><link rel='alternate' type='text/html' href='http://lavnish.blogspot.com/2008/05/java-garbage-collection.html' title='Java Garbage Collection'/><author><name>Lavnish</name><uri>http://www.blogger.com/profile/16714741724993845980</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://lh4.google.co.uk/image/lavnishl/RdK3Rnp8q2E/AAAAAAAAAAw/g7LYCh-VN-8/s160-c/Me_ramoji.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8563220776994779598.post-794968416307900769</id><published>2008-05-14T06:00:00.000-07:00</published><updated>2008-06-05T21:43:34.265-07:00</updated><title type='text'>Java and MS-Office</title><content type='html'>Just in case ever need to&lt;br /&gt;&lt;ol&gt;&lt;li&gt;&lt;a href="http://www.hiteshagrawal.com/java/reading-word-document-in-java"&gt;Read a Microsoft word document in Java&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.zfqjava.com/article/How-to-import-excel-into-JTabel.html"&gt;Import Excel in JTable&lt;/a&gt;&lt;/li&gt;&lt;/ol&gt;In Conference Java One 2008 , Oracle also gave demo on how to integrate MS-Excel with ADF&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://www.oracle.com/goto/newsletters/javadev/0508/java_sun_frdamp_267596.html?msgid=6551620"&gt;See The Video&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.oracle.com/technology/products/adf/adffaces/11/doc/adf-richclient-api/tagdoc/af_exportCollectionActionListener.html"&gt;Doc&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8563220776994779598-794968416307900769?l=lavnish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lavnish.blogspot.com/feeds/794968416307900769/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8563220776994779598&amp;postID=794968416307900769' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/794968416307900769'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/794968416307900769'/><link rel='alternate' type='text/html' href='http://lavnish.blogspot.com/2008/05/java-and-ms-office.html' title='Java and MS-Office'/><author><name>Lavnish</name><uri>http://www.blogger.com/profile/16714741724993845980</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://lh4.google.co.uk/image/lavnishl/RdK3Rnp8q2E/AAAAAAAAAAw/g7LYCh-VN-8/s160-c/Me_ramoji.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8563220776994779598.post-432097164444370193</id><published>2008-05-14T02:45:00.000-07:00</published><updated>2008-05-14T02:55:53.289-07:00</updated><title type='text'>Java Strings Immutable</title><content type='html'>Many modern languages (like java) employ “the immutable object” paradigm, which solves a lot of problems including the&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Memory conservation&lt;/li&gt;&lt;li&gt;Addressing concurrency concerns &lt;/li&gt;&lt;li&gt;Cache localization&lt;/li&gt;&lt;/ol&gt;Memory Conservation - A pool of string objects ( constant ) is maintained with references pointing to the constant objects. Instead of each variable having new String object. Re usability leads to lesser memory usage.&lt;br /&gt;&lt;br /&gt;Concurrency Concerns - if you change any string need to consider that more than one references may be pointing to same string ,  so if you will change that string all references must also be updated ( thats tough ) so a new object for changed string will be created and only that particular reference will be point to that new object hence actual object will never change.&lt;br /&gt;&lt;br /&gt;I am not sure about cache localization ??&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8563220776994779598-432097164444370193?l=lavnish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lavnish.blogspot.com/feeds/432097164444370193/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8563220776994779598&amp;postID=432097164444370193' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/432097164444370193'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/432097164444370193'/><link rel='alternate' type='text/html' href='http://lavnish.blogspot.com/2008/05/java-strings-immutable.html' title='Java Strings Immutable'/><author><name>Lavnish</name><uri>http://www.blogger.com/profile/16714741724993845980</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://lh4.google.co.uk/image/lavnishl/RdK3Rnp8q2E/AAAAAAAAAAw/g7LYCh-VN-8/s160-c/Me_ramoji.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8563220776994779598.post-5138408894533941844</id><published>2008-05-14T01:40:00.000-07:00</published><updated>2008-05-14T01:44:09.847-07:00</updated><title type='text'>Linux : how to list directory only</title><content type='html'>To see a listing of all directories in current directory&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;ls -l | grep ^d &lt;span style="font-style: italic; color: rgb(51, 204, 0);"&gt;( this will show names with details )&lt;/span&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;ls -d */            &lt;span style="font-style: italic; color: rgb(51, 204, 0);"&gt;( will how names only )&lt;/span&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;If you want to see hidden directory also&lt;br /&gt;&lt;ul&gt;&lt;li&gt;ls -d .*"/" *"/" &lt;/li&gt;&lt;li&gt;find . -type d -exec ls -d {} \;&lt;/li&gt;&lt;li&gt;find . -type d&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8563220776994779598-5138408894533941844?l=lavnish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lavnish.blogspot.com/feeds/5138408894533941844/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8563220776994779598&amp;postID=5138408894533941844' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/5138408894533941844'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/5138408894533941844'/><link rel='alternate' type='text/html' href='http://lavnish.blogspot.com/2008/05/linux-how-to-list-directory-only.html' title='Linux : how to list directory only'/><author><name>Lavnish</name><uri>http://www.blogger.com/profile/16714741724993845980</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://lh4.google.co.uk/image/lavnishl/RdK3Rnp8q2E/AAAAAAAAAAw/g7LYCh-VN-8/s160-c/Me_ramoji.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8563220776994779598.post-5271883480569382635</id><published>2008-05-13T21:51:00.000-07:00</published><updated>2008-05-13T21:54:16.696-07:00</updated><title type='text'>JavaScript : String Performance</title><content type='html'>Just wanted to book mark these two "excellent" blog entries ...&lt;br /&gt;&lt;ol&gt;&lt;li&gt;&lt;a href="http://www.sitepen.com/blog/2008/05/09/string-performance-an-analysis/"&gt;http://ajaxian.com/archives/everything-you-wanted-to-know-about-string-performance&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.sitepen.com/blog/2008/05/09/string-performance-an-analysis/"&gt;http://www.sitepen.com/blog/2008/05/09/string-performance-an-analysis/&lt;/a&gt;&lt;/li&gt;&lt;/ol&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8563220776994779598-5271883480569382635?l=lavnish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lavnish.blogspot.com/feeds/5271883480569382635/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8563220776994779598&amp;postID=5271883480569382635' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/5271883480569382635'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/5271883480569382635'/><link rel='alternate' type='text/html' href='http://lavnish.blogspot.com/2008/05/javascript-string-performance.html' title='JavaScript : String Performance'/><author><name>Lavnish</name><uri>http://www.blogger.com/profile/16714741724993845980</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://lh4.google.co.uk/image/lavnishl/RdK3Rnp8q2E/AAAAAAAAAAw/g7LYCh-VN-8/s160-c/Me_ramoji.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8563220776994779598.post-3299232980837056811</id><published>2008-05-13T06:34:00.000-07:00</published><updated>2008-05-13T06:57:30.779-07:00</updated><title type='text'>Servlets and Garbage Collection</title><content type='html'>&lt;span style="font-weight: bold; color: rgb(51, 102, 255);"&gt;Basic Cycle&lt;/span&gt;&lt;br /&gt;&lt;ol&gt;&lt;li&gt;The &lt;i&gt;destroy()&lt;/i&gt; method is called by the servlet container when the container decides to unload &lt;u&gt;the servlet instance itself&lt;/u&gt;.&lt;/li&gt;&lt;li&gt;After the &lt;i&gt;destroy()&lt;/i&gt; method completes, the servlet engine unloads the servlet,.&lt;/li&gt;&lt;li&gt;Then, the JVM eventually performs garbage collection on the memory resources associated with that servlet object.&lt;/li&gt;&lt;/ol&gt;&lt;span style="font-weight: bold; color: rgb(51, 102, 255);"&gt;Effecient Servlet : Goals&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;When can you say that a Servlet is efficient , well of course when  it  does your work in most effecient manner or in other words the algorithm/logic that you have in it is effecient... but there's more to its efficiency .. Read On !!&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-style: italic;"&gt;Secondly&lt;/span&gt; even for High volume Web applications, one needs to carefully control the amount of garbage created during page generation. More the garbage created, fewer the pages generated, and the slower is the response time for a particular request. ( &lt;span style="font-style: italic;"&gt;This bottleneck occurs because the Java VM has to steal cycles to run garbage collection when it should be generating pages. &lt;/span&gt;) On the flip side , if too much garbage is created, request processing could halt entirely. Which is unacceptable.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;                      &lt;p&gt;&lt;span style="font-style: italic;"&gt;Third&lt;/span&gt; is to keep the browser active: not too much of  "waiting for response" messages. To put it in programatic terms the time a bean spends querying backend is the time a user spends waiting for page to display. This can -- and should -- be avoided using servlet response streaming techniques.&lt;br /&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8563220776994779598-3299232980837056811?l=lavnish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lavnish.blogspot.com/feeds/3299232980837056811/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8563220776994779598&amp;postID=3299232980837056811' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/3299232980837056811'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/3299232980837056811'/><link rel='alternate' type='text/html' href='http://lavnish.blogspot.com/2008/05/servlets-and-garbage-collection.html' title='Servlets and Garbage Collection'/><author><name>Lavnish</name><uri>http://www.blogger.com/profile/16714741724993845980</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://lh4.google.co.uk/image/lavnishl/RdK3Rnp8q2E/AAAAAAAAAAw/g7LYCh-VN-8/s160-c/Me_ramoji.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8563220776994779598.post-6624714391127914753</id><published>2008-05-13T06:12:00.000-07:00</published><updated>2008-05-13T06:17:58.642-07:00</updated><title type='text'>All About Servlets : Run The Servlet</title><content type='html'>&lt;pre&gt;&lt;br /&gt;&lt;span style="color:RED;"&gt;&lt;b&gt;import&lt;/b&gt;&lt;/span&gt; java&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;io&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;IOException&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:RED;"&gt;&lt;b&gt;import&lt;/b&gt;&lt;/span&gt; java&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;io&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;PrintWriter&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color:RED;"&gt;&lt;b&gt;import&lt;/b&gt;&lt;/span&gt; javax&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;servlet&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;*&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:RED;"&gt;&lt;b&gt;import&lt;/b&gt;&lt;/span&gt; javax&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;servlet&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;http&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;*&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color:RED;"&gt;&lt;b&gt;public&lt;/b&gt;&lt;/span&gt; &lt;span style="color:RED;"&gt;&lt;b&gt;class&lt;/b&gt;&lt;/span&gt; AllAboutServlet &lt;span style="color:RED;"&gt;&lt;b&gt;extends&lt;/b&gt;&lt;/span&gt; HttpServlet &lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;{&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;   &lt;span style="color:RED;"&gt;&lt;b&gt;private&lt;/b&gt;&lt;/span&gt; &lt;span style="color:RED;"&gt;&lt;b&gt;static&lt;/b&gt;&lt;/span&gt; &lt;span style="color:RED;"&gt;&lt;b&gt;final&lt;/b&gt;&lt;/span&gt; String CONTENT_TYPE &lt;span style=";font-size:78%;color:BLUE;"  &gt;=&lt;/span&gt; &lt;span style="color:PURPLE;"&gt;"text/html; charset=windows-1252"&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;  &lt;span style="color:RED;"&gt;&lt;b&gt;public&lt;/b&gt;&lt;/span&gt; AllAboutServlet&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt; &lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;{&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;       System&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;out&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;println&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="color:PURPLE;"&gt;"CTOR : Servlet constructor can be overriden .. "&lt;/span&gt; &lt;span style=";font-size:78%;color:BLUE;"  &gt;+&lt;/span&gt;&lt;br /&gt;       &lt;span style="color:PURPLE;"&gt;"should not be private , protected , nor default"&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;       System&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;out&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;println&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="color:PURPLE;"&gt;"CTOR : The ctor will be called by the container ... "&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;       System&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;out&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;println&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="color:PURPLE;"&gt;"CTOR : At present its a normal java object .. "&lt;/span&gt; &lt;span style=";font-size:78%;color:BLUE;"  &gt;+&lt;/span&gt;&lt;br /&gt;       &lt;span style="color:PURPLE;"&gt;"doesnt understand ServletContext and ServletConfig "&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;       System&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;out&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;println&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="color:PURPLE;"&gt;"CTOR : Servlets are usually instantiated by the servlet "&lt;/span&gt; &lt;span style=";font-size:78%;color:BLUE;"  &gt;+&lt;/span&gt;&lt;br /&gt;       &lt;span style="color:PURPLE;"&gt;"container using the Class.newInstance() method, with no arguments"&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;   &lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt;&lt;br /&gt; &lt;br /&gt;   &lt;span style="color:RED;"&gt;&lt;b&gt;private&lt;/b&gt;&lt;/span&gt; AllAboutServlet&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="color:RED;"&gt;&lt;b&gt;int&lt;/b&gt;&lt;/span&gt; i&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;{&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;       System&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;out&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;println&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="color:PURPLE;"&gt;"Parameterized ctor value  "&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;+&lt;/span&gt;i&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;       System&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;out&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;println&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="color:PURPLE;"&gt;"It is possible to have a custom constructor for a servlet, "&lt;/span&gt; &lt;span style=";font-size:78%;color:BLUE;"  &gt;+&lt;/span&gt;&lt;br /&gt;       &lt;span style="color:PURPLE;"&gt;"so long as you also add a default constructor with no arguments ?? WHY ??"&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;       System&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;out&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;println&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="color:PURPLE;"&gt;"the servlet gets instantiated by the container dynamically"&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;       System&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;out&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;println&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="color:PURPLE;"&gt;"java does not allow to call parametrized constuctor for dynamically "&lt;/span&gt; &lt;span style=";font-size:78%;color:BLUE;"  &gt;+&lt;/span&gt;&lt;br /&gt;       &lt;span style="color:PURPLE;"&gt;"loaded clases"&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;   &lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt;&lt;br /&gt; &lt;br /&gt;   &lt;span style="color:RED;"&gt;&lt;b&gt;public&lt;/b&gt;&lt;/span&gt; &lt;span style="color:RED;"&gt;&lt;b&gt;static&lt;/b&gt;&lt;/span&gt; &lt;span style="color:RED;"&gt;&lt;b&gt;void&lt;/b&gt;&lt;/span&gt; static_method&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;{&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;       System&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;out&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;println&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="color:PURPLE;"&gt;"Can have Static method in servlet .. who can call it ??"&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;       System&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;out&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;println&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="color:PURPLE;"&gt;"Probably no one is stopping other classes to use servlet to"&lt;/span&gt; &lt;span style=";font-size:78%;color:BLUE;"  &gt;+&lt;/span&gt;&lt;br /&gt;       &lt;span style="color:PURPLE;"&gt;"instantiate amnd use it as a normal object "&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;       System&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;out&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;println&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="color:PURPLE;"&gt;"Other classes may even call init() service() and then destroy() "&lt;/span&gt; &lt;span style=";font-size:78%;color:BLUE;"  &gt;+&lt;/span&gt;&lt;br /&gt;       &lt;span style="color:PURPLE;"&gt;"that wont make it servlet.. unless container call"&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;       System&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;out&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;println&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="color:PURPLE;"&gt;"Only container can use servlet class as a servlet "&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;   &lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt;  &lt;br /&gt;&lt;br /&gt;   &lt;span style="color:RED;"&gt;&lt;b&gt;public&lt;/b&gt;&lt;/span&gt; &lt;span style="color:RED;"&gt;&lt;b&gt;void&lt;/b&gt;&lt;/span&gt; init&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;ServletConfig config&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt; &lt;span style="color:RED;"&gt;&lt;b&gt;throws&lt;/b&gt;&lt;/span&gt; ServletException &lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;{&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;       System&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;out&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;println&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="color:PURPLE;"&gt;"INIT : Servlet init called .. now java object turns servlet .. "&lt;/span&gt; &lt;span style=";font-size:78%;color:BLUE;"  &gt;+&lt;/span&gt;&lt;br /&gt;       &lt;span style="color:PURPLE;"&gt;"understands ServletContext and ServletConfig"&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;       System&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;out&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;println&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="color:PURPLE;"&gt;"INIT : perform one-time expensive operations, such as acquiring "&lt;/span&gt; &lt;span style=";font-size:78%;color:BLUE;"  &gt;+&lt;/span&gt;&lt;br /&gt;       &lt;span style="color:PURPLE;"&gt;"thread-safe resource acquisition mechanisms "&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;       &lt;span style="color:GREEN;"&gt;&lt;i&gt;// One effective use of the Servlet init method is the creation and caching of&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;        &lt;span style="color:GREEN;"&gt;&lt;i&gt;// thread-safe resource acquisition mechanisms, such as JDBC DataSources, EJB Homes,&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;        &lt;span style="color:GREEN;"&gt;&lt;i&gt;// and Web Services SOAP Mapping Registry. use this for caching data ...&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;        &lt;span style="color:RED;"&gt;&lt;b&gt;super&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;init&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;config&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;       &lt;span style="color:GREEN;"&gt;&lt;i&gt;// COMPULSORY the abstract superclass implementation of the method in GenericServlet&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;        &lt;span style="color:GREEN;"&gt;&lt;i&gt;// stores the servlet configuration object.&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;       &lt;span style="color:GREEN;"&gt;&lt;i&gt;// If an exception is thrown in your init(ServletConfig) method, it may be appropriate&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;        &lt;span style="color:GREEN;"&gt;&lt;i&gt;// to use the destroy() method to help handle the case. If so, you should still throw&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;        &lt;span style="color:GREEN;"&gt;&lt;i&gt;// a ServletException to ensure the servlet is not put into service in this state.&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;    &lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;   &lt;span style="color:RED;"&gt;&lt;b&gt;public&lt;/b&gt;&lt;/span&gt; &lt;span style="color:RED;"&gt;&lt;b&gt;void&lt;/b&gt;&lt;/span&gt; doGet&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;HttpServletRequest request&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;,&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;                     HttpServletResponse response&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt; &lt;span style="color:RED;"&gt;&lt;b&gt;throws&lt;/b&gt;&lt;/span&gt; ServletException&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;,&lt;/b&gt;&lt;/span&gt; IOException &lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;{&lt;/b&gt;&lt;/span&gt;response&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;setContentType&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;CONTENT_TYPE&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;       PrintWriter out &lt;span style=";font-size:78%;color:BLUE;"  &gt;=&lt;/span&gt; response&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;getWriter&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;       out&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;println&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="color:PURPLE;"&gt;"&amp;lt;html&amp;gt;"&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;       out&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;println&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="color:PURPLE;"&gt;"&amp;lt;head&amp;gt;&amp;lt;title&amp;gt;AllAboutServlet&amp;lt;/title&amp;gt;&amp;lt;/head&amp;gt;"&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;       out&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;println&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="color:PURPLE;"&gt;"&amp;lt;body&amp;gt;"&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;       out&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;println&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="color:PURPLE;"&gt;"&amp;lt;p&amp;gt;The servlet has received a GET. This is the reply.&amp;lt;/p&amp;gt;"&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;       out&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;println&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="color:PURPLE;"&gt;"&amp;lt;/body&amp;gt;&amp;lt;/html&amp;gt;"&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;       out&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;close&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;     &lt;br /&gt;       System&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;out&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;println&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="color:PURPLE;"&gt;"DOGET : doGet called "&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;       System&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;out&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;println&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="color:PURPLE;"&gt;"DOGET : one may call delete() from inside service() ... It will do whatever logic you have in destroy() (cleanup, remove attributes, etc.) but it won't \"&lt;/span&gt;unload\&lt;span style="color:PURPLE;"&gt;" the servlet instance itself"&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;       System&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;out&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;println&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="color:PURPLE;"&gt;""&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;   &lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;   &lt;span style="color:RED;"&gt;&lt;b&gt;public&lt;/b&gt;&lt;/span&gt; &lt;span style="color:RED;"&gt;&lt;b&gt;void&lt;/b&gt;&lt;/span&gt; doPost&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;HttpServletRequest request&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;,&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;                      HttpServletResponse response&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt; &lt;span style="color:RED;"&gt;&lt;b&gt;throws&lt;/b&gt;&lt;/span&gt; ServletException&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;,&lt;/b&gt;&lt;/span&gt; IOException &lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;{&lt;/b&gt;&lt;/span&gt;response&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;setContentType&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;CONTENT_TYPE&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;       PrintWriter out &lt;span style=";font-size:78%;color:BLUE;"  &gt;=&lt;/span&gt; response&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;getWriter&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;       out&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;println&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="color:PURPLE;"&gt;"&amp;lt;html&amp;gt;"&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;       out&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;println&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="color:PURPLE;"&gt;"&amp;lt;head&amp;gt;&amp;lt;title&amp;gt;AllAboutServlet&amp;lt;/title&amp;gt;&amp;lt;/head&amp;gt;"&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;       out&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;println&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="color:PURPLE;"&gt;"&amp;lt;body&amp;gt;"&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;       out&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;println&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="color:PURPLE;"&gt;"&amp;lt;p&amp;gt;The servlet has received a POST. This is the reply.&amp;lt;/p&amp;gt;"&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;       out&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;println&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="color:PURPLE;"&gt;"&amp;lt;/body&amp;gt;&amp;lt;/html&amp;gt;"&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;       out&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;close&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;   &lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;   &lt;span style="color:RED;"&gt;&lt;b&gt;public&lt;/b&gt;&lt;/span&gt; &lt;span style="color:RED;"&gt;&lt;b&gt;void&lt;/b&gt;&lt;/span&gt; doPut&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;HttpServletRequest request&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;,&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;                     HttpServletResponse response&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt; &lt;span style="color:RED;"&gt;&lt;b&gt;throws&lt;/b&gt;&lt;/span&gt; ServletException&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;,&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;                                                          IOException &lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;{&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;   &lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;   &lt;span style="color:RED;"&gt;&lt;b&gt;public&lt;/b&gt;&lt;/span&gt; &lt;span style="color:RED;"&gt;&lt;b&gt;void&lt;/b&gt;&lt;/span&gt; doDelete&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;HttpServletRequest request&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;,&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;                        HttpServletResponse response&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt; &lt;span style="color:RED;"&gt;&lt;b&gt;throws&lt;/b&gt;&lt;/span&gt; ServletException&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;,&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;                                                             IOException &lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;{&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;   &lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt;&lt;br /&gt; &lt;br /&gt;   &lt;span style="color:RED;"&gt;&lt;b&gt;public&lt;/b&gt;&lt;/span&gt; &lt;span style="color:RED;"&gt;&lt;b&gt;void&lt;/b&gt;&lt;/span&gt; destroy&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;{&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;       System&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;out&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;println&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="color:PURPLE;"&gt;"DESTROY : destroy called by contianer .. when is it called ??"&lt;/span&gt; &lt;span style=";font-size:78%;color:BLUE;"  &gt;+&lt;/span&gt;&lt;br /&gt;       &lt;span style="color:PURPLE;"&gt;"When your application is stopped or Servlet Container shuts down "&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;       System&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;out&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;println&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="color:PURPLE;"&gt;"DESTROY : Not when embedded oc4j stopped "&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;       System&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;out&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;println&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="color:PURPLE;"&gt;"DESTROY : destroy() does not imply garbage collection"&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;       System&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;out&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;println&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="color:PURPLE;"&gt;"DESTROY : write the destroy() method and destroy your servlet"&lt;/span&gt; &lt;span style=";font-size:78%;color:BLUE;"  &gt;+&lt;/span&gt;&lt;br /&gt;       &lt;span style="color:PURPLE;"&gt;"because if many servlets running on the same webserver are not destroyed explicitly,"&lt;/span&gt; &lt;span style=";font-size:78%;color:BLUE;"  &gt;+&lt;/span&gt;&lt;br /&gt;       &lt;span style="color:PURPLE;"&gt;"then the performance of the web server falls down"&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;       System&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;out&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;println&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="color:PURPLE;"&gt;"DESTROY : destroy() is not guaranteed to be called... but if it is, "&lt;/span&gt; &lt;span style=";font-size:78%;color:BLUE;"  &gt;+&lt;/span&gt;&lt;br /&gt;       &lt;span style="color:PURPLE;"&gt;"you should make sure it works right"&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;   &lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;   &lt;span style="color:RED;"&gt;&lt;b&gt;public&lt;/b&gt;&lt;/span&gt; &lt;span style="color:RED;"&gt;&lt;b&gt;void&lt;/b&gt;&lt;/span&gt; destroy&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="color:RED;"&gt;&lt;b&gt;int&lt;/b&gt;&lt;/span&gt; i&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;{&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;       System&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;out&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;println&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="color:PURPLE;"&gt;"may overload .. its syntactically ok ... container wont call this..."&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;   &lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt;&lt;br /&gt; &lt;br /&gt;   &lt;span style="color:RED;"&gt;&lt;b&gt;public&lt;/b&gt;&lt;/span&gt; &lt;span style="color:RED;"&gt;&lt;b&gt;void&lt;/b&gt;&lt;/span&gt; point1&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt; &lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;{&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;       System&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;out&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;println&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="color:PURPLE;"&gt;"Is it possible that the servlet container will call destroy()"&lt;/span&gt; &lt;span style=";font-size:78%;color:BLUE;"  &gt;+&lt;/span&gt;&lt;br /&gt;       &lt;span style="color:PURPLE;"&gt;"while the servlet is still processing a request inside service() on a different thread ?"&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;       System&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;out&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;println&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="color:PURPLE;"&gt;"yes, but it's a degenerate case. The servlet container is required"&lt;/span&gt; &lt;span style=";font-size:78%;color:BLUE;"  &gt;+&lt;/span&gt;&lt;br /&gt;       &lt;span style="color:PURPLE;"&gt;"to wait a reasonable amount of time for current requests to finish processing. So if your"&lt;/span&gt; &lt;span style=";font-size:78%;color:BLUE;"  &gt;+&lt;/span&gt;&lt;br /&gt;       &lt;span style="color:PURPLE;"&gt;"request is not totally lagging, it should work out fine. If you're spending more than"&lt;/span&gt; &lt;span style=";font-size:78%;color:BLUE;"  &gt;+&lt;/span&gt;&lt;br /&gt;       &lt;span style="color:PURPLE;"&gt;"a few seconds processing a request, that's a UI problem that you should try to work out first."&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;   &lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;   &lt;span style="color:RED;"&gt;&lt;b&gt;public&lt;/b&gt;&lt;/span&gt; &lt;span style="color:RED;"&gt;&lt;b&gt;void&lt;/b&gt;&lt;/span&gt; point2&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt; &lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;{&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;       &lt;span style="color:GREEN;"&gt;&lt;i&gt;// GenericServlet has methods ... init() destroy() log() getInitParameter() getInitParameterNames()&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;        &lt;span style="color:GREEN;"&gt;&lt;i&gt;// getServletContext() getServletConfig() getServletInfo() getServletName()&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;    &lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;   &lt;span style="color:RED;"&gt;&lt;b&gt;public&lt;/b&gt;&lt;/span&gt; &lt;span style="color:RED;"&gt;&lt;b&gt;void&lt;/b&gt;&lt;/span&gt; point3&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt; &lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;{&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;       &lt;span style="color:GREEN;"&gt;&lt;i&gt;// HttpServlet is declared abstract because the default implementations of the main service methods&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;        &lt;span style="color:GREEN;"&gt;&lt;i&gt;// do nothing and must be overridden&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;    &lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;   &lt;span style="color:RED;"&gt;&lt;b&gt;public&lt;/b&gt;&lt;/span&gt; &lt;span style="color:RED;"&gt;&lt;b&gt;void&lt;/b&gt;&lt;/span&gt; point4&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt; &lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;{&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;       &lt;span style="color:GREEN;"&gt;&lt;i&gt;// The HttpServletRequestWrapper and HttpServletResponseWrapper classes are designed to make it&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;        &lt;span style="color:GREEN;"&gt;&lt;i&gt;// easy for developers to create custom implementations of the servlet request and response types.&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;        &lt;span style="color:GREEN;"&gt;&lt;i&gt;// The classes are constructed with the standard HttpServletRequest and HttpServletResponse instances&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;        &lt;span style="color:GREEN;"&gt;&lt;i&gt;// respectively and their default behaviour is to pass all method calls directly to the underlying&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;        &lt;span style="color:GREEN;"&gt;&lt;i&gt;// objects.&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;    &lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8563220776994779598-6624714391127914753?l=lavnish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lavnish.blogspot.com/feeds/6624714391127914753/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8563220776994779598&amp;postID=6624714391127914753' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/6624714391127914753'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/6624714391127914753'/><link rel='alternate' type='text/html' href='http://lavnish.blogspot.com/2008/05/all-about-servlets-to-put-it-in.html' title='All About Servlets : Run The Servlet'/><author><name>Lavnish</name><uri>http://www.blogger.com/profile/16714741724993845980</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://lh4.google.co.uk/image/lavnishl/RdK3Rnp8q2E/AAAAAAAAAAw/g7LYCh-VN-8/s160-c/Me_ramoji.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8563220776994779598.post-16101848968676854</id><published>2008-05-13T05:21:00.000-07:00</published><updated>2008-05-14T02:01:21.433-07:00</updated><title type='text'>All About Servlets : Introduction</title><content type='html'>&lt;span style=";font-family:times new roman;font-size:100%;"  &gt;&lt;span style="font-weight: bold; color: rgb(51, 102, 255);"&gt;The Servlet Philosophy&lt;/span&gt;&lt;br /&gt;To write a server side program , need two things&lt;br /&gt;&lt;/span&gt;&lt;ol  style="font-family:times new roman;"&gt;&lt;li&gt;&lt;span style="font-size:100%;"&gt;Program at socket level .. handle all the incoming requests&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:100%;"&gt;Program at logical level .. write the correct response to each request&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;span style=";font-family:times new roman;font-size:100%;"  &gt;The Servlet API is based on simple philosophy , letting the programmers concentrate on the second option and taking care of first option by themselves.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(51, 102, 255);"&gt;Load On Startup&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:Verdana,Arial;font-size:100%;"  &gt;The element load-on-startup indicates that this servlet should be loaded (instantiated and have its init() called) on the startup of the Web application. The element content of this element &lt;span style="font-style: italic;"&gt;must be an integer &lt;/span&gt;indicating the order in which the servlet should be loaded.&lt;br /&gt;&lt;/span&gt;&lt;ol  style="font-family:times new roman;"&gt;&lt;li&gt;&lt;span style="font-size:100%;"&gt;If the value is a negative integer, or the element is not present, the container is free to load the servlet whenever it chooses. &lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:100%;"&gt;If the value is a positive integer or 0, the container must load and initialize the servlet as the application is deployed. The container must guarantee that servlets marked with lower integers are loaded before servlets marked with higher integers. The container may choose the order of loading of servlets with the same &lt;/span&gt;&lt;span style="font-size:100%;"&gt;load-on-startup value.&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;span style=";font-family:times new roman;font-size:100%;"  &gt;&lt;span style="font-weight: bold;"&gt;&lt;span style="color: rgb(51, 102, 255);"&gt;When is destroy( ) called ?&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;I could think of following cases...&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;ol  style="font-family:times new roman;"&gt;&lt;li&gt;&lt;span style="font-size:100%;"&gt; When your application is stopped &lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:100%;"&gt;Servlet Container shuts down&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:100%;"&gt;In init( ) method if an exception is thrown&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;span style=";font-family:times new roman;font-size:100%;"  &gt;&lt;span style="font-weight: bold;"&gt;&lt;span style="color: rgb(51, 102, 255);"&gt;What if i call the destroy( ) explicitly&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt;N&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;othing , it will just execute like a normal java method call it wont unload the servlet. The unloading happens only if the Container calls the destroy( ).&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 102, 255);"&gt;From the Spec&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:times new roman;font-size:100%;"  &gt;&lt;br /&gt;The servlet container is not required to keep a servlet loaded for any particular period of time. A servlet instance may be kept active in a servlet container for a period of milliseconds, for the lifetime of the servlet container (which could be a number of days, months, or years), or any amount of time in between.&lt;br /&gt;&lt;br /&gt;When the servlet container determines that a servlet should be removed from service, it calls the destroy method of the Servlet interface to allow the servlet to release any resources it is using and save any persistent state. For example, the container may do this when it wants to conserve memory resources, or when it is being shut down.&lt;br /&gt;&lt;br /&gt;Before the servlet container calls the destroy method, it must allow any threads that are currently running in the service method of the servlet to complete execution, or exceed a server-defined time limit.&lt;br /&gt;&lt;br /&gt;Once the destroy method is called on a servlet instance, the container may not route other requests to that instance of the servlet. If the container needs to enable the servlet again, it must do so with a new instance of the servlet’s class.&lt;br /&gt;&lt;br /&gt;After the destroy method completes, the servlet container must release the servlet instance so that it is eligible for garbage collection.&lt;/span&gt;&lt;span style=";font-family:times new roman;font-size:100%;"  &gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(51, 102, 255);"&gt;Can I use a constructor instead of init(ServletConfig) ?&lt;/span&gt;&lt;br /&gt;Servlet constructor can be overriden .. not be private , protected , nor default The constructor will be called by the container.  In the constructor it doesn't understand classes like ServletContext and ServletConfig.&lt;br /&gt;&lt;br /&gt;It is possible to have a custom constructor for a servlet, so long as you also add a default constructor with no arguments  the servlet gets instantiated by the container dynamically java does not allow to call parametrized constuctor for dynamically loaded clases&lt;br /&gt;&lt;br /&gt;It is possible to have a custom constructor for a servlet, so long as you also add a default constructor with no arguments, but constructors are not called in the standard servlet lifecycle. Servlets are usually instantiated by the servlet container using the Class.newInstance() method, with no arguments. At this point, the servlet has no reference to its configuration or the general servlet context, so it cannot do any useful start-up activity. These configuration references are only available through the init(ServletConfig) method.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(51, 102, 255);"&gt;Why is it necessary to call super.init(config)?&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Programmers are expected to call the super.init(ServletConfig) in the init(ServletConfig) method so that the abstract superclass implementation of the method in GenericServlet stores the servlet configuration object. When the configuration object is stored in this way, the servlet methods getInitParameter(String) and getInitParameterNames() can be called instead of calling the equivalent methods on the configuration object.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(51, 102, 255);"&gt;Should I get my database connection in the init() method?&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The init(ServletConfig) method is only called once when a servlet is brought into service by the servlet container, not for each new servlet thread. If you create a single database connection in the init(ServletConfig) method and use it to all handle servlet requests, &lt;span style="font-style: italic;"&gt;you must ensure all operations are synchronized &lt;/span&gt;or you will get unpredictable results. You must also ensure the connection is closed when the servlet is taken out of service by overriding the servlet's destroy() method.&lt;br /&gt;&lt;br /&gt; Generally it is better to use the init(ServletConfig) method to register the database driver and get a reference to the DriverManager, a DataSource or database connection pool. Then use the connection provider to get a connection for each request within a try/catch block. This way you can handle the case where the connection fails, and ensure that all connections are closed in any case. The close() method of a pooled Connection instance just returns it to the pool.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(51, 102, 255);"&gt;What's the difference between ServletConfig and ServletContext?&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The ServletContext object - represents the context for the whole Web application in which a servlet is deployed, and contains initialisation parameters that are shared amongst all servlets in the application.&lt;br /&gt;The ServletConfig object - represents the configuration for a single specific servlet.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(51, 102, 255);"&gt;How can I load a Properties file for my servlet?&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;There are standard methods for identifying and loading this type of static property set into servlets via the ServletContext object. The primary method is getResourceAsStream(String path), which opens an InputStream to the path given in the argument. The path must begin with a forward slash, /, and is relative to the context root, so for instance you might use the path:&lt;br /&gt; /WEB-INF/servlet.properties&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(51, 102, 255);"&gt;Is it possible to overload the destroy() method?&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Any Java method may be overloaded, but the overloaded version will not be called directly by a servlet container's lifecycle methods. The servlet container expects all servlets to have a standard no argument destroy() method, so your servlet is safe to use destroy methods with other signatures.&lt;br /&gt;&lt;pre&gt;    &lt;span style="color:RED;"&gt;&lt;b&gt;public&lt;/b&gt;&lt;/span&gt; &lt;span style="color:RED;"&gt;&lt;b&gt;void&lt;/b&gt;&lt;/span&gt; destroy&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="color:RED;"&gt;&lt;b&gt;final&lt;/b&gt;&lt;/span&gt; String arg&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt; &lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;{&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;   &lt;span style="color:GREEN;"&gt;&lt;i&gt;// Overloaded method body&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;    &lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(51, 102, 255);"&gt;Can I call destroy() from the service() method ?&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The destroy() method has a special significance in the servlet lifecycle when it is called by the servlet container, but is a normal method in all other respects. If you have a typical destroy() method that does servlet clean-up work before the servlet is taken out of service, it is difficult to imagine why you would want to call it from the service() method, though it is possible. Normally, you should handle service requests by overriding the relevant doGet() or doPost() method.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(51, 102, 255);"&gt;What happens if I call destroy() from init() ?&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;If the destroy() method is called from the init(ServletConfig) method, whatever statements are contained in the method will be executed and the method will return, it will not affect the lifecycle status of the servlet from the container's point of view. If the init(ServletConfig) method returns without exception, the servlet container will put the servlet into service regardless.&lt;br /&gt;&lt;br /&gt; If an exception is thrown in your init(ServletConfig) method, it may be appropriate to use the destroy() method to help handle the case. If so, you should still throw a ServletException to ensure the servlet is not put into service in this state.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(51, 102, 255);"&gt;Can have Static method in Servlet .. If yes , who can call it ??&lt;/span&gt;&lt;br /&gt;Probably no one is stopping other classes to use servlet to instantiate and use it as a normal object  Other classes may even call init() service() and then destroy() that wont make a java object a servlet.. unless container calls the same methods Only container can use java class as a servlet.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; font-style: italic; color: rgb(51, 102, 255);"&gt;Summary&lt;br /&gt;&lt;/span&gt;&lt;span style="font-style: italic; color: rgb(51, 102, 255);"&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;To sum up basically a Servlet first becomes a Java object and then a Servlet. I mean a container will first make a Java Object then convert it to Servlet Instance.&lt;br /&gt;&lt;br /&gt;You can very well use this as a java object ( in case you call destroy( ) from init( ) etc) but it wont effect the lifeCycle of a servlet. Life cycle of servlet is decided and executed by container servlets cant manage / change their own life cycle by calling there methods.&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-weight: bold; font-style: italic; color: rgb(51, 102, 255);"&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8563220776994779598-16101848968676854?l=lavnish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lavnish.blogspot.com/feeds/16101848968676854/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8563220776994779598&amp;postID=16101848968676854' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/16101848968676854'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/16101848968676854'/><link rel='alternate' type='text/html' href='http://lavnish.blogspot.com/2008/05/all-about-servlets-introduction.html' title='All About Servlets : Introduction'/><author><name>Lavnish</name><uri>http://www.blogger.com/profile/16714741724993845980</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://lh4.google.co.uk/image/lavnishl/RdK3Rnp8q2E/AAAAAAAAAAw/g7LYCh-VN-8/s160-c/Me_ramoji.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8563220776994779598.post-5443267019572082410</id><published>2008-05-10T02:05:00.000-07:00</published><updated>2008-05-19T06:28:27.038-07:00</updated><title type='text'>Flex 2 : Intro</title><content type='html'>One might think why blog about Flex2 .. when Flex 3 is out ?&lt;br /&gt;well even i dont know why ? all i can say is ... I like flex so thought need to start somewhere !&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;FLEX&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Flex application take advantage of Flash player 9 runtime environment ( which inturn supports  3 ) Flex application can also interact with Javascript.&lt;br /&gt;&lt;br /&gt;Flex 2 SDK consists of&lt;br /&gt;&lt;ol&gt;&lt;li&gt;the Flex framework (class library)&lt;/li&gt;&lt;li&gt;the Flex compilers,&lt;/li&gt;&lt;li&gt;the debugger,&lt;/li&gt;&lt;li&gt;the MXML&lt;/li&gt;&lt;li&gt;ActionScript programming languages&lt;/li&gt;&lt;li&gt;other utilities.&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;Flex applications consist of MXML ( set up the UI ) and ActionScript source files&lt;br /&gt;&lt;ol&gt;&lt;li style="font-weight: bold;"&gt;MXML is used for&lt;/li&gt;&lt;ol&gt;&lt;li&gt;Visual components - set up UI&lt;/li&gt;&lt;li&gt;Non visual components - acess network based components ( like webservice )                              server based resorces ( flex data service ) bindings ( between UI &amp;amp; data )&lt;/li&gt;&lt;/ol&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;ActionScript&lt;/span&gt; - provides flowcontrol and object manupilation features&lt;/li&gt;&lt;/ol&gt;Flex applications do not directly connect to a database, you use other tools and services&lt;br /&gt;such as PHP, ASP, JSP, Web services, Flex Data Services, ColdFusion Flash Remoting Services,&lt;br /&gt;and so on.&lt;br /&gt;&lt;br /&gt;The Flex platform supports a range of deployment models:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Client-side only Applications run on the client and use no server resources.&lt;/li&gt;&lt;li&gt;Access server data through simple RPC services  - Applications interact with remote data through web services and HTTP services. The Flex HTTPService and WebService tags let you retrieve data from a remote server  For security, by default Flash Player does not allow an application to access a remote data source from a domain other than   the domain from which the application was served. Therefore, a remote server must either be in the same domain as the server  hosting your application, or the remote server must define a crossdomain.xml file.&lt;/li&gt;&lt;li&gt;Flex Data Services - used to provide advanced features, such as data synchronization, security, and messaging.&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;Flex supports two versions of Flash Player&lt;br /&gt;&lt;ol&gt;&lt;li&gt;standard flash player&lt;/li&gt;&lt;li&gt;debug flash player&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Some questions i couldnt answer &lt;/span&gt;&lt;br /&gt;doesnt Flex use Http request / response at low level ? if yes then how ?&lt;br /&gt;if yes why is it so fast than JSF etc ? may be because of Flash player ??&lt;br /&gt;&lt;br /&gt;May be when i read more will be able to do so&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Interesting Link&lt;/span&gt;&lt;br /&gt;&lt;a href="http://coenraets.org/testdrive/flex4j/index.htm"&gt;http://coenraets.org/testdrive/flex4j/index.htm&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8563220776994779598-5443267019572082410?l=lavnish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lavnish.blogspot.com/feeds/5443267019572082410/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8563220776994779598&amp;postID=5443267019572082410' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/5443267019572082410'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/5443267019572082410'/><link rel='alternate' type='text/html' href='http://lavnish.blogspot.com/2008/05/flex-2-intro.html' title='Flex 2 : Intro'/><author><name>Lavnish</name><uri>http://www.blogger.com/profile/16714741724993845980</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://lh4.google.co.uk/image/lavnishl/RdK3Rnp8q2E/AAAAAAAAAAw/g7LYCh-VN-8/s160-c/Me_ramoji.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8563220776994779598.post-1378586341358182858</id><published>2008-05-08T11:06:00.000-07:00</published><updated>2008-05-08T11:08:25.842-07:00</updated><title type='text'>Object.hashcode VS System.identityHashCode</title><content type='html'>basically  System.identityHashCode (Object) always returns different values for different objects&lt;br /&gt;Its declared as public static int identityHashCode(Object x)&lt;br /&gt;&lt;br /&gt;The hash code for the null reference is zero.&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;// FileName Test.java&lt;br /&gt;class HashCodeTest&lt;br /&gt;{&lt;br /&gt;    int number;&lt;br /&gt;    public HashCodeTest(int i)&lt;br /&gt;    { this.number=i;}&lt;br /&gt;&lt;br /&gt;    public int hashCode() { return this.number; }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public class Test&lt;br /&gt;{&lt;br /&gt;    public static void main(String[] args)&lt;br /&gt;    {&lt;br /&gt;        String s1="Namaste"; String s2 = s1;&lt;br /&gt;        System.out.println("s1 "+ s1 + " s2 "+ s2);&lt;br /&gt;        System.out.println("System.identityHashCode(s1)"  + System.identityHashCode(s1));&lt;br /&gt;        System.out.println("System.identityHashCode(s2) "+ System.identityHashCode(s2));&lt;br /&gt;        s1=s1 + " World";&lt;br /&gt;        System.out.println(" s1 "+ s1 + " s2 " + s2);&lt;br /&gt;        System.out.println("System.identityHashCode(s1) " + System.identityHashCode(s1));&lt;br /&gt;        System.out.println("System.identityHashCode(s2) "+ System.identityHashCode(s2));&lt;br /&gt;&lt;br /&gt;        HashCodeTest o1 = new HashCodeTest(5);&lt;br /&gt;        HashCodeTest o2 = new HashCodeTest(5);&lt;br /&gt;&lt;br /&gt;        System.out.println("");&lt;br /&gt;        System.out.println("First Object : " + o1);&lt;br /&gt;        System.out.println("Second Object : " + o2);&lt;br /&gt;        System.out.println("System.identityHashCode(First_Object) : " + System.identityHashCode(o1));&lt;br /&gt;        System.out.println("System.identityHashCode(Second_Object) : " + System.identityHashCode(o2));&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;the output was something like&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;s1 Namaste s2 Namaste&lt;br /&gt;System.identityHashCode(s1)1671711&lt;br /&gt;System.identityHashCode(s2) 1671711&lt;br /&gt; s1 Namaste World s2 Namaste&lt;br /&gt;System.identityHashCode(s1) 11394033&lt;br /&gt;System.identityHashCode(s2) 1671711&lt;br /&gt;&lt;br /&gt;First Object : HashCodeTest@5&lt;br /&gt;Second Object : HashCodeTest@5&lt;br /&gt;System.identityHashCode(First_Object) : 4384790&lt;br /&gt;System.identityHashCode(Second_Object) : 9634993&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8563220776994779598-1378586341358182858?l=lavnish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lavnish.blogspot.com/feeds/1378586341358182858/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8563220776994779598&amp;postID=1378586341358182858' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/1378586341358182858'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/1378586341358182858'/><link rel='alternate' type='text/html' href='http://lavnish.blogspot.com/2008/05/objecthashcode-vs-systemidentityhashcod.html' title='Object.hashcode VS System.identityHashCode'/><author><name>Lavnish</name><uri>http://www.blogger.com/profile/16714741724993845980</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://lh4.google.co.uk/image/lavnishl/RdK3Rnp8q2E/AAAAAAAAAAw/g7LYCh-VN-8/s160-c/Me_ramoji.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8563220776994779598.post-8799375669590984339</id><published>2008-05-08T11:05:00.000-07:00</published><updated>2008-05-08T11:06:13.655-07:00</updated><title type='text'>String.split( ) VS stringTokenizer</title><content type='html'>tring.split() was introduced in jdk 1.4'&lt;br /&gt;&lt;br /&gt;For one thing, StringTokenizer returns one substring at a time whereas the split method returns an array of substrings.&lt;br /&gt;Best to use String's split(...) method. The StringTokenizer class is a legacy class (NOT deprecated)&lt;br /&gt;&lt;br /&gt;By default, StringTokenizer uses whitespace to delimit tokens, and if there are two or more delimiter characters&lt;br /&gt;in a row, it collapses them into one delimiter. So the split() equivalent would be&lt;br /&gt;&lt;br /&gt;  String[] result = "this is a test".split("\\s+");&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;But if you really want to treat each character as a separate delimiter, you just remove the plus sign again.&lt;br /&gt;This is, in my opinion, the best reason to choose split(); while there is a way to do single-character delimiters in StringTokenizer, it's kludgy and awkward.&lt;br /&gt;&lt;br /&gt;And yes, StringTokenizer is inherently faster,&lt;br /&gt;&lt;br /&gt;StringTokenizer can split strings based on single characters, split() takes regular expressions.&lt;br /&gt;I imagine that might make split() a bit slower when splitting for single characters (can't be arsed to test it&lt;br /&gt;though), but usually it's more handy.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8563220776994779598-8799375669590984339?l=lavnish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lavnish.blogspot.com/feeds/8799375669590984339/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8563220776994779598&amp;postID=8799375669590984339' title='7 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/8799375669590984339'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/8799375669590984339'/><link rel='alternate' type='text/html' href='http://lavnish.blogspot.com/2008/05/stringsplit-vs-stringtokenizer.html' title='String.split( ) VS stringTokenizer'/><author><name>Lavnish</name><uri>http://www.blogger.com/profile/16714741724993845980</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://lh4.google.co.uk/image/lavnishl/RdK3Rnp8q2E/AAAAAAAAAAw/g7LYCh-VN-8/s160-c/Me_ramoji.jpg'/></author><thr:total>7</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8563220776994779598.post-2596414634375878547</id><published>2008-05-05T01:32:00.000-07:00</published><updated>2008-05-05T01:37:17.469-07:00</updated><title type='text'>Business WebService VS Normal WebService</title><content type='html'>Business WebService demands the following extra features&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Security - Obvious&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Context - when one webservice needs to call another can pass security context need to pass extra context parameter.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Transactions - Business Transaction Protocol can help us manage it&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Process Flow - Controlling the process Flow&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8563220776994779598-2596414634375878547?l=lavnish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lavnish.blogspot.com/feeds/2596414634375878547/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8563220776994779598&amp;postID=2596414634375878547' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/2596414634375878547'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/2596414634375878547'/><link rel='alternate' type='text/html' href='http://lavnish.blogspot.com/2008/05/business-webservice-vs-normal.html' title='Business WebService VS Normal WebService'/><author><name>Lavnish</name><uri>http://www.blogger.com/profile/16714741724993845980</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://lh4.google.co.uk/image/lavnishl/RdK3Rnp8q2E/AAAAAAAAAAw/g7LYCh-VN-8/s160-c/Me_ramoji.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8563220776994779598.post-4690686247400718494</id><published>2008-05-01T05:04:00.000-07:00</published><updated>2008-05-01T05:06:19.066-07:00</updated><title type='text'>SOAP</title><content type='html'>SOAP - Stands for Simple Object Access Protocol&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-style: italic;"&gt;Simple&lt;/span&gt; - transport accross HTTP using Http (mime) and SMTP headers using XML. So is XML simple ? It can be as simple or complex u want it to be. Is MIME simple? It is simple only because it uses a data formatting convention that is already in widespread use, is familiar to most IT people, and is conceptually understood by less technical people.&lt;/li&gt;&lt;li&gt;&lt;span style="font-style: italic;"&gt;Object&lt;/span&gt; - has to do with ways of accessing object&lt;/li&gt;&lt;li&gt;&lt;span style="font-style: italic;"&gt;Access&lt;/span&gt; - A key feature of SOAP and web services is their accessibility. Possible to create SOAP binding for almost any protocol.&lt;/li&gt;&lt;li&gt;&lt;span style="font-style: italic;"&gt;Protocol&lt;/span&gt; - Its a rule.&lt;/li&gt;&lt;/ul&gt;SOAP messages are fundamentally one-way transmissions from a SOAP sender to a SOAP receiver; however, SOAP messages are often combined to implement patterns such as request/response.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;whats the use and difference beween xsi and xsd namespace used in SOAP ??&lt;/span&gt;&lt;br /&gt;for example xsi:type , and from xsd you get xsd:string or xsd:boolean&lt;br /&gt;&lt;br /&gt;Http has a SOAPAction header.&lt;br /&gt;&lt;br /&gt;Its easy to write a program that reads XML document and and wraps it inside SOAP message and send to URL. The class org.apache.soap.Envelope ( extends Lang.Object ) has a default constructor. Similarly org.apache.soap.Body has default constructor and method setBodyEntries(java.util.Vector).&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;// Build the Message.&lt;br /&gt;org.apache.soap.messaging.Message msg = new org.apache.soap.messaging.Message( );&lt;br /&gt;msg.send (new java.net.URL(m_hostURL), URI, envelope);&lt;br /&gt;org.apache.soap.transport.SOAPTransport st = msg.getSOAPTransport ( );&lt;br /&gt;BufferedReader br = st.receive ( );&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8563220776994779598-4690686247400718494?l=lavnish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lavnish.blogspot.com/feeds/4690686247400718494/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8563220776994779598&amp;postID=4690686247400718494' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/4690686247400718494'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/4690686247400718494'/><link rel='alternate' type='text/html' href='http://lavnish.blogspot.com/2008/05/soap.html' title='SOAP'/><author><name>Lavnish</name><uri>http://www.blogger.com/profile/16714741724993845980</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://lh4.google.co.uk/image/lavnishl/RdK3Rnp8q2E/AAAAAAAAAAw/g7LYCh-VN-8/s160-c/Me_ramoji.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8563220776994779598.post-6345046497212598674</id><published>2008-05-01T03:17:00.000-07:00</published><updated>2008-05-01T03:22:56.896-07:00</updated><title type='text'>JAXB</title><content type='html'>How do you access and use an XML document  through the Java ? Two ways&lt;br /&gt;&lt;ol&gt;&lt;li&gt;JAXP - Use Java API for XML Processing (JAXP) ( ie either SAX or DOM )&lt;/li&gt;&lt;li&gt;JAXB -  Java Architecture for XML Binding (JAXB)&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;we can modify the second way as two step process&lt;br /&gt;&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Bind the Schema for XML document into a set of Java classes ( and interface ) that represents the schema. All JAXB implementations provide a tool called a binding compiler to bind a schema (the way the binding compiler is invoked can be implementation-specific).&lt;/li&gt;&lt;li&gt;Unmarshal the document into Java content objects. Unmarshalling an XML document means creating a tree of content objects that represents the content and organization of the document. The content tree is not a DOM-based tree. In fact, content trees produced through JAXB can be more efficient in terms of memory use than DOM-based trees.&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;The binding framework comprises three packages. The primary package, javax.xml.bind, contains classes and interfaces for performing operations such as unmarshalling, marshalling, and validation (marshalling and validation will be covered later). A second package, javax.xml.bind.util, contains a number of utility classes. The third package, javax.xml.bind.helper, is designed for JAXB implementation providers.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-size:130%;" &gt;&lt;span style="font-family:webdings;"&gt;(1) Get Classes from XML&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;To unmarshal an XML document, you:&lt;br /&gt;&lt;br /&gt;Create a JAXBContext object. This object provides the entry point to the JAXB API. When you create the object, you need to specify a context path. This is a list of one or more package names that contain interfaces generated by the binding compiler. By allowing multiple package names in the context path, JAXB allows you to unmarshal a combination of XML data elements that correspond to different schemas.&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;import javax.xml.bind.JAXBContext;&lt;br /&gt;JAXBContext jc = JAXBContext.newInstance("test.jaxb");&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Create an Unmarshaller object.&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;import javax.xml.bind.Unmarshaller;&lt;br /&gt;Unmarshaller unmarshaller = jc.createUnmarshaller();&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Call the unmarshal method&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;unmarshaller.setValidating(true);// validate source data against schema&lt;br /&gt;Collection collection= (Collection)unmarshaller.unmarshal(new File( "books.xml"));&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Here the Collection is the base xml element &lt;collection&gt; not java.util.Collection&lt;br /&gt;&lt;br /&gt;Use the get methods in the schema-derived classes to access the XML data.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;you can unmarshal XML data from other input sources such as an InputStream object, a URL, or a DOM node. You can even unmarshal transformed XML data.&lt;br /&gt;&lt;br /&gt;JAXB also allows you to access XML data without having to unmarshal it. One of the classes generated from a schema, ObjectFactory, contains methods to generate objects for each of the schema-derived interfaces and classes. For example, ObjectFactory class that has methods such as createElement_Name to create a object corresponding to Node in the XML document. You can use these methods to create a tree of content objects without doing any unmarshalling. All your program needs is access to the ObjectFactory class that's in the package for the pertinent schema. Then you can use the appropriate methods in the ObjectFactory class to create the objects you need. After you create the objects, you need to provide their content. To do that, you use the set methods in the objects.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-size:130%;" &gt;(2) Write XML from Classes&lt;/span&gt;&lt;br /&gt;you would:&lt;br /&gt;&lt;br /&gt;   * Bind the schema for the XML document (if it isn't already bound - same as above)&lt;br /&gt;   * Create the content tree.&lt;br /&gt;   &lt;/collection&gt;&lt;pre&gt;&lt;br /&gt;   ObjectFactory objFactory = new ObjectFactory();&lt;br /&gt;   Collection collection=(Collection) objFactory.createCollection(); // collection is element name&lt;br /&gt;   Collection.BooksType booksType = objFactory.createCollectionTypeBooksType(); // books is element name ( acts as a conatiner )&lt;br /&gt;   BookType book = objFactory.createBookType(); // its a element name&lt;br /&gt;   &lt;/pre&gt;&lt;br /&gt;    Then use set methods in the created objects to specify data values. For example:&lt;br /&gt;    &lt;pre&gt;&lt;br /&gt;       book.setItemId("307");&lt;br /&gt;       book.setName("JAXB today and beyond");&lt;br /&gt;    &lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;   * Marshal the content tree into the XML document.&lt;br /&gt;   &lt;pre&gt;&lt;br /&gt;   import javax.xml.bind.JAXBContext;&lt;br /&gt;   import javax.xml.bind.Marshaller;&lt;br /&gt;   // step 1 - create context&lt;br /&gt;   JAXBContext jaxbContext = JAXBContext.newInstance("test.jaxb");&lt;br /&gt;   // step 2 - create marshaller&lt;br /&gt;   Marshaller marshaller = jaxbContext.createMarshaller();&lt;br /&gt;   marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT,new Boolean(true));&lt;br /&gt;   // step 3 - call marshal&lt;br /&gt;   marshaller.marshal(collection,new FileOutputStream("jaxbOutput.xml"));&lt;br /&gt;   &lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;   Notice that validation is not performed as part of the marshalling operation. In other words, unlike the case for unmarshalling, there is no setValidating method for marshalling. Instead, when marshalling data, you use the Validator class that is a part of the binding framework to validate a content tree against a schema. For example:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;import javax.xml.bind.Validator;&lt;br /&gt;&lt;br /&gt;Validator validator = jaxbContext.createValidator();&lt;br /&gt;validator.validate(collection))&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-size:130%;" &gt;&lt;br /&gt;(3) Updating XML document&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;References&lt;br /&gt;&lt;a href="http://java.sun.com/developer/technicalArticles/WebServices/jaxb/"&gt;http://java.sun.com/developer/technicalArticles/WebServices/jaxb/&lt;/a&gt;&lt;br /&gt;&lt;a href="http://wiki.java.net/bin/view/Javawsxml/JaxbArticles"&gt;http://wiki.java.net/bin/view/Javawsxml/JaxbArticles&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8563220776994779598-6345046497212598674?l=lavnish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lavnish.blogspot.com/feeds/6345046497212598674/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8563220776994779598&amp;postID=6345046497212598674' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/6345046497212598674'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/6345046497212598674'/><link rel='alternate' type='text/html' href='http://lavnish.blogspot.com/2008/05/jaxb.html' title='JAXB'/><author><name>Lavnish</name><uri>http://www.blogger.com/profile/16714741724993845980</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://lh4.google.co.uk/image/lavnishl/RdK3Rnp8q2E/AAAAAAAAAAw/g7LYCh-VN-8/s160-c/Me_ramoji.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8563220776994779598.post-2043014064008602945</id><published>2008-05-01T02:17:00.000-07:00</published><updated>2008-05-01T02:33:25.370-07:00</updated><title type='text'>Java Annotations</title><content type='html'>&lt;span style="font-weight: bold;"&gt;Annotations in General&lt;/span&gt;&lt;br /&gt;Basically it is the Metadata a syntactitcal way of adding metadata to source doe&lt;br /&gt;Differences in computer languages have given rise to a variety of words for programmer-added metadata, including annotation (Java, Python), attribute (C#), pragma (C), and metadata (HTML).&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Java Annotations&lt;/span&gt;&lt;br /&gt;Annotations provide data about a program that is not part of the program itself. They have no direct effect on the operation of the code they annotate.Annotations are modifiers you can add to your code and apply to package declarations, type declarations, constructors, methods, fields, parameters, and variables.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.jcp.org/en/jsr/detail?id=175"&gt;JSR 175&lt;/a&gt;, A Metadata Facility for the Java Programming Language, gives more details on it.&lt;br /&gt;&lt;br /&gt;The Interface &lt;span style="font-style: italic;"&gt;java.lang.annotation.Annotation&lt;/span&gt;  is extended by all annotation types. Note that an interface that manually extends this one does not define an annotation type. Also note that this interface does not itself define an annotation type.&lt;br /&gt;&lt;br /&gt;J2SE 5 comes with following  prebuilt annotations...&lt;br /&gt;&lt;br /&gt;(1)&lt;span style="font-style: italic;"&gt; java.lang.Overrides&lt;/span&gt; - If a method is decorated with this annotation type but does not override a superclass method, then the compiler will generate an error message... may be if one gives incorrect argument type then function will be overloaded so its better use this.&lt;br /&gt;Should be used only on methods (not on classes, package declarations, or other constructs)&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;@Override&lt;br /&gt;   interface Closable {&lt;br /&gt;       void close();&lt;br /&gt;   }&lt;br /&gt;&lt;br /&gt;   class File implements Closable {&lt;br /&gt;       @Override&lt;br /&gt;       public void close() {&lt;br /&gt;           //... close this file...&lt;br /&gt;       }&lt;br /&gt;   }&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;The compiler generates an error complaining that File.close doesn't override any method from its superclass. This is because it is not overriding Closable.close, it is implementing it!&lt;br /&gt;&lt;br /&gt;While it's not required to use this annotation when overriding a method, it helps to prevent errors. If a method marked with @Override fails to correctly override a method in one of its superclasses, the compiler generates an error.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;(2) java.lang.annotation.Documented&lt;br /&gt;This annotation indicates that the annotation to which this is applied is to be documented by javadoc and similar tools. Note that this annotation is just a hint, and a tool can ignore the annotation if it desires to do so.&lt;br /&gt;&lt;br /&gt;(3) &lt;span style="font-style: italic;"&gt;java.lang.Deprecated&lt;/span&gt;&lt;br /&gt;This annotation provides a hint to the Java compiler to warn users if they use the class, method, or field annotated with this annotation.&lt;br /&gt;When an element is deprecated, it should also be documented using the Javadoc @deprecated tag, as shown in the following example. The use of the "@" symbol in both Javadoc comments and in annotations is not coincidental—they are related conceptually. Also, note that the Javadoc tag starts with a lowercase "d" and the annotation starts with an uppercase "D".&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;      // Javadoc comment follows&lt;br /&gt;       /**&lt;br /&gt;        * @deprecated&lt;br /&gt;        * explanation of why it was deprecated&lt;br /&gt;        */&lt;br /&gt;       @Deprecated&lt;br /&gt;       static void deprecatedMethod() { }&lt;br /&gt;   }&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;(4) &lt;span style="font-style: italic;"&gt;java.lang.annotation.Inherited&lt;/span&gt;&lt;br /&gt;Indicates that an annotation type is automatically inherited. If an Inherited meta-annotation is present on an annotation type declaration, and the user queries the annotation type on a class declaration, and the class declaration has no annotation for this type, then the class's superclass will automatically be queried for the annotation type. This process will be repeated until an annotation for this type is found, or the top of the class hierarchy (Object) is reached. If no superclass has an annotation for this type, then the query will indicate that the class in question has no such annotation.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;(5) &lt;span style="font-style: italic;"&gt;java.lang.annotation.Retention&lt;/span&gt;&lt;br /&gt;The Retention annotation takes a single parameter that determines the decorated annotation's availability. The values of this parameter are:&lt;br /&gt;&lt;br /&gt;&lt;ol&gt;&lt;li&gt;    RetentionPolicy.SOURCE: The decorated annotation is available at the source code level only&lt;/li&gt;&lt;li&gt;    RetentionPolicy.CLASS: The decorated annotation is available in the source code and compiled class file, but is not loaded into the JVM at runtime&lt;/li&gt;&lt;li&gt;    RetentionPolicy.RUNTIME: The decorated annotation is available in the source code, the compiled class file, and is also loaded into the JVM at runtime&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;By default, all annotations are available at the source level only.&lt;br /&gt;&lt;br /&gt;(6) &lt;span style="font-style: italic;"&gt;java.lang.annotation.Target&lt;/span&gt;&lt;br /&gt;This annotation is used to indicate the type of program element (such as a class, method, or field) to which the declared annotation is applicable. If the Target annotation is not present on an annotation type declaration, then the declared type may be used on any program element. If the Target annotation is present, then the compiler will enforce the specified usage restriction. Legal values for the Target annotation are contained in the java.lang.annotation.ElementType enumeration.&lt;br /&gt;&lt;br /&gt;(7) &lt;span style="font-style: italic;"&gt;SuppressWarnings&lt;/span&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;@SuppressWarnings("deprecation")&lt;br /&gt;       void useDeprecatedMethod() {&lt;br /&gt;           objectOne.deprecatedMethod(); //deprecation warning - suppressed&lt;br /&gt;       }&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Every compiler warning belongs to a category. The Java Language Specification lists two categories: "deprecation" and "unchecked." The "unchecked" warning can occur when interfacing with legacy code written before the advent of generics (discussed in the lesson titled "Generics"). To suppress more than one category of warnings, use the following syntax:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;   @SuppressWarnings({"unchecked", "deprecation"})&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;consider the following code:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt; int a;&lt;br /&gt; Object object = new Object();&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;I declared two variables and did nto use them in my code. When I compiled the code, I got 2 warnings:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;The local variable a is never read&lt;br /&gt;The local variable object is never read&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;To remove the warnings, I will use the @SuppressWarnings annotation.&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;@SuppressWarnings("unused")&lt;br /&gt;Object object = new Object();&lt;br /&gt;@SuppressWarnings("unused")&lt;br /&gt;int a;&lt;br /&gt;&lt;br /&gt;// Suppress warnings about missing serialVersionUID&lt;br /&gt;  @SuppressWarnings( "serial" ) public void myMethod1()&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Note that  @SuppressWarnings(value={"unchecked"}) is same as @SuppressWarnings("unchecked")&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Assertion Exception&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;AnnotationTypeMismatchException&lt;/span&gt;&lt;br /&gt;Its a runtime exception. Thrown to indicate that a program has attempted to access an element of an annotation whose type has changed after the annotation was compiled (or serialized).&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;IncompleteAnnotationException &lt;/span&gt;&lt;br /&gt;Its a  RuntimeException&lt;br /&gt;Thrown to indicate that a program has attempted to access an element of an annotation type that was added to the annotation type definition after the annotation was compiled (or serialized). This exception will not be thrown if the new element has a default value.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Custom Annotation&lt;/span&gt;&lt;br /&gt;From Structure point of view Annotations fall into three basic categories:&lt;br /&gt;&lt;br /&gt;   * Marker annotations have no variables. The annotation simply appears, identified by name, with no additional data supplied. For example, @MarkerAnnotation is a marker annotation. It includes no data, just the annotation name.&lt;br /&gt;   An annotation type with no elements is termed a marker annotation type, for example:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;   /**&lt;br /&gt;    * Indicates that the specification of the annotated API element&lt;br /&gt;    * is preliminary and subject to change.&lt;br /&gt;    */&lt;br /&gt;   public @interface Preliminary { }&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;It is permissible to omit the parentheses in marker annotations, as shown below:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;   @Preliminary public class TimeTravel { ... }&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;   * Single-value annotations are similar to markers, but provide a single piece of data. Because only a single bit of data is supplied, you can use a shortcut syntax (assuming the annotation type is defined to accept this syntax): @SingleValueAnnotation("my data"). This should look a lot like a normal Java method call, aside from the @ sign.&lt;br /&gt;&lt;br /&gt;   In annotations with a single element, the element should be named value, as shown below:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;   /**&lt;br /&gt;    * Associates a copyright notice with the annotated API element.&lt;br /&gt;    */&lt;br /&gt;   public @interface Copyright {&lt;br /&gt;       String value();&lt;br /&gt;   }&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;It is permissible to omit the element name and equals sign (=) in a single-element annotation whose element name is value, as shown below:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;   @Copyright("2002 Yoyodyne Propulsion Systems")&lt;br /&gt;   public class OscillationOverthruster { ... }&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;   * Full annotations have multiple data members. As a result, you must use a fuller syntax (and the annotation doesn't look quite so much like a normal Java method anymore):&lt;br /&gt;&lt;pre&gt; @FullAnnotation(var1="data value 1", var2="data value 2", var3="data value 3"). &lt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;   @interface ClassPreamble {&lt;br /&gt;      String author();&lt;br /&gt;      String date();&lt;br /&gt;      int currentRevision() default 1;&lt;br /&gt;      String lastModified() default "N/A";&lt;br /&gt;      String lastModifiedBy() default "N/A";&lt;br /&gt;      String[] reviewers();  // Note use of array&lt;br /&gt;   }&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;The annotation type definition looks somewhat like an interface definition where the keyword interface is preceded by the @ character (@ = "AT" as in Annotation Type). The body of the annotation definition above contains annotation type element declarations, which look a lot like methods. Note that they may define optional default values.&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;// this code lives in a file called Copyright.java&lt;br /&gt;import java.lang.annotation.Documented;&lt;br /&gt;import java.lang.annotation.Retention;&lt;br /&gt;import java.lang.annotation.RetentionPolicy;&lt;br /&gt;&lt;br /&gt;/**&lt;br /&gt;* embedded copyright&lt;br /&gt;*/&lt;br /&gt;@Documented&lt;br /&gt;@Retention(RetentionPolicy.RUNTIME) @interface Copyright&lt;br /&gt;   {&lt;br /&gt;// ------------------------------ FIELDS ------------------------------&lt;br /&gt;&lt;br /&gt;   /**&lt;br /&gt;    * copyright to embed via annotations so it is embedded in all classes that reference it&lt;br /&gt;    */&lt;br /&gt;   String defaultCopyright =&lt;br /&gt;           "copyright (c) 1998-2008 Roedy Green, "&lt;br /&gt;           + "Canadian Mind Products, http://mindprod.com";&lt;br /&gt;// -------------------------- PUBLIC INSTANCE  METHODS --------------------------&lt;br /&gt;   /**&lt;br /&gt;    * get value of this annotation&lt;br /&gt;    *&lt;br /&gt;    * @return the copyright string&lt;br /&gt;    */&lt;br /&gt;   String value() default defaultCopyright;&lt;br /&gt;   }&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Annotation Uses&lt;/span&gt;&lt;br /&gt;In general, annotations benefits falls into three categories: documentation, compiler checking, and code analysis.&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Documentation : is probably the least relevant reason for adding metadata to the Java language. Javadoc is very powerful.&lt;/li&gt;&lt;li&gt;Code Analysis :&lt;/li&gt;&lt;li&gt;Compiler Checking : like Override&lt;/li&gt;&lt;/ul&gt;Annotations allow programmers to decorate Java code with their own attributes. These attributes can be used for code documentation, code generation, and, even during runtime, for providing special services such as enhanced business-level security or special business logic.&lt;br /&gt;&lt;br /&gt;Metadata provides a helpful way to indicate if methods are dependent on other methods, if they are incomplete, if a certain class must reference another class, and so on. This is indeed useful, but documentation is probably the least relevant reason for adding metadata to the Java language. Javadoc already provides a fairly easy-to-understand and robust way to document code. Besides, who wants to write a documentation tool when one already exists and works fine for the most part?&lt;br /&gt;&lt;br /&gt;Many APIs require a fair amount of boilerplate code. For example, in order to write a JAX-RPC web service, you must provide a paired interface and implementation. This boilerplate could be generated automatically by a tool if the program were “decorated” with annotations indicating which methods were remotely accessible.&lt;br /&gt;&lt;br /&gt;Other APIs require “side files” to be maintained in parallel with programs. For example JavaBeans requires a BeanInfo class to be maintained in parallel with a bean, and Enterprise JavaBeans (EJB) requires a deployment descriptor. It would be more convenient and less error-prone if the information in these side files were maintained as annotations in the program itself.&lt;br /&gt;&lt;br /&gt;used to create documentation&lt;br /&gt;used to track down dependencies in code&lt;br /&gt;used to perform rudimentary compile-time checking.&lt;br /&gt;&lt;br /&gt;The more advanced uses of annotations include writing an annotation processor that can read a Java program and take actions based on its annotations.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;   and should be run by the testing tool:&lt;br /&gt;&lt;br /&gt;   import java.lang.annotation.*;&lt;br /&gt;&lt;br /&gt;   /**&lt;br /&gt;    * Indicates that the annotated method is a test method.&lt;br /&gt;    * This annotation should be used only on parameterless static methods.&lt;br /&gt;    */&lt;br /&gt;   @Retention(RetentionPolicy.RUNTIME)&lt;br /&gt;   @Target(ElementType.METHOD)&lt;br /&gt;   public @interface Test { }&lt;br /&gt;&lt;br /&gt;Note that the annotation type declaration is itself annotated. Such annotations are called meta-annotations. The first (@Retention(RetentionPolicy.RUNTIME)) indicates that annotations with this type are to be retained by the VM so they can be read reflectively at run-time. The second (@Target(ElementType.METHOD)) indicates that this annotation type can be used to annotate only method declarations.&lt;br /&gt;&lt;br /&gt;Here is the testing tool:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;   import java.lang.reflect.*;&lt;br /&gt;&lt;br /&gt;   public class RunTests {&lt;br /&gt;      public static void main(String[] args) throws Exception {&lt;br /&gt;         int passed = 0, failed = 0;&lt;br /&gt;         for (Method m : Class.forName(args[0]).getMethods()) {&lt;br /&gt;            if (m.isAnnotationPresent(Test.class)) {&lt;br /&gt;               try {&lt;br /&gt;                  m.invoke(null);&lt;br /&gt;                  passed++;&lt;br /&gt;               } catch (Throwable ex) {&lt;br /&gt;                  System.out.printf("Test %s failed: %s %n", m, ex.getCause());&lt;br /&gt;                  failed++;&lt;br /&gt;               }&lt;br /&gt;            }&lt;br /&gt;         }&lt;br /&gt;         System.out.printf("Passed: %d, Failed %d%n", passed, failed);&lt;br /&gt;      }&lt;br /&gt;   }&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;References *&lt;br /&gt;&lt;a href="http://mindprod.com/jgloss/annotations.html"&gt;http://mindprod.com/jgloss/annotations.html&lt;/a&gt;&lt;br /&gt;&lt;a href="http://java.sun.com/docs/books/tutorial/java/javaOO/annotations.html"&gt;http://java.sun.com/docs/books/tutorial/java/javaOO/annotations.html&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.javaworld.com/javaworld/jw-07-2004/jw-0719-tiger3.html"&gt;http://www.javaworld.com/javaworld/jw-07-2004/jw-0719-tiger3.html&lt;/a&gt;&lt;br /&gt;&lt;a href="http://java.sun.com/j2se/1.5.0/docs/guide/language/annotations.html"&gt;http://java.sun.com/j2se/1.5.0/docs/guide/language/annotations.html&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.ibm.com/developerworks/java/library/j-annotate1/index.html"&gt;http://www.ibm.com/developerworks/java/library/j-annotate1/index.html&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8563220776994779598-2043014064008602945?l=lavnish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lavnish.blogspot.com/feeds/2043014064008602945/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8563220776994779598&amp;postID=2043014064008602945' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/2043014064008602945'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/2043014064008602945'/><link rel='alternate' type='text/html' href='http://lavnish.blogspot.com/2008/05/java-annotations.html' title='Java Annotations'/><author><name>Lavnish</name><uri>http://www.blogger.com/profile/16714741724993845980</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://lh4.google.co.uk/image/lavnishl/RdK3Rnp8q2E/AAAAAAAAAAw/g7LYCh-VN-8/s160-c/Me_ramoji.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8563220776994779598.post-2051948897373491863</id><published>2008-04-28T23:01:00.001-07:00</published><updated>2008-04-28T23:04:31.750-07:00</updated><title type='text'>Collection and Set interface</title><content type='html'>Its easy to note that the &lt;a href="http://java.sun.com/j2se/1.4.2/docs/api/java/util/Collection.html"&gt;collection &lt;/a&gt;interface and &lt;a href="http://java.sun.com/j2se/1.4.2/docs/api/java/util/Set.html"&gt;set&lt;/a&gt; interface both have same methods... but the Set interface doesnt allow duplicates and the Collection interface does allow.. why is it so ??&lt;br /&gt;&lt;br /&gt;Reason ...&lt;br /&gt;Every Set &lt;b&gt;IS A&lt;/b&gt; Collection. The reason to extend Collection is that the contract is different. Collection says nothing about duplicates. Set is not allowed to contain duplicates. Even though there are no additional methods in Set, as a developer, we know that a Set will have this additional characteristic. If there is a parameter declared as a Set, then any developer using it knows that it will not contain duplicates, and any developer assigning to it knows that he can't use a collection that allows duplicates.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8563220776994779598-2051948897373491863?l=lavnish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lavnish.blogspot.com/feeds/2051948897373491863/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8563220776994779598&amp;postID=2051948897373491863' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/2051948897373491863'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/2051948897373491863'/><link rel='alternate' type='text/html' href='http://lavnish.blogspot.com/2008/04/collection-and-set-interface.html' title='Collection and Set interface'/><author><name>Lavnish</name><uri>http://www.blogger.com/profile/16714741724993845980</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://lh4.google.co.uk/image/lavnishl/RdK3Rnp8q2E/AAAAAAAAAAw/g7LYCh-VN-8/s160-c/Me_ramoji.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8563220776994779598.post-5372047597185226676</id><published>2007-12-25T04:31:00.000-08:00</published><updated>2007-12-25T04:34:13.754-08:00</updated><title type='text'>why a servlet is preferred for JDBC</title><content type='html'>Servlet is preferred for JDBC code and not a static initializer block in a Class because the latter will be able to provide connections only when the static initializer block is run not before that ... &lt;br /&gt;on the other hand ... servlet can be loaded on startup&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8563220776994779598-5372047597185226676?l=lavnish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lavnish.blogspot.com/feeds/5372047597185226676/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8563220776994779598&amp;postID=5372047597185226676' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/5372047597185226676'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/5372047597185226676'/><link rel='alternate' type='text/html' href='http://lavnish.blogspot.com/2007/12/why-servlet-is-preferred-for-jdbc.html' title='why a servlet is preferred for JDBC'/><author><name>Lavnish</name><uri>http://www.blogger.com/profile/16714741724993845980</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://lh4.google.co.uk/image/lavnishl/RdK3Rnp8q2E/AAAAAAAAAAw/g7LYCh-VN-8/s160-c/Me_ramoji.jpg'/></author><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8563220776994779598.post-3127643422377332596</id><published>2007-12-25T04:06:00.000-08:00</published><updated>2007-12-25T04:11:23.237-08:00</updated><title type='text'>Google : Open Social</title><content type='html'>Really interesting stuff ...&lt;br /&gt;one can even make web sites that uses "Open Social API"&lt;br /&gt;benefits of open social for&lt;br /&gt;&lt;ul&gt;&lt;li&gt;developer .. they have more clients&lt;/li&gt;&lt;li&gt;consumers ... they have more apps&lt;/li&gt;&lt;/ul&gt;Makes sense !! heres how ....&lt;br /&gt;&lt;br /&gt;&lt;a href="http://code.google.com/apis/opensocial/"&gt;http://code.google.com/apis/opensocial/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;enables one to make application that can be used accross social networks !!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8563220776994779598-3127643422377332596?l=lavnish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lavnish.blogspot.com/feeds/3127643422377332596/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8563220776994779598&amp;postID=3127643422377332596' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/3127643422377332596'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/3127643422377332596'/><link rel='alternate' type='text/html' href='http://lavnish.blogspot.com/2007/12/google-open-social.html' title='Google : Open Social'/><author><name>Lavnish</name><uri>http://www.blogger.com/profile/16714741724993845980</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://lh4.google.co.uk/image/lavnishl/RdK3Rnp8q2E/AAAAAAAAAAw/g7LYCh-VN-8/s160-c/Me_ramoji.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8563220776994779598.post-264206908858588157</id><published>2007-12-12T08:02:00.000-08:00</published><updated>2007-12-12T09:18:32.667-08:00</updated><title type='text'>All about ADF tables</title><content type='html'>&lt;p&gt;&lt;br /&gt;&lt;strong&gt;How do i make a ADF TreeTable ?? &lt;/strong&gt;&lt;br /&gt;Saying it in very simple terms ... (i) &lt;em&gt;first&lt;/em&gt; make POJOs ... using parent POJO and child POJO make a tree like hierarchy (ii) &lt;em&gt;then&lt;/em&gt; using the ADF model classes convert them into ADF treeTable model !&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;strong&gt;Step one sounds easy .. can i have more details on step two ?&lt;/strong&gt;&lt;br /&gt;In ADF we have the following hierarchy...&lt;br /&gt;&lt;br /&gt;java.lang.Object&lt;br /&gt;&amp;nbsp&amp;nbsp&amp;nbspjavax.faces.model.DataModel&lt;br /&gt;&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsporacle.adf.view.faces.model.CollectionModel&lt;br /&gt;&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsporacle.adf.view.faces.model.TreeModel&lt;br /&gt;&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsporacle.adf.view.faces.model.ChildPropertyTreeModel&lt;br /&gt;&lt;br /&gt;javax.faces.model.DataModel&lt;br /&gt;has default constructor&lt;br /&gt;inherits directly from java.lang.Object&lt;br /&gt;The data collection underlying a DataModel instance is modeled as a collection of row objects that can be accessed by a zero-relative cursor (row index). The APIs provide mechanisms to position to a specified zero-relative row index, and to retrieve an object that represents the data that corresponds to the current row index.&lt;br /&gt;DataModel is an abstraction around arbitrary data binding technologies that can be used to adapt a variety of data sources for use by JavaServer Faces components that support per-row processing for their child components &lt;br /&gt;has a property rowIndex that starts from 0 ... up to max_no_of_child&lt;br /&gt;has other methods like getRowData() getRowCount() .. setWrappedData() and getWrappedData() .. they set the object representing the data collection wrapped by this DataModel&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;em&gt;oracle.adf.view.faces.model.CollectionModel&lt;/em&gt;&lt;br /&gt;implements no RowKeyIndex&lt;br /&gt;has default ctor&lt;br /&gt;The data model that is used by ADF Table components. This extends the faces DataModel class and adds on support for rowKeys and sorting.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;*** oracle.adf.view.faces.model.TreeModel ***&lt;br /&gt;It just has a default constructor ... &lt;br /&gt;&lt;br /&gt;rows in a treeModel may contain other rows...&lt;br /&gt;to figure out if current row is a container use method isContainer()&lt;br /&gt;If a row is a container, use the enterContainer() method to access its child rows. Once the enterContainer() method is called all the CollectionModel API's methods (like DataModel.getRowCount()) operate on the child collection. To return back to the parent row, use the exitContainer() method. &lt;br /&gt;&lt;br /&gt; |-Root1 (rowKey="r1", rowIndex=0)&lt;br /&gt; |  |-Folder1 (rowKey="r1f1", rowIndex=0)&lt;br /&gt; |  |  |-Node1 (rowKey="r1f1n1", rowIndex=0)&lt;br /&gt; |  |  |-Node2 (rowKey="r1f1n2", rowIndex=1)&lt;br /&gt; |  |  |-Node3 (rowKey="r1f1n3", rowIndex=2)&lt;br /&gt; |  |&lt;br /&gt; |  |-Folder2 (rowKey="r1f2", rowIndex=1)&lt;br /&gt; |     |-Node4 (rowKey="r1f2n1", rowIndex=0)&lt;br /&gt; |&lt;br /&gt; |-Root2 (rowKey="r2", rowIndex=1)&lt;br /&gt; |-Root3 (rowKey="r3", rowIndex=2)&lt;br /&gt; |-Root4 (rowKey="r4", rowIndex=3)&lt;br /&gt;&lt;br /&gt;so each row has a setRowKey() and setRowIndex() ... rowKey is inherited from CollectionModel and rowIndex from DataModel... the rowKey is unique accross the whole table ... rowIndex is relative to its parent ... &lt;br /&gt;use setRowKey(null) to reach the root ... &lt;br /&gt;&lt;br /&gt;To access Node4 use: &lt;br /&gt;&lt;br /&gt; setRowIndex(0); // isContainer()==true&lt;br /&gt; enterContainer(); // enter Root1, getRowCount()==2&lt;br /&gt; setRowIndex(1); // isContainer()==true&lt;br /&gt; enterContainer(); // enter Folder2, getRowCount()==1&lt;br /&gt; setRowIndex(0); // isContainer()==false&lt;br /&gt; getRowData(); // To access a particular row in the list, first make that row current, and then call the getRowData() method on the Table&lt;br /&gt;&lt;br /&gt;Or, more simply: &lt;br /&gt; setRowKey("r1f2n1");&lt;br /&gt; getRowData();&lt;br /&gt;&lt;br /&gt;*** oracle.adf.view.faces.model.ChildPropertyTreeModel ***&lt;br /&gt;It extends TreeModel&lt;br /&gt;&lt;br /&gt;Creates a TreeModel from a List of beans. To use this class you must have a tree of beans (or Maps). The structure of your tree must be a List (or array) of root beans, and each bean must have a getter method (or Map property) that returns the children List. All elements of your tree must be the same type. &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Tree VS TreeModel&lt;br /&gt;The Tree component displays a multi-root hierarchy in a simple UI... the TreeTabel displays a single-root hierarchy &lt;br /&gt;&lt;br /&gt;You may find the oracle.adf.view.faces.model.ChildPropertyTreeModel class useful when constructing a TreeModel &lt;br /&gt;&lt;br /&gt;*** the &lt;af:tree&gt; ***&lt;br /&gt;The "nodeStamp" facet of the Tree is used to display the data for each element in the tree. The Tree does not create components per element; instead, the "nodeStamp" is repeatedly rendered (stamped) once per element. Because of this stamping behavior, only certain types of components are supported as children inside a Tree. Supported components include all components with no behavior and most components that implement the EditableValueHolder or ActionSource interfaces.&lt;br /&gt;The Tree renders expand/collapse icons that the user can click on to expand or collapse a subtree. When these icons are clicked, the Tree generates a DisclosureEvent &lt;br /&gt;&lt;br /&gt;The immediate children of a Table component must all be &lt; af:column &gt; components.&lt;br /&gt;Use the "header" facet on a Column to create the column header.&lt;br /&gt;The child components of each Column display the data for each row in that column.... that means it may be a textbox , a label , a textArea etc ...&lt;br /&gt;Column does not create child components per row; instead, each child is repeatedly rendered (stamped) once per row... that means if there are 10 rows then the column elemnt will not create 10 children insteand 10 times rows will be created and each time one element for the column is created&lt;br /&gt;&lt;br /&gt;Because of this stamping behavior, some components many not work inside the table. Anything that is just pure output, with no behavior, will work without problems, as will components that don't "mutate" even as they deliver events&lt;br /&gt;&lt;br /&gt;one can have column groups ... &lt;br /&gt;&lt;br /&gt;Columns can be rendered as row headers by setting the "rowHeader" attribute on &lt; column &gt; to be true. Row header columns must be the first columns in a table. &lt;br /&gt;&lt;br /&gt;Range Navigation  &lt;af:table rows="10" ...&gt;&lt;br /&gt;When the list being displayed by a Table is huge, you can enable the Table to break up the list into ranges and display a single range at a time. Range controls are provided on the Table to let the user scroll to the next range, or to go back to the previous range.&lt;br /&gt;thi smay also generate RangeChangeEvent &lt;br /&gt;&lt;br /&gt;Displaying Details &lt;br /&gt;You can configure the Table to display or hide additional details of a particular row in response to a user gesture. When the details feature is enabled, a new column containing a toggle (per row) will render in the Table. When a toggle is activated, the details for that row are displayed. When a toggle is deactivated, the details for the row are hidden. The user can also display or hide the details for all rows at the same time (the controls for this feature are enabled by setting the "allDetailsEnabled" property to true.) &lt;br /&gt;&lt;br /&gt;To enable the details feature set the "detailStamp" facet on the Table. Place the components that are used to show the details (of a row), inside this facet. In the following example, the Person's age is displayed in the details section: &lt;br /&gt;&lt;br /&gt;&lt;af:table var="row" value="#{myBean.allEmployees}"&gt;&lt;br /&gt;  &lt;f:facet name="detailStamp"&gt;&lt;br /&gt;    &lt;af:outputText value="#{row.age}"/&gt;&lt;br /&gt;  &lt;/f:facet&gt;&lt;br /&gt;&lt;/af:table&gt;&lt;br /&gt;        &lt;br /&gt;Usually, the default behavior of the Table (with respect to displaying and hiding details) is sufficient. In some cases, however, it might be desirable to programmatically display or hide the details for a particular row. This can be done via the RowKeySet object obtained from the Table by calling the getDisclosureState() method. First, make the relevant row current by calling setRowIndex(...) or setRowKey(...) on the Table, and then call add() or remove() on the RowKeySet object. Adding the row to the set displays the details of the row. Removing the row hides them. &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;*** &lt;af:table&gt; ***&lt;br /&gt;The ADF Table component uses a model to access the data in the underlying list. The specific model class is oracle.adf.view.faces.model.CollectionModel . You may also use other model instances, e.g., java.util.List , array, and javax.faces.model.DataModel . The Table will automatically convert the instance into a CollectionModel ...??? not sure how will that happen as there is only one constructor for the CollectionModel and thats the default constructor ???&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;*** the &lt;af:treeTable&gt; ***&lt;br /&gt;single-root hierarchy&lt;br /&gt;TreeTable's children must be ADF Column components&lt;br /&gt;the tree table has a "nodeStamp" and a "pathStamp" facet ... Like the Tree, the TreeTable has a "nodeStamp" facet which renders the "Object Name" Column. The TreeTable has a "pathStamp" facet for rendering the focus path. &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;*** obvious ***&lt;br /&gt;ifmy af:table is inside af:panelcollection .. first panelcollection is made then the table&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8563220776994779598-264206908858588157?l=lavnish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lavnish.blogspot.com/feeds/264206908858588157/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8563220776994779598&amp;postID=264206908858588157' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/264206908858588157'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/264206908858588157'/><link rel='alternate' type='text/html' href='http://lavnish.blogspot.com/2007/12/all-about-adf-tables.html' title='All about ADF tables'/><author><name>Lavnish</name><uri>http://www.blogger.com/profile/16714741724993845980</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://lh4.google.co.uk/image/lavnishl/RdK3Rnp8q2E/AAAAAAAAAAw/g7LYCh-VN-8/s160-c/Me_ramoji.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8563220776994779598.post-9126981767236827750</id><published>2007-12-11T21:11:00.000-08:00</published><updated>2007-12-11T21:12:04.147-08:00</updated><title type='text'>ANT and versioning</title><content type='html'>&lt;a href="http://www.josesandoval.com/2007/12/java-automatically-increment-build.html"&gt;http://www.josesandoval.com/2007/12/java-automatically-increment-build.html&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8563220776994779598-9126981767236827750?l=lavnish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lavnish.blogspot.com/feeds/9126981767236827750/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8563220776994779598&amp;postID=9126981767236827750' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/9126981767236827750'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/9126981767236827750'/><link rel='alternate' type='text/html' href='http://lavnish.blogspot.com/2007/12/ant-and-versioning.html' title='ANT and versioning'/><author><name>Lavnish</name><uri>http://www.blogger.com/profile/16714741724993845980</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://lh4.google.co.uk/image/lavnishl/RdK3Rnp8q2E/AAAAAAAAAAw/g7LYCh-VN-8/s160-c/Me_ramoji.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8563220776994779598.post-3750728992667325815</id><published>2007-12-11T20:58:00.000-08:00</published><updated>2007-12-11T21:08:48.324-08:00</updated><title type='text'>Software Engineering</title><content type='html'>hhhhhhhhmmmmmmmmmmmm&lt;br /&gt;what THEY say ... &lt;br /&gt;The idea is to create a language around the problem you're trying to solve in order to make it easier to solve the problem. &lt;br /&gt;what I understood ...&lt;br /&gt;yes i kind of agree to that ... as far as my experience with product development goes succesfull product development companies have made there own properiatory frameworks first and then used to it to solve the problem in hand .. &lt;br /&gt;so what do they gain by making this framework ... ? wouldnt one save time by using existing framework .. ??&lt;br /&gt;my take is they visualize a big problem break it down to small ones by making small components / classes / APIs and solve each of them individually &lt;br /&gt;They even sav time .. how ?? if a bug comes in the framework they can solve it in less time rather than delegating it to some one else !&lt;br /&gt;&lt;br /&gt;There's always a big difference between setting out to invent new solutions and setting out to invent new problems... confused ?? allow me to explain ... rather than solving a big problem first try to break it into new problems .. smaller and more specific ones .. then soolve each of them ... if new design or constraints come up then they too can be solved with similar approach ...&lt;br /&gt;I wonder if its "Decorator Pattern" ;o)&lt;br /&gt;&lt;br /&gt;Dont waste a lot of time and money in solving yesterdays problem ... i hope it makes sense .. and thats what JAVA is upto ... &lt;br /&gt;&lt;br /&gt;cheerz !!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8563220776994779598-3750728992667325815?l=lavnish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lavnish.blogspot.com/feeds/3750728992667325815/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8563220776994779598&amp;postID=3750728992667325815' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/3750728992667325815'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/3750728992667325815'/><link rel='alternate' type='text/html' href='http://lavnish.blogspot.com/2007/12/software-engineering.html' title='Software Engineering'/><author><name>Lavnish</name><uri>http://www.blogger.com/profile/16714741724993845980</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://lh4.google.co.uk/image/lavnishl/RdK3Rnp8q2E/AAAAAAAAAAw/g7LYCh-VN-8/s160-c/Me_ramoji.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8563220776994779598.post-3068734737357872805</id><published>2007-12-08T11:23:00.000-08:00</published><updated>2007-12-08T11:26:13.992-08:00</updated><title type='text'>More JSF</title><content type='html'>For a web application, all objects held in the application scope must be handled in a threadsafe manner; because all users and all requests have access to the objects in this scope, it's very likely that more than one thread will access the same object. Objects in the session scope must also be threadsafe, because they are shared by all requests from the same user. If the user makes parallel requests, e.g., by submitting the same form over and over without waiting for the response, making requests from multiple browsers tied to the same session, or requesting pages that contain references (e.g., frame references) to other pages that modify session scope objects, a session scope object's state can be corrupted.&lt;br /&gt;&lt;br /&gt;When you use JSP as the presentation layer technology for JSF, you don't use the JSF API at all for creating and rendering components. Instead, you use the custom actions from the JSF custom tag libraries to say which components you need, and the tag handlers use the JSF API to create and render the corresponding component objects for you.&lt;br /&gt;&lt;br /&gt;The first action element in the page, &lt;f:view&gt;, is very important. The combination of the components that make up a specific user interface screen is called a view in JSF. A view contains an instance of the javax.faces.component.UIViewRoot class. This class is a nonvisual component type that acts as a container for all the other components in the view. Components representing UI widgets, such as input fields and buttons, are children of the UIViewRoot and can have children of their own. Together, the components form a tree, with the UIViewRoot at the top. The &lt;f:view&gt; action element represents the UIViewRoot component and you must make sure it encloses all other JSF action elements in the page; otherwise, they aren't included in the view.&lt;br /&gt;&lt;br /&gt;Note that there's a one-to-one relationship between a JSF view and an HTTP response. Hence, you must use only one &lt;f:view&gt; element in the JSP page. A JSP page can, as you may know, include other JSP pages dynamically. Such included pages represent subviews in JSF, and are represented by an &lt;f:subview&gt; element.&lt;br /&gt;&lt;br /&gt;The next JSF action element, &lt;h:form&gt;, represents a form component, acting as a container for input components that hold values that should be processed together. Within the &lt;h:form&gt; element &lt;br /&gt;&lt;br /&gt;The element names for all these actions are composed from a component type name and renderer type name. The core JSF components represent pure behavior and know nothing about how they are represented on a screen. This task instead falls on renderers associated with each component, making it possible to represent the same type of component in different ways. Take &lt; h : inputText &gt;, for example. It represents an input field component, i.e., a component type that holds a value that can be changed by the user. Such a component can be rendered in different ways. The &lt; h : inputText &gt; action associates the input component with a text renderer, which renders the component as an HTML &lt; input &gt; element with the type attribute set to text. Another action element named &lt; h : inputSecret &gt; associates an input component with a renderer of type "secret," which renders the component as an HTML &lt; input &gt; element with the type attribute set to password.&lt;br /&gt;&lt;br /&gt;&lt; h : commandButton &gt;&lt;br /&gt;component Type : command&lt;br /&gt;Renderer type : Button&lt;br /&gt;&lt;br /&gt;&lt; h : commandLink &gt;&lt;br /&gt;component Type : command&lt;br /&gt;Renderer type : Link&lt;br /&gt;&lt;br /&gt;&lt; h : panelGroup &gt;&lt;br /&gt;component Type : panel&lt;br /&gt;Renderer type : Group&lt;br /&gt;&lt;br /&gt;&lt; h : panelGrid &gt;&lt;br /&gt;component Type : panel&lt;br /&gt;Renderer type : grid&lt;br /&gt;&lt;br /&gt;&lt; h : selectOneMenu &gt;&lt;br /&gt;component Type : selectOne&lt;br /&gt;Renderer type : menu&lt;br /&gt;&lt;br /&gt;Most component types can be combined with more than one renderer type, and each valid combination is supported by an action element following the &lt;h:componentTypeRendererType&gt; naming convention.&lt;br /&gt;&lt;br /&gt;So why doesn't the &lt;h:form&gt; element name follow the same convention? Because the only renderer type for the form component type is the form renderer. To avoid action element names like &lt;h:formForm&gt;, JSF uses an abbreviated element name when the component type and the renderer type have the same name&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8563220776994779598-3068734737357872805?l=lavnish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lavnish.blogspot.com/feeds/3068734737357872805/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8563220776994779598&amp;postID=3068734737357872805' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/3068734737357872805'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8563220776994779598/posts/default/3068734737357872805'/><link rel='alternate' type='text/html' href='http://lavnish.blogspot.com/2007/12/more-jsf.html' title='More JSF'/><author><name>Lavnish</name><uri>http://www.blogger.com/profile/16714741724993845980</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://lh4.google.co.uk/image/lavnishl/RdK3Rnp8q2E/AAAAAAAAAAw/g7LYCh-VN-8/s160-c/Me_ramoji.jpg'/></author><thr:total>0</thr:total></entry></feed>
