<?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-7440397442105335024</id><updated>2012-02-16T04:10:37.407-08:00</updated><title type='text'>People Make The Difference</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://jayasanka.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7440397442105335024/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://jayasanka.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Jayasanka</name><uri>http://www.blogger.com/profile/02280544026487726690</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>15</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-7440397442105335024.post-5071502228864311806</id><published>2011-04-28T22:09:00.000-07:00</published><updated>2011-04-28T22:30:30.130-07:00</updated><title type='text'>What is serialVersionUID?</title><content type='html'>If a class implements &lt;span style="font-style: italic;"&gt;Serializable&lt;/span&gt; interface, your IDE worn you to add &lt;code&gt;serialVersionUID&lt;/code&gt; or it add automatically. This variable holds a &lt;span style="font-style: italic;"&gt;private static final long&lt;/span&gt; and IDE automatically declared it to 1L. &lt;code&gt;serialVersionUID&lt;/code&gt; is static, then it should not have been serialized. But why is this so impotent?&lt;br /&gt;&lt;br /&gt;consider following example.&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;class SerializeMe implements Serializable {&lt;br /&gt;   private static final long serialVersionUID = 1L;&lt;br /&gt;&lt;br /&gt;   private int data;&lt;br /&gt;&lt;br /&gt;   public SerializeMe (int data) {&lt;br /&gt;       this.data = data;&lt;br /&gt;   }&lt;br /&gt;&lt;br /&gt;   public int getData() {&lt;br /&gt;       return data;&lt;br /&gt;   }&lt;br /&gt;}&lt;br /&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7440397442105335024-5071502228864311806?l=jayasanka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jayasanka.blogspot.com/feeds/5071502228864311806/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7440397442105335024&amp;postID=5071502228864311806' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7440397442105335024/posts/default/5071502228864311806'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7440397442105335024/posts/default/5071502228864311806'/><link rel='alternate' type='text/html' href='http://jayasanka.blogspot.com/2011/04/what-is-serialversionuid.html' title='What is serialVersionUID?'/><author><name>Jayasanka</name><uri>http://www.blogger.com/profile/02280544026487726690</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7440397442105335024.post-8468387980159420906</id><published>2009-02-23T01:07:00.000-08:00</published><updated>2009-02-23T01:16:08.188-08:00</updated><title type='text'>-- Start Telnet feature in Vista --</title><content type='html'>-&gt; Open the Start Bar and search Telnet.&lt;br /&gt;-&gt; If it does not show anything in Programs do the following.&lt;br /&gt;-&gt; Open Control Panel.&lt;br /&gt;-&gt; Click on Programs.&lt;br /&gt;-&gt; Click on Programs and Features.&lt;br /&gt;-&gt; Under that click "Turn Windows features on or off" (left side of the window).&lt;br /&gt;-&gt; Click Continue on the Pop-Up.&lt;br /&gt;-&gt; A Dialog box will show up and it might take a while to populate the list.&lt;br /&gt;-&gt; Go down in Dialog box and look under Tablet PC Optional Components.&lt;br /&gt;-&gt; It will say Telnet Client.&lt;br /&gt;-&gt; Check the box -&gt; then OK. It may take a while.&lt;br /&gt;-&gt; check the telnet in command prompt.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7440397442105335024-8468387980159420906?l=jayasanka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jayasanka.blogspot.com/feeds/8468387980159420906/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7440397442105335024&amp;postID=8468387980159420906' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7440397442105335024/posts/default/8468387980159420906'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7440397442105335024/posts/default/8468387980159420906'/><link rel='alternate' type='text/html' href='http://jayasanka.blogspot.com/2009/02/start-telnet-feature-in-vista.html' title='-- Start Telnet feature in Vista --'/><author><name>Jayasanka</name><uri>http://www.blogger.com/profile/02280544026487726690</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7440397442105335024.post-3464482419062106216</id><published>2008-12-21T10:01:00.000-08:00</published><updated>2008-12-21T10:46:27.501-08:00</updated><title type='text'>-- Are you a Android Developer? --</title><content type='html'>If you going to develop an application using Android (specially hardware dependent&lt;br /&gt;application, just like new protocol for WI-FI or new network application), curren-&lt;br /&gt;tly you must have a mobile phone which is fully support Android OS. &lt;br /&gt;&lt;/br&gt;&lt;br /&gt;There was a Nokia phone and one Motorola phone which is support to Android &lt;br /&gt;partially. Because some Android features doesn't work will on those phones. &lt;br /&gt;That implies only T-Mobile G1 is the solution to such development.&lt;br /&gt;&lt;/br&gt;&lt;br /&gt;Android announce that they are going to issue a phone, for Android developments &lt;br /&gt;and they are call it as a &lt;a href="http://www.google-phone.com/"&gt;Android Dev Phone 1&lt;/a&gt;. &lt;br /&gt;Android Dev Phone 1 is a SIM-unlocked and hardware-unlocked device that is &lt;br /&gt;designed for advanced developers. The device ships with a system image that &lt;br /&gt;is fully compatible with Android 1.0, so you can rely on it when developing &lt;br /&gt;your applications. We can use any SIM in the device and can flash custom &lt;br /&gt;Android builds that will work with the unlocked bootloader.&lt;br /&gt;&lt;br /&gt;The device currently costs $399 (USD) (including free shipping in the US), &lt;br /&gt;and will be available for purchase in 18 international markets, including &lt;br /&gt;the US, UK, Germany, Japan, India, Canada, France, Taiwan, Spain, Australia, Singapore, Switzerland, Netherlands, Austria, Sweden, Finland, Poland, and &lt;br /&gt;Hungary.&lt;br /&gt;&lt;br /&gt;But the problem is, It is only available to registered Android developers; &lt;br /&gt;anyone can register as a developer for a $25 fee.&lt;br /&gt;&lt;br /&gt;following shows the registration link.&lt;br /&gt;&lt;a href"http://market.android.com/publish/signup?pli=1"&gt;market.android.com&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;b&gt;Android phone specification&lt;/b&gt;&lt;br /&gt;&lt;i&gt;Overview&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;Run and debug your Android™ applications directly on a device. Modify and rebuild&lt;br /&gt;the Android operating system, and flash it onto a phone. The Android Dev Phone 1 &lt;br /&gt;is carrier independent, and available for purchase by any developer registered &lt;br /&gt;with Android Market™.&lt;br /&gt;&lt;br /&gt;&lt;i&gt;Development Platform Features&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;   SIM unlocked - Put any SIM in the device&lt;br /&gt;   Hardware unlocked - Rebuild the Android operating system, and load it onto the&lt;br /&gt; device&lt;br /&gt;   Test out your apps on real hardware before publishing them to the world Software&lt;br /&gt; Features&lt;br /&gt;&lt;br /&gt;Real web browsing&lt;br /&gt;   Customizable home screen&lt;br /&gt;   One-touch Google™ Search&lt;br /&gt;   Android Market&lt;br /&gt;   Full-featured Google applications:&lt;br /&gt;   Google Maps™&lt;br /&gt;   Gmail™&lt;br /&gt;   YouTube™&lt;br /&gt;   Google Calendar™&lt;br /&gt;   Google Talk™&lt;br /&gt;   SMS and MMS&lt;br /&gt;   Music player&lt;br /&gt;&lt;br /&gt;Hardware Features&lt;br /&gt;   Touch screen&lt;br /&gt;   Trackball&lt;br /&gt;   3.2 Megapixel camera with auto focus&lt;br /&gt;   Wi-Fi&lt;br /&gt;   Bluetooth v2.0&lt;br /&gt;   Handsfree profile v1.5&lt;br /&gt;   Headset profile v1.0&lt;br /&gt;   3G WCDMA (1700/2100 MHz)&lt;br /&gt;   Quad-band GSM (850/900/1800/1900 MHz)&lt;br /&gt;   GPS-enabled&lt;br /&gt;   QWERTY slider keyboard&lt;br /&gt;   Includes 1GB MicroSD card (Can be replaced with up to 16GB card)&lt;br /&gt;&lt;br /&gt;Included in the box&lt;br /&gt;   HTC Android Dev Phone 1&lt;br /&gt;   USB Cable&lt;br /&gt;   AC Adapter (with US plug)&lt;br /&gt;   Stereo Hands-Free Headset&lt;br /&gt;   Battery&lt;br /&gt;   Getting Starting Guide&lt;br /&gt;   1G Micro SD Card (inserted into Device)&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7440397442105335024-3464482419062106216?l=jayasanka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jayasanka.blogspot.com/feeds/3464482419062106216/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7440397442105335024&amp;postID=3464482419062106216' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7440397442105335024/posts/default/3464482419062106216'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7440397442105335024/posts/default/3464482419062106216'/><link rel='alternate' type='text/html' href='http://jayasanka.blogspot.com/2008/12/are-you-android-developer.html' title='-- Are you a Android Developer? --'/><author><name>Jayasanka</name><uri>http://www.blogger.com/profile/02280544026487726690</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7440397442105335024.post-1315091127253388091</id><published>2008-12-21T09:54:00.000-08:00</published><updated>2008-12-21T10:00:47.994-08:00</updated><title type='text'>-- Google Android --</title><content type='html'>&lt;b&gt;What is Android?&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Android is a software stack + Operating system and middle-ware, for mobile devices. Its provides a SDK for develop a applications on Android using Java language. Now it has a Eclipse plug-in for Android application development.&lt;br /&gt;&lt;br /&gt;&lt;/br&gt;&lt;br /&gt;&lt;b&gt;Why is this so cool&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Android is a full open-source platform for mobile devices. It has a full access to hardware level and free to develop software.&lt;br /&gt;&lt;br /&gt;&lt;/br&gt;&lt;br /&gt;&lt;b&gt;Features&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;    * Application framework enabling reuse and replacement of components&lt;br /&gt;    * Dalvik virtual machine optimized for mobile devices&lt;br /&gt;    * Integrated browser based on the open source WebKit engine&lt;br /&gt;    * Optimized graphics powered by a custom 2D graphics library; 3D graphics based on the OpenGL ES 1.0 specification (hardware acceleration optional)&lt;br /&gt;    * SQLite for structured data storage&lt;br /&gt;    * Media support for common audio, video, and still image formats (MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, GIF)&lt;br /&gt;    * GSM Telephony (hardware dependent)&lt;br /&gt;    * Bluetooth, EDGE, 3G, and WiFi (hardware dependent)&lt;br /&gt;    * Camera, GPS, compass, and accelerometer (hardware dependent)&lt;br /&gt;    * Rich development environment including a device emulator, tools for debugging, memory and performance profiling, and a plugin for the Eclipse IDE&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7440397442105335024-1315091127253388091?l=jayasanka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jayasanka.blogspot.com/feeds/1315091127253388091/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7440397442105335024&amp;postID=1315091127253388091' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7440397442105335024/posts/default/1315091127253388091'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7440397442105335024/posts/default/1315091127253388091'/><link rel='alternate' type='text/html' href='http://jayasanka.blogspot.com/2008/12/google-android.html' title='-- Google Android --'/><author><name>Jayasanka</name><uri>http://www.blogger.com/profile/02280544026487726690</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7440397442105335024.post-2530528359215897090</id><published>2008-10-14T08:44:00.000-07:00</published><updated>2008-10-14T08:59:11.940-07:00</updated><title type='text'>-- What is ICEfaces --</title><content type='html'>CEfaces is a framework, which can be used to create high user interactive web pages. In another words this technology enables to develop and deploy thin-client, REA - Rich Enterprise Application in pure Java.&lt;br /&gt;&lt;br /&gt;Pure Java means... NO JavaScript. Therefore do not need any kind of knowledge about JavaScript. So JEE application development skills can directly apply to these technology.&lt;br /&gt;&lt;br /&gt;The other thing is thin-client... Thin client means, there are no Applets or proprietary browser plug-ins required to run ICEfaces.&lt;br /&gt;And Rich web application environment enables to... smooth, Incremental page updates... that do not require a full page refresh (i.e. need only partial refresh) to view the changes in the application. Only elements, which are changed, need to updated during the render phase.&lt;br /&gt;&lt;br /&gt;And also using ICEfaces, we can develop rapid applications, even within 2/3 months; single developer can develop a fully featured web application. Because these applications are easy to maintains, ustomize and extends... at a very low cost... actually at NO cost...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7440397442105335024-2530528359215897090?l=jayasanka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jayasanka.blogspot.com/feeds/2530528359215897090/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7440397442105335024&amp;postID=2530528359215897090' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7440397442105335024/posts/default/2530528359215897090'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7440397442105335024/posts/default/2530528359215897090'/><link rel='alternate' type='text/html' href='http://jayasanka.blogspot.com/2008/10/what-is-icefaces.html' title='-- What is ICEfaces --'/><author><name>Jayasanka</name><uri>http://www.blogger.com/profile/02280544026487726690</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7440397442105335024.post-4103492834157134825</id><published>2008-07-11T06:52:00.000-07:00</published><updated>2008-07-14T01:48:46.129-07:00</updated><title type='text'>-- Read a Property File --</title><content type='html'>&lt;pre&gt;&lt;br /&gt;&lt;hr/&gt;&lt;br /&gt;--------------------- ERA.properties --------------------&lt;br /&gt;&lt;br /&gt;webapp.name=ERA Admin DashBoard&lt;br /&gt;webapp.version=Version: neo_jsf_ice_with_tree_06&lt;br /&gt;&lt;br /&gt;author.name=Jayasanka Illangarathne&lt;br /&gt;author.url=http://jayasanka.blogspot.com&lt;br /&gt;&lt;br /&gt;company.name=Virtusa Private Ltd:&lt;br /&gt;company.url=http://www.virtusa.com&lt;br /&gt;copyright.year=2008&lt;br /&gt;&lt;br /&gt;dataBase.name=EraDB&lt;br /&gt;server.path=jdbc:sqlserver://localhost:1433&lt;br /&gt;dataBase.uname=sa&lt;br /&gt;dataBase.passwd=jayasanka&lt;br /&gt;&lt;br /&gt;-----------------------------------------------------&lt;br /&gt;&lt;br /&gt;-------------------------java file-------------------&lt;br /&gt;&lt;br /&gt;package com.resource;&lt;br /&gt;&lt;br /&gt;import java.io.FileInputStream;&lt;br /&gt;import java.io.FileOutputStream;&lt;br /&gt;import java.util.Properties;&lt;br /&gt;&lt;br /&gt;public class ERAProperties {&lt;br /&gt;&lt;br /&gt;    public static void main(String[] args) {&lt;br /&gt;&lt;br /&gt;        Properties properties = new Properties();&lt;br /&gt;&lt;br /&gt;        try {&lt;br /&gt;            // load the resource file&lt;br /&gt;            properties.load(new FileInputStream("src/com/resource/ERA.properties"));&lt;br /&gt;            // get a property&lt;br /&gt;            String name = properties.getProperty("author.name");&lt;br /&gt;            System.out.println(name);&lt;br /&gt;            // set a property&lt;br /&gt;            properties.setProperty("b'day", "04-02-1984");&lt;br /&gt;&lt;br /&gt;            // Write properties file.&lt;br /&gt;            properties.store(new FileOutputStream("src/com/resource /ERA.properties"), null);&lt;br /&gt;&lt;br /&gt;        } catch (Exception e) {&lt;br /&gt;            e.printStackTrace();&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;NOTE: &lt;br /&gt;   if you are using web-base project, put these property files in to /WEB-INF/classes/ folder &lt;br /&gt;and replace property.load(....) statement with following.&lt;br /&gt;&lt;br /&gt;properties.load(Thread.currentThread().getContextClassLoader()&lt;br /&gt;                    .getResourceAsStream("ERA.properties"));&lt;br /&gt;&lt;br /&gt;-----------------------------------------------------------&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7440397442105335024-4103492834157134825?l=jayasanka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jayasanka.blogspot.com/feeds/4103492834157134825/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7440397442105335024&amp;postID=4103492834157134825' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7440397442105335024/posts/default/4103492834157134825'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7440397442105335024/posts/default/4103492834157134825'/><link rel='alternate' type='text/html' href='http://jayasanka.blogspot.com/2008/07/read-property-file.html' title='-- Read a Property File --'/><author><name>Jayasanka</name><uri>http://www.blogger.com/profile/02280544026487726690</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7440397442105335024.post-5202216141993158004</id><published>2008-07-02T21:31:00.000-07:00</published><updated>2008-07-03T00:17:41.569-07:00</updated><title type='text'>-- Spring Framework --</title><content type='html'>&lt;hr /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;   -&gt; backGround&lt;br /&gt;       - Spring is an open-source framework, created by Rod Johnson and described in his book &lt;br /&gt;         Expert One-on-One: J2EE Design and Development.&lt;br /&gt;       - Spring is a lightweight inversion of control and aspect-oriented container framework.&lt;br /&gt;&lt;br /&gt;  -&gt; Spring is a development style like J2EE EJB.But solve some limitations of EJB&lt;br /&gt;&lt;br /&gt;     -&gt; problem: in EJB, has to write several classes to make a component. such as the home &lt;br /&gt;         interface,the local interface,and the bean itself. &lt;br /&gt;         in addition has to create a deployment descriptor for the bean.&lt;br /&gt;&lt;br /&gt;     -&gt; solution: incorporates XDoclet&lt;br /&gt;         XDoclet is a code generation tool that can generate all of the necessary EJB files &lt;br /&gt;         from a single source file.&lt;br /&gt;    &lt;br /&gt;     -&gt; Problem: when testing, have to fire up the container in each test and each change of &lt;br /&gt;         the code. It is a waisting time, the development lifecycle will add a "waitting" phase.&lt;br /&gt;         (code -&gt; wait -&gt; test).&lt;br /&gt;&lt;br /&gt;     -&gt; solution: using light waight container without any unnessasory things. &lt;br /&gt;         Because in J2EE containers have all transaction managment + remoting or security- &lt;br /&gt;         services + persistence services.&lt;br /&gt;         coz enterprise projects do not have this level of complexity at all.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;  -&gt; With EJB, application complexity is high, regardless of the complexity of the problem.&lt;br /&gt;     Even simple applications are unduly complex. With Spring, the complexity of application &lt;br /&gt;     is proportional to the complexity of the problem being solved. &lt;br /&gt;&lt;br /&gt;  -&gt; Spring was designed with following beliefs. &lt;br /&gt;&lt;br /&gt;     * Good design is more important than the underlying technology.&lt;br /&gt;&lt;br /&gt;   -&gt; spring reduse the complexity,and remove unnessasory functinalities.(ie- If an &lt;br /&gt;             application does not require distribution or declarative transaction support). &lt;br /&gt;             and easy to work with POJO instaed of EJBs. And you don't need an EJB container,&lt;br /&gt;             and don't have to implement special interfaces. You just have to write your code.&lt;br /&gt;&lt;br /&gt;     * JavaBeans loosely coupled through interfaces is a good model.&lt;br /&gt;&lt;br /&gt;   -&gt; EJBs are used to provide application services, but they not just depend on the &lt;br /&gt;             EJB business interface. They are also responsible for retrieving these EJB &lt;br /&gt;             objects from a directory- Java Naming and Directory Interface (JNDI) lookup and &lt;br /&gt;             communicating with the bean's EJBHome interface. This is not decoupling a &lt;br /&gt;             application. &lt;br /&gt;                 With Spring, your beans depend on collaborators through interfaces. Since &lt;br /&gt;             there are no implementation-specific dependencies, Spring applications are very &lt;br /&gt;             decoupled, testable, and easier to maintain. And because the Spring container&lt;br /&gt;             is responsible for resolving the dependencies, the active service lookup that &lt;br /&gt;             is involved in EJB is now out of the picture and the cost of programming to &lt;br /&gt;             interfaces is minimized. All you need to do is create classes that communicate &lt;br /&gt;             with each other through interfaces, and Spring takes care of the rest.&lt;br /&gt;&lt;br /&gt;     * Code should be easy to test.&lt;br /&gt;&lt;br /&gt;   -&gt; Spring applications with JavaBeans, testing is cheap (coz testing is on POJO).&lt;br /&gt;             therefore no beed a container. since Spring makes coding to interfaces easy, &lt;br /&gt;             your objects will be loosely coupled, making testing even easier. &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;  -&gt; charecteristics of Spring?&lt;br /&gt;&lt;br /&gt;    * Lightweight—&lt;br /&gt;        - The entire Spring framework can be distributed in a single JAR file(just over 1 MB). &lt;br /&gt;        - And the processing overhead required by Spring is negligible. &lt;br /&gt;        - Spring is nonintrusive: &lt;br /&gt;            objects in a Spring-enabls no dependencies on Spring-specific classes.&lt;br /&gt;&lt;br /&gt;    * Inversion of control—&lt;br /&gt;        - Spring promotes loose coupling through a technique.(ie-inversion of control (IoC)). &lt;br /&gt;          When IoC is applied, objects are passively given their dependencies instead of &lt;br /&gt;          creating or looking for dependent objects for themselves.&lt;br /&gt;            ( IoC as JNDI in reverse—instead of an object looking up dependencies from a &lt;br /&gt;            container,the container gives the dependencies to the object at instantiation &lt;br /&gt;            without waiting to be asked.)&lt;br /&gt;&lt;br /&gt;    * Aspect-oriented—&lt;br /&gt;        - AOP enables cohesive development by separating  busines logic from system services &lt;br /&gt;          (ie. auditing and transaction management).separate system functions from the objects.&lt;br /&gt;&lt;br /&gt;    * Container—&lt;br /&gt;        - Spring is a container in the sense that it contains and manages the life cycle &lt;br /&gt;          and configuration of application objects. &lt;br /&gt;          &lt;br /&gt;    * Framework—&lt;br /&gt;        - Spring makes it possible to configure and compose complex applications from &lt;br /&gt;          simpler components. &lt;br /&gt;        - In Spring, application objects are composed declaratively, typically in an XML file. &lt;br /&gt;        - Spring also provides much infrastructure functionality (transaction management, &lt;br /&gt;          persistence framework integration, etc.).&lt;br /&gt;&lt;br /&gt;  -&gt; Spring modules(made up of 7 modules)&lt;br /&gt;  &lt;br /&gt;   &lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_d50O-vhPiKA/SGxasIbBpKI/AAAAAAAAAA4/km7VCs0vC2U/s1600-h/spring.bmp"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;" src="http://4.bp.blogspot.com/_d50O-vhPiKA/SGxasIbBpKI/AAAAAAAAAA4/km7VCs0vC2U/s320/spring.bmp" border="0" alt=""id="BLOGGER_PHOTO_ID_5218645782437143714" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;   -&gt; The core container&lt;br /&gt;        - provides the fundamental functionality of &lt;br /&gt;          the Spring framework.(Spring's BeanFactory)&lt;br /&gt;        - A BeanFactory is an implementation of the &lt;br /&gt;          factory pattern that applies IoC to &lt;br /&gt;          separate your application's configuration &lt;br /&gt;          and dependency specifications from the &lt;br /&gt;          actual application code.&lt;br /&gt;   &lt;br /&gt;    -&gt; Application context module&lt;br /&gt;        - make a framework 4 Spring.&lt;br /&gt;        - This module extends the concept of "BeanFactory", adding support for &lt;br /&gt;          internationalization (I18N) messages, application life cycle events, and validation.&lt;br /&gt;        - and supplies many enterprise services such as e-mail, JNDI access, EJB integration, &lt;br /&gt;          remoting, and scheduling.&lt;br /&gt;        - and also supports templating frameworks such as Velocity and FreeMarker.&lt;br /&gt;&lt;br /&gt;    -&gt; Spring's AOP module&lt;br /&gt;        - used to develop aspects for Spring-enabled application. &lt;br /&gt;        - able to work with AOP Alliance(The AOP Alliance is an open-source project)&lt;br /&gt;        - also introduces metadata programming to Spring. &lt;br /&gt;          (metadata support -  add annotations and instruct Spring on where and how to &lt;br /&gt;          apply aspects).&lt;br /&gt;&lt;br /&gt;    -&gt; JDBC abstraction and the DAO module&lt;br /&gt;        - pring's JDBC and Data Access Objects (DAO) module abstracts away the boilerplate code &lt;br /&gt;          to keep your database code clean and simple.&lt;br /&gt;&lt;br /&gt;    -&gt; Object/relational mapping integration module&lt;br /&gt;        - provide hooks into several popular ORM frameworks such as Hibernate, JDO, &lt;br /&gt;          and iBATIS SQL Maps.&lt;br /&gt;&lt;br /&gt;    -&gt; Spring's web module&lt;br /&gt;        - this builds on the application context module, providing a context that is &lt;br /&gt;          appropriate for web-based applications.&lt;br /&gt;        - and provide web-oriented tasks such as transparently handling multipart requests for &lt;br /&gt;          file uploads and programmatic binding of request parameters to your business objects.&lt;br /&gt;&lt;br /&gt;    -&gt; The Spring MVC framework&lt;br /&gt;        -&gt; Spring comes with a full-featured Model/View/Controller (MVC) framework.&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7440397442105335024-5202216141993158004?l=jayasanka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jayasanka.blogspot.com/feeds/5202216141993158004/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7440397442105335024&amp;postID=5202216141993158004' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7440397442105335024/posts/default/5202216141993158004'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7440397442105335024/posts/default/5202216141993158004'/><link rel='alternate' type='text/html' href='http://jayasanka.blogspot.com/2008/07/spring-framework.html' title='-- Spring Framework --'/><author><name>Jayasanka</name><uri>http://www.blogger.com/profile/02280544026487726690</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_d50O-vhPiKA/SGxasIbBpKI/AAAAAAAAAA4/km7VCs0vC2U/s72-c/spring.bmp' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7440397442105335024.post-8340672592806238919</id><published>2008-07-01T00:04:00.000-07:00</published><updated>2008-07-01T00:12:58.029-07:00</updated><title type='text'>-- Send Mails --</title><content type='html'>&lt;hr&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;To implement the mail function u must download the javaMail.jar file,&lt;br&gt; and include it to ur lib folder.&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;package com.neo.mail;&lt;br /&gt;&lt;br /&gt;import java.util.Properties;&lt;br /&gt;import javax.mail.*;&lt;br /&gt;import javax.mail.internet.*;&lt;br /&gt;&lt;br /&gt;public class AdminMail {&lt;br /&gt;&lt;br /&gt; public void postMail( String recipients[ ], String subject, String message , String from) throws MessagingException&lt;br /&gt; {&lt;br /&gt;     boolean debug = false;&lt;br /&gt;&lt;br /&gt;      //Set the host smtp address&lt;br /&gt;      Properties props = new Properties();&lt;br /&gt;      &lt;br /&gt;      props.put("mail.smtp.host", "mailsvr");&lt;br /&gt;&lt;br /&gt;     // create some properties and get the default Session&lt;br /&gt;     Session session = Session.getDefaultInstance(props, null);&lt;br /&gt;     session.setDebug(debug);&lt;br /&gt;&lt;br /&gt;     // create a message&lt;br /&gt;     Message msg = new MimeMessage(session);&lt;br /&gt;&lt;br /&gt;     // set the from and to address&lt;br /&gt;     InternetAddress addressFrom = new InternetAddress(from);&lt;br /&gt;     msg.setFrom(addressFrom);&lt;br /&gt;&lt;br /&gt;     InternetAddress[] addressTo = new InternetAddress[recipients.length]; &lt;br /&gt;     for (int i = 0; i &lt; recipients.length; i++)&lt;br /&gt;     {&lt;br /&gt;         addressTo[i] = new InternetAddress(recipients[i]);&lt;br /&gt;     }&lt;br /&gt;     msg.setRecipients(Message.RecipientType.TO, addressTo);&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;     // Optional : You can also set your custom headers in the Email if you Want&lt;br /&gt;     msg.addHeader("MyHeaderName", "myHeaderValue");&lt;br /&gt;&lt;br /&gt;     // Setting the Subject and Content Type&lt;br /&gt;     msg.setSubject(subject);&lt;br /&gt;     msg.setContent(message, "text/plain");&lt;br /&gt;     Transport.send(msg);&lt;br /&gt; }&lt;br /&gt; &lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7440397442105335024-8340672592806238919?l=jayasanka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jayasanka.blogspot.com/feeds/8340672592806238919/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7440397442105335024&amp;postID=8340672592806238919' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7440397442105335024/posts/default/8340672592806238919'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7440397442105335024/posts/default/8340672592806238919'/><link rel='alternate' type='text/html' href='http://jayasanka.blogspot.com/2008/07/send-mails.html' title='-- Send Mails --'/><author><name>Jayasanka</name><uri>http://www.blogger.com/profile/02280544026487726690</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7440397442105335024.post-3026006625816215603</id><published>2008-06-30T02:23:00.000-07:00</published><updated>2008-07-01T00:14:33.288-07:00</updated><title type='text'>-- How to Schedule a Task --</title><content type='html'>&lt;hr&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;In some application some tasks need to be run periodically for example GUI screen should update the data from server periodically.&lt;br /&gt;This java tips illustrate a method of scheduling a task periodically. Developers may use it for repetitive invoking of a method as per their requirements.&lt;br /&gt;For this aim, first you have to make a class extending TimerTask abstract class and write code in run method, you want to run repetitively.&lt;br /&gt;&lt;br /&gt;import java.util.TimerTask;&lt;br /&gt;&lt;br /&gt;public class Shedule extends TimerTask{&lt;br /&gt;  public void run() {&lt;br /&gt;    // add the task here&lt;br /&gt;  }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;In your main program you can call this code to schedule task:&lt;br /&gt;&lt;br /&gt;    java.util.Timer timer = new java.util.Timer();&lt;br /&gt;&lt;br /&gt;    Calendar date = Calendar.getInstance();&lt;br /&gt;    date.set(Calendar.DAY_OF_WEEK, Calendar.SUNDAY);&lt;br /&gt;    date.set(Calendar.HOUR, 0);&lt;br /&gt;    date.set(Calendar.MINUTE, 0);&lt;br /&gt;    date.set(Calendar.SECOND, 0);&lt;br /&gt;    date.set(Calendar.MILLISECOND, 0);&lt;br /&gt;&lt;br /&gt;    //sheduler run now&lt;br /&gt;    //timer.schedule(new Shedule(), 0, 60 * 60);&lt;br /&gt;    // Schedule to run every Sunday in midnight&lt;br /&gt;    timer.schedule(new Shedule(), date.getTime(), 1000 * 60 * 60 * 24 * 7);&lt;br /&gt;&lt;br /&gt;Now the task will repeat after the fixed time interval.&lt;br /&gt;&lt;br /&gt;more ref;&lt;br /&gt;  --&gt; &lt;a href="http://www.developer.com/java/other/article.php/3564211"&gt;http://www.developer.com/java/other/article.php/3564211&lt;/a&gt;&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7440397442105335024-3026006625816215603?l=jayasanka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jayasanka.blogspot.com/feeds/3026006625816215603/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7440397442105335024&amp;postID=3026006625816215603' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7440397442105335024/posts/default/3026006625816215603'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7440397442105335024/posts/default/3026006625816215603'/><link rel='alternate' type='text/html' href='http://jayasanka.blogspot.com/2008/06/how-to-schedule-task-java.html' title='-- How to Schedule a Task --'/><author><name>Jayasanka</name><uri>http://www.blogger.com/profile/02280544026487726690</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7440397442105335024.post-9206478247466483761</id><published>2008-06-30T02:16:00.000-07:00</published><updated>2008-07-01T00:15:12.351-07:00</updated><title type='text'>-- Encode a URL --</title><content type='html'>&lt;hr&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;import java.net.MalformedURLException;&lt;br /&gt;import java.net.URI;&lt;br /&gt;import java.net.URISyntaxException;&lt;br /&gt;&lt;br /&gt;public final class TestURLEncode{&lt;br /&gt;&lt;br /&gt;    public static void main( String[] args ) throws URISyntaxException, MalformedURLException{&lt;br /&gt;&lt;br /&gt;        // reserved chars that are not escaped in URLs include:&lt;br /&gt;        // ; / ? : @ &amp; = + $ ,&lt;br /&gt;&lt;br /&gt;        URI uri = new URI( "http", "//www.example.com/you &amp; I 10%? weird &amp; weirder neé", null );&lt;br /&gt;        System.out.println( uri.toURL().toString() );&lt;br /&gt;&lt;br /&gt;        // prints http://www.example.com/you%20&amp;%20I%2010%25?%20wierd%20&amp;%20wierder%20neé&lt;br /&gt;        // note how it fails to encode é&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7440397442105335024-9206478247466483761?l=jayasanka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jayasanka.blogspot.com/feeds/9206478247466483761/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7440397442105335024&amp;postID=9206478247466483761' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7440397442105335024/posts/default/9206478247466483761'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7440397442105335024/posts/default/9206478247466483761'/><link rel='alternate' type='text/html' href='http://jayasanka.blogspot.com/2008/06/encode-url.html' title='-- Encode a URL --'/><author><name>Jayasanka</name><uri>http://www.blogger.com/profile/02280544026487726690</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7440397442105335024.post-3909088553562168239</id><published>2008-06-30T01:40:00.000-07:00</published><updated>2008-07-01T00:58:51.487-07:00</updated><title type='text'>-- Velosity Templates --</title><content type='html'>&lt;hr&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;br /&gt;Velosity Engine:&lt;br /&gt;&lt;br /&gt;  -&gt; Velocity is an open source templating tool developed by an international &lt;br /&gt;     volunteer community and hosted by the Apache Software Foundation's &lt;br /&gt;     Jakarta Project&lt;br /&gt;&lt;br /&gt;  -&gt; It's free and the source code is available under the Apache Software License, &lt;br /&gt;     a business-friendly open source license&lt;br /&gt;&lt;br /&gt;  -&gt; language - Velocity Template Language (VTL).&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;  -&gt; any Aplication using Velosity requires &lt;br /&gt;      -&gt; 1.0 Template&lt;br /&gt;      -&gt; 2.0 Corresponding java programme&lt;br /&gt;&lt;br /&gt;-------------template------------------------&lt;br /&gt;&lt;br /&gt;Hello $name! Welcome to Velosity!&lt;br /&gt;&lt;br /&gt;-------------java programme------------------&lt;br /&gt;&lt;br /&gt;import java.io.StringWriter;&lt;br /&gt;import org.apache.velocity.app.VelocityEngine;&lt;br /&gt;import org.apache.velocity.Template;&lt;br /&gt;import org.apache.velocity.VelocityContext;&lt;br /&gt;&lt;br /&gt;public class HelloWorld{&lt;br /&gt;&lt;br /&gt;  PSVM throws Exception{&lt;br /&gt;&lt;br /&gt;    VelocityEngine ve=new VelocityEngine();&lt;br /&gt;    ve.init();&lt;br /&gt;&lt;br /&gt;    Template t=ve.getTemplate("src/com/neo/..../myvelocity/helloworld.vm");&lt;br /&gt;    &lt;br /&gt;    VelocityContext context=new VelocityContext();&lt;br /&gt;    context.put("name","world");&lt;br /&gt;&lt;br /&gt;    StirngWriter writer=new StringWriter();&lt;br /&gt;    t.merge(context,writer);&lt;br /&gt;&lt;br /&gt;    System.out.println(writer.toString());&lt;br /&gt;  }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;----------------------------------------------&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;  -&gt; Why use Velocity templates??&lt;br /&gt;&lt;br /&gt;     -&gt; this useful in any application area that requires data formatting and presentation.&lt;br /&gt;&lt;br /&gt;        -&gt; it adapts to meny application areas and application environments (servlet...etc).&lt;br /&gt;        -&gt; simple &amp; clear syntax 4 the template desiners.&lt;br /&gt;        -&gt; simple programming model 4 developers.&lt;br /&gt;        -&gt; develop and maintain easily coz separate the logic and presentation &lt;br /&gt;        -&gt; Velocity enables templates to access any public method of data objects in the context.&lt;br /&gt;&lt;br /&gt;              i.e. Can reuse your existing classes. So, objects you want to use in your templates &lt;br /&gt;              don't need to be structured in a certain way, like JavaBeans, or &lt;br /&gt;              implement special I/O or lifecycle modes, such as JSP (JavaServer Pages) taglibs. &lt;br /&gt;              The only requirement is that methods are public.&lt;br /&gt;        &lt;br /&gt;        -&gt; Therefore it shows MVC architecture. Velocity is used to manipulate and present the data&lt;br /&gt;           Not to create data.&lt;br /&gt;        -&gt; can be used in &lt;br /&gt;            -&gt; Servlet Base Web applications&lt;br /&gt;            -&gt; Java and SQL code genarations&lt;br /&gt;            -&gt; XML processing and transaction&lt;br /&gt;            -&gt; Text processing (such as RTF file genaration)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;  -&gt; Velocity Template Language&lt;br /&gt;      -&gt; references:&lt;br /&gt;         -&gt; accessing the object in the context&lt;br /&gt;         -&gt; freely mix with the template's non-VTL contents.&lt;br /&gt;         -&gt; use "$" to refer context data. if not such data in context, treat as a text and render. &lt;br /&gt;         -&gt; Velocity reference allows access to any object's public method&lt;br /&gt;&lt;br /&gt;-----------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;   There are $myBean.getSize() elements.&lt;br /&gt;&lt;br /&gt;   $myObject.anotherMethod( 1, "more data ")&lt;br /&gt;   &lt;br /&gt;   $foo.getBar().barMethod("hello", $moredata )&lt;br /&gt;   &lt;br /&gt;   $foo.myMethod( $bar.callThis() )&lt;br /&gt;&lt;br /&gt;-----------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;          -&gt; Velocity worke as java bean (i.e. can access getter and setter as properties)&lt;br /&gt;              -&gt; $pet.name for only $pet.price and $pet.get('name') for only $pet.get('price') are same.&lt;br /&gt;&lt;br /&gt;      -&gt; directives:&lt;br /&gt;         -&gt; set of statements used for controle and action&lt;br /&gt;            -&gt; #set() - used to set a reference value within the template. can replace the existing object&lt;br /&gt;                        in the context or establish a new one. And can commaon math operations on integers and booleans&lt;br /&gt;               &lt;br /&gt;     #set( $startrow = 0)&lt;br /&gt;         #set( $count = $current + 1 )&lt;br /&gt;         #set( $isReady = ( $isOn &amp;&amp; $isOpen) )&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;            -&gt; #if() , #else , #elseif() , #end &lt;br /&gt;&lt;br /&gt;      #if( $value &gt; 5 )&lt;br /&gt;         bigger&lt;br /&gt;          #elseif( $value &lt; 5 )&lt;br /&gt;         smaller&lt;br /&gt;                    #else&lt;br /&gt;         just right&lt;br /&gt;           #end&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;     -&gt; #foreach() , #end()&lt;br /&gt;&lt;br /&gt;      #foreach( $item in $itemList )&lt;br /&gt;           My $item.&lt;br /&gt;          #end&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;     -&gt; #inclde() and #parse()&lt;br /&gt;&lt;br /&gt;  -&gt; The #include() and #parse() directives are similar.&lt;br /&gt;   -&gt; take a template or static resource name as an argument.&lt;br /&gt;  -&gt; The difference is that #include() includes the specified resource's content &lt;br /&gt;                   without any processing, and #parse() treats the specified resource as a template, &lt;br /&gt;                   processing all directives and references against the current context. (in dynamically)&lt;br /&gt;&lt;br /&gt;   #include("disclaimer.txt")&lt;br /&gt;&lt;br /&gt;   #parse("header.vm")&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;     -&gt; #macro()&lt;br /&gt;&lt;br /&gt;  -&gt; lets the designer create a parameterized bit of VTL code, called a Velocimacro, &lt;br /&gt;                   that can be invoked like a directive. Similar to a subroutine, this feature lets you &lt;br /&gt;                   create reusable pieces of VTL that contain explicit parameters for easier usage, &lt;br /&gt;                   readability, and maintenance. Velocimacro is a rich and powerful tool,&lt;br /&gt;                -&gt; Suppose you want to encapsulate the VTL that designers use to make HTML &amp;lt; select gt; widgets. &lt;br /&gt;                   You would define a Velocimacro in regular VTL code:&lt;br /&gt;&lt;br /&gt;   #macro( select $name $displayname $choicelist )&lt;br /&gt;         &amp;lt;SELECT name=$name&amp;gt;&lt;br /&gt;         &amp;lt;option value=""&amp;gt;$displayname&amp;lt;/option&amp;gt;&lt;br /&gt;         #foreach( $choice in $choicelist )&lt;br /&gt;              &amp;lt;option value=$choice&amp;gt;$choice&amp;lt;/option&amp;gt;&lt;br /&gt;         #end&lt;br /&gt;         &amp;lt;/select&amp;gt;&lt;br /&gt;     #end&lt;br /&gt;&lt;br /&gt;          &lt;br /&gt;   Then, anytime you need an HTML &amp;lt;select&amp;gt; widget, you could simply invoke &lt;br /&gt;                        the Velocimacro as a directive:&lt;br /&gt;    &lt;br /&gt;   Please choose:  #select( "size" "--SIZE--" $sizelist )&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;      -&gt; other VTL def's&lt;br /&gt;&lt;br /&gt;   #set( $myint = 5 )     // assign a integer&lt;br /&gt;   #set( $mystring = 'Hello There')     // assign a string&lt;br /&gt;   #set( $mybool = true )     // assign a boolean&lt;br /&gt;   #set( $objarr = [ "a", $myint, $mystring, false ] )   // assign arrays of object&lt;br /&gt;   #set( $intrangearr = [1..10] )    // assign sequencial integers&lt;br /&gt;&lt;br /&gt;   #set( $foo = 'bar')&lt;br /&gt;   #set( $interp = "The value is '$foo'")   // to use variable inside the stirng&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;  -&gt; Same data deferent temolates:&lt;br /&gt;&lt;br /&gt;-------------------html---------------------------------&lt;br /&gt;&lt;br /&gt;  &amp;lt;HTML&amp;gt;&lt;br /&gt;    &amp;lt;HEAD&amp;gt;&lt;br /&gt;      &amp;lt;TITLE&amp;gt;Pet Store Sale!&amp;lt;/TITLE&amp;gt;&lt;br /&gt;    &amp;lt;/HEAD&amp;gt;&lt;br /&gt;    &amp;lt;BODY&amp;gt;&lt;br /&gt;      &amp;lt;CENTER&amp;gt;&lt;br /&gt;      &amp;lt;B&amp;gt;$petList.size() Pets on Sale!&amp;lt;/B&amp;gt;&lt;br /&gt;      &amp;lt;BR/&amp;gt;&lt;br /&gt;      We are proud to offer these fine pets&lt;br /&gt;      at these amazing prices.  &lt;br /&gt;      &amp;lt;BR/&amp;gt;&lt;br /&gt;      This month only, choose from:&lt;br /&gt;      #set( $count = 1 )  &lt;br /&gt;      &amp;lt;TABLE&amp;gt;&lt;br /&gt;        #foreach( $pet in $petList )&lt;br /&gt;          &amp;lt;TR&amp;gt;&lt;br /&gt;            &amp;lt;TD&amp;gt;$count)&amp;lt;/TD&amp;gt;&lt;br /&gt;            &amp;lt;TD&amp;gt;$pet.name&amp;lt;/TD&amp;gt;&lt;br /&gt;            &amp;lt;TD&amp;gt;$pet.price&amp;lt;/TD&amp;gt;&lt;br /&gt;          &amp;lt;/TR&amp;gt;&lt;br /&gt;          #set( $count = $count + 1 )&lt;br /&gt;        #end&lt;br /&gt;      &amp;lt;/TABLE&amp;gt;&lt;br /&gt;      &amp;lt;BR/&amp;gt;&lt;br /&gt;      &amp;lt;I&amp;gt;Call Today!&amp;lt;/I&amp;gt;&lt;br /&gt;      &amp;lt;/CENTER&amp;gt;&lt;br /&gt;    &amp;lt;/BODY&amp;gt;&lt;br /&gt;  &amp;lt;/HTML&amp;gt;&lt;br /&gt;&lt;br /&gt;---------------------xml-----------------------------&lt;br /&gt;&lt;br /&gt;  &amp;lt;?xml version="1.0"?&amp;gt;&lt;br /&gt;  &amp;lt;salelist&amp;gt;&lt;br /&gt;  #foreach( $pet in $petList )&lt;br /&gt;    &amp;lt;pet&amp;gt;&lt;br /&gt;      &amp;lt;name&amp;gt;$pet.name&amp;lt;/name&amp;gt;&lt;br /&gt;      &amp;lt;price&amp;lt;$pet.price&amp;lt;/price&amp;gt;&lt;br /&gt;    &amp;lt;/pet&amp;gt;&lt;br /&gt;  #end&lt;br /&gt;  &amp;lt;/salelist&amp;gt;&lt;br /&gt;&lt;br /&gt;----------------------servlet-------------------------------&lt;br /&gt;&lt;br /&gt;import java.util.List;&lt;br /&gt;import java.util.ArrayList;&lt;br /&gt;import java.util.Map;&lt;br /&gt;import java.util.HashMap;&lt;br /&gt;import javax.servlet.http.HttpServletRequest;&lt;br /&gt;import javax.servlet.http.HttpServletResponse;&lt;br /&gt;import org.apache.velocity.Template;&lt;br /&gt;import org.apache.velocity.context.Context;&lt;br /&gt;import org.apache.velocity.servlet.VelocityServlet;&lt;br /&gt;import org.apache.velocity.exception.ResourceNotFoundException;&lt;br /&gt;import org.apache.velocity.exception.ParseErrorException;&lt;br /&gt;public class Sample extends VelocityServlet{&lt;br /&gt;&lt;br /&gt;    public Template handleRequest( HttpServletRequest request, &lt;br /&gt;         HttpServletResponse response, Context context ){        &lt;br /&gt;&lt;br /&gt;        ArrayList list = new ArrayList();&lt;br /&gt;        Map map = new HashMap();&lt;br /&gt;        map.put("name", "horse");&lt;br /&gt;        map.put("price", "00.00");&lt;br /&gt;        list.add( map );&lt;br /&gt; &lt;br /&gt;        map = new HashMap();&lt;br /&gt;        map.put("name", "dog");&lt;br /&gt;        map.put("price", "9.99");&lt;br /&gt;        list.add( map );&lt;br /&gt;        map = new HashMap();&lt;br /&gt;        map.put("name", "bear");&lt;br /&gt;        map.put("price", ".99");&lt;br /&gt;        list.add( map );&lt;br /&gt;&lt;br /&gt;        context.put("petList", list);        &lt;br /&gt;&lt;br /&gt;        Template template = null;&lt;br /&gt;      &lt;br /&gt;        try&lt;br /&gt;        {&lt;br /&gt;            template =  getTemplate("petstoreemail.vm");&lt;br /&gt;        }&lt;br /&gt;        catch( Exception e )&lt;br /&gt;        {&lt;br /&gt;            System.out.println("Error " + e);&lt;br /&gt;        }&lt;br /&gt;        return template;&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;------------------------------------------------------&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7440397442105335024-3909088553562168239?l=jayasanka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jayasanka.blogspot.com/feeds/3909088553562168239/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7440397442105335024&amp;postID=3909088553562168239' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7440397442105335024/posts/default/3909088553562168239'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7440397442105335024/posts/default/3909088553562168239'/><link rel='alternate' type='text/html' href='http://jayasanka.blogspot.com/2008/06/velosity-templates.html' title='-- Velosity Templates --'/><author><name>Jayasanka</name><uri>http://www.blogger.com/profile/02280544026487726690</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7440397442105335024.post-4703898985123975837</id><published>2008-03-12T23:33:00.000-07:00</published><updated>2008-07-01T00:58:12.607-07:00</updated><title type='text'>How to Connect DataBase to Java Application -JDBC</title><content type='html'>&lt;hr&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;import java.sql.Connection;&lt;br /&gt;import java.sql.DriverManager;&lt;br /&gt;import java.sql.ResultSet;&lt;br /&gt;import java.sql.SQLException;&lt;br /&gt;import java.sql.Statement;&lt;br /&gt;&lt;br /&gt;public class db {&lt;br /&gt;  public static void main(String[] args){&lt;br /&gt;     try {&lt;br /&gt;        Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");&lt;br /&gt;        Connection conn = DriverManager.getConnection("jdbc:odbc:&lt;span style="font-weight: bold; color: rgb(102, 255, 153);"&gt;mydb&lt;/span&gt;");&lt;br /&gt;        Statement stmt = conn.createStatement();&lt;br /&gt;        ResultSet results = stmt.executeQuery("SELECT * FROM &lt;span style="font-weight: bold; color: rgb(51, 255, 51);"&gt;student&lt;/span&gt;");&lt;br /&gt;     &lt;br /&gt;        while(results.next()){&lt;br /&gt;                  System.out.println(results.getString("SName"));&lt;br /&gt;                      }&lt;br /&gt;     } catch (ClassNotFoundException e) {&lt;br /&gt;                e.printStackTrace();&lt;br /&gt;     } catch (SQLException e) {&lt;br /&gt;                e.printStackTrace();&lt;br /&gt;     }&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7440397442105335024-4703898985123975837?l=jayasanka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jayasanka.blogspot.com/feeds/4703898985123975837/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7440397442105335024&amp;postID=4703898985123975837' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7440397442105335024/posts/default/4703898985123975837'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7440397442105335024/posts/default/4703898985123975837'/><link rel='alternate' type='text/html' href='http://jayasanka.blogspot.com/2008/03/how-to-connect-database-to-java.html' title='How to Connect DataBase to Java Application -JDBC'/><author><name>Jayasanka</name><uri>http://www.blogger.com/profile/02280544026487726690</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7440397442105335024.post-5186677245580298453</id><published>2008-02-27T04:58:00.000-08:00</published><updated>2008-07-01T00:59:05.362-07:00</updated><title type='text'>What is Thin client ---in J2EE</title><content type='html'>&lt;hr&gt;&lt;br /&gt;In J2EE&lt;br /&gt;&lt;ul&gt;&lt;li&gt;thin client is a client who do not query databases, execute large functions&lt;/li&gt;&lt;li&gt;just like JSP, heavy part of the  system  will execute using Servlet&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7440397442105335024-5186677245580298453?l=jayasanka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jayasanka.blogspot.com/feeds/5186677245580298453/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7440397442105335024&amp;postID=5186677245580298453' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7440397442105335024/posts/default/5186677245580298453'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7440397442105335024/posts/default/5186677245580298453'/><link rel='alternate' type='text/html' href='http://jayasanka.blogspot.com/2008/02/what-is-thin-client-in-j2ee.html' title='What is Thin client ---in J2EE'/><author><name>Jayasanka</name><uri>http://www.blogger.com/profile/02280544026487726690</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7440397442105335024.post-5070862605710777071</id><published>2008-02-27T01:43:00.000-08:00</published><updated>2008-07-01T00:59:35.626-07:00</updated><title type='text'>Aspect-Oriented Programming</title><content type='html'>&lt;hr&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;p class="ListParagraphCxSpFirst" style="margin-left: 0in;"&gt;What is AOP ?????&lt;/p&gt;  &lt;ul&gt;&lt;li&gt;Aspect-Oriented Programming (AOP) complements OO programming by allowing the developer to dynamically modify the static OO model to create a system that can grow to meet new requirements. ….&lt;/li&gt;&lt;/ul&gt;&lt;p class="ListParagraphCxSpLast" style="margin-left: 0in;"&gt;          Just as objects in the real world can change their states during their lifecycles, an application            can adopt new characteristics as it develops.&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;span class="body"&gt;Using an AOP language (such as AspectJ) or libraries (such as Spring), programmers can code this functionality once and then define where to weave it into existing                              Ex:                                                                                                                                        &lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;span class="body"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="body"&gt;public class First{&lt;/span&gt;&lt;br /&gt;&lt;span class="body"&gt;   public void method(String s){&lt;br /&gt;Logger.sign_in();&lt;br /&gt;// Business logic  ---&gt;  AAA&lt;br /&gt;Logger.sign_out();&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="body"&gt; public class Second{&lt;/span&gt;&lt;br /&gt;&lt;span class="body"&gt;   public void function(Object o){&lt;br /&gt;Logger.sign_in();&lt;br /&gt;// Business logic  ---&gt;  BBB&lt;br /&gt;Logger.sign_out();&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="body"&gt; Here we can see that logging functionality is exactly duplicated in two different classes.&lt;br /&gt;&lt;/span&gt;&lt;span class="body"&gt;With AOP we do something like this (note syntax is simplified for clarity)&lt;br /&gt;&lt;br /&gt;public aspect LogInspecter{&lt;br /&gt;  public Object invoke(){&lt;br /&gt;      Logger.sign_in();&lt;br /&gt;      method.execute();&lt;br /&gt;      Logger.sign_out();&lt;br /&gt;  }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;above method.execute() will execute class "First" or "Second" method&lt;br /&gt;&lt;br /&gt;public class First{&lt;br /&gt;   public void method(String s){&lt;br /&gt;     // Business logic  ---&gt;  AAA&lt;br /&gt;   }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;public class Second{&lt;br /&gt;   public void function(Object o){&lt;br /&gt;     // Business logic  ---&gt;  BBB&lt;br /&gt;   }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="body"&gt;both &lt;code&gt;&lt;/code&gt;&lt;/span&gt;&lt;span style="font-weight: bold;" class="body"&gt;First&lt;/span&gt;&lt;span class="body"&gt;&lt;code&gt;&lt;/code&gt; and &lt;code&gt;&lt;/code&gt;&lt;/span&gt;&lt;span style="font-weight: bold;" class="body"&gt;Second&lt;/span&gt;&lt;span class="body"&gt;&lt;code style="font-weight: bold;"&gt;&lt;/code&gt; have no knowledge and no dependency on &lt;code&gt;&lt;/code&gt;&lt;/span&gt;&lt;span style="font-weight: bold;" class="body"&gt;LogInspecter&lt;/span&gt;&lt;span class="body"&gt;&lt;code&gt;&lt;/code&gt;.&lt;/span&gt;&lt;span class="body"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7440397442105335024-5070862605710777071?l=jayasanka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jayasanka.blogspot.com/feeds/5070862605710777071/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7440397442105335024&amp;postID=5070862605710777071' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7440397442105335024/posts/default/5070862605710777071'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7440397442105335024/posts/default/5070862605710777071'/><link rel='alternate' type='text/html' href='http://jayasanka.blogspot.com/2008/02/aspect-oriented-programming.html' title='Aspect-Oriented Programming'/><author><name>Jayasanka</name><uri>http://www.blogger.com/profile/02280544026487726690</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7440397442105335024.post-2771343110282976709</id><published>2008-01-17T23:13:00.001-08:00</published><updated>2008-03-05T01:41:54.493-08:00</updated><title type='text'>Enable Sinhala in ur computer....</title><content type='html'>&lt;span style="font-size:100%;"&gt;For windows users..&lt;br /&gt;&lt;br /&gt;Get and install sinhala pack form &lt;a href="http://www.mrt.ac.lk/sinhala/SinhalaXP1.0.zip"&gt;fonts.lk&lt;/a&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:100%;"&gt;       You can download it by &lt;a href="http://www.mrt.ac.lk/sinhala/SinhalaXP1.0.zip"&gt;click in here.&lt;/a&gt; use instruction come with setup&lt;br /&gt;(this is based on Wijayasekara Unicode).&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7440397442105335024-2771343110282976709?l=jayasanka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jayasanka.blogspot.com/feeds/2771343110282976709/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7440397442105335024&amp;postID=2771343110282976709' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7440397442105335024/posts/default/2771343110282976709'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7440397442105335024/posts/default/2771343110282976709'/><link rel='alternate' type='text/html' href='http://jayasanka.blogspot.com/2008/01/adsfgfd.html' title='Enable Sinhala in ur computer....'/><author><name>Jayasanka</name><uri>http://www.blogger.com/profile/02280544026487726690</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
