<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-5937173170152272619</id><updated>2012-02-19T17:56:12.450-08:00</updated><title type='text'>iCeHanGeR's  foolish notes for Living</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://icehanger.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://icehanger.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>iCehaNgeR's hAcK NoteS</name><uri>http://www.blogger.com/profile/03757838076375432274</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>83</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-5937173170152272619.post-5242369834120404520</id><published>2012-02-02T04:51:00.000-08:00</published><updated>2012-02-02T04:51:08.041-08:00</updated><title type='text'></title><content type='html'>Gimp Photo scaling for even height and width.&lt;br /&gt;
&lt;br /&gt;
Lot of times when you want to scale the image to a square value lets say 2x2 the scaling value won't match. To fix this use this options&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Use the rectangle select and choose fixed&amp;nbsp; and size from drop down.&lt;/li&gt;
&lt;li&gt;Give a higher square number like 2700x 2700 so that the select rectangle cover the intended area of your picture.&lt;/li&gt;
&lt;li&gt;now crop the image to selection.&lt;/li&gt;
&lt;li&gt;During scaling provide DPI value as 300 pixels and your intended scaling number like 2 inch and 2 inch&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
For clearing the background.&lt;br /&gt;
 &lt;br /&gt;
&lt;ul&gt;
&lt;li&gt; Use the fuzzy select and select the area you want to clear.&lt;/li&gt;
&lt;li&gt;Use the color picker to get the color. &lt;/li&gt;
&lt;li&gt;right click and fill it with the choose color&lt;/li&gt;
&lt;li&gt;finish it up with paint tool to get more even color.&lt;/li&gt;
&lt;li&gt;Finallyuse the fuzzy select tool again on the background now right click on the selection and select image color option and select brightness give the max value for a white background.&lt;/li&gt;
&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5937173170152272619-5242369834120404520?l=icehanger.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icehanger.blogspot.com/feeds/5242369834120404520/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5937173170152272619&amp;postID=5242369834120404520' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/5242369834120404520'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/5242369834120404520'/><link rel='alternate' type='text/html' href='http://icehanger.blogspot.com/2012/02/gimp-photo-scaling-for-even-height-and.html' title=''/><author><name>iCehaNgeR's hAcK NoteS</name><uri>http://www.blogger.com/profile/03757838076375432274</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5937173170152272619.post-6901536773562151473</id><published>2011-02-16T16:01:00.000-08:00</published><updated>2011-02-16T16:13:11.837-08:00</updated><title type='text'>SOAPUI</title><content type='html'>Steps needed.

&lt;ol&gt;&lt;li&gt;Create a New Rest SOAPUI project.&lt;/li&gt;&lt;li&gt;Import the WADL to create the REST project.&lt;/li&gt;&lt;/ol&gt;&lt;ul&gt;&lt;li&gt;If the REST project does not have a WADL file, it can be created easily by typing the REST url with ending application.wadl under the context of REST&lt;/li&gt;&lt;li&gt;http://host/project/context/application.wadl&lt;/li&gt;&lt;li&gt;This will generate the WADL file required for SOAPUI.&lt;/li&gt;&lt;/ul&gt;     &lt;li&gt;  Create a TestSetup in the SOAPUI project.&lt;/li&gt;
&lt;ol&gt;&lt;li&gt;Create a TestSuite.&lt;/li&gt;&lt;li&gt;Write the Groovy script in the setup portion of the Testcase.&lt;/li&gt;&lt;li&gt;If the Groovy file needs an external library or your application class jar that file and add them under the  /bin/ext folder in SOAPUI home folder. Otherwise you will get the classnot found error during exception.&lt;/li&gt;&lt;li&gt;Create a property file if you want a dynamic variable change during your request.&lt;/li&gt;&lt;li&gt;Create the REST request as the test case&lt;/li&gt;&lt;li&gt;Now change the Request file to add the properties.&lt;/li&gt;&lt;li&gt;Run the Testsuite.
&lt;/li&gt;&lt;/ol&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5937173170152272619-6901536773562151473?l=icehanger.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icehanger.blogspot.com/feeds/6901536773562151473/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5937173170152272619&amp;postID=6901536773562151473' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/6901536773562151473'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/6901536773562151473'/><link rel='alternate' type='text/html' href='http://icehanger.blogspot.com/2011/02/soapui.html' title='SOAPUI'/><author><name>iCehaNgeR's hAcK NoteS</name><uri>http://www.blogger.com/profile/03757838076375432274</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5937173170152272619.post-1531119931292592125</id><published>2011-02-14T11:33:00.000-08:00</published><updated>2011-02-14T11:35:31.245-08:00</updated><title type='text'>REST WADL</title><content type='html'>http://10.xxx.xx.x:8080/{$projectname}/{$rest}/application.wadl


That should generate the required WADL for creating SOAPUI project&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5937173170152272619-1531119931292592125?l=icehanger.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icehanger.blogspot.com/feeds/1531119931292592125/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5937173170152272619&amp;postID=1531119931292592125' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/1531119931292592125'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/1531119931292592125'/><link rel='alternate' type='text/html' href='http://icehanger.blogspot.com/2011/02/rest-wadl.html' title='REST WADL'/><author><name>iCehaNgeR's hAcK NoteS</name><uri>http://www.blogger.com/profile/03757838076375432274</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5937173170152272619.post-5107809774893160072</id><published>2010-04-16T15:43:00.000-07:00</published><updated>2010-04-16T15:44:18.823-07:00</updated><title type='text'>List ports listening</title><content type='html'>&lt;div class="mycode"&gt;
netstat -tlnp | grep 8080



netstat -tlnp | grep java
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5937173170152272619-5107809774893160072?l=icehanger.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icehanger.blogspot.com/feeds/5107809774893160072/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5937173170152272619&amp;postID=5107809774893160072' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/5107809774893160072'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/5107809774893160072'/><link rel='alternate' type='text/html' href='http://icehanger.blogspot.com/2010/04/list-ports-listening.html' title='List ports listening'/><author><name>iCehaNgeR's hAcK NoteS</name><uri>http://www.blogger.com/profile/03757838076375432274</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5937173170152272619.post-6517457762918251667</id><published>2010-04-16T15:19:00.000-07:00</published><updated>2010-04-16T15:21:43.797-07:00</updated><title type='text'>List all installed jre linux</title><content type='html'>&lt;div class="mycode"&gt;
/usr/sbin/update-alternatives --config java
&lt;/div&gt;


&lt;div class="mycode"&gt;

There are 2 programs which provide 'java'.

  Selection    Command
-----------------------------------------------
*  1           /usr/lib/jvm/jre-1.4.2-gcj/bin/java
 + 2           /usr/java/jdk1.6.0_18/bin/java

Enter to keep the current selection[+], or type selection number:
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5937173170152272619-6517457762918251667?l=icehanger.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icehanger.blogspot.com/feeds/6517457762918251667/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5937173170152272619&amp;postID=6517457762918251667' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/6517457762918251667'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/6517457762918251667'/><link rel='alternate' type='text/html' href='http://icehanger.blogspot.com/2010/04/list-all-installed-jre-linux.html' title='List all installed jre linux'/><author><name>iCehaNgeR's hAcK NoteS</name><uri>http://www.blogger.com/profile/03757838076375432274</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5937173170152272619.post-3268836939574113828</id><published>2010-03-25T17:43:00.000-07:00</published><updated>2010-03-25T17:46:31.587-07:00</updated><title type='text'>Find the large hidden files in your file system</title><content type='html'>&lt;div class="mycode"&gt;
find {/path/to/yourdirectory} -type f -size +{file-size-in-kb}k -exec ls -lh {} \; | awk '{ print $8 ": " $5 }' 
&lt;/div&gt;

where $8 will show your directory and $5 size of the directory.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5937173170152272619-3268836939574113828?l=icehanger.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icehanger.blogspot.com/feeds/3268836939574113828/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5937173170152272619&amp;postID=3268836939574113828' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/3268836939574113828'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/3268836939574113828'/><link rel='alternate' type='text/html' href='http://icehanger.blogspot.com/2010/03/find-large-hidden-files-in-your-file.html' title='Find the large hidden files in your file system'/><author><name>iCehaNgeR's hAcK NoteS</name><uri>http://www.blogger.com/profile/03757838076375432274</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5937173170152272619.post-4823797926633959031</id><published>2010-01-01T10:07:00.000-08:00</published><updated>2010-01-01T10:29:05.227-08:00</updated><title type='text'>Desprado Song</title><content type='html'>&lt;pre&gt;
Desperado, why don't you come to your senses?
You been out ridin' fences for so long now
Oh, you're a hard one
I know that you got your reasons
These things that are pleasin' you
Can hurt you somehow
Don' you draw the queen of diamonds, boy
She'll beat you if she's able
You know the queen of hearts is always your best bet

Now it seems to me, some fine things
Have been laid upon your table
But you only want the ones that you can't get

Desperado, oh, you ain't gettin' no youger
Your pain and your hunger, they're drivin' you home
And freedom, oh freedom well, that's just some people talkin'
Your prison is walking through this world all alone

Don't your feet get cold in the winter time?
The sky won't snow and the sun won't shine
It's hard to tell the night time from the day
You're loosin' all your highs and lows
Ain't it funny how the feeling goes away?

Desperado, why don't you come to your senses?
Come down from your fences, open the gate
It may be rainin', but there's a rainbow above you
You better let somebody love you, before it's too late        &lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5937173170152272619-4823797926633959031?l=icehanger.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icehanger.blogspot.com/feeds/4823797926633959031/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5937173170152272619&amp;postID=4823797926633959031' title='22 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/4823797926633959031'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/4823797926633959031'/><link rel='alternate' type='text/html' href='http://icehanger.blogspot.com/2010/01/desprado-song.html' title='Desprado Song'/><author><name>iCehaNgeR's hAcK NoteS</name><uri>http://www.blogger.com/profile/03757838076375432274</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>22</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5937173170152272619.post-1582020811515376229</id><published>2009-07-13T08:25:00.000-07:00</published><updated>2009-07-13T20:25:36.354-07:00</updated><title type='text'>Google Voice Gizmo5 Sipphone and Ekiga on Ubuntu</title><content type='html'>&lt;p&gt;
I got a invite from Google for setting up a Google voice number. Since I use Ubuntu 64bit on my desktop, the default softphone with Jaunty is Ekiga. I downloaded the Gizmo5 client some reason it is not  able to detect my sound card and Alsa configuration. Long story short. The working configuration. 
&lt;/p&gt;

&lt;p&gt;
 My Goal :  Receive phone calls and place outbound calls from my linux desktop without paying anything to my cellphone provider or local cable company. Forward all calls (cellular and home Phone) to my Linux desktop during weekend.
&lt;/p&gt;

&lt;p&gt;
 Google Voice : with your Google voice number you can place call all over United States. For placing call you have to sign in to Google Voice account. You will get a nice GWT interface like your Gmail. There you have to select, the place call option and enter the phone where you want to dial.
&lt;/p&gt;
&lt;p&gt;
Here is the Gotcha. Google voice number is not a sip application, it's just a phone number router. It is not a softphone. You have two option now either configure you cellephone to forward the Google voice number and use the cellephone to speak to person who you are calling. Alternatively you can configure a softphone on your computer to receive and place call(again place call means you cannot use the softphone's dialpad and call straight to the callee, You have to use the Google voice web interface).
&lt;/P&gt;

&lt;div class="mycode"&gt;
Setup  Ekiga Account:

Create Ekiga account from Ekiga.net. You can skip the voice out number you don't need it.

Setup Gizmod5 -Sipphone account. 

I am still not sure what is the deal here both are owned by same people now.

https://signup.sipphone.com/new-users/app?class=NewUser;proc=start

This will allow you to create the account. 
&lt;/div&gt;
If all good

Success you should see this screen.

&lt;div class="mycode"&gt;
Welcome to My.SIPphone.
Gizmo Project name
 icehanger
SIP number
 17474XXXXXXX
Proxy Server
 proxy01.sipphone.com
Proxy Server Port
 5060
Email Address icehanger@XXXXX.com

&lt;/div&gt;
&lt;p&gt;
Nice ! one thing over. Now login to your gizmo account by the account name you created just now. In the Forwarding Gizmo5 Calls sub division.

Select -  Forward all calls to  and here Select  Sip. what you have enter is your Ekiga sip account information like youraccountnaame@ekiga.net.

What this will do is, it will forward all calls to your Gizmo phone number to the Ekiga Softphone. 


&lt;/p&gt;

Ekiga softphone setup:

&lt;p&gt;
 In the Ekiga softphone setup login with your account and from the accounts add a new account. Here is where we need to add the Gizmo sip information to be added.

Name your gizmo name
registrar : proxy01.sipphone.com
user: Your gizmo phone number  (1747xxxxxxx)
authinticatio user : Your gizmo phone number (1747xxxxxxx) (both user and authintaction user are same)
password gizmo password.
time out : leave the default.

&lt;/p&gt;
Now one more setting on your Google voice account. 

From setting --&gt; Phone add a phone select Gizmo and add the gizmo phone number and select forwarding . 

Nice. you are ready to to test now.

&lt;ul&gt;
1. Place  a call from Google Voice web interface to any number. Your Ekiga softphone should ring.

2. For first time user you have to authenticat the phone by entering the 2 digit code. 

3. Now if the callee takes the phone you can start conversation through the Ekiga soft client.
&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5937173170152272619-1582020811515376229?l=icehanger.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icehanger.blogspot.com/feeds/1582020811515376229/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5937173170152272619&amp;postID=1582020811515376229' title='8 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/1582020811515376229'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/1582020811515376229'/><link rel='alternate' type='text/html' href='http://icehanger.blogspot.com/2009/07/sipphone-gizmod5-and-ekiga-and-gv-on.html' title='Google Voice Gizmo5 Sipphone and Ekiga on Ubuntu'/><author><name>iCehaNgeR's hAcK NoteS</name><uri>http://www.blogger.com/profile/03757838076375432274</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>8</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5937173170152272619.post-540450174061740170</id><published>2009-06-25T13:32:00.000-07:00</published><updated>2009-06-25T14:06:34.457-07:00</updated><title type='text'>JSON, DOJO and innerHtml and Java Handler.</title><content type='html'>&lt;p&gt;
&lt;span style="font-weight:bold;"&gt;JSON &lt;/span&gt;: JavaScript Object Notation, it is the data interchange format, It simplify the data exchange between client side to server side script. In the example we will pass two string  and return a Java MAP response.
&lt;/P&gt;
&lt;p&gt;
&lt;span style="font-weight:bold;"&gt;DOJO&lt;/span&gt; : Is the working dog for ajax communication.
&lt;/P&gt;
&lt;p&gt;
&lt;span style="font-weight:bold;"&gt;innerHtml&lt;/span&gt;: this is useful to replace a element in the html document to be replaced with a ajax response.
call the element by dojo.byId("someid") then replace the content of the id by innerHtml. The id can be given to any html element.
&lt;/P&gt;


Our  Architecture 

&lt;div code="myclass"&gt;
Format data to JSON content---&gt; Dojo ---------&gt; 
xhrPost.Post 
--&gt; Java Handler process-------&gt; 
send back JSON response to DOJO------&gt; 
DOJO display on html.

&lt;/div&gt;

Our Javascript 

&lt;div class="mycode"&gt;

 //Ajax call to return a list of attributes

 function processBalanceAjaxLookup(  CardNo,pinNo, callbackfunction){ 
   var ajaxCommand = {};
   ajaxCommand.command="BalanceLookup";  
   ajaxCommand.formData={"CardNo":CardNo,"pinNo":pinNo};
   ajaxCommand.requestURI="/";
   var bindArgs = {
       url:        "/ajax",
      handleAs:   "json-comment-filtered",
      content: {ajaxCommandData: [JSON.stringify(ajaxCommand)]},
      error:      function(type, errObj){
     },
     load:      function(type, data){
        callbackfunction(type);
     }
  };   
  var requestObj = dojo.xhrPost(bindArgs);

 }
//function to be called by the jsp
 function checkBalance() {    
  var CardNo = document.getElementById("Number").value;
  var pinNo=document.getElementById("Pin").value;   
  processBalanceAjaxLookup(No,pinNo,processBalanceAjaxLookupCallback);
 }
 //call back function or the response function
 function processBalanceAjaxLookupCallback(attributeData){     
 //response token    
 var tokens = dojo.objectToQuery(attributeData).split("&amp;")
 
 //inner html tags that have to be replaced.
 var errorTag=dojo.byId("gcError");
 var balanceTag = dojo.byId("gcBalance");
 var dateTag=dojo.byId("gcDate");
 var cardNoTag=dojo.byId("gcNo"); 
 
 for(var i = 0; i &lt; tokens.length;i++){
  var responseData = tokens[i].split("=");             
   if(responseData[0] == "validity"){     
    if (responseData[1]== "valid" ){  
    }else{
    balanceTag.innerHTML="";
    dateTag.innerHTML="";
    errorTag.innerHTML="Invalid Card";
    }
   }
   else if(responseData[0] == "balance")
   {
   balanceTag.innerHTML=responseData[1];
   
   }
   else if(responseData[0] == "date")
   {
   var nowdate = new Date();   
   //alert (nowdate);
   dateTag.innerHTML= nowdate ;   
   }
   else if(responseData[0] == "CardNo")
   {   
   cardNoTag.innerHTML=responseData[1];
   }   
   else if(dojo.byId(responseData[0]))
   errorTag.innerHTML = responseData[1];
  }   
 } 
&lt;/div&gt;

The Html code which calls the function
&lt;div class="mycode"&gt;
         &lt; a href="#getBalance" class="nyroModal" onClick= javascript: checkBalance()&gt;&lt; img src="images/checkBalance-Btn.gif" width="140" height="41" /&gt;&lt;/ \a&gt; 

&lt;/div&gt;

The Java Code
&lt;div class="mycode"&gt;
public JSONObject process(HttpServletRequest request,
   WebApplicationContext factory, JSONObject ajaxData)
   throws JSONException {
  JSONObject rval = null;
  try {
  
   String balance= new String("199393.00");
   //process the info and return
   Map&lt;String, String&gt; responseMap = new HashMap&lt;String, String&gt; ();
   
   
   if ( CardNo != null ){
    responseMap.put("validity", "valid");
    responseMap.put( "CardNo", maskGc(CardNo));
    responseMap.put("date", formatDate);
    responseMap.put("balance", balance);
    
    rval= new JSONObject(responseMap);
   }else{
    responseMap.put("validity", "invalid");
    responseMap.put( "CardNo", "");
    responseMap.put("date", "");
    responseMap.put("balance", "");
    rval= new JSONObject(responseMap);
   }
   
  } catch (Exception e) {   
   e.printStackTrace();
   throw new JSONException("Error retrieving Card Balance.");
   
  }

 
  return rval;
 }
&lt;/div&gt;

An Abstract class to invoke the Spring handler and process AJAX calls
&lt;div class="mycode"&gt;
public class AbstractAjaxServlet extends HttpServlet {

 private static Logger myLogger = Logger.getLogger(AbstractAjaxServlet.class);

 @Override
 protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
  try {
   doProcess(req, resp);
  } catch (IOException e) {
   e.printStackTrace();
   throw e;
  }
 }

 @Override
 protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
  try {
   doProcess(req, resp);
  } catch (IOException e) {
   e.printStackTrace();
   throw e;
  }
 }

 /**
  * Parses an incoming ajax command object and uses the command name to perform
  * a Spring lookup for an appropriate handler.  Returns the handler's return value
  * as JSON back to the caller.
  * 
  * @param req
  * @param res
  * @throws IOException
  */
 private void doProcess(HttpServletRequest req, HttpServletResponse res) throws IOException {
  myLogger.info("&gt; doProcess", null);
  res.setContentType("text/json-comment-filtered");

  if (req.getParameterValues("ajaxCommandData") == null) {
   return; // We don't know how to handle the request.
  }
  String json = req.getParameterValues("ajaxCommandData")[0];

  try {
   JSONObject jsonObject = new JSONObject(json);

   // Delegation time.

   String command = jsonObject.getString("command");

   // Take the command string and lookup a Spring object to handle it.

   String handlerName = command;
   handlerName = handlerName.substring(0, 1).toUpperCase() + handlerName.substring(1);
   handlerName = "AjaxHandler" + handlerName;

   WebApplicationContext factory = WebApplicationContextUtils.getWebApplicationContext(req.getSession().getServletContext());

   if (!factory.containsBean(handlerName)) {
    throw new IOException("Invalid ajax handler " + handlerName);
   }

   AbstractAjaxHandler handler = (AbstractAjaxHandler) factory.getBean(handlerName);

   JSONObject returnValue = handler.process(req,factory,jsonObject);

   res.getWriter().println("/* " + returnValue + " */");

  } catch (JSONException e) {
   e.printStackTrace();
   throw new IOException(e.toString());
  }
  myLogger.info("&lt; doProcess", null);
 }
}

