<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-14883934</id><updated>2024-09-26T11:47:25.677+10:00</updated><title type='text'>Pradeep&#39;s   Blog</title><subtitle type='html'>New things that I come across in programming and trends in IT</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://pradeepselvaraj.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14883934/posts/default?alt=atom'/><link rel='alternate' type='text/html' href='http://pradeepselvaraj.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/14883934/posts/default?alt=atom&amp;start-index=26&amp;max-results=25'/><author><name>Pradeep Selvaraj</name><uri>http://www.blogger.com/profile/00341137741473142989</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>53</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-14883934.post-116590392252984393</id><published>2006-12-12T16:43:00.000+11:00</published><updated>2006-12-12T17:12:02.616+11:00</updated><title type='text'>Data Mapping Using Xsl</title><content type='html'>In B2B communications resolution of data between trading partners is one of the most important issue. Let’s consider a scenario where your trading partner sends you a Purchase Order and this PO has got only got a shipping address id. Once you get this PO, you must resolve the shipping address id to an actual destination so that your delivery guys can deliver it. Except the few Big ERP systems most ERP systems do not have to capability to resolve this id to a particular address. Hence the data has to be resolved by a pre-process before the PO enters your ERP System.&lt;br /&gt;&lt;br /&gt;Thought there are lots of ways to map information between partners, let me show you how it can be done using an XML mapping file. Let’s also considered that the incoming file is either’s XML or has been transformed to XML. I’ll now show you how an address id can be mapped to the complete address.&lt;br /&gt;&lt;br /&gt;Lets consider that the Xml file that we get have the address id as shown&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;img style=&quot;DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center&quot; alt=&quot;&quot; src=&quot;http://photos1.blogger.com/x/blogger/5442/1361/400/717155/test.jpg&quot; border=&quot;0&quot; /&gt;&lt;br /&gt;Now instead of the ident field inside the partyaddress something like this would be very useful &lt;/p&gt;&lt;p&gt;&lt;img style=&quot;DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center&quot; alt=&quot;&quot; src=&quot;http://photos1.blogger.com/x/blogger/5442/1361/400/870178/test2.jpg&quot; border=&quot;0&quot; /&gt;&lt;br /&gt;In order for us to map the ID to the address we need a mapping file. The actual mapping file could be something like the one shown below; this mapping file will be used in the xsl file to populate the address instead of the address ids.&lt;br /&gt;&lt;img style=&quot;DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center&quot; alt=&quot;&quot; src=&quot;http://photos1.blogger.com/x/blogger/5442/1361/400/44704/mapping.jpg&quot; border=&quot;0&quot; /&gt;Now the Xsl part, this is where the actual mapping is done. In the Xsl file create a variable that reads the mapping file like&lt;br /&gt;&lt;img style=&quot;DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center&quot; alt=&quot;&quot; src=&quot;http://photos1.blogger.com/x/blogger/5442/1361/400/174554/1.jpg&quot; border=&quot;0&quot; /&gt;&lt;br /&gt;Now to get the city mapped we could map it as shown above. Here the @id in the mapping file is compared with the ident field in the main xml file. If they are equal then we get the city name from the mapping file. &lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://pradeepselvaraj.blogspot.com/feeds/116590392252984393/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/14883934/116590392252984393' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14883934/posts/default/116590392252984393'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14883934/posts/default/116590392252984393'/><link rel='alternate' type='text/html' href='http://pradeepselvaraj.blogspot.com/2006/12/data-mapping-using-xsl.html' title='Data Mapping Using Xsl'/><author><name>Pradeep Selvaraj</name><uri>http://www.blogger.com/profile/00341137741473142989</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14883934.post-116227374328328986</id><published>2006-10-31T16:45:00.000+11:00</published><updated>2006-10-31T16:49:03.303+11:00</updated><title type='text'>Google Bomb</title><content type='html'>Before me telling what &lt;a href=&quot;http://google.com&quot;&gt;Google &lt;/a&gt;Bomb is try searching for &lt;a href=&quot;http://www.google.com.au/search?sourceid=navclient&amp;ie=UTF-8&amp;amp;rls=GGLD,GGLD:2005-14,GGLD:en&amp;q=miserable+failure+&quot;&gt;miserable failure &lt;/a&gt;or &lt;a href=&quot;http://www.google.com.au/search?sourceid=navclient&amp;amp;ie=UTF-8&amp;rls=GGLD,GGLD:2005-14,GGLD:en&amp;amp;q=failure&quot;&gt;failure&lt;/a&gt; and &lt;a href=&quot;http://www.google.com.au/search?sourceid=navclient&amp;ie=UTF-8&amp;amp;rls=GGLD,GGLD:2005-14,GGLD:en&amp;amp;q=liar&quot;&gt;liar&lt;/a&gt; in &lt;a href=&quot;http://google.com&quot;&gt;Google&lt;/a&gt;. Got the answer? Those two are perfect examples of Google bombing. As you all know &lt;a href=&quot;http://google.com&quot;&gt;Google Search&lt;/a&gt; has a set of rules by which it ranks pages. So once you understand how these rules work, you can build pages that get better ranking for a particular keyword. The most important criterion for page ranking by &lt;a href=&quot;http://google.com&quot;&gt;Google&lt;/a&gt; is the number of pages that link to your page with that keyword. Now that you know this, you can increase the page rank of your webpage for a certain keyword, by increasing the number of links to your page with that keyword. The more the number of pages that link to you with the specific keyword the better the ranking.&lt;br /&gt;The process of influencing Google’s ranking by flooding the pages on the net, with links to a particular page (with a certain keyword) is known as Google Bomb. Most of these Bombs are dropped for commercial reasons.</content><link rel='replies' type='application/atom+xml' href='http://pradeepselvaraj.blogspot.com/feeds/116227374328328986/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/14883934/116227374328328986' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14883934/posts/default/116227374328328986'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14883934/posts/default/116227374328328986'/><link rel='alternate' type='text/html' href='http://pradeepselvaraj.blogspot.com/2006/10/google-bomb.html' title='Google Bomb'/><author><name>Pradeep Selvaraj</name><uri>http://www.blogger.com/profile/00341137741473142989</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14883934.post-115848637753978983</id><published>2006-09-17T19:18:00.000+10:00</published><updated>2006-09-17T19:52:18.906+10:00</updated><title type='text'>Deploying AJAX application created using Google’s Web Toolkit</title><content type='html'>&lt;div align=&quot;justify&quot;&gt;&lt;strong&gt;AJAX &lt;/strong&gt;without java script! Few months back and I wouldn’t have believed this would be possible. With &lt;a href=&quot;http://code.google.com/webtoolkit/&quot;&gt;Google’s Web Toolkit &lt;/a&gt;you could code your &lt;strong&gt;AJAX&lt;/strong&gt; applications in &lt;a href=&quot;http://java.sun.com/&quot;&gt;Java&lt;/a&gt;, and it converts it into Java script for you. Any application created using this Toolkit has three parts to it. First the client side code, this is the code that gets converted into Java script (and runs on the browser) , then the server side code this is the part of the application that runs in your web server (like &lt;a href=&quot;http://tomcat.apache.org/&quot;&gt;Tomcat&lt;/a&gt;), then the public files, these can be any images or other files that are required by your application.&lt;br /&gt;&lt;br /&gt;Since the client side code is translated into Java script, your client side code can only have features that a normal web browser can support (So features like Threads are not supported). In the server side code you can do any thing that Java supports.&lt;br /&gt;&lt;br /&gt;The &lt;a href=&quot;http://code.google.com/webtoolkit/&quot;&gt;Google’s web toolkit &lt;/a&gt;supports two modes for running your &lt;strong&gt;AJAX&lt;/strong&gt; applications. The first one is the hosted mode; this mode is very useful while developing the application. In this mode &lt;a href=&quot;http://google.com&quot;&gt;Google’s&lt;/a&gt; simulates the output of your application. The other mode is the web mode. In this mode the &lt;a href=&quot;http://java.sun.com/&quot;&gt;Java &lt;/a&gt;code is compiled into Java script code and you can run your application from a web server.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The documentation provided by Google for deploying the application in web mode is very limited. I recently deployed my application in &lt;a href=&quot;http://tomcat.apache.org/&quot;&gt;Tomcat 5.5&lt;/a&gt; and these are the steps that I followed,&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;1. Use the application.compile.cmd file to create all the client side files. These files would be placed in the www directory.&lt;br /&gt;2. Get all the server side files compiled.&lt;br /&gt;&lt;br /&gt;Consider that we are going to deploy in the ROOT directory in a tomcat.&lt;br /&gt;&lt;br /&gt;1. Copy all the client side files (the content of the www directory) into the ROOT directory in tomcat.&lt;br /&gt;2. Then copy all the classes (server side) files to ROOT/WEB-INF/Classes directory.&lt;br /&gt;3. If there are any dependent jar files copy them to ROOT/WEB-INF/lib directory. [NOTE: The packages javax.servelt.*; have to be removed from both the jar files that are provided by Google].&lt;br /&gt;4. Then map the server side servlets (the classes that talk to the client) via the web.xml file in the ROOT/WEB-INF directory.&lt;br /&gt;&lt;br /&gt;The url pattern in the servlet mapping should be same in the client code, the application.gwt.xml and in the web.xml files.&lt;br /&gt;&lt;/div&gt;&lt;div align=&quot;justify&quot;&gt;If even after following these steps you have problems running you application in web mode, see your web server&#39;s logs for more information. &lt;/div&gt;&lt;div align=&quot;justify&quot;&gt;&lt;/div&gt;&lt;div align=&quot;justify&quot;&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://pradeepselvaraj.blogspot.com/feeds/115848637753978983/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/14883934/115848637753978983' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14883934/posts/default/115848637753978983'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14883934/posts/default/115848637753978983'/><link rel='alternate' type='text/html' href='http://pradeepselvaraj.blogspot.com/2006/09/deploying-ajax-application-created.html' title='Deploying AJAX application created using Google’s Web Toolkit'/><author><name>Pradeep Selvaraj</name><uri>http://www.blogger.com/profile/00341137741473142989</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14883934.post-115586029540728156</id><published>2006-08-18T09:33:00.000+10:00</published><updated>2006-08-18T10:20:05.900+10:00</updated><title type='text'>Ajax</title><content type='html'>&lt;div style=&quot;text-align: justify;&quot;&gt;Over the past few months there has been a buzz about the term &lt;span style=&quot;font-weight: bold;&quot;&gt;AJAX&lt;/span&gt;. &lt;span style=&quot;font-weight: bold;&quot;&gt;AJAX&lt;/span&gt; stands for &lt;span style=&quot;font-weight: bold;&quot;&gt;A&lt;/span&gt;synchronous &lt;span style=&quot;font-weight: bold;&quot;&gt;J&lt;/span&gt;avascript &lt;span style=&quot;font-weight: bold;&quot;&gt;A&lt;/span&gt;nd&lt;span style=&quot;font-weight: bold;&quot;&gt; X&lt;/span&gt;ML.&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;AJAX&lt;/span&gt; as a technology came into the spotlight mainly after Google (GMail) started using it. But &lt;span style=&quot;font-weight: bold;&quot;&gt;AJAX&lt;/span&gt; is not a completely new technology, it&#39;s old technology with some new tricks to improve the interactiveness of the webpages.&lt;br /&gt;&lt;br /&gt;One good news for coders is that you probably know most of the technologies behind building &lt;span style=&quot;font-weight: bold;&quot;&gt;AJAX&lt;/span&gt; applications. Some of the technologies involved are HTML, Javascript, DOM, and XML. &lt;span style=&quot;font-weight: bold;&quot;&gt;AJAX&lt;/span&gt; appliactions are much more responsive because they are able to send requests to the server without actually reloading the whole page. This is achieved by using the XMLHttpRequest object. The XMLHttpRequest Object enables us to bypass the normal request mechanism followed by the web pages (where the whole page actually reloads) . Instead this object along with Javascript makes it possible to send information to the server without actually refreshing the page, and thus improving interactiveness.&lt;br /&gt;&lt;br /&gt;Even Microsoft has taken note of the huge popularity of &lt;span style=&quot;font-weight: bold;&quot;&gt;AJAX &lt;/span&gt;and (as always) has planned to have &quot;it&#39;s own&quot; &lt;span style=&quot;font-weight: bold;&quot;&gt;AJAX&lt;/span&gt;, which is to be integrated with ASP.Net soon.&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://pradeepselvaraj.blogspot.com/feeds/115586029540728156/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/14883934/115586029540728156' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14883934/posts/default/115586029540728156'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14883934/posts/default/115586029540728156'/><link rel='alternate' type='text/html' href='http://pradeepselvaraj.blogspot.com/2006/08/ajax.html' title='Ajax'/><author><name>Pradeep Selvaraj</name><uri>http://www.blogger.com/profile/00341137741473142989</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14883934.post-115311460960358031</id><published>2006-07-17T14:26:00.000+10:00</published><updated>2006-07-17T15:41:59.436+10:00</updated><title type='text'>Search Engine Optimization  Tools</title><content type='html'>&lt;div align=&quot;justify&quot;&gt;As a search engine optimiser (SEO) you definitely require a set of tools that display your ranking in various search engines, generate keyword, analyse backlinks, etc. Listed below are the various free tools that are available on the net for SEO. &lt;/div&gt;&lt;br /&gt;&lt;strong&gt;Ranking in various search engines:&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;&lt;a href=&quot;http://www.googlerankings.com/&quot;&gt;http://www.googlerankings.com/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;div align=&quot;justify&quot;&gt;In order to use this tool you need to register with Google and get an API key. This tool enables users to check the rank of your web site for a certain key word with Google, Yahoo and Msn.&lt;br /&gt;&lt;br /&gt;I was able to get a high ranking of 16 for my site for the key words “software complexity”. &lt;/div&gt;&lt;div align=&quot;justify&quot;&gt; &lt;/div&gt;&lt;div align=&quot;justify&quot;&gt;&lt;/div&gt;&lt;div align=&quot;justify&quot;&gt;&lt;strong&gt;Keyword Suggestions/Density Checker:&lt;/strong&gt; &lt;/div&gt;&lt;div align=&quot;justify&quot;&gt;&lt;/div&gt;&lt;div align=&quot;justify&quot;&gt; &lt;/div&gt;&lt;div align=&quot;justify&quot;&gt;Though most search engines do not consider the keywords anymore for better ranking, its better to have appropriate keywords in your sites. These tools can help you in deciding keywords.&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://googlerankings.com/ultimate_seo_tool.php&quot;&gt;http://googlerankings.com/ultimate_seo_tool.php&lt;/a&gt;&lt;br /&gt;&lt;a href=&quot;https://adwords.google.com/select/KeywordToolExternal&quot;&gt;https://adwords.google.com/select/KeywordToolExternal&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Though these tool are good it would have been better if it could narrow down the keywords rather that giving a big list for us to choose from.&lt;/div&gt;&lt;div align=&quot;justify&quot;&gt; &lt;/div&gt;&lt;div align=&quot;justify&quot;&gt;&lt;/div&gt;&lt;div align=&quot;justify&quot;&gt;&lt;strong&gt;Other tools:&lt;/strong&gt;&lt;/div&gt;&lt;div align=&quot;justify&quot;&gt;&lt;strong&gt;&lt;/strong&gt; &lt;/div&gt;&lt;div align=&quot;justify&quot;&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/div&gt;&lt;div align=&quot;justify&quot;&gt;These are other third party tools that are available for free on these sites&lt;br /&gt;&lt;a href=&quot;http://www.webconfs.com/&quot;&gt;http://www.webconfs.com/&lt;/a&gt;&lt;br /&gt;&lt;a href=&quot;http://www.seochat.com/seo-tools/&quot;&gt;http://www.seochat.com/seo-tools/&lt;/a&gt;&lt;br /&gt;&lt;a href=&quot;http://www.seocompany.ca/tool/seo-tools.html&quot;&gt;http://www.seocompany.ca/tool/seo-tools.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Though these sites provide free tools using Google’s API, I consider most of the functionality provided by these tools to be redundant. &lt;/div&gt;&lt;div align=&quot;justify&quot;&gt;&lt;/div&gt;&lt;div align=&quot;justify&quot;&gt;&lt;strong&gt;&lt;/strong&gt; &lt;/div&gt;&lt;div align=&quot;justify&quot;&gt;&lt;strong&gt;Google’s Alert:&lt;/strong&gt; &lt;/div&gt;&lt;div align=&quot;justify&quot;&gt;&lt;br /&gt;One other good tool that might help webmaster to get more backlinks to their sites is to register with Google alert. With this alerting facility you can easily build more backlinks. Click here to register &lt;a href=&quot;http://www.google.com/alerts&quot;&gt;http://www.google.com/alerts&lt;/a&gt;&lt;/div&gt;&lt;div align=&quot;justify&quot;&gt; &lt;/div&gt;&lt;div align=&quot;justify&quot;&gt; &lt;/div&gt;&lt;div align=&quot;justify&quot;&gt; &lt;/div&gt;&lt;div align=&quot;justify&quot;&gt;&lt;/div&gt;&lt;div align=&quot;justify&quot;&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://pradeepselvaraj.blogspot.com/feeds/115311460960358031/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/14883934/115311460960358031' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14883934/posts/default/115311460960358031'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14883934/posts/default/115311460960358031'/><link rel='alternate' type='text/html' href='http://pradeepselvaraj.blogspot.com/2006/07/search-engine-optimization-tools.html' title='Search Engine Optimization  Tools'/><author><name>Pradeep Selvaraj</name><uri>http://www.blogger.com/profile/00341137741473142989</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14883934.post-115188543550910354</id><published>2006-07-03T10:07:00.000+10:00</published><updated>2006-07-03T10:10:35.530+10:00</updated><title type='text'>Passing parameters to XSL from Java</title><content type='html'>Generating a HTML from XML can be done using the javax.xml.transform class in the Java’s API. The transformation can be done using the code below;&lt;br /&gt;&lt;br /&gt;TransformerFactory tFactory = TransformerFactory.newInstance();&lt;br /&gt; Transformer transformer =  tFactory.newTransformer&lt;br /&gt;                                             (new javax.xml.transform.stream.StreamSource(xslFileName));&lt;br /&gt;transformer.transform(new javax.xml.transform.stream.StreamSource&lt;br /&gt;(xmlFileName),new javax.xml.transform.stream.StreamResult&lt;br /&gt;                                                ( new FileOutputStream(htmlFileName)));&lt;br /&gt;&lt;br /&gt;Note: Remember to provide the correct XSL, XML and HTML file names and the XSL and the XML file should be valid (i.e. all tags should be closed properly)&lt;br /&gt;&lt;br /&gt;Now, suppose you want to customise the HTML output depending on certain criteria in your program, how do you do that? This can be done by sending information to the XSL file as parameters. So, the next big question, how can parameters be passed into the XSL file from a java programme?&lt;br /&gt;The javax.xml.transform class provides you with a method called &lt;a href=&quot;http://java.sun.com/j2se/1.4.2/docs/api/javax/xml/transform/Transformer.html#setParameter(java.lang.String,&quot;&gt;setParameter&lt;/a&gt;(&lt;a title=&quot;class in java.lang&quot; href=&quot;http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html&quot;&gt;String&lt;/a&gt; name, &lt;a title=&quot;class in java.lang&quot; href=&quot;http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Object.html&quot;&gt;Object&lt;/a&gt; value). An example of this is given below;&lt;br /&gt;&lt;br /&gt;Timestamp ts = new Timestamp(System.currentTimeMillis());&lt;br /&gt; transformer.setParameter(&quot;timestamp&quot;, ts);&lt;br /&gt;&lt;br /&gt;Here the timestamp is passed to the XSL filename. The XSL file can get this value by using a global param field as shown below. &lt;br /&gt;&amp;lt;xsl:param name=&quot;timestamp&quot;/&gt;&lt;br /&gt;&lt;br /&gt;and used like this&lt;br /&gt;&amp;lt;xsl:value-of select=&quot;$timestamp&quot;/&gt;&lt;br /&gt;&lt;br /&gt;to print the time that is obtained from the java class.&lt;br /&gt;&lt;br /&gt;Note: The parameter name in the XSL should match the one in the java class.</content><link rel='replies' type='application/atom+xml' href='http://pradeepselvaraj.blogspot.com/feeds/115188543550910354/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/14883934/115188543550910354' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14883934/posts/default/115188543550910354'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14883934/posts/default/115188543550910354'/><link rel='alternate' type='text/html' href='http://pradeepselvaraj.blogspot.com/2006/07/passing-parameters-to-xsl-from-java.html' title='Passing parameters to XSL from Java'/><author><name>Pradeep Selvaraj</name><uri>http://www.blogger.com/profile/00341137741473142989</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14883934.post-115183979003288486</id><published>2006-07-02T21:28:00.000+10:00</published><updated>2006-07-02T21:29:50.046+10:00</updated><title type='text'>CyVis v0.9.0 Released!</title><content type='html'>Are you a Java developer? Do you want a tool that visualises the complexity of your software? We have just released the first public version of CyVis.&lt;br /&gt;CyVis is a software metrics collection, analysis and visualisation tool for software built using Java. It enables developers to identify complex part of their software very easily.&lt;br /&gt;CyVis collects data from java class or jar files hence there is no need for the actual source code.  Once the metrics are collected, the statistical information is shown in a way that enables you to immediately detect which part of your software is complicated and which is not.&lt;br /&gt;CyVis can either be integrated with your Ant script or used in command interface to generate reports. It also has a GUI Interface which we consider to be of great help to its users. &lt;br /&gt;Try this cute little tool once and you will love it. Visit &lt;a href=&quot;http://cyvis.sourceforge.net/&quot;&gt;http://cyvis.sourceforge.net&lt;/a&gt;  for more information.</content><link rel='replies' type='application/atom+xml' href='http://pradeepselvaraj.blogspot.com/feeds/115183979003288486/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/14883934/115183979003288486' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14883934/posts/default/115183979003288486'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14883934/posts/default/115183979003288486'/><link rel='alternate' type='text/html' href='http://pradeepselvaraj.blogspot.com/2006/07/cyvis-v090-released.html' title='CyVis v0.9.0 Released!'/><author><name>Pradeep Selvaraj</name><uri>http://www.blogger.com/profile/00341137741473142989</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14883934.post-114946811970032732</id><published>2006-06-05T10:35:00.000+10:00</published><updated>2006-06-05T10:49:21.243+10:00</updated><title type='text'>Writing Custom Ant Task</title><content type='html'>&lt;div align=&quot;justify&quot;&gt;I wanted to create an &lt;a href=&quot;http://ant.apache.org/&quot;&gt;Ant&lt;/a&gt; task for a project (&lt;a href=&quot;http://sourceforge.net/projects/cyvis&quot;&gt;CyVis&lt;/a&gt; - a free software metrics collection and analysis tool for java based software) that I am working on. Writing our own Ant task is actually very simple. This blog explains how to write a very simple (something like a hello world) task that can be integrated into ant.&lt;br /&gt;&lt;br /&gt;First write a class that extends org.apache.tools.ant.Task. Then for each attribute, write a setter method like the HelloTask class shown below.&lt;br /&gt;&lt;/div&gt;&lt;p&gt;&lt;a href=&quot;http://photos1.blogger.com/blogger/5442/1361/1600/3.png&quot;&gt;&lt;img style=&quot;DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center&quot; alt=&quot;&quot; src=&quot;http://photos1.blogger.com/blogger/5442/1361/320/3.png&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p align=&quot;justify&quot;&gt;Now compile the class and place it in the classpath or in the same dir as the Ant home directory in order to use the task. Then you can call you task as shown in the script below. Note that before you can use your task, you should use taskdef to define it. &lt;/p&gt;&lt;p align=&quot;justify&quot;&gt;&lt;img style=&quot;DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center&quot; alt=&quot;&quot; src=&quot;http://photos1.blogger.com/blogger/5442/1361/320/2.png&quot; border=&quot;0&quot; /&gt;&lt;/p&gt;&lt;p align=&quot;justify&quot;&gt;I had placed the HelloTask class file in a jar file and placed the jar file in the Ant’s home directory. You can either do this or define a classpath to say where it’s placed. Running this Ant script would print out some thing like this:&lt;br /&gt;&lt;img style=&quot;DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center&quot; alt=&quot;&quot; src=&quot;http://photos1.blogger.com/blogger/5442/1361/320/4.png&quot; border=&quot;0&quot; /&gt;&lt;br /&gt;For more complex examples see the&lt;a href=&quot;http://ant.apache.org/manual/develop.html#writingowntask&quot;&gt; Ant’s documentation.&lt;br /&gt;&lt;/a&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://pradeepselvaraj.blogspot.com/feeds/114946811970032732/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/14883934/114946811970032732' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14883934/posts/default/114946811970032732'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14883934/posts/default/114946811970032732'/><link rel='alternate' type='text/html' href='http://pradeepselvaraj.blogspot.com/2006/06/writing-custom-ant-task.html' title='Writing Custom Ant Task'/><author><name>Pradeep Selvaraj</name><uri>http://www.blogger.com/profile/00341137741473142989</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14883934.post-114886410703800182</id><published>2006-05-29T10:48:00.000+10:00</published><updated>2006-05-29T11:09:38.646+10:00</updated><title type='text'>Customizing JTree</title><content type='html'>&lt;div align=&quot;justify&quot;&gt;The default look and feel that the JTree provides might not be reasonable for certain applications. For example, the tree structure in &lt;a href=&quot;http://www.eclipse.org/&quot;&gt;eclipse&lt;/a&gt; has its own custom icons to represent different things (packages, java files, text files, etc). Let’s have a look at how to customise the JTree, so that we can get to a level of customization as shown below. &lt;/div&gt;&lt;div align=&quot;justify&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;p&gt;&lt;img style=&quot;DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center&quot; alt=&quot;&quot; src=&quot;http://photos1.blogger.com/blogger/5442/1361/320/eclipseimg.jpg&quot; border=&quot;0&quot; /&gt; There are actually two ways of doing the customization. The first method is straight-forward and this is all that you have to do:&lt;br /&gt;&lt;br /&gt;1. Create the tree structure.&lt;br /&gt;2. Create an object of DefaultTableCellRenderer and set the icons as shown below:&lt;/p&gt;&lt;p&gt;&lt;br /&gt;ImageIcon customLeafIcon = new ImageIcon(“class.gif”);&lt;br /&gt;DefaultTreeCellRenderer renderer = new DefaultTreeCellRenderer(); renderer.setLeafIcon(customLeafIcon);&lt;br /&gt;tree.setCellRenderer(renderer);&lt;br /&gt;&lt;br /&gt;The tree would look something like this now. &lt;/p&gt;&lt;p&gt;&lt;a href=&quot;http://photos1.blogger.com/blogger/5442/1361/1600/1.1.jpg&quot;&gt;&lt;img style=&quot;DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center&quot; alt=&quot;&quot; src=&quot;http://photos1.blogger.com/blogger/5442/1361/320/1.0.jpg&quot; border=&quot;0&quot; /&gt;&lt;/a&gt; Similarly you can change lots of other things. For more details have a look at the &lt;a href=&quot;http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/table/DefaultTableCellRenderer.html&quot;&gt;API&lt;/a&gt;. There are some drawbacks to this method such as, all leaf node icons being the same. So for those of you who would like to tweak a bit more, method two would serve as the better alternative.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;The second method is not as simple as the first one. This is what you have to do.&lt;br /&gt;&lt;br /&gt;1. Create the tree structure.&lt;br /&gt;2. Create a class that extends the DefaultTableCellRenderer class.&lt;br /&gt;3. Override the method getTreeCellRendererComponent&lt;br /&gt;4. Do all the customization in this method.&lt;br /&gt;5. Create an object of the class that we just created, and set it as the new tree cell renderer.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;TreeRenderer renderer = new TreeRenderer();&lt;/p&gt;&lt;p&gt;tree.setCellRenderer(renderer); &lt;/p&gt;&lt;p&gt;The code for the class that extends DefaultTableCellRenderer would look something like this:&lt;/p&gt;&lt;p&gt;&lt;img style=&quot;DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center&quot; alt=&quot;&quot; src=&quot;http://photos1.blogger.com/blogger/5442/1361/320/2.0.jpg&quot; border=&quot;0&quot; /&gt;And the resulting tree would look something like this.&lt;br /&gt;&lt;a href=&quot;http://photos1.blogger.com/blogger/5442/1361/1600/3.1.jpg&quot;&gt;&lt;img style=&quot;DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center&quot; alt=&quot;&quot; src=&quot;http://photos1.blogger.com/blogger/5442/1361/320/3.0.jpg&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://pradeepselvaraj.blogspot.com/feeds/114886410703800182/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/14883934/114886410703800182' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14883934/posts/default/114886410703800182'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14883934/posts/default/114886410703800182'/><link rel='alternate' type='text/html' href='http://pradeepselvaraj.blogspot.com/2006/05/customizing-jtree.html' title='Customizing JTree'/><author><name>Pradeep Selvaraj</name><uri>http://www.blogger.com/profile/00341137741473142989</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14883934.post-114825798724661163</id><published>2006-05-22T09:46:00.000+10:00</published><updated>2006-05-22T10:33:07.333+10:00</updated><title type='text'>Session Façade:</title><content type='html'>Session façade is one of the design patterns used in enterprise applications. Before I explain how it’s actually implemented lets have a look at the various components that make up the enterprise system.&lt;br /&gt;1. Client: Either a browser or a custom software.&lt;br /&gt;2. Session beans: This is where all the business logic takes place in the enterprise system.&lt;br /&gt;3. Entity Bean: It represents the database in object form.&lt;br /&gt;4. And lastly the database.&lt;br /&gt;&lt;br /&gt;Now let’s see how session façade can be implemented for a banking application. Let’s consider that the client can access his account via a browser or ATM. If the client wants to transfer money, from his account to another account, there are few things that have to be done by the bank; check his authorization and his balance.&lt;br /&gt;&lt;br /&gt;In session façade the client software would never talk directly to the data base (i.e. the entity bean representing the database) instead it would talk to the session bean where, all the business logic like checking his credit balance and his password would be done. It’s the session bean that talks to the entity bean to get the required data to validate and perform the transfer.&lt;br /&gt;&lt;br /&gt;The diagram below shows what I have explained. &lt;div align=&quot;justify&quot;&gt;&lt;/div&gt;&lt;div align=&quot;justify&quot;&gt;&lt;img style=&quot;DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center&quot; alt=&quot;&quot; src=&quot;http://photos1.blogger.com/blogger/5442/1361/320/architecture.0.jpg&quot; border=&quot;0&quot; /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://pradeepselvaraj.blogspot.com/feeds/114825798724661163/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/14883934/114825798724661163' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14883934/posts/default/114825798724661163'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14883934/posts/default/114825798724661163'/><link rel='alternate' type='text/html' href='http://pradeepselvaraj.blogspot.com/2006/05/session-faade.html' title='Session Façade:'/><author><name>Pradeep Selvaraj</name><uri>http://www.blogger.com/profile/00341137741473142989</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14883934.post-114765372574596544</id><published>2006-05-15T10:34:00.000+10:00</published><updated>2006-05-15T11:27:50.963+10:00</updated><title type='text'>Creating Custom Charts in Java</title><content type='html'>I am working on an application that required me to draw custom charts. This is what I was required to do: Draw a chart that consists of smaller graphs (which should each have tool tips) and the chart itself should be scrollable. This blog explains how this can be done and the problems I am facing.&lt;br /&gt;&lt;br /&gt;This is what I had as a plan before I started coding,&lt;br /&gt;&lt;div align=&quot;justify&quot;&gt;&lt;/div&gt;&lt;div align=&quot;justify&quot;&gt;1. For the chart, it has to extend JComponent, so that we can add the graphs to it and to make it scrollable depending on the number of graphs added.&lt;br /&gt;2. The graphs too should extend JComponent so that we can have tool tips on them.&lt;br /&gt;&lt;br /&gt;So the code came up something like this &lt;/div&gt;&lt;div align=&quot;justify&quot;&gt;&lt;/div&gt;&lt;img style=&quot;DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center&quot; alt=&quot;&quot; src=&quot;http://photos1.blogger.com/blogger/5442/1361/400/chartComponent.png&quot; border=&quot;0&quot; /&gt; &lt;div align=&quot;justify&quot;&gt;&lt;/div&gt;&lt;div align=&quot;justify&quot;&gt;&lt;/div&gt;&lt;div align=&quot;justify&quot;&gt;&lt;img style=&quot;DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center&quot; alt=&quot;&quot; src=&quot;http://photos1.blogger.com/blogger/5442/1361/400/graphComponent.0.png&quot; border=&quot;0&quot; /&gt;&lt;br /&gt;&lt;/div&gt;&lt;p align=&quot;left&quot;&gt;&lt;/p&gt;&lt;p align=&quot;justify&quot;&gt;&lt;br /&gt;The most important thing in this is to overload the getPreferredSize() method in the graph Component. If this is not done then the graph are given a default size of (0, 0) and the graphs don’t appear. So it’s important to calculate the size of the graph and return it in that method.&lt;br /&gt;The main problem that I am  facing is, in deciding the layout manager and the size of the graphs (which is being worked on). &lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://pradeepselvaraj.blogspot.com/feeds/114765372574596544/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/14883934/114765372574596544' title='7 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14883934/posts/default/114765372574596544'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14883934/posts/default/114765372574596544'/><link rel='alternate' type='text/html' href='http://pradeepselvaraj.blogspot.com/2006/05/creating-custom-charts-in-java.html' title='Creating Custom Charts in Java'/><author><name>Pradeep Selvaraj</name><uri>http://www.blogger.com/profile/00341137741473142989</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>7</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14883934.post-114704871595558332</id><published>2006-05-08T10:38:00.000+10:00</published><updated>2006-05-08T10:38:35.970+10:00</updated><title type='text'>Progress bar for your application:</title><content type='html'>&lt;div align=&quot;justify&quot;&gt;Majority of applications need progress bars to show the progress of time consuming operations. Most people have common questions like: Do I need Threads? How to integrate progress bar into my application? This blog answers these common questions.&lt;br /&gt;&lt;br /&gt;As for the first question, yes, you need Threads. Without Threads you cannot multitask, meaning you cannot update the progress bar while your time consuming task is running.&lt;br /&gt;&lt;br /&gt;The next question is how to integrate progress bar using Threads? Let’s assume that you have a time consuming task in class A. In order to use thread make this class extend Thread. Put the time consuming task in the run method (This enables the task to run in a separate thread by calling the start () method with an object of class A). In this class have an integer variable that you increment according to the progress of your task.&lt;br /&gt;&lt;br /&gt;Most applications make the progress bar to popup in a new window. So have it in another class that extends JDialog or JFrame. Add a timer to this class with an action listener added to it. In the action performed method get the integer from class A and set the progress bar’s value to it.&lt;br /&gt;&lt;br /&gt;Now that we have both the classes, you can start the task &amp;amp; the progress bar by calling the start () function in class A, followed immediately by a function that starts the timer in the progress bar class. &lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://pradeepselvaraj.blogspot.com/feeds/114704871595558332/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/14883934/114704871595558332' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14883934/posts/default/114704871595558332'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14883934/posts/default/114704871595558332'/><link rel='alternate' type='text/html' href='http://pradeepselvaraj.blogspot.com/2006/05/progress-bar-for-your-application.html' title='Progress bar for your application:'/><author><name>Pradeep Selvaraj</name><uri>http://www.blogger.com/profile/00341137741473142989</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14883934.post-114643203024953713</id><published>2006-05-01T07:17:00.000+10:00</published><updated>2006-05-01T10:00:41.726+10:00</updated><title type='text'>Finding Class Dependencies in Java</title><content type='html'>A requirement for our project, CyVis, was to find the classes that a particular class is dependent on. Finding the class dependencies for a particular class can be done as follows&lt;br /&gt;&lt;br /&gt;1. Get the type of all the variables declared in the class. This includes the global variables and local variables in all the methods.&lt;br /&gt;2. Get the return type for all the methods.&lt;br /&gt;3. The type of exception thrown in all the methods.&lt;br /&gt;4. The class that the particular class extends.&lt;br /&gt;5. The interface that the particular class implements.&lt;br /&gt;&lt;br /&gt;These five would give us a list of classes, that the particular class is dependent upon. Given below is a code snippet that shows, the things you have to look for in order to find the dependent classes. How you find that is up to you. I am using ASM to get this information directly from the class files.&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://photos1.blogger.com/blogger/5442/1361/1600/myClass.png&quot;&gt;&lt;img style=&quot;DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center&quot; alt=&quot;&quot; src=&quot;http://photos1.blogger.com/blogger/5442/1361/400/myClass.png&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;The import statements do not necessarily give you the actual list of dependent classes. There may be some imports that are actually not needed. For the above class the dependent classes can be found from the fields that I have circled.</content><link rel='replies' type='application/atom+xml' href='http://pradeepselvaraj.blogspot.com/feeds/114643203024953713/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/14883934/114643203024953713' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14883934/posts/default/114643203024953713'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14883934/posts/default/114643203024953713'/><link rel='alternate' type='text/html' href='http://pradeepselvaraj.blogspot.com/2006/05/finding-class-dependencies-in-java.html' title='Finding Class Dependencies in Java'/><author><name>Pradeep Selvaraj</name><uri>http://www.blogger.com/profile/00341137741473142989</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14883934.post-114643166064372062</id><published>2006-05-01T07:09:00.000+10:00</published><updated>2006-05-01T10:02:42.416+10:00</updated><title type='text'>Using Derby from Command Line</title><content type='html'>&lt;div align=&quot;justify&quot;&gt;Is there a way to add tables into &lt;a href=&quot;http://db.apache.org/derby/&quot;&gt;Derby&lt;/a&gt; from command line? The answer is yes. Let’s have a look at how it can be done. &lt;a href=&quot;http://db.apache.org/derby/&quot;&gt;Derby&lt;/a&gt; provides us tools (java programs), that enable us to create, delete, select and update tables in the database from the command line. Given below is a batch file that enables us to access the database. &lt;/div&gt;&lt;div align=&quot;left&quot;&gt;&lt;br /&gt;&lt;span style=&quot;color:#666666;&quot;&gt;***********Batch File *****************&lt;br /&gt;@echo off&lt;br /&gt;rem -- Run Derby ij --&lt;br /&gt;set LIBPATH=C:\Sun\AppServer\derby\lib&lt;br /&gt;java -classpath&lt;/span&gt;&lt;/div&gt;&lt;div align=&quot;left&quot;&gt;&lt;span style=&quot;color:#666666;&quot;&gt;&quot;%LIBPATH%\derbytools.jar;%LIBPATH%\derby.jar;%LIBPATH%\derbyclient.jar&quot; org.apache.derby.tools.ij %1.&lt;br /&gt;**********End of Batch File ************&lt;/span&gt;&lt;/div&gt;&lt;div align=&quot;left&quot;&gt;&lt;span style=&quot;color:#666666;&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div align=&quot;justify&quot;&gt;&lt;/div&gt;&lt;div align=&quot;justify&quot;&gt;&lt;/div&gt;&lt;div align=&quot;justify&quot;&gt; &lt;/div&gt;&lt;div align=&quot;justify&quot;&gt;This batch file actually sets that classpath and runs a java program with the argument that we pass along. This argument is a file containing the SQL command that we would like to run. Given below is a text file containing a SQL create statement. &lt;/div&gt;&lt;div align=&quot;justify&quot;&gt;&lt;/div&gt;&lt;div align=&quot;justify&quot;&gt;&lt;/div&gt;&lt;div align=&quot;left&quot;&gt;&lt;span style=&quot;color:#666666;&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div align=&quot;left&quot;&gt;&lt;span style=&quot;color:#666666;&quot;&gt;&lt;/span&gt; &lt;/div&gt;&lt;div align=&quot;left&quot;&gt;&lt;span style=&quot;color:#666666;&quot;&gt;&lt;/span&gt; &lt;/div&gt;&lt;div align=&quot;left&quot;&gt;&lt;span style=&quot;color:#666666;&quot;&gt;*********Text File ********************&lt;br /&gt;connect &#39;jdbc:derby://localhost/testdb;create=true&#39; user &#39;app&#39; password &#39;app&#39;;&lt;br /&gt;CREATE TABLE test_table (&lt;br /&gt;col1 VARCHAR(24) NOT NULL,&lt;br /&gt;col2 VARCHAR(24),&lt;br /&gt;col3 VARCHAR(24),&lt;br /&gt;CONSTRAINT pk_test_table PRIMARY KEY (col1)&lt;br /&gt;);&lt;br /&gt;disconnect;&lt;br /&gt;********* End Of Text File **************&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;The first and last line of the text file enable us to connects and disconnect with Derby. Any SQL statements that you want to run can be written in the middle. Considering that you have saved the batch file as runDerby.bat &amp;amp; the text file as sql.txt. You can run the SQL statement in the text file on &lt;a href=&quot;http://db.apache.org/derby/&quot;&gt;Derby&lt;/a&gt; as follows.&lt;br /&gt;&lt;br /&gt;Prompt&gt; runDerby sql.txt&lt;br /&gt;&lt;br /&gt;For more information look &lt;a href=&quot;http://db.apache.org/derby/&quot;&gt;here&lt;/a&gt;. &lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://pradeepselvaraj.blogspot.com/feeds/114643166064372062/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/14883934/114643166064372062' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14883934/posts/default/114643166064372062'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14883934/posts/default/114643166064372062'/><link rel='alternate' type='text/html' href='http://pradeepselvaraj.blogspot.com/2006/05/using-derby-from-command-line.html' title='Using Derby from Command Line'/><author><name>Pradeep Selvaraj</name><uri>http://www.blogger.com/profile/00341137741473142989</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14883934.post-114583973647918778</id><published>2006-04-24T10:43:00.000+10:00</published><updated>2006-04-24T10:48:56.480+10:00</updated><title type='text'>Advantages of Unit Testing:</title><content type='html'>&lt;div style=&quot;text-align: justify;&quot;&gt;My project requires me to perform unit testing. Initially we did not follow test driven development, instead the tests were written only after we had some sort of a stable architecture. Writing these test made me realize the advantages of test driven development &amp; unit testing. Here is what I think are the advantages:&lt;o:p&gt; &lt;/o:p&gt;&lt;br /&gt;&lt;o:p&gt;&lt;/o:p&gt;  &lt;/div&gt;&lt;ol style=&quot;margin-top: 0cm; text-align: justify;&quot; start=&quot;1&quot; type=&quot;1&quot;&gt;&lt;li class=&quot;MsoNormal&quot;&gt;You      get a very good understanding of the requirements.&lt;/li&gt;&lt;li class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot;&gt; &lt;/span&gt;Code quality improves, because of you      breaking the functionality into much smaller units for unit testing.&lt;/li&gt;&lt;li class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot;&gt; &lt;/span&gt;Improves your confidence in the      application you are building.&lt;/li&gt;&lt;li class=&quot;MsoNormal&quot;&gt;I      think it enables you to find the problems early. &lt;/li&gt;&lt;li class=&quot;MsoNormal&quot;&gt;You      are confident to change existing code.&lt;/li&gt;&lt;/ol&gt;    &lt;p class=&quot;MsoNormal&quot;&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://pradeepselvaraj.blogspot.com/feeds/114583973647918778/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/14883934/114583973647918778' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14883934/posts/default/114583973647918778'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14883934/posts/default/114583973647918778'/><link rel='alternate' type='text/html' href='http://pradeepselvaraj.blogspot.com/2006/04/advantages-of-unit-testing.html' title='Advantages of Unit Testing:'/><author><name>Pradeep Selvaraj</name><uri>http://www.blogger.com/profile/00341137741473142989</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14883934.post-114583928807530722</id><published>2006-04-24T10:28:00.001+10:00</published><updated>2006-04-25T13:20:54.053+10:00</updated><title type='text'>How to integrate Emma with Ant?</title><content type='html'>I had to integrate Emma with Ant for my project. I will explain the basic steps involved in doing it. Let’s consider that your directory structure is like this-&lt;br /&gt;Base dir&lt;br /&gt;==Source- Containing the source files.&lt;br /&gt;==Classes – Containing all the class files.&lt;br /&gt;==Test – Containing all the JUNit files.&lt;br /&gt;==Lib – Containing all the jar files needed. &lt;p class=&quot;MsoNormal&quot;&gt;&lt;?xml:namespace prefix = o /&gt;&lt;o:p&gt;&lt;/o:p&gt;The first task is to set the properties &amp; the class paths. This for our directory structure can be done as:&lt;br /&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;http://photos1.blogger.com/blogger/5442/1361/1600/1.0.jpg&quot;&gt;&lt;img style=&quot;DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: pointer; TEXT-ALIGN: center&quot; alt=&quot;&quot; src=&quot;http://photos1.blogger.com/blogger/5442/1361/400/1.jpg&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;The second task in your ant code is to compile all the file source and test files.&lt;/p&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;http://photos1.blogger.com/blogger/5442/1361/1600/2.0.jpg&quot;&gt;&lt;img style=&quot;DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: pointer; TEXT-ALIGN: center&quot; alt=&quot;&quot; src=&quot;http://photos1.blogger.com/blogger/5442/1361/400/2.jpg&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;Now we have the class files in the classes directory.&lt;o:p&gt;&lt;/o:p&gt;The third and the last task is to perform test coverage using emmajava. But before that, emma task should be defined as shown below:&lt;img style=&quot;DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center&quot; alt=&quot;&quot; src=&quot;http://photos1.blogger.com/blogger/5442/1361/400/3.0.jpg&quot; border=&quot;0&quot; /&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;TEXT-ALIGN: left&quot;&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;http://photos1.blogger.com/blogger/5442/1361/1600/3.0.jpg&quot;&gt;&lt;/a&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;Now we are all set to use emmajava. It can be done as follows:&lt;br /&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;http://photos1.blogger.com/blogger/5442/1361/1600/4.0.jpg&quot;&gt;&lt;img style=&quot;DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: pointer; TEXT-ALIGN: center&quot; alt=&quot;&quot; src=&quot;http://photos1.blogger.com/blogger/5442/1361/400/4.jpg&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;You have to substitute the “MyTestSuite”, with a class that starts your testing. Also include &amp;amp; exclude packages according to your needs. The above code generates both html and txt reports (which are placed in the coverage-report folder that was newly created).&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;The complete documentation of emmajava can be seen at emma’s site . &lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://pradeepselvaraj.blogspot.com/feeds/114583928807530722/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/14883934/114583928807530722' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14883934/posts/default/114583928807530722'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14883934/posts/default/114583928807530722'/><link rel='alternate' type='text/html' href='http://pradeepselvaraj.blogspot.com/2006/04/how-to-integrate-emma-with-ant.html' title='How to integrate Emma with Ant?'/><author><name>Pradeep Selvaraj</name><uri>http://www.blogger.com/profile/00341137741473142989</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14883934.post-114462578990137875</id><published>2006-04-10T09:23:00.000+10:00</published><updated>2006-04-15T11:57:25.126+10:00</updated><title type='text'>Do you have a big taxing for loop</title><content type='html'>&lt;div align=&quot;justify&quot;&gt;Does you program have very big for loops that it has to run through always? Are these loops making your program slower? Here is a method to over come it.&lt;br /&gt;&lt;br /&gt;Lets just consider that you program requires to go through a for loop a million times, this means that there are a million conditions checked (for the loop to go on).&lt;br /&gt;&lt;br /&gt;&lt;code&gt;for(long i=0;i&amp;lt=list.size();i++)&lt;/code&gt;&lt;/div&gt;&lt;div align=&quot;justify&quot;&gt;&lt;code&gt;&lt;list.size();i++)&gt;{&lt;/code&gt;&lt;/div&gt;&lt;div align=&quot;justify&quot;&gt;&lt;code&gt;    System.out.println(list.get(i).name);&lt;/code&gt;&lt;/div&gt;&lt;div align=&quot;justify&quot;&gt;&lt;code&gt;}&lt;br /&gt;This is very taxing on any application. So here what you can do&lt;br /&gt;&lt;code&gt;&lt;br /&gt;try&lt;br /&gt;{&lt;br /&gt;   long i=0;&lt;br /&gt;   while(true)&lt;br /&gt;   {&lt;br /&gt;       System.out.println(list.get(i).name);&lt;br /&gt;     i++;&lt;br /&gt;   }&lt;br /&gt;}&lt;br /&gt;catch(ArrayIndexOutOfBounds e)&lt;br /&gt;{&lt;br /&gt;//don’t handle the exception&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Isn’t it simple? &lt;/code&gt;&lt;code&gt;&lt;/code&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://pradeepselvaraj.blogspot.com/feeds/114462578990137875/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/14883934/114462578990137875' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14883934/posts/default/114462578990137875'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14883934/posts/default/114462578990137875'/><link rel='alternate' type='text/html' href='http://pradeepselvaraj.blogspot.com/2006/04/do-you-have-big-taxing-for-loop.html' title='Do you have a big taxing for loop'/><author><name>Pradeep Selvaraj</name><uri>http://www.blogger.com/profile/00341137741473142989</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14883934.post-114462498169689735</id><published>2006-04-10T08:54:00.000+10:00</published><updated>2006-04-10T09:23:10.903+10:00</updated><title type='text'>Good logging design in java</title><content type='html'>I had to use java’s logging API in my project. Though lots of the information (API &amp;amp; examples) regarding logging can be found online, most of these &lt;a href=&quot;http://javaalmanac.com/egs/java.util.logging/pkg.html&quot;&gt;examples &lt;/a&gt;were very simple. These examples were there to explain only to show how certain things can be done using the logging API. None of these sites really explained how logging could be done for larger projects. I looked into other open source projects like&lt;a href=&quot;http://hibernate.org&quot;&gt; hibernate&lt;/a&gt;, to look at how they had done their logging before I could start mine. So with that knowledge of how hibernate has done its logging and from my own experience, here are few tips on logging.&lt;br /&gt;&lt;br /&gt;- Its always good to have a separate class that generates the &lt;a href=&quot;http://java.sun.com/j2se/1.4.2/docs/api/java/util/logging/Logger.html&quot;&gt;logger&lt;/a&gt; object. So that any changes to logging mechanism requires you to make changes in just one place.&lt;br /&gt;- Its also better to have your own Log &lt;a href=&quot;http://java.sun.com/j2se/1.4.2/docs/api/java/util/logging/Formatter.html&quot;&gt;Formatter&lt;/a&gt; class, so that you can create customise logging outputs.&lt;br /&gt;- You may have more than one &lt;a href=&quot;http://java.sun.com/j2se/1.4.2/docs/api/java/util/logging/Formatter.html&quot;&gt;Logformatter &lt;/a&gt;class if you are logging to more than one &lt;a href=&quot;http://java.sun.com/j2se/1.4.2/docs/api/java/util/logging/Handler.html&quot;&gt;handler&lt;/a&gt;.&lt;br /&gt;- I would also recommend you to have just one &lt;a href=&quot;http://java.sun.com/j2se/1.4.2/docs/api/java/util/logging/Handler.html&quot;&gt;handler&lt;/a&gt; for one logger (I had more that one handler and it complicates things).</content><link rel='replies' type='application/atom+xml' href='http://pradeepselvaraj.blogspot.com/feeds/114462498169689735/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/14883934/114462498169689735' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14883934/posts/default/114462498169689735'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14883934/posts/default/114462498169689735'/><link rel='alternate' type='text/html' href='http://pradeepselvaraj.blogspot.com/2006/04/good-logging-design-in-java.html' title='Good logging design in java'/><author><name>Pradeep Selvaraj</name><uri>http://www.blogger.com/profile/00341137741473142989</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14883934.post-114402011412274240</id><published>2006-04-03T08:49:00.000+10:00</published><updated>2006-04-03T09:21:54.143+10:00</updated><title type='text'>System properties in Java</title><content type='html'>&lt;div align=&quot;justify&quot;&gt;Want to find out the system&#39;s default temp directory, users home directory, user’s name, the path, file or the line separator. These things become very useful if you consider to your application to be platform independent. Finding out these things in java has always been easy.&lt;br /&gt; The &lt;a href=&quot;http://java.sun.com/j2se/1.4.2/docs/api/java/lang/System.html&quot;&gt;System class&lt;/a&gt; maintains a set of properties, key/value pairs, which define properties of the current working environment. When the &lt;a href=&quot;http://java.sun.com/j2se/1.4.2/download.html&quot;&gt;JRE&lt;/a&gt; first start these system properties are initialised to contain information about the runtime environment. The complete list of system properties can be found &lt;a href=&quot;http://java.sun.com/j2se/1.4.2/docs/api/java/lang/System.html&quot;&gt;here&lt;/a&gt;:&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Reading System Properties: &lt;/strong&gt;&lt;/div&gt;&lt;div align=&quot;justify&quot;&gt;&lt;br /&gt;The &lt;a href=&quot;http://java.sun.com/j2se/1.4.2/docs/api/java/lang/System.html&quot;&gt;System class &lt;/a&gt;has two methods that you can use to read the system properties: getProperty and getProperties. The example below shows how you can print the user’s home directory.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;String home = System.getProperty(&quot;java.home&quot;);&lt;/div&gt;&lt;div align=&quot;justify&quot;&gt;System.out.println(home); &lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Writing System Properties: &lt;/strong&gt;&lt;/div&gt;&lt;strong&gt;&lt;div align=&quot;justify&quot;&gt;&lt;br /&gt;&lt;/strong&gt;Though java allows us to overwrite the system properties, it should be done with caution. Any how here’s how it can be done.&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;java.home =”c:\temp “;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;This would make change the user’s home directory to the path specifies in the string. &lt;/div&gt;&lt;div align=&quot;justify&quot;&gt; &lt;/div&gt;&lt;div align=&quot;justify&quot;&gt;References: &lt;/div&gt;&lt;div align=&quot;justify&quot;&gt;&lt;a href=&quot;http://java.sun.com/docs/books/tutorial/essential/system/properties.html&quot;&gt;System Properties&lt;/a&gt; &lt;/div&gt;&lt;div align=&quot;justify&quot;&gt;&lt;a href=&quot;http://scv.bu.edu/Doc/Java/tutorial/applet/ui/properties.html&quot;&gt;Reading System Properties&lt;/a&gt;&lt;/div&gt;&lt;div align=&quot;justify&quot;&gt;&lt;a href=&quot;http://javaalmanac.com/egs/java.lang/GetAllSysProps.html&quot;&gt;Program to list all system Properties&lt;/a&gt;&lt;/div&gt;&lt;div align=&quot;justify&quot;&gt;&lt;a href=&quot;http://javaalmanac.com/egs/java.security/SysProp.html&quot;&gt;Protectinf System Properties&lt;/a&gt;&lt;/div&gt;&lt;div align=&quot;justify&quot;&gt;&lt;br /&gt; &lt;/div&gt;&lt;div align=&quot;justify&quot;&gt; &lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://pradeepselvaraj.blogspot.com/feeds/114402011412274240/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/14883934/114402011412274240' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14883934/posts/default/114402011412274240'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14883934/posts/default/114402011412274240'/><link rel='alternate' type='text/html' href='http://pradeepselvaraj.blogspot.com/2006/04/system-properties-in-java.html' title='System properties in Java'/><author><name>Pradeep Selvaraj</name><uri>http://www.blogger.com/profile/00341137741473142989</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14883934.post-114401812472705704</id><published>2006-04-03T08:42:00.000+10:00</published><updated>2006-04-03T08:48:44.743+10:00</updated><title type='text'>Logging Packages’s in Java:</title><content type='html'>&lt;div align=&quot;justify&quot;&gt;&lt;strong&gt;Advantages of logging:&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Logging can generate detailed information about the operation of an application. Unlike normal debugging statements they can be easily turned off when not needed and are easy to maintain &amp; increase productivity. Unlike debugging statements logging frameworks allows us to generate output to different destinations like console, files, sockets etc. But the best of all these functionality would be the ability to turn them off and on (either completely or partially) according to our needs.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Logging packages for Java:&lt;br /&gt;&lt;/strong&gt; &lt;br /&gt;My project required me to use a logging framework. So I had to decide on the framework that we would be using. Of the various logging packages, &lt;a href=&quot;http://logging.apache.org/log4j/docs/&quot;&gt;log4j&lt;/a&gt; and &lt;a href=&quot;http://java.sun.com/j2se/1.4.2/docs/api/java/util/logging/package-summary.html&quot;&gt;Java’s own logging API &lt;/a&gt;are notable. Both of them have very similar functionality.&lt;a href=&quot;http://logging.apache.org/log4j/docs/&quot;&gt; Logj4&lt;/a&gt; has been around for a long time and is used widely, whereas the &lt;a href=&quot;http://java.sun.com/j2se/1.4.2/docs/guide/util/logging/&quot;&gt;java’s logging &lt;/a&gt;package was added with &lt;a href=&quot;http://java.sun.com/j2se/1.4.2/download.html&quot;&gt;jre1.4&lt;/a&gt; in 2003.&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://java.sun.com/j2se/1.4.2/docs/guide/util/logging/&quot;&gt;Java’s logging&lt;/a&gt; package has all the functions that log4j has. In fact it is nearly a copy of &lt;a href=&quot;http://logging.apache.org/log4j/docs/&quot;&gt;log4j&lt;/a&gt; with a bit more added to it. The difference is in the areas of appender/handler implementations, formatter/layout implementations, configuration flexibility, and in the levels of logging.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;My choice:&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Even though &lt;a href=&quot;http://logging.apache.org/log4j/docs/&quot;&gt;log4j&lt;/a&gt; is thoroughly tested and very popular, my choice was to go with &lt;a href=&quot;http://java.sun.com/j2se/1.4.2/docs/api/java/util/logging/package-summary.html&quot;&gt;Java’s own API &lt;/a&gt;because it’s already bundled with JRE and moreover has all the functionality that I would need.&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://pradeepselvaraj.blogspot.com/feeds/114401812472705704/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/14883934/114401812472705704' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14883934/posts/default/114401812472705704'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14883934/posts/default/114401812472705704'/><link rel='alternate' type='text/html' href='http://pradeepselvaraj.blogspot.com/2006/04/logging-packagess-in-java.html' title='Logging Packages’s in Java:'/><author><name>Pradeep Selvaraj</name><uri>http://www.blogger.com/profile/00341137741473142989</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14883934.post-114339357887204997</id><published>2006-03-27T04:16:00.000+11:00</published><updated>2006-03-27T09:22:38.733+11:00</updated><title type='text'>How to use Hibernate</title><content type='html'>&lt;div align=&quot;justify&quot;&gt;As mentioned in my earlier blog hibernate&lt;strong&gt; &lt;/strong&gt;is used to persist data stored in the objects into a data base. For this to happen there are three things that are needed. One a java data classes (whose object’s properties we want to persist).Two an xml file mapping this class to the respective table, and also the properties of the class into appropriate classes. This file tells Hibernate how &amp;amp; which data to store. The third thing that we need is an xml file that configures Hibernate. The purpose of this file is to tell Hibernate what database it has to use, mapping file information, and other defaults.&lt;br /&gt;&lt;br /&gt;Once these three are ready, we can use another class to populate the data, then hibernate can be used to in synchronise the object’s properties into their mapped columns in the database.&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://pradeepselvaraj.blogspot.com/feeds/114339357887204997/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/14883934/114339357887204997' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14883934/posts/default/114339357887204997'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14883934/posts/default/114339357887204997'/><link rel='alternate' type='text/html' href='http://pradeepselvaraj.blogspot.com/2006/03/how-to-use-hibernate.html' title='How to use Hibernate'/><author><name>Pradeep Selvaraj</name><uri>http://www.blogger.com/profile/00341137741473142989</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14883934.post-114334526958229644</id><published>2006-03-26T14:49:00.000+11:00</published><updated>2006-03-27T09:27:28.656+11:00</updated><title type='text'>Need for an ORM package like Hibernate?</title><content type='html'>&lt;div align=&quot;justify&quot;&gt;Relational database management systems are proven data management technology and are almost always a requirement in any Java project. While using objects in our application, we sometimes reach the point where we want them to persist using a RDBMS. We would typically open a JDBC connection, create an SQL statement and copy all our objects property values over.&lt;br /&gt;&lt;br /&gt;Since Java does not have SQL type, we are forced to use String concatenation which errors prone and time consuming. This may be easy for objects with small set of properties, but for an object with many properties just preparing the SQL statement would itself be complicated.&lt;br /&gt;&lt;br /&gt;That’s not the only problem, what about things like associations, foreign key constraints? And situations like adding a new property to an object half way through the development, trying to use the application with other database; do we go and change all associated SQL statements in the code to suit our new needs? Remember that the problem applies to both loading properties from the database into object’s properties and Vis-versa.&lt;br /&gt;&lt;br /&gt;So what can Hibernate do for us? Hibernate basically intends to takes most of that burden of our shoulder. By using Hibernate we only have to define the way we map our classes to tables once - which property maps to which column, which class to which table, etc. After this, we should be able to do things like this:&lt;br /&gt;&lt;br /&gt;session.save(MyObj);//statement 1 &lt;/div&gt;&lt;div align=&quot;justify&quot;&gt;myObject = session.load(MyObject.class, objectId);//statement 2&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The first statement saves the objects properties into the appropriate column in the database table &amp; the second statement the opposite as per our mapping.&lt;br /&gt;&lt;br /&gt;Hibernate will automatically generate all the SQL needed to store the object. It relieves us of manual JDBC result set handling, objects conversion, and keeps our application portable to all SQL databases, leaving us to concentrate on the business logic alone. Hence Hibernate helps in rapid product development, minimises maintenance &amp;amp; development costs. &lt;/div&gt;&lt;div align=&quot;justify&quot;&gt;&lt;/div&gt;&lt;div align=&quot;justify&quot;&gt;References: &lt;/div&gt;&lt;div align=&quot;justify&quot;&gt;• &lt;a href=&quot;http://www.gloegl.de/5.html&quot;&gt;Road to Hibernate Tutorial&lt;/a&gt; &lt;/div&gt;&lt;div align=&quot;justify&quot;&gt;• &lt;a href=&quot;http://hibernate.org&quot;&gt;Tutorials at hibernate.org&lt;/a&gt;&lt;/div&gt;&lt;div align=&quot;justify&quot;&gt;• &lt;a href=&quot;http://www.manning.com/books/bauer&quot;&gt;Hibernate in action&lt;br /&gt;&lt;/a&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://pradeepselvaraj.blogspot.com/feeds/114334526958229644/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/14883934/114334526958229644' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14883934/posts/default/114334526958229644'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14883934/posts/default/114334526958229644'/><link rel='alternate' type='text/html' href='http://pradeepselvaraj.blogspot.com/2006/03/need-for-orm-package-like-hibernate.html' title='Need for an ORM package like Hibernate?'/><author><name>Pradeep Selvaraj</name><uri>http://www.blogger.com/profile/00341137741473142989</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14883934.post-114280089903422898</id><published>2006-03-20T07:14:00.000+11:00</published><updated>2006-03-23T17:03:33.820+11:00</updated><title type='text'>Good Ways of Handling Exception in Java</title><content type='html'>&lt;div align=&quot;justify&quot;&gt;&lt;span style=&quot;color:#000000;&quot;&gt;Not that I know everything in exception handling, but here&#39;s what i think are good ways of handling exceptions.&lt;/span&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;&lt;div align=&quot;justify&quot;&gt;Never use a catch block that suppresses the exception (for example by doing nothing). This makes the program to continue on as if nothing ever happened.&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div align=&quot;justify&quot;&gt;Always try to catch the specific exception, unless you are sure that it makes no difference. For example when invoking a method that throws more that one type of exception, never just catch them using Exception. &lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div align=&quot;justify&quot;&gt;Handle exceptions where actions can be taken to deal with the exceptions caused. For example if a block of code throws an exception, handle it there only ifs possible for you to recover from the exception, or else throw the exception to a level where the system can recover.&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div align=&quot;justify&quot;&gt;Having said to throw the exceptions to an upper level where it can be comfortably handled, it dosent mean that you throw an fileNotFound Exception to a place where the applications logical level.&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div align=&quot;justify&quot;&gt;When deciding on checked or unchecked exceptions exceptions for your APIs, its good to throw an checked exception if its possible for the client to recover from the exception, or else it can be should unchecked exception.&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div align=&quot;justify&quot;&gt;Allways clean up afer exception using finally.&lt;/div&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://pradeepselvaraj.blogspot.com/feeds/114280089903422898/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/14883934/114280089903422898' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14883934/posts/default/114280089903422898'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14883934/posts/default/114280089903422898'/><link rel='alternate' type='text/html' href='http://pradeepselvaraj.blogspot.com/2006/03/good-ways-of-handling-exception-in.html' title='Good Ways of Handling Exception in Java'/><author><name>Pradeep Selvaraj</name><uri>http://www.blogger.com/profile/00341137741473142989</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14883934.post-114279921604241686</id><published>2006-03-20T06:48:00.000+11:00</published><updated>2006-03-21T16:56:53.360+11:00</updated><title type='text'>How to integrate Junit into Ant?</title><content type='html'>&lt;div align=&quot;justify&quot;&gt;&lt;/div&gt;&lt;div align=&quot;justify&quot;&gt;Ant provides a flexible JUnit task for compling and executing JUnit tests. I hope that you all know what how test classes are written in java. Consider that we have a class named metricEngine and a class named metricEngineTest to test it.&lt;/div&gt;&lt;div align=&quot;justify&quot;&gt;&lt;/div&gt;&lt;div align=&quot;justify&quot;&gt;The first thing that has to be done is that both the classes needs to be compiled. This can be done in Ant as follows (considering that both the files are in basedir itself). &lt;/div&gt;&lt;br /&gt;&lt;span style=&quot;font-size:85%;color:#333333;&quot;&gt;&lt;em&gt;&lt;br /&gt;&amp;lttarget description=&quot;Compiling Files.&quot; depends=&quot;init&quot; name=&quot;compile.source&quot;&gt;&lt;br /&gt;&amp;ltecho&gt;Compiling Files&lt;/echo&gt;&lt;br /&gt;&amp;ltjavac destdir=&quot;${destdir}&quot; srcdir=&quot;${basedir}&quot; target=&quot;1.5&quot; source=&quot;1.5&quot;&gt;&lt;br /&gt;&amp;ltclasspath refid=&quot;classpath&quot;&gt;&lt;br /&gt;&amp;ltinclude name=&quot;**&quot;&gt;&lt;br /&gt;&amp;lt/javac&gt;&lt;br /&gt;&amp;lt/target&gt;&lt;/em&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The classpath includes the list of libary files needed to compile these files. They can be set as follows (consider that the basedir/lib contains all the required library (jar) files.&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-size:85%;color:#333333;&quot;&gt;&lt;em&gt;&lt;br /&gt;&amp;ltpath id=&quot;classpath&quot;&gt;&lt;br /&gt;&amp;ltfileset dir=&quot;${basedir}/lib&quot;&gt;&lt;br /&gt;&amp;ltinclude name=&quot;*.jar&quot;&gt;&lt;br /&gt;&amp;lt/fileset&gt;&lt;br /&gt;&amp;lt/path&gt;&lt;/em&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div align=&quot;justify&quot;&gt;Now that both the files have been compiled we can test them, this can be done as follows&lt;/div&gt;&lt;br /&gt;&lt;span style=&quot;font-size:85%;color:#333333;&quot;&gt;&lt;em&gt;&lt;br /&gt;&amp;lttarget description=&quot;Runs the test suite&quot; depends=&quot;compile.test&quot; name=&quot;test&quot;&gt;&lt;br /&gt;&amp;ltprintsummary=&quot;yes&quot; fork=&quot;yes&quot; haltonfailure=&quot;no&quot; showoutput=&quot;yes&quot;&gt;&lt;br /&gt;&amp;ltformatter type=&quot;plain&quot; usefile=&quot;false&quot;&gt;&lt;br /&gt;&amp;ltclasspath refid=&quot;classpath&quot;&gt;&lt;br /&gt;&amp;ltlt todir=&quot;${basedir}/test-result.txt&quot; fork=&quot;yes&quot;&gt;&lt;br /&gt;&amp;ltfileset dir=&quot;${destdir}&quot;&gt;&lt;br /&gt;&amp;ltinclude name=&quot;**/metricEngineTest.class&quot;&gt;&lt;br /&gt;&amp;lt/fileset&gt;&lt;br /&gt;&amp;lt/batchtest&gt;&lt;br /&gt;&amp;lt/junit&gt;&lt;br /&gt;&amp;lt/target&gt;&lt;/em&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;MOre information on the JUnit tag can be found with &lt;a href=&quot;http://ant.apache.org/manual/index.html&quot;&gt;&lt;span style=&quot;color:#000000;&quot;&gt;ANT Documentation&lt;/span&gt;&lt;/a&gt;.</content><link rel='replies' type='application/atom+xml' href='http://pradeepselvaraj.blogspot.com/feeds/114279921604241686/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/14883934/114279921604241686' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14883934/posts/default/114279921604241686'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14883934/posts/default/114279921604241686'/><link rel='alternate' type='text/html' href='http://pradeepselvaraj.blogspot.com/2006/03/how-to-integrate-junit-into-ant.html' title='How to integrate Junit into Ant?'/><author><name>Pradeep Selvaraj</name><uri>http://www.blogger.com/profile/00341137741473142989</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14883934.post-114247299068403522</id><published>2006-03-16T12:05:00.000+11:00</published><updated>2006-03-21T16:46:51.056+11:00</updated><title type='text'>Data Recovery, My Experience !</title><content type='html'>&lt;div align=&quot;justify&quot;&gt;&lt;span style=&quot;color:#000000;&quot;&gt;&lt;/span&gt; &lt;/div&gt;&lt;div align=&quot;justify&quot;&gt;&lt;span style=&quot;color:#000000;&quot;&gt;My portable hard disk crashed (my computer was able to recognise it but not able to open it) today. I guess some important file that deals with the file format &amp; things like that got corrupted. There was a lot of data in the disk (some were not important &amp;amp; others I had backup). But I did not have a back up for a collection of e-books (around 6GB).&lt;/span&gt;&lt;/div&gt;&lt;div align=&quot;justify&quot;&gt;&lt;br /&gt;&lt;span style=&quot;color:#000000;&quot;&gt;I used software called &lt;/span&gt;&lt;a href=&quot;http://recovermyfiles.com&quot;&gt;&lt;span style=&quot;color:#000000;&quot;&gt;recovermyfiles&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color:#333333;&quot;&gt;&lt;span style=&quot;color:#000000;&quot;&gt;. It was pretty good, once I checked the files that I wanted it to recover it started recovering files. But just to scan 1 percent of the disk it took about 15 minutes &amp; the files that were recovered were all named as recovered filesomenumber.extension. I seemed that too much time would have been needed to just sort the recovered data.&lt;br /&gt;&lt;br /&gt;So, after just fifteen minutes of my hard disk crashing I am reformatting it (about 80% over now). And what about the ebook collection, well definitely I was not going to read all of them &amp;amp; I know how to get the books that I may need. Good thing it happened, i now dont have so much unwanted stuff...&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://pradeepselvaraj.blogspot.com/feeds/114247299068403522/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/14883934/114247299068403522' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14883934/posts/default/114247299068403522'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14883934/posts/default/114247299068403522'/><link rel='alternate' type='text/html' href='http://pradeepselvaraj.blogspot.com/2006/03/data-recovery-my-experience.html' title='Data Recovery, My Experience !'/><author><name>Pradeep Selvaraj</name><uri>http://www.blogger.com/profile/00341137741473142989</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>