<?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:blogger='http://schemas.google.com/blogger/2008' 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-7261548585686045052</id><updated>2024-10-25T02:22:47.463-07:00</updated><category term="Java"/><category term="IT-business alignment"/><category term="Joomla"/><category term="Netbeans"/><category term="SCJP"/><category term="SOAP"/><category term="Software Engineering"/><category term="AJAX"/><category term="BI"/><category term="Command design pattern"/><category term="Corba"/><category term="Css"/><category term="Decorator design pattern"/><category term="Factory Design Pattern"/><category term="JAXB tutorial"/><category term="Java EE"/><category term="Java inner class tutorial"/><category term="Java training"/><category term="Joomla1.6"/><category term="Kingston-Upon-Thames"/><category term="London"/><category term="London User Group"/><category term="MVC"/><category term="Mobile development"/><category term="Observer design pattern"/><category term="Outsourcing"/><category term="PHP"/><category term="Publisher-Subscriber pattern"/><category term="SAAJ"/><category term="SaaS"/><category term="Satyam"/><category term="Singleton design pattern"/><category term="Strategy Design Pattern"/><category term="Sun"/><category term="Tom Gilb"/><category term="UDDI"/><category term="UML editor"/><category term="W3C standards"/><category term="WSDL"/><category term="Web service"/><category term="XML"/><category term="XSD editor"/><category term="agile development"/><category term="cloud computing"/><category term="design pattern"/><category term="development process"/><category term="eXtreme Programming"/><category term="estimation"/><category term="function"/><category term="iphone"/><category term="iteration"/><category term="jquery"/><category term="migration"/><category term="mobile joomla"/><category term="new order"/><category term="p2p"/><category term="risk management"/><category term="scrum agile"/><category term="treawurfl"/><category term="tutorial"/><category term="understanding selectors"/><category term="upgrade"/><category term="w3schools"/><category term="web services"/><title type='text'>ITIS Consultants</title><subtitle type='html'>Matters pertaining to IT</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://itis-consultants.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7261548585686045052/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://itis-consultants.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/7261548585686045052/posts/default?start-index=26&amp;max-results=25&amp;redirect=false'/><author><name>Rajeev Trikha</name><uri>http://www.blogger.com/profile/07435391398428608212</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhVzRuF2tqPUf6AhwZpgELPdLM7-5yz9Su4T6v0q4Da0OUPkOIF7rkrSccgqegK7XcLtAUh8qQ073-QqJBYulq1wSwyJfnqYpGsGvjex7XhmNvdVA6yGzv4-NYp_P9chw/s220/raj.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>47</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-7261548585686045052.post-4169620433867755331</id><published>2015-06-01T02:57:00.001-07:00</published><updated>2015-06-01T03:15:58.724-07:00</updated><title type='text'>Hello World with some extra features in Scala</title><content type='html'>The ubiquitous &quot;Hello World&quot; program has been written in Scala to highlight some of the features of the language. A compiled scala programs runs on jvm. It can also import all the java classes as the example below shows.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
// &amp;nbsp;_ the underscore is like wildcard to import all the classes of math package&lt;br /&gt;
import scala.math._&lt;br /&gt;
/**&lt;br /&gt;
&amp;nbsp;* @author Rajeev&lt;br /&gt;
&amp;nbsp;*&lt;br /&gt;
&amp;nbsp;*/&lt;br /&gt;
// object keyword automatically created a singleton object for the class HelloWorld&lt;br /&gt;
object HelloWorld {&lt;br /&gt;
&lt;br /&gt;
/*&lt;br /&gt;
just like java main is the starting point&lt;br /&gt;
we say &#39;obj : type&#39; in scala rather than &#39;type obj&#39; in java as type can be automatically inferred in many cases&lt;br /&gt;
def indicates it is a function&lt;br /&gt;
Unit indicates it is returning void&lt;br /&gt;
Array[String] means array of type string&lt;br /&gt;
without = sign in the definition it will become a procedure which returns nothing rather than a function&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; def main(args: Array[String]): Unit = {&lt;br /&gt;
&lt;br /&gt;
// greet invoked like any method in java but it is passing a function, myFunc, in the arguments too&lt;br /&gt;
&amp;nbsp; &amp;nbsp; println(HelloWorld.greet(&quot;Rajeev&quot;,myFunc))&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;br /&gt;
/* note that the parameter type =&amp;gt; indicates it a by name function and wherever its name occurs in the current function it will be executed.&lt;br /&gt;
We don&#39;t neeed {} for single line function definitions&lt;br /&gt;
*/&lt;br /&gt;
&amp;nbsp; def greet (raj :String, afunc : =&amp;gt; String) : String = &quot;Hello World &quot; + raj + &quot; &quot; + afunc + &quot; &quot; + math.Pi&lt;br /&gt;
&amp;nbsp; def myFunc = &amp;nbsp;&quot;myfunc&quot;&lt;br /&gt;
}</content><link rel='replies' type='application/atom+xml' href='http://itis-consultants.blogspot.com/feeds/4169620433867755331/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://itis-consultants.blogspot.com/2015/06/hello-world-with-some-extra-features-in.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7261548585686045052/posts/default/4169620433867755331'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7261548585686045052/posts/default/4169620433867755331'/><link rel='alternate' type='text/html' href='http://itis-consultants.blogspot.com/2015/06/hello-world-with-some-extra-features-in.html' title='Hello World with some extra features in Scala'/><author><name>Rajeev Trikha</name><uri>http://www.blogger.com/profile/07435391398428608212</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhVzRuF2tqPUf6AhwZpgELPdLM7-5yz9Su4T6v0q4Da0OUPkOIF7rkrSccgqegK7XcLtAUh8qQ073-QqJBYulq1wSwyJfnqYpGsGvjex7XhmNvdVA6yGzv4-NYp_P9chw/s220/raj.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7261548585686045052.post-2273098233892665403</id><published>2015-05-27T03:33:00.002-07:00</published><updated>2015-05-27T04:32:15.292-07:00</updated><title type='text'>Apache Phoenix Installation</title><content type='html'>Apache Phoenix is the new kid on the block in HBase world&amp;nbsp;http://phoenix.apache.org/ It provides a SQL layer on top of HBase and greatly improves productivity. It provides standard RDBMS create table statements and also the secondary indexes to be created. However, if HBase was a poor fit for the use case then Phoenix is not going to change the underlying reality.&lt;br /&gt;
&lt;br /&gt;
Here are the instructions to install&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgGJbhAtvL-sCQqxc8RI1qdsQUjr8ev_XZ3lY_USnuQvwoENKeAbViyv4VdQFja4dBuV4XSpMLglHdy0R3ZlPXfPAvcyGuTz9U6GZ2LEX7Zm7ZR8b1CLoqabahr2liTK-rTjkaa_hwl6nA/s1600/hoenix.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;158&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgGJbhAtvL-sCQqxc8RI1qdsQUjr8ev_XZ3lY_USnuQvwoENKeAbViyv4VdQFja4dBuV4XSpMLglHdy0R3ZlPXfPAvcyGuTz9U6GZ2LEX7Zm7ZR8b1CLoqabahr2liTK-rTjkaa_hwl6nA/s320/hoenix.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
This is how the final HBase architecture looks with Phoenix installed&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi-U6naFAwj3zH8zY9Lij8aF0Sqb1vhTGmTnZZkQWe4Wov3qS2NHyzWNFFDhiQizu6UkwiQyRV1Zc1FMJaHlrcwfAetoQqj7gT1KOa97NzufdLIJr13yLHOMn0YSLl7-gA9U9bK-WHw7Lg/s1600/hbase.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;193&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi-U6naFAwj3zH8zY9Lij8aF0Sqb1vhTGmTnZZkQWe4Wov3qS2NHyzWNFFDhiQizu6UkwiQyRV1Zc1FMJaHlrcwfAetoQqj7gT1KOa97NzufdLIJr13yLHOMn0YSLl7-gA9U9bK-WHw7Lg/s320/hbase.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://itis-consultants.blogspot.com/feeds/2273098233892665403/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://itis-consultants.blogspot.com/2015/05/apache-phoenix-installation.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7261548585686045052/posts/default/2273098233892665403'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7261548585686045052/posts/default/2273098233892665403'/><link rel='alternate' type='text/html' href='http://itis-consultants.blogspot.com/2015/05/apache-phoenix-installation.html' title='Apache Phoenix Installation'/><author><name>Rajeev Trikha</name><uri>http://www.blogger.com/profile/07435391398428608212</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhVzRuF2tqPUf6AhwZpgELPdLM7-5yz9Su4T6v0q4Da0OUPkOIF7rkrSccgqegK7XcLtAUh8qQ073-QqJBYulq1wSwyJfnqYpGsGvjex7XhmNvdVA6yGzv4-NYp_P9chw/s220/raj.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgGJbhAtvL-sCQqxc8RI1qdsQUjr8ev_XZ3lY_USnuQvwoENKeAbViyv4VdQFja4dBuV4XSpMLglHdy0R3ZlPXfPAvcyGuTz9U6GZ2LEX7Zm7ZR8b1CLoqabahr2liTK-rTjkaa_hwl6nA/s72-c/hoenix.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7261548585686045052.post-8770621246768683920</id><published>2013-07-25T06:56:00.002-07:00</published><updated>2013-07-26T05:24:32.696-07:00</updated><title type='text'>jQuery custom plugins</title><content type='html'>This &lt;a href=&quot;http://www.codeproject.com/Articles/613981/Simple-jquery-Plugin-In-Details?msg=4620841#xx4620841xx&quot; target=&quot;_blank&quot;&gt;article &lt;/a&gt;is a very lucid explanation of creating jQuery plugins. It explains the importance of $.fn and shows the use of &amp;nbsp;$.extend and $.isFunction well. Obviously one can look at the source of jQuery but the author of the article has done a good job. The key points Are:&lt;br /&gt;
&lt;br /&gt;
Wrapping your plug-in in (function( $ ){ // plugin goes here })( jQuery ); is desirable.&lt;br /&gt;
&lt;br /&gt;
Don’t redundantly wrap the this keyword in the immediate scope of your plug-in’s function. Pay attention to this and $(this) in the article.&lt;br /&gt;
&lt;br /&gt;
Payattaention to object chaining aspect by returning this. Unless you’re returning an intrinsic value from your plug-in, always have your plug-in’s function return the this keyword to maintain chainability.&lt;br /&gt;
&lt;br /&gt;
Pass your plug-in settings in an object literal that can be extended over the plug-in’s defaults. Look at $.extend in the article.&lt;br /&gt;
&lt;br /&gt;
Don’t clutter the jQuery.fn object (incidentally pronounced “jQuery effin”) with more than one namespace per plug-in.&lt;br /&gt;
&lt;br /&gt;
Always namespace your methods, events, and data.&lt;br /&gt;
&lt;br /&gt;
This good practice should get you going.</content><link rel='replies' type='application/atom+xml' href='http://itis-consultants.blogspot.com/feeds/8770621246768683920/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://itis-consultants.blogspot.com/2013/07/jquery-custom-plugins.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7261548585686045052/posts/default/8770621246768683920'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7261548585686045052/posts/default/8770621246768683920'/><link rel='alternate' type='text/html' href='http://itis-consultants.blogspot.com/2013/07/jquery-custom-plugins.html' title='jQuery custom plugins'/><author><name>Rajeev Trikha</name><uri>http://www.blogger.com/profile/07435391398428608212</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhVzRuF2tqPUf6AhwZpgELPdLM7-5yz9Su4T6v0q4Da0OUPkOIF7rkrSccgqegK7XcLtAUh8qQ073-QqJBYulq1wSwyJfnqYpGsGvjex7XhmNvdVA6yGzv4-NYp_P9chw/s220/raj.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7261548585686045052.post-4349330034318115391</id><published>2013-07-07T02:19:00.000-07:00</published><updated>2013-07-07T02:19:17.501-07:00</updated><title type='text'>activity android:name=”.ExampleActivity” or activity android:name=”ExampleActivity”</title><content type='html'>Should there be a dot in the activity name in the AndroidManifest file and, if so, why? The question had exercised my mind and&amp;nbsp;&lt;a href=&quot;http://blog.javia.org/android-package-name/comment-page-1/#comment-14063&quot; target=&quot;_blank&quot;&gt;this&lt;/a&gt;&amp;nbsp;is a clear explanation. In short, prefixing with dot prefixes the activity name with package and application name. For itisconsulatants we have c&lt;span style=&quot;background-color: white; color: #222222; font-family: arial, helvetica, sans-serif; font-size: 12px; line-height: 18px;&quot;&gt;om.itisconsultants.myapp.ExampleActivity&lt;/span&gt;&amp;nbsp;when we say .ExampleActivity.&lt;br /&gt;
&lt;br /&gt;
Stackflow too has great&amp;nbsp;&lt;a href=&quot;http://stackoverflow.com/questions/3608017/activity-name-in-androidmanifest-xml&quot; target=&quot;_blank&quot;&gt;explanation&lt;/a&gt;.</content><link rel='replies' type='application/atom+xml' href='http://itis-consultants.blogspot.com/feeds/4349330034318115391/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://itis-consultants.blogspot.com/2013/07/activity-androidnameexampleactivity-or.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7261548585686045052/posts/default/4349330034318115391'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7261548585686045052/posts/default/4349330034318115391'/><link rel='alternate' type='text/html' href='http://itis-consultants.blogspot.com/2013/07/activity-androidnameexampleactivity-or.html' title='activity android:name=”.ExampleActivity” or activity android:name=”ExampleActivity”'/><author><name>Rajeev Trikha</name><uri>http://www.blogger.com/profile/07435391398428608212</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhVzRuF2tqPUf6AhwZpgELPdLM7-5yz9Su4T6v0q4Da0OUPkOIF7rkrSccgqegK7XcLtAUh8qQ073-QqJBYulq1wSwyJfnqYpGsGvjex7XhmNvdVA6yGzv4-NYp_P9chw/s220/raj.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7261548585686045052.post-6074584355499805700</id><published>2012-12-29T01:44:00.000-08:00</published><updated>2012-12-29T01:48:39.255-08:00</updated><title type='text'>Learning Android Development</title><content type='html'>I have never done any mobile development so it is a new journey for me. I thought the others may benefit from my experience. The most difficult steps are the initial ones. After that the software experience kicks-in and the development process just becomes coming to grips with the Android libraries.

The first step is to get the environment set up by downloading appropriate software. The standard advice is to follow these steps:&lt;br /&gt;
&lt;br /&gt;
1) set up java sdk&lt;br /&gt;
2) set up Eclipse&lt;br /&gt;
3) set up Android SDK&lt;br /&gt;
4) set up Android plug-in from&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;To my surprise, it is much easier than that. All one has to do is to download the Android bundle from http://developer.android.com/sdk/index.html which has all the necessary components. It is just a matter of unzipping the download in a preferred directory.&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;Before any application development starts, it is best to create an Android Virtual Device (AVD)emulator by going into Windows/Android Virtual Device Manager. The knowledge of setting up emulators will obviously help with testing the developed application on various platforms. I share my settings:

