<?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-1546366980808220992</id><updated>2012-01-13T17:30:48.973-05:00</updated><category term='AOP'/><category term='Janino'/><category term='hibernate'/><category term='delorme'/><category term='KML'/><category term='software management'/><category term='navigation'/><category term='jdbc'/><category term='mysql'/><category term='web'/><category term='photography'/><category term='Pixel Bender'/><category term='utm'/><category term='gis'/><category term='OpenSSL'/><category term='mac os x'/><category term='Photolinker'/><category term='maven'/><category term='Aperture'/><category term='GPSBabel'/><category term='bash'/><category term='Java'/><category term='evolution'/><category term='Snow Leopard'/><category term='properties'/><category term='Photoshop'/><category term='gps'/><category term='Algorithm'/><category term='AspectJ'/><category term='Google Earth'/><category term='css'/><category term='software'/><category term='devoxx'/><category term='spring'/><category term='eclipse'/><category term='JUnit'/><category term='evolutionary computing'/><category term='velocity'/><category term='Bike'/><category term='Design Patterns'/><category term='Blog'/><category term='database'/><title type='text'>Technology &amp; Science Interest</title><subtitle type='html'>Computer Science, Technology, and Issues in Science</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://techscienceinterest.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1546366980808220992/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://techscienceinterest.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Brent Coffey</name><uri>http://www.blogger.com/profile/14987122747702890412</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_7p4NxoKlbj4/S3RxOjAJ_rI/AAAAAAAAAEw/kOlFmUROluI/S220/Photo+on+2010-02-11+at+15.39+%232.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>34</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-1546366980808220992.post-1132839044887928788</id><published>2011-11-24T10:09:00.001-05:00</published><updated>2011-11-24T10:12:10.220-05:00</updated><title type='text'>Why I haven't posted in a while</title><content type='html'>Some have asked why I have not posted any new software tips in quite a while. &amp;nbsp;2 reasons.&lt;br /&gt;&lt;br /&gt;First. I've been promoted to oversee all the engineers and so that keeps me pretty busy.&lt;br /&gt;&lt;br /&gt;Secondly, because I am working on two masters degrees at the same time.&lt;br /&gt;&lt;br /&gt;So, I will be happy to answer questions when I have time but I don't plan on posting any new software tips for quite sometime unless I find something so amazing I just have too.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1546366980808220992-1132839044887928788?l=techscienceinterest.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techscienceinterest.blogspot.com/feeds/1132839044887928788/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techscienceinterest.blogspot.com/2011/11/why-i-havent-posted-in-while.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1546366980808220992/posts/default/1132839044887928788'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1546366980808220992/posts/default/1132839044887928788'/><link rel='alternate' type='text/html' href='http://techscienceinterest.blogspot.com/2011/11/why-i-havent-posted-in-while.html' title='Why I haven&apos;t posted in a while'/><author><name>Brent Coffey</name><uri>http://www.blogger.com/profile/14987122747702890412</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_7p4NxoKlbj4/S3RxOjAJ_rI/AAAAAAAAAEw/kOlFmUROluI/S220/Photo+on+2010-02-11+at+15.39+%232.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1546366980808220992.post-1319542575673445985</id><published>2010-12-12T07:52:00.000-05:00</published><updated>2010-12-12T07:52:36.511-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Snow Leopard'/><category scheme='http://www.blogger.com/atom/ns#' term='mac os x'/><category scheme='http://www.blogger.com/atom/ns#' term='OpenSSL'/><title type='text'>Compiling OpenSSL on Mac OS X Snow Leopard</title><content type='html'>Snow Leopard comes with a dated version of OpenSSL 0.9.8l and for various reasons you may want to install the latest version. &amp;nbsp;Here is how I was able to install the latest version (1.0.0c as of the writing of this blog) on Snow Leopard.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;NOTE:&lt;/b&gt; This Blog assumes you have some familiarity with the terminal, using the command line, and opening and closing applications. &amp;nbsp;If you are not comfortable with any of these things then I do not suggest you try this on a production machine.&lt;br /&gt;&lt;br /&gt;Before beginning check your current version of OpenSSL by opening a terminal and typing:&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;openssl version&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;You should get back the following if you have not updated OpenSSL since installing Snow Leopard:&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;OpenSSL 0.9.8l 5 Nov 2009&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;Assuming you don't already have 1.0.0c or later already installed, you have XCode installed from Apple, and you have administrative rights to the machine you are installing on, then you are ready to begin.&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;&lt;b&gt;STEP 1:&lt;/b&gt;&amp;nbsp;Download the Source Code from&amp;nbsp;&lt;/span&gt;the &lt;a href="http://www.blogger.com/"&gt;&lt;span id="goog_247060809"&gt;&lt;/span&gt;OpenSSL website&lt;span id="goog_247060810"&gt;&lt;/span&gt;&lt;/a&gt; (&lt;a href="http://www.openssl.org/source/"&gt;http://www.openssl.org/source/&lt;/a&gt;).&lt;br /&gt;&lt;br /&gt;&lt;b&gt;STEP 2:&lt;/b&gt; Open a Terminal and navigate to the directory where you download the source code to. In my case the source code was download to &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;~/Downloads&lt;/span&gt; so I typed on the command line:&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;cd ~/Downloads&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;STEP 3: &lt;span class="Apple-style-span" style="font-weight: normal;"&gt;Configure the build by typing&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;./configure darwin64-x86_64-cc&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;STEP 4: &lt;span class="Apple-style-span" style="font-weight: normal;"&gt;Type&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;make&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;STEP 5 (Optional but fun):&lt;/span&gt;&lt;/b&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt; Test that everything was created correctly by typing&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;make test&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;STEP 6:&lt;/b&gt; Install the newly built OpenSSL application by typing:&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;sudo make install&lt;/span&gt;&lt;br /&gt;(Type password when prompted)&lt;br /&gt;&lt;br /&gt;&lt;b&gt;STEP 7:&lt;/b&gt; Navigate to the directory where the old openssl is installed by typing:&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;cd /usr/bin&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;STEP 8:&lt;/b&gt; Rename the old openssl file to another name so that you can go back to it if you need to:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;sudo mv openssl opensslOld&lt;/span&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;STEP 9:&lt;/b&gt; Create a link to the new openssl file&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;sudo ln -s /usr/local/ssl/bin/openssl openssl&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;STEP 10:&lt;/b&gt; Test that everything worked by typing:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;openssl version&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;If it all worked you should now see&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;OpenSSL 1.0.0c 2 Dec 2010&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1546366980808220992-1319542575673445985?l=techscienceinterest.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techscienceinterest.blogspot.com/feeds/1319542575673445985/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techscienceinterest.blogspot.com/2010/12/compiling-openssl-on-mac-os-x-snow.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1546366980808220992/posts/default/1319542575673445985'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1546366980808220992/posts/default/1319542575673445985'/><link rel='alternate' type='text/html' href='http://techscienceinterest.blogspot.com/2010/12/compiling-openssl-on-mac-os-x-snow.html' title='Compiling OpenSSL on Mac OS X Snow Leopard'/><author><name>Brent Coffey</name><uri>http://www.blogger.com/profile/14987122747702890412</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_7p4NxoKlbj4/S3RxOjAJ_rI/AAAAAAAAAEw/kOlFmUROluI/S220/Photo+on+2010-02-11+at+15.39+%232.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1546366980808220992.post-396937439772238452</id><published>2010-10-26T19:30:00.001-04:00</published><updated>2010-10-26T19:30:59.509-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='devoxx'/><title type='text'>Devoxx Java Conference</title><content type='html'>My team and I are off to Belgium in two weeks for the &lt;a href="http://www.devoxx.com/"&gt;Devoxx Conference&lt;/a&gt;.  First time I have gone to &lt;a href="http://www.devoxx.com/"&gt;Devoxx&lt;/a&gt; and Belgium! Looking forward to it, even though I despise flying.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.devoxx.com/"&gt;&lt;img src="http://devoxx.com/download/attachments/4161594/LogoDevoxx150dpi.jpg?version=1&amp;amp;modificationDate=1275294792000" style="border-bottom-color: black; border-bottom-style: solid; border-bottom-width: 0px; border-left-color: black; border-left-style: solid; border-left-width: 0px; border-right-color: black; border-right-style: solid; border-right-width: 0px; border-top-color: black; border-top-style: solid; border-top-width: 0px;" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1546366980808220992-396937439772238452?l=techscienceinterest.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techscienceinterest.blogspot.com/feeds/396937439772238452/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techscienceinterest.blogspot.com/2010/10/devoxx-java-conference.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1546366980808220992/posts/default/396937439772238452'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1546366980808220992/posts/default/396937439772238452'/><link rel='alternate' type='text/html' href='http://techscienceinterest.blogspot.com/2010/10/devoxx-java-conference.html' title='Devoxx Java Conference'/><author><name>Brent Coffey</name><uri>http://www.blogger.com/profile/14987122747702890412</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_7p4NxoKlbj4/S3RxOjAJ_rI/AAAAAAAAAEw/kOlFmUROluI/S220/Photo+on+2010-02-11+at+15.39+%232.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1546366980808220992.post-2816955186207175021</id><published>2010-10-08T09:46:00.003-04:00</published><updated>2010-10-08T19:03:06.145-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='velocity'/><category scheme='http://www.blogger.com/atom/ns#' term='properties'/><title type='text'>Using Apache Velocity with Java Properties File</title><content type='html'>The Apache Velocity project is an amazingly useful tool which allows you to merge data with templates. Here is a quick example of how it works.&lt;br /&gt;&lt;br /&gt;First suppose you had a "template" text file that looks like the following&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;$awesomeProgrammer needs to purchase a new $device.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Go ahead and save this in a file called "test.tpl."&amp;nbsp;&amp;nbsp;Then suppose you had a "context" or "properties" file that read like this:&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;#This is a comment&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;awesomeProgrammer=Brent Coffey&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;device=Mac Pro&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Save this file as "test.properties." &amp;nbsp;Now you want to programmatically mash together the properties file with the the template file so that the output looks like this:&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;Brent Coffey needs to purchase a new Mac Pro.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;This is what the Apache Velocity Engine will do for you with very little code here is how it works. &lt;br /&gt;&lt;br /&gt;&lt;i&gt;&lt;b&gt;Assumptions:&lt;/b&gt;&lt;/i&gt; First this example assumes you have already have a working knowledge of Java, Eclipse, jars, and classpaths. &amp;nbsp;Therefore create a new project in Eclipse and add the velocity-dep-1.4.jar to the classpath. &amp;nbsp;You can download the jar from the &lt;a href="http://velocity.apache.org/download.cgi"&gt;Apache Velocity web sit by clicking here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Second note that the example I'm giving is a down and dirty example, and I would not recommend using this in production because I'm not going to handle all the try catch statements or possible errors that could arise nor is this an example of "good" OO programming. &lt;i&gt;&amp;nbsp;So take it for what it's worth; a plain-ole super simple example of how to use velocity to merge a properties file with template.&lt;/i&gt;&lt;br /&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;br /&gt;I wrote this code to be really self explanatory. I may come back later and explain more if it's needed or requested. &amp;nbsp;Let me know.&lt;br /&gt;&lt;br /&gt;Here is the code:&lt;br /&gt;&lt;br /&gt;&lt;script class="brush: java" type="syntaxhighlighter"&gt;&lt;![CDATA[package org.example;import java.io.FileInputStream;import java.io.IOException;import java.io.StringWriter;import java.util.Enumeration;import java.util.Properties;import org.apache.velocity.Template;import org.apache.velocity.VelocityContext;import org.apache.velocity.app.VelocityEngine;import org.apache.velocity.exception.MethodInvocationException;import org.apache.velocity.exception.ParseErrorException;import org.apache.velocity.exception.ResourceNotFoundException;import org.apache.velocity.runtime.RuntimeConstants;public class example { private static String templateFileName; private static String contextPropertiesFileName; private static VelocityEngine velocityEngine;  private static VelocityContext velocityContext; private static Template template; private static StringWriter result; /** START HERE--Hopefully it's self explanatory by just reading the method names*/ public static void main(String[] args) {  assignTemplateAndContextFileNamesFrom(args);  createVelocityContextFromPropertiesFile();  setupVelocityEngine();  loadTemplate();  mergeTemplateWithVelocityContext();  printResults();   }//******************* private static void assignTemplateAndContextFileNamesFrom(String[] args) {  templateFileName = args[0];  contextPropertiesFileName = args[1]; }  private static void createVelocityContextFromPropertiesFile() {  Properties properties = new Properties();  try {   properties.load(new FileInputStream(contextPropertiesFileName));  } catch (Exception e) {   e.printStackTrace();  }  velocityContext = new VelocityContext();  loadPropertiesIntoContext(properties); } private static void loadPropertiesIntoContext(Properties properties) {  Enumeration&lt;?&gt; enumeration = properties.propertyNames();     while (enumeration.hasMoreElements()) {       String key = (String) enumeration.nextElement();       String value = properties.getProperty(key);       velocityContext.put(key, value);     } } private static void setupVelocityEngine() {  velocityEngine = new VelocityEngine();                //Read documentation on these variables that can be set   // I'm not really doing anything with these here but if you wanted   // to set these internal velocity variables this is where you would do it.   velocityEngine.setApplicationAttribute(                              RuntimeConstants.FILE_RESOURCE_LOADER_PATH,"/");  // Once variables are set (if you want) then you can call init  try {   velocityEngine.init();  } catch (Exception e) {   e.printStackTrace();  } }  private static void loadTemplate() {  try {   template = velocityEngine.getTemplate(templateFileName);  } catch (ResourceNotFoundException e) {   e.printStackTrace();  } catch (ParseErrorException e) {   e.printStackTrace();  } catch (Exception e) {   e.printStackTrace();  } }  private static void mergeTemplateWithVelocityContext() {  result = new StringWriter();  try {   template.merge( velocityContext, result );  } catch (ResourceNotFoundException e) {   e.printStackTrace();  } catch (ParseErrorException e) {   e.printStackTrace();  } catch (MethodInvocationException e) {   e.printStackTrace();  } catch (IOException e) {   e.printStackTrace();  } }  private static void printResults() {  System.out.println(result.toString()); }}]]&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;To run this example ensure that the two files you created above (test.tpl, test.properties) are in the root of the executing directory. &amp;nbsp;Pass those two files to the application as command line arguments in the specified order (template first followed by properties file) and if everything is located in the correct place you should see the string: "&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;Brent Coffey needs to purchase a new Mac Pro.&lt;/span&gt;" printed out to the console.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1546366980808220992-2816955186207175021?l=techscienceinterest.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techscienceinterest.blogspot.com/feeds/2816955186207175021/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techscienceinterest.blogspot.com/2010/10/using-apache-velocity-with-java.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1546366980808220992/posts/default/2816955186207175021'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1546366980808220992/posts/default/2816955186207175021'/><link rel='alternate' type='text/html' href='http://techscienceinterest.blogspot.com/2010/10/using-apache-velocity-with-java.html' title='Using Apache Velocity with Java Properties File'/><author><name>Brent Coffey</name><uri>http://www.blogger.com/profile/14987122747702890412</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_7p4NxoKlbj4/S3RxOjAJ_rI/AAAAAAAAAEw/kOlFmUROluI/S220/Photo+on+2010-02-11+at+15.39+%232.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1546366980808220992.post-6465189573228263988</id><published>2010-09-30T05:24:00.001-04:00</published><updated>2010-09-30T06:07:11.518-04:00</updated><title type='text'>Man Pages as PDF</title><content type='html'>Sometimes I want to read a man pages in a seperate window from my terminal I am working in.  Instead of opening another terminal I read this &lt;a href="http://osxdaily.com/2010/09/27/open-any-man-page-in-preview-and-save-as-pdf/?utm_source=feedburner&amp;amp;utm_medium=feed&amp;amp;utm_campaign=Feed%3A+osxdaily+%28OS+X+Daily%29"&gt;handy blog &lt;/a&gt;on how to open a man page as a pdf.  &lt;i&gt;(Why I didn't think of this myself I don't know as I do simular type things for html and jpeg files all the time...oh well)&lt;/i&gt;. The solution suggested in the blog is to "simply" type:&lt;br /&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: monospace;"&gt;&lt;span class="Apple-style-span" style="line-height: 33px;"&gt;&lt;span class="Apple-style-span" style="color: black; font-family: Times;"&gt;&lt;span class="Apple-style-span" style="line-height: normal;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: monospace; line-height: 28px;"&gt; man -t XXXX | open -f -a /Applications/Preview.app&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Where XXXX is the thing you want the man page for such as&lt;span class="Apple-style-span" style="color: #333333; font-family: monospace; line-height: 28px;"&gt; ls, ipconfig, snmpget, &lt;/span&gt;etc. I thought that was quite a handy tip but a bear to type. &amp;nbsp;After all it's pretty simple to just type:&lt;span class="Apple-style-span" style="color: #333333; font-family: monospace; line-height: 28px;"&gt; man ls. &amp;nbsp;&lt;/span&gt;Whereas having to type the other monstrosity of a command makes for an interesting blog but frankly less than useful utility.&lt;br /&gt;&lt;br /&gt;So, for fear of stating the obvious, I took the blog one step further and created a script to do the work for me and to greatly simply the task. &amp;nbsp;Here is the simple script, which I named&lt;span class="Apple-style-span" style="color: #333333; font-family: monospace; line-height: 28px;"&gt; manpdf:&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: monospace; line-height: 28px;"&gt;&lt;br /&gt;#!/bin/bash&lt;br /&gt;man -t $1 | open -f -a /Applications/Preview.app&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;NOTE:There are tons of ways you could make this even more useful (post those in the comments if you wish):&lt;br /&gt;&lt;br /&gt;Save the script, as root, this script in your path, in my case I saved it to /usr/bin. Then make it executable by typing:&lt;br /&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: monospace;"&gt;&lt;span class="Apple-style-span" style="line-height: 33px;"&gt;&lt;span class="Apple-style-span" style="color: black; font-family: Times;"&gt;&lt;span class="Apple-style-span" style="line-height: normal;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: monospace; line-height: 28px;"&gt; sudo chmod uga+x manpdf&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Now you can simply type:&amp;nbsp;&lt;span class="Apple-style-span" style="color: #333333; font-family: monospace; line-height: 28px;"&gt;manpdf XXXX&lt;/span&gt;, to open a man page for a given command.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1546366980808220992-6465189573228263988?l=techscienceinterest.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techscienceinterest.blogspot.com/feeds/6465189573228263988/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techscienceinterest.blogspot.com/2010/09/man-pages-as-pdf.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1546366980808220992/posts/default/6465189573228263988'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1546366980808220992/posts/default/6465189573228263988'/><link rel='alternate' type='text/html' href='http://techscienceinterest.blogspot.com/2010/09/man-pages-as-pdf.html' title='Man Pages as PDF'/><author><name>Brent Coffey</name><uri>http://www.blogger.com/profile/14987122747702890412</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_7p4NxoKlbj4/S3RxOjAJ_rI/AAAAAAAAAEw/kOlFmUROluI/S220/Photo+on+2010-02-11+at+15.39+%232.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1546366980808220992.post-5082034602520982033</id><published>2010-08-16T14:01:00.002-04:00</published><updated>2010-08-16T14:04:40.760-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='photography'/><category scheme='http://www.blogger.com/atom/ns#' term='Photoshop'/><category scheme='http://www.blogger.com/atom/ns#' term='mac os x'/><category scheme='http://www.blogger.com/atom/ns#' term='Aperture'/><category scheme='http://www.blogger.com/atom/ns#' term='gps'/><category scheme='http://www.blogger.com/atom/ns#' term='GPSBabel'/><category scheme='http://www.blogger.com/atom/ns#' term='Photolinker'/><title type='text'>GeoTagging Photos and then What to do with them</title><content type='html'>How to GeoTag Photos and What to do once they are GeoTagged&lt;br /&gt;&lt;br /&gt;My Hardware:&lt;br /&gt;&lt;br /&gt;1. &lt;a href="http://www.usa.canon.com/cusa/consumer/products/cameras/slr_cameras/eos_rebel_t2i_ef_s_18_55mm_is_kit"&gt;Canon EOS Digital T2i Camera&lt;/a&gt;&lt;br /&gt;2. &lt;a href="http://shop.delorme.com/OA_HTML/DELibeCCtpSctDspRte.jsp?section=10461&amp;forge_prod=5STExSQifnSJSXruOJVwqgLL:S&amp;forge_prod_pses=forge_prod%3D5STExSQifnSJSXruOJVwqgLL%253AS~"&gt;Delorome PN-40 GPS&lt;/a&gt;&lt;br /&gt;3. &lt;a href="http://www.apple.com/macbookpro/"&gt;MacBook Pro&lt;/a&gt;&lt;br /&gt;4. &lt;a href="http://products.lowepro.com/product/Fastpack-350,2087,14.htm"&gt;LowePro FastPack 350&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;My Software:&lt;br /&gt;1. Mac OS X &lt;br /&gt;2. &lt;a href="http://www.gpsbabel.org/download.html"&gt;GPS Babel (Free)&lt;/a&gt;&lt;br /&gt;3. &lt;a href="http://www.earlyinnovations.com/"&gt;PhotoLinker ($50 recommended) or GPSPhotoLinker(Free)&lt;/a&gt;&lt;br /&gt;4. &lt;a href="http://www.apple.com/aperture/"&gt;Aperture 3&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Web Sites to use GeoTagged Photos (Listed in the order I would recommend using them)&lt;br /&gt;1. &lt;a href="http://www.panoramio.com"&gt;Panoramio.com&lt;/a&gt; (Easiest to use if you want your photos in Google Earth, only for scenic/landscape photography!)&lt;br /&gt;2. &lt;a href="http://www.everytrail.com"&gt;EveryTrail.com&lt;/a&gt; (If you went on a trip and you are logging your journey. Can place pictures and video of your trip along with GPS Track)&lt;br /&gt;3. &lt;a href="http://www.historypin.com/"&gt;HistoryPin&lt;/a&gt; (For Historical Photos of a place)&lt;br /&gt;&lt;br /&gt;Start of Photo Shoot Step 1:&lt;br /&gt;1. Ensure your Camera has the correct timeset, battery is fully charged for GPS and Camera.&lt;br /&gt;2. Turn on your GPS&lt;br /&gt;3. On your GPS, turn tracks on at the start of your photoshoot or trip.&lt;br /&gt;4. Once satellite lock is aquired on GPS begin journey toss gps in side mesh pouch of LowePro backpack and forget about until you are done.&lt;br /&gt;5. Hike and shoot photos at will.&lt;br /&gt;&lt;br /&gt;After Photo Shoot Step 2:&lt;br /&gt;1. Stop GPS Track and Save.&lt;br /&gt;2. Turn off GPS.&lt;br /&gt;2. Turn off Camera.&lt;br /&gt;&lt;br /&gt;Back at your Computer Step 3:&lt;br /&gt;GPS Babel&lt;br /&gt;&lt;br /&gt;1. Copy Pictures to new folder on your computer.  (Do not import to Apeture or Lightroom or anyother photo management tool yet!)&lt;br /&gt;2. Open GPS Babel&lt;br /&gt;3. Connect GPS to Computer&lt;br /&gt;4. Turn GPS On (and ensure GPS is ready to send data to computer (differs by model)).&lt;br /&gt;5. Select GPS From top pull down menu in GPS Babel&lt;br /&gt;6. Ensure ONLY Tracks is checked&lt;br /&gt;7. Select GPS XML from dropdown menu&lt;br /&gt;8. Click on File Name and choose to save your GPS XML file in the folder you created in step 1 above.&lt;br /&gt;9. Hit Apply&lt;br /&gt;10. Close GPS Babel.&lt;br /&gt;&lt;br /&gt;Photolinker&lt;br /&gt;1. Load Track (GPS XML file created above). Click Tracks-&gt;Load Tracks from File...&lt;br /&gt;2. Load all pictures saved above. Click Photos-&gt;Load Photos from File&lt;br /&gt;4. Click on GeoTagging Console button in the lower right side.&lt;br /&gt;5. Set Timezone to the timezone that the Camera is using for the pictures!! &lt;br /&gt;6. Click on one picture.&lt;br /&gt;7. Select all loaded photos (Ctrl+A)&lt;br /&gt;8. Click Geotag X Photos button in lower right side of GeoTagging Console&lt;br /&gt;9. Click Write Changed Tags&lt;br /&gt;10. Exit Photolinker&lt;br /&gt;&lt;br /&gt;Aperture&lt;br /&gt;&lt;br /&gt;1. Open Aperture.&lt;br /&gt;2. Click Import&lt;br /&gt;3. Select folder where new photos were stored&lt;br /&gt;4. Import Pictures as you would normally&lt;br /&gt;5. Make any adjustments to your photos as you normally would using Apertures tools.&lt;br /&gt;6. Once photos are imported, click on the Places button (Top Right Side) to see your photos all geotagged.&lt;br /&gt;7. Go back to Split View by clicking Split View Button (Top Right Side).&lt;br /&gt;8. Click File-&gt;Export-&gt;Versions...&lt;br /&gt;9. Create a new folder and name it "contrib"&lt;br /&gt;10. Give the photos a generic name&lt;br /&gt;11. Click ok.&lt;br /&gt;12. Wait for all photos to be exported (may take a while).&lt;br /&gt;&lt;br /&gt;NOTE: You now have JPEG versions of all of you photos on your harddrive.  These can now be used to upload to web sites.  Aperture to the best of my knowledge does not have an export for EveryTrail, Panoramio, or HistoryPin so this is why the manual export was necessary though annoying.&lt;br /&gt;&lt;br /&gt;Using your Photos to Benifit the World Step 4:&lt;br /&gt;&lt;br /&gt;Panoramio.com&lt;br /&gt;1. Open Browser&lt;br /&gt;2. Go to www.panoramio.com&lt;br /&gt;3. Create an Account&lt;br /&gt;4. Upload photos in your "contrib" folder by clicking Upload link at top of page.&lt;br /&gt;5. Follow Directions on site.&lt;br /&gt;6. Your photos, if approved should be avaible in on google earth in a few days, though it may take up to a month.  My experience has been days though.&lt;br /&gt;&lt;br /&gt;EveryTrail.com&lt;br /&gt;1. Go To www.everytrail.com&lt;br /&gt;2. Create an Account&lt;br /&gt;3. Upload GPS XML file you created&lt;br /&gt;4. Write a few sentences about your trip.&lt;br /&gt;5. Upload Photos from the "contrib" folder.&lt;br /&gt;6. Follow additional directions and photos should be placed on track correctly.&lt;br /&gt;&lt;br /&gt;HistoryPin&lt;br /&gt;&lt;br /&gt;You get the idea...same type thing... follow web sites directions&lt;br /&gt;&lt;br /&gt;Final Step Step 5:&lt;br /&gt;&lt;br /&gt;1. Tell all your friends about your photos on Panoramio and EveryTrail using the twitter and facebook links on Panoramio and EveryTrail!&lt;br /&gt;2. Post your pictures on your blog! ;-)&lt;br /&gt;&lt;br /&gt;&lt;iframe   src="http://www.panoramio.com/wapi/template/photo.html?user= 4737109&amp;amp;width=400&amp;amp;height=300"   frameborder="0" width="400" height="300" scrolling="no" marginwidth="0" marginheight="0"&gt; &lt;/iframe&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="border:1px solid #8D9D3A; width:190px;background-color:#ffffff; "&gt;&lt;div style="text-align: center; border-bottom:1px solid #DADADA;line-height:18px;color:#424241"&gt;&lt;b&gt;I’m on&lt;/b&gt; &lt;a href="http://www.everytrail.com"&gt;&lt;img src="http://www.everytrail.com/images/badge_ETlogo.png" border="0" title="EveryTrail: Map Your Trips" alt="EveryTrail: Map Your Trips" style="vertical-align:top"&gt;&lt;/a&gt;  &lt;/div&gt;&lt;div  style="padding: 4px"&gt;&lt;div style="float: left; margin-right: 5px"&gt;&lt;img src="http://graph.facebook.com/1650669486/picture&amp;type=large" width="50"&gt;   &lt;/div&gt;&lt;div style="font-size:12px"&gt;bcoffe&lt;br /&gt;&lt;span id="et-num-trips"&gt;1 trip&lt;/span&gt;     &lt;br /&gt;&lt;a href="http://www.everytrail.com/profile.php?user_id=102840" style="text-decoration:none"&gt;see my profile&lt;/a&gt;   &lt;/div&gt;&lt;div style="clear:both"&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="background-color:#AABF4A;padding:2px;text-align:center;font-size:12px; color:#FFFFFF;font-weight:bold;padding:2px;"&gt;Recent trips         by bcoffe &lt;/div&gt;&lt;div&gt;&lt;script type="text/javascript" src="http://www.everytrail.com/user/badgetrips?user_id=102840"&gt;&lt;/script&gt;                &lt;/div&gt;&lt;div style="padding:4px;background-color:#DADADA;text-align:center"&gt;&lt;b&gt;Check out EveryTrail &lt;a href="http://www.everytrail.com/guides" style="font-weight:bold"&gt;mobile travel guides&lt;/a&gt;&lt;/b&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1546366980808220992-5082034602520982033?l=techscienceinterest.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techscienceinterest.blogspot.com/feeds/5082034602520982033/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techscienceinterest.blogspot.com/2010/08/geotagging-photos-and-then-what-to-do.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1546366980808220992/posts/default/5082034602520982033'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1546366980808220992/posts/default/5082034602520982033'/><link rel='alternate' type='text/html' href='http://techscienceinterest.blogspot.com/2010/08/geotagging-photos-and-then-what-to-do.html' title='GeoTagging Photos and then What to do with them'/><author><name>Brent Coffey</name><uri>http://www.blogger.com/profile/14987122747702890412</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_7p4NxoKlbj4/S3RxOjAJ_rI/AAAAAAAAAEw/kOlFmUROluI/S220/Photo+on+2010-02-11+at+15.39+%232.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1546366980808220992.post-4235757130398093051</id><published>2010-08-06T10:25:00.001-04:00</published><updated>2010-08-06T10:29:13.086-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='JUnit'/><title type='text'>JUnit Parameterized Test</title><content type='html'>&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;Sometimes you want to test a method with various inputs to perhaps check to ensure the method works with all kinds of different data. I had just this issue the other day and knowing that JUnit 4 supports "Parameterized" Test I decided to use that methodology. Here is how it works.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: x-large;"&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;Problem&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;Imagine you have a method in a class that makes a word plural by adding an "s" or an "es" to the end of the word (yes I know, silly example, but just go with me on this!).&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;Example if you pass in the String "dog" it should return "dogs." If you pass in the word "fish" it returns "fishes." &lt;span class="Apple-style-span" style="font-size: small;"&gt;(&lt;/span&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;Because this is a simplistic example and this blog is about parameterized test, not how to make a word plural our method will only work for these two words.)&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: x-large;"&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;Method to Test&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;script class="brush: java" type="syntaxhighlighter"&gt;&lt;![CDATA[package org.example.grammer;public class WordChanger {     public static String pluralizer(String word){          if (word.equalsIgnoreCase("dog")) return "dogs";          if (word.equalsIgnoreCase("fish")) return "fishes";          return null;     }}]]&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: x-large;"&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;JUnit Test&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;Comments in the code tell what is being done&lt;/span&gt;&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;&lt;script class="brush: java" type="syntaxhighlighter"&gt;&lt;![CDATA[package org.example.grammer;import static org.junit.Assert.*;import java.util.Arrays;import java.util.Collection;//Imports Need for Parameterized Testimport org.junit.Test;import org.junit.runner.RunWith;import org.junit.runners.Parameterized;import org.junit.runners.Parameterized.Parameters;//Must Use this Runner. If you are trying to use Spring then you will have to write your own runner.@RunWith(Parameterized.class)public class WordChangerTest {     // Declare private variables that will be used to hold one set of the parameters     private String testString;     private String expectedResultString;     // Create a Constructor for the Test. It must take in the EXACT parameters     // In this case I will pass to the test the string to test, and the expected result.     public WordChangerTest(String testString, String expectedResultString) {          // Set the private variables declard above to the values passed in.          this.testString = testString;          this.expectedResultString = expectedResultString;     }     //Actual Test nothing new here, except you should use the private variables you declared     @Test     public void testPluralizer() {          assertEquals(expectedResultString, WordChanger.pluralizer(testString));     }     //Actual Parameters to pass in. You can pass in any type of data such as String, int, byte, etc..     @Parameters     public static Collection data() {          // When the test runs the first time it will pass in dog          // When the test runs the second time it will pass in fish          // If we wanted the test to run a third time we would just add another pair of objects to the list          return Arrays.asList(new Object[][] { { "dog", "dogs" }, { "fish", "fishes" } });     }}]]&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;Thats It. When you run your JUnit test in the Eclipse IDE you should see this result:&lt;/span&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_7p4NxoKlbj4/TFwZ1-o2O7I/AAAAAAAAAhw/__aAEK4MHdM/s1600/ParamertizedJunit.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="160" src="http://4.bp.blogspot.com/_7p4NxoKlbj4/TFwZ1-o2O7I/AAAAAAAAAhw/__aAEK4MHdM/s640/ParamertizedJunit.jpg" width="640" /&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/1546366980808220992-4235757130398093051?l=techscienceinterest.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techscienceinterest.blogspot.com/feeds/4235757130398093051/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techscienceinterest.blogspot.com/2010/08/junit-parameterized-test.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1546366980808220992/posts/default/4235757130398093051'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1546366980808220992/posts/default/4235757130398093051'/><link rel='alternate' type='text/html' href='http://techscienceinterest.blogspot.com/2010/08/junit-parameterized-test.html' title='JUnit Parameterized Test'/><author><name>Brent Coffey</name><uri>http://www.blogger.com/profile/14987122747702890412</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_7p4NxoKlbj4/S3RxOjAJ_rI/AAAAAAAAAEw/kOlFmUROluI/S220/Photo+on+2010-02-11+at+15.39+%232.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_7p4NxoKlbj4/TFwZ1-o2O7I/AAAAAAAAAhw/__aAEK4MHdM/s72-c/ParamertizedJunit.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1546366980808220992.post-8198099382785706856</id><published>2010-07-18T07:28:00.001-04:00</published><updated>2010-07-18T07:37:03.661-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Photoshop'/><title type='text'>Turning a White Sky, Blue</title><content type='html'>&lt;div&gt;I work a lot with Photoshop for various software engineering projects, but every now and then I have a family project that requires the use of my Photoshop skills. &amp;nbsp;The other day my oldest daughter and I went on a brief hike. &amp;nbsp;Along the way I stopped to take some pictures with my new Canon Rebel T2i and Ultra-Wide-Angle lens. &amp;nbsp;I got some great pictures but lots of them showed the sky as white instead of blue. &amp;nbsp;A very common photograph problem. &amp;nbsp;Here is one of the pictures before I photoshopped it: &amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_7p4NxoKlbj4/TELdNunbOiI/AAAAAAAAAgk/cwKgzgUidSY/s1600/Forest.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="640" src="http://2.bp.blogspot.com/_7p4NxoKlbj4/TELdNunbOiI/AAAAAAAAAgk/cwKgzgUidSY/s640/Forest.jpg" width="427" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;As you can see the sky is mostly white. On the web there are various techniques people blog for fixing this, but most of them are tedious as they require selecting the entire sky, including all of the hints of sky inbetween the leaves! &amp;nbsp;Yuck.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;So here is how I fix the problem in less than 1 Minute without having to tediously select every hint of sky.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;1. Create a new layer by clicking the new layer icon at the bottom of your layers window&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_7p4NxoKlbj4/TELfJL-5XBI/AAAAAAAAAgs/uA2Vr_iP950/s1600/newLayer.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/_7p4NxoKlbj4/TELfJL-5XBI/AAAAAAAAAgs/uA2Vr_iP950/s320/newLayer.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;3.&amp;nbsp;Change the Overlay mode to Darkest Color (This is the magic step!)&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;2. Select the new layer by clicking once on it.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;3. Click on the Gradient Tool&amp;nbsp;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_7p4NxoKlbj4/TELf9jw5lNI/AAAAAAAAAg0/AcX2Ei6MrS8/s1600/gradient.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/_7p4NxoKlbj4/TELf9jw5lNI/AAAAAAAAAg0/AcX2Ei6MrS8/s320/gradient.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;4. Ensure that Gradient is set to Linear Gradient and then create a gradient that goes from the desired dark blue color to a light color blue by clicking on the gradient controls at the top. &amp;nbsp;Click the drop down color bar to set the colors of the gradient and click the icon next to it to change to Linear Gradient&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_7p4NxoKlbj4/TELg3Fos6pI/AAAAAAAAAg8/-4yzA5FUW1A/s1600/gradientControl.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://1.bp.blogspot.com/_7p4NxoKlbj4/TELg3Fos6pI/AAAAAAAAAg8/-4yzA5FUW1A/s320/gradientControl.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;5. I choose the colors #269df0 and #dce2ec as the dark and light colors, respectively, inside of the Gradient editor.&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_7p4NxoKlbj4/TELh54QfuEI/AAAAAAAAAhE/vUYCKMgWa_I/s1600/gradientEditor.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="400" src="http://3.bp.blogspot.com/_7p4NxoKlbj4/TELh54QfuEI/AAAAAAAAAhE/vUYCKMgWa_I/s400/gradientEditor.jpg" width="370" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;6. Holding down the left mouse button, on your new layer, from about where you want the lightest part of the sky drag up and a little past the top of your picture and let go. &amp;nbsp;You may need to do this a couple of times to get the colors right where you want them. &amp;nbsp;Here are my end results. &amp;nbsp;&lt;i&gt;(For more of a real sky look download some free cloud brushes and use them to put a few white clouds in)&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_7p4NxoKlbj4/TELk543ygkI/AAAAAAAAAhM/Dxd1ulQXLEI/s1600/newForest.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="640" src="http://2.bp.blogspot.com/_7p4NxoKlbj4/TELk543ygkI/AAAAAAAAAhM/Dxd1ulQXLEI/s640/newForest.jpg" width="427" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;7. &amp;nbsp;For even a better effect. Do the water as well! &amp;nbsp;You do it the exact same way, creating a new layer, etc. but drag the gradient from middle to bottom (instead of middle to top as you did on the sky).&lt;br /&gt;&lt;br /&gt;Final result with water:&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_7p4NxoKlbj4/TELnRFQs3KI/AAAAAAAAAhU/EaDhiVCTr78/s1600/finalWithWater.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="640" src="http://1.bp.blogspot.com/_7p4NxoKlbj4/TELnRFQs3KI/AAAAAAAAAhU/EaDhiVCTr78/s640/finalWithWater.jpg" width="428" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1546366980808220992-8198099382785706856?l=techscienceinterest.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techscienceinterest.blogspot.com/feeds/8198099382785706856/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techscienceinterest.blogspot.com/2010/07/turning-white-sky-blue.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1546366980808220992/posts/default/8198099382785706856'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1546366980808220992/posts/default/8198099382785706856'/><link rel='alternate' type='text/html' href='http://techscienceinterest.blogspot.com/2010/07/turning-white-sky-blue.html' title='Turning a White Sky, Blue'/><author><name>Brent Coffey</name><uri>http://www.blogger.com/profile/14987122747702890412</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_7p4NxoKlbj4/S3RxOjAJ_rI/AAAAAAAAAEw/kOlFmUROluI/S220/Photo+on+2010-02-11+at+15.39+%232.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_7p4NxoKlbj4/TELdNunbOiI/AAAAAAAAAgk/cwKgzgUidSY/s72-c/Forest.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1546366980808220992.post-4896600616032128193</id><published>2010-06-14T17:46:00.000-04:00</published><updated>2010-06-14T17:46:08.666-04:00</updated><title type='text'>Highlight in Dock Stack Snow Leopard</title><content type='html'>&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;I really love my mac.  I love it so much I can't figure out how I, at one time, developed on a windows computer.  I can't imagine going back.  What I love about the mac is that just about anytime I find something I don't like about the way it works I can usually just find a way to change it. &lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;I didn't like the fact that on the dock stack when I placed my mouse over something it didn't hightlight.  Googled and found the answer &lt;/span&gt;&lt;a href="http://www.thecustommac.com/adding-highlight-snow-leopard-stacks/"&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;here&lt;/span&gt;&lt;/a&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;. Here are the steps:&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Open Terminal&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="color: #111111; line-height: 18px; white-space: pre;"&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;type:&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt; defaults write com.apple.dock mouse-over-hilite-stack -boolean YES&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="color: #111111; line-height: 18px; white-space: pre;"&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;type:&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt; killall dock&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;&lt;span class="Apple-style-span" style="color: #111111; line-height: 18px; white-space: pre;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="-webkit-text-decorations-in-effect: none; color: #111111; line-height: 18px; white-space: pre;"&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;Thats it!  Now your dock stack will highlight as you mouse over an item.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="-webkit-text-decorations-in-effect: none; color: #111111; line-height: 18px; white-space: pre;"&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_7p4NxoKlbj4/TBaijffdk1I/AAAAAAAAAMU/xXJO7S9g7JI/s1600/highlight+dock.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/_7p4NxoKlbj4/TBaijffdk1I/AAAAAAAAAMU/xXJO7S9g7JI/s320/highlight+dock.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;span class="Apple-style-span" style="-webkit-text-decorations-in-effect: none; color: #111111; line-height: 18px; white-space: pre;"&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1546366980808220992-4896600616032128193?l=techscienceinterest.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techscienceinterest.blogspot.com/feeds/4896600616032128193/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techscienceinterest.blogspot.com/2010/06/highlight-in-dock-stack-snow-leopard.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1546366980808220992/posts/default/4896600616032128193'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1546366980808220992/posts/default/4896600616032128193'/><link rel='alternate' type='text/html' href='http://techscienceinterest.blogspot.com/2010/06/highlight-in-dock-stack-snow-leopard.html' title='Highlight in Dock Stack Snow Leopard'/><author><name>Brent Coffey</name><uri>http://www.blogger.com/profile/14987122747702890412</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_7p4NxoKlbj4/S3RxOjAJ_rI/AAAAAAAAAEw/kOlFmUROluI/S220/Photo+on+2010-02-11+at+15.39+%232.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_7p4NxoKlbj4/TBaijffdk1I/AAAAAAAAAMU/xXJO7S9g7JI/s72-c/highlight+dock.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1546366980808220992.post-8976905185550768</id><published>2010-06-03T13:00:00.004-04:00</published><updated>2010-06-03T13:58:11.335-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='Janino'/><title type='text'>Execute a formula stored as a String</title><content type='html'>&lt;span id="goog_2020451340"&gt;&lt;/span&gt;&lt;span id="goog_2020451341"&gt;&lt;/span&gt;&lt;a href="http://www.blogger.com/"&gt;&lt;/a&gt;I recently had a situation where I needed to calculate a formula that came from an outside source as input into my program.  In this case the formula was from a record in the database.  Each formula was different.&lt;br /&gt;Coming from a database, the formula was passed into my application as a String so it looked something like this "(x + y) /z".  Since the formula was something sent to the application during runtime I needed to parse the String and turn it into an actual formula, replacing the variables (i.e. x, y, and z) with actual values that came from another place. In this case other servers on a network.&lt;br /&gt;&lt;br /&gt;Then to make things more complicated some of the formulas where not your typical math formula but where more like this "(x + Math.Round(y)) / z" or something to that effect&lt;br /&gt;&lt;br /&gt;So what to do? I needed a robust solution that could handle parsing a String and executing it as a valid java code during runtime.  This is when I discovered the really cool open source product called &lt;a href="http://docs.codehaus.org/display/JANINO/Home"&gt;Janino&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Here is how it works.  &lt;br /&gt;&lt;br /&gt;1. You pass in the Parameter Names&lt;br /&gt;2. You pass in the Parameter Types&lt;br /&gt;3. You pass in the result type (in my case all mine would be doubles)&lt;br /&gt;4. You pass in the formula&lt;br /&gt;5. Call evaluate&lt;br /&gt;&lt;br /&gt;This example is taken almost right from &lt;a href="http://docs.codehaus.org/display/JANINO/Basic"&gt;there web site&lt;/a&gt;.  You can also do even more powerful stuff with it.  But this is just to wet your appetite.&lt;br /&gt;&lt;br /&gt;&lt;script class="brush: java" type="syntaxhighlighter"&gt;&lt;![CDATA[ExpressionEvaluator ee = new ExpressionEvaluator(    "(x + Math.Round(y)) / z",                     // expression    double.class,                           // expressionType    new String[] { "x", "y", "z" },           // parameterNames    new Class[] { double.class, double.class, double.class } // parameterTypes);// Evaluate it with varying parameter values; very fast.Double res = (Integer) ee.evaluate(    new Object[] {          // parameterValues        new Double(10.0),        new Double(13.5),        new Double(2.2),    });System.out.println("res = " + res);]]&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Definitely check this out.  Better than writing the code yourself.  Janino is available from the Maven central repository.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1546366980808220992-8976905185550768?l=techscienceinterest.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techscienceinterest.blogspot.com/feeds/8976905185550768/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techscienceinterest.blogspot.com/2010/06/execute-formula-stored-as-string.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1546366980808220992/posts/default/8976905185550768'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1546366980808220992/posts/default/8976905185550768'/><link rel='alternate' type='text/html' href='http://techscienceinterest.blogspot.com/2010/06/execute-formula-stored-as-string.html' title='Execute a formula stored as a String'/><author><name>Brent Coffey</name><uri>http://www.blogger.com/profile/14987122747702890412</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_7p4NxoKlbj4/S3RxOjAJ_rI/AAAAAAAAAEw/kOlFmUROluI/S220/Photo+on+2010-02-11+at+15.39+%232.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1546366980808220992.post-1914359226277129221</id><published>2010-06-03T09:07:00.004-04:00</published><updated>2010-06-03T13:59:23.559-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='AspectJ'/><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='AOP'/><title type='text'>AspectJ Softening (Getting Rid of Annoying Try Catch Statements)</title><content type='html'>I love Java. I really do. But I absolutely hate the "try catch" construct. &amp;nbsp;Granted sometimes I can recover from a thrown exception by putting meaningful work in the catch statement. But more often than not I find myself simply putting a log statement in the catch section of the code. So the code looks like&lt;br /&gt;&lt;br /&gt;&lt;script type="syntaxhighlighter" class="brush: java"&gt;&lt;![CDATA[try {    someMethodThatFails();} catch (Exception exception) {    log.error("There is nothing I can do, fix the code! So this never gets called!");} ]]&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Now I end up "crosscutting" my code all over the place with log statements and the code is harder to read because the meaningful work is obscured by boilerplate try catch code. What is an engineer to do?&lt;br /&gt;&lt;br /&gt;Well fortunately the people at AspectJ have a way to fix this with a construct. Here is what it looks like:&lt;br /&gt;&lt;br /&gt;&lt;script type="syntaxhighlighter" class="brush: java"&gt;&lt;![CDATA[declare soft : Exception : execution (* *.someMethodThatFails());]]&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;The key words "declare soft" are followed by the type of exception you want to catch in this case "Exception."Then they are followed by the "pointcut" in this case &lt;br /&gt;&lt;script type="syntaxhighlighter" class="brush: java"&gt;&lt;![CDATA[execution(* *.someMethodThatFails(..));]]&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;This will now catch the exception thrown from "someMethodThatFails()." Which is exactly what I want! &amp;nbsp;Now one last step to log the error I write a really good log statement:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;script type="syntaxhighlighter" class="brush: java"&gt;&lt;![CDATA[after() throwing (Exception exception) : call (* *.someMethodThatFails()) {      log.error("Inside the class " + thisJoinPoint.getSourceLocation().getFileName() + " at line " + thisJoinPoint.getSourceLocation().getLine() + " a call was made to " + thisJoinPoint.getSignature().toShortString() + " and a Exception was thrown.");}]]&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Now I can back to my original code and remove the try catch block and am left &amp;nbsp;with this one line of code! &lt;br /&gt;&lt;br /&gt;&lt;script type="syntaxhighlighter" class="brush: java"&gt;&lt;![CDATA[someMethodThatFails();]]&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;Beautiful easy to read, and now all my log statements are not crosscutting the code but are elegantly all contained inside of one Aspect which I named ExceptionHandler.aj&lt;br /&gt;&lt;br /&gt;I defiantly recommend doing this everywhere you have a try catch and no real work is being done in the catch.&lt;br /&gt;&lt;br /&gt;One last trick. Suppose a constructor throws an exception, as is the case if you are using the Janino ExpressionEvaluater constructor? &amp;nbsp;How do you catch that? &amp;nbsp;Well this gave me fits the key is to use the "new" as if it where the method. &amp;nbsp;Here is what I mean:&lt;br /&gt;&lt;br /&gt;&lt;script type="syntaxhighlighter" class="brush: java"&gt;&lt;![CDATA[declare soft : org.codehaus.janino.Scanner.ScanException : within(org.example.myClass) &amp;&amp; execution(*.new(..)); ]]&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;See I use the keywords "declare soft" followed by the exception I want to catch ("ScanException"), followed by a valid constructor pointcut "within(org.example.myClass) &amp;&amp; execution(*.new(..));"&lt;br /&gt;&lt;br /&gt;NOTE I had significant problems when I tried putting something before the "new" besides a splat "*"&lt;br /&gt;&lt;br /&gt;Hope this helps get you started.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1546366980808220992-1914359226277129221?l=techscienceinterest.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techscienceinterest.blogspot.com/feeds/1914359226277129221/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techscienceinterest.blogspot.com/2010/06/aspectj-softening-getting-rid-of.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1546366980808220992/posts/default/1914359226277129221'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1546366980808220992/posts/default/1914359226277129221'/><link rel='alternate' type='text/html' href='http://techscienceinterest.blogspot.com/2010/06/aspectj-softening-getting-rid-of.html' title='AspectJ Softening (Getting Rid of Annoying Try Catch Statements)'/><author><name>Brent Coffey</name><uri>http://www.blogger.com/profile/14987122747702890412</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_7p4NxoKlbj4/S3RxOjAJ_rI/AAAAAAAAAEw/kOlFmUROluI/S220/Photo+on+2010-02-11+at+15.39+%232.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1546366980808220992.post-5150930725558003646</id><published>2010-05-08T16:01:00.008-04:00</published><updated>2011-04-29T15:10:57.790-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='bash'/><category scheme='http://www.blogger.com/atom/ns#' term='mac os x'/><title type='text'>Change to new BASH Shell (4.1) for Mac OS X</title><content type='html'>&lt;b&gt;UPDATE: THIS STILL WORKS WITH BASH 4.2&lt;/b&gt;&lt;br /&gt;Suppose you want to do some uber awesome shell scripting. &amp;nbsp;So you need to get the latest version of the Bash shell installed, this way you can use all the new features. &amp;nbsp;Well have no fear, this is super simple. &amp;nbsp;Here is how to update the default bash shell (3.2) to bash 4.1 on Mac OS X&amp;nbsp;Snow Leopard 10.6.3.&lt;br /&gt;&lt;br /&gt;(&lt;i&gt;Be sure you have admin/root rights to your box and that you have Apple XCode installed. &amp;nbsp;If you do then you are ready to get started. &amp;nbsp;If you don't have apple XCode installed it can be downloaded for free from Apple's Developer Website but you must be registered to get it.&lt;/i&gt;)&lt;br /&gt;&lt;br /&gt;&lt;i&gt;&lt;b&gt;NOTE&lt;/b&gt;:&amp;nbsp;&lt;a href="http://concisionandconcinnity.blogspot.com/2009/03/upgrade-bash-to-40-in-mac-os-x.html"&gt;This blog&lt;/a&gt;&lt;/i&gt;&lt;i&gt; was a major help, but it skipped one step that might mess up a newbie so I'm explicitly documenting it here.&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Step one download the &lt;a href="ftp://ftp.cwru.edu/pub/bash/bash-4.1.tar.gz"&gt;latest Bash code by clicking here&lt;/a&gt;.&lt;/li&gt;&lt;li&gt;Open up your terminal and change to the directory where you saved the download file. &amp;nbsp;In my case I typed in:&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;cd Downloads&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;Uncompress the tar file by typing: &lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;tar zxvf bash-4.1.tar&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;Change to newly uncompressed directory :&amp;nbsp;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;cd bash-4.1&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;Now configure, compile, and install code by typing: &lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;./configure &amp;amp;&amp;amp; make &amp;amp;&amp;amp; sudo make install&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;Make the new shell your default shell by typing (NOTE: replace {user_name} with your actual user name. &amp;nbsp;You can get your actual user name if you do not know it by typing '&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;whoami&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;' before typing this command):&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt; chsh -s /usr/local/bin/bash {user_name}&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;Now you need to register your shell by typing:&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt; sudo bash -c "echo /usr/local/bin/bash &amp;gt;&amp;gt; /private/etc/shells"&lt;/span&gt;&lt;/li&gt;&lt;li&gt;Shutdown your terminal and reopen it.&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;Check to make sure it all worked by typing:&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt; help &lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;If it worked it should say the following:&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;GNU bash, version 4.1.0(1)-release (i386-apple-darwin10.3.0)&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;)&lt;/span&gt;&lt;/li&gt;&lt;li&gt;Change to /bin by typing: &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;cd /bin&lt;/span&gt;&lt;/li&gt;&lt;li&gt;Move bash to bash-old: &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;sudo mv bash bash-old&lt;/span&gt;&lt;/li&gt;&lt;li&gt;Create a symlink to the new bash command: &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;sudo ln -s /usr/local/bin/bash bash&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;All Done!&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1546366980808220992-5150930725558003646?l=techscienceinterest.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techscienceinterest.blogspot.com/feeds/5150930725558003646/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techscienceinterest.blogspot.com/2010/05/change-to-new-bash-shell-41-for-mac-os.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1546366980808220992/posts/default/5150930725558003646'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1546366980808220992/posts/default/5150930725558003646'/><link rel='alternate' type='text/html' href='http://techscienceinterest.blogspot.com/2010/05/change-to-new-bash-shell-41-for-mac-os.html' title='Change to new BASH Shell (4.1) for Mac OS X'/><author><name>Brent Coffey</name><uri>http://www.blogger.com/profile/14987122747702890412</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_7p4NxoKlbj4/S3RxOjAJ_rI/AAAAAAAAAEw/kOlFmUROluI/S220/Photo+on+2010-02-11+at+15.39+%232.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1546366980808220992.post-8269402077570004473</id><published>2010-04-12T19:10:00.003-04:00</published><updated>2010-04-12T19:18:43.403-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Google Earth'/><category scheme='http://www.blogger.com/atom/ns#' term='gps'/><category scheme='http://www.blogger.com/atom/ns#' term='delorme'/><title type='text'>Google Earth Distance of Track</title><content type='html'>&lt;span class="Apple-style-span" style="line-height: 15px; white-space: pre-wrap;"&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;Well I hate to say it but sometimes I miss the obvious...or not so obvious.  Today I went for a Bike ride with my Delorme PN-40 attached to my bike.  Again I wanted to know the distance of my ride using google earth (obviously the GPS tells me but I want it in google earth!).  So following my last blog I was getting ready to upload the data to the aforementioned web site, when I discovered how to do this directly in Google Earth! &amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="line-height: 15px; white-space: pre-wrap;"&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="line-height: 15px; white-space: pre-wrap;"&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;Drum role.... Click the imported track over in the left hand side!  Once you do that a dialog appears and tells you the distance.  Ugh...... Why that had to be so hard to figure out I don't know.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="line-height: 15px; white-space: pre-wrap;"&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="line-height: 15px; white-space: pre-wrap;"&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;You can even click on individual waypoints along your track and the same dialog will appear but tell you your speed and time at the given waypoint!&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_7p4NxoKlbj4/S8OoZsuSUdI/AAAAAAAAAJs/MowLh46B4SI/s1600/gps+distance.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="306" src="http://2.bp.blogspot.com/_7p4NxoKlbj4/S8OoZsuSUdI/AAAAAAAAAJs/MowLh46B4SI/s400/gps+distance.jpg" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;span class="Apple-style-span" style="font-family: monospace; font-size: small;"&gt;&lt;span class="Apple-style-span" style="font-size: 12px; line-height: 15px; white-space: pre-wrap;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1546366980808220992-8269402077570004473?l=techscienceinterest.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techscienceinterest.blogspot.com/feeds/8269402077570004473/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techscienceinterest.blogspot.com/2010/04/google-earth-distance-of-track.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1546366980808220992/posts/default/8269402077570004473'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1546366980808220992/posts/default/8269402077570004473'/><link rel='alternate' type='text/html' href='http://techscienceinterest.blogspot.com/2010/04/google-earth-distance-of-track.html' title='Google Earth Distance of Track'/><author><name>Brent Coffey</name><uri>http://www.blogger.com/profile/14987122747702890412</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_7p4NxoKlbj4/S3RxOjAJ_rI/AAAAAAAAAEw/kOlFmUROluI/S220/Photo+on+2010-02-11+at+15.39+%232.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_7p4NxoKlbj4/S8OoZsuSUdI/AAAAAAAAAJs/MowLh46B4SI/s72-c/gps+distance.jpg' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1546366980808220992.post-7781182747368986627</id><published>2010-03-20T16:01:00.003-04:00</published><updated>2010-03-21T14:33:05.801-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='KML'/><category scheme='http://www.blogger.com/atom/ns#' term='Google Earth'/><category scheme='http://www.blogger.com/atom/ns#' term='Bike'/><category scheme='http://www.blogger.com/atom/ns#' term='gps'/><title type='text'>Importing a Track from a DeLorme PN-40 to Google Earth Using a Mac</title><content type='html'>&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;I bought a new &lt;/span&gt;&lt;a href="http://www.fujibikes.com/LifeStyle/Comfort/Sagres-1-0.aspx"&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;Fuji Sarges 1.0&lt;/span&gt;&lt;/a&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt; bike yesterday and I have to say I love it! &amp;nbsp;It's comfortable and perfect for running around the neighborhood with the kids. &amp;nbsp;I only live about 5 miles from my office so I may also try riding it to work a few times this summer once I get used to the gears and figure out where to park it at the office. &amp;nbsp;But like all good Engineers I wasted no time in thinking about how I could hook up my GPS to it to figure out how fast I am going, track my rides, and figure out how far I went on a ride. Here is how i figured I did it.&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;First off note that you can find your distance just by turning on your gps enable a new track when you start your ride and then &amp;nbsp;save your newly created "track" at the end of your ride. &amp;nbsp;When you save it will tell you the total distance. &amp;nbsp;But that's no fun! &amp;nbsp;I want to see the track in Google Earth on my mac!&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;Step One: Get the Track off of the GPS&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Lucida Grande'; font-size: small;"&gt;&lt;span class="Apple-style-span" style="font-size: 11px;"&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-family: Times; font-size: medium; font-weight: normal;"&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Lucida Grande'; font-size: small;"&gt;&lt;b&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Lucida Grande'; font-size: small;"&gt;&lt;b&gt;&lt;ol&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"&gt;Download the free GPS Babel tool for the mac from www.gpsbabel.org. &amp;nbsp;Be sure to scroll to the bottom of the Dowmload page and choose the Mac Beta version. &amp;nbsp;I had issues with the release version.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"&gt;Install GPS Babel as you would any Mac software.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"&gt;Connect your DeLerome PN-40 to your mac via the provided USB Cable&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"&gt;Turn on your GPS&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"&gt;Open GPS Babel&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"&gt;When your GPS prompts, Choose Data Transfer mode by clicking enter&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"&gt;Import Tracks with GPS Babel and Save them as a KML file. &amp;nbsp;Hit Apply&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Lucida Grande'; font-size: small;"&gt;&lt;span class="Apple-style-span" style="font-size: 11px;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Lucida Grande'; font-size: small;"&gt;&lt;span class="Apple-style-span" style="font-size: 11px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Lucida Grande'; font-size: small;"&gt;&lt;span class="Apple-style-span" style="font-size: 11px;"&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"&gt;NOTE:&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"&gt; Here is what your GPS Babel screen may look like:&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span class="Apple-style-span" style="font-family: 'Lucida Grande'; font-size: small;"&gt;&lt;b&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Lucida Grande'; font-size: small;"&gt;&lt;span class="Apple-style-span" style="font-size: 11px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_7p4NxoKlbj4/S6UmBJRA1CI/AAAAAAAAAJc/Koxyirgj6Fk/s1600-h/gpsbabel.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="572" src="http://4.bp.blogspot.com/_7p4NxoKlbj4/S6UmBJRA1CI/AAAAAAAAAJc/Koxyirgj6Fk/s640/gpsbabel.jpg" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;&lt;a href="http://4.bp.blogspot.com/_7p4NxoKlbj4/S6UmBJRA1CI/AAAAAAAAAJc/Koxyirgj6Fk/s1600-h/gpsbabel.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;/a&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;&lt;b&gt;Step Two: Import to Google Earth&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;/div&gt;&lt;ol&gt;&lt;li&gt;Open Google Earth&lt;/li&gt;&lt;li&gt;Click File-&amp;gt;Open&lt;/li&gt;&lt;li&gt;Select the File you saved&lt;/li&gt;&lt;/ol&gt;&lt;div&gt;Your Path and track points should now show up on Google Earth.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;But wait I want to know the distance of my path? &amp;nbsp;I could find no way to do this in google earth itself! Unbelievable! &amp;nbsp;I would think I could right click on the path and click a label called "Distance" but alas, there is no such option. &amp;nbsp;Well lots of other people had this same issue and so here is what you can do:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;Step Three: &amp;nbsp;Third Party To the rescue&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;ol&gt;&lt;li&gt;Open Safari&lt;/li&gt;&lt;li&gt;Go to&amp;nbsp;&lt;a href="http://www.emaltd.net/google/gec/utilities/"&gt;http://www.emaltd.net/google/gec/utilities/&lt;/a&gt;&lt;/li&gt;&lt;li&gt;Go Back to Google Earth&lt;/li&gt;&lt;li&gt;On the left hand side, find your path&lt;/li&gt;&lt;li&gt;Right Click&lt;/li&gt;&lt;li&gt;Click Copy&lt;/li&gt;&lt;li&gt;Paste the path in the text box on the web site provided.&lt;/li&gt;&lt;li&gt;Check British Units if you want the results in miles&lt;/li&gt;&lt;li&gt;Click Calculate&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_7p4NxoKlbj4/S6Uok9FkhhI/AAAAAAAAAJk/qyP7crauQzs/s1600-h/googlePathDistanceWeb.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="304" src="http://3.bp.blogspot.com/_7p4NxoKlbj4/S6Uok9FkhhI/AAAAAAAAAJk/qyP7crauQzs/s640/googlePathDistanceWeb.jpg" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;Here are my results:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="white-space: pre-wrap;"&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;Remember to click the "View in Google Earth" button on the right.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="white-space: pre-wrap;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="white-space: pre-wrap;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="white-space: pre-wrap;"&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;This list is only the list of distances. &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Lucida Grande'; font-size: 11px; white-space: pre-wrap;"&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Lucida Grande'; font-size: small;"&gt;&lt;span class="Apple-style-span" style="font-size: 11px; white-space: pre-wrap;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Lucida Grande'; font-size: small;"&gt;&lt;span class="Apple-style-span" style="font-size: 11px; white-space: pre-wrap;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Lucida Grande'; font-size: 11px; white-space: pre-wrap;"&gt;Total: 1.3765 mile  1 of 1: Bike around neighborhood (Path)      Total: 1.3765 mile  &lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1546366980808220992-7781182747368986627?l=techscienceinterest.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techscienceinterest.blogspot.com/feeds/7781182747368986627/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techscienceinterest.blogspot.com/2010/03/importing-track-from-delorme-pn-40-to.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1546366980808220992/posts/default/7781182747368986627'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1546366980808220992/posts/default/7781182747368986627'/><link rel='alternate' type='text/html' href='http://techscienceinterest.blogspot.com/2010/03/importing-track-from-delorme-pn-40-to.html' title='Importing a Track from a DeLorme PN-40 to Google Earth Using a Mac'/><author><name>Brent Coffey</name><uri>http://www.blogger.com/profile/14987122747702890412</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_7p4NxoKlbj4/S3RxOjAJ_rI/AAAAAAAAAEw/kOlFmUROluI/S220/Photo+on+2010-02-11+at+15.39+%232.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_7p4NxoKlbj4/S6UmBJRA1CI/AAAAAAAAAJc/Koxyirgj6Fk/s72-c/gpsbabel.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1546366980808220992.post-1099559505653947805</id><published>2010-03-19T09:36:00.007-04:00</published><updated>2010-03-21T14:31:01.447-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='AspectJ'/><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='Design Patterns'/><category scheme='http://www.blogger.com/atom/ns#' term='AOP'/><title type='text'>Using AspectJ for the Observable Design Pattern</title><content type='html'>In a nutshell the Observable design pattern says that certain entities (i.e. Observers) want to be notified when an attribute of a class changes. &amp;nbsp;The class that is changing we call the the "Subject" or the "Observable." &amp;nbsp;Often the "subject" is a pojo with just a bunch of getters and setters. &amp;nbsp;A common example would be a pojo representing a record in a database table. &amp;nbsp;Suppose you have a table in a database called "Animal." &amp;nbsp;Each record in that table represents an animal such that the table has the following columns:&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;Id, Name, Feet, Says&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;and the following type of data:&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;1, Cat, 4, meow&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;2, Dog, 4, woof&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The records in the database then can be represented by a simple class made up of getters and setters like the following:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: #7f0055;"&gt;package&lt;/span&gt; org.example.model;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="color: #7f0055; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;public&lt;span style="color: black;"&gt; &lt;/span&gt;class&lt;span style="color: black;"&gt; Animal {&lt;/span&gt;&lt;/div&gt;&lt;div style="color: #7f0055; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/span&gt;private&lt;span style="color: black;"&gt; &lt;/span&gt;int&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: #0000c0;"&gt;id&lt;/span&gt;&lt;span style="color: black;"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;private&lt;/span&gt; String &lt;span style="color: #0000c0;"&gt;name&lt;/span&gt;;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;private&lt;/span&gt; String &lt;span style="color: #0000c0;"&gt;says&lt;/span&gt;;&lt;/div&gt;&lt;div style="color: #7f0055; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/span&gt;private&lt;span style="color: black;"&gt; &lt;/span&gt;int&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: #0000c0;"&gt;feet&lt;/span&gt;&lt;span style="color: black;"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;public&lt;/span&gt; &lt;span style="color: #7f0055;"&gt;int&lt;/span&gt; getId() {&lt;/div&gt;&lt;div style="color: #7f0055; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;/span&gt;return&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: #0000c0;"&gt;id&lt;/span&gt;&lt;span style="color: black;"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;public&lt;/span&gt; &lt;span style="color: #7f0055;"&gt;void&lt;/span&gt; setId(&lt;span style="color: #7f0055;"&gt;int&lt;/span&gt; id) {&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;this&lt;/span&gt;.&lt;span style="color: #0000c0;"&gt;id&lt;/span&gt; = id;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;public&lt;/span&gt; String getName() {&lt;/div&gt;&lt;div style="color: #7f0055; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;/span&gt;return&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: #0000c0;"&gt;name&lt;/span&gt;&lt;span style="color: black;"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;public&lt;/span&gt; &lt;span style="color: #7f0055;"&gt;void&lt;/span&gt; setName(String name) {&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;this&lt;/span&gt;.&lt;span style="color: #0000c0;"&gt;name&lt;/span&gt; = name;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;public&lt;/span&gt; String getSays() {&lt;/div&gt;&lt;div style="color: #7f0055; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;/span&gt;return&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: #0000c0;"&gt;says&lt;/span&gt;&lt;span style="color: black;"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;public&lt;/span&gt; &lt;span style="color: #7f0055;"&gt;void&lt;/span&gt; setSays(String says) {&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;this&lt;/span&gt;.&lt;span style="color: #0000c0;"&gt;says&lt;/span&gt; = says;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;public&lt;/span&gt; &lt;span style="color: #7f0055;"&gt;int&lt;/span&gt; getFeet() {&lt;/div&gt;&lt;div style="color: #7f0055; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;/span&gt;return&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: #0000c0;"&gt;feet&lt;/span&gt;&lt;span style="color: black;"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;public&lt;/span&gt; &lt;span style="color: #7f0055;"&gt;void&lt;/span&gt; setFeet(&lt;span style="color: #7f0055;"&gt;int&lt;/span&gt; feet) {&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;this&lt;/span&gt;.&lt;span style="color: #0000c0;"&gt;feet&lt;/span&gt; = feet;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;}&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;Now suppose some class, an Observer, wants to be notified when a value for a given animal changes. &amp;nbsp;Such that when:&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: #0000c0;"&gt;animal&lt;/span&gt;.setName(&lt;span style="color: #2a00ff;"&gt;"Iguana"&lt;/span&gt;);&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;the Observer is notified of the change. &amp;nbsp;The best way to do this is using AOP. &amp;nbsp;Here is how. &amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;First create a new interface called subject. &amp;nbsp;This interface will need to be implemented by all the classes that you want to observe. &amp;nbsp;Don't worry though you don't have to change all your classes. We are going to use "static" crosscutting to alter the structure of your objects without actually touching your object. &amp;nbsp;Here is my subject interface:&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: #7f0055;"&gt;package&lt;/span&gt; org.example.designpattern.observable;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="color: #7f0055; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;public&lt;span style="color: black;"&gt; &lt;/span&gt;interface&lt;span style="color: black;"&gt; Subject {&lt;/span&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;public&lt;/span&gt; &lt;span style="color: #7f0055;"&gt;boolean&lt;/span&gt; addObserver (Observer observer);&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;public&lt;/span&gt; &lt;span style="color: #7f0055;"&gt;boolean&lt;/span&gt; removeObserver (Observer observer);&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;public&lt;/span&gt; &lt;span style="color: #7f0055;"&gt;void&lt;/span&gt; notifyObservers ();&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Next we are going to implement the Subject interface with a new class I called Observable. &amp;nbsp;Here is my observable class:&lt;/div&gt;&lt;div&gt;&lt;script type="syntaxhighlighter" class="brush: java"&gt;&lt;![CDATA[package org.example.designpattern.observable;import java.util.ArrayList;import java.util.List;public class Observable implements Subject { List&lt;Observer&gt; observers; Object observerableObject;  public Observable (Object observerableObject) {  observers = new ArrayList&lt;Observer&gt;();  this.observerableObject = observerableObject; } public boolean addObserver(Observer observer) {  if (!observers.contains(observer)) {   observers.add(observer);   return true;  }  return false; } public void notifyObservers() {  for (Observer observer : observers) {   observer.subjectChanged(observerableObject);  } } public boolean removeObserver(Observer observer) {  if (observers.contains(observer)) {   observers.remove(observer);   return true;  }  return false; }}]]&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-style-span" style="color: #7f0055;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Now the fun stuff. &amp;nbsp;Somehow we have to get our pojo (in this case our pojo is Animal) to implement "Subject" but we don't actually want to change our pojo class. &amp;nbsp;So how do we do this? &amp;nbsp;Well here is how "static" cross cutting works. &amp;nbsp;Create a new aspect and use the &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;@DeclareMixin&lt;/span&gt; annotation to tell the weaver which class this aspect is supposed to crosscut. &amp;nbsp;Here is the code:&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: #7f0055;"&gt;package&lt;/span&gt; org.example.aspects;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: #7f0055;"&gt;import&lt;/span&gt; org.aspectj.lang.annotation.DeclareMixin;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: #7f0055;"&gt;import&lt;/span&gt; org.example.designpattern.observable.Subject;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: #7f0055;"&gt;import&lt;/span&gt; org.example.designpattern.observable.Observable;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: #7f0055;"&gt;public&lt;/span&gt; &lt;span style="color: #7f0055;"&gt;aspect&lt;/span&gt; ObservableDesignPattern {&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/div&gt;&lt;div style="color: #2a00ff; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: #646464;"&gt;@DeclareMixin&lt;/span&gt;&lt;span style="color: black;"&gt;(&lt;/span&gt;"org.example.model.*"&lt;span style="color: black;"&gt;)&lt;/span&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;public&lt;/span&gt; Subject makeObservable(Object observableObject) {&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;return&lt;/span&gt; &lt;span style="color: #7f0055;"&gt;new&lt;/span&gt; Observable(observableObject);&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;}&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;Notice that this code says everything that is in the org.example.model hierarchy is to implement the Subject interface and the actual code that does the implementation will be found in the Observable class we created above. &amp;nbsp;This way no code has to change in "Animal" (i.e. our Subject pojo) at all!&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;Next we need to do one last thing. &amp;nbsp;Remember we said that the Observer should be notified when something changes. &amp;nbsp;Well in order to do this we need to use "dynamic" crosscutting to call the notifyObservers method after every setter is called in the Animal class (i.e. remember that is our Subject we are watching for changes in).&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;So we expand our aspect to look like this now:&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: #7f0055;"&gt;public&lt;/span&gt; &lt;span style="color: #7f0055;"&gt;aspect&lt;/span&gt; ObservableDesignPattern {&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/div&gt;&lt;div style="color: #2a00ff; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: #646464;"&gt;@DeclareMixin&lt;/span&gt;&lt;span style="color: black;"&gt;(&lt;/span&gt;"org.example.model.*"&lt;span style="color: black;"&gt;)&lt;/span&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;public&lt;/span&gt; Subject makeObservable(Object observableObject) {&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;return&lt;/span&gt; &lt;span style="color: #7f0055;"&gt;new&lt;/span&gt; Observable(observableObject);&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;pointcut&lt;/span&gt; notifyObservers (Subject subject, Object newValue) : &lt;span style="color: #7f0055;"&gt;execution&lt;/span&gt; (&lt;span style="color: #7f0055;"&gt;public&lt;/span&gt; * org.example.model.*.set*(..)) &amp;amp;&amp;amp; &lt;span style="color: #7f0055;"&gt;target&lt;/span&gt; (subject) &amp;amp;&amp;amp; &lt;span style="color: #7f0055;"&gt;args&lt;/span&gt; (newValue);&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;void&lt;/span&gt; &lt;span style="color: #7f0055;"&gt;around&lt;/span&gt; (Subject subject, Object newValue) : notifyObservers(subject, newValue) {&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style="color: #7f0055;"&gt;proceed&lt;/span&gt;(subject, newValue);&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; subject.notifyObservers();&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;}&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;Now we are almost done but there is a bug! &amp;nbsp;This will call &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;notifyObservers&lt;/span&gt;&lt;/span&gt; every single time someone calls "set" regardless if they passed in a new value or not. &amp;nbsp;But remember the Observer only want to be notified when something actually changes. &amp;nbsp;So we expand our aspect one last time to look like the following. &amp;nbsp;&lt;i&gt;&lt;b&gt;Notice&lt;/b&gt; we are using reflection to compare the before value with the new value and are only calling notify if they are different.&lt;/i&gt; &amp;nbsp;Here is the code:&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: #7f0055;"&gt;public&lt;/span&gt; &lt;span style="color: #7f0055;"&gt;aspect&lt;/span&gt; ObservableDesignPattern {&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="color: #2a00ff; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: #646464;"&gt;@DeclareMixin&lt;/span&gt;&lt;span style="color: black;"&gt;(&lt;/span&gt;"org.example.model.*"&lt;span style="color: black;"&gt;)&lt;/span&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;public&lt;/span&gt; Subject makeObservable(Object observableObject) {&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;return&lt;/span&gt; &lt;span style="color: #7f0055;"&gt;new&lt;/span&gt; Observable(observableObject);&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="color: #646464; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/span&gt;@SuppressWarnings&lt;span style="color: black;"&gt;(&lt;/span&gt;&lt;span style="color: #2a00ff;"&gt;"unchecked"&lt;/span&gt;&lt;span style="color: black;"&gt;)&lt;/span&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;private&lt;/span&gt; Class[] &lt;span style="color: #0000c0;"&gt;argTypes&lt;/span&gt; = &lt;span style="color: #7f0055;"&gt;new&lt;/span&gt; Class[] {};&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;private&lt;/span&gt; Object[] &lt;span style="color: #0000c0;"&gt;args&lt;/span&gt; = &lt;span style="color: #7f0055;"&gt;new&lt;/span&gt; Object[] {};&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;pointcut&lt;/span&gt; notifyObservers(Subject subject, Object newValue) : &lt;span style="color: #7f0055;"&gt;execution&lt;/span&gt; (&lt;span style="color: #7f0055;"&gt;public&lt;/span&gt; * org.example.model.*.set*(..)) &amp;amp;&amp;amp; &lt;span style="color: #7f0055;"&gt;target&lt;/span&gt; (subject) &amp;amp;&amp;amp; &lt;span style="color: #7f0055;"&gt;args&lt;/span&gt; (newValue);&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;void&lt;/span&gt; &lt;span style="color: #7f0055;"&gt;around&lt;/span&gt;(Subject subject, Object newValue) : notifyObservers(subject, newValue) {&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;try&lt;/span&gt; {&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;String getMethod = &lt;span style="color: #2a00ff;"&gt;"g"&lt;/span&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;     &lt;/span&gt;+ &lt;span style="color: #7f0055;"&gt;thisJoinPoint&lt;/span&gt;.getSignature().getName().substring(1);&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;Object value = subject.getClass().getMethod(getMethod, &lt;span style="color: #0000c0;"&gt;argTypes&lt;/span&gt;)&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;     &lt;/span&gt;.invoke(subject, &lt;span style="color: #0000c0;"&gt;args&lt;/span&gt;);&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;boolean&lt;/span&gt; clean = (newValue == &lt;span style="color: #7f0055;"&gt;null&lt;/span&gt;) ? value == &lt;span style="color: #7f0055;"&gt;null&lt;/span&gt; : newValue&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;     &lt;/span&gt;.equals(value);&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;if&lt;/span&gt; (!clean) {&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;    &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;proceed&lt;/span&gt;(subject, newValue);&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;    &lt;/span&gt;subject.notifyObservers();&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;}&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;} &lt;span style="color: #7f0055;"&gt;catch&lt;/span&gt; (Exception ex) {&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;throw&lt;/span&gt; &lt;span style="color: #7f0055;"&gt;new&lt;/span&gt; IllegalArgumentException(ex.getMessage());&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;}&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;}&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"&gt;That's it. &amp;nbsp;To test the code we write a JUnit test like the following. &amp;nbsp;If everything is setup correctly all test should pass..&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: #7f0055;"&gt;package&lt;/span&gt; org.example.designpattern.observable;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: #7f0055;"&gt;import&lt;/span&gt; &lt;span style="color: #7f0055;"&gt;static&lt;/span&gt; org.junit.Assert.assertEquals;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: #7f0055;"&gt;import&lt;/span&gt; org.example.model.Animal;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: #7f0055;"&gt;import&lt;/span&gt; org.junit.Before;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: #7f0055;"&gt;import&lt;/span&gt; org.junit.Test;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: #7f0055;"&gt;public&lt;/span&gt; &lt;span style="color: #7f0055;"&gt;class&lt;/span&gt; ObservableTest &lt;span style="color: #7f0055;"&gt;implements&lt;/span&gt; Observer {&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Animal &lt;span style="color: #0000c0;"&gt;animal&lt;/span&gt;;&lt;/div&gt;&lt;div style="color: #0000c0; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: #7f0055;"&gt;boolean&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;subjectChangeCalled&lt;span style="color: black;"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="color: #646464; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/span&gt;@Before&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;public&lt;/span&gt; &lt;span style="color: #7f0055;"&gt;void&lt;/span&gt; setUp() &lt;span style="color: #7f0055;"&gt;throws&lt;/span&gt; Exception {&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;span style="color: #0000c0;"&gt;animal&lt;/span&gt; = &lt;span style="color: #7f0055;"&gt;new&lt;/span&gt; Animal();&lt;/div&gt;&lt;div style="color: #0000c0; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;/span&gt;subjectChangeCalled&lt;span style="color: black;"&gt; = &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;false&lt;/span&gt;&lt;span style="color: black;"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="color: #646464; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/span&gt;@Test&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;public&lt;/span&gt; &lt;span style="color: #7f0055;"&gt;void&lt;/span&gt; testAddObserver() {&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;boolean&lt;/span&gt; result = &lt;span style="color: #7f0055;"&gt;false&lt;/span&gt;;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;result = ((Subject) &lt;span style="color: #0000c0;"&gt;animal&lt;/span&gt;).addObserver(&lt;span style="color: #7f0055;"&gt;this&lt;/span&gt;);&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;assertEquals(&lt;span style="color: #7f0055;"&gt;true&lt;/span&gt;, result);&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="color: #646464; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/span&gt;@Test&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;public&lt;/span&gt; &lt;span style="color: #7f0055;"&gt;void&lt;/span&gt; testRemoveObserver() {&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;boolean&lt;/span&gt; result = &lt;span style="color: #7f0055;"&gt;false&lt;/span&gt;;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;((Subject) &lt;span style="color: #0000c0;"&gt;animal&lt;/span&gt;).addObserver(&lt;span style="color: #7f0055;"&gt;this&lt;/span&gt;);&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;result = ((Subject) &lt;span style="color: #0000c0;"&gt;animal&lt;/span&gt;).removeObserver(&lt;span style="color: #7f0055;"&gt;this&lt;/span&gt;);&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;assertEquals(&lt;span style="color: #7f0055;"&gt;true&lt;/span&gt;, result);&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="color: #646464; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/span&gt;@Test&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;public&lt;/span&gt; &lt;span style="color: #7f0055;"&gt;void&lt;/span&gt; testNotifyObserversDoesGetCalled() {&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;((Subject) &lt;span style="color: #0000c0;"&gt;animal&lt;/span&gt;).addObserver(&lt;span style="color: #7f0055;"&gt;this&lt;/span&gt;);&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;span style="color: #0000c0;"&gt;animal&lt;/span&gt;.setName(&lt;span style="color: #2a00ff;"&gt;"Iguana"&lt;/span&gt;);&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;assertEquals(&lt;span style="color: #7f0055;"&gt;true&lt;/span&gt;, &lt;span style="color: #0000c0;"&gt;subjectChangeCalled&lt;/span&gt;);&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="color: #646464; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/span&gt;@Test&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;public&lt;/span&gt; &lt;span style="color: #7f0055;"&gt;void&lt;/span&gt; testNotifyObserversDoesntGetCalled() {&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;((Subject) &lt;span style="color: #0000c0;"&gt;animal&lt;/span&gt;).addObserver(&lt;span style="color: #7f0055;"&gt;this&lt;/span&gt;);&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;span style="color: #0000c0;"&gt;animal&lt;/span&gt;.setName(&lt;span style="color: #2a00ff;"&gt;"Iguana"&lt;/span&gt;);&lt;/div&gt;&lt;div style="color: #0000c0; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;/span&gt;subjectChangeCalled&lt;span style="color: black;"&gt; = &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;false&lt;/span&gt;&lt;span style="color: black;"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;span style="color: #0000c0;"&gt;animal&lt;/span&gt;.setName(&lt;span style="color: #2a00ff;"&gt;"Iguana"&lt;/span&gt;);&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;assertEquals(&lt;span style="color: #7f0055;"&gt;false&lt;/span&gt;, &lt;span style="color: #0000c0;"&gt;subjectChangeCalled&lt;/span&gt;);&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;public&lt;/span&gt; &lt;span style="color: #7f0055;"&gt;void&lt;/span&gt; subjectChanged(Object observerableObject) {&lt;/div&gt;&lt;div style="color: #0000c0; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;/span&gt;subjectChangeCalled&lt;span style="color: black;"&gt; = &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;true&lt;/span&gt;&lt;span style="color: black;"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;}&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1546366980808220992-1099559505653947805?l=techscienceinterest.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techscienceinterest.blogspot.com/feeds/1099559505653947805/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techscienceinterest.blogspot.com/2010/03/using-aspectj-for-observable-design.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1546366980808220992/posts/default/1099559505653947805'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1546366980808220992/posts/default/1099559505653947805'/><link rel='alternate' type='text/html' href='http://techscienceinterest.blogspot.com/2010/03/using-aspectj-for-observable-design.html' title='Using AspectJ for the Observable Design Pattern'/><author><name>Brent Coffey</name><uri>http://www.blogger.com/profile/14987122747702890412</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_7p4NxoKlbj4/S3RxOjAJ_rI/AAAAAAAAAEw/kOlFmUROluI/S220/Photo+on+2010-02-11+at+15.39+%232.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1546366980808220992.post-7948088033652468395</id><published>2010-02-24T16:02:00.006-05:00</published><updated>2010-02-24T16:13:17.080-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='hibernate'/><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='mysql'/><category scheme='http://www.blogger.com/atom/ns#' term='eclipse'/><category scheme='http://www.blogger.com/atom/ns#' term='spring'/><title type='text'>Spring Hibernate Integration HOW-TO using MySQL</title><content type='html'>&lt;div style="font: 14.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;span class="Apple-style-span" style="font-size: 12px;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;div style="font: 14.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-style-span" style="font-size: 12px;"&gt;This blog assumes you are using Eclipse 3.5 and already know how to setup and use a basic Maven Project. &amp;nbsp; If not check out my blog on creating a Maven, Spring, JUnit, AspectJ Project.&amp;nbsp; I will be using Spring 3.0.1 and Hibernate 3.3.2.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 14.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;This blog also assumes you have MySQL up and running and know the basics of how to create a database, create a table, populate a table using SQL, have permissions to the database and table, and know how to drop a table. If not you will first need to read the MySQL documentation from Oracle.&lt;/div&gt;&lt;div style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 14.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="color: #ff6666; font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;b&gt;&lt;i&gt;This blog is meant to walk someone through setting up a basic "HelloWorld" type Spring Hibernate integration project.&amp;nbsp; Little explanation as to the "why," and the "what" will be given.&amp;nbsp; Rather this blog answers the question "how." After gaining a basic understanding of the concepts of Spring and Hibernate, sometimes it's especially helpful to just see "how" without all the computer science lingo.&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;&lt;div style="color: #ff6666; font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 14.0px;"&gt;&lt;b&gt;&lt;i&gt;&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;&lt;div style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;In this blog I am going to walk through the bare-bones steps needed to create a basic Spring Hibernate integrated project.&amp;nbsp; This demo will retrieve, store, and delete animals with their associated attributes from a MySQL database.&amp;nbsp; Hopefully this blog will help someone understand how to actually configure a basic Spring Hibernate project.&lt;/div&gt;&lt;div style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 14.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="color: #0008ff; font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;b&gt;STEP 1: Create A Database Table&lt;/b&gt;&lt;/div&gt;&lt;div style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 14.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;ol style="list-style-type: decimal;"&gt;&lt;li style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;Login to MySQL&lt;/li&gt;&lt;li style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;Create a new database called test, if you don't already have this database setup&lt;/li&gt;&lt;li style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;Create a new table in your newly created database called "&lt;span style="font: normal normal normal 12px/normal 'Courier New';"&gt;Animal&lt;/span&gt;" using the provided SQL&lt;/li&gt;&lt;/ol&gt;&lt;div style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 14.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;ol style="list-style-type: decimal;"&gt;&lt;ul style="list-style-type: hyphen;"&gt;&lt;li style="font: 12.0px 'Courier New'; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;create table Animal (id int,name varchar(25), says varchar(10), feet int(3), index(id));&lt;/li&gt;&lt;/ul&gt;&lt;/ol&gt;&lt;div style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 14.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="color: #0008ff; font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;b&gt;STEP 2: Populate Database&lt;/b&gt;&lt;/div&gt;&lt;div style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 14.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;ol style="list-style-type: decimal;"&gt;&lt;li style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;At the MySQL Prompt execute the following commands:&lt;/li&gt;&lt;/ol&gt;&lt;div style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 14.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;ol style="list-style-type: decimal;"&gt;&lt;ul style="list-style-type: hyphen;"&gt;&lt;li style="font: 12.0px 'Courier New'; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;INSERT INTO Animal (id, name, says, feet) VALUES (1, 'cow', 'moo', 4);&lt;/li&gt;&lt;li style="font: 12.0px 'Courier New'; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;INSERT INTO Animal (id, name, says, feet) VALUES (2, 'chicken', 'cluck', 2);&lt;/li&gt;&lt;li style="font: 12.0px 'Courier New'; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;INSERT INTO Animal (id, name, says, feet) VALUES (3, 'horse', 'nay', 4);&lt;/li&gt;&lt;/ul&gt;&lt;/ol&gt;&lt;div style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 14.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="color: #0008ff; font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;b&gt;STEP 3: Setup Your Working Project&lt;/b&gt;&lt;/div&gt;&lt;div style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 14.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;ol style="list-style-type: decimal;"&gt;&lt;li style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;Create a new maven project&lt;/li&gt;&lt;li style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;Add the following dependancies with the specified versions numbers to your POM.xml:&lt;/li&gt;&lt;ul style="list-style-type: hyphen;"&gt;&lt;li style="font: 12.0px 'Courier New'; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;log4J : log4j 1.2.15&lt;/li&gt;&lt;li style="font: 12.0px 'Courier New'; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;org.springframework : spring-context : [3,)&lt;/li&gt;&lt;li style="font: 12.0px 'Courier New'; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;org.springframework : spring-jdbc : [3,)&lt;/li&gt;&lt;li style="font: 12.0px 'Courier New'; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;org.springframework : spring-orm : 3.0.1.RELEASE&lt;/li&gt;&lt;li style="font: 12.0px 'Courier New'; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;org.hibernate : hibernate-core : 3.3.2.GA&lt;/li&gt;&lt;li style="font: 12.0px 'Courier New'; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;javax.persistence : ebb : 3.0-public_review&lt;/li&gt;&lt;li style="font: 12.0px 'Courier New'; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;mysql : mysql-connector-java : [5,)&lt;/li&gt;&lt;li style="font: 12.0px 'Courier New'; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;org.slf4j : slf4j-simple : 1.5.8&lt;/li&gt;&lt;li style="font: 12.0px 'Courier New'; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;javassist : javassist : 3.8.0.GA&lt;/li&gt;&lt;/ul&gt;&lt;li style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;Save your Project&lt;/li&gt;&lt;li style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;Right click on the POM and select Run As Maven Build&lt;/li&gt;&lt;/ol&gt;&lt;div style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 14.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;ol style="list-style-type: decimal;"&gt;&lt;ul style="list-style-type: hyphen;"&gt;&lt;li style="font: 12.0px 'Courier New'; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;If prompted type "compile" as your goal and then click Apply and Run.&lt;/li&gt;&lt;/ul&gt;&lt;/ol&gt;&lt;div style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 14.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;i&gt;You may get an error from the javax.persistence dependency.&amp;nbsp; This is because the Maven repository does not contain the javax.persistence JAR file.&amp;nbsp; So you will need to find this JAR yourself and place it in the correct directory yourself.&amp;nbsp; Here is how to dot this:&lt;/i&gt;&lt;/div&gt;&lt;div style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 14.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;ol style="list-style-type: upper-alpha;"&gt;&lt;li style="font: 12.0px Arial; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;Close Eclipse&lt;/li&gt;&lt;li style="font: 13.0px Arial; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="font: normal normal normal 12px/normal Arial;"&gt;Download the file at &lt;/span&gt;http://prdownloads.sourceforge.net/hibernate/hibernate-annotations-3.1beta5.tar.gz?download&lt;/li&gt;&lt;li style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;Untar the file&lt;/li&gt;&lt;li style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;Find the ejb3-persistence.jar&lt;/li&gt;&lt;li style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;Rename to ejb-3.0-public_review.jar&lt;/li&gt;&lt;li style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;Copy this renamed jar to ~/m2/repository/javax/persistence/ejb/3.0-public_review/&lt;/li&gt;&lt;/ol&gt;&lt;div style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 14.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;i&gt;Open Eclipse and perform steps 3 &amp;amp; 4 again. The Maven build error should now be gone.&lt;/i&gt;&lt;/div&gt;&lt;div style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 14.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="color: #0008ff; font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;b&gt;STEP 4: Create the Projects Basic Structure&lt;/b&gt;&lt;/div&gt;&lt;div style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 14.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;ol style="list-style-type: decimal;"&gt;&lt;li style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;Right click on the folder "&lt;span style="font: normal normal normal 12px/normal 'Courier New';"&gt;src/main/java&lt;/span&gt;"&lt;/li&gt;&lt;li style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;Click New-&amp;gt;Package&lt;/li&gt;&lt;li style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;Name your package &lt;span style="font: normal normal normal 12px/normal 'Courier New';"&gt;org.example&lt;/span&gt;&lt;/li&gt;&lt;li style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;Click Finish&lt;/li&gt;&lt;li style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;Right click on the folder named "&lt;span style="font: normal normal normal 12px/normal 'Courier New';"&gt;src/main/resources&lt;/span&gt;"&lt;/li&gt;&lt;li style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;Click New-&amp;gt;Folder&lt;/li&gt;&lt;li style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;Name the folder&amp;nbsp; "&lt;span style="font: normal normal normal 12px/normal 'Courier New';"&gt;beans&lt;/span&gt;"&lt;/li&gt;&lt;li style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;Click Finish&lt;/li&gt;&lt;li style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;Right click on the folder named "&lt;span style="font: normal normal normal 12px/normal 'Courier New';"&gt;src/main/resources&lt;/span&gt;"&lt;/li&gt;&lt;li style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;Click New-&amp;gt;Folder&lt;/li&gt;&lt;li style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;Name the folder&amp;nbsp; "&lt;span style="font: normal normal normal 12px/normal 'Courier New';"&gt;hibernate&lt;/span&gt;"&lt;/li&gt;&lt;li style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;Click Finish&lt;/li&gt;&lt;/ol&gt;&lt;div style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 14.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="color: #0008ff; font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;b&gt;STEP 5: Create POJO Representation of Database Table&lt;/b&gt;&lt;/div&gt;&lt;div style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 14.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;ol style="list-style-type: decimal;"&gt;&lt;li style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;Right Click on the package you named "&lt;span style="font: normal normal normal 12px/normal 'Courier New';"&gt;org.example&lt;/span&gt;"&amp;nbsp;&lt;/li&gt;&lt;li style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;Click New-&amp;gt;Class&lt;/li&gt;&lt;li style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;Name the class the same as your table, in this case, "Animal."&lt;/li&gt;&lt;li style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;Write your Animal class to correspond to your database. It should look like this:&lt;/li&gt;&lt;/ol&gt;&lt;div style="color: #7f0055; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: #7f0055;"&gt;package&lt;/span&gt; org.example;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="color: #7f0055; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;public&lt;span style="color: black;"&gt; &lt;/span&gt;class&lt;span style="color: black;"&gt; Animal {&lt;/span&gt;&lt;/div&gt;&lt;div style="color: #7f0055; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/span&gt;private&lt;span style="color: black;"&gt; &lt;/span&gt;int&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: #0006c0;"&gt;id&lt;/span&gt;&lt;span style="color: black;"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;private&lt;/span&gt; String &lt;span style="color: #0006c0;"&gt;name&lt;/span&gt;;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;private&lt;/span&gt; String &lt;span style="color: #0006c0;"&gt;says&lt;/span&gt;;&lt;/div&gt;&lt;div style="color: #7f0055; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/span&gt;private&lt;span style="color: black;"&gt; &lt;/span&gt;int&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: #0006c0;"&gt;feet&lt;/span&gt;&lt;span style="color: black;"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;public&lt;/span&gt; &lt;span style="color: #7f0055;"&gt;int&lt;/span&gt; getId() {&lt;/div&gt;&lt;div style="color: #7f0055; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;/span&gt;return&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: #0006c0;"&gt;id&lt;/span&gt;&lt;span style="color: black;"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;public&lt;/span&gt; &lt;span style="color: #7f0055;"&gt;void&lt;/span&gt; setId(&lt;span style="color: #7f0055;"&gt;int&lt;/span&gt; id) {&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;this&lt;/span&gt;.&lt;span style="color: #0006c0;"&gt;id&lt;/span&gt; = id;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;public&lt;/span&gt; String getName() {&lt;/div&gt;&lt;div style="color: #7f0055; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;/span&gt;return&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: #0006c0;"&gt;name&lt;/span&gt;&lt;span style="color: black;"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;public&lt;/span&gt; &lt;span style="color: #7f0055;"&gt;void&lt;/span&gt; setName(String name) {&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;this&lt;/span&gt;.&lt;span style="color: #0006c0;"&gt;name&lt;/span&gt; = name;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;public&lt;/span&gt; String getSays() {&lt;/div&gt;&lt;div style="color: #7f0055; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;/span&gt;return&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: #0006c0;"&gt;says&lt;/span&gt;&lt;span style="color: black;"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;public&lt;/span&gt; &lt;span style="color: #7f0055;"&gt;void&lt;/span&gt; setSays(String says) {&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;this&lt;/span&gt;.&lt;span style="color: #0006c0;"&gt;says&lt;/span&gt; = says;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;public&lt;/span&gt; &lt;span style="color: #7f0055;"&gt;int&lt;/span&gt; getFeet() {&lt;/div&gt;&lt;div style="color: #7f0055; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;/span&gt;return&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: #0006c0;"&gt;feet&lt;/span&gt;&lt;span style="color: black;"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;public&lt;/span&gt; &lt;span style="color: #7f0055;"&gt;void&lt;/span&gt; setFeet(&lt;span style="color: #7f0055;"&gt;int&lt;/span&gt; feet) {&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;this&lt;/span&gt;.&lt;span style="color: #0006c0;"&gt;feet&lt;/span&gt; = feet;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;}&lt;/div&gt;&lt;div style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 14.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="color: #0008ff; font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;b&gt;STEP 6: Create Hibernate Mapping Between POJO and Database Table&lt;/b&gt;&lt;/div&gt;&lt;div style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 14.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;ol style="list-style-type: decimal;"&gt;&lt;li style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;Right click on the folder you created called "&lt;span style="font: normal normal normal 12px/normal 'Courier New';"&gt;hibernate&lt;/span&gt;"&amp;nbsp;&lt;/li&gt;&lt;li style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;Click New-&amp;gt;Other…&lt;/li&gt;&lt;li style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;Expand the Hibernate DropDown&lt;/li&gt;&lt;li style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;Select Hibernate XML Mapping file (hbm.xml)&lt;/li&gt;&lt;li style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;Name the File &lt;span style="font: normal normal normal 12px/normal 'Courier New';"&gt;Animal.hbm.xml&lt;/span&gt;&lt;/li&gt;&lt;li style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;Click Next&lt;/li&gt;&lt;li style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;Click Browse&lt;/li&gt;&lt;li style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;Type &lt;span style="font: normal normal normal 12px/normal 'Courier New';"&gt;Animal&lt;/span&gt;&lt;/li&gt;&lt;li style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;Select Animal in the "&lt;span style="font: normal normal normal 12px/normal 'Courier New';"&gt;org.example&lt;/span&gt;" Package&lt;/li&gt;&lt;li style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;Click Ok&lt;/li&gt;&lt;li style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;Click Finish&lt;/li&gt;&lt;li style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;Open the newly created &lt;span style="font: normal normal normal 12px/normal 'Courier New';"&gt;Animal.hbm.xml&lt;/span&gt; file&lt;/li&gt;&lt;li style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;Map the Table Columns to the Animal Object Attributes by making the &lt;span style="font: normal normal normal 12px/normal 'Courier New';"&gt;Animal.hbm.xml&lt;/span&gt; file look like the following:&lt;/li&gt;&lt;/ol&gt;&lt;div style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 14.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="color: #7f027f; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: #068080;"&gt;&lt;span style="color: #3f7f7f;"&gt;xml&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;version&lt;span style="color: black;"&gt;=&lt;/span&gt;&lt;span style="color: #2908ff;"&gt;"1.0"&lt;/span&gt;&lt;span style="color: #068080;"&gt;?&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="color: #068080; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: #3f7f7f;"&gt;DOCTYPE&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;hibernate-mapping&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: grey;"&gt;PUBLIC&lt;/span&gt;&lt;/div&gt;&lt;div style="color: #068080; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/span&gt;"-//Hibernate/Hibernate Mapping DTD 3.0//EN"&lt;/div&gt;&lt;div style="color: #3f7f5f; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/span&gt;"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"&lt;span style="color: #068080;"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="color: #3f7f7f; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: #068080;"&gt;&amp;lt;&lt;/span&gt;hibernate-mapping&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: #7f027f;"&gt;package&lt;/span&gt;&lt;span style="color: black;"&gt;=&lt;/span&gt;&lt;span style="color: #2908ff;"&gt;"org.example"&lt;/span&gt;&lt;span style="color: #068080;"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="color: #2908ff; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&amp;nbsp; &lt;/span&gt;&lt;span style="color: #068080;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #3f7f7f;"&gt;class&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: #7f027f;"&gt;name&lt;/span&gt;&lt;span style="color: black;"&gt;=&lt;/span&gt;"Animal"&lt;span style="color: #068080;"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="color: #7f027f; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&amp;nbsp; &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: #068080;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #3f7f7f;"&gt;id&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;name&lt;span style="color: black;"&gt;=&lt;/span&gt;&lt;span style="color: #2908ff;"&gt;"id"&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;column&lt;span style="color: black;"&gt;=&lt;/span&gt;&lt;span style="color: #2908ff;"&gt;"ID"&lt;/span&gt;&lt;span style="color: #068080;"&gt;/&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="color: #2908ff; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&amp;nbsp; &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: #068080;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #3f7f7f;"&gt;property&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: #7f027f;"&gt;name&lt;/span&gt;&lt;span style="color: black;"&gt;=&lt;/span&gt;"name"&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: #7f027f;"&gt;column&lt;/span&gt;&lt;span style="color: black;"&gt;=&lt;/span&gt;"NAME"&lt;span style="color: #068080;"&gt;/&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="color: #2908ff; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&amp;nbsp; &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: #068080;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #3f7f7f;"&gt;property&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: #7f027f;"&gt;name&lt;/span&gt;&lt;span style="color: black;"&gt;=&lt;/span&gt;"says"&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: #7f027f;"&gt;column&lt;/span&gt;&lt;span style="color: black;"&gt;=&lt;/span&gt;"SAYS"&lt;span style="color: #068080;"&gt;/&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="color: #2908ff; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&amp;nbsp; &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: #068080;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #3f7f7f;"&gt;property&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: #7f027f;"&gt;name&lt;/span&gt;&lt;span style="color: black;"&gt;=&lt;/span&gt;"feet"&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: #7f027f;"&gt;column&lt;/span&gt;&lt;span style="color: black;"&gt;=&lt;/span&gt;"FEET"&lt;span style="color: #068080;"&gt;/&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="color: #3f7f7f; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&amp;nbsp; &lt;/span&gt;&lt;span style="color: #068080;"&gt;&lt;/span&gt;class&lt;span style="color: #068080;"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="color: #3f7f7f; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: #068080;"&gt;&lt;/span&gt;hibernate-mapping&lt;span style="color: #068080;"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 14.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="color: #0008ff; font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;b&gt;STEP 7: Create Repository Interface&lt;/b&gt;&lt;/div&gt;&lt;div style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 14.0px;"&gt;&lt;b&gt;&lt;/b&gt;&lt;/div&gt;&lt;div style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;i&gt;The Repository interface is where you should write all of your code that deals with connecting to the database and returning the data in the form of objects back to the main business logic of your application&lt;/i&gt;&lt;/div&gt;&lt;div style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 14.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;ol style="list-style-type: decimal;"&gt;&lt;li style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;Right click on the "&lt;span style="font: normal normal normal 12px/normal 'Courier New';"&gt;org.example&lt;/span&gt;" package&lt;/li&gt;&lt;li style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;Click New-&amp;gt;Interface&lt;/li&gt;&lt;li style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;Name the interface "&lt;span style="font: normal normal normal 12px/normal 'Courier New';"&gt;AnimalRepository&lt;/span&gt;"&lt;/li&gt;&lt;li style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;Click Finish&amp;nbsp;&lt;/li&gt;&lt;li style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;Add all the mandatory methods to your repository that your business logic will want to call.&amp;nbsp; Here is the interface code:&lt;/li&gt;&lt;/ol&gt;&lt;div style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 14.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: #7f0055;"&gt;package&lt;/span&gt; org.example;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: #7f0055;"&gt;import&lt;/span&gt; java.util.List;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: #7f0055;"&gt;public&lt;/span&gt; &lt;span style="color: #7f0055;"&gt;interface&lt;/span&gt; AnimalRepository {&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;public&lt;/span&gt; Animal getAnimalById(&lt;span style="color: #7f0055;"&gt;int&lt;/span&gt; id);&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;public&lt;/span&gt; List getAnimalsNamed(String name);&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;public&lt;/span&gt; List getAnimalsWithFeet(&lt;span style="color: #7f0055;"&gt;int&lt;/span&gt; feet);&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;public&lt;/span&gt; &lt;span style="color: #7f0055;"&gt;void&lt;/span&gt; saveAnimal(Animal animal);&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;public&lt;/span&gt; &lt;span style="color: #7f0055;"&gt;void&lt;/span&gt; killAnimal(Animal animal);&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;}&lt;/div&gt;&lt;div style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 14.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="color: #0008ff; font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;b&gt;STEP 8: Implement the AnimalRepository Interface&lt;/b&gt;&lt;/div&gt;&lt;div style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 14.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;ol style="list-style-type: decimal;"&gt;&lt;li style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;Right click on the "&lt;span style="font: normal normal normal 12px/normal 'Courier New';"&gt;org.example&lt;/span&gt;" package&lt;/li&gt;&lt;li style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;Click New-&amp;gt;Class&lt;/li&gt;&lt;li style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;Name the Class "&lt;span style="font: normal normal normal 12px/normal 'Courier New';"&gt;AnimalBarn&lt;/span&gt;"&lt;/li&gt;&lt;li style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;Click Add… (Next to Interfaces)&lt;/li&gt;&lt;li style="font: 12.0px 'Courier New'; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="font: normal normal normal 12px/normal Helvetica;"&gt;Choose "&lt;/span&gt;AnimalRepository&lt;span style="font: normal normal normal 12px/normal Helvetica;"&gt;"&lt;/span&gt;&lt;/li&gt;&lt;li style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;Click Ok&lt;/li&gt;&lt;li style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;Click Finish&lt;/li&gt;&lt;li style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;Code the &lt;span style="font: normal normal normal 12px/normal 'Courier New';"&gt;AnimalBarn&lt;/span&gt; Implementation.&amp;nbsp; Here is what it looks like:&lt;/li&gt;&lt;/ol&gt;&lt;div style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 14.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: #7f0055;"&gt;package&lt;/span&gt; org.example;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: #7f0055;"&gt;import&lt;/span&gt; java.util.List;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: #7f0055;"&gt;import&lt;/span&gt; org.hibernate.Session;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: #7f0055;"&gt;import&lt;/span&gt; org.hibernate.SessionFactory;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: #7f0055;"&gt;import&lt;/span&gt; org.springframework.stereotype.Repository;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: #7f0055;"&gt;import&lt;/span&gt; org.springframework.transaction.annotation.Transactional;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="color: #646464; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;@Repository&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: #7f0055;"&gt;public&lt;/span&gt; &lt;span style="color: #7f0055;"&gt;class&lt;/span&gt; AnimalBarn &lt;span style="color: #7f0055;"&gt;implements&lt;/span&gt; AnimalRepository {&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;private&lt;/span&gt; SessionFactory &lt;span style="color: #0006c0;"&gt;sessionFactory&lt;/span&gt;;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;public&lt;/span&gt; AnimalBarn(SessionFactory sessionFactory) {&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;this&lt;/span&gt;.&lt;span style="color: #0006c0;"&gt;sessionFactory&lt;/span&gt; = sessionFactory;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;public&lt;/span&gt; &lt;span style="color: #7f0055;"&gt;void&lt;/span&gt; setSessionFactory(SessionFactory sessionFactory) {&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;this&lt;/span&gt;.&lt;span style="color: #0006c0;"&gt;sessionFactory&lt;/span&gt; = sessionFactory;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="color: #646464; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/span&gt;@Transactional&lt;span style="color: black;"&gt;(readOnly=&lt;/span&gt;&lt;span style="color: #7f0055;"&gt;true&lt;/span&gt;&lt;span style="color: black;"&gt;)&lt;/span&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;public&lt;/span&gt; Animal getAnimalById(&lt;span style="color: #7f0055;"&gt;int&lt;/span&gt; id) {&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;Session session = &lt;span style="color: #0006c0;"&gt;sessionFactory&lt;/span&gt;.getCurrentSession();&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;return&lt;/span&gt; (Animal) session.get(Animal.&lt;span style="color: #7f0055;"&gt;class&lt;/span&gt;, id);&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="color: #646464; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/span&gt;@Transactional&lt;span style="color: black;"&gt;(readOnly=&lt;/span&gt;&lt;span style="color: #7f0055;"&gt;true&lt;/span&gt;&lt;span style="color: black;"&gt;)&lt;/span&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;public&lt;/span&gt; List getAnimalsNamed(String name) {&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;Session session = &lt;span style="color: #0006c0;"&gt;sessionFactory&lt;/span&gt;.getCurrentSession();&lt;/div&gt;&lt;div style="color: #2908ff; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;String hql = &lt;/span&gt;"from Animal where name='"&lt;span style="color: black;"&gt; + name +&lt;/span&gt;"'"&lt;span style="color: black;"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;return&lt;/span&gt; session.createQuery(hql).list();&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="color: #646464; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/span&gt;@Transactional&lt;span style="color: black;"&gt;(readOnly=&lt;/span&gt;&lt;span style="color: #7f0055;"&gt;false&lt;/span&gt;&lt;span style="color: black;"&gt;)&lt;/span&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;public&lt;/span&gt; &lt;span style="color: #7f0055;"&gt;void&lt;/span&gt; saveAnimal(Animal animal) {&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;Session session = &lt;span style="color: #0006c0;"&gt;sessionFactory&lt;/span&gt;.getCurrentSession();&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;session.saveOrUpdate(animal);&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="color: #646464; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/span&gt;@Transactional&lt;span style="color: black;"&gt;(readOnly=&lt;/span&gt;&lt;span style="color: #7f0055;"&gt;false&lt;/span&gt;&lt;span style="color: black;"&gt;)&lt;/span&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;public&lt;/span&gt; &lt;span style="color: #7f0055;"&gt;void&lt;/span&gt; killAnimal(Animal animal) {&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;Session session = &lt;span style="color: #0006c0;"&gt;sessionFactory&lt;/span&gt;.getCurrentSession();&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;session.delete(animal);&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="color: #646464; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/span&gt;@Transactional&lt;span style="color: black;"&gt;(readOnly=&lt;/span&gt;&lt;span style="color: #7f0055;"&gt;true&lt;/span&gt;&lt;span style="color: black;"&gt;)&lt;/span&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;public&lt;/span&gt; List getAnimalsWithFeet(&lt;span style="color: #7f0055;"&gt;int&lt;/span&gt; feet) {&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;Session session = &lt;span style="color: #0006c0;"&gt;sessionFactory&lt;/span&gt;.getCurrentSession();&lt;/div&gt;&lt;div style="color: #2908ff; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;String hql = &lt;/span&gt;"from Animal where feet="&lt;span style="color: black;"&gt; + feet;&lt;/span&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;return&lt;/span&gt; session.createQuery(hql).list();&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;}&lt;/div&gt;&lt;div style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 14.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="color: #0008ff; font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;b&gt;STEP 9: Create Spring Configuration File&lt;/b&gt;&lt;/div&gt;&lt;div style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 14.0px;"&gt;&lt;b&gt;&lt;/b&gt;&lt;/div&gt;&lt;ol style="list-style-type: decimal;"&gt;&lt;li style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;Right click on the &lt;span style="font: normal normal normal 12px/normal 'Courier New';"&gt;beans&lt;/span&gt; folder&lt;/li&gt;&lt;li style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;Click New-&amp;gt;Spring Bean Configuration File&lt;/li&gt;&lt;li style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;Name the file application-config.xml&lt;/li&gt;&lt;li style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;Click Next&lt;/li&gt;&lt;li style="font: 12.0px 'Courier New'; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="font: normal normal normal 12px/normal Helvetica;"&gt;Select &lt;/span&gt;beans - http://www.springframework.org/shema/beans&lt;/li&gt;&lt;li style="font: 12.0px 'Courier New'; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="font: normal normal normal 12px/normal Helvetica;"&gt;Select &lt;/span&gt;tx - http://www.springframework.org/schema/tx&lt;/li&gt;&lt;li style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;Click Finish&lt;/li&gt;&lt;li style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;Setup beans in XML.&amp;nbsp; Here is what the completed file looks like:&lt;/li&gt;&lt;/ol&gt;&lt;div style="color: #068080; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="color: #7f027f; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: #068080;"&gt;&lt;span style="color: #3f7f7f;"&gt;xml&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;version&lt;span style="color: black;"&gt;=&lt;/span&gt;&lt;span style="color: #2908ff;"&gt;"1.0"&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;encoding&lt;span style="color: black;"&gt;=&lt;/span&gt;&lt;span style="color: #2908ff;"&gt;"UTF-8"&lt;/span&gt;&lt;span style="color: #068080;"&gt;?&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="color: #2908ff; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: #068080;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #3f7f7f;"&gt;beans&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: #7f027f;"&gt;xmlns&lt;/span&gt;&lt;span style="color: black;"&gt;=&lt;/span&gt;"http://www.springframework.org/schema/beans"&lt;/div&gt;&lt;div style="color: #2908ff; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: #7f027f;"&gt;xmlns:xsi&lt;/span&gt;&lt;span style="color: black;"&gt;=&lt;/span&gt;"http://www.w3.org/2001/XMLSchema-instance"&lt;/div&gt;&lt;div style="color: #2908ff; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: #7f027f;"&gt;xmlns:tx&lt;/span&gt;&lt;span style="color: black;"&gt;=&lt;/span&gt;"http://www.springframework.org/schema/tx"&lt;/div&gt;&lt;div style="color: #2908ff; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: #7f027f;"&gt;xsi:schemaLocation&lt;/span&gt;&lt;span style="color: black;"&gt;=&lt;/span&gt;"http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd&lt;/div&gt;&lt;div style="color: #2908ff; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd"&lt;span style="color: #068080;"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="color: #2908ff; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: #068080;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #3f7f7f;"&gt;bean&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: #7f027f;"&gt;id&lt;/span&gt;&lt;span style="color: black;"&gt;=&lt;/span&gt;"animalRepository"&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: #7f027f;"&gt;class&lt;/span&gt;&lt;span style="color: black;"&gt;=&lt;/span&gt;"org.example.AnimalBarn"&lt;span style="color: #068080;"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="color: #2908ff; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span style="color: #068080;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #3f7f7f;"&gt;constructor-arg&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: #7f027f;"&gt;ref&lt;/span&gt;&lt;span style="color: black;"&gt;=&lt;/span&gt;"sessionFactory"&lt;span style="color: #068080;"&gt;/&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="color: #3f7f7f; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: #068080;"&gt;&lt;/span&gt;bean&lt;span style="color: #068080;"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="color: #2908ff; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: #068080;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #3f7f7f;"&gt;bean&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: #7f027f;"&gt;id&lt;/span&gt;&lt;span style="color: black;"&gt;=&lt;/span&gt;"sessionFactory"&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: #7f027f;"&gt;class&lt;/span&gt;&lt;span style="color: black;"&gt;=&lt;/span&gt;"org.springframework.orm.hibernate3.LocalSessionFactoryBean"&lt;span style="color: #068080;"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="color: #2908ff; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span style="color: #068080;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #3f7f7f;"&gt;property&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: #7f027f;"&gt;name&lt;/span&gt;&lt;span style="color: black;"&gt;=&lt;/span&gt;"dataSource"&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: #7f027f;"&gt;ref&lt;/span&gt;&lt;span style="color: black;"&gt;=&lt;/span&gt;"mysqlDataSource"&lt;span style="color: #068080;"&gt;/&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="color: #2908ff; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span style="color: #068080;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #3f7f7f;"&gt;property&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: #7f027f;"&gt;name&lt;/span&gt;&lt;span style="color: black;"&gt;=&lt;/span&gt;"mappingResources"&lt;span style="color: #068080;"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="color: #3f7f7f; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;&lt;/span&gt;&lt;span style="color: #068080;"&gt;&amp;lt;&lt;/span&gt;list&lt;span style="color: #068080;"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;    &lt;/span&gt;&lt;span style="color: #068080;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #3f7f7f;"&gt;value&lt;/span&gt;&lt;span style="color: #068080;"&gt;&amp;gt;&lt;/span&gt;resources/&lt;span style="text-decoration: underline;"&gt;hibernate&lt;/span&gt;/Animal.hbm.xml&lt;span style="color: #068080;"&gt;&lt;/span&gt;&lt;span style="color: #3f7f7f;"&gt;value&lt;/span&gt;&lt;span style="color: #068080;"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="color: #3f7f7f; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;&lt;/span&gt;&lt;span style="color: #068080;"&gt;&lt;/span&gt;list&lt;span style="color: #068080;"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="color: #3f7f7f; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span style="color: #068080;"&gt;&lt;/span&gt;property&lt;span style="color: #068080;"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="color: #3f7f7f; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: #068080;"&gt;&lt;/span&gt;bean&lt;span style="color: #068080;"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="color: #2908ff; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: #068080;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #3f7f7f;"&gt;bean&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: #7f027f;"&gt;id&lt;/span&gt;&lt;span style="color: black;"&gt;=&lt;/span&gt;"mysqlDataSource"&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: #7f027f;"&gt;class&lt;/span&gt;&lt;span style="color: black;"&gt;=&lt;/span&gt;"org.springframework.jdbc.datasource.DriverManagerDataSource"&lt;span style="color: #068080;"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="color: #2908ff; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span style="color: #068080;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #3f7f7f;"&gt;property&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: #7f027f;"&gt;name&lt;/span&gt;&lt;span style="color: black;"&gt;=&lt;/span&gt;"driverClassName"&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: #7f027f;"&gt;value&lt;/span&gt;&lt;span style="color: black;"&gt;=&lt;/span&gt;"com.mysql.jdbc.Driver"&lt;span style="color: #068080;"&gt;/&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="color: #2908ff; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span style="color: #068080;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #3f7f7f;"&gt;property&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: #7f027f;"&gt;name&lt;/span&gt;&lt;span style="color: black;"&gt;=&lt;/span&gt;"url"&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: #7f027f;"&gt;value&lt;/span&gt;&lt;span style="color: black;"&gt;=&lt;/span&gt;"jdbc:mysql://localhost/test"&lt;span style="color: #068080;"&gt;/&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="color: #2908ff; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span style="color: #068080;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #3f7f7f;"&gt;property&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: #7f027f;"&gt;name&lt;/span&gt;&lt;span style="color: black;"&gt;=&lt;/span&gt;"username"&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: #7f027f;"&gt;value&lt;/span&gt;&lt;span style="color: black;"&gt;=&lt;/span&gt;"rosebud"&lt;span style="color: #068080;"&gt;/&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="color: #2908ff; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span style="color: #068080;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #3f7f7f;"&gt;property&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: #7f027f;"&gt;name&lt;/span&gt;&lt;span style="color: black;"&gt;=&lt;/span&gt;"password"&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: #7f027f;"&gt;value&lt;/span&gt;&lt;span style="color: black;"&gt;=&lt;/span&gt;"password"&lt;span style="color: #068080;"&gt;/&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="color: #3f7f7f; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: #068080;"&gt;&lt;/span&gt;bean&lt;span style="color: #068080;"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/div&gt;&lt;div style="color: #2908ff; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: #068080;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #3f7f7f;"&gt;bean&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: #7f027f;"&gt;id&lt;/span&gt;&lt;span style="color: black;"&gt;=&lt;/span&gt;"transacationManager"&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: #7f027f;"&gt;class&lt;/span&gt;&lt;span style="color: black;"&gt;=&lt;/span&gt;"org.springframework.orm.hibernate3.HibernateTransactionManager"&lt;span style="color: #068080;"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="color: #2908ff; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span style="color: #068080;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #3f7f7f;"&gt;property&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: #7f027f;"&gt;name&lt;/span&gt;&lt;span style="color: black;"&gt;=&lt;/span&gt;"sessionFactory"&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: #7f027f;"&gt;ref&lt;/span&gt;&lt;span style="color: black;"&gt;=&lt;/span&gt;"sessionFactory"&lt;span style="color: #068080;"&gt;/&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="color: #3f7f7f; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: #068080;"&gt;&lt;/span&gt;bean&lt;span style="color: #068080;"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/div&gt;&lt;div style="color: #2908ff; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: #068080;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #3f7f7f;"&gt;tx:annotation-driven&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: #7f027f;"&gt;transaction-manager&lt;/span&gt;&lt;span style="color: black;"&gt;=&lt;/span&gt;"transacationManager"&lt;span style="color: #068080;"&gt;/&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="color: #3f7f7f; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: #068080;"&gt;&lt;/span&gt;beans&lt;span style="color: #068080;"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 14.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="color: #0008ff; font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;b&gt;STEP 10: Implement the Business Logic&lt;/b&gt;&lt;/div&gt;&lt;div style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 14.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;ol style="list-style-type: decimal;"&gt;&lt;li style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;Right click on the "org.example" package&lt;/li&gt;&lt;li style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;Click New-&amp;gt;Class&lt;/li&gt;&lt;li style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;Name the class "BarnYard"&lt;/li&gt;&lt;li style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;Select the check box asking you to create a "public static void main(String[] args) method stub&lt;/li&gt;&lt;li style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;Click Finish&lt;/li&gt;&lt;li style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;Code the main method.&amp;nbsp; Here is the code I used:&lt;/li&gt;&lt;/ol&gt;&lt;div style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 14.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: #7f0055;"&gt;package&lt;/span&gt; org.example;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: #7f0055;"&gt;import&lt;/span&gt; java.util.List;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: #7f0055;"&gt;import&lt;/span&gt; org.apache.log4j.BasicConfigurator;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: #7f0055;"&gt;import&lt;/span&gt; org.springframework.context.ApplicationContext;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: #7f0055;"&gt;import&lt;/span&gt; org.springframework.context.support.ClassPathXmlApplicationContext;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: #7f0055;"&gt;public&lt;/span&gt; &lt;span style="color: #7f0055;"&gt;class&lt;/span&gt; BarnYard {&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="color: #3f5fbf; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/span&gt;/**&lt;/div&gt;&lt;div style="color: #3f5fbf; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt; * &lt;span style="color: #7f9fbf;"&gt;@param&lt;/span&gt; args&lt;/div&gt;&lt;div style="color: #3f5fbf; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt; */&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;public&lt;/span&gt; &lt;span style="color: #7f0055;"&gt;static&lt;/span&gt; &lt;span style="color: #7f0055;"&gt;void&lt;/span&gt; main(String[] args) {&lt;/div&gt;&lt;div style="color: #3f7f5f; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;/span&gt;//Log4J Logger so you can see all that is going on in the frameworks...&lt;/div&gt;&lt;div style="color: #3f7f5f; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;//BasicConfigurator.configure();&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;/div&gt;&lt;div style="color: #3f7f5f; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;/span&gt;//Get the Spring Bean AnimalRepository interface which is implemented by animalBarn&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;ApplicationContext context = &lt;span style="color: #7f0055;"&gt;new&lt;/span&gt; ClassPathXmlApplicationContext(&lt;span style="color: #2908ff;"&gt;"resources/beans/application-config.xml"&lt;/span&gt;);&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;AnimalRepository animalRepository = (AnimalRepository)context.getBean(&lt;span style="color: #2908ff;"&gt;"animalRepository"&lt;/span&gt;);&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;/div&gt;&lt;div style="color: #3f7f5f; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;/span&gt;//Showing how to get an Object by it's primary key.&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;Animal animal = animalRepository.getAnimalById(1);&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;System.&lt;span style="color: #0006c0;"&gt;out&lt;/span&gt;.println(&lt;span style="color: #2908ff;"&gt;"The "&lt;/span&gt; + animal.getName() + &lt;span style="color: #2908ff;"&gt;" says "&lt;/span&gt; + animal.getSays() + &lt;span style="color: #2908ff;"&gt;" and has "&lt;/span&gt; + animal.getFeet() + &lt;span style="color: #2908ff;"&gt;" feet."&lt;/span&gt;);&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/div&gt;&lt;div style="color: #3f7f5f; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;/span&gt;//Showing how to query for an object based on an attribute&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;int&lt;/span&gt; feet = 4;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;List&lt;animal&gt; animals = &lt;span style="text-decoration: underline;"&gt;(List&lt;animal&gt;) animalRepository.getAnimalsWithFeet(feet)&lt;/animal&gt;&lt;/span&gt;;&lt;/animal&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;int&lt;/span&gt; i = 0;&lt;/div&gt;&lt;div style="color: #2908ff; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;System.&lt;/span&gt;&lt;span style="color: #0006c0;"&gt;out&lt;/span&gt;&lt;span style="color: black;"&gt;.println(&lt;/span&gt;"The Following Animal have "&lt;span style="color: black;"&gt; + feet + &lt;/span&gt;" feet:"&lt;span style="color: black;"&gt;);&lt;/span&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;for&lt;/span&gt; (Animal anotherAnimal: animals) {&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;System.&lt;span style="color: #0006c0;"&gt;out&lt;/span&gt;.println(++i + &lt;span style="color: #2908ff;"&gt;". "&lt;/span&gt; + anotherAnimal.getName());&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;}&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;/div&gt;&lt;div style="color: #3f7f5f; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;/span&gt;//Showing how to query for an object based on an attribute&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;feet = 2;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;animals = &lt;span style="text-decoration: underline;"&gt;(List&lt;animal&gt;) animalRepository.getAnimalsWithFeet(feet)&lt;/animal&gt;&lt;/span&gt;;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;/div&gt;&lt;div style="color: #2908ff; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;System.&lt;/span&gt;&lt;span style="color: #0006c0;"&gt;out&lt;/span&gt;&lt;span style="color: black;"&gt;.println(&lt;/span&gt;"The Following Animal have "&lt;span style="color: black;"&gt; + feet + &lt;/span&gt;" feet:"&lt;span style="color: black;"&gt;);&lt;/span&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;i = 0;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;for&lt;/span&gt; (Animal anotherAnimal: animals) {&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;System.&lt;span style="color: #0006c0;"&gt;out&lt;/span&gt;.println(++i +&lt;span style="color: #2908ff;"&gt;". "&lt;/span&gt; + anotherAnimal.getName());&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;}&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/div&gt;&lt;div style="color: #3f7f5f; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;/span&gt;//Showing how to save an Object to the Database...&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;Animal newAnimal = &lt;span style="color: #7f0055;"&gt;new&lt;/span&gt; Animal();&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;newAnimal.setId(5);&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;newAnimal.setName(&lt;span style="color: #2908ff;"&gt;"piggy"&lt;/span&gt;);&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;newAnimal.setSays(&lt;span style="color: #2908ff;"&gt;"oink"&lt;/span&gt;);&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;newAnimal.setFeet(4);&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;animalRepository.saveAnimal(newAnimal);&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;Animal pig = animalRepository.getAnimalById(5);&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;System.&lt;span style="color: #0006c0;"&gt;out&lt;/span&gt;.println(&lt;span style="color: #2908ff;"&gt;"The "&lt;/span&gt; + pig.getName() + &lt;span style="color: #2908ff;"&gt;" says "&lt;/span&gt; + pig.getSays() + &lt;span style="color: #2908ff;"&gt;" and has "&lt;/span&gt; + pig.getFeet() + &lt;span style="color: #2908ff;"&gt;" feet."&lt;/span&gt;);&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/div&gt;&lt;div style="color: #3f7f5f; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;/span&gt;//Showing that updating an Object persist to the database...&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;newAnimal.setName(&lt;span style="color: #2908ff;"&gt;"pig"&lt;/span&gt;);&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;animalRepository.saveAnimal(newAnimal);&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;pig = animalRepository.getAnimalById(5);&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;System.&lt;span style="color: #0006c0;"&gt;out&lt;/span&gt;.println(&lt;span style="color: #2908ff;"&gt;"The "&lt;/span&gt; + pig.getName() + &lt;span style="color: #2908ff;"&gt;" says "&lt;/span&gt; + pig.getSays() + &lt;span style="color: #2908ff;"&gt;" and has "&lt;/span&gt; + pig.getFeet() + &lt;span style="color: #2908ff;"&gt;" feet."&lt;/span&gt;);&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="color: #3f7f5f; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;/span&gt;//Showing how to delete an Object from the Database&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;animalRepository.killAnimal(newAnimal);&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;}&lt;/div&gt;&lt;div style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 14.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="color: #0008ff; font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;b&gt;STEP 11: Setup Run Configuration&lt;/b&gt;&lt;/div&gt;&lt;div style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 14.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;ol style="list-style-type: decimal;"&gt;&lt;li style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;Right Click on BarnYard.java&lt;/li&gt;&lt;li style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;Click on Run As…-&amp;gt;Run Configurations...&lt;/li&gt;&lt;li style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;Right Click on Java Application&lt;/li&gt;&lt;li style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;Click New&lt;/li&gt;&lt;li style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;Name the Project BarnYard&lt;/li&gt;&lt;li style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;Click on the Classpath tab&lt;/li&gt;&lt;li style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;Click on User Enties&lt;/li&gt;&lt;li style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;Click Advanced…&lt;/li&gt;&lt;li style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;Click Add Folders&lt;/li&gt;&lt;li style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;Click Ok&lt;/li&gt;&lt;li style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;Select src main&lt;/li&gt;&lt;li style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;Select Ok&lt;/li&gt;&lt;li style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;Click Apply&lt;/li&gt;&lt;/ol&gt;&lt;div style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 14.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="color: #0008ff; font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;b&gt;STEP 12: Run Application&lt;/b&gt;&lt;/div&gt;&lt;div style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 14.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;ol style="list-style-type: decimal;"&gt;&lt;li style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;Click Run&lt;/li&gt;&lt;/ol&gt;&lt;div style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 14.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;If everything complied correctly you should see the following (&lt;i&gt;To turn on all the log messages uncomment the line BarnYard which calls BasicConfigurator.configure();)&lt;/i&gt;:&lt;/div&gt;&lt;div style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 14.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="color: #000480; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="text-decoration: underline;"&gt;log4j:WARN No appenders could be found for logger (org.springframework.context.support.ClassPathXmlApplicationContext).&lt;/span&gt;&lt;/div&gt;&lt;div style="color: #000480; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="text-decoration: underline;"&gt;log4j:WARN Please initialize the log4j system properly.&lt;/span&gt;&lt;/div&gt;&lt;div style="color: #fe0002; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;8 [main] INFO org.hibernate.cfg.Environment - Hibernate 3.3.2.GA&lt;/div&gt;&lt;div style="color: #fe0002; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;9 [main] INFO org.hibernate.cfg.Environment - hibernate.properties not found&lt;/div&gt;&lt;div style="color: #fe0002; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;11 [main] INFO org.hibernate.cfg.Environment - Bytecode provider name : javassist&lt;/div&gt;&lt;div style="color: #fe0002; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;14 [main] INFO org.hibernate.cfg.Environment - using JDK 1.4 java.sql.Timestamp handling&lt;/div&gt;&lt;div style="color: #fe0002; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;145 [main] INFO org.hibernate.cfg.HbmBinder - Mapping class: org.example.Animal -&amp;gt; Animal&lt;/div&gt;&lt;div style="color: #fe0002; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;200 [main] INFO org.hibernate.connection.ConnectionProviderFactory - Initializing connection provider: org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider&lt;/div&gt;&lt;div style="color: #fe0002; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;404 [main] INFO org.hibernate.cfg.SettingsFactory - RDBMS: MySQL, version: 5.1.39&lt;/div&gt;&lt;div style="color: #fe0002; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;404 [main] INFO org.hibernate.cfg.SettingsFactory - JDBC driver: MySQL-AB JDBC Driver, version: mysql-connector-java-5.1.12 ( Revision: ${bzr.revision-id} )&lt;/div&gt;&lt;div style="color: #fe0002; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;420 [main] INFO org.hibernate.dialect.Dialect - Using dialect: org.hibernate.dialect.MySQLDialect&lt;/div&gt;&lt;div style="color: #fe0002; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;423 [main] INFO org.hibernate.transaction.TransactionFactoryFactory - Transaction strategy: org.springframework.orm.hibernate3.SpringTransactionFactory&lt;/div&gt;&lt;div style="color: #fe0002; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;424 [main] INFO org.hibernate.transaction.TransactionManagerLookupFactory - No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)&lt;/div&gt;&lt;div style="color: #fe0002; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;424 [main] INFO org.hibernate.cfg.SettingsFactory - Automatic flush during beforeCompletion(): disabled&lt;/div&gt;&lt;div style="color: #fe0002; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;424 [main] INFO org.hibernate.cfg.SettingsFactory - Automatic session close at end of transaction: disabled&lt;/div&gt;&lt;div style="color: #fe0002; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;424 [main] INFO org.hibernate.cfg.SettingsFactory - JDBC batch size: 15&lt;/div&gt;&lt;div style="color: #fe0002; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;424 [main] INFO org.hibernate.cfg.SettingsFactory - JDBC batch updates for versioned data: disabled&lt;/div&gt;&lt;div style="color: #fe0002; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;425 [main] INFO org.hibernate.cfg.SettingsFactory - Scrollable result sets: enabled&lt;/div&gt;&lt;div style="color: #fe0002; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;425 [main] INFO org.hibernate.cfg.SettingsFactory - JDBC3 getGeneratedKeys(): enabled&lt;/div&gt;&lt;div style="color: #fe0002; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;425 [main] INFO org.hibernate.cfg.SettingsFactory - Connection release mode: auto&lt;/div&gt;&lt;div style="color: #fe0002; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;425 [main] INFO org.hibernate.cfg.SettingsFactory - Maximum outer join fetch depth: 2&lt;/div&gt;&lt;div style="color: #fe0002; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;425 [main] INFO org.hibernate.cfg.SettingsFactory - Default batch fetch size: 1&lt;/div&gt;&lt;div style="color: #fe0002; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;425 [main] INFO org.hibernate.cfg.SettingsFactory - Generate SQL with comments: disabled&lt;/div&gt;&lt;div style="color: #fe0002; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;426 [main] INFO org.hibernate.cfg.SettingsFactory - Order SQL updates by primary key: disabled&lt;/div&gt;&lt;div style="color: #fe0002; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;426 [main] INFO org.hibernate.cfg.SettingsFactory - Order SQL inserts for batching: disabled&lt;/div&gt;&lt;div style="color: #fe0002; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;426 [main] INFO org.hibernate.cfg.SettingsFactory - Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory&lt;/div&gt;&lt;div style="color: #fe0002; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;427 [main] INFO org.hibernate.hql.ast.ASTQueryTranslatorFactory - Using ASTQueryTranslatorFactory&lt;/div&gt;&lt;div style="color: #fe0002; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;427 [main] INFO org.hibernate.cfg.SettingsFactory - Query language substitutions: {}&lt;/div&gt;&lt;div style="color: #fe0002; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;427 [main] INFO org.hibernate.cfg.SettingsFactory - JPA-QL strict compliance: disabled&lt;/div&gt;&lt;div style="color: #fe0002; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;427 [main] INFO org.hibernate.cfg.SettingsFactory - Second-level cache: enabled&lt;/div&gt;&lt;div style="color: #fe0002; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;427 [main] INFO org.hibernate.cfg.SettingsFactory - Query cache: disabled&lt;/div&gt;&lt;div style="color: #fe0002; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;427 [main] INFO org.hibernate.cfg.SettingsFactory - Cache region factory : org.hibernate.cache.impl.NoCachingRegionFactory&lt;/div&gt;&lt;div style="color: #fe0002; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;427 [main] INFO org.hibernate.cfg.SettingsFactory - Optimize cache for minimal puts: disabled&lt;/div&gt;&lt;div style="color: #fe0002; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;427 [main] INFO org.hibernate.cfg.SettingsFactory - Structured second-level cache entries: disabled&lt;/div&gt;&lt;div style="color: #fe0002; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;430 [main] INFO org.hibernate.cfg.SettingsFactory - Statistics: disabled&lt;/div&gt;&lt;div style="color: #fe0002; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;430 [main] INFO org.hibernate.cfg.SettingsFactory - Deleted entity synthetic identifier rollback: disabled&lt;/div&gt;&lt;div style="color: #fe0002; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;430 [main] INFO org.hibernate.cfg.SettingsFactory - Default entity-mode: pojo&lt;/div&gt;&lt;div style="color: #fe0002; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;430 [main] INFO org.hibernate.cfg.SettingsFactory - Named query checking : enabled&lt;/div&gt;&lt;div style="color: #fe0002; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;454 [main] INFO org.hibernate.impl.SessionFactoryImpl - building session factory&lt;/div&gt;&lt;div style="color: #fe0002; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;585 [main] INFO org.hibernate.impl.SessionFactoryObjectFactory - Not binding factory to JNDI, no JNDI name configured&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;The cow says moow and has 4 feet.&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;The Following Animal have 4 feet:&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;1. cow&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;2. horse&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;The Following Animal have 2 feet:&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;1. chicken&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;The piggy says oink and has 4 feet.&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;The pig says oink and has 4 feet&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font: 11.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;b&gt;All Done!&lt;/b&gt;&lt;/div&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1546366980808220992-7948088033652468395?l=techscienceinterest.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techscienceinterest.blogspot.com/feeds/7948088033652468395/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techscienceinterest.blogspot.com/2010/02/spring-hibernate-integration-how-to.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1546366980808220992/posts/default/7948088033652468395'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1546366980808220992/posts/default/7948088033652468395'/><link rel='alternate' type='text/html' href='http://techscienceinterest.blogspot.com/2010/02/spring-hibernate-integration-how-to.html' title='Spring Hibernate Integration HOW-TO using MySQL'/><author><name>Brent Coffey</name><uri>http://www.blogger.com/profile/14987122747702890412</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_7p4NxoKlbj4/S3RxOjAJ_rI/AAAAAAAAAEw/kOlFmUROluI/S220/Photo+on+2010-02-11+at+15.39+%232.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1546366980808220992.post-2677566218077755970</id><published>2010-02-18T19:32:00.002-05:00</published><updated>2010-02-19T10:13:23.795-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='spring'/><category scheme='http://www.blogger.com/atom/ns#' term='database'/><category scheme='http://www.blogger.com/atom/ns#' term='jdbc'/><title type='text'>Using JDBC the Spring 3 Way</title><content type='html'>Normally when you go to query a database there are lots of boilerplate things you need to do to make a connection, query the database, process the result set, and finally close the connection. &amp;nbsp;Well Spring makes things easy. &amp;nbsp;I'm going to show you how to do all these things in Spring. &amp;nbsp;(&lt;b&gt;NOTE&lt;/b&gt;: &lt;i&gt;I'm using MySQL as my database&lt;/i&gt;)&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Step one add the Spring Jars to your application &lt;/b&gt;(&lt;b&gt;NOTE: &lt;/b&gt;&lt;i&gt;I'm using the Maven group Id's and artifact Id's, if you are not using Maven you will download the associated jars and put them in your classpath&lt;/i&gt;&lt;b&gt; &lt;/b&gt;):&lt;br /&gt;&lt;ol&gt;&lt;li&gt;mysql : mysql-connector-java&lt;/li&gt;&lt;li&gt;org.springframework : spring-jdbc&lt;/li&gt;&lt;li&gt;org.springframework : spring-context&lt;/li&gt;&lt;/ol&gt;&lt;div&gt;&lt;b&gt;Second Setup your application-config.xml:&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;div style="color: #7f007f; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: teal;"&gt;&lt;span style="color: #3f7f7f;"&gt;xml&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;version&lt;span style="color: black;"&gt;=&lt;/span&gt;&lt;span style="color: #2a00ff;"&gt;"1.0"&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;encoding&lt;span style="color: black;"&gt;=&lt;/span&gt;&lt;span style="color: #2a00ff;"&gt;"UTF-8"&lt;/span&gt;&lt;span style="color: teal;"&gt;?&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="color: #2a00ff; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: teal;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #3f7f7f;"&gt;beans&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: #7f007f;"&gt;xmlns&lt;/span&gt;&lt;span style="color: black;"&gt;=&lt;/span&gt;"http://www.springframework.org/schema/beans"&lt;/div&gt;&lt;div style="color: #2a00ff; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: #7f007f;"&gt;xmlns:xsi&lt;/span&gt;&lt;span style="color: black;"&gt;=&lt;/span&gt;"http://www.w3.org/2001/XMLSchema-instance"&lt;/div&gt;&lt;div style="color: #2a00ff; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: #7f007f;"&gt;xmlns:jdbc&lt;/span&gt;&lt;span style="color: black;"&gt;=&lt;/span&gt;"http://www.springframework.org/schema/jdbc"&lt;/div&gt;&lt;div style="color: #2a00ff; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: #7f007f;"&gt;xsi:schemaLocation&lt;/span&gt;&lt;span style="color: black;"&gt;=&lt;/span&gt;"http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd&lt;/div&gt;&lt;div style="color: #2a00ff; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.0.xsd"&lt;span style="color: teal;"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/div&gt;&lt;div style="color: #2a00ff; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-style-span" style="color: black;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="color: #2a00ff; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #3f7f7f;"&gt;bean&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: #7f007f;"&gt;id&lt;/span&gt;&lt;span style="color: black;"&gt;=&lt;/span&gt;"mysqlDataSource"&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: #7f007f;"&gt;class&lt;/span&gt;&lt;span style="color: black;"&gt;=&lt;/span&gt;"org.springframework.jdbc.datasource.DriverManagerDataSource"&lt;span style="color: teal;"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="color: #2a00ff; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style="color: teal;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #3f7f7f;"&gt;property&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: #7f007f;"&gt;name&lt;/span&gt;&lt;span style="color: black;"&gt;=&lt;/span&gt;"driverClassName"&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: #7f007f;"&gt;value&lt;/span&gt;&lt;span style="color: black;"&gt;=&lt;/span&gt;"com.mysql.jdbc.Driver"&lt;span style="color: teal;"&gt;/&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="color: #2a00ff; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style="color: teal;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #3f7f7f;"&gt;property&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: #7f007f;"&gt;name&lt;/span&gt;&lt;span style="color: black;"&gt;=&lt;/span&gt;"url"&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: #7f007f;"&gt;value&lt;/span&gt;&lt;span style="color: black;"&gt;=&lt;/span&gt;"jdbc:mysql://localhost/test"&lt;span style="color: teal;"&gt;/&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="color: #2a00ff; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style="color: teal;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #3f7f7f;"&gt;property&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: #7f007f;"&gt;name&lt;/span&gt;&lt;span style="color: black;"&gt;=&lt;/span&gt;"username"&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: #7f007f;"&gt;value&lt;/span&gt;&lt;span style="color: black;"&gt;=&lt;/span&gt;"test"&lt;span style="color: teal;"&gt;/&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="color: #2a00ff; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style="color: teal;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #3f7f7f;"&gt;property&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: #7f007f;"&gt;name&lt;/span&gt;&lt;span style="color: black;"&gt;=&lt;/span&gt;"password"&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: #7f007f;"&gt;value&lt;/span&gt;&lt;span style="color: black;"&gt;=&lt;/span&gt;"password"&lt;span style="color: teal;"&gt;/&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&amp;nbsp; &amp;nbsp; &lt;span style="color: teal;"&gt;&lt;/span&gt;&lt;span style="color: #3f7f7f;"&gt;bean&lt;/span&gt;&lt;span style="color: teal;"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="color: #2a00ff; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #3f7f7f;"&gt;bean&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: #7f007f;"&gt;id&lt;/span&gt;&lt;span style="color: black;"&gt;=&lt;/span&gt;"jdbcTemplate"&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: #7f007f;"&gt;class&lt;/span&gt;&lt;span style="color: black;"&gt;=&lt;/span&gt;"org.springframework.jdbc.core.simple.SimpleJdbcTemplate"&lt;span style="color: teal;"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="color: #2a00ff; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #3f7f7f;"&gt;constructor-arg&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: #7f007f;"&gt;ref&lt;/span&gt;&lt;span style="color: black;"&gt;=&lt;/span&gt;"mysqlDataSource"&lt;span style="color: teal;"&gt;/&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&amp;nbsp; &amp;nbsp; &lt;span style="color: teal;"&gt;&lt;/span&gt;&lt;span style="color: #3f7f7f;"&gt;bean&lt;/span&gt;&lt;span style="color: teal;"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="color: #3f7f7f; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: teal;"&gt;&lt;/span&gt;beans&lt;span style="color: teal;"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;Notice I have setup 2 beans mysqlDataSource and jdbcTemplate, respectively. &amp;nbsp;I have passed the mysqlDataSource to the jdbcTemplate as a constructor-arg. &amp;nbsp;Also note that in mysqlDataSource you will need to change the username, password, and URL to point to your database with the correct login credentials.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;Next I create a table in the database:&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div style="font: 12.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;CREATE TABLE animal (name VARCHAR(255), says VARCHAR (10), feet int(3));&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;Create a pojo that will hold a row of the table. &lt;/b&gt;&amp;nbsp;In my case since I have table called animal, each row of the table corresponds to a particular animal. &amp;nbsp;Therefore, I create a java class called animal that looks like this:&lt;/div&gt;&lt;div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: #7f0055;"&gt;package&lt;/span&gt; org.example;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="color: #7f0055; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;public&lt;span style="color: black;"&gt; &lt;/span&gt;class&lt;span style="color: black;"&gt; Animal {&lt;/span&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;private&lt;/span&gt; String &lt;span style="color: #0000c0;"&gt;name&lt;/span&gt;;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;private&lt;/span&gt; String &lt;span style="color: #0000c0;"&gt;says&lt;/span&gt;;&lt;/div&gt;&lt;div style="color: #7f0055; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/span&gt;private&lt;span style="color: black;"&gt; &lt;/span&gt;int&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: #0000c0;"&gt;feet&lt;/span&gt;&lt;span style="color: black;"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;public&lt;/span&gt; String getName() {&lt;/div&gt;&lt;div style="color: #7f0055; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;/span&gt;return&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: #0000c0;"&gt;name&lt;/span&gt;&lt;span style="color: black;"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;public&lt;/span&gt; &lt;span style="color: #7f0055;"&gt;void&lt;/span&gt; setName(String name) {&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;this&lt;/span&gt;.&lt;span style="color: #0000c0;"&gt;name&lt;/span&gt; = name;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;public&lt;/span&gt; String getSays() {&lt;/div&gt;&lt;div style="color: #7f0055; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;/span&gt;return&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: #0000c0;"&gt;says&lt;/span&gt;&lt;span style="color: black;"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;public&lt;/span&gt; &lt;span style="color: #7f0055;"&gt;void&lt;/span&gt; setSays(String says) {&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;this&lt;/span&gt;.&lt;span style="color: #0000c0;"&gt;says&lt;/span&gt; = says;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;public&lt;/span&gt; &lt;span style="color: #7f0055;"&gt;int&lt;/span&gt; getFeet() {&lt;/div&gt;&lt;div style="color: #7f0055; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;/span&gt;return&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: #0000c0;"&gt;feet&lt;/span&gt;&lt;span style="color: black;"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;public&lt;/span&gt; &lt;span style="color: #7f0055;"&gt;void&lt;/span&gt; setFeet(&lt;span style="color: #7f0055;"&gt;int&lt;/span&gt; feet) {&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;this&lt;/span&gt;.&lt;span style="color: #0000c0;"&gt;feet&lt;/span&gt; = feet;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;}&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;Next write a class that will implement springs RowMapper interface:&lt;/b&gt;&amp;nbsp;&amp;nbsp;This is import because this is the class that will map a single result set to an Animal object. This is also where Spring magic starts to happen so pay attention to what is going on.&lt;/div&gt;&lt;div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: #7f0055;"&gt;package&lt;/span&gt; org.example;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: #7f0055;"&gt;import&lt;/span&gt; java.sql.ResultSet;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: #7f0055;"&gt;import&lt;/span&gt; java.sql.SQLException;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: #7f0055;"&gt;import&lt;/span&gt; org.springframework.jdbc.core.RowMapper;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: #7f0055;"&gt;public&lt;/span&gt; &lt;span style="color: #7f0055;"&gt;class&lt;/span&gt; AnimalMapper &lt;span style="color: #7f0055;"&gt;implements&lt;/span&gt; RowMapper&lt;animal&gt; {&lt;/animal&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;public&lt;/span&gt; Animal mapRow(ResultSet rs, &lt;span style="color: #7f0055;"&gt;int&lt;/span&gt; i) &lt;span style="color: #7f0055;"&gt;throws&lt;/span&gt; SQLException {&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;Animal animal = &lt;span style="color: #7f0055;"&gt;new&lt;/span&gt; Animal();&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;animal.setName(rs.getString(&lt;span style="color: #2a00ff;"&gt;"name"&lt;/span&gt;));&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;animal.setSays(rs.getString(&lt;span style="color: #2a00ff;"&gt;"says"&lt;/span&gt;));&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;animal.setFeet(rs.getInt(&lt;span style="color: #2a00ff;"&gt;"feet"&lt;/span&gt;));&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;return&lt;/span&gt; animal;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;}&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;Now I write my calling code:&lt;/b&gt; Notice I will get the SimpleJdbcTemplate bean from the application-config.xml which I setup at the top of this blog. &amp;nbsp;I will then use this bean created by Spring to call "update" to setup the database. &amp;nbsp;Finally I will retrieve the data I place in the database using the "query" method. &amp;nbsp;Notice how the query method takes as an argument a SQL String, and a RowMapper Object. &amp;nbsp;It will then return a List of whatever types of objects your RowMapper was created to return. &amp;nbsp;Notice how I never called "next" on the resultSet or had a while loop to iterate over the result set to create the list. I also never closed the connection, because, again, Spring does this all for me!&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;/b&gt;&lt;br /&gt;&lt;b&gt;&lt;/b&gt;&lt;br /&gt;&lt;b&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: #7f0055;"&gt;package&lt;/span&gt; org.example;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: #7f0055;"&gt;import&lt;/span&gt; java.util.List;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;span class="Apple-style-span" style="color: #7f0055;"&gt;&lt;span class="Apple-style-span" style="color: black;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: #7f0055;"&gt;import&lt;/span&gt; org.springframework.context.ApplicationContext;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: #7f0055;"&gt;import&lt;/span&gt; org.springframework.context.support.ClassPathXmlApplicationContext;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: #7f0055;"&gt;import&lt;/span&gt; org.springframework.jdbc.core.simple.SimpleJdbcTemplate;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: #7f0055;"&gt;public&lt;/span&gt; &lt;span style="color: #7f0055;"&gt;class&lt;/span&gt; HelloAnimals {&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;public&lt;/span&gt; &lt;span style="color: #7f0055;"&gt;static&lt;/span&gt; &lt;span style="color: #7f0055;"&gt;void&lt;/span&gt; main(String[] args) {&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;BasicConfigurator.configure();&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;ApplicationContext context = &lt;span style="color: #7f0055;"&gt;new&lt;/span&gt; ClassPathXmlApplicationContext(&lt;span style="color: #2a00ff;"&gt;"./application-config.xml"&lt;/span&gt;);&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;SimpleJdbcTemplate jdbcTemplate = (SimpleJdbcTemplate) context.getBean(&lt;span style="color: #2a00ff;"&gt;"jdbcTemplate"&lt;/span&gt;);&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;jdbcTemplate.update(&lt;span style="color: #2a00ff;"&gt;"DELETE FROM animal;"&lt;/span&gt;);&lt;/div&gt;&lt;div style="color: #2a00ff; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;jdbcTemplate.update(&lt;/span&gt;"INSERT INTO animal (name, says, feet) VALUES ('cow', 'moow', 4);"&lt;span style="color: black;"&gt;);&lt;/span&gt;&lt;/div&gt;&lt;div style="color: #2a00ff; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;jdbcTemplate.update(&lt;/span&gt;"INSERT INTO animal (name, says, feet) VALUES ('chicken', 'cluck', 2);"&lt;span style="color: black;"&gt;);&lt;/span&gt;&lt;/div&gt;&lt;div style="color: #2a00ff; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;jdbcTemplate.update(&lt;/span&gt;"INSERT INTO animal (name, says, feet) VALUES ('dog', 'woof', 4);"&lt;span style="color: black;"&gt;);&lt;/span&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;List&lt;animal&gt; animals = jdbcTemplate.query(&lt;span style="color: #2a00ff;"&gt;"SELECT * FROM animal"&lt;/span&gt;,&lt;span style="color: #7f0055;"&gt;new&lt;/span&gt; AnimalMapper());&lt;/animal&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;for&lt;/span&gt; (Animal animal : animals) {&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;System.&lt;span style="color: #0000c0;"&gt;out&lt;/span&gt;.println(&lt;span style="color: #2a00ff;"&gt;"Animals name is "&lt;/span&gt; + animal.getName() +&amp;nbsp;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;     &lt;/span&gt;&lt;span style="color: #2a00ff;"&gt;" and says "&lt;/span&gt; + animal.getSays() +&amp;nbsp;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;     &lt;/span&gt;&lt;span style="color: #2a00ff;"&gt;" and has "&lt;/span&gt; + animal.getFeet() + &lt;span style="color: #2a00ff;"&gt;" feet"&lt;/span&gt;);&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;}&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;}&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;b&gt;My Results:&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;Animals name is cow and says moow and has 4 feet&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;Animals name is chicken and says cluck and has 2 feet&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;Animals name is dog and says woof and has 4 feet&lt;/div&gt;&lt;/b&gt;&lt;b&gt;&lt;br /&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1546366980808220992-2677566218077755970?l=techscienceinterest.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techscienceinterest.blogspot.com/feeds/2677566218077755970/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techscienceinterest.blogspot.com/2010/02/using-jdbc-spring-3-way.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1546366980808220992/posts/default/2677566218077755970'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1546366980808220992/posts/default/2677566218077755970'/><link rel='alternate' type='text/html' href='http://techscienceinterest.blogspot.com/2010/02/using-jdbc-spring-3-way.html' title='Using JDBC the Spring 3 Way'/><author><name>Brent Coffey</name><uri>http://www.blogger.com/profile/14987122747702890412</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_7p4NxoKlbj4/S3RxOjAJ_rI/AAAAAAAAAEw/kOlFmUROluI/S220/Photo+on+2010-02-11+at+15.39+%232.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1546366980808220992.post-1084032785777141622</id><published>2010-02-17T20:48:00.001-05:00</published><updated>2010-02-17T21:00:02.202-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='evolutionary computing'/><category scheme='http://www.blogger.com/atom/ns#' term='evolution'/><title type='text'>Mona Lisa Evolution Part II</title><content type='html'>Earlier I posted a short &lt;a href="http://techscienceinterest.blogspot.com/2010/02/evolutionary-computing-with-java.html"&gt;article on evolving the "Mona Lisa" using genetic algorithms&lt;/a&gt;. &amp;nbsp;Today I stumbled on another blog that refers does the same thing. &amp;nbsp;The results are simply amazing! &amp;nbsp;&lt;a href="http://rogeralsing.com/2008/12/07/genetic-programming-evolution-of-mona-lisa/"&gt;Check out the pictures on this blog&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1546366980808220992-1084032785777141622?l=techscienceinterest.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techscienceinterest.blogspot.com/feeds/1084032785777141622/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techscienceinterest.blogspot.com/2010/02/mona-lisa-evolution-part-ii.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1546366980808220992/posts/default/1084032785777141622'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1546366980808220992/posts/default/1084032785777141622'/><link rel='alternate' type='text/html' href='http://techscienceinterest.blogspot.com/2010/02/mona-lisa-evolution-part-ii.html' title='Mona Lisa Evolution Part II'/><author><name>Brent Coffey</name><uri>http://www.blogger.com/profile/14987122747702890412</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_7p4NxoKlbj4/S3RxOjAJ_rI/AAAAAAAAAEw/kOlFmUROluI/S220/Photo+on+2010-02-11+at+15.39+%232.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1546366980808220992.post-5804888260919753402</id><published>2010-02-17T12:56:00.003-05:00</published><updated>2010-02-17T13:10:29.750-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='spring'/><title type='text'>Setter Injection &amp; Custom Property Editors</title><content type='html'>Below is an example of a typical use of setter injection. &amp;nbsp;As you can see, some property of a java class is going to be set to the string "Hello World."&lt;br /&gt;&lt;br /&gt;&lt;div style="color: #2a00ff; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: teal;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #3f7f7f;"&gt;bean&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: #7f007f;"&gt;id&lt;/span&gt;&lt;span style="color: black;"&gt;=&lt;/span&gt;"..."&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: #7f007f;"&gt;class&lt;/span&gt;&lt;span style="color: black;"&gt;=&lt;/span&gt;"..."&lt;span style="color: teal;"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="color: #2a00ff; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #3f7f7f;"&gt;property&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: #7f007f;"&gt;name&lt;/span&gt;&lt;span style="color: black;"&gt;=&lt;/span&gt;"someClassProperty"&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: #7f007f;"&gt;value&lt;/span&gt;&lt;span style="color: black;"&gt;=&lt;/span&gt;"Hello World"&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: teal;"&gt;/&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="color: #3f7f7f; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: teal;"&gt;&lt;/span&gt;bean&lt;span style="color: teal;"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;Out of the box Spring supports automagically setting java class properties to the following types besides just String:&lt;br /&gt;&lt;br /&gt;1. Number&lt;br /&gt;2. Boolean&lt;br /&gt;3. Date&lt;br /&gt;4. Resource&lt;br /&gt;5. Properties&lt;br /&gt;6. Byte&lt;br /&gt;7. Locale&lt;br /&gt;&lt;br /&gt;But sometimes you may want to use setter injection to set a property of a java class to a non-supported property type, like "java.util.regex.Pattern." &amp;nbsp;Consider this class for example:&lt;br /&gt;&lt;br /&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: #7f0055;"&gt;package&lt;/span&gt; org.example;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: #7f0055;"&gt;import&lt;/span&gt; java.util.regex.Pattern;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: #7f0055;"&gt;public&lt;/span&gt; &lt;span style="color: #7f0055;"&gt;class&lt;/span&gt; HelloPattern &lt;span style="color: #7f0055;"&gt;implements&lt;/span&gt; Hello {&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Pattern &lt;span style="color: #0000c0;"&gt;pattern&lt;/span&gt;;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;public&lt;/span&gt; Pattern getPattern() {&lt;/div&gt;&lt;div style="color: #0000c0; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span style="color: #7f0055;"&gt;return&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;pattern&lt;span style="color: black;"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;public&lt;/span&gt; &lt;span style="color: #7f0055;"&gt;void&lt;/span&gt; setPattern(Pattern pattern) {&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;this&lt;/span&gt;.&lt;span style="color: #0000c0;"&gt;pattern&lt;/span&gt; = pattern;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;public&lt;/span&gt; &lt;span style="color: #7f0055;"&gt;void&lt;/span&gt; printMeAPattern() {&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;System.&lt;span style="color: #0000c0;"&gt;out&lt;/span&gt;.println(&lt;span style="color: #2a00ff;"&gt;"I got a pattern like this: "&lt;/span&gt; + &lt;span style="color: #0000c0;"&gt;pattern&lt;/span&gt;.toString());&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;}&lt;/div&gt;&lt;br /&gt;So how would you use setter injection in spring to set "pattern"?&lt;br /&gt;&lt;br /&gt;Well Spring allows you to extend something called the "PropertyEditorSupport" class and override two of it's methods; setAsText(String) and getAsText(). &amp;nbsp;Once you extend this class, you will use your newly created class to support the setting of properties. &amp;nbsp;Here is how it works.&lt;br /&gt;&lt;br /&gt;First extend PropertyEditorSupport. &amp;nbsp;Here is mine:&lt;br /&gt;&lt;br /&gt;&lt;div style="font: normal normal normal 11px/normal Monaco; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span style="color: #7f0055;"&gt;package&lt;/span&gt;&amp;nbsp;org.example;&lt;/div&gt;&lt;div style="font: normal normal normal 11px/normal Monaco; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-height: 15px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font: normal normal normal 11px/normal Monaco; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span style="color: #7f0055;"&gt;import&lt;/span&gt;&amp;nbsp;java.beans.PropertyEditorSupport;&lt;/div&gt;&lt;div style="font: normal normal normal 11px/normal Monaco; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span style="color: #7f0055;"&gt;import&lt;/span&gt;&amp;nbsp;java.util.regex.Pattern;&lt;/div&gt;&lt;div style="font: normal normal normal 11px/normal Monaco; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-height: 15px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font: normal normal normal 11px/normal Monaco; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span style="color: #7f0055;"&gt;public&lt;/span&gt;&amp;nbsp;&lt;span style="color: #7f0055;"&gt;class&lt;/span&gt;&amp;nbsp;PatternEditorSupport&amp;nbsp;&lt;span style="color: #7f0055;"&gt;extends&lt;/span&gt;&amp;nbsp;PropertyEditorSupport {&lt;/div&gt;&lt;div style="font: normal normal normal 11px/normal Monaco; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;public&lt;/span&gt;&amp;nbsp;&lt;span style="color: #7f0055;"&gt;void&lt;/span&gt;&amp;nbsp;setAsText(String regex) {&lt;/div&gt;&lt;div style="font: normal normal normal 11px/normal Monaco; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;if&lt;/span&gt;&amp;nbsp;(regex !=&amp;nbsp;&lt;span style="color: #7f0055;"&gt;null&lt;/span&gt;) {&lt;/div&gt;&lt;div style="font: normal normal normal 11px/normal Monaco; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;setValue(Pattern.compile(regex));&lt;/div&gt;&lt;div style="font: normal normal normal 11px/normal Monaco; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;}&amp;nbsp;&lt;span style="color: #7f0055;"&gt;else&lt;/span&gt;&amp;nbsp;{&lt;/div&gt;&lt;div style="font: normal normal normal 11px/normal Monaco; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;setValue(&lt;span style="color: #7f0055;"&gt;null&lt;/span&gt;);&lt;/div&gt;&lt;div style="font: normal normal normal 11px/normal Monaco; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;}&lt;/div&gt;&lt;div style="font: normal normal normal 11px/normal Monaco; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div style="font: normal normal normal 11px/normal Monaco; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-height: 15px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/div&gt;&lt;div style="font: normal normal normal 11px/normal Monaco; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;public&lt;/span&gt;&amp;nbsp;String getAsText() {&lt;/div&gt;&lt;div style="font: normal normal normal 11px/normal Monaco; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;String rtnString =&amp;nbsp;&lt;span style="color: #2a00ff;"&gt;""&lt;/span&gt;;&lt;/div&gt;&lt;div style="font: normal normal normal 11px/normal Monaco; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;Pattern pattern = (Pattern)getValue();&lt;/div&gt;&lt;div style="font: normal normal normal 11px/normal Monaco; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;if&lt;/span&gt;&amp;nbsp;(pattern !=&amp;nbsp;&lt;span style="color: #7f0055;"&gt;null&lt;/span&gt;) {&lt;/div&gt;&lt;div style="font: normal normal normal 11px/normal Monaco; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;rtnString = pattern.pattern();&lt;/div&gt;&lt;div style="font: normal normal normal 11px/normal Monaco; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;}&lt;/div&gt;&lt;div style="font: normal normal normal 11px/normal Monaco; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-height: 15px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;/div&gt;&lt;div style="font: normal normal normal 11px/normal Monaco; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;return&lt;/span&gt;&amp;nbsp;rtnString;&lt;/div&gt;&lt;div style="font: normal normal normal 11px/normal Monaco; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div style="font: normal normal normal 11px/normal Monaco; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;}&lt;/div&gt;&lt;br /&gt;Notice a few of things.&lt;br /&gt;&lt;br /&gt;1. You must override the setAsText(String) and the getAsText() methods as I stated above.&lt;br /&gt;2. You must call setValue(String) in the setAsText(String) method&lt;br /&gt;3. You must call getValue() and cast it to the correct type in the getAsText() method.&lt;br /&gt;4. You must return an empty value from getAsText() in case of null.&lt;br /&gt;5. You must send null to setValue(String) if for some reason the String is null.&lt;br /&gt;&lt;br /&gt;After having written your PropertyEditorSupport extended class you will then add the following to your bean xml (usually application-config.xml):&lt;br /&gt;&lt;div style="color: #3f7f7f; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: teal;"&gt;&amp;lt;&lt;/span&gt;bean&lt;span class="Apple-style-span" style="color: black;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #2a00ff;"&gt;&lt;span style="color: #7f007f;"&gt;class&lt;/span&gt;&lt;span style="color: black;"&gt;=&lt;/span&gt;"org.springframework.beans.factory.config.CustomEditorConfigurer"&lt;span style="color: teal;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="color: #2a00ff; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #3f7f7f;"&gt;property&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: #7f007f;"&gt;name&lt;/span&gt;&lt;span style="color: black;"&gt;=&lt;/span&gt;"customEditors"&lt;span style="color: teal;"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;span style="color: teal;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #3f7f7f;"&gt;map&lt;/span&gt;&lt;span style="color: teal;"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="color: #2a00ff; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #3f7f7f;"&gt;entry&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: #7f007f;"&gt;key&lt;/span&gt;&lt;span style="color: black;"&gt;=&lt;/span&gt;"java.util.regex.Pattern"&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: #7f007f;"&gt;value&lt;/span&gt;&lt;span style="color: black;"&gt;=&lt;/span&gt;"org.example.PatternEditorSupport"&lt;span style="color: teal;"&gt;/&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;span style="color: teal;"&gt;&lt;/span&gt;&lt;span style="color: #3f7f7f;"&gt;map&lt;/span&gt;&lt;span style="color: teal;"&gt;&amp;gt;&lt;span class="Apple-style-span" style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="color: #3f7f7f; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;&lt;/span&gt;property&lt;span style="color: teal;"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="color: #3f7f7f; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: teal;"&gt;&lt;/span&gt;bean&lt;span style="color: teal;"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;Finally create your bean in your xml file just like normal and the Spring framework will automagically call the correct CustomEditorConfigurer for the property in question. In this case I'm going to set a Pattern for a zip code...&lt;br /&gt;&lt;br /&gt;&lt;div style="color: #2a00ff; font: normal normal normal 11px/normal Monaco; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span style="color: teal;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #3f7f7f;"&gt;bean&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: #7f007f;"&gt;id&lt;/span&gt;&lt;span style="color: black;"&gt;=&lt;/span&gt;"helloPattern"&lt;span style="color: black;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: #7f007f;"&gt;class&lt;/span&gt;&lt;span style="color: black;"&gt;=&lt;/span&gt;"org.example.HelloPattern"&lt;span style="color: teal;"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="color: #2a00ff; font: normal normal normal 11px/normal Monaco; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #3f7f7f;"&gt;property&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: #7f007f;"&gt;name&lt;/span&gt;&lt;span style="color: black;"&gt;=&lt;/span&gt;"pattern"&lt;span style="color: black;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: #7f007f;"&gt;value&lt;/span&gt;&lt;span style="color: black;"&gt;=&lt;/span&gt;"[0-9]{5}"&lt;span style="color: teal;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #3f7f7f;"&gt;property&lt;/span&gt;&lt;span style="color: teal;"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="color: #3f7f7f; font: normal normal normal 11px/normal Monaco; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span style="color: teal;"&gt;&lt;/span&gt;bean&lt;span style="color: teal;"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;Spring knows to call the correct CustomEditorConfigurer because Spring knows that the property "pattern" in set in the class org.example.HelloPattern with a setter requiring type java.util.regex.Pattern to be passed in. &amp;nbsp;So it will look in the CustomEditors map and see if there is a Custom editor to support that type. &amp;nbsp;Sure enough, in this case there is. &amp;nbsp;So Spring calls the PatternEditorSupport class to handle the setAsText(String) and getAsText() functions. &amp;nbsp;Our property "pattern" has now been properly intialized to a Pattern.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Important to remember:&lt;/b&gt; In Spring, everything starts as a String (because it's XML) and the Spring framework tries to convert this starting String to something else before calling the set method on the property; albeit a number, a date, a custom something, etc. &amp;nbsp;If none of those conversions work Spring will only then pass it as a String to the property.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1546366980808220992-5804888260919753402?l=techscienceinterest.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techscienceinterest.blogspot.com/feeds/5804888260919753402/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techscienceinterest.blogspot.com/2010/02/setter-injection-custom-property.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1546366980808220992/posts/default/5804888260919753402'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1546366980808220992/posts/default/5804888260919753402'/><link rel='alternate' type='text/html' href='http://techscienceinterest.blogspot.com/2010/02/setter-injection-custom-property.html' title='Setter Injection &amp; Custom Property Editors'/><author><name>Brent Coffey</name><uri>http://www.blogger.com/profile/14987122747702890412</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_7p4NxoKlbj4/S3RxOjAJ_rI/AAAAAAAAAEw/kOlFmUROluI/S220/Photo+on+2010-02-11+at+15.39+%232.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1546366980808220992.post-6298233665912922290</id><published>2010-02-16T17:48:00.001-05:00</published><updated>2010-02-17T13:02:57.468-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='spring'/><title type='text'>Using properties files in Spring</title><content type='html'>&lt;span class="Apple-style-span" style="font-family: 'Lucida Grande'; line-height: 19px;"&gt;When one wants to set a value in the Spring Framework using "Setter Injection" typically the application-context.xml has the following type of XML in it:&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Lucida Grande';"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Lucida Grande'; line-height: 19px;"&gt;&lt;span class="Apple-style-span" style="color: #2a00ff; font-family: Monaco; font-size: 11px; line-height: normal;"&gt;&lt;span style="color: teal;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #3f7f7f;"&gt;bean&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: #7f007f;"&gt;id&lt;/span&gt;&lt;span style="color: black;"&gt;=&lt;/span&gt;"helloWorldOld"&lt;span style="color: black;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: #7f007f;"&gt;class&lt;/span&gt;&lt;span style="color: black;"&gt;=&lt;/span&gt;"org.example.HelloWorldOld"&lt;span style="color: teal;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Lucida Grande';"&gt;&lt;span class="Apple-style-span" style="line-height: 19px;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;span class="Apple-style-span" style="font-family: 'Lucida Grande';"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Lucida Grande';"&gt;&lt;div style="color: #2a00ff; font: normal normal normal 11px/normal Monaco; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span style="color: teal;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;lt;&lt;/span&gt;&lt;span style="color: #3f7f7f;"&gt;property&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: #7f007f;"&gt;name&lt;/span&gt;&lt;span style="color: black;"&gt;=&lt;/span&gt;"question"&lt;span style="color: black;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: #7f007f;"&gt;value&lt;/span&gt;&lt;span style="color: black;"&gt;=&lt;/span&gt;"Hello World without using .properties?"&lt;span style="color: black;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: teal;"&gt;/&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="color: #3f7f7f; font: normal normal normal 11px/normal Monaco; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span style="color: teal;"&gt;&lt;/span&gt;bean&lt;span style="color: teal;"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Lucida Grande';"&gt;&lt;span class="Apple-style-span" style="font-family: 'Lucida Grande';"&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Lucida Grande'; line-height: 22px;"&gt;The problem with this is that if you want to change the "value" then you have to wade through an xml file to find the value you want to change. &amp;nbsp;This could easily cause a bug such as a missing " or an accidently deleted &amp;gt; or /. &amp;nbsp;Not to mention it is just hard to read a bunch of XML when you are just looking to set a single value. Any little typo in the XML that will cause a runtime exception that may be difficult to find and fix. &amp;nbsp;A way to keep the "values" out the xml file is to use a traditional properties file and refer to it from the application-context.xml &amp;nbsp;file. Here is what this solution would look like:&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Lucida Grande';"&gt;&lt;span class="Apple-style-span" style="line-height: 19px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Lucida Grande';"&gt;&lt;span class="Apple-style-span" style="line-height: 19px;"&gt;&lt;span class="Apple-style-span" style="font-family: Times; line-height: normal;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Lucida Grande';"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Lucida Grande';"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Lucida Grande'; line-height: 19px;"&gt;&lt;span class="Apple-style-span" style="color: #2a00ff; font-family: Monaco; font-size: 11px; line-height: normal;"&gt;&lt;span style="color: teal;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #3f7f7f;"&gt;bean&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: #7f007f;"&gt;id&lt;/span&gt;&lt;span style="color: black;"&gt;=&lt;/span&gt;"helloWorldOld"&lt;span style="color: black;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: #7f007f;"&gt;class&lt;/span&gt;&lt;span style="color: black;"&gt;=&lt;/span&gt;"org.example.HelloWorldOld"&lt;span style="color: teal;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Lucida Grande';"&gt;&lt;span class="Apple-style-span" style="line-height: 19px;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;span class="Apple-style-span" style="font-family: 'Lucida Grande';"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Lucida Grande';"&gt;&lt;div style="color: #2a00ff; font: normal normal normal 11px/normal Monaco; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span style="color: teal;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;lt;&lt;/span&gt;&lt;span style="color: #3f7f7f;"&gt;property&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: #7f007f;"&gt;name&lt;/span&gt;&lt;span style="color: black;"&gt;=&lt;/span&gt;"question"&lt;span style="color: black;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: #7f007f;"&gt;value&lt;/span&gt;&lt;span style="color: black;"&gt;=&lt;/span&gt;"${values.question}"&lt;span style="color: black;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: teal;"&gt;/&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="color: #3f7f7f; font: normal normal normal 11px/normal Monaco; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span style="color: teal;"&gt;&lt;/span&gt;bean&lt;span style="color: teal;"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="color: #3f7f7f; font: normal normal normal 11px/normal Monaco; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span" style="color: teal;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="color: #3f7f7f; font: normal normal normal 11px/normal Monaco; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span" style="color: teal;"&gt;&lt;/span&gt;&lt;/div&gt;&lt;span class="Apple-style-span" style="color: teal;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: teal;"&gt;&lt;div style="color: #2a00ff; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: teal;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #3f7f7f;"&gt;context:property-placeholder&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: #7f007f;"&gt;location&lt;/span&gt;&lt;span style="color: black;"&gt;=&lt;/span&gt;"./resources/values.properties"&lt;span style="color: teal;"&gt;/&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Lucida Grande'; line-height: 22px;"&gt;And the values.properties file would read like this:&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Lucida Grande';"&gt;&lt;span class="Apple-style-span" style="line-height: 19px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Lucida Grande';"&gt;&lt;span class="Apple-style-span" style="line-height: 19px;"&gt;values.question=Hello World using properties!&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Lucida Grande';"&gt;&lt;span class="Apple-style-span" style="line-height: 19px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Lucida Grande';"&gt;&lt;span class="Apple-style-span" style="line-height: 19px;"&gt;That's it.&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1546366980808220992-6298233665912922290?l=techscienceinterest.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techscienceinterest.blogspot.com/feeds/6298233665912922290/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techscienceinterest.blogspot.com/2010/02/using-properties-files-in-spring.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1546366980808220992/posts/default/6298233665912922290'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1546366980808220992/posts/default/6298233665912922290'/><link rel='alternate' type='text/html' href='http://techscienceinterest.blogspot.com/2010/02/using-properties-files-in-spring.html' title='Using properties files in Spring'/><author><name>Brent Coffey</name><uri>http://www.blogger.com/profile/14987122747702890412</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_7p4NxoKlbj4/S3RxOjAJ_rI/AAAAAAAAAEw/kOlFmUROluI/S220/Photo+on+2010-02-11+at+15.39+%232.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1546366980808220992.post-2215028541996272507</id><published>2010-02-12T20:39:00.002-05:00</published><updated>2010-02-12T20:51:12.526-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='eclipse'/><category scheme='http://www.blogger.com/atom/ns#' term='JUnit'/><title type='text'>JUnit 4 in Eclispe 3.5</title><content type='html'>&lt;span class="Apple-style-span" style="font-family: 'Lucida Grande'; line-height: 19px;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div contenteditable="true" id="text_0" style="clear: both; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: none; outline-width: initial; overflow-x: auto; overflow-y: auto; padding-bottom: 0px; padding-left: 1px; padding-right: 1px; padding-top: 0px; width: 643px;"&gt;Here is a simple example on how to use JUnit 4 inside of Eclipse 3.5. First to setup an Eclipse 3.5 project to use JUnit you can follow &lt;a href="http://techscienceinterest.blogspot.com/2010/02/i-see-lots-of-blogs-on-how-to-do-any.html"&gt;my blog on how to setup an Eclipse project using Maven, JUnit, Spring, etc...&lt;/a&gt;&lt;/div&gt;&lt;div contenteditable="true" id="text_1" style="clear: both; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: none; outline-width: initial; overflow-x: auto; overflow-y: auto; padding-bottom: 0px; padding-left: 1px; padding-right: 1px; padding-top: 0px; width: 643px;"&gt;&lt;strong&gt;Step 1 Create a Class to Test:&lt;/strong&gt;&lt;/div&gt;&lt;ol contenteditable="true" id="text_2" style="-webkit-background-clip: initial; -webkit-background-origin: initial; -webkit-border-bottom-left-radius: 5px 5px; -webkit-border-bottom-right-radius: 5px 5px; -webkit-border-top-left-radius: 5px 5px; -webkit-border-top-right-radius: 5px 5px; background-attachment: initial; background-color: rgba(0, 0, 0, 0.0976562); background-image: initial; background-position: initial initial; background-repeat: initial; clear: both; margin-bottom: 19px; margin-left: 20px; margin-right: 10px; padding-bottom: 10px; padding-left: 10px; padding-right: 10px; padding-top: 10px;"&gt;&lt;li style="margin-left: 20px;"&gt;Create a new package by right clicking on the src/main/java folder. I called my package org.example.testing&lt;/li&gt;&lt;li style="margin-left: 20px;"&gt;Create a new Java Class inside of your package by right clicking and selecting class. I called my class "Cow."&lt;/li&gt;&lt;/ol&gt;&lt;div contenteditable="true" id="text_3" style="clear: both; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: none; outline-width: initial; overflow-x: auto; overflow-y: auto; padding-bottom: 0px; padding-left: 1px; padding-right: 1px; padding-top: 0px; width: 643px;"&gt;Here is my "Cow" class:&lt;/div&gt;&lt;div contenteditable="true" id="text_4" style="clear: both; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: none; outline-width: initial; overflow-x: auto; overflow-y: auto; padding-bottom: 0px; padding-left: 1px; padding-right: 1px; padding-top: 0px; width: 643px;"&gt;&lt;/div&gt;&lt;div class="draggable" id="object_4" style="-webkit-user-select: none; cursor: move; display: inline; float: left; margin-bottom: 5px; margin-left: 0px; margin-right: 5px; margin-top: 0px;" unlocked=""&gt;&lt;img align="left" object_source="&amp;lt;script class=&amp;quot;brush: java&amp;quot; type=&amp;quot;syntaxhighlighter&amp;quot;&amp;gt;&amp;lt;![CDATA[&amp;lt;p style=&amp;quot;clear: both&amp;quot;&amp;gt;package org.example.testing;&amp;lt;/p&amp;gt;&amp;lt;p style=&amp;quot;clear: both&amp;quot;&amp;gt;public class Cow {&amp;lt;/p&amp;gt;&amp;lt;p style=&amp;quot;clear: both&amp;quot;&amp;gt; private String says;&amp;lt;br /&amp;gt; private int feet;&amp;lt;br /&amp;gt; private int stomachs;&amp;lt;br /&amp;gt;&amp;lt;span class=&amp;quot;Apple-tab-span&amp;quot; style=&amp;quot;white-space:pre&amp;quot;&amp;gt; &amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; public Cow () {&amp;lt;br /&amp;gt; this (&amp;quot;moow&amp;quot;, 4, 4);&amp;lt;br /&amp;gt; }&amp;lt;br /&amp;gt;&amp;lt;span class=&amp;quot;Apple-tab-span&amp;quot; style=&amp;quot;white-space:pre&amp;quot;&amp;gt; &amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; public Cow (String says, int feet, int stomachs) {&amp;lt;br /&amp;gt; this.says = says;&amp;lt;br /&amp;gt; this.feet = feet;&amp;lt;br /&amp;gt; this.stomachs = stomachs;&amp;lt;br /&amp;gt; }&amp;lt;br /&amp;gt;&amp;lt;span class=&amp;quot;Apple-tab-span&amp;quot; style=&amp;quot;white-space:pre&amp;quot;&amp;gt; &amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; public String getSays() {&amp;lt;br /&amp;gt; return says;&amp;lt;br /&amp;gt; }&amp;lt;br /&amp;gt; public void setSays(String says) {&amp;lt;br /&amp;gt; this.says = says;&amp;lt;br /&amp;gt; }&amp;lt;br /&amp;gt; public int getFeet() {&amp;lt;br /&amp;gt; return feet;&amp;lt;br /&amp;gt; }&amp;lt;br /&amp;gt; public void setFeet(int feet) {&amp;lt;br /&amp;gt; this.feet = feet;&amp;lt;br /&amp;gt; }&amp;lt;br /&amp;gt; public int getStomachs() {&amp;lt;br /&amp;gt; return stomachs;&amp;lt;br /&amp;gt; }&amp;lt;br /&amp;gt; public void setStomachs(int stomachs) {&amp;lt;br /&amp;gt; this.stomachs = stomachs;&amp;lt;br /&amp;gt; }&amp;lt;br /&amp;gt; public void throwSomeExceptions () {&amp;lt;br /&amp;gt; int test = 5/0;&amp;lt;br /&amp;gt; }&amp;lt;span class=&amp;quot;Apple-tab-span&amp;quot; style=&amp;quot;white-space:pre&amp;quot;&amp;gt; &amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;}&amp;lt;/p&amp;gt;]]&amp;gt;&amp;lt;/script&amp;gt;" src="file:///Applications/Blogo.app/Contents/Resources/placeholder-object-black.png" style="-webkit-background-clip: initial; -webkit-background-origin: initial; -webkit-user-drag: element; -webkit-user-select: none; background-attachment: initial; background-color: #7b7b7b; background-image: initial; background-position: initial initial; background-repeat: initial; padding-bottom: 0px; padding-left: 20px; padding-right: 20px; padding-top: 0px;" /&gt;&lt;a class="object_anchor" href="http://www.blogger.com/post-edit.g?blogID=1546366980808220992&amp;amp;postID=2215028541996272507" name="object_4"&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="color: #7f0055; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;public&lt;span style="color: black;"&gt; &lt;/span&gt;class&lt;span style="color: black;"&gt; Cow {&lt;/span&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;private&lt;/span&gt; String &lt;span style="color: #0000c0;"&gt;says&lt;/span&gt;;&lt;/div&gt;&lt;div style="color: #7f0055; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/span&gt;private&lt;span style="color: black;"&gt; &lt;/span&gt;int&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: #0000c0;"&gt;feet&lt;/span&gt;&lt;span style="color: black;"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;div style="color: #7f0055; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/span&gt;private&lt;span style="color: black;"&gt; &lt;/span&gt;int&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: #0000c0;"&gt;stomachs&lt;/span&gt;&lt;span style="color: black;"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;public&lt;/span&gt; Cow () {&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;this&lt;/span&gt; (&lt;span style="color: #2a00ff;"&gt;"moow"&lt;/span&gt;, 4, 4);&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;public&lt;/span&gt; Cow (String says, &lt;span style="color: #7f0055;"&gt;int&lt;/span&gt; feet, &lt;span style="color: #7f0055;"&gt;int&lt;/span&gt; stomachs) {&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;this&lt;/span&gt;.&lt;span style="color: #0000c0;"&gt;says&lt;/span&gt; = says;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;this&lt;/span&gt;.&lt;span style="color: #0000c0;"&gt;feet&lt;/span&gt; = feet;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;this&lt;/span&gt;.&lt;span style="color: #0000c0;"&gt;stomachs&lt;/span&gt; = stomachs;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;public&lt;/span&gt; String getSays() {&lt;/div&gt;&lt;div style="color: #7f0055; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;/span&gt;return&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: #0000c0;"&gt;says&lt;/span&gt;&lt;span style="color: black;"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;public&lt;/span&gt; &lt;span style="color: #7f0055;"&gt;void&lt;/span&gt; setSays(String says) {&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;this&lt;/span&gt;.&lt;span style="color: #0000c0;"&gt;says&lt;/span&gt; = says;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;public&lt;/span&gt; &lt;span style="color: #7f0055;"&gt;int&lt;/span&gt; getFeet() {&lt;/div&gt;&lt;div style="color: #7f0055; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;/span&gt;return&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: #0000c0;"&gt;feet&lt;/span&gt;&lt;span style="color: black;"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;public&lt;/span&gt; &lt;span style="color: #7f0055;"&gt;void&lt;/span&gt; setFeet(&lt;span style="color: #7f0055;"&gt;int&lt;/span&gt; feet) {&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;this&lt;/span&gt;.&lt;span style="color: #0000c0;"&gt;feet&lt;/span&gt; = feet;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;public&lt;/span&gt; &lt;span style="color: #7f0055;"&gt;int&lt;/span&gt; getStomachs() {&lt;/div&gt;&lt;div style="color: #0000c0; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span style="color: #7f0055;"&gt;return&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;stomachs&lt;span style="color: black;"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;public&lt;/span&gt; &lt;span style="color: #7f0055;"&gt;void&lt;/span&gt; setStomachs(&lt;span style="color: #7f0055;"&gt;int&lt;/span&gt; stomachs) {&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;this&lt;/span&gt;.&lt;span style="color: #0000c0;"&gt;stomachs&lt;/span&gt; = stomachs;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;public&lt;/span&gt; &lt;span style="color: #7f0055;"&gt;void&lt;/span&gt; throwSomeExceptions () {&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;int&lt;/span&gt; &lt;span style="text-decoration: underline;"&gt;test&lt;/span&gt; = 5/0;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;}&lt;/div&gt;&lt;br /&gt;&lt;div contenteditable="true" id="text_5" style="clear: both; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: none; outline-width: initial; overflow-x: auto; overflow-y: auto; padding-bottom: 0px; padding-left: 1px; padding-right: 1px; padding-top: 0px; width: 643px;"&gt;&lt;/div&gt;&lt;div contenteditable="true" id="text_6" style="clear: both; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: none; outline-width: initial; overflow-x: auto; overflow-y: auto; padding-bottom: 0px; padding-left: 1px; padding-right: 1px; padding-top: 0px; width: 643px;"&gt;&lt;strong&gt;Step 2 Create a Test Case&lt;/strong&gt;&lt;/div&gt;&lt;ol contenteditable="true" id="text_7" style="-webkit-background-clip: initial; -webkit-background-origin: initial; -webkit-border-bottom-left-radius: 5px 5px; -webkit-border-bottom-right-radius: 5px 5px; -webkit-border-top-left-radius: 5px 5px; -webkit-border-top-right-radius: 5px 5px; background-attachment: initial; background-color: rgba(0, 0, 0, 0.0976562); background-image: initial; background-position: initial initial; background-repeat: initial; clear: both; margin-bottom: 19px; margin-left: 20px; margin-right: 10px; padding-bottom: 10px; padding-left: 10px; padding-right: 10px; padding-top: 10px;"&gt;&lt;li style="margin-left: 20px;"&gt;Create create the same package you created above in your src/test/java folder.&lt;/li&gt;&lt;li style="margin-left: 20px;"&gt;Create a JUnit Case, by right clicking on your newly created package and then clicking Other... and finding the JUnit Case.&lt;/li&gt;&lt;/ol&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_7p4NxoKlbj4/S3YCv05sCVI/AAAAAAAAAI4/wimRLp7wqHQ/s1600-h/newJunitTestCase.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="400" src="http://4.bp.blogspot.com/_7p4NxoKlbj4/S3YCv05sCVI/AAAAAAAAAI4/wimRLp7wqHQ/s400/newJunitTestCase.jpg" width="365" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div contenteditable="true" id="text_8" style="clear: both; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: none; outline-width: initial; overflow-x: auto; overflow-y: auto; padding-bottom: 0px; padding-left: 1px; padding-right: 1px; padding-top: 0px; width: 643px;"&gt;You will be given a dialog box that looks like this:&lt;/div&gt;&lt;br /&gt;&lt;div contenteditable="true" id="text_10" style="clear: both; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: none; outline-width: initial; overflow-x: auto; overflow-y: auto; padding-bottom: 0px; padding-left: 1px; padding-right: 1px; padding-top: 0px; width: 643px;"&gt;&lt;strong&gt;&lt;em&gt;Be sure "New JUnit 4 test" is selected.&lt;/em&gt;&lt;/strong&gt;&lt;/div&gt;&lt;ul contenteditable="true" id="text_11" style="-webkit-background-clip: initial; -webkit-background-origin: initial; -webkit-border-bottom-left-radius: 5px 5px; -webkit-border-bottom-right-radius: 5px 5px; -webkit-border-top-left-radius: 5px 5px; -webkit-border-top-right-radius: 5px 5px; background-attachment: initial; background-color: rgba(0, 0, 0, 0.0976562); background-image: initial; background-position: initial initial; background-repeat: initial; clear: both; margin-bottom: 19px; margin-left: 20px; margin-right: 10px; padding-bottom: 10px; padding-left: 10px; padding-right: 10px; padding-top: 10px;"&gt;&lt;li style="margin-left: 20px;"&gt;Give your test case a name. I called mine CowTest&lt;/li&gt;&lt;li style="margin-left: 20px;"&gt;Select setUp()&lt;/li&gt;&lt;li style="margin-left: 20px;"&gt;For the "Class under test:" text box, select "Browse..." and Select the Cow class you created earlier.&lt;/li&gt;&lt;/ul&gt;&lt;div contenteditable="true" id="text_12" style="clear: both; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: none; outline-width: initial; overflow-x: auto; overflow-y: auto; padding-bottom: 0px; padding-left: 1px; padding-right: 1px; padding-top: 0px; width: 643px;"&gt;&lt;em&gt;You may be given a warning at the bottom that says, "JUnit 4 requires a Java 5 project." If so click the Configure link and change the compliance level to 1.5 or higher.&lt;/em&gt;&lt;/div&gt;&lt;div contenteditable="true" id="text_13" style="clear: both; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: none; outline-width: initial; overflow-x: auto; overflow-y: auto; padding-bottom: 0px; padding-left: 1px; padding-right: 1px; padding-top: 0px; width: 643px;"&gt;Click Next and select the Cow methods to test. In this case I choose to test the following methods:&lt;/div&gt;&lt;ul contenteditable="true" id="text_14" style="-webkit-background-clip: initial; -webkit-background-origin: initial; -webkit-border-bottom-left-radius: 5px 5px; -webkit-border-bottom-right-radius: 5px 5px; -webkit-border-top-left-radius: 5px 5px; -webkit-border-top-right-radius: 5px 5px; background-attachment: initial; background-color: rgba(0, 0, 0, 0.0976562); background-image: initial; background-position: initial initial; background-repeat: initial; clear: both; margin-bottom: 19px; margin-left: 20px; margin-right: 10px; padding-bottom: 10px; padding-left: 10px; padding-right: 10px; padding-top: 10px;"&gt;&lt;li style="margin-left: 20px;"&gt;getSays();&lt;/li&gt;&lt;li style="margin-left: 20px;"&gt;getFeet();&lt;/li&gt;&lt;li style="margin-left: 20px;"&gt;getStomachs();&lt;/li&gt;&lt;li style="margin-left: 20px;"&gt;throwSomeException();&lt;/li&gt;&lt;/ul&gt;&lt;div contenteditable="true" id="text_15" style="clear: both; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: none; outline-width: initial; overflow-x: auto; overflow-y: auto; padding-bottom: 0px; padding-left: 1px; padding-right: 1px; padding-top: 0px; width: 643px;"&gt;Click Finish.&lt;/div&gt;&lt;div contenteditable="true" id="text_16" style="clear: both; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: none; outline-width: initial; overflow-x: auto; overflow-y: auto; padding-bottom: 0px; padding-left: 1px; padding-right: 1px; padding-top: 0px; width: 643px;"&gt;&lt;br class="khtml-block-placeholder" /&gt;&lt;/div&gt;&lt;div contenteditable="true" id="text_17" style="clear: both; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: none; outline-width: initial; overflow-x: auto; overflow-y: auto; padding-bottom: 0px; padding-left: 1px; padding-right: 1px; padding-top: 0px; width: 643px;"&gt;Fill in the functions in your test case until it looks like this:&lt;/div&gt;&lt;div contenteditable="true" id="text_17" style="clear: both; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: none; outline-width: initial; overflow-x: auto; overflow-y: auto; padding-bottom: 0px; padding-left: 1px; padding-right: 1px; padding-top: 0px; width: 643px;"&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: #7f0055;"&gt;public&lt;/span&gt; &lt;span style="color: #7f0055;"&gt;class&lt;/span&gt; CowTest {&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;private&lt;/span&gt; Cow &lt;span style="color: #0000c0;"&gt;cow&lt;/span&gt;;&lt;/div&gt;&lt;div style="color: #646464; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/span&gt;@Before&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;public&lt;/span&gt; &lt;span style="color: #7f0055;"&gt;void&lt;/span&gt; setUp() &lt;span style="color: #7f0055;"&gt;throws&lt;/span&gt; Exception {&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;span style="color: #0000c0;"&gt;cow&lt;/span&gt; = &lt;span style="color: #7f0055;"&gt;new&lt;/span&gt; Cow (&lt;span style="color: #2a00ff;"&gt;"moow"&lt;/span&gt;, 4, 3);&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="color: #646464; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/span&gt;@Test&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;public&lt;/span&gt; &lt;span style="color: #7f0055;"&gt;void&lt;/span&gt; testGetSays() {&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;assertEquals (&lt;span style="color: #0000c0;"&gt;cow&lt;/span&gt;.getSays(), &lt;span style="color: #2a00ff;"&gt;"moow"&lt;/span&gt;);&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="color: #646464; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/span&gt;@Test&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;public&lt;/span&gt; &lt;span style="color: #7f0055;"&gt;void&lt;/span&gt; testGetFeet() {&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;assertEquals (&lt;span style="color: #0000c0;"&gt;cow&lt;/span&gt;.getFeet(), 4);&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="color: #646464; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/span&gt;@Test&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;public&lt;/span&gt; &lt;span style="color: #7f0055;"&gt;void&lt;/span&gt; testGetStomachs() {&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;assertEquals (&lt;span style="color: #0000c0;"&gt;cow&lt;/span&gt;.getStomachs(), 4);&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;span style="color: #646464;"&gt;@Test&lt;/span&gt; (expected = Exception.&lt;span style="color: #7f0055;"&gt;class&lt;/span&gt;)&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;public&lt;/span&gt; &lt;span style="color: #7f0055;"&gt;void&lt;/span&gt; testThrowSomeExceptions() {&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;span style="color: #0000c0;"&gt;cow&lt;/span&gt;.throwSomeExceptions();&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;}&lt;/div&gt;&lt;br /&gt;&lt;div contenteditable="true" id="object_18" style="clear: both; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: none; outline-width: initial; overflow-x: auto; overflow-y: auto; padding-bottom: 0px; padding-left: 1px; padding-right: 1px; padding-top: 0px; width: 643px;"&gt;&lt;img align="left" object_source="&amp;lt;script class=&amp;quot;brush: java&amp;quot; type=&amp;quot;syntaxhighlighter&amp;quot;&amp;gt;&amp;lt;![CDATA[&amp;lt;p style=&amp;quot;clear: both&amp;quot;&amp;gt;public class CowTest {&amp;lt;/p&amp;gt;&amp;lt;p style=&amp;quot;clear: both&amp;quot;&amp;gt; private Cow cow;&amp;lt;br /&amp;gt; @Before&amp;lt;br /&amp;gt; public void setUp() throws Exception {&amp;lt;br /&amp;gt; cow = new Cow (&amp;quot;moow&amp;quot;, 4, 3);&amp;lt;br /&amp;gt; }&amp;lt;/p&amp;gt;&amp;lt;p style=&amp;quot;clear: both&amp;quot;&amp;gt; @Test&amp;lt;br /&amp;gt; public void testGetSays() {&amp;lt;br /&amp;gt; assertEquals (cow.getSays(), &amp;quot;moow&amp;quot;);&amp;lt;br /&amp;gt; }&amp;lt;/p&amp;gt;&amp;lt;p style=&amp;quot;clear: both&amp;quot;&amp;gt; @Test&amp;lt;br /&amp;gt; public void testGetFeet() {&amp;lt;br /&amp;gt; assertEquals (cow.getFeet(), 4);&amp;lt;br /&amp;gt; }&amp;lt;/p&amp;gt;&amp;lt;p style=&amp;quot;clear: both&amp;quot;&amp;gt; @Test&amp;lt;br /&amp;gt; public void testGetStomachs() {&amp;lt;br /&amp;gt; assertEquals (cow.getStomachs(), 4);&amp;lt;br /&amp;gt; }&amp;lt;/p&amp;gt;&amp;lt;p style=&amp;quot;clear: both&amp;quot;&amp;gt; @Test (expected = Exception.class)&amp;lt;br /&amp;gt; public void testThrowSomeExceptions() {&amp;lt;br /&amp;gt; cow.throwSomeExceptions();&amp;lt;br /&amp;gt; }&amp;lt;/p&amp;gt;&amp;lt;p style=&amp;quot;clear: both&amp;quot;&amp;gt;}&amp;lt;/p&amp;gt;]]&amp;gt;&amp;lt;/script&amp;gt;" src="file:///Applications/Blogo.app/Contents/Resources/placeholder-object-black.png" style="-webkit-background-clip: initial; -webkit-background-origin: initial; -webkit-user-drag: element; -webkit-user-select: none; background-attachment: initial; background-color: #7b7b7b; background-image: initial; background-position: initial initial; background-repeat: initial; padding-bottom: 0px; padding-left: 20px; padding-right: 20px; padding-top: 0px;" /&gt;&lt;/div&gt;&lt;div contenteditable="true" id="text_19" style="clear: both; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: none; outline-width: initial; overflow-x: auto; overflow-y: auto; padding-bottom: 0px; padding-left: 1px; padding-right: 1px; padding-top: 0px; width: 643px;"&gt;&lt;/div&gt;&lt;div contenteditable="true" id="text_20" style="clear: both; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: none; outline-width: initial; overflow-x: auto; overflow-y: auto; padding-bottom: 0px; padding-left: 1px; padding-right: 1px; padding-top: 0px; width: 643px;"&gt;&lt;strong&gt;Step 3 Run the JUnit Test&lt;/strong&gt;&lt;/div&gt;&lt;div contenteditable="true" id="text_21" style="clear: both; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: none; outline-width: initial; overflow-x: auto; overflow-y: auto; padding-bottom: 0px; padding-left: 1px; padding-right: 1px; padding-top: 0px; width: 643px;"&gt;To run the JUnit test right click on your test case and select Run as JUnit test&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_7p4NxoKlbj4/S3YCkf_wRRI/AAAAAAAAAIw/eJ2OUjOaYzs/s1600-h/RunJUnit.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="640" src="http://2.bp.blogspot.com/_7p4NxoKlbj4/S3YCkf_wRRI/AAAAAAAAAIw/eJ2OUjOaYzs/s640/RunJUnit.jpg" width="556" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div contenteditable="true" id="text_21" style="clear: both; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: none; outline-width: initial; overflow-x: auto; overflow-y: auto; padding-bottom: 0px; padding-left: 1px; padding-right: 1px; padding-top: 0px; width: 643px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div contenteditable="true" id="text_23" style="clear: both; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: none; outline-width: initial; overflow-x: auto; overflow-y: auto; padding-bottom: 0px; padding-left: 1px; padding-right: 1px; padding-top: 0px; width: 643px;"&gt;The test should now run and you should see get this GUI displayed inside of Eclipse telling you which test ran, passed, and failed (In this case 4 Test where run, 3 Passed, 1 Failed):&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_7p4NxoKlbj4/S3YCZHTQJHI/AAAAAAAAAIo/CM6qtM-PgRw/s1600-h/JUnitGUIFail.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="282" src="http://1.bp.blogspot.com/_7p4NxoKlbj4/S3YCZHTQJHI/AAAAAAAAAIo/CM6qtM-PgRw/s400/JUnitGUIFail.jpg" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div contenteditable="true" id="text_23" style="clear: both; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: none; outline-width: initial; overflow-x: auto; overflow-y: auto; padding-bottom: 0px; padding-left: 1px; padding-right: 1px; padding-top: 0px; width: 643px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div contenteditable="true" id="text_25" style="clear: both; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: none; outline-width: initial; overflow-x: auto; overflow-y: auto; padding-bottom: 0px; padding-left: 1px; padding-right: 1px; padding-top: 0px; width: 643px;"&gt;Go back to your JUnit Test case and change your setUp() code to:&lt;/div&gt;&lt;div contenteditable="true" id="text_25" style="clear: both; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: none; outline-width: initial; overflow-x: auto; overflow-y: auto; padding-bottom: 0px; padding-left: 1px; padding-right: 1px; padding-top: 0px; width: 643px;"&gt;&lt;/div&gt;&lt;div style="font: normal normal normal 11px/normal Monaco; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span style="color: #7f0055;"&gt;public&lt;/span&gt;&amp;nbsp;&lt;span style="color: #7f0055;"&gt;void&lt;/span&gt;&amp;nbsp;setUp()&amp;nbsp;&lt;span style="color: #7f0055;"&gt;throws&lt;/span&gt;&amp;nbsp;Exception {&lt;/div&gt;&lt;div style="font: normal normal normal 11px/normal Monaco; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;span style="color: #0000c0;"&gt;cow&lt;/span&gt;&amp;nbsp;=&amp;nbsp;&lt;span style="color: #7f0055;"&gt;new&lt;/span&gt;&amp;nbsp;Cow (&lt;span style="color: #2a00ff;"&gt;"moow"&lt;/span&gt;, 4, 4);&lt;/div&gt;&lt;div style="font: normal normal normal 11px/normal Monaco; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;}&lt;/div&gt;&lt;br /&gt;&lt;div contenteditable="true" id="object_26" style="clear: both; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: none; outline-width: initial; overflow-x: auto; overflow-y: auto; padding-bottom: 0px; padding-left: 1px; padding-right: 1px; padding-top: 0px; width: 643px;"&gt;&lt;img align="left" object_source="&amp;lt;script class=&amp;quot;brush: java&amp;quot; type=&amp;quot;syntaxhighlighter&amp;quot;&amp;gt;&amp;lt;![CDATA[&amp;lt;p style=&amp;quot;clear: both&amp;quot;&amp;gt;@Before&amp;lt;br /&amp;gt; public void setUp() throws Exception {&amp;lt;br /&amp;gt; cow = new Cow (&amp;quot;moow&amp;quot;, 4, 4);&amp;lt;br /&amp;gt; }&amp;lt;/p&amp;gt;]]&amp;gt;&amp;lt;/script&amp;gt;" src="file:///Applications/Blogo.app/Contents/Resources/placeholder-object-black.png" style="-webkit-background-clip: initial; -webkit-background-origin: initial; -webkit-user-drag: element; -webkit-user-select: none; background-attachment: initial; background-color: #7b7b7b; background-image: initial; background-position: initial initial; background-repeat: initial; padding-bottom: 0px; padding-left: 20px; padding-right: 20px; padding-top: 0px;" /&gt;&lt;/div&gt;&lt;div contenteditable="true" id="text_27" style="clear: both; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: none; outline-width: initial; overflow-x: auto; overflow-y: auto; padding-bottom: 0px; padding-left: 1px; padding-right: 1px; padding-top: 0px; width: 643px;"&gt;&lt;/div&gt;&lt;div contenteditable="true" id="text_28" style="clear: both; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: none; outline-width: initial; overflow-x: auto; overflow-y: auto; padding-bottom: 0px; padding-left: 1px; padding-right: 1px; padding-top: 0px; width: 643px;"&gt;Rerun the JUnit test, just as you did before and you should see this GUI displayed:&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_7p4NxoKlbj4/S3YCHkXQnFI/AAAAAAAAAIg/cPeLQKOvMQ8/s1600-h/JUnitSuccess.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="255" src="http://3.bp.blogspot.com/_7p4NxoKlbj4/S3YCHkXQnFI/AAAAAAAAAIg/cPeLQKOvMQ8/s400/JUnitSuccess.jpg" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div contenteditable="true" id="text_28" style="clear: both; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: none; outline-width: initial; overflow-x: auto; overflow-y: auto; padding-bottom: 0px; padding-left: 1px; padding-right: 1px; padding-top: 0px; width: 643px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div contenteditable="true" id="text_30" style="clear: both; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: none; outline-width: initial; overflow-x: auto; overflow-y: auto; padding-bottom: 0px; padding-left: 1px; padding-right: 1px; padding-top: 0px; width: 643px;"&gt;Congratulations you have just successfully used JUnit 4 in Eclipse 3.5! As you add more test cases to the package, you can run them all at once by right clicking on the Package and selecting Run As JUnit test. It will now run all of the test cases in the package.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1546366980808220992-2215028541996272507?l=techscienceinterest.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techscienceinterest.blogspot.com/feeds/2215028541996272507/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techscienceinterest.blogspot.com/2010/02/here-is-simple-example-on-how-to-use.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1546366980808220992/posts/default/2215028541996272507'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1546366980808220992/posts/default/2215028541996272507'/><link rel='alternate' type='text/html' href='http://techscienceinterest.blogspot.com/2010/02/here-is-simple-example-on-how-to-use.html' title='JUnit 4 in Eclispe 3.5'/><author><name>Brent Coffey</name><uri>http://www.blogger.com/profile/14987122747702890412</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_7p4NxoKlbj4/S3RxOjAJ_rI/AAAAAAAAAEw/kOlFmUROluI/S220/Photo+on+2010-02-11+at+15.39+%232.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_7p4NxoKlbj4/S3YCv05sCVI/AAAAAAAAAI4/wimRLp7wqHQ/s72-c/newJunitTestCase.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1546366980808220992.post-7857237619325307197</id><published>2010-02-12T16:54:00.001-05:00</published><updated>2010-02-12T17:00:16.475-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Algorithm'/><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='evolutionary computing'/><category scheme='http://www.blogger.com/atom/ns#' term='evolution'/><title type='text'>Evolutionary Computing with Java</title><content type='html'>&lt;p style="clear: both"&gt;One the most interesting areas in computer science is the area of Evolutionary Computing. I found this open source Java framework called the "&lt;a href="http://watchmaker.uncommons.org/index.php" target="_blank"&gt;Watchmaker Framework&lt;/a&gt;." This framework is a group of algorithms based on biological evolution. The authors show an example of their framework in action by &lt;a href="http://watchmaker.uncommons.org/examples/monalisa.php" target="_blank"&gt;evolving the Mona Lisa&lt;/a&gt; from a maximum of 50 polygons over a series of generations. But like evolution in the biological world, running the application may take a while! ;-) However, it's very impressive even after a couple of minutes of running to say the least!&lt;/p&gt;&lt;p style="clear: both"&gt;Here are my results after about 1.5 Minutes and a population size of 5&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style="clear: both"&gt;&lt;a href="http://lh4.ggpht.com/_7p4NxoKlbj4/S3XPb0K32aI/AAAAAAAAAH4/nbc5YqMBYrY/s800/monalisa1.png" class="image-link"&gt;&lt;img class="linked-to-original" src="http://lh6.ggpht.com/_7p4NxoKlbj4/S3XPbTF3fRI/AAAAAAAAAH0/d8NzM40vXwk/s800/monalisa1-thumb.png" height="183" align="left" width="377" style=" display: inline; float: left; margin: 0 10px 10px 0;" /&gt;&lt;/a&gt;&lt;br style="clear: both" /&gt;&lt;div&gt;&lt;div&gt;Check out &lt;a href="http://watchmaker.uncommons.org/index.php" target="_blank"&gt;the watchmaker framework here&lt;/a&gt;.&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/p&gt;&lt;p style="clear: both"&gt;&lt;a href="http://lh4.ggpht.com/_7p4NxoKlbj4/S3XOFSothoI/AAAAAAAAAHw/pQHu-TKUg6g/s800/logo1.png" class="image-link"&gt;&lt;img class="linked-to-original" src="http://lh4.ggpht.com/_7p4NxoKlbj4/S3XOEwf39UI/AAAAAAAAAHs/YLQUhTnL9Mc/s800/logo1-thumb.png" height="115" align="left" width="298" style=" display: inline; float: left; margin: 0 10px 10px 0;" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;br class='final-break' style='clear: both' /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1546366980808220992-7857237619325307197?l=techscienceinterest.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techscienceinterest.blogspot.com/feeds/7857237619325307197/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techscienceinterest.blogspot.com/2010/02/evolutionary-computing-with-java.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1546366980808220992/posts/default/7857237619325307197'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1546366980808220992/posts/default/7857237619325307197'/><link rel='alternate' type='text/html' href='http://techscienceinterest.blogspot.com/2010/02/evolutionary-computing-with-java.html' title='Evolutionary Computing with Java'/><author><name>Brent Coffey</name><uri>http://www.blogger.com/profile/14987122747702890412</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_7p4NxoKlbj4/S3RxOjAJ_rI/AAAAAAAAAEw/kOlFmUROluI/S220/Photo+on+2010-02-11+at+15.39+%232.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh6.ggpht.com/_7p4NxoKlbj4/S3XPbTF3fRI/AAAAAAAAAH0/d8NzM40vXwk/s72-c/monalisa1-thumb.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1546366980808220992.post-267762528170913437</id><published>2010-02-12T13:13:00.004-05:00</published><updated>2010-02-19T10:13:54.365-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='eclipse'/><category scheme='http://www.blogger.com/atom/ns#' term='web'/><category scheme='http://www.blogger.com/atom/ns#' term='css'/><category scheme='http://www.blogger.com/atom/ns#' term='Blog'/><title type='text'>Syntax Highlighting in Web Pages</title><content type='html'>Since my blogs are mostly about technology and software engineering, I wanted to have some method of putting code in my blogs and it to have good syntax highlighting.&lt;br /&gt;&lt;br /&gt;Without syntax highlighting my blogs look like this:&lt;br /&gt;&lt;br /&gt;public void bland () {&lt;br /&gt;System.out.println("This stinks!");&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;with Syntax highlighting turned on though they look like this:&lt;br /&gt;&lt;br /&gt;&lt;script class="brush: java" type="syntaxhighlighter"&gt;&lt;![CDATA[public void nice () {     System.out.println("This looks good!");}]]&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;I found a number of solutions on the web, but &lt;a href="http://blog.cartercole.com/2009/10/awesome-syntax-highlighting-made-easy.html"&gt;this blog&lt;/a&gt; had the simplest and best method I found.&lt;br /&gt;&lt;br /&gt;Follow the direction on the linked blog and your done. Source code is actually written by &lt;a href="http://alexgorbatchev.com/wiki/SyntaxHighlighter"&gt;SyntaxHighlighter&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Simpler though is to simply to cut and paste cut directly from Eclipse to the Blogger New Post Compose page. &amp;nbsp;No css or HTML to worry about at all! &amp;nbsp;Here is what text pasted from Eclipse looks like:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: #7f0055;"&gt;package&lt;/span&gt; org.example.testing;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="color: #7f0055; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;public&lt;span style="color: black;"&gt; &lt;/span&gt;class&lt;span style="color: black;"&gt; Cow {&lt;/span&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;private&lt;/span&gt; String &lt;span style="color: #0000c0;"&gt;says&lt;/span&gt;;&lt;/div&gt;&lt;div style="color: #7f0055; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/span&gt;private&lt;span style="color: black;"&gt; &lt;/span&gt;int&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: #0000c0;"&gt;feet&lt;/span&gt;&lt;span style="color: black;"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;div style="color: #7f0055; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/span&gt;private&lt;span style="color: black;"&gt; &lt;/span&gt;int&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: #0000c0;"&gt;stomachs&lt;/span&gt;&lt;span style="color: black;"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;public&lt;/span&gt; Cow () {&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;this&lt;/span&gt; (&lt;span style="color: #2a00ff;"&gt;"moow"&lt;/span&gt;, 4, 4);&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;public&lt;/span&gt; Cow (String says, &lt;span style="color: #7f0055;"&gt;int&lt;/span&gt; feet, &lt;span style="color: #7f0055;"&gt;int&lt;/span&gt; stomachs) {&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;this&lt;/span&gt;.&lt;span style="color: #0000c0;"&gt;says&lt;/span&gt; = says;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;this&lt;/span&gt;.&lt;span style="color: #0000c0;"&gt;feet&lt;/span&gt; = feet;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;this&lt;/span&gt;.&lt;span style="color: #0000c0;"&gt;stomachs&lt;/span&gt; = stomachs;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;public&lt;/span&gt; String getSays() {&lt;/div&gt;&lt;div style="color: #7f0055; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;/span&gt;return&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: #0000c0;"&gt;says&lt;/span&gt;&lt;span style="color: black;"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;public&lt;/span&gt; &lt;span style="color: #7f0055;"&gt;void&lt;/span&gt; setSays(String says) {&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;this&lt;/span&gt;.&lt;span style="color: #0000c0;"&gt;says&lt;/span&gt; = says;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;public&lt;/span&gt; &lt;span style="color: #7f0055;"&gt;int&lt;/span&gt; getFeet() {&lt;/div&gt;&lt;div style="color: #7f0055; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;/span&gt;return&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: #0000c0;"&gt;feet&lt;/span&gt;&lt;span style="color: black;"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;public&lt;/span&gt; &lt;span style="color: #7f0055;"&gt;void&lt;/span&gt; setFeet(&lt;span style="color: #7f0055;"&gt;int&lt;/span&gt; feet) {&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;this&lt;/span&gt;.&lt;span style="color: #0000c0;"&gt;feet&lt;/span&gt; = feet;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;public&lt;/span&gt; &lt;span style="color: #7f0055;"&gt;int&lt;/span&gt; getStomachs() {&lt;/div&gt;&lt;div style="color: #0000c0; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span style="color: #7f0055;"&gt;return&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;stomachs&lt;span style="color: black;"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;public&lt;/span&gt; &lt;span style="color: #7f0055;"&gt;void&lt;/span&gt; setStomachs(&lt;span style="color: #7f0055;"&gt;int&lt;/span&gt; stomachs) {&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;this&lt;/span&gt;.&lt;span style="color: #0000c0;"&gt;stomachs&lt;/span&gt; = stomachs;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;public&lt;/span&gt; &lt;span style="color: #7f0055;"&gt;void&lt;/span&gt; throwSomeExceptions () {&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;span style="color: #7f0055;"&gt;int test&lt;/span&gt;&amp;nbsp;= 5/0;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/div&gt;&lt;div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;}&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1546366980808220992-267762528170913437?l=techscienceinterest.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techscienceinterest.blogspot.com/feeds/267762528170913437/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techscienceinterest.blogspot.com/2010/02/syntax-highlighting-in-web-pages.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1546366980808220992/posts/default/267762528170913437'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1546366980808220992/posts/default/267762528170913437'/><link rel='alternate' type='text/html' href='http://techscienceinterest.blogspot.com/2010/02/syntax-highlighting-in-web-pages.html' title='Syntax Highlighting in Web Pages'/><author><name>Brent Coffey</name><uri>http://www.blogger.com/profile/14987122747702890412</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_7p4NxoKlbj4/S3RxOjAJ_rI/AAAAAAAAAEw/kOlFmUROluI/S220/Photo+on+2010-02-11+at+15.39+%232.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1546366980808220992.post-1493088658393665824</id><published>2010-02-11T22:06:00.003-05:00</published><updated>2010-02-12T20:56:41.305-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='software'/><category scheme='http://www.blogger.com/atom/ns#' term='Blog'/><title type='text'>Mac Blog Software</title><content type='html'>&lt;div style="clear: both;"&gt;I have been looking for good Blogging Software for the Mac. After much searching I have settled on &lt;a href="http://www.drinkbrainjuice.com/blogo" target="_blank" title="Blogo"&gt;Blogo&lt;/a&gt;.&lt;u&gt;&lt;br /&gt;&lt;/u&gt;&lt;/div&gt;&lt;div style="clear: both;"&gt;I first tried &lt;a href="http://www.red-sweater.com/marsedit/" target="_blank" title="MarsEdit"&gt;MarsEdit&lt;/a&gt;.&lt;/div&gt;&lt;div style="clear: both;"&gt;&lt;a class="image-link" href="http://lh4.ggpht.com/_7p4NxoKlbj4/S3TFmoB5HcI/AAAAAAAAAGk/UYAPt2zz4lE/s800/MainWindow1.png"&gt;&lt;img class="linked-to-original" height="263" src="http://lh4.ggpht.com/_7p4NxoKlbj4/S3TFmG9v0OI/AAAAAAAAAGg/f8crwFs-s7o/s800/MainWindow1-thumb.png" style="display: block; margin: 0 auto 10px; text-align: center;" width="380" /&gt;&lt;/a&gt;Pro's: I liked the simplicity, liked how to add Categories to the blog post.&lt;/div&gt;&lt;div style="clear: both;"&gt;Con's: To simple. Pictures are put in as img links. Not as images. It also didn't automatically resize my images to fit with in the contours of my Blogger Blog. It was also not intuitive as to how to make a thumbnail image a link to the full image.&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="clear: both;"&gt;Second I tried &lt;a href="http://illuminex.com/ecto/" target="_blank"&gt;Ecto&lt;/a&gt;&lt;u&gt;&lt;br /&gt;&lt;/u&gt;&lt;/div&gt;&lt;div style="clear: both;"&gt;&lt;a class="image-link" href="http://lh3.ggpht.com/_7p4NxoKlbj4/S3TFnQQpSCI/AAAAAAAAAGs/beDDguRhJQk/s800/ecto3-editor1.png"&gt;&lt;img class="linked-to-original" height="392" src="http://lh3.ggpht.com/_7p4NxoKlbj4/S3TFnPRmqXI/AAAAAAAAAGo/n5abaNuFSNw/s800/ecto3-editor1-thumb.png" style="display: block; margin: 0 auto 10px; text-align: center;" width="380" /&gt;&lt;/a&gt;Pro's: Images show up as images. More of a WYSWYG editor than MarsEdit.&lt;/div&gt;&lt;div style="clear: both;"&gt;Con's: Couldn't figure out how to upload photos to picasoweb. &lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="clear: both;"&gt;Third I tried &lt;a href="http://marinersoftware.com/sitepage.php?page=85" target="_blank"&gt;MacJournal&lt;/a&gt;&lt;u&gt;&lt;br /&gt;&lt;/u&gt;&lt;/div&gt;&lt;div style="clear: both;"&gt;&lt;a class="image-link" href="http://lh3.ggpht.com/_7p4NxoKlbj4/S3TFoRW5U8I/AAAAAAAAAG0/tc4euj_kySk/s800/Main-Window-Inspector1.jpg"&gt;&lt;img class="linked-to-original" height="257" src="http://lh6.ggpht.com/_7p4NxoKlbj4/S3TFnycylEI/AAAAAAAAAGw/jxUEXQmfbGQ/s800/Main-Window-Inspector1-thumb.jpg" style="display: block; margin: 0 auto 10px; text-align: center;" width="380" /&gt;&lt;/a&gt;Pro's: Color and lots of features&lt;br /&gt;Con's: Cryptic, just couldn't do simple thing easily.&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="clear: both;"&gt;Finally I tried &lt;a href="http://www.drinkbrainjuice.com/blogo" target="_blank"&gt;Blogo&lt;/a&gt;&lt;u&gt;&lt;br /&gt;&lt;br /&gt;&lt;/u&gt;&lt;/div&gt;&lt;div style="clear: both;"&gt;&lt;a class="image-link" href="http://lh4.ggpht.com/_7p4NxoKlbj4/S3TFpPKP6KI/AAAAAAAAAG8/TTxS7ZsuNoU/s800/screenshot_1.jpg"&gt;&lt;img class="linked-to-original" height="238" src="http://lh6.ggpht.com/_7p4NxoKlbj4/S3TFo89iXRI/AAAAAAAAAG4/S74T3sH2YPM/s800/screenshot_1-thumb.jpg" style="display: block; margin: 0 auto 10px; text-align: center;" width="380" /&gt;&lt;/a&gt;Pro': Simple, Easy to use, automatically sized images to fit my blog, easy to link images to full size image. Overall I found this product to be the simplest and to provide the best integration with Blogger and a general pleasure to use so long as you are doing really simple stuff. The image functionality and the good rich text support is why I choose this software.&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="clear: both;"&gt;Con's: Picture is just a place holder in editor, adding Categories to blogs are awkward. &amp;nbsp;Anything like code pasting or advance stuff is very difficult.&lt;br /&gt;&lt;br /&gt;In conclusion while I'm using Blogo, I wouldn't say any of the products are will knock your socks off. &amp;nbsp;There certainly is a market here for some one to write the Ultimate Blogging software.&lt;/div&gt;&lt;div style="clear: both;"&gt;&lt;/div&gt;&lt;div style="clear: both;"&gt;&lt;/div&gt;&lt;br class="final-break" style="clear: both;" /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1546366980808220992-1493088658393665824?l=techscienceinterest.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techscienceinterest.blogspot.com/feeds/1493088658393665824/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techscienceinterest.blogspot.com/2010/02/mac-blog-software.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1546366980808220992/posts/default/1493088658393665824'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1546366980808220992/posts/default/1493088658393665824'/><link rel='alternate' type='text/html' href='http://techscienceinterest.blogspot.com/2010/02/mac-blog-software.html' title='Mac Blog Software'/><author><name>Brent Coffey</name><uri>http://www.blogger.com/profile/14987122747702890412</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_7p4NxoKlbj4/S3RxOjAJ_rI/AAAAAAAAAEw/kOlFmUROluI/S220/Photo+on+2010-02-11+at+15.39+%232.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh4.ggpht.com/_7p4NxoKlbj4/S3TFmG9v0OI/AAAAAAAAAGg/f8crwFs-s7o/s72-c/MainWindow1-thumb.png' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1546366980808220992.post-8945600707893202910</id><published>2010-02-11T14:45:00.002-05:00</published><updated>2010-02-12T08:35:17.938-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='AspectJ'/><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='eclipse'/><category scheme='http://www.blogger.com/atom/ns#' term='spring'/><category scheme='http://www.blogger.com/atom/ns#' term='maven'/><title type='text'>How To Setup an Eclipse Project to use Maven, AspectJ, Log4J, Spring, and JUnit</title><content type='html'>&lt;div style="clear: both;"&gt;I see lots of blogs on how to do any one of these things, but I want to do them all in the same project. So how do I do this? First it's easy, but a little tricky so follow closely. This blog assumes you have setup your eclipse environment with all of these plugins already. If not check out &lt;a href="http://techscienceinterest.blogspot.com/2010/02/ideal-eclipse-35.html"&gt;my blog telling you how to configure the "Ideal Eclipse 3.5"&lt;/a&gt; (at least it's ideal to me) ;-)&lt;/div&gt;&lt;div style="clear: both;"&gt;&lt;/div&gt;&lt;h4&gt;&lt;em&gt;(To see the full images just right click and say open Image in New Window)&lt;br /&gt;&lt;/em&gt;&lt;/h4&gt;&lt;div style="clear: both;"&gt;1. Click File-&amp;gt;New-&amp;gt;Other...&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="clear: both;"&gt;&lt;a class="image-link" href="http://lh4.ggpht.com/_7p4NxoKlbj4/S3RzHETzRvI/AAAAAAAAAFU/s9U33ljY-QU/s800/New_Maven_Project.png"&gt;&lt;img class="linked-to-original" height="360" src="http://lh6.ggpht.com/_7p4NxoKlbj4/S3RzGxxKpuI/AAAAAAAAAFQ/UZ8NZx4BBfo/s800/New_Maven_Project-thumb.png" style="display: block; margin: 0 auto 10px; text-align: center;" width="380" /&gt;&lt;/a&gt;2. Click Maven Project&lt;/div&gt;&lt;div style="clear: both;"&gt;3. Walk through setup wizard as shown in these screen shots. (There are plenty of blogs that can explain what each option means, but for now just follow along)&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="clear: both;"&gt;&lt;a class="image-link" href="http://lh6.ggpht.com/_7p4NxoKlbj4/S3RzHgbfubI/AAAAAAAAAFc/B4Gs5mxC1ks/s800/maven_settings.png"&gt;&lt;img class="linked-to-original" height="378" src="http://lh3.ggpht.com/_7p4NxoKlbj4/S3RzHYAFCII/AAAAAAAAAFY/0BhoyFiTf1w/s800/maven_settings-thumb.png" style="display: block; margin: 0 auto 10px; text-align: center;" width="380" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="clear: both;"&gt;&lt;a class="image-link" href="http://lh3.ggpht.com/_7p4NxoKlbj4/S3RzIZLJHkI/AAAAAAAAAFk/dv7G-Do6V7k/s800/configureGroupID.png"&gt;&lt;img class="linked-to-original" height="378" src="http://lh4.ggpht.com/_7p4NxoKlbj4/S3RzIBID-rI/AAAAAAAAAFg/2mezTR088DE/s800/configureGroupID-thumb.png" style="display: block; margin: 0 auto 10px; text-align: center;" width="380" /&gt;&lt;/a&gt;4. Click Finish and then Double click on the file called pom.xml Your screen should look like this.&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="clear: both;"&gt;&lt;a class="image-link" href="http://lh6.ggpht.com/_7p4NxoKlbj4/S3RzJY7I46I/AAAAAAAAAFs/5N-83ACO6M0/s800/NewProject.png"&gt;&lt;img class="linked-to-original" height="270" src="http://lh6.ggpht.com/_7p4NxoKlbj4/S3RzIwvC2nI/AAAAAAAAAFo/bq7qPoD02Tw/s800/NewProject-thumb.png" style="display: block; margin: 0 auto 10px; text-align: center;" width="379" /&gt;&lt;/a&gt;&lt;br /&gt;5. Click on the Dependencies tab in the lower left hand side of the middle window&lt;/div&gt;&lt;div style="clear: both;"&gt;6. Click Add...&lt;/div&gt;&lt;div style="clear: both;"&gt;7. Then click the little folder with the Jar in it over on the upper right side.&lt;/div&gt;&lt;div style="clear: both;"&gt;&lt;a class="image-link" href="http://lh4.ggpht.com/_7p4NxoKlbj4/S3RzJjg5oXI/AAAAAAAAAF0/t4abJX0aTKM/s800/AddingDep.jpg"&gt;&lt;img class="linked-to-original" height="104" src="http://lh4.ggpht.com/_7p4NxoKlbj4/S3RzJjOVSFI/AAAAAAAAAFw/d5KkfX3eqVg/s800/AddingDep-thumb.jpg" style="display: block; margin: 0 auto 10px; text-align: center;" width="380" /&gt;&lt;/a&gt;8. Type in Junit and select it from the list&lt;/div&gt;&lt;div style="clear: both;"&gt;9. Continue clicking Add and then the folder with a Jar icon until you have added Junit, Log4J, spring-context, and aspectjrt. Your Dependency list should look like this.&lt;/div&gt;&lt;div style="clear: both;"&gt;&lt;a class="image-link" href="http://lh3.ggpht.com/_7p4NxoKlbj4/S3RzKhNsDTI/AAAAAAAAAF8/dI04Re-8nSc/s800/AddingDep.png"&gt;&lt;img class="linked-to-original" height="262" src="http://lh6.ggpht.com/_7p4NxoKlbj4/S3RzKA2ZjRI/AAAAAAAAAF4/NHx8Jm9wR4E/s800/AddingDep-thumb.png" style="display: block; margin: 0 auto 10px; text-align: center;" width="379" /&gt;&lt;/a&gt;10. Click on the tab labeled Reporting&lt;/div&gt;&lt;div style="clear: both;"&gt;11. Like you did for dependencies, click add, and then the icon of the folder with a jar until you have all the following plugins added: surefire-report-maven-plugin, maven-javadoc-plugin, jdepend-maven-plugin, dashboard-maven-plugin. When completed it should look like this:&lt;/div&gt;&lt;div style="clear: both;"&gt;&lt;a class="image-link" href="http://lh3.ggpht.com/_7p4NxoKlbj4/S3RzLZuB3JI/AAAAAAAAAGE/RuO3gXHw5eA/s800/SettingUpReports.png"&gt;&lt;img class="linked-to-original" height="257" src="http://lh5.ggpht.com/_7p4NxoKlbj4/S3RzK-opaYI/AAAAAAAAAGA/043mBVYCHbM/s800/SettingUpReports-thumb.png" style="display: block; margin: 0 auto 10px; text-align: center;" width="380" /&gt;&lt;/a&gt;12. For fun click the tab labeled Dependency Graph. It should now look like this:&lt;/div&gt;&lt;div style="clear: both;"&gt;&lt;a class="image-link" href="http://lh5.ggpht.com/_7p4NxoKlbj4/S3RzMf5PATI/AAAAAAAAAGM/4ZTQeFSa9t8/s800/DepGraph.png"&gt;&lt;img class="linked-to-original" height="257" src="http://lh4.ggpht.com/_7p4NxoKlbj4/S3RzLsAR3kI/AAAAAAAAAGI/jFiSkDEeg8s/s800/DepGraph-thumb.png" style="display: block; margin: 0 auto 10px; text-align: center;" width="379" /&gt;&lt;/a&gt;13. Now Right click on your project folder and click Configure-&amp;gt;Convert to AspectJ Project (Don't worry you won't lose your Maven Project Settings)&lt;/div&gt;&lt;div style="clear: both;"&gt;&lt;/div&gt;&lt;div style="clear: both;"&gt;&lt;a class="image-link" href="http://lh3.ggpht.com/_7p4NxoKlbj4/S3RzNB_ydNI/AAAAAAAAAGU/K3r3nVOgcM4/s800/AddAspectJ.jpg"&gt;&lt;img class="linked-to-original" height="460" src="http://lh5.ggpht.com/_7p4NxoKlbj4/S3RzMtMSfTI/AAAAAAAAAGQ/dVYbkJ-ppeA/s800/AddAspectJ-thumb.jpg" style="display: block; margin: 0 auto 10px; text-align: center;" width="361" /&gt;&lt;/a&gt;14. You will notice now a new folder has been added in your Package Explorer called AspectJ Runtime Library&lt;/div&gt;&lt;div style="clear: both;"&gt;&lt;a class="image-link" href="http://lh5.ggpht.com/_7p4NxoKlbj4/S3RzNVgPtBI/AAAAAAAAAGc/NaoYh4Y_GVs/s800/AspectJ_Runtime_Added.png"&gt;&lt;img class="linked-to-original" height="207" src="http://lh6.ggpht.com/_7p4NxoKlbj4/S3RzNaOIo_I/AAAAAAAAAGY/1Y8RI4x0m94/s800/AspectJ_Runtime_Added-thumb.png" style="display: block; margin: 0 auto 10px; text-align: center;" width="270" /&gt;&lt;/a&gt;And that's it. You now have configured a New Project which can use Maven, AspectJ, JUnit, Log4J, and Spring. Just be sure to keep your JUnit test in your src/test/java folder and you should be good to go. Hope this was helpful.&lt;/div&gt;&lt;br class="final-break" style="clear: both;" /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1546366980808220992-8945600707893202910?l=techscienceinterest.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techscienceinterest.blogspot.com/feeds/8945600707893202910/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techscienceinterest.blogspot.com/2010/02/i-see-lots-of-blogs-on-how-to-do-any.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1546366980808220992/posts/default/8945600707893202910'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1546366980808220992/posts/default/8945600707893202910'/><link rel='alternate' type='text/html' href='http://techscienceinterest.blogspot.com/2010/02/i-see-lots-of-blogs-on-how-to-do-any.html' title='How To Setup an Eclipse Project to use Maven, AspectJ, Log4J, Spring, and JUnit'/><author><name>Brent Coffey</name><uri>http://www.blogger.com/profile/14987122747702890412</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_7p4NxoKlbj4/S3RxOjAJ_rI/AAAAAAAAAEw/kOlFmUROluI/S220/Photo+on+2010-02-11+at+15.39+%232.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh6.ggpht.com/_7p4NxoKlbj4/S3RzGxxKpuI/AAAAAAAAAFQ/UZ8NZx4BBfo/s72-c/New_Maven_Project-thumb.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1546366980808220992.post-5794128094254581765</id><published>2010-02-11T12:05:00.001-05:00</published><updated>2010-02-12T15:23:29.774-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='hibernate'/><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='eclipse'/><title type='text'>Installing Hibernate Tools in Eclipse 3.5</title><content type='html'>&lt;p style="clear: both"&gt;How do I get Hibernate Tools to work in Eclipse 3.5?"&lt;br /&gt;&lt;em&gt;(Personally I use Eclipse 3.5 for Cocoa 32 Bit Addition)&lt;/em&gt;&lt;/p&gt;&lt;p style="clear: both"&gt;Well here are the steps (assuming you already have Eclipse 3.5 installed)&lt;br /&gt;&lt;ol style="clear: both"&gt;&lt;li&gt;In Eclipse, click on Help -&amp;gt; Install New Software...&lt;/li&gt;&lt;li&gt;Click Add...&lt;/li&gt;&lt;li&gt;Type in a name, I typed, "Hibernate" (without the quotes)&lt;/li&gt;&lt;li&gt;Type in this location: http://download.jboss.org/jbosstools/updates/stable/ (This is Hibernate Update site)&lt;/li&gt;&lt;li&gt;Expand the JBoss Tools Box&lt;/li&gt;&lt;li&gt;Click Hibernate Tools&lt;/li&gt;&lt;li&gt;Click Finish and follow the directions accepting the license agreements&lt;/li&gt;&lt;/ol&gt;&lt;/p&gt;&lt;p style="clear: both"&gt;&lt;/p&gt;&lt;br class='final-break' style='clear: both' /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1546366980808220992-5794128094254581765?l=techscienceinterest.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techscienceinterest.blogspot.com/feeds/5794128094254581765/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techscienceinterest.blogspot.com/2010/02/installing-hibernate-tools-in-eclipse.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1546366980808220992/posts/default/5794128094254581765'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1546366980808220992/posts/default/5794128094254581765'/><link rel='alternate' type='text/html' href='http://techscienceinterest.blogspot.com/2010/02/installing-hibernate-tools-in-eclipse.html' title='Installing Hibernate Tools in Eclipse 3.5'/><author><name>Brent Coffey</name><uri>http://www.blogger.com/profile/14987122747702890412</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_7p4NxoKlbj4/S3RxOjAJ_rI/AAAAAAAAAEw/kOlFmUROluI/S220/Photo+on+2010-02-11+at+15.39+%232.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1546366980808220992.post-7645790969679684326</id><published>2010-02-11T11:27:00.002-05:00</published><updated>2010-02-19T10:21:07.220-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='eclipse'/><category scheme='http://www.blogger.com/atom/ns#' term='software management'/><title type='text'>Ideal Eclipse 3.5</title><content type='html'>&lt;div style="clear: both;"&gt;I'm a Software Manager and I have a team of developers who mostly code in Java and Flex but occasionally in C++. Occasionally new people join the team and they need to setup their work environment so that they have all the same tools as everyone else. We had been keeping a document that told step by step how to setup their Eclipse IDE. But as things changed, new versions of plugins get released, Eclipse changed, or we discover a new useful plugin, the document has to be continually revised and someone has to take the time to update it. Then it occurred to me one day why not just create an Eclipse distribution that is already setup with all the plugins and configurations we use? Anyone else doing this? Well here is how I created our own personal Eclipse Distribution. Any ideas for making this better would be great!&lt;/div&gt;&lt;div style="clear: both;"&gt;I noticed that when you download Eclipse the download is really just one big folder zipped up. This gave me the idea that if I download the Eclipse we as a team want to use and simply start installing the plugins we want, when we are done we should be able to simply zip the Eclipse folder back up and put it out on our server. When we decide to use a new version, instead of updating documentation, we just setup one new Eclipse the way we want and put it on the server and let everyone download it. No reading, no tedious writing, no downloading and no configuring!&lt;br /&gt;&lt;br /&gt;So here is how I have setup our Eclipse Distribution:&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;ol style="clear: both;"&gt;&lt;li&gt;Download Eclipse IDE for Java EE Developers 3.5 Cocoa 32Bit Version from the Eclipse.org website and unzip/untar as normal&lt;/li&gt;&lt;li&gt;Click Help-&amp;gt;Check For Updates and get all the latest&lt;/li&gt;&lt;li&gt;Click Help-&amp;gt;Install New Software...&lt;/li&gt;&lt;li&gt;Select the Galileo Update Site from the Drop Down Menu labeled "Work With"&lt;/li&gt;&lt;li&gt;Select Collaboration (Why not? Might be useful one day) ;-) &lt;/li&gt;&lt;li&gt;Expand Programming Languages and select Eclipse C/C++ Development Tools&lt;/li&gt;&lt;li&gt;Click Next and Finish &lt;/li&gt;&lt;li&gt;Click Yes to restart Eclipse when prompted.&lt;/li&gt;&lt;li&gt;Click SVN Kit 1.3.0&lt;/li&gt;&lt;li&gt;Click Finish&lt;/li&gt;&lt;li&gt;Click Next when prompted ensuring both boxes &lt;/li&gt;&lt;li&gt;Click Next&lt;/li&gt;&lt;li&gt;Accept the license agreement&lt;/li&gt;&lt;li&gt;Click Finish&lt;/li&gt;&lt;li&gt;Click Ok when you get a Security Warning. &lt;/li&gt;&lt;li&gt;Click Yes to restart &lt;/li&gt;&lt;li&gt;Click Help-&amp;gt;Install New Software...&lt;/li&gt;&lt;li&gt;Click on the Eclipse Web Tools Platform from the Drop Down Menu labeled "Work With"&lt;/li&gt;&lt;li&gt;Expand the Web Tools Platform SDK&lt;/li&gt;&lt;li&gt;Select Eclipse XML Editors and Tools SDK &lt;/li&gt;&lt;li&gt;Select JavaScript Developer Tools SDK&lt;/li&gt;&lt;li&gt;Select XSL Tools SDK &lt;/li&gt;&lt;li&gt;Select Web Page Editor &lt;/li&gt;&lt;li&gt;Click Next and then Finish and Yes to restart when prompted just as before &lt;/li&gt;&lt;li&gt;Select the Mylyn Update Site from the Drop Down Menu labeled "Work With"&lt;/li&gt;&lt;li&gt;Select All boxes.&lt;/li&gt;&lt;li&gt;Click Next and then Finish and Yes to restart when prompted just as before &lt;em&gt;(It will tell you somethings have been modified...that's fine...just keep going)&lt;/em&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://techscienceinterest.blogspot.com/2010/02/how-to-install-aspectj-in-eclipse-35.html" target="_blank"&gt;Follow my Blog on installing AspectJ in Eclipse&lt;/a&gt; &lt;/li&gt;&lt;li&gt;&lt;a href="http://techscienceinterest.blogspot.com/2010/02/installing-m2eclipse-maven-in-eclipse.html" target="_blank"&gt;Follow my Blog on installing Maven in Eclipse&lt;/a&gt; &lt;em&gt;(In our case you can unselect the Subclipse package since we are using Subversive to talk to Subversion) (&lt;b&gt;NOTE&lt;/b&gt;: &lt;span class="Apple-style-span" style="color: red;"&gt;This step is not necessary if you are going to install the Spring Tool Suite in the next step. &amp;nbsp;Just skip this step&lt;/span&gt;)&lt;/em&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://techscienceinterest.blogspot.com/2010/02/installing-spring-in-eclipse-35.html" target="_blank"&gt;Follow my Blog on installing Spring IDE in Eclipse&lt;/a&gt; &lt;/li&gt;&lt;li&gt;&lt;a href="http://techscienceinterest.blogspot.com/search/label/hibernate" target="_blank"&gt;Follow my Blog on installing Hibernate tools in Eclipse&lt;/a&gt;&lt;/li&gt;&lt;li&gt;Now find your eclipse folder on your hard drive.&lt;/li&gt;&lt;li&gt;On the Mac you right click and then click Compress&lt;/li&gt;&lt;/ol&gt;&lt;div style="clear: both;"&gt;Now you have your own Custom Eclipse IDE to distribute to your team.&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;br class="final-break" style="clear: both;" /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1546366980808220992-7645790969679684326?l=techscienceinterest.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techscienceinterest.blogspot.com/feeds/7645790969679684326/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techscienceinterest.blogspot.com/2010/02/ideal-eclipse-35.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1546366980808220992/posts/default/7645790969679684326'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1546366980808220992/posts/default/7645790969679684326'/><link rel='alternate' type='text/html' href='http://techscienceinterest.blogspot.com/2010/02/ideal-eclipse-35.html' title='Ideal Eclipse 3.5'/><author><name>Brent Coffey</name><uri>http://www.blogger.com/profile/14987122747702890412</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_7p4NxoKlbj4/S3RxOjAJ_rI/AAAAAAAAAEw/kOlFmUROluI/S220/Photo+on+2010-02-11+at+15.39+%232.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1546366980808220992.post-6539344770020889902</id><published>2010-02-11T11:07:00.002-05:00</published><updated>2010-02-17T09:06:30.333-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='eclipse'/><category scheme='http://www.blogger.com/atom/ns#' term='spring'/><title type='text'>Installing Spring in Eclipse 3.5</title><content type='html'>&lt;div style="clear: both;"&gt;How do I get Spring to work in Eclipse 3.5?" &lt;em&gt;(Personally I use Eclipse 3.5 for Cocoa 32 Bit Addition)&lt;/em&gt; Well here are the steps (assuming you already have Eclipse 3.5 installed)&lt;/div&gt;&lt;div style="clear: both;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="clear: both;"&gt;In order to install Spring and the Spring Tool Suite first you have to have Mylyn installed as well as Mylyn Extra's.&amp;nbsp;&lt;/div&gt;&lt;div style="clear: both;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="clear: both;"&gt;&lt;b&gt;Install Mylyn&lt;/b&gt;&lt;/div&gt;&lt;div style="clear: both;"&gt;&lt;/div&gt;&lt;ol style="clear: both;"&gt;&lt;li&gt;In Eclipse, click on Help -&amp;gt; Install New Software...&lt;/li&gt;&lt;li&gt;Click Add...&lt;/li&gt;&lt;li&gt;Type in a name, I typed, "Mylyn" (without the quotes)&lt;/li&gt;&lt;li&gt;Type in this location: http://download.eclipse.org/tools/mylyn/update/e3.4/&amp;nbsp;&lt;em&gt;(This is Mylyn Update site)&lt;/em&gt;&lt;/li&gt;&lt;li&gt;Select all the boxes.&amp;nbsp;&lt;/li&gt;&lt;li&gt;Click Finish and follow the directions accepting the license agreements&lt;/li&gt;&lt;/ol&gt;&lt;div&gt;&lt;b&gt;Install Mylyn Extra's&lt;/b&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="clear: both;"&gt;&lt;/div&gt;&lt;ol style="clear: both;"&gt;&lt;li&gt;In Eclipse, click on Help -&amp;gt; Install New Software...&lt;/li&gt;&lt;li&gt;Click Add...&lt;/li&gt;&lt;li&gt;Type in a name, I typed, "Mylyn Extra's" (without the quotes)&lt;/li&gt;&lt;li&gt;Type in this location: http://download.eclipse.org/tools/mylyn/update/extras&amp;nbsp;&lt;em&gt;(This is Mylyn Extra's Update site)&lt;/em&gt;&lt;/li&gt;&lt;li&gt;Select all the boxes.&amp;nbsp;&lt;/li&gt;&lt;li&gt;Click Finish and follow the directions accepting the license agreements&lt;/li&gt;&lt;/ol&gt;&lt;div&gt;&lt;b&gt;Install Spring&lt;/b&gt;&lt;/div&gt;&lt;br /&gt;&lt;ol style="clear: both;"&gt;&lt;li&gt;In Eclipse, click on Help -&amp;gt; Install New Software...&lt;/li&gt;&lt;li&gt;Click Add...&lt;/li&gt;&lt;li&gt;Type in a name, I typed, "Spring" (without the quotes)&lt;/li&gt;&lt;li&gt;Type in this location: http://www.springsource.org/update/e3.4 &lt;em&gt;(This is Spring Update site)&lt;/em&gt;&lt;/li&gt;&lt;li&gt;Select all the boxes.&amp;nbsp;&lt;/li&gt;&lt;li&gt;Click Finish and follow the directions accepting the license agreements&lt;/li&gt;&lt;/ol&gt;&lt;br class="final-break" style="clear: both;" /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1546366980808220992-6539344770020889902?l=techscienceinterest.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techscienceinterest.blogspot.com/feeds/6539344770020889902/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techscienceinterest.blogspot.com/2010/02/installing-spring-in-eclipse-35.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1546366980808220992/posts/default/6539344770020889902'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1546366980808220992/posts/default/6539344770020889902'/><link rel='alternate' type='text/html' href='http://techscienceinterest.blogspot.com/2010/02/installing-spring-in-eclipse-35.html' title='Installing Spring in Eclipse 3.5'/><author><name>Brent Coffey</name><uri>http://www.blogger.com/profile/14987122747702890412</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_7p4NxoKlbj4/S3RxOjAJ_rI/AAAAAAAAAEw/kOlFmUROluI/S220/Photo+on+2010-02-11+at+15.39+%232.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1546366980808220992.post-8337597128662238854</id><published>2010-02-11T10:44:00.002-05:00</published><updated>2010-02-19T10:18:20.761-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='eclipse'/><category scheme='http://www.blogger.com/atom/ns#' term='maven'/><title type='text'>Installing m2Eclipse (Maven) in Eclipse</title><content type='html'>&lt;div style="clear: both;"&gt;How do I get Maven to work in Eclipse 3.5?"&lt;br /&gt;&lt;em&gt;(Personally I use Eclipse 3.5 for Cocoa 32 Bit Addition)&lt;/em&gt;&lt;/div&gt;&lt;div style="clear: both;"&gt;&lt;i&gt;(&lt;b&gt;NOTE&lt;/b&gt;: &lt;span class="Apple-style-span" style="color: red;"&gt;If you are using the Spring Tool Suite then it already includes m2Eclipse so no need to follow these steps.&lt;/span&gt;)&lt;/i&gt;&lt;/div&gt;&lt;div style="clear: both;"&gt;Well here are the steps (assuming you already have Eclipse 3.5 installed)&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="clear: both;"&gt;&lt;b&gt;m2Eclipse Installation&lt;/b&gt;&lt;/div&gt;&lt;ol style="clear: both;"&gt;&lt;li&gt;In Eclipse, click on Help -&amp;gt; Install New Software...&lt;/li&gt;&lt;li&gt;Click Add...&lt;/li&gt;&lt;li&gt;Type in a name, I typed, "m2Eclipse (Maven)" (without the quotes)&lt;/li&gt;&lt;li&gt;Type in this location: http://m2eclipse.sonatype.org/sites/m2e &lt;em&gt;(This is m2Eclispe Update site)&lt;/em&gt;&lt;/li&gt;&lt;li&gt;Select all the check boxes, if you have Subclipse, AspectJ, and Mylyn installed. Otherwise uncheck those particular boxes. &lt;em&gt;If you just select everything it will tell you which ones won't be installed because you are missing a dependency. So don't worry about it if you don't know which ones I'm referring to. Just happily continue.&lt;/em&gt;&lt;/li&gt;&lt;li&gt;Click Finish and follow the directions accepting the license agreements&lt;/li&gt;&lt;/ol&gt;&lt;div&gt;&lt;b&gt;m2Eclipe Extras Installation&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;ol style="clear: both;"&gt;&lt;li&gt;In Eclipse, click on Help -&amp;gt; Install New Software...&lt;/li&gt;&lt;li&gt;Click Add...&lt;/li&gt;&lt;li&gt;Type in a name, I typed, "m2Eclipse (Maven)" (without the quotes)&lt;/li&gt;&lt;li&gt;Type in this location: http://m2eclipse.sonatype.org/sites/m2e-extras&amp;nbsp;&lt;em&gt;(This is m2Eclispe Extras Update site)&lt;/em&gt;&lt;/li&gt;&lt;li&gt;Select all the check boxes, if you have Subclipse, AspectJ, and Mylyn installed. Otherwise uncheck those particular boxes.&amp;nbsp;&lt;em&gt;If you just select everything it will tell you which ones won't be installed because you are missing a dependency. So don't worry about it if you don't know which ones I'm referring to. Just happily continue.&lt;/em&gt;&lt;/li&gt;&lt;li&gt;Click Finish and follow the directions accepting the license agreements&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;&lt;div style="clear: both;"&gt;&lt;/div&gt;&lt;br class="final-break" style="clear: both;" /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1546366980808220992-8337597128662238854?l=techscienceinterest.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techscienceinterest.blogspot.com/feeds/8337597128662238854/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techscienceinterest.blogspot.com/2010/02/installing-m2eclipse-maven-in-eclipse.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1546366980808220992/posts/default/8337597128662238854'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1546366980808220992/posts/default/8337597128662238854'/><link rel='alternate' type='text/html' href='http://techscienceinterest.blogspot.com/2010/02/installing-m2eclipse-maven-in-eclipse.html' title='Installing m2Eclipse (Maven) in Eclipse'/><author><name>Brent Coffey</name><uri>http://www.blogger.com/profile/14987122747702890412</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_7p4NxoKlbj4/S3RxOjAJ_rI/AAAAAAAAAEw/kOlFmUROluI/S220/Photo+on+2010-02-11+at+15.39+%232.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1546366980808220992.post-4536984675656597759</id><published>2010-02-10T16:29:00.001-05:00</published><updated>2010-02-10T16:49:04.276-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='gis'/><category scheme='http://www.blogger.com/atom/ns#' term='gps'/><category scheme='http://www.blogger.com/atom/ns#' term='utm'/><category scheme='http://www.blogger.com/atom/ns#' term='navigation'/><title type='text'>What is UTM? (Universal Transverse Mercator)</title><content type='html'>&lt;em&gt;(First I assume you know what Latitude and Longitude is if you are reading this.)&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;UTM was developed as a way of determining coordinates on a paper map or really any flat 2D surface (such as a computer screen!).  Here is how it works in a nutshell:&lt;br /&gt;&lt;br /&gt;UTM is written like this 18S 3741214233566 (Like all the numbers? ;-)) So here is how to read this "garble-de-goop" (That's a technical term!)&lt;br /&gt;&lt;br /&gt;UTM divides the world up from 80 degrees South latitude to 84 degrees North Latitude.&lt;br /&gt;&lt;br /&gt;These areas are labeled from bottom to top &amp; left to right.  Exactly how you read a typical X &amp; Y graph.  But instead of using just numbers UTM uses a mix of numbers and letters.&lt;br /&gt;&lt;br /&gt;The Y axis starts with the letter F and goes through the Letter X&lt;br /&gt;&lt;br /&gt;The X axis starts with the number 1 and goes through the number 60&lt;br /&gt;&lt;br /&gt;&lt;img src="http://lh6.ggpht.com/_7p4NxoKlbj4/S3Mmul7I3OI/AAAAAAAAAC8/pbxIbcD0cu0/UTM.jpg?imgmax=800" alt="UTM.jpg" border="0" width="295" height="190" /&gt;&lt;br /&gt;&lt;br /&gt;Now there are good mathematical reasons for all of this.  If you are interested you can read a book on the subject.  A simple book on navigation will explain this well.  I personally have enjoyed reading &lt;a href="http://www.amazon.com/gp/product/0899974457?ie=UTF8&amp;tag=brencoff-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=0899974457"&gt;Outdoor Navigation With GPS: Hiking, Geocaching, Canoeing, Kayaking, Fishing, Outdoor Photography, Backpacking, Mountain Biking by Stephen Hinch&lt;/a&gt;&lt;img src="http://www.assoc-amazon.com/e/ir?t=brencoff-20&amp;l=as2&amp;o=1&amp;a=0899974457" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /&gt;&lt;br /&gt;.  He explains it in more detail in his book.  But for our purposes I'm going to keep this really simple.&lt;br /&gt;&lt;br /&gt;So if you have ever played the board game battleship you should understand that if I said 18 S that would refer to the grid area somewhere around Maryland, Virginia, and Delaware.&lt;br /&gt;&lt;br /&gt;Now the next 13 digits are the "eastings and the northings."  This may not always be 13 digits, but typically is.  When there are an odd number of digits the easting digits are always one less than the northing digits.  So in our example the easting measurement is 374121 (6 Digits) and the northing measurement is 4233566 (7 Digits).  &lt;br /&gt;&lt;br /&gt;Now you find the map for the 18 S (which can be found at usgs.gov) and you simply go over on the X Axis 374121 and on the Y axis up to 423566. Remember what I said about the Y Axis having letters and the X axis going from 0 to 60?  Well now once you have found the right map, the letters and numbers I told you about are irrelevant. We now switch back to good old numbers on both the X and Y Axis.  Just read them like you would any X &amp; Y graph now.&lt;br /&gt;&lt;br /&gt;In other words the first number and letter tell you on a global scale what general area map you need to find.  Once you have found the corresponding map, you then basically just use the next string of numbers to find the point on the map.  Simple right?&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;a href="http://www.nwcg.gov/pms/pubs/475/PMS475_chap6b.pdf"&gt;Click Here for more detailed explanation here along with pictures and sample maps from the US Government..&lt;/a&gt;&lt;/strong&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1546366980808220992-4536984675656597759?l=techscienceinterest.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techscienceinterest.blogspot.com/feeds/4536984675656597759/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techscienceinterest.blogspot.com/2010/02/what-is-utm-universal-transverse.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1546366980808220992/posts/default/4536984675656597759'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1546366980808220992/posts/default/4536984675656597759'/><link rel='alternate' type='text/html' href='http://techscienceinterest.blogspot.com/2010/02/what-is-utm-universal-transverse.html' title='What is UTM? (Universal Transverse Mercator)'/><author><name>Brent Coffey</name><uri>http://www.blogger.com/profile/14987122747702890412</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_7p4NxoKlbj4/S3RxOjAJ_rI/AAAAAAAAAEw/kOlFmUROluI/S220/Photo+on+2010-02-11+at+15.39+%232.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh6.ggpht.com/_7p4NxoKlbj4/S3Mmul7I3OI/AAAAAAAAAC8/pbxIbcD0cu0/s72-c/UTM.jpg?imgmax=800' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1546366980808220992.post-2640265532352678948</id><published>2010-02-10T15:46:00.001-05:00</published><updated>2010-02-12T15:16:14.305-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='AspectJ'/><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='eclipse'/><category scheme='http://www.blogger.com/atom/ns#' term='AOP'/><title type='text'>Create/Convert to an AspectJ Project in Eclipse 3.5</title><content type='html'>&lt;p style="clear: both"&gt;To create an AspectJ project:&lt;/p&gt;&lt;p style="clear: both"&gt;&lt;ol style="clear: both"&gt;&lt;li&gt;Click on File-&amp;gt;New-&amp;gt;Other...&lt;/li&gt;&lt;li&gt;Select AspectJ Project.&lt;/li&gt;&lt;/ol&gt;&lt;/p&gt;&lt;p style="clear: both"&gt;To add AspectJ code to an existing Java Project:&lt;/p&gt;&lt;p style="clear: both"&gt;&lt;ol style="clear: both"&gt;&lt;li&gt;Right click on the project folder in the Package Explorer window&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Click Configure-&amp;gt;Convert to AspectJ Project.&lt;/li&gt;&lt;/ol&gt;Your project will now allow you to create Aspects and of course use the AspectJ weaver. Don't worry your current Java code should still compile and work fine. The only thing you have done is told Eclipse to use the AspectJ weaver when compiling this project.&lt;/p&gt;&lt;p style="clear: both"&gt;That's it! Keep in mind that ApsectJ has it's own unique compiler separate from javac. This AspectJ compiler is called a "weaver" and this weaver is now installed on your computer and you are able to create AspectJ projects that will use this new weaver. Don't worry your java code should still work fine. &lt;/p&gt;&lt;p style="clear: both"&gt;&lt;strong&gt;But if you have an Ant build script that is calling the "javac" compiler you will need to change it to call the "ajc" compiler or your aspects will not compile.&lt;/strong&gt;&lt;/p&gt;&lt;p style="clear: both"&gt;&lt;/p&gt;&lt;br class='final-break' style='clear: both' /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1546366980808220992-2640265532352678948?l=techscienceinterest.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techscienceinterest.blogspot.com/feeds/2640265532352678948/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techscienceinterest.blogspot.com/2010/02/createconvert-to-aspectj-project-in.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1546366980808220992/posts/default/2640265532352678948'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1546366980808220992/posts/default/2640265532352678948'/><link rel='alternate' type='text/html' href='http://techscienceinterest.blogspot.com/2010/02/createconvert-to-aspectj-project-in.html' title='Create/Convert to an AspectJ Project in Eclipse 3.5'/><author><name>Brent Coffey</name><uri>http://www.blogger.com/profile/14987122747702890412</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_7p4NxoKlbj4/S3RxOjAJ_rI/AAAAAAAAAEw/kOlFmUROluI/S220/Photo+on+2010-02-11+at+15.39+%232.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1546366980808220992.post-4488072848539134950</id><published>2010-02-10T15:45:00.003-05:00</published><updated>2010-07-08T09:07:38.554-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='AspectJ'/><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='eclipse'/><category scheme='http://www.blogger.com/atom/ns#' term='AOP'/><title type='text'>How to Install AspectJ in Eclipse 3.5</title><content type='html'>&lt;div style="clear: both;"&gt;If you read my last post you may be thinking, "Ok AOP sounds interesting but how do I get AspectJ to workin Eclipse 3.5?"&lt;br /&gt;&lt;em&gt;(Personally I use Eclipse 3.5 for Cocoa 32 Bit Addition)&lt;/em&gt;&lt;/div&gt;&lt;div style="clear: both;"&gt;Well here are the steps (assuming you already have Eclipse 3.5 installed)&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;ol style="clear: both;"&gt;&lt;li&gt;In Eclipse, click on Help -&amp;gt; Install New Software...&lt;/li&gt;&lt;li&gt;Click Add...&lt;/li&gt;&lt;li&gt;Type in a name, I typed, "AspectJ" (without the quotes)&lt;/li&gt;&lt;li&gt;Type in this location: http://download.eclipse.org/tools/ajdt/35/update &lt;em&gt;(This is AspectJ Update site for Eclipse 3.5 for 3.6 use&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/em&gt;&lt;span class="Apple-style-span" style="-webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px;"&gt;&lt;code&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;http://download.eclipse.org/tools/ajdt/36/update)&lt;/span&gt;&lt;/code&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;Select all the check boxes&lt;/li&gt;&lt;li&gt;Click Finish and follow the directions accepting the license agreements&lt;/li&gt;&lt;/ol&gt;&lt;div style="clear: both;"&gt;&lt;/div&gt;&lt;br class="final-break" style="clear: both;" /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1546366980808220992-4488072848539134950?l=techscienceinterest.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techscienceinterest.blogspot.com/feeds/4488072848539134950/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techscienceinterest.blogspot.com/2010/02/how-to-install-aspectj-in-eclipse-35.html#comment-form' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1546366980808220992/posts/default/4488072848539134950'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1546366980808220992/posts/default/4488072848539134950'/><link rel='alternate' type='text/html' href='http://techscienceinterest.blogspot.com/2010/02/how-to-install-aspectj-in-eclipse-35.html' title='How to Install AspectJ in Eclipse 3.5'/><author><name>Brent Coffey</name><uri>http://www.blogger.com/profile/14987122747702890412</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_7p4NxoKlbj4/S3RxOjAJ_rI/AAAAAAAAAEw/kOlFmUROluI/S220/Photo+on+2010-02-11+at+15.39+%232.jpg'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1546366980808220992.post-7354844600968207694</id><published>2010-02-10T13:55:00.006-05:00</published><updated>2010-02-12T13:25:47.081-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='AspectJ'/><category scheme='http://www.blogger.com/atom/ns#' term='AOP'/><title type='text'>An Intro to Aspect Oriented Programming</title><content type='html'>What in the world is Aspect Oriented Programming (AOP)? Well if you don't know your not alone. In fact I had no idea until about two weeks ago, and no one on my software team had a clue either. But I kept seeing the word "AOP" pop up on blogs so I decided to investigate.&lt;br /&gt;&lt;br /&gt;Well I hate big words and long explanations so in a nutshell AOP is a programming methodology whereby the primary aspects (i.e. requirements!) are separated from the secondary aspects. So let me explain. Say you are writing ATM software. It's primary job/aspect/requirement is to move money from Account A into your hands. Any other requirements that are used to support that main requirement of moving money (such as logging, security, etc) are probably secondary aspects/jobs/requirements and can/should be written using aspects in an aspect oriented language such as AspectJ. Why you ask?&lt;br /&gt;&lt;br /&gt;Well these secondary requirements, like logging, tend to "cross cut" many of your traditional objects and make for ugly hard to follow code example:&lt;br /&gt;&lt;br /&gt;Requirements:&lt;br /&gt;&lt;br /&gt;1. Move Money&lt;br /&gt;2. Log all Changes in Account Balance&lt;br /&gt;&lt;br /&gt;&lt;script class="brush: java" type="syntaxhighlighter"&gt;&lt;![CDATA[//Simple to Understand, and function moveMoney //does only that, moves money!public void moveMoney (String fromAccount, String toAccount, double amount) {            fromAccount -= amount;            toAccount += amount;}// Now add some secondary "aspects" to it // and notice how the code gets sloppier// and the function moveMoney now does more than// move money but it also logs.public void moveMoney (String fromAccount, String toAccount, double amount) {            System.out.println ("Taking: $" + amount + " out of account " + fromAccount);            fromAccount -= amount;            System.out.println ("Adding: $" + amount + " out of account " + toAccount);            toAccount += amount;}]]&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;In this case "logging" is a secondary aspect/job/requirement of the code. So here is how AOP would solve this problem?&lt;br /&gt;&lt;br /&gt;&lt;script class="brush: java" type="syntaxhighlighter"&gt;&lt;![CDATA[// Simple to Understand, and function moveMoney // does only that, moves money!public boolean moveMoney (String fromAccount, String toAccount, double amount) {               fromAccount -= amount;               toAccount += amount;}// Notice the key words "aspect," "pointcut," "call," // "args," and "before"public aspect loggingAspect {              pointcut logAccountChange (java.lang.String from, java.lang.String to, double amount) : call (public void moveMoney (java.lang.String, java.lang.String, double)) &amp;amp;&amp;amp; args(from, to, amount);before (java.lang.String from, java.lang.String to, double amount) : logAccountChange (from, to, amount) {         System.out.println ("Taking: $" + amount + " out of account " + fromAccount);         System.out.println ("Adding: $" + amount + " out of account " + toAccount);}}]]&gt;&lt;/script&gt;&lt;br /&gt;Notice that the moveMoney function now only deals with "moving money" while the logAccountChange "advice" (think of the term "advice" as a method inside a class) deals with the logging and only the logging.&lt;br /&gt;&lt;br /&gt;That is what AOP is about in a nutshell; separating out primary aspects/requirements from secondary aspects/requirements. It is not a replacement to OOP it is complementary to it.&lt;br /&gt;&lt;br class="final-break" style="clear: both;" /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1546366980808220992-7354844600968207694?l=techscienceinterest.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techscienceinterest.blogspot.com/feeds/7354844600968207694/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techscienceinterest.blogspot.com/2010/02/intro-to-aspect-oriented-programming.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1546366980808220992/posts/default/7354844600968207694'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1546366980808220992/posts/default/7354844600968207694'/><link rel='alternate' type='text/html' href='http://techscienceinterest.blogspot.com/2010/02/intro-to-aspect-oriented-programming.html' title='An Intro to Aspect Oriented Programming'/><author><name>Brent Coffey</name><uri>http://www.blogger.com/profile/14987122747702890412</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_7p4NxoKlbj4/S3RxOjAJ_rI/AAAAAAAAAEw/kOlFmUROluI/S220/Photo+on+2010-02-11+at+15.39+%232.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1546366980808220992.post-5542153717494318877</id><published>2009-03-20T13:47:00.001-04:00</published><updated>2010-02-11T18:09:24.258-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Pixel Bender'/><title type='text'>Using Pixel Bender</title><content type='html'>&lt;p style="clear: both"&gt;I'm going to demonstrate how to write a short Pixel Bender script which will change the color of a graphic from Green to Yellow or Red. &lt;/p&gt;&lt;p style="clear: both"&gt;The Pixel Bender application is a simple development tool that comes with Adobe Flash CS4. You can also download it from &lt;a href="http://labs.adobe.com/technologies/pixelbender/" title="Pixel Bender Toolkit Download" target="_blank"&gt;Adobe Labs&lt;/a&gt; if you don't have it.&lt;/p&gt;&lt;p style="clear: both"&gt;&lt;em&gt;(I'm using an Intel Macbook Pro 2.53GHz with 4GB of RAM to write this code, this will also work on a Microsoft Windows PC)&lt;/em&gt;&lt;/p&gt;&lt;p style="clear: both"&gt;&lt;strong&gt;Part 1:&lt;/strong&gt;&lt;/p&gt;&lt;p style="clear: both"&gt;1. Start Pixel Bender. I use Spotlight to start all my applications. (&lt;em&gt;Command + Spacebar&lt;/em&gt; on the Mac and start typing &lt;em&gt;Pixel Bender ToolKit&lt;/em&gt;)&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style="clear: both"&gt;&lt;a href="http://picasaweb.google.com/data/media/api/user/coffeybrent/albumid/5315327903418853105/photoid/5315328068178149954/1237571255770000?authkey=Gv1sRgCKS4l5nk4venTA" class="image-link"&gt;&lt;img class="linked-to-original" src="http://picasaweb.google.com/data/media/api/user/coffeybrent/albumid/5315327903418853105/photoid/5315328068653317058/1237571255112000?authkey=Gv1sRgCKS4l5nk4venTA" height="103" align="left" width="341" style=" display: inline; float: left; margin: 0 10px 10px 0;" /&gt;&lt;/a&gt;&lt;br style="clear: both" /&gt;2. When Pixel Bender starts you will see the window below. Look in the lower right hand corner and click the "Create a new filter" button.&lt;/p&gt;&lt;p style="clear: both"&gt;&lt;a href="http://picasaweb.google.com/data/media/api/user/coffeybrent/albumid/5315327903418853105/photoid/5315328087414335250/1237571259025000?authkey=Gv1sRgCKS4l5nk4venTA" class="image-link"&gt;&lt;img class="linked-to-original" src="http://picasaweb.google.com/data/media/api/user/coffeybrent/albumid/5315327903418853105/photoid/5315328080578989922/1237571258225000?authkey=Gv1sRgCKS4l5nk4venTA" height="263" align="left" width="380" style=" display: inline; float: left; margin: 0 10px 10px 0;" /&gt;&lt;/a&gt;&lt;br style="clear: both" /&gt;3. When you click the "&lt;strong&gt;Create a new filter&lt;/strong&gt;" button, Pixel Bender will put the basic stub code in the editor pane (&lt;em&gt;Lower Left hand side&lt;/em&gt;).&lt;/p&gt;&lt;p style="clear: both"&gt;&lt;a href="http://picasaweb.google.com/data/media/api/user/coffeybrent/albumid/5315327903418853105/photoid/5315328093849325554/1237571261360000?authkey=Gv1sRgCKS4l5nk4venTA" class="image-link"&gt;&lt;img class="linked-to-original" src="http://picasaweb.google.com/data/media/api/user/coffeybrent/albumid/5315327903418853105/photoid/5315328089026187058/1237571260489000?authkey=Gv1sRgCKS4l5nk4venTA" height="213" align="left" width="379" style=" display: inline; float: left; margin: 0 10px 10px 0;" /&gt;&lt;/a&gt;&lt;br style="clear: both" /&gt;&lt;strong&gt;NOTE&lt;/strong&gt;: &lt;em&gt;Don't let the code intimidate you. This will be easy. Don't worry about what all the code means at the moment. We will get to it in later blogs. We are just going to cover the bare minimum here.&lt;/em&gt;&lt;/p&gt;&lt;p style="clear: both"&gt;4. Now Load a sample image so that when we are done we can see the results of our code. To do this click on &lt;strong&gt;File &amp;gt; Load Image 1...&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style="clear: both"&gt;&lt;a href="http://picasaweb.google.com/data/media/api/user/coffeybrent/albumid/5315327903418853105/photoid/5315328113670366338/1237571265419000?authkey=Gv1sRgCKS4l5nk4venTA" class="image-link"&gt;&lt;img class="linked-to-original" src="http://picasaweb.google.com/data/media/api/user/coffeybrent/albumid/5315327903418853105/photoid/5315328098818213426/1237571262368000?authkey=Gv1sRgCKS4l5nk4venTA" height="61" align="left" width="166" style=" display: inline; float: left; margin: 0 10px 10px 0;" /&gt;&lt;/a&gt;&lt;br style="clear: both" /&gt;5. Find the Image you want to use to test the code. This image &lt;u&gt;doesn't&lt;/u&gt; have to be the image you want to use in the final product. But In this case we need to find a green button image in order for the script to work as intended. &lt;/p&gt;&lt;p style="clear: both"&gt;I created a simple green button in Adobe Illustrator and saved it as a jpeg &lt;em&gt;(Pixel Bender can use either jpeg or png images to test the code). &lt;/em&gt;Here is the image I used (yes it's a little cheesy but it's mine, get's the job done, and it's free to use.)&lt;/p&gt;&lt;p style="clear: both"&gt;&lt;a href="http://picasaweb.google.com/data/media/api/user/coffeybrent/albumid/5315327903418853105/photoid/5315328115778079186/1237571266969000?authkey=Gv1sRgCKS4l5nk4venTA" class="image-link"&gt;&lt;img class="linked-to-original" src="http://picasaweb.google.com/data/media/api/user/coffeybrent/albumid/5315327903418853105/photoid/5315328116173729138/1237571266394000?authkey=Gv1sRgCKS4l5nk4venTA" height="285" align="left" width="380" style=" display: inline; float: left; margin: 0 10px 10px 0;" /&gt;&lt;/a&gt;&lt;br style="clear: both" /&gt;5. Now look down at the source code. Note that there are two variables in the code, (&lt;em&gt;src, and dst&lt;/em&gt;) and also note that there is one function (&lt;em&gt;evaluatePixel()&lt;/em&gt;).&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style="clear: both"&gt;&lt;a href="http://picasaweb.google.com/data/media/api/user/coffeybrent/albumid/5315327903418853105/photoid/5315328125070342434/1237571268646000?authkey=Gv1sRgCKS4l5nk4venTA" class="image-link"&gt;&lt;img class="linked-to-original" src="http://picasaweb.google.com/data/media/api/user/coffeybrent/albumid/5315327903418853105/photoid/5315328125881164514/1237571268073000?authkey=Gv1sRgCKS4l5nk4venTA" height="93" align="left" width="197" style=" display: inline; float: left; margin: 0 10px 10px 0;" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;ul style="clear: both"&gt;&lt;li&gt;&lt;em&gt;src&lt;/em&gt; is the variable that stores your "&lt;em&gt;source"&lt;/em&gt; image (your original image). In this case src has already been set to our green button. Pixel Bender did this for you. You don't need to do anything to make this happen.&lt;/li&gt;&lt;li&gt;&lt;em&gt;dst&lt;/em&gt; is the variable that stores your output image, your "&lt;em&gt;destination&lt;/em&gt;" image.&lt;/li&gt;&lt;li&gt;The &lt;em&gt;evaluatePixel() &lt;/em&gt;function is the function that is called by default when the script runs. &lt;em&gt;(If you are familiar with C++ you can think of it as kind of like the "main" function).&lt;br /&gt;&lt;/em&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p style="clear: both"&gt;6. In order to turn a green pixel to Yellow or Red pixel you have to understand that basically all pixels are made up of 3 color channels (Red, Green, and Blue). &lt;/p&gt;&lt;ul style="clear: both"&gt;&lt;li&gt;A red pixel has the red channel turned up, and the green and blue channels turned down. Think of it like volume on a radio. To best hear the Left side speaker turn the left side speaker up and turn the right side speaker down. The stronger you want the sound out of the left speaker the more you can turn up the left speaker and turn down the right speaker. &lt;/li&gt;&lt;li&gt;Thus a green pixel has the Green channel turned up and the two other channels turned down.&lt;/li&gt;&lt;li&gt;A yellow pixel has the red and green channels equal and the blue channel down.&lt;/li&gt;&lt;li&gt;A white pixel has all the channels turned all the way up.&lt;/li&gt;&lt;li&gt;A grey pixel has all the channels equal but not turned fully up or fully down.&lt;/li&gt;&lt;li&gt;A black pixel has all the channels turned down.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p style="clear: both"&gt;So to make our pixel bender script turn our green image to a red image we are going to take the red channel of the dst variable and set it equal to the green channel of the src variable and we are going to set the dst variable green channel to the src variable red channel. To do this we are going to insert the following code inside the evaluatePixel() function below the line that says "dst = sampleNearest(src, outCoord());"&lt;/p&gt;&lt;p style="clear: both"&gt;&lt;/p&gt;&lt;p style="clear: both"&gt;&lt;strong&gt; float greenChannel = dst.g;&lt;br /&gt; float redChannel = dst.r;&lt;br /&gt;  &lt;br /&gt; dst.r = greenChannel;&lt;br /&gt; dst.g = redChannel;&lt;/strong&gt;&lt;/p&gt;&lt;p style="clear: both"&gt;7, If you followed all these steps your Pixel Bender window should now look like this:&lt;/p&gt;&lt;p style="clear: both"&gt;&lt;a href="http://picasaweb.google.com/data/media/api/user/coffeybrent/albumid/5315327903418853105/photoid/5315328138383069522/1237571271942000?authkey=Gv1sRgCKS4l5nk4venTA" class="image-link"&gt;&lt;img class="linked-to-original" src="http://picasaweb.google.com/data/media/api/user/coffeybrent/albumid/5315327903418853105/photoid/5315328127350222626/1237571269861000?authkey=Gv1sRgCKS4l5nk4venTA" height="267" align="left" width="378" style=" display: inline; float: left; margin: 0 10px 10px 0;" /&gt;&lt;/a&gt;&lt;br style="clear: both" /&gt;8. Almost done. Double check your code for typos. When your sure it matches mine then click the &lt;em&gt;&lt;strong&gt;run&lt;/strong&gt;&lt;/em&gt; button in the lower right hand side. &lt;/p&gt;&lt;p style="clear: both"&gt;Your image should turn red. &lt;em&gt; (D&lt;/em&gt;&lt;em&gt;on't worry this is a non-destructive operation. You original image is not actually changed &lt;u&gt;only&lt;/u&gt; what is displayed on the screen! Your screen should now look like this.)&lt;/em&gt;&lt;/p&gt;&lt;p style="clear: both"&gt;&lt;a href="http://picasaweb.google.com/data/media/api/user/coffeybrent/albumid/5315327903418853105/photoid/5315328155239020578/1237571275535000?authkey=Gv1sRgCKS4l5nk4venTA" class="image-link"&gt;&lt;img class="linked-to-original" src="http://picasaweb.google.com/data/media/api/user/coffeybrent/albumid/5315327903418853105/photoid/5315328142587314258/1237571272926000?authkey=Gv1sRgCKS4l5nk4venTA" height="267" align="left" width="378" style=" display: inline; float: left; margin: 0 10px 10px 0;" /&gt;&lt;/a&gt;&lt;br style="clear: both" /&gt;9. Now lets add the code that allows us to choose whether we want to turn the image red or yellow. To do this we first have to create two "parameters." These parameters will let an outside program or person change the image color. We can't use a boolean type to do this because if we do it won't work later when we want to put it into Adobe's Flash CS4. So we need to create two integer parameters. To do this we add the following code above the &lt;em&gt;evaluatePixel()&lt;/em&gt; function, but below the variable declarations. You can name the parameters whatever you want but I choose "alarm" and "warning" because ultimately I want to use this to show whether a computer on a network is working properly or not.&lt;/p&gt;&lt;p style="clear: both"&gt;&lt;strong&gt;parameter int alarm&lt;br /&gt; &amp;lt;&lt;br /&gt; minValue : 0;&lt;br /&gt; maxValue : 1;&lt;br /&gt; defaultValue : 0;&lt;br /&gt; description : "Change To Red";&lt;br /&gt; &amp;gt;;&lt;br /&gt;  &lt;br /&gt; parameter int warning&lt;br /&gt; &amp;lt;&lt;br /&gt; minValue : 0;&lt;br /&gt; maxValue : 1;&lt;br /&gt; defaultValue : 0;&lt;br /&gt; description : "Change to Yellow";&lt;br /&gt; &amp;gt;;&lt;br /&gt;&lt;/strong&gt;&lt;br /&gt;10. Now we need to add the code to the evaluatePixel() function that will evaluate the pixels based on the parameters. If the alarm parameter is set to 1 (i.e. ON) then we want a red image. On the other hand if the warning parameter is set to 1 then we want the image to turn yellow. To do this we change the evaluatePixel() function to look like the following:&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style="clear: both"&gt;&lt;strong&gt;dst = sampleNearest(src,outCoord());&lt;br /&gt;float greenChannel = dst.g;&lt;br /&gt;float redChannel = dst.r;&lt;br /&gt;  &lt;br /&gt; if (alarm == 1)&lt;br /&gt; {&lt;br /&gt; dst.r = greenChannel;&lt;br /&gt; dst.g = redChannel;&lt;br /&gt; }&lt;br /&gt; else if (warning == 1)&lt;br /&gt; {&lt;br /&gt; dst.r = greenChannel;&lt;br /&gt; }&lt;/strong&gt;&lt;/p&gt;&lt;p style="clear: both"&gt;11. All Done! If you followed all these steps hit the &lt;strong&gt;Run&lt;/strong&gt; button again and now your script should be all done and working. &lt;/p&gt;&lt;p style="clear: both"&gt;Test your script by moving the sliders on the upper right hand side from 0 to 1. Be sure to save your pixel bender script. I called mine SystemState.pbk&lt;/p&gt;&lt;p style="clear: both"&gt;&lt;a href="http://picasaweb.google.com/data/media/api/user/coffeybrent/albumid/5315327903418853105/photoid/5315328163546641426/1237571277701000?authkey=Gv1sRgCKS4l5nk4venTA" class="image-link"&gt;&lt;img class="linked-to-original" src="http://picasaweb.google.com/data/media/api/user/coffeybrent/albumid/5315327903418853105/photoid/5315328158736629490/1237571276381000?authkey=Gv1sRgCKS4l5nk4venTA" height="267" align="left" width="378" style=" display: inline; float: left; margin: 0 10px 10px 0;" /&gt;&lt;/a&gt;&lt;br style="clear: both" /&gt;&lt;em&gt;(&lt;/em&gt;&lt;strong&gt;&lt;em&gt;NOTE:&lt;/em&gt;&lt;/strong&gt;&lt;em&gt; If you set both your sliders to 1 the image will be Red. You can change that if you want. I personally choose not to)&lt;/em&gt;&lt;/p&gt;&lt;br class='final-break' style='clear: both' /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1546366980808220992-5542153717494318877?l=techscienceinterest.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techscienceinterest.blogspot.com/feeds/5542153717494318877/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techscienceinterest.blogspot.com/2009/03/using-pixel-bender-to-change-flex.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1546366980808220992/posts/default/5542153717494318877'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1546366980808220992/posts/default/5542153717494318877'/><link rel='alternate' type='text/html' href='http://techscienceinterest.blogspot.com/2009/03/using-pixel-bender-to-change-flex.html' title='Using Pixel Bender'/><author><name>Brent Coffey</name><uri>http://www.blogger.com/profile/14987122747702890412</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_7p4NxoKlbj4/S3RxOjAJ_rI/AAAAAAAAAEw/kOlFmUROluI/S220/Photo+on+2010-02-11+at+15.39+%232.jpg'/></author><thr:total>0</thr:total></entry></feed>