&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5937173170152272619-540450174061740170?l=icehanger.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icehanger.blogspot.com/feeds/540450174061740170/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5937173170152272619&amp;postID=540450174061740170' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/540450174061740170'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/540450174061740170'/><link rel='alternate' type='text/html' href='http://icehanger.blogspot.com/2009/06/json-dojo-and-innerhtml-and-java.html' title='JSON, DOJO and innerHtml and Java Handler.'/><author><name>iCehaNgeR's hAcK NoteS</name><uri>http://www.blogger.com/profile/03757838076375432274</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5937173170152272619.post-3266799173737231841</id><published>2009-06-25T13:08:00.000-07:00</published><updated>2009-06-25T13:10:32.329-07:00</updated><title type='text'>Masking for Credit Cards</title><content type='html'>This will show only the last 4 digits .
&lt;div class="mycode"&gt;
private String maskGc(String oS){
  int beginIndex=0;
  int endIndex=12;  
  if (oS.length()&gt;15){
  oS= oS.replace(oS.substring(beginIndex, endIndex), "****************");
return oS;
  }

Output:

****************3456
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5937173170152272619-3266799173737231841?l=icehanger.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icehanger.blogspot.com/feeds/3266799173737231841/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5937173170152272619&amp;postID=3266799173737231841' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/3266799173737231841'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/3266799173737231841'/><link rel='alternate' type='text/html' href='http://icehanger.blogspot.com/2009/06/masking-for-credit-cards.html' title='Masking for Credit Cards'/><author><name>iCehaNgeR's hAcK NoteS</name><uri>http://www.blogger.com/profile/03757838076375432274</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5937173170152272619.post-2840365512178217680</id><published>2009-06-02T13:22:00.000-07:00</published><updated>2009-06-02T13:58:12.881-07:00</updated><title type='text'>Solr/Lucene .</title><content type='html'>&lt;pre&gt;
I am trying to add up what I learned so far on the Solr.

Lucene : Is the search engine

Solr : The Search Server.

Solr / Lucene Terms.

Facet --- The data that have to be breakdown. example: manufacturer
FacetField -- This will contain the facet data
SolrDocument -- This will contain one solr search data.
setFacetMinCount -- This will limit returning search data with the minimum count of hit.
&lt;/pre&gt;

A sample Query using SolrJ

&lt;div class="mycode"&gt;
query.addFacetField("manu");
query.setFacetMinCount(1);
       query.setIncludeScore(true);
List&lt;facetfield&gt; facetFieldList=qr.getFacetFields();
           for(FacetField facetField: facetFieldList){              
               System.out.println(facetField.toString() +"Manufactures");
               }
And it returns
-----------------
[manu:[dell (5), inc (5), corp (1), sharp (1), sonic (1), view (1), viewson (1), vizo (1)]]


Notice here it will return only manufactures with facet count 1 and above.
&lt;/facetfield&gt;&lt;/div&gt;

&lt;span style="font-weight: bold;"&gt;
Solr Price Range:&lt;/span&gt;
&lt;br&gt;

Querying price range need little special skill in solr,
I am still exploring different option of querying.
The search querys are case sensitive, if you put 'To' instead
of 'TO' solr will throw invalid syntax error.

&lt;div class="mycode"&gt;


query.addFacetQuery("price:[* TO 500]");
       query.addFacetQuery("price:[500 TO 1000]");
       query.addFacetQuery("price:[1000 TO *]");

  HashMap  priceRangeMap =  (HashMap) qr.getFacetQuery();
           Iterator priceRageIter=priceRangeMap.entrySet().iterator();
           System.out.println(qr.getFacetQuery().toString());
           while(priceRageIter.hasNext()){
            Map.Entry pairs = (Map.Entry)priceRageIter.next();
               System.out.println(pairs.getKey() + " -- found -- " + pairs.getValue());
           }    

And it will return
----------------------
{price:[* TO 500]=1, price:[500 TO 1000]=2, price:[1000 TO *]=6}
price:[* TO 500] -- found -- 1
price:[500 TO 1000] -- found -- 2
price:[1000 TO *] -- found -- 6

&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5937173170152272619-2840365512178217680?l=icehanger.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icehanger.blogspot.com/feeds/2840365512178217680/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5937173170152272619&amp;postID=2840365512178217680' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/2840365512178217680'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/2840365512178217680'/><link rel='alternate' type='text/html' href='http://icehanger.blogspot.com/2009/06/solrlucene.html' title='Solr/Lucene .'/><author><name>iCehaNgeR's hAcK NoteS</name><uri>http://www.blogger.com/profile/03757838076375432274</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5937173170152272619.post-7193935175263181576</id><published>2009-05-28T10:43:00.000-07:00</published><updated>2009-05-28T10:55:40.990-07:00</updated><title type='text'>Ruby on Windows XP installation</title><content type='html'>&lt;p&gt;
Don't install the one click installer from ruby site. This will not help you if your script has some 'fork' command on it. Windows don't support fork.
&lt;/p&gt;
&lt;p&gt;
Get CYGWIN and select the category development select-&gt; make, select interpreters -&gt; ruby , select Base -&gt; cygwin
&lt;/p&gt;
&lt;p&gt;
If you use default Cygwin installation these packages will not be installed. After installation type in 'which ruby' on the $ prompt this  will show the ruby installation directory this is import to know about the installation directory so you can add up the location of the ruby binary on the header of your script.
&lt;/p&gt;
&lt;p&gt;
Now if you want to add ruby libraries download the rubygem package from http://rubyforge.org/frs/?group_id=126
&lt;br&gt;
un-tar the package and to the directory. type in ruby setup.rb that will setup the gems to your ruby installation. Now to install individual gems
&lt;/br&gt;
&lt;/p&gt;&lt;p&gt;
example.
gem install hpricot
&lt;/p&gt;&lt;/br&gt;

this will install the hpricot library to ruby installation.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5937173170152272619-7193935175263181576?l=icehanger.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icehanger.blogspot.com/feeds/7193935175263181576/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5937173170152272619&amp;postID=7193935175263181576' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/7193935175263181576'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/7193935175263181576'/><link rel='alternate' type='text/html' href='http://icehanger.blogspot.com/2009/05/ruby-on-windows-xp-installation.html' title='Ruby on Windows XP installation'/><author><name>iCehaNgeR's hAcK NoteS</name><uri>http://www.blogger.com/profile/03757838076375432274</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5937173170152272619.post-6018615988405330999</id><published>2009-05-09T13:50:00.000-07:00</published><updated>2009-05-09T14:08:15.504-07:00</updated><title type='text'>Generate Torque Schema from existing DB</title><content type='html'>I came across a situation where there is the excellent DB schema available,
 but no torque schema to generate the Peer and Maper classes. 

Solution&gt;

&lt;div class="mycode"&gt;
Setup an eclipse JAVA project.

create a lib folder add all the torque lib and generator jars from lib folder of 
each projects. Now we need a build.properties and torque-build.xml. We can get both
 of them from the generator project. Now setup the build.properties to point to your
 existing database. point the database name, username password and connection 
url and don't forget to place the db driver on the lib folder. 

Run the torque-build.xml ant script when the ant generator dialogue
 comes select the jdbc option unselect the main task.
 Make sure to point the place where the generated schema.xml should be put.
 This can be specified on the build.properties.

example builld.properties.
-------------------------

torque.project = starcraft
torque.schema.dir=.
application.root = .
torque.database.name = konakart
torque.database.type = mysql
torque.database.user = starcraft
torque.database.password = star
torque.database.driver = com.mysql.jdbc.Driver
torque.database.url = jdbc:mysql://142.148.1.142:3306/starcraft
torque.database.validationQuery = SELECT 1
torque.sameJavaName = false


This will dump a torque schema.xml on the root of the project directory.


How to Run the torque Schema.xml to generate Java classes.

Modify the schema.xml to your database name here ( starcraft-schema.xml) and
 inside the schema check the database name is correct and all the can be wrong
 if you have not specified the database property in the build.properties.

Now fire the Ant this time select the task OM. This should generate the java classes.
 You may need to readjust the packages of the generated classes if the package is 
not properly specified on the build.properties.

If any time ant complaints about torquexxx task not found make sure all jars
 assosiated to the task in the lib folder of the project. Use your Ctrl+ALT+T 
key for search the task on the eclipse project space.











&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5937173170152272619-6018615988405330999?l=icehanger.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icehanger.blogspot.com/feeds/6018615988405330999/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5937173170152272619&amp;postID=6018615988405330999' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/6018615988405330999'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/6018615988405330999'/><link rel='alternate' type='text/html' href='http://icehanger.blogspot.com/2009/05/generate-torque-schema-from-existing-db.html' title='Generate Torque Schema from existing DB'/><author><name>iCehaNgeR's hAcK NoteS</name><uri>http://www.blogger.com/profile/03757838076375432274</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5937173170152272619.post-7004405919499938920</id><published>2009-05-06T07:09:00.000-07:00</published><updated>2009-05-06T07:13:41.546-07:00</updated><title type='text'>Weblogic startup failed after password change in admin console</title><content type='html'>&lt;div class="mycode"&gt;
weblogic.security.SecurityInitializationException: Authentication denied: Boot i
dentity not valid; The user name and/or password from the boot identity file (bo
ot.properties) is not valid. The boot identity may have been changed since the b
oot identity file was created. Please edit and update the boot identity file wit
h the proper values of username and password. The first time the updated boot id
entity file is used to start the server, these new values are encrypted.
        at weblogic.security.service.CommonSecurityServiceManagerDelegateImpl.do
BootAuthorization(Unknown Source)
        at weblogic.security.service.CommonSecurityServiceManagerDelegateImpl.in
itialize(Unknown Source)
        at weblogic.security.service.SecurityServiceManager.initialize(Unknown S
ource)
        at weblogic.security.SecurityService.start(SecurityService.java:141)
        at weblogic.t3.srvr.SubsystemRequest.run(SubsystemRequest.java:64)
        Truncated. see log file for complete stacktrace

&lt;/div&gt;

&lt;div class="mycode"&gt;
Solution
---------

C:\bea1001\user_projects\domains\otc_domain\servers\AdminServer\security

find the boot.properties

backup the property file.


Edit,it will look like this:

username={3DES}3xhQwbNOXngKswp63s8oqg==
password={3DES}B+/Hy/ELjHZztOCHsMxzpg==

&lt;/div&gt;

&lt;div class="mycode"&gt;
change to your admin password you changed in plain

like:
username=weblogic
password=weblogic

&lt;/div&gt;
&lt;div class="mycode"&gt;
run your

C:\bea1001\user_projects\domains\otc_domain\bin&gt;startWebLogic.cmd

Nice server started

Look at your boo.properties

now it should like this after startup

password={3DES}3xhQwbNOXngKswp63s8oqg\=\=
username={3DES}3xhQwbNOXngKswp63s8oqg\=\=

&lt;/div&gt;

Good your are safe and good to go!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5937173170152272619-7004405919499938920?l=icehanger.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icehanger.blogspot.com/feeds/7004405919499938920/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5937173170152272619&amp;postID=7004405919499938920' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/7004405919499938920'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/7004405919499938920'/><link rel='alternate' type='text/html' href='http://icehanger.blogspot.com/2009/05/weblogic-startup-failed-after-password.html' title='Weblogic startup failed after password change in admin console'/><author><name>iCehaNgeR's hAcK NoteS</name><uri>http://www.blogger.com/profile/03757838076375432274</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5937173170152272619.post-5153399610551133230</id><published>2009-04-17T15:52:00.000-07:00</published><updated>2009-04-17T16:07:29.429-07:00</updated><title type='text'>Screen Graber Deamon</title><content type='html'>This was a hack to grab the questions from a paid online quiz. Idea here is, this program will run as a deamon in the background and take the screen shot every 10 second and save it into a jpeg file on temp directory.

&lt;div class="mycode"&gt;

 public void captureFullScreen() {
        try {
   Robot robot = new Robot();
            Rectangle area = new Rectangle(Toolkit.getDefaultToolkit().getScreenSize());
            File target = new File(saveLocation, imageName + "_" + System.currentTimeMillis() + "." + imageType);
            saveImageToFile(robot.createScreenCapture(area), target);
        } catch (AWTException e) {
            System.err.println("Exception while capturing screen. " + e);
        }
    }

    /**
     * Saves the specified RenderedImage to the specified File.
     *
     * @param renderedImage the image to write to file.
     * @param target the file to write the image to.
     */
    private void saveImageToFile(RenderedImage renderedImage, File target) {
        try {
            ImageIO.write(renderedImage, imageType, target);
        } catch (IOException e) {
            System.err.println(e);
        }
    }

&lt;/div&gt;

and now the Deamon 


&lt;div class="mycode"&gt;
public static void main(String args[]) throws InterruptedException {
     
     while(true)
        {
      new ScreenGraber().captureFullScreen();
            Thread.sleep(10000); // will sleep for 10 seconds
        }
    
        
    }


&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5937173170152272619-5153399610551133230?l=icehanger.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icehanger.blogspot.com/feeds/5153399610551133230/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5937173170152272619&amp;postID=5153399610551133230' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/5153399610551133230'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/5153399610551133230'/><link rel='alternate' type='text/html' href='http://icehanger.blogspot.com/2009/04/screen-graber-deamon.html' title='Screen Graber Deamon'/><author><name>iCehaNgeR's hAcK NoteS</name><uri>http://www.blogger.com/profile/03757838076375432274</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5937173170152272619.post-6091374007914525547</id><published>2009-04-08T05:47:00.000-07:00</published><updated>2009-04-08T06:00:00.949-07:00</updated><title type='text'>JPA  OneToMany using FetchType.EAGER</title><content type='html'>Scenario:

 Want to insert multiple address to basket header  with a unique basketId. 


&lt;div class="mycode"&gt;
BasketHeader.java

@OneToMany(fetch = FetchType.EAGER, cascade = CascadeType.ALL)    
    @JoinColumn(name = "basketId", nullable = false)
 public Set&lt;BasketBillTo&gt; getBasketBillTos() {
  return basketBillTos;
 }

&lt;/div&gt;

By specifying @JoinColumn  basketId is set as the foreign key column name for the relationship. Otherwise a default name will be given for the foreign key column. If you are mapping to an existing database schema you will typically require setting the @JoinColumn, otherwise the defaults are probably fine. 

Implementation on action
&lt;div class="mycode"&gt;
 Set basketBillToSet = new HashSet();
      basketBillToSet.add(basketBillTo);
      basketHeader.setBasketBillTos(basketBillToSet);
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5937173170152272619-6091374007914525547?l=icehanger.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icehanger.blogspot.com/feeds/6091374007914525547/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5937173170152272619&amp;postID=6091374007914525547' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/6091374007914525547'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/6091374007914525547'/><link rel='alternate' type='text/html' href='http://icehanger.blogspot.com/2009/04/jpa-onetomany-using-fetchtypeeager.html' title='JPA  OneToMany using FetchType.EAGER'/><author><name>iCehaNgeR's hAcK NoteS</name><uri>http://www.blogger.com/profile/03757838076375432274</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5937173170152272619.post-8067048558643359883</id><published>2009-04-01T14:10:00.000-07:00</published><updated>2009-04-01T14:33:17.916-07:00</updated><title type='text'>Struts 2 OGNL variable evaluation</title><content type='html'>&lt;div class="mycode"&gt;

&lt; s: set name="startIndex" value="%{#parameters['start'][0]}"/ &gt;

&lt; s: property value="@java.lang.Integer@parseInt(#startIndex)+4"/ &gt;

&lt;/div&gt;

Here the first statement grab the query string value using parameter object and assign it as a string,  the &lt;code&gt; '%{}' &lt;/code&gt;  syntax is used for this purpose.

The second statement convert the string to int and add the two integers.



&lt;div class="mycode"&gt;
IMPORTANT: for the parseInt to work you should enable the constant in struts.xml

&lt; constant name="struts.ognl.allowStaticMethodAccess" value="true" / &gt;

&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5937173170152272619-8067048558643359883?l=icehanger.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icehanger.blogspot.com/feeds/8067048558643359883/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5937173170152272619&amp;postID=8067048558643359883' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/8067048558643359883'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/8067048558643359883'/><link rel='alternate' type='text/html' href='http://icehanger.blogspot.com/2009/04/struts-2-ognl-variable-evaluation.html' title='Struts 2 OGNL variable evaluation'/><author><name>iCehaNgeR's hAcK NoteS</name><uri>http://www.blogger.com/profile/03757838076375432274</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5937173170152272619.post-1538568526292372090</id><published>2009-03-30T18:10:00.000-07:00</published><updated>2009-08-22T15:54:10.964-07:00</updated><title type='text'>SVN with Eclipse Ganymede</title><content type='html'>&lt;ol&gt;&lt;li&gt;Install svn server for windows, use the msi package.&lt;/li&gt;&lt;li&gt; Create Repository &lt;/li&gt;&lt;/ol&gt;&lt;div class="mycode"&gt;
svnadmin create "c:\svnrepo"
&lt;/div&gt;
Navigate to the folder we just created. Within that folder, uncomment the following lines in the /conf/svnserve.conf file:
&lt;div class="mycode"&gt;
[general]
anon-access = read
auth-access = write
password-db = passwd
&lt;/div&gt;

Next, uncomment these lines in the /conf/passwd file:
&lt;div class="mycode"&gt;
[users]
harry = harryssecret
sally = sallyssecret

&lt;/div&gt;


3. Install subeclipse 1.6.x package for Ganymede.


4. check in the project using these parameters
&lt;div class="mycode"&gt;
host  svn://localhost
use  default port
repository svnrepo

&lt;/div&gt;

In  Linux if you have created a subversion group, don't forget to change the file group permission, like this.

&lt;div class="mycode"&gt;
sudo chown :subversion directory/
&lt;/div&gt;
Do not forget to commit the project at the end.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5937173170152272619-1538568526292372090?l=icehanger.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icehanger.blogspot.com/feeds/1538568526292372090/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5937173170152272619&amp;postID=1538568526292372090' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/1538568526292372090'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/1538568526292372090'/><link rel='alternate' type='text/html' href='http://icehanger.blogspot.com/2009/03/svn-with-eclipse-ganymede.html' title='SVN with Eclipse Ganymede'/><author><name>iCehaNgeR's hAcK NoteS</name><uri>http://www.blogger.com/profile/03757838076375432274</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5937173170152272619.post-2649567056579763708</id><published>2008-12-31T09:13:00.000-08:00</published><updated>2008-12-31T09:18:18.741-08:00</updated><title type='text'>Auto create tables JPA</title><content type='html'>&lt;div class="mycode"&gt;

&lt; property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"&gt;
&lt; property name="hibernate.hbm2ddl.auto" value="create-drop"&gt;
&lt; property name="hibernate.show_sql" value="true"&gt;
&lt; property name="hibernate.cache.provider_class" value="org.hibernate.cache.HashtableCacheProvider"&gt;
&lt; /property&gt;


&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5937173170152272619-2649567056579763708?l=icehanger.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icehanger.blogspot.com/feeds/2649567056579763708/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5937173170152272619&amp;postID=2649567056579763708' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/2649567056579763708'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/2649567056579763708'/><link rel='alternate' type='text/html' href='http://icehanger.blogspot.com/2008/12/auto-create-tables-jpa.html' title='Auto create tables JPA'/><author><name>iCehaNgeR's hAcK NoteS</name><uri>http://www.blogger.com/profile/03757838076375432274</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5937173170152272619.post-1299300357670722820</id><published>2008-12-02T15:25:00.000-08:00</published><updated>2008-12-02T15:28:20.508-08:00</updated><title type='text'>Recusively deleting a folder in  MS DOS</title><content type='html'>&lt;div class="mycode"&gt;

for /f %D in ('dir/s/b/ad ^| find/i ".svn" ') do if exist "%D" rd/s/q "%D" 

&lt;/div&gt;
replace %D with %%D for batch job&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5937173170152272619-1299300357670722820?l=icehanger.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icehanger.blogspot.com/feeds/1299300357670722820/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5937173170152272619&amp;postID=1299300357670722820' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/1299300357670722820'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/1299300357670722820'/><link rel='alternate' type='text/html' href='http://icehanger.blogspot.com/2008/12/recusively-deleting-folder-in-ms-dos.html' title='Recusively deleting a folder in  MS DOS'/><author><name>iCehaNgeR's hAcK NoteS</name><uri>http://www.blogger.com/profile/03757838076375432274</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5937173170152272619.post-1714183133683153958</id><published>2008-11-13T15:12:00.001-08:00</published><updated>2008-12-02T15:27:40.926-08:00</updated><title type='text'>Where not to put presistance.xml</title><content type='html'>Where to put persistence.xml in web app?

In all cases, persistence.xml always resides in {root-of-persistence-unit}/META-INF/ directory. For example,
&lt;div class="mycode"&gt;
foo.war:
WEB-INF/classes/META-INF/persistence.xml  //good
WEB-INF/classes/com/foo123/jpa/Project.class
WEB-INF/web.xml
index.jsp

You may also package entity classes and persistence.xml inside a library jar, which is packaged inside the war: WEB-INF/lib

foo.war:
WEB-INF/lib/my-entities.jar
WEB-INF/web.xml
index.jsp

my-entities.jar:
META-INF/persistence.xml  //good
com/foo123/jpa/Project.class

For comparison, some invalid configurations are:

foo.war:
WEB-INF/persistence.xml  //invalid
WEB-INF/web.xml
WEB-INF/classes/com/foo123/jpa/Project.
index.jsp
-----------------------------------------------
foo.war:
META-INF/persistence.xml  //invalid
WEB-INF/classes/com/foo123/jpa/Project.class
WEB-INF/web.xml
index.jsp
-----------------------------------------------
foo.war:
persistence.xml  //invalid
WEB-INF/classes/com/foo123/jpa/Project.class
WEB-INF/web.xml
index.jsp
-----------------------------------------------
foo.war:
META-INF/persistence.xml  //invalid
com/foo123/jpa/Project.class
WEB-INF/web.xml
index.jsp

&lt;/div&gt;
In all these invalid configurations, EntityManager lookup will fail with javax.naming.NameNotFoundException, or @PersistenceContext injection will be silently skipped and the em variable is always null, and hence NullPointerException when referenced.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5937173170152272619-1714183133683153958?l=icehanger.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icehanger.blogspot.com/feeds/1714183133683153958/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5937173170152272619&amp;postID=1714183133683153958' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/1714183133683153958'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/1714183133683153958'/><link rel='alternate' type='text/html' href='http://icehanger.blogspot.com/2008/11/where-not-to-put-presistancexml.html' title='Where not to put presistance.xml'/><author><name>iCehaNgeR's hAcK NoteS</name><uri>http://www.blogger.com/profile/03757838076375432274</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5937173170152272619.post-4177434134107170717</id><published>2008-07-30T13:46:00.000-07:00</published><updated>2008-07-30T13:48:50.840-07:00</updated><title type='text'>SCP between two remote hosts</title><content type='html'>&lt;div class="mycode"&gt;
scp  emartine@localhost:/var/eone/batch/production/data/exports/*.csv  emartine@192.168.100.5:/home/emartine

Now it will ask for.

emartine@localhost's password:
emartine@192.168.100.5's password:

&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5937173170152272619-4177434134107170717?l=icehanger.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icehanger.blogspot.com/feeds/4177434134107170717/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5937173170152272619&amp;postID=4177434134107170717' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/4177434134107170717'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/4177434134107170717'/><link rel='alternate' type='text/html' href='http://icehanger.blogspot.com/2008/07/scp-between-two-remote-hosts.html' title='SCP between two remote hosts'/><author><name>iCehaNgeR's hAcK NoteS</name><uri>http://www.blogger.com/profile/03757838076375432274</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5937173170152272619.post-4409835460398932882</id><published>2008-07-14T13:27:00.000-07:00</published><updated>2008-07-14T13:38:18.036-07:00</updated><title type='text'>MYSQL Error29</title><content type='html'>&lt;div class="mycode"&gt;
mysqldump: Got error: 29: File './databasename/tablename.MYD' not found (Errcode: 24) when using LOCK TABLES

The best way to get to the bottom of the error is to find out what it means:

$ perror 24
OS error code 24: Too many open files
&lt;/div&gt;
There’s two ways to fix the problem. First, if you find that you only hit the limit during mysqldumps and never during normal database operation, just add
&lt;div class="mycode"&gt;
 --single-transaction to your mysqldump command line options.
ex:
mysqldump -h localhost --single-transaction
&lt;/div&gt;
 This will cause mysql to keep only one table open at a time.

However, if this happens while backups aren’t running, you may want to increase the open_files_limit in your MySQL configuration file. By default, the variable is set to 1,024 open files.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5937173170152272619-4409835460398932882?l=icehanger.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icehanger.blogspot.com/feeds/4409835460398932882/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5937173170152272619&amp;postID=4409835460398932882' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/4409835460398932882'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/4409835460398932882'/><link rel='alternate' type='text/html' href='http://icehanger.blogspot.com/2008/07/mysql-error29.html' title='MYSQL Error29'/><author><name>iCehaNgeR's hAcK NoteS</name><uri>http://www.blogger.com/profile/03757838076375432274</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5937173170152272619.post-6904510831961480787</id><published>2008-05-17T07:36:00.000-07:00</published><updated>2008-05-17T07:58:38.349-07:00</updated><title type='text'>FireGPG on Linux</title><content type='html'>How GPG works for the email.

&lt;div class="mycode"&gt;
Scenario 1:
 Sam creates public and private key
 Sam Publishes Sam's public Key to Key server.
 
  Bob Creates his public and private key
  Bob publishes Bob's public Key to Key Server.

&lt;/div&gt;

Scenario 2:


&lt;div class="mycode"&gt;
   No Sam and Bob need to engage a secured email communication.

Sam pulls Bob's public key from key server and imports that public 
key into his trusted keyring using seahorse or gpg command line. 

Sam use Bob's Public Key to sign the message and send to Bob.

Bob use his Private Key to decrypt and verify Sam's Message 
which was signed and encrypted using Bob's Public key.
  &lt;/div&gt;

Tools Needed

&lt;div class="mycode"&gt;
FireGPG
GPG
seahorse
&lt;/div&gt;
Generate Key Pairs.

&lt;div class="mycode"&gt;
gpg --key-gen now the keys are generated and stored to keystore. 
Use the Seahorse to manual edit the keys and export keys.

gpg normally get installed in usr/bin if you install with apt-get.

Now install FireGPG plugin to FireFox. 
&lt;/div&gt;

&lt;div class="mycode"&gt;
Run the FireFox as ROOT.  Here is the catch all the key 
genereration and keystore are acessible only for the root user.
 Firefox launch itself as firefox user, so when you launch the 
FireGPG it wont able to find the KEY's. It took me a while what was going wrong.
 If you launch the firefox as ROOT user or install the KEY's as universal user
 this issue can be fixed.

Once you are in gmail and type the subject you should be able to see the encrypt and decrypt button and when you click the encrypt it should prompt for the public keys.
 If you are not a privilaged user to access the KEY store you wont see the KEYS.

&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5937173170152272619-6904510831961480787?l=icehanger.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icehanger.blogspot.com/feeds/6904510831961480787/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5937173170152272619&amp;postID=6904510831961480787' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/6904510831961480787'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/6904510831961480787'/><link rel='alternate' type='text/html' href='http://icehanger.blogspot.com/2008/05/firegpg-on-linux.html' title='FireGPG on Linux'/><author><name>iCehaNgeR's hAcK NoteS</name><uri>http://www.blogger.com/profile/03757838076375432274</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5937173170152272619.post-4788132961479977083</id><published>2008-05-09T07:42:00.000-07:00</published><updated>2008-05-09T07:47:10.753-07:00</updated><title type='text'>NYI  - Not Yet Implemented error</title><content type='html'>If you are getting this error

&lt;div class="mycode"&gt;

Exception in thread "main" java.lang.RuntimeException: NYI
at cryptix.jce.provider.elgamal.ElGamalCipher.engineGetParameters(ElGamalCipher.java:120)
at javax.crypto.Cipher.a(DashoA12275)

&lt;/div&gt;

Reason is the suns default policy doesn't have the strength to encrypt/decrypt with higher strength keys.

Got to SUN downloads and install/replace it in you JRE/lib/security
Other Downloads
   Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files 6&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5937173170152272619-4788132961479977083?l=icehanger.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icehanger.blogspot.com/feeds/4788132961479977083/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5937173170152272619&amp;postID=4788132961479977083' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/4788132961479977083'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/4788132961479977083'/><link rel='alternate' type='text/html' href='http://icehanger.blogspot.com/2008/05/nyi-not-yet-implemented-error.html' title='NYI  - Not Yet Implemented error'/><author><name>iCehaNgeR's hAcK NoteS</name><uri>http://www.blogger.com/profile/03757838076375432274</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5937173170152272619.post-1872600093454007661</id><published>2008-05-07T09:58:00.000-07:00</published><updated>2008-12-08T21:42:53.851-08:00</updated><title type='text'>Formating Currencies and Dates in Struts 2</title><content type='html'>Create a Global message property so that the formating can be applied to all the pages name it

globalMessages.properties

&lt;div class="mycode"&gt;

item.listprice = {0,number,$##0.00}
&lt;/div&gt;

Now add the property to struts.properties


&lt;div class="mycode"&gt;

struts.custom.i18n.resources=globalMessages
&lt;/div&gt;

Now how to Call the formating string in JSP

where listprice comes from the stack and the formating string from the global resource we set earlier.

&lt;div class="mycode"&gt;
&amp;lt;s:text name="%{getText('item.listprice')}"&amp;gt;
&amp;lt;s:param name="value" value="listprice"/&amp;gt;    
&amp;lt;/s:text&amp;gt;
&lt;/div&gt;

And now the Output
&lt;div class="mycode"&gt;
$12.20

&lt;/div&gt;

Make sure to put the property files in the correct folder of your project.

&lt;div style="text-align: justify;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_76z2KKQ_T1Y/SCHi3pR3gdI/AAAAAAAABac/5-ndEuwPq3I/s1600-h/propertyfile.JPG"&gt;&lt;img style="cursor: pointer;" src="http://1.bp.blogspot.com/_76z2KKQ_T1Y/SCHi3pR3gdI/AAAAAAAABac/5-ndEuwPq3I/s400/propertyfile.JPG" alt="" id="BLOGGER_PHOTO_ID_5197684890563740114" border="0" /&gt;&lt;/a&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5937173170152272619-1872600093454007661?l=icehanger.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icehanger.blogspot.com/feeds/1872600093454007661/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5937173170152272619&amp;postID=1872600093454007661' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/1872600093454007661'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/1872600093454007661'/><link rel='alternate' type='text/html' href='http://icehanger.blogspot.com/2008/05/formating-currencies-and-dates-in.html' title='Formating Currencies and Dates in Struts 2'/><author><name>iCehaNgeR's hAcK NoteS</name><uri>http://www.blogger.com/profile/03757838076375432274</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_76z2KKQ_T1Y/SCHi3pR3gdI/AAAAAAAABac/5-ndEuwPq3I/s72-c/propertyfile.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5937173170152272619.post-1313544212607944982</id><published>2008-04-21T08:59:00.000-07:00</published><updated>2008-04-21T09:02:48.409-07:00</updated><title type='text'>Another Session Iteration</title><content type='html'>&lt;div class="mycode"&gt;
&amp;lt;s:if test=&amp;quot;#session.cartitems.size &amp;gt; 0&amp;quot;&amp;gt;
 &amp;lt;table&amp;gt;
  &amp;lt;s:iterator value=&amp;quot;#session.cartitems&amp;quot;&amp;gt;
    
   &amp;lt;tr id=&amp;quot;row_&amp;lt;s:property value=&amp;quot;itemid&amp;quot;/&amp;gt;&amp;quot;&amp;gt;
    &amp;lt;td&amp;gt;
     &amp;lt;s:property value=&amp;quot;itemName&amp;quot; /&amp;gt;
    &amp;lt;/td&amp;gt;
    &amp;lt;td&amp;gt;
     &amp;lt;s:property value=&amp;quot;listprice&amp;quot; /&amp;gt;
    &amp;lt;/td&amp;gt;
    &amp;lt;td&amp;gt;
     &amp;lt;s:url id=&amp;quot;removeUrl&amp;quot; action=&amp;quot;removeItemFromCart&amp;quot;&amp;gt;
      &amp;lt;s:param name=&amp;quot;itemid&amp;quot; value=&amp;quot;itemid&amp;quot; /&amp;gt;
     &amp;lt;/s:url&amp;gt;
     &amp;lt;s:a href=&amp;quot;%{removeUrl}&amp;quot; theme=&amp;quot;ajax&amp;quot; targets=&amp;quot;basket&amp;quot;&amp;gt;Remove&amp;lt;/s:a&amp;gt;
     &amp;lt;s:a id=&amp;quot;a_%{id}&amp;quot; theme=&amp;quot;ajax&amp;quot; notifyTopics=&amp;quot;/edit&amp;quot;&amp;gt;Edit&amp;lt;/s:a&amp;gt;
    &amp;lt;/td&amp;gt;    
   &amp;lt;/tr&amp;gt;
  &amp;lt;/s:iterator&amp;gt;
 &amp;lt;/table&amp;gt;
&amp;lt;/s:if&amp;gt;

&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5937173170152272619-1313544212607944982?l=icehanger.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icehanger.blogspot.com/feeds/1313544212607944982/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5937173170152272619&amp;postID=1313544212607944982' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/1313544212607944982'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/1313544212607944982'/><link rel='alternate' type='text/html' href='http://icehanger.blogspot.com/2008/04/another-session-iteration.html' title='Another Session Iteration'/><author><name>iCehaNgeR's hAcK NoteS</name><uri>http://www.blogger.com/profile/03757838076375432274</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5937173170152272619.post-8228005879993141097</id><published>2008-04-01T12:06:00.001-07:00</published><updated>2008-04-02T03:32:27.665-07:00</updated><title type='text'>Iterating a List Value  Struts2</title><content type='html'>&lt;div class="mycode"&gt;
&amp;lt;s:if test=&amp;quot;&amp;quot;&amp;gt; 0&amp;quot;&amp;gt;
  &amp;lt;s:iterator value=&amp;quot;#session.categorys&amp;quot;&amp;gt;
&amp;lt;li&amp;gt;&amp;lt;a href=&amp;quot;&amp;lt;s:url action=&amp;quot;itemlisthome.action&amp;quot;&amp;gt;&amp;lt;s:param name=&amp;quot;catalogid&amp;quot; value=&amp;quot;#session.catalogs[catalogid-1].id&amp;quot;&amp;gt;
&amp;lt;s:param name=&amp;quot;categoryid&amp;quot; value=&amp;quot;#session.categorys[id-1].id&amp;quot;&amp;gt;
&amp;lt;/s:url&amp;gt;&amp;quot;&amp;gt;
            &amp;lt;s:property value=&amp;quot;#session.categorys[id-1].name&amp;quot;&amp;gt; &amp;lt;/a&amp;gt; &amp;lt;/li&amp;gt;
        &amp;lt;/s:iterator&amp;gt;
    &amp;lt;/s:if&amp;gt;&amp;lt;s:if test=&amp;quot;&amp;quot;&amp;gt;
  &amp;lt;/s:if&amp;gt;

&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5937173170152272619-8228005879993141097?l=icehanger.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icehanger.blogspot.com/feeds/8228005879993141097/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5937173170152272619&amp;postID=8228005879993141097' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/8228005879993141097'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/8228005879993141097'/><link rel='alternate' type='text/html' href='http://icehanger.blogspot.com/2008/04/iterating-list-value-struts2.html' title='Iterating a List Value  Struts2'/><author><name>iCehaNgeR's hAcK NoteS</name><uri>http://www.blogger.com/profile/03757838076375432274</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5937173170152272619.post-4903366779248293043</id><published>2008-04-01T11:54:00.000-07:00</published><updated>2008-04-02T03:33:49.090-07:00</updated><title type='text'>Struts 2 Tips and Tricks</title><content type='html'>OGNL treats a character in single-quotes as an actual character, not a
String.

So this statement will not return your desired result.
&lt;div class="mycode"&gt;
&amp;lt;s:if test=&amp;quot;%{state=='N'}&amp;quot;&amp;gt;
This will work.
&amp;lt;s:if test=&amp;quot;%{state=='NE'}&amp;quot;&amp;gt;
&amp;lt;/s:if&amp;gt;

&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5937173170152272619-4903366779248293043?l=icehanger.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icehanger.blogspot.com/feeds/4903366779248293043/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5937173170152272619&amp;postID=4903366779248293043' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/4903366779248293043'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/4903366779248293043'/><link rel='alternate' type='text/html' href='http://icehanger.blogspot.com/2008/04/struts-2-tips-and-tricks.html' title='Struts 2 Tips and Tricks'/><author><name>iCehaNgeR's hAcK NoteS</name><uri>http://www.blogger.com/profile/03757838076375432274</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5937173170152272619.post-148292828626954429</id><published>2008-03-24T12:53:00.000-07:00</published><updated>2008-03-24T12:54:10.523-07:00</updated><title type='text'>File Count in a Folder</title><content type='html'>Recently I found a command that displays the Number of files in a ls command listing:
Code:

ls -l | wc -l

Above will find the number of files in a directory, and it will send o/p as pipe to the wc -l, which outputs the number of lines in its input.

To display all file including hidden and dot files, try
Code:

ls -lA | wc -l&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5937173170152272619-148292828626954429?l=icehanger.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icehanger.blogspot.com/feeds/148292828626954429/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5937173170152272619&amp;postID=148292828626954429' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/148292828626954429'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/148292828626954429'/><link rel='alternate' type='text/html' href='http://icehanger.blogspot.com/2008/03/file-count-in-folder.html' title='File Count in a Folder'/><author><name>iCehaNgeR's hAcK NoteS</name><uri>http://www.blogger.com/profile/03757838076375432274</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5937173170152272619.post-2310591677552982559</id><published>2008-03-14T14:33:00.000-07:00</published><updated>2008-03-19T12:25:50.458-07:00</updated><title type='text'>Stripping white space</title><content type='html'>s = s.replaceAll(" +", "");

Here is the String BFI  NS-16

after the replace  BFINS-16&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5937173170152272619-2310591677552982559?l=icehanger.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icehanger.blogspot.com/feeds/2310591677552982559/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5937173170152272619&amp;postID=2310591677552982559' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/2310591677552982559'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/2310591677552982559'/><link rel='alternate' type='text/html' href='http://icehanger.blogspot.com/2008/03/stipping-white-space.html' title='Stripping white space'/><author><name>iCehaNgeR's hAcK NoteS</name><uri>http://www.blogger.com/profile/03757838076375432274</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5937173170152272619.post-5442637680762046839</id><published>2008-02-21T14:00:00.000-08:00</published><updated>2009-04-07T20:13:51.449-07:00</updated><title type='text'>cat and grep to omit some unwanted pattern on log file</title><content type='html'>The app I am debugging is toiled by some crappy domain redirecting output. I was looking for a way clear the catalina out file with some decent message. There is nice tutorial &lt;a href="http://logtail.blogspot.com/search/label/tutorial"&gt;logTail Tutorial&lt;/a&gt; tailing the log.

For there is a part where pattern omition is there,which worked quite well for me.
 &lt;div class="mycode"&gt; 
cat /usr/local/tomcat/logs/catalina.out | grep -v testing | grep -v url | grep -v 
&lt;/div&gt;
Redirecting

This will omit the lines starting with testing Redirecting and url&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5937173170152272619-5442637680762046839?l=icehanger.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icehanger.blogspot.com/feeds/5442637680762046839/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5937173170152272619&amp;postID=5442637680762046839' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/5442637680762046839'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/5442637680762046839'/><link rel='alternate' type='text/html' href='http://icehanger.blogspot.com/2008/02/cat-and-grep-to-omit-some-unwanted.html' title='cat and grep to omit some unwanted pattern on log file'/><author><name>iCehaNgeR's hAcK NoteS</name><uri>http://www.blogger.com/profile/03757838076375432274</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5937173170152272619.post-3127260836039999322</id><published>2008-02-11T07:07:00.000-08:00</published><updated>2008-02-11T07:18:55.442-08:00</updated><title type='text'>Trendnet WiFI fiasco</title><content type='html'>When I moved my home I want to setup the wireless hookup in the new home. I was trying to get into the admin console with admin ip 192.168.1.10. For my surprise i am no way able to get in. After searching for while I found out Linksys router my neighbor have the same ip for its router console.

  I enabled my wifi connection alone and gone to admin console and renamed the router name. after setting up my wep and all I am still not able to get the wireless traffic comming to my computers. Again fiddling around the admin console I found some reason I am not able to release old DHCP address. 

 This is how i released the DHCP. Swithched off the wireless router unplugged the Ethernet. Switched off the cable modem even the power, waited for 10 min. Plugged in the Cable modem powered the modem,waited for all the lights to come in, after three minutes plugged in the Router and powered in the router. 

At this point connected my router profile on the computer. Aha.. at last I am able to get the wifi. cool.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5937173170152272619-3127260836039999322?l=icehanger.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icehanger.blogspot.com/feeds/3127260836039999322/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5937173170152272619&amp;postID=3127260836039999322' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/3127260836039999322'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/3127260836039999322'/><link rel='alternate' type='text/html' href='http://icehanger.blogspot.com/2008/02/trendnet-wifi-fiasco.html' title='Trendnet WiFI fiasco'/><author><name>iCehaNgeR's hAcK NoteS</name><uri>http://www.blogger.com/profile/03757838076375432274</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5937173170152272619.post-922789932599439892</id><published>2007-10-18T07:31:00.000-07:00</published><updated>2009-04-07T20:11:47.076-07:00</updated><title type='text'>Tar and Gzip in one command</title><content type='html'>Easier way
&lt;div class="mycode"&gt;
 tar -czvf  osp2.tar.gz --exclude=*.png --exclude=*.jpg --exclude=*.pdf --exclude=*.zip --exclude=*.gz --exclude=*.tar osp
&lt;/div&gt;

here i am creating .gz archive from osp directory. For some I needed multiple exclude for each file extension. Some one can digg into this.

Tougher way



Example of how to gzip a single file
&lt;div class="mycode"&gt;
tar cvf - foofoo.sql | gzip &gt; foofoo.tar.gz

&lt;/div&gt;
Example of how to gzip an entire directory:

&lt;div class="mycode"&gt;
    cd a1

    tar cvf - . | gzip &gt; ~/backup-020916.tar.gz

&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5937173170152272619-922789932599439892?l=icehanger.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icehanger.blogspot.com/feeds/922789932599439892/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5937173170152272619&amp;postID=922789932599439892' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/922789932599439892'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/922789932599439892'/><link rel='alternate' type='text/html' href='http://icehanger.blogspot.com/2007/10/tar-and-gzip-in-one-command.html' title='Tar and Gzip in one command'/><author><name>iCehaNgeR's hAcK NoteS</name><uri>http://www.blogger.com/profile/03757838076375432274</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5937173170152272619.post-8844446195381271973</id><published>2007-10-15T08:11:00.000-07:00</published><updated>2007-10-15T08:19:56.527-07:00</updated><title type='text'>How to Escape the SAX parser from wild characters</title><content type='html'>SAX parser give you a exception if your string contain a &amp;amp; parameter. This character is normal on a URL when parsing URL's this could be headache work around is .

convert &amp;amp; with &amp; amp ;  all without space&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5937173170152272619-8844446195381271973?l=icehanger.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icehanger.blogspot.com/feeds/8844446195381271973/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5937173170152272619&amp;postID=8844446195381271973' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/8844446195381271973'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/8844446195381271973'/><link rel='alternate' type='text/html' href='http://icehanger.blogspot.com/2007/10/how-escape-sax-parser-from-wild.html' title='How to Escape the SAX parser from wild characters'/><author><name>iCehaNgeR's hAcK NoteS</name><uri>http://www.blogger.com/profile/03757838076375432274</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5937173170152272619.post-3033386066621533594</id><published>2007-10-02T13:28:00.001-07:00</published><updated>2007-10-02T13:28:32.550-07:00</updated><title type='text'>Listing your drives</title><content type='html'>File []file=File.listRoots();
          for (File fl : file){
              System.out.println(fl.getPath());
          }&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5937173170152272619-3033386066621533594?l=icehanger.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icehanger.blogspot.com/feeds/3033386066621533594/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5937173170152272619&amp;postID=3033386066621533594' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/3033386066621533594'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/3033386066621533594'/><link rel='alternate' type='text/html' href='http://icehanger.blogspot.com/2007/10/listing-your-drives.html' title='Listing your drives'/><author><name>iCehaNgeR's hAcK NoteS</name><uri>http://www.blogger.com/profile/03757838076375432274</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5937173170152272619.post-3570049651942590621</id><published>2007-09-28T08:17:00.000-07:00</published><updated>2008-12-08T21:42:54.142-08:00</updated><title type='text'>Dual Boot XP and Ubuntu 7.04 with NTDLR</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_76z2KKQ_T1Y/Rv0bVptKRmI/AAAAAAAAAzA/EyKwUC5Nhfc/s1600-h/Screenshot.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://4.bp.blogspot.com/_76z2KKQ_T1Y/Rv0bVptKRmI/AAAAAAAAAzA/EyKwUC5Nhfc/s400/Screenshot.png" alt="" id="BLOGGER_PHOTO_ID_5115274810549225058" border="0" /&gt;&lt;/a&gt;
My current System partion after the dual boot configuration.


Tools You Needed and Handy at all situations.

Windows Installation CD (For safety)
Ubuntu Installation CD
GRUB rescue CD &lt;a href="http://supergrub.forjamari.linex.org/"&gt;http://supergrub.forjamari.linex.org/&lt;/a&gt;
Linux Rescue CD &lt;a href="http://www.sysresccd.org/Main_Page"&gt;http://www.sysresccd.org/Main_Page&lt;/a&gt;
USB drive.

My System Configuration
Dell Precision M90

Dual Processor
100GB hardisk.


Partitioning

There current partition have

62.72 MB Fat16 this came up with the System where Dell stores its utils.

44.01GB of NTFS and this is Boot Active  Partition where all windows files go and  it is named C:\

49.15 GB of NTFS which is empty and named D:\

If you need to format or shrink the partition from windows at initial in any other way you can do it from MMC and select disk partitioning. Just type MMC on the run mode.


The whole point here is how to install UBUNTU on windows without affect the current MBR configuration. We wont disturb the windows MBR at any point of time.

Now we will boot the system with the linux Rescue CD.

Press enter at the end of the prompts and type &lt;span style="font-weight: bold;"&gt;startx &lt;/span&gt;

This will take you to the  Graphical screen. Select the Disk partition Utility and re-partition your D:\ drive with two linux partitions.

we will shrink it D:\ with

24.67 GB of NTFS

22.7GB with ext3

1.76 GB with linux-swap

Save the workspace and quit and come out of the os by halt or shutdown.


Thats it with partitioning for now.  :-)


Now Boot the System with the linux install CD.

just do all the step until partition

Select &lt;span style="font-weight: bold;"&gt;Manual option

&lt;span style="font-weight: bold;"&gt;  &lt;/span&gt;&lt;/span&gt;give the partition names we partitioned earlier. Like the ext3 and linux-swap.
use the ext3 as your root partition. OK ubuntu will complaint now that its not formated  check the format option there so that UBUNTU will format the root partition again.

At the end of partition select the Advance option. This is the most confusing part in Ubuntu 7.04  it was not there in 6.10 or previous versions. When you click advance it will give a value (hda0)  . Actualy it is the place where you going to install your GRUB if you dont change the parameter your an deep trouble it will install in the MBR and wipe out windows MBR no more windows again until u fix the MBR using the Windows Resucue CD the command is MBRFIX it will wipe out the GRUB additions.

Back to the GRUB install in the advance option you have to tell UBUNTU you are going to install the GRUB on your LINUX partition that is /dev/sda6 in my case. In previous version we could tell just like that now in the 7.04 we have to tell it as this way.

(hda0,5)

That means you are going to install the GRUB on your first hard Disk = hda0
and your 5th partition that is 5.

Now complete the installation.

Before your reboot you can go to the console and type in this

dd if=/dev/sda6 of=/media/device/linux.bin  bs=512 os=2

this will create a linux.bin file in your USB drive /media/device is my usb drive mount path.

If your lucky and did't do anything wrong after your reboot you should be able to get into your windows. If your are not able to Windows but able to get into your Ubunut that means.

You have wiped out your MBR.
   OR
Your boot partition is not active instead your Linux partition is active.

If it is MBR problem use  windows rescue cd to fix it.
If the boot partition is not active use the Linux rescue CD and activate the Windows partition active boot.


Now get into windows and change the boot.ini in C:\ drive you have make the hidden and system files visible. You can do that from the folder options.

now edit it the boot.ini with

C:\linux.bin "Linux"  as  your last lin and save This is how we tell NTDLR to boot the linux using its GRUB.

At this point you have another option if you did't have a usb drive or  you forget to issue the dd command you have tool called &lt;span style="font-weight: bold;"&gt;bootpart

&lt;span style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt;What&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt; it will do is it will create the linux.bin file and add it to the boo.ini no manual editing the file cool, bad part about is it will add a url and some text when you load. Free advertisement. blaaaaaaa.

&lt;span style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;
&lt;/span&gt;Now reboot the system and see the two option XP and Linux select Linux if its loading and booting your successful in your effort.
&lt;span style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt;&lt;/span&gt;
&lt;/span&gt;
If not you may have to do one more thing to do. Your GRUB installation is curropted. You have to re-install the GRUB. This where your Super GRUB comes in help.

boot again with SuperGrub

type C

your at the grub prompt now issue this.

find /boot/grup/stage1 this will tell you where your grub is installed.

it will give (hda0,5)

Now try to boot your grub with the boot option from the SuperGrub  and give it the place where your GRUB is installed, we found it earlier using the find command.

if it errors out like no executable or end line corupted, You have to re-install the GRUB not a big thing.

type
root  (hda0,5)
setup (hda0,5)

quit

Make sure you have a space between root and (, otherwise it will tell command not found.

now Your GRUB is re-installed.  boot the GRUB again with partition loader.  This time it should work.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5937173170152272619-3570049651942590621?l=icehanger.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icehanger.blogspot.com/feeds/3570049651942590621/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5937173170152272619&amp;postID=3570049651942590621' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/3570049651942590621'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/3570049651942590621'/><link rel='alternate' type='text/html' href='http://icehanger.blogspot.com/2007/09/dual-boot-xp-and-ubuntu-704-with-ntdlr.html' title='Dual Boot XP and Ubuntu 7.04 with NTDLR'/><author><name>iCehaNgeR's hAcK NoteS</name><uri>http://www.blogger.com/profile/03757838076375432274</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_76z2KKQ_T1Y/Rv0bVptKRmI/AAAAAAAAAzA/EyKwUC5Nhfc/s72-c/Screenshot.png' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5937173170152272619.post-6694179687642923321</id><published>2007-09-26T08:46:00.000-07:00</published><updated>2007-09-26T08:47:06.440-07:00</updated><title type='text'>For Each Loop</title><content type='html'>Iterating over a collection is uglier than it needs to be.  Consider the following method, which takes a collection of timer tasks and cancels them: &lt;blockquote&gt; &lt;pre&gt;void cancelAll(Collection&lt;timertask&gt; c) {
   for (&lt;span style="color:#cc0000;"&gt;Iterator&lt;timertask&gt; i = c.iterator(); i.hasNext(); &lt;/span&gt;)
       &lt;span style="color:#cc0000;"&gt;i.next()&lt;/span&gt;.cancel();
}
&lt;/pre&gt; &lt;/blockquote&gt;  &lt;p&gt;The iterator is just clutter. Furthermore, it is an opportunity for error.  The iterator variable occurs three times in each loop: that is two chances to get it wrong. The for-each construct gets rid of the clutter and the opportunity for error. Here is how the example looks with the for-each construct:  &lt;/p&gt;&lt;blockquote&gt; &lt;pre&gt;void cancelAll(Collection&lt;timertask&gt; c) {
   for (&lt;span style="color:#009900;"&gt;TimerTask t : c&lt;/span&gt;)
       t.cancel();
}
&lt;/pre&gt; &lt;/blockquote&gt;  &lt;p&gt;When you see the colon (&lt;code&gt;:&lt;/code&gt;) &lt;span style="font-weight: bold;"&gt;read it as “in.” The loop above reads as “for each &lt;/span&gt;&lt;code style="font-weight: bold;"&gt;TimerTask t&lt;/code&gt;&lt;span style="font-weight: bold;"&gt; in &lt;/span&gt;&lt;code style="font-weight: bold;"&gt;c&lt;/code&gt;&lt;span style="font-weight: bold;"&gt;.”&lt;/span&gt; As you can see, the for-each construct combines beautifully with &lt;a href="http://java.sun.com/j2se/1.5.0/docs/guide/language/generics.html"&gt;generics&lt;/a&gt;. It preserves all of the type safety, while removing the remaining clutter. Because you don't have to declare the iterator, you don't have to provide a generic declaration for it. (The compiler does this for you behind your back, but you need not concern yourself with it.)  &lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5937173170152272619-6694179687642923321?l=icehanger.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icehanger.blogspot.com/feeds/6694179687642923321/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5937173170152272619&amp;postID=6694179687642923321' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/6694179687642923321'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/6694179687642923321'/><link rel='alternate' type='text/html' href='http://icehanger.blogspot.com/2007/09/for-each-loop.html' title='For Each Loop'/><author><name>iCehaNgeR's hAcK NoteS</name><uri>http://www.blogger.com/profile/03757838076375432274</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5937173170152272619.post-1957002535068875145</id><published>2007-09-24T08:09:00.001-07:00</published><updated>2008-12-08T21:42:54.243-08:00</updated><title type='text'>simpsonized</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_76z2KKQ_T1Y/RvfTX5tKRiI/AAAAAAAAAyM/TIADpkZWZ5Y/s1600-h/bsimpson.jpeg"&gt;&lt;img style="cursor: pointer;" src="http://3.bp.blogspot.com/_76z2KKQ_T1Y/RvfTX5tKRiI/AAAAAAAAAyM/TIADpkZWZ5Y/s400/bsimpson.jpeg" alt="" id="BLOGGER_PHOTO_ID_5113788309483177506" border="0" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5937173170152272619-1957002535068875145?l=icehanger.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icehanger.blogspot.com/feeds/1957002535068875145/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5937173170152272619&amp;postID=1957002535068875145' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/1957002535068875145'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/1957002535068875145'/><link rel='alternate' type='text/html' href='http://icehanger.blogspot.com/2007/09/simpsonized.html' title='simpsonized'/><author><name>iCehaNgeR's hAcK NoteS</name><uri>http://www.blogger.com/profile/03757838076375432274</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_76z2KKQ_T1Y/RvfTX5tKRiI/AAAAAAAAAyM/TIADpkZWZ5Y/s72-c/bsimpson.jpeg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5937173170152272619.post-651866255695703616</id><published>2007-08-23T16:27:00.000-07:00</published><updated>2007-08-23T16:31:30.742-07:00</updated><title type='text'>Collection</title><content type='html'>&lt;table border="2"&gt;&lt;caption id="General-purpose-implementations"&gt;&lt;strong&gt;General-purpose Implementations&lt;/strong&gt;&lt;/caption&gt; &lt;tbody&gt;&lt;tr&gt;     &lt;th width="15%"&gt;Interfaces&lt;/th&gt;     &lt;th colspan="5"&gt;Implementations&lt;/th&gt; &lt;/tr&gt; &lt;tr&gt;     &lt;td&gt; &lt;/td&gt;     &lt;td&gt;&lt;b&gt;Hash table&lt;/b&gt;&lt;/td&gt;     &lt;td&gt;&lt;b&gt;Resizable array&lt;/b&gt;&lt;/td&gt;     &lt;td&gt;&lt;b&gt;Tree&lt;/b&gt;&lt;/td&gt;     &lt;td&gt;&lt;b&gt;Linked list&lt;/b&gt;&lt;/td&gt;     &lt;td&gt;&lt;b&gt;Hash table + Linked list&lt;/b&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt;     &lt;td&gt;&lt;code&gt;Set&lt;/code&gt;&lt;/td&gt;     &lt;td&gt;&lt;code&gt;HashSet&lt;/code&gt;&lt;/td&gt;     &lt;td&gt; &lt;/td&gt;     &lt;td&gt;&lt;code&gt;TreeSet&lt;/code&gt;&lt;/td&gt;     &lt;td&gt; &lt;/td&gt;     &lt;td&gt;&lt;code&gt;LinkedHashSet&lt;/code&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt;     &lt;td&gt;&lt;code&gt;List&lt;/code&gt;&lt;/td&gt;     &lt;td&gt; &lt;/td&gt;     &lt;td&gt;&lt;code&gt;ArrayList&lt;/code&gt;&lt;/td&gt;     &lt;td&gt; &lt;/td&gt;     &lt;td&gt;&lt;code&gt;LinkedList&lt;/code&gt;&lt;/td&gt;     &lt;td&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt;     &lt;td&gt;&lt;code&gt;Queue&lt;/code&gt;&lt;/td&gt;     &lt;td&gt; &lt;/td&gt;     &lt;td&gt; &lt;/td&gt;     &lt;td&gt; &lt;/td&gt;     &lt;td&gt; &lt;/td&gt;     &lt;td&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt;     &lt;td&gt;&lt;code&gt;Map&lt;/code&gt;&lt;/td&gt;     &lt;td&gt;&lt;code&gt;HashMap&lt;/code&gt;&lt;/td&gt;     &lt;td&gt; &lt;/td&gt;     &lt;td&gt;&lt;code&gt;TreeMap&lt;/code&gt;&lt;/td&gt;     &lt;td&gt; &lt;/td&gt;     &lt;td&gt;&lt;code&gt;LinkedHashMap&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;a name="l3"&gt;A Set and a Map &lt;span style="font-weight: bold;"&gt;cannot&lt;/span&gt; contain &lt;span style="font-weight: bold;"&gt;duplicates&lt;/span&gt;
A Map contains pairs of (key;object). the elements are ordered and can be accessed by the key

&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5937173170152272619-651866255695703616?l=icehanger.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icehanger.blogspot.com/feeds/651866255695703616/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5937173170152272619&amp;postID=651866255695703616' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/651866255695703616'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/651866255695703616'/><link rel='alternate' type='text/html' href='http://icehanger.blogspot.com/2007/08/collection.html' title='Collection'/><author><name>iCehaNgeR's hAcK NoteS</name><uri>http://www.blogger.com/profile/03757838076375432274</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5937173170152272619.post-587474497245458963</id><published>2007-08-23T16:21:00.000-07:00</published><updated>2007-08-23T16:25:02.891-07:00</updated><title type='text'>SAX V/S DOM</title><content type='html'>Instead of reading a document  one piece at a time (as with SAX), a DOM parser reads an entire  document. It then makes the tree for the entire document available  to program code for reading and updating. Simply put, the  difference between SAX and DOM is the difference between  sequential, read-only access, and random, read-write access.

&lt;h2&gt;&lt;small&gt;&lt;span style="color:#666699;"&gt;When to use DOM&lt;/span&gt;&lt;/small&gt;       &lt;hr /&gt;&lt;/h2&gt;              &lt;small&gt;&lt;a name="pgfId-1128165"&gt;&lt;/a&gt;&lt;/small&gt;       &lt;p class="Body"&gt;&lt;small&gt;&lt;a name="pgfId-1128171"&gt;&lt;/a&gt;If your XML documents contain document data (e.g., Framemaker documents stored in XML format), then DOM is a completely natural fit for your solution. If you are creating some sort of document information management system, then you will probably have to deal with a lot of document data. An example of this is the Datachannel RIO product, which can index and organize information that comes from all kinds of document sources (like Word and Excel files). In this case, DOM is well suited to allow programs access to information stored in these documents.&lt;/small&gt;&lt;/p&gt;              &lt;p class="Body"&gt;&lt;small&gt;&lt;a name="pgfId-1154645"&gt;&lt;/a&gt;However, if you are dealing mostly with structured data (the equivalent of serialized Java objects in XML) DOM is not the best choice. That is when SAX might be a better fit.&lt;/small&gt;&lt;/p&gt;              &lt;div&gt;       &lt;h2&gt;&lt;small&gt;&lt;span style="color:#666699;"&gt;&lt;a name="32209"&gt;&lt;/a&gt;When to use SAX&lt;/span&gt;&lt;/small&gt;       &lt;hr /&gt;&lt;/h2&gt;       &lt;/div&gt;       &lt;small&gt;&lt;a name="pgfId-1128166"&gt;&lt;/a&gt;&lt;/small&gt;       &lt;p class="Body"&gt;&lt;small&gt;&lt;a name="pgfId-1128172"&gt;&lt;/a&gt;If the information stored in your XML documents is machine readable (and generated) data then SAX is the right API for giving your programs access to this information. Machine readable and generated data include things like:&lt;/small&gt;&lt;/p&gt;              &lt;ul&gt;&lt;li class="Bulleted"&gt;&lt;small&gt; &lt;a name="pgfId-1154660"&gt;&lt;/a&gt;Java object properties stored in XML format&lt;/small&gt;&lt;/li&gt;&lt;li class="Bulleted"&gt;&lt;small&gt; &lt;a name="pgfId-1154661"&gt;&lt;/a&gt;queries that are formulated using some kind of text based query language (SQL, XQL, OQL)&lt;/small&gt;&lt;/li&gt;&lt;li class="Bulleted"&gt;&lt;small&gt; &lt;a name="pgfId-1154664"&gt;&lt;/a&gt;result sets that are generated based on queries (this might include data in relational database tables encoded into XML).&lt;/small&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5937173170152272619-587474497245458963?l=icehanger.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icehanger.blogspot.com/feeds/587474497245458963/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5937173170152272619&amp;postID=587474497245458963' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/587474497245458963'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/587474497245458963'/><link rel='alternate' type='text/html' href='http://icehanger.blogspot.com/2007/08/sax-vs-dom.html' title='SAX V/S DOM'/><author><name>iCehaNgeR's hAcK NoteS</name><uri>http://www.blogger.com/profile/03757838076375432274</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5937173170152272619.post-8492409378668347946</id><published>2007-07-24T09:11:00.001-07:00</published><updated>2007-07-24T09:11:59.982-07:00</updated><title type='text'>Find and Remove files recusively Linux</title><content type='html'>&lt;p&gt;&lt;code&gt;find ./ -name subsub* -ok rm -r {} \;&lt;/code&gt;&lt;/p&gt;&lt;p&gt;&lt;code&gt;find ./ -name *.class -ok rm -r {} \;&lt;/code&gt;
&lt;code&gt;&lt;/code&gt;&lt;/p&gt;&lt;p&gt;Will search for any file or (sub)dir and delete it after asking politly…&lt;/p&gt; &lt;p&gt;&lt;code&gt;find ./ -name sub* -exec rm -rf {} \;&lt;/code&gt;&lt;/p&gt; &lt;p&gt;Will search for any file or (sub)dir, delete it and won’t tell anyone at all…&lt;/p&gt; The trick is, the {}  in the rm command, will be repaced by what ever the find commands finds… (obviously, you dont have to delete..&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5937173170152272619-8492409378668347946?l=icehanger.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icehanger.blogspot.com/feeds/8492409378668347946/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5937173170152272619&amp;postID=8492409378668347946' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/8492409378668347946'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/8492409378668347946'/><link rel='alternate' type='text/html' href='http://icehanger.blogspot.com/2007/07/find-and-remove-files-recusively-linux.html' title='Find and Remove files recusively Linux'/><author><name>iCehaNgeR's hAcK NoteS</name><uri>http://www.blogger.com/profile/03757838076375432274</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5937173170152272619.post-3893585226863525029</id><published>2007-07-24T08:16:00.001-07:00</published><updated>2007-07-24T08:16:38.053-07:00</updated><title type='text'>LDAP SCHEMA DESIGN</title><content type='html'>&lt;h1&gt;COLLEGE LDAP Schema - CASE STUDY&lt;/h1&gt; &lt;h2&gt;
Description&lt;/h2&gt; &lt;p&gt;This document describes about design of ldap schema for a college  administration department. College will have various departments like  mechanical, chemical, Electronics, civil etc.. Each department will of various  branches. For example electronics department can have Electronics &amp;  Communication Engineering, Electronics &amp;amp; Electrical Engineering, Electronics &amp;  Instrumentation Engineering, Computer Science Engineering, Computer Science &amp;amp;  Information Technology, Electronics &amp; Computer Science etc.. Each branch will  have in charge, number of students, teaching and non teaching staff. Each student  will be attending set of subjects for an academic year. Each teaching staff &amp;amp;  non teaching staff will have salary details. Framing the requirements into  hierarchical structure, following LDAP tree depicts the tree structure.&lt;/p&gt; &lt;h3&gt;&lt;p&gt;Note: the oids used in this article are selected randomly and they are for temporary use and please don't use oid's mentioned in this article. Use your own oids. The oids in this article will be changed in the next release&lt;/p&gt;&lt;/h3&gt;  &lt;h2&gt;
Schema design&lt;/h2&gt; &lt;p&gt;
From the above description, the objectclasses identified are COLLEGE,  DEPARTMENT,  BRANCH, ACADEMIC, STUDENT, SUBJECTS, STAFF and SALARY and each  object class consists of following attributes.&lt;/p&gt; &lt;table style="border-collapse: collapse;color:#111111;" id="AutoNumber10" border="1" border cellpadding="0" cellspacing="0" width="100%"&gt;   &lt;tbody&gt;&lt;tr&gt;     &lt;td width="16%"&gt;&lt;b&gt;&lt;span style="font-size:130%;"&gt;COLLEGE&lt;/span&gt;&lt;/b&gt;&lt;/td&gt;     &lt;td rowspan="9" width="3%"&gt; &lt;/td&gt;     &lt;td width="18%"&gt;&lt;b&gt;&lt;span style="font-size:130%;"&gt;DEPARTMENT&lt;/span&gt;&lt;/b&gt;&lt;/td&gt;     &lt;td rowspan="9" width="3%"&gt; &lt;/td&gt;     &lt;td width="14%"&gt;&lt;b&gt;&lt;span style="font-size:130%;"&gt;BRANCH&lt;/span&gt;&lt;/b&gt;&lt;/td&gt;     &lt;td rowspan="9" width="3%"&gt; &lt;/td&gt;     &lt;td width="13%"&gt;&lt;b&gt;&lt;span style="font-size:130%;"&gt;ACADEMIC&lt;/span&gt;&lt;/b&gt;&lt;/td&gt;     &lt;td rowspan="9" width="3%"&gt; &lt;/td&gt;     &lt;td width="17%"&gt;&lt;b&gt;&lt;span style="font-size:130%;"&gt;STUDENT&lt;/span&gt;&lt;/b&gt;&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td width="16%"&gt;collegeName&lt;/td&gt;     &lt;td width="18%"&gt;deptName&lt;/td&gt;     &lt;td width="14%"&gt;branchName&lt;/td&gt;     &lt;td width="13%"&gt;academicYear&lt;/td&gt;     &lt;td width="17%"&gt;studentName&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td width="16%"&gt;collegePrincipal&lt;/td&gt;     &lt;td width="18%"&gt;deptHead&lt;/td&gt;     &lt;td width="14%"&gt;BranchHead&lt;/td&gt;     &lt;td rowspan="7" width="13%"&gt; &lt;/td&gt;     &lt;td width="17%"&gt;studentNumber&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td width="16%"&gt;collegePresident&lt;/td&gt;     &lt;td rowspan="6" width="18%"&gt; &lt;/td&gt;     &lt;td width="14%"&gt;branchNumberOfStudents&lt;/td&gt;     &lt;td width="17%"&gt;studentAddress&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td width="16%"&gt;collegeSecretary&lt;/td&gt;     &lt;td rowspan="5" width="14%"&gt; &lt;/td&gt;     &lt;td width="17%"&gt;studentAcademicYear&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td width="16%"&gt;collegeBoardMember&lt;/td&gt;     &lt;td width="17%"&gt;studemtCourse&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td rowspan="3" width="16%"&gt; &lt;/td&gt;     &lt;td width="17%"&gt;studentStatus&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td width="17%"&gt;studentYear&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td width="17%"&gt; &lt;/td&gt;   &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt; &lt;h3&gt; &lt;/h3&gt; &lt;table style="border-collapse: collapse;color:#111111;" id="AutoNumber11" border="1" border cellpadding="0" cellspacing="0" width="80%"&gt;   &lt;tbody&gt;&lt;tr&gt;     &lt;td width="28%"&gt;&lt;b&gt;&lt;span style="font-size:130%;"&gt;SUBJECTS&lt;/span&gt;&lt;/b&gt;&lt;/td&gt;     &lt;td rowspan="8" width="3%"&gt; &lt;/td&gt;     &lt;td width="31%"&gt;&lt;b&gt;&lt;span style="font-size:130%;"&gt;STAFF&lt;/span&gt;&lt;/b&gt;&lt;/td&gt;     &lt;td rowspan="8" width="3%"&gt; &lt;/td&gt;     &lt;td width="37%"&gt;&lt;b&gt;&lt;span style="font-size:130%;"&gt;SALARY&lt;/span&gt;&lt;/b&gt;&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td width="28%"&gt;subjectName&lt;/td&gt;     &lt;td width="31%"&gt;staffName&lt;/td&gt;     &lt;td width="37%"&gt;salaryBASIC&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td width="28%"&gt;subjectMarks&lt;/td&gt;     &lt;td width="31%"&gt;staffID&lt;/td&gt;     &lt;td width="37%"&gt;salaryDA&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td width="28%"&gt;subjectCode&lt;/td&gt;     &lt;td width="31%"&gt;staffAddress&lt;/td&gt;     &lt;td width="37%"&gt;salaryHRA&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td width="28%"&gt; &lt;/td&gt;     &lt;td width="31%"&gt;staffQualification&lt;/td&gt;     &lt;td width="37%"&gt;salaryAllowance&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td width="28%"&gt; &lt;/td&gt;     &lt;td width="31%"&gt;staffDesignation&lt;/td&gt;     &lt;td width="37%"&gt;salaryTotal&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td width="28%"&gt; &lt;/td&gt;     &lt;td width="31%"&gt;staffBranch&lt;/td&gt;     &lt;td width="37%"&gt; &lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td width="28%"&gt; &lt;/td&gt;     &lt;td width="31%"&gt;staffType&lt;/td&gt;     &lt;td width="37%"&gt; &lt;/td&gt;   &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt; &lt;p&gt;The top node is &lt;i&gt;college&lt;/i&gt; with unique DN as o=college. College will have  different departments like Civil, Electronics, Mechanical etc.. The number of  child nodes depends on the number of departments in the college. Let us take,  college has two departments Civil and Electronics. Then the o=college parent  node will have two child nodes deptName=Civil and deptName=Electronics. Each  node can be identified as deptName=Civil,o=college and  deptName=Electronics,o=college. If searched with DN  deptName=Electronics,o=college, attributes at this entry will be retrieved. The  subtree is&lt;/p&gt; &lt;p&gt;                                                                     o=college
                                                                             |
                                                         ---------------------------------
                                                         |                                                 |
                                              deptName=Civil             deptName=Electronics&lt;/p&gt; &lt;p&gt;Consider the department Electronics has three branches ECE, EEE &amp; CSE. The DN  for each branch will be &lt;i&gt;                 branchName=ECE,deptName=Electronics,o=college&lt;/i&gt;,
&lt;i&gt;branchName=EEE,,deptName=Electronics,o=college&lt;/i&gt; and
&lt;i&gt;branchName=CSE,,deptName=Electronics,o=college. &lt;/i&gt;&lt;/p&gt; &lt;p&gt;Now take the branch ECE, each branch will  have students and staff. Each  student belongs to a particular year and each staff belongs to either teaching  or non-teaching staff. So consider the sub tree under the dn &lt;i&gt; branchName=ECE,deptName=Electronics,o=college &lt;/i&gt;is&lt;i&gt;
&lt;/i&gt;                                                                                 branchName=ECE 
                                                                                                 |
                                                               -----------------------------------------------------
                                                                |                                                                             |
                                                         ou=student                                                                 ou=staff
                                                                 |                                                                             |
                                         ------------------------------ &amp;nbspp;                                    ---------------------------
                                             |                                    |                                                                |
          academicYear=1999-2000     academicaYear=2000-2001                ou=teaching                     ou=nonteaching&lt;/p&gt; &lt;p&gt;Each academicYear consists of students and each student will be studying the  subjects, each staff will have salary details and subjects he/she is handling.  The subtrees for academicYear, teaching and nonteaching are   &lt;/p&gt; &lt;p&gt;                              ademicYear=1999-2000                                                 ou=teaching                     ou=nonteaching
                                             |                                                                              |                                         |
                                         ----------------------------  &amp;                            -----------------    ;             -----------------
                                         |                                        |                                  |                         |                 |                      |
                            studentNumber=100    studentNumber=101          staffID=200         staffID201     staffID=300  staffID=301
                                              |                                                                 |                                             |
                                  ----------------------   &amp;                                  -----------------                     ou=Salary Details
                                  |                               |                                          |                       |    
                             subjectCode=001  subjectCode=002                 ou=Salary Details   subjectCode=001    &lt;/p&gt; &lt;h2&gt;COLLEGE LDAP Tree&lt;/h2&gt; &lt;p&gt;                                                                     o=college
                                                                             |
                                                         ---------------------------------
                                                         |                                                 |
                                              deptName=Civil             deptName=Electronics
                                                                                                   |
                                                                    ------------------------------------------
                                                                      |                           |                                  | 
                                                      branchName=EEE    branchName=ECE        branchName=CSE 
                                                                                                 |
                                                               -----------------------------------------------------
                                                                |                                                                             |
                                                         ou=student                                                                 ou=staff
                                                                 |                                                                             |
                                         ------------------------------ &amp;nbspp;                                    ---------------------------
                                             |                                    |                                                                |
          academicYear=1999-2000     academicaYear=2000-2001                ou=teaching                     ou=nonteaching
                                             |                                                                              |                                         |
                                         ----------------------------  &amp;                            -----------------    ;             -----------------
                                         |                                        |                                  |                         |                 |                      |
                            studentNumber=100    studentNumber=101          staffID=200         staffID201     staffID=300  staffID=301
                                              |                                                                 |                                             |
                                  ----------------------   &amp;                                  -----------------                     ou=Salary Details
                                  |                               |                                          |                       |    
                             subjectCode=001  subjectCode=002                 ou=Salary Details   subjectCode=001    &lt;/p&gt; &lt;h2&gt; &lt;/h2&gt; &lt;h2&gt;Attributes&lt;/h2&gt; &lt;p class="MsoPlainText"&gt;This section contains attribute file for College LDAP  tree&lt;/p&gt; &lt;p class="MsoPlainText"&gt;attributetype ( 1.3.6.1.4.1.15490.1.1 NAME 'collegeName'
                DESC 'college name'
                EQUALITY caseIgnoreMatch
                SUBSTR caseIgnoreSubstringsMatch
                SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
                SINGLE-VALUE )
attributetype ( 1.3.6.1.4.1.15490.1.2 NAME 'collegePrincipal'
                DESC 'college principal name'
                EQUALITY caseIgnoreMatch
                SUBSTR caseIgnoreSubstringsMatch
                SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
                SINGLE-VALUE )
attributetype ( 1.3.6.1.4.1.15490.1.3 NAME 'collegePresident'
                DESC 'college  president'
                EQUALITY caseIgnoreMatch
                SUBSTR caseIgnoreSubstringsMatch
                SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
                SINGLE-VALUE )
attributetype ( 1.3.6.1.4.1.15490.1.4 NAME 'collegeSecretary'
                DESC 'college secretary name'
                EQUALITY caseIgnoreMatch
                SUBSTR caseIgnoreSubstringsMatch
                SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
                SINGLE-VALUE )
attributetype ( 1.3.6.1.4.1.15490.1.5 NAME 'collegeBoardMember'
                DESC 'board member name'
                EQUALITY caseIgnoreMatch
                SUBSTR caseIgnoreSubstringsMatch
                SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
                        )
attributetype ( 1.3.6.1.4.1.15490.1.6 NAME 'deptName'
                DESC 'description'
                EQUALITY caseIgnoreMatch
                SUBSTR caseIgnoreSubstringsMatch
                SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
                SINGLE-VALUE )
attributetype ( 1.3.6.1.4.1.15490.1.7 NAME 'deptHead'
                DESC 'description'
                EQUALITY caseIgnoreMatch
                SUBSTR caseIgnoreSubstringsMatch
                SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
                SINGLE-VALUE )
attributetype ( 1.3.6.1.4.1.15490.1.8 NAME 'branchName'
                DESC 'board member name'
                EQUALITY caseIgnoreMatch
                SUBSTR caseIgnoreSubstringsMatch
                SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
                SINGLE-VALUE)
attributetype ( 1.3.6.1.4.1.15490.1.9 NAME 'branchHead'
                DESC 'description'
                EQUALITY caseIgnoreMatch
                SUBSTR caseIgnoreSubstringsMatch
                SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
                SINGLE-VALUE )
attributetype ( 1.3.6.1.4.1.15490.1.10 NAME 'branchNumberOfStudents'
                DESC 'description'
                EQUALITY caseIgnoreMatch
                SUBSTR caseIgnoreSubstringsMatch
                SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
                SINGLE-VALUE )

attributetype ( 1.3.6.1.4.1.15490.1.11 NAME 'studentName'
                DESC 'description'
                EQUALITY caseIgnoreMatch
                SUBSTR caseIgnoreSubstringsMatch
                SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
                SINGLE-VALUE )
attributetype ( 1.3.6.1.4.1.15490.1.12 NAME 'studentNumber'
                DESC 'description'
                EQUALITY caseIgnoreMatch
                SUBSTR caseIgnoreSubstringsMatch
                SYNTAX 1.3.6.1.4.1.1466.115.121.1.15)
attributetype ( 1.3.6.1.4.1.15490.1.13 NAME 'studentAddress'
                DESC 'description'
                EQUALITY caseIgnoreMatch
                SUBSTR caseIgnoreSubstringsMatch
                SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
                SINGLE-VALUE )
attributetype ( 1.3.6.1.4.1.15490.1.14 NAME 'studentAcademicYear'
                DESC 'description'
                EQUALITY caseIgnoreMatch
                SUBSTR caseIgnoreSubstringsMatch
                SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
                SINGLE-VALUE )
attributetype ( 1.3.6.1.4.1.15490.1.15 NAME 'studentCourse'
                DESC 'description'
                EQUALITY caseIgnoreMatch
                SUBSTR caseIgnoreSubstringsMatch
                SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
                SINGLE-VALUE)
attributetype ( 1.3.6.1.4.1.15490.1.16 NAME 'studentStatus'
                DESC 'description'
                EQUALITY caseIgnoreMatch
                SUBSTR caseIgnoreSubstringsMatch
                SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
                SINGLE-VALUE )
attributetype ( 1.3.6.1.4.1.15490.1.17 NAME 'studentYear'
                DESC 'description'
                EQUALITY caseIgnoreMatch
                SUBSTR caseIgnoreSubstringsMatch
                SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
                SINGLE-VALUE )
attributetype ( 1.3.6.1.4.1.15490.1.18 NAME 'subjectName'
                DESC 'description'
                EQUALITY caseIgnoreMatch
                SUBSTR caseIgnoreSubstringsMatch
                SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
                SINGLE-VALUE )
attributetype ( 1.3.6.1.4.1.15490.1.19 NAME 'subjectMarks'
                DESC 'description'
                EQUALITY caseIgnoreMatch
                SUBSTR caseIgnoreSubstringsMatch
                SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
                SINGLE-VALUE )

attributetype ( 1.3.6.1.4.1.15490.1.20 NAME 'subjectCode'
                DESC 'description'
                EQUALITY caseIgnoreMatch
                SUBSTR caseIgnoreSubstringsMatch
                SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
                SINGLE-VALUE )

attributetype ( 1.3.6.1.4.1.15490.1.21 NAME 'staffName'
                DESC 'description'
                EQUALITY caseIgnoreMatch
                SUBSTR caseIgnoreSubstringsMatch
                SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
                SINGLE-VALUE )
attributetype ( 1.3.6.1.4.1.15490.1.22 NAME 'staffID'
                DESC 'description'
                EQUALITY caseIgnoreMatch
                SUBSTR caseIgnoreSubstringsMatch
                SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
                SINGLE-VALUE )
attributetype ( 1.3.6.1.4.1.15490.1.23 NAME 'staffAddress'
                DESC 'description'
                EQUALITY caseIgnoreMatch
                SUBSTR caseIgnoreSubstringsMatch
                SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
                SINGLE-VALUE )
attributetype ( 1.3.6.1.4.1.15490.1.24 NAME 'staffQualification'
                DESC 'description'
                EQUALITY caseIgnoreMatch
                SUBSTR caseIgnoreSubstringsMatch
                SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
                SINGLE-VALUE )
attributetype ( 1.3.6.1.4.1.15490.1.25 NAME 'staffDesignation'
                DESC 'description'
                EQUALITY caseIgnoreMatch
                SUBSTR caseIgnoreSubstringsMatch
                SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
                SINGLE-VALUE )
attributetype ( 1.3.6.1.4.1.15490.1.26 NAME 'staffDepartment'
                DESC 'description'
                EQUALITY caseIgnoreMatch
                SUBSTR caseIgnoreSubstringsMatch
                SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
                SINGLE-VALUE )
attributetype ( 1.3.6.1.4.1.15490.1.27 NAME 'staffBranch'
                DESC 'description'
                EQUALITY caseIgnoreMatch
                SUBSTR caseIgnoreSubstringsMatch
                SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
                SINGLE-VALUE )
attributetype ( 1.3.6.1.4.1.15490.1.28 NAME 'staffType'
                DESC 'description'
                EQUALITY caseIgnoreMatch
                SUBSTR caseIgnoreSubstringsMatch
                SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
                SINGLE-VALUE )
attributetype ( 1.3.6.1.4.1.15490.1.29 NAME 'salaryBasic'
                DESC 'description'
                EQUALITY caseIgnoreMatch
                SUBSTR caseIgnoreSubstringsMatch
                SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
                SINGLE-VALUE )
attributetype ( 1.3.6.1.4.1.15490.1.30 NAME 'salaryDA'
                DESC 'description'
                EQUALITY caseIgnoreMatch
                SUBSTR caseIgnoreSubstringsMatch
                SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
                SINGLE-VALUE )
attributetype ( 1.3.6.1.4.1.15490.1.31 NAME 'salaryHRA'
                DESC 'description'
                EQUALITY caseIgnoreMatch
                SUBSTR caseIgnoreSubstringsMatch
                SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
                SINGLE-VALUE )
attributetype ( 1.3.6.1.4.1.15490.1.32 NAME 'salaryAllowance'
                DESC 'description'
                EQUALITY caseIgnoreMatch
                SUBSTR caseIgnoreSubstringsMatch
                SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
                SINGLE-VALUE )
attributetype ( 1.3.6.1.4.1.15490.1.33 NAME 'salaryTotal'
                DESC 'description'
                EQUALITY caseIgnoreMatch
                SUBSTR caseIgnoreSubstringsMatch
                SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
                SINGLE-VALUE )
attributetype ( 1.3.6.1.4.1.15490.1.34 NAME 'academicYear'
                DESC 'description'
                EQUALITY caseIgnoreMatch
                SUBSTR caseIgnoreSubstringsMatch
                SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
                SINGLE-VALUE )&lt;/p&gt; &lt;h2&gt;Object class          &lt;/h2&gt; &lt;p class="MsoPlainText"&gt;This section gives objectclass details for College LDAP  tree.

objectclass ( 1.3.6.1.4.1.15490.2.1 NAME 'objCollege'
                SUP top STRUCTURAL
                DESC 'object class'
                MUST (collegeName $ collegePrincipal $ collegePresident $  collegeSecretary  )
                MAY (collegeBoardMember ) )
objectclass ( 1.3.6.1.4.1.15490.2.2 NAME 'objDepartment'
                SUP top STRUCTURAL
                DESC 'object class'
                MUST (deptName $ deptHead ) )

objectclass ( 1.3.6.1.4.1.15490.2.3 NAME 'objBranch'
                SUP top STRUCTURAL
                DESC 'object class'
                MUST (branchHead $ branchName $ branchNumberOfStudents  ) )

objectclass ( 1.3.6.1.4.1.15490.2.4 NAME 'objStudent'
                DESC 'object class'
                SUP top STRUCTURAL
                MUST ( studentName $ studentNumber $ studentAddress $  studentAcademicYear $ studentCourse $
                            studentStatus $ studentYear ) )

objectclass ( 1.3.6.1.4.1.15490.2.5 NAME 'objSubject'
                DESC 'object class'
                SUP top STRUCTURAL
                MUST ( subjectCode $subjectName $ subjectMarks ) )

objectclass ( 1.3.6.1.4.1.15490.2.6 NAME 'objStaff'
                DESC 'object class'
                SUP top STRUCTURAL
               MUST ( staffName $ staffID $ staffAddress $ staffQualification
                     $ staffDepartment $ staffBranch $ staffType) )

objectclass ( 1.3.6.1.4.1.15490.2.7 NAME 'objSalary'
                SUP top STRUCTURAL
                DESC 'object class'
                MUST ( salaryBASIC $ salaryDA $ salaryHRA $ salaryAllowance $
                        salaryTotal) )
objectclass ( 1.3.6.1.4.1.15490.2.8 NAME 'objAcademic'
                DESC 'object class'
                SUP top STRUCTURAL
                MUST ( academicYear ) ) &lt;/p&gt; &lt;h2&gt;Sample LDIF File&lt;/h2&gt; &lt;p&gt;This section gives sample ldif file for creating LDAP tree,&lt;/p&gt; &lt;p class="MsoPlainText"&gt;dn: o=college
o: college
objectclass: organization
objectclass: objCollege
objectclass: top
Description: top object class
collegeName: ABC Engineering college
collegePrincipal: John Peter
collegePresident: Samual A
collegeSecretary: Benson K
collegeBoardMember:    Jennifer King
collegeBoardMember:    George K Danial &lt;/p&gt; &lt;p class="MsoPlainText"&gt;dn: deptName=Civil,o=college
deptName: Civil
objectclass: objDepartment
objectclass: top
deptHead: abc &lt;/p&gt; &lt;p class="MsoPlainText"&gt;dn: deptName=Electronics,o=college
deptName: Civil
objectclass: objDepartment
objectclass: top
deptHead=defg &lt;/p&gt; &lt;p class="MsoPlainText"&gt;dn: branchName=ECE,deptName=Electronics,o=college
branchName: ECE
objectclass: top
objectclass: objBranch
branchHead: kkk
branchNumberOfStudents: 50 &lt;/p&gt; &lt;p class="MsoPlainText"&gt;dn: ou=student,branchName=ECE, deptName=Electronics,o=college
ou: student
objectclass: top
objectclass: organizationalUnit &lt;/p&gt; &lt;p class="MsoPlainText"&gt;dn: ou=staff,branchName=ECE, deptName=Electronics,o=college
ou: staff
objectclass: top
objectclass: organizationalUnit &lt;/p&gt; &lt;p class="MsoPlainText"&gt;dn: academicYear=1999-2000,ou=student,branchName=ECE,  deptName=Electronics,o=college
academicYear: 1999-2000
objectclass: top
objectclass: objAcademic &lt;/p&gt; &lt;p class="MsoPlainText"&gt;dn: academicYear=2000-2001,ou=student,branchName=ECE,  deptName=Electronics,o=college
academicYear: 2000-2001
objectclass: top
objectclass: objAcademic &lt;/p&gt; &lt;p class="MsoPlainText"&gt;dn: studentNumber=100,academicYear=1999-2000,ou=student,branchName=ECE,  deptName=Electronics,o=college
studentNumber: 100
objectclass: top
objectclass: objStudent
studentName: abc
studentAddress: abc
studentAcademicYear: 1999-2000
studentCourse: BS
studentStatus: Active
studentYear: 1999 &lt;/p&gt; &lt;p class="MsoPlainText"&gt;dn: studentNumber=101,academicYear=1999-2000,ou=student,branchName=ECE,  deptName=Electronics,o=college
studentNumber: 101
objectclass: top
objectclass: objStudent
studentName: def
studentAddress: def
studentAcademicYear: 1999-2000
studentCourse: BS
studentStatus: Active
studentYear: 1999 &lt;/p&gt; &lt;p class="MsoPlainText"&gt;dn: subjectCode=001,studentNumber=101,academicYear=1999-2000,ou=student,branchName=ECE,  deptName=Electronics,o=college
subjectCode: 001
objectclass: top
objectclass: objSubject
subjectName: Mathematics-1
subjectMarks: 90 &lt;/p&gt; &lt;p class="MsoPlainText"&gt;dn: subjectCode=002,studentNumber=101,academicYear=1999-2000,ou=student,branchName=ECE,  deptName=Electronics,o=college
subjectCode: 002
objectclass: top
objectclass: objSubject
subjectName: Electrical Technology
subjectMarks: 85 &lt;/p&gt; &lt;p class="MsoPlainText"&gt;dn: ou=teaching,ou=staff,branchName=ECE, deptName=Electronics,o=college
ou: teaching
objectclass: top
objectclass: organizationalUnit &lt;/p&gt; &lt;p class="MsoPlainText"&gt;dn: ou=nonteaching,ou=staff,branchName=ECE, deptName=Electronics,o=college
ou: nonteaching
objectclass: top
objectclass: organizationalUnit &lt;/p&gt; &lt;p class="MsoPlainText"&gt;dn: staffID=001,ou=teaching,ou=staff,branchName=ECE,  deptName=Electronics,o=college
staffID: 001
objectclass: top
objectclass: objStaff
staffName: abc&lt;/p&gt; &lt;p class="MsoPlainText"&gt;staffAddress: sdflasjflasd
staffQualification: MS, Phd
staffDepartment: Electronics
staffBranch: ECE
staffType: teaching &lt;/p&gt; &lt;p class="MsoPlainText"&gt;dn: staffID=002,ou=teaching,ou=staff,branchName=ECE,  deptName=Electronics,o=college
staffID: 002
objectclass: top
objectclass: objStaff
staffName: def
staffAddress: saas
staffQualification: MS, Phd
staffDepartment: Electronics
staffBranch: ECE
staffType: teaching &lt;/p&gt; &lt;p class="MsoPlainText"&gt;dn: staffID=101,ou=nonteaching,ou=staff,branchName=ECE,  deptName=Electronics,o=college
staffID: 101
objectclass: top
objectclass: objStaff
staffName: abc
staffAddress: sdflasjflasd
staffQualification: BS
staffDepartment: Electronics
staffBranch: ECE
staffType: nonteaching &lt;/p&gt; &lt;p class="MsoPlainText"&gt;dn: staffID=102,ou=nonteaching,ou=staff,branchName=ECE,  deptName=Electronics,o=college
staffID: 102
objectclass: top
objectclass: objStaff
staffName: def
staffAddress: saas
staffQualification: B.Com
staffDepartment: Electronics
staffBranch: ECE
staffType: nonteaching &lt;/p&gt; &lt;p class="MsoPlainText"&gt;dn: ou=Salary Details,staffID=002,ou=teaching,ou=staff,branchName=ECE,  deptName=Electronics,o=college
ou: Salary Details
objectclass: top
objectclass: objSalary
objectclass: organizationalUnit
salaryBasic: 10000
salaryDA: 20000
salaryHRA: 4000
salaryAllowance: 6000
salaryTotal: 40000 &lt;/p&gt; &lt;p class="MsoPlainText"&gt;dn: subjectCode=001,staffID=002,ou=teaching,ou=staff,branchName=ECE,  deptName=Electronics,o=college
subjectCode: 001
objectclass: top
objectclass: objSubject
subjectName: Electrinics-1
subjectMarks: 100 &lt;/p&gt; &lt;p class="MsoPlainText"&gt;dn: ou=Salary Details,staffID=102,ou=nonteaching,ou=staff,branchName=ECE,  deptName=Electronics,o=college
ou: Salary Details
objectclass: top
objectclass: objSalary
objectclass: organizatinalUnit
salaryBasic: 1000
salaryDA: 2000
salaryHRA: 400
salaryAllowance: 600
salaryTotal: 4000&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5937173170152272619-3893585226863525029?l=icehanger.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icehanger.blogspot.com/feeds/3893585226863525029/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5937173170152272619&amp;postID=3893585226863525029' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/3893585226863525029'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/3893585226863525029'/><link rel='alternate' type='text/html' href='http://icehanger.blogspot.com/2007/07/ldap-schema-design.html' title='LDAP SCHEMA DESIGN'/><author><name>iCehaNgeR's hAcK NoteS</name><uri>http://www.blogger.com/profile/03757838076375432274</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5937173170152272619.post-7101613284550296537</id><published>2007-07-24T08:03:00.000-07:00</published><updated>2008-12-08T21:42:54.524-08:00</updated><title type='text'>LDAP</title><content type='html'>Use ApacheDS server for the LDAP server.

Designing an LDAP application.

Install the  LDAP Server.

Install the LDAP client Browser.
The default Bind DN
uid=admin,ou=system
and password secret

Edit the password if needed.

Create the Root Suffix or the new Partion.

Objects
A directory service is an extension of a naming service. In a directory service, an object is also associated with a name. However, each object is allowed to have attributes. You can look up an object by its name; but you can also obtain the object's attributes or search for the object based on its attributes.

The object classes for all objects in the directory form a class hierarchy. The classes "top" and "alias" are at the root of the hierarchy. For example, the "organizationalPerson" object class is a subclass of the "Person" object class, which in turn is a subclass of "top". When creating a new LDAP entry, you must always specify all of the object classes to which the new entry belongs. Because many directories do not support object class subclassing, you also should always include all of the superclasses of the entry. For example, for an "organizationalPerson" object, you should list in its object classes the "organizationalPerson", "person", and "top" classes.



Add the Attributes.
An attribute of a directory object is a property of the object. For example, a person can have the following attributes: last name, first name, user name, email address, telephone number, and so on. A printer can have attributes like resolution, color, and speed.

An attribute has an identifier which is a unique name in that object. Each attribute can have one or more values. For instance, a person object can have an attribute called LastName. LastName is the identifier of an attribute. An attribute value is the content of the attribute. For example, the LastName attribute can have a value like "Martin".



Define the Tree.

Write the Search and browse application.



Reference

http://java.sun.com/products/jndi/tutorial/ldap/schema/object.html

First Steps in LDAP

I want to have a simple addressbook with telephonenumbers and email-addresses to be reached from every mail-client I use. The addressbook shall be built and modified automatically from a database which is the main datasource.

   * Structure
   * Preparing LDAP-server
   * Creating Organization Units
   * Create people in ou=people,dc=zirndorf,dc=de
   * Commands to delete and modify records
   * Query the LDAP-database from your mailprogram, how to configure


Structure

&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_76z2KKQ_T1Y/RqYW8YI6DNI/AAAAAAAAAqk/iU51LknIAYs/s1600-h/simple_structure.gif"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 481px; height: 689px;" src="http://4.bp.blogspot.com/_76z2KKQ_T1Y/RqYW8YI6DNI/AAAAAAAAAqk/iU51LknIAYs/s400/simple_structure.gif" alt="" id="BLOGGER_PHOTO_ID_5090781655316696274" border="0" /&gt;&lt;/a&gt;
Data must be structured for LDAP. Our internet-domain is zirndorf.de, so I use that. Under that there is a unit in which all the people are.

simple_structure.gif
Preparing LDAP-server

I use Debian-Linux for the LDAP-server and install this packages:slapd, ldap-utils. Take care that these files get installed in /etc/ldap/schema/:

   * core.schema 
   * cosine.schema 
   * inetorgperson.schema 
   * nis.schema

Now I have to modify the file /etc/ldap/sladp.conf:

     # Schema and objectClass definitions
     include /etc/ldap/schema/core.schema
     include /etc/ldap/schema/cosine.schema
     include /etc/ldap/schema/nis.schema
     include /etc/ldap/schema/inetorgperson.schema
     ...
     # The base of your directory
     suffix          "dc=zirndorf,dc=de"
     rootdn          "cn=admin,dc=zirndorf,dc=de"
     # this really means, that the password is "secret"
     rootpw          secret
     # you can create a crypted password like this: slappasswd -u
     # and get the crypted version on your terminal:
     # rootpw          {SSHA}8e8vfyo0KSWoLbyPVIPaG+MqH6h51Vst

The server should listen only to a special IP-address (slapd is running under vserver-Linux) so I have to start the server like this in the start scripts:

     /usr/sbin/slapd -h ldap://10.1.1.138:389/

Starting LDAP (and checking bind with "netstat -ln" if you like).
Creating Organization Units

Create a file ou_people.ldif like this:

     # file ou_people.ldif
     dn: ou=people,dc=zirndorf,dc=de
     ou: people
     objectClass: top
     objectClass: organizationalUnit

and import it into the database

     # ldapadd -a -x \
       -D "cn=admin,dc=zirndorf,dc=de" -w secret \
       -h ldap.zdf \
       -f /tmp/ou_people.ldif

Did the import work? You can dump your whole LDAP-server with this command to check it:

     # ldapsearch -x -b 'dc=zirndorf,dc=de' 'objectclass=*' -h ldap.zdf

     ...
     dn: ou=people,dc=zirndorf,dc=de
     ou: people
     objectClass: top
     objectClass: organizationalUnit
     ...

If you have more units like this create more line in ou_people.ldif, some copy the lines I gave you.
Create people in ou=people,dc=zirndorf,dc=de

First create a very simple file to import into LDAP. I did this with Perl from a centralized database where I have all the informations collected:

     # the unique name in the directory
     dn: cn=Roland Wende, ou=people, dc=zirndorf, dc=de
     ou: people
     # which schemas to use
     objectClass: top
     objectClass: person
     objectClass: organizationalPerson
     objectClass: inetOrgPerson
     # the data itself, name-data
     cn: Roland Wende
     gn: Roland
     sn: Wende
     # other data (could be more, but doesn't have to be more)
     mail: roland.wende@zirndorf.de
     telephoneNumber: 9600-190

Now let's create a person with more attributes:

     # the unique name in the directory
     dn: cn=Richard Lippmann,ou=people,dc=zirndorf,dc=de
     # which schema to use
     objectClass: top
     objectClass: person
     objectClass: organizationalPerson
     objectClass: inetOrgPerson
     cn: Richard Lippmann
     givenName: Richard
     sn: Lippmann
     # internet section
     mail: lippmann@zirndorf.de
     mail: horshack@lisa.franken.de
     # address section, private
     postalAddress: My Way 5
     postalCode: 90522
     l: Oberasbach
     # phone section
     homePhone: 0911 /123 456 789
     mobile: 0179 / 123 123 123

Commands to delete and modify records
To delete a record this you have to know the dn (unique record-identifier):

     # ldapdelete -x \
       -D "cn=admin,dc=zirndorf,dc=de" -w secret \
       -h ldap.zdf \
       'cn=Roland Wende,ou=People,dc=zirndorf,dc=de'

Recursively delete: ldapdelete -r ...
If you want to modify a record you have to modify it completely. ALL the attributes must be in your ldif-file!

     # ldapmodify -x \
       -D "cn=admin,dc=zirndorf,dc=de" -w secret \
       -h ldap.zdf \
       -f /tmp/ou_people.ldif

     

Query the LDAP-database from your mailprogram, how to configure

You have to know:

   * your LDAP-server's hostname (ldap.zdf)
   * your base-DSN (dc=zirndorf,dc=de)
   * Port (389 for cleartext)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5937173170152272619-7101613284550296537?l=icehanger.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icehanger.blogspot.com/feeds/7101613284550296537/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5937173170152272619&amp;postID=7101613284550296537' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/7101613284550296537'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/7101613284550296537'/><link rel='alternate' type='text/html' href='http://icehanger.blogspot.com/2007/07/ldap.html' title='LDAP'/><author><name>iCehaNgeR's hAcK NoteS</name><uri>http://www.blogger.com/profile/03757838076375432274</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_76z2KKQ_T1Y/RqYW8YI6DNI/AAAAAAAAAqk/iU51LknIAYs/s72-c/simple_structure.gif' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5937173170152272619.post-1136633420985774795</id><published>2007-07-23T13:40:00.000-07:00</published><updated>2007-07-23T13:41:27.487-07:00</updated><title type='text'>vi Set number and copy line between number</title><content type='html'>:set number


copy lines from address to destination.
    eg. :1,10co50      copy lines 1 to to 10 to below line 50&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5937173170152272619-1136633420985774795?l=icehanger.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icehanger.blogspot.com/feeds/1136633420985774795/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5937173170152272619&amp;postID=1136633420985774795' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/1136633420985774795'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/1136633420985774795'/><link rel='alternate' type='text/html' href='http://icehanger.blogspot.com/2007/07/vi-set-number-and-copy-line-between.html' title='vi Set number and copy line between number'/><author><name>iCehaNgeR's hAcK NoteS</name><uri>http://www.blogger.com/profile/03757838076375432274</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5937173170152272619.post-3726749287415863230</id><published>2007-07-23T13:25:00.000-07:00</published><updated>2007-07-23T13:42:13.470-07:00</updated><title type='text'>Monitor a log file in linux</title><content type='html'>tail -f /var/log/somelogfile.log

This will show the  last entry in the log file as updated.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5937173170152272619-3726749287415863230?l=icehanger.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icehanger.blogspot.com/feeds/3726749287415863230/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5937173170152272619&amp;postID=3726749287415863230' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/3726749287415863230'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/3726749287415863230'/><link rel='alternate' type='text/html' href='http://icehanger.blogspot.com/2007/07/monit-log-file-in-linux.html' title='Monitor a log file in linux'/><author><name>iCehaNgeR's hAcK NoteS</name><uri>http://www.blogger.com/profile/03757838076375432274</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5937173170152272619.post-8272392294140128231</id><published>2007-07-23T08:42:00.000-07:00</published><updated>2007-07-23T08:49:24.043-07:00</updated><title type='text'>Extracting gz file</title><content type='html'>tar xvfz filename.tar.gz&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5937173170152272619-8272392294140128231?l=icehanger.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icehanger.blogspot.com/feeds/8272392294140128231/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5937173170152272619&amp;postID=8272392294140128231' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/8272392294140128231'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/8272392294140128231'/><link rel='alternate' type='text/html' href='http://icehanger.blogspot.com/2007/07/extracting-gz-file.html' title='Extracting gz file'/><author><name>iCehaNgeR's hAcK NoteS</name><uri>http://www.blogger.com/profile/03757838076375432274</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5937173170152272619.post-4616258174983114618</id><published>2007-07-19T07:38:00.000-07:00</published><updated>2007-07-27T07:43:00.577-07:00</updated><title type='text'>Linux Networking</title><content type='html'>Network not connecting using wired network (lo)

When you switch between the networks like home to office. The dns setting remains unchanged sometimes and this makes the network not to connect.

Change the dns setting by

./network-admin

go to the dns setting and under the search domain add the dns of the ISP(parent network)

then  issue the ./etc/init.d/networking restart.

give a ping to google.com. If the packet are not lost you are good to go.

There is another way you can prepend the new domain name in the /etc/dhcp3/dhcpclient.con file.

open vi
/s prepend

and add the new dhcp domain name there .example  "mydomain.com,";

This will make new domain available during each network startup&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5937173170152272619-4616258174983114618?l=icehanger.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icehanger.blogspot.com/feeds/4616258174983114618/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5937173170152272619&amp;postID=4616258174983114618' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/4616258174983114618'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/4616258174983114618'/><link rel='alternate' type='text/html' href='http://icehanger.blogspot.com/2007/07/linux-networking.html' title='Linux Networking'/><author><name>iCehaNgeR's hAcK NoteS</name><uri>http://www.blogger.com/profile/03757838076375432274</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5937173170152272619.post-1890286652547894221</id><published>2007-06-18T16:29:00.000-07:00</published><updated>2007-06-18T16:31:22.894-07:00</updated><title type='text'>JSR 168  Portlet life cycle</title><content type='html'>&lt;span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;font-family:Verdana;font-size:13;"  &gt;&lt;h4&gt;Portlet life cycle&lt;/h4&gt;&lt;p&gt;The basic portlet life cycle of a JSR 168 portlet is:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;strong&gt;Init:&lt;/strong&gt; initialize the portlet and put the portlet into service                         &lt;/li&gt;&lt;li&gt;&lt;strong&gt;Handle requests:&lt;/strong&gt; process different kinds of action- and render-requests                         &lt;/li&gt;&lt;li&gt;&lt;strong&gt;Destroy:&lt;/strong&gt; put portlet out of service                         &lt;/li&gt;&lt;/ul&gt;

&lt;p&gt;The portlet container manages the portlet life cycle and calls the corresponding methods on the portlet interface.&lt;/p&gt;&lt;h4&gt;Portlet interface&lt;/h4&gt;&lt;p&gt;Every portlet must implement the portlet interface, or extend a class that implements the portlet interface. The portlet interface                         consists of the following methods:                      &lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;code&gt;&lt;strong&gt;init(PortletConfig config)&lt;/strong&gt;:&lt;/code&gt; to initialize the portlet. This method is called only once after instantiating the portlet. This method can be used to create                            expensive objects/resources used by the portlet.                         &lt;/li&gt;&lt;li&gt;&lt;code&gt;&lt;strong&gt;processAction(ActionRequest request, ActionResponse response)&lt;/strong&gt;:&lt;/code&gt; to notify the portlet that the user has triggered an action on this portlet. Only one action per client request is triggered.                            In an action, a portlet can issue a redirect, change its portlet mode or window state, modify its persistent state, or set                            render parameters.                         &lt;/li&gt;&lt;li&gt;&lt;code&gt;&lt;strong&gt;render(RenderRequest request, RenderResponse response)&lt;/strong&gt;:&lt;/code&gt; to generate the markup. For each portlet on the current page, the render method is called, and the portlet can produce markup                            that may depend on the portlet mode or window state, render parameters, request attributes, persistent state, session data,                            or backend data.                         &lt;/li&gt;&lt;li&gt;&lt;code&gt;&lt;strong&gt;destroy()&lt;/strong&gt;:&lt;/code&gt; to indicate to the portlet the life cycle's end. This method allows the portlet to free up resources and update any persistent                            data that belongs to this portlet.&lt;/li&gt;&lt;/ul&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Verdana; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"&gt;&lt;h4&gt;Portlet modes&lt;/h4&gt;&lt;p&gt;A portlet mode indicates the function a portlet performs. Usually, portlets execute different tasks and create different content                         depending on the functions they currently perform. A portlet mode advises the portlet what task it should perform and what                         content it should generate. When invoking a portlet, the portlet container provides the current portlet mode to the portlet.                         Portlets can programmatically change their mode when processing an action request.                      &lt;/p&gt;&lt;p&gt;JSR 168 splits portlet modes into three categories:&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;strong&gt;Required modes:&lt;/strong&gt; Every portal must support the modes Edit, Help, and View. A portlet must at least support the View mode used to render markup                            for a page. The Edit mode is used to change per-user settings to customize the portlet markup, and the Help mode is used to                            show a help screen.                         &lt;/li&gt;&lt;li&gt;&lt;strong&gt;Optional custom modes:&lt;/strong&gt; These are modes that a portal may support; while in an optional mode, a portlet might not be called. The optional modes include                            the About mode to display an "about" message; the Config mode to let administrators configure the portlet; Edit_defaults mode                            to let an administrator preset the Edit mode's values; the Preview mode to show the portlet's preview; and the Print mode                            to render a view that can easily print.                         &lt;/li&gt;&lt;li&gt;&lt;strong&gt;Portal vendor-specific modes:&lt;/strong&gt; These modes are not defined in the specification and are therefore vendor specific.                         &lt;/li&gt;&lt;/ol&gt;

&lt;h4&gt;Window states&lt;/h4&gt;&lt;p&gt;A window state indicates the amount of portal page space that will be assigned to the content generated by a portlet. When                         invoking a portlet, the portlet container provides the current window state to the portlet. The portlet may use the window                         state to decide how much information it should render. Portlets can programmatically change their window state when processing                         an action request.                      &lt;/p&gt;&lt;p&gt;JSR 168 defines the following window states:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;strong&gt;Normal:&lt;/strong&gt; Indicates that a portlet may share the page with other portlets. This is the default window state.                         &lt;/li&gt;&lt;li&gt;&lt;strong&gt;Maximized:&lt;/strong&gt; Indicates that a portlet may be the only portlet on the portal page or that the portlet has more space compared to other                            portlets in the portal page, and can therefore produce richer content than in a normal window state.                         &lt;/li&gt;&lt;li&gt;&lt;strong&gt;Minimized:&lt;/strong&gt; Indicates that the portlet should only render minimal output or no output at all.                         &lt;/li&gt;&lt;/ul&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5937173170152272619-1890286652547894221?l=icehanger.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icehanger.blogspot.com/feeds/1890286652547894221/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5937173170152272619&amp;postID=1890286652547894221' title='13 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/1890286652547894221'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/1890286652547894221'/><link rel='alternate' type='text/html' href='http://icehanger.blogspot.com/2007/06/jsr-168-portlet-life-cycle.html' title='JSR 168  Portlet life cycle'/><author><name>iCehaNgeR's hAcK NoteS</name><uri>http://www.blogger.com/profile/03757838076375432274</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>13</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5937173170152272619.post-1061563166304137064</id><published>2007-06-08T14:19:00.001-07:00</published><updated>2007-06-22T07:01:42.252-07:00</updated><title type='text'>Spring Hibernate FAQ</title><content type='html'>&lt;table dir="ltr" border="0" cellpadding="0" cellspacing="0" width="100%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td valign="top" width="24"&gt;
&lt;/td&gt;&lt;!--msnavigation--&gt;&lt;td valign="top"&gt;  &lt;p&gt;Q. Explain DI or IOC pattern.
A:  Dependency injection (DI) is a programming design pattern and architectural  model, sometimes also referred to as inversion of control or IOC, although  technically speaking, dependency injection specifically refers to an  implementation of a particular form of IOC. Dependancy Injection describes the  situation where one object uses a second object to provide a particular  capacity. For example, being passed a database connection as an argument to the  constructor instead of creating one internally. The term "Dependency injection"  is a misnomer, since it is not a dependency that is injected, rather it is a  provider of some capability or resource that is injected. There are three common  forms of dependency injection: setter-, constructor- and interface-based  injection. Dependency injection is a way to achieve loose coupling. Inversion of  control (IOC) relates to the way in which an object obtains references to its  dependencies. This is often done by a lookup method. The advantage of inversion  of control is that it decouples objects from specific lookup mechanisms and  implementations of the objects it depends on. As a result, more flexibility is  obtained for production applications as well as for testing.

Q. What are the different IOC containers available?
A. Spring is an IOC container. Other IOC containers are HiveMind, Avalon,  PicoContainer.

Q. What are the different types of dependency injection. Explain with examples.
A: There are two types of dependency injection: setter injection and constructor  injection.
&lt;u&gt;Setter Injection&lt;/u&gt;:  Normally in all the java beans, we will use setter and  getter method to set and get the value of property as follows:
&lt;/p&gt; &lt;div style="margin-left: 40px;"&gt;       public class namebean {
      String      name; 
      public void setName(String a) {
         name = a; }
      public String getName() {
         return name; }
     }
&lt;/div&gt; &lt;div style="margin-left: 40px;"&gt;   We will create an instance of the bean 'namebean' (say bean1) and set property    as bean1.setName("tom"); Here in setter injection, we will set the property    'name'  in spring configuration file as showm below:
 &lt;bean id="bean1" class="namebean"&gt;
    &lt;property name="name"&gt;
        &lt;value&gt;tom&lt;/value&gt;
    &lt;/property&gt;
 &lt;/bean&gt;
 The subelement &lt;value&gt; sets the 'name' property by calling the set method as    setName("tom"); This process is called setter injection.
 To set properties that reference other beans &lt;ref&gt;, subelement of &lt;property&gt;    is used as shown below,
  &lt;bean id="bean1" class="bean1impl"&gt;
    &lt;property name="game"&gt;
        &lt;ref bean="bean2"&gt;
    &lt;/ref&gt;
 &lt;/property&gt;
 &lt;bean id="bean2" class="bean2impl"&gt;
&lt;/bean&gt;&lt;/bean&gt;&lt;/property&gt;&lt;/ref&gt;&lt;/value&gt;&lt;/div&gt; &lt;p&gt;&lt;u&gt;Constructor injection&lt;/u&gt;:  For constructor injection, we use constructor  with parameters as shown below,
&lt;/p&gt; &lt;div style="margin-left: 40px;"&gt;    public class namebean {
      String name;
      public namebean(String a) {
         name = a;
      }  
 }
&lt;/div&gt; &lt;div style="margin-left: 40px;"&gt;   We will set the property 'name' while creating an instance of the bean 'namebean'    as namebean bean1 = new namebean("tom");
&lt;/div&gt; &lt;div style="margin-left: 40px;"&gt;   Here we use the &lt;constructor-arg&gt; element to set the the property by    constructor injection as
  &lt;bean id="bean1" class="namebean"&gt;
     &lt;constructor-arg&gt;
        &lt;value&gt;My Bean Value&lt;/value&gt;
    &lt;/constructor-arg&gt;
 &lt;/bean&gt;
&lt;/constructor-arg&gt;&lt;/div&gt; &lt;p&gt;
Q. What is spring? What are the various parts of spring framework? What are the  different persistence frameworks which could be used with spring?
A. Spring is an open source framework created to address the complexity of  enterprise application development. One of the chief advantages of the Spring  framework is its layered architecture, which allows you to be selective about  which of its components you use while also providing a cohesive framework for  J2EE application development. The Spring modules are built on top of the core  container, which defines how beans are created, configured, and managed, as  shown in the following figure. Each of the modules (or components) that comprise  the Spring framework can stand on its own or be implemented jointly with one or  more of the others. The functionality of each component is as follows:

&lt;u&gt;The core container&lt;/u&gt;: The core container provides the essential  functionality of the Spring framework. A primary component of the core container  is the BeanFactory, an implementation of the Factory pattern. The BeanFactory  applies the Inversion of Control (IOC) pattern to separate an application’s  configuration and dependency specification from the actual application code.

&lt;u&gt;Spring context&lt;/u&gt;: The Spring context is a configuration file that provides  context information to the Spring framework. The Spring context includes  enterprise services such as JNDI, EJB, e-mail, internalization, validation, and  scheduling functionality.

&lt;u&gt;Spring AOP&lt;/u&gt;: The Spring AOP module integrates aspect-oriented programming  functionality directly into the Spring framework, through its configuration  management feature. As a result you can easily AOP-enable any object managed by  the Spring framework. The Spring AOP module provides transaction management  services for objects in any Spring-based application. With Spring AOP you can  incorporate declarative transaction management into your applications without  relying on EJB components.

&lt;u&gt;Spring DAO&lt;/u&gt;: The Spring JDBC DAO abstraction layer offers a meaningful  exception hierarchy for managing the exception handling and error messages  thrown by different database vendors. The exception hierarchy simplifies error  handling and greatly reduces the amount of exception code you need to write,  such as opening and closing connections. Spring DAO’s JDBC-oriented exceptions  comply to its generic DAO exception hierarchy.

&lt;u&gt;Spring ORM&lt;/u&gt;: The Spring framework plugs into several ORM frameworks to  provide its Object Relational tool, including JDO, Hibernate, and iBatis SQL  Maps. All of these comply to Spring’s generic transaction and DAO exception  hierarchies.

&lt;u&gt;Spring Web module&lt;/u&gt;: The Web context module builds on top of the  application context module, providing contexts for Web-based applications. As a  result, the Spring framework supports integration with Jakarta Struts. The Web  module also eases the tasks of handling multi-part requests and binding request  parameters to domain objects.

&lt;u&gt;Spring MVC framework&lt;/u&gt;: The Model-View-Controller (MVC) framework is a  full-featured MVC implementation for building Web applications. The MVC  framework is highly configurable via strategy interfaces and accommodates  numerous view technologies including JSP, Velocity, Tiles, iText, and POI.

Q. What is AOP? How does it relate with IOC? What are different tools to utilize  AOP?
A:  Aspect-oriented programming, or AOP, is a programming technique that allows  programmers to modularize crosscutting concerns, or behavior that cuts across  the typical divisions of responsibility, such as logging and transaction  management. The core construct of AOP is the aspect, which encapsulates  behaviors affecting multiple classes into reusable modules. AOP and IOC are  complementary technologies in that both apply a modular approach to complex  problems in enterprise application development. In a typical object-oriented  development approach you might implement logging functionality by putting logger  statements in all your methods and Java classes. In an AOP approach you would  instead modularize the logging services and apply them declaratively to the  components that required logging. The advantage, of course, is that the Java  class doesn't need to know about the existence of the logging service or concern  itself with any related code. As a result, application code written using Spring  AOP is loosely coupled. The best tool to utilize AOP to its capability is  AspectJ. However AspectJ works at he byte code level and you need to use AspectJ  compiler to get the aop features built into your compiled code. Nevertheless AOP  functionality is fully integrated into the Spring context for transaction  management, logging, and various other features.  In general any AOP framework  control aspects in three possible ways:
&lt;/p&gt; &lt;div style="margin-left: 40px;"&gt;   &lt;u&gt;Joinpoints&lt;/u&gt;: Points in a program's execution. For example, joinpoints    could define calls to specific methods in a class
 &lt;u&gt;Pointcuts&lt;/u&gt;: Program constructs to designate joinpoints and collect    specific context at those points
 &lt;u&gt;Advices&lt;/u&gt;: Code that runs upon meeting certain conditions. For example,    an advice could log a message before executing a joinpoint
&lt;/div&gt; &lt;p&gt;Q. What are the advantages of spring framework?
A.  &lt;/p&gt; &lt;ol&gt;&lt;li&gt;Spring has layed architecture. Use what you need and leave you don't need    now.&lt;/li&gt;&lt;li&gt;Spring Enables POJO Programming. There is no behind the scene magic here. POJO    programming enables continous integration and testability.&lt;/li&gt;&lt;li&gt;Dependency Injection and Inversion of Control Simplifies JDBC (Read the    first question.)&lt;/li&gt;&lt;li&gt;Open source and no vendor lock-in.&lt;/li&gt;&lt;/ol&gt;    &lt;p&gt;Q. Can you name a tool which could provide the initial ant files and directory  structure for a new spring project.
A: Appfuse or equinox.

Q. Explain BeanFactory in spring.
A: Bean factory is an implementation of the factory design pattern and its  function is to create and dispense beans. As the bean factory knows about many  objects within an application, it is able to create association between  collaborating objects as they are instantiated. This removes the burden of  configuration from the bean and the client. There are several implementation of  BeanFactory. The most useful one is "org.springframework.beans.factory.xml.XmlBeanFactory"  It loads its beans based on the definition contained in an XML file. To create  an XmlBeanFactory, pass a InputStream to the constructor. The resource will  provide the XML to the factory. BeanFactory  factory = new XmlBeanFactory(new  FileInputStream("myBean.xml"));
This line tells the bean factory to read the bean definition from the XML file.  The bean definition includes the description of beans and their properties. But  the bean factory doesn't instantiate the bean yet. To retrieve a bean from a 'BeanFactory',  the getBean() method is called. When getBean() method is called, factory will  instantiate the bean and begin setting the bean's properties using dependency  injection. myBean bean1 = (myBean)factory.getBean("myBean");

Q. Explain the role of ApplicationContext in spring.
A. While Bean Factory is used for simple applications, the Application Context  is spring's more advanced container. Like 'BeanFactory' it can be used to load  bean definitions, wire beans together and dispense beans upon request. It also  provide
&lt;/p&gt;  &lt;div style="margin-left: 40px;"&gt;   1) a means for resolving text messages, including support for    internationalization.
 2) a generic way to load file resources.
 3) events to beans that are registered as listeners.
&lt;/div&gt; &lt;p&gt;Because of additional functionality, 'Application Context' is preferred over  a BeanFactory. Only when the resource is scarce like mobile devices, 'BeanFactory'  is used. The three commonly used implementation of 'Application Context' are
&lt;/p&gt; &lt;div style="margin-left: 40px;"&gt;   1. &lt;u&gt;ClassPathXmlApplicationContext&lt;/u&gt; : It Loads  context definition from an XML    file located in the classpath, treating context definitions as classpath    resources. The application context is loaded from the application's classpath    by using the code
 ApplicationContext    context = new ClassPathXmlApplicationContext("bean.xml"); 
 2. &lt;u&gt;FileSystemXmlApplicationContext&lt;/u&gt; : It loads context definition from an XML    file in the filesystem. The application context is loaded from the file system    by using the code
 ApplicationContext    context = new FileSystemXmlApplicationContext("bean.xml"); 
 3. &lt;u&gt;XmlWebApplicationContext&lt;/u&gt; : It loads context definition from an XML file    contained within a web application.
&lt;/div&gt; &lt;p&gt;Q. How does Spring supports DAO in hibernate?
A. Spring’s HibernateDaoSupport class is a convenient super class for Hibernate  DAOs. It has handy methods you can call to get a Hibernate Session, or a  SessionFactory. The most convenient method is getHibernateTemplate(), which  returns a HibernateTemplate. This template wraps Hibernate checked exceptions  with runtime exceptions, allowing your DAO interfaces to be Hibernate  exception-free.
Example:
&lt;/p&gt; &lt;div style="margin-left: 40px;"&gt;   public class UserDAOHibernate extends HibernateDaoSupport {
&lt;/div&gt; &lt;div style="margin-left: 80px;"&gt;   public User getUser(Long id) {
 return (User) getHibernateTemplate().get(User.class, id);
 }
 public void saveUser(User user) {
 getHibernateTemplate().saveOrUpdate(user);
 if (log.isDebugEnabled()) {
 log.debug(“userId set to: “ + user.getID());
 }
 }
 public void removeUser(Long id) {
 Object user = getHibernateTemplate().load(User.class, id);
 getHibernateTemplate().delete(user);
 }
&lt;/div&gt; &lt;div style="margin-left: 40px;"&gt;   }
&lt;/div&gt; &lt;p&gt;
Q. What are the id generator classes in hibernate?
A:  increment: It generates identifiers of type long, short or int that are  unique only when no other process is inserting data into the same table. It  should not the used in the clustered environment.
&lt;u&gt;identity&lt;/u&gt;: It supports identity columns in DB2, MySQL, MS SQL Server, Sybase and HypersonicSQL. The returned identifier is of type long, short or int.
&lt;u&gt;sequence&lt;/u&gt;: The sequence generator uses a sequence in DB2, PostgreSQL, Oracle, SAP  DB, McKoi or a generator in Interbase. The returned identifier is of type long,  short or int
&lt;u&gt;hilo&lt;/u&gt;: The hilo generator uses a hi/lo algorithm to efficiently generate  identifiers of type long, short or int, given a table and column (by default  hibernate_unique_key and next_hi respectively) as a source of hi values. The  hi/lo algorithm generates identifiers that are unique only for a particular  database. Do not use this generator with connections enlisted with JTA or with a  user-supplied connection.
&lt;u&gt;seqhilo&lt;/u&gt;: The seqhilo generator uses a hi/lo algorithm to efficiently generate  identifiers of type long, short or int, given a named database sequence.
&lt;u&gt;uuid&lt;/u&gt;: The uuid generator uses a 128-bit UUID algorithm to generate identifiers  of type string, unique within a network (the IP address is used). The UUID is  encoded as a string of hexadecimal digits of length 32.
&lt;u&gt;guid&lt;/u&gt;: It uses a database-generated GUID string on MS SQL Server and MySQL.
native: It picks identity, sequence or hilo depending upon the capabilities of  the underlying database.
&lt;u&gt;assigned&lt;/u&gt;: lets the application to assign an identifier to the object before  save() is called. This is the default strategy if no &lt;generator&gt; element is  specified.
&lt;u&gt;select&lt;/u&gt;: retrieves a primary key assigned by a database trigger by selecting the  row by some unique key and retrieving the primary key value.
&lt;u&gt;foreign&lt;/u&gt;: uses the identifier of another associated object. Usually used in  conjunction with a &lt;one-to-one&gt; primary key association.

Q. How is a typical spring implementation look like?
A. For a typical Spring Application we need the following files
&lt;/one-to-one&gt;&lt;/generator&gt;&lt;/p&gt; &lt;div style="margin-left: 40px;"&gt;   1. An interface that defines the functions.
 2. An Implementation that contains properties, its setter and getter methods,    functions etc.,
 3. A XML file called Spring configuration file.
 4. Client program that uses the function.

&lt;/div&gt; &lt;p&gt;Q. How do you define hibernate mapping file in spring?
A. Add the hibernate mapping file entry in mapping resource inside Spring’s  applicationContext.xml file in the web/WEB-INF directory.
&lt;/p&gt; &lt;div style="margin-left: 40px;"&gt;   &lt;property name="mappingResources"&gt;
     &lt;list&gt;
         &lt;value&gt;org/appfuse/model/User.hbm.xml&lt;/value&gt;
     &lt;/list&gt;
 &lt;/property&gt;
&lt;/div&gt; &lt;p&gt;
Q. How do you configure spring in a web application?
A. It is very easy to configure any J2EE-based web application to use Spring. At  the very least, you can simply add Spring’s ContextLoaderListener to your  web.xml file:
&lt;/p&gt; &lt;div style="margin-left: 40px;"&gt;   &lt;listener&gt;
     &lt;listener-class&gt;org.springframework.web.context.ContextLoaderListener&lt;/listener-class&gt;
 &lt;/listener&gt;

&lt;/div&gt; &lt;p&gt;Q. Can you have xyz.xml file instead of applicationcontext.xml?
A. ContextLoaderListener is a ServletContextListener that initializes when your  webapp starts up. By default, it looks for Spring’s configuration file at  WEB-INF/applicationContext.xml. You can change this default value by specifying  a &lt;context-param&gt; element named “contextConfigLocation.” Example:
&lt;/context-param&gt;&lt;/p&gt; &lt;div style="margin-left: 40px;"&gt;   &lt;listener&gt;
     &lt;listener-class&gt;org.springframework.web.context.ContextLoaderListener
&lt;/listener-class&gt;&lt;/listener&gt;&lt;/div&gt; &lt;div style="margin-left: 80px;"&gt;       &lt;context-param&gt;
         &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;
         &lt;param-value&gt;/WEB-INF/xyz.xml&lt;/param-value&gt;
     &lt;/context-param&gt;
&lt;/div&gt; &lt;div style="margin-left: 40px;"&gt;      

&lt;/div&gt; &lt;div style="margin-left: 40px;"&gt; 
&lt;/div&gt; &lt;p&gt;Q. How do you configure your database driver in spring?
A. Using datasource "org.springframework.jdbc.datasource.DriverManagerDataSource".  Example:
&lt;/p&gt; &lt;div style="margin-left: 40px;"&gt;   &lt;bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"&gt;
     &lt;property name="driverClassName"&gt;
         &lt;value&gt;org.hsqldb.jdbcDriver&lt;/value&gt;
     &lt;/property&gt;
     &lt;property name="url"&gt;
         &lt;value&gt;jdbc:hsqldb:db/appfuse&lt;/value&gt;
     &lt;/property&gt;
     &lt;property name="username"&gt;&lt;value&gt;sa&lt;/value&gt;&lt;/property&gt;
     &lt;property name="password"&gt;&lt;value&gt;&lt;/value&gt;&lt;/property&gt;
 &lt;/bean&gt;
&lt;/div&gt; &lt;p&gt;
Q. How can you configure JNDI instead of datasource in spring  applicationcontext.xml?
A. Using "org.springframework.jndi.JndiObjectFactoryBean". Example:
&lt;/p&gt; &lt;div style="margin-left: 40px;"&gt;   &lt;bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean"&gt;
     &lt;property name="jndiName"&gt;
         &lt;value&gt;java:comp/env/jdbc/appfuse&lt;/value&gt;
     &lt;/property&gt;
 &lt;/bean&gt;

&lt;/div&gt; &lt;p&gt;Q. What are the key benifits of Hibernate?
A:  These are the key benifits of Hibernate: &lt;/p&gt; &lt;ul&gt;&lt;li&gt;Transparent persistence based on POJOs without byte code processing &lt;/li&gt;&lt;li&gt;Powerful object-oriented hibernate query language&lt;/li&gt;&lt;li&gt;Descriptive O/R Mapping through mapping file.&lt;/li&gt;&lt;li&gt;Automatic primary key generation &lt;/li&gt;&lt;li&gt;Hibernate cache : Session Level, Query and Second level cache.&lt;/li&gt;&lt;li&gt;Performance: Lazy initialization, Outer join fetching, Batch fetching&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;Q. What is hibernate session and session factory? How do you configure  sessionfactory in spring configuration file?
A. Hibernate Session is the main runtime interface between a Java application  and Hibernate. SessionFactory allows applications to create hibernate session by  reading hibernate configurations file hibernate.cfg.xml.
&lt;/p&gt; &lt;div style="margin-left: 40px;"&gt;   // Initialize the Hibernate environment
 Configuration cfg = new Configuration().configure();
 // Create the session factory
 SessionFactory factory = cfg.buildSessionFactory();
 // Obtain the new session object
 Session session = factory.openSession();
&lt;/div&gt; &lt;p&gt;The call to Configuration().configure() loads the hibernate.cfg.xml  configuration file and initializes the Hibernate environment. Once the  configuration is initialized, you can make any additional modifications you  desire programmatically. However, you must make these modifications prior to  creating the SessionFactory instance. An instance of SessionFactory is typically  created once and used to create all sessions related to a given context.
The main function of the Session is to offer create, read and delete operations  for instances of mapped entity classes. Instances may exist in one of three  states:
&lt;/p&gt; &lt;div style="margin-left: 40px;"&gt;   &lt;u&gt;transient&lt;/u&gt;: never persistent, not associated with any Session
 &lt;u&gt;persistent&lt;/u&gt;: associated with a unique Session
 &lt;u&gt;detached&lt;/u&gt;: previously persistent, not associated with any Session
&lt;/div&gt; &lt;p&gt;A Hibernate Session object represents a single unit-of-work for a given data  store and is opened by a SessionFactory instance. You must close Sessions when  all work for a transaction is completed. The following illustrates a typical  Hibernate session:
Session session = null;
UserInfo user = null;
Transaction tx = null;
try {
  session = factory.openSession();
  tx = session.beginTransaction();
  user = (UserInfo)session.load(UserInfo.class, id);
  tx.commit();
} catch(Exception e) {
  if (tx != null) {
     try {
        tx.rollback();
     } catch (HibernateException e1) {
        throw new DAOException(e1.toString()); }
  } throw new DAOException(e.toString());
} finally {
  if (session != null) {
     try {
        session.close();
     } catch (HibernateException e) { }
  }
}

Q. What is the difference between hibernate get and load methods?
A. The load() method is older; get() was added to Hibernate’s API due to user  request. The difference is trivial:
The following Hibernate code snippet retrieves a User object from the database:   User user = (User) session.get(User.class, userID);
The get() method is special because the identifier uniquely identifies a single  instance of a class. Hence it’s common for applications to use the identifier as  a convenient handle to a persistent object. Retrieval by identifier can use the  cache when retrieving an object, avoiding a database hit if the object is  already cached.
Hibernate also provides a load() method:  User user = (User)  session.load(User.class, userID);
If load() can’t find the object in the cache or database, an exception is  thrown. The load() method never returns null. The get() method returns
null if the object can’t be found. The load() method may return a proxy instead  of a real persistent instance. A proxy is a placeholder instance of a  runtime-generated subclass (through cglib or Javassist) of a mapped persistent  class, it can initialize itself if any method is called that is not the mapped  database identifier getter-method. On the other hand, get() never returns a  proxy. Choosing between get() and load() is easy: If you’re certain the  persistent object exists, and nonexistence would be considered exceptional,  load() is a good option. If you aren’t certain there is a persistent instance  with the given
identifier, use get() and test the return value to see if it’s null. Using  load() has a further implication: The application may retrieve a valid reference  (a proxy) to a
persistent instance without hitting the database to retrieve its persistent  state. So load() might not throw an exception when it doesn’t find the  persistent object
in the cache or database; the exception would be thrown later, when the proxy is  accessed.

Q. What type of transaction management is supported in hibernate?
A. Hibernate communicates with the database via a JDBC Connection; hence it must  support both managed and non-managed transactions.
   &lt;u&gt;non-managed in web containers&lt;/u&gt;:
&lt;/p&gt; &lt;div style="margin-left: 40px;"&gt;   &lt;bean id="transactionManager" class="org.springframework.orm.hibernate.HibernateTransactionManager"&gt;
     &lt;property name="sessionFactory"&gt;
         &lt;ref local="sessionFactory"&gt;
     &lt;/ref&gt;
 &lt;/property&gt;
&lt;/bean&gt;&lt;/div&gt; &lt;p&gt;    &lt;u&gt;managed in application server using JTA&lt;/u&gt;:
&lt;/p&gt; &lt;div style="margin-left: 40px;"&gt;   &lt;bean id="transactionManager" class="org.springframework.transaction.jta.JtaTransactionManager."&gt;
     &lt;property name="sessionFactory"&gt;
         &lt;ref local="sessionFactory"&gt;
     &lt;/ref&gt;
 &lt;/property&gt;
&lt;/bean&gt;&lt;/div&gt; &lt;p&gt;
Q. What is lazy loading and how do you achieve that in hibernate?
A. Lazy setting decides whether to load child objects while loading the Parent  Object. You need to specify parent class.Lazy = true in hibernate mapping file.  By default the lazy loading of the child objects is true. This make sure that  the child objects are not loaded unless they are explicitly invoked in the  application by calling getChild() method on parent. In this case hibernate  issues a fresh database call to load the child when getChild() is actully called  on the Parent object. But in some cases you do need to load the child objects  when parent is loaded. Just make the lazy=false and hibernate will load the  child when parent is loaded from the database. Examples: Address child of User  class can be made lazy if it is not required frequently. But you may need to  load the Author object for Book parent whenever you deal with the book for  online bookshop.
Hibernate does not support lazy initialization for detached objects. Access to a  lazy association outside of the context of an open Hibernate session will result  in an exception.

Q. What are the different fetching strategy in Hibernate?
A. Hibernate3 defines the following fetching strategies:
&lt;/p&gt; &lt;div style="margin-left: 40px;"&gt;   &lt;u&gt;Join fetching&lt;/u&gt; - Hibernate retrieves the associated instance or collection in    the same SELECT, using an OUTER JOIN.
 Select fetching - a second SELECT is used to retrieve the associated entity or    collection. Unless you explicitly disable lazy fetching by specifying    lazy="false", this second select will only be executed when you actually    access the association.
 &lt;u&gt;Subselect fetching&lt;/u&gt; - a second SELECT is used to retrieve the associated    collections for all entities retrieved in a previous query or fetch. Unless    you explicitly disable &lt;u&gt;lazy fetching&lt;/u&gt; by specifying lazy="false", this second    select will only be executed when you actually access the association.Batch    fetching - an optimization strategy for select fetching - Hibernate retrieves    a batch of entity instances or collections in a single SELECT, by specifying a    list of primary keys or foreign keys.
 For more details read short primer on fetching strategy at   &lt;a href="http://www.hibernate.org/315.html" target="_blank"&gt;   http://www.hibernate.org/315.html&lt;/a&gt;
&lt;/div&gt; &lt;p&gt;Q. What are different types of cache hibernate supports ?
A. Caching is widely used for optimizing database applications. Hibernate uses  two different caches for objects: &lt;u&gt;first-level cache&lt;/u&gt; and &lt;u&gt;second-level cache&lt;/u&gt;.  First-level cache is associated with the Session object, while second-level  cache is associated with the Session Factory object. By default, Hibernate uses  first-level cache on a per-transaction basis. Hibernate uses this cache mainly  to reduce the number of SQL queries it needs to generate within a given  transaction. For example, if an object is modified several times within the same  transaction, Hibernate will generate only one SQL UPDATE statement at the end of  the transaction, containing all the modifications. To reduce database traffic,  second-level cache keeps loaded objects at the Session Factory level between  transactions. These objects are available to the whole application, not just to  the user running the query. This way, each time a query returns an object that  is already loaded in the cache, one or more database transactions potentially  are avoided. In addition, you can use a &lt;u&gt;query-level cache&lt;/u&gt; if you need to cache  actual query results, rather than just persistent objects. The query cache  should always be used in conjunction with the second-level cache. Hibernate  supports the following open-source cache implementations out-of-the-box:
&lt;/p&gt; &lt;ul&gt;&lt;li&gt;&lt;a href="http://ehcache.sourceforge.net/" target="new"&gt;EHCache&lt;/a&gt; is a    fast, lightweight, and easy-to-use in-process cache. It supports read-only and    read/write caching, and memory- and disk-based caching. However, it does not    support clustering. &lt;/li&gt;&lt;li&gt;&lt;a href="http://www.opensymphony.com/oscache/" target="new"&gt;OSCache&lt;/a&gt; is    another open-source caching solution. It is part of a larger package, which    also provides caching functionalities for JSP pages or arbitrary objects. It    is a powerful and flexible package, which, like EHCache, supports read-only    and read/write caching, and memory- and disk-based caching. It also provides    basic support for clustering via either JavaGroups or JMS. &lt;/li&gt;&lt;li&gt;&lt;a href="http://swarmcache.sourceforge.net/" target="new"&gt;SwarmCache&lt;/a&gt;    is a simple cluster-based caching solution based on JavaGroups. It supports    read-only or nonstrict read/write caching (the next section explains this    term). This type of cache is appropriate for applications that typically have    many more read operations than write operations. &lt;/li&gt;&lt;li&gt;&lt;a href="http://www.jboss.com/products/jbosscache" target="new"&gt;JBoss    TreeCache&lt;/a&gt; is a powerful replicated (synchronous or asynchronous) and    transactional cache. Use this solution if you really need a true    transaction-capable caching architecture.&lt;/li&gt;&lt;li&gt;Commercial &lt;a href="http://hibernate.org/132.html" target="new"&gt;Tangosol    Coherence cache&lt;/a&gt;. &lt;/li&gt;&lt;/ul&gt; &lt;p&gt;Q. What are the different caching strategies?
A. The following four caching strategies are available: &lt;/p&gt; &lt;ul&gt;&lt;li&gt;Read-only: This strategy is useful for data that is read frequently but    never updated. This is by far the simplest and best-performing cache strategy.   &lt;/li&gt;&lt;li&gt;Read/write: Read/write caches may be appropriate if your data needs to be    updated. They carry more overhead than read-only caches. In non-JTA    environments, each transaction should be completed when Session.close() or    Session.disconnect() is called. &lt;/li&gt;&lt;li&gt;Nonstrict read/write: This strategy does not guarantee that two    transactions won't simultaneously modify the same data. Therefore, it may be    most appropriate for data that is read often but only occasionally modified.   &lt;/li&gt;&lt;li&gt;Transactional: This is a fully transactional cache that may be used only    in a JTA environment. &lt;/li&gt;&lt;/ul&gt; &lt;p&gt;Q. How do you configure 2nd level cach in hibernate?
A. To activate second-level caching, you need to define the  hibernate.cache.provider_class property in the hibernate.cfg.xml file as  follows: &lt;hibernate-configuration&gt;
   &lt;session-factory&gt;
       &lt;property name="hibernate.cache.provider_class"&gt;org.hibernate.cache.EHCacheProvider&lt;/property&gt;
   &lt;/session-factory&gt;
&lt;/hibernate-configuration&gt;
By default, the second-level cache is activated and uses the EHCache provider.
To use the query cache you must first enable it by setting the property  hibernate.cache.use_query_cache to true in hibernate.properties.
&lt;/p&gt; &lt;p&gt;Q. What is the difference between sorted and ordered collection in hibernate?
A. A sorted collection is sorted in-memory using java comparator, while order  collection is ordered at the database level using order by clause.
&lt;/p&gt; &lt;p&gt;&lt;a&gt;Q. What are the types of inheritence models and describe how they work  like vertical inheritence and horizontal?
A.&lt;span style="font-weight: bold;"&gt; There are three types of inheritance mapping in hibernate :&lt;/span&gt;&lt;/a&gt;
&lt;/p&gt; &lt;div style="margin-left: 40px;"&gt;   Example: Let us take the simple example of 3 java classes. Class Manager and    Worker are inherited from Employee Abstract class.
 1. &lt;span style="font-weight: bold;"&gt;Table per concrete class with unions &lt;/span&gt;: In this case there will be 2 tables.    Tables: Manager, Worker [all common attributes will be duplicated]
 2. &lt;span style="font-weight: bold;"&gt;Table per class hierarchy:&lt;/span&gt; Single Table can be mapped to a class hierarchy.    There will be only one table in database called 'Employee' that will represent    all the attributes required for all 3 classes. But it needs some    discriminating column to differentiate between Manager and worker;
 3. &lt;span style="font-weight: bold;"&gt;Table per subclass&lt;/span&gt;: In this case there will be 3 tables represent Employee,    Manager and Worker&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5937173170152272619-1061563166304137064?l=icehanger.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icehanger.blogspot.com/feeds/1061563166304137064/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5937173170152272619&amp;postID=1061563166304137064' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/1061563166304137064'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/1061563166304137064'/><link rel='alternate' type='text/html' href='http://icehanger.blogspot.com/2007/06/spring-hibernate-faq.html' title='Spring Hibernate FAQ'/><author><name>iCehaNgeR's hAcK NoteS</name><uri>http://www.blogger.com/profile/03757838076375432274</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5937173170152272619.post-1548104098984931142</id><published>2007-06-07T20:40:00.001-07:00</published><updated>2007-06-07T20:40:39.063-07:00</updated><title type='text'>Versions</title><content type='html'>JDK
1.4 and 1.5

Struts
1.3
Hibernet
3.1.3
Spring
1.2.8

Apache
Tomcat
Eclipse
RAD
WAS&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5937173170152272619-1548104098984931142?l=icehanger.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icehanger.blogspot.com/feeds/1548104098984931142/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5937173170152272619&amp;postID=1548104098984931142' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/1548104098984931142'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/1548104098984931142'/><link rel='alternate' type='text/html' href='http://icehanger.blogspot.com/2007/06/versions.html' title='Versions'/><author><name>iCehaNgeR's hAcK NoteS</name><uri>http://www.blogger.com/profile/03757838076375432274</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5937173170152272619.post-8593050727301985034</id><published>2007-06-07T20:39:00.007-07:00</published><updated>2007-06-07T20:40:17.206-07:00</updated><title type='text'>Testing</title><content type='html'>RFT&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5937173170152272619-8593050727301985034?l=icehanger.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icehanger.blogspot.com/feeds/8593050727301985034/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5937173170152272619&amp;postID=8593050727301985034' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/8593050727301985034'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/8593050727301985034'/><link rel='alternate' type='text/html' href='http://icehanger.blogspot.com/2007/06/testing.html' title='Testing'/><author><name>iCehaNgeR's hAcK NoteS</name><uri>http://www.blogger.com/profile/03757838076375432274</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5937173170152272619.post-1949510572626714960</id><published>2007-06-07T20:39:00.005-07:00</published><updated>2007-06-22T07:30:20.131-07:00</updated><title type='text'>UML diagrams</title><content type='html'>http://www.holub.com/goodies/uml/&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5937173170152272619-1949510572626714960?l=icehanger.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icehanger.blogspot.com/feeds/1949510572626714960/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5937173170152272619&amp;postID=1949510572626714960' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/1949510572626714960'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/1949510572626714960'/><link rel='alternate' type='text/html' href='http://icehanger.blogspot.com/2007/06/uml-diagrams.html' title='UML diagrams'/><author><name>iCehaNgeR's hAcK NoteS</name><uri>http://www.blogger.com/profile/03757838076375432274</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5937173170152272619.post-8831620269720396636</id><published>2007-06-07T20:39:00.003-07:00</published><updated>2007-06-07T20:39:37.361-07:00</updated><title type='text'>Security JAAS and LDAP.</title><content type='html'>&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5937173170152272619-8831620269720396636?l=icehanger.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icehanger.blogspot.com/feeds/8831620269720396636/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5937173170152272619&amp;postID=8831620269720396636' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/8831620269720396636'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/8831620269720396636'/><link rel='alternate' type='text/html' href='http://icehanger.blogspot.com/2007/06/security-jaas-and-ldap.html' title='Security JAAS and LDAP.'/><author><name>iCehaNgeR's hAcK NoteS</name><uri>http://www.blogger.com/profile/03757838076375432274</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5937173170152272619.post-3755710554336662578</id><published>2007-06-07T20:39:00.001-07:00</published><updated>2007-06-07T20:39:21.403-07:00</updated><title type='text'>Webservices</title><content type='html'>1. How to implement Webservice. steps.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5937173170152272619-3755710554336662578?l=icehanger.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icehanger.blogspot.com/feeds/3755710554336662578/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5937173170152272619&amp;postID=3755710554336662578' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/3755710554336662578'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/3755710554336662578'/><link rel='alternate' type='text/html' href='http://icehanger.blogspot.com/2007/06/webservices.html' title='Webservices'/><author><name>iCehaNgeR's hAcK NoteS</name><uri>http://www.blogger.com/profile/03757838076375432274</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5937173170152272619.post-274032359697727617</id><published>2007-06-07T20:38:00.002-07:00</published><updated>2009-04-07T20:05:16.936-07:00</updated><title type='text'>Patterns</title><content type='html'>1.Different types of patterns.
&lt;div class="mycode"&gt;
Creational Patterns
--- Abstract Factory
--- Builder
--- Factory Method
--- Prototype
--- Singleton

 Structural Patterns
--- Adapter
--- Bridge
--- Composite
--- Decorator
--- FaÃ§ade
--- Flyweight
--- Proxy
 Behavioral Patterns
--- Chain of Responsibility
--- Command
--- Interpreter
--- Iterator
--- Mediator
--- Memento
--- Observer
--- State
--- Strategy
--- Template Method
--- Visitor

 J2EE Patterns
--- MVC
--- Business Delegate
--- Composite Entity
--- Data Access Object
--- Front Controller
--- Intercepting Filter
--- Service Locator
--- Transfer Object
&lt;/div&gt;
http://www.javacamp.org/designPattern/&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5937173170152272619-274032359697727617?l=icehanger.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icehanger.blogspot.com/feeds/274032359697727617/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5937173170152272619&amp;postID=274032359697727617' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/274032359697727617'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/274032359697727617'/><link rel='alternate' type='text/html' href='http://icehanger.blogspot.com/2007/06/patterns.html' title='Patterns'/><author><name>iCehaNgeR's hAcK NoteS</name><uri>http://www.blogger.com/profile/03757838076375432274</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5937173170152272619.post-6048152383477181867</id><published>2007-06-07T20:38:00.001-07:00</published><updated>2009-04-08T14:21:27.965-07:00</updated><title type='text'>JMS.</title><content type='html'>1.How to do lookup in JMS.

&lt;div class="mycode"&gt;
What is the difference between topic and queue?
A topic is typically used for one to many messaging i.e. it supports publish subscribe model of messaging. 
While queue is used for one-to-one messaging i.e. it supports Point to Point Messaging.
&lt;/div&gt;
2.JMS step by step.
Queue
Topic
Connection
define JNDI name for queue
&lt;h3 class="pHeading2"&gt; JMS API Architecture &lt;/h3&gt; &lt;a name="wp78650"&gt; &lt;/a&gt;&lt;p class="pBody"&gt; A JMS application is composed of the following parts. &lt;/p&gt; &lt;a name="wp78651"&gt; &lt;/a&gt;&lt;div class="pSmartList1"&gt;&lt;li&gt;A &lt;em class="cEmphasis"&gt;JMS provider&lt;/em&gt; is a messaging system that implements the JMS interfaces and provides administrative and control features. An implementation of the J2EE platform at release 1.3 and later includes a JMS provider.&lt;/li&gt;&lt;/div&gt;&lt;a name="wp78652"&gt; &lt;/a&gt;&lt;div class="pSmartList1"&gt;&lt;li&gt;&lt;em class="cEmphasis"&gt;JMS clients&lt;/em&gt; are the programs or components, written in the Java programming language, that produce and consume messages. Any J2EE application component can act as a JMS client.&lt;/li&gt;&lt;/div&gt;&lt;a name="wp78653"&gt; &lt;/a&gt;&lt;div class="pSmartList1"&gt;&lt;li&gt;&lt;em class="cEmphasis"&gt;Messages&lt;/em&gt; are the objects that communicate information between JMS clients.&lt;/li&gt;&lt;/div&gt;&lt;a name="wp78654"&gt; &lt;/a&gt;&lt;em class="cEmphasis"&gt;Administered objects&lt;/em&gt; are preconfigured JMS objects created by an administrator for the use of clients.


&lt;span style="font-weight: bold;"&gt;Message Queue --Point-to-Point&lt;/span&gt;
A message queue, used in a Point-to-Point messaging system, receives messages from many senders and puts them in one queue to one receiver.

A point-to-point (PTP) product or application is built on the concept of message queues, senders, and receivers. Each message is addressed to a specific queue, and receiving clients extract messages from the queues established to hold their messages. Queues retain all messages sent to them until the messages are consumed or until the messages expire.


&lt;span style="font-weight: bold;"&gt;Topic -- Publish-Subscribe&lt;/span&gt;
A topic, used in a Publish-Subscribe messaging system, receives messages from many senders and sends them to many receivers, which subscribe to the topic.

&lt;p class="pBody"&gt; Pub/sub messaging has the following characteristics. &lt;/p&gt; &lt;div class="pSmartList1"&gt;&lt;ul class="pSmartList1"&gt;&lt;a name="wp78766"&gt; &lt;/a&gt;&lt;div class="pSmartList1"&gt;&lt;li&gt;Each message can have multiple consumers. &lt;/li&gt;&lt;/div&gt;&lt;a name="wp78767"&gt; &lt;/a&gt;&lt;div class="pSmartList1"&gt;&lt;li&gt;Publishers and subscribers have a timing dependency. A client that subscribes to a topic can consume only messages published after the client has created a subscription, and the subscriber must continue to be active in order for it to consume messages.&lt;/li&gt;&lt;/div&gt;&lt;/ul&gt;&lt;span style="font-weight: bold;"&gt;Steps for Creating Messages.&lt;/span&gt;

&lt;pre&gt; /*
       * Look up connection factory and queue.  If either does
       * not exist, exit.
       */
      try {
          queueConnectionFactory = (QueueConnectionFactory)
jndiContext.lookup("java:comp/env/jms/MyQueueConnectionFactory");
          queue = (Queue)
             jndiContext.lookup("java:comp/env/jms/QueueName");
      } catch (NamingException e) {
          System.out.println("JNDI lookup failed: " +
              e.toString());
          System.exit(1);
      }

      /*
       * Create connection.
       * Create session from connection; false means session is
       * not transacted.
       * Create sender and text message.
       * Send messages, varying text slightly.
       * Finally, close connection.
       */
      try {
          queueConnection =
              queueConnectionFactory.createQueueConnection();
          queueSession =
              queueConnection.createQueueSession(false,
                  Session.AUTO_ACKNOWLEDGE);
          queueSender = queueSession.createSender(queue);
          message = queueSession.createTextMessage();
          for (int i = 0; i &lt; NUM_MSGS; i++) {                message.setText("This is message " + (i + 1));                System.out.println("Sending message: " +                    message.getText());                queueSender.send(message);            }  


&lt;span style="font-size:130%;"&gt; &lt;/span&gt;&lt;span style="font-weight: bold;"&gt;&lt;span style="font-size:130%;"&gt;Receiving Message Using MDB
---------------------------&lt;/span&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;dl&gt;&lt;dt&gt;public interface &lt;b&gt;TextMessage &lt;/b&gt;extends &lt;a href="http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/jms/Message.html"&gt;Message&lt;/a&gt;
&lt;/dt&gt;&lt;/dl&gt;&lt;pre&gt;A &lt;code&gt;TextMessage&lt;/code&gt; object is used to send a message containing a  &lt;code&gt;java.lang.String&lt;/code&gt;.
It inherits from the &lt;code&gt;Message&lt;/code&gt; interface and adds a text message  body.
&lt;span style="font-weight: bold;"&gt;

implement the Message Driven Bean with
&lt;/span&gt;implements MessageDrivenBean,  MessageListener


/**
   * onMessage method, declared as public (but not final or
   * static), with a return type of void, and with one argument
   * of type javax.jms.Message.
   *
   * Casts the incoming Message to a TextMessage and displays
   * the text.
   *
   * @param inMessage    the incoming message
   */
  public void onMessage(Message inMessage) {
      TextMessage msg = null;

      try {
          if (inMessage instanceof TextMessage) {
              msg = (TextMessage) inMessage;
              System.out.println("MESSAGE BEAN: Message " +
                  "received: " + msg.getText());
          } else {
              System.out.println("Message of wrong type: " +
                  inMessage.getClass().getName());
          }
      } catch (JMSException e) {
          System.err.println("MessageBean.onMessage: " +
              "JMSException: " + e.toString());
          mdc.setRollbackOnly();
      } catch (Throwable te) {
          System.err.println("MessageBean.onMessage: " +
              "Exception: " + te.toString());
      }
  }
&lt;span style="font-weight: bold;"&gt;

&lt;/span&gt;        } catch (JMSException e) {&lt;/pre&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5937173170152272619-6048152383477181867?l=icehanger.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icehanger.blogspot.com/feeds/6048152383477181867/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5937173170152272619&amp;postID=6048152383477181867' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/6048152383477181867'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/6048152383477181867'/><link rel='alternate' type='text/html' href='http://icehanger.blogspot.com/2007/06/jms.html' title='JMS.'/><author><name>iCehaNgeR's hAcK NoteS</name><uri>http://www.blogger.com/profile/03757838076375432274</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5937173170152272619.post-86868063398386394</id><published>2007-06-07T20:37:00.002-07:00</published><updated>2007-06-07T20:38:04.306-07:00</updated><title type='text'>JDBC</title><content type='html'>1. How to do JDBC connection
2. Prepared statement&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5937173170152272619-86868063398386394?l=icehanger.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icehanger.blogspot.com/feeds/86868063398386394/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5937173170152272619&amp;postID=86868063398386394' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/86868063398386394'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/86868063398386394'/><link rel='alternate' type='text/html' href='http://icehanger.blogspot.com/2007/06/jdbc.html' title='JDBC'/><author><name>iCehaNgeR's hAcK NoteS</name><uri>http://www.blogger.com/profile/03757838076375432274</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5937173170152272619.post-1984027267815409812</id><published>2007-06-07T20:37:00.001-07:00</published><updated>2007-06-14T20:31:51.819-07:00</updated><title type='text'>EJB</title><content type='html'>BMP and  CMB
1. Methods in EJB
2. EJB life cycle

&lt;p class="head1"&gt;&lt;a name="EJB117"&gt;&lt;span style="font-weight: bold;"&gt; Stateless session bean life cycle&lt;/span&gt; &lt;/a&gt; &lt;/p&gt;    &lt;p&gt; &lt;span style="font-size:100%;"&gt;&lt;span style="font-weight: 400;"&gt;Life cycle means  when an EJBean is created and removed by EJB Container, and when the Container calls  methods of EJBean. The following figure illustrates the life cycle of  Stateless session bean.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0.1in; text-align: center;"&gt;    &lt;img alt="Stateless session bean figure" src="http://www.precisejava.com/javaperf/j2ee/EJB_files/stateless.gif" /&gt;&lt;/p&gt;    &lt;p&gt; &lt;span style="font-size:100%;"&gt;&lt;span style="font-weight: 400;"&gt;You can  control life cycle by mentioning instance pool size in vendor specific  deployment descriptor. For example weblogic server's weblogic-ejb-jar.xml has  element for instance pool size&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin-top: 0.1in;"&gt; &lt;span style="color: rgb(51, 102, 204);font-size:85%;" &gt;  &lt;span style="font-weight: 400;"&gt;&lt;pool&gt;&lt;/pool&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin-top: 0.1in;"&gt; &lt;span style="color: rgb(51, 102, 204);font-size:85%;" &gt;  &lt;span style="font-weight: 400;"&gt;         &lt;max-beans-in-free-pool&gt;100&lt;/max-beans-in-free-pool&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin-top: 0.1in;"&gt; &lt;span style="color: rgb(51, 102, 204);font-size:85%;" &gt;  &lt;span style="font-weight: 400;"&gt;         &lt;initial-beans-in-free-pool&gt;50&lt;/initial-beans-in-free-pool&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin-top: 0.1in;"&gt; &lt;span style="color: rgb(51, 102, 204);font-size:85%;" &gt;  &lt;span style="font-weight: 400;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p&gt; &lt;span style="font-weight: 400;"&gt;&lt;span style="font-size:100%;"&gt;and JBoss  server's jboss.xml has an element &lt;/span&gt;&lt;span style="color: rgb(51, 102, 204);font-size:85%;" &gt;  &lt;instance-pool&gt;&lt;/instance-pool&gt;&lt;/span&gt;&lt;span style="font-size:100%;"&gt; to mention pool size. See vendors  documentation for information for other servers. Here you can specify  initial beans and maximum beans in pool. If you mention for example 50 beans in  initial beans and 100 for maximum beans in the pool, the life cycle starts when  the server starts up.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p&gt; &lt;span style="font-size:100%;"&gt;&lt;span style="font-weight: 400;"&gt;When the server  starts up, the EJB Container/Server creates 50 beans using Class.newInstance()  method and puts it in the pool and  it calls the following call back methods of the bean.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin-top: 0.1in;"&gt; &lt;span style="font-weight: 400;"&gt;  &lt;span style="font-size:100%;"&gt;        &lt;/span&gt;  &lt;/span&gt; &lt;span style="color: rgb(51, 102, 204);font-size:85%;" &gt;  &lt;span style="font-weight: 400;"&gt;setSessionContext(ctx) and &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin-top: 0.1in;"&gt; &lt;span style="color: rgb(51, 102, 204);font-size:85%;" &gt;  &lt;span style="font-weight: 400;"&gt;         ejbCreate() methods&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p&gt; &lt;span style="font-size:100%;"&gt;&lt;span style="font-weight: 400;"&gt;these 50 beans are  ready to be accessed by 50 clients concurrently. If the client accesses exceed 50 then the Container creates beans and calls the  above methods till the number of beans is equal to 100 (maximum beans in the pool). So at any time the Container  can only have a maximum of 100 beans to serve clients. What will happen if the  concurrent clients are more than 100? Then the container puts clients in the  queue. We will discuss about this in the next section on how you can tune the pool size.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p&gt; &lt;span style="font-size:100%;"&gt;&lt;span style="font-weight: 400;"&gt;The Container  removes the beans from the pool if the number of clients accessing beans are  less. When  the Container removes the beans depending on its specific algorithms ( perhaps LRU,  Least Recently Used). At this time Container calls ejbRemove() method of the  bean.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p&gt; &lt;span style="font-size:100%;"&gt;&lt;span style="font-weight: 400;"&gt;If the client calls the home.create() method,  the Container creates EJBObject and assigns existing bean from the pool to the the client, at this time client neither creates a bean nor calls ejbCreate() method because it is already called when it created and is put in the pool. In the same manner, if the client calls home.remove() / remote.remove() method, the Container removes EJBObject and deassigns the bean from the client and puts it back to the pool but does not remove from the pool. &lt;span style="font-weight: bold;"&gt;In Stateless session bean life cycle, Client does not have control over bean's life cycle and bean's call back methods, it does not know when the creation, destruction and call back methods occur. So In Stateless session beans the creation, destruction and call back methods depend upon the pool size, clients concurrent access and Container algorithms.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p&gt; &lt;span style="font-size:100%;"&gt;&lt;span style="font-weight: 400;"&gt;As the name  implies, a Stateless session bean does not maintain any state ( instance  variables values) across methods, that is the reason why ejbActivate() and  ejbPassivate() methods do not have significance in Stateless session bean. So the Container can assign different beans  from the pool to the client for successive methods.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p&gt; &lt;span style="font-size:100%;"&gt;&lt;span style="font-weight: 400;"&gt;With this  discussion, we understand the importance of pool size and when the call back  methods are executed in Stateless session beans. Now let us discuss how we can tune  Stateless session beans.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p class="head1"&gt;&lt;a name="EJB118"&gt; Tune Stateless session beans instance pool size&lt;/a&gt;&lt;/p&gt;    &lt;p&gt; &lt;span style="font-size:100%;"&gt;&lt;span style="font-weight: 400;"&gt;The creation and  destruction of beans is expensive. To reduce this cost, The EJB  Container/Server creates pool of beans that depending upon vendor specific  configuration, you need to give a proper value for this pool size to increase performance. As we  discussed above, configure pool size, for example weblogic's weblogic-ejb-jar.xml has an element &lt;pool&gt; and JBoss  server's jboss.xml has an element &lt;instance-pool&gt;. see your vendor documentation  for configuring your EJB server pool size.&lt;/instance-pool&gt;&lt;/pool&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p&gt; &lt;span style="font-size:100%;"&gt;&lt;span style="font-weight: 400;"&gt;The number of  maximum beans in pool impacts performance. If this is less, then the  Container has to put the clients in the queue when the number of clients accessing  is more  than the maximum pool size. This degrades the performance and clients take more time  to execute. For best performance, give maximum beans as equal to number of  maximum clients accesses. &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class="head1"&gt; &lt;a name="EJB122"&gt;Stateful session bean life cycle &lt;/a&gt;&lt;/p&gt;    &lt;p&gt; &lt;span style="font-size:100%;"&gt;&lt;span style="font-weight: 400;"&gt;The life cycle of  Stateful and Stateless bean is differs. The reason is,  Stateful session bean has to maintain state (instance variables values) across the methods for a client. That  means once a client assigns values for instance variables using one method,  those values are available for other methods also. The following figure  illustrates the life cycle of Stateful session bean.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;      &lt;p&gt;Figure7: Stateful session bean life cycle&lt;/p&gt;  &lt;p style="margin: 0.1in; text-align: center;"&gt;  &lt;img alt="Stateful session bean figure" src="http://www.precisejava.com/javaperf/j2ee/EJB_files/stateful.gif" /&gt;&lt;/p&gt;    &lt;p&gt; &lt;span style="font-size:100%;"&gt;&lt;span style="font-weight: 400;"&gt;Here you see the  instance cache instead of instance pool. Cache maintains beans that have state (Stateful)  whereas pool maintains beans that don't have state (Stateless). You can  control life cycle by describing instance cache size in vendor specific  deployment descriptor file. For example weblogic's weblogic-ejb-jar.xml has  element for instance cache size&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin-top: 0.1in;"&gt; &lt;span style="color: rgb(51, 102, 204);font-size:85%;" &gt;  &lt;span style="font-weight: 400;"&gt;&lt;stateful-session-cache&gt;&lt;/stateful-session-cache&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin-top: 0.1in;"&gt; &lt;span style="color: rgb(51, 102, 204);font-size:85%;" &gt;  &lt;span style="font-weight: 400;"&gt;         &lt;max-beans-in-cache&gt;100&lt;/max-beans-in-cache&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin-top: 0.1in;"&gt; &lt;span style="color: rgb(51, 102, 204);font-size:85%;" &gt;  &lt;span style="font-weight: 400;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p&gt; &lt;span style="font-weight: 400;"&gt;&lt;span style="font-size:100%;"&gt;and JBoss  server's jboss.xml has an element&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin-top: 1px;"&gt; &lt;span style="font-weight: 400;"&gt;&lt;span style="color: rgb(51, 102, 204);font-size:85%;" &gt;  &lt;instance-cache&gt;&lt;/instance-cache&gt;&lt;/span&gt;&lt;span style="font-size:100%;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin-top: 1px;"&gt; &lt;span style="color: rgb(51, 102, 204);font-size:85%;" &gt;  &lt;span style="font-weight: 400;"&gt;&lt;container-cache-conf&gt;&lt;/container-cache-conf&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin-top: 1px;"&gt; &lt;span style="color: rgb(51, 102, 204);font-size:85%;" &gt;  &lt;span style="font-weight: 400;"&gt;         &lt;cache-policy&gt;&lt;/cache-policy&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin-top: 1px;"&gt; &lt;span style="color: rgb(51, 102, 204);font-size:85%;" &gt;  &lt;span style="font-weight: 400;"&gt;                &lt;cache-policy-conf&gt;     &lt;/cache-policy-conf&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin-top: 1px;"&gt; &lt;span style="color: rgb(51, 102, 204);font-size:85%;" &gt;  &lt;span style="font-weight: 400;"&gt;                          &lt;min-capacity&gt;5&lt;/min-capacity&gt;         &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin-top: 1px;"&gt; &lt;span style="color: rgb(51, 102, 204);font-size:85%;" &gt;  &lt;span style="font-weight: 400;"&gt;                        &lt;max-capacity&gt;10&lt;/max-capacity&gt;     &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin-top: 1px;"&gt; &lt;span style="color: rgb(51, 102, 204);font-size:85%;" &gt;  &lt;span style="font-weight: 400;"&gt;               &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin-top: 1px;"&gt; &lt;span style="color: rgb(51, 102, 204);font-size:85%;" &gt;  &lt;span style="font-weight: 400;"&gt;                     &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin-top: 1px;"&gt; &lt;span style="color: rgb(51, 102, 204);font-size:85%;" &gt;  &lt;span style="font-weight: 400;"&gt;         &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin-top: 1px;"&gt; &lt;span style="color: rgb(51, 102, 204);font-size:85%;" &gt;  &lt;span style="font-weight: 400;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin-top: 1px;"&gt; &lt;span style="font-weight: 400;"&gt;&lt;span style="color: rgb(51, 102, 204);font-size:85%;" &gt;  &lt;/span&gt;&lt;span style="font-size:100%;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin-top: 0.1in;"&gt; &lt;span style="font-weight: 400;"&gt;&lt;span style="font-size:100%;"&gt;  For detailed information, look at their documentation and for other servers look  at vendors documentation for instance cache configuration. &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p&gt; &lt;span style="font-weight: 400;"&gt;&lt;span style="font-size:100%;"&gt;Here you can  specify minimum beans and maximum beans in cache. Some vendors such as weblogic  do not support  configuring minimum beans but support configuring maximum beans.  So look at your vendor documentation for detailed information on what your EJB   Container/server supports.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p&gt; &lt;span style="font-size:100%;"&gt;&lt;span style="font-weight: 400;"&gt;Here life cycle of stateful session bean starts when the client calls create() method.  When the the client calls create() method, the Container creates the bean using  Class.newInstance() and calls &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin-top: 0.1in;"&gt; &lt;span style="color: rgb(51, 102, 204);font-size:85%;" &gt;  &lt;span style="font-weight: 400;"&gt;         setSessionContext(ctx) and &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin-top: 0.1in;"&gt; &lt;span style="color: rgb(51, 102, 204);font-size:85%;" &gt;  &lt;span style="font-weight: 400;"&gt;         ejbCreate() methods&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p&gt; &lt;span style="font-size:100%;"&gt;&lt;span style="font-weight: 400;"&gt;and puts it in the instance cache. Then onwards, the client is assigned to that bean till client calls remove() method, thus container calls ejbRemove() and destroys the bean. &lt;span style="font-weight: bold;"&gt;In Stateful session bean, the client controls life cycle ( creation and removal but not activation and passivation). So when does container call ejbActivate() and ejbPassivate() methods? For example, if you set maximum beans in cache as 100 beans, when clients are accessing a bean concurrently, container creates beans till 100 (maximum bean limit) and assigns those beans to clients. After this limit, if the 101st client accesses this bean, Container passivates some of the idle beans that depending on Container algorithms. &lt;/span&gt;Just before passivating beans, it calls ejbPassivate() method. Here passivation means, it stores the bean's state (instance variables values) in the secondary storage (file storage or database). The passivation happens through Serialization. Later if the the idle client accesses the bean again, then Container activates the bean and reassigns the passivated values to its instance variables and calls ejbActivate() method.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p&gt; &lt;span style="font-size:100%;"&gt;&lt;span style="font-weight: 400;"&gt;Here what we  understand is that client controls creation and destruction of beans but not  activation and passivation. Activation and passivation are controlled by  Container and depend on instance cache size. &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p&gt; &lt;span style="font-size:100%;"&gt;&lt;span style="font-weight: 400;"&gt;With this  discussion, we understand the importance of instance cache size and when the  call back methods are executed in Stateful session beans. Now let us discuss how we can tune  Stateful session beans.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p class="head1"&gt;&lt;a name="EJB123"&gt; Tune Stateful session beans instance cache size&lt;/a&gt;&lt;/p&gt;    &lt;p&gt; &lt;span style="font-size:100%;"&gt;&lt;span style="font-weight: 400;"&gt;As discussed above, You control activation and passivation indirectly by describing instance cache size in vendor specific deployment descriptor file . Activation and passivation is expensive because of serialization process. If the instance cache size is less and concurrent active clients are more than instance cache size then activation and passivation occur often, thus degrading performance. So in order to increase performance, give optimal cache size. &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p class="head1"&gt;&lt;a name="EJB124"&gt; Set optimal bean age for Stateful session beans&lt;/a&gt;&lt;/p&gt;    &lt;p&gt; &lt;span style="font-size:100%;"&gt;&lt;span style="font-weight: 400;"&gt;The removal of EJBean instance by the Container from the instance cache depends not only on when the client calls remove() method but also on EJBean time out value (bean age) that you can configure in the vendor specific descriptor file. If the beans time out value is less, the Container needs to remove and create often,which is expensive. So set optimal bean age to minimise removal and creation process.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;
&lt;span style="font-size:100%;"&gt;&lt;span style="font-weight: 400;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="head1"&gt;&lt;a name="EJB128"&gt; Entity bean life cycle &lt;/a&gt;&lt;/p&gt;    &lt;p&gt; &lt;span style="font-size:100%;"&gt;&lt;span style="font-weight: 400;"&gt;The life cycle of  Entity beans is a combination of Stateless and Stateful bean  life cycles.  There is slight difference between Container  managed persistence (CMP) and Bean managed persistence (BMP) entity bean's life cycle that is  negligible. So here we will discuss a generalized life cycle  that applies to both.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p&gt; &lt;span style="font-size:100%;"&gt;&lt;span style="font-weight: 400;"&gt;The following  figure illustrates the life cycle of Entity beans.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;  Figure7: Entity session bean life cycle&lt;/p&gt;  &lt;p style="margin: 0.1in; text-align: center;"&gt;  &lt;img alt="" src="http://www.precisejava.com/javaperf/j2ee/EJB_files/entity.gif" /&gt;&lt;/p&gt;    &lt;p&gt; &lt;span style="font-size:100%;"&gt;&lt;span style="font-weight: 400;"&gt;Here you see both  instance pool and instance cache. instance pool maintains entity beans without  state data and instance cache maintains entity beans with state data. &lt;/span&gt;  &lt;/span&gt;&lt;/p&gt;    &lt;p&gt; &lt;span style="font-size:100%;"&gt;&lt;span style="font-weight: 400;"&gt;You can  control life cycle in Entity beans by mentioning instance pool size and instance  cache size in vendor specific  deployment descriptor. For example  weblogic's weblogic-ejb-jar.xml has  element for instance pool size, &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin-top: 0.1in;"&gt; &lt;span style="color: rgb(51, 102, 204);font-size:85%;" &gt;  &lt;span style="font-weight: 400;"&gt;&lt;pool&gt;&lt;/pool&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin-top: 0.1in;"&gt; &lt;span style="color: rgb(51, 102, 204);font-size:85%;" &gt;  &lt;span style="font-weight: 400;"&gt;         &lt;max-beans-in-free-pool&gt;100&lt;/max-beans-in-free-pool&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin-top: 0.1in;"&gt; &lt;span style="color: rgb(51, 102, 204);font-size:85%;" &gt;  &lt;span style="font-weight: 400;"&gt;         &lt;initial-beans-in-free-pool&gt;50&lt;/initial-beans-in-free-pool&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin-top: 0.1in;"&gt; &lt;span style="color: rgb(51, 102, 204);font-size:85%;" &gt;  &lt;span style="font-weight: 400;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin-top: 0.1in;"&gt; &lt;span style="font-size:100%;"&gt;&lt;span style="font-weight: 400;"&gt;  and instance cache size&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin-top: 0.1in;"&gt; &lt;span style="color: rgb(51, 102, 204);font-size:85%;" &gt;  &lt;span style="font-weight: 400;"&gt;&lt;entity-cache&gt;&lt;/entity-cache&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin-top: 0.1in;"&gt; &lt;span style="color: rgb(51, 102, 204);font-size:85%;" &gt;  &lt;span style="font-weight: 400;"&gt;         &lt;max-beans-in-cache&gt;100&lt;/max-beans-in-cache&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin-top: 0.1in;"&gt; &lt;span style="color: rgb(51, 102, 204);font-size:85%;" &gt;  &lt;span style="font-weight: 400;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin-top: 0.1in;"&gt;  &lt;/p&gt;    &lt;p&gt; &lt;span style="font-weight: 400;"&gt;&lt;span style="font-size:100%;"&gt;and in JBoss,   jboss.xml has an element &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p&gt; &lt;span style="font-weight: 400;"&gt;&lt;span style="color: rgb(51, 102, 204);font-size:85%;" &gt;  &lt;instance-pool&gt;&lt;/instance-pool&gt;&lt;/span&gt;&lt;span style="font-size:100%;"&gt; to mention pool size. &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p&gt; &lt;span style="font-size:100%;"&gt;&lt;span style="font-weight: 400;"&gt;and for instance  cache size &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin-top: 1px;"&gt; &lt;span style="font-weight: 400;"&gt;&lt;span style="color: rgb(51, 102, 204);font-size:85%;" &gt;  &lt;instance-cache&gt;&lt;/instance-cache&gt;&lt;/span&gt;&lt;span style="font-size:100%;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin-top: 1px;"&gt; &lt;span style="color: rgb(51, 102, 204);font-size:85%;" &gt;  &lt;span style="font-weight: 400;"&gt;&lt;container-cache-conf&gt;&lt;/container-cache-conf&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin-top: 1px;"&gt; &lt;span style="color: rgb(51, 102, 204);font-size:85%;" &gt;  &lt;span style="font-weight: 400;"&gt;         &lt;cache-policy&gt;&lt;/cache-policy&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin-top: 1px;"&gt; &lt;span style="color: rgb(51, 102, 204);font-size:85%;" &gt;  &lt;span style="font-weight: 400;"&gt;                &lt;cache-policy-conf&gt;     &lt;/cache-policy-conf&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin-top: 1px;"&gt; &lt;span style="color: rgb(51, 102, 204);font-size:85%;" &gt;  &lt;span style="font-weight: 400;"&gt;                          &lt;min-capacity&gt;5&lt;/min-capacity&gt;         &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin-top: 1px;"&gt; &lt;span style="color: rgb(51, 102, 204);font-size:85%;" &gt;  &lt;span style="font-weight: 400;"&gt;                        &lt;max-capacity&gt;10&lt;/max-capacity&gt;     &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin-top: 1px;"&gt; &lt;span style="color: rgb(51, 102, 204);font-size:85%;" &gt;  &lt;span style="font-weight: 400;"&gt;               &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin-top: 1px;"&gt; &lt;span style="color: rgb(51, 102, 204);font-size:85%;" &gt;  &lt;span style="font-weight: 400;"&gt;                     &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin-top: 1px;"&gt; &lt;span style="color: rgb(51, 102, 204);font-size:85%;" &gt;  &lt;span style="font-weight: 400;"&gt;         &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin-top: 1px;"&gt; &lt;span style="color: rgb(51, 102, 204);font-size:85%;" &gt;  &lt;span style="font-weight: 400;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin-top: 1px;"&gt; &lt;span style="font-weight: 400;"&gt;&lt;span style="color: rgb(51, 102, 204);font-size:85%;" &gt;  &lt;/span&gt;&lt;span style="font-size:100%;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p&gt; &lt;span style="font-weight: 400;"&gt;&lt;span style="font-size:100%;"&gt; If you  mention 50 beans as initial beans and 100 beans as maximum beans for instance  pool, 50 (min) and 100(max) for instance cache, life cycle starts when the  server starts up.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p&gt; &lt;span style="font-size:100%;"&gt;&lt;span style="font-weight: 400;"&gt;When the server  starts up, First, the EJB Container/Server creates 50 beans using Class.newInstance()  method and puts them in the pool and  it calls setEntityContext() method on each bean. The Container  can remove beans from the pool depending on clients accesses and idle time of beans in  the pool. When it removes the bean from the pool it calls unSetEntityContext()  method on the bean.  &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p&gt; &lt;span style="font-size:100%;"&gt;&lt;span style="font-weight: 400;"&gt;Next, &lt;span style="font-weight: bold;"&gt;When the client  calls the create() method, the Container calls corresponding ejbCreate() method on  one of the beans in the instance pool and creates a row in the database and  populates the values to the variables and puts it in the instance cache after  returning primary key. At this stage an EJBObject is assigned to the client that  communicates to the bean in the instance cache. Next, the Container calls  ejbPostCreate() method. At this stage, the bean is moved from pool to cache and  is ready to serve clients business methods.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p&gt; &lt;span style="font-size:100%;"&gt;&lt;span style="font-weight: 400;"&gt;Next, When the client calls the business method, the Container calls ejbLoad() that updates the beans state, executes the business method, and calls ejbStore() method to store the data in the database. If the concurrent active clients are more than cache size then the container passivates a bean and calls ejbStore(), ejbPassivate() methods and puts it back in the instance pool. If the idle client calls again after some time, container calls ejbLoad() to get latest data, and calls ejbActivate() method and puts it in the instance cache. &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p&gt; &lt;span style="font-size:100%;"&gt;&lt;span style="font-weight: 400;"&gt;Next, If the client calls  remove() method, the Container calls ejbRemove() method that removes the data  from the database and puts the bean back in the instance pool from instance  cache.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p&gt; &lt;span style="font-size:100%;"&gt;&lt;span style="font-weight: 400;"&gt;With this  discussion, we understand that  &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p&gt; &lt;span style="font-size:100%;"&gt;&lt;span style="font-weight: 400;"&gt;1. Client controls life cycle of a bean  that involves  creation of data in the database thus moving the bean from pool to the cache and  removal of data from the database thus moving the bean from cache to the pool.    &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p&gt; &lt;span style="font-size:100%;"&gt;&lt;span style="font-weight: 400;"&gt;2.  Container controls the life cycle in the pool and cache and also activation and passivation process  in the cache. &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p&gt; &lt;span style="font-size:100%;"&gt;&lt;span style="font-weight: 400;"&gt;3. Both client and container control ejbLoad() and ejbStore() methods depending upon client's method calls and Container activation and passivation process. &lt;/span&gt;  &lt;/span&gt;&lt;/p&gt;    &lt;p&gt; &lt;span style="font-size:100%;"&gt;&lt;span style="font-weight: 400;"&gt;Finally the  overall life cycle depends upon clients concurrent operations, instance pool  size and instance cache size.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p&gt; &lt;span style="font-size:100%;"&gt;&lt;span style="font-weight: 400;"&gt;Now let us discuss  how we can tune Entity beans.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p class="head1"&gt;&lt;a name="EJB129"&gt; Tune Entity beans instance pool size&lt;/a&gt;&lt;/p&gt;    &lt;p&gt; &lt;span style="font-size:100%;"&gt;&lt;span style="font-weight: 400;"&gt;As per Entity bean life cycle discussion, we understand that we can control creation and destruction of beans by describing pool size(min and max) in vendor specific deployment descriptor (or other vendor specific manner). If this size is less (if your default size is less or you configure a smaller size) then the Container has to put the clients in the queue when the number of concurrent clients accessing ( create/finder/home methods) are more than the max pool size. And also instance cache depends up on instance pool because the instance cache needs to get beans from the instance pool. So if the pool size is less, It degrades the performance and clients take more time to execute. For best performance, give maximum beans in pool as equal to number of maximum concurrent client accesses (create/finder/home methods), so that it reduces creation and destruction of beans.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p&gt; &lt;span style="font-size:100%;"&gt;&lt;span style="font-weight: 400;"&gt;You can configure your pool  size in vendor specific deployment descriptor ( or other vendor specific manner). In the above  &lt;span style="color: rgb(51, 102, 204);"&gt;&lt;a href="http://www.precisejava.com/javaperf/j2ee/EJB.htm#EJB128"&gt;Entity bean life cycle&lt;/a&gt;&lt;/span&gt; section, We  discussed how to configure this pool size in Weblogic and JBoss servers.&lt;/span&gt;  &lt;/span&gt;&lt;/p&gt;&lt;p&gt;
&lt;span style="font-size:100%;"&gt;&lt;span style="font-weight: 400;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-weight: 400;"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
4. Different EJB's
5. How to do lookup.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5937173170152272619-1984027267815409812?l=icehanger.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icehanger.blogspot.com/feeds/1984027267815409812/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5937173170152272619&amp;postID=1984027267815409812' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/1984027267815409812'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/1984027267815409812'/><link rel='alternate' type='text/html' href='http://icehanger.blogspot.com/2007/06/ejb.html' title='EJB'/><author><name>iCehaNgeR's hAcK NoteS</name><uri>http://www.blogger.com/profile/03757838076375432274</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5937173170152272619.post-127749906159450224</id><published>2007-06-07T20:36:00.002-07:00</published><updated>2007-06-07T20:37:16.245-07:00</updated><title type='text'>Hibernate</title><content type='html'>1. Difference between SQL and HQL
2. Why is hbernate useful
3. How is it used step by step

Mapping is done in .hbm.xml
applicationContext-hibernate.xml
An ApplicationContext provides the following functionalities:

    * Bean factory methods, inherited from ListableBeanFactory. This avoids the need for applications to use singletons.
    * The ability to resolve messages, supporting internationalization. Inherited from the MessageSource interface.
    * The ability to load file resources in a generic fashion. Inherited from the ResourceLoader interface.
    * The ability to publish events. Implementations must provide a means of registering event listeners.
    * Inheritance from a parent context. Definitions in a descendant context will always take priority. This means, for example, that a single parent context can   be used by an entire web application, while each servlet has its own child context that is independent of that of any other servlet.

Things to be defined in the applicationContext
        DriverManagerDataSource
    LocalSessionFactoryBean --
        HibernateTransactionManager
        DAOImplementation
        TransactionProxyFactoryBean
&lt;prop key="get*"&gt;PROPAGATION_REQUIRED,readOnly&lt;/prop&gt;
&lt;prop key="find*"&gt;PROPAGATION_REQUIRED,readOnly&lt;/prop&gt;
&lt;prop key="load*"&gt;PROPAGATION_REQUIRED,readOnly&lt;/prop&gt;
&lt;prop key="store*"&gt;PROPAGATION_REQUIRED&lt;/prop&gt;
        Mail

4. Foreign keys.
5. Multiple of single type&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5937173170152272619-127749906159450224?l=icehanger.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icehanger.blogspot.com/feeds/127749906159450224/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5937173170152272619&amp;postID=127749906159450224' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/127749906159450224'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/127749906159450224'/><link rel='alternate' type='text/html' href='http://icehanger.blogspot.com/2007/06/hibernate.html' title='Hibernate'/><author><name>iCehaNgeR's hAcK NoteS</name><uri>http://www.blogger.com/profile/03757838076375432274</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5937173170152272619.post-356370067982355439</id><published>2007-06-07T20:36:00.001-07:00</published><updated>2007-06-08T04:41:46.168-07:00</updated><title type='text'>Struts</title><content type='html'>&lt;a name="h3"&gt;&lt;span class="atitle"&gt;Model-View-Controller (MVC)
&lt;/span&gt;&lt;/a&gt;&lt;a name="N10311"&gt;&lt;b&gt;MVC Model 2&lt;/b&gt;&lt;/a&gt;
&lt;img alt="MVC Model 2" src="http://www.ibm.com/developerworks/library/j-struts/mvc2.gif" height="170" width="410" /&gt;&lt;a name="h3"&gt;
&lt;/a&gt;&lt;ul&gt;&lt;li&gt; &lt;b&gt;Model&lt;/b&gt;
The model contains the core of the application's functionality. The model encapsulates the state of the application. Sometimes the only functionality it contains is state. It knows nothing about the view or controller. &lt;/li&gt;&lt;li&gt; &lt;b&gt;View&lt;/b&gt;
The view provides the presentation of the model. It is the &lt;i&gt;look&lt;/i&gt; of the application. The view can access the model getters, but it has no knowledge of the setters. In addition, it knows nothing about the controller. The view should be notified when changes to the model occur. &lt;/li&gt;&lt;li&gt; &lt;b&gt;Controller&lt;/b&gt;
The controller reacts to the user input. It creates and sets the model.&lt;/li&gt;&lt;/ul&gt;

          Model 1: - coupling of controller and view

JSP - Controller and a View
Java Bean - Model

Model 2: decoupling of controller and view

delegation of control is easier and therefore decoupling of the view lets you define and choose a technology and implementation for the view that you prefer

Servlet - Controller
Java Bean - Model
JSP (possible others like XSL) - View           

&lt;p&gt; &lt;/p&gt;
&lt;img src="http://www.ibm.com/i/v14/rules/blue_rule.gif" alt="" height="1" width="100%" /&gt;&lt;a name="h3"&gt;
&lt;span class="atitle"&gt;
&lt;/span&gt;&lt;/a&gt;1. Different classes in Struts.
2. Objects in struts
3. Steps in Struts with Flow and the Class

&lt;a name="N10325"&gt;&lt;b&gt;Figure 5. Struts overview&lt;/b&gt;&lt;/a&gt;
&lt;img alt="Struts overview" src="http://www.ibm.com/developerworks/library/j-struts/mvc2_struts.gif" height="170" width="410" /&gt;
&lt;p&gt; &lt;b&gt;Struts overview&lt;/b&gt; &lt;/p&gt;&lt;ul&gt;&lt;li&gt; &lt;b&gt;Client browser&lt;/b&gt;
An HTTP request from the client browser creates an event. The Web container will respond with an HTTP response. &lt;/li&gt;&lt;li&gt; &lt;b&gt;Controller&lt;/b&gt;
The Controller receives the request from the browser, and makes the decision where to send the request. With Struts, the Controller is a command design pattern implemented as a servlet. The &lt;code&gt;struts-config.xml&lt;/code&gt; file configures the Controller. &lt;/li&gt;&lt;li&gt; &lt;b&gt;Business logic&lt;/b&gt;
The business logic updates the state of the model and helps control the flow of the application. With Struts this is done with an &lt;code&gt;Action&lt;/code&gt; class as a thin wrapper to the actual business logic. &lt;/li&gt;&lt;li&gt; &lt;b&gt;Model state&lt;/b&gt;
The model represents the state of the application. The business objects update the application state. ActionForm bean represents the Model state at a session or request level, and not at a persistent level. The JSP file reads information from the ActionForm bean using JSP tags. &lt;/li&gt;&lt;li&gt; &lt;b&gt;View&lt;/b&gt;
The view is simply a JSP file. There is no flow logic, no business logic, and no model information -- just tags. Tags are one of the things that make Struts unique compared to other frameworks like Velocity.&lt;/li&gt;&lt;/ul&gt;&lt;a name="N103B7"&gt;&lt;b&gt;UML diagram of the relationship of the Command (ActionServlet) to the Model (Action)&lt;/b&gt;&lt;/a&gt;
&lt;img alt="Relationship of ActionServlet to Action" src="http://www.ibm.com/developerworks/library/j-struts/action_mapping.jpg" height="261" width="525" /&gt;
&lt;p&gt; &lt;b&gt;The &lt;code&gt;ActionMapping&lt;/code&gt; class&lt;/b&gt;
An incoming event is normally in the form of an HTTP request, which the servlet Container turns into an &lt;code&gt;HttpServletRequest&lt;/code&gt;. The Controller looks at the incoming event and dispatches the request to an &lt;code&gt;Action&lt;/code&gt; class. The &lt;code&gt;struts-config.xml&lt;/code&gt; determines what &lt;code&gt;Action&lt;/code&gt; class the Controller calls. The &lt;code&gt;struts-config.xml&lt;/code&gt; configuration information is translated into a set of &lt;code&gt;ActionMapping&lt;/code&gt;, which are put into container of &lt;code&gt;ActionMappings&lt;/code&gt;. (If you have not noticed it, classes that end with &lt;i&gt;s&lt;/i&gt; are containers)&lt;/p&gt;&lt;p&gt;The &lt;code&gt;ActionMapping&lt;/code&gt; contains the knowledge of how a specific event maps to specific &lt;code&gt;Actions&lt;/code&gt;. The &lt;code&gt;ActionServlet&lt;/code&gt; (Command) passes the &lt;code&gt;ActionMapping&lt;/code&gt; to the &lt;code&gt;Action&lt;/code&gt; class via the &lt;code&gt;perform()&lt;/code&gt; method. This allows &lt;code&gt;Action&lt;/code&gt; to access the information to control flow.&lt;/p&gt;&lt;p&gt; &lt;b&gt; &lt;code&gt;ActionMappings&lt;/code&gt; &lt;/b&gt;
&lt;code&gt;ActionMappings&lt;/code&gt; is a collection of &lt;code&gt;ActionMapping&lt;/code&gt; objects.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5937173170152272619-356370067982355439?l=icehanger.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icehanger.blogspot.com/feeds/356370067982355439/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5937173170152272619&amp;postID=356370067982355439' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/356370067982355439'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/356370067982355439'/><link rel='alternate' type='text/html' href='http://icehanger.blogspot.com/2007/06/struts.html' title='Struts'/><author><name>iCehaNgeR's hAcK NoteS</name><uri>http://www.blogger.com/profile/03757838076375432274</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5937173170152272619.post-23974542349664055</id><published>2007-06-07T20:35:00.004-07:00</published><updated>2009-07-23T07:08:56.895-07:00</updated><title type='text'>Spring.</title><content type='html'>1. Spring Layers
&lt;p&gt;
 *. Core Container:
The core container provides the fundamental functionality of Spring. It's primary component is the 'BeanFactory', an implementation of the Factory pattern. The BeanFactory applies the IOC pattern to separate an application's configuration and dependency specification from the actual application code.
&lt;/p&gt;

 *. Spring Context/Application Context:
&lt;p&gt;
The Spring context is a configuration file that provides context information to the Spring framework . The Spring context supplies enterprise services such as JNDI access, EJB integration, e-mail, internalization, validation, and scheduling functionality.
&lt;/p&gt;
 *. Spring AOP:(Aspect-Oriented)
&lt;p&gt;
The Spring AOP module integrates aspect-oriented programming functionality directly into the Spring framework, through its configuration management feature. As a result we can easily AOP-enable any object managed by the Spring framework. The Spring AOP module provides transaction management services for objects in any Spring-based application. With Spring AOP we can incorporate declarative transaction management into our applications without relying on EJB components.
The Spring AOP module also introduces metadata programming to Spring. Using this we can add annotation to the source code that instructs Spring on where and how to apply aspects.
&lt;/p&gt;
 *. Spring DAO:
&lt;p&gt;
The Spring's JDBC and DAO abstraction layer offers a meaningful exception hierarchy for managing the databaase connection, exception handling and error messages thrown by different database vendors. The exception hierarchy simplifies error handling and greatly reduces the amount of code that we need to write, such as opening and closing connections. This module also provide transaction management services for objects in a spring application.
&lt;/p&gt;
 *. Spring ORM:
&lt;p&gt;
The Spring framework can be integrated to  several ORM frameworks to provide Object Relational tool, including JDO, Hibernate, OJB and iBatis SQL Maps.
&lt;/p&gt;
 *. Spring Web module:
&lt;p&gt;
The Web context module builds on top of the application context module, providing contexts for Web-based applications. As a result, the Spring framework supports integration with Jakarta Struts, JSF and webworks. The Web module also eases the tasks of handling multipart requests and binding request parameters to domain objects.
&lt;/p&gt;
 *. Spring MVC Framework:
&lt;p&gt;
The MVC framework is a full-featured MVC implementation for building Web applications. The MVC framework is highly configurable via strategy interfaces and accommodates numerous view technologies including JSP, Velocity, Tiles and the generation of PDF and Excel Files.
&lt;/p&gt;

Declerative Management
&lt;p&gt;
We don't directly connect our components and services together in code but describe which services are needed by which components in a configuration file. A container is responsible for hooking it up. This concept is similar to 'Declarative Management'.
&lt;/P&gt;
Dependency Lookup:
&lt;p&gt;
The container provides callbacks to components and a lookup context. The managed objects are responsible for their other lookups

Dependency Injection:
In this application objects is not responsible for looking up resources they depend on. Instead IoC container configures the object externalizing resource lookup from application code into the container. That is, dependencies are injected into objects. Thus lookups are completely removed from application objects and it can be used outside the container also.
cle
&lt;/p&gt;
&lt;div class="mycode"&gt;
1. Spring methods

2. POJO
  Plain Old Java Objects
3. Object Decoupling

4. What is Inversion of control
  Model of a Beanfactory.

5. Object Injection

6. Describe Spring.

7. Steps in Spring

8. Some classes in Spring
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5937173170152272619-23974542349664055?l=icehanger.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icehanger.blogspot.com/feeds/23974542349664055/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5937173170152272619&amp;postID=23974542349664055' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/23974542349664055'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/23974542349664055'/><link rel='alternate' type='text/html' href='http://icehanger.blogspot.com/2007/06/spring.html' title='Spring.'/><author><name>iCehaNgeR's hAcK NoteS</name><uri>http://www.blogger.com/profile/03757838076375432274</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5937173170152272619.post-2961636767460170810</id><published>2007-06-07T20:35:00.003-07:00</published><updated>2007-06-07T20:35:39.474-07:00</updated><title type='text'>Session object in Servlet</title><content type='html'>HttpSession&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5937173170152272619-2961636767460170810?l=icehanger.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icehanger.blogspot.com/feeds/2961636767460170810/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5937173170152272619&amp;postID=2961636767460170810' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/2961636767460170810'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/2961636767460170810'/><link rel='alternate' type='text/html' href='http://icehanger.blogspot.com/2007/06/session-object-in-servlet.html' title='Session object in Servlet'/><author><name>iCehaNgeR's hAcK NoteS</name><uri>http://www.blogger.com/profile/03757838076375432274</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5937173170152272619.post-5966682980325454952</id><published>2007-06-07T20:35:00.001-07:00</published><updated>2007-06-14T20:50:46.628-07:00</updated><title type='text'>Servlet life cycle</title><content type='html'>init()
  doGet()
  doPost()
  destroy()

&lt;b&gt;&lt;span style="font-family: Arial;"&gt;What are the different cases for using   sendRedirect() vs. getRequestDispatcher()?&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;  &lt;p class="MsoNormal"&gt;   &lt;b&gt;&lt;span style="font-family: Arial;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt; &lt;/p&gt; &lt;p class="MsoNormal" style="margin-right: 0.5in; margin-left: 0.5in;"&gt;   &lt;span style="font-family: Arial;"&gt;When you want to preserve the current   request/response objects and transfer them to another resource WITHIN the   context, you must use getRequestDispatcher or getNamedDispatcher.   &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin: 5pt 0.5in;"&gt;   &lt;span style="font-family: Arial;"&gt;If you want to dispatch to resources OUTSIDE   the context, then you must use sendRedirect. In this case you won't be sending   the original request/response objects, but you will be sending a header asking   to the browser to issue a request to the new URL.
&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 5pt 0.5in;"&gt;
&lt;span style="font-family: Arial;"&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 5pt 0.5in;"&gt;&lt;span style="font-family: Arial;"&gt;http://faqs.javabeat.net/servlet/java-servlets-interview-questions-faqs-8.php
&lt;/span&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5937173170152272619-5966682980325454952?l=icehanger.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icehanger.blogspot.com/feeds/5966682980325454952/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5937173170152272619&amp;postID=5966682980325454952' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/5966682980325454952'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/5966682980325454952'/><link rel='alternate' type='text/html' href='http://icehanger.blogspot.com/2007/06/servlet-life-cycle.html' title='Servlet life cycle'/><author><name>iCehaNgeR's hAcK NoteS</name><uri>http://www.blogger.com/profile/03757838076375432274</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5937173170152272619.post-9057588696692108213</id><published>2007-06-07T20:34:00.003-07:00</published><updated>2007-06-07T20:34:59.838-07:00</updated><title type='text'>Methods in Servlet</title><content type='html'>ServletContext, HttpSession, ServletConfig&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5937173170152272619-9057588696692108213?l=icehanger.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icehanger.blogspot.com/feeds/9057588696692108213/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5937173170152272619&amp;postID=9057588696692108213' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/9057588696692108213'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/9057588696692108213'/><link rel='alternate' type='text/html' href='http://icehanger.blogspot.com/2007/06/methods-in-servlet.html' title='Methods in Servlet'/><author><name>iCehaNgeR's hAcK NoteS</name><uri>http://www.blogger.com/profile/03757838076375432274</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5937173170152272619.post-9055374858099471670</id><published>2007-06-07T20:34:00.001-07:00</published><updated>2009-04-07T19:45:46.639-07:00</updated><title type='text'>JSP/Servlet.</title><content type='html'>&lt;div class="mycode"&gt;
Implicit objects in JSP
 request - the HttpServletRequest associated with request. 
response - the HttpServletResponse associated with response to client. 
out - the JspWriter (PrintWriter subclass) used to send output to the client. 
session - the HttpSession object associated with request.
 application -the ServletContext as obtained by getServletConfig().getContext(). 
Shared by all servlets and JSP pages on server or in Web application.
 config - the ServletConfig object for this page.
 pageContext-the PageContext object associated with current page.
 page - synonym for this (current servlet instance); not very useful now. 
Placeholder for future.
 Context Application, Session , request, page.
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5937173170152272619-9055374858099471670?l=icehanger.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icehanger.blogspot.com/feeds/9055374858099471670/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5937173170152272619&amp;postID=9055374858099471670' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/9055374858099471670'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/9055374858099471670'/><link rel='alternate' type='text/html' href='http://icehanger.blogspot.com/2007/06/jspservlet.html' title='JSP/Servlet.'/><author><name>iCehaNgeR's hAcK NoteS</name><uri>http://www.blogger.com/profile/03757838076375432274</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5937173170152272619.post-171458198338304355</id><published>2007-06-07T20:33:00.002-07:00</published><updated>2007-06-07T20:34:03.473-07:00</updated><title type='text'>Pass By Value Pass By reference</title><content type='html'>Java pass everything by Value. Objects are manuplated by refrence though for methods its all Value.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5937173170152272619-171458198338304355?l=icehanger.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icehanger.blogspot.com/feeds/171458198338304355/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5937173170152272619&amp;postID=171458198338304355' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/171458198338304355'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/171458198338304355'/><link rel='alternate' type='text/html' href='http://icehanger.blogspot.com/2007/06/pass-by-value-pass-by-reference.html' title='Pass By Value Pass By reference'/><author><name>iCehaNgeR's hAcK NoteS</name><uri>http://www.blogger.com/profile/03757838076375432274</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5937173170152272619.post-1061136985094915327</id><published>2007-06-07T20:33:00.001-07:00</published><updated>2009-04-07T19:36:51.420-07:00</updated><title type='text'>When to use Vector? When to use ArrayList?</title><content type='html'>&lt;div class="mycode"&gt;
* ArrayList is faster when compared to Vector since ArrayList is unsynchronized. So, if the List will be modified by only one thread, use ArrayList. If the list  is a local variable, you can always use ArrayList.
 *If the List will be accessed by multiple threads, always use Vector, otherwise you should take care of synchronization manually.
&lt;/div&gt;

&lt;div class="mycode"&gt;
1. Use Vector if there are multiple threads and ArrayList if there is only a single thread.
2. Use Hashtable if there are multiple threads and HashMap if there is only a single thread.
3. Use StringBuffer if there are multiple threads and StringBuilder if there is only a single thread.

&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5937173170152272619-1061136985094915327?l=icehanger.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icehanger.blogspot.com/feeds/1061136985094915327/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5937173170152272619&amp;postID=1061136985094915327' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/1061136985094915327'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/1061136985094915327'/><link rel='alternate' type='text/html' href='http://icehanger.blogspot.com/2007/06/when-to-use-vector-when-to-use.html' title='When to use Vector? When to use ArrayList?'/><author><name>iCehaNgeR's hAcK NoteS</name><uri>http://www.blogger.com/profile/03757838076375432274</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5937173170152272619.post-5632292121564327918</id><published>2007-06-07T20:32:00.000-07:00</published><updated>2007-06-07T20:33:12.739-07:00</updated><title type='text'>ArrayList v/s Vector</title><content type='html'>Arraylist is not synchronized while vector is. (not thread safe)
  Arraylist has no default size while vector has a default size of 10.
  Arraylist don't define any increment size while vector does.
  ArrayList implements Iterator Interface for traversing While Vector implements Innumerator Interface for traverse.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5937173170152272619-5632292121564327918?l=icehanger.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icehanger.blogspot.com/feeds/5632292121564327918/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5937173170152272619&amp;postID=5632292121564327918' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/5632292121564327918'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/5632292121564327918'/><link rel='alternate' type='text/html' href='http://icehanger.blogspot.com/2007/06/arraylist-vs-vector.html' title='ArrayList v/s Vector'/><author><name>iCehaNgeR's hAcK NoteS</name><uri>http://www.blogger.com/profile/03757838076375432274</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5937173170152272619.post-7131333897952262046</id><published>2007-06-07T20:31:00.002-07:00</published><updated>2007-06-07T20:32:50.665-07:00</updated><title type='text'>Iterator</title><content type='html'>using

for loop

while loop&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5937173170152272619-7131333897952262046?l=icehanger.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icehanger.blogspot.com/feeds/7131333897952262046/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5937173170152272619&amp;postID=7131333897952262046' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/7131333897952262046'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/7131333897952262046'/><link rel='alternate' type='text/html' href='http://icehanger.blogspot.com/2007/06/iterator.html' title='Iterator'/><author><name>iCehaNgeR's hAcK NoteS</name><uri>http://www.blogger.com/profile/03757838076375432274</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5937173170152272619.post-6399126888654382915</id><published>2007-06-07T20:31:00.001-07:00</published><updated>2009-04-07T19:28:25.797-07:00</updated><title type='text'>Singleton</title><content type='html'>Creating only one instance of the class
&lt;div class="mycode"&gt;
With the Singleton design pattern you can:

    * Ensure that only one instance of a class is created
    * Provide a global point of access to the object
    * Allow multiple instances in the future without affecting a singleton class's clients

&lt;/div&gt;
&lt;div class="mycode"&gt;
public class ClassicSingleton {
   private static ClassicSingleton instance = null;
   protected ClassicSingleton() {
      // Exists only to defeat instantiation.
   }
   public static ClassicSingleton getInstance() {
      if(instance == null) {
         instance = new ClassicSingleton();
      }
      return instance;
   }
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5937173170152272619-6399126888654382915?l=icehanger.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icehanger.blogspot.com/feeds/6399126888654382915/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5937173170152272619&amp;postID=6399126888654382915' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/6399126888654382915'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/6399126888654382915'/><link rel='alternate' type='text/html' href='http://icehanger.blogspot.com/2007/06/singolten.html' title='Singleton'/><author><name>iCehaNgeR's hAcK NoteS</name><uri>http://www.blogger.com/profile/03757838076375432274</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5937173170152272619.post-3542549580643705212</id><published>2007-06-07T20:30:00.001-07:00</published><updated>2007-06-07T20:30:59.422-07:00</updated><title type='text'>Static Class</title><content type='html'>A static member class will have the static keyword&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5937173170152272619-3542549580643705212?l=icehanger.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icehanger.blogspot.com/feeds/3542549580643705212/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5937173170152272619&amp;postID=3542549580643705212' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/3542549580643705212'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/3542549580643705212'/><link rel='alternate' type='text/html' href='http://icehanger.blogspot.com/2007/06/static-class.html' title='Static Class'/><author><name>iCehaNgeR's hAcK NoteS</name><uri>http://www.blogger.com/profile/03757838076375432274</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5937173170152272619.post-6137359354413377725</id><published>2007-06-07T20:29:00.002-07:00</published><updated>2007-06-22T06:57:02.037-07:00</updated><title type='text'>Final , Finaly and Finalize</title><content type='html'>&lt;h3&gt;&lt;span style="font-family:Georgia;"&gt;Final data
&lt;/span&gt;&lt;/h3&gt; &lt;p&gt;&lt;span style="font-family:Georgia;"&gt;&lt;a name="Index565"&gt;&lt;/a&gt;&lt;a name="Index566"&gt;&lt;/a&gt;Many programming languages have a way to tell the compiler that a piece of data is “constant.” A constant is useful for two reasons:
&lt;/span&gt;&lt;/p&gt; &lt;ol&gt;&lt;span style="font-family:Georgia;"&gt;&lt;li&gt;&lt;a name="Index567"&gt;&lt;/a&gt;&lt;a name="Index568"&gt;&lt;/a&gt;&lt;a name="Index569"&gt;&lt;/a&gt;It can be a &lt;i&gt;compile-time constant&lt;/i&gt; that won’t ever change. &lt;/li&gt; &lt;li&gt;It can be a value initialized at run time that you don’t want changed.&lt;/li&gt;&lt;/span&gt;&lt;/ol&gt;&lt;span style="font-family:Georgia;"&gt;With a primitive, &lt;b&gt;final&lt;/b&gt; makes the &lt;i&gt;value&lt;/i&gt; a constant, but with an object reference, &lt;b&gt;final&lt;/b&gt; makes the &lt;i&gt;reference&lt;/i&gt; a constant. Once the reference is initialized to an object, it can never be changed to point to another object. However, the object itself can be modified; Java does not provide a way to make any arbitrary object a constant.


&lt;/span&gt;&lt;h3&gt;&lt;span style="font-family:Georgia;"&gt;Final methods&lt;/span&gt;&lt;/h3&gt; &lt;p&gt;&lt;span style="font-family:Georgia;"&gt;There are two reasons for &lt;a name="Index585"&gt;&lt;/a&gt;&lt;a name="Index586"&gt;&lt;/a&gt;&lt;b&gt;final&lt;/b&gt; methods. The first is to put a “lock” on the method to prevent any inheriting class from changing its meaning. This is done for design reasons when you want to make sure that a method’s behavior is retained during inheritance and cannot be overridden. &lt;span style=""&gt;&lt;a href="mailto:TIJ3@MindView.net?Subject=%5BTIJ3%5DChap06_976" title="Send BackTalk Comment"&gt;Feedback&lt;/a&gt;&lt;/span&gt;
&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family:Georgia;"&gt;The second reason for &lt;b&gt;final&lt;/b&gt; methods is efficiency. If you make a method &lt;b&gt;final&lt;/b&gt;, you are allowing the compiler to turn any calls to that method into &lt;a name="Index587"&gt;&lt;/a&gt;&lt;a name="Index588"&gt;&lt;/a&gt;&lt;i&gt;inline&lt;/i&gt; calls. When the compiler sees a &lt;b&gt;final&lt;/b&gt; method call, it can (at its discretion) skip the normal approach of inserting code to perform the method call mechanism (push arguments on the stack, hop over to the method code and execute it, hop back and clean off the stack arguments, and deal with the return value) and instead replace the method call with a copy of the actual code in the method body. This eliminates the overhead of the method call.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;
&lt;/p&gt;&lt;h3&gt;&lt;span style="font-family:Georgia;"&gt;Final classes
&lt;/span&gt;&lt;/h3&gt; &lt;p&gt;&lt;span style="font-family:Georgia;"&gt;&lt;a name="Index591"&gt;&lt;/a&gt;&lt;a name="Index592"&gt;&lt;/a&gt;When you say that an entire class is &lt;b&gt;final&lt;/b&gt; (by preceding its definition with the &lt;b&gt;final&lt;/b&gt; keyword), you state that you don’t want to inherit from this class or allow anyone else to do so. In other words, for some reason the design of your class is such that there is never a need to make any changes, or for safety or security reasons you don’t want subclassing&lt;/span&gt;&lt;/p&gt;&lt;span style="font-weight: bold;"&gt;Finaly&lt;/span&gt;

The &lt;code style="font-weight: bold;"&gt;finally&lt;/code&gt; block &lt;i&gt;always&lt;/i&gt; executes when the &lt;code&gt;try&lt;/code&gt; block exits. This ensures that the &lt;code&gt;finally&lt;/code&gt; block is executed even if an unexpected exception occurs. But &lt;code&gt;finally&lt;/code&gt; is useful for more than just exception handling — it allows the programmer to avoid having cleanup code accidentally bypassed by a &lt;code&gt;return&lt;/code&gt;, &lt;code&gt;continue&lt;/code&gt;, or &lt;code&gt;break&lt;/code&gt;.  Putting cleanup code in a &lt;code&gt;finally&lt;/code&gt; block is always a good practice, even when no exceptions are anticipated.

&lt;span style="font-weight: bold;"&gt;Finalize.&lt;/span&gt;

&lt;ul&gt;&lt;li&gt;every class inherits the &lt;b&gt;finalize()&lt;/b&gt; method from &lt;b&gt;java.lang.Object&lt;/b&gt; &lt;/li&gt;&lt;li&gt;the method is called by the garbage collector when it determines no more references to the object exist &lt;/li&gt;&lt;li&gt;the &lt;b&gt;Object&lt;/b&gt; finalize method performs no actions but it may be overridden by any class &lt;/li&gt;&lt;li&gt;normally it should be overridden to clean-up non-Java resources ie closing a file &lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5937173170152272619-6137359354413377725?l=icehanger.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icehanger.blogspot.com/feeds/6137359354413377725/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5937173170152272619&amp;postID=6137359354413377725' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/6137359354413377725'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/6137359354413377725'/><link rel='alternate' type='text/html' href='http://icehanger.blogspot.com/2007/06/finaly.html' title='Final , Finaly and Finalize'/><author><name>iCehaNgeR's hAcK NoteS</name><uri>http://www.blogger.com/profile/03757838076375432274</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5937173170152272619.post-3161967664897605101</id><published>2007-06-07T20:29:00.001-07:00</published><updated>2007-06-07T20:29:35.725-07:00</updated><title type='text'>UnChecked Exception</title><content type='html'>*"Unchecked runtime exceptions represent conditions that, generally speaking, reflect errors in your program's logic and cannot be reasonably recovered from at         run time."
    * are subclasses of RuntimeException, and are usually implemented using IllegalArgumentException, NullPointerException, or IllegalStateException
    * a method is not obliged to establish a policy for the unchecked exceptions thrown by its implementation.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5937173170152272619-3161967664897605101?l=icehanger.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icehanger.blogspot.com/feeds/3161967664897605101/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5937173170152272619&amp;postID=3161967664897605101' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/3161967664897605101'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/3161967664897605101'/><link rel='alternate' type='text/html' href='http://icehanger.blogspot.com/2007/06/unchecked-exception.html' title='UnChecked Exception'/><author><name>iCehaNgeR's hAcK NoteS</name><uri>http://www.blogger.com/profile/03757838076375432274</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5937173170152272619.post-3644202024798244372</id><published>2007-06-07T20:28:00.000-07:00</published><updated>2007-06-07T20:29:12.853-07:00</updated><title type='text'>Exception</title><content type='html'>Checked Exception
    * represent invalid conditions in areas outside the immediate control of the program (invalid user input, database problems, network outages, absent files)
    * are subclasses of Exception
    * a method is obliged to establish a policy for all checked exceptions thrown by its implementation (either pass the checked exception further up the stack, or handle it somehow)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5937173170152272619-3644202024798244372?l=icehanger.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icehanger.blogspot.com/feeds/3644202024798244372/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5937173170152272619&amp;postID=3644202024798244372' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/3644202024798244372'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/3644202024798244372'/><link rel='alternate' type='text/html' href='http://icehanger.blogspot.com/2007/06/exception.html' title='Exception'/><author><name>iCehaNgeR's hAcK NoteS</name><uri>http://www.blogger.com/profile/03757838076375432274</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5937173170152272619.post-6765589084064358631</id><published>2007-06-07T20:27:00.002-07:00</published><updated>2007-06-07T20:28:42.130-07:00</updated><title type='text'>Thread lifecycle</title><content type='html'>Extend the Abstract Class Thread or implement Runnabel
overide the run method.
call the start method to ivoke the run

start--&gt; run()
Yield method is used to allow other thread to use the resource.
sleep also can be used to pause for execution the thread

Demon Thread.
A demon thread is one that is supposed to provide a general service in the background as long as the program is running, this have to be called before start&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5937173170152272619-6765589084064358631?l=icehanger.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icehanger.blogspot.com/feeds/6765589084064358631/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5937173170152272619&amp;postID=6765589084064358631' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/6765589084064358631'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/6765589084064358631'/><link rel='alternate' type='text/html' href='http://icehanger.blogspot.com/2007/06/thread-lifecycle.html' title='Thread lifecycle'/><author><name>iCehaNgeR's hAcK NoteS</name><uri>http://www.blogger.com/profile/03757838076375432274</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5937173170152272619.post-1755495523947971150</id><published>2007-06-07T20:27:00.001-07:00</published><updated>2007-06-07T20:27:42.533-07:00</updated><title type='text'>Package</title><content type='html'>A Java package is a mechanism for organizing Java classes into namespaces
A package provides a unique namespace for the types it contains.
Classes in the same package can access each other's protected members.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5937173170152272619-1755495523947971150?l=icehanger.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icehanger.blogspot.com/feeds/1755495523947971150/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5937173170152272619&amp;postID=1755495523947971150' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/1755495523947971150'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/1755495523947971150'/><link rel='alternate' type='text/html' href='http://icehanger.blogspot.com/2007/06/package.html' title='Package'/><author><name>iCehaNgeR's hAcK NoteS</name><uri>http://www.blogger.com/profile/03757838076375432274</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5937173170152272619.post-8708064445989979563</id><published>2007-06-07T20:26:00.000-07:00</published><updated>2007-06-07T20:27:05.123-07:00</updated><title type='text'>Encapsulation.</title><content type='html'>Encapsulation is the ability of an object to be a container (or capsule) for related properties (ie. data variables) and methods (ie. functions).
Data hiding is the ability of objects to shield variables from external access. These private variables can only be seen or modified by use of object accessor and mutator methods.
Private, Public and Protected. usage of Package. etc.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5937173170152272619-8708064445989979563?l=icehanger.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icehanger.blogspot.com/feeds/8708064445989979563/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5937173170152272619&amp;postID=8708064445989979563' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/8708064445989979563'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/8708064445989979563'/><link rel='alternate' type='text/html' href='http://icehanger.blogspot.com/2007/06/encapsulation.html' title='Encapsulation.'/><author><name>iCehaNgeR's hAcK NoteS</name><uri>http://www.blogger.com/profile/03757838076375432274</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5937173170152272619.post-3946160921907613696</id><published>2007-06-07T20:24:00.000-07:00</published><updated>2007-06-07T20:25:39.660-07:00</updated><title type='text'>Polymorphisms</title><content type='html'>Polymorphisms is the capability of an action or method to do different things based on the object that it is acting upon. method overloading , overriding and dynamic method binding.

Overloading
It happens in same Class.
method name should be the same but argument and return type can change


Overriding

It happens in the derived Class with specif new definition
should have same method name , argument and return type like the parent class.


Dynamic Binding
A mechanism by which, when the compiler can't determine which method implementation to use in advance, the runtime system (JVM) selects the appropriate method at runtime, based on the class of the object&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5937173170152272619-3946160921907613696?l=icehanger.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icehanger.blogspot.com/feeds/3946160921907613696/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5937173170152272619&amp;postID=3946160921907613696' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/3946160921907613696'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/3946160921907613696'/><link rel='alternate' type='text/html' href='http://icehanger.blogspot.com/2007/06/polymorphisms.html' title='Polymorphisms'/><author><name>iCehaNgeR's hAcK NoteS</name><uri>http://www.blogger.com/profile/03757838076375432274</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5937173170152272619.post-6836093079612247309</id><published>2007-06-07T20:23:00.000-07:00</published><updated>2007-06-07T20:24:19.096-07:00</updated><title type='text'>Inheritance</title><content type='html'>Inheritance is the capability of a class to use the properties and methods of another class while adding its own functionality. An example of where this could be  useful is with an employee records system. You could create a generic employee class with states and actions that are common to all employees. Then more specific classes could be defined for salaried, commissioned and hourly employees. The generic class is known as the parent (or superclass or base class) and the specific classes as children (or subclasses or derived classes). The concept of inheritance greatly enhances the ability to reuse code as well as making design a much simpler and cleaner process.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5937173170152272619-6836093079612247309?l=icehanger.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icehanger.blogspot.com/feeds/6836093079612247309/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5937173170152272619&amp;postID=6836093079612247309' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/6836093079612247309'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/6836093079612247309'/><link rel='alternate' type='text/html' href='http://icehanger.blogspot.com/2007/06/inheritance.html' title='Inheritance'/><author><name>iCehaNgeR's hAcK NoteS</name><uri>http://www.blogger.com/profile/03757838076375432274</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5937173170152272619.post-410468126426072075</id><published>2007-06-07T20:22:00.000-07:00</published><updated>2007-06-07T20:23:40.205-07:00</updated><title type='text'>OOPS !</title><content type='html'>Corner Stone.

Polymorphisms , Inheritance, Encapsulation&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5937173170152272619-410468126426072075?l=icehanger.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icehanger.blogspot.com/feeds/410468126426072075/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5937173170152272619&amp;postID=410468126426072075' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/410468126426072075'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/410468126426072075'/><link rel='alternate' type='text/html' href='http://icehanger.blogspot.com/2007/06/oops.html' title='OOPS !'/><author><name>iCehaNgeR's hAcK NoteS</name><uri>http://www.blogger.com/profile/03757838076375432274</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5937173170152272619.post-4997292718264284187</id><published>2007-06-07T20:21:00.001-07:00</published><updated>2007-06-07T20:21:53.251-07:00</updated><title type='text'>Object</title><content type='html'>2. What is an Object
   An Object is a instance of class.
   An Object has state, behavior and identity.

Object Class
The Object class is the superclass of Java. All other classes are subclasses of the Object class. The object class includes methods such as:
clone()    finalize()    hashCode()    toString()
copy(Object src)    getClass()    notifyAll()     wait()&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5937173170152272619-4997292718264284187?l=icehanger.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icehanger.blogspot.com/feeds/4997292718264284187/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5937173170152272619&amp;postID=4997292718264284187' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/4997292718264284187'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/4997292718264284187'/><link rel='alternate' type='text/html' href='http://icehanger.blogspot.com/2007/06/object.html' title='Object'/><author><name>iCehaNgeR's hAcK NoteS</name><uri>http://www.blogger.com/profile/03757838076375432274</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5937173170152272619.post-6987413431089894843</id><published>2007-06-07T20:17:00.000-07:00</published><updated>2007-06-07T20:20:34.893-07:00</updated><title type='text'>Class</title><content type='html'>1. What is a Class

 * Class describes a set of objects that have identical characteristics (data elements) and behaviors (functionality).
 * A class is a definition or prototype whereas an object is an instance or living representation of the prototype.
 * A class specifies the properties (data) and methods (actions) that objects can work with. It is a template or prototype for each of many objects made to the class design.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5937173170152272619-6987413431089894843?l=icehanger.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icehanger.blogspot.com/feeds/6987413431089894843/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5937173170152272619&amp;postID=6987413431089894843' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/6987413431089894843'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5937173170152272619/posts/default/6987413431089894843'/><link rel='alternate' type='text/html' href='http://icehanger.blogspot.com/2007/06/class.html' title='Class'/><author><name>iCehaNgeR's hAcK NoteS</name><uri>http://www.blogger.com/profile/03757838076375432274</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry></feed>