&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhdUMC0hJs1tADPZa1BhdfsZSMJJD0DrhBA557nh5GLClZKkZ8K1uAaeqXGw06OBNdZ4wL1zoL7LOpMoZQVV9bx6E7lPeC5bzbhPSLk7q_B7h_wbfrdgykYJgxODKZv0zynnB91Dgkun70/s1600/avd.GIF&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;400&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhdUMC0hJs1tADPZa1BhdfsZSMJJD0DrhBA557nh5GLClZKkZ8K1uAaeqXGw06OBNdZ4wL1zoL7LOpMoZQVV9bx6E7lPeC5bzbhPSLk7q_B7h_wbfrdgykYJgxODKZv0zynnB91Dgkun70/s400/avd.GIF&quot; width=&quot;308&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
The SD card file shown as c:\sdcard.iso was created by using the mksdcard.exe in the sdk/tools directory of the bundle installation. Simply change to the tools directory and issue the command&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;mksdcard 64M c:\sdcard.iso&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;Obviously this step has to be done before the AVD creation. I had difficulty in getting the AVD setup correctly. There were initially errors:&lt;br /&gt;
&amp;nbsp;35 - Emulator] Failed to create Context 0x3005
[2012-12-29 08:34:35 - Emulator] emulator: WARNING: Could not initialize OpenglES emulation, using software renderer.
[2012-12-29 08:34:&lt;br /&gt;
&lt;br /&gt;
The above set up resolved the issues for me so I have shared the image. 

OK. You are set to go. Enjoy!
</content><link rel='replies' type='application/atom+xml' href='http://itis-consultants.blogspot.com/feeds/6074584355499805700/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://itis-consultants.blogspot.com/2012/12/learning-android-development.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7261548585686045052/posts/default/6074584355499805700'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7261548585686045052/posts/default/6074584355499805700'/><link rel='alternate' type='text/html' href='http://itis-consultants.blogspot.com/2012/12/learning-android-development.html' title='Learning Android Development'/><author><name>Rajeev Trikha</name><uri>http://www.blogger.com/profile/07435391398428608212</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhVzRuF2tqPUf6AhwZpgELPdLM7-5yz9Su4T6v0q4Da0OUPkOIF7rkrSccgqegK7XcLtAUh8qQ073-QqJBYulq1wSwyJfnqYpGsGvjex7XhmNvdVA6yGzv4-NYp_P9chw/s220/raj.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhdUMC0hJs1tADPZa1BhdfsZSMJJD0DrhBA557nh5GLClZKkZ8K1uAaeqXGw06OBNdZ4wL1zoL7LOpMoZQVV9bx6E7lPeC5bzbhPSLk7q_B7h_wbfrdgykYJgxODKZv0zynnB91Dgkun70/s72-c/avd.GIF" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7261548585686045052.post-5711962554094725315</id><published>2011-03-10T02:04:00.000-08:00</published><updated>2011-03-10T02:18:39.195-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="BI"/><category scheme="http://www.blogger.com/atom/ns#" term="IT-business alignment"/><title type='text'>JUMP - Joint Up Means Payback</title><content type='html'>Yesterday I attended the joint meeting of British Computer Society and Chartered Institute of Management Accountants at the premises of BCS in London. The agenda was to review what business-IT alignment and business intelligence means from the perspective of these two organisations.&lt;br /&gt;
&lt;br /&gt;
IT is a world with a bewildering array of technologies - Java, .net, c++, sql, ITIL, CMS, databases, Joomla!, XML, CSS, HTML, PHP, TCP/IP, SMTP, HTTP, Unix, Firefox, agile, SCRUM and one can go on. To harness these successfully for business has been the dream for last twenty-five years. In fact, I cannot remember a single year over the last two decades when one or other management consultancy did not emerge with a framework for successfully aligning IT with business. Historically, many organisations have moved their IT personnel into business departments or encouraged their IT people to acquire CIMA/MBA qualification to bridge the chasm between these two worlds. Yet it was sobering to discover that business perceptions remains that these two world are far apart and bridging them is still a burning issue. A framework was presented to bridge this divide by Dr James Bacon based upon system-thinking and Genuine Action Learning. The claim was that joint-up thinking leads to dramatic increase in profitability (JUMP).&lt;br /&gt;
&lt;br /&gt;
Also I remember that in the early 90s the BI systems were called Executive Information Systems (EIS). In the mid-90s I remember dubbing EIS as Everybody&#39;s Information System as the technology was becoming ubiquitous and affordable for lower tiers in the organisation. Interestingly CIMA sees this shift now and believes that analytical processing will move from the hands of accountants to become more pervasive. This redefines the role to become more focused on planning and control rather than analysis.&lt;br /&gt;
&lt;br /&gt;
The moral of the story is that we are still grappling with old problems and trying to find better solutions to them.</content><link rel='replies' type='application/atom+xml' href='http://itis-consultants.blogspot.com/feeds/5711962554094725315/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://itis-consultants.blogspot.com/2011/03/jump-joint-up-means-payback.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7261548585686045052/posts/default/5711962554094725315'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7261548585686045052/posts/default/5711962554094725315'/><link rel='alternate' type='text/html' href='http://itis-consultants.blogspot.com/2011/03/jump-joint-up-means-payback.html' title='JUMP - Joint Up Means Payback'/><author><name>Rajeev Trikha</name><uri>http://www.blogger.com/profile/07435391398428608212</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhVzRuF2tqPUf6AhwZpgELPdLM7-5yz9Su4T6v0q4Da0OUPkOIF7rkrSccgqegK7XcLtAUh8qQ073-QqJBYulq1wSwyJfnqYpGsGvjex7XhmNvdVA6yGzv4-NYp_P9chw/s220/raj.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7261548585686045052.post-1621609620244744878</id><published>2011-02-18T10:02:00.000-08:00</published><updated>2011-02-18T10:14:52.745-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="mobile joomla"/><category scheme="http://www.blogger.com/atom/ns#" term="treawurfl"/><title type='text'>Mobile Joomla and TERAWURFL database</title><content type='html'>&amp;nbsp;Mobile Joomla! is a great extension for making your Joomla site ready for mobile viewing but it adds in a 40M worth of tables into Joomla database. This potentially causes difficulty in database backup and recovery. So here are the steps to put all the terawurfl tables in a separate database.&amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
1) Go into phpmyadmin and copy you Joomla database as terawurfl.&lt;br /&gt;
&lt;br /&gt;
2) Go into information_schema database and run the query&lt;br /&gt;
&lt;br /&gt;
select concat(&quot;drop table &quot;,table_name,&quot;;&quot;) from tables where substr(table_name,1,4) = &#39;jos_&#39; and&lt;br /&gt;
substr(table_name,1,13) != &#39;Jos_terawurfl&#39;;&lt;br /&gt;
&lt;br /&gt;
Note: I am assuming you are running Joomla database with prefix &#39;jos_&#39;, if not then change the above accordingly&lt;br /&gt;
&lt;br /&gt;
3) Copy all the drop statements into clipboard.&lt;br /&gt;
&lt;br /&gt;
4) Go into terawurl database and run SQL with statements copied from the  clipboard. At this stage you have a database with just the terawurfl  tables.&lt;br /&gt;
&lt;br /&gt;
5) Now go back to information_schema database and run the query&lt;br /&gt;
&lt;br /&gt;
select concat(&quot;drop table &quot;,table_name,&quot;;&quot;) from tables where  substr(table_name,1,13) = &#39;Jos_terawurfl&#39;;&lt;br /&gt;
&lt;br /&gt;
6) Copy the drop statements to clipboard.&lt;br /&gt;
&lt;br /&gt;
7) Now go to your Joomla database and run the SQL with statements copied  from the clipboard. At this stage you have a database with just the  joomla tables.&lt;br /&gt;
&lt;br /&gt;
The above process would have taken out the terawurfl tables and put them in a separate database.&lt;br /&gt;
&lt;br /&gt;
Now go and set database name, user and pass in plugins/mobile/terawurfl.php, They are currently picked up from the configuration.php You probably will just have to change the line to set schema to terarwurfl as the user and password would still be valid as we follow the above procedure.&lt;br /&gt;
&lt;br /&gt;
TeraWurflConfig::DB_SCHEMA = &quot;terawurfl&quot;;&lt;br /&gt;
&lt;br /&gt;
Now you can backup your dynamically changing Joomla database more frequently without having the overhead of copying terawurfl tables as well. Also the database recovery time for Joomla tables will be lower too.</content><link rel='replies' type='application/atom+xml' href='http://itis-consultants.blogspot.com/feeds/1621609620244744878/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://itis-consultants.blogspot.com/2011/02/mobile-joomla-and-terawurfl-database.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7261548585686045052/posts/default/1621609620244744878'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7261548585686045052/posts/default/1621609620244744878'/><link rel='alternate' type='text/html' href='http://itis-consultants.blogspot.com/2011/02/mobile-joomla-and-terawurfl-database.html' title='Mobile Joomla and TERAWURFL database'/><author><name>Rajeev Trikha</name><uri>http://www.blogger.com/profile/07435391398428608212</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhVzRuF2tqPUf6AhwZpgELPdLM7-5yz9Su4T6v0q4Da0OUPkOIF7rkrSccgqegK7XcLtAUh8qQ073-QqJBYulq1wSwyJfnqYpGsGvjex7XhmNvdVA6yGzv4-NYp_P9chw/s220/raj.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7261548585686045052.post-3043265945563099592</id><published>2011-02-17T03:27:00.000-08:00</published><updated>2011-02-17T03:27:25.005-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="iphone"/><category scheme="http://www.blogger.com/atom/ns#" term="Joomla"/><category scheme="http://www.blogger.com/atom/ns#" term="Mobile development"/><title type='text'>Mobile Development and Joomla</title><content type='html'>Here is to get you going with getting your Joomla site ready for iPhone on your local PC. We start with the assumption that WAMP has already been installed, along with Joomla.&lt;br /&gt;
&lt;br /&gt;
First download the Mobile Joomla extension from &lt;a href=&quot;http://www.mobilejoomla.com/&quot;&gt;here&lt;/a&gt;. You have to register but it is free. The extension provides the support for carrying out mobile development.&amp;nbsp; It is a rather big component which adds a number of templates, plugins and module positions. So once you kick-off the install it could take 30-50s to install. Just disable the &#39;Mobile - Always&#39; plugin as you don&#39;t want to your site to be permanently served via mobile. It may be alright in development environment to leave this plugin enabled but in production environment you have to disable it as you are serving different types of clients.&lt;br /&gt;
&lt;br /&gt;
In mobile development you always have two choices. Either you can have a different URL in a subdomain for iPhone (multi-site option) or you can use the same URL and let the mobile plugin decide which template to serve (multi-client option). We will opt for the latter but if you want the multi-site option then you will have to set it up in the Joomla Mobile settings. We can adjust the modules for iPhone or just serve the default before tinkering.&lt;br /&gt;
&lt;br /&gt;
Now establish the ip address of your local PC by running ipconfig. It will be something like 192.168.1.2.&lt;br /&gt;
. &lt;br /&gt;
Go to iphonetester.com. If you were typing localhost/joomla to get into your local website then you will have to type http://192.168.1.2/joomla in the tester URL. Now you have full simulation of your site as viewed by iPhone. You can start playing with module positions and experimenting. Enjoy!</content><link rel='replies' type='application/atom+xml' href='http://itis-consultants.blogspot.com/feeds/3043265945563099592/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://itis-consultants.blogspot.com/2011/02/mobile-development-and-joomla.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7261548585686045052/posts/default/3043265945563099592'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7261548585686045052/posts/default/3043265945563099592'/><link rel='alternate' type='text/html' href='http://itis-consultants.blogspot.com/2011/02/mobile-development-and-joomla.html' title='Mobile Development and Joomla'/><author><name>Rajeev Trikha</name><uri>http://www.blogger.com/profile/07435391398428608212</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhVzRuF2tqPUf6AhwZpgELPdLM7-5yz9Su4T6v0q4Da0OUPkOIF7rkrSccgqegK7XcLtAUh8qQ073-QqJBYulq1wSwyJfnqYpGsGvjex7XhmNvdVA6yGzv4-NYp_P9chw/s220/raj.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7261548585686045052.post-8039717236455263762</id><published>2011-02-16T00:23:00.000-08:00</published><updated>2011-02-16T00:23:57.941-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Joomla"/><category scheme="http://www.blogger.com/atom/ns#" term="London User Group"/><title type='text'>Exciting meeting of London&#39;s Joomla User Group</title><content type='html'>I had the pleasure of attending my first-ever Joomla User Group meeting at University College London yesterday. The minor drizzle in the evening did not dampen the enthusiasm of the attendees who were all passionate about Joomla. It turned out to a lively session of two hours where a lot of insights were parted by the members.&lt;br /&gt;
&lt;br /&gt;
We had a presentation on Joomla performance tuning which covered all the aspects from caching, compression, CSS and Javascript minification, MySql tuning and image servers. A suggestion that serving images from a different server speeds up the page download as the HTTP traffic becomes parallelized was particularly good. Also the warning that many image-bloated templates and sub-optimal extensions are the main culprit in reducing performance was welcome.&lt;br /&gt;
&lt;br /&gt;
A lively discussion followed on extensions. The two most memorable ones for me were Alpha Content and Store Locator. The former provided a directory listing of articles in a category in an alphabetic manner and gave A-Z index on top to navigate easily to any content beginning with that letter. The latter gave a Google Map of Excel-loaded interest-points (they could be stores or individuals) to easily zoom in at their location or associated URL. &lt;br /&gt;
&lt;br /&gt;
There were a host of other useful insights and this brief introduction does slight injustice to the meeting. I would suggest that if you are interested in Joomla then make your way to the next meeting on15th of March at 7.00pm.</content><link rel='replies' type='application/atom+xml' href='http://itis-consultants.blogspot.com/feeds/8039717236455263762/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://itis-consultants.blogspot.com/2011/02/exciting-meeting-of-londons-joomla-user.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7261548585686045052/posts/default/8039717236455263762'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7261548585686045052/posts/default/8039717236455263762'/><link rel='alternate' type='text/html' href='http://itis-consultants.blogspot.com/2011/02/exciting-meeting-of-londons-joomla-user.html' title='Exciting meeting of London&#39;s Joomla User Group'/><author><name>Rajeev Trikha</name><uri>http://www.blogger.com/profile/07435391398428608212</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhVzRuF2tqPUf6AhwZpgELPdLM7-5yz9Su4T6v0q4Da0OUPkOIF7rkrSccgqegK7XcLtAUh8qQ073-QqJBYulq1wSwyJfnqYpGsGvjex7XhmNvdVA6yGzv4-NYp_P9chw/s220/raj.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7261548585686045052.post-2883375740712817949</id><published>2011-01-25T01:18:00.000-08:00</published><updated>2011-01-25T01:25:49.002-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Joomla1.6"/><category scheme="http://www.blogger.com/atom/ns#" term="migration"/><category scheme="http://www.blogger.com/atom/ns#" term="upgrade"/><title type='text'>Migrating to Joomla 1.6</title><content type='html'>I carried out a quick test to establish the issues in migrating to Joomla1.6 on my local PC. The simple answer is that one shouldn&#39;t jump into it if one is not willing to do a considerable amount of work oneself. I used a basic site which used rhuk_milkyway template. Here are the findings:&lt;br /&gt;
&lt;br /&gt;
The JUpgrade actually works quite smoothly if you are converting from Joomla 1.5.22. It successfully creates a new working environment for Joomla1.6 and preserves the 1.5 installation. Basically a new directory is created to hold 1.6 code and the MySql database gets the additional Joomla tables with j16 prefix. In ideal world it should just be required to drop the old tables and directory and point to the new installation. However the life is not that simple.&lt;br /&gt;
&lt;br /&gt;
Firstly, the default templates which Joomla1.6 comes with are not production quality and&amp;nbsp;rhuk_milkyway is not supported. Originally it was envisaged to include this particular template in the production release but the idea was shelved. The net effect is that various menus just disappear as one has to place them in new positions manually. Also the menu items had a value of -1 set in line Link Type Options/Link Image for various menu items. All these had to be manually set which is annoying and cumbersome.&lt;br /&gt;
&lt;br /&gt;
After spending around an hour I had a functional site but it was a crude replica of the 1.5 version. I was not too fussed about extensions at this stage but obviously their availability is a critical decision in choosing to migrate. To get the site fully working I would have been forced to spend a considerable amount of time on CSS. So the bottom line is : &quot;Don&#39;t rush in! Access control lists are great but the effort required to migrate is too much at this point in time&quot;.</content><link rel='replies' type='application/atom+xml' href='http://itis-consultants.blogspot.com/feeds/2883375740712817949/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://itis-consultants.blogspot.com/2011/01/migrating-to-joomla-16.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7261548585686045052/posts/default/2883375740712817949'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7261548585686045052/posts/default/2883375740712817949'/><link rel='alternate' type='text/html' href='http://itis-consultants.blogspot.com/2011/01/migrating-to-joomla-16.html' title='Migrating to Joomla 1.6'/><author><name>Rajeev Trikha</name><uri>http://www.blogger.com/profile/07435391398428608212</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhVzRuF2tqPUf6AhwZpgELPdLM7-5yz9Su4T6v0q4Da0OUPkOIF7rkrSccgqegK7XcLtAUh8qQ073-QqJBYulq1wSwyJfnqYpGsGvjex7XhmNvdVA6yGzv4-NYp_P9chw/s220/raj.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7261548585686045052.post-9011515719765458216</id><published>2011-01-15T06:28:00.000-08:00</published><updated>2011-01-15T06:31:03.218-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="estimation"/><category scheme="http://www.blogger.com/atom/ns#" term="scrum agile"/><category scheme="http://www.blogger.com/atom/ns#" term="Tom Gilb"/><title type='text'>Estimating project delay just from the quality of requirement specification</title><content type='html'>I was privileged to attend a course by Tom Gilb recently on quality and he produced a wonderful way of estimating project delay from just the quality of its requirement&amp;nbsp;specification. Those who are not&amp;nbsp;familiar with Tom should know that he is the pioneer of&amp;nbsp;iterative development&amp;nbsp;method. His Evo methodology with emphasis on weekly deliverables and feedback was produced in the 60s, a long before Agile and Scrum appeared on the horizon. Also he can be credited with introducing software metrics in the 70s which were&amp;nbsp;incorporated as Capability Maturity Model level IV.&amp;nbsp;People who have grown up in quality movement are familiar with the fact that the quality is something which has to be designed within a process and cannot be gained through mere inspection. So just by checking the number of defects in a random page of the specification we can estimate the probability of project success.&lt;br /&gt;
&lt;br /&gt;
A logical page of around three hundred words is&amp;nbsp;inspected&amp;nbsp;for deviation from the rules like testability,&amp;nbsp;ambiguousness&amp;nbsp;and no-design by 3-5 people. It is no good saying that a quality like usability should be dramatically improved unless we&amp;nbsp;numerically&amp;nbsp;quantify it. We take the figure for the highest number of major defects discovered by a team member, D. We multiply this by a factor of two to establish the discoverable defect density (source: experience). Now any inspection only captures a third of the potential defects (source: Capers Jones) so we multiply the discoverable defect density by a factor to generate potential major defects. Now the likelihood of a major defect turning into a downstream bug is one third. Each of this downstream bugs will cost 10 hours to resolve. This gives the formula for project slippage as:&lt;br /&gt;
&lt;br /&gt;
Hours slippage = D * 2 * 3 * 1/3 * 10 * number of non-comment logical pages in the specification&lt;br /&gt;
&lt;br /&gt;
Now this is pure magic as it has been empirically validated on a number of projects in the field. If you don&#39;t believe it then carry out the test on a project on which you have worked in the past and see whether the slippage provided by the formula is not within plus or minus 10% of the actual slippage.</content><link rel='replies' type='application/atom+xml' href='http://itis-consultants.blogspot.com/feeds/9011515719765458216/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://itis-consultants.blogspot.com/2011/01/estimating-project-delay-just-from.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7261548585686045052/posts/default/9011515719765458216'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7261548585686045052/posts/default/9011515719765458216'/><link rel='alternate' type='text/html' href='http://itis-consultants.blogspot.com/2011/01/estimating-project-delay-just-from.html' title='Estimating project delay just from the quality of requirement specification'/><author><name>Rajeev Trikha</name><uri>http://www.blogger.com/profile/07435391398428608212</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhVzRuF2tqPUf6AhwZpgELPdLM7-5yz9Su4T6v0q4Da0OUPkOIF7rkrSccgqegK7XcLtAUh8qQ073-QqJBYulq1wSwyJfnqYpGsGvjex7XhmNvdVA6yGzv4-NYp_P9chw/s220/raj.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7261548585686045052.post-5774202246282591991</id><published>2010-05-23T02:54:00.000-07:00</published><updated>2010-05-23T03:11:09.621-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="function"/><category scheme="http://www.blogger.com/atom/ns#" term="Java"/><category scheme="http://www.blogger.com/atom/ns#" term="PHP"/><title type='text'>PHP essentials for Java programmers</title><content type='html'>I recently had to do a project in PHP and being from Java background one notices enumerable similarities. Obviously the whole knowledge about object-oriented programming and the procedural constructs like assignments, statements, conditions, loop etc are totally&amp;nbsp;transferable. However the key difference I noticed was in the function calls. In Java all the arguments are passed by value, even for the objects, ie we pass the copy of the address for the object. But in PHP we are allowed to pass arguments by value or reference. Thus we have a simple function&lt;br /&gt;
&lt;br /&gt;
function writeName($name) { echo $name; }&lt;br /&gt;
&lt;br /&gt;
it passes the $name argument as value. However, by just prefixing $name with an ampersand we pass the argument by reference to give&lt;br /&gt;
&lt;br /&gt;
function writeName(&amp;amp;$name) { echo $name; }&lt;br /&gt;
&lt;br /&gt;
The other clever thing about PHP function is that we can return a value by reference too. Take the example from Joomla! library:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
function &amp;amp;getLanguage()&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;static $instance;&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;if (!is_object($instance))&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;//get the debug configuration setting&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;$conf =&amp;amp; JFactory::getConfig();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;$debug = $conf-&amp;gt;getValue(&#39;config.debug_lang&#39;);&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;$instance = JFactory::_createLanguage();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;$instance-&amp;gt;setDebug($debug);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;return $instance;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&lt;br /&gt;
Preceding the getLanguage() function by an ampersand indicates that the function will return a value by reference, thus the return is a pointer to $instance.&lt;br /&gt;
&lt;br /&gt;
The another line which will puzzle Java programmers above is&lt;br /&gt;
&lt;br /&gt;
$conf =&amp;amp; JFactory::getConfig();&lt;br /&gt;
&lt;br /&gt;
=&amp;amp; the syntax simply means that $conf is being assigned reference to the object created by getConfig() method of JFactory class. :: notation indicates that we are invoking a class method rather than an instance method. The normal Java dot notation of object.method() for invoking an instance method is changed in PHP to object-&amp;gt;method()&lt;br /&gt;
&lt;br /&gt;
Armed with the knowledge in this article a Java programmer is ready to do a PHP project. The only other thing to bear in mind is that the class constructor is defined by&amp;nbsp;function __construct(). Obviously one will have to come to grips with various PHP functions but this should be no different from understanding a new Java API.</content><link rel='replies' type='application/atom+xml' href='http://itis-consultants.blogspot.com/feeds/5774202246282591991/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://itis-consultants.blogspot.com/2010/05/java-and-php.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7261548585686045052/posts/default/5774202246282591991'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7261548585686045052/posts/default/5774202246282591991'/><link rel='alternate' type='text/html' href='http://itis-consultants.blogspot.com/2010/05/java-and-php.html' title='PHP essentials for Java programmers'/><author><name>Rajeev Trikha</name><uri>http://www.blogger.com/profile/07435391398428608212</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhVzRuF2tqPUf6AhwZpgELPdLM7-5yz9Su4T6v0q4Da0OUPkOIF7rkrSccgqegK7XcLtAUh8qQ073-QqJBYulq1wSwyJfnqYpGsGvjex7XhmNvdVA6yGzv4-NYp_P9chw/s220/raj.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7261548585686045052.post-8759734669275686798</id><published>2010-04-23T01:11:00.000-07:00</published><updated>2010-04-23T01:11:21.009-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Css"/><category scheme="http://www.blogger.com/atom/ns#" term="understanding selectors"/><title type='text'>Selectors in Cascading Style Sheets</title><content type='html'>The&amp;nbsp;indispensable tool&amp;nbsp;&amp;nbsp;in every web developers portfolio is&amp;nbsp;Cascading Style Sheets (CSS). Once HTML has been used to organize the contents, the presentational brilliance stems from using CSS rules. Syntactically the rules have a selector followed by a declaration containing various properties&amp;nbsp;separated&amp;nbsp;by semicolons:&lt;br /&gt;
&lt;br /&gt;
p {color:blue; font-weight:normal;}&lt;br /&gt;
&lt;br /&gt;
This&amp;nbsp;simple&amp;nbsp;tag selector rule colours all the contents of &lt;br /&gt;
tags in the HTML document. Also noted that the property-value combination is defined by separating the property from its value with a colon. &amp;nbsp;Instead of p we could have used any of the html elements like h1, h2 etc. To apply the rule to a group of elements we simply use a selector with comma separated the elements. For example, if we want to override the h3, h4, h5 and h6 header elements default definition of the browser, we can just use group selector:&lt;br /&gt;
&lt;br /&gt;
h3, h4, h5, h6 {color:black; font-size:1.2em;)&lt;br /&gt;
&lt;br /&gt;
The commonest way of formatting content is to use the class selector in conjunction with&amp;nbsp;&amp;lt;div&amp;gt;&amp;nbsp;block element or&amp;nbsp;&amp;lt;span&amp;gt;&amp;nbsp;inline element.&lt;br /&gt;
&lt;br /&gt;
.myClass&amp;nbsp;{color:black; font-size:1.2em;) class selector has a period prefix. Currently it will apply to any tag which has attribute definition of class=&quot;myClass&quot;. For example, if we have the following in our document:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p class=&quot;myClass&quot;&amp;gt;...&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;div class=&quot;myClass&quot;&amp;gt;...&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
then the .myClass selector will apply the declaration formatting to both these elements. To just restrict the formatting to &lt;br /&gt;
element, we change the selector to p.myClass in our rule.&lt;br /&gt;
&lt;br /&gt;
Along with class, id is another attribute which can be placed on most elements. Indeed, javascript uses id to get the elements. So if we have&amp;nbsp;&amp;lt;p id=&quot;myID&quot;&amp;gt;&amp;nbsp;then the hash prefixed selector for this element becomes:&lt;br /&gt;
&lt;br /&gt;
#myID&amp;nbsp;{color:black; font-size:1.2em;)&lt;br /&gt;
&lt;br /&gt;
We also have pseudo-classes and pseudo-elements available as selectors. The anchor pseudo-classes are used to invariably define link&amp;nbsp;interaction&amp;nbsp;with a:link, a:visited, a:hover and a:active selectors. We know that these stages happen with links.&amp;nbsp;Similarly, the first line of a&amp;nbsp;paragraph&amp;nbsp;or a first letter of the paragraph doesn&#39;t have a tag but it is easily&amp;nbsp;identifiable&amp;nbsp;pseudo-element so we can have a selectors like:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
p:first-letter {color: blue;font-size:1.5em;}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
p:first-line {color: blue;font-size:1.5em;}&lt;br /&gt;
&lt;br /&gt;
Similarly there are pseudo-elements after and before for auto-generated content. To prefix a paragraph with a class=&quot;intro&quot; with &#39;Thought of the day!&#39; auto-generated content, we have the selector syntax:&lt;br /&gt;
&lt;br /&gt;
p.intro:before {content: &quot;Thought of the day!&quot; }&lt;br /&gt;
&lt;br /&gt;
or to give the text after the paragraph:&lt;br /&gt;
&lt;br /&gt;
p.intro:after {content: &quot;Thought of the day!&quot; }&lt;br /&gt;
&lt;br /&gt;
To style tags within tags we have descendant selector. For example, to highlight emphasis within a paragraph we may use the selector:&lt;br /&gt;
&lt;br /&gt;
h1 strong { color: red; }&lt;br /&gt;
&lt;br /&gt;
Here sub-element&amp;nbsp;&amp;lt;strong&amp;gt; within element&amp;nbsp;&amp;lt;h1&amp;gt; is coloured red. Similarly if we wanted to select the ordered lists which are direct children of body element the syntax is body&amp;nbsp;&amp;gt;&amp;nbsp;ol for the rule. Note the angle bracket is used for the child selector. Or to get to an adjacent sibling we use the plus (&#39;+&#39;) sign instead of the angle bracket.&lt;br /&gt;
&lt;br /&gt;
We can also select on the attributes. These selectors allow us to select element which have a certain property. For example to select all the images with title attribute we will have a selector img[title]. Or to just select text boxes in a form we can have the attribute selector&lt;br /&gt;
&lt;br /&gt;
input[type=&quot;text&quot;]&lt;br /&gt;
&lt;br /&gt;
There are some further refinements to these selector but the knowledge is acquired by experimentation. The aspects covered are more than adequate.&lt;br /&gt;
&lt;br /&gt;
For a good source for understanding the selectors visit&amp;nbsp;&lt;a href=&quot;http://gallery.theopalgroup.com/selectoracle/&quot;&gt;here&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://www.amazon.com/CSS-Missing-David-Sawyer-McFarland/dp/0596802447?ie=UTF8&amp;amp;tag=wwwitisconsul-20&amp;amp;link_code=btl&amp;amp;camp=213689&amp;amp;creative=392969&quot; target=&quot;_blank&quot;&gt;CSS: The Missing Manual&lt;/a&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; height=&quot;1&quot; src=&quot;http://www.assoc-amazon.com/e/ir?t=wwwitisconsul-20&amp;amp;l=btl&amp;amp;camp=213689&amp;amp;creative=392969&amp;amp;o=1&amp;amp;a=0596802447&quot; style=&quot;border: none !important; margin: 0px !important; padding: 0px !important;&quot; width=&quot;1&quot; /&gt;&amp;nbsp;is a very useful resource which you should have in your collection.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;</content><link rel='replies' type='application/atom+xml' href='http://itis-consultants.blogspot.com/feeds/8759734669275686798/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://itis-consultants.blogspot.com/2010/04/selectors-in-cascading-style-sheets.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7261548585686045052/posts/default/8759734669275686798'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7261548585686045052/posts/default/8759734669275686798'/><link rel='alternate' type='text/html' href='http://itis-consultants.blogspot.com/2010/04/selectors-in-cascading-style-sheets.html' title='Selectors in Cascading Style Sheets'/><author><name>Rajeev Trikha</name><uri>http://www.blogger.com/profile/07435391398428608212</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhVzRuF2tqPUf6AhwZpgELPdLM7-5yz9Su4T6v0q4Da0OUPkOIF7rkrSccgqegK7XcLtAUh8qQ073-QqJBYulq1wSwyJfnqYpGsGvjex7XhmNvdVA6yGzv4-NYp_P9chw/s220/raj.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7261548585686045052.post-8026013740695023601</id><published>2010-04-14T23:53:00.000-07:00</published><updated>2010-04-14T23:53:27.530-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="jquery"/><category scheme="http://www.blogger.com/atom/ns#" term="tutorial"/><category scheme="http://www.blogger.com/atom/ns#" term="w3schools"/><title type='text'>Delight of w3schools</title><content type='html'>Like countless other people I have used the tutorials at &lt;a href=&quot;http://www.w3schools.com/&quot;&gt;w3schools&lt;/a&gt;&amp;nbsp;to become familiar with various technologies at different stages in my life. It is impossible to be not familiar with this site for anyone who has taken delight in learning new things. I recall learning about ASP, XPath etc on this site a number of years ago. Indeed a career in IT is impossible without constantly updating ones skill base so a comprehensive training resource is a real boon. The site invariably appears in the top searches whenever &#39;Ajax tutorial&#39; or &#39;jquery tutorial&#39; type terms are used in google so cannot escape the radar of any technology&amp;nbsp;aficionado. For last couple of years I had been hearing good things about jquey so decided to take the plunge and become familiar with the framework yesterday. Needless to say that w3schools gave me a couple of hours of real pleasure. There tutorial seem basic but they get to the heart of the matter. Their examples were lucid and their jquery engine for practising is great. So here is a public thanks for being so useful. W3schools, you rock!</content><link rel='replies' type='application/atom+xml' href='http://itis-consultants.blogspot.com/feeds/8026013740695023601/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://itis-consultants.blogspot.com/2010/04/delight-of-w3schools.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7261548585686045052/posts/default/8026013740695023601'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7261548585686045052/posts/default/8026013740695023601'/><link rel='alternate' type='text/html' href='http://itis-consultants.blogspot.com/2010/04/delight-of-w3schools.html' title='Delight of w3schools'/><author><name>Rajeev Trikha</name><uri>http://www.blogger.com/profile/07435391398428608212</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhVzRuF2tqPUf6AhwZpgELPdLM7-5yz9Su4T6v0q4Da0OUPkOIF7rkrSccgqegK7XcLtAUh8qQ073-QqJBYulq1wSwyJfnqYpGsGvjex7XhmNvdVA6yGzv4-NYp_P9chw/s220/raj.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7261548585686045052.post-7418974406199395396</id><published>2010-03-31T12:24:00.000-07:00</published><updated>2010-04-01T00:17:56.698-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="IT-business alignment"/><category scheme="http://www.blogger.com/atom/ns#" term="new order"/><title type='text'>The brave new world</title><content type='html'>The pressure on IT has always been there to deliver. I recall the 80s when the business-IT alignment was on everybody&#39;s lips, the 90s when the IT-facilitated business process re-engineering and kaizan were talk of the town and the new economic order was proclaimed by the web-based companies at the turn of the century. IT was always deemed indispensable in these initiatives but adjudged to be slow to meet the business needs. The bursting of the dotcom bubble and the y2k experience tarnished the IT image but did not abet the pressure on IT to facilitate inter-organisational processes in a globalised world. IT&#39;s role was still at the heart of &#39;making it happen&#39;. One assumed that the ERP systems had taken care of all the transactional needs at the operational level and the datawarehouses and business intelligence tools had enamoured the business executives by adding value to strategy formulation. Now comes the &lt;a href=&quot;http://bit.ly/d0tNgY&quot;&gt;frightening reminder &lt;/a&gt; that all is not well in the wake of global financial meltdown.&lt;br /&gt;
&lt;br /&gt;
&quot;Capital expenditure priorities are shifted into IT from other high-payback projects&quot; just to perform necessary ERP changes, claims one executive. Whilst another bemoans: &quot;Change to ERP paralyzes the entire organization in moving forward in other areas that can bring more value.&quot;&lt;br /&gt;
&lt;br /&gt;
An Accenture partner sees rising tide of operational flexibility on daily basis and proclaims &quot;strategy, as we knew it, is dead.&quot; A paradigm shift in IT&#39;s execution is expected and demanded in this new world order. Yet the top priority for 2009 was &quot;modernizing key legacy applications&quot; and the SOA, the pre-requisite for flexibility, seemed fatally wounded.&lt;br /&gt;
&lt;br /&gt;
It is a challenge to all the IT professionals to acquire a mindset attuned with business imperatives and successfully deploy disruptive technologies to make a quantum change. The decade ahead of us is full of potential and we must not fail.</content><link rel='replies' type='application/atom+xml' href='http://itis-consultants.blogspot.com/feeds/7418974406199395396/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://itis-consultants.blogspot.com/2010/03/brave-new-world.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7261548585686045052/posts/default/7418974406199395396'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7261548585686045052/posts/default/7418974406199395396'/><link rel='alternate' type='text/html' href='http://itis-consultants.blogspot.com/2010/03/brave-new-world.html' title='The brave new world'/><author><name>Rajeev Trikha</name><uri>http://www.blogger.com/profile/07435391398428608212</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhVzRuF2tqPUf6AhwZpgELPdLM7-5yz9Su4T6v0q4Da0OUPkOIF7rkrSccgqegK7XcLtAUh8qQ073-QqJBYulq1wSwyJfnqYpGsGvjex7XhmNvdVA6yGzv4-NYp_P9chw/s220/raj.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7261548585686045052.post-1773619202075736830</id><published>2010-03-30T04:14:00.000-07:00</published><updated>2010-03-30T08:50:05.353-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Java"/><category scheme="http://www.blogger.com/atom/ns#" term="SAAJ"/><category scheme="http://www.blogger.com/atom/ns#" term="SOAP"/><title type='text'>SOAP with Attachment API for Java (SAAJ) example</title><content type='html'>SAAJ is an indispensable tool for manipulating SOAP messages, especially if they have got attachments. We have illustrated all the steps in creating a SwA (SOAP Messages with Attachments) in the short self-explanatory example which can be adapted for all purposes.&lt;br /&gt;
&lt;br /&gt;
package saajexample;&lt;br /&gt;
&lt;br /&gt;
import java.awt.Image;&lt;br /&gt;
import java.awt.Toolkit;&lt;br /&gt;
import javax.xml.soap.*;&lt;br /&gt;
&lt;br /&gt;
public class Main {&lt;br /&gt;
&lt;br /&gt;
public static void main(String[] args) throws Exception {&lt;br /&gt;
// Factory needed to create SOAP message&lt;br /&gt;
MessageFactory msgFactory = MessageFactory.newInstance();&lt;br /&gt;
SOAPMessage message = msgFactory.createMessage();&lt;br /&gt;
// illustrate the story so far by dumping out the message&lt;br /&gt;
message.writeTo(System.out);&lt;br /&gt;
// detach the header from the SOAP Envelope&lt;br /&gt;
message.getSOAPHeader().detachNode();&lt;br /&gt;
System.out.println(&quot;&quot;);&lt;br /&gt;
message.writeTo(System.out);&lt;br /&gt;
// manipulate the body of the SOAP message&lt;br /&gt;
SOAPBody body = message.getSOAPBody();&lt;br /&gt;
SOAPElement getStockPrice = body.addChildElement(&lt;br /&gt;
&quot;getStockPrice&quot;,&lt;br /&gt;
&quot;rt&quot;,&lt;br /&gt;
&quot;http://www.rajeev.com/jws/StockQuote&quot;);&lt;br /&gt;
System.out.println(&quot;&quot;);&lt;br /&gt;
message.writeTo(System.out);&lt;br /&gt;
getStockPrice.setEncodingStyle(SOAPConstants.URI_NS_SOAP_ENCODING);&lt;br /&gt;
System.out.println(&quot;&quot;);&lt;br /&gt;
message.writeTo(System.out);&lt;br /&gt;
SOAPElement code = getStockPrice.addChildElement(&quot;stockCode&quot;);&lt;br /&gt;
System.out.println(&quot;&quot;);&lt;br /&gt;
message.writeTo(System.out);&lt;br /&gt;
code.addTextNode(&quot;IBM&quot;);&lt;br /&gt;
System.out.println(&quot;&quot;);&lt;br /&gt;
message.writeTo(System.out);&lt;br /&gt;
// attach an image&lt;br /&gt;
Image image = Toolkit.getDefaultToolkit().createImage(&quot;raj.jpg&quot;);&lt;br /&gt;
AttachmentPart jpegAttach = message.createAttachmentPart();&lt;br /&gt;
// use setDataHandler method below if connecting to FileDataSource object for pdf file&lt;br /&gt;
jpegAttach.setContent(image, &quot;image/jpeg&quot;);&lt;br /&gt;
// add the mime type for the image&lt;br /&gt;
jpegAttach.addMimeHeader(&quot;Content-Transfer-Encoding&quot;, &quot;binary&quot;);&lt;br /&gt;
jpegAttach.setContentId(&quot;xxx&quot;);&lt;br /&gt;
message.addAttachmentPart(jpegAttach);&lt;br /&gt;
System.out.println(&quot;&quot;);&lt;br /&gt;
//        message.writeTo(System.out); // cannot stream image&lt;br /&gt;
// check attachment created successfully&lt;br /&gt;
System.out.printf(&quot;Number of attachments: %d%n&quot;, message.countAttachments());&lt;br /&gt;
// remove the attachment and verify&lt;br /&gt;
message.removeAllAttachments();&lt;br /&gt;
System.out.printf(&quot;Number of attachments: %d%n&quot;, message.countAttachments());&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
}</content><link rel='replies' type='application/atom+xml' href='http://itis-consultants.blogspot.com/feeds/1773619202075736830/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://itis-consultants.blogspot.com/2010/03/soap-with-attachment-api-for-java-saaj.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7261548585686045052/posts/default/1773619202075736830'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7261548585686045052/posts/default/1773619202075736830'/><link rel='alternate' type='text/html' href='http://itis-consultants.blogspot.com/2010/03/soap-with-attachment-api-for-java-saaj.html' title='SOAP with Attachment API for Java (SAAJ) example'/><author><name>Rajeev Trikha</name><uri>http://www.blogger.com/profile/07435391398428608212</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhVzRuF2tqPUf6AhwZpgELPdLM7-5yz9Su4T6v0q4Da0OUPkOIF7rkrSccgqegK7XcLtAUh8qQ073-QqJBYulq1wSwyJfnqYpGsGvjex7XhmNvdVA6yGzv4-NYp_P9chw/s220/raj.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7261548585686045052.post-5648449413176249506</id><published>2010-03-29T02:20:00.000-07:00</published><updated>2010-03-29T05:55:02.556-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="JAXB tutorial"/><title type='text'>JAXB tutorial</title><content type='html'>XML is the lingua franca of the web services world. Unsurprisingly, the ability to process XML documents simply is an essential requirement. To my mind DOM and SAX parsers are the equivalent of assembler programming compared to the high-level programming provided by the Java Architecture for XML Binding, JAXB. It is an essential tool in every Java developer&#39;s portfolio. But many tutorials on the web hark back to JAXB1.0 so here is something to get you started.&lt;br /&gt;
&lt;br /&gt;
The JAXB tutorial provided by &lt;a href=&quot;http://www.roseindia.net/jaxb/r/jaxb.shtml&quot;&gt;Rose India&lt;/a&gt; is rather dated now. The &lt;a href=&quot;http://www.ibm.com/developerworks/webservices/library/ws-tip-jaxwsrpc2.html&quot;&gt;IBM resource&lt;/a&gt; was a fairly good introduction to Java-XML mapping once upon a time but the Sun/Oracle JAXB tutorial is simply amazing. &lt;br /&gt;
&lt;br /&gt;
Rarely a tutorial is written which is as comprehensive as the one provided &lt;a href=&quot;https://jaxb.dev.java.net/tutorial/index.html&quot;&gt;here&lt;/a&gt;. All the aspects of mapping XML Schema Language types to Java, marshalling Java-based tree content to XML, unmarshalling from XML-to-Java, ObjectFactory class, XML annotations, the JAXB schema compiler (xjc) et al have been covered very lucidly.&lt;br /&gt;
&lt;br /&gt;
If it still doesn&#39;t satisfy your curiosity then the book &lt;a target=&quot;_blank&quot;  href=&quot;http://www.amazon.com/JAXB-2-0-Wolfgang-Schmiesing/dp/3446407537?ie=UTF8&amp;tag=wwwitisconsul-20&amp;link_code=btl&amp;camp=213689&amp;creative=392969&quot;&gt;JAXB 2.0&lt;/a&gt;&lt;img src=&quot;http://www.assoc-amazon.com/e/ir?t=wwwitisconsul-20&amp;l=btl&amp;camp=213689&amp;creative=392969&amp;o=1&amp;a=3446407537&quot; width=&quot;1&quot; height=&quot;1&quot; border=&quot;0&quot; alt=&quot;&quot; style=&quot;border:none !important; margin:0px !important; padding: 0px !important&quot; /&gt; is all you need for all the JAXB requirements but unfortunately it is in German.&lt;br /&gt;
&lt;br /&gt;
Here is a sample code to marshal and unmarshal a simple letter written by me to Helen of Troy.&lt;br /&gt;
&lt;br /&gt;
package raj;&lt;br /&gt;
&lt;br /&gt;
import java.io.File;&lt;br /&gt;
import javax.xml.bind.JAXBContext;&lt;br /&gt;
import javax.xml.bind.Marshaller;&lt;br /&gt;
import javax.xml.bind.Unmarshaller;&lt;br /&gt;
import javax.xml.bind.annotation.XmlAttribute;&lt;br /&gt;
import javax.xml.bind.annotation.XmlRootElement;&lt;br /&gt;
&lt;br /&gt;
@XmlRootElement&lt;br /&gt;
public class Letter {&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
* The sender of the letter.&lt;br /&gt;
*/&lt;br /&gt;
private String sender;&lt;br /&gt;
/**&lt;br /&gt;
* The receiver.&lt;br /&gt;
*/&lt;br /&gt;
private String receiver;&lt;br /&gt;
/**&lt;br /&gt;
* A unique number for the message number sent .&lt;br /&gt;
*/&lt;br /&gt;
private int messageNo;&lt;br /&gt;
/**&lt;br /&gt;
* The missive despatched.&lt;br /&gt;
*/&lt;br /&gt;
private String message;&lt;br /&gt;
&lt;br /&gt;
public Letter() {&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
public String getSender() {&lt;br /&gt;
return sender;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
public void setSender(String sender) {&lt;br /&gt;
this.sender = sender;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
public String getReceiver() {&lt;br /&gt;
return receiver;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
public void setReceiver(String receiver) {&lt;br /&gt;
this.receiver = receiver;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
public String getMessage() {&lt;br /&gt;
return message;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
public void setMessage(String message) {&lt;br /&gt;
this.message = message;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
public int getMessageNo() {&lt;br /&gt;
return messageNo;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
@XmlAttribute&lt;br /&gt;
public void setMessageNo(int messageNo) {&lt;br /&gt;
this.messageNo = messageNo;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
public String toString() {&lt;br /&gt;
return String.format(&quot;Letter %s from %s to %s, saying &#39;%s&#39;&quot;, messageNo, sender, receiver, message);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
public static void main(String[] arg) {&lt;br /&gt;
Letter text = new Letter();&lt;br /&gt;
text.setSender(&quot;Rajeev Trikha&quot;);&lt;br /&gt;
text.setMessageNo(2010);&lt;br /&gt;
text.setReceiver(&quot;Helen of Troy&quot;);&lt;br /&gt;
text.setMessage(&quot;Welcome to my world of JAXB in 2010!&quot;);&lt;br /&gt;
// Create a JAXB context and a marshaller&lt;br /&gt;
try {&lt;br /&gt;
// here just using a class as an argument but normally is a package&lt;br /&gt;
JAXBContext context = JAXBContext.newInstance(Letter.class);&lt;br /&gt;
Marshaller marshaller = context.createMarshaller();&lt;br /&gt;
// Set the output in formatted manner&lt;br /&gt;
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);&lt;br /&gt;
// Make the actual serialization&lt;br /&gt;
&lt;br /&gt;
marshaller.marshal(text, new File(&quot;raj.xml&quot;));&lt;br /&gt;
Unmarshaller unmarshaller = context.createUnmarshaller();&lt;br /&gt;
// Get the object&lt;br /&gt;
Letter msg = (Letter) unmarshaller.unmarshal(new File(&quot;raj.xml&quot;));&lt;br /&gt;
System.out.println(msg);&lt;br /&gt;
} catch (Exception e) {&lt;br /&gt;
System.out.println(&quot;exc&quot;);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
The marshalled file raj.xml shows the created XML message which is well indented.&lt;br /&gt;
&lt;br /&gt;
The unmarshalling prints out to the console: &lt;br /&gt;
Letter 2010 from Rajeev Trikha to Helen of Troy, saying &#39;Welcome to my world of JAXB in 2010!&#39;&lt;br /&gt;
&lt;br /&gt;
If you are using Netbeans then &lt;a href=&quot;http://netbeans.org/kb/docs/websvc/jaxb.html&quot;&gt;check out&lt;/a&gt; for understanding how xjc is tied up within the product.</content><link rel='replies' type='application/atom+xml' href='http://itis-consultants.blogspot.com/feeds/5648449413176249506/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://itis-consultants.blogspot.com/2010/03/jaxb-tutorial.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7261548585686045052/posts/default/5648449413176249506'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7261548585686045052/posts/default/5648449413176249506'/><link rel='alternate' type='text/html' href='http://itis-consultants.blogspot.com/2010/03/jaxb-tutorial.html' title='JAXB tutorial'/><author><name>Rajeev Trikha</name><uri>http://www.blogger.com/profile/07435391398428608212</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhVzRuF2tqPUf6AhwZpgELPdLM7-5yz9Su4T6v0q4Da0OUPkOIF7rkrSccgqegK7XcLtAUh8qQ073-QqJBYulq1wSwyJfnqYpGsGvjex7XhmNvdVA6yGzv4-NYp_P9chw/s220/raj.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7261548585686045052.post-6428375383225852286</id><published>2010-03-20T02:48:00.000-07:00</published><updated>2010-03-25T04:44:58.505-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Corba"/><category scheme="http://www.blogger.com/atom/ns#" term="web services"/><title type='text'>CORBA or web services</title><content type='html'>CORBA has the key advantage of being truly object-oriented component architecture and comes with a host of standard services like naming, transactions, printing, events etc which support complex applications in a heterogeneous environment in a platform and language independent manner. For example, there is no equivalent of CORBA Security service in web service environment and only now the suppliers have started addressing these aspects. So the disadvantage of web services over CORBA is that it is reinventing-the-wheel and cannot handle the required amount of complexity in its current state. However the complexity of CORBA, the issues with its specification and the slowness of new development have opened way for web services which are more suited to web-environment with their loose coupling, XML and HTTP usage. The SOAP messages of web services are simple to use and implement. Unsurprisingly, this simplicity has given momentum to web services over CORBA.&lt;br /&gt;
&lt;br /&gt;
&lt;a target=&quot;_blank&quot;  href=&quot;http://www.amazon.com/Java-Web-Services-Up-Running/dp/059652112X?ie=UTF8&amp;tag=wwwitisconsul-20&amp;link_code=btl&amp;camp=213689&amp;creative=392969&quot;&gt;Java Web Services: Up and Running&lt;/a&gt;&lt;img src=&quot;http://www.assoc-amazon.com/e/ir?t=wwwitisconsul-20&amp;l=btl&amp;camp=213689&amp;creative=392969&amp;o=1&amp;a=059652112X&quot; width=&quot;1&quot; height=&quot;1&quot; border=&quot;0&quot; alt=&quot;&quot; style=&quot;border:none !important; margin:0px !important; padding: 0px !important&quot; /&gt; is one of the most up-to-date and practical books on web services.</content><link rel='replies' type='application/atom+xml' href='http://itis-consultants.blogspot.com/feeds/6428375383225852286/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://itis-consultants.blogspot.com/2010/03/corba-or-web-services.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7261548585686045052/posts/default/6428375383225852286'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7261548585686045052/posts/default/6428375383225852286'/><link rel='alternate' type='text/html' href='http://itis-consultants.blogspot.com/2010/03/corba-or-web-services.html' title='CORBA or web services'/><author><name>Rajeev Trikha</name><uri>http://www.blogger.com/profile/07435391398428608212</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhVzRuF2tqPUf6AhwZpgELPdLM7-5yz9Su4T6v0q4Da0OUPkOIF7rkrSccgqegK7XcLtAUh8qQ073-QqJBYulq1wSwyJfnqYpGsGvjex7XhmNvdVA6yGzv4-NYp_P9chw/s220/raj.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7261548585686045052.post-3219947943642026503</id><published>2010-03-20T02:37:00.000-07:00</published><updated>2010-03-20T02:42:42.792-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="SOAP"/><category scheme="http://www.blogger.com/atom/ns#" term="UDDI"/><category scheme="http://www.blogger.com/atom/ns#" term="W3C standards"/><category scheme="http://www.blogger.com/atom/ns#" term="WSDL"/><category scheme="http://www.blogger.com/atom/ns#" term="XML"/><title type='text'>W3C standards for web services</title><content type='html'>The key W3C standards for web services are SOAP (previously Simple Object Access Protocol), eXtensible Markup Language (XML), Web Services Description Language (WSDL) and, peripherally, Universal Description, Discovery and Integration (UDDI).&lt;br /&gt;&lt;br /&gt;SOAP is protocol which facilitates message-based communication between heterogeneous systems using XML over HTTP (usually) in a defined form. The SOAP message envelop is well-formed, its tags are qualified by a namespace, avoids firewall issues as HTTP port is always open and is part of the body of HTTP request or response.  &lt;br /&gt;&lt;br /&gt;XML has become the de facto standard for exchanging data between systems as it segregates the meaning of data from its presentation in a plain Unicode text file. SOAP, WSDL and UDDI entries use XML. XML Schema Definition (XSD) is W3C standard for constraining documents vocabularies. The XML files are inherently readable, compressible, portable and support internationalisation, which are pre-requisites in a complex heterogeneous environment. To testify to its popularity, the vocabularies with defined elements and attributes exist for various business domains and the language is extensible. It has become the lingua franca of inter-system communication. SOAP protocol and WSDL descriptions use it. XML messages can be sent over HTTP channels, XML parsers exist in abundance and Data Type Definitions (DTD) or XML Schemas of various vocabularies means that irrespective of platform and implementation language a received XML document can be checked for conformance and meaning and facilitates communication.&lt;br /&gt;&lt;br /&gt;WSDL provides platform-independent definition of interfaces of a web service. A WSDL definition describes the location, protocol, service operations, parameters etc in an XML file thus facilitating the segregation of description from the actual implementation. The definition enables one to understand the service and its operations and invoke them.&lt;br /&gt;&lt;br /&gt;The UDDI specification is managed by OASIS but it is so central to web services use that it will be churlish to avoid it. UDDI enables web services to be registered and discovered in standard way. The creators of web services register their services in the registry and the potential customers/users discover them there and use them. The white pages, yellow pages and green pages of UDDI entries are well understood and utilised by all who are interested in services-oriented architecture.</content><link rel='replies' type='application/atom+xml' href='http://itis-consultants.blogspot.com/feeds/3219947943642026503/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://itis-consultants.blogspot.com/2010/03/w3c-standards-for-web-services.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7261548585686045052/posts/default/3219947943642026503'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7261548585686045052/posts/default/3219947943642026503'/><link rel='alternate' type='text/html' href='http://itis-consultants.blogspot.com/2010/03/w3c-standards-for-web-services.html' title='W3C standards for web services'/><author><name>Rajeev Trikha</name><uri>http://www.blogger.com/profile/07435391398428608212</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhVzRuF2tqPUf6AhwZpgELPdLM7-5yz9Su4T6v0q4Da0OUPkOIF7rkrSccgqegK7XcLtAUh8qQ073-QqJBYulq1wSwyJfnqYpGsGvjex7XhmNvdVA6yGzv4-NYp_P9chw/s220/raj.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7261548585686045052.post-3929645651079998509</id><published>2010-03-20T01:20:00.000-07:00</published><updated>2010-03-25T04:50:46.871-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Java training"/><category scheme="http://www.blogger.com/atom/ns#" term="Kingston-Upon-Thames"/><category scheme="http://www.blogger.com/atom/ns#" term="London"/><category scheme="http://www.blogger.com/atom/ns#" term="SCJP"/><title type='text'>Java training course to pass SCJP 6 in Kingston-Upon-Thames</title><content type='html'>&lt;span class=&quot;Apple-style-span&quot;   style=&quot;  border-collapse: collapse; font-family:arial, sans-serif;font-size:13px;&quot;&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;   style=&quot;  border-collapse: collapse; font-family:arial, sans-serif;font-size:13px;&quot;&gt;If you live in the vicinity of Kingston-Upon-Thames or are based in London then here is an excellent opportunity to learn Java for £300. Obviously the intention of the course is to give a thorough grounding in Java but the course is structured around the objectives of SCJP 6. You do not need any prior exposure to programming or Java to do this course.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;   style=&quot;  border-collapse: collapse; font-family:arial, sans-serif;font-size:13px;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;We will use Netbeans IDE  and focus on the objective of SCJP 6. The idea is to make students comfortable with all the relevant classes in JDK 6 and have good foundational knowledge of object orientated concepts like inheritance polymorphism, and encapsulation. &lt;/span&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;   style=&quot;  border-collapse: collapse; font-family:arial, sans-serif;font-size:13px;&quot;&gt;The SCJP focuses on modifiers, wrapper classes, autoboxing, flow control, loops, exceptions, APIs, serialization, threads, packaging (JARs), collections, generics, garbage collection, assertions, regular expressions, var-args, covariant returns, static imports, enum, inner classes etc and we will cover all these aspects of Java language over the five days. The IDE hides complexity so we will do some command line compilation and running of programs to give a clear feel for how packages work and the various flags in java and javac&lt;/span&gt;&lt;div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;   style=&quot;  border-collapse: collapse; font-family:arial, sans-serif;font-size:13px;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;   style=&quot;  border-collapse: collapse; font-family:arial, sans-serif;font-size:13px;&quot;&gt;What is most important is that we will provide the support till you actually pass the SCJP exam. Note that the Prometric centre examination fees are not covered in the course cost.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;   style=&quot;  border-collapse: collapse; font-family:arial, sans-serif;font-size:13px;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;   style=&quot;  border-collapse: collapse; font-family:arial, sans-serif;font-size:13px;&quot;&gt;For more information either phone me at 0208 541 0225 or email rajeev108@gmail.com&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;
&lt;a target=&quot;_blank&quot;  href=&quot;http://www.amazon.com/SCJP-Certified-Programmer-Java-310-065/dp/0071591060?ie=UTF8&amp;tag=wwwitisconsul-20&amp;link_code=btl&amp;camp=213689&amp;creative=392969&quot;&gt;SCJP Sun Certified Programmer for Java 6 Exam 310-065&lt;/a&gt;&lt;img src=&quot;http://www.assoc-amazon.com/e/ir?t=wwwitisconsul-20&amp;l=btl&amp;camp=213689&amp;creative=392969&amp;o=1&amp;a=0071591060&quot; width=&quot;1&quot; height=&quot;1&quot; border=&quot;0&quot; alt=&quot;&quot; style=&quot;border:none !important; margin:0px !important; padding: 0px !important&quot; /&gt; is the recommended book if you really want to come to grip with the language and pass the SCJP.</content><link rel='replies' type='application/atom+xml' href='http://itis-consultants.blogspot.com/feeds/3929645651079998509/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://itis-consultants.blogspot.com/2010/03/java-training-course-to-pass-scjp-6-in.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7261548585686045052/posts/default/3929645651079998509'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7261548585686045052/posts/default/3929645651079998509'/><link rel='alternate' type='text/html' href='http://itis-consultants.blogspot.com/2010/03/java-training-course-to-pass-scjp-6-in.html' title='Java training course to pass SCJP 6 in Kingston-Upon-Thames'/><author><name>Rajeev Trikha</name><uri>http://www.blogger.com/profile/07435391398428608212</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhVzRuF2tqPUf6AhwZpgELPdLM7-5yz9Su4T6v0q4Da0OUPkOIF7rkrSccgqegK7XcLtAUh8qQ073-QqJBYulq1wSwyJfnqYpGsGvjex7XhmNvdVA6yGzv4-NYp_P9chw/s220/raj.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7261548585686045052.post-8782815338861623189</id><published>2010-03-15T23:47:00.000-07:00</published><updated>2010-03-16T00:35:24.641-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Java"/><category scheme="http://www.blogger.com/atom/ns#" term="Netbeans"/><category scheme="http://www.blogger.com/atom/ns#" term="Sun"/><category scheme="http://www.blogger.com/atom/ns#" term="UML editor"/><category scheme="http://www.blogger.com/atom/ns#" term="XSD editor"/><title type='text'>Return of some useful plugins in Netbeans6.9</title><content type='html'>The introduction of Netbeans6.8 was a mixed blessing. Its support for JSF2.0 and ease of development at various-fronts is indeed praiseworthy but the downside was that we lost many useful plugins including visual web tool for JSF development, UML editor, XML schema editor etc. The&lt;a href=&quot;http://forums.netbeans.org/topic20097.html&quot;&gt; howls of anguish&lt;/a&gt; were widespread. Sun justified it on the basis of instability of some of the tools and the strategic need to marshal resources on winning fronts. Well, Netbeans6.9 early release have some of these back. It indeed is a good news for champions of these tools but it leaves the question answered on the future direction of these tools in the hands of Oracle. The departure of Sun&#39;s CEO Jonathan Schwartz, the chief open source officer Simon Phipps and Java technology evangelist Sang Shin (whose javapassion.com was a useful tool for learning various Java technologies) is indicative of the winds of change. Are these back because of the transitional uncertainties? Whatever the reason, enjoy while they are available.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Many know how to add a new plugin in Netbeans using Tools/Plugins/Available Plugins but fewer are certain of Tools/Plugins/Downloaded/Add Plugins which allows the .nbm (the Netbeans distribution files or Netbeans Modules files) to be incorporated in our &#39;User Installed Plugins) section. The latter option is the one you need to use if you are downloading a zip file from the Sun&#39;s site with the appropriate plugin and want to include it in your environment.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I recall an interview of Leo Apotheker (SAPS&#39;s ex-CEO) at Charlie Rose last year where he surmised that SAP may even get in the business of producing hardware devices. The rationale was that the software could easily integrate into remotely monitoring utilities meters and other devices and as BI Accelerator shows that the marriage is inevitable in many cases. Whilst there is feverish speculation on the direction of Java, MySql, OpenOffice etc under the aegis of Oracle, it may well be that it is the hardware/software marriage which underpins the acquisition. But it is hard to remain sanguine about these technologies future under a profit-driven acquisitor like Oracle. The Netbeans tools mentioned above may have gained temporary life while Oracle rationalises their product portfolio. So let us temporarily enjoy their availability whilst there are transitional uncertainties.&lt;/div&gt;&lt;div&gt; &lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://itis-consultants.blogspot.com/feeds/8782815338861623189/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://itis-consultants.blogspot.com/2010/03/return-of-some-useful-plugins-in.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7261548585686045052/posts/default/8782815338861623189'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7261548585686045052/posts/default/8782815338861623189'/><link rel='alternate' type='text/html' href='http://itis-consultants.blogspot.com/2010/03/return-of-some-useful-plugins-in.html' title='Return of some useful plugins in Netbeans6.9'/><author><name>Rajeev Trikha</name><uri>http://www.blogger.com/profile/07435391398428608212</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhVzRuF2tqPUf6AhwZpgELPdLM7-5yz9Su4T6v0q4Da0OUPkOIF7rkrSccgqegK7XcLtAUh8qQ073-QqJBYulq1wSwyJfnqYpGsGvjex7XhmNvdVA6yGzv4-NYp_P9chw/s220/raj.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7261548585686045052.post-2843909308032779644</id><published>2010-03-15T08:30:00.000-07:00</published><updated>2010-03-15T10:16:29.003-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Netbeans"/><category scheme="http://www.blogger.com/atom/ns#" term="Web service"/><title type='text'>Creating and consuming a web service using Netbeans</title><content type='html'>&lt;div style=&quot;text-align: left;&quot;&gt;Here are the steps for creating a simple service which allows two numbers to be multiplied:&lt;/div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;create a new web application project called MultiplyApp (File/New project/Java Web/Web Application)&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;Click on the MultiplyApp node in the project and add a new web service called MultiplyWS (new/Web Service and type MultiplyWS as the Web Service Name and raj as the Package)&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;Expand the new created Web Services folder and look at the source of MultiplyWS. The default skeleton code should be showing error on MultiplyWS class as it has no operation as yet.&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;Right click within the class definition and define the multiply operation with long return type and two int type parameters i and j (insert Code/Add Web Service Operation)&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: rgb(0, 0, 238); -webkit-text-decorations-in-effect: underline; &quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg-VlkHsF3RqG9CwvJTHJ6czbOX3rcvRz01tukHoFER7NwAoD3N6G4p6m1HPnTnhZHgruF48PDulh-je2HnAuLAExixcCWM4MlKHlm4t2pySA24aID8YLB8Jk4BcqLcXk31k46GrBQbK40/s400/ws.JPG&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5448891342286443362&quot; style=&quot;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; text-align: center; cursor: pointer; width: 400px; height: 300px; &quot; /&gt;&lt;/span&gt; &lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: rgb(0, 0, 238); -webkit-text-decorations-in-effect: underline; &quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;Change the MultiplyWS. java code from return 0; to return i * j;&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;Right click on the MultiplyApp node and select Deploy to deploy the web service.&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;Right click on MultiplyWS in Web Service folder and select Test Web Service to see the service behaviour.&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;Right click on MultiplyApp and select Properties and then choose Run category and change the relative path to /MultiplyWSService?Tester&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;At this stage our service is ready but we need service consumers which can be any Java application, a servlet or a JSP. We cover the steps for the Java application in some detail but the process for creating a JSP or servlet consumer follows the same pattern.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;Create a new Java application project called MultiplyClient (File/New Project/Java/Java Application). Leave the Create Main Class box checked while creating.&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;Right click on the project name MultiplyClient and create new web service client (New/Web Service Client). Select the MultiplyWS service in Project by using Browse.&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: rgb(0, 0, 238); -webkit-text-decorations-in-effect: underline; &quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiw3jAJVMjCS3zGP2h3M-xZCxbFJx6P9n5UvhHZI-Kr29xzyt_fmpTqG1IeAfupDSJ02cKjh_RDvaP9WrpIQWcT7hGAsRX6yJGA-kmrtZURGQMIIrrkwMSc-QtoQ-j2DvQR6vFxXRjd0Dg/s400/ws2.JPG&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5448900918974310658&quot; style=&quot;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; text-align: center; cursor: pointer; width: 400px; height: 268px; &quot; /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;Right click within main method of our Main.java class and select Insert Code/Call Web Service Operation and choose multiply from the available web service references.&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;Set the values of i and j and add in a code to print exception if you want.&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;Run the project and verify that the console printed the correct multiplication of i and j variables which we set in the previous step.&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;The process for creating the JSP or servlet-based client is the same, barring the fact that when we create a new project we choose File/New Project/Java Web/Web Application. We go through all the steps as above but we add the logic in a new servlet or a JSP and set the relative path in the project/properties/run  accordingly to make these the entry points. Obviously the syntactic changes would be there to reflect that we are dealing with a servlet or a JSP when Insert Code/Call Web Service Operation happens. The only point worth mentioning is that the multiply operation can be dragged from the Web Service References to the appropriate point in the code to auto-generate the appropriate logic for the service call at that point. Thus for JSP we get this:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: rgb(0, 0, 238); -webkit-text-decorations-in-effect: underline; &quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhDRd7Bfp-fTyPmKUmiEYioT0QsdxL1iTUca5NRZGikzqY2TDgpX9IeEYGsLrS3F6dAOljyTbb-WumWUQO4OmMlrC6-uLVWuKaOSEmlRqb4duM_j0SFSSMjXsQfExi4dtpq6cB9dys-sQE/s400/ws3.JPG&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5448910529710282242&quot; style=&quot;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; text-align: center; cursor: pointer; width: 400px; height: 288px; &quot; /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: rgb(0, 0, 238); -webkit-text-decorations-in-effect: underline; &quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Experiment and enjoy! &lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;color:#0000EE;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;color:#0000EE;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;color:#0000EE;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: rgb(0, 0, 238); -webkit-text-decorations-in-effect: underline; &quot;&gt;&lt;br /&gt;&lt;/span&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;</content><link rel='replies' type='application/atom+xml' href='http://itis-consultants.blogspot.com/feeds/2843909308032779644/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://itis-consultants.blogspot.com/2010/03/creating-and-consuming-web-service.html#comment-form' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7261548585686045052/posts/default/2843909308032779644'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7261548585686045052/posts/default/2843909308032779644'/><link rel='alternate' type='text/html' href='http://itis-consultants.blogspot.com/2010/03/creating-and-consuming-web-service.html' title='Creating and consuming a web service using Netbeans'/><author><name>Rajeev Trikha</name><uri>http://www.blogger.com/profile/07435391398428608212</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhVzRuF2tqPUf6AhwZpgELPdLM7-5yz9Su4T6v0q4Da0OUPkOIF7rkrSccgqegK7XcLtAUh8qQ073-QqJBYulq1wSwyJfnqYpGsGvjex7XhmNvdVA6yGzv4-NYp_P9chw/s220/raj.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg-VlkHsF3RqG9CwvJTHJ6czbOX3rcvRz01tukHoFER7NwAoD3N6G4p6m1HPnTnhZHgruF48PDulh-je2HnAuLAExixcCWM4MlKHlm4t2pySA24aID8YLB8Jk4BcqLcXk31k46GrBQbK40/s72-c/ws.JPG" height="72" width="72"/><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7261548585686045052.post-7108612326805234464</id><published>2010-03-14T00:33:00.000-08:00</published><updated>2010-03-14T01:10:22.740-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Command design pattern"/><category scheme="http://www.blogger.com/atom/ns#" term="Java"/><title type='text'>Command design pattern</title><content type='html'>&lt;div&gt;The command pattern basically has client, command, invoker and the receiver. The pattern encapsulates request (command)  as an object. It decouples the client from the receiver. The requests are defined through concrete commands which encapsulate the receiver and implement the command interface containing a single execute() method in it. It uses an invoker with a standardised interface (execute())  to invoke the request on the receiver. The invoker has no knowledge of the receiver. The concrete command it invokes knows about the receiver, the action to invoke on it and the parameters to be passed to it. We are basically issuing requests to objects without knowing anything about the receiver of the object or the method being invoked on it.&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;We will illustrate it with an example whose UML is in Fig1.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg2OY9RueN9fCQ8umkdHcf-mFMR2cnaqxN3D4nhhytqZ-p1NrNSo3J9CnbGyYZiWkMJmkZ30LQlbzZxyNIucVZw_kO7_x21M4jAa9zUoEY94PZTRl7Nx0R4tmj_AYlD_awGDBrQswvjkdM/s320/command.jpg&quot; /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The walk through the example is self-explanatory.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;package raj;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;public class TestCommand {&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;    public static void main(String[] arg) {&lt;/div&gt;&lt;div&gt;        // First illustrate the tight coupling of Horse class&lt;/div&gt;&lt;div&gt;        Horse horse = new Horse();&lt;/div&gt;&lt;div&gt;        horse.eat();&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;        /* Obviously we could do this with other classes too&lt;/div&gt;&lt;div&gt;         * but we want to decouple the receiver of the action&lt;/div&gt;&lt;div&gt;         * from the client using action commands invoked by an&lt;/div&gt;&lt;div&gt;         * intermediary, the Invoker.&lt;/div&gt;&lt;div&gt;         */&lt;/div&gt;&lt;div&gt;        // create the command we want to invoke&lt;/div&gt;&lt;div&gt;        Command command = new EatCommand(new Horse());&lt;/div&gt;&lt;div&gt;        // create the invoker&lt;/div&gt;&lt;div&gt;        Invoker invoker = new Invoker();&lt;/div&gt;&lt;div&gt;        // Tell the invoker about the command we want to execute&lt;/div&gt;&lt;div&gt;        invoker.setCommand(command);&lt;/div&gt;&lt;div&gt;        // execute the EatCommand via the invoker&lt;/div&gt;&lt;div&gt;        invoker.execute();&lt;/div&gt;&lt;div&gt;        // change the animal to tiger and execute&lt;/div&gt;&lt;div&gt;        command = new EatCommand(new Tiger());&lt;/div&gt;&lt;div&gt;        invoker.setCommand(command);&lt;/div&gt;&lt;div&gt;        invoker.execute();&lt;/div&gt;&lt;div&gt;        // illustrate how we can do no action&lt;/div&gt;&lt;div&gt;        invoker.setCommand(new NoCommand());&lt;/div&gt;&lt;div&gt;        invoker.execute();&lt;/div&gt;&lt;div&gt;        // create a different type of command on a different class&lt;/div&gt;&lt;div&gt;        // illustrate the action can do multiple things&lt;/div&gt;&lt;div&gt;        invoker.setCommand(new ExamineCommand(new Vet()));&lt;/div&gt;&lt;div&gt;        invoker.execute();&lt;/div&gt;&lt;div&gt;        // pass parameters to command&lt;/div&gt;&lt;div&gt;        invoker.setCommand(new PaperWorkCommand(new Clerk(), &quot;Efficienly&quot;));&lt;/div&gt;&lt;div&gt;        invoker.execute();&lt;/div&gt;&lt;div&gt;    }&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;interface Command {&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;    public void execute();&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;class Invoker implements Command {&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;    Command command;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;    public void execute() {&lt;/div&gt;&lt;div&gt;        command.execute();&lt;/div&gt;&lt;div&gt;    }&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;    public void setCommand(Command command) {&lt;/div&gt;&lt;div&gt;        this.command = command;&lt;/div&gt;&lt;div&gt;    }&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;class NoCommand implements Command {&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;    public void execute() {&lt;/div&gt;&lt;div&gt;    }&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;class EatCommand implements Command {&lt;/div&gt;&lt;div&gt;    /* the key thing is that the command knows about the receiver&lt;/div&gt;&lt;div&gt;     * (contains Animal in this case)&lt;/div&gt;&lt;div&gt;     * and the type of action to take on it (run eat() method)&lt;/div&gt;&lt;div&gt;     */&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;    Animal animal;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;    EatCommand(Animal animal) {&lt;/div&gt;&lt;div&gt;        this.animal = animal;&lt;/div&gt;&lt;div&gt;    }&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;    public void execute() {&lt;/div&gt;&lt;div&gt;        animal.eat();&lt;/div&gt;&lt;div&gt;    }&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;class ExamineCommand implements Command {&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;    Vet vet;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;    ExamineCommand(Vet vet) {&lt;/div&gt;&lt;div&gt;        this.vet = vet;&lt;/div&gt;&lt;div&gt;    }&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;    public void execute() {&lt;/div&gt;&lt;div&gt;        vet.openSurgery();&lt;/div&gt;&lt;div&gt;        vet.examine();&lt;/div&gt;&lt;div&gt;        vet.closeSurgery();&lt;/div&gt;&lt;div&gt;    }&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;class PaperWorkCommand implements Command {&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;    Clerk clerk;&lt;/div&gt;&lt;div&gt;    String efficiency;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;    PaperWorkCommand(Clerk clerk, String efficiency) {&lt;/div&gt;&lt;div&gt;        this.clerk = clerk;&lt;/div&gt;&lt;div&gt;        this.efficiency = efficiency;&lt;/div&gt;&lt;div&gt;    }&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;    public void execute() {&lt;/div&gt;&lt;div&gt;        clerk.pushPaper(efficiency);&lt;/div&gt;&lt;div&gt;    }&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;class Animal {&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;    public void eat() {&lt;/div&gt;&lt;div&gt;        System.out.println(&quot;Eating generically&quot;);&lt;/div&gt;&lt;div&gt;    }&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;class Horse extends Animal {&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;    public void eat() {&lt;/div&gt;&lt;div&gt;        System.out.println(&quot;Eating grass&quot;);&lt;/div&gt;&lt;div&gt;    }&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;class Tiger extends Animal {&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;    public void eat() {&lt;/div&gt;&lt;div&gt;        System.out.println(&quot;Eating meat&quot;);&lt;/div&gt;&lt;div&gt;    }&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;    public void attack() {&lt;/div&gt;&lt;div&gt;        System.out.println(&quot;Killing a prey&quot;);&lt;/div&gt;&lt;div&gt;    }&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;class Vet {&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;    public void examine() {&lt;/div&gt;&lt;div&gt;        System.out.println(&quot;Examine an animal&quot;);&lt;/div&gt;&lt;div&gt;    }&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;    public void openSurgery() {&lt;/div&gt;&lt;div&gt;        System.out.println(&quot;Surgery opened&quot;);&lt;/div&gt;&lt;div&gt;    }&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;    public void closeSurgery() {&lt;/div&gt;&lt;div&gt;        System.out.println(&quot;Surgery closed&quot;);&lt;/div&gt;&lt;div&gt;    }&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;class Clerk {&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;    public void pushPaper(String efficiency) {&lt;/div&gt;&lt;div&gt;        System.out.println(&quot;Doing paperwork &quot; + efficiency);&lt;/div&gt;&lt;div&gt;    }&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Note that &lt;a href=&quot;http://itis-consultants.blogspot.com/2010/03/strategy-design-pattern.html&quot;&gt;strategy pattern &lt;/a&gt; had also encapsulated behaviour.&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;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://itis-consultants.blogspot.com/feeds/7108612326805234464/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://itis-consultants.blogspot.com/2010/03/command-design-pattern.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7261548585686045052/posts/default/7108612326805234464'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7261548585686045052/posts/default/7108612326805234464'/><link rel='alternate' type='text/html' href='http://itis-consultants.blogspot.com/2010/03/command-design-pattern.html' title='Command design pattern'/><author><name>Rajeev Trikha</name><uri>http://www.blogger.com/profile/07435391398428608212</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhVzRuF2tqPUf6AhwZpgELPdLM7-5yz9Su4T6v0q4Da0OUPkOIF7rkrSccgqegK7XcLtAUh8qQ073-QqJBYulq1wSwyJfnqYpGsGvjex7XhmNvdVA6yGzv4-NYp_P9chw/s220/raj.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg2OY9RueN9fCQ8umkdHcf-mFMR2cnaqxN3D4nhhytqZ-p1NrNSo3J9CnbGyYZiWkMJmkZ30LQlbzZxyNIucVZw_kO7_x21M4jAa9zUoEY94PZTRl7Nx0R4tmj_AYlD_awGDBrQswvjkdM/s72-c/command.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7261548585686045052.post-4740786795489801013</id><published>2010-03-13T11:20:00.001-08:00</published><updated>2010-03-13T12:20:40.673-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Java"/><category scheme="http://www.blogger.com/atom/ns#" term="Observer design pattern"/><category scheme="http://www.blogger.com/atom/ns#" term="Publisher-Subscriber pattern"/><title type='text'>Observer design pattern (Publisher-Subscriber)</title><content type='html'>The use of observer design pattern is ubiquitous in Java. We just have to consider Swing classes, GUI frameworks, RMI, JavaBeans etc to note its pervasive nature. Whenever a component registers for an action event, it is using the Observer pattern. The straightforward principle is that whenever multiple parties (observers) are interested in the changes of state of an object (subject/observable) then they subscribe for the notification of changes. The observable object monitors its state and on observing relevant change in its state, it notifies all the interested parties through a common update() interface. The subject provides methods for the subscription and un-subscription. Obviously, the subject can either push all the changes to the observers or allow the observers to pull the changes on notification through provides API. The key is that the subject and the observers are loosely coupled, as the subject has no knowledge of the observers.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Our sample program clearly illustrate the principle.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;package raj;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;import java.util.ArrayList;&lt;/div&gt;&lt;div&gt;import java.util.List;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;public class TestObserver {&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;    public static void main(String[] arg) {&lt;/div&gt;&lt;div&gt;        // create the subject we are interested in subscribing&lt;/div&gt;&lt;div&gt;        Subject subject = new Subject();&lt;/div&gt;&lt;div&gt;        // create the subscriber for the subject&lt;/div&gt;&lt;div&gt;        Bar interestedObserver = new Bar();&lt;/div&gt;&lt;div&gt;        // add subscribers&lt;/div&gt;&lt;div&gt;        subject.addObserver(new Foo());&lt;/div&gt;&lt;div&gt;        subject.addObserver(new Bar());&lt;/div&gt;&lt;div&gt;        subject.addObserver(interestedObserver);&lt;/div&gt;&lt;div&gt;        // subject state changes; the observers notified&lt;/div&gt;&lt;div&gt;        subject.stateChange();&lt;/div&gt;&lt;div&gt;        // unsubscribe&lt;/div&gt;&lt;div&gt;        subject.removeObserver(interestedObserver);&lt;/div&gt;&lt;div&gt;        // check the unsubscribed party doesn&#39;t get further notification&lt;/div&gt;&lt;div&gt;        subject.stateChange();&lt;/div&gt;&lt;div&gt;    }&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;class Subject {&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;    List&lt;observer&gt; observerList = new ArrayList&lt;observer&gt;();&lt;/observer&gt;&lt;/observer&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;    public void addObserver(Observer o) {&lt;/div&gt;&lt;div&gt;        observerList.add(o);&lt;/div&gt;&lt;div&gt;    }&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;    public void removeObserver(Observer o) {&lt;/div&gt;&lt;div&gt;        int index = observerList.indexOf(o);&lt;/div&gt;&lt;div&gt;        if (index &gt;= 0) {&lt;/div&gt;&lt;div&gt;            observerList.remove(index);&lt;/div&gt;&lt;div&gt;        }&lt;/div&gt;&lt;div&gt;    }&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;    public void notifyObservers() {&lt;/div&gt;&lt;div&gt;        for (Observer o : observerList) {&lt;/div&gt;&lt;div&gt;            o.update(&quot;change&quot;);&lt;/div&gt;&lt;div&gt;        }&lt;/div&gt;&lt;div&gt;    }&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;    public void stateChange() {&lt;/div&gt;&lt;div&gt;        notifyObservers();&lt;/div&gt;&lt;div&gt;    }&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;interface Observer {&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;    public void update(String message);&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;class Foo implements Observer {&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;    public void update(String message) {&lt;/div&gt;&lt;div&gt;        System.out.println(&quot;Foo: &quot; + message);&lt;/div&gt;&lt;div&gt;    }&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;class Bar implements Observer {&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;    public void update(String message) {&lt;/div&gt;&lt;div&gt;        System.out.println(&quot;Bar: &quot; + message);&lt;/div&gt;&lt;div&gt;    }&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;We have opted for push technique in our example but it could be more appropriate to use pull as it allows the observer more flexibility in responding to the change.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Also it is worth noticing that Java provides its own implementation of Observer and Observable in the java.util package so the above sample could have been codes as:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;import java.util.Observable;&lt;/div&gt;&lt;div&gt;import java.util.Observer;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;public class JavaObserver extends Observable {&lt;/div&gt;&lt;div&gt;  private String message;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;  public String getMessage() {&lt;/div&gt;&lt;div&gt;    return message;&lt;/div&gt;&lt;div&gt;  }&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;  public void stateChange(String message) {&lt;/div&gt;&lt;div&gt;    this.message = message;&lt;/div&gt;&lt;div&gt;    setChanged(); // signifies state change&lt;/div&gt;&lt;div&gt;    notifyObservers(message);&lt;/div&gt;&lt;div&gt;// the line below is for &#39;pull&#39; as we pass the object so getMessage() can be invoked&lt;/div&gt;&lt;div&gt;// notifyObservers(this);&lt;/div&gt;&lt;div&gt;  }&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;  public static void main(String[] args) {&lt;/div&gt;&lt;div&gt;    JavaObserver subject = new JavaObserver();&lt;/div&gt;&lt;div&gt;    Baz bar = new Baz();&lt;/div&gt;&lt;div&gt;    Baz baz = new Baz();&lt;/div&gt;&lt;div&gt;    Baz foo = new Baz();&lt;/div&gt;&lt;div&gt;    subject.addObserver(foo);&lt;/div&gt;&lt;div&gt;    subject.addObserver(bar);&lt;/div&gt;&lt;div&gt;    subject.addObserver(baz);&lt;/div&gt;&lt;div&gt;    subject.stateChange(&quot;Change!&quot;);&lt;/div&gt;&lt;div&gt;  }&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;class Baz implements Observer {&lt;/div&gt;&lt;div&gt;  public void update(Observable o, Object message) {&lt;/div&gt;&lt;div&gt;    System.out.println(&quot;Baz: &quot; + message); // push&lt;/div&gt;&lt;div&gt;// the line below is for &#39;pull&#39;&lt;/div&gt;&lt;div&gt;//  System.out.println(&quot;Baz: &quot; + ((JavaObserver) message).getMessage());&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;  }&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The key restriction of the Java built-in functionality is that we have to extend the Observable class so there is no way extending JavaObserver from any other class.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&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;br /&gt;&lt;/div&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;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://itis-consultants.blogspot.com/feeds/4740786795489801013/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://itis-consultants.blogspot.com/2010/03/observer-design-pattern.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7261548585686045052/posts/default/4740786795489801013'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7261548585686045052/posts/default/4740786795489801013'/><link rel='alternate' type='text/html' href='http://itis-consultants.blogspot.com/2010/03/observer-design-pattern.html' title='Observer design pattern (Publisher-Subscriber)'/><author><name>Rajeev Trikha</name><uri>http://www.blogger.com/profile/07435391398428608212</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhVzRuF2tqPUf6AhwZpgELPdLM7-5yz9Su4T6v0q4Da0OUPkOIF7rkrSccgqegK7XcLtAUh8qQ073-QqJBYulq1wSwyJfnqYpGsGvjex7XhmNvdVA6yGzv4-NYp_P9chw/s220/raj.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7261548585686045052.post-1599035344839208799</id><published>2010-03-13T05:17:00.000-08:00</published><updated>2010-03-13T05:55:39.232-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="design pattern"/><category scheme="http://www.blogger.com/atom/ns#" term="Java"/><category scheme="http://www.blogger.com/atom/ns#" term="MVC"/><title type='text'>Model-View-Controller (MVC) pattern</title><content type='html'>The MVC architectural pattern is the bedrock of technologies like JavaServer Faces and is fundamental to implementing three-tier architecture. It clearly segregates the model in the business layer, view in the presentation layer and the controller, which handles all the inputs affecting the model. Obviously if the model is totally segregated then it becomes relatively easier to test the domain logic with automated tools. We can illustrate this decoupling of model and view through a simple calculator application which takes two numbers and applies the requested operator to provide the result.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiRWsipyXc7D8mtkGZ2kAJ9ZL3qOl5olo-FG9PT6C9ARFZ0mmtB3M0IIgZbHokNbBKZULbhFmlV_78m0t7tobCEnoR-XWgzrWX5X-OmDrzjY6ncJTcEd8fC292gMRJ-owrQvORB0oFme6s/s1600-h/calculator.JPG&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiRWsipyXc7D8mtkGZ2kAJ9ZL3qOl5olo-FG9PT6C9ARFZ0mmtB3M0IIgZbHokNbBKZULbhFmlV_78m0t7tobCEnoR-XWgzrWX5X-OmDrzjY6ncJTcEd8fC292gMRJ-owrQvORB0oFme6s/s320/calculator.JPG&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5448115633527533138&quot; style=&quot;cursor: pointer; width: 320px; height: 54px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;package mvc;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;import java.awt.event.ActionEvent;&lt;/div&gt;&lt;div&gt;import javax.swing.*;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;public class MvcTest {&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;    private static void buildUI() {&lt;/div&gt;&lt;div&gt;        MvcModel model = new MvcModel();&lt;/div&gt;&lt;div&gt;        MvcView view = new MvcView();&lt;/div&gt;&lt;div&gt;        MvcControl control = new MvcControl(&quot;Result&quot;, view, model);&lt;/div&gt;&lt;div&gt;        view.setControl(control);&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;        JFrame frame = new JFrame(&quot;Test Calculator&quot;);&lt;/div&gt;&lt;div&gt;        frame.getContentPane().add(view.getMainPanel());&lt;/div&gt;&lt;div&gt;        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);&lt;/div&gt;&lt;div&gt;        frame.pack();&lt;/div&gt;&lt;div&gt;        frame.setLocationRelativeTo(null);&lt;/div&gt;&lt;div&gt;        frame.setVisible(true);&lt;/div&gt;&lt;div&gt;    }&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;    public static void main(String[] args) {&lt;/div&gt;&lt;div&gt;        java.awt.EventQueue.invokeLater(new Runnable() {&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;            public void run() {&lt;/div&gt;&lt;div&gt;                buildUI();&lt;/div&gt;&lt;div&gt;            }&lt;/div&gt;&lt;div&gt;        });&lt;/div&gt;&lt;div&gt;    }&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;class MvcView {&lt;/div&gt;&lt;div&gt;    // mainPanel holds all the GUI components&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;    private JPanel mainPanel = new JPanel();&lt;/div&gt;&lt;div&gt;    // two input fields and the result textfield&lt;/div&gt;&lt;div&gt;    private JTextField firstOperand = new JTextField(10);&lt;/div&gt;&lt;div&gt;    private JTextField operator = new JTextField(1);&lt;/div&gt;&lt;div&gt;    private JTextField secondOperand = new JTextField(10);&lt;/div&gt;&lt;div&gt;    private JTextField resultField = new JTextField(10);&lt;/div&gt;&lt;div&gt;    private JButton addButton = new JButton();&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;    public MvcView() {&lt;/div&gt;&lt;div&gt;        resultField.setEditable(false);&lt;/div&gt;&lt;div&gt;        operator.setText(&quot;+&quot;); // default to add&lt;/div&gt;&lt;div&gt;        mainPanel.add(firstOperand);&lt;/div&gt;&lt;div&gt;        mainPanel.add(operator);&lt;/div&gt;&lt;div&gt;        mainPanel.add(secondOperand);&lt;/div&gt;&lt;div&gt;        mainPanel.add(new JLabel(&quot;=&quot;));&lt;/div&gt;&lt;div&gt;        mainPanel.add(resultField);&lt;/div&gt;&lt;div&gt;        mainPanel.add(addButton);&lt;/div&gt;&lt;div&gt;    }&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;    public void setControl(MvcControl control) {&lt;/div&gt;&lt;div&gt;        addButton.setAction(control);&lt;/div&gt;&lt;div&gt;    }&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;    public JPanel getMainPanel() {&lt;/div&gt;&lt;div&gt;        return mainPanel;&lt;/div&gt;&lt;div&gt;    }&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;    public String getFirstOperandText() {&lt;/div&gt;&lt;div&gt;        return firstOperand.getText();&lt;/div&gt;&lt;div&gt;    }&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;    public String getSecondOperandText() {&lt;/div&gt;&lt;div&gt;        return secondOperand.getText();&lt;/div&gt;&lt;div&gt;    }&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;    public String getOperatorText() {&lt;/div&gt;&lt;div&gt;        return operator.getText();&lt;/div&gt;&lt;div&gt;    }&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;    public void setResultText(String text) {&lt;/div&gt;&lt;div&gt;        resultField.setText(text);&lt;/div&gt;&lt;div&gt;    }&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;class MvcControl extends AbstractAction {&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;    private MvcModel model;&lt;/div&gt;&lt;div&gt;    private MvcView view;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;    public MvcControl(String text, MvcView view, MvcModel model) {&lt;/div&gt;&lt;div&gt;        super(text);&lt;/div&gt;&lt;div&gt;        this.view = view;&lt;/div&gt;&lt;div&gt;        this.model = model;&lt;/div&gt;&lt;div&gt;    }&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;    public void actionPerformed(ActionEvent e) {&lt;/div&gt;&lt;div&gt;        view.setResultText(&quot;&quot;); // clear the result &lt;/div&gt;&lt;div&gt;        try {&lt;/div&gt;&lt;div&gt;            double op1 = Double.parseDouble(view.getFirstOperandText());&lt;/div&gt;&lt;div&gt;            double op2 = Double.parseDouble(view.getSecondOperandText());&lt;/div&gt;&lt;div&gt;            char operator = view.getOperatorText().charAt(0);&lt;/div&gt;&lt;div&gt;            if (operator == &#39;+&#39;&lt;/div&gt;&lt;div&gt;                    || operator == &#39;-&#39;&lt;/div&gt;&lt;div&gt;                    || operator == &#39;*&#39;&lt;/div&gt;&lt;div&gt;                    || operator == &#39;x&#39;&lt;/div&gt;&lt;div&gt;                    || operator == &#39;X&#39;&lt;/div&gt;&lt;div&gt;                    || operator == &#39;/&#39;&lt;/div&gt;&lt;div&gt;                    || operator == &#39;%&#39;) {}&lt;/div&gt;&lt;div&gt;            else throw new IllegalArgumentException();&lt;/div&gt;&lt;div&gt;            double result = model.doOperation(op1, op2, operator); // use the model here&lt;/div&gt;&lt;div&gt;            view.setResultText(String.valueOf(result));&lt;/div&gt;&lt;div&gt;        } catch (NumberFormatException nfe) {&lt;/div&gt;&lt;div&gt;            JOptionPane.showMessageDialog(view.getMainPanel(), &quot;Only Numbers Allowed&quot;,&lt;/div&gt;&lt;div&gt;                    &quot;Data Error&quot;, JOptionPane.ERROR_MESSAGE);&lt;/div&gt;&lt;div&gt;        } catch (IllegalArgumentException nfe) {&lt;/div&gt;&lt;div&gt;            JOptionPane.showMessageDialog(view.getMainPanel(), &quot;The operator must be one of *, /, +, - or %&quot;,&lt;/div&gt;&lt;div&gt;                    &quot;Data Error&quot;, JOptionPane.ERROR_MESSAGE);&lt;/div&gt;&lt;div&gt;        }&lt;/div&gt;&lt;div&gt;    }&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;class MvcModel {&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;    public double doOperation(double op1, double op2, char operator) {&lt;/div&gt;&lt;div&gt;        double result = 0;&lt;/div&gt;&lt;div&gt;        switch (operator) {&lt;/div&gt;&lt;div&gt;            case &#39;+&#39;:&lt;/div&gt;&lt;div&gt;                result = op1 + op2;&lt;/div&gt;&lt;div&gt;                break;&lt;/div&gt;&lt;div&gt;            case &#39;-&#39;:&lt;/div&gt;&lt;div&gt;                result = op1 - op2;&lt;/div&gt;&lt;div&gt;                break;&lt;/div&gt;&lt;div&gt;            case &#39;*&#39;:&lt;/div&gt;&lt;div&gt;            case &#39;x&#39;:&lt;/div&gt;&lt;div&gt;            case &#39;X&#39;:&lt;/div&gt;&lt;div&gt;                result = op1 * op2;&lt;/div&gt;&lt;div&gt;                break;&lt;/div&gt;&lt;div&gt;            case &#39;/&#39;:&lt;/div&gt;&lt;div&gt;                result = op1 / op2;&lt;/div&gt;&lt;div&gt;                break;&lt;/div&gt;&lt;div&gt;            case &#39;%&#39;:&lt;/div&gt;&lt;div&gt;                result = op1 % op2;&lt;/div&gt;&lt;div&gt;        }&lt;/div&gt;&lt;div&gt;        return result;&lt;/div&gt;&lt;div&gt;    }&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;It is clear in our example that the view (MvcView)  is the user interface which asks for two operands and the mathematical operation to apply on them. Model (MvcModel) is passed these inputs by the controller (MvcController) to get the calculation result. In our design the view has no knowledge of the model and the controller is an observer of the action performed on the &#39;result&#39; button in the view. The controller uses its knowledge of the view to update the result. Thus a clear segregation of roles has been achieved. Obviously an application can have a number of these MVC triplets.&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;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://itis-consultants.blogspot.com/feeds/1599035344839208799/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://itis-consultants.blogspot.com/2010/03/model-view-controller-mvc-pattern.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7261548585686045052/posts/default/1599035344839208799'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7261548585686045052/posts/default/1599035344839208799'/><link rel='alternate' type='text/html' href='http://itis-consultants.blogspot.com/2010/03/model-view-controller-mvc-pattern.html' title='Model-View-Controller (MVC) pattern'/><author><name>Rajeev Trikha</name><uri>http://www.blogger.com/profile/07435391398428608212</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhVzRuF2tqPUf6AhwZpgELPdLM7-5yz9Su4T6v0q4Da0OUPkOIF7rkrSccgqegK7XcLtAUh8qQ073-QqJBYulq1wSwyJfnqYpGsGvjex7XhmNvdVA6yGzv4-NYp_P9chw/s220/raj.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiRWsipyXc7D8mtkGZ2kAJ9ZL3qOl5olo-FG9PT6C9ARFZ0mmtB3M0IIgZbHokNbBKZULbhFmlV_78m0t7tobCEnoR-XWgzrWX5X-OmDrzjY6ncJTcEd8fC292gMRJ-owrQvORB0oFme6s/s72-c/calculator.JPG" height="72" width="72"/><thr:total>0</thr:total></entry></feed>