<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Saurabh Juneja's Weblog</title>
	<atom:link href="http://sjuneja.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://sjuneja.wordpress.com</link>
	<description>Just another WordPress.com weblog</description>
	<lastBuildDate>Fri, 21 Oct 2011 18:48:42 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='sjuneja.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Saurabh Juneja's Weblog</title>
		<link>http://sjuneja.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://sjuneja.wordpress.com/osd.xml" title="Saurabh Juneja&#039;s Weblog" />
	<atom:link rel='hub' href='http://sjuneja.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Why do we need a web server ?</title>
		<link>http://sjuneja.wordpress.com/2011/10/21/why-do-we-need-a-web-server/</link>
		<comments>http://sjuneja.wordpress.com/2011/10/21/why-do-we-need-a-web-server/#comments</comments>
		<pubDate>Fri, 21 Oct 2011 18:13:38 +0000</pubDate>
		<dc:creator>sjuneja</dc:creator>
				<category><![CDATA[J2EE]]></category>

		<guid isPermaLink="false">http://sjuneja.wordpress.com/?p=276</guid>
		<description><![CDATA[Why do we need a web server ? In an Web or Enterprise Application perspective, you need a webserver as a first entry point since all the requests have to be originated from a single place. Say, your login page to the application. But processing the login operation may not be the job of a Web Server and [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sjuneja.wordpress.com&amp;blog=1795710&amp;post=276&amp;subd=sjuneja&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Why do we need a web server ?</p>
<p>In an Web or Enterprise Application perspective, you need a webserver as a first entry point since all the requests have to be originated from a single place. Say, your login page to the application. But processing the login operation may not be the job of a <a id="itxthook2" href="http://wiki.answers.com/Q/Why_do_you_need_a_web_server#" rel="nofollow">Web Server</a> and it would be done by a Web Application.</p>
<p>As such, a Web Server is preferred to serve any static files, which is not changing in nature for any type of requests. Whereas, you need a Web <a id="itxthook3" href="http://wiki.answers.com/Q/Why_do_you_need_a_web_server#" rel="nofollow">application</a> to produce a dynamic response according to the type of inputs you provide along with your request.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sjuneja.wordpress.com/276/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sjuneja.wordpress.com/276/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sjuneja.wordpress.com/276/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sjuneja.wordpress.com/276/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sjuneja.wordpress.com/276/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sjuneja.wordpress.com/276/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sjuneja.wordpress.com/276/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sjuneja.wordpress.com/276/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sjuneja.wordpress.com/276/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sjuneja.wordpress.com/276/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sjuneja.wordpress.com/276/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sjuneja.wordpress.com/276/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sjuneja.wordpress.com/276/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sjuneja.wordpress.com/276/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sjuneja.wordpress.com&amp;blog=1795710&amp;post=276&amp;subd=sjuneja&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sjuneja.wordpress.com/2011/10/21/why-do-we-need-a-web-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/58808f74067a1f808f4cf9afa228b43d?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">sjuneja</media:title>
		</media:content>
	</item>
		<item>
		<title>XML</title>
		<link>http://sjuneja.wordpress.com/2011/09/08/xml/</link>
		<comments>http://sjuneja.wordpress.com/2011/09/08/xml/#comments</comments>
		<pubDate>Thu, 08 Sep 2011 18:08:59 +0000</pubDate>
		<dc:creator>sjuneja</dc:creator>
				<category><![CDATA[J2EE]]></category>

		<guid isPermaLink="false">http://sjuneja.wordpress.com/?p=229</guid>
		<description><![CDATA[DOM (Document Object Model) The XML DOM defines a standard way for accessing and manipulating XML documents. The DOM presents an XML document as a tree-structure. Knowing the XML DOM is a must for anyone working with XML. SAX Simple API for XML (SAX) for the events-based parsing of XML documents Difference SAX parsers operate [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sjuneja.wordpress.com&amp;blog=1795710&amp;post=229&amp;subd=sjuneja&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><span style="text-decoration:underline;">DOM (Document Object Model)</span></p>
<p>The XML DOM defines a standard way for accessing and manipulating XML documents.</p>
<p>The DOM presents an XML document as a tree-structure.</p>
<p>Knowing the XML DOM is a must for anyone working with XML.</p>
<p><span style="text-decoration:underline;">SAX</span></p>
<p>Simple API for XML (SAX)</p>
<p>for the events-based parsing of XML documents</p>
<p><span style="text-decoration:underline;">Difference</span></p>
<p>SAX parsers operate on each piece of the XML document sequentially while the DOM operates on the document as a whole.</p>
<p>The quantity of memory that a SAX parser must use in order to function is typically much smaller than that of a DOM parser.</p>
<p>DOM parsers must have the entire tree in memory before any processing can begin, so the amount of memory used by a DOM parser depends entirely on the size of the input data. The memory footprint of a SAX parser, by contrast, is based only on the maximum depth of the XML file (the maximum depth of the XML tree) and the maximum data stored in XML attributes on a single XML element</p>
<p><span style="text-decoration:underline;">JDOM</span></p>
<p>The JDOM is open source Java API for manipulating XML files within Java Program.</p>
<p>it allow writing Java programs that can read, manipulate and output XML data</p>
<p>The JDOM API is faster than DOM API and it simplifies the interaction with the XML.</p>
<p>JDOM’s provide XPath support.</p>
<p><span style="text-decoration:underline;">StAX </span></p>
<p>goal of the StAX API is to give &#8220;parsing control to the programmer by exposing a simple iterator based API</p>
<p><span style="text-decoration:underline;">Namespace</span></p>
<p>When a namespace is defined for an element, all child elements with the same prefix are associated with the same namespace.</p>
<p>Defining a default namespace for an element saves us from using prefixes in all the child elements. It has the following syntax:</p>
<p>&lt;root<br />
xmlns:h=&#8221;http://www.w3.org/TR/html4/&#8221;<br />
xmlns:f=&#8221;http://www.w3schools.com/furniture&#8221;&gt;</p>
<p>&lt;h:table&gt;<br />
&lt;h:tr&gt;<br />
&lt;h:td&gt;Apples&lt;/h:td&gt;<br />
&lt;h:td&gt;Bananas&lt;/h:td&gt;<br />
&lt;/h:tr&gt;<br />
&lt;/h:table&gt;</p>
<p>&lt;f:table&gt;<br />
&lt;f:name&gt;African Coffee Table&lt;/f:name&gt;<br />
&lt;f:width&gt;80&lt;/f:width&gt;<br />
&lt;f:length&gt;120&lt;/f:length&gt;<br />
&lt;/f:table&gt;</p>
<p>&lt;/root&gt;</p>
<p><span style="text-decoration:underline;">CDATA</span></p>
<p>All text in an XML document will be parsed by the parser.</p>
<p>But text inside a CDATA section will be ignored by the parser.</p>
<p><span style="text-decoration:underline;">service contract</span></p>
<p>= data contract + operational contract</p>
<p>data contract will define the messages going in and out of the service.</p>
<p>operational contract will define the operations that our service will perform.</p>
<p>WSDL file contains both:-</p>
<p>1) contains an embedded xsd file that defines data contract.</p>
<p>2) The rest of he WSDL file defines the opeartional contract<span class="Apple-style-span" style="font-family:Consolas, Monaco, monospace;font-size:12px;line-height:18px;white-space:pre;">,</span>including one or more &lt;wsdl:operation&gt; elements within the &lt;wsdl:binding&gt; element</p>
<p><span style="text-decoration:underline;">XPath</span></p>
<p>is used for identifying or extracting parts of an XML structure.</p>
<p>You could say that XPath is to XML what SQL is to relation database.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sjuneja.wordpress.com/229/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sjuneja.wordpress.com/229/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sjuneja.wordpress.com/229/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sjuneja.wordpress.com/229/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sjuneja.wordpress.com/229/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sjuneja.wordpress.com/229/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sjuneja.wordpress.com/229/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sjuneja.wordpress.com/229/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sjuneja.wordpress.com/229/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sjuneja.wordpress.com/229/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sjuneja.wordpress.com/229/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sjuneja.wordpress.com/229/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sjuneja.wordpress.com/229/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sjuneja.wordpress.com/229/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sjuneja.wordpress.com&amp;blog=1795710&amp;post=229&amp;subd=sjuneja&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sjuneja.wordpress.com/2011/09/08/xml/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/58808f74067a1f808f4cf9afa228b43d?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">sjuneja</media:title>
		</media:content>
	</item>
		<item>
		<title>Leadership</title>
		<link>http://sjuneja.wordpress.com/2011/08/22/leadership/</link>
		<comments>http://sjuneja.wordpress.com/2011/08/22/leadership/#comments</comments>
		<pubDate>Mon, 22 Aug 2011 17:50:09 +0000</pubDate>
		<dc:creator>sjuneja</dc:creator>
				<category><![CDATA[J2EE]]></category>

		<guid isPermaLink="false">http://sjuneja.wordpress.com/2011/08/22/leadership/</guid>
		<description><![CDATA[Put courage first Be mentally tough Decline yourself Value your character Project confidence It is not work that kills men, it is worry. Work is healthy; you can hardly put more on a man than he can bear. But worry is rust upon the blade. It is not movement that destroys the machinery, but friction. [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sjuneja.wordpress.com&amp;blog=1795710&amp;post=224&amp;subd=sjuneja&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Put courage first<br />
Be mentally tough<br />
Decline yourself<br />
Value your character<br />
Project confidence</p>
<p>It is not work that kills men, it is worry. Work is healthy; you can hardly put more on a man than he can bear. But worry is rust upon the blade. It is not movement that destroys the machinery, but friction. ~ Henry Ward Beecher</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sjuneja.wordpress.com/224/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sjuneja.wordpress.com/224/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sjuneja.wordpress.com/224/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sjuneja.wordpress.com/224/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sjuneja.wordpress.com/224/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sjuneja.wordpress.com/224/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sjuneja.wordpress.com/224/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sjuneja.wordpress.com/224/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sjuneja.wordpress.com/224/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sjuneja.wordpress.com/224/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sjuneja.wordpress.com/224/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sjuneja.wordpress.com/224/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sjuneja.wordpress.com/224/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sjuneja.wordpress.com/224/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sjuneja.wordpress.com&amp;blog=1795710&amp;post=224&amp;subd=sjuneja&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sjuneja.wordpress.com/2011/08/22/leadership/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/58808f74067a1f808f4cf9afa228b43d?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">sjuneja</media:title>
		</media:content>
	</item>
		<item>
		<title>Design Pattern</title>
		<link>http://sjuneja.wordpress.com/2011/08/21/design-pattern/</link>
		<comments>http://sjuneja.wordpress.com/2011/08/21/design-pattern/#comments</comments>
		<pubDate>Sun, 21 Aug 2011 10:02:17 +0000</pubDate>
		<dc:creator>sjuneja</dc:creator>
				<category><![CDATA[J2EE]]></category>

		<guid isPermaLink="false">http://sjuneja.wordpress.com/?p=193</guid>
		<description><![CDATA[Adapter Pattern:- Converts the interface of the class to another one that client expects. eg: Converting a Turkey into a Duck. we wrap Turkey into a TurkeyAdapter and send the adapter to the client. Client has a Target Interface, Adapter implements Target Interface and has a Adaptee. Two types of adapter:- 1. object adapter 2. [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sjuneja.wordpress.com&amp;blog=1795710&amp;post=193&amp;subd=sjuneja&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Adapter Pattern:-</p>
<p style="padding-left:30px;">Converts the interface of the class to another one that client expects.</p>
<p style="padding-left:30px;">eg: Converting a Turkey into a Duck.</p>
<p style="padding-left:30px;">we wrap Turkey into a TurkeyAdapter and send the adapter to the client.</p>
<p style="padding-left:30px;">Client has a Target Interface,</p>
<p style="padding-left:30px;">Adapter implements Target Interface and has a Adaptee.</p>
<p style="padding-left:30px;">Two types of adapter:-</p>
<p style="padding-left:30px;">1. object adapter</p>
<p style="padding-left:30px;">2. class adapter</p>
<p style="padding-left:30px;">1. Object Adapter:- is what we read so far.</p>
<p style="padding-left:30px;">2. Class Adapter:- Require multiple inheritance by sub-classing both target and adaptee.</p>
<p style="padding-left:30px;">Difference between Object and Class Adapter:-</p>
<p style="padding-left:30px;">Object Adapter, based on composition, can adapt the adaptee or any of its sub class.</p>
<p style="padding-left:30px;">Class Adapter, can override behavior</p>
<p style="padding-left:30px;">Real world adapter example:-</p>
<p style="padding-left:30px;">Adapting an Enumeration to an Iterator.</p>
<p>Bridge Pattern</p>
<blockquote><p>Use Bridge Pattern to vary not only your implementations, but your abstractions.</p>
<p>example:- Universal remote and controller and various TV implementation.</p>
<p>Both TV remote and TV implementation.</p></blockquote>
<p>Decorator Pattern<br />
Inheritance: behavior is set statically at compile time.<br />
All sub class inherit the same behavior.<br />
Composition: dynamically composing objects, we can add functionality in the new code, rather than altering existing code.</p>
<p>Design Principal: Classes should be open for extension but closed for modification.</p>
<p>Definition: Decorator pattern attaches additional responsibility to an object dynamically. It provides a flexible alternative to sub classing for extending the functionality.</p>
<p>Component is the base class, eg Beverage<br />
Concrete component &amp; Decorator, both extends Component, eg. Expresso &amp; CondimentDecorator (for type matching, not for inheriting behavior.<br />
We acquire behavior by composing objects together.<br />
With composition, we can mix and match behavior as we want.)<br />
Decorator also has a Component eg. Condiment also has a Beverage.<br />
Concerete Decorators extend Decorator, eg. Milk &amp; Soya extend Condiment.</p>
<p>Similar objects doing similar operations, abstract class Beverage, abstract method cost(), requirement is to call cost method on some object in hierarchy dynamically is a candidate for such pattern</p>
<p>Requirement:<br />
Write code as per abstract component, writing to concrete will brake decorator.</p>
<p>Cost in implementing decorator:<br />
Many small classes<br />
Following type is necessary<br />
Increase code complexity that factory pattern can help to reduce.</p>
<p>Adapter is used to match with the client requirement for an adaptee, while facade is used to simplify the interface</p>
<p>The facade pattern provide a unified interface to a set of interfaces. It defines a higher level of interface that make the subsystem easy to use.</p>
<p>Design principle : principle of least knowledge, talk only to your immediate friends.</p>
<p>Flyweight:  one single instance of a class can be used to provide many virtual instances, in this way you are able to flw away the memory weight of creation of multiple instance</p>
<p>Its Approach is to collect the state of many object and rather centralize the state at one location and form virtual objects out of one object.</p>
<p>It is used when class has many state and can be controlled identically.<br />
Single logical instance of a class can not behave independently from other</p>
<p>Example : large tree plantation project</p>
<p>Proxy pattern provides a surrogate or placeholder for another object to control access to.</p>
<p>Another object, which may be remote, expensive to create or in the need of securing.</p>
<p>Both RealSubject and the Proxy implement Subject interface.<br />
This allows any client to treat the proxy just like the real subject.</p>
<p>Proxy keep the reference to the real object, so it can forward the requests to the subject when necessary. it also often instantiate or handles the creation of the realsubject<br />
Realsubject is usually the object the does most of the work.</p>
<p>Composite pattern: allows to compose objects into tree structure to represent part-whole hierarchies.<br />
It let client treat individual &amp; composition of objects uniformly.<br />
We can apply same operations over both composite &amp; individual object.</p>
<p>Eg: menu &amp; sub menu</p>
<p>Client has a component, which is extended by leaf &amp; composite. Composite contains component ( recursive )</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sjuneja.wordpress.com/193/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sjuneja.wordpress.com/193/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sjuneja.wordpress.com/193/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sjuneja.wordpress.com/193/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sjuneja.wordpress.com/193/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sjuneja.wordpress.com/193/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sjuneja.wordpress.com/193/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sjuneja.wordpress.com/193/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sjuneja.wordpress.com/193/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sjuneja.wordpress.com/193/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sjuneja.wordpress.com/193/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sjuneja.wordpress.com/193/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sjuneja.wordpress.com/193/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sjuneja.wordpress.com/193/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sjuneja.wordpress.com&amp;blog=1795710&amp;post=193&amp;subd=sjuneja&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sjuneja.wordpress.com/2011/08/21/design-pattern/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/58808f74067a1f808f4cf9afa228b43d?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">sjuneja</media:title>
		</media:content>
	</item>
		<item>
		<title>Servlets &#8211; Question Answer way!</title>
		<link>http://sjuneja.wordpress.com/2011/08/06/servlets-question-answer-way/</link>
		<comments>http://sjuneja.wordpress.com/2011/08/06/servlets-question-answer-way/#comments</comments>
		<pubDate>Sat, 06 Aug 2011 06:23:25 +0000</pubDate>
		<dc:creator>sjuneja</dc:creator>
				<category><![CDATA[J2EE]]></category>

		<guid isPermaLink="false">http://sjuneja.wordpress.com/?p=87</guid>
		<description><![CDATA[Q. What is Container ? A. Servlets dint have a main() method. They are under control of another Java application called a &#8220;Container&#8221;. Example of a Container is Tomcat. Example of a web server is Apache. Container provides:- 1. Communication Support: provide easy way for servlet to talk to your web server. 2. Lifecycle Management: [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sjuneja.wordpress.com&amp;blog=1795710&amp;post=87&amp;subd=sjuneja&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><strong>Q. What is Container ?</strong></p>
<p>A. Servlets dint have a main() method. They are under control of another Java application called a &#8220;Container&#8221;.</p>
<p>Example of a Container is Tomcat.</p>
<p>Example of a web server is Apache.</p>
<p>Container provides:-</p>
<p>1. Communication Support: provide easy way for servlet to talk to your web server.</p>
<p>2. Lifecycle Management: of servlet</p>
<p>3. Multithreading support: a new java thread is create to handle each servlet request.</p>
<p>4. Declarative security:  via xml configuration.</p>
<p>5. JSP Support: converting JSP to real java code.</p>
<p>Q. Explain Life-cycle of a servlet</p>
<p>A.1 Container Load class</p>
<p>2. Instantiate Servlet (Invoke its default constructor)</p>
<p>2.A Load ServletConfig</p>
<p>2.B Load ServletContext</p>
<p>3. Call init() -&gt; which may contain, getting a DB Connection.</p>
<p>4. service(), which eventually generate a thread to process each request and subsequently call doGet() &amp; doPost()</p>
<p>5. destroy()</p>
<p><strong>!Note</strong></p>
<p>When you have multiple parameter values for a single parameter, you need getPatameterValues() that returns an array instead of getParameter()</p>
<p><strong>Q. Beside parameter, what can I get from request object?</strong></p>
<p>A. request.getHeader(&#8220;User-Agent&#8221;); -&gt; Get request header</p>
<p>request.getCookies();</p>
<p>request.getSession();</p>
<p>request.getMethod();</p>
<p>request.getInputStream(); -&gt; get all raw request information.</p>
<p><strong>Q. Important method to call on response</strong></p>
<p>A. setContentType()</p>
<p>getWriter()</p>
<p>getOutputStream()</p>
<p><strong>Q. Difference between forward and sendRedirect</strong></p>
<p><strong>A.1</strong> forward (page 89)</p>
<ul>
<li>Control can be forward to resources available within the server from where the call is made. This transfer of control is done by the container internally and browser / client is not involved.</li>
<li>The original request and response objects are transfered along with additional parameters if needed.</li>
</ul>
<p>RequestDispatcher view = request.getRequestDispatcher(&#8220;result.jsp&#8221;);</p>
<p>view.forward(request, response);</p>
<p><strong>A.2</strong> sendRedirect (page 136)</p>
<p>if (workforme)</p>
<p>{</p>
<p>//hadel request</p>
<p>}else {</p>
<p>response.sendRedirect(&#8220;http://www.oreilly.com&#8221;);</p>
<p>}</p>
<p>Control can be redirect to resources to different servers or domains. This transfer of control task is delegated to the browser by the container. That is, the redirect sends a header back to the browser / client. This header contains the resource url to be redirected by the browser. Then the browser initiates a new request to the given url. Since it is a new request, the old request and response object is lost.</p>
<p>For example, sendRedirect can transfer control from http://javapapers.com to http://anydomain.com but forward cannot do this.</p>
<p><strong>‘session’ is not lost in both forward and redirect.</strong></p>
<p>To feel the difference between forward and sendRedirect visually see the address bar of your browser,<br />
in forward, you will not see the forwarded address (since the browser is not involved)<br />
in redirect, you can see the redirected address.</p>
<p>You can call sendRedirect() after response is already written. -&gt;IlligalStateException.</p>
<p>Attributes are not parameters!<br />
3 Attribute types:-<br />
1. Application/context<br />
2. Request<br />
3. Session</p>
<p>1. Application/context<br />
getServletContext().set/getAttribute(&#8220;&#8221;,&#8221;");<br />
They are not thread safe. to make it thread safe, we need to lock servletContext as below:-<br />
Synchronized (getServletContext()) {}</p>
<p>2. Session<br />
requirest.getSession().get/setAttribute(&#8220;&#8221;,&#8221;");<br />
Multiple request from same session, say multiple browser window<br />
Lock on session<br />
Synchronized (session){}</p>
<p>Implementing SingleThreadModel interface is also not a solution , it is as good as synchronizing service method.<br />
Also result in poor performance.</p>
<p>3. Request<br />
Only request attribute and local variable are thread safe<br />
Use when some other component of the app take over all or part of the request via<br />
RequestDispatcher.<br />
By two of its method forward() &amp; include() ()<br />
Get RD from request or servletContext(/ is must, root of application, not relative to current request)</p>
<p>Session<br />
If http uses state less connection so how container keep track of the user session ?<br />
On first request , container generate a unique session Id to send with the response &amp; client keep sending it for each subsequent request.<br />
This happen via cookie maintained by the container.<br />
What if client has cookies disabled on his browser ?<br />
URL re-writing happen automatically if cookies not supported, we only need to call response.encodeUrl()<br />
Invalidate the session if not active </p>
<p>Now! JSP</p>
<p>Page directives:-<br />
@<br />
scriptlet<br />
%%<br />
expression<br />
=<br />
s and e land up in service method</p>
<p>Declaration<br />
!<br />
Added to class outside of the service method, it can be variable declaration or method.</p>
<p>Implicit objects :-<br />
out JspWriter<br />
session HttpSession<br />
request HttpServletRequest<br />
response HttpServletResponse<br />
config ServletConfig<br />
application ServletContext<br />
exception JspException<br />
pageContext PageContext<br />
page Object</p>
<p>Comments<br />
HTML !<br />
Jsp %%</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sjuneja.wordpress.com/87/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sjuneja.wordpress.com/87/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sjuneja.wordpress.com/87/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sjuneja.wordpress.com/87/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sjuneja.wordpress.com/87/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sjuneja.wordpress.com/87/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sjuneja.wordpress.com/87/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sjuneja.wordpress.com/87/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sjuneja.wordpress.com/87/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sjuneja.wordpress.com/87/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sjuneja.wordpress.com/87/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sjuneja.wordpress.com/87/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sjuneja.wordpress.com/87/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sjuneja.wordpress.com/87/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sjuneja.wordpress.com&amp;blog=1795710&amp;post=87&amp;subd=sjuneja&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sjuneja.wordpress.com/2011/08/06/servlets-question-answer-way/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/58808f74067a1f808f4cf9afa228b43d?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">sjuneja</media:title>
		</media:content>
	</item>
		<item>
		<title>Core Java Question Answers</title>
		<link>http://sjuneja.wordpress.com/2011/07/30/core-java-question-answers/</link>
		<comments>http://sjuneja.wordpress.com/2011/07/30/core-java-question-answers/#comments</comments>
		<pubDate>Sat, 30 Jul 2011 07:43:52 +0000</pubDate>
		<dc:creator>sjuneja</dc:creator>
				<category><![CDATA[J2SE]]></category>

		<guid isPermaLink="false">http://sjuneja.wordpress.com/?p=92</guid>
		<description><![CDATA[&#160; Static members:- Certain member should only belong to class, and not be part of any object created from the class. Static member is initialized when a class is loaded at run time. !Note Java enforce a rule that at the most, one class in a java file has public accessibility. A Class is compiled to [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sjuneja.wordpress.com&amp;blog=1795710&amp;post=92&amp;subd=sjuneja&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>&nbsp;</p>
<p>Static members:-</p>
<ul>
<li>Certain member should only belong to class, and not be part of any object created from the class.</li>
<li>Static member is initialized when a class is loaded at run time.</li>
</ul>
<div>!Note</div>
<div>
<ul>
<li>Java enforce a rule that at the most, one class in a java file has public accessibility.</li>
<li>A Class is compiled to Java byte code.</li>
<li>Reserved literals in Java: null, true, false</li>
<li>int i = 010; system.out.println(&#8220;i = &#8221; + i); Output =&gt; 8</li>
</ul>
</div>
<div>Primitive data types</div>
<div>
<ul>
<li>Integral type: int 16 0, long 32 0L, byte 8 0, short 16 0, unsigned char 16 &#8216;\u0000&#8242;</li>
<li>Float type: float 23; double 64</li>
<li>Boolean type: boolean, default is false.</li>
<li>Reference type are default to null</li>
<li>Initialization of primitive variable are checked at compile time</li>
</ul>
</div>
<div>main()</div>
<div>
<ul>
<li>public static void main(String args[]) throws Exception works</li>
<li>public : so that it is accessible to jvm</li>
<li>static : so that class object is not needed to call it.</li>
<li>if void or static not present, we get run time error &#8220;Exception in thread &#8220;main&#8221; java.lang.NoSuchMethodError: main&#8221;</li>
</ul>
</div>
<div>Cast Oprator</div>
<div>
<ul>
<li>We need casting when narrowing down in the hierarchic</li>
</ul>
<p>Arithmetic</p>
</div>
<div>
<ul>
<li>Integer Arithmetic always return a value which is in the range, other than divide by zero which gives Arithmetic Exception.</li>
<li>Floating point Arithmetic can result in value that are out of range</li>
<li>When divide by zero, Infinity and -Infinity; 0.0F and -0.0F, NaN(0.0/0,0)</li>
</ul>
</div>
<div>Parameter passing</div>
<div>
<ul>
<li>Primitive: Values are copied.</li>
<li>Object Reference: Can only change the state not the value (can not change to null &#8230; hence always call by value)</li>
<li>Passing array reference is same as Object reference passing</li>
</ul>
<p>Static</p>
<ul>
<li>Static code can not access non static members by there simple name</li>
<li>static code is not executed in the context of an object, hence this and supper are not available.</li>
</ul>
</div>
<div>Compiling</div>
<div>
<ul>
<li>To put class files in package directory</li>
<li>javac -d . MainTests.</li>
</ul>
</div>
<div>Abstract Class</div>
<div>
<ul>
<li>Can not be instantiated</li>
<li>must be abstract if it has one+ abstract method</li>
<li>Sub class not implementing abstract from supper, must also be abstract</li>
</ul>
</div>
<div>Interface</div>
<div>
<ul>
<li>just specify method prototype and implicitly abstract.</li>
<li>abstract interface abc, -&gt; Redundent</li>
</ul>
</div>
<div>final class</div>
<div>
<ul>
<li>can not be extended</li>
<li>class whose definition is complete</li>
</ul>
</div>
<div>Other modifiers for members</div>
<div>static member</div>
<div>final member</div>
<div>
<ul>
<li>primitive final variable can not change its value once initialized</li>
<li>reference type final variable once initialized can not change its reference, but can change the state of the object it refers.</li>
</ul>
</div>
<div>abstract method</div>
<div>
<ul>
<li>Only an instance method can be declared as abstract</li>
<li>Static method can not be overridden, declaring an abstract static method make no sense.</li>
<li>MainTests.java:4: illegal combination of modifiers: abstract and static</li>
<li>method specified in an interface is implicitly abstract</li>
</ul>
</div>
<div>synchronized method</div>
<div>native method</div>
<div>
<ul>
<li>Implementation is defined in other language</li>
</ul>
</div>
<div>transient fields</div>
<div>
<ul>
<li>such field will not be stored to persistent storage when object will be stored.</li>
<li>Static are by default transient.</li>
</ul>
</div>
<div>volatile field</div>
<div>
<ul>
<li>stop compiler from optimizing the field by caching its value, preventing unpredictable results when retrieving the value in a multi-threaded environment.</li>
</ul>
</div>
<div>Switch statment</div>
<div>
<ul>
<li>one default label</li>
<li>all labels after the matched label are executed until u add break statement</li>
</ul>
<div>Exception</div>
<div>
<ul>
<li>All exception are derived from java.lang.Throwable</li>
<li>getMessage(), printStackTrace() are two method in it<img src="http://www3.ntu.edu.sg/home/ehchua/programming/java/images/Exception_Classes.gif" alt="" width="300" height="300" /></li>
<li>New exception usually extends Exception or one of its checked sub-classes, there by making the new exception as checked exception.</li>
<li>after a catch block is executed, control is transferred to finally block as long as one is present, regardless of whether the catch block itself throws an exception.</li>
<li>compiler complains if a super class shadows sub class exception catch block.</li>
<li>say, if finally block throes an exception, the new exception overrules any previous exception</li>
<li>return or break from finally block will determine further control flow, irrespective of how try block or any catch block were executed&#8230; it will</li>
<li>if no catch block handle the exception, exception are handled by default exception handler.</li>
</ul>
</div>
<div>throw</div>
<div>
<ul>
<li>a program can throw an exception using &#8220;throw&#8221; statement</li>
<li>throw &lt;object of type Throwable class&gt;, when&lt;&gt; null throw null pointer</li>
</ul>
</div>
<div>throws</div>
<div>
<ul>
<li>checked exception thrown by method are part of throws clause in method prototype</li>
<li>sub class can be thrown once supper class is in throws clause (bad prog style).</li>
<li>method overriding can specify a subset of checked exception in throws clause, because client may be ill prepared for newly added checked exception.</li>
</ul>
</div>
<div>Inharitence</div>
<div>
<ul>
<li>Private, override, hidden members are not inherited (they cant be accessed in base class without supper keyword)</li>
<li>constructor &amp; initializer blocks are not member of a class, they are not inherited</li>
<li>Down-casting require type-casting.</li>
</ul>
</div>
<div>Overriding Method within classes or interfaces</div>
<div>
<ul>
<li>non static method only</li>
<li>same signature: method name, parameter list in order &amp; same return type</li>
<li>parameter being final is at discretion of sub class.</li>
<li>Accessibility can not be narrow</li>
<li>throws can not be widen</li>
<li>static method can not be overridden in sub class &#8211; compiler error, however can be hidden</li>
<li>final method can not be overridden &#8211; compiler error</li>
<li>private method can not be overridden, however can be as exactly same prototype in sub class.</li>
<li>all above no override cases, early binding is done!</li>
</ul>
</div>
<div>Field Hiding</div>
<div>
<ul>
<li>sub class can not override field, it can hide field</li>
<li>use super to access super class fields including the ones hidden in sub class</li>
<li>static fields of supper class can also be hidden</li>
<li>only name has to be same to be hidden, rest all is ok!</li>
</ul>
</div>
<div>supper</div>
<div>
<ul>
<li>unlike this, it can not cast to other references or cast to other references type.</li>
<li>super.super .. not allowed</li>
<li>typecasting the &#8220;this&#8221; only changes its type, but its reference remains the same.</li>
</ul>
</div>
<div>Constructor</div>
<div>
<ul>
<li>chaining by this(), this() being the first statement in constructor.</li>
<li>super() constructor call must be the fist statement in sub class constructor</li>
<li>super() and this() can not be used together in a constructor.</li>
<li>if no explicit call to super(), default super() call is inserted implicitly.</li>
<li>in such case, if super dont have default constructor, compiler error occur.</li>
</ul>
</div>
<div>Interface</div>
<div>
<ul>
<li>sub interface extends base interface</li>
<li>all member variable are public static final and hence initialization is must.</li>
<li>all method/class/interface declaration are public and abstract.</li>
<li>class implementing interface method, have to keep method as public</li>
<li>class can not narrow access and can not broaden throws exception</li>
</ul>
</div>
<div>Extending Interface</div>
<div>
<ul>
<li>One interface can extend several interfaces (supper interfaces)</li>
</ul>
</div>
<div>Subclass</div>
</div>
<div>
<ul>
<li>one nested interface</li>
</ul>
<ol>
<li>static member interfaces</li>
</ol>
<ul>
<li>Four categories of nested classes</li>
</ul>
<ol>
<li>static member class</li>
<li>non static member class</li>
<li>local classes</li>
<li>anonymous classes</li>
</ol>
<ul>
<li>last three classes are called inner classes.</li>
<li>instance of an inner class may be associated with (iei) immediately enclosing instance.</li>
<li>instance of an inner class can also access members of iei by there simple name.</li>
</ul>
</div>
<div>
<ul>
<li>static member class can be instantiated as any top level class using its full name.</li>
<li>no iei is required.</li>
<li>interface are only at top level or static member, nothing else!</li>
</ul>
</div>
<div>
<ul>
<li>instance of a non static member can be defined like other member of a class, such class always have iei instance associated with it.</li>
<li>local classes are defined just as local member variable.</li>
<li>Anonymous class can be defined as expressions and instantiated on the fly.</li>
<li>A nested class can not have the same name as any of its enclosing classes.</li>
</ul>
</div>
<div>
<ul>
<li>Top level class can only be public or default.</li>
</ul>
<div>Garbage Collection</div>
<div>
<ul>
<li>Any object not accessible by a live thread is candidate for GC.</li>
<li>gc can be facilitated by nullifying the reference.</li>
<li>Program can request garbage collection, but no way it can be forced. GC call is not guaranteed so is finalizer call.</li>
<li>finalizer:- from the Object class, protected void finalize() throws Throable{super.finalize();} get called before the object get gc.</li>
<li>System.gc(); -&gt; request GC</li>
<li>System.runFunalizer(); -&gt; request to run any pending</li>
</ul>
</div>
<div>
<pre>
Access Specifiers:-
Modifier    | Class | Package | Subclass | World

public      |  Y    |    Y    |    Y     |   Y

protected   |  Y    |    Y    |    Y     |   N

no modifier |  Y    |    Y    |    N     |   N

private     |  Y    |    N    |    N     |   N</pre>
</div>
</div>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sjuneja.wordpress.com/92/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sjuneja.wordpress.com/92/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sjuneja.wordpress.com/92/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sjuneja.wordpress.com/92/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sjuneja.wordpress.com/92/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sjuneja.wordpress.com/92/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sjuneja.wordpress.com/92/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sjuneja.wordpress.com/92/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sjuneja.wordpress.com/92/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sjuneja.wordpress.com/92/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sjuneja.wordpress.com/92/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sjuneja.wordpress.com/92/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sjuneja.wordpress.com/92/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sjuneja.wordpress.com/92/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sjuneja.wordpress.com&amp;blog=1795710&amp;post=92&amp;subd=sjuneja&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sjuneja.wordpress.com/2011/07/30/core-java-question-answers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/58808f74067a1f808f4cf9afa228b43d?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">sjuneja</media:title>
		</media:content>

		<media:content url="http://www3.ntu.edu.sg/home/ehchua/programming/java/images/Exception_Classes.gif" medium="image" />
	</item>
		<item>
		<title>Collection Framework &#8211; Question Answer way!</title>
		<link>http://sjuneja.wordpress.com/2011/05/30/collection-framework-question-answer-way/</link>
		<comments>http://sjuneja.wordpress.com/2011/05/30/collection-framework-question-answer-way/#comments</comments>
		<pubDate>Sun, 29 May 2011 19:57:33 +0000</pubDate>
		<dc:creator>sjuneja</dc:creator>
				<category><![CDATA[J2SE]]></category>

		<guid isPermaLink="false">http://sjuneja.wordpress.com/?p=56</guid>
		<description><![CDATA[Q. What is collection framework ? A. The collection framework presents a set of standard utility classes for manging group of objects. Arbitrary objects can be stored, retrieved and manipulated as elements of collection. Q. Which package has collection framework ? this framework is provided in java.util package Q. What is Mathamatical concept of a set? A. A set is just a group of unique [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sjuneja.wordpress.com&amp;blog=1795710&amp;post=56&amp;subd=sjuneja&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><strong>Q. What is collection framework ?</strong></p>
<p>A. The collection framework presents a set of standard utility classes for manging group of objects.</p>
<p>Arbitrary objects can be stored, retrieved and manipulated as elements of collection.</p>
<p><strong>Q. Which package has collection framework ?</strong></p>
<p>this framework is provided in java.util package</p>
<p><strong>Q. What is Mathamatical concept of a <em>set?</em></strong></p>
<p>A. A set is just a group of unique items, meaning that the group contains no duplicates.</p>
<p>Some real-world examples of sets include the following:</p>
<ul>
<li>The set of uppercase letters &#8216;A&#8217; through &#8216;Z&#8217;</li>
<li>The set of nonnegative integers {0, 1, 2 &#8230;}</li>
</ul>
<div>
<p>These examples show the basic properties of sets:</p>
</div>
<div>
<ul>
<li>Sets contains only one instance of each item</li>
<li>Sets may be finite or infinite</li>
<li>Sets can define abstract concepts</li>
</ul>
</div>
<div>The idea of a &#8220;connection pool&#8221; is a set of open connections to a database server.</div>
<div>Web servers have to manage sets of clients and connections.</div>
<div>File descriptors provide another example of a set in the operating system.</div>
<div><strong>Q. <strong>What is Mathamatical concept of a Map</strong>?</strong></div>
<div>A. It is a set of pairs, each pair representing a one-directional &#8220;mapping&#8221; from one element to another. Some examples of maps are:</p>
<ul>
<li>The map of IP addresses to domain names (DNS)</li>
<li>A map from keys to database records</li>
<li>A dictionary (words mapped to meanings)</li>
<li>The conversion from base 2 to base 10</li>
</ul>
<div><strong>Q. Why Map don&#8217;t extend collection ?</strong></div>
<div>A. The typical application of a <code>Map</code> is to provide access to values stored by keys. The set of collection operations are all there, but you work with a key-value pair, instead of an isolated element. <code>Map</code> is therefore designed to support the basic operations of <span style="font-family:monospace;">get() </span>and put()<span style="font-family:monospace;"> </span>which are not required by <code>Set</code>.</div>
</div>
<div><strong>!Note:</strong> When designing software with the Collections Framework, it is useful to remember the following hierarchical relationships of the four</div>
<div>basic interfaces of the framework:</div>
<div>
<ul>
<li>The <code>Collection</code> interface is a group of objects, with duplicates allowed</li>
<li><code>Set</code> extends <code>Collection</code> but forbids duplicates</li>
<li><code>List</code> extends <code>Collection</code> also, allows duplicates and introduces positional indexing (order of element is retained)</li>
<li><code>Map</code> extends neither <code>Set</code> nor <code>Collection</code></li>
</ul>
<div>The following table shows the six collection implementations introduced with the Java 2 framework</div>
<div>
<table width="588" border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td valign="top" width="84"><strong>Interface</strong></td>
<td colspan="4" valign="top" width="396"><strong>Implementation</strong></td>
<td valign="top" width="108"><strong>Historical</strong></td>
</tr>
<tr>
<td valign="top" width="84">Set(.) no duplicate(.)at most one null</td>
<td valign="top" width="108">HashSet(.) No OrderHashing: Constant time for add, remove, contain, size</p>
<p>Key-&gt;Hashcode-&gt;Index</p>
<p>(.) no guaranty of order</td>
<td valign="top" width="108"></td>
<td valign="top" width="84">TreeSet(.) Sorted</p>
<p>Assenting</p>
<p>(.) Use tree for storage</p>
<p>(.) large data, sorted order, found quickly</p>
<p>Comparator</td>
<td valign="top" width="96">LinkedHashSet(.) Insertion Order</td>
<td valign="top" width="108"></td>
</tr>
<tr>
<td valign="top" width="84">List(.)allow duplicate(.)Positional indexing(.) Insertion Order</td>
<td valign="top" width="108"></td>
<td valign="top" width="108">ArrayList(.)notSynchronized(.)Random Access</p>
<p>(.)Easy Tail manipulation</p>
<p>(.)default size 0.</td>
<td valign="top" width="84"></td>
<td valign="top" width="96">LinkedList(.)Sequential Access(.)Add Remove Element in between</td>
<td valign="top" width="108">Vector<br />
Stack(.)synchronized, make it slow(.) default size 10Then double</td>
</tr>
<tr>
<td valign="top" width="84">Map(.)Unique Key</td>
<td valign="top" width="108">HashMap(.)Allow Null as key &amp; value(.)unsynchronized(.)no order</p>
<p>(.) get/put constant time for larger map</td>
<td valign="top" width="108"></td>
<td valign="top" width="84">TreeMap(.) Sorted in Key order(.)Natural ordering</p>
<p>Comparator</td>
<td valign="top" width="96">LinkeHashMap(.) Key insertion order.</td>
<td valign="top" width="108">Hashtable<br />
Properties(.)synchronized(.)can only store object the override hashCode() and equals()</p>
<p>Sting does.</td>
</tr>
</tbody>
</table>
</div>
<div>
<h5>Collection Interface</h5>
<h5><span class="Apple-style-span" style="font-size:13px;font-weight:normal;">The <code>Collection</code> interface is used to represent any group of objects, or elements. You use the interface when you wish to work with a group of elements in as general a manner as possible.</span></h5>
</div>
<div><img src="http://java.sun.com/developer/onlineTraining/collections/images/UMLCollection.gif" alt="UML Diagram for Collection Interface" width="252" height="261" /></div>
<div><span class="Apple-style-span" style="font-size:10px;font-weight:bold;"><a name="IteratorInterface"></a></span></div>
<div><span class="Apple-style-span" style="font-size:10px;font-weight:bold;">Iterator Interface</span></div>
<div>
<div><a name="IteratorInterface"></a></div>
<p><img src="http://java.sun.com/developer/onlineTraining/collections/images/UMLIterator.gif" alt="UML Diagram for Iterator Interface" width="122" height="98" /></p>
</div>
<div><strong>Q. What is the difference between HashSet &amp; TreeSet</strong></div>
<div>A. HashSet is not sorted while TreeSet is.</div>
<div>1) HashSet: For efficiency, objects added to a <code>HashSet</code> need to implement the <code>hashCode()</code> method in a manner that properly distributes the hash codes. While most system classes override the default <span style="font-family:monospace;">hashCode() </span>implementation in <code>Object</code>, when creating your own classes to add to a <code>HashSet</code> remember to override <code>hashCode()</code></div>
<div>2) TreeSet: The <code>TreeSet</code> implementation is useful when you need to extract elements from a collection in a sorted manner. In order to work property, elements added to a <code>TreeSet</code> must be sortable.</div>
</div>
<div>
<p>To optimize <code>HashSet</code> space usage, you can tune the initial capacity and load factor. The <code>TreeSet</code> has no tuning options, as the tree is always balanced, ensuring <code>log(n)</code> performance for insertions, deletions, and queries.</p>
<p><strong>!Note: All Collection concrete classes implements <code>Cloneable &amp; Serializable </code>interface.</strong></p>
<p><strong>Q. Can an implementation of collection be changed ?</strong></p>
<p>Each of the implementation of Collection interface provides a constructor for creating a collection based on elements of another Collection object passed as an argument. This interchangeability is true among Map implementation as well.</p>
<p>But Collection and Maps are not interchangeable.</p>
<p>Below example demonstrate use of HashSet, TreeSet and the way HashSet can be interchanged to TreeSet.</p>
<pre>public class SetExample {
  public static void main(String args[]) {
    Set set = new HashSet();
    set.add("Bernadine");
    set.add("Elizabeth");
    set.add("Gene");
    set.add("Elizabeth");
    set.add("Clara");
    System.out.println(set);
    Set sortedSet = new TreeSet(set);
    System.out.println(sortedSet);
  }
}
<span class="Apple-style-span" style="font-family:Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;font-size:13px;line-height:19px;white-space:normal;">Running the program produces the following output. Notice that the duplicate entry is only present once, and the second list output is sorted.</span>
[Gene, Clara, Bernadine, Elizabeth]
[Bernadine, Clara, Elizabeth, Gene]</pre>
<h6><strong><span class="Apple-style-span" style="font-size:13px;">Q. What does  <code>AbstractSet</code> class overrides?</span></strong></h6>
<h6><strong></strong><span class="Apple-style-span" style="font-size:13px;font-weight:normal;">A.The <code>AbstractSet</code> class overrides the <span style="font-family:monospace;">equals()</span> and <span style="font-family:monospace;">hashCode()</span> methods to ensure two equal sets return the same hash code. Two sets are equal if they are the same size and contain the same elements. By definition, the hash code for a set is the sum of the hash codes for the elements of the set. Thus, no matter what the internal ordering of the sets, two equal sets will report the same hash code.</span></h6>
<p><strong>Q. How List is different from Set ?</strong></p>
<p>A. List is an</p>
<p style="padding-left:30px;">Ordered collection</p>
<p style="padding-left:30px;">Permitting Duplicates</p>
<p style="padding-left:30px;">Ability to work with part of the list</p>
<p style="padding-left:30px;">Bidirectional Iterattion</p>
<p><strong>Q. When to use LinkedList &amp; when ArrayList?</strong></p>
<p><strong> ArrayList:</strong> If you need to support random access, without inserting or removing elements from any place other than the end, than <code>ArrayList</code> offers the optimal collection</p>
<p><strong>LinkedList: </strong>you need to frequently add and remove elements from the middle of the list and only access the list elements sequentially then <code>LinkedList</code> offers the better implementation</p>
<p><strong>!Note: </strong>Two List are equal if they are the same size and contain the same elements in the same order.</p>
<p><strong>Q. How can we determine the length of an ArrayList ? </strong></p>
<p>A. a.size();</p>
<p style="text-align:left;"><strong>Q. What is Map.Entity?</strong></p>
<p style="text-align:left;">A. The <code>entrySet()</code> method of <code>Map</code> returns a collection of objects that implement <code>Map.Entry</code> interface. Each object in the collection is a specific key-value pair in the underlying <code>Map</code>.</p>
<p style="text-align:left;"><strong>!Note : </strong>Both the key and value can be <code>null</code>. However, you should not add a <code>Map</code> to itself as a key or value.</p>
<p style="text-align:left;"><strong>Q. Difference between HashMap &amp; TreeMap ?</strong></p>
<p style="text-align:left;">A. <strong>HashMap: </strong>Deleting, and locating elements in a <code>Map</code>, the <code>HashMap</code> offers the best alternative</p>
<p style="text-align:left;"><strong>TreeMap: </strong>You need to traverse the keys in a sorted order, then <code>TreeMap</code> is your better alternative.</p>
<p style="text-align:left;">Depending upon the size of your collection, it may be faster to add elements to a <code>HashMap</code>, then convert the map to a <code>TreeMap</code> for sorted key traversal. Using a <code>HashMap</code> requires that the class of key added have a well-defined <code>hashCode()</code> implementation. With the <code>TreeMap</code> implementation, elements added to the map must be sortable.</p>
<p>To optimize <code>HashMap</code> space usage, you can tune the initial capacity and load factor. The <code>TreeMap</code> has no tuning options, as the tree is always balanced.</p>
<p><strong>!Note: </strong>Similar to the other abstract collection implementations, the <code>AbstractMap</code> class overrides the <code>equals()</code> and <code>hashCode()</code> methods to ensure two equal maps return the same hash code. Two maps are equal if they are the same size, contain the same keys, and each key maps to the same value in both maps. By definition, the hash code for a map is the sum of the hash codes for the elements of the map, where each element is an implementation of the <code>Map.Entry</code> interface. Thus, no matter what the internal ordering of the maps, two equal maps will report the same hash code.</p>
<p><strong>Q. What is Comparator?</strong></p>
<p>A. Defines how two objects are compared.</p>
<p><strong>Q. What is Autoboxing and Unboxing</strong></p>
<p>A. As Collection can not store primitives. Java perform the proper <strong>Autoboxing and Unboxing </strong>needed when storing or retrieving primitive types.</p>
<p><strong>Q. Collection extends Iterable interface</strong></p>
<p>A. Means can be cycled using for each type for loop.</p>
<p><strong>Q. </strong></p>
</div>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sjuneja.wordpress.com/56/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sjuneja.wordpress.com/56/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sjuneja.wordpress.com/56/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sjuneja.wordpress.com/56/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sjuneja.wordpress.com/56/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sjuneja.wordpress.com/56/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sjuneja.wordpress.com/56/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sjuneja.wordpress.com/56/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sjuneja.wordpress.com/56/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sjuneja.wordpress.com/56/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sjuneja.wordpress.com/56/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sjuneja.wordpress.com/56/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sjuneja.wordpress.com/56/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sjuneja.wordpress.com/56/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sjuneja.wordpress.com&amp;blog=1795710&amp;post=56&amp;subd=sjuneja&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sjuneja.wordpress.com/2011/05/30/collection-framework-question-answer-way/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/58808f74067a1f808f4cf9afa228b43d?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">sjuneja</media:title>
		</media:content>

		<media:content url="http://java.sun.com/developer/onlineTraining/collections/images/UMLCollection.gif" medium="image">
			<media:title type="html">UML Diagram for Collection Interface</media:title>
		</media:content>

		<media:content url="http://java.sun.com/developer/onlineTraining/collections/images/UMLIterator.gif" medium="image">
			<media:title type="html">UML Diagram for Iterator Interface</media:title>
		</media:content>
	</item>
		<item>
		<title>Synchronization &#8211; The Question Answer way!</title>
		<link>http://sjuneja.wordpress.com/2011/05/29/synchronization-the-question-answer-way/</link>
		<comments>http://sjuneja.wordpress.com/2011/05/29/synchronization-the-question-answer-way/#comments</comments>
		<pubDate>Sun, 29 May 2011 11:57:03 +0000</pubDate>
		<dc:creator>sjuneja</dc:creator>
				<category><![CDATA[J2SE]]></category>

		<guid isPermaLink="false">http://sjuneja.wordpress.com/?p=37</guid>
		<description><![CDATA[Q. What is the difference between Synchronization Method &#38; Synchronization Block. They can be differentiated on two basis:- 1) The nature of lock:- Synchronized method of an object is synchronized on the lock of the object or class (static synchronized method) of the method, while Synchronized block allows execution of arbitrary code to be synchronized on the lock of an arbitrary object. 2) [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sjuneja.wordpress.com&amp;blog=1795710&amp;post=37&amp;subd=sjuneja&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><strong>Q. What is the difference between Synchronization Method &amp; Synchronization Block.</strong></p>
<p>They can be differentiated on two basis:-</p>
<p>1) The nature of lock:-</p>
<p>Synchronized method of an object is synchronized on the lock of the object or class (static synchronized method) of the method, while</p>
<p>Synchronized block allows execution of arbitrary code to be synchronized on the lock of an arbitrary object.</p>
<p>2)  Granularity of lock:-</p>
<p>Synchronization Block mechanism allows fine-grained synchronization, while</p>
<p>Synchronized method are to be used when a method can manipulate the state of the object in ways that can corrupt the state if executed concurrently.</p>
<p><strong>Q. What are Locks ?</strong></p>
<p>A. Lock is used to synchronize access to shared resources</p>
<p>A thread gain access to a shared resource by first acquiring the lock associated with the resource</p>
<p>A lock thus implements mutual exclusion</p>
<p>All objects have a lock, only one thread at a time can access the shared resource guarded by the lock.</p>
<p><strong>Q. Number of ways access of the resource can be synchronized ?</strong></p>
<p>There are two ways in which access of the resource can be syncronized</p>
<p>a. Synchronized method</p>
<p>b. Synchronized block</p>
<p><strong>a. Synchronized method:-</strong></p>
<p style="padding-left:30px;">A thread wish to execute synchronized method must first obtain the OBJECTS LOCK before it can enter the object to execute the method.</p>
<p style="padding-left:30px;">In other words, Synchronized method of an object is synchronized on the lock of the object</p>
<p style="padding-left:30px;"><strong>Q. How is lock of the object achieved ?</strong></p>
<p style="padding-left:30px;">A. This is simply achieved Lock is by calling the method,  if the object&#8217;s lock is acquired by some other thread, the calling thread waits.</p>
<p style="padding-left:30px;"><strong>Q. When to Use synchronized method ?</strong></p>
<p style="padding-left:30px;">Synchronized method are to be used when a method can manipulate the state of the object in ways that can corrupt the state if executed concurrently.</p>
<p style="padding-left:30px;">Example:- Stack Push &amp; Pop methods. When one thread is pushing other thread can not pop.</p>
<p style="padding-left:30px;">When one thread is executing the synchronized method of an object, all other threads that wish to execute this or any other sync. method have to wait.</p>
<p style="padding-left:30px;">This does not applies to thread that already has the lock, such a method can call other sync. method without being blocked.</p>
<p style="padding-left:30px;"><strong>Important Note:-</strong></p>
<p style="padding-left:30px;"><strong>Q. How Static method are synchronized ?</strong></p>
<p style="padding-left:30px;">Static method synchronize on the class lock.</p>
<p style="padding-left:30px;">Also, synchronization of static method in a class is independent from the synchronization of instance method of the class.</p>
<p style="padding-left:30px;"><strong>Q. A synchronized method, when overridden in sub class, what happens to its synchronized quality ?</strong></p>
<p style="padding-left:30px;">A sub class decides whether the  new definition of an inherited synchronized method will remain synchronized in the subclass.</p>
<p><strong>b. Synchronized block</strong></p>
<p style="padding-left:30px;">Synchronized block allows execution of arbitrary code to be synchronized on the lock of an arbitrary object.</p>
<p style="padding-left:30px;">synchronized (&lt;object reference expression&gt;) {&lt;Code block&gt;}</p>
<p style="padding-left:30px;">&#8220;object reference expression&#8221; must evaluate to a non null reference value, else a null pointer exception is thrown</p>
<p style="padding-left:30px;">The code block is usually related to the object on which synchronization is done.</p>
<p style="padding-left:30px;">example:- synchronized (this) {}</p>
<p style="padding-left:30px;">Once the thread had entered the code block, no other thread will be able to execute the code block, or any other code requiring the same object lock.</p>
<p style="padding-left:30px;">This mechanism allows fine-grained synchronization of code on arbitrary object.</p>
<p style="padding-left:30px;">Q. <strong>Synchronization Block, are all part of the sytex <strong>mandatory?</strong></strong></p>
<p style="padding-left:30px;"><strong>&#8220;synchronized (&lt;object reference expression&gt;) {&lt;Code block&gt;}&#8221; </strong></p>
<p style="padding-left:30px;"><strong></strong>Object specification &amp; {} are mandatory even if we have a single line of code.</p>
<p style="padding-left:30px;"><strong>Q. An inner object might need to synchronize on its associated outer object, how is it achievable ?</strong></p>
<p style="padding-left:30px;">class Outer{</p>
<p style="padding-left:60px;">private double myPi;</p>
<p style="padding-left:60px;">protected class inner{</p>
<p style="padding-left:90px;">public void setPi(){</p>
<p style="padding-left:120px;">synchronized void setPi(Outer.this){</p>
<p style="padding-left:150px;">myPi = Math.PI;</p>
<p style="padding-left:120px;">}</p>
<p style="padding-left:90px;">}</p>
<p style="padding-left:60px;">}</p>
<p style="padding-left:30px;">}</p>
<p style="padding-left:30px;"><strong>Q. Can Synchronized block be specified on class lock ?</strong></p>
<p style="padding-left:30px;">Yes, by:-</p>
<p style="padding-left:30px;">synchronized (&lt;class name&gt;.class) {&lt;code block&gt;}</p>
<p style="padding-left:30px;">A static synchronized method of class A is equivalent to</p>
<p style="padding-left:30px;">static void classAction(){</p>
<p style="padding-left:60px;">synchronized (A.class)  {</p>
<p style="padding-left:90px;">&#8230;</p>
<p style="padding-left:60px;">}</p>
<p style="padding-left:30px;">}</p>
<p style="padding-left:30px;"><strong>Q. In how many ways a thread can hold a lock on an object ? </strong></p>
<p style="padding-left:30px;">1) By executing a member synchronized method, object lock.</p>
<p style="padding-left:30px;">2) By executing a static  synchronized method, class lock.</p>
<p style="padding-left:30px;">3) By executing a synchronized block, lock on an object or class.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sjuneja.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sjuneja.wordpress.com/37/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sjuneja.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sjuneja.wordpress.com/37/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sjuneja.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sjuneja.wordpress.com/37/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sjuneja.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sjuneja.wordpress.com/37/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sjuneja.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sjuneja.wordpress.com/37/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sjuneja.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sjuneja.wordpress.com/37/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sjuneja.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sjuneja.wordpress.com/37/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sjuneja.wordpress.com&amp;blog=1795710&amp;post=37&amp;subd=sjuneja&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sjuneja.wordpress.com/2011/05/29/synchronization-the-question-answer-way/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/58808f74067a1f808f4cf9afa228b43d?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">sjuneja</media:title>
		</media:content>
	</item>
		<item>
		<title>What is &#8220;System&#8221;, &#8220;out&#8221;, &#8220;println&#8221; in System.out.println ? Explain !</title>
		<link>http://sjuneja.wordpress.com/2011/05/29/what-is-system-out-println-in-system-out-println-explain/</link>
		<comments>http://sjuneja.wordpress.com/2011/05/29/what-is-system-out-println-in-system-out-println-explain/#comments</comments>
		<pubDate>Sun, 29 May 2011 09:42:50 +0000</pubDate>
		<dc:creator>sjuneja</dc:creator>
				<category><![CDATA[J2SE]]></category>

		<guid isPermaLink="false">http://sjuneja.wordpress.com/?p=33</guid>
		<description><![CDATA[System.out.println() System is a built-in class present in java.lang package. This class has a final modifier, which means that, it cannot be inherited by other classes. It contains pre-defined methods and fields, which provides facilities like standard input, output, etc. out is a static final field (ie, variable)in System class which is of the type PrintStream (a [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sjuneja.wordpress.com&amp;blog=1795710&amp;post=33&amp;subd=sjuneja&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<div id="post-800">System.out.println()</p>
<p><span style="text-decoration:underline;">System</span> is a built-in class present in java.lang package.<br />
This class has a final modifier, which means that, it cannot be inherited by other classes.<br />
It contains pre-defined methods and fields, which provides facilities like standard input, output, etc.</p>
<p><span style="text-decoration:underline;">out</span> is a static final field (ie, variable)in System class which is of the type PrintStream (a built-in class, contains methods to print the different data values).<br />
static fields and methods must be accessed by using the class name, so ( System.out ).</p>
<p><span style="text-decoration:underline;">out</span> here denotes the reference variable of the type PrintStream class.</p>
<p><span style="text-decoration:underline;">println()</span> is a public method in PrintStream class to print the data values.<br />
Hence to access a method in PrintStream class, we use out.println() (as non static methods and fields can only be accessed by using the refrence varialble)</p>
<p>System.out.println();</p>
<p>eg:</p>
<p>int i = 3;<br />
System.out.println(i);</p>
<p>the above code prints the value of 3 in the screen and brings the control to the next line.</p></div>
<div>All java programs automatically import java.lang package.This package defines a class called <strong><em>System</em></strong></div>
<div>standard input,output and error output of the java runtime are stored in <em><strong>in,out,err variable</strong></em></div>
<div>
<pre> 
Demo Program:-
class SystemTester
{
	public static void main(String[] args)
	{
		int i = 3;
		System.out.println(i);
		System.out.println(System.currentTimeMillis());
		//Return the current time in terms of milliseconds.
		System.out.println(System.getProperty("user.dir"));
	}
}

Output:-
E:\Java\Examples&gt;java SystemTester
3
1306662087283
E:\Java\Examples</pre>
</div>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sjuneja.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sjuneja.wordpress.com/33/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sjuneja.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sjuneja.wordpress.com/33/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sjuneja.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sjuneja.wordpress.com/33/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sjuneja.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sjuneja.wordpress.com/33/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sjuneja.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sjuneja.wordpress.com/33/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sjuneja.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sjuneja.wordpress.com/33/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sjuneja.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sjuneja.wordpress.com/33/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sjuneja.wordpress.com&amp;blog=1795710&amp;post=33&amp;subd=sjuneja&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sjuneja.wordpress.com/2011/05/29/what-is-system-out-println-in-system-out-println-explain/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/58808f74067a1f808f4cf9afa228b43d?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">sjuneja</media:title>
		</media:content>
	</item>
		<item>
		<title>Programming with JBoss Seam, using eclipse</title>
		<link>http://sjuneja.wordpress.com/2007/10/23/programming-with-jboss-seam/</link>
		<comments>http://sjuneja.wordpress.com/2007/10/23/programming-with-jboss-seam/#comments</comments>
		<pubDate>Tue, 23 Oct 2007 08:02:39 +0000</pubDate>
		<dc:creator>sjuneja</dc:creator>
				<category><![CDATA[JBoss Seam Framwork]]></category>

		<guid isPermaLink="false">http://sjuneja.wordpress.com/2007/10/23/programming-with-jboss-seam/</guid>
		<description><![CDATA[Seam is an application framework for Java EE 5. The best thing to start programming in seam is by going through the examples bundled with the seam distribution from http://labs.jboss.com/jbossseam/download/index.html, any thing else to start of will be second best for sure, I tried two books but non could give me a jump start like [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sjuneja.wordpress.com&amp;blog=1795710&amp;post=15&amp;subd=sjuneja&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://sjuneja.files.wordpress.com/2007/10/register.gif" title="Registeration"></a><a href="http://sjuneja.files.wordpress.com/2007/10/register.gif" title="Registeration"></a><a href="http://sjuneja.files.wordpress.com/2007/10/register.gif" title="Register"></a>Seam is an application framework for Java EE 5.</p>
<p>The best thing to start programming in seam is by going through the examples bundled with the seam distribution from <a href="http://labs.jboss.com/jbossseam/download/index.html"><font color="#6c8c37">http://labs.jboss.com/jbossseam/download/index.html</font></a>, any thing else to start of will be second best for sure, I tried two books but non could give me a jump start like the start given by the seam examples.</p>
<p>Here I would also like to give you some comments about the two books I have gon through so that I could support you in making a choice of book for learning ahead after this post.</p>
<p>1) Apress.Beginning.JBoss.Seam.Feb.2007</p>
<p>Is a beginners book and assume that you have very little knowledge of EJBs and starts from scratch. the book clearly shows how easy and fast it is to program in JBoss Seam by comparing the way we program in struts with jboss for the same problem at hand.</p>
<p>2) Prentice.Hall.JBoss.Seam.Simplicity.and.Power.Beyond.Java.EE.Apr.2007</p>
<p>this book is not a beginners book but an intermediate one, the book is a comprehensive guide on Seam.</p>
<p><font size="3" face="Times-Roman"><u>Let&#8217;s start Learning</u></font></p>
<p>Here we will cover one of the seam example application to understand how easy it is to develop application in JBoss Seam, various features of JBoss seam has been covered in my previous post titled &#8220;Features of JBoss Seam&#8221;.</p>
<p>Here we will also cover the way we can run the same examples using eclipse IDE and use the examples as template for our custom application development.</p>
<p>before starting with the example, lets have a quick look where seam sits in an enterprise application.<a href="http://sjuneja.files.wordpress.com/2007/10/register.gif" title="Register"></a></p>
<p><a href="http://sjuneja.files.wordpress.com/2007/10/architecture.png" title="architecture.png"><img src="http://sjuneja.files.wordpress.com/2007/10/architecture.png?w=600" alt="architecture.png" /></a></p>
<p>Seam does the role of a Context Management and JSF serving as a Request Controller, while in the presentation tier we have the option to use any of the three, JSP, Facelets and Portal and similarly for the State Management we can use EJB3, JBossjBPM or Hibernate.</p>
<p>It turns out that the combination of Seam, JSF and EJB3 is <span class="emphasis"><em>the</em></span> simplest way to write a complex web application in Java. You won&#8217;t believe how little code is required!</p>
<p>Before starting the example please follow the steps in my earlier post &#8220;<a href="http://sjuneja.wordpress.com/2007/10/12/install-and-configure-jboss-seam/">Install and configure JBoss Seam</a>&#8221; for performing the necessary setup for running JBoss Seam application.</p>
<p><strong>&#8220;Registration Example&#8221;</strong></p>
<p>The registration example is a fairly trivial application that lets a new user store his username, real name and password in the database. The example isn&#8217;t intended to show off all of the cool functionality of Seam. However, it demonstrates the use of an EJB3 session bean as a JSF action listener, and basic configuration of Seam.</p>
<p><em>Following is the registration screen of the application</em></p>
<p><a href="http://sjuneja.files.wordpress.com/2007/10/register.gif" title="Registeration"></a></p>
<p><a href="http://sjuneja.files.wordpress.com/2007/10/register-user.gif" title="Register User"><img src="http://sjuneja.files.wordpress.com/2007/10/register-user.gif?w=600" alt="Register User" /></a></p>
<p><u>Understanding the structure of application.</u></p>
<p>The application is implemented using two JSP pages, one entity bean and one stateless session bean.</p>
<p><a href="http://sjuneja.files.wordpress.com/2007/10/application-structure.gif" title="Application Structure"><img src="http://sjuneja.files.wordpress.com/2007/10/application-structure.gif?w=600" alt="Application Structure" /></a></p>
<p><u>Let&#8217;s take a look at the code, starting from the &#8220;bottom&#8221;.</u></p>
<p><strong>The entity bean: User.java</strong></p>
<p>This class serve two purposes</p>
<p>1) define persistence</p>
<p>2) and validation declaratively, via anotations</p>
<p>The code of this class is as follows, please find my comments with code as the explanation of the code with &#8220;-&gt;&#8221; mark<br />
<font color="#008000"><br />
@Entity // -&gt; indicates that the <tt>User</tt> class is an entity bean<br />
@Name(&#8220;user&#8221;) // -&gt; Seam components requre a component name provided by @Name anotations<br />
@Scope(SESSION) // -&gt; User bean is a session scope component.<br />
@Table(name=&#8221;users&#8221;) // -&gt; Persistence: User class is mapped to user table.<br />
public class User implements Serializable {<br />
private static final long serialVersionUID = 1881413500711441951L;<br />
 // -&gt; name, <tt>password</tt> and <tt>username</tt> are the persistent attributes of the entity bean<br />
private String username; <span class="co">(5)</span><br />
 private String password;<br />
 private String name;<br />
public User(String name, String password, String username) {<br />
  this.name = name;<br />
  this.password = password;<br />
this.username = username;<br />
 }<br />
 public User() {} <span class="co">(6)</span><br />
 // -&gt; The <tt>@NotNull</tt> and <tt>@Length</tt>annotations are part of the Hibernate Validator framework<br />
@NotNull @Length(min=5, max=15) <span class="co">(7)</span><br />
public String getPassword() { return password; }<br />
public void setPassword(String password) { this.password = password; }<br />
@NotNull<br />
public String getName() { return name; }<br />
public void setName(String name) { this.name = name; }<br />
// -&gt; EJB standard <tt>@Id</tt> annotation indicates primary key attribute of entity bean.<br />
@Id @NotNull @Length(min=5, max=15) <span class="co">(8)</span><br />
public String getUsername() { return username; }<br />
public void setUsername(String username) { this.username = username; }<br />
}<br />
</font><br />
Properties of our <tt>User</tt>class are bound to directly to JSF components and are populated by JSF during the update model values phase.</p>
<p><u>Now we will have a look at the state less session bean class RegisterAction.java which defines the action listner method.</u></p>
<p><strong>RegisterAction.java</strong><br />
<font color="#008000"><br />
@Stateless // -&gt; stateless session bean.@Name(&#8220;register&#8221;)public class RegisterAction implements Register{<br />
  @In // -&gt; marks an attribute injected by Seam, In this case, the attribute is injected<br />
  // from a context variable named <tt>user</tt> private User user; @PersistenceContext // -&gt; used to inject the EJB3 entity manager. private EntityManager em; @Logger // -&gt; used to inject the component&#8217;s <tt>Log</tt> instance private Log log;</font><font color="#008000">public String register() (5)</p>
<p>{</p>
<p>List existing = em.createQuery(</p>
<p>&#8220;select username from User where username=#{user.username}&#8221;) (6)</p>
<p>.getResultList();</p>
<p>if (existing.size()==0)</p>
<p>{</p>
<p>em.persist(user);</p>
<p>log.info(&#8220;Registered new user #{user.username}&#8221;); (7)</p>
<p>return &#8220;/registered.jsp&#8221;; (8)</p>
<p>}</p>
<p>else</p>
<p>{</p>
<p>FacesMessages.instance().add(&#8220;User #{user.username} already exists&#8221;); (9)</p>
<p>return null;</p>
<p>}</p>
<p>}<br />
}</p>
<p><em>Note that:</em></p>
<p></font>1) The <tt>Log</tt>API lets us easily display templated log messages.</p>
<p>2) JSF action listener methods return a string-valued outcome that determines what page will be displayed next. A null outcome (or a void action listener method) redisplays the previous page. In plain JSF, it is normal to always use a JSF <span class="emphasis"><em>navigation rule</em></span>to determine the JSF view id from the outcome. For complex application this indirection is useful and a good practice. However, for very simple examples like this one, Seam lets you use the JSF view id as the outcome, eliminating the requirement for a navigation rule. <span class="emphasis"><em>Note that when you </em></span><span class="emphasis"><em>use a view id as an outcome, Seam always performs a browser redirect.</em></span></p>
<p>3) Seam provides a number of <span class="emphasis"><em>built-in components</em></span> to help solve common problems.<br />
The <tt>FacesMessages</tt>component makes it easy to display templated error or success messages. Built-in Seam components may be obtained by injection, or by calling an <tt>instance()</tt> method.</p>
<p><u>The session bean local interface:</u></p>
<p><strong>Register.java</strong><br />
<tt><br />
@Local public interface Register { public String register(); }</tt><tt> </tt></p>
<p>That&#8217;s the end of the Java code.</p>
<p><u>Now we will cover some of the deployment descriptors as most of the deployment files have common code among various applications.</u></p>
<p>1) <strong>components.xml</strong></p>
<p>&lt;components xmlns=&#8221;http://jboss.com/products/seam/components&#8221;<br />
  xmlns:core=&#8221;http://jboss.com/products/seam/core&#8221;&gt;<br />
  &lt;core:init jndi-pattern=&#8221;@jndiPattern@&#8221;/&gt;<br />
&lt;/components&gt;</p>
<p>This code configures a property named <tt>jndiPattern</tt> of a built-in Seam component named <tt>org.jboss.seam.core.init</tt>.</p>
<p>2) <strong>web.xml</strong></p>
<p>This <tt>web.xml</tt>file configures Seam and MyFaces</p>
<p>3) <font face="Courier New"><strong>faces-config.xml</strong></font></p>
<p>The <tt>faces-config.xml</tt>file integrates Seam into JSF</p>
<p>In fact, once you have all the basic descriptors set up, the <span class="emphasis"><em>only</em></span>XML you need to write as you add new functionality to a Seam application is the navigation rules, and possibly jBPM process definitions. Seam takes the view that <span class="emphasis"><em>process flow</em></span> and <span class="emphasis"><em>configuration data</em></span> are the only things that truly belong in XML.</p>
<p>In this simple example, we don&#8217;t even need a navigation rule, since we decided to embed the view id in our action code.</p>
<p>4) <font face="Courier New"><strong>ejb-jar.xml</strong></font></p>
<p>The <tt>ejb-jar.xml</tt> file integrates Seam with EJB3, by attaching the <tt>SeamInterceptor</tt> to all session beans in the archive.</p>
<p>5) <font face="Courier New"><strong>persistence.xml</strong></font></p>
<p>The <tt>persistence.xml</tt>file tells the EJB persistence provider where to find the datasource</p>
<p><u>The view files</u></p>
<p>1) <strong>register.jsp</strong></p>
<p>&lt;%@ taglib uri=&#8221;<a href="http://java.sun.com/jsf/html">http://java.sun.com/jsf/html</a>&#8221; prefix=&#8221;h&#8221; %&gt;<br />
&lt;%@ taglib uri=&#8221;<a href="http://java.sun.com/jsf/core">http://java.sun.com/jsf/core</a>&#8221; prefix=&#8221;f&#8221; %&gt;<br />
&lt;%@ taglib uri=&#8221;<a href="http://jboss.com/products/seam/taglib">http://jboss.com/products/seam/taglib</a>&#8221; prefix=&#8221;s&#8221; %&gt;<br />
&lt;html&gt;<br />
 &lt;head&gt;<br />
  &lt;title&gt;Register New User&lt;/title&gt;<br />
 &lt;/head&gt;<br />
 &lt;body&gt;<br />
  &lt;f:view&gt;<br />
  &lt;h:form&gt;<br />
  &lt;table border=&#8221;0&#8243;&gt;<br />
  &lt;s:validateAll&gt;<br />
  &lt;tr&gt;<br />
  &lt;td&gt;Username&lt;/td&gt;<br />
  &lt;td&gt;&lt;h:inputText value=&#8221;#{user.username}&#8221;/&gt;&lt;/td&gt;<br />
  &lt;/tr&gt;<br />
  &lt;tr&gt;<br />
  &lt;td&gt;Real Name&lt;/td&gt;<br />
  &lt;td&gt;&lt;h:inputText value=&#8221;#{user.name}&#8221;/&gt;&lt;/td&gt;<br />
  &lt;/tr&gt;<br />
  &lt;tr&gt;<br />
  &lt;td&gt;Password&lt;/td&gt;<br />
  &lt;td&gt;&lt;h:inputSecret value=&#8221;#{user.password}&#8221;/&gt;&lt;/td&gt;<br />
  &lt;/tr&gt;<br />
  &lt;/s:validateAll&gt;<br />
  &lt;/table&gt;<br />
  &lt;h:messages/&gt;<br />
  &lt;h:commandButton type=&#8221;submit&#8221; value=&#8221;Register&#8221; action=&#8221;#{register.register}&#8221;/&gt;<br />
  &lt;/h:form&gt;<br />
  &lt;/f:view&gt;<br />
 &lt;/body&gt;<br />
&lt;/html&gt;</p>
<p>The only thing here that is specific to Seam is the <tt>&lt;s:validateAll&gt;</tt>tag. This JSF component tells JSF to validate all the contained input fields against the Hibernate Validator annotations specified on the entity bean.</p>
<p>2) <strong>registered.jsp</strong></p>
<p>&lt;%@ taglib uri=&#8221;<a href="http://java.sun.com/jsf/html">http://java.sun.com/jsf/html</a>&#8221; prefix=&#8221;h&#8221; %&gt;<br />
&lt;%@ taglib uri=&#8221;<a href="http://java.sun.com/jsf/core">http://java.sun.com/jsf/core</a>&#8221; prefix=&#8221;f&#8221; %&gt;<br />
&lt;html&gt;<br />
 &lt;head&gt;<br />
  &lt;title&gt;Successfully Registered New User&lt;/title&gt;<br />
 &lt;/head&gt;<br />
 &lt;body&gt;<br />
  &lt;f:view&gt;<br />
  Welcome, &lt;h:outputText value=&#8221;#{user.name}&#8221;/&gt;,<br />
  you are successfully registered as &lt;h:outputText value=&#8221;#{user.username}&#8221;/&gt;.<br />
  &lt;/f:view&gt;<br />
 &lt;/body&gt;<br />
&lt;/html&gt;</p>
<p><strong><u>How it works</u></strong></p>
<p>When the form is submitted, JSF asks Seam to resolve the variable named <tt>user</tt>. Since there is no value already bound to that name (in any Seam context), Seam instantiates the <tt>user</tt> component, and returns the resulting <tt>User</tt>entity bean instance to JSF after storing it in the Seam session context.</p>
<p>The form input values are now validated against the Hibernate Validator constraints specified on the <tt>User</tt>entity. If the constraints are violated, JSF redisplays the page. Otherwise, JSF binds the form input values to properties of the <tt>User</tt> entity bean.</p>
<p>Next, JSF asks Seam to resolve the variable named <tt>register</tt>. Seam finds the <tt>RegisterAction</tt>stateless session bean in the stateless context and returns it. JSF invokes the <tt>register()</tt> action listener method.</p>
<p>Seam intercepts the method call and injects the <tt>User</tt> entity from the Seam session context, before continuing the invocation.</p>
<p>The <tt>register()</tt>method checks if a user with the entered username already exists. If so, an error message is queued with the <tt>FacesMessages</tt> component, and a null outcome is returned, causing a page redisplay. The <tt>FacesMessages</tt>component interpolates the JSF expression embedded in the message string and adds a JSF <tt>FacesMessage</tt> to the view.</p>
<p>If no user with that username exists, the <tt>"/registered.jsp"</tt> outcome triggers a browser redirect to the <tt>registered.jsp</tt>page. When JSF comes to render the page, it asks Seam to resolve the variable named <tt>user</tt> and uses property values of the returned <tt>User</tt> entity from Seam&#8217;s session scope.</p>
<p><strong><u>To run the example from eclipse</u></strong></p>
<p>Step 1) In eclipse create a new java project with existing source code and give the name of the project as &#8220;registration&#8221;, browse to pint the directory where the &#8220;registration&#8221; example source code is unziped, then click on finish.</p>
<p><a href="http://sjuneja.files.wordpress.com/2007/10/newproject.gif" title="New Project"><img src="http://sjuneja.files.wordpress.com/2007/10/newproject.gif?w=600" alt="New Project" /></a></p>
<p>Step 2) add</p>
<p>testng.jar<br />
myfaces-all.jar<br />
jsf-api.jar<br />
jboss-seam.jar<br />
jboss-ejb3-all.jar<br />
jboss-4.2.1.GA.jar<br />
hibernate-all.jar<br />
ejb3-persistence.jar</p>
<p>to your classpath.</p>
<p>Step 3) Right click build.xml of the registration project and select Run As &#8211; &gt; Ant Build</p>
<p><a href="http://sjuneja.files.wordpress.com/2007/10/antbuild.gif" title="Ant Build"><img src="http://sjuneja.files.wordpress.com/2007/10/antbuild.gif?w=600" alt="Ant Build" /></a></p>
<p>Step 4) (make sure you have jboss server add before doing this step)</p>
<p>Select the &#8220;registration project&#8221; tree node from the navigator window to select &#8220;Debug As&#8221; -&gt; &#8220;Open Debug Dialog&#8221; -&gt; &#8220;Debug&#8221; to start the server in debug mode.</p>
<p>Step 5) open the browser window and type <a href="http://localhost:8080/seam-registration">http://localhost:8080/seam-registration</a> to start the &#8220;registration application&#8221;.</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/sjuneja.wordpress.com/15/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/sjuneja.wordpress.com/15/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sjuneja.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sjuneja.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sjuneja.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sjuneja.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sjuneja.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sjuneja.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sjuneja.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sjuneja.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sjuneja.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sjuneja.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sjuneja.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sjuneja.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sjuneja.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sjuneja.wordpress.com/15/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sjuneja.wordpress.com&amp;blog=1795710&amp;post=15&amp;subd=sjuneja&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sjuneja.wordpress.com/2007/10/23/programming-with-jboss-seam/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/58808f74067a1f808f4cf9afa228b43d?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">sjuneja</media:title>
		</media:content>

		<media:content url="http://sjuneja.files.wordpress.com/2007/10/architecture.png" medium="image">
			<media:title type="html">architecture.png</media:title>
		</media:content>

		<media:content url="http://sjuneja.files.wordpress.com/2007/10/register-user.gif" medium="image">
			<media:title type="html">Register User</media:title>
		</media:content>

		<media:content url="http://sjuneja.files.wordpress.com/2007/10/application-structure.gif" medium="image">
			<media:title type="html">Application Structure</media:title>
		</media:content>

		<media:content url="http://sjuneja.files.wordpress.com/2007/10/newproject.gif" medium="image">
			<media:title type="html">New Project</media:title>
		</media:content>

		<media:content url="http://sjuneja.files.wordpress.com/2007/10/antbuild.gif" medium="image">
			<media:title type="html">Ant Build</media:title>
		</media:content>
	</item>
	</channel>
</rss>
