<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Programming and Algorithm Tutorial</title>
	<atom:link href="http://learn2program.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://learn2program.wordpress.com</link>
	<description>Tech blog</description>
	<lastBuildDate>Thu, 19 Jan 2012 09:08:41 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='learn2program.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Programming and Algorithm Tutorial</title>
		<link>http://learn2program.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://learn2program.wordpress.com/osd.xml" title="Programming and Algorithm Tutorial" />
	<atom:link rel='hub' href='http://learn2program.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Iterating list and array by passing as a parameterClass in iBATIS sql map</title>
		<link>http://learn2program.wordpress.com/2011/12/14/iterating-list-and-array-by-passing-as-a-parameterclass-in-ibatis-sql-map/</link>
		<comments>http://learn2program.wordpress.com/2011/12/14/iterating-list-and-array-by-passing-as-a-parameterclass-in-ibatis-sql-map/#comments</comments>
		<pubDate>Wed, 14 Dec 2011 06:40:06 +0000</pubDate>
		<dc:creator>Md. Shahjalal</dc:creator>
				<category><![CDATA[iBATIS]]></category>
		<category><![CDATA[Oracle]]></category>
		<category><![CDATA[array]]></category>
		<category><![CDATA[list]]></category>
		<category><![CDATA[map]]></category>
		<category><![CDATA[oracle]]></category>

		<guid isPermaLink="false">http://learn2program.wordpress.com/?p=224</guid>
		<description><![CDATA[A list/map can be passed as a parameterClass to an iBATIS sql map to iterate. A IN clause is the basic example of iteration over a list and create comma separated query. For example, if a list have 3 elements (10,20,30). It is passed as parameterClass in the query for a IN clause, the syntax [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=learn2program.wordpress.com&amp;blog=1062372&amp;post=224&amp;subd=learn2program&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>A list/map can be passed as a <strong>parameterClass</strong> to an iBATIS sql map to iterate. A IN clause is the basic example of iteration over a list and create comma separated query. For example, if a list have 3 elements (10,20,30). It is passed as parameterClass in the query for a IN clause, the syntax is like following:</p>
<p style="text-align:left;"><code>&lt;select id="getAllScore" resultClass="score" parameterClass="java.util.List"&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;SELECT * FROM score WHERE id IN<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;iterate open="(" close=")" conjunction=","&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#value[]#<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/iterate&gt;<br />
&lt;/select&gt;<br />
</code></p>
<p>You can define a list in the parameterClass. But what about a array? You cannot define array like int[] in the parameter class. Most surprising thing is, for an array you do not have to define a parameterClass in iBATIS. If nothing is defined as parameterClass then it is considered as Array.</p>
<p>If you want to iterate over an array with then the following code works fine. Every array elements will be printed in the code #[]#.</p>
<p><code><code>&lt;select id="getAllScore" resultClass="score"&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;SELECT * FROM score WHERE id IN<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;iterate open="(" close=")" conjunction=","&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#[]#<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/iterate&gt;<br />
&lt;/select&gt;</code></code></p>
<p>&nbsp;</p>
<p><strong>By: <a href="http://www.jalalian.net">Md. Shahjalal</a></strong></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/learn2program.wordpress.com/224/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/learn2program.wordpress.com/224/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/learn2program.wordpress.com/224/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/learn2program.wordpress.com/224/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/learn2program.wordpress.com/224/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/learn2program.wordpress.com/224/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/learn2program.wordpress.com/224/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/learn2program.wordpress.com/224/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/learn2program.wordpress.com/224/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/learn2program.wordpress.com/224/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/learn2program.wordpress.com/224/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/learn2program.wordpress.com/224/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/learn2program.wordpress.com/224/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/learn2program.wordpress.com/224/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=learn2program.wordpress.com&amp;blog=1062372&amp;post=224&amp;subd=learn2program&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://learn2program.wordpress.com/2011/12/14/iterating-list-and-array-by-passing-as-a-parameterclass-in-ibatis-sql-map/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<georss:point>23.783439 90.393938</georss:point>
		<geo:lat>23.783439</geo:lat>
		<geo:long>90.393938</geo:long>
		<media:content url="http://0.gravatar.com/avatar/20d0298aad54832d0f4183e13e131fef?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Jalal</media:title>
		</media:content>
	</item>
		<item>
		<title>Beginning Android 4 with Intellij IDEA: Unable to find a userdata.img file to copy into the AVD folder</title>
		<link>http://learn2program.wordpress.com/2011/11/17/beginning-android-4-with-intellij-idea-unable-to-find-a-userdata-img-file-to-copy-into-the-avd-folder/</link>
		<comments>http://learn2program.wordpress.com/2011/11/17/beginning-android-4-with-intellij-idea-unable-to-find-a-userdata-img-file-to-copy-into-the-avd-folder/#comments</comments>
		<pubDate>Thu, 17 Nov 2011 05:53:58 +0000</pubDate>
		<dc:creator>Md. Shahjalal</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[avd]]></category>
		<category><![CDATA[find]]></category>
		<category><![CDATA[idea]]></category>
		<category><![CDATA[unable]]></category>
		<category><![CDATA[userdata.img]]></category>

		<guid isPermaLink="false">http://learn2program.wordpress.com/?p=219</guid>
		<description><![CDATA[Android 4 (API level-14) has changed it&#8217;s userdata.img file location. On other versions (upto andoid 3.2, api level 13), it was kept in location -/android-sdk-linux/platforms/android-(api level)/images/userdata.img. Intellij IDEA (up to 10.5.2) is not up to date with this current change. Therefore shows &#8220;Unable to find a &#8216;userdata.img&#8217; file to copy into the AVD folder&#8221; when [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=learn2program.wordpress.com&amp;blog=1062372&amp;post=219&amp;subd=learn2program&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Android 4 (API level-14) has changed it&#8217;s userdata.img file location. On other versions (upto andoid 3.2, api level 13), it was kept in location -/android-sdk-linux/platforms/android-(api level)/images/userdata.img. Intellij IDEA (up to 10.5.2) is not up to date with this current change. Therefore shows &#8220;<strong>Unable to find a &#8216;userdata.img&#8217; file to copy into the AVD folder</strong>&#8221; when you will try to create a new &#8220;Android Virtual Device&#8221;.</p>
<p>Even the <a href="http://youtrack.jetbrains.net/issue/IDEA-75994" title="Issue">idea site</a> is misleading to the solution of this problem. They ask to follow a solution from stack <a href="http://stackoverflow.com/questions/7817044/how-to-create-a-avd-for-android-4-0">overflow site</a>. But that is not a solution too.</p>
<p><strong>Solution:</strong>From idea&#8217;s Run/Debug configuration click on browse besides &#8220;Prefer Android Virtual Device for deployment&#8221;. Then from &#8220;<strong>Select Android Virtual Device</strong>&#8221; screen click on <strong>Android SDK Manage</strong> Then from Android SDK Manager, click on <strong>Tools</strong> and choose <strong>Manage AVDs</strong>. Then from <strong>Android Virtual Device Manage</strong> Click <strong>New</strong> and create the AVD for version 4.</p>
<p>Now run the project for version 4. Hello World. <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>By: <a href="http://www.jalalian.net">Md. Shahjalal</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/learn2program.wordpress.com/219/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/learn2program.wordpress.com/219/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/learn2program.wordpress.com/219/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/learn2program.wordpress.com/219/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/learn2program.wordpress.com/219/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/learn2program.wordpress.com/219/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/learn2program.wordpress.com/219/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/learn2program.wordpress.com/219/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/learn2program.wordpress.com/219/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/learn2program.wordpress.com/219/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/learn2program.wordpress.com/219/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/learn2program.wordpress.com/219/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/learn2program.wordpress.com/219/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/learn2program.wordpress.com/219/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=learn2program.wordpress.com&amp;blog=1062372&amp;post=219&amp;subd=learn2program&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://learn2program.wordpress.com/2011/11/17/beginning-android-4-with-intellij-idea-unable-to-find-a-userdata-img-file-to-copy-into-the-avd-folder/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<georss:point>23.783439 90.393938</georss:point>
		<geo:lat>23.783439</geo:lat>
		<geo:long>90.393938</geo:long>
		<media:content url="http://0.gravatar.com/avatar/20d0298aad54832d0f4183e13e131fef?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Jalal</media:title>
		</media:content>
	</item>
		<item>
		<title>Interesting behavior of JSP If tag for comparing Enum value</title>
		<link>http://learn2program.wordpress.com/2011/07/17/interesting-behavior-of-jsp-if-tag-for-comparing-enum-value/</link>
		<comments>http://learn2program.wordpress.com/2011/07/17/interesting-behavior-of-jsp-if-tag-for-comparing-enum-value/#comments</comments>
		<pubDate>Sun, 17 Jul 2011 04:35:25 +0000</pubDate>
		<dc:creator>Md. Shahjalal</dc:creator>
				<category><![CDATA[Html]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[JSP]]></category>
		<category><![CDATA[enum]]></category>
		<category><![CDATA[jsp]]></category>
		<category><![CDATA[tage]]></category>

		<guid isPermaLink="false">http://learn2program.wordpress.com/?p=213</guid>
		<description><![CDATA[If anyone like to compare a Enum value with JSP if tag there is a little surprise for him. JSP if tag do not support to compare a enum value directly in the test condition. For example a java Enum Employee. public enum Employee { &#160;&#160;&#160;&#160;PART_TIME, &#160;&#160;&#160;&#160;FULL_TIME; } Now if you want to compare the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=learn2program.wordpress.com&amp;blog=1062372&amp;post=213&amp;subd=learn2program&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>If anyone like to compare a Enum value with JSP if tag there is a little surprise for him. JSP if tag do not support to compare a enum value directly in the test condition. For example a java Enum Employee.</p>
<p><code><br />
public enum Employee {<br />
&nbsp;&nbsp;&nbsp;&nbsp;PART_TIME,<br />
&nbsp;&nbsp;&nbsp;&nbsp;FULL_TIME;<br />
}<br />
</code></p>
<p>Now if you want to compare the Enum value in jsp if tag directly like following,<br />
<code><br />
&lt;c:if test=&quot;${bean.employee == '&lt;%=Employee.PART_TIME%&gt;'}"&gt;<br />
.........<br />
&lt;/c:if&gt;<br />
</code></p>
<p>JSP generates error. But if you assign the value to a variable and compare then this is allowed as following</p>
<p><code><br />
&lt;c:set var=&quot;partTime&quot; value="&lt;%=Employee.PART_TIME%&gt;"/&gt;<br />
&lt;c:if test=&quot;${bean.employee == partTime'}"&gt;<br />
.........<br />
&lt;/c:if&gt;<br />
</code></p>
<p>By <a href="http://learn2program.wordpress.com/md-shahjalal-references">Md. Shahjalal</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/learn2program.wordpress.com/213/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/learn2program.wordpress.com/213/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/learn2program.wordpress.com/213/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/learn2program.wordpress.com/213/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/learn2program.wordpress.com/213/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/learn2program.wordpress.com/213/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/learn2program.wordpress.com/213/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/learn2program.wordpress.com/213/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/learn2program.wordpress.com/213/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/learn2program.wordpress.com/213/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/learn2program.wordpress.com/213/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/learn2program.wordpress.com/213/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/learn2program.wordpress.com/213/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/learn2program.wordpress.com/213/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=learn2program.wordpress.com&amp;blog=1062372&amp;post=213&amp;subd=learn2program&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://learn2program.wordpress.com/2011/07/17/interesting-behavior-of-jsp-if-tag-for-comparing-enum-value/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<georss:point>23.783439 90.393938</georss:point>
		<geo:lat>23.783439</geo:lat>
		<geo:long>90.393938</geo:long>
		<media:content url="http://0.gravatar.com/avatar/20d0298aad54832d0f4183e13e131fef?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Jalal</media:title>
		</media:content>
	</item>
		<item>
		<title>Groovy and Grails Security: Denial of Service (DoS) Case 2</title>
		<link>http://learn2program.wordpress.com/2010/08/09/groovy-and-grails-security-denial-of-service-dos-case-2/</link>
		<comments>http://learn2program.wordpress.com/2010/08/09/groovy-and-grails-security-denial-of-service-dos-case-2/#comments</comments>
		<pubDate>Mon, 09 Aug 2010 05:05:51 +0000</pubDate>
		<dc:creator>Md. Shahjalal</dc:creator>
				<category><![CDATA[Grails]]></category>
		<category><![CDATA[Groovy]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[grails]]></category>
		<category><![CDATA[groovy]]></category>
		<category><![CDATA[query]]></category>
		<category><![CDATA[result]]></category>
		<category><![CDATA[security]]></category>

		<guid isPermaLink="false">http://learn2program.wordpress.com/?p=209</guid>
		<description><![CDATA[Denial of Service Case 2: Scenario: For showing list of Clients with pagination (max 10 per page). def list = { if(!params.max) params.max = 10 [clientList: Client.list(params)] } Possible Attack: Changing the max value to 100000000 in the request Result: Query result loads 100000000 client data and again occurs an out of memory error Possible [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=learn2program.wordpress.com&amp;blog=1062372&amp;post=209&amp;subd=learn2program&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Denial of Service Case 2:</p>
<p><strong>Scenario:</strong> For showing list of Clients with pagination (max 10 per page).<br />
<code>def list = {<br />
if(!params.max) params.max = 10<br />
[clientList: Client.list(params)]<br />
}<br />
</code></p>
<p><strong>Possible Attack:</strong> Changing the max value to 100000000 in the request</p>
<p><strong>Result:</strong> Query result loads 100000000 client data and again occurs an out of memory error</p>
<p><strong>Possible Solutions in Groovy and Grails</strong>:<br />
<code>def list = {<br />
params.max = Math.min( params.max?.toInteger() ?: 0, 100)<br />
[clientList: Client.list(params)]<br />
}<br />
</code><br />
at worst case it will load just 100 records.</p>
<p>Reference: The Definite Guide to Grails, 2nd Edition</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/learn2program.wordpress.com/209/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/learn2program.wordpress.com/209/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/learn2program.wordpress.com/209/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/learn2program.wordpress.com/209/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/learn2program.wordpress.com/209/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/learn2program.wordpress.com/209/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/learn2program.wordpress.com/209/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/learn2program.wordpress.com/209/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/learn2program.wordpress.com/209/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/learn2program.wordpress.com/209/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/learn2program.wordpress.com/209/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/learn2program.wordpress.com/209/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/learn2program.wordpress.com/209/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/learn2program.wordpress.com/209/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=learn2program.wordpress.com&amp;blog=1062372&amp;post=209&amp;subd=learn2program&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://learn2program.wordpress.com/2010/08/09/groovy-and-grails-security-denial-of-service-dos-case-2/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<georss:point>23.783439 90.393938</georss:point>
		<geo:lat>23.783439</geo:lat>
		<geo:long>90.393938</geo:long>
		<media:content url="http://0.gravatar.com/avatar/20d0298aad54832d0f4183e13e131fef?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Jalal</media:title>
		</media:content>
	</item>
		<item>
		<title>Groovy and Grails Security: Denial of Service (DoS) Case 1</title>
		<link>http://learn2program.wordpress.com/2010/08/09/groovy-and-grails-security-denial-of-service-dos-case-1/</link>
		<comments>http://learn2program.wordpress.com/2010/08/09/groovy-and-grails-security-denial-of-service-dos-case-1/#comments</comments>
		<pubDate>Mon, 09 Aug 2010 04:54:05 +0000</pubDate>
		<dc:creator>Md. Shahjalal</dc:creator>
				<category><![CDATA[Grails]]></category>
		<category><![CDATA[Groovy]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[grails]]></category>
		<category><![CDATA[groovy]]></category>
		<category><![CDATA[query]]></category>
		<category><![CDATA[security]]></category>

		<guid isPermaLink="false">http://learn2program.wordpress.com/?p=206</guid>
		<description><![CDATA[Denial of Service: Scenario: We have a client object with not null last name. A search query like following: search = { Client.findAll("from Client where lastName='"+ params.lastName +"'") } Possible Attack: if param.lastName = &#8216; or id &#62; 0 send with request the query becomes: search = { Client.findAll("from Client where lastName='' or id &#62; [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=learn2program.wordpress.com&amp;blog=1062372&amp;post=206&amp;subd=learn2program&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Denial of Service:</p>
<p><strong>Scenario:</strong> We have a client object with not null last name. A search query like following:<br />
<code>search = {<br />
Client.findAll("from Client where lastName='"+ params.lastName +"'")<br />
}</code></p>
<p><strong> Possible Attack:<br />
</strong>if param.lastName = &#8216; or id &gt; 0 send with request the query becomes:<br />
<code>search = {<br />
Client.findAll("from Client where lastName='' or id &gt; 0")<br />
}</code></p>
<p><strong>Result:</strong><br />
All the client from the database will be fetched and resulted out of memory error</p>
<p><strong>Possible Solutions in Groovy and Grails:</strong></p>
<p><code>search = {<br />
Client.findAll("from Client where lastName= :lastName",  [lastName: params.lastName)<br />
}<br />
or<br />
search = {<br />
Client.findAll("from Client where lastName= ?",  [lastName: params.lastName)<br />
}<br />
or<br />
Client.withCriteria {<br />
eq('lastName', params.lastName)<br />
}<br />
or</code><code><br />
Client.findAllByLastName(params.lastName)</code></p>
<pre><code>
</code></pre>
<h5><code>Reference: Definite Guide to Grails, 2nd Edition</code></h5>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/learn2program.wordpress.com/206/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/learn2program.wordpress.com/206/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/learn2program.wordpress.com/206/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/learn2program.wordpress.com/206/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/learn2program.wordpress.com/206/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/learn2program.wordpress.com/206/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/learn2program.wordpress.com/206/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/learn2program.wordpress.com/206/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/learn2program.wordpress.com/206/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/learn2program.wordpress.com/206/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/learn2program.wordpress.com/206/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/learn2program.wordpress.com/206/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/learn2program.wordpress.com/206/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/learn2program.wordpress.com/206/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=learn2program.wordpress.com&amp;blog=1062372&amp;post=206&amp;subd=learn2program&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://learn2program.wordpress.com/2010/08/09/groovy-and-grails-security-denial-of-service-dos-case-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<georss:point>23.783439 90.393938</georss:point>
		<geo:lat>23.783439</geo:lat>
		<geo:long>90.393938</geo:long>
		<media:content url="http://0.gravatar.com/avatar/20d0298aad54832d0f4183e13e131fef?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Jalal</media:title>
		</media:content>
	</item>
	</channel>
</rss>
