<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-5951603711668509916</id><updated>2011-12-16T16:51:13.499+05:30</updated><title type='text'>TechBook</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://ramprasad-techbook.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://ramprasad-techbook.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Ramprasad</name><uri>http://www.blogger.com/profile/16032736524787849385</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>86</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-5951603711668509916.post-5654099174192556430</id><published>2011-12-16T16:50:00.000+05:30</published><updated>2011-12-16T16:51:13.511+05:30</updated><title type='text'>JProfiler</title><content type='html'>JProfiler is a tool useful for analyzing the performance problems and memory leaks of a java project. When Jprofiler is run it asks us to choose the jvm on which we want to analyze the performance.&lt;br /&gt;&lt;br /&gt;It provides visual representation for the virtual machine load in terms of active and total bytes, instances, threads, classes, Garbage Collector activity.&lt;br /&gt;&lt;br /&gt;It is a commercially licensed Java profiling tool developed by ej-technologies targeted at Java EE and Java SE applications&lt;br /&gt;&lt;br /&gt;http://resources.ej-technologies.com/jprofiler/help/doc/help.pdf&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951603711668509916-5654099174192556430?l=ramprasad-techbook.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ramprasad-techbook.blogspot.com/feeds/5654099174192556430/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951603711668509916&amp;postID=5654099174192556430' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/5654099174192556430'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/5654099174192556430'/><link rel='alternate' type='text/html' href='http://ramprasad-techbook.blogspot.com/2011/12/jprofiler.html' title='JProfiler'/><author><name>Ramprasad</name><uri>http://www.blogger.com/profile/16032736524787849385</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951603711668509916.post-6324968771531819020</id><published>2011-11-29T17:48:00.000+05:30</published><updated>2011-11-29T17:49:21.434+05:30</updated><title type='text'>Some design perspectives</title><content type='html'>When an application/product is evaluated, it has to be done in various perspectives. If it fails in one of these, it will be considered as a bad design. Several industry standards exist for this. Some important ones are :&lt;br /&gt;&lt;br /&gt;1.Functionality - it should render a decent coverage of various functionalities it boasts to provide. The extent of functionalities which can satisfy its clients depends on the business domain and various terminologies in that. For example, if we consider an online website where we can order books, it should have a good search functionality so that customers can search the books they want by various parameters such as author's name, title, publications, keywords etc. &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;2.Usability - software should be easy to use. If people need special training to use a software it may not be a good fit for the public in general. One important aspect in this is user interface. But usability is much broader than just the user interface.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;3. Accessibility - in certain countries, it is mandated that people with disabilities should be able to use a software. Software should adhere to such guidelines.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;4. Security - software that is exposed on the internet should take extra care to ensure that there is no security threat for the users who want to provide their personal information. Again, there are third parties who can certify whether the site is vulnerable for security threats.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;5.Performance - If the software has too many functionalities but takes too much time to load, it is again a bad thing. Ideal standard is that a screen/page should not take more than 8 seconds to load. The standard may vary, however it should take as little time as possible.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;6.Scalability - refers to how many users(or load) an application can support simultaneously. We all know about those websites which crash when they are needed most.&lt;br /&gt;&lt;br /&gt;7.Internationalization - refers to how many languages can the software support. When the software has global presence, it is desired to provide support for multiple locales.&lt;br /&gt;&lt;br /&gt;8.Maintainability/Upgradability - this aspect of software is equally important because once the software is developed, it is very likely to undergo a lot of changes over a period of time. If the design of software is not good enough to accommodate new features, it may become a nightmare for developers to support the software.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951603711668509916-6324968771531819020?l=ramprasad-techbook.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ramprasad-techbook.blogspot.com/feeds/6324968771531819020/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951603711668509916&amp;postID=6324968771531819020' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/6324968771531819020'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/6324968771531819020'/><link rel='alternate' type='text/html' href='http://ramprasad-techbook.blogspot.com/2011/11/some-design-perspectives.html' title='Some design perspectives'/><author><name>Ramprasad</name><uri>http://www.blogger.com/profile/16032736524787849385</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951603711668509916.post-5123181639321142515</id><published>2011-11-14T12:23:00.001+05:30</published><updated>2011-11-14T12:52:37.915+05:30</updated><title type='text'>Code Performance</title><content type='html'>Many performance related issues become difficult to debug, if we do not know how to measure the time take to execute a piece of code. If we introduce a couple of simple lines in our code base,it can be measure with a decent accuracy.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;ThreadMXBean threadMxBeam = ManagementFactory.getThreadMXBean();&lt;br /&gt;long timeBefore = threadMxBeam.getCurrentThreadCpuTime();&lt;br /&gt;&lt;br /&gt;//Code whose performance has to be tested goes here.&lt;br /&gt;&lt;br /&gt;long timeAfter = threadMxBeam.getCurrentThreadCpuTime();&lt;br /&gt;System.out.println("======Time Taken to execute this code==" +(timeAfter-timeBefore));&lt;br /&gt;&lt;br /&gt;There is another API which gives time in milli seconds. But some developers say that it is not so effective.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;long startTimeStamp = System.currentTimeMillis();&lt;br /&gt;&lt;br /&gt;//Code whose performance has to be tested goes here.&lt;br /&gt;&lt;br /&gt;long endTimeStamp = System.currentTimeMillis();&lt;br /&gt;long timeTaken = (endTimeStamp - startTimeStamp);&lt;br /&gt;&lt;br /&gt;When performance issues are discovered at a later stage of the project, fixing them can have a significant impact on the codebase.  Whilst it may not be practical to expect our code to be very performant in the beginning itself, if we can keep a few things in our mind while coding,  there is  a chances to reduce such occurrences.&lt;br /&gt;&lt;br /&gt;Some ways to improve the performance:&lt;br /&gt;&lt;br /&gt;1. Use of database indexes optimally. It should be examined for all SQL that gets run. If you select on a table using a single field that is not indexed then an entire table scan is done which would take a very long time on larger tables. If you’re selecting using two values then at least one should be indexed as that way the DB would initially go through the index and then restrict those results using the second field. The more often an SQL is executed the more critical that it is indexed, although it should also be noted that indexes will slow down the inserts slightly.&lt;br /&gt;&lt;br /&gt;2. Avoid unnecessary java looping. Instead, try to restrict them in the database itself before bringing them to the java layer.&lt;br /&gt;&lt;br /&gt;3. Use sql joins instead of multiple queries. This can reduce the number of database calls.&lt;br /&gt;&lt;br /&gt;4. Use caching for frequently read tables. For example, if a common table such as person has to be read on every page, it may be worth storing the required person's details in a cache in data  access layer. If data is present in the cache, no need to query the database again. Another way is to put the details in a session. But potential security issues also have to be given due importance while considering this.&lt;br /&gt;&lt;br /&gt;5.Avoid unnecessary lines of code. Sometimes it is possible that mistakenly, some java lines are present even though they are not necessary for every flow. Such lines should be optimized.&lt;br /&gt;&lt;br /&gt;6. Carefully considering the &amp;&amp; and || conditions in the if blocks. The condition which executes faster should come first. Since, success or failure of this condition will decide whether to execute the next condition or not.&lt;br /&gt;&lt;br /&gt;7. Avoid unnecessary object instantiation. Split large methods into smaller ones wherever possible, since it is believed to improve garbage collection.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951603711668509916-5123181639321142515?l=ramprasad-techbook.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ramprasad-techbook.blogspot.com/feeds/5123181639321142515/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951603711668509916&amp;postID=5123181639321142515' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/5123181639321142515'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/5123181639321142515'/><link rel='alternate' type='text/html' href='http://ramprasad-techbook.blogspot.com/2011/11/measuring-performance.html' title='Code Performance'/><author><name>Ramprasad</name><uri>http://www.blogger.com/profile/16032736524787849385</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951603711668509916.post-4911758264714169331</id><published>2011-10-21T14:59:00.001+05:30</published><updated>2011-10-21T14:59:58.849+05:30</updated><title type='text'>Setting up data for testing performance issues</title><content type='html'>Loading huge volume of data into the database to carry out performance testing is a big challenge. Actual data in production may not available to either testers or developers due to privacy issues. So, only options left are populate the data by writing some test cases or sql scripts or go for filling the data manually.&lt;br /&gt;&lt;br /&gt;There will be more challenges again in the filling up the data through test cases. Usually, we make use of loops to execute a piece of code that inserts data into various tables. But this data will be very much likely to be identical and not diverse as in real time. If we  want to fill in diverse data junits should be more robust. Otherwise, with identical data, most of the queries or conditions in the code base will be by passed in all flows, and a holistic performance behavior of the code base cannot be known.&lt;br /&gt;&lt;br /&gt;Once test data is filled, extracting that into some xml or similar files through some build targets is an option, if that is supported by the prevalent infrastructure of the project. Even the data dump options provided by databases such as oracle or db2 can also be used to  pull out the same. Here, care should be taken to ensure that database versions of the source and destination are same.&lt;br /&gt;&lt;br /&gt;It will be cumbersome, impractical and sometimes even risky to check the data table by table and extract data from only those tables required for testing. Typically in a enterprise project, database tables will be so closely interlinked that, we may end up needing data in most of the tables to account for data integrity. So, a better option is always to export data in the entire schema and them import the same.&lt;br /&gt;&lt;br /&gt;If data is inserted through junits or scripts, it is more likely that it will have security errors with respect to creation and view of data. Because, junits or scripts do not cater to login authentication, authorization etc, instead dump some data into database just to test other functionality. If the same data is imported on test runtime where there will be more powerful security checks, there could be issues in logging into the application itself.&lt;br /&gt;&lt;br /&gt;Despite all these issues, performance testing is very important and to conduct this it is equally important to set up a reasonable volume of data. How this can be achieved will always be an interesting question to the project architects.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951603711668509916-4911758264714169331?l=ramprasad-techbook.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ramprasad-techbook.blogspot.com/feeds/4911758264714169331/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951603711668509916&amp;postID=4911758264714169331' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/4911758264714169331'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/4911758264714169331'/><link rel='alternate' type='text/html' href='http://ramprasad-techbook.blogspot.com/2011/10/setting-up-data-for-testing-performance.html' title='Setting up data for testing performance issues'/><author><name>Ramprasad</name><uri>http://www.blogger.com/profile/16032736524787849385</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951603711668509916.post-3976216472217417891</id><published>2011-08-23T20:10:00.000+05:30</published><updated>2011-08-23T20:11:07.459+05:30</updated><title type='text'>PermGen</title><content type='html'>In the JVM, PermGen holds the metadata about classes that have been loaded/created. This information is garbage collected like the other parts of the heap, however there are rough edges that can prevent this from happening, class loaders in particular.&lt;br /&gt;&lt;br /&gt;PermGen is not a part of the region called heap.Actually, in Sun's JVM Permanent Generation (PermGen) is completely separate from the heap.&lt;br /&gt;&lt;br /&gt;This area is filled of your app classes metadata and many other things that do not depend on the application usage.&lt;br /&gt;&lt;br /&gt;For the HotSpot Java VM, the memory pools for serial garbage collection are the following.&lt;br /&gt;&lt;br /&gt;Eden Space (heap): The pool from which memory is initially allocated for most objects. &lt;br /&gt;Survivor Space (heap): The pool containing objects that have survived the garbage collection of the Eden space. &lt;br /&gt;Tenured Generation (heap): The pool containing objects that have existed for some time in the survivor space. &lt;br /&gt;Permanent Generation (non-heap): The pool containing all the reflective data of the virtual machine itself, such as class and method objects. With Java VMs that use class data sharing, this generation is divided into read-only and read-write areas. &lt;br /&gt;Code Cache (non-heap): The HotSpot Java VM also includes a code cache, containing memory that is used for compilation and storage of native code. &lt;br /&gt;&lt;br /&gt;Some of the common causes:&lt;br /&gt;&lt;br /&gt;Custom classloaders that don't carefully free up older classes after loading new ones. &lt;br /&gt;Classes remaining in PermGen after redeploying an application multiple times (more common in Dev than Prod) &lt;br /&gt;Heavy use of Proxy classes, which are created synthetically during runtime. It's easy to create new Proxy classes when an a single class definition could be reused for multiple instances. &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Exception in thread main java.lang.OutOfMemoryError: PermGen space signifies too many classes loaded or being generated; or the String.intern table is too big. Increase using the -XX:MaxPermSize option. &lt;br /&gt;&lt;br /&gt;-XX:PermSize=256M -XX:MaxPermSize=128M&lt;br /&gt;&lt;br /&gt;How do I know what classes are being loaded or unloaded? Use the command line options &lt;br /&gt;-XX:+TraceClassloading and -XX:+TraceClassUnloading http://java.sun.com/docs/hotspot/gc1.4.2/faq.html &lt;br /&gt;&lt;br /&gt;http://stackoverflow.com/questions/2051734/why-is-permgen-space-growing&lt;br /&gt;http://download.oracle.com/javase/1.4.2/docs/tooldocs/windows/java.html&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951603711668509916-3976216472217417891?l=ramprasad-techbook.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ramprasad-techbook.blogspot.com/feeds/3976216472217417891/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951603711668509916&amp;postID=3976216472217417891' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/3976216472217417891'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/3976216472217417891'/><link rel='alternate' type='text/html' href='http://ramprasad-techbook.blogspot.com/2011/08/permgen.html' title='PermGen'/><author><name>Ramprasad</name><uri>http://www.blogger.com/profile/16032736524787849385</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951603711668509916.post-8788589425388892406</id><published>2011-06-24T15:59:00.002+05:30</published><updated>2011-06-24T16:01:42.055+05:30</updated><title type='text'>An interesting way of instantiation</title><content type='html'>When you do not have access to instantiate a class through a factory or so, one possible way is to declare an inner private class which extends the class to be instantiated. &lt;br /&gt;&lt;br /&gt;For example, we have a class "Vehicle" which is marked abstract and hence cannot be instantiated directly. There is a "VehicleFactory" which is meant for giving an instance of this class. &lt;br /&gt;&lt;br /&gt;Now, I want to to create an instance of "Vehicle" class in my class without using VehicleFactory. Here is how:&lt;br /&gt;&lt;br /&gt;public class Myclass{&lt;br /&gt;&lt;br /&gt;private MyVehicle myVehicle = new MyVehicle();&lt;br /&gt;&lt;br /&gt;private class MyVehicle extends Vehicle{&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public static void main(String args[]){&lt;br /&gt;Myclass myClass = new Myclass();&lt;br /&gt;myClass.myMethod();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public void myMethod(){&lt;br /&gt;myVehicle.drive();&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;Can you think of some advantage of this kind of usage ?&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951603711668509916-8788589425388892406?l=ramprasad-techbook.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ramprasad-techbook.blogspot.com/feeds/8788589425388892406/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951603711668509916&amp;postID=8788589425388892406' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/8788589425388892406'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/8788589425388892406'/><link rel='alternate' type='text/html' href='http://ramprasad-techbook.blogspot.com/2011/06/interesting-way-of-instantiation.html' title='An interesting way of instantiation'/><author><name>Ramprasad</name><uri>http://www.blogger.com/profile/16032736524787849385</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951603711668509916.post-1629096243083697077</id><published>2011-05-27T12:56:00.003+05:30</published><updated>2011-05-27T13:01:21.694+05:30</updated><title type='text'>Significance of selecting a proper collection class OR danger of using collections with hashing</title><content type='html'>In java, lot of people are fond of the ‘Set’ collection class. The most commonly used implementation class of Set is HashSet. It is easy to use and is believed to have good performance. It is good for returning data from the data access layer.(though it may not be of use with ORDERBY clauses).&lt;br /&gt;&lt;br /&gt;But one thing people might forget is that it uses hashing algorithm. So the order in which you store the data is not maintained.  There are instances where we get different results when executed at different times.  This could be because of iterating through a collection such as HashSet. There are chances of its usage going unnoticed and at times it becomes difficult to debug it out. But as a good practice, it is better to use some predictable collections like ArrayList unless absolutely necessary. &lt;br /&gt;&lt;br /&gt;Performance may not be a big issue with the blinding fast advancements in the processing and storage technologies. But making the application work consistently and predictably is the most important responsibility of a developer. Definitely there is no use of a software which works very fast and consumes very less memory if it doesn't do what is expected.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951603711668509916-1629096243083697077?l=ramprasad-techbook.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ramprasad-techbook.blogspot.com/feeds/1629096243083697077/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951603711668509916&amp;postID=1629096243083697077' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/1629096243083697077'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/1629096243083697077'/><link rel='alternate' type='text/html' href='http://ramprasad-techbook.blogspot.com/2011/05/significance-of-selecting-proper.html' title='Significance of selecting a proper collection class OR danger of using collections with hashing'/><author><name>Ramprasad</name><uri>http://www.blogger.com/profile/16032736524787849385</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951603711668509916.post-2127609718651255134</id><published>2011-05-18T14:50:00.001+05:30</published><updated>2011-05-18T14:54:14.696+05:30</updated><title type='text'>A tale of two queries</title><content type='html'>Consider following two queries&lt;br /&gt;&lt;br /&gt;1) SELECT * FROM MYSTORIES WHERE STORY LIKE 'X' &lt;br /&gt;&lt;br /&gt;2) SELECT * FROM MYSTORIES WHERE STORY ='X'&lt;br /&gt;&lt;br /&gt;Both will find the exact match and give the same result. However some interesting things are &lt;br /&gt;&lt;br /&gt;1) The first query doesn't work on DB2 but works on Oracle.&lt;br /&gt;2) The second query works fine on both DB2 and Oracle.&lt;br /&gt;3) There is a performance overhead in using like without a wild card (i.e %)&lt;br /&gt;4) Any good optimizer would reduce the first expression to the second.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Note that in the above example the field 'STORY' is of data type CHARACTER&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951603711668509916-2127609718651255134?l=ramprasad-techbook.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ramprasad-techbook.blogspot.com/feeds/2127609718651255134/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951603711668509916&amp;postID=2127609718651255134' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/2127609718651255134'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/2127609718651255134'/><link rel='alternate' type='text/html' href='http://ramprasad-techbook.blogspot.com/2011/05/tale-of-two-queries.html' title='A tale of two queries'/><author><name>Ramprasad</name><uri>http://www.blogger.com/profile/16032736524787849385</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951603711668509916.post-2925372788518998264</id><published>2011-05-05T12:00:00.001+05:30</published><updated>2011-05-05T12:00:53.403+05:30</updated><title type='text'>Junit - the saviour</title><content type='html'>Usually, in maintenance projects, we fix defects, test them and deliver. But sometimes it so happens that fixing one defect might cause some other previous fix to fail. When deadlines are tight, developers can't afford to test all possible complex scenarios at the last moment, and no sensible developer would intentionally break some existing fix for introducing a new fix. But it still happens inadvertently. &lt;br /&gt;&lt;br /&gt;If you are a seasoned developer, you would have encountered some testers who re-open old defects just one day before the release schedule. Testers always escape saying their favourite sentence 'It was working earlier and now it is not working'. You might have to burn the mid night oil to see which of your recent change has caused this last moment catastrophe.&lt;br /&gt;&lt;br /&gt;There is a proven method which is so simple and obvious but when it comes to following it, described as "vehemently impractical" by developers. Yes, you are right. It is about writing junits.&lt;br /&gt;&lt;br /&gt;For every defect, developer should write a junit first to simulate the scenario. The junit would fail and the fix would pass it. This would also save you from running all steps through the application each time, setting up the required data etc. More importantly, this junit would safe guard your fix for ever. Even if you introduce 100 new fixes in future, if any of these causes your old fix to break, this loyal junit would raise an alarm by failing itself.&lt;br /&gt;&lt;br /&gt;Writing junits by test scenarios may not be encouraged everywhere since it is not a standard. It is seen more as testers job to write automated scripts for these. But if you want to avoid those last bad moments in your release, this approach is highly advisable. How you negotiate with your manager to get time for such things is up to you and your manager !!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951603711668509916-2925372788518998264?l=ramprasad-techbook.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ramprasad-techbook.blogspot.com/feeds/2925372788518998264/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951603711668509916&amp;postID=2925372788518998264' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/2925372788518998264'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/2925372788518998264'/><link rel='alternate' type='text/html' href='http://ramprasad-techbook.blogspot.com/2011/05/junit-saviour.html' title='Junit - the saviour'/><author><name>Ramprasad</name><uri>http://www.blogger.com/profile/16032736524787849385</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951603711668509916.post-8889605642139280852</id><published>2011-05-03T14:25:00.000+05:30</published><updated>2011-05-03T14:26:19.940+05:30</updated><title type='text'>Environment Variables</title><content type='html'>Environment Variables are set as User Variables or System Variables. They override over the environment variables which might be set while running our build targets. This can lead to confusion sometimes. For example lets say we have an environment variable ENVVAR_VAR1 set to pathX as user/system variable. We have a target batch file to run the build say build.bat which internally sets the ENVVAR_VAR1 to pathY. Now, actually pathX will take priority.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Setting up too many environment variables explicitly as User Variables or System Variables could be very misleading. It is always a good practice to set them through the batch as required for the context instead of setting them permanently.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951603711668509916-8889605642139280852?l=ramprasad-techbook.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ramprasad-techbook.blogspot.com/feeds/8889605642139280852/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951603711668509916&amp;postID=8889605642139280852' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/8889605642139280852'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/8889605642139280852'/><link rel='alternate' type='text/html' href='http://ramprasad-techbook.blogspot.com/2011/05/environment-variables.html' title='Environment Variables'/><author><name>Ramprasad</name><uri>http://www.blogger.com/profile/16032736524787849385</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951603711668509916.post-4583280073194174233</id><published>2011-04-13T17:53:00.003+05:30</published><updated>2011-04-13T18:07:09.622+05:30</updated><title type='text'>Merging</title><content type='html'>&lt;p&gt;When we work on various versions of the code, replication of what was delivered on the previous release on to the current release and future releases becomes a matter of critical importance. &lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Suppose there are 3 releases going on parallel - V1.3, V1.2.1, and V2.0 An issue was found while testing V1.2.1 which is an emergency release. The fix is delivered on V1.2.1 immediately. Now, the same fix has to be replicated on V1.3 which is a future point release in progress. The fix should also be replicated on V2.0 which is a major release which too is in progress by another team. Following things are worth considering while doing this. &lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;1) It is possible that the files in V1.2.1 would have changed in V1.3 and would have significantly changed further in V2.0. So when the fix delivered on V1.2.1 is copied to that on V1.3 and V2.0 care should be taken not to break the newly developed functionality. &lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;2) It is always advisable to go for manual merge instead of automatic(through tools or through the version controller). Because even a very small change can impact a lot and may become difficult to debug in future, resulting in wastage of time. &lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;3) Unit tests should be written in such cases for the scenario fixed on emergency release. Inclusion of these unit tests would ensure that the same scenario would work fine on all other future versions. &lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;4) Customers who have already taken a previous version when they want to upgrade to newer version, should not face problems with compilation if there are any changes done on method signature or such things causing the existing code to break. In such cases, the old code (methods) should continue to be supported (can be deprecated if needed) and new methods should be provided to get this additional feature. Details regarding why the changes were done and what would happen if the new code is not taken etc should be clearly documented for customers. &lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;This may not be of major significance where there is only one client using the entire code(as in software services companies). But if there are multiple clients (e.g in software product companies) handling simultaneous releases could be challenging. Strong processes should be in place and should be strictly followed in such cases. &lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951603711668509916-4583280073194174233?l=ramprasad-techbook.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ramprasad-techbook.blogspot.com/feeds/4583280073194174233/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951603711668509916&amp;postID=4583280073194174233' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/4583280073194174233'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/4583280073194174233'/><link rel='alternate' type='text/html' href='http://ramprasad-techbook.blogspot.com/2011/04/merging.html' title='Merging'/><author><name>Ramprasad</name><uri>http://www.blogger.com/profile/16032736524787849385</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951603711668509916.post-5956214392113153458</id><published>2011-03-29T11:41:00.003+05:30</published><updated>2011-03-29T11:46:11.075+05:30</updated><title type='text'>Remote debugging</title><content type='html'>If a runtime environment is not set up in the local machine, sometimes it becomes difficult to debug some issues. For example consider an enterprise application deployed on a websphere server on a remote machine. If there is an issue reproducible on this environment the developer may not be able to debug and find out what the issue is. This is because the enviroment is remote and developer has the code base on his machine. Developer might have his own development environment say - Tomcat server. However, it is possible to remotely debug the issues existing on the remote production machine. For this, the developer should have the same version of code base in his eclipse as that present on the runtime environment. Once that is confirmed he needs to do the following. In WebSphere web console, left navigation, 1. Servers -&amp;gt; Server Types -&amp;gt; WebSphere application servers 2. Under Server Infrastructure section -&amp;gt; expand Java and Process Management -&amp;gt; Process definition 3. Under Additional Properties section -&amp;gt; click Java Virtual Machine 4. Checked the 'Debug Mode' 5. In Debug arguments textbox, put this -Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8888 6. Restart WebSphere server instance. Now, WebSphere is started in debug mode, and listening on port 8888. (Later, Eclipse will connect to this port for debugging) In Eclipse IDE, under your project source 1. Click on 'Run', 'Debug Configurations' 2. Select 'Remote Java Application', right click and select 'New' 3. Renamed a new name , e.g 'WebSphere 7 Instance' 4. In 'Connection Type', select default, 'Standard (Socket Attached)' 5. Host, put your WebSphere host IP 6. Port, put 8888. 7. Click on the debug button. Now, Eclipse debugger is started and connected to port 8888. Now, as you run the application on the remote machine, the code can be debugged in single steps. Taken from &lt;a href="http://www.mkyong.com/websphere/remote-debugging-with-eclipse-websphere-7/"&gt;http://www.mkyong.com/websphere/remote-debugging-with-eclipse-websphere-7/&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951603711668509916-5956214392113153458?l=ramprasad-techbook.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ramprasad-techbook.blogspot.com/feeds/5956214392113153458/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951603711668509916&amp;postID=5956214392113153458' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/5956214392113153458'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/5956214392113153458'/><link rel='alternate' type='text/html' href='http://ramprasad-techbook.blogspot.com/2011/03/remote-debugging.html' title='Remote debugging'/><author><name>Ramprasad</name><uri>http://www.blogger.com/profile/16032736524787849385</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951603711668509916.post-4880115580213668488</id><published>2011-03-26T12:06:00.003+05:30</published><updated>2011-03-26T12:10:28.976+05:30</updated><title type='text'>Including selected class files in a deployed jar</title><content type='html'>&lt;ul&gt;&lt;li&gt;Copy the new class files to be included into a tmp folder.&lt;/li&gt;&lt;li&gt;Take the jar file too to this tmp folder&lt;/li&gt;&lt;li&gt;Extract the class files which need to be replaced, out from the jar. This should be extracted into the tmp folder with the same directory structure as it was packed initially.&lt;/li&gt;&lt;li&gt;Now, replace these class files extracted from the jar with the new class files(don't change the directory structure, keep the same but replace old class files with new one)&lt;/li&gt;&lt;li&gt;Open the jar file. Drag and drop the directory containing the class files into the jar.&lt;/li&gt;&lt;li&gt;Now, the jar contains the new class file. The same can be tested by sorting all the classfiles inside the jar with time stamp.&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;br /&gt;This process is useful when we have a lot of class files packed in the jar and only a very few of them need to be replaced. Building the whole jar again would take significantly more time. Instead, this work around can be used. Restarting the server should suffice to pick the new jar.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951603711668509916-4880115580213668488?l=ramprasad-techbook.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ramprasad-techbook.blogspot.com/feeds/4880115580213668488/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951603711668509916&amp;postID=4880115580213668488' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/4880115580213668488'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/4880115580213668488'/><link rel='alternate' type='text/html' href='http://ramprasad-techbook.blogspot.com/2011/03/including-selected-class-files-in.html' title='Including selected class files in a deployed jar'/><author><name>Ramprasad</name><uri>http://www.blogger.com/profile/16032736524787849385</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951603711668509916.post-5098824343105212451</id><published>2011-03-21T17:42:00.002+05:30</published><updated>2011-03-21T17:45:46.840+05:30</updated><title type='text'>Struts</title><content type='html'>Struts&lt;br /&gt;· open-source framework&lt;br /&gt;· web application framework&lt;br /&gt;· request-based web application framework&lt;br /&gt;· supports internationalization by web forms&lt;br /&gt;· can include a template mechanism called "Tiles"&lt;br /&gt;· uses and extends the Java Servlet API&lt;br /&gt;· encourages developers to use (MVC) architecture&lt;br /&gt;&lt;br /&gt;Traditional approach:&lt;br /&gt;· client submits information to the server via a web form.&lt;br /&gt;· information is given to the Servlet that processes it&lt;br /&gt;· or information is given to a JSP document that combines HTML and Java code&lt;br /&gt;· both interact with database wherever needed and produce HTML-formatted response&lt;br /&gt;&lt;br /&gt;Disadvantages:&lt;br /&gt;· application logic is mixed with presentation&lt;br /&gt;· for large projects maintenance becomes difficult&lt;br /&gt;&lt;br /&gt;Struts separates the following :&lt;br /&gt;· application logic that interacts with a database(Model)&lt;br /&gt;· HTML pages presented to the client(View)&lt;br /&gt;· instance that passes information between view and model (Controller)&lt;br /&gt;&lt;br /&gt;· controller is a servlet known as ActionServlet&lt;br /&gt;· Requests from the client are sent to the controller in the form of Actions&lt;br /&gt;· when the controller receives such a request it calls the corresponding Action class&lt;br /&gt;· Action class interacts with the application-specific model code&lt;br /&gt;· web application programmer is responsible for writing the model code&lt;br /&gt;· model code returns an "ActionForward" - a string telling the controller what output page to send to the client&lt;br /&gt;· A model represents an application’s data and contains the logic for accessing and manipulating that data.&lt;br /&gt;· information is passed between model and view in the form of special JavaBeans&lt;br /&gt;· Model components are generally standard Java classes. EJB, Java Data Objects(JDO) and JavaBeans can be use as a model. The Struts Framework has no built-in support for the Model layer and Struts frame work doesn't limit you to one particular model implementation.&lt;br /&gt;&lt;br /&gt;struts-config.xml binds model, view and controller together.&lt;br /&gt;source: &lt;a href="http://en.wikipedia.org/wiki/Struts"&gt;http://en.wikipedia.org/wiki/Struts&lt;/a&gt;&lt;br /&gt;&lt;a href="http://publib.boulder.ibm.com/infocenter/rtnlhelp/v6r0m0/index.jsp?topic=%2Fcom.ibm.etools.struts.doc%2Ftopics%2Fcstrdoc001.html"&gt;http://publib.boulder.ibm.com/infocenter/rtnlhelp/v6r0m0/index.jsp?topic=%2Fcom.ibm.etools.struts.doc%2Ftopics%2Fcstrdoc001.html&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951603711668509916-5098824343105212451?l=ramprasad-techbook.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ramprasad-techbook.blogspot.com/feeds/5098824343105212451/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951603711668509916&amp;postID=5098824343105212451' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/5098824343105212451'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/5098824343105212451'/><link rel='alternate' type='text/html' href='http://ramprasad-techbook.blogspot.com/2011/03/struts.html' title='Struts'/><author><name>Ramprasad</name><uri>http://www.blogger.com/profile/16032736524787849385</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951603711668509916.post-991898230635270894</id><published>2011-03-21T17:36:00.004+05:30</published><updated>2011-03-21T17:41:54.061+05:30</updated><title type='text'>PDF generation</title><content type='html'>Itext is a tool that can be used for generationg pdf.&lt;br /&gt;Download iText-5.0.6.jar from &lt;a href="http://sourceforge.net/projects/itext/files/iText/iText5.0.6/iText-5.0.6.jar/download"&gt;http://sourceforge.net/projects/itext/files/iText/iText5.0.6/iText-5.0.6.jar/download&lt;/a&gt;&lt;br /&gt;Following is a sample code that generates PDF.&lt;br /&gt;&lt;br /&gt;&lt;em&gt;&lt;span style="font-family:courier new;"&gt;import java.io.FileNotFoundException;&lt;/span&gt;&lt;/em&gt;&lt;br /&gt;&lt;em&gt;&lt;span style="font-family:courier new;"&gt;import java.io.FileOutputStream;&lt;br /&gt;import com.itextpdf.text.BaseColor;&lt;/span&gt;&lt;/em&gt;&lt;br /&gt;&lt;em&gt;&lt;span style="font-family:courier new;"&gt;import com.itextpdf.text.Document;&lt;/span&gt;&lt;/em&gt;&lt;br /&gt;&lt;em&gt;&lt;span style="font-family:courier new;"&gt;import com.itextpdf.text.DocumentException;&lt;/span&gt;&lt;/em&gt;&lt;br /&gt;&lt;em&gt;&lt;span style="font-family:courier new;"&gt;import com.itextpdf.text.Font;&lt;/span&gt;&lt;/em&gt;&lt;br /&gt;&lt;em&gt;&lt;span style="font-family:courier new;"&gt;import com.itextpdf.text.FontFactory;&lt;/span&gt;&lt;/em&gt;&lt;br /&gt;&lt;em&gt;&lt;span style="font-family:courier new;"&gt;import com.itextpdf.text.PageSize;&lt;/span&gt;&lt;/em&gt;&lt;br /&gt;&lt;em&gt;&lt;span style="font-family:courier new;"&gt;import com.itextpdf.text.Paragraph;&lt;/span&gt;&lt;/em&gt;&lt;br /&gt;&lt;em&gt;&lt;span style="font-family:courier new;"&gt;import com.itextpdf.text.pdf.PdfWriter;&lt;/span&gt;&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;&lt;em&gt;&lt;span style="font-family:courier new;"&gt;public class PDFGenerator {&lt;br /&gt;public static void main(String args[]) throws FileNotFoundException,DocumentException {&lt;br /&gt;Document document = new Document(PageSize.A4, 50, 50, 50, 50);&lt;/span&gt;&lt;/em&gt;&lt;br /&gt;&lt;em&gt;&lt;span style="font-family:courier new;"&gt;PdfWriter.getInstance(document, new FileOutputStream("C:\\SampleTextTest.pdf"));document.open();&lt;/span&gt;&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;&lt;em&gt;&lt;span style="font-family:courier new;"&gt;document.add(new Paragraph("This is a sample document"));&lt;br /&gt;document.add(new Paragraph("How is the text in this color?",&lt;/span&gt;&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;&lt;em&gt;&lt;span style="font-family:courier new;"&gt;FontFactory.getFont(FontFactory.TIMES_ITALIC, 14, Font.BOLD, new BaseColor(145,140, 250))));&lt;br /&gt;document.close();&lt;/span&gt;&lt;/em&gt;&lt;br /&gt;&lt;em&gt;&lt;span style="font-family:courier new;"&gt;System.out.println("=======success=====");&lt;br /&gt;}&lt;/span&gt;&lt;/em&gt;&lt;br /&gt;&lt;em&gt;&lt;span style="font-family:courier new;"&gt;}&lt;/span&gt;&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;Put the above code in the PDFGenerator.java file and run it after ensuring that the requiredjar file is accessible in the classpath.If the program is success, you will have a pdf file created in the path given.There are various other apis which can be used to implement our needs.Source &lt;a href="http://www.ibm.com/developerworks/opensource/library/os-javapdf/"&gt;http://www.ibm.com/developerworks/opensource/library/os-javapdf/&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951603711668509916-991898230635270894?l=ramprasad-techbook.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ramprasad-techbook.blogspot.com/feeds/991898230635270894/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951603711668509916&amp;postID=991898230635270894' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/991898230635270894'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/991898230635270894'/><link rel='alternate' type='text/html' href='http://ramprasad-techbook.blogspot.com/2011/03/pdf-generation.html' title='PDF generation'/><author><name>Ramprasad</name><uri>http://www.blogger.com/profile/16032736524787849385</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951603711668509916.post-4855803675105459230</id><published>2011-03-14T12:48:00.001+05:30</published><updated>2011-03-14T12:49:51.793+05:30</updated><title type='text'>A Query</title><content type='html'>&lt;p&gt;Following is an interesting query to get the description of all the tables in a database.&lt;/p&gt;&lt;p&gt;SELECT      T.TABLE_NAME, ROWNUM "Sr No", T.COLUMN_NAME, T.DATA_TYPE , T.DATA_LENGTH,      DECODE (T.NULLABLE, 'N', 'NOT NULL', 'Y', ' ') NULLABLE, T.DATA_DEFAULT, C.COMMENTS      FROM      ALL_TAB_COLS T, ALL_COL_COMMENTS C      WHERE      T.OWNER = C.OWNER      AND T.TABLE_NAME = C.TABLE_NAME      AND T.COLUMN_NAME = C.COLUMN_NAME      ORDER BY T.TABLE_NAME&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951603711668509916-4855803675105459230?l=ramprasad-techbook.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ramprasad-techbook.blogspot.com/feeds/4855803675105459230/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951603711668509916&amp;postID=4855803675105459230' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/4855803675105459230'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/4855803675105459230'/><link rel='alternate' type='text/html' href='http://ramprasad-techbook.blogspot.com/2011/03/query.html' title='A Query'/><author><name>Ramprasad</name><uri>http://www.blogger.com/profile/16032736524787849385</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951603711668509916.post-8911379499766542420</id><published>2011-02-08T17:56:00.002+05:30</published><updated>2011-02-08T17:59:03.287+05:30</updated><title type='text'></title><content type='html'>The process of building a computer program is usually managed by a build tool, a program that coordinates and controls other programs. Building a software program may comprise various modules. Each of this module will do a number of specific tasks which are logically related and clubbed together. Usually these tasks may consist of&lt;br /&gt;&lt;br /&gt;· creating/deleting directories&lt;br /&gt;· parsing some files into another type of files&lt;br /&gt;· compiling source files into class files&lt;br /&gt;· bundling the compiled files into archives&lt;br /&gt;· moving files from one place to another&lt;br /&gt;· generating some new files&lt;br /&gt;· validating some files&lt;br /&gt;· checking dependencies&lt;br /&gt;· creating databases, tables, executing sqls&lt;br /&gt;&lt;br /&gt;The build utility needs to compile and link the various files, in the correct order. If the source code in a particular file has not changed then it may not need to be recompiled (may not rather than need not because it may itself depend on other files that have changed), to shorten the time required to complete the build.&lt;br /&gt;&lt;br /&gt;The overall architecture of the build process elaborates various targets executed internally. Usually, in the build scripts echo target and some key steps they execute. If the build is starting, ending or skipping something, or if there are some files missing or if there are some errors encountered, that is echoed on the command prompt. It is also a common practice to echo the timestamp along with the steps.&lt;br /&gt;&lt;br /&gt;It is a good practice to echo the progress as elaborate as possible since that would help the user to understand the status of the build. Some other good practices include&lt;br /&gt;&lt;br /&gt;· Don't use Hard-coded values - use relative references and be sure the files/directories are checked in your version control repository so that they are available from your local workstation.&lt;br /&gt;&lt;br /&gt;· Don't Copy and Paste build scripts - same problems will be replicated everywhere. So, put all the common code in a single build script and use a .properties file to adapt to each environment&lt;br /&gt;&lt;br /&gt;· Avoid Long targets - Try to break up build behavior into discrete targets.&lt;br /&gt;&lt;br /&gt;· Clean up: If you are not removing temporary files, classes, assemblies and other files before you build, you have no way of ensuring the build was successful.&lt;br /&gt;&lt;br /&gt;· Provide test targets: If some targets are provided to test if the configuration is proper or not, it will be helpful. This would ensure that the required configuration such as installation of required software, versions matching, setting environment variables etc are done properly before starting the execution of the actual build targets.&lt;br /&gt;&lt;br /&gt;Build scripts are very powerful in automating various repetitive tasks and thereby reduce the work. Theoretically everything that is repetitive can be put in build scripts. In large software systems, having a stable, efficient, replicable and modularized build architecture is essential. This will ensure consistency and reduce the manual errors.&lt;br /&gt;&lt;br /&gt;From &lt;a href="http://blog.stelligent.com/integrate-button/2010/07/10-bad-build-practices---part-i.html"&gt;http://blog.stelligent.com/integrate-button/2010/07/10-bad-build-practices---part-i.html&lt;/a&gt; and &lt;a href="http://blog.stelligent.com/integrate-button/2010/07/10-bad-build-practices---part-i.html%0d%20en.wikipedia.org"&gt;en.wikipedia.org&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951603711668509916-8911379499766542420?l=ramprasad-techbook.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ramprasad-techbook.blogspot.com/feeds/8911379499766542420/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951603711668509916&amp;postID=8911379499766542420' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/8911379499766542420'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/8911379499766542420'/><link rel='alternate' type='text/html' href='http://ramprasad-techbook.blogspot.com/2011/02/process-of-building-computer-program-is.html' title=''/><author><name>Ramprasad</name><uri>http://www.blogger.com/profile/16032736524787849385</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951603711668509916.post-3057710912667438615</id><published>2011-01-06T12:08:00.000+05:30</published><updated>2011-01-06T12:09:41.440+05:30</updated><title type='text'>Java OS</title><content type='html'>&lt;p&gt;JavaOS is an operating system with a Java virtual machine as a fundamental component. It is developed by Sun Microsystems. Unlike Windows, Mac OS, Unix or Unix-like systems which are primarily written in the C programming language, JavaOS is primarily written in Java.&lt;br /&gt;&lt;br /&gt;As with all operating systems, the primary role of a Javaos is to manage resources in such a way so as to allow more than one program to run concurrently.As resources we define the set of computational power, memory space and I/O bandwidth that running programs compete for.&lt;br /&gt;&lt;br /&gt;In java OS, all device drivers are written in Java and executed by the virtual machine. A graphics and windowing system, implementing the AWT API is also written in Java.&lt;br /&gt;&lt;br /&gt;In the case of a Javaos , the JVM is the component responsible to interact with the hardware. Since the JVM expects an operating system to do the hardware interaction in its place, a compatibility layer between the JVM and the hardware must be built. This layer must do little more than initialising the hardware, setting up a context switching environment for servicing interrupts and branching into the JVM. Device drivers would better be kept out of the compatibility layer and be directly implemented in Java, because this will make them portable and enable them to use the classpath facilities.&lt;br /&gt;&lt;br /&gt;Two approaches to organising resources&lt;br /&gt;&lt;br /&gt;Process based: All executed programs run on the same JVM. The virtual machine builds the notion of a process by using seperate classloaders for each loaded program. Each program is tricked to believe it is running in its own virtual machine by being with private copies of bootstrap classes and its private memory space and garbage collector. Changes in the JVM are required to support this model.&lt;br /&gt;&lt;br /&gt;JVM based: Each executed program consists of one or more Java threads. A supervising thread is responsible for spawning new programs as needed using a well defined interface. Language-based memory protection and thread synchronisation mechanisms are used to protect shared resources. Loaded programs become part of the system’s classpath and so other programs can directly access their methods, but namespaces and method access control can be used to protect the program internals. No changes are required to the JVM.&lt;br /&gt;&lt;br /&gt;In the case of the Javaos , the classpath has to be modified to use the OS’s subsystems instead of native calls. Finally, although the size of the classpath seems too big to be used as the basic Javaos library, the classpath is the only library most Java applications will ever need to run.&lt;br /&gt;&lt;br /&gt;JavaOS was initially designed to run on embedded systems.&lt;br /&gt;&lt;br /&gt;From 2006 onwards Sun considers JavaOS a legacy system and recommends migration to Java ME. This by itself however is not a full replacement, as Java ME is an API specification, which runs on top of an operating system, and is not an operating system in itself.&lt;br /&gt;Sources:&lt;br /&gt;ftp://ftp.cs.man.ac.uk/pub/apt/theses/GeorgiosGousios_MSc.pdf&lt;br /&gt;wikipedia&lt;br /&gt;&lt;br /&gt;&lt;br /&gt; &lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951603711668509916-3057710912667438615?l=ramprasad-techbook.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ramprasad-techbook.blogspot.com/feeds/3057710912667438615/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951603711668509916&amp;postID=3057710912667438615' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/3057710912667438615'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/3057710912667438615'/><link rel='alternate' type='text/html' href='http://ramprasad-techbook.blogspot.com/2011/01/java-os.html' title='Java OS'/><author><name>Ramprasad</name><uri>http://www.blogger.com/profile/16032736524787849385</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951603711668509916.post-4769134622520514010</id><published>2010-12-17T14:57:00.001+05:30</published><updated>2010-12-17T14:57:48.759+05:30</updated><title type='text'>PHP</title><content type='html'>PHP stands for PHP: Hypertext Preprocessor. It is a server-side scripting language, like ASP.PHP scripts are executed on the server.PHP code is embedded into the HTML source document and interpreted by a web server with a PHP processor module, which generates the web page document.PHP is available as a processor for most modern web servers and as a standalone interpreter on most operating systems and computing platforms.&lt;br /&gt;&lt;br /&gt;Originally designed to create dynamic web pages, PHP now focuses mainly on server-side scripting,[35] and it is similar to other server-side scripting languages that provide dynamic content from a web server to a client, such as Microsoft's Asp.net, Sun Microsystems' JavaServer Pages,[36] and mod_perl.&lt;br /&gt;&lt;br /&gt;The PHP language was originally implemented using a PHP interpreter. Several compilers now exist, which decouple the PHP language from the interpreter.&lt;br /&gt;&lt;br /&gt;It is a powerful tool for making dynamic and interactive Web pages. PHP is an open source software and is free to download and use. PHP Group provides the complete source code for users to build, customize and extend for their own use. It is the widely-used, free, and efficient alternative to competitors such as Microsoft's ASP.PHP supports many databases (MySQL, Informix, Oracle, Sybase, Solid, PostgreSQL, Generic ODBC, etc.)&lt;br /&gt;&lt;br /&gt;PHP cannot be run on tomcat server directly. Apache foundation has apache server which is capable of compiling PHP scripts. We can run both servers in same machine at the same time.&lt;br /&gt;&lt;br /&gt;Advantages of php:&lt;br /&gt;·        It is fast, stable, secure, easy to use and open source (free).&lt;br /&gt;·         PHP code is inserted directly into the HTML that makes up even a website.&lt;br /&gt;·         It runs on many different operating systems&lt;br /&gt;·         Since it is server side (no need to futz with client installs - only with rendering issues if you use CSS).&lt;br /&gt;·         The language is similar to C and Perl so that anyone with a background in either C or Perl programming will feel comfortable using and understanding PHP&lt;br /&gt;·         PHP is a full-fledged programming language (unlike HTML for example, which is more of a presentation means) and many complex applications can be written it it.&lt;br /&gt;·         There are tons of ready PHP scripts and functions, which can be customized to our liking and used in our PHP applications.&lt;br /&gt;·         PHP hosting is a type of a webhosting package aimed at running applications written in PHP. Since the webhosting provider can use webhosting technologies for free(PHP, Linux and MySQL) it leads to the lower cost of webhosting.&lt;br /&gt; &lt;br /&gt;Sources&lt;br /&gt;http://www.w3schools.com/php/default.asp&lt;br /&gt;http://www.softminer.net/2009/05/how-to-install-or-run-php-on-tomcat-6.html&lt;br /&gt;http://www.designersplayground.com/articles/118/1/The-Advantages-of-PHP/Page1.html&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951603711668509916-4769134622520514010?l=ramprasad-techbook.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ramprasad-techbook.blogspot.com/feeds/4769134622520514010/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951603711668509916&amp;postID=4769134622520514010' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/4769134622520514010'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/4769134622520514010'/><link rel='alternate' type='text/html' href='http://ramprasad-techbook.blogspot.com/2010/12/php.html' title='PHP'/><author><name>Ramprasad</name><uri>http://www.blogger.com/profile/16032736524787849385</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951603711668509916.post-6078164290716167867</id><published>2010-12-15T12:35:00.001+05:30</published><updated>2010-12-15T12:35:32.498+05:30</updated><title type='text'>Scripting</title><content type='html'>Scripts are often interpreted from source code or bytecode, whereas application software is typically first compiled to a native machine code or to an intermediate code.&lt;br /&gt;&lt;br /&gt;Client scripts&lt;br /&gt;-----------------&lt;br /&gt;Client-side scripts are often embedded within an HTML document (hence known as an "embedded script"), but they may also be contained in a separate file, which is referenced by the document (or documents) that use it (hence known as an "external script"). &lt;br /&gt;By viewing the file that contains the script, users may be able to see its source code. Many web authors learn how to write client-side scripts partly by examining the source code for other authors' scripts.&lt;br /&gt;&lt;br /&gt;Client-side scripts have greater access to the information and functions available on the user's browser, whereas server-side scripts have greater access to the information and functions available on the server.&lt;br /&gt;&lt;br /&gt;Due to security restrictions, client-side scripts may not be allowed to access the user's computer beyond the web browser application. Techniques like ActiveX controls can be used to sidestep this restriction.&lt;br /&gt;&lt;br /&gt;Unfortunately, even languages that are supported by a wide variety of browsers may not be implemented in precisely the same way across all browsers and operating systems. Authors are well-advised to review the behavior of their client-side scripts on a variety of platforms before they put them into use.&lt;br /&gt;&lt;br /&gt;Some client-side scripting languages:&lt;br /&gt;&lt;br /&gt;JavaScript (Client-side JavaScript) (*.js)&lt;br /&gt;VBScript(*.vbs)&lt;br /&gt;&lt;br /&gt;Server scripts&lt;br /&gt;------------------&lt;br /&gt;Server-side scripts, written in languages such as Perl, PHP, and server-side VBScript, are executed by the web server when the user requests a document. They produce output in a format understandable by web browsers (usually HTML), which is then sent to the user's computer. The user cannot see the script's source code (unless the author publishes the code separately), and may not even be aware that a script was executed. Documents produced by server-side scripts may, in turn, contain client-side script&lt;br /&gt;&lt;br /&gt;Server-side scripts require that their language's interpreter be installed on the server, and produce the same output regardless of the client's browser, operating system, or other system details. Client-side scripts do not require additional software on the server (making them popular with authors who lack administrative access to their servers); however, they do require that the user's web browser understands the scripting language in which they are written. It is therefore impractical for an author to write scripts in a language that is not supported by popular web browsers.&lt;br /&gt;&lt;br /&gt;In the earlier days of the web, server-side scripting was almost exclusively performed by using a combination of C programs, Perl scripts and shell scripts using the Common Gateway Interface (CGI). Those scripts were executed by the operating system, mnemonic coding and the results simply served back by the web server. Nowadays, these and other on-line scripting languages such as ASP and PHP can often be executed directly by the web server itself or by extension modules (e.g. mod_perl or mod php) to the web server.&lt;br /&gt;&lt;br /&gt;Some server-side scripting languages:&lt;br /&gt;ASP&lt;br /&gt;ColdFusion Markup Language (*.cfm)&lt;br /&gt;Java via JavaServer Pages (*.jsp)&lt;br /&gt;JavaScript using Server-side JavaScript (*.ssjs)&lt;br /&gt;PHP (*.php)&lt;br /&gt;SMX (*.smx)&lt;br /&gt;Lasso (*.lasso)&lt;br /&gt;WebDNA (*.dna,*.tpl)&lt;br /&gt;&lt;br /&gt;ECMAScript is the scripting language standardized by Ecma International in the ECMA-262 specification and ISO/IEC 16262. The language is widely used for client-side scripting on the web, in the form of several well-known dialects such as JavaScript, JScript, and ActionScript(ActionScript is an object-oriented language originally developed by Macromedia Inc).&lt;br /&gt;&lt;br /&gt;source: wikipedia.org&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951603711668509916-6078164290716167867?l=ramprasad-techbook.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ramprasad-techbook.blogspot.com/feeds/6078164290716167867/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951603711668509916&amp;postID=6078164290716167867' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/6078164290716167867'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/6078164290716167867'/><link rel='alternate' type='text/html' href='http://ramprasad-techbook.blogspot.com/2010/12/scripting.html' title='Scripting'/><author><name>Ramprasad</name><uri>http://www.blogger.com/profile/16032736524787849385</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951603711668509916.post-3109339206213954271</id><published>2010-12-14T15:07:00.000+05:30</published><updated>2010-12-14T15:08:04.838+05:30</updated><title type='text'>CTI</title><content type='html'>Computer telephony integration, also called or CTI, is technology that allows interactions on a telephone and a computer to be integrated or co-ordinated. As contact channels have expanded from voice to include email, web, and fax, the definition of CTI has expanded to include the integration of all customer contact channels (voice, email, web, fax, etc.) with computer systems. It mainly does the following:&lt;br /&gt;&lt;br /&gt;· CTI enables the computer user to control their telephone system&lt;br /&gt;· CTI enables the telephone system to display information via the computer&lt;br /&gt;&lt;br /&gt;A CTI system performs various other functionalities which are listed below:&lt;br /&gt;&lt;br /&gt;· It displays information about the call like the caller’s number, the dialed number etc&lt;br /&gt;· The dialing is automatically computer managed, speedy and prognostic&lt;br /&gt;·  It flawlessly synchronizes the transmission of data between telephone and computer&lt;br /&gt;· It is integrated with call routing, reporting utilities, desktop functions automation, multi channeling, mailing and cataloguing online requests&lt;br /&gt;· It can record the calls with an inbuilt recording software for quality inspection&lt;br /&gt;&lt;br /&gt;http://www.tech-faq.com/computer-telephony-integration-cti.html&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951603711668509916-3109339206213954271?l=ramprasad-techbook.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ramprasad-techbook.blogspot.com/feeds/3109339206213954271/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951603711668509916&amp;postID=3109339206213954271' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/3109339206213954271'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/3109339206213954271'/><link rel='alternate' type='text/html' href='http://ramprasad-techbook.blogspot.com/2010/12/cti.html' title='CTI'/><author><name>Ramprasad</name><uri>http://www.blogger.com/profile/16032736524787849385</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951603711668509916.post-3697306607347700904</id><published>2010-12-09T19:21:00.003+05:30</published><updated>2010-12-09T19:24:42.049+05:30</updated><title type='text'>Documentation</title><content type='html'>Most of the engineers look at documentation work contemptuously. They think that it is not actually the "engineering" work but has got mostly to do with one's skills in the language. Many engineers who are excellent coders are found to be equally horrible when it comes to documenting what they have coded.&lt;br /&gt;&lt;br /&gt;But very few intelligent folks agree that documentation can be as interesting and challenging as coding. In product companies, writing Release notes is an important task. Some companies hire technical writers who are specialized in doing this, but many would expect the developer himself/herself to perform this task. No one can deny the fact that the best documentation can be provided by the one who has coded it, provided he is skilled in that as well.&lt;br /&gt;&lt;br /&gt;One need not be the Shakespeare to write good release notes or documentation. Nor does he need to have a great vocabulary. He just has to be clear in his thinking and develop the skill to put it with simple but appropriate words.&lt;br /&gt;&lt;br /&gt;Here are some guidelines on that, it may seem very obvious but they are very important.&lt;br /&gt;&lt;br /&gt;· Sentences should explain what the application/code/fix does than how it does.&lt;br /&gt;· Wherever there is an external reference needed, proper link(ref numbers, urls etc) to that should be provided.&lt;br /&gt;· Examples/diagrams should be used to explain relatively complex things.&lt;br /&gt;· Sentences should be arranged in logical paragraphs.&lt;br /&gt;· Repeated usage of verbose description and unnecessary phrases(e.g what it means is that), should be avoided.&lt;br /&gt;· Lengthy sentences should be avoided as much as possible.&lt;br /&gt;· Spelling and other grammar rules should be respected.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951603711668509916-3697306607347700904?l=ramprasad-techbook.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ramprasad-techbook.blogspot.com/feeds/3697306607347700904/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951603711668509916&amp;postID=3697306607347700904' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/3697306607347700904'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/3697306607347700904'/><link rel='alternate' type='text/html' href='http://ramprasad-techbook.blogspot.com/2010/12/documentation.html' title='Documentation'/><author><name>Ramprasad</name><uri>http://www.blogger.com/profile/16032736524787849385</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951603711668509916.post-6736227336608389249</id><published>2010-12-03T15:23:00.000+05:30</published><updated>2010-12-03T15:25:16.286+05:30</updated><title type='text'>RSM</title><content type='html'>It is used for visual modeling and model-driven development (MDD) with UML for creating applications and web services. It has integrations with other Rational tools, such as ClearCase configuration management and ClearQuest.&lt;br /&gt;&lt;br /&gt;Some features:&lt;br /&gt;Model files are stored as .emx/.efx files. (compare this with rose files which are stored as .cat files)These are in fact nothing but xml files.&lt;br /&gt;RSM came to overcome the drawback of rational rose where it was not possible to integrate it within the IDE. But RSM can be integrated within IDE.&lt;br /&gt;For the next-generation MDD products, model-driven development functions was built on top of Eclipse to form a more complete MDD tool. These came with IBM Rational XDE (extended development environment for the next generation of programming technologies) IBM Rational XDE was characterized as the next generation of IBM Rational Rose.&lt;br /&gt; v7.5 was released in September 2008 &lt;br /&gt;source: Wikipedia&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951603711668509916-6736227336608389249?l=ramprasad-techbook.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ramprasad-techbook.blogspot.com/feeds/6736227336608389249/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951603711668509916&amp;postID=6736227336608389249' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/6736227336608389249'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/6736227336608389249'/><link rel='alternate' type='text/html' href='http://ramprasad-techbook.blogspot.com/2010/12/rsm.html' title='RSM'/><author><name>Ramprasad</name><uri>http://www.blogger.com/profile/16032736524787849385</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951603711668509916.post-1428628732349602602</id><published>2010-11-23T14:52:00.000+05:30</published><updated>2010-11-23T14:53:02.240+05:30</updated><title type='text'>Deprecation</title><content type='html'>In fact, the meaning of the word Deprecation goes as 'A prayer to avert or remove some evil or disaster', but in java as we all know it is a way to tell callers of methods/classes that 'This is not a good method/class to use, we may discontinue to have this with us eventually'. One common thing usually associated with deprecation is to point to the new method/class that should be used as a replacement.&lt;br /&gt;&lt;br /&gt;Following things are worth considering while deprecating something:&lt;br /&gt;&lt;br /&gt;1) Clients might be already using the artifacts which you are planning to deprecate. If you remove this, or change the signature of this, their code might break. That is exactly why we have deprecation in place. So deprecation is one of the best alternatives to remove an artifact. Any removal/addition that can impact the existing code is worth considering for deprecation.&lt;br /&gt;&lt;br /&gt;2) When you deprecate an artifact, ideally you should deprecate all other artifacts which refer to this deprecated artifact as well, if they are in your control. Of course, you cannot control those which are calling your deprecated artifact from outside.&lt;br /&gt;&lt;br /&gt;3) Deprecation is usually associated with a clear description of the release since when it was deprecated, why it was deprecated and what is the alternative provided.&lt;br /&gt;&lt;br /&gt;4) If you are writing new artifacts, try to avoid the references to deprecated artifacts as much as possible.&lt;br /&gt;&lt;br /&gt;5) Deprecated artifacts are believed be removed at some point in time in future, though I have never seen anything deprecated previously that was actually removed. The explanation to this is 'backward compatibility'.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951603711668509916-1428628732349602602?l=ramprasad-techbook.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ramprasad-techbook.blogspot.com/feeds/1428628732349602602/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951603711668509916&amp;postID=1428628732349602602' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/1428628732349602602'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/1428628732349602602'/><link rel='alternate' type='text/html' href='http://ramprasad-techbook.blogspot.com/2010/11/deprecation.html' title='Deprecation'/><author><name>Ramprasad</name><uri>http://www.blogger.com/profile/16032736524787849385</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951603711668509916.post-8863875501939085663</id><published>2010-10-07T10:57:00.001+05:30</published><updated>2010-10-07T10:57:53.057+05:30</updated><title type='text'>Annotations</title><content type='html'>Annotations in Java is all about adding meta-data facility to the Java Elements. Like Classes, Interfaces or Enums, Annotations define a type in Java and they can be applied to several Java Elements. Annotations are differentiated from other elements like class, interface etc., by preceding an '@' symbol before it.&lt;br /&gt;&lt;br /&gt;Rules:&lt;br /&gt;Annotation declaration should start with an 'at' sign like @, following with an interface keyword, following with the annotation name.&lt;br /&gt;&lt;br /&gt;Method declarations should not have any parameters.&lt;br /&gt;Method declarations should not have any throws clauses.&lt;br /&gt;&lt;br /&gt;Return types of the method should be one of the following:&lt;br /&gt;1)primitives&lt;br /&gt;2)String&lt;br /&gt;3)Class&lt;br /&gt;4)enum&lt;br /&gt;5)array of the above types&lt;br /&gt;&lt;br /&gt;There are three annotation types:&lt;br /&gt;Marker: Marker type annotations have no elements, except the annotation name itself.&lt;br /&gt;Example&lt;br /&gt;&lt;br /&gt;public @interface MyAnnotation {&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;Single-Element: Single-element, or single-value type, annotations provide a single piece of data only. This can be represented with a data=value pair or, simply with the value (a shortcut syntax) only, within parenthesis.&lt;br /&gt;&lt;br /&gt;public @interface MyAnnotation&lt;br /&gt;{&lt;br /&gt;    String doSomething();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;Full-value or multi-value: Full-value type annotations have multiple data members. Therefore, you must use a full data=value parameter syntax for each member.&lt;br /&gt;&lt;br /&gt;public @interface MyAnnotation {&lt;br /&gt;   String doSomething();&lt;br /&gt;   int count; String date();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;There are only three types of simple annotations provided by JDK5&lt;br /&gt;1)Override&lt;br /&gt;2)Deprecated&lt;br /&gt;3)SuppressWarnings&lt;br /&gt;&lt;br /&gt;Meta-Annotations (Annotation Types)&lt;br /&gt;Target Annotation - @Target(ElementType.METHOD)&lt;br /&gt;Retention Annotation -@Retention(RetentionPolicy.CLASS)&lt;br /&gt;Documented Annotation - @Documented&lt;br /&gt;Inherited Annotation - @Inherited&lt;br /&gt; &lt;br /&gt;From &lt;a href="http://www.javabeat.net/articles/30-annotations-in-java-50-1.html"&gt;http://www.javabeat.net/articles/30-annotations-in-java-50-1.html&lt;/a&gt;&lt;br /&gt; and &lt;a href="http://www.developer.com/java/other/article.php/3556176/An-Introduction-to-Java-Annotations.htm"&gt;http://www.developer.com/java/other/article.php/3556176/An-Introduction-to-Java-Annotations.htm&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951603711668509916-8863875501939085663?l=ramprasad-techbook.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ramprasad-techbook.blogspot.com/feeds/8863875501939085663/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951603711668509916&amp;postID=8863875501939085663' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/8863875501939085663'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/8863875501939085663'/><link rel='alternate' type='text/html' href='http://ramprasad-techbook.blogspot.com/2010/10/annotations.html' title='Annotations'/><author><name>Ramprasad</name><uri>http://www.blogger.com/profile/16032736524787849385</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951603711668509916.post-7270927864574381040</id><published>2010-10-06T12:16:00.001+05:30</published><updated>2010-10-06T12:16:45.573+05:30</updated><title type='text'>Guice</title><content type='html'>Guice provides support for dependency injection using annotations to configure Java objects. Dependency injection is a design pattern with a core principal is to separate behavior from dependency resolution. In other words: a technique for decoupling highly dependent software components.&lt;br /&gt;&lt;br /&gt;Dependency injection is a specific form of inversion of control where the concern being inverted is the process of obtaining the needed dependency.&lt;br /&gt;&lt;br /&gt;The following is an example. A car (the consumer) depends upon an engine (the dependency) in order to move. The car's engine is made by an automaker (the dependency provider). The car does not know how to install an engine into itself, but it needs an engine in order to move. The automaker installs an engine into the car and the car utilizes the engine to move.&lt;br /&gt;&lt;br /&gt;Guice allows implementation classes to be programmatically bound to an interface, then injected into constructors, methods or fields using an @Inject annotation. When more than one implementation of the same interface is needed, the user can create custom annotations that identify an implementation, then use that annotation when injecting it.&lt;br /&gt;&lt;br /&gt;Following is an extract from official Google guice site(from http://code.google.com/docreader/#p=google-guice&amp;amp;s=google-guice&amp;amp;t=UsersGuide):-&lt;br /&gt;&lt;br /&gt;The dependency injection pattern separates behaviour from dependency resolution. Rather than looking up dependencies directly or from factories, the pattern recommends that dependencies are passed in. The process of setting dependencies into an object is called injection.&lt;br /&gt;&lt;br /&gt;Constructor Injection&lt;br /&gt;Method Injection&lt;br /&gt;Field Injection&lt;br /&gt;Optional Injections&lt;br /&gt;requestInjection&lt;br /&gt;Static Injections&lt;br /&gt;Automatic Injection&lt;br /&gt;&lt;br /&gt;With dependency injection, objects accept dependencies in their constructors. To construct an object, you first build it's dependencies. But to build each dependency, you need its dependencies, and so on. So when you build an object, you really need to build an object graph.&lt;br /&gt;&lt;br /&gt;Building object graphs by hand is labour intensive, error prone, and makes testing difficult. Instead, Guice can build the object graph for you. But first, Guice needs to be configured to build the graph exactly as you want it. Guice uses bindings to map types to their implementations. A module is a collection of bindings specified using fluent, English-like method calls:&lt;br /&gt;&lt;br /&gt;The injector's job is to assemble graphs of objects. You request an instance of a given type, and it figures out what to build, resolves dependencies, and wires everything together. To specify how dependencies are resolved, configure your injector with bindings.&lt;br /&gt;&lt;br /&gt;Bindings could be 'linked bindings, instance bindings, @Provides methods, provider bindings, untargetted bindings.In addition to the bindings you specify, the injector includes 'built-in bindings'. When a dependency is requested but not found it attempts to create a 'just-in-time binding'. The injector also includes bindings for the providersof its other bindings.&lt;br /&gt;&lt;br /&gt;Linked bindings map a type to its implementation.Linked bindings can also be chained:&lt;br /&gt;bind(TransactionLog.class).to(DatabaseTransactionLog.class);  bind(DatabaseTransactionLog.class).to(MySqlDatabaseTransactionLog.class);&lt;br /&gt; &lt;br /&gt;To enable multiple bindings for a same type, bindings support an optional binding annotation. The annotation and type together uniquely identify a binding. This pair is called a key.&lt;br /&gt;&lt;br /&gt;You can bind a type to a specific instance of that type. This is usually only useful only for objects that don't have dependencies of their own, such as value objects:&lt;br /&gt;&lt;br /&gt;When you need code to create an object, use an @Provides method. The method must be defined within a module, and it must have an @Provides annotation. The method's return type is the bound type. Whenever the injector needs an instance of that type, it will invoke the method.&lt;br /&gt;&lt;br /&gt;You may create bindings without specifying a target. This is most useful for concrete classes and types annotated by either @ImplementedBy or @ProvidedBy. An untargetted binding informs the injector about a type, so it may prepare dependencies eagerly.&lt;br /&gt;&lt;br /&gt;@ImplementedBy&lt;br /&gt;Annotate types tell the injector what their default implementation type is. The @ImplementedBy annotation acts like a linked binding, specifying the subtype to use when building a type.&lt;br /&gt;&lt;br /&gt;Guice uses annotations to identify scopes. Specify the scope for a type by applying the scope annotation to the implementation class. As well as being functional, this annotation also serves as documentation. For example, @Singleton indicates that the class is intended to be threadsafe.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951603711668509916-7270927864574381040?l=ramprasad-techbook.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ramprasad-techbook.blogspot.com/feeds/7270927864574381040/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951603711668509916&amp;postID=7270927864574381040' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/7270927864574381040'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/7270927864574381040'/><link rel='alternate' type='text/html' href='http://ramprasad-techbook.blogspot.com/2010/10/guice.html' title='Guice'/><author><name>Ramprasad</name><uri>http://www.blogger.com/profile/16032736524787849385</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951603711668509916.post-5791169822610469379</id><published>2010-08-20T15:41:00.001+05:30</published><updated>2010-08-20T15:41:53.145+05:30</updated><title type='text'>Workflow</title><content type='html'>&lt;p&gt;In operating system workflow is scheduling of independent jobs on a computer. But in general it impliesa set of relationships between all the activities in a project, from start to finish. Activities are related by different types of trigger relation. Activities may be triggered by external events or by other activities. It can also mean the movement of documents around an organisation for purposes including sign-off, evaluation, performing activities in a process and co-writing.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;A workflow application is a software application which automates, at least to some degree, a process or processes. The processes are usually business-related, but it may be any process that requires a series of steps that can be automated via software. Some steps of the process may require human intervention, such as an approval or the development of custom text, but functions that can be automated should be handled by the application. &lt;/p&gt;&lt;p&gt;&lt;br /&gt;Some examples:&lt;br /&gt;CuteFlow is a webbased document circulation/workflow tool. Users are able to define "documents" which are send step by step to every user in a list. It's an electronical way for doing (i.e. internal) document circulations&lt;/p&gt;&lt;p&gt;&lt;br /&gt;The Java Workflow Tooling project (JWT) aims to build design time, development time and runtime workflow tools and to foster an ecosystem of interoperable Business Process Management (BPM) platforms. &lt;/p&gt;&lt;p&gt;&lt;br /&gt;YAWL is a BPM/Workflow system. Based on a concise and powerful modelling language, YAWL handles complex data, transformations, integration with organizational resources and Web Service integration. Built in Java, it uses XML Schema and XQuery natively.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;The Open Business Engine is a Java workflow engine implementing Workflow Management Coalition Open Standards (WfMC: XPDL, WAPI, Auditing). Highly modular and configurable, it suits J2EE or embedded deployment. Supports integration via Web Services etc. &lt;/p&gt;&lt;p&gt;&lt;br /&gt;The 'Workflow' Perl module implements a standalone workflow system. It aims to be simple but flexible and therefore powerful. Each piece of the 'Workflow' system has a direct and easily stated job, and hopefully you will find that you can put the pieces together to create very useful systems. &lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951603711668509916-5791169822610469379?l=ramprasad-techbook.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ramprasad-techbook.blogspot.com/feeds/5791169822610469379/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951603711668509916&amp;postID=5791169822610469379' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/5791169822610469379'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/5791169822610469379'/><link rel='alternate' type='text/html' href='http://ramprasad-techbook.blogspot.com/2010/08/workflow.html' title='Workflow'/><author><name>Ramprasad</name><uri>http://www.blogger.com/profile/16032736524787849385</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951603711668509916.post-1284790430084904568</id><published>2010-08-10T20:05:00.000+05:30</published><updated>2010-08-10T20:06:33.233+05:30</updated><title type='text'>Bulk transactions</title><content type='html'>Sometimes, we might need to insert a huge number of records into database. Such situations can be tricky. Lets consider a scenario where you have to insert say 25000 records in 3-4 tables. There could be some data integrity constraints among these tables. The database cache may not accommodate all the data into it before a commit is executed. In such cases it might be necessary to explicitly commit the data inserted after say every 5000 records. Care should be taken to ensure data integrity between multiple tables. Also, need to think what would happen if the first 5000 inserts are successful and committed but the next 5000 failed. Should the previous 5000 inserts already committed be removed ?&lt;br /&gt;&lt;br /&gt;Executing such transactions in one single go could be painful. Usually large amount of insertions are done using batch processes. These are nothing but some special programs set up so they can be run to completion without manual intervention, so all input data is pre-selected through scripts or command-line parameters.(This is in contrast to "online" or interactive programs which prompt the user for such input. A program takes a set of data files as input, processes the data, and produces a set of output data files. This operating environment is termed as "batch processing" because the input data are collected into batches on files and are processed in batches by the program) However, in order to track the failure it is good to maintain logs for such transactions.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951603711668509916-1284790430084904568?l=ramprasad-techbook.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ramprasad-techbook.blogspot.com/feeds/1284790430084904568/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951603711668509916&amp;postID=1284790430084904568' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/1284790430084904568'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/1284790430084904568'/><link rel='alternate' type='text/html' href='http://ramprasad-techbook.blogspot.com/2010/08/bulk-transactions.html' title='Bulk transactions'/><author><name>Ramprasad</name><uri>http://www.blogger.com/profile/16032736524787849385</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951603711668509916.post-1330043192200087607</id><published>2010-07-22T18:40:00.001+05:30</published><updated>2010-07-22T18:41:25.593+05:30</updated><title type='text'>SQL joins</title><content type='html'>Inner join&lt;br /&gt;================&lt;br /&gt;This is the default join-type. It creates a new result table by combining column values of two tables (A and B) based upon the join-predicate.&lt;br /&gt;&lt;br /&gt;The "explicit join notation" uses the JOIN keyword to specify the table to join, and the ON keyword to specify the predicates for the join.&lt;br /&gt;&lt;br /&gt;SELECT * FROM employee INNER JOIN department ON employee.DepartmentID = department.DepartmentID&lt;br /&gt;&lt;br /&gt;The "implicit join notation" simply lists the tables for joining (in the FROM clause of the SELECT statement), using commas to separate them. Thus, it specifies a cross-join, and the WHERE clause may apply additional filter-predicates (which function comparably to the join-predicates in the explicit notation).&lt;br /&gt;&lt;br /&gt;SELECT * FROM employee, department WHERE employee.DepartmentID = department.DepartmentID&lt;br /&gt;&lt;br /&gt;Programmers should take special care when joining tables on columns that can contain NULL values, since NULL will never match any other value (or even NULL itself), unless the join condition explicitly uses the IS NULL or IS NOT NULL predicates.&lt;br /&gt;&lt;br /&gt;Equi join&lt;br /&gt;===========&lt;br /&gt;An equi-join, sees only equality comparisons in the join-predicate. Using other comparison operators (such as &lt;) disqualifies a join as an equi-join. The query shown above are examples of an equi-join.&lt;br /&gt;&lt;br /&gt;Natural Join&lt;br /&gt;===============&lt;br /&gt;A natural join offers a further specialization of equi-joins. The join predicate arises implicitly by comparing all columns in both tables that have the same column-name in the joined tables. The resulting joined table contains only one column for each pair of equally-named columns.&lt;br /&gt;&lt;br /&gt;SELECT * FROM employee NATURAL JOIN department&lt;br /&gt;&lt;br /&gt;Cross join&lt;br /&gt;============&lt;br /&gt;A cross join returns the cartesian product of the sets of records from the two joined tables. This is the foundation upon which all types of inner joins operate. It equates to an inner join where the join-condition always evaluates to True or where the join-condition is absent from the statement.&lt;br /&gt;SELECT * FROM employee CROSS JOIN department&lt;br /&gt;or&lt;br /&gt;SELECT * FROM employee, department;&lt;br /&gt;&lt;br /&gt;Self-join&lt;br /&gt;==============&lt;br /&gt;A self-join is joining a table to itself. For example a query to find all pairings of two employees in the same country is desired. Both employee and country information stored in the same table.&lt;br /&gt;&lt;br /&gt;Outer joins&lt;br /&gt;============&lt;br /&gt;An outer join does not require each record in the two joined tables to have a matching record. The joined table retains each record even if no other matching record exists. Outer joins are further classified into left outer joins, right outer joins, and full outer joins.&lt;br /&gt;&lt;br /&gt;Left outer join&lt;br /&gt;=================&lt;br /&gt;The result of a left outer join for table A and B always contains all records of the "left" table (A), even if the join-condition does not find any matching record in the "right" table (B). This means that it returns all the values from the left table, plus matched values from the right table (or NULL in case of no matching join predicate).If the left table returns one row and the right table returns more than one matching row for it, the values in the left table will be repeated for each distinct row on the right table.&lt;br /&gt;SELECT * FROM employee LEFT OUTER JOIN department ON employee.DepartmentID = department.DepartmentID&lt;br /&gt;&lt;br /&gt;Right outer joins&lt;br /&gt;=====================&lt;br /&gt;A right outer join closely resembles a left outer join, except with the treatment of the tables is reversed. Every row from the "right" table (B) will appear in the joined table at least once. In practice, explicit right outer joins are rarely used, since they can always be replaced with left outer joins (with the table order switched) and provide no additional functionality.&lt;br /&gt;&lt;br /&gt;Full outer join&lt;br /&gt;=================&lt;br /&gt;A full outer join combines the results of both left and right outer joins. The joined table will contain all records from both tables, and fill in NULLs for missing matches on either side.&lt;br /&gt;&lt;br /&gt;SELECT * FROM employee FULL OUTER JOIN department ON employee.DepartmentID = department.DepartmentID&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951603711668509916-1330043192200087607?l=ramprasad-techbook.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ramprasad-techbook.blogspot.com/feeds/1330043192200087607/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951603711668509916&amp;postID=1330043192200087607' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/1330043192200087607'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/1330043192200087607'/><link rel='alternate' type='text/html' href='http://ramprasad-techbook.blogspot.com/2010/07/inner-join-this-is-default-join-type.html' title='SQL joins'/><author><name>Ramprasad</name><uri>http://www.blogger.com/profile/16032736524787849385</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951603711668509916.post-1297480377710384861</id><published>2010-07-12T18:40:00.001+05:30</published><updated>2010-07-15T12:35:43.160+05:30</updated><title type='text'>DB design guidelines</title><content type='html'>&lt;p&gt;Following guidelines are useful in most of the database design.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;Consider 2 tables A and B&lt;/p&gt;&lt;p&gt;&lt;br /&gt;If the relationship from A to B is 1 to 1(one to one)&lt;br /&gt;then either pk of A can be fk in B or vice versa. Ideally, if B is dependent on A, the pk of A should be an fk in B.&lt;br /&gt;&lt;br /&gt;If the relationship from A to B is 0:1 to 0:1(one to one, non-mandatory)&lt;br /&gt;then either pk of A can be fk in B or vice versa, but with a nullable fk constraint. Ideally, if B is dependent on A, the pk of A should be an fk in B.&lt;br /&gt;&lt;br /&gt;If the relationship from A to B is 1 to 0:N(one to many)&lt;br /&gt;then pk of A is fk in B&lt;br /&gt;&lt;br /&gt;If the relationship from A to B is 0:1 to 0:N (one to many, non-mandatory)&lt;br /&gt;then pk of A is fk in B, but with a nullable fk constraint.&lt;br /&gt;&lt;br /&gt;If the relationship from A to B is 0:N to 0:N(many to many, non-mandatory)&lt;br /&gt;we need a link entity to contain pk of A and pk of B.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951603711668509916-1297480377710384861?l=ramprasad-techbook.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ramprasad-techbook.blogspot.com/feeds/1297480377710384861/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951603711668509916&amp;postID=1297480377710384861' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/1297480377710384861'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/1297480377710384861'/><link rel='alternate' type='text/html' href='http://ramprasad-techbook.blogspot.com/2010/07/db-design-guidelines.html' title='DB design guidelines'/><author><name>Ramprasad</name><uri>http://www.blogger.com/profile/16032736524787849385</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951603711668509916.post-8467850010299418415</id><published>2010-07-09T20:04:00.001+05:30</published><updated>2010-07-09T20:04:25.326+05:30</updated><title type='text'>Multiple instances of jvm.</title><content type='html'>When 2 java programs containing two main methods are running, actually there are two separate instances of jvm running. Each java.exe launches an instance of jvm. Different instances of JVM are multiple instances of java.exe running on the same machine.&lt;br /&gt;&lt;br /&gt;That means when you open two command prompts and run two java programs - "java program1" and "java program2" - there are two instances of jvm running through  two separate java.exe.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951603711668509916-8467850010299418415?l=ramprasad-techbook.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ramprasad-techbook.blogspot.com/feeds/8467850010299418415/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951603711668509916&amp;postID=8467850010299418415' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/8467850010299418415'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/8467850010299418415'/><link rel='alternate' type='text/html' href='http://ramprasad-techbook.blogspot.com/2010/07/multiple-instances-of-jvm.html' title='Multiple instances of jvm.'/><author><name>Ramprasad</name><uri>http://www.blogger.com/profile/16032736524787849385</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951603711668509916.post-1671447001897669020</id><published>2010-07-08T14:13:00.000+05:30</published><updated>2010-07-08T14:14:08.702+05:30</updated><title type='text'>Castor</title><content type='html'>Castor is a framework used for xml databinding. Data can be converted from xml to java object and from java object to xml file through marshalling and unmarshalling. A mapping xml file is used to indicate the java object type and the corresponding xml element or attribute.&lt;br /&gt;Castor XML can marshal almost any "bean-like" Java Object to and from XML. In most cases the marshalling framework uses a set of ClassDescriptors and FieldDescriptors to describe how an Object should be marshalled and unmarshalled from XML.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.castor.org/xml-framework.html"&gt;http://www.castor.org/xml-framework.html&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951603711668509916-1671447001897669020?l=ramprasad-techbook.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ramprasad-techbook.blogspot.com/feeds/1671447001897669020/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951603711668509916&amp;postID=1671447001897669020' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/1671447001897669020'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/1671447001897669020'/><link rel='alternate' type='text/html' href='http://ramprasad-techbook.blogspot.com/2010/07/castor.html' title='Castor'/><author><name>Ramprasad</name><uri>http://www.blogger.com/profile/16032736524787849385</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951603711668509916.post-1516568358522303666</id><published>2010-05-07T14:18:00.000+05:30</published><updated>2010-05-07T14:19:55.823+05:30</updated><title type='text'>Connecting to db</title><content type='html'>There are various applications available to connect to the database such as toad,sqldbx etc.&lt;br /&gt;However, sometimes it is easy to use a plain java class to execute some queries or read some tables for test purposes.Here is a sample code snippet for the same.&lt;br /&gt;&lt;br /&gt;import java.sql.Connection;&lt;br /&gt;import java.sql.DriverManager;&lt;br /&gt;import java.sql.PreparedStatement;&lt;br /&gt;import java.sql.ResultSet;&lt;br /&gt;&lt;br /&gt;public class TestDatabase {&lt;br /&gt;  public static void main(String args[]) {&lt;br /&gt;    try {&lt;br /&gt;      Connection databaseConnection = connectToOracle();&lt;br /&gt;      // Connection databaseConnection = connectToDB2();&lt;br /&gt;      System.out.println("=============Conneted to database======"&lt;br /&gt;          + databaseConnection);&lt;br /&gt;      PreparedStatement sqlStatement = databaseConnection&lt;br /&gt;          .prepareStatement("SELECT * FROM MYTABLE");&lt;br /&gt;      ResultSet resultSet = sqlStatement.executeQuery();&lt;br /&gt;      while (resultSet.next()) {&lt;br /&gt;        System.out.println(resultSet.getString(1));&lt;br /&gt;      }&lt;br /&gt;    } catch (Exception e) {&lt;br /&gt;      e.printStackTrace();&lt;br /&gt;    }&lt;br /&gt;  }&lt;br /&gt;  private static Connection connectToOracle() throws Exception {&lt;br /&gt;    // Ip address for local host. even "localhost" can also be used instead of&lt;br /&gt;    // this.&lt;br /&gt;    String serverName = "127.0.0.1";&lt;br /&gt;    // String serverName = "localhost";&lt;br /&gt;    String portNumber = "1521";&lt;br /&gt;    // SID is the name of the database. By default the sid is "XE".&lt;br /&gt;    String sid = "mydbname";&lt;br /&gt;    String url = "jdbc:oracle:thin:@" + serverName + ":" + portNumber + ":"&lt;br /&gt;        + sid;&lt;br /&gt;    String username = "myusername";&lt;br /&gt;    String password = "mypassword";&lt;br /&gt;    Class.forName("oracle.jdbc.driver.OracleDriver");&lt;br /&gt;    Connection databaseConnection = DriverManager.getConnection(url, username,&lt;br /&gt;        password);&lt;br /&gt;    return databaseConnection;&lt;br /&gt;  }&lt;br /&gt;  private static Connection connectToDB2() throws Exception {&lt;br /&gt;    Class.forName("com.ibm.db2.jcc.DB2Driver");&lt;br /&gt;    Connection databaseConnection = DriverManager.getConnection(&lt;br /&gt;        "jdbc:db2:mydbname", "db2user", "db2password");&lt;br /&gt;    return databaseConnection;&lt;br /&gt;  }&lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951603711668509916-1516568358522303666?l=ramprasad-techbook.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ramprasad-techbook.blogspot.com/feeds/1516568358522303666/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951603711668509916&amp;postID=1516568358522303666' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/1516568358522303666'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/1516568358522303666'/><link rel='alternate' type='text/html' href='http://ramprasad-techbook.blogspot.com/2010/05/connecting-to-db.html' title='Connecting to db'/><author><name>Ramprasad</name><uri>http://www.blogger.com/profile/16032736524787849385</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951603711668509916.post-7064935621392230088</id><published>2010-05-06T15:14:00.001+05:30</published><updated>2010-05-06T15:14:40.744+05:30</updated><title type='text'>Java mail</title><content type='html'>javax.mail package has the APIs to deal with mailing in java.&lt;br /&gt;Here is a very simple example to send email in java.(obtained from example in sun's documentation)&lt;br /&gt;&lt;br /&gt;public class EmailTest{&lt;br /&gt;public static void main(String args[]){&lt;br /&gt;Properties props = new Properties();&lt;br /&gt;props.put("mail.smtp.host", "smtp.mycompany.com");&lt;br /&gt;props.put("mail.from", "myemail@mycompany.com");&lt;br /&gt;Session session = Session.getInstance(props, null);&lt;br /&gt;&lt;br /&gt;try {&lt;br /&gt;MimeMessage msg = new MimeMessage(session);&lt;br /&gt;msg.setFrom();&lt;br /&gt;msg.setRecipients(Message.RecipientType.TO,&lt;br /&gt;"youremail@yourcompany.com");&lt;br /&gt;msg.setSubject("Just learning how to send email!!");&lt;br /&gt;msg.setSentDate(new Date());&lt;br /&gt;msg.setText("How are you Sir ?");&lt;br /&gt;Transport.send(msg);&lt;br /&gt;} catch (MessagingException mex) {&lt;br /&gt;System.out.println("Email could not be sent: " + mex);&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;If you have provided proper smtp server name, above code works fine.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951603711668509916-7064935621392230088?l=ramprasad-techbook.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ramprasad-techbook.blogspot.com/feeds/7064935621392230088/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951603711668509916&amp;postID=7064935621392230088' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/7064935621392230088'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/7064935621392230088'/><link rel='alternate' type='text/html' href='http://ramprasad-techbook.blogspot.com/2010/05/java-mail.html' title='Java mail'/><author><name>Ramprasad</name><uri>http://www.blogger.com/profile/16032736524787849385</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951603711668509916.post-1311140550136985598</id><published>2010-05-05T11:56:00.002+05:30</published><updated>2010-05-05T11:57:47.880+05:30</updated><title type='text'>JAAS</title><content type='html'>&lt;p&gt;Java Authentication and Authorization Service's main goal is to separate the concerns of user authentication so that they may be managed independently.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;It is a Java security framework for user-centric security to augment the Java code-based security. Since Java Runtime Environment 1.4 JAAS has been integrated with the JRE - previously JAAS was supplied as an extension library by Sun.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;JAAS can be used for two purposes:&lt;br /&gt;1) for authentication of users, to reliably and securely determine who is currently executing Java code, regardless of whether the code is running as an application, an applet, a bean, or a servlet; and&lt;br /&gt;2) for authorization of users to ensure they have the access control rights (permissions) required to do the actions performed. &lt;/p&gt;&lt;p&gt;&lt;br /&gt;JAAS implements a Java version of the standard Pluggable Authentication Module (PAM) framework &lt;/p&gt;&lt;p&gt;&lt;br /&gt;Some important interfaces and classes include Principal,Key,PublicKey,PrivateKey, Permission, Certificate,Security,Signature,Signer,Provider etc. &lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;a href="http://java.sun.com/j2se/1.4.2/docs/api/java/security/package-summary.html"&gt;http://java.sun.com/j2se/1.4.2/docs/api/java/security/package-summary.html&lt;/a&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951603711668509916-1311140550136985598?l=ramprasad-techbook.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ramprasad-techbook.blogspot.com/feeds/1311140550136985598/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951603711668509916&amp;postID=1311140550136985598' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/1311140550136985598'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/1311140550136985598'/><link rel='alternate' type='text/html' href='http://ramprasad-techbook.blogspot.com/2010/05/jaas.html' title='JAAS'/><author><name>Ramprasad</name><uri>http://www.blogger.com/profile/16032736524787849385</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951603711668509916.post-1041724470750061345</id><published>2010-05-01T13:38:00.002+05:30</published><updated>2010-05-01T13:47:01.649+05:30</updated><title type='text'>Reflection in java</title><content type='html'>Here is a code snippet that demonstrates reflection in java.&lt;br /&gt;&lt;br /&gt;This takes the each class file in the directory ReflectionDemo,  checks if there are any public static methods that start with prefix "do" and whether such method is public static and requires no argument. The following code extracts that information and prints the same. It also invokes and executes that method.&lt;br /&gt;&lt;br /&gt;ReflectionDemo.java&lt;br /&gt;------------------------------------&lt;br /&gt;import java.io.File;&lt;br /&gt;import java.lang.reflect.Method;&lt;br /&gt;import java.lang.reflect.Modifier;&lt;br /&gt;public class ReflectionDemo&lt;br /&gt;{ &lt;br /&gt;public static void main(String args[])&lt;br /&gt;{   &lt;br /&gt;File pathName = new File("C:\\Documents and Settings\\Ramprasad\\workspace\\Test\\ReflectionDemo");&lt;br /&gt;&lt;br /&gt;  File[] allFiles = null;;   &lt;br /&gt;if(pathName.isDirectory())&lt;br /&gt;{  &lt;br /&gt;allFiles = pathName.listFiles(); &lt;br /&gt;} &lt;br /&gt;  try{&lt;br /&gt;    for(int i=0; i&lt; allFiles.length ; i++)&lt;br /&gt;{  &lt;br /&gt;String classFile = allFiles[i].getName();    &lt;br /&gt; int suffix = classFile.indexOf(".class");      &lt;br /&gt; if(suffix != -1 &amp;amp;&amp;amp; suffix &gt; 0)&lt;br /&gt;{   &lt;br /&gt;String fileName = classFile.substring(0,suffix);       &lt;br /&gt;System.out.println("=========The file being parsed is ========"+fileName);    &lt;br /&gt;   Class classTobeParsed = Class.forName(fileName);  &lt;br /&gt; parseClass(classTobeParsed);  &lt;br /&gt;}       &lt;br /&gt;} &lt;br /&gt;}&lt;br /&gt;catch(Exception e)&lt;br /&gt;{  &lt;br /&gt;e.printStackTrace(); &lt;br /&gt;}  &lt;br /&gt;}&lt;br /&gt; &lt;br /&gt;// Lets assume that the class has a method which starts with prefix "do" and such method is public static and requires no argument.&lt;br /&gt;&lt;br /&gt; private static void parseClass(Class classTobeParsed)&lt;br /&gt;{  &lt;br /&gt;Method[] allMethods = classTobeParsed.getMethods();   &lt;br /&gt;try{ &lt;br /&gt;for(int i=0 ;i &lt; allMethods.length ; i++)&lt;br /&gt;{  &lt;br /&gt;String methodName = allMethods[i].getName(); &lt;br /&gt; int modifiers = allMethods[i].getModifiers();  &lt;br /&gt; boolean isMethodWithNoArgumentAndNoReturnType = false;  &lt;br /&gt;boolean isStatciPublicMethod = false;     &lt;br /&gt;Class returnType = allMethods[i].getReturnType(); &lt;br /&gt; Class[] getParameterTypes = allMethods[i].getParameterTypes();    &lt;br /&gt; if("void".equalsIgnoreCase(returnType.getName()) &amp;amp;&amp;amp; 0 == getParameterTypes.length){   &lt;br /&gt;isMethodWithNoArgumentAndNoReturnType = true;  &lt;br /&gt;}    &lt;br /&gt; if(Modifier.isStatic(modifiers) &amp;amp;&amp;amp; Modifier.isPublic(modifiers))&lt;br /&gt;{   &lt;br /&gt;isStatciPublicMethod = true;  &lt;br /&gt;}    &lt;br /&gt; if(methodName.indexOf("do") != -1)&lt;br /&gt;{   &lt;br /&gt;// if the method is static and public it can be invoked.    if&lt;br /&gt;&lt;br /&gt;(isMethodWithNoArgumentAndNoReturnType &amp;amp;&amp;amp; isStatciPublicMethod)&lt;br /&gt;{    &lt;br /&gt;System.out.println("There is a public static 'do' method --" + methodName + "-- found in the file --- " + classTobeParsed.getName()+ " and I am going to execute that");    &lt;br /&gt;&lt;br /&gt;allMethods[i].invoke(null, null);   &lt;br /&gt;}       &lt;br /&gt;}     &lt;br /&gt;&lt;br /&gt;else{ &lt;br /&gt;// do nothing   , following message can be printed if needed. But since there are lot of other methods such as wait,notify,notifyAll, equals etc obtained from Object class, the following line is commented out.&lt;br /&gt;//System.out.println("Current method is ===" + methodName+" but no 'do' method was found in this class --" +classTobeParsed); &lt;br /&gt; }    &lt;br /&gt;}&lt;br /&gt; }&lt;br /&gt;catch(Exception e)&lt;br /&gt;{ &lt;br /&gt; e.printStackTrace();&lt;br /&gt; }    &lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;The following file exists in the path mentioned above.&lt;br /&gt;&lt;br /&gt;Hello.java&lt;br /&gt;----------------------------&lt;br /&gt;public class Hello&lt;br /&gt;{&lt;br /&gt; public static void main(String args[])&lt;br /&gt;{&lt;br /&gt;}   &lt;br /&gt;public static void doTesting()&lt;br /&gt;{  &lt;br /&gt;System.out.println("===========Finally executed this do method====="); &lt;br /&gt;}   &lt;br /&gt;public void doSomething()&lt;br /&gt;{  &lt;br /&gt;System.out.println("===========Doing something not static ===="); &lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;Output:&lt;br /&gt;------------------&lt;br /&gt;&lt;br /&gt;=========The file being parsed is ========Hello&lt;br /&gt;There is a public static 'do' method --doTesting-- found in the file --- Hello and I am going to execute that&lt;br /&gt;===========Finally executed this do method=====&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951603711668509916-1041724470750061345?l=ramprasad-techbook.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ramprasad-techbook.blogspot.com/feeds/1041724470750061345/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951603711668509916&amp;postID=1041724470750061345' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/1041724470750061345'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/1041724470750061345'/><link rel='alternate' type='text/html' href='http://ramprasad-techbook.blogspot.com/2010/05/reflection-in-java.html' title='Reflection in java'/><author><name>Ramprasad</name><uri>http://www.blogger.com/profile/16032736524787849385</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951603711668509916.post-3522082076230429248</id><published>2010-04-21T17:39:00.001+05:30</published><updated>2010-04-21T17:39:48.359+05:30</updated><title type='text'>Source controlling the project artifacts</title><content type='html'>Usually all the java files, configuration files, web components, static files and build scripts are source controlled.&lt;br /&gt;It is obvious that jar files should not be source controlled in a project unless it is related to a third party tool. If the jar file contains files related to the project, it should be built throught the build using the class files generated. The source file from which the class files and jar are generated should be source controlled. And of course, the build script too should be source controlled.&lt;br /&gt;The dependency on the third party tools should be externalized. Meaning, the versions should be contained in a separate file (xml or properties or something) and also all the third party related files should be kept under a separate folder say external/lib or something. If the jars are developed internally, are are not something that need to be built each time, it can be put in a folder say internal/lib. This structure helps in reducing the confusion.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951603711668509916-3522082076230429248?l=ramprasad-techbook.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ramprasad-techbook.blogspot.com/feeds/3522082076230429248/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951603711668509916&amp;postID=3522082076230429248' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/3522082076230429248'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/3522082076230429248'/><link rel='alternate' type='text/html' href='http://ramprasad-techbook.blogspot.com/2010/04/source-controlling-project-artifacts.html' title='Source controlling the project artifacts'/><author><name>Ramprasad</name><uri>http://www.blogger.com/profile/16032736524787849385</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951603711668509916.post-6778403680479516993</id><published>2010-03-29T12:03:00.000+05:30</published><updated>2010-03-29T12:05:43.981+05:30</updated><title type='text'>SQLite</title><content type='html'>SQLite is a light weight database extremely useful for small database execution especially for testing sqlqueries before migrating them to a production database.&lt;br /&gt;There is just an .exe file(for windows) and it plays the entire role. For eachnew database a new file is created and information is maintained there.&lt;br /&gt;It is very easy to use and the documentation is very good.&lt;br /&gt;&lt;a href="http://www.sqlite.org/"&gt;http://www.sqlite.org/&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951603711668509916-6778403680479516993?l=ramprasad-techbook.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ramprasad-techbook.blogspot.com/feeds/6778403680479516993/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951603711668509916&amp;postID=6778403680479516993' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/6778403680479516993'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/6778403680479516993'/><link rel='alternate' type='text/html' href='http://ramprasad-techbook.blogspot.com/2010/03/sqlite.html' title='SQLite'/><author><name>Ramprasad</name><uri>http://www.blogger.com/profile/16032736524787849385</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951603711668509916.post-1550181783545361837</id><published>2010-03-24T18:52:00.001+05:30</published><updated>2010-03-24T18:52:17.850+05:30</updated><title type='text'>AnthillPro</title><content type='html'>AnthillPro supports automated deployment of a build to a user-configured environment (for example: DEV, QA, STAGE, PROD). Administrators can set up gates between each environment, requiring manual user intervention and providing an audit trail.&lt;br /&gt;The practice of continuous integration is one where developers integrate their changes to a common code line frequently (generally at least once a day) and those integrations are rapidly verified by tests. AnthillPro supports this practice by monitoring (or listening to) the organizations various source control systems and triggering a build when it detects a developer commit. It supports distributed as well as cross-platform builds in .Net, Java, C/C++ and other languages.&lt;br /&gt;&lt;br /&gt;It is proprietary software - &lt;a href="http://www.anthillpro.com/"&gt;www.anthillpro.com&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951603711668509916-1550181783545361837?l=ramprasad-techbook.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ramprasad-techbook.blogspot.com/feeds/1550181783545361837/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951603711668509916&amp;postID=1550181783545361837' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/1550181783545361837'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/1550181783545361837'/><link rel='alternate' type='text/html' href='http://ramprasad-techbook.blogspot.com/2010/03/anthillpro.html' title='AnthillPro'/><author><name>Ramprasad</name><uri>http://www.blogger.com/profile/16032736524787849385</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951603711668509916.post-8468670473313835320</id><published>2010-02-26T12:31:00.001+05:30</published><updated>2010-02-26T12:31:50.696+05:30</updated><title type='text'>Java as a procedural language</title><content type='html'>Just like C can simulate OOPs by using the concept of 'struct', can java too have only static methods and private constructors in all classes, pass only primitives and thereby make itself essentially procedural ?&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951603711668509916-8468670473313835320?l=ramprasad-techbook.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ramprasad-techbook.blogspot.com/feeds/8468670473313835320/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951603711668509916&amp;postID=8468670473313835320' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/8468670473313835320'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/8468670473313835320'/><link rel='alternate' type='text/html' href='http://ramprasad-techbook.blogspot.com/2010/02/java-as-procedural-language.html' title='Java as a procedural language'/><author><name>Ramprasad</name><uri>http://www.blogger.com/profile/16032736524787849385</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951603711668509916.post-1643424051252367271</id><published>2010-01-25T14:18:00.000+05:30</published><updated>2010-01-25T14:19:13.622+05:30</updated><title type='text'>Observer pattern</title><content type='html'>Here is a simple code snippet that demonstrates the Observer pattern.&lt;br /&gt;&lt;br /&gt;file 1&lt;br /&gt;================&lt;br /&gt;&lt;br /&gt;public class ObserverPatternTest {       &lt;br /&gt;            public static void main(String args[]){               &lt;br /&gt;                        ObserveableTest obTest = new ObserveableTest(6);&lt;br /&gt;                        ObserverTest observerTest = new ObserverTest(obTest);&lt;br /&gt;                        System.out.println("Before setting the value to new value");;&lt;br /&gt;                        obTest.setTestInteger(5);&lt;br /&gt;                        System.out.println("After setting the value to new value");;&lt;br /&gt;                       &lt;br /&gt;            }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;file 2&lt;br /&gt;==============&lt;br /&gt; import java.util.Observable;&lt;br /&gt;public class ObserveableTest extends Observable{&lt;br /&gt;           &lt;br /&gt;            private int testInteger;&lt;br /&gt;            public ObserveableTest(int value){&lt;br /&gt;                        this.testInteger = value;&lt;br /&gt;            }&lt;br /&gt;           &lt;br /&gt;            public int getTestInteger() {&lt;br /&gt;                        return testInteger;&lt;br /&gt;            }&lt;br /&gt;&lt;br /&gt;            public void setTestInteger(int testInteger) {&lt;br /&gt;                        this.testInteger = testInteger;&lt;br /&gt;                        setChanged();&lt;br /&gt;                        notifyObservers();&lt;br /&gt;            }         &lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;file 3&lt;br /&gt;================&lt;br /&gt;import java.util.Observable;&lt;br /&gt;import java.util.Observer;&lt;br /&gt;&lt;br /&gt;public class ObserverTest implements Observer{         &lt;br /&gt;            Observable observableTester;  &lt;br /&gt;            public ObserverTest(Observable o){&lt;br /&gt;                        this.observableTester = o;&lt;br /&gt;                        o.addObserver(this);&lt;br /&gt;            }&lt;br /&gt;&lt;br /&gt;            public void update(Observable o, Object arg) {                       &lt;br /&gt;            System.out.println("The update method called");&lt;br /&gt;                       &lt;br /&gt;            }&lt;br /&gt;           &lt;br /&gt;}&lt;br /&gt;output after running file 1&lt;br /&gt;============================&lt;br /&gt;Before setting the value to new value&lt;br /&gt;The update method called&lt;br /&gt;After setting the value to new value&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951603711668509916-1643424051252367271?l=ramprasad-techbook.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ramprasad-techbook.blogspot.com/feeds/1643424051252367271/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951603711668509916&amp;postID=1643424051252367271' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/1643424051252367271'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/1643424051252367271'/><link rel='alternate' type='text/html' href='http://ramprasad-techbook.blogspot.com/2010/01/observer-pattern.html' title='Observer pattern'/><author><name>Ramprasad</name><uri>http://www.blogger.com/profile/16032736524787849385</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951603711668509916.post-2341416872326139181</id><published>2010-01-25T14:15:00.001+05:30</published><updated>2010-01-25T14:17:35.757+05:30</updated><title type='text'>RMI</title><content type='html'>&lt;p&gt;One classic example for RMI is a project in software services industry.&lt;br /&gt;The analogy can be drawn as follows:&lt;br /&gt;Customer - Client&lt;br /&gt;Onsite Project Manager - Client Helper (stub)&lt;br /&gt;Offshore Project manager - Service Helper (Skeleton)&lt;br /&gt;Offshore Developer - Service&lt;/p&gt;&lt;p&gt;&lt;br /&gt;Anyway here are steps to learn RMI&lt;br /&gt;1) Write your remote interface&lt;br /&gt;2) Write your remote implementation (service)&lt;br /&gt;3) Generate stub and skeleton&lt;br /&gt;&lt;br /&gt;To generate stub and skeleton invoke the rmic.exe file that comes with jdk&lt;br /&gt;and exists in the bin folder.&lt;br /&gt;You can invoke this exe just by typing its path and supplying the name of&lt;br /&gt;the class for which stub and skeleton are to be created&lt;br /&gt;&lt;br /&gt;e.g if MyRemoteImpl exists in the C:\Documents and&lt;br /&gt;Settings\workspace\Test folder and jdk is in the D: drive then,&lt;br /&gt;&lt;br /&gt;C:\Documents and Settings\workspace\Test&gt;D:\j2sdk1.4.1_06\bin\rmic&lt;br /&gt;MyRemoteImpl&lt;br /&gt;4) Run the rmiregistry&lt;br /&gt;&lt;br /&gt;Rmi registry exists again as an exe&lt;br /&gt;Invoke this exe from the path where your class exists, otherwise it will&lt;br /&gt;throw ClassNotFound exception for the Stub and Skeleton when you try to&lt;br /&gt;run the implementation class&lt;br /&gt;&lt;br /&gt;e.g In the above case, it should be&lt;br /&gt;C:\Documents and&lt;br /&gt;Settings\workspace\Test&gt;D:\j2sdk1.4.1_06\bin\rmiregistry.exe&lt;br /&gt;5)Now run the implementation class i.e the service&lt;br /&gt;6) Write a client code and run the same : it can access the service and&lt;br /&gt;display the contents present there.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Below code snipped gives the example&lt;br /&gt;&lt;br /&gt;Remote interface&lt;br /&gt;================&lt;br /&gt;&lt;br /&gt;import java.rmi.Remote;&lt;br /&gt;import java.rmi.RemoteException;&lt;br /&gt;&lt;br /&gt;public interface MyRemote extends Remote {&lt;br /&gt;public String sayHello() throws RemoteException;&lt;br /&gt;}&lt;/p&gt;&lt;p&gt;&lt;br /&gt;Remote implementation&lt;br /&gt;=====================&lt;br /&gt;&lt;br /&gt;import java.rmi.Naming;&lt;br /&gt;import java.rmi.RemoteException;&lt;br /&gt;import java.rmi.server.UnicastRemoteObject;&lt;br /&gt;&lt;br /&gt;public class MyRemoteImpl extends UnicastRemoteObject implements MyRemote{&lt;br /&gt;&lt;br /&gt;protected MyRemoteImpl() throws RemoteException {&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;public static void main(String[] args){&lt;br /&gt;try{&lt;br /&gt;MyRemote service = new MyRemoteImpl();&lt;br /&gt;Naming.rebind("RemoteHello",service);&lt;br /&gt;}catch (Exception e) {&lt;br /&gt;e.printStackTrace();&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public String sayHello() throws RemoteException {&lt;br /&gt;return "Server says, I am fine";&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;Remote client&lt;br /&gt;===================&lt;br /&gt;import java.rmi.Naming;&lt;br /&gt;public class MyRemoteClient {&lt;br /&gt;&lt;br /&gt;public static void main(String[] args){&lt;br /&gt;new MyRemoteClient().doIt();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public void doIt(){&lt;br /&gt;try{&lt;br /&gt;MyRemote service =&lt;br /&gt;(MyRemote)Naming.lookup("rmi://localhost/RemoteHello");&lt;br /&gt;String s = service.sayHello();&lt;br /&gt;System.out.println(s);&lt;br /&gt;&lt;br /&gt;}catch (Exception e) {&lt;br /&gt;e.printStackTrace();&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;1)From the path where the class file exists run the command "rmic&lt;br /&gt;MyRemoteImpl"&lt;br /&gt;2)From the path where the class file exists run the command "rmirgistry"&lt;br /&gt;3)From the path where the class file exists run the command "java&lt;br /&gt;MyRemoteImpl"&lt;br /&gt;4)From the path where the class file exists run the command "java&lt;br /&gt;MyRemoteClient"&lt;br /&gt;&lt;br /&gt;output&lt;br /&gt;==========&lt;br /&gt;Server says, I am fine&lt;br /&gt;&lt;br /&gt;*localhost in the above case can be replaced by the ip address of the&lt;br /&gt;machine when running on multiple machines&lt;br /&gt;* If there is a change done in the service, all the steps 1 to 4 should be&lt;br /&gt;executed again to get it reflected&lt;br /&gt;*The stub class must exist on the client side and client invokes the&lt;br /&gt;method on the stub as if it is a real service&lt;br /&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951603711668509916-2341416872326139181?l=ramprasad-techbook.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ramprasad-techbook.blogspot.com/feeds/2341416872326139181/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951603711668509916&amp;postID=2341416872326139181' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/2341416872326139181'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/2341416872326139181'/><link rel='alternate' type='text/html' href='http://ramprasad-techbook.blogspot.com/2010/01/rmi.html' title='RMI'/><author><name>Ramprasad</name><uri>http://www.blogger.com/profile/16032736524787849385</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951603711668509916.post-7398831770919167154</id><published>2009-12-28T20:33:00.001+05:30</published><updated>2009-12-28T20:36:40.070+05:30</updated><title type='text'>Singleton</title><content type='html'>Only one instance of that class can exist.&lt;br /&gt;&lt;br /&gt;Apporach 1 :&lt;br /&gt;Declare the class as final and have only static methods in that.E.g Math in java library.&lt;br /&gt;&lt;br /&gt;Approach2:&lt;br /&gt;Private constructor and a static method and a static flag. Check the flag each time and if not set call the private constructor.&lt;br /&gt;&lt;br /&gt;Approach 3:&lt;br /&gt;Have a static flag and check this each time in the constructor and if it is set (this will be set when the object is created for the first time), throw an exception in the constructor.&lt;br /&gt;&lt;br /&gt;Approach 4:&lt;br /&gt;Have a private static instance inside the object itself. Have a static method that checks if this instance variable is pointing to null and if yes call the private constructor.&lt;br /&gt;(Normally the static methods that instantiate the singleton object are marked synchronized - yes, static methods can be synchronized)&lt;br /&gt;&lt;br /&gt;But there is a clone method unwantedly inherited from the java.lang.Object class which can be used to clone even a singleton object !!!!&lt;br /&gt;&lt;br /&gt;By default, the clone() method is marked as protected, but if your SingletonObject extends another class that does support cloning, it is possible to violate the design principles of the singleton.  So, to be absolutely positively 100% certain that a singleton really is a singleton, we must add a clone() method of our own, and throw a CloneNotSupportedException&lt;br /&gt;&lt;br /&gt;It can be difficult to subclass a Singleton, since this can only work if the&lt;br /&gt;base Singleton class has not yet been instantiated(yes you can call a non static constructor - as if there can be static constructors !! - from a static method).&lt;br /&gt;&lt;br /&gt;You can easily change a Singleton to allow a small number of instances where this is allowable and meaningful.&lt;br /&gt;&lt;br /&gt;Essentially, there are 3 steps to be followed&lt;br /&gt;1)Block access to all constructors&lt;br /&gt;2)Provide a static method to get an instance&lt;br /&gt;3)Prevent cloning&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951603711668509916-7398831770919167154?l=ramprasad-techbook.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ramprasad-techbook.blogspot.com/feeds/7398831770919167154/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951603711668509916&amp;postID=7398831770919167154' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/7398831770919167154'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/7398831770919167154'/><link rel='alternate' type='text/html' href='http://ramprasad-techbook.blogspot.com/2009/12/singleton.html' title='Singleton'/><author><name>Ramprasad</name><uri>http://www.blogger.com/profile/16032736524787849385</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951603711668509916.post-7992473100123808164</id><published>2009-12-16T15:06:00.002+05:30</published><updated>2009-12-16T15:10:29.746+05:30</updated><title type='text'>Manifest.mf file</title><content type='html'>· It is a special file that can contain information about the files packaged in a JAR file&lt;br /&gt;· When you create a JAR file, it automatically receives a default manifest file.&lt;br /&gt;· There can be only one manifest file in an archive, and it always has the pathname META-INF/MANIFEST.MF.&lt;br /&gt;· The "meta" information that the manifest can be changed so that JAR file can be used for a variety of purposes.&lt;br /&gt;· Not all files in the JAR file need to be listed in the manifest as entries, but all files which are to be signed must be listed.&lt;br /&gt;· The manifest file itself must not be listed.&lt;br /&gt;· If a JAR file is intended to be used as an executable file, the manifest file specifies the main class of the application.&lt;br /&gt;· The manifest can also contain information about the other files that are packaged in the archive.&lt;br /&gt;· Uses standard syntax for unicode characters.&lt;br /&gt;· Uses standard line length: 72 characters Uses standard encoding: UTF-8&lt;br /&gt;· Uses standard rules for wrapping long lines.&lt;br /&gt;· If the UTF-8 encoded line would exceed 72 characters, the line must be broken at the 72 character mark.&lt;br /&gt;· The remainder of the value should continue on the following line, with a preceding space to indicate that this is a continuation.&lt;br /&gt;· Entries may not be duplicated, except for Class-Path: entries.&lt;br /&gt;· Very lightweight to parse: no need for an XML parser or similar.&lt;br /&gt;· This makes it easier to embed Java into very small devices.&lt;br /&gt;· But there is no utility API to read and write the manifest in the standard Java API, other than the Java Package class&lt;br /&gt;&lt;br /&gt;There can be 2 types of attributes&lt;br /&gt;&lt;br /&gt;1) Main Attributes&lt;br /&gt;Main attributes are the attributes that are present in the main section of the manifest.E.g Manifest-Version,Created-By,Main-Class etc&lt;br /&gt;&lt;br /&gt;2) Per-Entry Attributes&lt;br /&gt;Per-entry attributes apply only to the individual JAR file entry to which the manifest entry is associated with. If the same attribute also appeared in the main section, then the value of the per-entry attribute overwrites the main attribute's value&lt;br /&gt;&lt;br /&gt;&lt;a href="http://java.sun.com/j2se/1.3/docs/guide/jar/jar.html"&gt;http://java.sun.com/j2se/1.3/docs/guide/jar/jar.html&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951603711668509916-7992473100123808164?l=ramprasad-techbook.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ramprasad-techbook.blogspot.com/feeds/7992473100123808164/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951603711668509916&amp;postID=7992473100123808164' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/7992473100123808164'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/7992473100123808164'/><link rel='alternate' type='text/html' href='http://ramprasad-techbook.blogspot.com/2009/12/manifestmf-file.html' title='Manifest.mf file'/><author><name>Ramprasad</name><uri>http://www.blogger.com/profile/16032736524787849385</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951603711668509916.post-4454148430087100202</id><published>2009-12-15T12:09:00.000+05:30</published><updated>2009-12-15T12:10:14.456+05:30</updated><title type='text'>Fujaba</title><content type='html'>This is a very nice tool for reverse engineering. We might come up with situations where we need to get the modeldiagrams from the available java files. This is a tool meant for that. Easy to use and quite useful to an extent. Download the jar and install using jar command.&lt;br /&gt;&lt;a href="http://www.fujaba.de/"&gt;http://www.fujaba.de/&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951603711668509916-4454148430087100202?l=ramprasad-techbook.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ramprasad-techbook.blogspot.com/feeds/4454148430087100202/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951603711668509916&amp;postID=4454148430087100202' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/4454148430087100202'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/4454148430087100202'/><link rel='alternate' type='text/html' href='http://ramprasad-techbook.blogspot.com/2009/12/fujaba.html' title='Fujaba'/><author><name>Ramprasad</name><uri>http://www.blogger.com/profile/16032736524787849385</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951603711668509916.post-7249064510701030360</id><published>2009-12-07T19:34:00.000+05:30</published><updated>2009-12-07T19:35:36.644+05:30</updated><title type='text'>Clearcase</title><content type='html'>&lt;a name="_MailAutoSig"&gt; &lt;/a&gt;Rational Clearcase is an SCM tool used revision control which supports 2 kinds of models &lt;br /&gt;UCM(out of the box - OOTB) and Base clear case (Customizeable)&lt;br /&gt;UCM is built on top of base clear case.&lt;br /&gt;Can run on a variety of platforms - UNIX,Solaris,z/OS, HP-UX, Windows etc.&lt;br /&gt;Objects under version control in ClearCase are stored in repositories called VOBs (Versioned Object Base).&lt;br /&gt;There are 2 directories used by Clear case&lt;br /&gt;1.CC-project(or something similar) - doesn't need to be shared. This contains the project specific VOB,view.dat file and .updt files&lt;br /&gt;2.views - this directory is  shared out and full access granted to everyone including you. Here .vws folders reside.&lt;br /&gt;&lt;br /&gt;View is a work area for one (or more) users.Stream determines which versions of elements appear in any view configured&lt;br /&gt;by that stream.Development stream is a working area to make changes in isolation from other development streams and Integration area is to combine changes from different development streams.An element is a file or directory under version control. It will have a tree of versions.If changes are done and discarded a .keep file will be generated for each such file.The act of updating one branch with the changes made in another branch is called merging. If the merging required between the branches is large, then it will ask for manual decision asking which version to select.&lt;br /&gt;Otherwise, most of the times, merging will be done automatically when there are trivial differences.Once a stable configuration is built on the repository a baseline is created. Baseline could be just a baseline or could be a recommended one.If we want to make changes to a file without checking out the file, we can "hijack" the file and work on that.We can "join a project" on clear case and then each time a new baseline is created, we can rebase to get the latest code. Each submission of files(modifying an existing file by checking out and then checking in or adding a new file to the source control) requires an associated "activity" on clear quest. Even for a rebase operation an activity will be created.At any point in time, we can go an check the version history of an element on clear case which appears in the form of a tree.&lt;br /&gt;&lt;br /&gt;&lt;a href="https://publib.boulder.ibm.com/infocenter/cchelp/v7r1m0/index.jsp?topic=/com.ibm.rational.clearcase.help.ic.doc/helpindex_clearcase.htm"&gt;https://publib.boulder.ibm.com/infocenter/cchelp/v7r1m0/index.jsp?topic=/com.ibm.rational.clearcase.help.ic.doc/helpindex_clearcase.htm&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.highley-recommended.com/sw_process/faq.html"&gt;http://www.highley-recommended.com/sw_process/faq.html&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951603711668509916-7249064510701030360?l=ramprasad-techbook.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ramprasad-techbook.blogspot.com/feeds/7249064510701030360/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951603711668509916&amp;postID=7249064510701030360' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/7249064510701030360'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/7249064510701030360'/><link rel='alternate' type='text/html' href='http://ramprasad-techbook.blogspot.com/2009/12/clearcase.html' title='Clearcase'/><author><name>Ramprasad</name><uri>http://www.blogger.com/profile/16032736524787849385</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951603711668509916.post-1982807548588131840</id><published>2009-10-30T15:39:00.004+05:30</published><updated>2009-10-30T15:43:54.759+05:30</updated><title type='text'>Web browser architecture</title><content type='html'>&lt;a href="http://4.bp.blogspot.com/_kO6KttbWHQg/Suq7jL0zauI/AAAAAAAAABs/u5sxU8_j0G4/s1600-h/WebBrowser_BuildingJavaEnterpriseSystemsWithJ2EE.JPG"&gt;&lt;img id="BLOGGER_PHOTO_ID_5398333316501039842" style="FLOAT: left; MARGIN: 0px 10px 10px 0px; WIDTH: 557px; CURSOR: hand; HEIGHT: 205px" alt="" src="http://4.bp.blogspot.com/_kO6KttbWHQg/Suq7jL0zauI/AAAAAAAAABs/u5sxU8_j0G4/s320/WebBrowser_BuildingJavaEnterpriseSystemsWithJ2EE.JPG" border="0" /&gt;&lt;/a&gt;&lt;br /&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;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;(click on the image to enlarge)&lt;/div&gt;&lt;div&gt;(From book 'Building Java Enterprise systems using J2EE' by SAMS - techMedia By Venkata S.R and Paul J Perrone)&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951603711668509916-1982807548588131840?l=ramprasad-techbook.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ramprasad-techbook.blogspot.com/feeds/1982807548588131840/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951603711668509916&amp;postID=1982807548588131840' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/1982807548588131840'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/1982807548588131840'/><link rel='alternate' type='text/html' href='http://ramprasad-techbook.blogspot.com/2009/10/web-browser.html' title='Web browser architecture'/><author><name>Ramprasad</name><uri>http://www.blogger.com/profile/16032736524787849385</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_kO6KttbWHQg/Suq7jL0zauI/AAAAAAAAABs/u5sxU8_j0G4/s72-c/WebBrowser_BuildingJavaEnterpriseSystemsWithJ2EE.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951603711668509916.post-4372437747297538114</id><published>2009-10-26T15:25:00.000+05:30</published><updated>2009-10-26T15:26:38.345+05:30</updated><title type='text'>Javascript debugger</title><content type='html'>Venkman is a good debugger that can be used with firefox.&lt;br /&gt;Very useful in debugging javascript.&lt;br /&gt;&lt;a href="https://addons.mozilla.org/en-US/firefox/addon/216"&gt;https://addons.mozilla.org/en-US/firefox/addon/216&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951603711668509916-4372437747297538114?l=ramprasad-techbook.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ramprasad-techbook.blogspot.com/feeds/4372437747297538114/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951603711668509916&amp;postID=4372437747297538114' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/4372437747297538114'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/4372437747297538114'/><link rel='alternate' type='text/html' href='http://ramprasad-techbook.blogspot.com/2009/10/javascript-debugger.html' title='Javascript debugger'/><author><name>Ramprasad</name><uri>http://www.blogger.com/profile/16032736524787849385</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951603711668509916.post-4353525467624014849</id><published>2009-09-24T11:52:00.000+05:30</published><updated>2009-09-24T11:53:35.493+05:30</updated><title type='text'>Code policing.</title><content type='html'>&lt;p&gt;Code Policing is the task of checking if all the software artifacts adhere to the standards followed in the project/organization. It includes adhering to the best practices, following the coding standards and refraining from the bad coding and logic.&lt;br /&gt;The result of Policing is usually some kind of report (word doc, html etc)which shows warnings as well as errors.(which one should be an error and which one should be a warningis configurable ideally)&lt;/p&gt;&lt;p&gt;&lt;br /&gt;Some of the most common things done by code policing tools include :&lt;br /&gt;1)Checking if strings are hard coded in the code.&lt;/p&gt;&lt;p&gt;2)Checking if if-else and for loops are nested too much.&lt;/p&gt;&lt;p&gt;3)Checking if classes/methods are too long (depends on the standards)&lt;/p&gt;&lt;p&gt;4)Checking if variables/methods/classes/files are named according to the standards.&lt;/p&gt;&lt;p&gt;5)Spell checks for comments and code documentations.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;Normally, policing tools come with some configuration where it is possible to exclude a list of files that should be excluded. This helps in allowing some exceptions as well.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951603711668509916-4353525467624014849?l=ramprasad-techbook.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ramprasad-techbook.blogspot.com/feeds/4353525467624014849/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951603711668509916&amp;postID=4353525467624014849' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/4353525467624014849'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/4353525467624014849'/><link rel='alternate' type='text/html' href='http://ramprasad-techbook.blogspot.com/2009/09/code-policing.html' title='Code policing.'/><author><name>Ramprasad</name><uri>http://www.blogger.com/profile/16032736524787849385</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951603711668509916.post-6392666364482640473</id><published>2009-08-11T11:14:00.001+05:30</published><updated>2009-08-11T11:14:29.874+05:30</updated><title type='text'>DOM</title><content type='html'>DOM stands for Document Object Model.&lt;br /&gt;&lt;br /&gt;It exposes the xml document as a tree structure composed of nodes.&lt;br /&gt;DOM programming interface standards are defined by W3C&lt;br /&gt;&lt;br /&gt;This is an interface used to&lt;br /&gt;1. Create a new XML document&lt;br /&gt;2.Read(Parse) an existing XML document&lt;br /&gt;3. Update an XML document&lt;br /&gt;&lt;br /&gt;Following are the key objects to remember.&lt;br /&gt;&lt;br /&gt;Builder&lt;br /&gt;Document&lt;br /&gt;Element (root or child)&lt;br /&gt;Attribute&lt;br /&gt;Comment&lt;br /&gt;Outputter&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;JDOM is a java based API for DOM which comes as a part of JDK.&lt;br /&gt;It supports both DOM and SAX parsing.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.jdom.org/"&gt;http://www.jdom.org/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.jdom.org/docs/apidocs/index.html"&gt;http://www.jdom.org/docs/apidocs/index.html&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951603711668509916-6392666364482640473?l=ramprasad-techbook.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ramprasad-techbook.blogspot.com/feeds/6392666364482640473/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951603711668509916&amp;postID=6392666364482640473' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/6392666364482640473'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/6392666364482640473'/><link rel='alternate' type='text/html' href='http://ramprasad-techbook.blogspot.com/2009/08/dom.html' title='DOM'/><author><name>Ramprasad</name><uri>http://www.blogger.com/profile/16032736524787849385</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951603711668509916.post-5381264194969313156</id><published>2009-08-10T11:26:00.001+05:30</published><updated>2009-08-10T11:27:51.892+05:30</updated><title type='text'>BMC</title><content type='html'>Application Monitoring is an important aspect in software development. BMC is a IT infrastructure management tool that helps in doing so.&lt;br /&gt;&lt;br /&gt;For example it can be used to monitor huge web applications with clustered servers in a distributed environment such as&lt;br /&gt;&lt;br /&gt;1. Memory utilization - in terms of memory pages of each machine involved in the environment&lt;br /&gt;&lt;br /&gt;2.CPU utilization - percentage utilization of cpu associated to each managed server/ admin server&lt;br /&gt;&lt;br /&gt;3.Peak CPU utilization and the time when it occurred.&lt;br /&gt;&lt;br /&gt;The information can be configured to display in a variety of graphs. This would help in understanding and analysing the production runtime behaviour of the web application and can be further used for load balancing etc. Also, such information helps in understanding the peak utilization of the website (say for a website the maximum utilization is on wednesday and thursday). If one of the managed servers comes to standstill due to peak utilization of CPU, it can be predicted as a cause for the slow response of the website.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951603711668509916-5381264194969313156?l=ramprasad-techbook.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ramprasad-techbook.blogspot.com/feeds/5381264194969313156/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951603711668509916&amp;postID=5381264194969313156' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/5381264194969313156'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/5381264194969313156'/><link rel='alternate' type='text/html' href='http://ramprasad-techbook.blogspot.com/2009/08/bmc.html' title='BMC'/><author><name>Ramprasad</name><uri>http://www.blogger.com/profile/16032736524787849385</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951603711668509916.post-5964843686396916840</id><published>2009-08-07T16:38:00.000+05:30</published><updated>2009-08-07T16:39:55.389+05:30</updated><title type='text'>WATIJ</title><content type='html'>&lt;p&gt;Web Application Testing In Java(WATIJ) is a java API that helps in automating the testing of a web application.Automation is actually an application development whos purpose is to test everything that another application does.&lt;/p&gt;&lt;p&gt;WATIJ features:&lt;/p&gt;&lt;ol&gt;&lt;li&gt;It does everything that a web browser can do and verifys the results.&lt;/li&gt;&lt;li&gt;It is free and open source.&lt;/li&gt;&lt;li&gt;Contolling a Container(browser) and a Document(things loaded) is possible.&lt;/li&gt;&lt;li&gt;Only windows and IE are supported currently.&lt;/li&gt;&lt;/ol&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951603711668509916-5964843686396916840?l=ramprasad-techbook.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ramprasad-techbook.blogspot.com/feeds/5964843686396916840/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951603711668509916&amp;postID=5964843686396916840' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/5964843686396916840'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/5964843686396916840'/><link rel='alternate' type='text/html' href='http://ramprasad-techbook.blogspot.com/2009/08/watij.html' title='WATIJ'/><author><name>Ramprasad</name><uri>http://www.blogger.com/profile/16032736524787849385</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951603711668509916.post-4505575560787601272</id><published>2009-08-06T17:58:00.000+05:30</published><updated>2009-08-06T17:59:09.564+05:30</updated><title type='text'>Clover</title><content type='html'>&lt;p&gt;Writing proper unit test cases to test all the possible scenarios in a code base is an important aspect to be considered. Normally, in java applications, junits are used for unit testing. However, sometimes it may so happen each line of the code may not be tested if junits are not robust enough. For example, in case of complex if else nesting, only some if-else conditions may be covered by junits but not all possible cases.&lt;br /&gt;&lt;br /&gt;One way to make sure, that each line of code to be tested is covered through junits, is to put in debug mode and make sure that debugger passes through each line. However, it may not be practical in case of large code base.&lt;br /&gt;&lt;br /&gt;Clover is one such tool that helps in measuring the code coverage.&lt;/p&gt;&lt;p&gt;&lt;a href="http://confluence.atlassian.com/display/CLOVER/Tutorial+-+Using+Clover+with+Ant+and+JUnit"&gt;http://confluence.atlassian.com/display/CLOVER/Tutorial+-+Using+Clover+with+Ant+and+JUnit&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; It can be configured to generate reports to indicate the code covered by testcases.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951603711668509916-4505575560787601272?l=ramprasad-techbook.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ramprasad-techbook.blogspot.com/feeds/4505575560787601272/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951603711668509916&amp;postID=4505575560787601272' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/4505575560787601272'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/4505575560787601272'/><link rel='alternate' type='text/html' href='http://ramprasad-techbook.blogspot.com/2009/08/clover.html' title='Clover'/><author><name>Ramprasad</name><uri>http://www.blogger.com/profile/16032736524787849385</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951603711668509916.post-6667589533419609755</id><published>2009-07-02T18:14:00.001+05:30</published><updated>2009-07-02T18:28:14.252+05:30</updated><title type='text'>Java</title><content type='html'>&lt;p&gt;Some info useful for understanding basic java.&lt;br /&gt;&lt;br /&gt;Interface:&lt;br /&gt;===================&lt;br /&gt;Every field declared in an interface is public static and final by default always, whether all of these modifiers are mentioned or not.&lt;br /&gt;Each of such field must be initialized. Final, static and public can be put in any order before the data type of the field. There can be any amount of space in between these modifiers. Interface field members can't be protected, private, transient, and volatile.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;All the field members in an interface are always constants.&lt;br /&gt;&lt;br /&gt;Every method in an interface is public whether mentioned or not. Only other modifier applicable is abstract(though redundant). Interface methods can't be static, final, private, protected, synchronized, native, strictfp.&lt;br /&gt;&lt;br /&gt;Interfaces don't have constructors.&lt;br /&gt;&lt;br /&gt;Interface method can throw both checked and/or unchecked(though practically doesn't make sense) exceptions. But the implementation methods should bother only about the checked exceptions.&lt;br /&gt;&lt;br /&gt;Classes implementing the interface, can overload the methods in the interface. But can't have some static methods with signature same as that of the methods in the interface.&lt;br /&gt;&lt;br /&gt;Abstract classes:&lt;br /&gt;==================&lt;br /&gt;Any class can be declared abstract regardless of whether its super class is abstract or not.&lt;br /&gt;A class can't be both abstract and final.&lt;br /&gt;Abstract classes have constructors.&lt;br /&gt;Though they can never be called from outside, the constructors in an abstract class can be overloaded.&lt;br /&gt;&lt;br /&gt;An abstract class can have&lt;br /&gt;all or some static members,&lt;br /&gt;all or some private members,&lt;br /&gt;no abstract methods at all,&lt;br /&gt;and all or some final members.&lt;br /&gt;&lt;br /&gt;Fields declared in abstract classes need not be necessarily initialized unlike that for interfaces. Such fields take the default values.&lt;br /&gt;&lt;br /&gt;If there are abstract methods in an abstract class they can't be private, final, static, strictfp, synchronized or native. But abstract methods can be public or protected.&lt;br /&gt;&lt;br /&gt;It is legal to have a subclass as abstract while super class is a concrete class.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951603711668509916-6667589533419609755?l=ramprasad-techbook.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ramprasad-techbook.blogspot.com/feeds/6667589533419609755/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951603711668509916&amp;postID=6667589533419609755' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/6667589533419609755'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/6667589533419609755'/><link rel='alternate' type='text/html' href='http://ramprasad-techbook.blogspot.com/2009/07/java.html' title='Java'/><author><name>Ramprasad</name><uri>http://www.blogger.com/profile/16032736524787849385</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951603711668509916.post-3294566390153530081</id><published>2009-06-05T17:00:00.001+05:30</published><updated>2009-06-05T17:03:14.926+05:30</updated><title type='text'>Entity relationship cont...</title><content type='html'>&lt;a href="http://1.bp.blogspot.com/_kO6KttbWHQg/SikCa8ge04I/AAAAAAAAABk/1JkuKbA96YU/s1600-h/Relationship_generic.JPG"&gt;&lt;img id="BLOGGER_PHOTO_ID_5343805094794023810" style="FLOAT: left; MARGIN: 0px 10px 10px 0px; WIDTH: 320px; CURSOR: hand; HEIGHT: 198px" alt="" src="http://1.bp.blogspot.com/_kO6KttbWHQg/SikCa8ge04I/AAAAAAAAABk/1JkuKbA96YU/s320/Relationship_generic.JPG" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;div&gt;&lt;a href="http://2.bp.blogspot.com/_kO6KttbWHQg/SikCB7CztPI/AAAAAAAAABc/7p0_MRRAz4g/s1600-h/Relationship_generic.JPG"&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Here is an example where a same table is linked to 3 tables.&lt;br /&gt;It may appear as though, for every entry in the table A, there should be corresponding entries in the all the 3 tables B,C and D.&lt;br /&gt;But actually, it means that A cannot exist indepedently. For every entry in the table A, thereshould exist an entry atleast in any one of B,C or D.(it could be just one or two or all three of B,C and D)&lt;br /&gt;Such relationships are normally used with tables used to link different tables (called link tables).&lt;br /&gt;Had there been a bubble, before B,C and D, it would mean that an entry in A can exist independently.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951603711668509916-3294566390153530081?l=ramprasad-techbook.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ramprasad-techbook.blogspot.com/feeds/3294566390153530081/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951603711668509916&amp;postID=3294566390153530081' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/3294566390153530081'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/3294566390153530081'/><link rel='alternate' type='text/html' href='http://ramprasad-techbook.blogspot.com/2009/06/entity-relationship-cont.html' title='Entity relationship cont...'/><author><name>Ramprasad</name><uri>http://www.blogger.com/profile/16032736524787849385</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_kO6KttbWHQg/SikCa8ge04I/AAAAAAAAABk/1JkuKbA96YU/s72-c/Relationship_generic.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951603711668509916.post-8746081804313542783</id><published>2009-05-28T15:57:00.011+05:30</published><updated>2009-05-28T16:09:10.881+05:30</updated><title type='text'>Data model cardinalities - very useful in designing db tables</title><content type='html'>&lt;a href="http://1.bp.blogspot.com/_kO6KttbWHQg/Sh5nM0Ldy3I/AAAAAAAAAAU/LXSVVo6zmZM/s1600-h/Cardinality1.gif"&gt;&lt;img id="BLOGGER_PHOTO_ID_5340819677970811762" style="FLOAT: left; MARGIN: 0px 10px 10px 0px; WIDTH: 330px; CURSOR: hand; HEIGHT: 41px" alt="" src="http://1.bp.blogspot.com/_kO6KttbWHQg/Sh5nM0Ldy3I/AAAAAAAAAAU/LXSVVo6zmZM/s320/Cardinality1.gif" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;div&gt;&lt;div&gt;&lt;div&gt;&lt;br /&gt;&lt;div&gt;&lt;a href="http://2.bp.blogspot.com/_kO6KttbWHQg/Sh5nedI0lnI/AAAAAAAAAAk/KGhVY7_h5JI/s1600-h/Cardinality2.gif"&gt;&lt;img id="BLOGGER_PHOTO_ID_5340819981023352434" style="FLOAT: left; MARGIN: 0px 10px 10px 0px; WIDTH: 313px; CURSOR: hand; HEIGHT: 47px" alt="" src="http://2.bp.blogspot.com/_kO6KttbWHQg/Sh5nedI0lnI/AAAAAAAAAAk/KGhVY7_h5JI/s320/Cardinality2.gif" border="0" /&gt;&lt;/a&gt; &lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;a href="http://1.bp.blogspot.com/_kO6KttbWHQg/Sh5njpMCz3I/AAAAAAAAAAs/siGylnu0uHE/s1600-h/Cardinality3.gif"&gt;&lt;img id="BLOGGER_PHOTO_ID_5340820070157438834" style="FLOAT: left; MARGIN: 0px 10px 10px 0px; WIDTH: 313px; CURSOR: hand; HEIGHT: 47px" alt="" src="http://1.bp.blogspot.com/_kO6KttbWHQg/Sh5njpMCz3I/AAAAAAAAAAs/siGylnu0uHE/s320/Cardinality3.gif" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;a href="http://3.bp.blogspot.com/_kO6KttbWHQg/Sh5nqokw53I/AAAAAAAAAA0/jzYyenKpk7w/s1600-h/Cardinality4.gif"&gt;&lt;img id="BLOGGER_PHOTO_ID_5340820190251771762" style="FLOAT: left; MARGIN: 0px 10px 10px 0px; WIDTH: 307px; CURSOR: hand; HEIGHT: 47px" alt="" src="http://3.bp.blogspot.com/_kO6KttbWHQg/Sh5nqokw53I/AAAAAAAAAA0/jzYyenKpk7w/s320/Cardinality4.gif" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://1.bp.blogspot.com/_kO6KttbWHQg/Sh5n1uWqPEI/AAAAAAAAAA8/_tCjTW0F2bg/s1600-h/Cardinality5.gif"&gt;&lt;img id="BLOGGER_PHOTO_ID_5340820380781788226" style="FLOAT: left; MARGIN: 0px 10px 10px 0px; WIDTH: 307px; CURSOR: hand; HEIGHT: 47px" alt="" src="http://1.bp.blogspot.com/_kO6KttbWHQg/Sh5n1uWqPEI/AAAAAAAAAA8/_tCjTW0F2bg/s320/Cardinality5.gif" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a href="http://4.bp.blogspot.com/_kO6KttbWHQg/Sh5n8llRWZI/AAAAAAAAABE/ybQLVH1GyHM/s1600-h/Cardinality6.gif"&gt;&lt;img id="BLOGGER_PHOTO_ID_5340820498686237074" style="FLOAT: left; MARGIN: 0px 10px 10px 0px; WIDTH: 307px; CURSOR: hand; HEIGHT: 47px" alt="" src="http://4.bp.blogspot.com/_kO6KttbWHQg/Sh5n8llRWZI/AAAAAAAAABE/ybQLVH1GyHM/s320/Cardinality6.gif" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://4.bp.blogspot.com/_kO6KttbWHQg/Sh5oHDyHXoI/AAAAAAAAABM/qIxXJloWK1w/s1600-h/Cardinality7.gif"&gt;&lt;img id="BLOGGER_PHOTO_ID_5340820678591864450" style="FLOAT: left; MARGIN: 0px 10px 10px 0px; WIDTH: 310px; CURSOR: hand; HEIGHT: 47px" alt="" src="http://4.bp.blogspot.com/_kO6KttbWHQg/Sh5oHDyHXoI/AAAAAAAAABM/qIxXJloWK1w/s320/Cardinality7.gif" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a href="http://4.bp.blogspot.com/_kO6KttbWHQg/Sh5oQAtzM7I/AAAAAAAAABU/ud_EhMpAzbk/s1600-h/Cardinality8.gif"&gt;&lt;img id="BLOGGER_PHOTO_ID_5340820832387281842" style="FLOAT: left; MARGIN: 0px 10px 10px 0px; WIDTH: 307px; CURSOR: hand; HEIGHT: 47px" alt="" src="http://4.bp.blogspot.com/_kO6KttbWHQg/Sh5oQAtzM7I/AAAAAAAAABU/ud_EhMpAzbk/s320/Cardinality8.gif" border="0" /&gt;&lt;/a&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;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;1.Link This is a 0:0 optional relationship basically stating that a person can occupy one parking space, that I don't need a person to have a space and I don't need a space to have a person. Although the concept is fairly simple, a database can't express it directly. You would need to nominate one entity to become the dominant table and use triggers or programs to limit the number of related records in the other table.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;2.SubType This is a 1:0 relationship; optional only on one side. This would indicate that a person might be a programmer, but a programmer must be a person. It is assumed that the mandatory side of the relationship is the dominant. Again, triggers or programs must be used to control the database.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;3.Physical Segment This is a 1:1 mandatory relationship and demonstrates a segmentation denormalization. A person must have one and only one DNA pattern and that pattern must apply to one and only one person. This is difficult to implement in a database, since declarative referential integrity will get caught in a "Chicken and the Egg" situation. Basically, this is a single entity.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;4.Possession This is a 0:M (zero to many) optional relationship indicating that a person might have no phone, one phone or lots of phones, and that a phone might be un-owned, but can only be owned by a maximum of one person. This is implemented in a database as a nullable foreign key column in the phone table that references the person table.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;5.Child This is a 1:M mandatory relationship, the most common one seen in databases. A person might be a member or might not, but could be found multiple times (if the member entity represents membership in multiple clubs, for instance). A member must be a person, no questions asked. The foreign key in the member table would be mandatory, or not-null.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;6.Characteristic This is a 0:M relationship that is mandatory on the many side. It indicates that a person must have at least one name, but possibly many names, and that a name might be assigned to a person (might not) but at most to one person. In a database you would have the the name table with a nullable foreign key to the person table and triggers or programs to force a person to have at least one name.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;7.Paradox This is a 1:M relationship mandatory on both sides. As with the physical segment situation, the "Chicken and the Egg" is involved since you have to have a person to have citizenship, but citizenship to have a person.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;8.Association This is a M:M (many to many) optional relationship. Conceptually, it means that a person might or might not work for an employer, but could certainly moonlight for multiple companies. An employer might have no employees, but could have any number of them. Again, not hard to visualize, but hard to implement. Most solutions of this situation involve creating a third "Associative Entity" to resolve the M:M into two 0:M relationships. This might be an entity called employee because it does link the person to the employer the person works for.&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;Copied from&lt;br /&gt;&lt;a href="http://www.datamodel.org/DataModelCardinality.html"&gt;http://www.datamodel.org/DataModelCardinality.html&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951603711668509916-8746081804313542783?l=ramprasad-techbook.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ramprasad-techbook.blogspot.com/feeds/8746081804313542783/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951603711668509916&amp;postID=8746081804313542783' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/8746081804313542783'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/8746081804313542783'/><link rel='alternate' type='text/html' href='http://ramprasad-techbook.blogspot.com/2009/05/data-model-cardinalities-very-useful-in.html' title='Data model cardinalities - very useful in designing db tables'/><author><name>Ramprasad</name><uri>http://www.blogger.com/profile/16032736524787849385</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_kO6KttbWHQg/Sh5nM0Ldy3I/AAAAAAAAAAU/LXSVVo6zmZM/s72-c/Cardinality1.gif' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951603711668509916.post-873624066679846289</id><published>2009-04-02T11:11:00.001+05:30</published><updated>2009-04-02T11:12:30.641+05:30</updated><title type='text'>Jadclipse</title><content type='html'>Very useful decompiler tool that comes as an eclipse plugin.&lt;br /&gt;&lt;br /&gt;http://jadclipse.sourceforge.net/&lt;br /&gt;&lt;br /&gt;This is nothing but jad which runs behind eclipse and helps in opening class files in eclipse.&lt;br /&gt;&lt;br /&gt;To use this.&lt;br /&gt;&lt;br /&gt;1.Copy the in the jadclipse_versionNo.jar file in eclipse\plugins directory.&lt;br /&gt;2.Restart eclipse&lt;br /&gt;3.Go to windows -- &gt; Preferences --&gt; Java -- &gt; Jadclipse(this should be present now after copying the plugin)&lt;br /&gt;4.Give the "Path to decompiler" as the directory where jad.exe exists.&lt;br /&gt;5.Give a directory for temporary files.&lt;br /&gt;&lt;br /&gt;Just try to open any class file in eclipse using Ctrl+Shift+T and the decompiled file will open up.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951603711668509916-873624066679846289?l=ramprasad-techbook.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ramprasad-techbook.blogspot.com/feeds/873624066679846289/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951603711668509916&amp;postID=873624066679846289' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/873624066679846289'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/873624066679846289'/><link rel='alternate' type='text/html' href='http://ramprasad-techbook.blogspot.com/2009/04/jadclipse.html' title='Jadclipse'/><author><name>Ramprasad</name><uri>http://www.blogger.com/profile/16032736524787849385</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951603711668509916.post-6963873362150828981</id><published>2009-01-29T14:23:00.001+05:30</published><updated>2009-01-29T14:25:18.197+05:30</updated><title type='text'>Junit 4</title><content type='html'>Junit 4 absolutely depends on Java 5 features.&lt;br /&gt;Will not compile or run with 1.4 or earlier version.&lt;br /&gt;&lt;br /&gt;@Test&lt;br /&gt;Mark your test cases with @Test annotations. You don’t need to prefix your&lt;br /&gt;test cases with “test”.  In addition, your class does not need to extend&lt;br /&gt;from “TestCase” class.&lt;br /&gt;&lt;br /&gt;@Before and @After&lt;br /&gt;Use @Before and @After annotations for “setup” and “tearDown” methods&lt;br /&gt;respectively. They run before and after every test case.&lt;br /&gt;&lt;br /&gt;@BeforeClass and @AfterClass&lt;br /&gt;Use @BeforeClass and @AfterClass annotations for class wide “setup” and&lt;br /&gt;“tearDown” respectively. Think them as one time setup and tearDown. They&lt;br /&gt;run for one time before and after all test cases.&lt;br /&gt;&lt;br /&gt;Exception Handling&lt;br /&gt;Use “expected” paramater with @Test annotation for test cases that expect&lt;br /&gt;exception. Write the class name of the exception that will be thrown.&lt;br /&gt;&lt;br /&gt;@Ignore&lt;br /&gt;Put @Ignore annotation for test cases you want to ignore. You can add a&lt;br /&gt;string parameter that defines the reason of ignorance if you want.&lt;br /&gt;&lt;br /&gt;Timeout&lt;br /&gt;Define a timeout period in miliseconds with “timeout” parameter. The test&lt;br /&gt;fails when the timeout period exceeds.&lt;br /&gt;&lt;br /&gt;New Assertions&lt;br /&gt;Compare arrays with new assertion methods. Two arrays are equal if they&lt;br /&gt;have the same length and each element is equal to the corresponding&lt;br /&gt;element in the other array; otherwise, they’re not.&lt;br /&gt;public static void assertEquals(Object[] expected, Object[] actual);public static void assertEquals(String message, Object[] expected,&lt;br /&gt;Object[] actual);&lt;br /&gt;&lt;br /&gt;JUnit4Adapter&lt;br /&gt;Run your Junit 4 tests in Junit 3 test runners with Junit4Adapter.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951603711668509916-6963873362150828981?l=ramprasad-techbook.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ramprasad-techbook.blogspot.com/feeds/6963873362150828981/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951603711668509916&amp;postID=6963873362150828981' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/6963873362150828981'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/6963873362150828981'/><link rel='alternate' type='text/html' href='http://ramprasad-techbook.blogspot.com/2009/01/junit-4.html' title='Junit 4'/><author><name>Ramprasad</name><uri>http://www.blogger.com/profile/16032736524787849385</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951603711668509916.post-1053443012983998315</id><published>2008-10-06T10:50:00.001+05:30</published><updated>2008-10-06T10:53:29.144+05:30</updated><title type='text'></title><content type='html'>&lt;a href="http://2.bp.blogspot.com/_kO6KttbWHQg/SOmgMFG6jtI/AAAAAAAAAAM/2jGlVVVCyys/s1600-h/jspimplicitobj.jpg"&gt;&lt;img id="BLOGGER_PHOTO_ID_5253906569694449362" style="FLOAT: left; MARGIN: 0px 10px 10px 0px; WIDTH: 417px; CURSOR: hand; HEIGHT: 167px" height="211" alt="" src="http://2.bp.blogspot.com/_kO6KttbWHQg/SOmgMFG6jtI/AAAAAAAAAAM/2jGlVVVCyys/s320/jspimplicitobj.jpg" width="509" border="0" /&gt;&lt;/a&gt;&lt;br /&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;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt;Found this good. I don't remember where I got this image from. Full view can be obtained by clicking on the image.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951603711668509916-1053443012983998315?l=ramprasad-techbook.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ramprasad-techbook.blogspot.com/feeds/1053443012983998315/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951603711668509916&amp;postID=1053443012983998315' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/1053443012983998315'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/1053443012983998315'/><link rel='alternate' type='text/html' href='http://ramprasad-techbook.blogspot.com/2008/10/blog-post.html' title=''/><author><name>Ramprasad</name><uri>http://www.blogger.com/profile/16032736524787849385</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_kO6KttbWHQg/SOmgMFG6jtI/AAAAAAAAAAM/2jGlVVVCyys/s72-c/jspimplicitobj.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951603711668509916.post-4345414608374056775</id><published>2008-10-01T12:42:00.000+05:30</published><updated>2008-10-01T12:43:46.018+05:30</updated><title type='text'>Internationalization</title><content type='html'>&lt;p&gt;When any software application is targeted for clients across the globe, it should always support multiple languages. This feature is called internationalization(i18n), localization or externalization. The application should be designed keeping this in mind in the beginning itself. Except the back-end code which is not shown to the user, everything that is displayed to the user should be internationalized.&lt;br /&gt;Following are the things to be considered.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;1. Labels for different fields on the screen&lt;/p&gt;&lt;p&gt;2. Headers,titles,display messages on the screen.&lt;/p&gt;&lt;p&gt;3. Error messages.&lt;/p&gt;&lt;p&gt;4. Validation messages.&lt;/p&gt;&lt;p&gt;5. Drop down values&lt;/p&gt;&lt;p&gt;6. Widget elements&lt;br /&gt;There are even chances that words in same language might have different spellings in different locales. This is also taken care in i18n.&lt;br /&gt;&lt;br /&gt;Internationalization is mainly accomplished by externalizing all the files that are shown to the user. This enables the back end code to change independently without bothering about the effect on the displayed texts. Such texts can be put in following types of files.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;1. Properties file - a separate properties file with _en,_pt etc is created for each locale and depending on the locale set.&lt;/p&gt;&lt;p&gt;2. XML fil - an xml file will have locale as an element and the messages can be put for the corresponding locale.&lt;/p&gt;&lt;p&gt;3.Java files - this is no very much encouraged approach, however separate java files containing the message strings for different locales can be used, but it would require re-compilation and deployment of class files in the environment whenever there is a change in messages.&lt;/p&gt;&lt;p&gt;4.Using database - database tables can be designed for different locales and messages can be fetched from appropriate tables.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951603711668509916-4345414608374056775?l=ramprasad-techbook.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ramprasad-techbook.blogspot.com/feeds/4345414608374056775/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951603711668509916&amp;postID=4345414608374056775' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/4345414608374056775'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/4345414608374056775'/><link rel='alternate' type='text/html' href='http://ramprasad-techbook.blogspot.com/2008/10/internationalization.html' title='Internationalization'/><author><name>Ramprasad</name><uri>http://www.blogger.com/profile/16032736524787849385</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951603711668509916.post-3264260228115144716</id><published>2008-09-24T10:32:00.000+05:30</published><updated>2008-09-24T10:33:45.947+05:30</updated><title type='text'>Handling code dependency</title><content type='html'>While developing a project, dependency is inevitable. We always have to rely on code being written by others. If a person is in charge of say Contorl part of a project with MVC architecture, he needs Model and view to ensure that his code is working fine.&lt;br /&gt;&lt;br /&gt;In such cases,if dependency is not addressed properly, it results in poor integration, poor testing and hence bad quality of deliverables. Developers tend to blame others if their code is not working saying that they never got enough time to test their functionality as the other part&lt;br /&gt;was not available on time.&lt;br /&gt;&lt;br /&gt;To avoid such confusions and pressure at the nth moment, one should try to stick to the initial design as much as possible. However, change is unavoidable and even is very good projects the adherence to initial design would not be more than 75%.&lt;br /&gt;&lt;br /&gt;One of the ways is to hardcode input values and print the output values for each flow. This can help overcome the dependency on service layer and data access layer and the facade/controller can be tested.&lt;br /&gt;&lt;br /&gt;UI part can be tested just by directly hardcoding the values in the screen pages.&lt;br /&gt;&lt;br /&gt;If data cannot be inserted through the application, it can be manually inserted in database and the functionality such as deleting/reading/updating can be tested without bothering about the&lt;br /&gt;functionality of creating/inserting data in the database.&lt;br /&gt;&lt;br /&gt;Writing unit test cases such as junits is a good way to test the service/data access layer. One need not wait till the UI/facade/controller is ready. This also can be used to test validations.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951603711668509916-3264260228115144716?l=ramprasad-techbook.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ramprasad-techbook.blogspot.com/feeds/3264260228115144716/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951603711668509916&amp;postID=3264260228115144716' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/3264260228115144716'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/3264260228115144716'/><link rel='alternate' type='text/html' href='http://ramprasad-techbook.blogspot.com/2008/09/handling-code-dependency.html' title='Handling code dependency'/><author><name>Ramprasad</name><uri>http://www.blogger.com/profile/16032736524787849385</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951603711668509916.post-8783413429458394708</id><published>2008-09-15T12:09:00.000+05:30</published><updated>2008-09-15T12:10:03.883+05:30</updated><title type='text'>Validations</title><content type='html'>In any application, there will be need for validating the user-entered data. Following are the most common validations.&lt;br /&gt;1. Mandatory validations -  A field cannot be left blank. If the field is made mandatory some value must be entered for that field.&lt;br /&gt;&lt;br /&gt;2. Date validations - The date and time should be valid. In some cases It cannot be in the past or in the future.&lt;br /&gt;&lt;br /&gt;3. Numeric validations - This includes something like value should not be negative,zero or should not be greater than some value, less than something etc.&lt;br /&gt;&lt;br /&gt;4. String validations - This includes the maximum/minimum number of characters in the string, whether special characters/space are allowed or not,if alphanumeric characters are allowed or not etc.&lt;br /&gt;&lt;br /&gt;5.Cross field validations - This is to validate if some field is entered, some other field should not be left blank.&lt;br /&gt;&lt;br /&gt;6.Pattern matching validations - This includes some pattern matching such as the pincode, phone number, some kind of coupon numbers etc where we would validate if the first few characters are letters, next few are numbers and so on.&lt;br /&gt;&lt;br /&gt;7. Validating with the database - In some cases, we need to check if the value entered is present in a database record or not. If it is already present sometimes we say it is a duplicate. There can also be scenarios where we would say if the data is not present in the database, we cannot continue.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951603711668509916-8783413429458394708?l=ramprasad-techbook.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ramprasad-techbook.blogspot.com/feeds/8783413429458394708/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951603711668509916&amp;postID=8783413429458394708' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/8783413429458394708'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/8783413429458394708'/><link rel='alternate' type='text/html' href='http://ramprasad-techbook.blogspot.com/2008/09/validations.html' title='Validations'/><author><name>Ramprasad</name><uri>http://www.blogger.com/profile/16032736524787849385</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951603711668509916.post-3862647870077842108</id><published>2008-09-02T18:14:00.003+05:30</published><updated>2008-09-02T18:29:12.583+05:30</updated><title type='text'>Database Operations</title><content type='html'>&lt;p&gt;&lt;br /&gt;The criteria for operation are&lt;br /&gt;1.Is it a single row operation or multiple row operation ? If it is a single row, normally the primary key of the table should be provided. If it is a multiple row operation, some other column value can be provided.(because if the primary key value is provided, it should be provided for all the rows. If any other column value is provided, it is possible that multiple entries(rows) exist for the same column value)&lt;/p&gt;&lt;p&gt;&lt;br /&gt;2.Is it a single column operation or multiple column operation ?&lt;/p&gt;&lt;p&gt;&lt;br /&gt;3. Is it a single table operation or does it involve multiple tables ?(Involving multiple tables might mean that the tables other than the primary one may be just used for reading values from them, or they also might get modified in the operation)&lt;/p&gt;&lt;p&gt;&lt;br /&gt;4.Is there a condition in the operation or if it is a generic operation on the entire table(s) ?&lt;/p&gt;&lt;p&gt;&lt;br /&gt;There are following basic database operations.&lt;br /&gt;1.Read&lt;/p&gt;&lt;p&gt;2.Insert&lt;/p&gt;&lt;p&gt;3.Update&lt;/p&gt;&lt;p&gt;4.Delete&lt;/p&gt;&lt;p&gt;&lt;br /&gt;======Read======&lt;br /&gt;Reading a single unique entry from a table&lt;/p&gt;&lt;p&gt;You need to provide the primary key value for the table. There always exists only a single result for the given value. A select query with a where clause for primary key column should be used.&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;Reading single or multiple entries from a table - single value passed&lt;/p&gt;&lt;p&gt;You need to provide the value corresponding to a column in the table. All the entries whose values are equal to the one provided will be fetched. A select query with a where clause for corresponding column should be used.Note that if the column is primary key column then it is same as the previous one.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;Reading single or multiple entries from a table - multiple values passed.&lt;/p&gt;&lt;p&gt;You need to provide values corresponding to multiple columns in the table. A select query with multiple where clauses for corresponding columns should be used.&lt;br /&gt;&lt;br /&gt;Reading single or multiple entries from a table - no value passed&lt;/p&gt;&lt;p&gt;Here we don't have to pass any value matching any column. The entries in the table will be filtered on some criterion that is not dependent on any input. E.g select all values where a particular column is not null.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;Reading all values from a table - no value passed&lt;/p&gt;&lt;p&gt;Here you need not provide anything other than the table name. All values in the table would be fetched. A select query with a * will be used.&lt;/p&gt;&lt;p&gt;Reading single or multiple entries from more than one table - single or multiple values passed&lt;/p&gt;&lt;p&gt;Here we need to provide the values corresponding to the column names of each of the tables involved. These tables must be linked through some common columns or through some common tables. A Select query with single or multiple where clauses and a join for linking the tables through common columns should be used.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;P.S: The order of columns is determined while creating the table.E.g columns x, column y are specified while creating a table, column x would appear first and column y would appear next.&lt;br /&gt;&lt;br /&gt;==========Insert==========&lt;br /&gt;&lt;br /&gt;For insert there is only following options&lt;/p&gt;&lt;p&gt;&lt;br /&gt;Inserting a single entry(row) into a table --- values for one or more or&lt;br /&gt;all columns&lt;/p&gt;&lt;p&gt;You need to provide the column name and the corresponding values to be inserted.A simple insert query with column name and values will be used.Inserting multiple entries(rows) into a table --- values for one or more or all columns&lt;/p&gt;&lt;p&gt;Row value constructors are used to insert values into the table. An insert query with values in bracket separated by comma are used. E.g INSERT INTO phone_book VALUES ('John Doe', '555-1212'), ('Peter Doe', '555-2323');&lt;br /&gt;&lt;br /&gt;Inserting multiple entries(rows) into a table selecting it from another or same table --- values for one or more or all columns&lt;/p&gt;&lt;p&gt;Here you need to provide the table from where the values are to be selected, the criterion for selection(where clause, or to be more generic, any read operation) and the table and the name of the columns of this table into which values are to be inserted.&lt;br /&gt;&lt;br /&gt;Inserting single or multiple entries into multiple tables&lt;/p&gt;&lt;p&gt;Not sure, if this can be done in a single query.&lt;br /&gt;&lt;br /&gt;==========Update==========&lt;br /&gt;Updating a single entry(row) into a table --- values for one or more or all columns&lt;/p&gt;&lt;p&gt;You need to provide the primary key value, the column name and the corresponding values to be updated.A simple update query with column name and values will be used.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;Updating multiple entries(rows) into a table --- values for one or more or all columns&lt;/p&gt;&lt;p&gt;You need to provide the value corresponding to a column in the table and this would be taken as a criterion to filter the rows to be updated.You also need to provide the new values of the columns which need to be entered in place of old values.All the entries whose values are equal to&lt;br /&gt;the conditional value provided will be updated.An update query with a where clause should be used.&lt;br /&gt;&lt;br /&gt;Updating multiple entries(rows) into a table selecting it from another or same table --- values for one or more or all columns&lt;/p&gt;&lt;p&gt;Here you need to provide the table from where the values are to be selected, the criterion for selection(where clause, or to be more generic, any read operation) and the table and the name of the columns of this table into which values are to be updated.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;Updating single or multiple entries into multiple tables&lt;/p&gt;&lt;p&gt;Not sure, if this can be done in a single query.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;=========Delete==========&lt;br /&gt;Normally delete operations are only for rows and not for columns. If columns are to be deleted, then update should be used.Delete operations are almost always followed by a where clause, otherwise it would delete all the rows.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;Deleting a single entry(row) from a table &lt;/p&gt;&lt;p&gt;You need to provide the primary key value.A simple delete query with a where clause matching the primary key would be used.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;Deleting a multiple entries(rows) from a table &lt;/p&gt;&lt;p&gt;You need to provide the value of a column.A simple delete query with a where clause matching the column value would be used.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;Deleting single or multiple entries from multiple tables&lt;/p&gt;&lt;p&gt;Not sure, if this can be done in a single query. Looks like it can't be except in cases where the tables are related to each other as parent and child.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951603711668509916-3862647870077842108?l=ramprasad-techbook.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ramprasad-techbook.blogspot.com/feeds/3862647870077842108/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951603711668509916&amp;postID=3862647870077842108' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/3862647870077842108'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/3862647870077842108'/><link rel='alternate' type='text/html' href='http://ramprasad-techbook.blogspot.com/2008/09/database-operations.html' title='Database Operations'/><author><name>Ramprasad</name><uri>http://www.blogger.com/profile/16032736524787849385</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951603711668509916.post-1453895042167744570</id><published>2008-08-11T17:13:00.001+05:30</published><updated>2008-08-11T17:15:13.894+05:30</updated><title type='text'>Junit</title><content type='html'>&lt;p&gt;It is a unit testing frame work which is a member of family called xUnit.Created by Kent Beck and Erich Gamma.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;At the heart of JUnit is the TestRunner, which comes in multiple forms. They all do pretty much the same thing, however: they take a Test (or collection of Tests), and invoke a method called run(junit.framework.TestResult).&lt;/p&gt;&lt;p&gt;&lt;br /&gt;Test is an interface. There are two basic implementations of Test that we need to concern ourselves with: TestSuite and TestCase. &lt;/p&gt;&lt;p&gt;&lt;br /&gt;A TestSuite, essentially, is a collection of TestCases.The TestCase is where the action all happens!  The run() method takes a parameter, called the TestResult. The TestCase&lt;br /&gt;method deals with the run method, inside a method called runBare(). A test will fail if an exception propogates outwards. Exceptions of a particular type (the AssertionFailedError) are recognised as test failures; other types of exceptions will get marked as errors.We can define our own runTest() method if we like.&lt;/p&gt;&lt;br /&gt;While writing test cases we generally extend the class TestCase. Normally, for this an abstract class would be provided for a project. All the Junits in the project would be categorised based on module and each one would extend this abstract class to test the behavior. This abstract class would do common things like - initialise the database, set the locales, load the necessary properties, increase the cache size and other similar configuration related things)&lt;br /&gt;&lt;br /&gt;All previous versions of JUnit use naming conventions and reflection to locate tests.By contrast, in JUnit 4, tests are identified by an @Test annotation. The advantage is that method names need not start with the word "test" and the class need not extend TestCase. The annotation @Test would suffice. @Before, @After are other annotations introduced in Junit4.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951603711668509916-1453895042167744570?l=ramprasad-techbook.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ramprasad-techbook.blogspot.com/feeds/1453895042167744570/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951603711668509916&amp;postID=1453895042167744570' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/1453895042167744570'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/1453895042167744570'/><link rel='alternate' type='text/html' href='http://ramprasad-techbook.blogspot.com/2008/08/junit.html' title='Junit'/><author><name>Ramprasad</name><uri>http://www.blogger.com/profile/16032736524787849385</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951603711668509916.post-7126650196159519192</id><published>2008-06-10T12:12:00.003+05:30</published><updated>2008-06-10T12:21:33.852+05:30</updated><title type='text'>Networking basics - a brush up 2</title><content type='html'>&lt;p&gt;&lt;strong&gt;DHCP - &lt;/strong&gt;This is a protocol used by the client network devices to obtain various parameters necessary to operate in the IP network.By using this protocol, system administration workload greatly decreases, and devices can be added to the network with minimal or no manual configurations.The Dynamic Host Configuration Protocol (DHCP) automates the assignment of IP addresses, subnet masks, default gateway, and other IP parameters.When a DHCP-configured client (be it a computer or any other network-aware device) connects to a network, the DHCP client sends a broadcast query requesting necessary information from a DHCP server. The DHCP server manages a pool of IP addresses and information about client configuration parameters such as the default gateway, the domain name, the DNS servers, other servers such as time servers, and so forth. Upon receipt of a valid request the server will assign the computer an IP address, a lease (the length of time for which the allocation is valid), and other IP configuration parameters, such as the subnet mask and the default gateway. The query is typically initiated immediately after booting and must be completed before the client can initiate IP-based communication with other hosts.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;strong&gt;DNS - &lt;/strong&gt;Domain Name System is like a phone book which maps the complex, difficult to remember IP addresses into easily rememberable domain names. E.g 208.77.188.166 can be translated in to &lt;a href="http://www.dnsexample.com/"&gt;http://www.dnsexample.com/&lt;/a&gt;. It also stores other information such as the list of mail servers that accept email for a given domain.&lt;/p&gt;&lt;p&gt;&lt;strong&gt;MAC - &lt;/strong&gt;Media Access Control address is a number that serves as an identifier for a particular network adapter. Thus network cards (or built-in network adapters) in two different computers will have different MAC addresses,However, it is possible to change the MAC address on most of today's hardware, often referred to as MAC spoofing.It is also called Ethernet Hardware Address (EHA) or hardware address or adapter address.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;ISP - &lt;/strong&gt;An Internet service provider (ISP, also called Internet access provider or IAP) is a company or business that provides access to the Internet and related services.ISPs employ a range of technologies to enable consumers to connect to their network.For home users and small businesses, the most popular options include dial-up, DSL (typically Asymmetric Digital Subscriber Line, ADSL), broadband wireless, cable modem, fiber to the premises (FTTH), and Integrated Services Digital Network (ISDN) (typically basic rate interface (BRI).For customers who have more demanding requirements, such as medium-to-large businesses, or other ISPs, DSL (often SHDSL or ADSL), Ethernet, Metro Ethernet, Gigabit Ethernet, Frame Relay, ISDN (BRI or PRI), ATM, satellite Internet access and synchronous optical networking (SONET) are more likely. With the increasing popularity of downloading music and online video and the general demand for faster page loads, higher bandwidth connections are becoming more popular.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;strong&gt;VPN - &lt;/strong&gt;A virtual private network (VPN) is a computer network in which some of the links between nodes are carried by open connections or virtual circuits in some larger network (e.g., the Internet) instead of by physical wires.It is used for secure connections in the public internet but a VPN need not have explicit security features, such as authentication or content encryption.The distinguishing characteristics of VPNs are not security or performance, but that they overlay other network(s) to provide a certain functionality that is meaningful to a user community.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Wi-fi - &lt;/strong&gt;Wireless Fidelity is a wireless technology standard that is supported by most of the mobiles,operating systems,networks and games.Power consumption is fairly high compared to some other low-bandwidth standards. A typical Wi-Fi home router using 802.11b or 802.11g with a stock antenna might have a range of 32 m (120 ft) indoors and 95 m (300 ft) outdoors. Range also varies with frequency band. &lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;strong&gt;Bluetooth - &lt;/strong&gt;This is a wireless protocol that utilise short range communications technology. Both voice and data can be transmitted over short distances to create PANs(Personal Area Networks). It is intended to connect multiple devices such as mobiles, computers/laptops, printers, digital cameras etc.It consumes comparitively less power and transmission range is also short(1m - 10m). It uses 2.4 GHz short-range radio frequency bandwidth.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Spread spectrum - &lt;/strong&gt;This is a technology in which energy generated in a particular bandwidth is deliberately spread in the frequency domain, resulting in a signal with a wider bandwidth. These techniques are used for a variety of reasons, including the establishment of secure communications, increasing resistance to natural interference and jamming, and to prevent detection&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Frequency Hopping - &lt;/strong&gt;This is a method of transmitting radio signals by rapidly switching a carrier among many frequency channels, using a pseudorandom sequence known to both transmitter and receiver.These are resistant to narrowband interference and are difficult to intercept,&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;PSK,BPSK,QPSK - &lt;/strong&gt;PSK is a digital modulation scheme that conveys data by changing, or modulating, the phase of a reference signal BPSK uses two phases which are separated by 180° and so can also be termed 2-PSK.This modulation is the most robust of all the PSKs. It is, however, only able to modulate at 1 bit/symboland so is unsuitable for high data-rate applications when bandwidth is limited. If there are four phases, it is called QPSK which can encode two bits per symbol. Other PSK techniques include OQPSK,DPSK,FQPSK and pI/4 QPSK.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951603711668509916-7126650196159519192?l=ramprasad-techbook.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ramprasad-techbook.blogspot.com/feeds/7126650196159519192/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951603711668509916&amp;postID=7126650196159519192' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/7126650196159519192'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/7126650196159519192'/><link rel='alternate' type='text/html' href='http://ramprasad-techbook.blogspot.com/2008/06/networking-basics-brush-up.html' title='Networking basics - a brush up 2'/><author><name>Ramprasad</name><uri>http://www.blogger.com/profile/16032736524787849385</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951603711668509916.post-7754405365691615609</id><published>2008-05-28T11:44:00.003+05:30</published><updated>2008-06-10T12:18:16.090+05:30</updated><title type='text'>Networking basics - a brush up 1</title><content type='html'>&lt;p&gt;&lt;strong&gt;Routers &lt;/strong&gt;-- it is a combination of hardware and software which is used forforwarding the information. They contain the specialised operating system,processor memory etc inside that. They are used for providing connectivity within enterprises or between and enterprise and internet.There are different types of routers used for a variety of purposes.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;strong&gt;Network switches&lt;/strong&gt; - are devices that are used for connecting networksegments.They can operate on multiple OSI layers such as physical,datalink,network and transport layers. So the word switch is a generic marketing term. For example router is a swith at layer 3 and hub is a switch at layer 1.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;strong&gt;Network Hub&lt;/strong&gt; -- also called concentrators connect multiple network segements at physical layer.It is becoming obsolete nowadays and switches are used instead.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;strong&gt;Ethernet -&lt;/strong&gt; A type of network technology for local area networks where coaxial cable carries radio frequency signals between computers.It defines a number of wiring and signaling standards for the physical layer.The coaxial cable is now replaced with point-to-point links connected by Ethernet hubs and/or switches to reduce installation costs, increase reliability, and enable point-to-point management and troubleshooting.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;strong&gt;Modem&lt;/strong&gt; --- stands for modulator/demodulator. It is a device used for modulating some information on a carrier signal and demodulating the same to get the original information back.They are normally classified based on the amount of data they can transmit or in terms of baud rate.(baud is not modems speed)The most familiar example is a voiceband modem that turns the digital 1s and 0s of a personal computer into sounds that can be transmitted over the telephone lines of Plain Old Telephone Systems (POTS), and once received on the other side, converts those 1s and 0s back into a form used by a USB, Serial, or Network connection. &lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;strong&gt;IP address&lt;/strong&gt; -- it is a unique id associated with every computer in the network.Any participating network device—including routers, switches, computers, infrastructure servers (e.g., NTP, DNS, DHCP, SNMP, etc.), printers, Internet fax machines, and some telephones—can have its own address that is unique within the scope of the specific network. Some IP addresses are intended to be unique within the scope of the global Internet, while others need to be unique only within the scope of an enterprise. In the current standards, IP address need not be a unique identifier always because of the technologies such as dynamic assignment and NAT.On the public Internet (as opposed to private internets or intranets), IP addresses are managed and created by the Internet AssignedNumbers Authority (IANA). The IANA generally allocates super-blocks to Regional Internet Registries, who in turn allocate smaller blocks to Internet service providers and enterprises.IPV4 is the latest version of standards which uses 32 bits(4 bytes).This limits the number of addresses to 2 to the power of 32. However some of these reserved for special purposes.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;strong&gt;NAT&lt;/strong&gt; -- Network Address Translation first became popular as a way to deal with the IPv4 address shortage. This technique involves taking the networktraffic through a single IP address through a router and re-writing the source and destination IPs mostly in a private network.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;strong&gt;Gateways&lt;/strong&gt; - are also called protocol converters. They can operate at any layer of the OSI model.Typically, a gateway must convert one protocol stack into another.A gateway may contain devices such as protocol translators, impedance matching devices, rate converters, fault isolatorsor signal translators as necessary to provide system interoperability.Routers exemplify special cases of gateways. &lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;strong&gt;Firewall&lt;/strong&gt; - is a device for controlling the network traffic. It can permit, deny, encrypt, or proxy the traffice based on a configured set of rules. More or less like a traffic police controlling the traffic on road.&lt;br /&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951603711668509916-7754405365691615609?l=ramprasad-techbook.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ramprasad-techbook.blogspot.com/feeds/7754405365691615609/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951603711668509916&amp;postID=7754405365691615609' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/7754405365691615609'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/7754405365691615609'/><link rel='alternate' type='text/html' href='http://ramprasad-techbook.blogspot.com/2008/05/networking-basics-brush-up.html' title='Networking basics - a brush up 1'/><author><name>Ramprasad</name><uri>http://www.blogger.com/profile/16032736524787849385</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951603711668509916.post-3793771976884362130</id><published>2008-04-28T11:57:00.001+05:30</published><updated>2008-04-28T12:01:01.049+05:30</updated><title type='text'>Factory Patterns</title><content type='html'>There are mainly 3 types of factory patterns which are kind of similar and hence sometimes lead to confusion.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Simple Factory&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Here you just decouple the creation of object. The class whose object needs to be created using simple factory will not have a public constructor. Instead it provides a static method with name like "newInstance" or "createInstance" or something similar. This method would create an object and return it. While returning a generic type of the object (an interface or abstract class) is used as a return type. Depending on the input parameters, the static method can return different&lt;br /&gt;types of objects which extend of implement the generic type. This decouples the direct usage of new operator which needs to be changed for different implementations.&lt;br /&gt;&lt;br /&gt;There is one other interesting technique in simple factory. We declare the class as abstract though it doesn't have any abstract methods inside it. This is because when it is abstract you cannot instantiate it directly. We extend this abstract class and provide an implementation which just has a static method and instantiates the object. This enforces the client to use the factory for instantiation rather than the new operator.&lt;br /&gt;&lt;br /&gt;Small Note : The disadvantage with static method is that it cannot be overridden further by extending it.Static methods are implicitly final, because overriding is done based on the type of the object, and static methods are attached to a class, not an object. A static method in a&lt;br /&gt;superclass can be shadowed by another static method in a subclass, as long as the original method was not declared final. However, you can't override a static method with a nonstatic method. In other words, you can't change a static method into an instance method in a subclass.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Factory Method Pattern&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Consider,&lt;br /&gt;1. An interface X.&lt;br /&gt;2. Concrete classes X1 and X2 which implement the interface X.&lt;br /&gt;3. An abstract class A with two methods m1 and m2. Method m1 has&lt;br /&gt;implementation and m2 is an abstract method which should be implemented by&lt;br /&gt;the extending classes. Method m1 is exposed to the client. Method m1 calls&lt;br /&gt;method m2. Method m2 has a return type X.&lt;br /&gt;4. A1 and A2 are concrete classes which extend the abstract class A. So they have to provide implementation for the abstract method m2. Method m2 in A1 would return X1. Method m2 in A2 would return X2.&lt;br /&gt;&lt;br /&gt;The above one is a simple scenario and it can be extended for multiple implmentations of the interface X and multiple extensions of the abstract class A.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Abstract Factory pattern&lt;/strong&gt;&lt;br /&gt;Consider,&lt;br /&gt;1. Two interfaces - interface X and interface Y&lt;br /&gt;2. Concrete classes X1 and X2 which implement the interface X and concrete classes Y1 and Y2 which implement Y&lt;br /&gt;3. An interface A which would have two methods viz: createX which has a return type X and createY which has a return type Y.&lt;br /&gt;4. Two concrete classes A1 and A2 which implement the interface A. When the two methods createX, createY are to be implemented, A1 would have return type X1 and Y1 for the two methods respectively.A2 would have return type X2 and Y2 for the two methods respectively.&lt;br /&gt;&lt;br /&gt;The above one is a simple scenario and it can be extended further with multiple implementations for the interfaces A,X and Y.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951603711668509916-3793771976884362130?l=ramprasad-techbook.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ramprasad-techbook.blogspot.com/feeds/3793771976884362130/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951603711668509916&amp;postID=3793771976884362130' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/3793771976884362130'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/3793771976884362130'/><link rel='alternate' type='text/html' href='http://ramprasad-techbook.blogspot.com/2008/04/factory-patterns.html' title='Factory Patterns'/><author><name>Ramprasad</name><uri>http://www.blogger.com/profile/16032736524787849385</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951603711668509916.post-8648405146344700711</id><published>2008-04-23T12:28:00.000+05:30</published><updated>2008-04-23T12:29:46.411+05:30</updated><title type='text'>Obfuscators</title><content type='html'>&lt;p&gt;There is always an element of fear for developers that their code might be reverse engineered. In java there are lot of decompilers available to get a fairly sensible and understandable source code from the class files. Though very few techies have this kind of patience to reverse engineer the class files to get the source back, the possibility cannot be denied.&lt;br /&gt;Here comes the help from obfuscators. They operate on the source code and change the compiled code to confusing class files and thereby make it almost impossible to reverse engineer the classes even for the most intelligent decompilers.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://en.wikipedia.org/wiki/Obfuscated_code"&gt;http://en.wikipedia.org/wiki/Obfuscated_code&lt;/a&gt;&lt;br /&gt;&lt;a href="http://java-source.net/open-source/obfuscators"&gt;http://java-source.net/open-source/obfuscators&lt;/a&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951603711668509916-8648405146344700711?l=ramprasad-techbook.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ramprasad-techbook.blogspot.com/feeds/8648405146344700711/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951603711668509916&amp;postID=8648405146344700711' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/8648405146344700711'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/8648405146344700711'/><link rel='alternate' type='text/html' href='http://ramprasad-techbook.blogspot.com/2008/04/obfuscators.html' title='Obfuscators'/><author><name>Ramprasad</name><uri>http://www.blogger.com/profile/16032736524787849385</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951603711668509916.post-5541218578789907736</id><published>2008-04-21T19:00:00.003+05:30</published><updated>2008-04-21T19:07:57.986+05:30</updated><title type='text'>Classdocs</title><content type='html'>Java doc is very useful in understanding the overall architecture and even the details of the framework/application. But generally we generate java docs only for the sources. Suppose we have a jar file provided by someother party and we don't have the java doc for that. How do we understand what is there inside the jar ? (Ideally, we don't need to know it if java doc is not provided. But still for curiousity we may want to know how it is written.)&lt;br /&gt;&lt;br /&gt;One way is to extract all the class files in that jar and use a decompiler to get the source back.But this is bit tedious and also we might not want to know all the details inside the class file but only the overall structure and relation between different parts.In this case a javadoc for the jar would have helped a much.&lt;br /&gt;&lt;br /&gt;A tool called classdoc helps here. It is just another jar file. All we need to do is run java command providing this jar file for -cp, and the path of the jar file for which we want a java doc. Of course there are a few of other parameters such as target for generated java docs, the title for the java docs etc. This provides a crude javadoc for the classes in the jar file.&lt;br /&gt;&lt;br /&gt;Here is how to run it.Download it from the link &lt;a href="http://classdoc.sourceforge.net/"&gt;http://classdoc.sourceforge.net/&lt;/a&gt;&lt;br /&gt;Extract it to a convenient place.Note the path of the jar files for which you want the java doc. Also note the target where you want to put these generated java doc.&lt;br /&gt;Give the command which looks something like the following,&lt;br /&gt;&lt;br /&gt;java -cp %JAVA%\lib\tools.jar;F:\mine\classdoc\classdoc.jar;F:\mine\classdoc\jmxtools.jar classdoc -docpath F:\mine\classdoc\jmxtools.jar -private -d F:\mine\classdoc\target -windowtitle "simple test" -header "header" -verbose&lt;br /&gt;&lt;br /&gt;classdoc.jar is required for generating the java doc and jmxtools.jar is the jar file on which the experiment is executed. Target is the folder where the java docs will be generated. The parameter "private" indicates that java doc should be generated for private members.&lt;br /&gt;&lt;br /&gt;It is not foolproof and doesn't have any warranty also, but it is conceptually a great software.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951603711668509916-5541218578789907736?l=ramprasad-techbook.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ramprasad-techbook.blogspot.com/feeds/5541218578789907736/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951603711668509916&amp;postID=5541218578789907736' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/5541218578789907736'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/5541218578789907736'/><link rel='alternate' type='text/html' href='http://ramprasad-techbook.blogspot.com/2008/04/classdocs.html' title='Classdocs'/><author><name>Ramprasad</name><uri>http://www.blogger.com/profile/16032736524787849385</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951603711668509916.post-7612700508796934783</id><published>2008-04-18T18:57:00.001+05:30</published><updated>2008-04-18T18:59:15.986+05:30</updated><title type='text'>Screen Recorder</title><content type='html'>Found this very useful, to describe what has happened in the system.It is Just like we use the printscreen, we have the animation here.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.sameshow.com/democreator/article/demo-creator-article-2.html"&gt;http://www.sameshow.com/democreator/article/demo-creator-article-2.html&lt;/a&gt; (trial version)&lt;br /&gt;&lt;br /&gt;Install the application (it is really simple)&lt;br /&gt;&lt;br /&gt;Have the application which you want to run open.Click on democreator icon created on your desktop.&lt;br /&gt;&lt;br /&gt;Select "By capturing screenshots" option.Do whatever you want on your application which you had opened before launching demo creator.&lt;br /&gt;&lt;br /&gt;When you want to stop press F10.&lt;br /&gt;&lt;br /&gt;You have the demo ready now. Publish it and it will be saved on your computor. You can view this as an html with shockwave flash object.&lt;br /&gt;&lt;br /&gt;There are many other powerful features available with Demo creator.&lt;br /&gt;&lt;br /&gt;We can custom the size of the window.Then the animation will appear in the size we wished with a progressbar (just like we use windows media player minimized).&lt;br /&gt;&lt;br /&gt;Or we can even use the full screen option as well. In this case the it will appear just like the first option - i.e running the application. But demo creator will be running silently and we can do whatever we wish on the computer and everything gets recorded.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951603711668509916-7612700508796934783?l=ramprasad-techbook.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ramprasad-techbook.blogspot.com/feeds/7612700508796934783/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951603711668509916&amp;postID=7612700508796934783' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/7612700508796934783'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/7612700508796934783'/><link rel='alternate' type='text/html' href='http://ramprasad-techbook.blogspot.com/2008/04/screen-recorder.html' title='Screen Recorder'/><author><name>Ramprasad</name><uri>http://www.blogger.com/profile/16032736524787849385</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951603711668509916.post-7888106229383357547</id><published>2008-04-08T11:43:00.003+05:30</published><updated>2008-04-08T11:47:08.864+05:30</updated><title type='text'>JMS</title><content type='html'>Messaging means exchanging information. When different software components live in different environments, they need to communicate with each other. It could be a tightly coupled communication or a loosely coupled communication.&lt;br /&gt;&lt;br /&gt;In the first one, the components know each other, i.e who is the sender and who is the receiver.So they communicate direclty. Examples for this kind of communication are CORBA,RMI, TCP n/w sockets.&lt;br /&gt;&lt;br /&gt;In the second type of communication,i.e the lightly coupled communication, there is an intermediate component coming in between the communicating entities. So the sender and receiver do not communicate directly, instead they use another entity in between.&lt;br /&gt;&lt;br /&gt;JMS falls in the second category. It is java's standard for Message Oreinted Middleware (MOM) service which is essential in enterprise applicaton.&lt;br /&gt;&lt;br /&gt;It should be notee that, just like any other j2ee specification, JMS is onlya standard for messaging. The vendors would provide this service. But the components which intend to usethis service can call the standard interfaces to get their work done, without least bothering about how the implementation is done.&lt;br /&gt;&lt;br /&gt;All Java EE application servers from version 1.4 and later are required to contain a JMS provider.&lt;br /&gt;&lt;br /&gt;Following entities are conceptualized.&lt;br /&gt;JMS provider --- this is the one which provides messaging service&lt;br /&gt;JMS clients ---- these are entities which produce and consume messages&lt;br /&gt;Messages ---- information is sent and received as messages&lt;br /&gt;&lt;br /&gt;Messaging can be done in 2 ways.&lt;br /&gt;1.Point to point (PTP)&lt;br /&gt;2.Publish and subsribe(Pub/Sub)&lt;br /&gt;Here comes the interesting part.&lt;br /&gt;In PTP, there is a client which wants to send a message to another client. It would put it in an entity called "queue" meant for the intended client. The client might be off when the message was put in its queue. But when client wakes up and checks its queue, it would get its message and send an acknowledgement back.Here every message is sent to the queue of the intended client separately. Or only one client is supposed to receive the message sent. It can be imagined as a postman putting the letter in the post box attached to the door of the clien't house. PTP messaging is used when every message sent must be processed by one consumer.&lt;br /&gt;&lt;br /&gt;In the Pub/Sub model, there is a particular topic on which interested clients can publish messages or subscribe for messages. Here normally neither publishers nor the subscribers know each other.The message provider would take care of sending the messages belonging to a particular topic coming from multiple publishers to multiple subscribers. Once the messages are sent to all the concerned subscribers, the particular message in the topic is not retained.&lt;br /&gt;Pub/sub messaging is used when each message can be processed by zero,or many consumers.&lt;br /&gt;Each JMS provider would have a JNDI name. Any java class can connect to any JMS provider using the JNDI info for that. It would further use the ConnectionFactory to get the connection to a particular Topic or Queue.&lt;br /&gt;&lt;br /&gt;Following are the important concepts (interfaces)&lt;br /&gt;&lt;strong&gt;1.ConnectionFactory&lt;/strong&gt; - You ask for a connection by specifying its JNDI name and this will give you. The connection could be to a topic or queue. The corresponding connection factory can be used.&lt;br /&gt;&lt;strong&gt;2.Connection&lt;/strong&gt; --If you have the Connection means you have established a communication with the JMS message provider product and you can start doing what all you want - it could be creating session, sending a message or receiving a message to and from a queue or topic. Again we have corresponding connection objects for queue and topic&lt;br /&gt;&lt;strong&gt;3.Destination&lt;/strong&gt; - This represents an entity where the messages are supposed to reach. It could be a queue or a topic accordingly.&lt;br /&gt;&lt;strong&gt;4.Message Consumer&lt;/strong&gt; -- This entity eats up the message sent to it. In case of Queue it is QueueReceiver and in case of Topic it is TopicSubsciber(Note that this is different from Destination in the sense, destination represents where a message should reach and stay, the consumer is the one who grabs the message sitting there in the destination)&lt;br /&gt;&lt;strong&gt;5.MessageProducer&lt;/strong&gt; -- This is the one that generates the message and sends it to the destination (Queue or Topic). We have accordingly QueueSender and TopicPublisher.&lt;br /&gt;&lt;strong&gt;6.Message&lt;/strong&gt; - this is the entity which actually moves here and there.It could be textmessage,bytemessage,stream message etc.&lt;br /&gt;&lt;strong&gt;7.Session&lt;/strong&gt; -- Represents context for sending and receiving the messages.&lt;br /&gt;Represents a single-threaded context for sending and receiving messages. A session is single-threaded so that messages are serialized, meaning that messages are received one-by-one in the order sent. The benefit of a session is that it supports transactions. If the user selects transaction support, the session context holds a group of messages until the transaction is committed, then delivers the messages. Before committing the transaction, the user can cancel the messages using a rollback operation. A session allows users to create message producers to send messages, and message consumers to receive messages.&lt;br /&gt;&lt;p&gt;&lt;a href="http://java.sun.com/products/jms/tutorial/1_3_1-fcs/doc/basics.html"&gt;http://java.sun.com/products/jms/tutorial/1_3_1-fcs/doc/basics.html&lt;/a&gt;&lt;a href="http://en.wikipedia.org/wiki/Java_Message_Service"&gt;http://en.wikipedia.org/wiki/Java_Message_Service&lt;/a&gt;&lt;/p&gt;&lt;p&gt; &lt;/p&gt;&lt;p&gt; &lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951603711668509916-7888106229383357547?l=ramprasad-techbook.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ramprasad-techbook.blogspot.com/feeds/7888106229383357547/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951603711668509916&amp;postID=7888106229383357547' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/7888106229383357547'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/7888106229383357547'/><link rel='alternate' type='text/html' href='http://ramprasad-techbook.blogspot.com/2008/04/jms.html' title='JMS'/><author><name>Ramprasad</name><uri>http://www.blogger.com/profile/16032736524787849385</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951603711668509916.post-6511234728979617124</id><published>2008-03-31T10:21:00.004+05:30</published><updated>2008-03-31T10:39:30.481+05:30</updated><title type='text'>Servlets</title><content type='html'>We can imagine servlets as entities which can live in their own world called servlet containers. Their job is to serve those who come to them asking for some kind of service. The service is normally providing the information seekers ask.&lt;br /&gt;&lt;br /&gt;We can create some of our own servlets who can live in their world of servlet container. There are vendors who can provide a ready-made servlet containers just like we get an aquarium for fishes.&lt;br /&gt;&lt;br /&gt;The technology has concepts(interfaces) as follows:&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Servlet&lt;/strong&gt; These are the basic entities for whom servlet container is created. Servlets experience following things in their life. They are born (init method), they have to serve their clients (service method), and one day they will die (destroy method).Moreover each servlet would have its own info - by whom,when why etc it was created. This can be obtained by getServletInfo() method.This is just an information.It would also have its intial configurations such as how it was created, what all went in while giving birth to it etc. This can be obtained by getServletConfig() method.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Servlet Config. &lt;/strong&gt;This has all the details, that went in to give birth to a servlet.What was the name of the servlet ?(getInitParameterNames)What all things were used to create the servlet ? (getInitparameters)What was the environment(servlet container) where it was born ?&lt;br /&gt;(getServletContext method)&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;ServletContext&lt;/strong&gt; This tells each servlet, what is happening in the servlet container where it is living.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;ServletContextAttributeListener&lt;/strong&gt; He is a guy, who keeps listening to check if anything is added or removed in the servlets' world. If you request this guy, he will keep you updated as and when he finds something interesting.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;ServletContextListener &lt;/strong&gt;He is a guy, who keeps listening to few changes happening in the servlets' world. He can tell you if the servlets' world is ready with servlets to do the job or it is destroyed.If you catch hold of this guy and ask him to update you, he will promptly inform you when anything happens there. You need not check yourself periodically to see what is happening because, this guy's job is to keep listening constantly and inform others.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;ServletRequest&lt;/strong&gt; This represnts the things as a whole that seekers are asking a servlet to provide. The request might contain lot of information. The access to all such infomation can be obtained if you get hold of this servletrequest.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;ServletResponse &lt;/strong&gt;This is a pack that contains things returned by servlet to its service seeker. What all did the servlet return to its client , get hold of this servletresponse.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;SingleThreadModel &lt;/strong&gt;This is a special category of servlets, which you can create. Normally, a servlet is designed to handle things asked by many of its clients, simultaneously. But sometimes, it gets confused, if too many clients are asking it to do too many things simultaneously. In such cases it will mess up the things. So, to avoid this you can create special servlets which handle only one thing at a time.If one more client asks to do one more thing meanwhile, it would first complete what it is currently doing and then come to this new request. No doubt, this might make the clients angry due to the delay caused, but some servlet containers expect this, and hence makes sure that a lot of identical servlets are available in the pool. Though each can do only one thing at a time, there will be others to handle multiple requests and that would solve the hectic workload.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Filter &lt;/strong&gt;This is a kind of gate keeper, who keeps observing what is coming in and what is going out from the servlets' world.This is brought into existence by the servlets world with appropriate initialization parameter provided by FilterConfig. When this is not required, the container would destroy the same.While filtering, the filter would need to know what is the request, what is the response(in the sense for which request and response comibination the filtering needs to be applied) and what are the filters in the filter chain for the same request and response. (A chain of filters can be applied for a given request response pair and each filter in the chain needs to know the name of the chain of which it is a part)&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;FilterChain &lt;/strong&gt;This is available in the servlets's world if you want to know all the filters in the chain of filters. The ordering of filters is controlled by the descriptor files.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;FilterConfig&lt;/strong&gt; When a filter is to be created in the servlets world,the container needs this to know some information about the filter. using this, you can get to know the information such as servletcontext, filtername, initialization parameters etc.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;RequestDispatcher &lt;/strong&gt;This is a broker kind of guy, whose job is to get the request from the client and pass it to the appropriate entity. In most of the cases it is servlet, but it can be passed to other entities such as jsp etc which live in the same world where servlets live.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.onjava.com/pub/a/onjava/2001/05/10/servlet_filters.html"&gt;http://www.onjava.com/pub/a/onjava/2001/05/10/servlet_filters.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;ServletException&lt;/strong&gt; If there is any problem with a servlet, it will complain by shouting this&lt;br /&gt;kind of exception.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;UnavailableException&lt;/strong&gt; If a servlet is not willing to serve, or not ready or not finding something or anything like that which results in its unavailability of its service, this exception is thrown.&lt;br /&gt;&lt;br /&gt;Following are little bit more concrete concepts(abstract classes) which have a vague body&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;GenericServlet(abstract)&lt;/strong&gt; This is a vague servlet which doesn't know what kind of protocols it can handle, but has got a skeleton to know what is the purpose of its existence and what all it is supposed to do. It doesn't know how to do it.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;ServletContextAttributeEvent&lt;/strong&gt; This guys job is to shout if there are any changes happened to the members of servlet context. There is a listener(ServletContextAttributeListener)&lt;br /&gt;to listen when he shouts.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;ServletContextEvent&lt;/strong&gt; This guy also shouts if there are any changes that took place in the&lt;br /&gt;servlets world. He has got a guy(ServletContextListener) to listen to him as well.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;ServletInputStream(abstract)&lt;/strong&gt; This is a stream which gets the data coming from the client. If you want to read the actual bits of data coming from client, this stream has that in it.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;ServletOutputStream(abstract) &lt;/strong&gt;Same as input stream but only change is that it is associated with output data.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;ServletRequestWrapper&lt;/strong&gt; A prototype that wraps a servlet request object.The concrete servlet request implementation too is packed inside this wrapper object.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;ServletResponseWrapper&lt;/strong&gt; Same as above,except that it wraps the response. This guy also shouts if there are any changes that took place in the servlets world. He has got a guy(ServletContextListener) to listen to him as well.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;ServletInputStream(abstract)&lt;/strong&gt; This is a stream which gets the data coming from the client. If you want to read the actual bits of data coming from client, this stream has that&lt;br /&gt;in it.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;ServletOutputStream(abstract)&lt;/strong&gt; Same as input stream but only change is that it is associated with output data.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;ServletRequestWrapper&lt;/strong&gt; A prototype that wraps a servlet request object.The concrete servlet request implementation too is packed inside this wrapper object.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;ServletResponseWrapper&lt;/strong&gt; Same as above,except that it wraps the response.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951603711668509916-6511234728979617124?l=ramprasad-techbook.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ramprasad-techbook.blogspot.com/feeds/6511234728979617124/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951603711668509916&amp;postID=6511234728979617124' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/6511234728979617124'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/6511234728979617124'/><link rel='alternate' type='text/html' href='http://ramprasad-techbook.blogspot.com/2008/03/servlets.html' title='Servlets'/><author><name>Ramprasad</name><uri>http://www.blogger.com/profile/16032736524787849385</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951603711668509916.post-180262998687865345</id><published>2008-03-27T18:22:00.003+05:30</published><updated>2008-03-27T18:27:42.675+05:30</updated><title type='text'>Abstraction and Encapsulation</title><content type='html'>&lt;p&gt;When I say “chair”, as a common man, you imagine a chair which can offer itself for you to sit.&lt;br /&gt;Or do you imagine the wooden or iron molecules/atoms/protons/electrons/mesons and neutrons constituting the chair ? No right ?&lt;br /&gt;This is what exactly abstraction is. The idea is derived from an ancient concept by Plato who had a platonic idea.i.e the concept of a chair is a separate entity from any particular chair.&lt;br /&gt;In other words, we can conceive of a chair in the abstract without thinking of any particular chair.&lt;br /&gt;Abstraction -- A concept or idea not associated with any specific&lt;br /&gt;instance.(definition from wiki)&lt;/p&gt;&lt;p&gt;&lt;br /&gt;That is how we design an abstract class or abstract method. Abstract means we have a vague idea, what it does, but you don't have a clear picture how exactly it should be done. So normally when a system or framework is designed, it starts with interfaces and abstract classes.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;Another useful example to illustrate abstraction is the naming ofconstants. Suppose we want to use the number 7 to indicate the no of days in a week. We abstract the value 7 by giving the constant name as noOfDaysInWeek. Because, if you just use 7 directly, the person reading&lt;br /&gt;the code might not be able to understand why 7 is used there. Here abstraction makes a better understanding of what is happening.Encapsulation is the term as an implementor one should be aware of. How much details should be made visible and accessible to the person going to use that artifact. This helps in replacing the whole object instead of worrying about what all are there inside and leaving that to experts in that.Example, when a TV is to be repaired, the whole TV can be replaced&lt;br /&gt;for the end user, without bothering him about the devices encapsulated in that. The experts will further dig in to find out, which component encapsulated in the TV is not working. Definitely there would have been a havoc if the TV was uncovered, leaving all its spare parts accessible to&lt;br /&gt;everyone.&lt;br /&gt;Headfirst java book calls any class that has its attributes public as a naked class and tells that it is dangerous to expose all the attributes to the external world. Hence encapsulation is a must.&lt;br /&gt;Encpsulation is all about how much should be made visible and accessible to the external world. This concept helps very much in oops.&lt;br /&gt;So abstraction is related to the design or imagining a system of objects but encpsulation is about implementation of a particular object.Abstraction is a design concept while encapsulation is an implementation technique.&lt;br /&gt;&lt;a href="http://en.wikipedia.org/wiki/Abstraction_(computer_science)"&gt;http://en.wikipedia.org/wiki/Abstraction_(computer_science)&lt;/a&gt;&lt;br /&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951603711668509916-180262998687865345?l=ramprasad-techbook.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ramprasad-techbook.blogspot.com/feeds/180262998687865345/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951603711668509916&amp;postID=180262998687865345' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/180262998687865345'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/180262998687865345'/><link rel='alternate' type='text/html' href='http://ramprasad-techbook.blogspot.com/2008/03/abstraction-and-encapsulation.html' title='Abstraction and Encapsulation'/><author><name>Ramprasad</name><uri>http://www.blogger.com/profile/16032736524787849385</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951603711668509916.post-8486302343584770615</id><published>2008-03-25T10:18:00.000+05:30</published><updated>2008-03-25T10:19:59.274+05:30</updated><title type='text'>J2EE</title><content type='html'>Any software comprises of 2 things.&lt;br /&gt;1.A runtime where a software can exist,run and live(Also called Host).&lt;br /&gt;2.Different components that together make an integrated bundle of software components which is set to exist and funtion on its target runtime.&lt;br /&gt;&lt;br /&gt;The real world analogy could be something like this. There is sound and its existence makes sense to us only if there are ears. Smell exists only because there is nose. For every entity there is a corresponding entity which can sense its presence and make its existence worthwhile. The same logic is applicable in the software world. Every software exists because, there is another software/hardware to host it or detect it. Or rather, it was created targetting to live on something existing. That gets into a kind of philosophy, if we think deeper anyway !!&lt;br /&gt;&lt;br /&gt;Interestingly, as you move up building softwares on top of another existing software/hardware, eventually there is a possibility of creating a host as well as the component from the same material.&lt;br /&gt;&lt;br /&gt;J2EE is also conceived on the same logic. Here the components as well as the container are made of JAVA.&lt;br /&gt;&lt;br /&gt;J2EE is a standard, that tells what kind of components can exist in what kind of containers and what all they can do. Of course this is standardization is reached based on the common requirements for building enterprise applications. This standardization is very important because, when a programmer develops some j2ee component for some purpose, he can deploy it on any of the concerned container that complies to j2ee standard.&lt;br /&gt;&lt;br /&gt;J2ee specifications just mention what all standard services the container should provide for what kind of components. How it should be done is left to the container. This gives the flexibility and tremendous scope for imagination for vendors. This also means a great opportunity to build a product.&lt;br /&gt;&lt;br /&gt;J2EE has the following things to understand&lt;br /&gt;1.Container --- web container, EJB container&lt;br /&gt;2.Component technologies --- servlets,Jsps,EJBs&lt;br /&gt;3.Service technologies ---- JMS,JDBC,JTA&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951603711668509916-8486302343584770615?l=ramprasad-techbook.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ramprasad-techbook.blogspot.com/feeds/8486302343584770615/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951603711668509916&amp;postID=8486302343584770615' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/8486302343584770615'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/8486302343584770615'/><link rel='alternate' type='text/html' href='http://ramprasad-techbook.blogspot.com/2008/03/j2ee.html' title='J2EE'/><author><name>Ramprasad</name><uri>http://www.blogger.com/profile/16032736524787849385</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951603711668509916.post-6980304929184713394</id><published>2008-03-20T15:35:00.000+05:30</published><updated>2008-03-20T15:38:11.769+05:30</updated><title type='text'>Batch Files</title><content type='html'>&lt;p&gt;It is a file containing a series of commands to be executed by command interpreters of MS-DOS and Windows. These files normally end with the extension such as .bat .cmd .btm.&lt;br /&gt;Batch files are useful for running a sequence of executables automatically and are often used by system administrators to automate tedious processes.&lt;/p&gt;&lt;p&gt;There is no difference between the .BAT and .CMD extensions when the file is directly executed. However, when a shortcut is used to launch them, .BAT files run commands using the 16-bit COMMAND.COM command processor whereas if the extension is .CMD, the batch commands are run using the 32-bit Windows NT cmd.exe with all command extensions enabled. Also, the&lt;br /&gt;Windows 9x family only recognizes .BAT extension.&lt;br /&gt;(Source: &lt;a href="http://en.wikipedia.org/wiki/Batch_file"&gt;http://en.wikipedia.org/wiki/Batch_file&lt;/a&gt;)&lt;/p&gt;&lt;p&gt;&lt;br /&gt;I guess following commands should be sufficient to write most of the batch files.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;@echo off&lt;/p&gt;&lt;p&gt;rem&lt;/p&gt;&lt;p&gt;if&lt;/p&gt;&lt;p&gt;if not&lt;/p&gt;&lt;p&gt;if exist&lt;br /&gt;set&lt;/p&gt;&lt;p&gt;call setlocal&lt;/p&gt;&lt;p&gt;endlocal&lt;/p&gt;&lt;p&gt;echo&lt;/p&gt;&lt;p&gt;exit&lt;/p&gt;&lt;p&gt;cd&lt;br /&gt;goto :label&lt;/p&gt;&lt;p&gt;:label&lt;br /&gt;&lt;a href="http://www.ss64.com/nt/"&gt;http://www.ss64.com/nt/&lt;/a&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951603711668509916-6980304929184713394?l=ramprasad-techbook.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ramprasad-techbook.blogspot.com/feeds/6980304929184713394/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951603711668509916&amp;postID=6980304929184713394' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/6980304929184713394'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/6980304929184713394'/><link rel='alternate' type='text/html' href='http://ramprasad-techbook.blogspot.com/2008/03/batch-files.html' title='Batch Files'/><author><name>Ramprasad</name><uri>http://www.blogger.com/profile/16032736524787849385</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951603711668509916.post-5367853570259889252</id><published>2008-03-19T14:18:00.000+05:30</published><updated>2008-03-19T14:20:21.877+05:30</updated><title type='text'>FindBugs</title><content type='html'>FindBugs is an interesting open source program which looks for bugs in Java code. It uses static analysis to identify hundreds of different potential types of error in Java programs. FindBugs operates on Java bytecode, rather than source code. It includes both a stand alone GUI and&lt;br /&gt;an Eclipse plug-in.&lt;br /&gt;&lt;a href="http://findbugs.sourceforge.net/bugDescriptions.html"&gt;http://findbugs.sourceforge.net/bugDescriptions.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Installing findbugs plugin with eclipse.&lt;br /&gt;&lt;br /&gt;Download, the plugin from sourceforge.net and copy the folder in the eclipse plugins folder.(Make sure that the plugin is meant for the eclipse version you have.Otherwise it will not work)&lt;br /&gt;Go to window -&gt; preferences --&gt; general --&gt; perspectiveYou can see findbugs icon there. That means it is installed.Now when you go to any package or java class in your project explorer and&lt;br /&gt;right click, you can see the option called Find Bugs.&lt;br /&gt;&lt;br /&gt;Some examples of potential bugs identified by findbugs.&lt;br /&gt;&lt;br /&gt;1.Invoking System.exit shuts down the entire Java virtual machine. This&lt;br /&gt;should only been done when it is appropriate. Such calls make it hard or&lt;br /&gt;impossible for your code to be invoked by other code. Consider throwing a&lt;br /&gt;RuntimeException instead.&lt;br /&gt;&lt;br /&gt;2.Never call System.runFinalizersOnExit or Runtime.runFinalizersOnExit for&lt;br /&gt;any reason: they are among the most dangerous methods in the Java&lt;br /&gt;libraries.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951603711668509916-5367853570259889252?l=ramprasad-techbook.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ramprasad-techbook.blogspot.com/feeds/5367853570259889252/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951603711668509916&amp;postID=5367853570259889252' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/5367853570259889252'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/5367853570259889252'/><link rel='alternate' type='text/html' href='http://ramprasad-techbook.blogspot.com/2008/03/findbugs.html' title='FindBugs'/><author><name>Ramprasad</name><uri>http://www.blogger.com/profile/16032736524787849385</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951603711668509916.post-5699248127136067734</id><published>2008-03-18T11:10:00.000+05:30</published><updated>2008-03-18T11:11:36.227+05:30</updated><title type='text'>Environment Variables</title><content type='html'>Environment variables can be thought of as certain pointers on the surroundings where the softwares run.It normally tells what exists where. For successful compilation and running, normally softwares should take help from some other tools and softwares already existing in the system. The environment variables provide this information.&lt;br /&gt;In certain operating systems like Unix, each process can have its own set of private environment variables. All the child processes would have access to this.&lt;br /&gt;In Unix, the environment variables are normally initialized during system startup by the system init scripts, and hence inherited by all other processes in the system. Users can, and often do, augment them in the profile script for the shell they are using. In Microsoft Windows,&lt;br /&gt;environment variables defaults are stored in the windows registry or set in autoexec.bat.(Ref:http://en.wikipedia.org/wiki/Environment_variables)&lt;br /&gt;&lt;a href="http://support.microsoft.com/default.aspx?scid=kb;en-us;310519"&gt;http://support.microsoft.com/default.aspx?scid=kb;en-us;310519&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951603711668509916-5699248127136067734?l=ramprasad-techbook.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ramprasad-techbook.blogspot.com/feeds/5699248127136067734/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951603711668509916&amp;postID=5699248127136067734' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/5699248127136067734'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/5699248127136067734'/><link rel='alternate' type='text/html' href='http://ramprasad-techbook.blogspot.com/2008/03/environment-variables.html' title='Environment Variables'/><author><name>Ramprasad</name><uri>http://www.blogger.com/profile/16032736524787849385</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951603711668509916.post-4062332105127232253</id><published>2008-03-17T14:07:00.000+05:30</published><updated>2008-03-17T14:11:30.238+05:30</updated><title type='text'>Widgets</title><content type='html'>&lt;p&gt;&lt;span style="font-family:verdana;"&gt;Widget (or control) is an interface element that a computer user interacts with, such as a window or a text box. &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;Widget is a virtual object just like any visible physical object in the real world.So theoritically we can have as many widgets as there are seeable perceivable objects around us.It is again upto our imagination - how anew widget can be created and made available in the graphical world.&lt;br /&gt;&lt;br /&gt;List of common most commonly used widgets.&lt;br /&gt;Selection and display of collections&lt;br /&gt;1.Button (Toggle,Check box,Radio button )&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:verdana;"&gt;2.Slider &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:verdana;"&gt;3.List box &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:verdana;"&gt;4.Spinner &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:verdana;"&gt;5.Drop-down list &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:verdana;"&gt;6.Menu (Context menu ,Pie menu )&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:verdana;"&gt;7.Menu bar &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:verdana;"&gt;8.Toolbar &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:verdana;"&gt;9.Ribbon &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:verdana;"&gt;10.Combo box (text box with attached menu or List box) &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:verdana;"&gt;11.Icon &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:verdana;"&gt;12.Tree view &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:verdana;"&gt;13.Grid view &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;Navigation&lt;br /&gt;1.Tab &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:verdana;"&gt;2.Scrollbar &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;Text input &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:verdana;"&gt;1.Text box (edit field) &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:verdana;"&gt;2.Combo box (text box with attached menu) &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;Output&lt;br /&gt;1.Label &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:verdana;"&gt;2.Tooltip &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:verdana;"&gt;3.Balloon help &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:verdana;"&gt;4.Status bar &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:verdana;"&gt;5.Progress bar &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:verdana;"&gt;6.Infobar &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;Containers &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:verdana;"&gt;1.Window &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:verdana;"&gt;2.Modal window &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:verdana;"&gt;3.Dialog box &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:verdana;"&gt;4.Palette window, (or"Utility window" )(Inspector window,Drawer Heads-up display, similar to HUD (computer gaming)&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951603711668509916-4062332105127232253?l=ramprasad-techbook.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ramprasad-techbook.blogspot.com/feeds/4062332105127232253/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951603711668509916&amp;postID=4062332105127232253' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/4062332105127232253'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/4062332105127232253'/><link rel='alternate' type='text/html' href='http://ramprasad-techbook.blogspot.com/2008/03/widgets.html' title='Widgets'/><author><name>Ramprasad</name><uri>http://www.blogger.com/profile/16032736524787849385</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951603711668509916.post-5005158570787648447</id><published>2008-03-14T16:07:00.000+05:30</published><updated>2008-03-14T16:08:14.036+05:30</updated><title type='text'>Antipattern</title><content type='html'>We invent something, get excited and find it very useful. So we standardize it.We start using it everywhere. But slowly we realise that the disadvantages by using this practice is outweighing the disadvantage of not using it. So better not to use it.&lt;br /&gt;This is called antipattern.&lt;br /&gt;Anti-patterns are specific repeated practices that appear initially to be beneficial, but ultimately result in bad consequences that outweigh the hoped-for advantages.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951603711668509916-5005158570787648447?l=ramprasad-techbook.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ramprasad-techbook.blogspot.com/feeds/5005158570787648447/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951603711668509916&amp;postID=5005158570787648447' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/5005158570787648447'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/5005158570787648447'/><link rel='alternate' type='text/html' href='http://ramprasad-techbook.blogspot.com/2008/03/antipattern.html' title='Antipattern'/><author><name>Ramprasad</name><uri>http://www.blogger.com/profile/16032736524787849385</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951603711668509916.post-9115159658619997795</id><published>2008-03-13T12:40:00.001+05:30</published><updated>2008-03-13T12:40:55.799+05:30</updated><title type='text'>Scripting and Programming Languages</title><content type='html'>This is an arguable topic.&lt;br /&gt;A scripting language operates on an existing application. But programming language is used to write an independent application.Some people argue that programs that can create binary executables and consume memory are fit to be called a programming language.  But scripts are never converted to anything and each time they are read and interpreted.&lt;br /&gt;ActionScript,javascript are scripting languages.C,Java are programming languages.&lt;br /&gt;&lt;a href="http://www.killersites.com/blog/2005/scripting-vs-programming-is-there-a-difference/"&gt;http://www.killersites.com/blog/2005/scripting-vs-programming-is-there-a-difference/&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951603711668509916-9115159658619997795?l=ramprasad-techbook.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ramprasad-techbook.blogspot.com/feeds/9115159658619997795/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951603711668509916&amp;postID=9115159658619997795' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/9115159658619997795'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/9115159658619997795'/><link rel='alternate' type='text/html' href='http://ramprasad-techbook.blogspot.com/2008/03/scripting-and-programming-languages.html' title='Scripting and Programming Languages'/><author><name>Ramprasad</name><uri>http://www.blogger.com/profile/16032736524787849385</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951603711668509916.post-2604376871885082183</id><published>2008-03-12T10:42:00.000+05:30</published><updated>2008-03-12T10:43:09.072+05:30</updated><title type='text'>JAR-WAR-EAR</title><content type='html'>&lt;p&gt;Ear stands for Enterprise Archive&lt;/p&gt;&lt;p&gt;It is a packed form of J2EE application with various modulesIt can be deployed on an J2EE application server and all the modules will be deployed simultaneously.Deployment descriptors in the EAR file would tell the appserver how to deploy various modules.&lt;br /&gt;In fact ear file is actually a jar file only with a different extension.Typically an Ear would contain following1. A .war file - a web module2.jar files containing java classes3.A .rar file - Resource Adapter or java connectors.4.Deployment descriptor xml files5.Vendor specific files&lt;br /&gt;&lt;br /&gt;WAR stands for Web archive.&lt;/p&gt;&lt;p&gt;This is a package of web components that can be deployed on a web container.Typically it contains1.JSPs2.Servlets3.Java classes4.XML5.Tag libraries6.Static web pages (HTML)&lt;/p&gt;&lt;p&gt;&lt;br /&gt;Jar file stands for Java Archive&lt;br /&gt;It is a file that bundles many java classes and associated meta data into one. This makes it easy for distribution.&lt;br /&gt;JAR files can be created and extracted using the "jar" command that comes with the JDK.&lt;br /&gt;A JAR file has an optional manifest file located in the path  META-INF/MANIFEST.MF&lt;br /&gt;The entries in the manifest file determine how the JAR file will be used. JAR files which are intended to be executed as standalone programs will have one of their classes specified as the "main" class in the manifest file.&lt;br /&gt;&lt;a href="http://www.cezwright.com/tools/java/jar_war_ear.htm"&gt;http://www.cezwright.com/tools/java/jar_war_ear.htm&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt; &lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951603711668509916-2604376871885082183?l=ramprasad-techbook.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ramprasad-techbook.blogspot.com/feeds/2604376871885082183/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951603711668509916&amp;postID=2604376871885082183' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/2604376871885082183'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/2604376871885082183'/><link rel='alternate' type='text/html' href='http://ramprasad-techbook.blogspot.com/2008/03/jar-war-ear.html' title='JAR-WAR-EAR'/><author><name>Ramprasad</name><uri>http://www.blogger.com/profile/16032736524787849385</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951603711668509916.post-5934572670863838900</id><published>2008-03-11T10:43:00.000+05:30</published><updated>2008-03-11T10:45:17.588+05:30</updated><title type='text'>Kernel and Shell</title><content type='html'>The terms shell and kernel are used in operating system.The name is probably derived in comparison with a fruit which has inner kernel as the edible core part and outer shell as a cover.&lt;br /&gt;&lt;br /&gt;A shell is a piece of software that provides an interface for users. Typically, the term refers to an operating system shell which provides access to the services of a kernel. However, the term is also applied very loosely to applications and may include any software that is "built around" a particular component, such as web browsers and email clients that are "shells" for HTML rendering engines. The name 'shell' originates from shells being an outer layer of interface between the user and the innards of the operating system (the kernel). Operating system shells generally fall into one of two categories: command line and graphical. Command line shells provide a command line interface (CLI) to the operating system, while graphical shells provide a graphical user interface (GUI).&lt;br /&gt;&lt;br /&gt;The kernel is the central component of most computer operating systems (OS). Its responsibilities include managing the system's resources (the communication between hardware and software components).As a basic component of an operating system, a kernel provides the lowest-level abstraction layer for the resources (especially memory, processors and I/O devices) that application software must control to perform its function. It typically makes these facilities available to application processes through inter-process communication mechanisms and system calls.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951603711668509916-5934572670863838900?l=ramprasad-techbook.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ramprasad-techbook.blogspot.com/feeds/5934572670863838900/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951603711668509916&amp;postID=5934572670863838900' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/5934572670863838900'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/5934572670863838900'/><link rel='alternate' type='text/html' href='http://ramprasad-techbook.blogspot.com/2008/03/kernel-and-shell.html' title='Kernel and Shell'/><author><name>Ramprasad</name><uri>http://www.blogger.com/profile/16032736524787849385</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951603711668509916.post-2384322086089950183</id><published>2008-03-10T10:37:00.000+05:30</published><updated>2008-03-10T10:40:49.196+05:30</updated><title type='text'>ANT</title><content type='html'>&lt;p&gt;A.N.T. – Another Neat Tool &lt;/p&gt;&lt;p&gt;&lt;br /&gt;It is a software tool for automating software build processes.Building a software means, you have the source code and you would compile and convert it and deploy it in a way so that the software is all set to work. Ant is used for doing all this automatically instead of you doing it.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;Another tool used for building C/C++ code is "make".Ant uses XML to describe the build process and its dependencies, whereas make has its Makefile format. By default the XML file used by ant is named build.xml.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;Ant is operating system and language neutral.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;There are 3 terms to know in ant&lt;/p&gt;&lt;p&gt;1.Project&lt;/p&gt;&lt;p&gt;2.Target&lt;/p&gt;&lt;p&gt;3.Task&lt;br /&gt;The first or root element of any buildfile is always the &lt;project&gt;tag. No buildfile can be without one nor can it have more than one.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;Each 'Project' has a Build File, Default build file name is 'build.xml'However,any name with '-buildfile' command line option can be specified.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;Each buildfile contains one project and at least one (default) target. &lt;/p&gt;&lt;p&gt;&lt;br /&gt;The "A" target lists the "B" target as a dependency means telling Ant that before it can start the "A" target it must first complete the "B" target.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;Targets depend only on other targets and reference them by their target name. Targets NEVER depend on projects or tasks. Target depends are optional.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;Optionally you can pass ant the name of the target to run as a command line argument.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;Within each target are the actions that Ant must take to build that target; these are performed using built-in tasks.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;Tasks could be something like creating a new directory,compiling java&lt;br /&gt;files, creating a jar file etc.&lt;/p&gt;&lt;p&gt; &lt;/p&gt;&lt;p&gt; &lt;/p&gt;&lt;p&gt;&lt;a href="http://ant.apache.org/"&gt;http://ant.apache.org/&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.allapplabs.com/ant/ant_basics.htm"&gt;http://www.allapplabs.com/ant/ant_basics.htm&lt;/a&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951603711668509916-2384322086089950183?l=ramprasad-techbook.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ramprasad-techbook.blogspot.com/feeds/2384322086089950183/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951603711668509916&amp;postID=2384322086089950183' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/2384322086089950183'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/2384322086089950183'/><link rel='alternate' type='text/html' href='http://ramprasad-techbook.blogspot.com/2008/03/ant.html' title='ANT'/><author><name>Ramprasad</name><uri>http://www.blogger.com/profile/16032736524787849385</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951603711668509916.post-3401012996105550282</id><published>2008-03-07T12:34:00.000+05:30</published><updated>2008-03-07T12:35:36.003+05:30</updated><title type='text'>Http way...</title><content type='html'>Http is a stateless protocol of application layer. That means, the way you interact in HTTp is that, suppose client tells something to you in http way, after sometime client tells something to you again, but neither client nor you remember that they had talked sometime before on something. So http way of communicating means, people who are communicating can perceive only the present and there is no link to associate with the past.&lt;br /&gt;&lt;br /&gt;So, that makes it difficult, right ? In web applications client and server talk in http way. You have got some entites like servlets who are there to serve what the client asks. These servlets would have very much appreciated had there been a way, to remember a little bit of past - at least that if they can know that, it was the same client who had come a couple of minutes before asking for a cold coffee and now the same person is asking for hot coffee.&lt;br /&gt;&lt;br /&gt;There are some solutions.&lt;br /&gt;Solution 1 - When the client comes first time, you(imagine you are a servlet) assign a unique id for him. So each time now onwards when this client comes, he has to quote his id. Wait, the client too forgets his id the moment the conversation stops !!. So each sentence you talk to the client, you end your sentence reminding him his id. And each time the client talks to you, he will end his sentence saying his id. So both of you never forget, what was going on before.(This technique is called URL rewriting)&lt;br /&gt;Solution2 - Attach something to client that contains all the info required to track and each time you need to keep updating it. This entity attached to the client is called cookies. Cookies contain the necessary information required to track the conversation and it is absolutely your resposnsibilty to manage it. Client never bothers to check the way cookies are handled. Each time the client comes to you asking something, he will just carry his cookies with him always and you should read it to know the what all has happened so far. Client should not have any objection to store cookies in his side. Some clients may not like to get these cookies attached to them.&lt;br /&gt;Solution3 - Don't put any burden on client.So what can be done is, use sessions instead. As soon as a client comes to you you create an entity called session for him on your side and keep it with you updating it with all the relevant information. When he chooses to quit and stops asking anything from you(i.e browser is closed) you can destroy this entity called session.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951603711668509916-3401012996105550282?l=ramprasad-techbook.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ramprasad-techbook.blogspot.com/feeds/3401012996105550282/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951603711668509916&amp;postID=3401012996105550282' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/3401012996105550282'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/3401012996105550282'/><link rel='alternate' type='text/html' href='http://ramprasad-techbook.blogspot.com/2008/03/http-way.html' title='Http way...'/><author><name>Ramprasad</name><uri>http://www.blogger.com/profile/16032736524787849385</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951603711668509916.post-7741060298693412249</id><published>2008-03-06T10:57:00.000+05:30</published><updated>2008-03-06T11:12:37.972+05:30</updated><title type='text'>Turn .jar into .exe</title><content type='html'>Executor turns your jar file into a Windows executable. When we write a java application, it is quite irritating sometimes to write a batch file and ant script to run it. We do feel, it would have been nice, if it were converted our application to an exe that can run on windows platform so that just a click from your mouse on a cute icon would run the application.&lt;br /&gt;Read:&lt;br /&gt;&lt;a href="http://mpowers.net/executor/"&gt;http://mpowers.net/executor/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;(some excerpts)&lt;br /&gt;Package your Java application as a jar, and Executor will turn the jar into a Windows exe file, indistinguishable from a native application. Simply double-clicking the exe file will invoke the Java Runtime Environment and launch your application.&lt;br /&gt;&lt;br /&gt;This allows you to distribute your Java application as a genuine Win32 binary executable. Your users will never need to run an ugly batch file to run your application. You will not have to distribute any temp or config files along with your executable. You will never need to learn JNI and have a C compiler to make a launcher for your application. You will save the hours of effort needed for writing a native launcher with this one tool.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951603711668509916-7741060298693412249?l=ramprasad-techbook.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ramprasad-techbook.blogspot.com/feeds/7741060298693412249/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951603711668509916&amp;postID=7741060298693412249' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/7741060298693412249'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/7741060298693412249'/><link rel='alternate' type='text/html' href='http://ramprasad-techbook.blogspot.com/2008/03/turn-jar-into-exe.html' title='Turn .jar into .exe'/><author><name>Ramprasad</name><uri>http://www.blogger.com/profile/16032736524787849385</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951603711668509916.post-7779100291859478677</id><published>2008-03-05T13:48:00.000+05:30</published><updated>2008-03-05T14:02:59.382+05:30</updated><title type='text'>XML</title><content type='html'>There are four central problems in data management:&lt;br /&gt;1. Capture&lt;br /&gt;2. Storage,&lt;br /&gt;3. Retrieval&lt;br /&gt;4. Exchange.&lt;br /&gt;XML is a technology mainly for managing data exchange.&lt;br /&gt;&lt;br /&gt;It is a subset of SGML(Standard Generalised Markup Language).Extensible Markup Language. It is called "extensible" because user can define his own elements.&lt;br /&gt;&lt;br /&gt;xml has following elements:--&lt;br /&gt;1. XML document: An XML file containing XML code.&lt;br /&gt;2. XML schema: An XML file that describes the structure of a document and its tags.&lt;br /&gt;3. XML stylesheet: An XML file containing formatting instructions for an XML file.&lt;br /&gt;&lt;br /&gt;xml can be Well-formed or Valid(conforms to a DTD or XML schema)&lt;br /&gt;&lt;br /&gt;DTD is oldest. It has inclusion in the XML 1.0 standard. It has no support for new features such as namespaces. Represented by .dtd files.&lt;br /&gt;&lt;br /&gt;XML schema language is defined by W3C.&lt;br /&gt;More powerful than DTD. Represented by .xsd files.&lt;br /&gt;&lt;br /&gt;Database content can be converted into XML and afterwards into HTML by using an XSLT stylesheet. Making use of this technique, complex websites as well as print media like PDF files can be generated. Information no longer has to be stored in different formats (i.e. RTF, DOC, PDF, HTML). Content can be stored in the neutral XML format and then, using appropriate layout style sheets and transformations, brochures, websites, or datalists can be generated&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951603711668509916-7779100291859478677?l=ramprasad-techbook.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ramprasad-techbook.blogspot.com/feeds/7779100291859478677/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951603711668509916&amp;postID=7779100291859478677' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/7779100291859478677'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951603711668509916/posts/default/7779100291859478677'/><link rel='alternate' type='text/html' href='http://ramprasad-techbook.blogspot.com/2008/03/xml.html' title='XML'/><author><name>Ramprasad</name><uri>http://www.blogger.com/profile/16032736524787849385</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
