<?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-4924966385028011361</id><updated>2012-01-15T15:21:58.691-08:00</updated><category term='Code'/><category term='MSSQL'/><category term='MYSQL Database'/><category term='SQL Data Types'/><category term='ssrs'/><category term='Opensource'/><category term='Technology'/><category term='windirstart'/><category term='Hibernate'/><category term='Tools'/><category term='JSF'/><category term='Report'/><category term='Java'/><category term='Groovy'/><category term='Schema Spy'/><category term='Clob'/><category term='Grail'/><category term='Welcome'/><title type='text'>Mytechtoday.com</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://www.mytechtoday.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4924966385028011361/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://www.mytechtoday.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Bishow Paudel</name><uri>http://www.blogger.com/profile/13404171528390907420</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/-Y168AeCY_eE/TguViHWNgkI/AAAAAAAAATk/y5g4EdsLf2Q/s220/bishow-paudel.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>20</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-4924966385028011361.post-1469837760725135967</id><published>2011-11-18T12:21:00.001-08:00</published><updated>2011-11-18T12:32:43.510-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Technology'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL Data Types'/><category scheme='http://www.blogger.com/atom/ns#' term='ssrs'/><category scheme='http://www.blogger.com/atom/ns#' term='MSSQL'/><title type='text'>Get the the difference between two dates in MS SQL</title><content type='html'>The DATEDIFF() function returns the difference between two dates&lt;br /&gt;Syntax: &lt;code&gt; DATEDIFF ( datepart , startdate , enddate ) &lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Following is an example for the DateDiff() &lt;br /&gt;&lt;code&gt;DECLARE @startdate datetime ='2011-11-14 02:00:06.957';&lt;br /&gt; DECLARE @enddate datetime = '2011-11-16 05:00:15.490';&lt;br /&gt;SELECT DATEDIFF(day, @startdate, @enddate) as dayDifference,DATEDIFF(HOUR, @startdate, @enddate)as hourDifference &lt;br /&gt;&lt;u&gt;Output&lt;/u&gt;&lt;table&gt;&lt;tr&gt;&lt;td&gt;dayDifference &lt;/td&gt; &lt;td&gt; hourDifference  &lt;/td&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr&gt;&lt;td&gt;  2    &lt;/td&gt;&lt;td&gt;                51 &lt;/td&gt;&lt;/tr&gt;&lt;br /&gt;&lt;/table&gt; &lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Similarly the following are the available&lt;code&gt; datepart&lt;/code&gt; Options on the &lt;code&gt;DateDiff()&lt;/code&gt; Function.&lt;br /&gt;&lt;code&gt;&lt;br /&gt;year(or yy or yyyy)&lt;br /&gt;quarter(or qq or q)&lt;br /&gt;month (or mm or m )&lt;br /&gt;dayofyear(or dy or y )&lt;br /&gt;day (or dd, d )&lt;br /&gt;week(or wk or ww)&lt;br /&gt;&lt;span class="fullpost"&gt;&lt;br /&gt;hour(or hh)&lt;br /&gt;minute(or mi or n)&lt;br /&gt;second(or ss or s )&lt;br /&gt;millisecond(or ms)&lt;br /&gt;microsecond(or mcs) &lt;br /&gt;nanosecond(or ns) &lt;br /&gt;TZoffset(or tz)&lt;br /&gt;ISO_WEEK(or isowk or isoww)&lt;/code&gt;&lt;br /&gt; &lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4924966385028011361-1469837760725135967?l=www.mytechtoday.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.mytechtoday.com/feeds/1469837760725135967/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.mytechtoday.com/2011/11/get-the-difference-between-two-dates-in.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4924966385028011361/posts/default/1469837760725135967'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4924966385028011361/posts/default/1469837760725135967'/><link rel='alternate' type='text/html' href='http://www.mytechtoday.com/2011/11/get-the-difference-between-two-dates-in.html' title='Get the the difference between two dates in MS SQL'/><author><name>Bishow Paudel</name><uri>http://www.blogger.com/profile/13404171528390907420</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/-Y168AeCY_eE/TguViHWNgkI/AAAAAAAAATk/y5g4EdsLf2Q/s220/bishow-paudel.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4924966385028011361.post-6915998430303754274</id><published>2011-11-18T11:27:00.000-08:00</published><updated>2011-11-18T11:28:54.022-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='MYSQL Database'/><category scheme='http://www.blogger.com/atom/ns#' term='Technology'/><category scheme='http://www.blogger.com/atom/ns#' term='ssrs'/><category scheme='http://www.blogger.com/atom/ns#' term='MSSQL'/><title type='text'>Get the Row Numbers as a separate column on MS SQL Query</title><content type='html'>I was trying to  execute a new query where I need  the Row number as a new column on the result itself.  I used the SQL Function &lt;code&gt;ROW_NUMBER()&lt;/code&gt; to get the row number.&lt;br /&gt;Following query gives the Report Path with the HitCount along with the added Row Number.&lt;br /&gt;&lt;code&gt;&lt;br /&gt;select ROW_NUMBER() OVER(ORDER BY count(ReportPath) DESC) AS 'Row Number',  ReportPath,count(ReportPath) as HitCount&lt;br /&gt;FROM [ReportServer].[dbo].[ExecutionLog2]&lt;br /&gt;Group by ReportPath&lt;br /&gt;Order by HitCount desc&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Cheers !&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4924966385028011361-6915998430303754274?l=www.mytechtoday.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.mytechtoday.com/feeds/6915998430303754274/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.mytechtoday.com/2011/11/get-row-numbers-as-separate-column-on.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4924966385028011361/posts/default/6915998430303754274'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4924966385028011361/posts/default/6915998430303754274'/><link rel='alternate' type='text/html' href='http://www.mytechtoday.com/2011/11/get-row-numbers-as-separate-column-on.html' title='Get the Row Numbers as a separate column on MS SQL Query'/><author><name>Bishow Paudel</name><uri>http://www.blogger.com/profile/13404171528390907420</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/-Y168AeCY_eE/TguViHWNgkI/AAAAAAAAATk/y5g4EdsLf2Q/s220/bishow-paudel.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4924966385028011361.post-7547893148119497052</id><published>2011-07-08T12:48:00.000-07:00</published><updated>2011-07-08T12:55:12.204-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='windirstart'/><category scheme='http://www.blogger.com/atom/ns#' term='Opensource'/><category scheme='http://www.blogger.com/atom/ns#' term='Technology'/><category scheme='http://www.blogger.com/atom/ns#' term='Tools'/><title type='text'>Get the Disk Usage Statistics from the WinDirStat !</title><content type='html'>&lt;!-- your section of the post that is going to be displayed on the main page goes here --&gt;&lt;a href="http://windirstat.info/"&gt;WinDirStat&lt;/a&gt; is an opensource tool to identify howmuch of disk space you are using on  your wondow box. It shows disk, file and directory sizes in a treelist as well as graphically in a treemap, much like KDirStat or SequoiaView.&lt;br /&gt;&lt;br /&gt;Once i started using it, i feel like life would have been very hard without it. &lt;br /&gt;Why don't you try it  yourself. &lt;br /&gt;&lt;br /&gt;You can download the tool from &lt;a href="http://windirstat.info/"&gt;http://windirstat.info/&lt;/a&gt;&lt;br /&gt; &lt;span class="fullpost"&gt; &lt;!---Your Hidden post goes here --&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4924966385028011361-7547893148119497052?l=www.mytechtoday.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.mytechtoday.com/feeds/7547893148119497052/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.mytechtoday.com/2011/07/get-disk-usage-statistics-from.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4924966385028011361/posts/default/7547893148119497052'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4924966385028011361/posts/default/7547893148119497052'/><link rel='alternate' type='text/html' href='http://www.mytechtoday.com/2011/07/get-disk-usage-statistics-from.html' title='Get the Disk Usage Statistics from the WinDirStat !'/><author><name>Bishow Paudel</name><uri>http://www.blogger.com/profile/13404171528390907420</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/-Y168AeCY_eE/TguViHWNgkI/AAAAAAAAATk/y5g4EdsLf2Q/s220/bishow-paudel.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4924966385028011361.post-8830971479652831780</id><published>2011-06-29T13:18:00.000-07:00</published><updated>2011-06-29T13:30:08.729-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Report'/><category scheme='http://www.blogger.com/atom/ns#' term='ssrs'/><category scheme='http://www.blogger.com/atom/ns#' term='MSSQL'/><title type='text'>How to parse multi value parameter from SSRS Report !</title><content type='html'>While writing an SSRS Report, I had to parse a multivalued parameter and stored it on a temp table. After some googling i came up with the following solution. @id is the multi valued parameter that need to be parsed.  Following is the sample code that you can used to parse and put the values on a temp table. &lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;br /&gt;-- @uid is the parameter. Lets define the parameter for testing.&lt;br /&gt;&lt;br /&gt;declare @uid as nvarchar(200)&lt;br /&gt;set @uid='u01052901,u01052789,u01052897,u0105345,u08023432,u0234324,u23479879'&lt;br /&gt;&lt;br /&gt;create table #TempIDTable (&lt;br /&gt;    slice varchar(50))&lt;br /&gt;  declare @index1 int&lt;br /&gt;  declare @u_id nvarchar(4000)&lt;br /&gt;    set @index1 = 1&lt;br /&gt;  if @uid is null&lt;br /&gt;    set @index1 = 0&lt;br /&gt;  while @index1 !=0&lt;br /&gt;    begin&lt;br /&gt;      set @index1 = charindex(',',@uid)&lt;br /&gt;      if @index1 !=0&lt;br /&gt;        set @u_id = left(@uid,@index1 - 1)&lt;br /&gt;      else&lt;br /&gt;        set @u_id = @uid&lt;br /&gt;      insert into #TempIDTable select @u_id&lt;br /&gt;      set @uid= right(@uid,len(@uid) - @index1)&lt;br /&gt;      if len(@uid) = 0&lt;br /&gt;        break&lt;br /&gt;      end&lt;br /&gt; &lt;br /&gt;Select * from #TempIDTable&lt;br /&gt;--drop table #TempIDTable&lt;br /&gt;&lt;code &gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4924966385028011361-8830971479652831780?l=www.mytechtoday.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.mytechtoday.com/feeds/8830971479652831780/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.mytechtoday.com/2011/06/how-to-parse-multi-value-parameter-from.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4924966385028011361/posts/default/8830971479652831780'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4924966385028011361/posts/default/8830971479652831780'/><link rel='alternate' type='text/html' href='http://www.mytechtoday.com/2011/06/how-to-parse-multi-value-parameter-from.html' title='How to parse multi value parameter from SSRS Report !'/><author><name>Bishow Paudel</name><uri>http://www.blogger.com/profile/13404171528390907420</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/-Y168AeCY_eE/TguViHWNgkI/AAAAAAAAATk/y5g4EdsLf2Q/s220/bishow-paudel.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4924966385028011361.post-8176390894582265955</id><published>2011-06-17T09:30:00.000-07:00</published><updated>2011-11-18T11:31:08.775-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Technology'/><category scheme='http://www.blogger.com/atom/ns#' term='ssrs'/><category scheme='http://www.blogger.com/atom/ns#' term='MSSQL'/><title type='text'>Date Conversion from YYYY-MM-DD HH:MM:SS:MMM to YYYY-MM-DD 00:00:00:000   !</title><content type='html'>Just keeping it handy !&lt;br /&gt;&lt;code&gt;&lt;br /&gt;declare @StartTime as DateTime&lt;br /&gt;set @StartTime= dateadd(dd,0, datediff(dd,0,'2011-06-08 11:18:26.000'))&lt;br /&gt;select @StartTime as StartTime&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;span class="fullpost"&gt; &lt;!---Your Hidden post goes here --&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4924966385028011361-8176390894582265955?l=www.mytechtoday.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.mytechtoday.com/feeds/8176390894582265955/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.mytechtoday.com/2011/06/date-conversion-from-yyyy-mm-hhmmssmmm.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4924966385028011361/posts/default/8176390894582265955'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4924966385028011361/posts/default/8176390894582265955'/><link rel='alternate' type='text/html' href='http://www.mytechtoday.com/2011/06/date-conversion-from-yyyy-mm-hhmmssmmm.html' title='Date Conversion from YYYY-MM-DD HH:MM:SS:MMM to YYYY-MM-DD 00:00:00:000   !'/><author><name>Bishow Paudel</name><uri>http://www.blogger.com/profile/13404171528390907420</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/-Y168AeCY_eE/TguViHWNgkI/AAAAAAAAATk/y5g4EdsLf2Q/s220/bishow-paudel.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4924966385028011361.post-2008750604534245400</id><published>2010-03-23T12:38:00.000-07:00</published><updated>2010-03-23T14:01:23.046-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='MYSQL Database'/><category scheme='http://www.blogger.com/atom/ns#' term='Tools'/><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='Schema Spy'/><title type='text'>Schema Spy, A Graphical Database Schema Metadata Browser.</title><content type='html'>&lt;a href="http://schemaspy.sourceforge.net/"&gt;Schemaspy&lt;/a&gt; is a java based tool that analyzes the metadata of a schema in a database and generated the visual representation of it. The output is highly user friendly. You can browse through table via child and parent table relationship.&lt;br /&gt;&lt;br /&gt;Schema Spy uses the dot executable from &lt;a href="http://www.graphviz.org/"&gt;graphviz &lt;/a&gt; to generate the graphical representation of the schema and its relationship. Graphviz is the graphics visualization software that takes descriptions of graphs in a simple text language, and make diagrams in several useful formats such as images and SVG for web pages, Postscript for inclusion in PDF or other documents; or display in an interactive graph browser.&lt;br /&gt;&lt;br /&gt;Following is the steps to execute the SchemaSpy tool (for a sample MYSQL database.)&lt;br /&gt;1. Download and install Graphviz from &lt;a href="http://www.graphviz.org/Download..php"&gt;http://www.graphviz.org/Download..php&lt;/a&gt;&lt;br /&gt;2. Download the Schema spay jar file, Schemaspy_x_y_z.jar from &lt;a href="http://sourceforge.net/projects/schemaspy/files/"&gt;http://sourceforge.net/projects/schemaspy/files/&lt;/a&gt;&lt;br /&gt;3. Download the corresponding JDBC Connector and have it on the same source folder where the schemaspy_x_y_z.jar resides. For example for a mysql database, I would simply download mysql-connector-java-5.1.5.jar or any other latest version of mysql connector. &lt;span class="fullpost"&gt;&lt;br /&gt;4. Now from the source location of your Schemaspy_x_y_z.jar file, execute schemaspy to generate the graphical representation of the schema of your database, as shown on the following syntax&lt;br /&gt;&lt;code&gt;&lt;br /&gt;java -jar schemaSpy_x.y.z.jar -t database_type -dp mysql jdbcdatabase_connector -hq -o output_Directory -db databaseName -u username -p password&lt;br /&gt;for example : java -jar schemaSpy_4.1.1.jar -t mysql -dp mysql-connector-java-5.1.5.jar -hq -o out -db bisudatabae -u bishow -p north&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;/span&gt;&lt;a href="http://schemaspy.sourceforge.net/"&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4924966385028011361-2008750604534245400?l=www.mytechtoday.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.mytechtoday.com/feeds/2008750604534245400/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.mytechtoday.com/2010/03/schemas-spy-graphical-database-schema.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4924966385028011361/posts/default/2008750604534245400'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4924966385028011361/posts/default/2008750604534245400'/><link rel='alternate' type='text/html' href='http://www.mytechtoday.com/2010/03/schemas-spy-graphical-database-schema.html' title='Schema Spy, A Graphical Database Schema Metadata Browser.'/><author><name>Bishow Paudel</name><uri>http://www.blogger.com/profile/13404171528390907420</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/-Y168AeCY_eE/TguViHWNgkI/AAAAAAAAATk/y5g4EdsLf2Q/s220/bishow-paudel.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4924966385028011361.post-5176820671844945754</id><published>2010-01-22T13:23:00.000-08:00</published><updated>2010-01-22T13:24:52.613-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL Data Types'/><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='Clob'/><category scheme='http://www.blogger.com/atom/ns#' term='Hibernate'/><category scheme='http://www.blogger.com/atom/ns#' term='Code'/><title type='text'>Converting Clob Datatype to String and ViceVersa .</title><content type='html'>If you have been using Hibernate 3.x.x or greater you can easily convert clob type to string type and vice versa, i.e String data type to Clob type.&lt;br /&gt;&lt;br /&gt;Following piece of codes demonstrate the process of doing the conversion.&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;br /&gt;.........&lt;br /&gt;.........&lt;br /&gt;&lt;br /&gt;Clob textClobValue;&lt;br /&gt;String textValue;&lt;br /&gt;String newTextValue;&lt;br /&gt;Clob newTextClobValue;&lt;br /&gt;InputStream textStream;&lt;br /&gt;Paragraph paragraph  // my domain Class that contains a clob datatypes and used to update the database connection with hibernate connection (Hibernate version &gt;=3.0)&lt;br /&gt;...........&lt;br /&gt;...........&lt;br /&gt;&lt;br /&gt;textClobValue=paragraph.getText();&lt;br /&gt;textStream = textClobValue.getAsciiStream(); //return inputstream&lt;br /&gt;textValue=convertStreamToString(textStream);&lt;br /&gt;newTextValue=textValue.replaceAll("Some text","new Text"); //Replacing some text from old text. &lt;br /&gt;   &lt;br /&gt;newTextClobValue=Hibernate.createClob(newTextValue);&lt;br /&gt;//System.out.println("Updated="+newParaContentValue);&lt;br /&gt;paragraph.setText(newTextClobValue);&lt;br /&gt;..........&lt;br /&gt;..........&lt;br /&gt;..........&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;public static String convertStreamToString(InputStream is) throws Exception {&lt;br /&gt;     BufferedReader reader = new BufferedReader(new InputStreamReader(is));&lt;br /&gt;     StringBuilder sb = new StringBuilder();&lt;br /&gt;     String line = null;&lt;br /&gt;&lt;span class="fullpost"&gt; &lt;br /&gt;     while ((line = reader.readLine()) != null) {&lt;br /&gt;       sb.append(line + "\n");&lt;br /&gt;     }&lt;br /&gt;     is.close();&lt;br /&gt;     return sb.toString();&lt;br /&gt;   }&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4924966385028011361-5176820671844945754?l=www.mytechtoday.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.mytechtoday.com/feeds/5176820671844945754/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.mytechtoday.com/2010/01/converting-clob-datatype-to-string-and.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4924966385028011361/posts/default/5176820671844945754'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4924966385028011361/posts/default/5176820671844945754'/><link rel='alternate' type='text/html' href='http://www.mytechtoday.com/2010/01/converting-clob-datatype-to-string-and.html' title='Converting Clob Datatype to String and ViceVersa .'/><author><name>Bishow Paudel</name><uri>http://www.blogger.com/profile/13404171528390907420</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/-Y168AeCY_eE/TguViHWNgkI/AAAAAAAAATk/y5g4EdsLf2Q/s220/bishow-paudel.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4924966385028011361.post-4973472220788282724</id><published>2009-11-03T09:33:00.000-08:00</published><updated>2010-03-07T14:22:16.941-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Technology'/><category scheme='http://www.blogger.com/atom/ns#' term='Groovy'/><category scheme='http://www.blogger.com/atom/ns#' term='Code'/><title type='text'>Converting Groovy Array type to Java Array Type</title><content type='html'>Following is the code snipped in groovy that demonstrate the conversion Groovy Array type to Java Array Type.&lt;br /&gt;Code for Groovy &lt;br /&gt;&lt;code&gt;&lt;br /&gt;def param=[]&lt;br /&gt;param+="paramater 1"&lt;br /&gt;param+="paramater 2"&lt;br /&gt;param+="paramater 3"&lt;br /&gt;param+="paramater 4"&lt;br /&gt;def stringArgForJava = (String[])params &lt;br /&gt;&lt;br /&gt;&lt;!-- You can now pass the variable stringArgForJava to a String[] arg paramater to a java method --&gt;&lt;br /&gt;Test.callJavaClass(stringArgForJava) //static method&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;The sample java class is as follow;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;class Test&lt;br /&gt; {&lt;br /&gt;  public static void callJavaClass(String[] arg)&lt;br /&gt;   {&lt;br /&gt;       for(int i=0;i&lt;params.length;i++)&lt;br /&gt;        {&lt;br /&gt;            System.out.println("params "+i ":" +params[i]);&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;span class="fullpost"&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt; &lt;!---Your Hidden post goes here --&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4924966385028011361-4973472220788282724?l=www.mytechtoday.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.mytechtoday.com/feeds/4973472220788282724/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.mytechtoday.com/2009/11/converting-groovy-array-type-to-java.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4924966385028011361/posts/default/4973472220788282724'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4924966385028011361/posts/default/4973472220788282724'/><link rel='alternate' type='text/html' href='http://www.mytechtoday.com/2009/11/converting-groovy-array-type-to-java.html' title='Converting Groovy Array type to Java Array Type'/><author><name>Bishow Paudel</name><uri>http://www.blogger.com/profile/13404171528390907420</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/-Y168AeCY_eE/TguViHWNgkI/AAAAAAAAATk/y5g4EdsLf2Q/s220/bishow-paudel.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4924966385028011361.post-6396022426983750693</id><published>2009-10-13T12:02:00.000-07:00</published><updated>2009-10-13T12:04:13.728-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Grail'/><category scheme='http://www.blogger.com/atom/ns#' term='Technology'/><category scheme='http://www.blogger.com/atom/ns#' term='Groovy'/><category scheme='http://www.blogger.com/atom/ns#' term='Code'/><title type='text'>Read a variable defined on the config file from a controller in a grail application</title><content type='html'>&lt;!-- your section of the post that is going to be displayed on the main page goes here --&gt;&lt;br /&gt;&lt;br /&gt;Let's say, you have the config.groovy file as follow.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt; ...........&lt;br /&gt; ..........&lt;br /&gt;&lt;br /&gt;  environments {&lt;br /&gt;     production {&lt;br /&gt;           myVariable1="I am variable1 on RPOD"&lt;br /&gt;           myVariable1="I am variable1 on RPOD"&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;          development {&lt;br /&gt;               myVariable1="I am variable1 on DEV"&lt;br /&gt;               myVariable1="I am variable1 on RPOD"&lt;br /&gt;      }&lt;br /&gt;&lt;br /&gt;  log4j {&lt;br /&gt;    appender.stdout = "org.apache.log4j.ConsoleAppender"&lt;br /&gt;    .........&lt;br /&gt;    ........&lt;br /&gt;&lt;/code&gt;&lt;br /&gt; Now the above varaible can be easily access through any of the controller as follow. &lt;br /&gt;&lt;span class="fullpost"&gt;&lt;br /&gt; &lt;code&gt;&lt;br /&gt;    def config = ConfigurationHolder.config&lt;br /&gt;    def myVaraible1 = config.myVaraible1&lt;br /&gt;    def myVaraible2 = config.myVaraible2&lt;br /&gt; &lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4924966385028011361-6396022426983750693?l=www.mytechtoday.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.mytechtoday.com/feeds/6396022426983750693/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.mytechtoday.com/2009/10/read-variable-defined-on-config-file.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4924966385028011361/posts/default/6396022426983750693'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4924966385028011361/posts/default/6396022426983750693'/><link rel='alternate' type='text/html' href='http://www.mytechtoday.com/2009/10/read-variable-defined-on-config-file.html' title='Read a variable defined on the config file from a controller in a grail application'/><author><name>Bishow Paudel</name><uri>http://www.blogger.com/profile/13404171528390907420</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/-Y168AeCY_eE/TguViHWNgkI/AAAAAAAAATk/y5g4EdsLf2Q/s220/bishow-paudel.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4924966385028011361.post-3427782102731281843</id><published>2009-07-08T11:12:00.001-07:00</published><updated>2009-07-09T16:59:34.389-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Technology'/><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='Groovy'/><category scheme='http://www.blogger.com/atom/ns#' term='Code'/><title type='text'>Reading the status code of  HTTP Request !</title><content type='html'>When you make an HTTP request to any server url throuh your client software, lets say IE, HTTP Status codes are returned by the server to the client software to determine the outcome of your request. There are five different classes of status code range. They are &lt;br /&gt;Status codes 100-101 &lt;br /&gt;Status codes 200-206  &lt;br /&gt;Status codes 300-307 &lt;br /&gt;Status codes 400-417 &lt;br /&gt;Status codes 500-505 &lt;br /&gt;&lt;br /&gt;Following is  a simple program written in groovy that checks and returns the status code of any url.&lt;br /&gt;&lt;code&gt;&lt;br /&gt;import java.net.URL;&lt;br /&gt;    def url&lt;br /&gt;    def message =""&lt;br /&gt;    boolean fail=true&lt;br /&gt;    def urlString="http://192.168.0.1/test/test.html"&lt;br /&gt;    println checkURL(urlString)&lt;br /&gt;&lt;br /&gt;def checkURL(urlString){&lt;br /&gt;          int status_code&lt;br /&gt;        def tempmessage=""&lt;br /&gt;  URL URLserver = new URL("urlString");&lt;br /&gt; try{&lt;br /&gt;  URLConnection connection = &lt;strike&gt;(HttpURLConnection)&lt;/strike&gt;URLserver.openConnection();&lt;br /&gt;&lt;span class="fullpost"&gt;&lt;br /&gt;  status_code = connection.getResponseCode();&lt;br /&gt;&lt;br /&gt;&lt;br /&gt; switch (status_code)&lt;br /&gt; {&lt;br /&gt;      case  200:&lt;br /&gt;           tempmessage=" Connection Successful"&lt;br /&gt;           break;&lt;br /&gt;     case  401:&lt;br /&gt;           tempmessage="UnAuthorised"&lt;br /&gt;           break;&lt;br /&gt;     case  405 :&lt;br /&gt;           tempmessage= " Resource Not Found"&lt;br /&gt;           break;&lt;br /&gt;     case  408:&lt;br /&gt;           tempmessage="Request Time-out"&lt;br /&gt;           break;&lt;br /&gt;     case  500:&lt;br /&gt;           tempmessage="Internal Server Error"&lt;br /&gt;           break;&lt;br /&gt;     case  502:&lt;br /&gt;           tempmessage="Bad Gateway"&lt;br /&gt;           break;&lt;br /&gt;      case  503:&lt;br /&gt;           tempmessage="Service Temporarily Unavailable"&lt;br /&gt;           break;&lt;br /&gt;      default :&lt;br /&gt;            tempmessage= connection.getResponseMessage()&lt;br /&gt;        break;&lt;br /&gt;&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;catch (Exception exc){&lt;br /&gt;     tempmessage=exc&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;     &lt;br /&gt;return "\n "+urlString+" :"+status_code+":"+tempmessage;&lt;br /&gt;&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Visit &lt;a href="http://www.w3.org/Protocols/HTTP/HTRESP.html"&gt;http://www.w3.org/Protocols/HTTP/HTRESP.html&lt;/a&gt; for detail about the status codes.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4924966385028011361-3427782102731281843?l=www.mytechtoday.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.mytechtoday.com/feeds/3427782102731281843/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.mytechtoday.com/2009/07/reading-status-code-of-http-request.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4924966385028011361/posts/default/3427782102731281843'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4924966385028011361/posts/default/3427782102731281843'/><link rel='alternate' type='text/html' href='http://www.mytechtoday.com/2009/07/reading-status-code-of-http-request.html' title='Reading the status code of  HTTP Request !'/><author><name>Bishow Paudel</name><uri>http://www.blogger.com/profile/13404171528390907420</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/-Y168AeCY_eE/TguViHWNgkI/AAAAAAAAATk/y5g4EdsLf2Q/s220/bishow-paudel.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4924966385028011361.post-4211999683323253781</id><published>2009-06-12T08:43:00.000-07:00</published><updated>2009-06-12T08:45:43.576-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Technology'/><title type='text'>Problems with Hotmail login</title><content type='html'>Hotmail has been going under the planned maintenance on its servers, So you might face some problem accessing your hotmail.  Some of the problems that I am facing are like&lt;br /&gt;1. Asking to enter password for multiple times&lt;br /&gt;2. When i type in the address http:// hotmail.com in the address bar and enter than I get a message “The requested URL could not be retrieved”. Sometimes it loads the page but once I enter the password and username it throws the message “The requested URL could not be retrieved”, i.e. the connection timed out. &lt;br /&gt;3.  Some time I am able to log in but I get the same problem while sending or opening a message. &lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Solution: &lt;/span&gt;&lt;br /&gt;Following are some of the solutions recommended by Microsoft,. &lt;br /&gt;1. &lt;a href="http://windowslivehelp.com/solutions/servicemgt/archive/2008/12/26/what-to-do-if-you-can-t-sign-into-windows-live-hotmail.aspx"&gt;http://windowslivehelp.com/solutions/servicemgt/archive/2008/12/26/what-to-do-if-you-can-t-sign-into-windows-live-hotmail.aspx&lt;/a&gt;&lt;br /&gt;2. &lt;a href="http://windowslivehelp.com/solutions/servicemgt/archive/2008/08/22/how-to-determine-which-server-you-are-on.aspx"&gt;http://windowslivehelp.com/solutions/accounts/archive/2009/03/03/How-to-optimize-Internet-Explorer-browser.aspx&lt;/a&gt;&lt;br /&gt;3. &lt;a href="http://windowslivehelp.com/solutions/servicemgt/archive/2008/08/22/how-to-determine-which-server-you-are-on.aspx"&gt;http://windowslivehelp.com/solutions/servicemgt/archive/2008/08/22/how-to-determine-which-server-you-are-on.aspx&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4924966385028011361-4211999683323253781?l=www.mytechtoday.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.mytechtoday.com/feeds/4211999683323253781/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.mytechtoday.com/2009/06/problems-with-hotmail-login.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4924966385028011361/posts/default/4211999683323253781'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4924966385028011361/posts/default/4211999683323253781'/><link rel='alternate' type='text/html' href='http://www.mytechtoday.com/2009/06/problems-with-hotmail-login.html' title='Problems with Hotmail login'/><author><name>सपनासंसार</name><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-4924966385028011361.post-8053556480035469910</id><published>2009-05-28T14:45:00.000-07:00</published><updated>2009-05-28T14:46:32.800-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Technology'/><title type='text'>Microsoft to replace its live search engine with a new decision based engine “ Bing”</title><content type='html'>&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 220px; height: 80px;" src="http://1.bp.blogspot.com/_-ynDT2oG4zk/Sh8CHbQ2FYI/AAAAAAAABIw/0SJn74tR13U/s320/soon.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5340990009685448066" /&gt;&lt;br /&gt;In order to compete with the giant search engine, Google, Microsoft has unveiled its new search engine, Bing. On May 28, 2009, Microsoft CEO Steve Ballmer has announced the new incarnation of live search as Bing, formerly code-named "Kumo". Bing is fully available from June 3, 09. &lt;br /&gt;Microsoft has claimed that Bing is not only the search engine but a Decision Engine, designed to empower people to gain insight and knowledge from the Web, moving more quickly to important decisions.&lt;br /&gt;“Today, search engines do a decent job of helping people navigate the Web and find information, but they don’t do a very good job of enabling people to use the information they find,” said Steve Ballmer, Microsoft CEO. “When we set out to build Bing, we grounded ourselves in a deep understanding of how people really want to use the Web. Bing is an important first step forward in our long-term effort to deliver innovations in search that enable people to find information quickly and use the information they’ve found to accomplish tasks and make smart decisions.”&lt;br /&gt;&lt;span class="fullpost"&gt;&lt;br /&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 220px; height: 301px;" src="http://3.bp.blogspot.com/_-ynDT2oG4zk/Sh8CHg0_lkI/AAAAAAAABI4/GTA_pyZpAFM/s320/chart_search_wars2.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5340990011179243074" /&gt; Microsoft has aimed to gun down Google with Bing. Microsoft has already announced an $80 to $100 Million ad campaign for Bing.  Google has spent about $25 million on all its advertising last year with $11.6 million for recruiting. &lt;br /&gt;As show in the graph Microsoft search market share has been lowering down with just an 8.2% share of the market for core search compared to 64.2% for Google and 20.4% for Yahoo.  Microsoft has been struggling to for improving its search advertisement revenue. Last year only Microsoft has offered more than $47 billion dollar bid.  They might come up with another Microsoft-yahoo search deal by mid July. &lt;br /&gt;Good luck to the Microsoft for the new product!  &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt; &lt;!---Your Hidden post goes here --&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4924966385028011361-8053556480035469910?l=www.mytechtoday.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.mytechtoday.com/feeds/8053556480035469910/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.mytechtoday.com/2009/05/microsoft-to-replace-its-live-search.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4924966385028011361/posts/default/8053556480035469910'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4924966385028011361/posts/default/8053556480035469910'/><link rel='alternate' type='text/html' href='http://www.mytechtoday.com/2009/05/microsoft-to-replace-its-live-search.html' title='Microsoft to replace its live search engine with a new decision based engine “ Bing”'/><author><name>Bishow Paudel</name><uri>http://www.blogger.com/profile/13404171528390907420</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/-Y168AeCY_eE/TguViHWNgkI/AAAAAAAAATk/y5g4EdsLf2Q/s220/bishow-paudel.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_-ynDT2oG4zk/Sh8CHbQ2FYI/AAAAAAAABIw/0SJn74tR13U/s72-c/soon.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4924966385028011361.post-3186124672135635083</id><published>2009-01-30T21:20:00.000-08:00</published><updated>2009-01-30T21:41:21.489-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Groovy'/><title type='text'>Read Environment Variables with Groovy</title><content type='html'>Environment variables can be easily accessed with Groovy with getenv() method as shown below.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;def env = System.getenv()&lt;br /&gt;//Print all the environment variables.&lt;br /&gt;&lt;br /&gt; env.each{&lt;br /&gt;      println it&lt;br /&gt;  }  &lt;br /&gt;// You can also access the specific variable, say 'username', as show below &lt;br /&gt; String user= env['USERNAME']&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4924966385028011361-3186124672135635083?l=www.mytechtoday.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.mytechtoday.com/feeds/3186124672135635083/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.mytechtoday.com/2009/01/read-environment-variables-with-groovy.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4924966385028011361/posts/default/3186124672135635083'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4924966385028011361/posts/default/3186124672135635083'/><link rel='alternate' type='text/html' href='http://www.mytechtoday.com/2009/01/read-environment-variables-with-groovy.html' title='Read Environment Variables with Groovy'/><author><name>Bishow Paudel</name><uri>http://www.blogger.com/profile/13404171528390907420</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/-Y168AeCY_eE/TguViHWNgkI/AAAAAAAAATk/y5g4EdsLf2Q/s220/bishow-paudel.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4924966385028011361.post-4402598991766866792</id><published>2008-11-04T13:33:00.000-08:00</published><updated>2008-11-11T18:44:40.626-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Grail'/><title type='text'>Spring’s JDBC Template Set Up for a Grail Application</title><content type='html'>To take an advantage of the Spring JDBC Template for any Grail application, the first thing you need to do, is to define the DataSource bean in &lt;code&gt; resources.groovy &lt;/code&gt;, Don’t forget to have the jdbc driver(.jar) corresponding to your backend database server under the lib folder of your grail application.&lt;br /&gt;&lt;br /&gt;For example ,&lt;code&gt;resources.groovy&lt;/code&gt; is shown as below,&lt;br /&gt;&lt;code&gt;&lt;br /&gt;import org.springframework.jdbc.core.JdbcTemplate&lt;br /&gt;import org.apache.commons.dbcp.BasicDataSource&lt;br /&gt;&lt;span class="fullpost"&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;beans = {&lt;br /&gt;myDataSource(BasicDataSource) {&lt;br /&gt;driverClassName = "oracle.jdbc.OracleDriver"&lt;br /&gt;url ="jdbc:oracle:thin:@ . . . . . “&lt;br /&gt;username = "myUser"&lt;br /&gt;password = "myPass"&lt;br /&gt;}&lt;br /&gt;jdbcTemplate(JdbcTemplate)&lt;br /&gt;{&lt;br /&gt;dataSource=myDataSource&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;}&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;If you have used MS SQL server as your back end database, the driver class name and the url format is as follow.&lt;br /&gt;&lt;code&gt;&lt;br /&gt;myDataSource(BasicDataSource) {&lt;br /&gt;driverClassName = "com.microsoft.jdbc.sqlserver.SQLServerDriver"&lt;br /&gt;url = "jdbc:microsoft:sqlserver://myDataBaseServerURL"&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Similarly for MYSQL database server, the driver class name and the url format could be as follows :&lt;br /&gt;&lt;code&gt;&lt;br /&gt;dataSource {&lt;br /&gt;driverClassName = "com.mysql.jdbc.Driver"&lt;br /&gt;url = "jdbc:mysql:// myDataBaseServerURL "&lt;br /&gt;username = "myUser"&lt;br /&gt;password = "myPass"&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Once its set up you can simply make a query as follows&lt;br /&gt;&lt;code&gt;myResult = jdbcTemplate.queryForList (myQuery)&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;where myQuery is the query that needs to be execute on the remoteDatabase. &lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4924966385028011361-4402598991766866792?l=www.mytechtoday.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.mytechtoday.com/feeds/4402598991766866792/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.mytechtoday.com/2008/11/springs-jdbc-template-set-up-for-grail.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4924966385028011361/posts/default/4402598991766866792'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4924966385028011361/posts/default/4402598991766866792'/><link rel='alternate' type='text/html' href='http://www.mytechtoday.com/2008/11/springs-jdbc-template-set-up-for-grail.html' title='Spring’s JDBC Template Set Up for a Grail Application'/><author><name>Bishow Paudel</name><uri>http://www.blogger.com/profile/13404171528390907420</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/-Y168AeCY_eE/TguViHWNgkI/AAAAAAAAATk/y5g4EdsLf2Q/s220/bishow-paudel.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4924966385028011361.post-3105001696675717451</id><published>2008-07-16T16:08:00.000-07:00</published><updated>2008-11-04T13:41:17.380-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Groovy'/><title type='text'>Generate Random Alphanumeric Random String of N Characters with Groovy or Java</title><content type='html'>I was googling for a Alpha-numeric Random String generation. I come up with two solution.  One option is to generate Random Alphanumeric Strings with  RandomStringUtils available on &lt;a href= "http://commons.apache.org"&gt;  Apache Common&lt;/a&gt; . The following section of code is borrowed from &lt;a href="http://www.java2s.com/Code/JavaAPI/org.apache.commons.lang/RandomStringUtilsrandomNumericintcount.htm"&gt;java2s.com&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;import org.apache.commons.lang.RandomStringUtils;&lt;br /&gt;public class RandomStringUtilsTrial {&lt;br /&gt;    public static void main(String[] args) {&lt;br /&gt;&lt;br /&gt;      //Random 8 chars string where letters are enabled while numbers are not.&lt;br /&gt;      System.out.print("8 char string using letters but no numbers &gt;&gt;&gt;");&lt;br /&gt;      System.out.println(RandomStringUtils.random(8, true, false));&lt;br /&gt;&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Other Option can be using the Java Uitil class Random as shown below. You don’t have to worry about Apache Common API. The following code section (written for Groovy) generates 100 &lt;i&gt;'32 characters'&lt;/i&gt; long Alphanumeric Random string.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;br /&gt;private static String validChars ="ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_"&lt;br /&gt;    private int IDlength=32&lt;br /&gt;      int maxIndex = validChars.length()&lt;br /&gt;      for(i in 0..99)&lt;br /&gt;      {   String resultID = ""&lt;br /&gt;        java.util.Random rnd = new java.util.Random(System.currentTimeMillis()*(new java.util.Random().nextInt()))&lt;br /&gt;        for ( i in 0..IDlength ) {&lt;br /&gt;            int rndPos = Math.abs(rnd.nextInt() % maxIndex);&lt;br /&gt;            resultID += validChars.charAt(rndPos)&lt;br /&gt;            number=resultID&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;   println  resultID&lt;br /&gt;      }&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Good luck !&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4924966385028011361-3105001696675717451?l=www.mytechtoday.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.mytechtoday.com/feeds/3105001696675717451/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.mytechtoday.com/2008/07/generate-random-alphanumeric-random.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4924966385028011361/posts/default/3105001696675717451'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4924966385028011361/posts/default/3105001696675717451'/><link rel='alternate' type='text/html' href='http://www.mytechtoday.com/2008/07/generate-random-alphanumeric-random.html' title='Generate Random Alphanumeric Random String of N Characters with Groovy or Java'/><author><name>Bishow Paudel</name><uri>http://www.blogger.com/profile/13404171528390907420</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/-Y168AeCY_eE/TguViHWNgkI/AAAAAAAAATk/y5g4EdsLf2Q/s220/bishow-paudel.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4924966385028011361.post-4412111125429654709</id><published>2008-07-10T14:42:00.000-07:00</published><updated>2008-11-04T13:44:30.869-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Tools'/><title type='text'>cURL , A command line tool with URL Support !</title><content type='html'>One of my co-worker introduced a tool named cURL to me today. It a quite handy command line tool for transferring files with URL Syntax supporting most of the interner protocols like FTP, FTPS, HTTP, HTTPS, SCP, SFTP, TFTP, TELNET, DICT, LDAP, LDAPS and FILE. curl supports SSL certificates, HTTP POST, HTTP PUT, proxy tunneling , HTTP form based upload, proxies, cookies, user+password authentication (Basic, Digest, NTLM, Negotiate, Kerberos and many more)&lt;br /&gt;&lt;br /&gt;You can download cURL from &lt;span style="font-family: courier new;"&gt; http://curl.haxx.se/&lt;/span&gt; . It’s a free and open software tools.&lt;br /&gt;&lt;br /&gt;For example &lt;span style="font-family: courier new;"&gt;curl http://nepalnews.com&lt;/span&gt;   : return a html version of your web page in your console window. Its detail tutorial and example can be found at &lt;span style="font-family: courier new;"&gt;http://curl.haxx.se/docs/httpscripting.html&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;I have use curl on the following&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;curl -X POST -H 'Content-type: text/xml' -d @ http://myserver.com/process.gsp &lt; firstfocus.xml&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;Here I am sending an xml file, &lt;span style="font-family: courier new;"&gt;firstfocus.xml&lt;/span&gt;,  to the server &lt;span style="font-family: courier new;"&gt;myserver.com&lt;/span&gt; . &lt;span style="font-family: courier new;"&gt;process.gsp&lt;/span&gt; do calls the controller which helps in the  business logic at the back end and return the result on my console window. It’s a pretty good tool for testing and development environment.&lt;br /&gt;Thanks to Joshua for letting me know about this tool and its usage.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4924966385028011361-4412111125429654709?l=www.mytechtoday.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.mytechtoday.com/feeds/4412111125429654709/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.mytechtoday.com/2008/07/curl-command-line-tool-with-url-support.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4924966385028011361/posts/default/4412111125429654709'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4924966385028011361/posts/default/4412111125429654709'/><link rel='alternate' type='text/html' href='http://www.mytechtoday.com/2008/07/curl-command-line-tool-with-url-support.html' title='cURL , A command line tool with URL Support !'/><author><name>Bishow Paudel</name><uri>http://www.blogger.com/profile/13404171528390907420</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/-Y168AeCY_eE/TguViHWNgkI/AAAAAAAAATk/y5g4EdsLf2Q/s220/bishow-paudel.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4924966385028011361.post-1106359295325851143</id><published>2008-06-07T09:13:00.000-07:00</published><updated>2008-06-07T09:25:56.041-07:00</updated><title type='text'>Free Java Technology Cources!</title><content type='html'>Dear Readers,&lt;br /&gt;If you are interested with free online courses on java technologies, &lt;a href="http://www.javapassion.com/"&gt;http://www.javapassion.com/&lt;/a&gt; could be a good platform for you. Shan Shin teaches the courses. Sang Shin is presently working for Sun Microsystems as a Technology architect, consultant, and evangelist. After a successful completion of any courses you are awarded with the Certificate from java passion. I suggest you all to register for at least one source at a time. Detail about the schedule and courses can be seen at the course home page. Currently he is offering the following courses and all are totally free.&lt;br /&gt;&lt;ul&gt;&lt;br /&gt;&lt;li&gt;Java Programming (with Passion!) &lt;br /&gt;&lt;li&gt;Performance, Debugging, Testing, Monitoring, and Management (with Passion!) &lt;br /&gt;&lt;li&gt;Java EE Programming (with Passion!) &lt;br /&gt;&lt;li&gt;Ajax Programming (with Passion!) &lt;br /&gt;&lt;li&gt;Web Services Programming (with Passion!) &lt;br /&gt;&lt;li&gt;Sun Java System Identity Manager (with Passion!) &lt;br /&gt;&lt;li&gt;Java FX Programming (with Passion!) &lt;br /&gt;&lt;li&gt;JRuby on Rails (with Passion!) &lt;br /&gt;&lt;li&gt;Groovy and GRails (with Passion!) &lt;br /&gt;&lt;li&gt;Java ME Mobility Programming (with Passion!)&lt;br /&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4924966385028011361-1106359295325851143?l=www.mytechtoday.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.mytechtoday.com/feeds/1106359295325851143/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.mytechtoday.com/2008/06/free-java-technology-cources.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4924966385028011361/posts/default/1106359295325851143'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4924966385028011361/posts/default/1106359295325851143'/><link rel='alternate' type='text/html' href='http://www.mytechtoday.com/2008/06/free-java-technology-cources.html' title='Free Java Technology Cources!'/><author><name>Bishow Paudel</name><uri>http://www.blogger.com/profile/13404171528390907420</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/-Y168AeCY_eE/TguViHWNgkI/AAAAAAAAATk/y5g4EdsLf2Q/s220/bishow-paudel.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4924966385028011361.post-949139359747125485</id><published>2008-05-09T14:34:00.000-07:00</published><updated>2008-11-04T13:44:16.638-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='JSF'/><title type='text'>How to read a Java Session Back bean of a JSF page from JSP pages</title><content type='html'>In this section I am describing about accessing a JSF back bean from a JSP page.&lt;br /&gt;Lets us take an example of a java back bean ServerInfo for a JSF page&lt;br /&gt;&lt;code&gt;&lt;br /&gt;// File Name : ServerInfo.java&lt;br /&gt;package thomson.com;&lt;br /&gt;public class ServerInfo {&lt;br /&gt;String server;&lt;br /&gt;String environment;&lt;br /&gt;&lt;br /&gt;public String getServer() {&lt;br /&gt;return server;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public void setServer(String server) {&lt;br /&gt;this.server = server;&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Bean is defined on faces-config.xml as following&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&amp;lt;navigation-rule&amp;gt;&lt;br /&gt;    &amp;lt;from-view-id&amp;gt;/index.jsp&amp;lt;/from-view-id&amp;gt;&lt;br /&gt;    &amp;lt;navigation-case&amp;gt;&lt;br /&gt;        &amp;lt;to-view-id&amp;gt;/process.jsp&amp;lt;/to-view-id&amp;gt;&lt;br /&gt;    &amp;lt;/navigation-case&amp;gt;&lt;br /&gt;&amp;lt;/navigation-rule&amp;gt;&lt;br /&gt;&amp;lt;managed-bean&amp;gt;&lt;br /&gt;    &amp;lt;managed-bean-name&amp;gt;ServerInfoBean&amp;lt;/managed-bean-name&amp;gt;&lt;br /&gt;    &amp;lt;managed-bean-class&amp;gt;thomson.com.ServerInfo&amp;lt;/managed-bean-class&amp;gt;&lt;br /&gt;    &amp;lt;managed-bean-scope&amp;gt;session&amp;lt;/managed-bean-scope&amp;gt;&lt;br /&gt;&amp;lt;/managed-bean&amp;gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Now lets take an example of JSF page section that sets up the java bean ServerInfoBean from the input text of the form as shown below&lt;br /&gt;&lt;code&gt;&lt;br /&gt;//File name: index.jsp&lt;br /&gt;&amp;lt;f:view&amp;gt;&lt;br /&gt;    &amp;lt;h:form id="serverForm"&amp;gt;&lt;br /&gt;        &amp;lt;h:outputLabel for="serverName"&amp;gt;&lt;br /&gt;            &amp;lt;h:outputText value="Enter the Server Name"/&amp;gt;&lt;br /&gt;        &amp;lt;/h:outputLabel&amp;gt;&lt;br /&gt;        &amp;lt;h:inputText id="serverName" value="#{ServerInfoBean.server}" required="true"/&amp;gt;&lt;br /&gt;        &amp;lt;h:message for="serverName"/&amp;gt;&lt;br /&gt;        &amp;lt;br&amp;gt;&lt;br /&gt;        &amp;lt;h:outputLabel for="environment"&amp;gt;&lt;br /&gt;            &amp;lt;h:outputText value="Select Environment"/&amp;gt;&lt;br /&gt;        &amp;lt;/h:outputLabel&amp;gt;&lt;br /&gt;    &amp;lt;/h:form&amp;gt;&lt;br /&gt;&amp;lt;/f:view&amp;gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Now  in process.jsp the back bean can be accessed as shown below&lt;br /&gt;&lt;code&gt;&lt;br /&gt;File name : process.jsp&lt;br /&gt;..&lt;br /&gt;&amp;lt;%&lt;br /&gt;ServerInfo mbean = (ServerInfo) request.getSession().getAttribute("ServerInfoBean");&lt;br /&gt;String server = mbean.getServer();&lt;br /&gt;Out.print(“server name read from the jsf back bean =” +server)&lt;br /&gt;&lt;br /&gt;%&amp;gt;&lt;br /&gt;&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4924966385028011361-949139359747125485?l=www.mytechtoday.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.mytechtoday.com/feeds/949139359747125485/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.mytechtoday.com/2008/05/how-to-read-java-session-back-bean-of.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4924966385028011361/posts/default/949139359747125485'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4924966385028011361/posts/default/949139359747125485'/><link rel='alternate' type='text/html' href='http://www.mytechtoday.com/2008/05/how-to-read-java-session-back-bean-of.html' title='How to read a Java Session Back bean of a JSF page from JSP pages'/><author><name>Bishow Paudel</name><uri>http://www.blogger.com/profile/13404171528390907420</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/-Y168AeCY_eE/TguViHWNgkI/AAAAAAAAATk/y5g4EdsLf2Q/s220/bishow-paudel.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4924966385028011361.post-809634496932575206</id><published>2008-05-07T08:43:00.000-07:00</published><updated>2008-11-04T13:46:30.659-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Groovy'/><title type='text'>Read custom created XML file from a Groovy/Java class in a J2EE Web Application</title><content type='html'>I have a following xml file that I created to store the application name and Application Owner email address&lt;br /&gt;&lt;code&gt;&lt;br /&gt;//File name: EmailInfo.xml&lt;br /&gt;&lt;br /&gt;&amp;lt; emailInfo&amp;gt;&lt;br /&gt;&amp;lt; application&amp;gt; &amp;lt; name&amp;gt; Saleways &amp;lt; /name&amp;gt; &amp;lt; email&amp;gt; david@david.com&amp;lt; /email&amp;gt; &amp;lt; /application&amp;gt;&lt;br /&gt;&amp;lt; application&amp;gt; &amp;lt; name&amp;gt; Mercantile House&amp;lt; /name&amp;gt; &amp;lt; email&amp;gt; binod@hotmail.com&amp;lt; /email&amp;gt; &amp;lt; /application&amp;gt;&lt;br /&gt;&amp;lt; application&amp;gt; &amp;lt; name&amp;gt; BishowShop&amp;lt; /name&amp;gt; &amp;lt; email&amp;gt; bishow@hotmail.com&amp;lt; /email&amp;gt; &amp;lt; /application&amp;gt;&lt;br /&gt;&amp;lt; /emailInfo&amp;gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Now I have a J2EE application that contains a Groovy or a Java class that access the above XML file. The method to access above html file using Groovy is presented below. Note that the xml file resides on the same location where the class exists.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;def appName=[]&lt;br /&gt;def appEmail=[]&lt;br /&gt;java.net.URL url= this.getClass().getClassLoader().getResource("EmailInfo.xml");&lt;br /&gt;java.net.URI uri = new URI(url.toString())&lt;br /&gt;File f=new File(uri)&lt;br /&gt;def emailInfo = new XmlSlurper().parse(f) //Specific to groovy&lt;br /&gt;emailInfo.application.name.each {appName += it} //specific to groovy&lt;br /&gt;emailInfo.application.email.each {appEmail += it} // specific to groovy&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;You simply can modify the above code for java classes. The final result for the above code is that appName contains the list of the Name and appEmail contains the list of the Email address. You can put it into hash map as below.&lt;br /&gt;&lt;code&gt;&lt;br /&gt;def emailMap=[:] //define an empty map&lt;br /&gt;for(i in 0 .. appName.size()-1)&lt;br /&gt;emailMap.put(appName[i].toString(),appEmail[i].toString())&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Now you simply can access the email address of a person as shown below&lt;br /&gt;&lt;code&gt;&lt;br /&gt;println emailMap[“Mercantile House”] //prints binod@hotmail.com&lt;br /&gt;&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4924966385028011361-809634496932575206?l=www.mytechtoday.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.mytechtoday.com/feeds/809634496932575206/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.mytechtoday.com/2008/05/read-custom-created-xml-file-from.html#comment-form' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4924966385028011361/posts/default/809634496932575206'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4924966385028011361/posts/default/809634496932575206'/><link rel='alternate' type='text/html' href='http://www.mytechtoday.com/2008/05/read-custom-created-xml-file-from.html' title='Read custom created XML file from a Groovy/Java class in a J2EE Web Application'/><author><name>Bishow Paudel</name><uri>http://www.blogger.com/profile/13404171528390907420</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/-Y168AeCY_eE/TguViHWNgkI/AAAAAAAAATk/y5g4EdsLf2Q/s220/bishow-paudel.jpg'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4924966385028011361.post-3482009447696776417</id><published>2008-05-07T08:31:00.000-07:00</published><updated>2008-05-07T08:37:24.348-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Welcome'/><title type='text'>Welcome to my Technical Blog!</title><content type='html'>I create this blog so that i can share all the technical stuffs that i came across as a software engineer in J2EE Technologies. I will be glad to receive your feedback for every post and share your idea on the postings.&lt;br /&gt;Welcome you all.&lt;br /&gt;~Bishow&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4924966385028011361-3482009447696776417?l=www.mytechtoday.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.mytechtoday.com/feeds/3482009447696776417/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.mytechtoday.com/2008/05/welcome-to-my-technical-blog.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4924966385028011361/posts/default/3482009447696776417'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4924966385028011361/posts/default/3482009447696776417'/><link rel='alternate' type='text/html' href='http://www.mytechtoday.com/2008/05/welcome-to-my-technical-blog.html' title='Welcome to my Technical Blog!'/><author><name>Bishow Paudel</name><uri>http://www.blogger.com/profile/13404171528390907420</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/-Y168AeCY_eE/TguViHWNgkI/AAAAAAAAATk/y5g4EdsLf2Q/s220/bishow-paudel.jpg'/></author><thr:total>0</thr:total></entry></feed>
