<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Skill-Guru</title>
	<atom:link href="http://www.skill-guru.com/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.skill-guru.com/blog</link>
	<description>Demonstrate and share your knowledge</description>
	<lastBuildDate>Thu, 11 Mar 2010 18:34:58 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>JNDI lookup on JBoss</title>
		<link>http://www.skill-guru.com/blog/2010/03/11/jndi-lookup-on-jboss/</link>
		<comments>http://www.skill-guru.com/blog/2010/03/11/jndi-lookup-on-jboss/#comments</comments>
		<pubDate>Thu, 11 Mar 2010 15:50:54 +0000</pubDate>
		<dc:creator>sadhna</dc:creator>
				<category><![CDATA[Programming / tutorials]]></category>
		<category><![CDATA[EJB]]></category>
		<category><![CDATA[j2ee]]></category>
		<category><![CDATA[jndi]]></category>

		<guid isPermaLink="false">http://www.skill-guru.com/blog/?p=1733</guid>
		<description><![CDATA[




There is no standard way as per Java EE specs for  JNDI naming conventions, hence most of the application servers have their own way of JNDI naming.
On specifying a Datasource&#8217;s JNDI name as &#8216;myDatasource&#8217;, JBoss binds as &#8216;java:myDatasource&#8217;. So if one want to deploy the application on Jboss application servers then can use the simplest [...]]]></description>
			<content:encoded><![CDATA[<p>There is no standard way as per Java EE specs for  JNDI naming conventions, hence most of the application servers have their own way of JNDI naming.</p>
<p>On specifying a Datasource&#8217;s JNDI name as &#8216;myDatasource&#8217;, JBoss binds as &#8216;java:myDatasource&#8217;. So if one want to deploy the application on Jboss application servers then can use the simplest way is here. The steps for adding and using jndi Datasource to JBOSS 4.x is as under-</p>
<ul>
<li>Copy the jdbc driver to JBOSS_HOME/server/default/lib.</li>
</ul>
<ul>
<li>Create the jndi xml file for datasource – example ds.xml <span id="more-1733"></span></li>
</ul>
<p><em> &lt;?xml version=</em><em>&#8220;1.0&#8243; encoding=</em><em>&#8220;UTF-8&#8243;?&gt;</em></p>
<p><em>&lt;datasources&gt;</em></p>
<p><em>&lt;local-tx-datasource&gt;</em></p>
<p><em>&lt;jndi-name&gt;myDataSource&lt;/jndi-name&gt;</em></p>
<p><em>&lt;connection-url&gt;jdbc:sqlserver://10.0.120.109:1199;databaseName= Systest;<span style="text-decoration: underline;">lastupdatecount</span>=false;socketKeepAlive=true&lt;/connection-url&gt;</em></p>
<p><em>&lt;driver-class&gt;com.microsoft.sqlserver.jdbc.SQLServerDriver</em></p>
<p><em>&lt;/driver-class&gt;</em></p>
<p><em>&lt;min-pool-size&gt;5&lt;/min-pool-size&gt;</em></p>
<p><em>&lt;max-pool-size&gt;20&lt;/max-pool-size&gt;</em></p>
<p><em>&lt;user-name&gt;<span style="text-decoration: underline;">user</span>&lt;/user-name&gt;</em></p>
<p><em>&lt;password&gt;<span style="text-decoration: underline;">password</span>&lt;/password&gt;</em></p>
<p><em>&lt;check-valid-connection-sql&gt;SELECT 1&lt;/check-valid-connection-sql&gt;</em></p>
<p><em>&lt;metadata&gt;</em></p>
<p><em>&lt;type-mapping&gt;MS SQLSERVER2000&lt;/type-mapping&gt;</em></p>
<p><em>&lt;/metadata&gt;</em></p>
<p><em>&lt;/local-tx-datasource&gt;</em></p>
<p><em>&lt;/datasources&gt;</em></p>
<ul>
<li>Copy the ds.xml to JBOSS_HOME/server/default/deploy</li>
</ul>
<ul>
<li>Now we  look this up using <strong>java:jndi-name</strong> in our java code as in below example. it Works perfect. Example—</li>
</ul>
<p><strong> </strong></p>
<p><em><strong>public</strong> <strong>static</strong> Connection GetSqlServerConnection() {</em></p>
<p><em>java.sql.Connection conn = <strong>null</strong>;</em></p>
<p><em><strong>try</strong> {</em></p>
<p><em>Context initContext = <strong>new</strong> InitialContext();</em></p>
<p><em>javax.sql.DataSource ds = (javax.sql.DataSource)initContext.lookup(&#8220;java:myDataSource&#8221;);</em></p>
<p><em>conn = ds.getConnection();</em></p>
<p><em><strong>return</strong> conn;</em></p>
<p><em>}</em></p>
<p><em><strong> catch</strong> (javax.naming.NamingException nex) {</em></p>
<p><em>nex.printStackTrace();</em></p>
<p><em>logger.error(nex.getMessage(), nex);</em></p>
<p><em><strong>return</strong> <strong>null</strong>;</em></p>
<p><em>}</em></p>
<p><em><strong>catch</strong> (Exception e) {</em></p>
<p><em>e.printStackTrace();</em></p>
<p><em>logger.error(e.getMessage(), e);</em></p>
<p><em><strong>return</strong> <strong>null</strong>;</em></p>
<p><em>}</em></p>
<p><em>}</em></p>
<p>Now For compatibility with other containers, we can move the  jndi-datasource to for example  <strong>java:comp/ jdbc/jndi-name</strong> location then we need to add the &lt;resource-ref&gt; for jndi name to  <strong>jboss-web.xml &amp; web.xml.</strong><ins datetime="2010-03-11T15:42:29+00:00"></ins></p>
]]></content:encoded>
			<wfw:commentRss>http://www.skill-guru.com/blog/2010/03/11/jndi-lookup-on-jboss/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Debug Maven tests running inside eclipse</title>
		<link>http://www.skill-guru.com/blog/2010/03/01/debug-maven-tests-running-inside-eclipse/</link>
		<comments>http://www.skill-guru.com/blog/2010/03/01/debug-maven-tests-running-inside-eclipse/#comments</comments>
		<pubDate>Tue, 02 Mar 2010 02:52:25 +0000</pubDate>
		<dc:creator>Vinay</dc:creator>
				<category><![CDATA[Programming / tutorials]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[maven]]></category>

		<guid isPermaLink="false">http://www.skill-guru.com/blog/?p=1715</guid>
		<description><![CDATA[For those of us who have been running JUnit tests inside eclipse , one of the biggest feature available to us was the debug ability of the JUnit tests.
When we started working on Maven tests , the first questions which came to mind was , How am I going to debug it ?
I started with [...]]]></description>
			<content:encoded><![CDATA[<p>For those of us who have been running JUnit tests inside eclipse , one of the biggest feature available to us was the debug ability of the JUnit tests.<br />
When we started working on Maven tests , the first questions which came to mind was , How am I going to debug it ?<br />
I started with running the tests class by selecting the class in eclipse and right &#8211;&gt; <strong>Run as Junit Test</strong>.</p>
<p>But this does not work. There are some variables which are being injected through pom.xml and tons of other dependency bugs which would be thrown.</p>
<p>So here is how to run your units tests in debug mode while running through mvn command.  There are two steps to this. You will have to first set up a remote launcher, similar to the way you might have done for remote server.</p>
<p>Then you will run the tests from command prompt or</p>
<p><strong>Create Remote Java Application Debug Configurations <span id="more-1715"></span><br />
</strong></p>
<p>Create a debug configuration let us say &#8220;Maven Debug&#8221;</p>
<p>Run &gt; Debug&#8230; and then right click on Remote Java Application and chose New Launch Configuration. Save the this new configuration as &#8220;Maven Debug&#8221;.  On the Connect tab click the Browse&#8230; button and select the &#8220;Maven Debug&#8221; project. Make sure that the Connection Properties &gt; Port is 8000 and host is localhost . (This matches the address value set on the MAVEN_OPTS command line in the mvndebug.bat file from above. mvndebug.bat file can be found under bin in your installation directory)</p>
<p>This has set up your Maven remote launch.</p>
<p><strong>Running maven Tests</strong></p>
<p>On the command prompt go to the project where your test class resides. for eg c:/development/maven/skillMaven</p>
<p>Run <strong>mvnDebug -DforkMode=never test -Dtest=ShiftListFormActionTest</strong></p>
<p>You can run all the test cases or only selected test from here.</p>
<p>If you want to run all the tests</p>
<p><strong>mvnDebug -DforkMode=never test</strong></p>
<p>After you run this command , you will see</p>
<p><em>Preparing to Execute Maven in Debug Mode<br />
Listening for transport dt_socket at address: 8000</em></p>
<p>Now go to <strong>eclipse</strong> and click on <strong>Maven Launch</strong> configuration created above .</p>
<p>This will launch the debugger in Maven.</p>
<p>And now you will the action happening in the command prompt and Vola..test hits the debugger</p>
<p>Why are we using <strong>-DforkMode=never ? </strong>By default, Maven runs your tests in a separate (&#8220;forked&#8221;) process.<br />
You can force Maven not to fork tests by configuring the forkMode configuration parameter</p>
<p><strong>mvnDebug -DforkMode=never test</strong></p>
<p>Some reference sites which I had used and you might find helpful are</p>
<p>http://docs.codehaus.org/display/MAVENUSER/Dealing+with+Eclipse-based+IDE</p>
<p>http://maven.apache.org/plugins/maven-surefire-plugin/examples/debugging.html</p>
]]></content:encoded>
			<wfw:commentRss>http://www.skill-guru.com/blog/2010/03/01/debug-maven-tests-running-inside-eclipse/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Fatal error: wp-includes/vars.php on line 16</title>
		<link>http://www.skill-guru.com/blog/2010/02/27/fatal-error-wp-includesvars-php-on-line-16/</link>
		<comments>http://www.skill-guru.com/blog/2010/02/27/fatal-error-wp-includesvars-php-on-line-16/#comments</comments>
		<pubDate>Sat, 27 Feb 2010 19:49:55 +0000</pubDate>
		<dc:creator>Vinay</dc:creator>
				<category><![CDATA[Programming / tutorials]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.skill-guru.com/blog/?p=1710</guid>
		<description><![CDATA[If you are upgrading to wordpress 2.9, you might get this error Fatal error: wp-includes/vars.php .
Some people get this error when they do an automatic upgrade. I got this error when doing upgrade manually.
Reason : Some of the files were not copied correctly. You would keep your wp-config.php  and contents folder. Rest all the files [...]]]></description>
			<content:encoded><![CDATA[<p>If you are upgrading to wordpress 2.9, you might get this error <strong>Fatal error: wp-includes/vars.php</strong> .</p>
<p>Some people get this error when they do an automatic upgrade. I got this error when doing upgrade manually.</p>
<p><strong>Reason </strong>: Some of the files were not copied correctly. You would keep your wp-config.php  and contents folder. Rest all the files and folders need to be replaced.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.skill-guru.com/blog/2010/02/27/fatal-error-wp-includesvars-php-on-line-16/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Free Schedule D generator with Wash Sale Calculation</title>
		<link>http://www.skill-guru.com/blog/2010/02/24/free-schedule-d-generator-with-wash-sale-calculation/</link>
		<comments>http://www.skill-guru.com/blog/2010/02/24/free-schedule-d-generator-with-wash-sale-calculation/#comments</comments>
		<pubDate>Wed, 24 Feb 2010 19:18:20 +0000</pubDate>
		<dc:creator>Vinay</dc:creator>
				<category><![CDATA[Miscellaneous]]></category>
		<category><![CDATA[Schedule D]]></category>
		<category><![CDATA[tax return]]></category>

		<guid isPermaLink="false">http://www.skill-guru.com/blog/?p=1694</guid>
		<description><![CDATA[If your broker provides a .txf file for your stock transactions and you do not want to spend big bucks on turbo tax, use the simple Schedule D generator excel sheet below.
ScheduleD_Generator
Steps to generate wash sale and schedule D 1. Download latest txf file from your broker site save in a directory
2. Download the Schedule [...]]]></description>
			<content:encoded><![CDATA[<p>If your broker provides a .txf file for your stock transactions and you do not want to spend big bucks on turbo tax, use the simple Schedule D generator excel sheet below.</p>
<p><a href="http://www.skill-guru.com/blog/wp-content/uploads/2010/02/ScheduleD1_Generator1.xls">ScheduleD_Generator</a></p>
<p>Steps to generate wash sale and schedule D <span id="more-1694"></span>1. Download latest txf file from your broker site save in a directory<br />
2. Download the Schedule D generator excel file and save in a directory</p>
<p>3. Open Schedule D generator excel and press &#8220;Ctrl+Shift+J&#8221;</p>
<p>4. It will open a location for you on your computer. Point it to the directory where you have saved .txf file and select the file</p>
<p>5. Boom .. the magic starts. At the end it will prompt &#8220;Process Completed.  Want to generate Schedule D ? &#8221;</p>
<p>6. Say yes.</p>
<p>7. Enter your name and SSN and it will generate the Schedule D for you</p>
<p>What is Schedule D generator doing on <a href="../../">Skill-Guru</a> ?</p>
<p>Thanks to <a href="http://wow-itscool.blogspot.com/">Jatin</a> , an enthusiastic programmer with a very good understanding of finances and tax returns who created this excel sheet program for himself and then donated to our readers.</p>
<p>PS: Jatin send us an updated version of Schedule d1 generator which works for all .txf file provided by any broker like Scottrade,  Ameritrade.  We have updated the above link with new file.  Thanks Jatin !</p>
]]></content:encoded>
			<wfw:commentRss>http://www.skill-guru.com/blog/2010/02/24/free-schedule-d-generator-with-wash-sale-calculation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>One-to-One mapping in Hibernate using Foreign Key Association</title>
		<link>http://www.skill-guru.com/blog/2010/02/16/one-to-one-mapping-in-hibernate-using-foreign-key-association/</link>
		<comments>http://www.skill-guru.com/blog/2010/02/16/one-to-one-mapping-in-hibernate-using-foreign-key-association/#comments</comments>
		<pubDate>Tue, 16 Feb 2010 09:56:26 +0000</pubDate>
		<dc:creator>smitha</dc:creator>
				<category><![CDATA[Education]]></category>
		<category><![CDATA[Programming / tutorials]]></category>
		<category><![CDATA[hibernate]]></category>

		<guid isPermaLink="false">http://www.skill-guru.com/blog/?p=1689</guid>
		<description><![CDATA[One-to-One mapping can be done in 2 ways:

Primary key association:
Foreign key association.

My previous post described about the Primary key one-to-one mapping in Hibernate. This post gives an example of Foreign key one-to-one association in Hibernate.
In Foreign key one-to-one mapping,  2 entities will have one to one association using foreign keys. one  table holds primary key of 2nd [...]]]></description>
			<content:encoded><![CDATA[<p>One-to-One mapping can be done in 2 ways:</p>
<ol>
<li><a href="http://www.skill-guru.com/blog/2010/02/08/one-to-one-mapping-in-hibernate/">Primary key association</a>:</li>
<li>Foreign key association.</li>
</ol>
<p>My <a href="http://www.skill-guru.com/blog/2010/02/08/one-to-one-mapping-in-hibernate/">previous post </a>described about the Primary key one-to-one mapping in Hibernate. This post gives an example of Foreign key one-to-one association in Hibernate.<span id="more-1689"></span></p>
<p>In Foreign key one-to-one mapping,  2 entities will have one to one association using foreign keys. one  table holds primary key of 2nd table. Eg: consider Customer and address entities. In primary key association,  both the tables share same primary key. In foreign key association, customer table will have a address_id columns, in which primary key (address_id) of the customer’s address will be saved. Both customer and address tables will have different primary keys.</p>
<p>The tables would look like below:</p>
<p><strong><strong>create table address(<br />
    address_id int(11) not null auto_increment,<br />
    address_line1 varchar(100) not null,<br />
    address_line2 varchar(100),<br />
    city varchar(50) not null,<br />
    state varchar(50) not null,<br />
    pincode int(10) not null,<br />
    primary key(address_id));</strong></strong></p>
<p><strong></strong> </p>
<p><strong>create table customer(<br />
    customer_id int(11) not null auto_increment,<br />
    name varchar(50) not null,<br />
    email_id varchar(100),<br />
    contact_no varchar(20),<br />
    address_id int(11),<br />
    primary key(customer_id),<br />
    foreign key(address_id) references address(address_id));</strong></p>
<p><strong></strong> </p>
<p>Address is a simple table and customer table contains a column to store the corresponding address_id.</p>
<p>Corresponding Beans would be with following fields and their getter and setter methods:</p>
<blockquote><p>public class Address {</p>
<p> long addressId;<br />
 String addressLine1;<br />
 String addressLine2;<br />
 String city;<br />
 String state;<br />
 Integer pincode;<br />
 Customer customer;</p></blockquote>
<p> </p>
<blockquote><p>public class Customer {<br />
 Long customerId;<br />
    String name;<br />
    String emailAddress;<br />
    String contactNo;<br />
    Address address;</p></blockquote>
<p> </p>
<p>The Hibernate mapping files would look like below:</p>
<p>Address.hbm.xml:</p>
<blockquote><p>&lt;?xml version=&#8221;1.0&#8243;?&gt;<br />
&lt;!DOCTYPE hibernate-mapping PUBLIC<br />
&#8220;-//Hibernate/Hibernate Mapping DTD 3.0//EN&#8221;<br />
&#8220;<a href="http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd</a>&#8220;&gt;</p>
<p>&lt;hibernate-mapping&gt;<br />
  &lt;class name=&#8221;entities.Address&#8221; table=&#8221;ADDRESS&#8221;&gt;<br />
    &lt;id name=&#8221;addressId&#8221; type=&#8221;long&#8221; column=&#8221;address_id&#8221; &gt;<br />
     &lt;generator/&gt;<br />
  &lt;/id&gt;<br />
  <br />
  &lt;property name=&#8221;addressLine1&#8243;&gt;<br />
     &lt;column name=&#8221;address_line1&#8243; /&gt;<br />
    &lt;/property&gt;<br />
   <br />
    &lt;property name=&#8221;addressLine2&#8243;&gt;<br />
     &lt;column name=&#8221;address_line2&#8243; /&gt;<br />
    &lt;/property&gt;<br />
   <br />
    &lt;property name=&#8221;city&#8221;&gt;<br />
     &lt;column name=&#8221;city&#8221; /&gt;<br />
    &lt;/property&gt;<br />
   <br />
    &lt;property name=&#8221;state&#8221;&gt;<br />
     &lt;column name=&#8221;state&#8221; /&gt;<br />
    &lt;/property&gt;<br />
   <br />
    &lt;property name=&#8221;pincode&#8221;&gt;<br />
     &lt;column name=&#8221;pincode&#8221; /&gt;<br />
    &lt;/property&gt;<br />
  &lt;/class&gt;<br />
&lt;/hibernate-mapping&gt;</p></blockquote>
<p> </p>
<p>address.hbm.xml is simple and there is no much complications.</p>
<p>Customer.hbm.xml:</p>
<blockquote><p>&lt;?xml version=&#8221;1.0&#8243;?&gt;<br />
&lt;!DOCTYPE hibernate-mapping PUBLIC<br />
&#8220;-//Hibernate/Hibernate Mapping DTD 3.0//EN&#8221;<br />
&#8220;<a href="http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd</a>&#8220;&gt;</p>
<p>&lt;hibernate-mapping&gt;<br />
  &lt;class name=&#8221;entities.Customer&#8221; table=&#8221;CUSTOMER&#8221;&gt;<br />
    &lt;id name=&#8221;customerId&#8221; type=&#8221;long&#8221; column=&#8221;customer_id&#8221; &gt;<br />
     &lt;generator/&gt;<br />
  &lt;/id&gt;<br />
  <br />
  &lt;property name=&#8221;name&#8221;&gt;<br />
     &lt;column name=&#8221;NAME&#8221; /&gt;<br />
    &lt;/property&gt;<br />
   <br />
    &lt;property name=&#8221;emailAddress&#8221;&gt;<br />
     &lt;column name=&#8221;email_id&#8221; /&gt;<br />
    &lt;/property&gt;<br />
   <br />
    &lt;property name=&#8221;contactNo&#8221;&gt;<br />
     &lt;column name=&#8221;contact_no&#8221; /&gt;<br />
    &lt;/property&gt;</p>
<p>    <strong>&lt;many-to-one name=&#8221;address&#8221;<br />
                column=&#8221;address_id&#8221;<br />
                cascade=&#8221;all&#8221;  unique=&#8221;true&#8221;<br />
                /&gt;<br />
</strong>  &lt;/class&gt;<br />
&lt;/hibernate-mapping&gt;</p></blockquote>
<p> </p>
<p>Point to note here is the Many-to-one tag. We are associating the entities with one-to-one but we are using a many-to-one tag. When using many-to-one in one-to-one mapping, we ignore the ‘many’ part. We are not caring how many address are bound to a customer, but here we ensure that only one customer (to-one part) is bound to an address.</p>
<p>In customer class, by defining the address variable as below:</p>
<p> Address address;</p>
<p> (As its not a List/Set or collection) we ensure that its just an one-to-one relationship.</p>
<p> Now we can test it using following code:</p>
<p>// save customer<br />
         Customer customer = new Customer();<br />
         customer.setName(&#8220;Surya&#8221;);<br />
         customer.setEmailAddress(&#8220;<a href="mailto:surya@gmail.com">surya@gmail.com</a>&#8220;);<br />
         customer.setContactNo(&#8220;91-932686876&#8243;);<br />
         Address address = new Address();<br />
         address.setAddressLine1(&#8220;xxx-street, near Surya Complex&#8221;);<br />
         address.setCity(&#8220;Pune&#8221;);<br />
         address.setState(&#8220;Maharashtra&#8221;);<br />
         address.setPincode(11111);<br />
        <br />
         customer.setAddress(address);<br />
         address.setCustomer(customer);<br />
         session.save(customer);</p>
<p>   //fetch all customers<br />
           <br />
            Query query = session.createQuery(&#8220;from Customer customer&#8221;);<br />
            for(Iterator it=query.iterate();it.hasNext();){<br />
             Customer customer1 = (Customer) it.next();<br />
             Address address1 = customer1.getAddress();<br />
                System.out.println(&#8220;customer ID: &#8221; + customer1.getCustomerId());<br />
                System.out.println(&#8220;Name: &#8221; + customer1.getName());<br />
                System.out.println(&#8220;address: &#8221; + address1.getAddressLine1());<br />
                System.out.println(address1.getAddressId());<br />
                System.out.println(address1.getAddressLine2());<br />
                System.out.println(address1.getCity());<br />
                System.out.println(address1.getState());<br />
                System.out.println(address1.getPincode());<br />
              }</p>
<p> </p>
<p>To download full code of above example please <a href="http://www.skill-guru.com/blog/wp-content/uploads/2010/02/HibernateExample1.zip">click here.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.skill-guru.com/blog/2010/02/16/one-to-one-mapping-in-hibernate-using-foreign-key-association/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mapping Composite Keys in Hibernate</title>
		<link>http://www.skill-guru.com/blog/2010/02/10/mapping-composite-keys-in-hibernate/</link>
		<comments>http://www.skill-guru.com/blog/2010/02/10/mapping-composite-keys-in-hibernate/#comments</comments>
		<pubDate>Wed, 10 Feb 2010 10:57:11 +0000</pubDate>
		<dc:creator>smitha</dc:creator>
				<category><![CDATA[Programming / tutorials]]></category>
		<category><![CDATA[hibernate]]></category>

		<guid isPermaLink="false">http://www.skill-guru.com/blog/?p=1682</guid>
		<description><![CDATA[In Real world applications it is natural to have tables with composite keys. The row will be identified with combination of key  column values of a row.
Consider Following scenario:
A test selling website defines tests and customers.

create table test(
test_id int(11) not null auto_increment,
test_name varchar(100),
test_desc varchar(150),
test_questions varchar(5),
primary key(test_id));
create table customer(
    customer_id int(11) not null auto_increment,
    name varchar(50) [...]]]></description>
			<content:encoded><![CDATA[<p>In Real world applications it is natural to have tables with composite keys. The row will be identified with combination of key  column values of a row.</p>
<p>Consider Following scenario:</p>
<p>A test selling website defines tests and customers.</p>
<p><span id="more-1682"></span></p>
<blockquote><p>create table test(<br />
test_id int(11) not null auto_increment,<br />
test_name varchar(100),<br />
test_desc varchar(150),<br />
test_questions varchar(5),<br />
primary key(test_id));</p>
<p>create table customer(<br />
    customer_id int(11) not null auto_increment,<br />
    name varchar(50) not null,<br />
    email_id varchar(100),<br />
    contact_no varchar(20),<br />
    primary key(customer_id));</p></blockquote>
<p>To keep track of tests purchased by customers it maintains following table:</p>
<blockquote><p>create table tests_purchased(<br />
customer_id int(11) not null,<br />
test_id int(11) not null,<br />
created_date datetime not null,<br />
primary key(customer_id, test_id));</p></blockquote>
<p>Primary key of this table is combination of customer and test id.<br />
To map such classes we have to use &lt;composite-key&gt; tag.  Both the test_id and customer_id acts as identifier to the tests_purchased table.</p>
<p>In hibernate we use session.load (entityClass, id_type_object) to find and load the entity using primary key. In case of composite keys, the id object should be a separate ‘id ‘ class (in above case a PurchasedTestId class)  which just declares the primary key attributes, something like below:</p>
<blockquote><p>package entities;<br />
import java.io.Serializable;<br />
public class PurchasedTestId <strong>implements Serializable</strong>{<br />
  private Long testId;<br />
  private Long customerId;<br />
  // an easy initializing constructor<br />
    <strong>public PurchasedTestId(Long testId, Long customerId){<br />
     this.testId = testId;<br />
     this.customerId = customerId;<br />
    }<br />
</strong> public Long getTestId() {<br />
  return testId;<br />
 }<br />
 public void setTestId(Long testId) {<br />
  this.testId = testId;<br />
 }<br />
 public Long getCustomerId() {<br />
  return customerId;<br />
 }<br />
 public void setCustomerId(Long customerId) {<br />
  this.customerId = customerId;<br />
 }<br />
 @Override<br />
 <strong>public boolean equals(Object arg0) {<br />
  if(arg0 == null) return false;<br />
  if(!(arg0 instanceof PurchasedTestId)) return false;<br />
  PurchasedTestId arg1 = (PurchasedTestId) arg0;<br />
  return (this.testId.longValue() == arg1.getTestId().longValue()) &amp;&amp; (this.customerId.longValue() == arg1.getCustomerId().longValue()); </strong></p>
<p><strong> }<br />
</strong> @Override<br />
<strong> public int hashCode() {<br />
  int hsCode;<br />
  hsCode = testId.hashCode();<br />
  hsCode = 19 * hsCode+ customerId.hashCode();<br />
  return hsCode;<br />
 }<br />
</strong> <br />
}</p></blockquote>
<p>2 main things to note here are:<br />
1. the Class implements Serializable<br />
2. The equals() and hashcode() functions. It is important to implement these 2 functions as hibernate relies on  these methods to cache and compare the data.<br />
So with this ID class, the PurchasedTest bean representing tests_purchased table would look like below:</p>
<blockquote><p>package entities;<br />
import java.util.Date;<br />
public class PurchasedTest {<br />
 PurchasedTestId purchasedTestId;<br />
  <br />
   Date purchaseDate;<br />
 <br />
 public PurchasedTestId getPurchasedTestId() {<br />
  return purchasedTestId;<br />
 }<br />
 public void setPurchasedTestId(PurchasedTestId purchasedTestId) {<br />
  this.purchasedTestId = purchasedTestId;<br />
 }<br />
 public Date getPurchaseDate() {<br />
  return purchaseDate;<br />
 }<br />
 public void setPurchaseDate(Date purchaseDate) {<br />
  this.purchaseDate = purchaseDate;<br />
 }<br />
 <br />
}</p></blockquote>
<p>Here it replaces both testId and customerId columns and declares single purchasedTestId variable.</p>
<p>The purchasedTest.hbm.xml file would look like below:</p>
<blockquote><p>&lt;?xml version=&#8221;1.0&#8243;?&gt;<br />
&lt;!DOCTYPE hibernate-mapping PUBLIC<br />
&#8220;-//Hibernate/Hibernate Mapping DTD 3.0//EN&#8221;<br />
&#8220;<a href="http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd</a>&#8220;&gt;</p>
<p>&lt;hibernate-mapping&gt;<br />
  &lt;class name=&#8221;entities.PurchasedTest&#8221; table=&#8221;tests_purchased&#8221;&gt;<br />
 <br />
    &lt;composite-id name=&#8221;purchasedTestId&#8221;&gt;<br />
       &lt;key-property name=&#8221;testId&#8221; column=&#8221;TEST_ID&#8221; /&gt;<br />
       &lt;key-property name=&#8221;customerId&#8221; column=&#8221;CUSTOMER_ID&#8221; /&gt;<br />
    &lt;/composite-id&gt;<br />
     <br />
  &lt;property name=&#8221;purchaseDate&#8221; type=&#8221;timestamp&#8221;&gt;<br />
     &lt;column name=&#8221;created_date&#8221; /&gt;<br />
    &lt;/property&gt;<br />
   <br />
   <br />
  &lt;/class&gt;<br />
&lt;/hibernate-mapping&gt;</p></blockquote>
<p> </p>
<p> </p>
<p>The &lt;id&gt; is replaced by &lt;composite-id&gt; tag. The name filed specifies the name of the PurchasedTestId type property in PurchasedTest bean.<br />
Both the &lt;key-property&gt; tags represent the key columns.<br />
With the above setting one can do operations on tests_purchased table like below:<br />
// To save data</p>
<p>PurchasedTest ptest = new PurchasedTest();<br />
        PurchasedTestId purchasedTestId = new PurchasedTestId(1l,1l);<br />
        ptest.setPurchasedTestId(purchasedTestId);<br />
        ptest.setPurchaseDate(new Date());<br />
        session.save(ptest);<br />
// To find data<br />
PurchasedTestId purchasedTestId = new PurchasedTestId(1l,1l);<br />
        PurchasedTest ptest = (PurchasedTest)session.load(PurchasedTest.class, purchasedTestId);<br />
        System.out.println(&#8220;test ID ::&#8221;+ptest.getPurchasedTestId().getTestId());<br />
        System.out.println(&#8220;cust ID ::&#8221;+ptest.getPurchasedTestId().getCustomerId());<br />
       <br />
// deleting the row<br />
PurchasedTestId purchasedTestId = new PurchasedTestId(1l,1l);<br />
        PurchasedTest ptest = (PurchasedTest)session.load(PurchasedTest.class, purchasedTestId);</p>
<p>    session.delete(ptest);</p>
<p> </p>
<p>To download full code click <a href="http://www.skill-guru.com/blog/wp-content/uploads/2010/02/copositeKeyExample.zip">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.skill-guru.com/blog/2010/02/10/mapping-composite-keys-in-hibernate/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>One-to-One mapping in Hibernate</title>
		<link>http://www.skill-guru.com/blog/2010/02/08/one-to-one-mapping-in-hibernate/</link>
		<comments>http://www.skill-guru.com/blog/2010/02/08/one-to-one-mapping-in-hibernate/#comments</comments>
		<pubDate>Mon, 08 Feb 2010 07:03:11 +0000</pubDate>
		<dc:creator>smitha</dc:creator>
				<category><![CDATA[Programming / tutorials]]></category>
		<category><![CDATA[hibernate]]></category>

		<guid isPermaLink="false">http://www.skill-guru.com/blog/?p=1676</guid>
		<description><![CDATA[In Hibernate One-to-One mapping can be done in 2 ways: 

Primary key association:
Foreign key association. 

This article describes how a Primary key One-to-one association can be done. 
Consider a Customer and address entities. Each customer will have one address. And an address is associated with one customer.  To make this relationship work in database customer and address will [...]]]></description>
			<content:encoded><![CDATA[<p>In Hibernate One-to-One mapping can be done in 2 ways: </p>
<ol>
<li>Primary key association:</li>
<li>Foreign key association. </li>
</ol>
<p>This article describes how a Primary key One-to-one association can be done. </p>
<p>Consider a Customer and address entities. Each customer will have one address. And an address is associated with one customer.  To make this relationship work in database customer and address will have same Id(primary key). Mapping this kind of relationship in Hibernate is called primary key One-to-One association. Doing so will help you saving, updating, deleting related entities easy.</p>
<p><span id="more-1676"></span></p>
<p> Define following 2 tables in mysql database.</p>
<blockquote><p>create table customer(<br />
    customer_id int(11) not null auto_increment,<br />
    name varchar(50) not null,<br />
    email_id varchar(100),<br />
    contact_no varchar(20),<br />
    primary key(customer_id));</p>
<p> create table address(<br />
    address_id int(11) not null,<br />
    address_line1 varchar(100) not null,<br />
    address_line2 varchar(100),<br />
    city varchar(50) not null,<br />
    state varchar(50) not null,<br />
    pincode int(10) not null,<br />
    primary key(address_id),<br />
    foreign key(address_id) references customer(customer_id));</p></blockquote>
<p> Here both customer and address share same primary key. Address_id is primary key and also a foreign key. Any new address should belong to a some customer. Customet ID will be an autogenerated sequence in database. But Address ID shuld be copied from customer table.</p>
<p> </p>
<p>Now lets define the entities:</p>
<p>Customer.java   Address.java</p>
<p>(you can download full code at the end of the article)</p>
<p> </p>
<p>Customer.java bean has the following fields and their getter and setter methods:</p>
<blockquote><p><strong>long</strong> customerId;</p>
<p><span style="text-decoration: underline;">String</span> name;</p>
<p>String emailAddress;</p>
<p>String contactNo;</p>
<p>Address address;</p></blockquote>
<p> </p>
<p>And Address.java bean has follow following fields and their getter and setter methods:</p>
<blockquote><p> <strong>long</strong> addressId;</p>
<p>String addressLine1;</p>
<p><span style="text-decoration: underline;">String</span> addressLine2;</p>
<p>String city;</p>
<p>String state;</p>
<p>Integer pincode;</p>
<p>Customer customer;</p></blockquote>
<p> </p>
<p> </p>
<p>In One-to-One primary key mapping, we need to relate both the entities bidirectional.We need to have address property in customer and vice versa. </p>
<p>Lets define the hibernate mapping files:</p>
<p> customer.hbm.xml file will look like below:</p>
<blockquote><p>&lt;?xml version=&#8221;1.0&#8243;?&gt;<br />
&lt;!DOCTYPE hibernate-mapping PUBLIC<br />
&#8220;-//Hibernate/Hibernate Mapping DTD 3.0//EN&#8221;<br />
&#8220;<a href="http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd</a>&#8220;&gt;</p>
<p>&lt;hibernate-mapping&gt;<br />
  &lt;class name=&#8221;entities.Customer&#8221; table=&#8221;CUSTOMER&#8221;&gt;<br />
    &lt;id name=&#8221;customerId&#8221; type=&#8221;long&#8221; column=&#8221;customer_id&#8221; &gt;<br />
     &lt;generator/&gt;<br />
  &lt;/id&gt;<br />
  <br />
  &lt;property name=&#8221;name&#8221;&gt;<br />
     &lt;column name=&#8221;NAME&#8221; /&gt;<br />
    &lt;/property&gt;<br />
   <br />
    &lt;property name=&#8221;emailAddress&#8221;&gt;<br />
     &lt;column name=&#8221;email_id&#8221; /&gt;<br />
    &lt;/property&gt;<br />
   <br />
    &lt;property name=&#8221;contactNo&#8221;&gt;<br />
     &lt;column name=&#8221;contact_no&#8221; /&gt;<br />
    &lt;/property&gt;<br />
   <br />
   <br />
   &lt;one-to-one name=&#8221;address&#8221;<br />
               <br />
                cascade=&#8221;all&#8221;<br />
                &gt;<br />
               <br />
    &lt;/one-to-one&gt;<br />
   <br />
  &lt;/class&gt;<br />
&lt;/hibernate-mapping&gt;</p></blockquote>
<p> </p>
<p> </p>
<p>Important part is the one-to-one mapping. Name should point to the Address type variable defined in Customer entity.</p>
<p>We have cascade =“all”. This means both the entities are related in all the operations.Adding / updating and deleting Customer will also do same on related address entity.</p>
<p> </p>
<p> </p>
<p> address.hbm.xml file will look like below:</p>
<blockquote><p>&lt;?xml version=&#8221;1.0&#8243;?&gt;<br />
&lt;!DOCTYPE hibernate-mapping PUBLIC<br />
&#8220;-//Hibernate/Hibernate Mapping DTD 3.0//EN&#8221;<br />
&#8220;<a href="http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd</a>&#8220;&gt;</p>
<p>&lt;hibernate-mapping&gt;<br />
  &lt;class name=&#8221;entities.Address&#8221; table=&#8221;ADDRESS&#8221;&gt;<br />
    &lt;id name=&#8221;addressId&#8221; type=&#8221;long&#8221; column=&#8221;address_id&#8221; &gt;<br />
     &lt;generator&gt;<br />
            &lt;param name=&#8221;property&#8221;&gt;customer&lt;/param&gt;<br />
        &lt;/generator&gt;</p>
<p>  &lt;/id&gt;<br />
  <br />
  &lt;property name=&#8221;addressLine1&#8243;&gt;<br />
     &lt;column name=&#8221;address_line1&#8243; /&gt;<br />
    &lt;/property&gt;<br />
   <br />
    &lt;property name=&#8221;addressLine2&#8243;&gt;<br />
     &lt;column name=&#8221;address_line2&#8243; /&gt;<br />
    &lt;/property&gt;<br />
   <br />
    &lt;property name=&#8221;city&#8221;&gt;<br />
     &lt;column name=&#8221;city&#8221; /&gt;<br />
    &lt;/property&gt;<br />
   <br />
    &lt;property name=&#8221;state&#8221;&gt;<br />
     &lt;column name=&#8221;state&#8221; /&gt;<br />
    &lt;/property&gt;<br />
   <br />
    &lt;property name=&#8221;pincode&#8221;&gt;<br />
     &lt;column name=&#8221;pincode&#8221; /&gt;<br />
    &lt;/property&gt;<br />
   <br />
    &lt;one-to-one name=&#8221;customer&#8221;<br />
               <br />
                constrained=&#8221;true&#8221; /&gt;<br />
               <br />
   <br />
   <br />
   <br />
  &lt;/class&gt;<br />
&lt;/hibernate-mapping&gt;</p></blockquote>
<p> </p>
<p> </p>
<p>In this mapping file we have to ensure 2 things:</p>
<ol>
<li>Address table do not have any ID generation strategy. It has to get id from customer table.</li>
<li>The Address ID is a foreign key which should be specified to hibernate.</li>
</ol>
<p> This is to ensure the order of insert/delete and update statements, which hibernate would perform on these two tables.</p>
<p> &lt;id name=&#8221;addressId&#8221; type=&#8221;long&#8221; column=&#8221;address_id&#8221; &gt;<br />
   &lt;generator&gt;<br />
        &lt;param name=&#8221;property&#8221;&gt;customer&lt;/param&gt;<br />
   &lt;/generator&gt;<br />
&lt;/id&gt;</p>
<p>Is to ensure that the addresseId gets a value of customerId we use special id generation strategy called “foreign”.</p>
<p> </p>
<p>To specify the foreign key constraint on addressId, we have set constrained=&#8221;true&#8221;  like below in address.hbm.xml file</p>
<p>&lt;one-to-one name=&#8221;customer&#8221;<strong>constrained</strong><strong>=</strong><strong>&#8220;true&#8221;</strong> /&gt;</p>
<p>  </p>
<p>Now the mapping part is over. We can test it using following client code:</p>
<blockquote><p>// saving the Customer and Address data</p>
<p>Customer customer = new Customer();<br />
customer.setName(&#8220;Surya&#8221;);<br />
customer.setEmailAddress(&#8220;<a href="mailto:surya@gmail.com">surya@gmail.com</a>&#8220;);<br />
customer.setContactNo(&#8220;91-932686876&#8243;);<br />
Address address = new Address();<br />
address.setAddressLine1(&#8220;xxx-street, near Surya Complex&#8221;);<br />
address.setCity(&#8220;Pune&#8221;);<br />
address.setState(&#8220;Maharashtra&#8221;);<br />
address.setPincode(11111);<br />
customer.setAddress(address);<br />
address.setCustomer(customer);<br />
session.save(customer);<br />
//Fetch all the customers<br />
Query query = session.createQuery(&#8220;from Customer customer&#8221;);<br />
for(Iterator it=query.iterate();it.hasNext();){<br />
 Customer customer1 = (Customer) it.next();<br />
 Address address1 = customer1.getAddress();<br />
 System.out.println(&#8220;customer ID: &#8221; + customer1.getCustomerId());<br />
 System.out.println(&#8220;Name: &#8221; + customer1.getName());<br />
 System.out.println(&#8220;address: &#8221; + address1.getAddressLine1());<br />
 System.out.println(address1.getAddressLine2());<br />
 System.out.println(address1.getCity());<br />
 System.out.println(address1.getState());<br />
 System.out.println(address1.getPincode());<br />
}</p>
<p>// delete a customer – also delete address<br />
Query query = session.createQuery(&#8220;from Customer customer where customer.customerId = :cust&#8221;).setLong(&#8220;cust&#8221;, 3);<br />
            Customer customer2 = (Customer) query.uniqueResult();<br />
session.delete(customer2);</p>
<p>// delete only Address<br />
Query query = session.createQuery(&#8220;from Customer customer where customer.customerId = :cust&#8221;).setLong(&#8220;cust&#8221;, 1);<br />
Customer customer2 = (Customer) query.uniqueResult();<br />
Address address2 = customer2.getAddress();<br />
customer2.setAddress(null);<br />
address2.setCustomer(null);<br />
session.delete(address2);</p></blockquote>
<p> </p>
<p> </p>
<p><strong>You can download full code from </strong><a href="http://www.skill-guru.com/blog/wp-content/uploads/2010/02/HibernateExample.zip"><strong>here</strong></a><strong>.</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://www.skill-guru.com/blog/2010/02/08/one-to-one-mapping-in-hibernate/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>The Object Oriented Game Approach Part 2: Getting started with iPhone Game development</title>
		<link>http://www.skill-guru.com/blog/2010/02/06/the-object-oriented-game-approach-part-2-getting-started-with-iphone-game-development/</link>
		<comments>http://www.skill-guru.com/blog/2010/02/06/the-object-oriented-game-approach-part-2-getting-started-with-iphone-game-development/#comments</comments>
		<pubDate>Sat, 06 Feb 2010 16:19:55 +0000</pubDate>
		<dc:creator>jvmovi</dc:creator>
				<category><![CDATA[Programming / tutorials]]></category>

		<guid isPermaLink="false">http://www.skill-guru.com/blog/?p=1654</guid>
		<description><![CDATA[In the past articles, I&#8217;ve discussed OOP(Object Oriented Programming) and Game Programming.Be sure to at have a grasp of the basics before diving to this next article.
The basic prerequisites to develop your first iPhone GameApp are:
1)Objective C
2)the iPhone SDK
3)MAC:XCode
So to develop a game in the iPhone , these prerequisites will force you to work in [...]]]></description>
			<content:encoded><![CDATA[<p><em>In the past articles, I&#8217;ve discussed <a href="http://www.skill-guru.com/blog/2010/01/27/the-object-oriented-game-approach-part-1-objects/">OOP(Object Oriented Programming)</a> and <a href="http://www.skill-guru.com/blog/2010/01/18/a-game-design-game-creation-short/">Game Programming</a>.Be sure to at have a grasp of the basics before diving to this next article.</em></p>
<p>The basic prerequisites to develop your first iPhone GameApp are:<br />
1)Objective C<br />
2)the iPhone SDK<br />
3)MAC:XCode</p>
<p>So to develop a game in the iPhone , these prerequisites will force you to work in a <u>MAC</u>, and learn <u>Objective C</u> on top of learning the <u>iPhone SDK</u>. Do not be alarmed. Take one step at a time.If you know OOP already, then you just have to familiarize.</p>
<p><span id="more-1654"></span>First let us tackle Objective C.This next article is an Object C Primer which will prepare you for the iPhone Game Development.<br />
Objective C is a combination of OOP + C. As such, it can be compared to C++ in being object oriented with the feel of our good old ANSI C.You may or may not have been trained in C so let us look at the differences first.</p>
<p><strong>Syntax:</strong><br />
This is a hello world program in C. This also works in object C. There isn&#8217;t much difference when it comes to syntax.<br />
<code>#import &lt;stdio.h&gt;</p>
<p>int main( int argc, const char *argv[] ) {<br />
printf( "hello world\n" );<br />
return 0;<br />
}</p>
<p></code><strong>Paradigm:</strong></p>
<p><a href="http://www.skill-guru.com/blog/2010/01/27/the-object-oriented-game-approach-part-1-objects/">OOP</a> vs Procedural. In ANSI C, you learned to program using procedures,but in Object C, we work with objects.</p>
<p>4 things that you should be familiar :<br />
<strong>a)Objects<br />
b)Class<br />
c)Methods<br />
d)Memory Management</strong></p>
<p><strong>a)Objects</strong>-Objects are what makes OOP.<br />
-creating objects<br />
i)manual-you initialize this object, so you have to remove it later<br />
<code>NSAutoreleasePool *pool=[[NSAutoreleasePool alloc] init]</code><br />
ii)automatic-this has some relation with the automatic memory management<br />
<code>Integer *num1 = [Integer new]</code><br />
iii)Other examples:<br />
<code>//An array object; nil is equivalent to NULL<br />
NSMutableArray *aRR= nil<br />
//A string<br />
NSString* myString = [NSString string];<br />
//A number with initialized value<br />
NSNumber* num= [[NSNumber alloc] initWithFloat:10.0];</code></p>
<p><strong>b)Class</strong><br />
You need a yourClass.h and yourClass.m files<br />
+yourClass.h contains:<br />
-instance variables<br />
-public methods.<br />
+yourClass.m contain the methods<br />
eg.   this file is named “main.m”<br />
<code><br />
#import &lt;UIKit/UIKit.h&gt;<br />
int main(int argc,char *argv[]){<br />
NSAutoreleasePool *pool=[[NSAutoreleasePool alloc] init]<br />
int retVal=UIApplicationMain(argc,argv,nil,nil);<br />
[pool release];<br />
//since the object pool has been initialized manually, you need to manually remove it<br />
return retVal<br />
}</code></p>
<p><strong>c)Methods</strong></p>
<p>Remember about setters and getters method?Setters set values, while getters get values.<br />
-<code> (NSString*) string;         //.a getter</code><br />
-<code> (void) setString: (NSString*)input; // a setter</code></p>
<p>Some notes;<br />
A dash before means that it&#8217;s an instanceinstance method.<br />
A plus beforemeans it&#8217;s a class method.</p>
<p><strong>d)Memory Management</strong><br />
By now, you should have learned that memory is valuable. You can have lots of it, but without learning how to do some cleanup, you&#8217;ll probably leave a lot of clutter.  We&#8217;ve learned that objects can be manually or automaticall instantiated. Doing it manually gives you better control of the object, while doing it automatically means that you won&#8217;t have to worry  about not deallocating the objects.<br />
eg.<br />
<code>(void) dealloc{<br />
[string release];  //deallocates the string instance variable<br />
[super dealloc]; //calls the superclass to clean up itself to prevent memory leak<br />
}</code></p>
<blockquote><p>
Remember this simple rule:”What you allocate, deallocate.”</p></blockquote>
<p>You cannot learn everything about OOP in this article, but this will be enough to get you started in your development.<br />
Now are you ready for the iPhone?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.skill-guru.com/blog/2010/02/06/the-object-oriented-game-approach-part-2-getting-started-with-iphone-game-development/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Spring Certification in India</title>
		<link>http://www.skill-guru.com/blog/2010/02/04/spring-certification-in-india/</link>
		<comments>http://www.skill-guru.com/blog/2010/02/04/spring-certification-in-india/#comments</comments>
		<pubDate>Thu, 04 Feb 2010 05:35:38 +0000</pubDate>
		<dc:creator>smitha</dc:creator>
				<category><![CDATA[Education]]></category>
		<category><![CDATA[Mock  Exam / Certifications]]></category>
		<category><![CDATA[certification]]></category>
		<category><![CDATA[spring]]></category>

		<guid isPermaLink="false">http://www.skill-guru.com/blog/?p=1648</guid>
		<description><![CDATA[    Spring framework is very popular and need of spring knowledge among the IT industry is raising. But I found that getting a spring certification is not very easy.  To get the spring certification voucher you have to take spring training from spring source, which are available in few major cities of India or you [...]]]></description>
			<content:encoded><![CDATA[<p>    Spring framework is very popular and need of spring knowledge among the IT industry is raising. But I found that getting a spring certification is not very easy.  To get the spring certification voucher you have to take spring training from spring source, which are available in few major cities of India or you have to have a prior work experience in spring. </p>
<p> You can find spring training locations here&#8230;</p>
<p><span id="more-1648"></span></p>
<p><a href="http://mylearn.vmware.com/portals/springsource/search/findcourse.cfm?ui=s2">http://mylearn.vmware.com/portals/springsource/search/findcourse.cfm?ui=s2</a></p>
<p>You need to get registered to see information on fees, location etc.</p>
<p> If you don’t want to go for spring training then you must have experience in working on spring. Spring source such candidates as &#8216;grandfathered&#8217; candidates. You need to provide a ‘Grandfather Application’ providing proof of their experience on spring. Some more details are given below</p>
<blockquote><p> Spring Framework is offered to two groups of people: those who have attended a 4-day Core Spring training course and those who haven&#8217;t attended the course but have gained knowledge of Spring from other sources, such as private study, client projects, forums etc.  We call this second group, &#8216;grandfathered&#8217; candidates.<br />
 <br />
A grandfathered candidate is a person who has not attended the four-day Core Spring class but who has satisfied any one of the following criteria:<br />
 <br />
•             Demonstrable evidence of (1) successful Spring solution completed. Evidence will include customer name and contact information reference.<br />
 <br />
•             Demonstrable evidence of adding value to Spring Products and/or the Community. Candidate should provide supporting information from one or more of the following examples:<br />
 <br />
                                                  a. Forum post<br />
                                                  b. Software patches<br />
                                                  c. Articles promoting Spring or explaining Spring<br />
                                                  d. User Group involvement<br />
 <br />
•             Possession of a Spring Framework Professional Certification from a previous version of Spring.<br />
 <br />
These are the only ways in which you can obtain a voucher in order to take the certification exam and become a Certified Spring Professional. More information including sample questions and costs can be found here: <a href="http://www.springsource.com/training/certification/springprofessional">http://www.springsource.com/training/certification/springprofessional</a></p>
<p> </p>
<p> </p></blockquote>
<p><a href="http://www.skill-guru.com/blog/wp-content/uploads/2010/02/SpringSource-Certification-Program-Grandfather-Application_APAC.doc">Clck here </a>to see the Grandfather Application.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.skill-guru.com/blog/2010/02/04/spring-certification-in-india/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting started with Spring TC server</title>
		<link>http://www.skill-guru.com/blog/2010/01/28/getting-started-with-spring-tc-server/</link>
		<comments>http://www.skill-guru.com/blog/2010/01/28/getting-started-with-spring-tc-server/#comments</comments>
		<pubDate>Thu, 28 Jan 2010 16:52:37 +0000</pubDate>
		<dc:creator>Vinay</dc:creator>
				<category><![CDATA[Programming / tutorials]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[spring]]></category>
		<category><![CDATA[spring tc server]]></category>

		<guid isPermaLink="false">http://www.skill-guru.com/blog/?p=1641</guid>
		<description><![CDATA[As promised in last post Good bye MyEclipse. Welcome STS -Spring source Tool Suite, I would be going into the details of Spring TC server development edition and its integration with Spring Source tool suite (STS).
Spring launched the Spring source tc server which is a layer of functional ties and capabilities over the famous Apache [...]]]></description>
			<content:encoded><![CDATA[<p>As promised in last post<a href="http://www.skill-guru.com/blog/2010/01/22/good-bye-myeclipse-welcome-sts-spring-source-tool-suite/"> Good bye MyEclipse. Welcome STS -Spring source Tool Suite</a>, I would be going into the details of Spring TC server development edition and its integration with Spring Source tool suite (STS).</p>
<p>Spring launched the Spring source tc server which is a layer of functional ties and capabilities over the famous Apache Tomcat server. From Spring source site</p>
<blockquote><p>SpringSource tc Server™ is an enterprise version of Apache Tomcat that provides developers with the lightweight server they want paired with the operational management, advanced diagnostics, and mission-critical support capabilities businesses need.</p></blockquote>
<p>More details on Spring TC server can be found  <a href="http://www.springsource.com/products/tcserver">SpringSource tc Server &#8212; The Tomcat You Know</a></p>
<p>I decide to give the Spring TC server a shot. I downloaded tc Server Developer Edition(Free) edition (you will have to fill in details and then you get a link in email)</p>
<p><span id="more-1641"></span>When install.bat or install.sh unpacks , select the options to install. I selected 2 but for faster setup user option 3. i.e Application server only</p>
<p>1. Install tc Server AMS (Server/Agent) &#8211; Quick setup</p>
<p>2. Install tc Server AMS (Server/Agent) &#8211; Full setup</p>
<p>3. Install tc Server Application Servertc</p>
<p>4. Upgrade tc Server AMS Server</p>
<p>5. Exit<strong> </strong></p>
<p><strong> </strong></p>
<p>It will create a folder <strong>tcServer-6.0.20.C-GA-windows-x86</strong></p>
<p>Go inside the folder after installation and run tcServer-6.0.20.C-GA-tomcat.sfx.jar</p>
<p>It will create folder tcServer-6.0</p>
<p>Go inside tcServer-6.0</p>
<p><strong> </strong></p>
<p><strong>C:\skillguru\dev\tcServer-6.0.20.C-GA-windows-x86\tcServer-6.0</strong></p>
<p><strong> </strong></p>
<p>Create an instance tcserver-instance.bat -c -s geek</p>
<p>After an instance(directory) geek is created  run the server</p>
<p>tcserver-ctl.bat geek run</p>
<p><a href="http://localhost:8080/">http://localhost:8080/</a></p>
<p>You can run your web application and start tc server through STS (Spring source tool Suite) as well.</p>
<p>Below is the link to a video on the installation steps of tc server and how</p>
<p><a href="http://s3.springsource.com/MRKT/spring-metrics/Spring_Insight_Preview-final2.mov">http://s3.springsource.com/MRKT/spring-metrics/Spring_Insight_Preview-final2.mov</a></p>
<p>The biggest feature which would be of interest to developers is the ability to monitor your applications health and performance.  Spring Tc also allows also allows  you to do source code integration which means you can change the code and in realtime monitor the application performance. Will cover this in later posts.</p>
<p>The one big question looms , <strong>Is the Spring TC server Free ?</strong></p>
<p>Yes the development version is free.  You will have to pay for production version and support.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.skill-guru.com/blog/2010/01/28/getting-started-with-spring-tc-server/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
<enclosure url="http://s3.springsource.com/MRKT/spring-metrics/Spring_Insight_Preview-final2.mov" length="155989307" type="video/quicktime" />
		</item>
	</channel>
</rss>
